1818
1919#include " Framework/O2DatabasePDGPlugin.h"
2020
21-
2221using namespace o2 ;
2322using namespace o2 ::framework;
2423using std::array;
2524
2625struct OnTheFlyDecayer {
27- Service<o2::framework::O2DatabasePDG> pdgDB;
26+ Service<o2::framework::O2DatabasePDG> pdgDB;
2827
2928 void init (o2::framework::InitContext&)
3029 {
3130 }
3231
33- template <typename ParticleType>
34- bool decayParticle (const auto & particle){
35-
36-
37- bool canDecay = false ;
38-
39- switch (particle.pdgCode ()){
40- case 3312 :
41- canDecay = true ;
42- }
43- if (!canDecay){
44- return false ;
45- }
46- // Check that it does not have daughters
47- if (particle.hasDaughters ()){
48- LOG (fatal) << " Particle has daughters" ;
49- }
50-
32+ template <typename ParticleType>
33+ bool decayParticle (const auto & particle)
34+ {
5135
52- const auto & pdgInfo = pdgDB->GetParticle (particle.pdgCode ());
53- if (!pdgInfo) {
54- LOG (fatal) << " PDG code " << particle.pdgCode () << " not found in the database" ;
55- }
56-
36+ bool canDecay = false ;
5737
38+ switch (particle.pdgCode ()) {
39+ case 3312 :
40+ canDecay = true ;
41+ }
42+ if (!canDecay) {
43+ return false ;
44+ }
45+ // Check that it does not have daughters
46+ if (particle.hasDaughters ()) {
47+ LOG (fatal) << " Particle has daughters" ;
48+ }
5849
50+ const auto & pdgInfo = pdgDB->GetParticle (particle.pdgCode ());
51+ if (!pdgInfo) {
52+ LOG (fatal) << " PDG code " << particle.pdgCode () << " not found in the database" ;
53+ }
5954
6055 const double u = rand.Uniform (0 , 1 );
6156 double xi_mass = o2::constants::physics::MassXiMinus;
@@ -65,14 +60,13 @@ LOG(fatal) << "Particle has daughters";
6560
6661 double mass = 0 .;
6762 double tau = 0 .;
68- // Compute channel
69- switch (particle.pdgCode ())
70- {
71- case 3312 :
63+ // Compute channel
64+ switch (particle.pdgCode ()) {
65+ case 3312 :
7266 mass = xi_mass;
7367 tau = 4.91 ;
7468 break ;
75- case 3112 :
69+ case 3112 :
7670 mass = la_mass;
7771 tau = 7.89 ;
7872 break ;
@@ -84,12 +78,10 @@ LOG(fatal) << "Particle has daughters";
8478 // If the particle is charged, then propagate in the mag field
8579 o2::math_utils::CircleXYf_t circle;
8680 if (pdgInfo->Charge () != 0 ) {
87- float sna, csa;
88- track.getCircleParams (magneticField, circle, sna, csa);
89- }
90- else { // Neutral particles
91-
92- }
81+ float sna, csa;
82+ track.getCircleParams (magneticField, circle, sna, csa);
83+ } else { // Neutral particles
84+ }
9385 const double rxy = rxyz / sqrt (1 . + track.getTgl () * track.getTgl ());
9486 const double theta = rxy / circle.rC ;
9587 const double newX = ((particle.vx () - circle.xC ) * std::cos (theta) - (particle.vy () - circle.yC ) * std::sin (theta)) + circle.xC ;
@@ -123,19 +115,17 @@ LOG(fatal) << "Particle has daughters";
123115 laDecay.Generate ();
124116 decayDaughters.push_back (*laDecay.GetDecay (0 ));
125117 decayDaughters.push_back (*laDecay.GetDecay (1 ));
126-
127- }
128-
118+ }
129119
130120 void process (aod::McCollision const & mcCollision,
131121 aod::McParticles const & mcParticles)
132122 {
133- for (const auto & particle : mcParticles) {
134- decayParticle (particle);
135- }
136- };
123+ for (const auto & particle : mcParticles) {
124+ decayParticle (particle);
125+ }
126+ };
137127
138- WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
139- {
140- return WorkflowSpec{adaptAnalysisTask<OnTheFlyDecayer>(cfgc)};
141- }
128+ WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
129+ {
130+ return WorkflowSpec{adaptAnalysisTask<OnTheFlyDecayer>(cfgc)};
131+ }
0 commit comments