2222#include " DetectorsBase/GeometryManager.h"
2323#include " SimulationDataFormat/MCEventLabel.h"
2424#include " SimulationDataFormat/MCUtils.h"
25+ #include " SimulationDataFormat/MCTrack.h"
2526#include " CommonDataFormat/BunchFilling.h"
2627#include " CommonUtils/NameConf.h"
2728#include " DataFormatsFT0/RecPoints.h"
@@ -86,7 +87,7 @@ class SVStudySpec : public Task
8687 float mBz = 0 ;
8788 GTrackID::mask_t mTracksSrc {};
8889 o2::vertexing::DCAFitterN<2 > mFitterV0 ;
89- o2::steer::MCKinematicsReader mcReader; // reader of MC information
90+ std::unique_ptr< o2::steer::MCKinematicsReader> mcReader; // reader of MC information
9091};
9192
9293void SVStudySpec::init (InitContext& ic)
@@ -96,6 +97,9 @@ void SVStudySpec::init(InitContext& ic)
9697 mRefit = ic.options ().get <bool >(" refit" );
9798 mSelK0 = ic.options ().get <float >(" sel-k0" );
9899 mMaxEta = ic.options ().get <float >(" max-eta" );
100+ if (mUseMC ) {
101+ mcReader = std::make_unique<o2::steer::MCKinematicsReader>(" collisioncontext.root" );
102+ }
99103}
100104
101105void SVStudySpec::run (ProcessingContext& pc)
@@ -162,6 +166,7 @@ o2::dataformats::V0Ext SVStudySpec::processV0(int iv, o2::globaltracking::RecoCo
162166 }
163167 v0ext.v0ID = v0id;
164168 o2::MCCompLabel lb;
169+ const o2::MCTrack* mcTrks[2 ];
165170 for (int ip = 0 ; ip < 2 ; ip++) {
166171 auto & prInfo = v0ext.prInfo [ip];
167172 auto gid = v0ext.v0ID .getProngID (ip);
@@ -218,6 +223,16 @@ o2::dataformats::V0Ext SVStudySpec::processV0(int iv, o2::globaltracking::RecoCo
218223 }
219224 }
220225 }
226+ if (mUseMC ) { // temp store of mctrks
227+ mcTrks[ip] = mcReader->getTrack (lb);
228+ }
229+ }
230+ if (mUseMC && (mcTrks[0 ] != nullptr ) && (mcTrks[1 ] != nullptr )) {
231+ // check majority vote on mother particle otherwise leave pdg -1
232+ if (mcTrks[0 ]->getMotherTrackId () == mcTrks[1 ]->getMotherTrackId ()) {
233+ const auto mother = mcReader->getTrack (lb.getSourceID (), lb.getEventID (), mcTrks[0 ]->getMotherTrackId ());
234+ v0ext.mcPID = mother->GetPdgCode ();
235+ }
221236 }
222237 return v0ext;
223238}
0 commit comments