57 const int aDefaultTag=1);
77 Segments(
const string aFilePattern,
const string aDirectory,
const string aTreeName);
87 Segments(
const vector<double> aGpsStarts,
const vector<double> aGpsEnds);
96 Segments(
const double aGpsStart,
const double aGpsEnd,
const int aTag=1);
122 int GetSegmentStartBefore(
const double aGps);
127 inline unsigned int GetN(
void){
return seg_start.size(); };
133 unsigned int GetNWithTag(
const int aTag);
138 inline vector<double>
GetStarts(
void){
return seg_start; };
143 inline vector<double>
GetEnds(
void){
return seg_end; };
148 inline vector<int>
GetTags(
void){
return seg_tag; };
155 inline double GetStart(
const unsigned int aSegmentIndex=0){
return seg_start[aSegmentIndex]; };
162 inline double GetEnd(
const unsigned int aSegmentIndex=0){
return seg_end[aSegmentIndex]; };
174 inline double GetLast(){
return GetEnd(GetN()-1); };
181 inline double GetDuration(
const unsigned int aSegmentIndex=0){
return seg_end[aSegmentIndex]-seg_start[aSegmentIndex]; };
188 inline int GetTag(
const unsigned int aSegmentIndex=0){
return seg_tag[aSegmentIndex]; };
201 double GetLiveTime(
const double aGpsStart,
const double aGpsEnd);
209 inline double GetLiveTime(
const unsigned int aSegmentIndex){
return GetDuration(aSegmentIndex); };
215 double GetLiveTimeWithTag(
const int aTag);
229 TH1I* GetHistogram(
const double aGpsStart,
const double aGpsEnd,
const double aOffset=0.0);
241 return GetHistogram(seg_start[0],seg_end[seg_start.size()-1],aOffset);
253 TTree* GetTree(
const double aGpsStart,
const double aGpsEnd);
262 if(GetN())
return GetTree(seg_start[0], seg_end[seg_start.size()-1]);
263 return GetTree(0.0, 0.0);
272 bool IsInsideSegment(
unsigned int &aSegmentIndex,
const double aGps);
279 bool IsInsideSegment(
const double aGps);
287 inline void SetTag(
const unsigned int aSegmentIndex,
const int aTag){
288 seg_tag[aSegmentIndex] = aTag;
295 void SetTags(
const int aTag);
306 bool Append(
const double aGpsStart,
const double aGpsEnd,
const int aTag=1);
317 bool Append(vector <double> aGpsStarts, vector <double> aGpsEnds, vector <double> aTags);
335 bool Append(TTree *aSegmentTree);
345 bool AddSegment(
const double aGpsStart,
const double aGpsEnd,
const int aTag=1);
363 bool ApplyPadding(
const double aPadStart,
const double aPadEnd);
370 bool TruncateAfter(
const double aGps);
377 bool TruncateBefore(
const double aGps);
385 bool MakeSecond(
void);
417 bool Intersect(
const double aGpsStart,
const double aGpsEnd,
const int aTag=1);
432 void Dump(
unsigned int aNcols=2,
const string aTxtFileName=
"");
453 if(aTag1<0||aTag2<0)
return TMath::Min(aTag1,aTag2);
454 return TMath::Max(aTag1,aTag2);
469 bool CheckConsistency(
const unsigned int aStartIndex);
477 void MergeOverlaps(
const unsigned int aStartIndex);
490 int GetMark(
const unsigned int aGps);
496 void ComputeLiveTime(
void);
Parser for text files with columns.
Manage time segment lists.
Definition: Segments.h:28
unsigned int GetN(void)
Returns the number of time segments in the list.
Definition: Segments.h:127
vector< double > seg_start
List of segment starts.
Definition: Segments.h:437
vector< int > seg_tag
List of segment tags.
Definition: Segments.h:439
double GetEnd(const unsigned int aSegmentIndex=0)
Returns the ending time of a given segment.
Definition: Segments.h:162
void SetTag(const unsigned int aSegmentIndex, const int aTag)
Tags a given segment.
Definition: Segments.h:287
vector< double > GetStarts(void)
Returns the list of segment starts.
Definition: Segments.h:138
double GetLast()
Returns the ending time of the last segment.
Definition: Segments.h:174
vector< double > seg_end
List of segment ends.
Definition: Segments.h:438
TTree * GetTree(void)
Returns a formatted TTree representing the segments.
Definition: Segments.h:261
bool status
Status of the Segments object.
Definition: Segments.h:436
double GetFirst()
Returns the starting time of the first segment.
Definition: Segments.h:168
double GetStart(const unsigned int aSegmentIndex=0)
Returns the starting time of a given segment.
Definition: Segments.h:155
vector< unsigned int > n_mark
Segment index marks.
Definition: Segments.h:442
double GetDuration(const unsigned int aSegmentIndex=0)
Returns the duration of a given segment.
Definition: Segments.h:181
double GetLiveTime(const unsigned int aSegmentIndex)
Returns the livetime of one segment.
Definition: Segments.h:209
TH1I * GetHisto(const double aOffset=0.0)
Returns an histogram representing the segments.
Definition: Segments.h:240
Segments(void)
Default constructor of the Segments class.
int GetTag(const unsigned int aSegmentIndex=0)
Returns the tag of a given segment.
Definition: Segments.h:188
bool GetStatus(void) const
Returns the status of the Segments object.
Definition: Segments.h:115
double GetLiveTime(void)
Returns the total livetime.
Definition: Segments.h:194
vector< int > GetTags(void)
Returns the list of segment tags.
Definition: Segments.h:148
double seg_livetime
Integrated livetime.
Definition: Segments.h:440
vector< unsigned int > time_mark
Time marks.
Definition: Segments.h:441
int GetTagProduct(const int aTag1, const int aTag2)
Computes the product of 2 tags.
Definition: Segments.h:452
vector< double > GetEnds(void)
Returns the list of segment ends.
Definition: Segments.h:143