Skip to content

Commit d97113d

Browse files
noferinisawenzel
authored andcommitted
finalizing tool to test TOF digitizer
1 parent 1561ebb commit d97113d

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

Detectors/TOF/simulation/include/TOFSimulation/Digitizer.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@ class Digitizer : public WindowFiller
6161
Float_t getEffZ(Float_t z);
6262
Float_t getFractionOfCharge(Float_t x, Float_t z);
6363

64-
Float_t getTimeLastHit(Int_t idigit) const { return 0; }
65-
Float_t getTotLastHit(Int_t idigit) const { return 0; }
66-
Int_t getXshift(Int_t idigit) const { return 0; }
67-
Int_t getZshift(Int_t idigit) const { return 0; }
64+
Float_t getTimeLastHit(Int_t idigit) const { return mTimeLastHit[idigit]; }
65+
Float_t getTotLastHit(Int_t idigit) const { return mTotLastHit[idigit]; }
66+
Int_t getXshift(Int_t idigit) const { return mXLastShift[idigit]; }
67+
Int_t getZshift(Int_t idigit) const { return mZLastShift[idigit]; }
6868
void setEventID(Int_t id) { mEventID = id; }
6969
void setSrcID(Int_t id) { mSrcID = id; }
7070

71+
void runFullTestExample(const char* geo = "");
7172
void test(const char* geo = "");
7273
void testFromHits(const char* geo = "", const char* hits = "AliceO2_TGeant3.tof.mc_10_event.root");
7374

@@ -134,6 +135,11 @@ class Digitizer : public WindowFiller
134135

135136
void checkIfReuseFutureDigits();
136137

138+
int mNLastHit = 0;
139+
float mTimeLastHit[10];
140+
float mTotLastHit[10];
141+
Int_t mXLastShift[10];
142+
Int_t mZLastShift[10];
137143
ClassDefNV(Digitizer, 1);
138144
};
139145
} // namespace tof

Detectors/TOF/simulation/src/Digitizer.cxx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ int Digitizer::process(const std::vector<HitType>* hits, std::vector<Digit>* dig
128128

129129
Int_t Digitizer::processHit(const HitType& hit, Double_t event_time)
130130
{
131+
mNLastHit = 0;
132+
131133
Float_t pos[3] = {hit.GetX(), hit.GetY(), hit.GetZ()};
132134
Float_t deltapos[3];
133135
Int_t detInd[5];
@@ -169,6 +171,8 @@ Int_t Digitizer::processHit(const HitType& hit, Double_t event_time)
169171
// check the fired PAD 1 (A)
170172
if (isFired(xLocal, zLocal, charge)) {
171173
ndigits++;
174+
mXLastShift[mNLastHit] = 0;
175+
mZLastShift[mNLastHit] = 0;
172176
addDigit(channel, istrip, time, xLocal, zLocal, charge, 0, 0, detInd[3], trackID);
173177
}
174178

@@ -184,6 +188,8 @@ Int_t Digitizer::processHit(const HitType& hit, Double_t event_time)
184188
}
185189
if (isFired(xLocal, zLocal, charge)) {
186190
ndigits++;
191+
mXLastShift[mNLastHit] = 0;
192+
mZLastShift[mNLastHit] = iZshift;
187193
addDigit(channel, istrip, time, xLocal, zLocal, charge, 0, iZshift, detInd[3], trackID);
188194
}
189195

@@ -196,6 +202,8 @@ Int_t Digitizer::processHit(const HitType& hit, Double_t event_time)
196202
zLocal = deltapos[2]; // recompute local coordinates
197203
if (isFired(xLocal, zLocal, charge)) {
198204
ndigits++;
205+
mXLastShift[mNLastHit] = -1;
206+
mZLastShift[mNLastHit] = 0;
199207
addDigit(channel, istrip, time, xLocal, zLocal, charge, -1, 0, detInd[3], trackID);
200208
}
201209
}
@@ -209,6 +217,8 @@ Int_t Digitizer::processHit(const HitType& hit, Double_t event_time)
209217
zLocal = deltapos[2]; // recompute local coordinates
210218
if (isFired(xLocal, zLocal, charge)) {
211219
ndigits++;
220+
mXLastShift[mNLastHit] = 1;
221+
mZLastShift[mNLastHit] = 0;
212222
addDigit(channel, istrip, time, xLocal, zLocal, charge, 1, 0, detInd[3], trackID);
213223
}
214224
}
@@ -226,6 +236,8 @@ Int_t Digitizer::processHit(const HitType& hit, Double_t event_time)
226236
}
227237
if (isFired(xLocal, zLocal, charge)) {
228238
ndigits++;
239+
mXLastShift[mNLastHit] = -1;
240+
mZLastShift[mNLastHit] = iZshift;
229241
addDigit(channel, istrip, time, xLocal, zLocal, charge, -1, iZshift, detInd[3], trackID);
230242
}
231243
}
@@ -243,6 +255,8 @@ Int_t Digitizer::processHit(const HitType& hit, Double_t event_time)
243255
}
244256
if (isFired(xLocal, zLocal, charge)) {
245257
ndigits++;
258+
mXLastShift[mNLastHit] = 1;
259+
mZLastShift[mNLastHit] = iZshift;
246260
addDigit(channel, istrip, time, xLocal, zLocal, charge, 1, iZshift, detInd[3], trackID);
247261
}
248262
}
@@ -297,6 +311,11 @@ void Digitizer::addDigit(Int_t channel, UInt_t istrip, Double_t time, Float_t x,
297311
LOG(error) << "Wrong de-calibration correction for ch = " << channel << ", tot = " << tot << " (Skip it)";
298312
return;
299313
}
314+
315+
mTimeLastHit[mNLastHit] = time;
316+
mTotLastHit[mNLastHit] = tot;
317+
mNLastHit++;
318+
300319
time -= tsCorr; // TODO: to be checked that "-" is correct, and we did not need "+" instead :-)
301320

302321
// let's move from time to bc, tdc
@@ -590,7 +609,17 @@ void Digitizer::printParameters()
590609
printf("Time walk ON = %f ps/cm\n", mTimeWalkeSlope);
591610
}
592611
}
593-
612+
//______________________________________________________________________
613+
void Digitizer::runFullTestExample(const char* geo)
614+
{
615+
initParameters();
616+
o2::tof::CalibTOFapi* api = new o2::tof::CalibTOFapi();
617+
api->setTimeStamp(0);
618+
api->readLHCphase();
619+
api->readTimeSlewingParam();
620+
setCalibApi(api);
621+
test(geo);
622+
}
594623
//______________________________________________________________________
595624
void Digitizer::test(const char* geo)
596625
{
@@ -696,7 +725,8 @@ void Digitizer::test(const char* geo)
696725

697726
hit->SetEnergyLoss(0.0001);
698727

699-
Int_t ndigits = processHit(*hit, mEventTime.getTimeOffsetWrtBC());
728+
processHit(*hit, mEventTime.getTimeOffsetWrtBC());
729+
Int_t ndigits = mNLastHit;
700730

701731
h3->Fill(ndigits);
702732
hpadAll->Fill(xlocal, zlocal);

0 commit comments

Comments
 (0)