@@ -87,70 +87,64 @@ struct sgPIDAnalyzer {
8787
8888 void process (aod::SGEvents const & events, aod::SGTracks const & tracks)
8989 {
90- int eventIndex = 0 ; // Sequential index for SGEvents
91- for (auto event : events) {
92- for (auto track : tracks) {
93- if (track.sgEventId () != eventIndex)
94- continue ; // Match track to the current event index
95- bool isPositive = (track.sign () > 0 );
96- if (track.tofpi () == -999 ) {
97- // Directly fill histograms without a local variable for histName
98- if (isPositive) {
99- histos.fill (HIST (" TPC/pTPC_Pi" ), track.pt (), track.tpcpi ());
100- histos.fill (HIST (" TPC/pTPC_Ka" ), track.pt (), track.tpcka ());
101- histos.fill (HIST (" TPC/pTPC_Pr" ), track.pt (), track.tpcpr ());
102- histos.fill (HIST (" TPC/pTPC_El" ), track.pt (), track.tpcel ());
103- if (abs (track.tpcpi ()) < 1 ) {
104- histos.fill (HIST (" TPC/pTPC_Pi_Ka" ), track.pt (), track.tpcka ());
105- histos.fill (HIST (" TPC/pTPC_Pi_Pr" ), track.pt (), track.tpcpr ());
106- histos.fill (HIST (" TPC/pTPC_Pi_El" ), track.pt (), track.tpcel ());
107- }
108- if (abs (track.tpcka ()) < 1 ) {
109- histos.fill (HIST (" TPC/pTPC_Ka_Pi" ), track.pt (), track.tpcpi ());
110- histos.fill (HIST (" TPC/pTPC_Ka_Pr" ), track.pt (), track.tpcpr ());
111- histos.fill (HIST (" TPC/pTPC_Ka_El" ), track.pt (), track.tpcel ());
112- }
113- if (abs (track.tpcpr ()) < 1 ) {
114- histos.fill (HIST (" TPC/pTPC_Pr_Pi" ), track.pt (), track.tpcpi ());
115- histos.fill (HIST (" TPC/pTPC_Pr_Ka" ), track.pt (), track.tpcka ());
116- histos.fill (HIST (" TPC/pTPC_Pr_El" ), track.pt (), track.tpcel ());
117- }
118- } else {
119- histos.fill (HIST (" TPC/nTPC_Pi" ), track.pt (), track.tpcpi ());
120- histos.fill (HIST (" TPC/nTPC_Ka" ), track.pt (), track.tpcka ());
121- histos.fill (HIST (" TPC/nTPC_Pr" ), track.pt (), track.tpcpr ());
122- histos.fill (HIST (" TPC/nTPC_El" ), track.pt (), track.tpcel ());
123- if (abs (track.tpcpi ()) < 1 ) {
124- histos.fill (HIST (" TPC/nTPC_Pi_Ka" ), track.pt (), track.tpcka ());
125- histos.fill (HIST (" TPC/nTPC_Pi_Pr" ), track.pt (), track.tpcpr ());
126- histos.fill (HIST (" TPC/nTPC_Pi_El" ), track.pt (), track.tpcel ());
127- }
128- if (abs (track.tpcka ()) < 1 ) {
129- histos.fill (HIST (" TPC/nTPC_Ka_Pi" ), track.pt (), track.tpcpi ());
130- histos.fill (HIST (" TPC/nTPC_Ka_Pr" ), track.pt (), track.tpcpr ());
131- histos.fill (HIST (" TPC/nTPC_Ka_El" ), track.pt (), track.tpcel ());
132- }
133- if (abs (track.tpcpr ()) < 1 ) {
134- histos.fill (HIST (" TPC/nTPC_Pr_Pi" ), track.pt (), track.tpcpi ());
135- histos.fill (HIST (" TPC/nTPC_Pr_Ka" ), track.pt (), track.tpcka ());
136- histos.fill (HIST (" TPC/nTPC_Pr_El" ), track.pt (), track.tpcel ());
137- }
90+ for (const auto & track : tracks) {
91+ bool isPositive = (track.sign () > 0 );
92+ if (track.tofpi () == -999 ) {
93+ // Directly fill histograms without a local variable for histName
94+ if (isPositive) {
95+ histos.fill (HIST (" TPC/pTPC_Pi" ), track.pt (), track.tpcpi ());
96+ histos.fill (HIST (" TPC/pTPC_Ka" ), track.pt (), track.tpcka ());
97+ histos.fill (HIST (" TPC/pTPC_Pr" ), track.pt (), track.tpcpr ());
98+ histos.fill (HIST (" TPC/pTPC_El" ), track.pt (), track.tpcel ());
99+ if (std::abs (track.tpcpi ()) < 1 ) {
100+ histos.fill (HIST (" TPC/pTPC_Pi_Ka" ), track.pt (), track.tpcka ());
101+ histos.fill (HIST (" TPC/pTPC_Pi_Pr" ), track.pt (), track.tpcpr ());
102+ histos.fill (HIST (" TPC/pTPC_Pi_El" ), track.pt (), track.tpcel ());
103+ }
104+ if (std::abs (track.tpcka ()) < 1 ) {
105+ histos.fill (HIST (" TPC/pTPC_Ka_Pi" ), track.pt (), track.tpcpi ());
106+ histos.fill (HIST (" TPC/pTPC_Ka_Pr" ), track.pt (), track.tpcpr ());
107+ histos.fill (HIST (" TPC/pTPC_Ka_El" ), track.pt (), track.tpcel ());
108+ }
109+ if (std::abs (track.tpcpr ()) < 1 ) {
110+ histos.fill (HIST (" TPC/pTPC_Pr_Pi" ), track.pt (), track.tpcpi ());
111+ histos.fill (HIST (" TPC/pTPC_Pr_Ka" ), track.pt (), track.tpcka ());
112+ histos.fill (HIST (" TPC/pTPC_Pr_El" ), track.pt (), track.tpcel ());
138113 }
139114 } else {
140- if (isPositive) {
141- histos.fill (HIST (" TOF/pPi" ), track.pt (), track.tpcpi (), track.tofpi ());
142- histos.fill (HIST (" TOF/pKa" ), track.pt (), track.tpcka (), track.tofka ());
143- histos.fill (HIST (" TOF/pPr" ), track.pt (), track.tpcpr (), track.tofpr ());
144- histos.fill (HIST (" TOF/pEl" ), track.pt (), track.tpcel (), track.tofel ());
145- } else {
146- histos.fill (HIST (" TOF/nPi" ), track.pt (), track.tpcpi (), track.tofpi ());
147- histos.fill (HIST (" TOF/nKa" ), track.pt (), track.tpcka (), track.tofka ());
148- histos.fill (HIST (" TOF/nPr" ), track.pt (), track.tpcpr (), track.tofpr ());
149- histos.fill (HIST (" TOF/nEl" ), track.pt (), track.tpcel (), track.tofel ());
115+ histos.fill (HIST (" TPC/nTPC_Pi" ), track.pt (), track.tpcpi ());
116+ histos.fill (HIST (" TPC/nTPC_Ka" ), track.pt (), track.tpcka ());
117+ histos.fill (HIST (" TPC/nTPC_Pr" ), track.pt (), track.tpcpr ());
118+ histos.fill (HIST (" TPC/nTPC_El" ), track.pt (), track.tpcel ());
119+ if (std::abs (track.tpcpi ()) < 1 ) {
120+ histos.fill (HIST (" TPC/nTPC_Pi_Ka" ), track.pt (), track.tpcka ());
121+ histos.fill (HIST (" TPC/nTPC_Pi_Pr" ), track.pt (), track.tpcpr ());
122+ histos.fill (HIST (" TPC/nTPC_Pi_El" ), track.pt (), track.tpcel ());
123+ }
124+ if (std::abs (track.tpcka ()) < 1 ) {
125+ histos.fill (HIST (" TPC/nTPC_Ka_Pi" ), track.pt (), track.tpcpi ());
126+ histos.fill (HIST (" TPC/nTPC_Ka_Pr" ), track.pt (), track.tpcpr ());
127+ histos.fill (HIST (" TPC/nTPC_Ka_El" ), track.pt (), track.tpcel ());
150128 }
129+ if (std::abs (track.tpcpr ()) < 1 ) {
130+ histos.fill (HIST (" TPC/nTPC_Pr_Pi" ), track.pt (), track.tpcpi ());
131+ histos.fill (HIST (" TPC/nTPC_Pr_Ka" ), track.pt (), track.tpcka ());
132+ histos.fill (HIST (" TPC/nTPC_Pr_El" ), track.pt (), track.tpcel ());
133+ }
134+ }
135+ } else {
136+ if (isPositive) {
137+ histos.fill (HIST (" TOF/pPi" ), track.pt (), track.tpcpi (), track.tofpi ());
138+ histos.fill (HIST (" TOF/pKa" ), track.pt (), track.tpcka (), track.tofka ());
139+ histos.fill (HIST (" TOF/pPr" ), track.pt (), track.tpcpr (), track.tofpr ());
140+ histos.fill (HIST (" TOF/pEl" ), track.pt (), track.tpcel (), track.tofel ());
141+ } else {
142+ histos.fill (HIST (" TOF/nPi" ), track.pt (), track.tpcpi (), track.tofpi ());
143+ histos.fill (HIST (" TOF/nKa" ), track.pt (), track.tpcka (), track.tofka ());
144+ histos.fill (HIST (" TOF/nPr" ), track.pt (), track.tpcpr (), track.tofpr ());
145+ histos.fill (HIST (" TOF/nEl" ), track.pt (), track.tpcel (), track.tofel ());
151146 }
152147 }
153- eventIndex++;
154148 }
155149 }
156150};
0 commit comments