Logo coherent WaveBurst  
Library Reference Guide
Logo
livetime.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Gabriele Vedovato, Sergey Klimenko
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 //////////////////////////////////////////////////////////
20 // root tree class to store live time
21 // Sergey Klimenko, University of Florida
22 //////////////////////////////////////////////////////////
23 
24 
25 #ifndef livetime_h
26 #define livetime_h
27 
28 #include <TROOT.h>
29 #include <TChain.h>
30 #include <TFile.h>
31 #include <stdlib.h>
32 #include "wat.hh"
33 #include "network.hh"
34 
35 /* Structure of WaveBurst single IFO event */
36 
37 static vector<waveSegment> DEFAULT_WAVESEGMENT;
38 
39 class livetime {
40  public :
41 
42  TTree *fChain; //!pointer to the analyzed TTree or TChain
43  Int_t fCurrent; //!current Tree number in a TChain
44 
45 //Declaration of leaves types
46 // for arrays: ifo1 - first index, ifo2 - second index
47 
48  Int_t run; // run
49  Double_t gps; // gps start time segment of the first detector
50  Double_t live; // live time
51  Float_t* lag; //! time lag [sec]
52  Float_t* slag; //! time slag [sec]
53  Double_t* start; //! array of gps start time segment for each detector
54  Double_t* stop; //! array of gps stop time segment for each detector
55 
56 //List of branches
57 
58  TBranch *b_run; //!
59  TBranch *b_gps; //!
60  TBranch *b_live; //!
61  TBranch *b_lag; //!
62  TBranch *b_slag; //!
63  TBranch *b_start; //!
64  TBranch *b_stop; //!
65 
66  livetime() : lag(NULL), slag(NULL), start(NULL), stop(NULL) {allocate(); fChain=NULL;};
67  livetime(TTree *tree) : lag(NULL), slag(NULL), start(NULL), stop(NULL) {allocate(); if(tree) Init(tree);};
68  virtual ~livetime() {
69  if (lag) free(lag); // lag array
70  if (slag) free(slag); // slag array
71  if (start) free(start); // start array
72  if (stop) free(stop); // stop array
73  if (fChain) delete fChain->GetCurrentFile();
74  return;
75  };
76 
77  virtual livetime& operator=(livetime &);
78 
79  Int_t GetEntry(Int_t);
80  void Init(TTree *);
81  void allocate();
82  Bool_t Notify();
83  TTree* setTree();
84  void output(TTree* waveTree, network* net, float* slag=NULL,
85  vector<waveSegment> detSegs = DEFAULT_WAVESEGMENT);
86 
87 // void Loop();
88 // Int_t Cut(Int_t entry);
89 // Int_t LoadTree(Int_t entry);
90 
91  void Show(Int_t entry = -1);
92 
93  // used by THtml doc
94  ClassDef(livetime,2)
95 };
96 
97 #endif
98 
99 
100 
101 
TTree * tree
Definition: TimeSortTree.C:20
void Init(TTree *)
Definition: livetime.cc:47
TBranch * b_live
Definition: livetime.hh:60
Double_t * start
time slag [sec]
Definition: livetime.hh:53
Double_t gps
Definition: livetime.hh:49
TBranch * b_start
Definition: livetime.hh:63
livetime()
Definition: livetime.hh:66
network ** net
NOISE_MDC_SIMULATION.
virtual livetime & operator=(livetime &)
Definition: livetime.cc:26
Int_t fCurrent
pointer to the analyzed TTree or TChain
Definition: livetime.hh:43
Double_t live
Definition: livetime.hh:50
Int_t run
current Tree number in a TChain
Definition: livetime.hh:48
TTree * fChain
Definition: livetime.hh:42
TBranch * b_gps
Definition: livetime.hh:59
Float_t * lag
Definition: livetime.hh:51
TBranch * b_lag
Definition: livetime.hh:61
void allocate()
Definition: livetime.cc:65
livetime(TTree *tree)
Definition: livetime.hh:67
void output(TTree *waveTree, network *net, float *slag=NULL, vector< waveSegment > detSegs=DEFAULT_WAVESEGMENT)
Definition: livetime.cc:109
double * entry
Definition: cwb_setcuts.C:224
Int_t GetEntry(Int_t)
Definition: livetime.cc:166
vector< waveSegment > detSegs
Definition: cwb_net.C:193
Bool_t Notify()
Definition: livetime.cc:152
Double_t * stop
array of gps start time segment for each detector
Definition: livetime.hh:54
Float_t * slag
time lag [sec]
Definition: livetime.hh:52
TTree * setTree()
Definition: livetime.cc:81
static vector< waveSegment > DEFAULT_WAVESEGMENT
Definition: livetime.hh:37
void Show(Int_t entry=-1)
Definition: livetime.cc:172
virtual ~livetime()
Definition: livetime.hh:68
TBranch * b_run
array of gps stop time segment for each detector
Definition: livetime.hh:58
TBranch * b_slag
Definition: livetime.hh:62
TBranch * b_stop
Definition: livetime.hh:64