QTriggerFinder.hh
Go to the documentation of this file.00001
00008 #ifndef _QTRIGGER_FINDER_HH_
00009 #define _QTRIGGER_FINDER_HH_
00010
00011 #include "QCuore.hh"
00012
00013 #include <map>
00014 #include <list>
00015
00016 #include "QBuilderDefs.hh"
00017 #include "QEventFiller.hh"
00018
00019 class QCrateReceiverBuffer;
00020 class QTrgInfo;
00021
00022 namespace Cuore {class QEvent;}
00023
00024
00025 class QTriggerFinder
00026 {
00027 public:
00028
00030 QTriggerFinder();
00031
00033 virtual ~QTriggerFinder();
00034
00040 bool SetMap(std::map<unsigned int,QBuilderInfo_t>& info);
00041
00047 bool SearchForTrigger();
00048
00057 bool GetEarliestTrigger(int& ch, long long& time, QEventType_t& type);
00058
00059 int GetNextEvent(QEvent* ev);
00060
00069 bool SetMuonChannel(const unsigned int& ch);
00070
00079 bool SetHeaterChannel(const unsigned int& ch);
00080
00086 bool IsHeater(const unsigned int& ch) const
00087 { return (bool)(ch == fHeaterCh); }
00088
00094 bool IsMuon(const unsigned int& ch) const
00095 { return (bool)(ch == fMuonCh);}
00096
00103 bool IsBolometer(const unsigned int& ch) const
00104 { return (!IsMuon(ch) && !IsHeater(ch));}
00105
00112 bool SetLoopTime(const int& loopTime);
00113
00120 bool SetTimeOut(const int& timeOut);
00121
00127 bool SetRunNumber(const unsigned int& runNumber);
00128
00134 virtual bool Consolidate();
00135
00136 protected:
00137
00139 QEventFiller fFiller;
00140
00142 unsigned int fEventNumber;
00143
00145 std::map<unsigned int,QBuilderInfo_t>* fInfo;
00146
00148 std::map<unsigned int,long> fLastCtrVal;
00149
00155 std::map<unsigned int,std::list<QTrgInfo>*> fTrgMemory;
00156
00161 std::map<unsigned int,long long> fReleaseTime;
00162
00167 std::map<unsigned int,long long> fMaxPostTrigger;
00168
00169 std::list<QTrgInfo> fSortedTriggers;
00170
00172 std::list<QTrgInfo>::const_iterator fNext;
00173
00175 bool fNextIsValid;
00176
00178 std::map<unsigned int, std::list<unsigned int> > fPulsers;
00179
00184 std::map<unsigned int, std::list<long long> > fPulserTimes;
00185
00187 long long fPulserTimeVeto;
00188
00190 std::map<unsigned int, std::list<unsigned int> > fSidePulses;
00191
00193 unsigned int fMuonCh;
00194
00196 bool fMuonWasHigh;
00197
00199 unsigned int fHeaterCh;
00200
00202 bool fHeaterWasHigh;
00203
00205 long long fMaxPreTriggerNs;
00206
00209 long long fLastValidTimeNs;
00210
00215 long long fLoopTime;
00216
00222 long long fTimeOut;
00223
00228 bool fIsReady;
00229
00231 unsigned int fCurrentDaqRun;
00232
00237 unsigned long long fLastHeaterTime;
00238
00247 bool IsDataAvailable(const QCrateReceiverBuffer* buf,
00248 const int& postTriggerSamples) const;
00249
00251 void SortTriggers();
00252
00254 void Release();
00255
00265 void SetReleaseTime(const unsigned int& ch, const long long& time);
00266
00268 void FillPulsersMap();
00269
00271 void FillSidePulsesMap();
00272
00276 void FlushSortedTriggers();
00277
00285 void FillMaxPostTriggers();
00286
00293 bool VetoedByHeater(const QTrgInfo& trgInfo) const;
00294
00298
00299
00300
00301 void UpdateHeaterVeto();
00302
00303 bool IsToBeReturned(const QTrgInfo& trgInfo) const;
00304
00309 virtual void CheckExtraBits(const QBuilderInfo_t& info,
00310 const unsigned long long sampleIndex,
00311 const long data);
00312
00313 virtual void SetAuxData(QEvent* ev);
00314 };
00315
00316 #endif
00317