50 #ifndef STTOFCALIMAKER_H
51 #define STTOFCALIMAKER_H
57 #define VHRBIN2PS 24.4140625 // Very High resolution mode, pico-second per bin
59 #define HRBIN2PS 97.65625 // High resolution mode, pico-second per bin
61 #define TMAX 51200. // tdc limit
65 #ifndef ST_NO_NAMESPACES
77 #include "StPhysicalHelixD.hh"
78 #include "StTofUtil/StSortTofRawData.h"
80 #if !defined(ST_NO_TEMPLATE_DEF_ARGS) || defined(__CINT__)
81 typedef vector<Int_t> IntVec;
82 typedef vector<Double_t> DoubleVec;
84 typedef vector<Int_t, allocator<Int_t>> IntVec;
85 typedef vector<Double_t, allocator<Double_t>> DoubleVec;
102 Int_t processEventYear2to4();
103 Int_t processEventYear5();
115 void setTDCLimits(
const Double_t,
const Double_t);
116 void setADCCut(
const Double_t);
117 void setTDCWidth(
const Double_t);
119 void setPVPDADCLimits(
const Double_t,
const Double_t);
120 void setPVPDTDCLimits(
const Double_t,
const Double_t);
121 void setPVPDHitsCut(
const Int_t,
const Int_t);
123 Bool_t validPVPDADC(
const Double_t);
124 Bool_t validPVPDTDC(
const Double_t);
133 Double_t
tofrT0Corr(
const Double_t
tof,
const Double_t Tstart,
const Int_t iDaqChan);
135 Double_t
tofrSlewingCorr(
const Double_t tof,
const Double_t adc,
const Int_t iDaqChan);
137 Double_t
tofrZCorr(
const Double_t tof,
const Double_t zlocal);
139 Double_t
tofrAllCorr(
const Double_t tof,
const Double_t Tstart,
const Double_t adc,
const Double_t zlocal,
const Int_t iDaqChan);
142 Double_t
tofpT0Corr(
const Double_t tof,
const Double_t Tstart,
const Int_t iDaqChan);
144 Double_t
tofpSlewingCorr(
const Double_t tof,
const Double_t adc,
const Int_t iDaqChan);
146 Double_t
tofpZCorr(
const Double_t tof,
const Double_t zlocal);
148 Double_t
tofpAllCorr(
const Double_t tof,
const Double_t Tstart,
const Double_t adc,
const Double_t zlocal,
const Int_t iDaqChan);
151 Double_t
tstart(
const Double_t *adc,
const Double_t *tdc,
const Double_t Vz);
154 Double_t
GetINLcorr(
const int edgeid,
const int tempchan,
const int bin);
155 Double_t
tstart5(
const Double_t *tot,
const Double_t *time,
const Double_t Vz);
156 Double_t tofr5AllCorr(
const Double_t tof,
const Double_t tot,
const Double_t zlocal,
const Int_t iModuleChan);
159 void tsum8(
const Double_t *tot,
const Double_t *time);
160 Double_t tstart8(
const Double_t Vz);
161 Double_t
tofr8AllCorr(
const Double_t tof,
const Double_t tot,
const Double_t zlocal,
const Int_t iTray,
const Int_t iModuleChan);
162 Double_t vpdVertexZ();
166 static Int_t
const mNCell = 6;
167 static Int_t
const mNTOFr = 120;
168 static Int_t
const mNTOFp = 41;
169 static Int_t
const mNPVPD = 6;
170 static Int_t
const mNMax = 200;
171 static Int_t
const mNPar = 10;
173 static Int_t
const mNTOFr5 = 192;
174 static Int_t
const mTdigBoard = 10;
175 static Int_t
const mTdcOnBoard = 4;
176 static Int_t
const mTdcChannel = 1024;
177 static Int_t
const mNBinMax = 60;
179 static const Int_t mNTOF = 192;
180 static const Int_t mNTDIG = 8;
181 static const Int_t mNTray8 = 5;
182 static const Int_t mNModule = 32;
183 static const Int_t mNVPD = 19;
186 static const Int_t mNTray = 120;
187 static const Int_t mWestVpdTrayId = 121;
188 static const Int_t mEastVpdTrayId = 122;
190 Double_t mTDCBinWidth;
191 Double_t mTDCLowLimit;
192 Double_t mTDCHighLimit;
196 Double_t mPVPDADCLowLimit;
197 Double_t mPVPDADCHighLimit;
198 Double_t mPVPDTDCLowLimit;
199 Double_t mPVPDTDCHighLimit;
202 Double_t mTofrADCMin[mNTOFr];
203 Double_t mTofrADCMax[mNTOFr];
204 Double_t mTofpADCMin[mNTOFp];
205 Double_t mTofpADCMax[mNTOFp];
213 Bool_t mEastPVPDValid;
215 Bool_t mValidCalibPar;
216 Bool_t mValidStartTime;
218 Double_t mTofrT0[mNTOFr];
219 Double_t mTofrTAPar[mNTOFr*mNPar];
220 Double_t mTofrZPar[mNPar];
221 Double_t mTofpT0[mNTOFp];
222 Double_t mTofpTAPar[mNTOFp*mNPar];
223 Double_t mTofpZPar[mNPar];
224 Double_t mPVPDTAPar[mNPVPD*mNPar];
226 Double_t mPVPDTdc[mNPVPD];
227 Double_t mPVPDAdc[mNPVPD];
229 Int_t mPVPDEastHitsCut;
230 Int_t mPVPDWestHitsCut;
232 Double_t mTofrRes[mNTOFr];
233 Double_t mTofpRes[mNTOFp];
234 Double_t mPVPDRes[mNPVPD];
244 Double_t mINLtable[mTdigBoard][mTdcOnBoard][mTdcChannel];
246 Double_t mTofr5TotEdge[mNTOFr5][mNBinMax];
247 Double_t mTofr5TotCorr[mNTOFr5][mNBinMax];
248 Double_t mTofr5ZEdge[mNTOFr5][mNBinMax];
249 Double_t mTofr5ZCorr[mNTOFr5][mNBinMax];
251 Double_t mPVPDTotEdge[mNPVPD][mNBinMax];
252 Double_t mPVPDTotCorr[mNPVPD][mNBinMax];
254 Double_t mPVPDLeTime[mNPVPD];
255 Double_t mPVPDTot[mNPVPD];
258 Double_t mTofTotEdge[mNTray][mNTDIG][mNBinMax];
259 Double_t mTofTotCorr[mNTray][mNTDIG][mNBinMax];
260 Double_t mTofZEdge[mNTray][mNTDIG][mNBinMax];
261 Double_t mTofZCorr[mNTray][mNTDIG][mNBinMax];
262 Double_t mTofTZero[mNTray][mNModule][mNCell];
264 Double_t mVPDTotEdge[2*mNVPD][mNBinMax];
265 Double_t mVPDTotCorr[2*mNVPD][mNBinMax];
266 Double_t mVPDTZero[2*mNVPD];
268 Double_t mVPDLeTime[2*mNVPD];
269 Double_t mVPDTot[2*mNVPD];
273 UInt_t mVPDHitPatternEast;
274 UInt_t mVPDHitPatternWest;
282 Double_t mPhaseOffset8;
287 Bool_t mOuterGeometry;
291 virtual const char *GetCVS()
const
292 {
static const char cvs[]=
"Tag $Name: $ $Id: StTofCalibMaker.h,v 1.9 2014/08/06 11:43:46 jeromel Exp $ built " __DATE__
" " __TIME__ ;
return cvs;}
297 inline void StTofCalibMaker::setTDCLimits(
const Double_t tmin,
const Double_t tmax) { mTDCLowLimit = tmin; mTDCHighLimit = tmax; }
299 inline void StTofCalibMaker::setADCCut(
const Double_t cut) { mADCCut = cut; }
301 inline void StTofCalibMaker::setTDCWidth(
const Double_t tdcwid) { mTDCWidth = tdcwid; }
303 inline void StTofCalibMaker::setPVPDTDCLimits(
const Double_t tmin,
const Double_t tmax) { mPVPDTDCLowLimit = tmin; mPVPDTDCHighLimit = tmax; }
305 inline void StTofCalibMaker::setPVPDADCLimits(
const Double_t amin,
const Double_t amax) { mPVPDADCLowLimit = amin; mPVPDADCHighLimit = amax; }
307 inline Bool_t StTofCalibMaker::validPVPDADC(
const Double_t adc) {
return (adc>=mPVPDADCLowLimit&&adc<mPVPDADCHighLimit); }
309 inline Bool_t StTofCalibMaker::validPVPDTDC(
const Double_t tdc) {
return (tdc>=mPVPDTDCLowLimit&&tdc<mPVPDTDCHighLimit); }
311 inline void StTofCalibMaker::setPVPDHitsCut(
const Int_t ieast,
const Int_t iwest) { mPVPDEastHitsCut=ieast ; mPVPDWestHitsCut=iwest; }
317 inline Double_t StTofCalibMaker::vpdVertexZ() {
return mVPDVtxZ; }
Double_t tofpSlewingCorr(const Double_t tof, const Double_t adc, const Int_t iDaqChan)
tofp TA slewing correction function
Int_t processEventYear8()
void resetPars()
Reset the calibration parameters.
Int_t initParameters(int)
Initialize the calibration parameters from dbase.
void setOuterGeometry(const bool)
switch to select the Helix Geometry
Double_t tofrAllCorr(const Double_t tof, const Double_t Tstart, const Double_t adc, const Double_t zlocal, const Int_t iDaqChan)
tofr overall correction function
Double_t GetINLcorr(const int edgeid, const int tempchan, const int bin)
Run 5 ->
Double_t tstart(const Double_t *adc, const Double_t *tdc, const Double_t Vz)
Start timing calculation function.
void tsum8(const Double_t *tot, const Double_t *time)
Run 8 ->
void initFormulas()
Initialize the formulas of calibration functions.
Double_t tofrSlewingCorr(const Double_t tof, const Double_t adc, const Int_t iDaqChan)
tofr TA slewing correction function
StTofCalibMaker(const char *name="tofCalib")
Default constructor.
Time-of-Flight Geometry Utilities.
Double_t tofpZCorr(const Double_t tof, const Double_t zlocal)
tofp loca Zhit correction function
Double_t tofpT0Corr(const Double_t tof, const Double_t Tstart, const Int_t iDaqChan)
tofp T0 calibration function
void clearFormulars()
Delete the calibration functions.
void setSlewingCorr(const bool)
switch to turn on slewing correction or not - maybe only T0 in the first step.
Double_t tofrZCorr(const Double_t tof, const Double_t zlocal)
tofr local Zhit correction function
Double_t tstart5(const Double_t *tot, const Double_t *time, const Double_t Vz)
~StTofCalibMaker()
Destructor.
Double_t tofrT0Corr(const Double_t tof, const Double_t Tstart, const Int_t iDaqChan)
tofr T0 calibration function
Double_t tofr8AllCorr(const Double_t tof, const Double_t tot, const Double_t zlocal, const Int_t iTray, const Int_t iModuleChan)
tstart calculation splitted into 2 steps in Run 8 since no primary vertex in the event ...
Double_t tofpAllCorr(const Double_t tof, const Double_t Tstart, const Double_t adc, const Double_t zlocal, const Int_t iDaqChan)
tofp overall correction function