GENIEGenerator
Loading...
Searching...
No Matches
PhotonCOHWdecPythia6.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Alfonso Garcia <aagarciasoto \at km3net.de>
7 IFIC (Valencia)
8*/
9//____________________________________________________________________________
10
12
13#ifdef __GENIE_PYTHIA6_ENABLED__
14#if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,6)
15#include <TMCParticle.h>
16#else
17#include <TMCParticle6.h>
18#endif
19#endif
20
21//___________________________________________________________________________
23EventRecordVisitorI("genie::PhotonCOHWdecPythia6")
24{
25 this->Initialize();
26}
27//___________________________________________________________________________
29EventRecordVisitorI("genie::PhotonCOHWdecPythia6", config)
30{
31 this->Initialize();
32}
33//___________________________________________________________________________
38//____________________________________________________________________________
40{
41
42 if(!this->Wdecay(event)) {
43 LOG("PhotonCOHGenerator", pWARN) << "W decayer failed!";
44 event->EventFlags()->SetBitNumber(kHadroSysGenErr, true);
46 exception.SetReason("Could not simulate the W decay system");
47 exception.SwitchOnFastForward();
48 throw exception;
49 return;
50 }
51
52}
53//___________________________________________________________________________
55#ifdef __GENIE_PYTHIA6_ENABLED__
56 event // avoid unused variable warning if PYTHIA6 is not enabled
57#endif
58) const
59{
60
61#ifdef __GENIE_PYTHIA6_ENABLED__
62 Interaction * interaction = event->Summary();
63 const InitialState & init_state = interaction->InitState();
64
65 //incoming v & struck particle & remnant nucleus
66 GHepParticle * nu = event->Probe();
67
68 GHepParticle * target = event -> TargetNucleus();
69 if(target) event->AddParticle(target->Pdg(), kIStFinalStateNuclearRemnant, 1,-1,-1,-1, *(target->P4()), *(target->X4()) );
70
71 TVector3 unit_nu = nu->P4()->Vect().Unit();
72
73 long double Ev = init_state.ProbeE(kRfLab);
74
75 long double Mtgt = init_state.Tgt().Z()*kProtonMass + init_state.Tgt().N()*kNeutronMass;
76
77 long double n1 = interaction->Kine().GetKV(kKVn1);
78 long double n2 = interaction->Kine().GetKV(kKVn2);
79 long double n3 = interaction->Kine().GetKV(kKVn3);
80
81 long double costh = n1;
82 long double sinth = sqrtl(1-costh*costh);
83
84 long double mlout = 0;
85 if (pdg::IsNuE (TMath::Abs(nu->Pdg()))) mlout = kElectronMass;
86 else if (pdg::IsNuMu (TMath::Abs(nu->Pdg()))) mlout = kMuonMass;
87 else if (pdg::IsNuTau(TMath::Abs(nu->Pdg()))) mlout = kTauMass;
88 long double mlout2 = mlout*mlout;
89
90 long double mL = mlout+kMw;
91 long double Delta = sqrtl( powl(2.*Ev*Mtgt-mL*mL,2)-4.*powl(Mtgt*mL,2) );
92 long double s12_min = Ev/(2.*Ev+Mtgt)*(mL*mL+2.*Ev*Mtgt-Delta);
93 long double s12_max = Ev/(2.*Ev+Mtgt)*(mL*mL+2.*Ev*Mtgt+Delta);
94 long double s12 = expl( logl(s12_min)+(logl(s12_max)-logl(s12_min))*n2);
95 long double Q2_min = powl(s12,2)*Mtgt/(2.*Ev*(2.*Ev*Mtgt-s12));
96 long double Q2_max = s12 - mL*mL;
97 double Q2 = expl( logl(Q2_min) + (logl(Q2_max)-logl(Q2_min))*n3 );
98 double s_r = s12 - Q2;
99
100 long double EW = (s_r+kMw2-mlout2)/sqrtl(s_r)/2.;
101 long double El = (s_r-kMw2+mlout2)/sqrtl(s_r)/2.;
102 long double p = sqrtl( EW*EW - kMw2 );
103 LongLorentzVector p4_lout( 0., -p*sinth, -p*costh, El );
104
105 long double bz = 4.*Ev*Mtgt*Q2/(Q2+s_r)/(2.*Ev*Mtgt-Q2) - (2.*Ev*Mtgt+Q2)/(2.*Ev*Mtgt-Q2);
106 long double by = sqrtl(Mtgt*powl(Q2+s_r,2)/(2.*Ev*Q2*(s_r+Q2-2.*Ev*Mtgt))+1.);
107
108 p4_lout.BoostZ(-bz);
109 p4_lout.BoostY(-by);
110
111 TLorentzVector p4l_o(p4_lout.Px(),p4_lout.Py(),p4_lout.Pz(),p4_lout.E());
112 p4l_o.RotateX((double)acosl(by)-kPi/2.);
113
114
115 // Randomize transverse components
117 double phi = 2 * kPi * rnd->RndLep().Rndm();
118
119 p4l_o.RotateZ(phi);
120
121 //rotate from LAB=[0,0,Ev,Ev]->[px,py,pz,E]
122 p4l_o.RotateUz(unit_nu);
123
124 int pdglout = 0;
125 if (pdg::IsAntiNuE (nu->Pdg())) pdglout = kPdgPositron;
126 else if (pdg::IsNuE (nu->Pdg())) pdglout = kPdgElectron;
127 else if (pdg::IsAntiNuMu (nu->Pdg())) pdglout = kPdgAntiMuon;
128 else if (pdg::IsNuMu (nu->Pdg())) pdglout = kPdgMuon;
129 else if (pdg::IsAntiNuTau(nu->Pdg())) pdglout = kPdgAntiTau;
130 else if (pdg::IsNuTau (nu->Pdg())) pdglout = kPdgTau;
131
132 // Create a GHepParticle and add it to the event record
133 event->AddParticle( pdglout, kIStStableFinalState, 0, -1, -1, -1, p4l_o, *(nu->X4()) );
134
135 int pdgboson = pdg::IsNeutrino(init_state.ProbePdg()) ? kPdgWP : kPdgWM;
136
137 int def61 = fPythia->GetMSTP(61);
138 int def71 = fPythia->GetMSTP(71);
139 fPythia->SetMSTP(61,0); // (Default=2) master switch for initial-state QCD and QED radiation.
140 fPythia->SetMSTP(71,0); // (Default=2) master switch for initial-state QCD and QED radiation.
141
142 fPythia->Py1ent( -1, pdgboson, EW, acosl(costh), kPi/2. ); //k(1,2) = 2
143 fPythia->Pyexec();
144
145 fPythia->SetMSTP(61,def61);
146 fPythia->SetMSTP(71,def71);
147
148 fPythia->GetPrimaries();
149 TClonesArray * pythia_particles = (TClonesArray *) fPythia->ImportParticles("All");
150 int np = pythia_particles->GetEntries();
151 assert(np>0);
152
153 TMCParticle * particle = 0;
154 TIter piter(pythia_particles);
155 while( (particle = (TMCParticle *) piter.Next()) ) {
156
157 int pdgc = particle->GetKF();
158 int ks = particle->GetKS();
159
160 LongLorentzVector p4longo(particle->GetPx(), particle->GetPy(), particle->GetPz(), particle->GetEnergy());
161 p4longo.BoostZ(-bz);
162 p4longo.BoostY(-by);
163
164 TLorentzVector p4o(p4longo.Px(),p4longo.Py(),p4longo.Pz(),p4longo.E());
165 p4o.RotateX((double)acosl(by)-kPi/2.);
166 p4o.RotateZ(phi);
167 p4o.RotateUz(unit_nu);
168
169 double massPDG = PDGLibrary::Instance()->Find(pdgc)->Mass();
170 if ( (ks==1 || ks==4) && p4o.E()<massPDG ) {
171 LOG("PhotonCOHGenerator", pWARN) << "Putting at rest one stable particle generated by PYTHIA because E < m";
172 LOG("PhotonCOHGenerator", pWARN) << "PDG = " << pdgc << " // State = " << ks;
173 LOG("PhotonCOHGenerator", pWARN) << "E = " << p4o.E() << " // |p| = " << TMath::Sqrt(p4o.P());
174 LOG("PhotonCOHGenerator", pWARN) << "p = [ " << p4o.Px() << " , " << p4o.Py() << " , " << p4o.Pz() << " ]";
175 LOG("PhotonCOHGenerator", pWARN) << "m = " << p4o.M() << " // mpdg = " << massPDG;
176 p4o.SetXYZT(0,0,0,massPDG);
177 }
178
179 // copy final state particles to the event record
181
182 // fix numbering scheme used for mother/daughter assignments
183 int firstmother = -1;
184 int lastmother = -1;
185 int firstchild = -1;
186 int lastchild = -1;
187
188 if (particle->GetParent()==0) {
189 firstmother = 0;
190 }
191 else {
192 firstmother = particle->GetParent() + 3;
193 if (particle->GetFirstChild()!=0) firstchild = particle->GetFirstChild() + 3;
194 if (particle->GetLastChild() !=0) lastchild = particle->GetLastChild() + 3;
195
196 }
197
198 double vx = nu->X4()->X() + particle->GetVx()*1e12; //pythia gives position in [mm] while genie uses [fm]
199 double vy = nu->X4()->Y() + particle->GetVy()*1e12;
200 double vz = nu->X4()->Z() + particle->GetVz()*1e12;
201 double vt = nu->X4()->T() + particle->GetTime()*(units::millimeter/units::second);
202 TLorentzVector pos( vx, vy, vz, vt );
203
204 event->AddParticle(pdgc, ist, firstmother, lastmother, firstchild, lastchild, p4o, pos );
205
206 }
207
208 delete particle;
209 pythia_particles->Clear("C");
210
211 return true;
212#else
213 return false;
214#endif
215
216}
217//___________________________________________________________________________
223//____________________________________________________________________________
229//____________________________________________________________________________
231{
232
233#ifdef __GENIE_PYTHIA6_ENABLED__
234 GetParam( "SSBarSuppression", fSSBarSuppression );
235 GetParam( "GaussianPt2", fGaussianPt2 );
236 GetParam( "NonGaussianPt2Tail", fNonGaussianPt2Tail );
237 GetParam( "RemainingEnergyCutoff", fRemainingECutoff );
238 GetParam( "DiQuarkSuppression", fDiQuarkSuppression );
239 GetParam( "LightVMesonSuppression", fLightVMesonSuppression );
240 GetParam( "SVMesonSuppression", fSVMesonSuppression );
241 GetParam( "Lunda", fLunda );
242 GetParam( "Lundb", fLundb );
243 GetParam( "LundaDiq", fLundaDiq );
244
245 // PYTHIA parameters only valid for HEDIS
246 double wmin; GetParam( "Xsec-Wmin", wmin ) ;
247 int warnings; GetParam( "Warnings", warnings ) ;
248 int errors; GetParam( "Errors", errors ) ;
249 int qrk_mass; GetParam( "QuarkMass", qrk_mass ) ;
250 fPythia->SetPARP(2, wmin); //(D = 10. GeV) lowest c.m. energy for the event as a whole that the program will accept to simulate. (bellow 2GeV pythia crashes)
251 fPythia->SetMSTU(26, warnings); // (Default=10) maximum number of warnings that are printed
252 fPythia->SetMSTU(22, errors); // (Default=10) maximum number of errors that are printed
253 fPythia->SetMSTJ(93, qrk_mass); // light (d, u, s, c, b) quark masses are taken from PARF(101) - PARF(105) rather than PMAS(1,1) - PMAS(5,1). Diquark masses are given as sum of quark masses, without spin splitting term.
254 fPythia->SetPMAS(24,1,kMw); //mass of the W boson (pythia=80.450 // genie=80.385)
255 fPythia->SetPMAS(24,2,0.); //set to 0 the width of the W boson to avoid problems with energy conservation
256 fPythia->SetPMAS(6,2,0.); //set to 0 the width of the top to avoid problems with energy conservation
257 fPythia->SetMDME(192,1,0); // W->dbar+t decay off
258 fPythia->SetMDME(196,1,0); // W->cbar+t decay off
259 fPythia->SetMDME(200,1,0); // W->cbar+t decay off
260
261 // PYTHIA tuned parameters
262 fPythia->SetPARJ(2, fSSBarSuppression );
263 fPythia->SetPARJ(21, fGaussianPt2 );
264 fPythia->SetPARJ(23, fNonGaussianPt2Tail );
265 fPythia->SetPARJ(33, fRemainingECutoff );
266 fPythia->SetPARJ(1, fDiQuarkSuppression );
267 fPythia->SetPARJ(11, fLightVMesonSuppression );
268 fPythia->SetPARJ(12, fSVMesonSuppression );
269 fPythia->SetPARJ(41, fLunda );
270 fPythia->SetPARJ(42, fLundb );
271 fPythia->SetPARJ(45, fLundaDiq );
272#endif
273
274}
275//____________________________________________________________________________
277{
278
279#ifdef __GENIE_PYTHIA6_ENABLED__
280 fPythia = TPythia6::Instance();
281
282 // sync GENIE/PYTHIA6 seed number
284#endif
285
286}
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
#define pWARN
Definition Messenger.h:60
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62
STDHEP-like event record entry that can fit a particle or a nucleus.
int Pdg(void) const
const TLorentzVector * P4(void) const
const TLorentzVector * X4(void) const
GENIE's GHEP MC event record.
Definition GHepRecord.h:45
Initial State information.
const Target & Tgt(void) const
int ProbePdg(void) const
double ProbeE(RefFrame_t rf) const
Summary information for an interaction.
Definition Interaction.h:56
const Kinematics & Kine(void) const
Definition Interaction.h:71
const InitialState & InitState(void) const
Definition Interaction.h:69
double GetKV(KineVar_t kv) const
static PDGLibrary * Instance(void)
TParticlePDG * Find(int pdgc, bool must_exist=true)
double fDiQuarkSuppression
di-quark suppression parameter
void ProcessEventRecord(GHepRecord *event) const
bool Wdecay(GHepRecord *event) const
double fLunda
Lund a parameter.
double fNonGaussianPt2Tail
non gaussian pt2 tail parameterization
double fSSBarSuppression
ssbar suppression
double fLundb
Lund b parameter.
double fGaussianPt2
gaussian pt2 distribution width
double fLightVMesonSuppression
light vector meson suppression
double fLundaDiq
adjustment of Lund a for di-quark
void Configure(const Registry &config)
double fRemainingECutoff
remaining E cutoff stopping fragmentation
double fSVMesonSuppression
strange vector meson suppression
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition RandomGen.h:29
static RandomGen * Instance()
Access instance.
Definition RandomGen.cxx:74
TRandom3 & RndLep(void) const
rnd number generator used by final state primary lepton generators
Definition RandomGen.h:62
A registry. Provides the container for algorithm configuration parameters.
Definition Registry.h:65
int N(void) const
Definition Target.h:69
int Z(void) const
Definition Target.h:68
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
bool IsAntiNuTau(int pdgc)
Definition PDGUtils.cxx:183
bool IsNuE(int pdgc)
Definition PDGUtils.cxx:158
bool IsAntiNuE(int pdgc)
Definition PDGUtils.cxx:173
bool IsAntiNuMu(int pdgc)
Definition PDGUtils.cxx:178
bool IsNeutrino(int pdgc)
Definition PDGUtils.cxx:110
bool IsNuMu(int pdgc)
Definition PDGUtils.cxx:163
bool IsNuTau(int pdgc)
Definition PDGUtils.cxx:168
static constexpr double millimeter
Definition Units.h:41
static constexpr double second
Definition Units.h:37
Simple functions for loading and reading nucleus dependent keys from config files.
@ kIStFinalStateNuclearRemnant
Definition GHepStatus.h:38
@ kIStDISPreFragmHadronicState
Definition GHepStatus.h:35
@ kIStStableFinalState
Definition GHepStatus.h:30
const int kPdgAntiMuon
Definition PDGCodes.h:38
const int kPdgWM
Definition PDGCodes.h:192
const int kPdgTau
Definition PDGCodes.h:39
enum genie::EGHepStatus GHepStatus_t
@ kKVn2
Definition KineVar.h:62
@ kKVn1
Definition KineVar.h:61
@ kKVn3
Definition KineVar.h:63
@ kRfLab
Definition RefFrame.h:26
const int kPdgWP
Definition PDGCodes.h:191
const int kPdgMuon
Definition PDGCodes.h:37
const int kPdgPositron
Definition PDGCodes.h:36
@ kHadroSysGenErr
Definition GHepFlags.h:32
const int kPdgAntiTau
Definition PDGCodes.h:40
const int kPdgElectron
Definition PDGCodes.h:35