|
42 | 42 | #include <DataFormatsParameters/GRPMagField.h> |
43 | 43 | #include <DetectorsBase/GeometryManager.h> |
44 | 44 | #include <DetectorsBase/Propagator.h> |
45 | | -#include <ReconstructionDataFormats/HelixHelper.h> |
46 | 45 | #include <Framework/ASoAHelpers.h> |
47 | 46 | #include <Framework/AnalysisDataModel.h> |
48 | 47 | #include <Framework/AnalysisTask.h> |
|
51 | 50 | #include <Framework/RunningWorkflowInfo.h> |
52 | 51 | #include <Framework/runDataProcessing.h> |
53 | 52 | #include <ReconstructionDataFormats/DCA.h> |
| 53 | +#include <ReconstructionDataFormats/HelixHelper.h> |
54 | 54 |
|
55 | 55 | #include <TEfficiency.h> |
56 | 56 | #include <THashList.h> |
@@ -93,6 +93,12 @@ struct OnTheFlyTofPid { |
93 | 93 | Configurable<bool> considerEventTime{"considerEventTime", true, "flag to consider event time"}; |
94 | 94 | Configurable<float> innerTOFRadius{"innerTOFRadius", 20, "barrel inner TOF radius (cm)"}; |
95 | 95 | 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"}; |
96 | 102 | Configurable<float> innerTOFTimeReso{"innerTOFTimeReso", 20, "barrel inner TOF time error (ps)"}; |
97 | 103 | Configurable<float> outerTOFTimeReso{"outerTOFTimeReso", 20, "barrel outer TOF time error (ps)"}; |
98 | 104 | Configurable<int> nStepsLIntegrator{"nStepsLIntegrator", 200, "number of steps in length integrator"}; |
@@ -244,6 +250,86 @@ struct OnTheFlyTofPid { |
244 | 250 | } |
245 | 251 | } |
246 | 252 |
|
| 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 | + |
247 | 333 | /// function to calculate track length of this track up to a certain radius |
248 | 334 | /// \param track the input track |
249 | 335 | /// \param radius the radius of the layer you're calculating the length to |
@@ -298,9 +384,28 @@ struct OnTheFlyTofPid { |
298 | 384 | if (scalarProduct1 > scalarProduct2) { |
299 | 385 | modulus = std::hypot(point1[0] - trcCircle.xC, point1[1] - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); |
300 | 386 | 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 | + |
301 | 397 | } else { |
302 | 398 | modulus = std::hypot(point2[0] - trcCircle.xC, point2[1] - trcCircle.yC) * std::hypot(startPoint[0] - trcCircle.xC, startPoint[1] - trcCircle.yC); |
303 | 399 | 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 | + } |
304 | 409 | } |
305 | 410 | cosAngle /= modulus; |
306 | 411 | length = trcCircle.rC * std::acos(cosAngle); |
|
0 commit comments