Skip to content

Commit 9ce92df

Browse files
committed
MC HMPID table changes
1 parent 24fa5eb commit 9ce92df

2 files changed

Lines changed: 49 additions & 21 deletions

File tree

DPG/Tasks/AOTTrack/PID/HMPID/hmpidTableProducer.cxx

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,8 @@
2424
#include <DetectorsBase/MatLayerCylSet.h>
2525
#include <DetectorsBase/Propagator.h>
2626
#include <Framework/AnalysisDataModel.h>
27-
#include <Framework/AnalysisHelpers.h>
2827
#include <Framework/AnalysisTask.h>
29-
#include <Framework/Configurable.h>
3028
#include <Framework/HistogramRegistry.h>
31-
#include <Framework/HistogramSpec.h>
32-
#include <Framework/InitContext.h>
33-
#include <Framework/OutputObjHeader.h>
3429
#include <Framework/runDataProcessing.h>
3530

3631
#include <TGeoManager.h>
@@ -72,6 +67,10 @@ struct HmpidTableProducer {
7267
Configurable<bool> requireTPC{"requireTPC", true, "Require TPC track"};
7368
Configurable<bool> requireTOF{"requireTOF", true, "Require TOF track"};
7469

70+
// Absorbers position
71+
Configurable<float> absorberEdgeRich2{"absorberEdgeRich2", 435.5f, "Raggio esterno (bordo) del target Al davanti a rich2 [cm]"};
72+
Configurable<float> absorberEdgeRich4{"absorberEdgeRich4", 435.0f, "Raggio esterno (bordo) del target Al davanti a rich4 [cm]"};
73+
7574
using CollisionCandidates = o2::soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFV0As>;
7675

7776
using TrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra,
@@ -91,6 +90,10 @@ struct HmpidTableProducer {
9190

9291
std::unordered_set<uint32_t> mCollisionsWithHmpid;
9392

93+
const int rich2 = 2, rich4 = 4;
94+
const float kRich2AbsorberThickness = 4.0f;
95+
const float kRich4AbsorberThickness = 8.0f;
96+
9497
void init(o2::framework::InitContext&)
9598
{
9699
ccdb->setURL(ccdbConfig.ccdbUrl);
@@ -305,14 +308,15 @@ struct HmpidTableProducer {
305308
}
306309
PROCESS_SWITCH(HmpidTableProducer, processEvent, "Process event level", true);
307310

308-
template <bool isMC, typename TTrackTable>
311+
template <bool isMC, typename TTrackTable, typename TMcParticles = int>
309312
void runHmpidAnalysis(
310313
aod::HMPIDs const& hmpids,
311314
TTrackTable const&,
312315
CollisionCandidates const&,
313-
aod::BCsWithTimestamps const&)
316+
aod::BCsWithTimestamps const&,
317+
TMcParticles const& mcParticles = 0)
314318
{
315-
for (auto const& t : hmpids) {
319+
for (auto const& t : hmpids) { // begin loop over hmpids
316320

317321
const auto& globalTrack = t.template track_as<TTrackTable>();
318322

@@ -366,17 +370,17 @@ struct HmpidTableProducer {
366370

367371
histos.fill(HIST("hChamberM1"), chamberM1);
368372

369-
if (!isCorrupt) {
373+
if (!isCorrupt) { // begin if(!isCorrupt) - fill M1vsM2
370374
histos.fill(HIST("hChamberM1vsM2"), chamberM2, chamberM1);
371-
}
375+
} // end if(!isCorrupt) - fill M1vsM2
372376

373377
// --- M3: hybrid ---
374378
int chamberM3 = -1;
375-
if (!isCorrupt) {
379+
if (!isCorrupt) { // begin if/else - M3 assignment
376380
chamberM3 = chamberM2;
377381
} else {
378382
chamberM3 = chamberM1;
379-
}
383+
} // end if/else - M3 assignment
380384

381385
// Legend:
382386
// bin 0 = clusSize > 0, chamber found (M2 ok)
@@ -400,8 +404,9 @@ struct HmpidTableProducer {
400404
continue;
401405

402406
float hmpidPhotsCharge2[o2::aod::kDimPhotonsCharge];
403-
for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++)
407+
for (int i = 0; i < o2::aod::kDimPhotonsCharge; i++) // begin for - copy photon charges
404408
hmpidPhotsCharge2[i] = t.hmpidPhotsCharge()[i];
409+
// end for - copy photon charges
405410

406411
// fill hmpid table
407412
hmpidAnalysis(
@@ -427,14 +432,35 @@ struct HmpidTableProducer {
427432
if constexpr (isMC) {
428433
if (globalTrack.has_mcParticle()) {
429434
const auto& mc = globalTrack.mcParticle();
430-
hmpidAnalysisMC(mc.pdgCode(), mc.vx(), mc.vy(), mc.vz(), mc.isPhysicalPrimary(), mc.getProcess());
435+
436+
bool interactionInAbsorber = false;
437+
438+
if (mc.has_daughters()) {
439+
auto dIds = mc.daughtersIds();
440+
for (int32_t idx = dIds.front(); idx <= dIds.back(); ++idx) {
441+
auto daughter = mcParticles.rawIteratorAt(idx);
442+
double r = std::hypot(daughter.vx(), daughter.vy());
443+
444+
if (chamberM3 == rich2 && r >= absorberEdgeRich2 - kRich2AbsorberThickness && r <= absorberEdgeRich2) {
445+
interactionInAbsorber = true;
446+
break;
447+
}
448+
if (chamberM3 == rich4 && r >= absorberEdgeRich4 - kRich4AbsorberThickness && r <= absorberEdgeRich4) {
449+
interactionInAbsorber = true;
450+
break;
451+
}
452+
} // end loop daughters
453+
} // end if has_daughters
454+
455+
hmpidAnalysisMC(mc.pdgCode(), mc.vx(), mc.vy(), mc.vz(),
456+
mc.isPhysicalPrimary(), mc.getProcess(), interactionInAbsorber);
431457
} else {
432-
hmpidAnalysisMC(-1, 0.f, 0.f, 0.f, false, -100);
458+
hmpidAnalysisMC(-1, 0.f, 0.f, 0.f, false, -100, false);
433459
}
434-
}
460+
} // end if constexpr (isMC)
435461

436-
} // end HMPID loop
437-
}
462+
} // end for - loop over hmpids
463+
} // end runHmpidAnalysis
438464

439465
// process real data
440466
void processHmpid(aod::HMPIDs const& hmpids,
@@ -452,9 +478,9 @@ struct HmpidTableProducer {
452478
TrackCandidatesMC const& tracks,
453479
CollisionCandidates const& cols,
454480
aod::BCsWithTimestamps const& bcs,
455-
aod::McParticles const&)
481+
aod::McParticles const& mcParticles)
456482
{
457-
runHmpidAnalysis<true>(hmpids, tracks, cols, bcs);
483+
runHmpidAnalysis<true>(hmpids, tracks, cols, bcs, mcParticles);
458484
}
459485
PROCESS_SWITCH(HmpidTableProducer, processHmpidMC, "Process HMPID MC entries", true);
460486
};

DPG/Tasks/AOTTrack/PID/HMPID/tableHMPID.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ DECLARE_SOA_COLUMN(McVy, mcVy, float);
103103
DECLARE_SOA_COLUMN(McVz, mcVz, float);
104104
DECLARE_SOA_COLUMN(IsPhysPrimary, isPhysPrimary, bool);
105105
DECLARE_SOA_COLUMN(ProcessCode, processCode, int);
106+
DECLARE_SOA_COLUMN(HasInteractedInAbsorber, hasInteractedInAbsorber, bool);
106107

107108
} // namespace hmpid_mc
108109

@@ -112,7 +113,8 @@ DECLARE_SOA_TABLE(HmpidAnalysisMC, "AOD", "HMPIDANALYSISMC",
112113
hmpid_mc::McVy,
113114
hmpid_mc::McVz,
114115
hmpid_mc::IsPhysPrimary,
115-
hmpid_mc::ProcessCode);
116+
hmpid_mc::ProcessCode,
117+
hmpid_mc::HasInteractedInAbsorber);
116118

117119
} // namespace o2::aod
118120

0 commit comments

Comments
 (0)