@@ -14,7 +14,7 @@ class GeneratorPythia8LongLivedGun : public o2::eventgen::GeneratorPythia8
1414{
1515public :
1616 /// constructor
17- GeneratorPythia8LongLivedGun (int input_pdg , int nInject = 1 ) : pdg {input_pdg }, nParticles {nInject }, m {getMass (input_pdg )}
17+ GeneratorPythia8LongLivedGun (int input_pdg , int nInject = 1 , float ptMin = 1 , float ptMax = 10 , int input_pdg2 = -1 ) : pdg {input_pdg }, nParticles {nInject }, genMinPt { ptMin }, genMaxPt { ptMax }, m {getMass (input_pdg )}, pdg2 { input_pdg2 }
1818 {
1919 }
2020
@@ -60,6 +60,23 @@ public:
6060 sign *= randomizePDGsign ? -1 : 1 ;
6161 mParticles .push_back (TParticle (sign * pdg , 1 , -1 , -1 , -1 , -1 , px , py , pz , et , 0. , 0. , 0. , 0. ));
6262 }
63+
64+ if (pdg2 != -1 )
65+ {
66+ for (int i {0 }; i < nParticles ; ++ i )
67+ {
68+ const double pt = gRandom -> Uniform (genMinPt , genMaxPt );
69+ const double eta = gRandom -> Uniform (genMinEta , genMaxEta );
70+ const double phi = gRandom -> Uniform (0 , TMath ::TwoPi ());
71+ const double px {pt * std ::cos (phi )};
72+ const double py {pt * std ::sin (phi )};
73+ const double pz {pt * std ::sinh (eta )};
74+ const double et {std ::hypot (std ::hypot (pt , pz ), m )};
75+ sign *= randomizePDGsign ? -1 : 1 ;
76+ mParticles .push_back (TParticle (sign * pdg2 , 1 , -1 , -1 , -1 , -1 , px , py , pz , et , 0. , 0. , 0. , 0. ));
77+ }
78+ }
79+
6380 return true;
6481 }
6582
@@ -73,11 +90,13 @@ private:
7390 int pdg = 0 ; /// particle pdg code
7491 int nParticles = 1 ; /// Number of injected particles
7592
93+ int pdg2 = -1 ; /// optional second particle pdg code
94+
7695 bool randomizePDGsign = true; /// bool to randomize the PDG code of the core particle
7796};
7897
7998///___________________________________________________________
80- FairGenerator * generateLongLived (int pdg , int nInject )
99+ FairGenerator * generateLongLived (int pdg , int nInject , float ptMin = 1 , float ptMax = 10 , int pdg2 = -1 )
81100{
82- return new GeneratorPythia8LongLivedGun (pdg , nInject );
101+ return new GeneratorPythia8LongLivedGun (pdg , nInject , ptMin , ptMax , pdg2 );
83102}
0 commit comments