Skip to content

Commit a9221be

Browse files
committed
add decay length vars for MCtruth pairs to direct task
1 parent 14c315d commit a9221be

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
@@ -49,6 +49,7 @@
4949
#include <Framework/InitContext.h>
5050
#include <Framework/runDataProcessing.h>
5151
#include <ReconstructionDataFormats/Track.h>
52+
#include <Framework/O2DatabasePDGPlugin.h>
5253

5354
#include <THashList.h>
5455
#include <TList.h>
@@ -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)