Skip to content

Commit 50ed322

Browse files
ffiondaalibuild
andauthored
[PWGDQ] add decay length vars for MCtruth pairs to direct task (#15898)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 3fba068 commit 50ed322

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

PWGDQ/Tasks/dqEfficiency_withAssoc_direct.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <Framework/AnalysisTask.h>
4848
#include <Framework/Configurable.h>
4949
#include <Framework/InitContext.h>
50+
#include <Framework/O2DatabasePDGPlugin.h>
5051
#include <Framework/runDataProcessing.h>
5152
#include <ReconstructionDataFormats/Track.h>
5253

@@ -1151,6 +1152,8 @@ struct AnalysisSameEventPairing {
11511152
} fConfigCCDB;
11521153

11531154
Service<o2::ccdb::BasicCCDBManager> fCCDB;
1155+
// PDG database
1156+
Service<o2::framework::O2DatabasePDG> pdgDB;
11541157

11551158
HistogramManager* fHistMan;
11561159

@@ -2076,6 +2079,16 @@ struct AnalysisSameEventPairing {
20762079
mcDecision |= (static_cast<uint32_t>(1) << isig);
20772080
VarManager::FillPairMC<TPairType>(t1_raw, t2_raw);
20782081
// cout << " Filled VarManager for the pair." << endl;
2082+
// check if t1_raw and t2_raw have same mother to compute decay length related variables
2083+
if (t1_raw.has_mothers() && t2_raw.has_mothers()) {
2084+
auto motherMCParticle_t1 = t1_raw.template mothers_first_as<McParticles>();
2085+
auto motherMCParticle_t2 = t2_raw.template mothers_first_as<McParticles>();
2086+
if (motherMCParticle_t1 == motherMCParticle_t2) {
2087+
auto mcEvent = mcEvents.rawIteratorAt(motherMCParticle_t1.mcCollisionId());
2088+
std::array<double, 3> collVtxPos = {mcEvent.posX(), mcEvent.posY(), mcEvent.posZ()};
2089+
VarManager::FillTrackCollisionMC<TPairType>(motherMCParticle_t1, collVtxPos, pdgDB->Mass(motherMCParticle_t1.pdgCode()));
2090+
}
2091+
}
20792092
if (fUseMCGenAccCut) {
20802093
if (!fMCGenAccCut.IsSelected(VarManager::fgValues)) {
20812094
continue;

0 commit comments

Comments
 (0)