Segments
Every GW analysis pipeline has to deal with segment lists at some point. The Segments class was built to handle segment lists in an easy way. A segment is a gps interval and the convention for segments is described in the GWOLLUM convention. The Segments class functions offer many operations on the segments. A segment list looks like this: 931157000 931157018 931157028 931157102 931157103 931157245 931157335 931158000 In this page we will play with this segment list interactively in ROOT to explore the possibilities of the Segments class. For an extensive function description of the Segments class, refer to the Segments full documentation. In the following, we will use a text file called 'seg.txt' containing the 4 segments above. Index: |
||
In the following example, we load the Segments library and construct the Segments object with the class constructor. The Dump() function is used to print the current segment list. When '4' columns are requested, the printing is more complete: the segment number and duration is added. root [0] gSystem->Load("libSegments.so") root [1] Segments *S = new Segments("./seg.txt"); root [2] S->Dump() 931157000 931157018 931157028 931157102 931157103 931157245 931157335 931158000 root [3] S->Dump(4) 0 931157000 931157018 18 1 931157028 931157102 74 2 931157103 931157245 142 3 931157335 931158000 665 root [4] delete S |
||
In the following example, we print the number of segments in the list and the total livetime (integrated segment durations). root [0] gSystem->Load("libSegments.so") root [1] Segments *S = new Segments("./seg.txt"); root [2] cout<<S->GetNsegments()<<endl; 4 root [3] cout<<S->GetLiveTime()<<endl; 899 root [4] delete S |
||
In the following example, we add a segment padding, meaning that segment boundaries are extended or shrunk. As we can see the number of segments has changed. Indeed, overlapping segments are merged into one and negative duration segments are removed. NB: the padding value can be negative. root [0] gSystem->Load("libSegments.so") root [1] Segments *S = new Segments("./seg.txt"); root [2] S->Dump() 931157000 931157018 931157028 931157102 931157103 931157245 931157335 931158000 root [3] S->ApplyPadding(20,35) root [4] S->Dump(4) 0 931157020 931157280 260 1 931157355 931158035 680 root [5] delete S |
||
Segments are often used to flag some event occuring at a given time. For that purpose, one can use the IsInsideSegment() function: root [0] gSystem->Load("libSegments.so") root [1] Segments *S = new Segments("./seg.txt"); root [2] S->Dump() 931157000 931157018 931157028 931157102 931157103 931157245 931157335 931158000 root [4] cout<<S->IsInsideSegment(931157002)<<endl; 1 root [5] cout<<S->IsInsideSegment(931157019)<<endl; 0 root [4] delete S In this example, GPS=931157002 is found to be inside a segment while GPS=931157019 is not. Sometimes, it can be convenient to retrieve the segment the closest to a given GPS time. For example: root [0] gSystem->Load("libSegments.so") root [1] Segments *S = new Segments("./seg.txt"); root [2] S->Dump() 931157000 931157018 931157028 931157102 931157103 931157245 931157335 931158000 root [4] vector <double> closest_segment; root [5] S->GetClosestSegment(931157019,closest_segment) root [5] cout<<closest_segment[0]<<" "<<closest_segment[1]<<endl; 931157000 931157018 root [5] S->GetClosestSegment(931157030,closest_segment) root [5] cout<<closest_segment[0]<<" "<<closest_segment[1]<<endl; 931157028 931157102 root [4] delete S |
||
|