Skip to content

Commit 24fe594

Browse files
committed
TOF: Add dead chip area to TOF sim
1 parent 475dab0 commit 24fe594

File tree

1 file changed

+106
-1
lines changed

1 file changed

+106
-1
lines changed

ALICE3/TableProducer/OTF/onTheFlyTofPid.cxx

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#include <DataFormatsParameters/GRPMagField.h>
4343
#include <DetectorsBase/GeometryManager.h>
4444
#include <DetectorsBase/Propagator.h>
45-
#include <ReconstructionDataFormats/HelixHelper.h>
4645
#include <Framework/ASoAHelpers.h>
4746
#include <Framework/AnalysisDataModel.h>
4847
#include <Framework/AnalysisTask.h>
@@ -51,6 +50,7 @@
5150
#include <Framework/RunningWorkflowInfo.h>
5251
#include <Framework/runDataProcessing.h>
5352
#include <ReconstructionDataFormats/DCA.h>
53+
#include <ReconstructionDataFormats/HelixHelper.h>
5454

5555
#include <TEfficiency.h>
5656
#include <THashList.h>
@@ -93,6 +93,12 @@ struct OnTheFlyTofPid {
9393
Configurable<bool> considerEventTime{"considerEventTime", true, "flag to consider event time"};
9494
Configurable<float> innerTOFRadius{"innerTOFRadius", 20, "barrel inner TOF radius (cm)"};
9595
Configurable<float> outerTOFRadius{"outerTOFRadius", 80, "barrel outer TOF radius (cm)"};
96+
Configurable<float> innerTOFLength{"innerTOFLength", 124, "barrel inner TOF length (cm)"};
97+
Configurable<float> outerTOFLength{"outerTOFLength", 250, "barrel outer TOF length (cm)"};
98+
Configurable<float> innerTOFPixelArea{"innerTOFPixelArea", 1.0, "barrel inner TOF pixel area (mm^2)"};
99+
Configurable<float> innerTOFFractionOfInactiveArea{"innerTOFFractionOfInactiveArea", 2.f, "barrel inner TOF fraction of inactive area"};
100+
Configurable<float> outerTOFPixelArea{"outerTOFPixelArea", 25.0, "barrel outer TOF pixel area (mm^2)"};
101+
Configurable<float> outerTOFFractionOfInactiveArea{"outerTOFFractionOfInactiveArea", 2.f, "barrel outer TOF fraction of inactive area"};
96102
Configurable<float> innerTOFTimeReso{"innerTOFTimeReso", 20, "barrel inner TOF time error (ps)"};
97103
Configurable<float> outerTOFTimeReso{"outerTOFTimeReso", 20, "barrel outer TOF time error (ps)"};
98104
Configurable<int> nStepsLIntegrator{"nStepsLIntegrator", 200, "number of steps in length integrator"};
@@ -244,6 +250,86 @@ struct OnTheFlyTofPid {
244250
}
245251
}
246252

253+
bool isTrackInActiveAreaOfInnerTOF(const float hitRphi, const float hitZ)
254+
{
255+
256+
// First we compute the fraction of active area (at the first call of the function)
257+
if (simConfig.innerTOFFractionOfInactiveArea.value >= 1.f) {
258+
return true; // no inefficiency
259+
}
260+
static bool firstCall = true;
261+
static float totalArea = 0.f;
262+
static int chipsInRphi = 0;
263+
static int chipsInZ = 0;
264+
static float chipSizeRphi = 0.f;
265+
static float chipSizeZ = 0.f;
266+
static float chipInactiveSkinRphi = 0.f;
267+
static float chipInactiveSkinZ = 0.f;
268+
if (firstCall) {
269+
firstCall = false;
270+
totalArea = o2::constants::math::TwoPI * simConfig.innerTOFRadius.value * simConfig.innerTOFLength.value; // total cylindrical area
271+
totalArea *= (1.f - simConfig.innerTOFFractionOfInactiveArea.value);
272+
// For now we assume square chips
273+
chipSizeRphi = std::sqrt(simConfig.innerTOFPixelArea.value);
274+
chipSizeZ = chipSizeRphi;
275+
chipsInRphi = static_cast<int>(o2::constants::math::TwoPI * simConfig.innerTOFRadius.value / chipSizeRphi);
276+
chipsInZ = static_cast<int>(simConfig.innerTOFLength.value / chipSizeZ);
277+
}
278+
// Now we check if the track fell in the active area or not
279+
int chipIdRphi = hitRphi / chipSizeRphi;
280+
int chipIdZ = (hitZ + simConfig.innerTOFLength.value / 2) / chipSizeZ;
281+
282+
// Now compute the position of the track in the chip local frame
283+
float localPosRphi = hitRphi - (chipIdRphi * chipSizeRphi);
284+
float localPosZ = (hitZ + simConfig.innerTOFLength.value / 2) - (chipIdZ * chipSizeZ);
285+
286+
if (localPosRphi < chipInactiveSkinRphi || localPosRphi > (chipSizeRphi - chipInactiveSkinRphi) ||
287+
localPosZ < chipInactiveSkinZ || localPosZ > (chipSizeZ - chipInactiveSkinZ)) {
288+
return false; // track in inactive area
289+
}
290+
return true;
291+
}
292+
293+
bool isTrackInActiveAreaOfOuterTOF(const float hitRphi, const float hitZ)
294+
{
295+
296+
// First we compute the fraction of active area (at the first call of the function)
297+
if (simConfig.outerTOFFractionOfInactiveArea.value >= 1.f) {
298+
return true; // no inefficiency
299+
}
300+
static bool firstCall = true;
301+
static float totalArea = 0.f;
302+
static int chipsInRphi = 0;
303+
static int chipsInZ = 0;
304+
static float chipSizeRphi = 0.f;
305+
static float chipSizeZ = 0.f;
306+
static float chipInactiveSkinRphi = 0.f;
307+
static float chipInactiveSkinZ = 0.f;
308+
if (firstCall) {
309+
firstCall = false;
310+
totalArea = o2::constants::math::TwoPI * simConfig.outerTOFRadius.value * simConfig.outerTOFLength.value; // total cylindrical area
311+
totalArea *= (1.f - simConfig.outerTOFFractionOfInactiveArea.value);
312+
// For now we assume square chips
313+
chipSizeRphi = std::sqrt(simConfig.outerTOFPixelArea.value);
314+
chipSizeZ = chipSizeRphi;
315+
chipsInRphi = static_cast<int>(o2::constants::math::TwoPI * simConfig.outerTOFRadius.value / chipSizeRphi);
316+
chipsInZ = static_cast<int>(simConfig.outerTOFLength.value / chipSizeZ);
317+
}
318+
// Now we check if the track fell in the active area or not
319+
int chipIdRphi = hitRphi / chipSizeRphi;
320+
int chipIdZ = (hitZ + simConfig.outerTOFLength.value / 2) / chipSizeZ;
321+
322+
// Now compute the position of the track in the chip local frame
323+
float localPosRphi = hitRphi - (chipIdRphi * chipSizeRphi);
324+
float localPosZ = (hitZ + simConfig.outerTOFLength.value / 2) - (chipIdZ * chipSizeZ);
325+
326+
if (localPosRphi < chipInactiveSkinRphi || localPosRphi > (chipSizeRphi - chipInactiveSkinRphi) ||
327+
localPosZ < chipInactiveSkinZ || localPosZ > (chipSizeZ - chipInactiveSkinZ)) {
328+
return false; // track in inactive area
329+
}
330+
return true;
331+
}
332+
247333
/// function to calculate track length of this track up to a certain radius
248334
/// \param track the input track
249335
/// \param radius the radius of the layer you're calculating the length to
@@ -298,9 +384,28 @@ struct OnTheFlyTofPid {
298384
if (scalarProduct1 > scalarProduct2) {
299385
modulus = std::hypot(point1[0] - trcCircle.xC, point1[1] - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC);
300386
cosAngle = (point1[0] - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (point1[1] - trcCircle.yC) * (startPoint[1] - trcCircle.yC);
387+
if (abs(radius - simConfig.innerTOFRadius.value) < o2::constants::math::Epsilon) {
388+
if (!isTrackInActiveAreaOfInnerTOF(point1[0], point1[1])) {
389+
return 0.f; // track in inactive area
390+
}
391+
} else {
392+
if (!isTrackInActiveAreaOfOuterTOF(point1[0], point1[1])) {
393+
return 0.f; // track in inactive area
394+
}
395+
}
396+
301397
} else {
302398
modulus = std::hypot(point2[0] - trcCircle.xC, point2[1] - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC);
303399
cosAngle = (point2[0] - trcCircle.xC) * (startPoint[0] - trcCircle.xC) + (point2[1] - trcCircle.yC) * (startPoint[1] - trcCircle.yC);
400+
if (abs(radius - simConfig.innerTOFRadius.value) < o2::constants::math::Epsilon) {
401+
if (!isTrackInActiveAreaOfInnerTOF(point2[0], point2[1])) {
402+
return 0.f; // track in inactive area
403+
}
404+
} else {
405+
if (!isTrackInActiveAreaOfOuterTOF(point2[0], point2[1])) {
406+
return 0.f; // track in inactive area
407+
}
408+
}
304409
}
305410
cosAngle /= modulus;
306411
length = trcCircle.rC * std::acos(cosAngle);

0 commit comments

Comments
 (0)