35 #ifndef STETOFCALIBMAKER_H
36 #define STETOFCALIBMAKER_H
68 Int_t InitRun( Int_t );
69 Int_t FinishRun( Int_t );
78 void setFileNameElectronicsMap(
const char* fileName );
79 void setFileNameStatusMap(
const char* fileName );
80 void setFileNameTimingWindow(
const char* fileName );
81 void setFileNameSignalVelocity(
const char* fileName );
82 void setFileNameCalibHistograms(
const char* fileName );
83 void setFileNameOffsetHistograms(
const char* fileName );
84 void setFileNameResetTimeCorr(
const char* fileName );
85 void setFileNamePulserTotPeak(
const char* fileName );
86 void setFileNamePulserTimeDiffGbtx(
const char* fileName );
87 void setCalState(
const bool calTrue );
90 void setDoQA(
const bool doQA );
91 void setDebug(
const bool debug );
92 void setStrictPulserHandling(
const bool debug );
93 void setReferencePulserIndex(
const int index );
96 short GetDefaultState(
int);
106 return geomId == r.geomId && fabs( time - r.time ) < 1.e-5 && fabs( tot - r.tot ) < 1.e-5;
112 unsigned long int evtId;
118 bool isFileExisting(
const std::string fileName );
122 void flagPulserDigis (
StETofDigi* aDigi,
unsigned int index, std::map<
unsigned int, std::vector< unsigned int > >& pulserCandMap );
128 void flagPulserDigis (
StMuETofDigi* aDigi,
unsigned int index, std::map<
unsigned int, std::vector< unsigned int > >& pulserCandMap );
131 void calculatePulserOffsets( std::map<
unsigned int, std::vector< unsigned int > >& pulserCandMap );
136 double slewingTimeOffset(
StETofDigi* aDigi );
137 double applyPulserOffset(
StETofDigi* aDigi );
139 double resetTimeCorr()
const;
144 unsigned int channelToKey(
const unsigned int channelId );
145 unsigned int detectorToKey(
const unsigned int detectorId );
146 unsigned int sideToKey(
const unsigned int sideId );
149 void bookHistograms();
150 void setHistFileName();
151 void writeHistograms();
153 void readGet4State(
int fileNr,
short forward);
154 void checkGet4State(
unsigned long int eventNr);
160 std::string mFileNameCalibParam;
161 std::string mFileNameElectronicsMap;
162 std::string mFileNameStatusMap;
163 std::string mFileNameTimingWindow;
164 std::string mFileNameSignalVelocity;
165 std::string mFileNameCalibHistograms;
166 std::string mFileNameOffsetHistograms;
167 std::string mFileNameResetTimeCorr;
168 std::string mFileNamePulserTotPeak;
169 std::string mFileNamePulserTimeDiffGbtx;
172 Float_t mGet4TotBinWidthNs;
173 Int_t mMinDigisPerSlewBin;
174 Float_t mResetTimeCorr;
176 Double_t mTriggerTime;
180 Float_t mPulserPeakTime;
181 Int_t mReferencePulserIndex;
183 std::map< UInt_t, std::pair< Float_t, Float_t > > mTimingWindow;
184 std::map< UInt_t, std::pair< Float_t, Float_t > > mPulserWindow;
185 std::map< UInt_t, UInt_t > mStatus;
186 std::map< UInt_t, Float_t > mSignalVelocity;
188 std::map< UInt_t, TH1F* > mDigiTotCorr;
189 std::map< UInt_t, TH1F* > mDigiTimeCorr;
190 std::map< UInt_t, TProfile* > mDigiSlewCorr;
192 std::map< UInt_t, Float_t > mPulserPeakTot;
193 std::map< UInt_t, Double_t > mPulserTimeDiff;
194 std::map< UInt_t, Double_t > mPulserTimeDiffGbtx;
195 std::map< UInt_t, UInt_t > mNPulsersCounter;
196 std::map< UInt_t, UInt_t > mNStatusBitsCounter;
197 std::map< UInt_t, Bool_t > mPulserPresent;
199 std::map< UInt_t, Int_t > mJumpingPulsers;
201 std::map< UInt_t, Int_t > mUnlockPulserState;
203 std::vector< StructStuckFwDigi > mStuckFwDigi;
205 Bool_t mStrictPulserHandling;
206 Bool_t mUsePulserGbtxDiff;
209 std::string mHistFileName;
210 std::map< std::string, TH1* > mHistograms;
213 std::string mFileNameGet4State;
214 std::vector<short> mStateVec[1728];
215 std::vector<unsigned long int> mStartVec[1728];
216 std::vector<unsigned long int> mMasterStartVec;
217 std::map<int , short> mGet4StateMap;
218 std::map<int , short> mGet4ZeroStateMap;
219 std::map<int , short> mGet4DefaultStateMap;
221 unsigned long int mStateMapStart;
222 unsigned long int mStateMapStop;
223 unsigned long int mDbEntryStart;
224 unsigned long int mDbEntryStop;
228 void decodeInt( std::vector<unsigned long int>& intVec ,std::vector<unsigned long int>& startVec ,std::map<
unsigned long int,vector<int>>& stateVec ,std::map<
unsigned long int,vector<int>>& get4IdVec);
231 virtual const Char_t *GetCVS()
const {
static const char cvs[]=
"Tag $Name: $Id: built " __DATE__
" " __TIME__ ;
return cvs; }
236 inline bool StETofCalibMaker::calState( ) {
return mCalState; }
237 inline short StETofCalibMaker::GetDefaultState(
int get4 ) {
return mGet4DefaultStateMap.at(get4); }
238 inline short StETofCalibMaker::GetState(
int get4 ) {
return mGet4StateMap.at(get4); }
239 inline void StETofCalibMaker::setCalState(
const bool calTrue ) { mCalState = calTrue; }
242 inline void StETofCalibMaker::setFileNameElectronicsMap(
const char* fileName ) { mFileNameElectronicsMap = fileName; }
243 inline void StETofCalibMaker::setFileNameStatusMap(
const char* fileName ) { mFileNameStatusMap = fileName; }
244 inline void StETofCalibMaker::setFileNameTimingWindow(
const char* fileName ) { mFileNameTimingWindow = fileName; }
245 inline void StETofCalibMaker::setFileNameSignalVelocity(
const char* fileName ) { mFileNameSignalVelocity = fileName; }
246 inline void StETofCalibMaker::setFileNameCalibHistograms(
const char* fileName ) { mFileNameCalibHistograms = fileName; }
247 inline void StETofCalibMaker::setFileNameOffsetHistograms(
const char* fileName ) { mFileNameOffsetHistograms = fileName; }
248 inline void StETofCalibMaker::setFileNameResetTimeCorr(
const char* fileName ) { mFileNameResetTimeCorr = fileName; }
249 inline void StETofCalibMaker::setFileNamePulserTotPeak(
const char* fileName ) { mFileNamePulserTotPeak = fileName; }
250 inline void StETofCalibMaker::setFileNamePulserTimeDiffGbtx(
const char* fileName ) { mFileNamePulserTimeDiffGbtx = fileName; }
253 inline double StETofCalibMaker::resetTimeCorr()
const {
return mResetTimeCorr; }
255 inline void StETofCalibMaker::setStrictPulserHandling(
const bool StrictPulserHandling ) { mStrictPulserHandling = StrictPulserHandling; }
256 inline void StETofCalibMaker::setDoQA(
const bool doQA ) { mDoQA = doQA; }
257 inline void StETofCalibMaker::setDebug(
const bool debug ) { mDebug = debug; }
258 inline void StETofCalibMaker::setReferencePulserIndex(
const int index ) { mReferencePulserIndex = index; }
260 #endif // STETOFCALIBMAKER_H
void setFileNameCalibParam(const char *fileName)
read calibration parameters from file
StETofCalibMaker(const char *name="etofCalib")
default constructor