1717// / \author Marcello Di Costanzo <marcello.di.costanzo@cern.ch>, Politecnico and INFN Torino
1818// / \author Marcello Di Costanzo <luca.aglietta@unito.it>, Università and INFN Torino
1919
20+ #include " TPDGCode.h"
21+
2022#include " Framework/AnalysisTask.h"
2123#include " Framework/HistogramRegistry.h"
2224#include " Framework/runDataProcessing.h"
@@ -37,9 +39,11 @@ namespace o2::aod
3739{
3840namespace pid_studies
3941{
42+ enum Particle {NotMatched=0 , Lambda, K0s, Omega};
4043// V0s
4144DECLARE_SOA_COLUMN (MassK0, massK0, float ); // ! Candidate mass
4245DECLARE_SOA_COLUMN (MassLambda, massLambda, float ); // ! Candidate mass
46+ DECLARE_SOA_COLUMN (MassAntiLambda, massAntiLambda, float ); // ! Candidate mass
4347DECLARE_SOA_COLUMN (PtPos, ptPos, float ); // ! Transverse momentum of positive track (GeV/c)
4448DECLARE_SOA_COLUMN (PtNeg, ptNeg, float ); // ! Transverse momentum of negative track (GeV/c)
4549DECLARE_SOA_COLUMN (Radius, radius, float ); // ! Radius
@@ -75,6 +79,7 @@ DECLARE_SOA_COLUMN(CandFlag, candFlag, int); //! Flag for MC matc
7579DECLARE_SOA_TABLE (pidV0s, " AOD" , " PIDV0S" , // ! Table with PID information
7680 pid_studies::MassK0,
7781 pid_studies::MassLambda,
82+ pid_studies::MassAntiLambda,
7883 pid_studies::PtPos,
7984 pid_studies::PtNeg,
8085 pid_studies::Radius,
@@ -112,7 +117,6 @@ DECLARE_SOA_TABLE(pidCascades, "AOD", "PIDCASCADES", //! Table with PID informat
112117 );
113118} // namespace o2::aod
114119
115-
116120struct pidStudies {
117121 Produces <o2::aod::pidV0s> pidV0;
118122 Produces <o2::aod::pidCascades> pidCascade;
@@ -131,6 +135,8 @@ struct pidStudies {
131135 Configurable<float > massLambdaMax{" massLambdaMax" , 1.3 , " Maximum mass for lambda" };
132136 Configurable<float > massOmegaMin{" massOmegaMin" , 1.5 , " Minimum mass for omega" };
133137 Configurable<float > massOmegaMax{" massOmegaMax" , 1.8 , " Maximum mass for omega" };
138+ Configurable<float > downSampleBkgFactor{" downSampleBkgFactor" , 1 ., " Fraction of candidates to keep" };
139+ Configurable<float > ptMaxForDownSample{" ptMaxForDownSample" , 10 ., " Maximum pt for the application of the downsampling factor" };
134140
135141 void init (InitContext&)
136142 {
@@ -139,13 +145,20 @@ struct pidStudies {
139145 template <typename Cand>
140146 void fillTree (Cand const & candidate, const int & flag)
141147 {
148+ LOG (info) << candidate.pt ();
149+ float pseudoRndm = candidate.pt () * 1000 . - (int64_t )(candidate.pt () * 1000 );
150+ if (candidate.pt () < ptMaxForDownSample && pseudoRndm > downSampleBkgFactor) {
151+ return ;
152+ }
153+
142154 const auto & coll = candidate.template collision_as <CollSels>();
143155 if constexpr (std::is_same<Cand, V0sMCRec::iterator>::value) {
144156 const auto & posTrack = candidate.template posTrack_as <PIDTracks>();
145157 const auto & negTrack = candidate.template negTrack_as <PIDTracks>();
146158 pidV0 (
147159 candidate.mK0Short (),
148160 candidate.mLambda (),
161+ candidate.mAntiLambda (),
149162 posTrack.pt (),
150163 negTrack.pt (),
151164 candidate.v0radius (),
@@ -188,52 +201,52 @@ struct pidStudies {
188201
189202 template <typename T1>
190203 int isMatched (const T1& cand) {
191- int matched{0 };
192204 if constexpr (std::is_same<T1, V0sMCRec::iterator>::value) {
193- if (!cand.has_v0MCCore ())
194- return matched;
205+ if (!cand.has_v0MCCore ()) {
206+ return aod::pid_studies::NotMatched;
207+ }
195208 auto v0MC = cand.template v0MCCore_as <aod::V0MCCores>();
196- if (v0MC.pdgCode () == 3122 && v0MC.pdgCodeNegative () == -211
197- && v0MC.pdgCodePositive () == 2212 ) {
198- matched = 1 ;
209+ LOG (info) << v0MC.pdgCode ();
210+ if (v0MC.pdgCode () == kLambda0 && v0MC.pdgCodeNegative () == -kPiPlus
211+ && v0MC.pdgCodePositive () == kProton ) {
212+ return aod::pid_studies::Lambda;
199213 }
200- if (v0MC.pdgCode () == -3122 && v0MC.pdgCodeNegative () == -2212
201- && v0MC.pdgCodePositive () == 211 ) {
202- matched = - 1 ;
214+ if (v0MC.pdgCode () == -kLambda0 && v0MC.pdgCodeNegative () == -kProton
215+ && v0MC.pdgCodePositive () == kPiPlus ) {
216+ return -aod::pid_studies::Lambda ;
203217 }
204- if (v0MC.pdgCode () == 310 && v0MC.pdgCodeNegative () == -211
205- && v0MC.pdgCodePositive () == 211 ) {
206- matched = 2 ;
218+ if (v0MC.pdgCode () == kK0Short && v0MC.pdgCodeNegative () == -kPiPlus
219+ && v0MC.pdgCodePositive () == kPiPlus ) {
220+ return aod::pid_studies::K0s ;
207221 }
208- if (v0MC.pdgCode () == -310 && v0MC.pdgCodeNegative () == -211
209- && v0MC.pdgCodePositive () == 211 ) {
210- matched = - 2 ;
222+ if (v0MC.pdgCode () == -kK0Short && v0MC.pdgCodeNegative () == -kPiPlus
223+ && v0MC.pdgCodePositive () == kPiPlus ) {
224+ return -aod::pid_studies::K0s ;
211225 }
212226 }
213227 if constexpr (std::is_same<T1, CascsMCRec::iterator>::value) {
214- if (!cand.has_cascMCCore ())
215- return matched ;
216- LOG (info) << " Inside checker " ;
228+ if (!cand.has_cascMCCore ()) {
229+ return aod::pid_studies::NotMatched ;
230+ }
217231 auto cascMC = cand.template cascMCCore_as <aod::CascMCCores>();
218232 if (cascMC.pdgCode () > 0 ) {
219- if (cascMC.pdgCode () == 3334 &&
220- cascMC.pdgCodeBachelor () == -321 &&
221- cascMC.pdgCodeV0 () == 3122 &&
222- cascMC.pdgCodePositive () == 2212 &&
223- cascMC.pdgCodeNegative () == -211 ) {
224- matched = 3 ;
233+ if (cascMC.pdgCode () == kOmegaMinus &&
234+ cascMC.pdgCodeBachelor () == -kKPlus &&
235+ cascMC.pdgCodeV0 () == kLambda0 &&
236+ cascMC.pdgCodePositive () == kProton &&
237+ cascMC.pdgCodeNegative () == -kPiPlus ) {
238+ return aod::pid_studies::Omega ;
225239 }
226240 } else {
227- if (cascMC.pdgCode () == -3334 &&
228- cascMC.pdgCodeBachelor () == 321 &&
229- cascMC.pdgCodeV0 () == -3122 &&
230- cascMC.pdgCodePositive () == 211 &&
231- cascMC.pdgCodeNegative () == -2212 ) {
232- matched = - 3 ;
241+ if (cascMC.pdgCode () == -kOmegaMinus &&
242+ cascMC.pdgCodeBachelor () == kKPlus &&
243+ cascMC.pdgCodeV0 () == -kLambda0 &&
244+ cascMC.pdgCodePositive () == kPiPlus &&
245+ cascMC.pdgCodeNegative () == -kProton ) {
246+ return -aod::pid_studies::Omega ;
233247 }
234248 }
235- }
236- return matched;
249+ }
237250 }
238251
239252 void processMC (V0sMCRec const & V0s, aod::V0MCCores const & V0sMC, CascsMCRec const & cascs,
@@ -258,19 +271,19 @@ struct pidStudies {
258271 }
259272
260273 }
261- PROCESS_SWITCH (pidStudies, processMC, " process MC" , true );
274+ PROCESS_SWITCH (pidStudies, processMC, " Process MC" , true );
262275
263276 void processData (aod::V0Datas const & V0s, aod::CascDatas const & cascades, CollSels const &, PIDTracks const &)
264277 {
265278 for (const auto & v0 : V0s) {
266279 if (v0.mK0Short () > massK0Min && v0.mK0Short () < massK0Max ||
267280 v0.mLambda () > massLambdaMin && v0.mLambda () < massLambdaMax ||
268281 v0.mAntiLambda () > massLambdaMin && v0.mAntiLambda () < massLambdaMax) {
269- fillTree (v0, 0 );
282+ fillTree (v0, aod::pid_studies::NotMatched );
270283 }
271284 }
272285 }
273- PROCESS_SWITCH (pidStudies, processData, " process data" , false );
286+ PROCESS_SWITCH (pidStudies, processData, " Process data" , false );
274287};
275288
276289WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments