@@ -53,6 +53,7 @@ struct JetDerivedDataWriter {
5353 Configurable<bool > performTrackSelection{" performTrackSelection" , true , " only save tracks that pass one of the track selections" };
5454 Configurable<float > trackPtSelectionMin{" trackPtSelectionMin" , 0.15 , " only save tracks that have a pT larger than this pT" };
5555 Configurable<float > trackEtaSelectionMax{" trackEtaSelectionMax" , 0.9 , " only save tracks that have an eta smaller than this eta" };
56+ Configurable<bool > savePartonLevelInfo{" savePartonLevelInfo" , true , " save parton level info at MCP level" };
5657
5758 Configurable<std::string> triggerMasks{" triggerMasks" , " " , " possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL" };
5859 } config;
@@ -665,21 +666,27 @@ struct JetDerivedDataWriter {
665666 for (auto particle : particlesPerMcCollision) {
666667
667668 std::vector<int32_t > mothersIds;
668- if (particle.has_mothers ()) {
669- auto mothersIdTemps = particle.mothersIds ();
670- for (auto mothersIdTemp : mothersIdTemps) {
671- mothersIds.push_back (particleMapping[mothersIdTemp]);
672- }
673- }
674669 int daughtersIds[2 ] = {-1 , -1 };
675- if (particle.has_daughters ()) {
676- auto i = 0 ;
677- for (auto daughterId : particle.daughtersIds ()) {
678- if (i > 1 ) {
679- break ;
670+ if (config.savePartonLevelInfo ) {
671+ if (particle.has_mothers ()) {
672+ auto mothersIdTemps = particle.mothersIds ();
673+ for (auto mothersIdTemp : mothersIdTemps) {
674+ mothersIds.push_back (particleMapping[mothersIdTemp]);
675+ }
676+ }
677+ if (particle.has_daughters ()) {
678+ auto i = 0 ;
679+ for (auto daughterId : particle.daughtersIds ()) {
680+ if (i > 1 ) {
681+ break ;
682+ }
683+ daughtersIds[i] = particleMapping[daughterId];
684+ i++;
680685 }
681- daughtersIds[i] = particleMapping[daughterId];
682- i++;
686+ }
687+ } else {
688+ if (!particle.isPhysicalPrimary ()) { // add outgoing partons exclusion here later
689+ continue ;
683690 }
684691 }
685692 products.storedJMcParticlesTable (mcCollisionMapping[mcCollision.globalIndex ()], o2::math_utils::detail::truncateFloatFraction (particle.pt (), precisionMomentumMask), o2::math_utils::detail::truncateFloatFraction (particle.eta (), precisionPositionMask), o2::math_utils::detail::truncateFloatFraction (particle.phi (), precisionPositionMask), o2::math_utils::detail::truncateFloatFraction (particle.y (), precisionPositionMask), o2::math_utils::detail::truncateFloatFraction (particle.e (), precisionMomentumMask), particle.pdgCode (), particle.statusCode (), particle.flags (), mothersIds, daughtersIds);
@@ -909,14 +916,14 @@ struct JetDerivedDataWriter {
909916 }
910917 PROCESS_SWITCH (JetDerivedDataWriter, processColllisonsMcCollisionLabel, " write out collision mcCollision label output tables" , false );
911918
912- void processTracksMcParticleLabel (soa::Join<aod::JCollisions, aod::JCollisionSelections>::iterator const & collision, soa::Join<aod::JTracks, aod::JMcTrackLbs> const & tracks)
919+ void processTracksMcParticleLabel (soa::Join<aod::JCollisions, aod::JCollisionSelections>::iterator const & collision, soa::Join<aod::JTracks, aod::JMcTrackLbs> const & tracks, aod::JMcParticles const & )
913920 {
914921 if (collision.isCollisionSelected ()) {
915922 for (const auto & track : tracks) {
916923 if (!trackSelection (track)) {
917924 continue ;
918925 }
919- if (track.has_mcParticle ()) {
926+ if (track.has_mcParticle () && (config. savePartonLevelInfo || track. mcParticle (). isPhysicalPrimary ()) ) {
920927 products.storedJMcTracksLabelTable (particleMapping[track.mcParticleId ()]);
921928 } else {
922929 products.storedJMcTracksLabelTable (-1 );
@@ -926,12 +933,18 @@ struct JetDerivedDataWriter {
926933 }
927934 PROCESS_SWITCH (JetDerivedDataWriter, processTracksMcParticleLabel, " write out track mcParticle label output tables" , false );
928935
929- void processClusterMcLabel (soa::Join<aod::JCollisions, aod::JCollisionSelections>::iterator const & collision, soa::Join<aod::JClusters, aod::JMcClusterLbs> const & clusters)
936+ void processClusterMcLabel (soa::Join<aod::JCollisions, aod::JCollisionSelections>::iterator const & collision, soa::Join<aod::JClusters, aod::JMcClusterLbs> const & clusters, aod::JMcParticles const & particles )
930937 {
931938 if (collision.isCollisionSelected ()) {
932939 for (const auto & cluster : clusters) {
933940 std::vector<int32_t > clusterStoredJParticleIDs;
934941 for (const auto & clusterParticleId : cluster.mcParticlesIds ()) {
942+ if (!config.savePartonLevelInfo ) {
943+ const auto & particle = particles.iteratorAt (clusterParticleId);
944+ if (!particle.isPhysicalPrimary ()) {
945+ continue ;
946+ }
947+ }
935948 clusterStoredJParticleIDs.push_back (particleMapping[clusterParticleId]);
936949 }
937950 std::vector<float > amplitudeA;
0 commit comments