79 #ifndef STBTOFCALIMAKER_H
80 #define STBTOFCALIMAKER_H
82 #include "phys_constants.h"
106 #include "StPhysicalHelixD.hh"
107 #include "StBTofUtil/StVpdSimConfig.h"
109 typedef std::vector<Int_t> IntVec;
110 typedef std::vector<Double_t> DoubleVec;
120 virtual Int_t Init();
122 virtual Int_t FinishRun(
int);
123 virtual Int_t
Make();
168 void setCalibFilePvpd(
const Char_t*);
169 void setCalibFileTot(
const Char_t*);
170 void setCalibFileZhit(
const Char_t*);
171 void setCalibFileT0(
const Char_t*);
173 enum calibtype {NOTSET=0, BOARDCALIB=960, MODULECALIB=3840, CELLCALIB=23040};
174 Int_t getZCalibType();
175 Int_t getTotCalibType();
177 void forceTStartZero();
182 calibtype mZCalibType, mTotCalibType;
192 void writeStartTime();
194 Int_t initParameters(Int_t runnumber);
197 void processStEvent();
201 void cleanCalibMuDst();
205 void tstart(
const Double_t Vz, Double_t *tstart, Double_t *tdiff);
206 Double_t tofAllCorr(
const Double_t
tof,
const Double_t tot,
const Double_t zlocal,
const Int_t iTray,
const Int_t iModuleChan);
214 void vpdTStartForBTofComparison(Double_t vz, Double_t *vpdStartTime);
215 double fudgeFactor(
double eta,
double zVtx);
216 void fillDtiVsPtotProfiles(
double eta,
double zVtx,
double ptot,
double Dti);
218 void archiveVpdHitInfo();
222 float tofCellResolution(
const Int_t iTray,
const Int_t iModuleChan);
225 void bookHistograms();
227 void writeHistograms();
230 void bookPPPAHistograms();
232 void writePPPAHistograms();
245 mWestVpdTrayId = 121,
249 static const Double_t VHRBIN2PS;
251 static const Double_t HRBIN2PS;
253 static const Double_t TMAX;
254 static const Double_t VZDIFFCUT;
255 static const Double_t DCARCUT;
257 static const Double_t mC_Light;
259 static const Float_t BTHBLCHCNST;
262 static const Float_t DEDXTCORR[2];
264 Bool_t mValidCalibPar = kFALSE;
265 Bool_t mValidStartTime = kFALSE;
267 Int_t mVPDEastHitsCut = 0;
268 Int_t mVPDWestHitsCut = 0;
270 Float_t mTofTotEdge[mNTray][mNModule][mNCell][mNBinMax];
271 Float_t mTofTotCorr[mNTray][mNModule][mNCell][mNBinMax];
272 Float_t mTofZEdge[mNTray][mNModule][mNCell][mNBinMax];
273 Float_t mTofZCorr[mNTray][mNModule][mNCell][mNBinMax];
274 Double_t mTofTZero[mNTray][mNModule][mNCell];
276 Double_t mVPDLeTime[2*mNVPD];
278 Double_t mTSumEast = 0.0;
279 Double_t mTSumWest = 0.0;
280 Double_t mTSumEastSigma = 0.0;
281 Double_t mTSumWestSigma = 0.0;
282 UInt_t mVPDHitPatternEast = 0;
283 UInt_t mVPDHitPatternWest = 0;
286 Double_t mVPDVtxZ = 0.0;
287 Double_t mProjVtxZ = 0.0;
288 Double_t mEvtVtxZ = 0.0;
289 Double_t mTDiff = 0.0;
290 Double_t mTStart = 0.0;
293 Int_t mNTzeroCan = 0;
294 Double_t mTCanFirst = 0.0;
295 Double_t mTCanLast = 0.0;
297 Double_t mVpdEHits = 0;
298 Double_t mVpdWHits = 0;
299 Double_t mVpdEGoodHits = 0;
300 Double_t mVpdWGoodHits = 0;
301 Double_t mEarliestVpdEHit = 0.0;
302 Double_t mEarliestVpdWHit = 0.0;
303 Double_t mClosestVpdEHit = 0.0;
304 Double_t mClosestVpdWHit = 0.0;
305 Double_t mLatestVpdEHit = 0.0;
306 Double_t mLatestVpdWHit = 0.0;
316 Bool_t mOuterGeometry;
318 Bool_t mUseEventVertex = kFALSE;
319 Bool_t mInitFromFile;
321 Bool_t mForceTStartZero =
false;
322 Bool_t mFXTMode = kFALSE;
325 std::map<int, StVpdSimConfig::SingleTubeParams> mVpdRes;
328 Bool_t mPPPAMode = kFALSE;
329 Bool_t mPPPAPionSel = kFALSE;
330 Bool_t mPPPAOutlierRej = kFALSE;
331 Bool_t mNSigmaTofMode = kFALSE;
332 Bool_t mRun15Slew = kFALSE;
334 string mCalibFilePvpd;
335 string mCalibFileTot;
336 string mCalibFileZhit;
340 string mHistoFileName;
341 TH1D* hEventCounter =
nullptr;
343 Bool_t mPPPAModeHist = kFALSE;
344 string mPPPAModeHistoFileName;
348 TProfile* hDtiVsPtot[11][2];
350 virtual const char *GetCVS()
const
351 {
static const char cvs[]=
"Tag $Name: $ $Id: StBTofCalibMaker.h,v 1.15 2021/05/29 23:57:08 geurts Exp $ built " __DATE__
" " __TIME__ ;
return cvs;}
356 inline void StBTofCalibMaker::forceTStartZero( ) { mForceTStartZero =
true; }
365 inline void StBTofCalibMaker::setCalibFilePvpd(
const Char_t* filename) {mCalibFilePvpd = filename;}
366 inline void StBTofCalibMaker::setCalibFileTot(
const Char_t* filename) {mCalibFileTot = filename;}
367 inline void StBTofCalibMaker::setCalibFileZhit(
const Char_t* filename) {mCalibFileZhit = filename;}
368 inline void StBTofCalibMaker::setCalibFileT0(
const Char_t* filename) {mCalibFileT0 = filename;}
369 inline Int_t StBTofCalibMaker::getZCalibType() {
return Int_t(mZCalibType);}
370 inline Int_t StBTofCalibMaker::getTotCalibType() {
return Int_t(mTotCalibType);}
373 inline void StBTofCalibMaker::setPPPAMode(
const Bool_t val) { mPPPAMode = val;
if(val){LOG_INFO <<
"You are now using PPPAMode!" << endm;}
if(!val){mPPPAModeHist = kFALSE;}; }
377 inline void StBTofCalibMaker::setPPPAModeHist(
const Bool_t val) {
if(mPPPAMode){mPPPAModeHist = val;
if(mPPPAModeHist){LOG_INFO <<
"mPPPAModeHist is on!" << endm;}}
else if(val){LOG_INFO <<
"setPPPAModeHist() is only valid when pppAMode is on! " << endm;}
else{mPPPAModeHist = val;}; }
378 inline void StBTofCalibMaker::setPPPAModeHistoFileName(
const Char_t* filename) {
if(mPPPAMode && mPPPAModeHist){mPPPAModeHistoFileName = filename;}
else {LOG_INFO <<
"setPPPAMode() and setPPPAModeHist() must be turned on first before calling setPPPAModeHistoFileName()!" << endm;}; }
void setVPDHitsCut(const Int_t, const Int_t)
switch to set the VPD # of hits cut
void setPPPAPionSel(const Bool_t val=kFALSE)
switch to pp/pA pion selection
virtual Int_t InitRun(int)
void setFXTMode(const bool val=kTRUE)
switch to FXT mode to include protons in T0 calculation
void setHistoFileName(const Char_t *)
set histogram output file name
void setNSigmaTofMode(const Bool_t val=kFALSE)
enable nSigmTof mode
void setJP2017FF(const Bool_t val=kFALSE)
enable JP 2017 fudge factor
void setMB2015FF(const Bool_t val=kFALSE)
enable MB 2015 fudge factor
void setMuDstIn(const bool val=kTRUE)
switch to read in StEvent/MuDst
void setOuterGeometry(const bool val=kTRUE)
switch to select the Helix Geometry
void setPPPAModeHistoFileName(const Char_t *filename)
set file name for pp/pA QA histograms
void setUseEventVertex(const bool)
switch to turn on the use of event vertex
void setPPPAMode(const Bool_t val=kFALSE)
switch to pp/pA mode
void setRun15Slew(const Bool_t val=kFALSE)
explicitly set Run15 slewing correction
StBTofCalibMaker(const char *name="btofCalib")
Default constructor.
void setJP2015FF(const Bool_t val=kFALSE)
enable JP 2015 fudge factor
void setPPPAOutlierRej(const Bool_t val=kFALSE)
switch outlier rejection in pp/pA
virtual ~StBTofCalibMaker()
Destructor.
void setInitFromFile(const Bool_t val=kTRUE)
read calibration parameters from file
void setPPPAModeHist(const Bool_t val=kFALSE)
enable pp/pA QA histograms
void setCreateHistoFlag(Bool_t histos=kTRUE)
enable QA histogram filling
void setSlewingCorr(const bool val=kTRUE)
switch to turn on slewing correction or not - maybe only T0 in the first step.