@@ -104,6 +104,7 @@ struct skimmerPrimaryElectron {
104104 Configurable<float > maxpt_itssa{" maxpt_itssa" , 0.15 , " max pt for ITSsa track" };
105105 Configurable<float > maxMeanITSClusterSize{" maxMeanITSClusterSize" , 16 , " max <ITS cluster size> x cos(lambda)" };
106106 Configurable<bool > storeOnlyTrueElectronMC{" storeOnlyTrueElectronMC" , false , " Flag to store only true electron in MC" };
107+ Configurable<int > minNelectron{" minNelectron" , 1 , " min number of electron candidates per collision" };
107108
108109 // configuration for PID ML
109110 Configurable<bool > usePIDML{" usePIDML" , false , " Flag to use PID ML" };
@@ -176,6 +177,7 @@ struct skimmerPrimaryElectron {
176177 fRegistry .add (" Track/hMeanClusterSizeITSib" , " mean cluster size ITSib;p_{pv} (GeV/c);<ITSib cluster size> #times cos(#lambda)" , kTH2F , {{1000 , 0 , 10 }, {150 , 0 , 15 }}, false );
177178 fRegistry .add (" Track/hMeanClusterSizeITSob" , " mean cluster size ITSob;p_{pv} (GeV/c);<ITSob cluster size> #times cos(#lambda)" , kTH2F , {{1000 , 0 , 10 }, {150 , 0 , 15 }}, false );
178179 fRegistry .add (" Track/hProbElBDT" , " probability to be e from BDT;p_{in} (GeV/c);BDT score;" , kTH2F , {{1000 , 0 , 10 }, {100 , 0 , 1 }}, false );
180+ fRegistry .add (" Track/hNe" , " electron counts;N_{e} per collision" , kTH1F , {{51 , -0.5 , 50.5 }}, false );
179181 }
180182
181183 if (usePIDML) {
@@ -498,7 +500,6 @@ struct skimmerPrimaryElectron {
498500 track.beta (), track.tofNSigmaEl (), /* track.tofNSigmaPi(), track.tofNSigmaKa(), track.tofNSigmaPr(),*/
499501 track.itsClusterSizes (),
500502 track.itsChi2NCl (), track.tofChi2 (), track.detectorMap (),
501- // trackParCov.getTgl(),
502503 isAssociatedToMPC, false , probaEl, mcTunedTPCSignal);
503504
504505 emprimaryelectronscov (
@@ -601,6 +602,9 @@ struct skimmerPrimaryElectron {
601602 Partition<MyFilteredTracks> posTracks = o2::aod::track::signed1Pt > 0 .f;
602603 Partition<MyFilteredTracks> negTracks = o2::aod::track::signed1Pt < 0 .f;
603604
605+ std::map<std::pair<int , int >, float > mapProbEl; // map pair(collisionId, trackId) -> probaEl
606+ std::unordered_multimap<int , int > multiMapTracksPerCollision; // collisionId -> trackIds
607+
604608 // ---------- for data ----------
605609
606610 void processRec_SA (MyCollisions const & collisions, aod::BCsWithTimestamps const &, MyFilteredTracks const & tracks)
@@ -624,12 +628,26 @@ struct skimmerPrimaryElectron {
624628 if (!isElectron (collision, track, probaEl)) {
625629 continue ;
626630 }
627-
628- fillTrackTable< false >( collision, track, probaEl );
631+ mapProbEl[ std::make_pair (collision. globalIndex (), track. globalIndex ())] = probaEl;
632+ multiMapTracksPerCollision. insert ( std::make_pair ( collision. globalIndex () , track. globalIndex ()) );
629633 }
634+ } // end of collision loop
630635
636+ for (const auto & collision : collisions) {
637+ int count_electrons = multiMapTracksPerCollision.count (collision.globalIndex ());
638+ fRegistry .fill (HIST (" Track/hNe" ), count_electrons);
639+
640+ if (count_electrons >= minNelectron) {
641+ auto range_electrons = multiMapTracksPerCollision.equal_range (collision.globalIndex ());
642+ for (auto it = range_electrons.first ; it != range_electrons.second ; it++) {
643+ auto track = tracks.rawIteratorAt (it->second );
644+ fillTrackTable<false >(collision, track, mapProbEl[std::make_pair (collision.globalIndex (), track.globalIndex ())]);
645+ }
646+ }
631647 } // end of collision loop
632648
649+ mapProbEl.clear ();
650+ multiMapTracksPerCollision.clear ();
633651 stored_trackIds.clear ();
634652 stored_trackIds.shrink_to_fit ();
635653 }
@@ -658,10 +676,25 @@ struct skimmerPrimaryElectron {
658676 if (!isElectron (collision, track, probaEl)) {
659677 continue ;
660678 }
661- fillTrackTable<false >(collision, track, probaEl);
679+ mapProbEl[std::make_pair (collision.globalIndex (), track.globalIndex ())] = probaEl;
680+ }
681+ } // end of collision loop
682+
683+ for (const auto & collision : collisions) {
684+ int count_electrons = multiMapTracksPerCollision.count (collision.globalIndex ());
685+ fRegistry .fill (HIST (" Track/hNe" ), count_electrons);
686+
687+ if (count_electrons >= minNelectron) {
688+ auto range_electrons = multiMapTracksPerCollision.equal_range (collision.globalIndex ());
689+ for (auto it = range_electrons.first ; it != range_electrons.second ; it++) {
690+ auto track = tracks.rawIteratorAt (it->second );
691+ fillTrackTable<false >(collision, track, mapProbEl[std::make_pair (collision.globalIndex (), track.globalIndex ())]);
692+ }
662693 }
663694 } // end of collision loop
664695
696+ mapProbEl.clear ();
697+ multiMapTracksPerCollision.clear ();
665698 stored_trackIds.clear ();
666699 stored_trackIds.shrink_to_fit ();
667700 }
@@ -692,11 +725,26 @@ struct skimmerPrimaryElectron {
692725 if (!isElectron (collision, track, probaEl)) {
693726 continue ;
694727 }
695- fillTrackTable< false > (collision, track, probaEl) ;
728+ mapProbEl[ std::make_pair (collision. globalIndex () , track. globalIndex ())] = probaEl;
696729 }
697730
698731 } // end of collision loop
699732
733+ for (const auto & collision : collisions) {
734+ int count_electrons = multiMapTracksPerCollision.count (collision.globalIndex ());
735+ fRegistry .fill (HIST (" Track/hNe" ), count_electrons);
736+
737+ if (count_electrons >= minNelectron) {
738+ auto range_electrons = multiMapTracksPerCollision.equal_range (collision.globalIndex ());
739+ for (auto it = range_electrons.first ; it != range_electrons.second ; it++) {
740+ auto track = tracks.rawIteratorAt (it->second );
741+ fillTrackTable<false >(collision, track, mapProbEl[std::make_pair (collision.globalIndex (), track.globalIndex ())]);
742+ }
743+ }
744+ } // end of collision loop
745+
746+ mapProbEl.clear ();
747+ multiMapTracksPerCollision.clear ();
700748 stored_trackIds.clear ();
701749 stored_trackIds.shrink_to_fit ();
702750 }
@@ -728,10 +776,25 @@ struct skimmerPrimaryElectron {
728776 if (!isElectron (collision, track, probaEl)) {
729777 continue ;
730778 }
731- fillTrackTable< false > (collision, track, probaEl) ;
779+ mapProbEl[ std::make_pair (collision. globalIndex () , track. globalIndex ())] = probaEl;
732780 }
733781 } // end of collision loop
734782
783+ for (const auto & collision : collisions) {
784+ int count_electrons = multiMapTracksPerCollision.count (collision.globalIndex ());
785+ fRegistry .fill (HIST (" Track/hNe" ), count_electrons);
786+
787+ if (count_electrons >= minNelectron) {
788+ auto range_electrons = multiMapTracksPerCollision.equal_range (collision.globalIndex ());
789+ for (auto it = range_electrons.first ; it != range_electrons.second ; it++) {
790+ auto track = tracks.rawIteratorAt (it->second );
791+ fillTrackTable<false >(collision, track, mapProbEl[std::make_pair (collision.globalIndex (), track.globalIndex ())]);
792+ }
793+ }
794+ } // end of collision loop
795+
796+ mapProbEl.clear ();
797+ multiMapTracksPerCollision.clear ();
735798 stored_trackIds.clear ();
736799 stored_trackIds.shrink_to_fit ();
737800 }
@@ -766,10 +829,25 @@ struct skimmerPrimaryElectron {
766829 if (!isElectron (collision, track, probaEl)) {
767830 continue ;
768831 }
769- fillTrackTable< true > (collision, track, probaEl) ;
832+ mapProbEl[ std::make_pair (collision. globalIndex () , track. globalIndex ())] = probaEl;
770833 }
771834 } // end of collision loop
772835
836+ for (const auto & collision : collisions) {
837+ int count_electrons = multiMapTracksPerCollision.count (collision.globalIndex ());
838+ fRegistry .fill (HIST (" Track/hNe" ), count_electrons);
839+
840+ if (count_electrons >= minNelectron) {
841+ auto range_electrons = multiMapTracksPerCollision.equal_range (collision.globalIndex ());
842+ for (auto it = range_electrons.first ; it != range_electrons.second ; it++) {
843+ auto track = tracks.rawIteratorAt (it->second );
844+ fillTrackTable<true >(collision, track, mapProbEl[std::make_pair (collision.globalIndex (), track.globalIndex ())]);
845+ }
846+ }
847+ } // end of collision loop
848+
849+ mapProbEl.clear ();
850+ multiMapTracksPerCollision.clear ();
773851 stored_trackIds.clear ();
774852 stored_trackIds.shrink_to_fit ();
775853 }
@@ -801,10 +879,25 @@ struct skimmerPrimaryElectron {
801879 if (!isElectron (collision, track, probaEl)) {
802880 continue ;
803881 }
804- fillTrackTable<true >(collision, track, probaEl);
882+ mapProbEl[std::make_pair (collision.globalIndex (), track.globalIndex ())] = probaEl;
883+ }
884+ } // end of collision loop
885+
886+ for (const auto & collision : collisions) {
887+ int count_electrons = multiMapTracksPerCollision.count (collision.globalIndex ());
888+ fRegistry .fill (HIST (" Track/hNe" ), count_electrons);
889+
890+ if (count_electrons >= minNelectron) {
891+ auto range_electrons = multiMapTracksPerCollision.equal_range (collision.globalIndex ());
892+ for (auto it = range_electrons.first ; it != range_electrons.second ; it++) {
893+ auto track = tracks.rawIteratorAt (it->second );
894+ fillTrackTable<true >(collision, track, mapProbEl[std::make_pair (collision.globalIndex (), track.globalIndex ())]);
895+ }
805896 }
806897 } // end of collision loop
807898
899+ mapProbEl.clear ();
900+ multiMapTracksPerCollision.clear ();
808901 stored_trackIds.clear ();
809902 stored_trackIds.shrink_to_fit ();
810903 }
@@ -882,7 +975,7 @@ struct prefilterPrimaryElectron {
882975 fRegistry .add (" Track/hEtaPhi" , " #eta vs. #varphi;#varphi (rad.);#eta" , kTH2F , {{90 , 0 , 2 * M_PI}, {80 , -2 .0f , 2 .0f }}, false );
883976 fRegistry .add (" Track/hTPCNsigmaEl" , " loose track TPC PID" , kTH2F , {{1000 , 0 .f , 10 }, {100 , -5 , +5 }});
884977 fRegistry .add (" Pair/before/uls/hMvsPt" , " mass vs. pT;m_{ee} (GeV/c^{2});p_{T,ee} (GeV/c)" , kTH2F , {{500 , 0 , 0.5 }, {100 , 0 , 1 }});
885- fRegistry .add (" Pair/before/uls/hMvsPhiV" , " mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})" , kTH2F , {{90 , 0 .f , M_PI}, {100 , 0 , 1.0 }});
978+ fRegistry .add (" Pair/before/uls/hMvsPhiV" , " mass vs. phiv;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})" , kTH2F , {{90 , 0 .f , M_PI}, {100 , 0 , 0.1 }});
886979 fRegistry .addClone (" Pair/before/uls/" , " Pair/before/lspp/" );
887980 fRegistry .addClone (" Pair/before/uls/" , " Pair/before/lsmm/" );
888981 fRegistry .addClone (" Pair/before/" , " Pair/after/" );
0 commit comments