1717
1818#include " ALICE3/Core/Decayer.h"
1919#include " ALICE3/Core/TrackUtilities.h"
20+ #include " ALICE3/DataModel/OTFMCParticle.h"
2021
2122#include < CCDB/BasicCCDBManager.h>
2223#include < CommonConstants/MathConstants.h>
@@ -64,16 +65,23 @@ static const std::vector<int> pdgCodes{kK0Short,
6465 kOmegaPlusBar };
6566
6667struct OnTheFlyDecayer {
68+ Produces<aod::OTFMCParticles> tableMcParticles;
6769 o2::upgrade::Decayer decayer;
6870 Service<o2::ccdb::BasicCCDBManager> ccdb;
6971 Service<o2::framework::O2DatabasePDG> pdgDB;
72+ HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
7073
7174 Configurable<int > seed{" seed" , 0 , " Set seed for particle decayer" };
7275 Configurable<float > magneticField{" magneticField" , 20 ., " Magnetic field (kG)" };
7376 Configurable<LabeledArray<int >> enabledDecays{" enabledDecays" ,
7477 {defaultParameters[0 ], kNumDecays , kNumParameters , particleNames, parameterNames},
7578 " Enable option for particle to be decayed: 0 - no, 1 - yes" };
76-
79+
80+
81+ ConfigurableAxis axisRadius{" axisRadius" , {1000 , 0 , 100 }, " Radius" };
82+ ConfigurableAxis axisPt{" axisPt" , {VARIABLE_WIDTH, 0 .0f , 0 .1f , 0 .2f , 0 .3f , 0 .4f , 0 .5f , 0 .6f , 0 .7f , 0 .8f , 0 .9f , 1 .0f , 1 .1f , 1 .2f , 1 .3f , 1 .4f , 1 .5f , 1 .6f , 1 .7f , 1 .8f , 1 .9f , 2 .0f , 2 .2f , 2 .4f , 2 .6f , 2 .8f , 3 .0f , 3 .2f , 3 .4f , 3 .6f , 3 .8f , 4 .0f , 4 .4f , 4 .8f , 5 .2f , 5 .6f , 6 .0f , 6 .5f , 7 .0f , 7 .5f , 8 .0f , 9 .0f , 10 .0f , 11 .0f , 12 .0f , 13 .0f , 14 .0f , 15 .0f , 17 .0f , 19 .0f , 21 .0f , 23 .0f , 25 .0f , 30 .0f , 35 .0f , 40 .0f , 50 .0f }, " pt axis for QA histograms" };
83+
84+
7785 std::vector<int > mEnabledDecays ;
7886 void init (o2::framework::InitContext&)
7987 {
@@ -86,6 +94,14 @@ struct OnTheFlyDecayer {
8694 mEnabledDecays .push_back (pdgCodes[i]);
8795 }
8896 }
97+
98+ histos.add (" K0S/hGenK0S" , " hGenK0S" , kTH2D , {axisRadius, axisPt});
99+ histos.add (" Lambda/hGenLambda" , " hGenLambda" , kTH2D , {axisRadius, axisPt});
100+ histos.add (" AntiLambda/hGenAntiLambda" , " hGenAntiLambda" , kTH2D , {axisRadius, axisPt});
101+ histos.add (" Xi/hGenXi" , " hGenXi" , kTH2D , {axisRadius, axisPt});
102+ histos.add (" AntiXi/hGenAntiXi" , " hGenAntiXi" , kTH2D , {axisRadius, axisPt});
103+ histos.add (" Omega/hGenOmega" , " hGenOmega" , kTH2D , {axisRadius, axisPt});
104+ histos.add (" AntiOmega/hGenAntiOmega" , " hGenAntiOmega" , kTH2D , {axisRadius, axisPt});
89105 }
90106
91107 bool canDecay (const int pdgCode)
@@ -103,7 +119,6 @@ struct OnTheFlyDecayer {
103119 o2::track::TrackParCov o2track;
104120 o2::upgrade::convertMCParticleToO2Track (particle, o2track, pdgDB);
105121 std::vector<o2::upgrade::OTFParticle> decayDaughters = decayer.decayParticle (pdgDB, o2track, particle.pdgCode ());
106- std::cout << particle.pdgCode () << " decayed into: " ;
107122 for (const auto & dau : decayDaughters) {
108123 o2::track::TrackParCov dauTrack;
109124 o2::upgrade::convertOTFParticleToO2Track (dau, dauTrack, pdgDB);
@@ -114,9 +129,38 @@ struct OnTheFlyDecayer {
114129 }
115130 }
116131 }
117- std::vector<bool > isFinalState;
132+
133+ if (decayDaughters.empty ()) {
134+ LOG (error) << " Attempted to decay " << particle.pdgCode () << " but resulting vector of daugthers were empty" ;
135+ continue ;
136+ }
137+
138+
139+ const float decayRadius2D = std::hypot (decayDaughters[0 ].vx , decayDaughters[0 ].vy );
140+ std::cout << particle.pdgCode () << " : " << decayRadius2D << std::endl;
141+ if (particle.pdgCode () == kK0Short ) {
142+ histos.fill (HIST (" K0S/hGenK0S" ), decayRadius2D, particle.pt ());
143+ } else if (particle.pdgCode () == kLambda0 ) {
144+ histos.fill (HIST (" Lambda/hGenLambda" ), decayRadius2D, particle.pt ());
145+ } else if (particle.pdgCode () == kLambda0Bar ) {
146+ histos.fill (HIST (" AntiLambda/hGenAntiLambda" ), decayRadius2D, particle.pt ());
147+ } else if (particle.pdgCode () == kXiMinus ) {
148+ histos.fill (HIST (" Xi/hGenXi" ), decayRadius2D, particle.pt ());
149+ } else if (particle.pdgCode () == kXiPlusBar ) {
150+ histos.fill (HIST (" AntiXi/hGenAntiXi" ), decayRadius2D, particle.pt ());
151+ } else if (particle.pdgCode () == kOmegaMinus ) {
152+ histos.fill (HIST (" Omega/hGenOmega" ), decayRadius2D, particle.pt ());
153+ } else if (particle.pdgCode () == kOmegaPlusBar ) {
154+ histos.fill (HIST (" AntiOmega/hGenAntiOmega" ), decayRadius2D, particle.pt ());
155+ }
156+
118157 for (size_t i = 0 ; i < decayDaughters.size (); ++i) {
119- isFinalState.push_back (!canDecay (decayDaughters[i].pdgCode ));
158+ const o2::upgrade::OTFParticle& dau = decayDaughters[i];
159+ const bool isAlive = !canDecay (dau.pdgCode );
160+ tableMcParticles (particle.globalIndex (),
161+ isAlive, dau.pdgCode ,
162+ dau.vx , dau.vy , dau.vz ,
163+ dau.px , dau.py , dau.pz );
120164 }
121165 }
122166 }
0 commit comments