Skip to content

Commit 9fdd9f2

Browse files
committed
implemented Vit comments
1 parent dcaeee0 commit 9fdd9f2

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

PWGHF/Tasks/pidStudies.cxx

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
/// \file pidStudies.cxx
12+
/// \file HfPidStudies.cxx
1313
/// \brief task for studies of PID performance
1414
///
1515
/// \author Fabrizio Chinu <fabrizio.chinu@cern.ch>, Università and INFN Torino
@@ -81,7 +81,7 @@ DECLARE_SOA_COLUMN(CentralityFT0M, centralityFT0M, float); //! Centrality from F
8181
DECLARE_SOA_COLUMN(CandFlag, candFlag, int); //! Flag for MC matching
8282
} // namespace pid_studies
8383

84-
DECLARE_SOA_TABLE(pidV0s, "AOD", "PIDV0S", //! Table with PID information
84+
DECLARE_SOA_TABLE(PidV0s, "AOD", "PIDV0S", //! Table with PID information
8585
pid_studies::MassK0,
8686
pid_studies::MassLambda,
8787
pid_studies::MassAntiLambda,
@@ -106,7 +106,7 @@ DECLARE_SOA_TABLE(pidV0s, "AOD", "PIDV0S", //! Table with PID information
106106
pid_studies::CentralityFT0M,
107107
pid_studies::CandFlag);
108108

109-
DECLARE_SOA_TABLE(pidCascades, "AOD", "PIDCASCADES", //! Table with PID information
109+
DECLARE_SOA_TABLE(PidCascades, "AOD", "PIDCASCADES", //! Table with PID information
110110
pid_studies::MassOmega,
111111
pid_studies::Pt,
112112
pid_studies::BachPt,
@@ -124,17 +124,9 @@ DECLARE_SOA_TABLE(pidCascades, "AOD", "PIDCASCADES", //! Table with PID informat
124124
pid_studies::CandFlag);
125125
} // namespace o2::aod
126126

127-
struct pidStudies {
128-
Produces<o2::aod::pidV0s> pidV0;
129-
Produces<o2::aod::pidCascades> pidCascade;
130-
HistogramRegistry registry{"registry", {}};
131-
132-
using PIDTracks = soa::Join<aod::Tracks, aod::TracksExtra,
133-
aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr,
134-
aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>;
135-
using CollSels = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::CentFT0Ms>;
136-
using V0sMCRec = soa::Join<aod::V0Datas, aod::V0CoreMCLabels>;
137-
using CascsMCRec = soa::Join<aod::CascDatas, aod::CascCoreMCLabels>;
127+
struct HfPidStudies {
128+
Produces<o2::aod::PidV0s> pidV0;
129+
Produces<o2::aod::PidCascades> pidCascade;
138130

139131
Configurable<float> massK0Min{"massK0Min", 0.4, "Minimum mass for K0"};
140132
Configurable<float> massK0Max{"massK0Max", 0.6, "Maximum mass for K0"};
@@ -145,12 +137,15 @@ struct pidStudies {
145137
Configurable<float> downSampleBkgFactor{"downSampleBkgFactor", 1., "Fraction of candidates to keep"};
146138
Configurable<float> ptMaxForDownSample{"ptMaxForDownSample", 10., "Maximum pt for the application of the downsampling factor"};
147139

148-
void init(InitContext&)
149-
{
150-
}
140+
using PidTracks = soa::Join<aod::Tracks, aod::TracksExtra,
141+
aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr,
142+
aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>;
143+
using CollSels = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::CentFT0Ms>;
144+
using V0sMcRec = soa::Join<aod::V0Datas, aod::V0CoreMCLabels>;
145+
using CascsMcRec = soa::Join<aod::CascDatas, aod::CascCoreMCLabels>;
151146

152147
template <bool isV0, typename Cand>
153-
void fillTree(Cand const& candidate, const int& flag)
148+
void fillTree(Cand const& candidate, const int flag)
154149
{
155150
float pseudoRndm = candidate.pt() * 1000. - static_cast<int64_t>(candidate.pt() * 1000);
156151
if (candidate.pt() < ptMaxForDownSample && pseudoRndm > downSampleBkgFactor) {
@@ -159,8 +154,8 @@ struct pidStudies {
159154

160155
const auto& coll = candidate.template collision_as<CollSels>();
161156
if constexpr (isV0) {
162-
const auto& posTrack = candidate.template posTrack_as<PIDTracks>();
163-
const auto& negTrack = candidate.template negTrack_as<PIDTracks>();
157+
const auto& posTrack = candidate.template posTrack_as<PidTracks>();
158+
const auto& negTrack = candidate.template negTrack_as<PidTracks>();
164159
pidV0(
165160
candidate.mK0Short(),
166161
candidate.mLambda(),
@@ -186,7 +181,7 @@ struct pidStudies {
186181
coll.centFT0M(),
187182
flag);
188183
} else {
189-
const auto& bachTrack = candidate.template bachelor_as<PIDTracks>();
184+
const auto& bachTrack = candidate.template bachelor_as<PidTracks>();
190185
pidCascade(
191186
candidate.mOmega(),
192187
candidate.pt(),
@@ -209,7 +204,7 @@ struct pidStudies {
209204
template <typename T1>
210205
int isMatched(const T1& cand)
211206
{
212-
if constexpr (std::is_same<T1, V0sMCRec::iterator>::value) {
207+
if constexpr (std::is_same<T1, V0sMcRec::iterator>::value) {
213208
if (!cand.has_v0MCCore()) {
214209
return aod::pid_studies::Particle::NotMatched;
215210
}
@@ -224,7 +219,7 @@ struct pidStudies {
224219
return -aod::pid_studies::Particle::Lambda;
225220
}
226221
}
227-
if constexpr (std::is_same<T1, CascsMCRec::iterator>::value) {
222+
if constexpr (std::is_same<T1, CascsMcRec::iterator>::value) {
228223
if (!cand.has_cascMCCore()) {
229224
return aod::pid_studies::Particle::NotMatched;
230225
}
@@ -247,8 +242,12 @@ struct pidStudies {
247242
return aod::pid_studies::Particle::NotMatched;
248243
}
249244

250-
void processMC(V0sMCRec const& V0s, aod::V0MCCores const&, CascsMCRec const& cascades,
251-
aod::CascMCCores const&, CollSels const&, PIDTracks const&)
245+
void processMc(V0sMcRec const& V0s,
246+
aod::V0MCCores const&,
247+
CascsMcRec const& cascades,
248+
aod::CascMCCores const&,
249+
CollSels const&,
250+
PidTracks const&)
252251
{
253252
for (const auto& v0 : V0s) {
254253
if ((v0.mK0Short() > massK0Min && v0.mK0Short() < massK0Max) ||
@@ -269,9 +268,9 @@ struct pidStudies {
269268
}
270269
}
271270
}
272-
PROCESS_SWITCH(pidStudies, processMC, "Process MC", true);
271+
PROCESS_SWITCH(HfPidStudies, processMc, "Process MC", true);
273272

274-
void processData(aod::V0Datas const& V0s, aod::CascDatas const& cascades, CollSels const&, PIDTracks const&)
273+
void processData(aod::V0Datas const& V0s, aod::CascDatas const& cascades, CollSels const&, PidTracks const&)
275274
{
276275
for (const auto& v0 : V0s) {
277276
if ((v0.mK0Short() > massK0Min && v0.mK0Short() < massK0Max) ||
@@ -286,10 +285,10 @@ struct pidStudies {
286285
}
287286
}
288287
}
289-
PROCESS_SWITCH(pidStudies, processData, "Process data", false);
288+
PROCESS_SWITCH(HfPidStudies, processData, "Process data", false);
290289
};
291290

292291
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
293292
{
294-
return WorkflowSpec{adaptAnalysisTask<pidStudies>(cfgc)};
293+
return WorkflowSpec{adaptAnalysisTask<HfPidStudies>(cfgc)};
295294
}

0 commit comments

Comments
 (0)