@@ -122,6 +122,26 @@ struct SkimmerGammaCalo {
122122 template <typename TCollision, typename TClusters, typename TClusterCells, typename TTracks, typename TMatchedTracks, typename TMatchedSecondaries = std::nullptr_t >
123123 void runAnalysis (TCollision const & collision, TClusters const & emcclusters, TClusterCells const & emcclustercells, TMatchedTracks const & emcmatchedtracks, TTracks const & /* tracks*/ , TMatchedSecondaries const & secondaries = nullptr )
124124 {
125+ const size_t NMaxMatchedTracks = 10 ;
126+ // Skimmed matched tracks table
127+ std::vector<float > vEta;
128+ std::vector<float > vPhi;
129+ std::vector<float > vP;
130+ std::vector<float > vPt;
131+ vEta.reserve (NMaxMatchedTracks);
132+ vPhi.reserve (NMaxMatchedTracks);
133+ vP.reserve (NMaxMatchedTracks);
134+ vPt.reserve (NMaxMatchedTracks);
135+
136+ std::vector<float > vEtaSecondaries = {};
137+ std::vector<float > vPhiSecondaries = {};
138+ std::vector<float > vPSecondaries = {};
139+ std::vector<float > vPtSecondaries = {};
140+ vEtaSecondaries.reserve (NMaxMatchedTracks);
141+ vPhiSecondaries.reserve (NMaxMatchedTracks);
142+ vPSecondaries.reserve (NMaxMatchedTracks);
143+ vPtSecondaries.reserve (NMaxMatchedTracks);
144+
125145 if (!collision.isSelected ()) {
126146 return ;
127147 }
@@ -168,17 +188,7 @@ struct SkimmerGammaCalo {
168188 for (const auto & emcclustercell : groupedCells) {
169189 tableCellEMCReco (emcclustercell.emcalclusterId (), emcclustercell.caloId ());
170190 }
171-
172- // Skimmed matched tracks table
173- std::vector<float > vEta;
174- std::vector<float > vPhi;
175- std::vector<float > vP;
176- std::vector<float > vPt;
177191 auto groupedMTs = emcmatchedtracks.sliceBy (psMTperCluster, emccluster.globalIndex ());
178- vEta.reserve (groupedMTs.size ());
179- vPhi.reserve (groupedMTs.size ());
180- vP.reserve (groupedMTs.size ());
181- vPt.reserve (groupedMTs.size ());
182192 for (const auto & emcmatchedtrack : groupedMTs) {
183193 historeg.fill (HIST (" hCaloTrackFilter" ), 0 );
184194 historeg.fill (HIST (" MTEtaPhiBeforeTM" ), emcmatchedtrack.deltaEta (), emcmatchedtrack.deltaPhi ());
@@ -199,17 +209,8 @@ struct SkimmerGammaCalo {
199209 vPt.emplace_back (emcmatchedtrack.template track_as <aod::FullTracks>().pt ());
200210 }
201211
202- std::vector<float > vEtaSecondaries = {};
203- std::vector<float > vPhiSecondaries = {};
204- std::vector<float > vPSecondaries = {};
205- std::vector<float > vPtSecondaries = {};
206-
207212 if constexpr (HasSecondaries<TMatchedSecondaries>) {
208213 auto groupedMatchedSecondaries = secondaries.sliceBy (psMSperCluster, emccluster.globalIndex ());
209- vEta.reserve (groupedMatchedSecondaries.size ());
210- vPhi.reserve (groupedMatchedSecondaries.size ());
211- vP.reserve (groupedMatchedSecondaries.size ());
212- vPt.reserve (groupedMatchedSecondaries.size ());
213214 for (const auto & emcMatchedSecondary : groupedMatchedSecondaries) {
214215 historeg.fill (HIST (" hCaloSecondaryTrackFilter" ), 0 );
215216 historeg.fill (HIST (" MSTEtaPhiBeforeTM" ), emcMatchedSecondary.deltaEta (), emcMatchedSecondary.deltaPhi ());
@@ -219,10 +220,10 @@ struct SkimmerGammaCalo {
219220 }
220221 historeg.fill (HIST (" hCaloSecondaryTrackFilter" ), 3 );
221222 historeg.fill (HIST (" MSTEtaPhiAfterTM" ), emcMatchedSecondary.deltaEta (), emcMatchedSecondary.deltaPhi ());
222- vEta .emplace_back (emcMatchedSecondary.deltaEta ());
223- vPhi .emplace_back (emcMatchedSecondary.deltaPhi ());
224- vP .emplace_back (emcMatchedSecondary.template track_as <aod::FullTracks>().p ());
225- vPt .emplace_back (emcMatchedSecondary.template track_as <aod::FullTracks>().pt ());
223+ vEtaSecondaries .emplace_back (emcMatchedSecondary.deltaEta ());
224+ vPhiSecondaries .emplace_back (emcMatchedSecondary.deltaPhi ());
225+ vPSecondaries .emplace_back (emcMatchedSecondary.template track_as <aod::FullTracks>().p ());
226+ vPtSecondaries .emplace_back (emcMatchedSecondary.template track_as <aod::FullTracks>().pt ());
226227 }
227228 }
228229
@@ -233,6 +234,14 @@ struct SkimmerGammaCalo {
233234
234235 tableGammaEMCReco (emccluster.collisionId (), emccluster.definition (), emccluster.energy (), emccluster.eta (), emccluster.phi (), emccluster.m02 (),
235236 emccluster.nCells (), emccluster.time (), emccluster.isExotic (), vPhi, vEta, vP, vPt, vPhiSecondaries, vEtaSecondaries, vPSecondaries, vPtSecondaries);
237+ vEta.clear ();
238+ vPhi.clear ();
239+ vP.clear ();
240+ vPt.clear ();
241+ vPhiSecondaries.clear ();
242+ vEtaSecondaries.clear ();
243+ vPSecondaries.clear ();
244+ vPtSecondaries.clear ();
236245 }
237246 }
238247
0 commit comments