@@ -1052,6 +1052,61 @@ struct nucleiSpectra {
10521052 }
10531053
10541054 PROCESS_SWITCH (nucleiSpectra, processMatching, " Matching analysis" , false );
1055+
1056+ void processMCasData (soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels> const & collisions, aod::McCollisions const & mcCollisions, soa::Join<TrackCandidates, aod::McTrackLabels> const & tracks, aod::McParticles const & particlesMC, aod::BCsWithTimestamps const &)
1057+ {
1058+ nuclei::candidates.clear ();
1059+ std::vector<bool > goodCollisions (mcCollisions.size (), false );
1060+ for (auto & collision : collisions) {
1061+ if (!eventSelection (collision)) {
1062+ continue ;
1063+ }
1064+ goodCollisions[collision.mcCollisionId ()] = true ;
1065+ const auto & slicedTracks = tracks.sliceBy (tracksPerCollisions, collision.globalIndex ());
1066+ fillDataInfo (collision, slicedTracks);
1067+ }
1068+ std::vector<bool > isReconstructed (particlesMC.size (), false );
1069+ for (size_t i{0 }; i < nuclei::candidates.size (); ++i) {
1070+ auto & c = nuclei::candidates[i];
1071+ if (c.fillTree ) {
1072+ auto label = tracks.iteratorAt (c.globalIndex );
1073+ if (label.mcParticleId () < -1 || label.mcParticleId () >= particlesMC.size ()) {
1074+ continue ;
1075+ }
1076+ auto particle = particlesMC.iteratorAt (label.mcParticleId ());
1077+ int motherPdgCode = 0 ;
1078+ float motherDecRadius = -1 ;
1079+ isReconstructed[particle.globalIndex ()] = true ;
1080+ if (particle.isPhysicalPrimary ()) {
1081+ c.flags |= kIsPhysicalPrimary ;
1082+ if (particle.has_mothers ()) {
1083+ for (auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
1084+ if (std::find (nuclei::hfMothCodes.begin (), nuclei::hfMothCodes.end (), std::abs (motherparticle.pdgCode ())) != nuclei::hfMothCodes.end ()) {
1085+ c.flags |= kIsSecondaryFromWeakDecay ;
1086+ motherPdgCode = motherparticle.pdgCode ();
1087+ motherDecRadius = std::hypot (particle.vx () - motherparticle.vx (), particle.vy () - motherparticle.vy ());
1088+ break ;
1089+ }
1090+ }
1091+ }
1092+ } else if (particle.has_mothers ()) {
1093+ c.flags |= kIsSecondaryFromWeakDecay ;
1094+ for (auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
1095+ motherPdgCode = motherparticle.pdgCode ();
1096+ motherDecRadius = std::hypot (particle.vx () - motherparticle.vx (), particle.vy () - motherparticle.vy ());
1097+ }
1098+ } else {
1099+ c.flags |= kIsSecondaryFromMaterial ;
1100+ }
1101+
1102+ isReconstructed[particle.globalIndex ()] = true ;
1103+ float absoDecL = computeAbsoDecL (particle);
1104+
1105+ nucleiTableMC (c.pt , c.eta , c.phi , c.tpcInnerParam , c.beta , c.zVertex , c.nContrib , c.DCAxy , c.DCAz , c.TPCsignal , c.ITSchi2 , c.TPCchi2 , c.TOFchi2 , c.flags , c.TPCfindableCls , c.TPCcrossedRows , c.ITSclsMap , c.TPCnCls , c.TPCnClsShared , c.clusterSizesITS , goodCollisions[particle.mcCollisionId ()], particle.pt (), particle.eta (), particle.phi (), particle.pdgCode (), motherPdgCode, motherDecRadius, absoDecL);
1106+ }
1107+ }
1108+ }
1109+ PROCESS_SWITCH (nucleiSpectra, processMCasData, " MC as data analysis" , false );
10551110};
10561111
10571112WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments