GWOLLUM  4.2.0
Tools for gravitational-wave analyses
Coinc2.h
Go to the documentation of this file.
1 
6 #ifndef __Coinc2__
7 #define __Coinc2__
8 
9 #include "GwollumPlot.h"
10 #include "TriggerSelect.h"
11 
12 using namespace std;
13 
17 #define COINC2_NT 2
18 
27 class Coinc2: public GwollumPlot {
28 
29  public:
30 
39  Coinc2(const unsigned int aVerbose=0);
40 
44  virtual ~Coinc2(void);
68  bool SetTriggers(ReadTriggers *aTrigger0, ReadTriggers *aTrigger1,
69  const double aTimeOffset0=0.0, const double aTimeOffset1=0.0,
70  Segments *aValidSegments=NULL);
71 
85  unsigned int MakeCoinc(void);
86 
90  void PrintCoinc(void);
91 
97  void PrintCoincNot(const unsigned int aSampleIndex);
98 
110  inline double GetCoincTimeWindowStart(const unsigned int aSampleIndex, const unsigned int aClusterIndex){
111  return TMath::Max(triggers[aSampleIndex]->GetClusterTime(aClusterIndex)+toffset[aSampleIndex]-coinc_dt/2.0,
112  triggers[aSampleIndex]->GetClusterTimeStart(aClusterIndex)+toffset[aSampleIndex]);
113  };
114 
126  inline double GetCoincTimeWindowEnd(const unsigned int aSampleIndex, const unsigned int aClusterIndex){
127  return TMath::Min(triggers[aSampleIndex]->GetClusterTime(aClusterIndex)+toffset[aSampleIndex]+coinc_dt/2.0,
128  triggers[aSampleIndex]->GetClusterTimeEnd(aClusterIndex)+toffset[aSampleIndex]);
129  };
130 
135  inline void SetCoincDeltat(const double aDeltat){ coinc_dt=aDeltat; };
136 
140  inline unsigned int GetCoincN(void){ return CoC[0].size(); };
141 
148  inline unsigned int GetClusterIndex(const unsigned int aSampleIndex, const unsigned int aCoincIndex){
149  return CoC[aSampleIndex%COINC2_NT][aCoincIndex];
150  };
151 
158  inline void SetCoincTag(const unsigned int aCoincIndex, const bool aNewTag){
159  CoTag[aCoincIndex]=aNewTag;
160  };
161 
166  inline void SetCoincTag(const bool aNewTag){
167  for(unsigned int c=0; c<CoC[0].size(); c++) CoTag[c]=aNewTag;
168  };
169 
175  inline bool GetCoincTag(const unsigned int aCoincIndex){ return CoTag[aCoincIndex]; };
176 
184  inline unsigned int GetActiveClusterN(const unsigned int aSampleIndex){
185  return nactive[aSampleIndex%COINC2_NT];
186  };
187 
192  inline double GetTimeOffset(const unsigned int aSampleIndex){
193  return toffset[aSampleIndex%COINC2_NT];
194  };
195 
199  inline double GetCoincDeltat(void){ return coinc_dt; };
200 
204  inline double GetCoincLiveTime(void){ return CoSeg->GetLiveTime(); };
205 
209  inline Segments* GetCoincSegments(void){
210  return CoSeg;
211  };
212 
217  return new Segments(CoSeg->GetStarts(), CoSeg->GetEnds());
218  };
219 
226  inline void SetSnrMin(const unsigned int aSampleIndex, const double aSnrMin){
227  snrmin[aSampleIndex%COINC2_NT]=aSnrMin;
228  return;
229  };
230 
235  inline double GetSnrMin(const unsigned int aSampleIndex){
236  return snrmin[aSampleIndex%COINC2_NT];
237  };
238 
246  inline void SetFrequencyRange(const unsigned int aSampleIndex, const double aFrequencyMin, const double aFrequencyMax){
247  freqmin[aSampleIndex%COINC2_NT]=aFrequencyMin;
248  freqmax[aSampleIndex%COINC2_NT]=aFrequencyMax;
249  return;
250  };
251 
256  inline double GetFrequencyMin(const unsigned int aSampleIndex){
257  return freqmin[aSampleIndex%COINC2_NT];
258  };
259 
264  inline double GetFrequencyMax(const unsigned int aSampleIndex){
265  return freqmax[aSampleIndex%COINC2_NT];
266  };
267 
281  bool MakeComparators(void);
282 
288  void PrintComparators(const string aFileName);
289 
290  private:
291 
292  // GENERAL
293  unsigned int verbosity;
294 
295  // TRIGGERS
296  ReadTriggers *triggers[COINC2_NT];
297  double toffset[COINC2_NT];
298  unsigned int nactive[COINC2_NT];
299  double snrmin[COINC2_NT];
300  double freqmin[COINC2_NT];
301  double freqmax[COINC2_NT];
302 
303  // COINC
304  double coinc_dt;
305  vector <unsigned int> CoC[COINC2_NT];
306  bool *CoTag;
308 
309  // COMPARATORS
310  TH1D *hc_snrfrac[2];
311  TH1D *hc_freqfrac[2];
312  TGraph *gc_snrtime[4];
313  TGraph *gc_freqtime[4];
314  TGraph *gc_snrsnr;
315  TGraph *gc_freqfreq;
316 
328  void SelectClusters(const unsigned int aSampleIndex);
329 
330  ClassDef(Coinc2,0)
331 };
332 
333 #endif
334 
335 
#define COINC2_NT
Number of trigger sets.
Definition: Coinc2.h:17
Interface to draw and print ROOT objects.
Select trigger parameters.
Set two trigger sets in coincidence.
Definition: Coinc2.h:27
double GetFrequencyMax(const unsigned int aSampleIndex)
Returns the miaximum frequency used to select input clusters [Hz].
Definition: Coinc2.h:264
unsigned int verbosity
Verbosity level.
Definition: Coinc2.h:293
void SetCoincTag(const unsigned int aCoincIndex, const bool aNewTag)
Sets a new tag to a given coinc event.
Definition: Coinc2.h:158
Segments * GetCoincSegments(void)
Returns a pointer to the coincidence segments.
Definition: Coinc2.h:209
void SetSnrMin(const unsigned int aSampleIndex, const double aSnrMin)
Sets a minimum SNR to select input clusters.
Definition: Coinc2.h:226
unsigned int GetClusterIndex(const unsigned int aSampleIndex, const unsigned int aCoincIndex)
Returns the cluster index involved in a given coinc event.
Definition: Coinc2.h:148
Segments * GetCoincSegmentsCopy(void)
Returns a copy of coincidence segments.
Definition: Coinc2.h:216
double GetSnrMin(const unsigned int aSampleIndex)
Returns the minimum SNR used to select input clusters [Hz].
Definition: Coinc2.h:235
double GetCoincLiveTime(void)
Returns the livetime of coinc segments [s].
Definition: Coinc2.h:204
double GetFrequencyMin(const unsigned int aSampleIndex)
Returns the minimum frequency used to select input clusters [Hz].
Definition: Coinc2.h:256
unsigned int GetActiveClusterN(const unsigned int aSampleIndex)
Gets the number of active clusters.
Definition: Coinc2.h:184
double GetTimeOffset(const unsigned int aSampleIndex)
Returns the time offset of a trigger set [s].
Definition: Coinc2.h:192
TGraph * gc_freqfreq
Frequency vs frequency.
Definition: Coinc2.h:315
TGraph * gc_snrsnr
Coinc SNR vs SNR.
Definition: Coinc2.h:314
double GetCoincTimeWindowEnd(const unsigned int aSampleIndex, const unsigned int aClusterIndex)
Returns the coincidence time window end [s].
Definition: Coinc2.h:126
double coinc_dt
Coinc time distance [s].
Definition: Coinc2.h:304
bool * CoTag
Coinc tags.
Definition: Coinc2.h:306
double GetCoincTimeWindowStart(const unsigned int aSampleIndex, const unsigned int aClusterIndex)
Returns the coincidence time window start [s].
Definition: Coinc2.h:110
unsigned int GetCoincN(void)
Returns the current number of coinc events.
Definition: Coinc2.h:140
bool GetCoincTag(const unsigned int aCoincIndex)
Gets the tag value of a given coinc event.
Definition: Coinc2.h:175
void SetCoincDeltat(const double aDeltat)
Sets the chacteristic duration to define a coinc .
Definition: Coinc2.h:135
double GetCoincDeltat(void)
Returns the chacteristic duration defining a coinc [s].
Definition: Coinc2.h:199
void SetFrequencyRange(const unsigned int aSampleIndex, const double aFrequencyMin, const double aFrequencyMax)
Sets a frequency range to select input clusters.
Definition: Coinc2.h:246
Segments * CoSeg
Coinc segments.
Definition: Coinc2.h:307
Coinc2(const unsigned int aVerbose=0)
Constructor of the Coinc2 class.
void SetCoincTag(const bool aNewTag)
Sets a new tag for all coinc events.
Definition: Coinc2.h:166
Interface to draw and print ROOT objects.
Definition: GwollumPlot.h:39
Read trigger files.
Definition: ReadTriggers.h:19
Manage time segment lists.
Definition: Segments.h:28