00001
00002
00004 #ifndef __Omicron__
00005 #define __Omicron__
00006
00007 #include "IO.h"
00008 #include "Otile.h"
00009 #include "Oinject.h"
00010 #include "Date.h"
00011 #include "InjEct.h"
00012 #include "ffl.h"
00013 #include "TRandom.h"
00014 #include "TRandom3.h"
00015 #include "TriggerBuffer.h"
00016
00017 using namespace std;
00018
00019
00029 class Omicron {
00030
00031 public:
00032
00054 Omicron(const string aOptionFile);
00055
00059 virtual ~Omicron(void);
00073 bool InitSegments(Segments *aInSeg, Segments *aOutSeg=NULL);
00074
00088 bool MakeDirectories(const int aId = 0);
00089
00096 bool NewChunk(void);
00097
00109 bool DefineNewChunk(const int aTimeStart, const int aTimeEnd, const bool aResetPSDBuffer=false);
00110
00115 bool NewChannel(void);
00116
00126 bool LoadData(double **aDataVector, int *aSize);
00127
00148 int Condition(const int aInVectSize, double *aInVect);
00149
00154 int Project(void);
00155
00161 bool ExtractTriggers(void);
00162
00171 string WriteTriggers(const bool aLVDirConvention = false);
00172
00177 bool WriteOutput(void);
00178
00182 void PrintStatusInfo(void);
00183
00192 Segments* GetTriggerSegments(TH1D *aThr=NULL, const double aInfValue=1e20);
00193
00197 vector <string> GetChannels(void);
00198
00202 inline int GetChunkDuration(void){return tile->GetTimeRange();};
00203
00207 inline int GetOverlapDuration(void){return tile->GetOverlapDuration();};
00208
00212 inline int GetSampleFrequency(void){return triggers[0]->GetWorkingFrequency();};
00213
00217 inline int GetNTriggers(void){ return triggers[chanindex]->GetNtriggers(); };
00218
00219
00223 inline double GetTriggerBufferLiveTime(void){ return triggers[chanindex]->GetBufferLiveTime(); };
00224
00228 inline void ResetTriggerBuffer(void){ return triggers[chanindex]->ResetBuffer(); };
00229
00236 inline void ResetTriggerBufferAfter(const double aTime){ return triggers[chanindex]->ResetAfter(aTime); };
00237
00242 inline void ResetPSDBuffer(void) { spectrum1[chanindex]->Reset(); };
00243
00248 void PrintMessage(const string aMessage);
00249
00253 inline bool GetStatus(void){ return status_OK; };
00254
00258 inline int GetVerbosity(void){ return fVerbosity; };
00259
00263 inline string GetVersion(void){ return "v2r2"; };
00264
00265 private:
00266
00267
00268 bool status_OK;
00269 time_t timer;
00270 time_t timer_start;
00271 struct tm * ptm;
00272 int chanindex;
00273
00274
00275 void ReadOptions(void);
00276 string fOptionFile;
00277 int fVerbosity;
00278 string fMaindir;
00279 string fOutFormat;
00280 string fOutProducts;
00281 bool fNoLogo;
00282 vector <int> fWindows;
00283 string fClusterAlgo;
00284 string fftplan;
00285 double fratemax;
00286 vector <string> fInjChan;
00287 vector <double> fInjFact;
00288 int fsginj;
00289
00290
00291 Segments *inSegments;
00292 Segments **outSegments;
00293 int chunk_ctr;
00294 int *chan_ctr;
00295 int *chan_data_ctr;
00296 int *chan_cond_ctr;
00297 int *chan_proj_ctr;
00298 int *chan_write_ctr;
00299 int *trig_ctr;
00300 double *chan_mapsnrmax;
00301 vector <int> chunkcenter;
00302 vector <string> chunktfile;
00303 ofstream oinjfile;
00304
00305
00306 int nchannels;
00307 GwollumPlot *GPlot;
00308 vector <string> outdir;
00309 Spectrum **spectrum1;
00310 Spectrum **spectrum2;
00311 Spectrum *spectrumw;
00312 ffl *FFL;
00313 ffl *FFL_inject;
00314 fft *offt;
00315 Otile *tile;
00316 TriggerBuffer **triggers;
00317 Oinject *oinj;
00318 InjEct **inject;
00319
00320
00321 double *ChunkVect;
00322
00323
00324 void Whiten(Spectrum *aSpec);
00325 double* GetTukeyWindow(const int aSize, const int aFractionSize);
00326 double *TukeyWindow;
00327
00328
00329 string maindir;
00330 void SaveAPSD(const string aType);
00331 void SaveWPSD(void);
00332 void SaveTS(const bool aWhite=false);
00333 void SaveSG(void);
00334 void SaveSpectral(void);
00335 void MakeHtml(void);
00336
00337
00338 void PrintASCIIlogo(void);
00339 static const string colorcode[17];
00340 string GetColorCode(const double aSNRratio);
00341 bool IsFlat(const int aInVectSize, double *aInVect);
00342
00343 ClassDef(Omicron,0)
00344 };
00345
00346 #endif
00347
00348