INCLConvertParticle.hh
Go to the documentation of this file.
1 #include "Framework/Conventions/GBuild.h"
2 #ifdef __GENIE_INCL_ENABLED__
3 
4 #ifndef INCLConvertParticle_hh
5 #define INCLConvertParticle_hh 1
6 
7 // INCL++
8 #include "G4INCLParticleSpecies.hh" // includes G4INCLParticleType
9 #include "G4INCLParticleTable.hh"
10 
11 // GENIE
16 
17 using namespace genie;
18 
19 namespace G4INCL {
20 
21  int INCLpartycleSpecietoPDGCODE(G4INCL::ParticleSpecies theSpecies) {
22  if (theSpecies.theType != Composite) {
23  if (ParticleTable::getName(theSpecies.theType) == "pi0") return 111;
24  else if (ParticleTable::getName(theSpecies.theType) == "pi+") return 211;
25  else if (ParticleTable::getName(theSpecies.theType) == "pi-") return -211;
26  }
27  if (theSpecies.theA == 1 && theSpecies.theZ == 1) return 2212;
28  else if (theSpecies.theA == 1 && theSpecies.theZ == 0) return 2112;
29  return 0; // return _something_
30  }
31 
32  int INCLtopdgcode(int A, int Z) {
33  if (A == 1 && Z == 1) return 2212;
34  else if (A == 1 && Z == 0) return 2112;
35  else if (A == 0 && Z == 0) return 111;
36  else if (A == 0 && Z == 1) return 211;
37  else if (A == 0 && Z ==-1) return -211;
38  else {
39  return genie::pdg::IonPdgCode( A , Z );
40  }
41  }
42 
43  G4INCL::ParticleType toINCLparticletype(int pdgc) {
44 
45  if (pdgc == 2212) return G4INCL::Proton;
46  else if (pdgc == 2112) return G4INCL::Neutron;
47  else if (pdgc == 211) return G4INCL::PiPlus;
48  else if (pdgc == -211) return G4INCL::PiMinus;
49  else if (pdgc == 111) return G4INCL::PiZero;
50  else if (pdgc == 1000010020) return G4INCL::Composite;
51  else if (pdgc == 1000010030) return G4INCL::Composite;
52  else if (pdgc == 1000020030) return G4INCL::Composite;
53  else if (pdgc == 1000020040) return G4INCL::Composite;
54  else return G4INCL::UnknownParticle;
55 
56  }
57 
58  GHepParticle *INCLtoGenieParticle(G4INCL::EventInfo result,
59  int nP, GHepStatus_t ist, int mom1, int mom2) {
60  int pdg_codeP(0);
61  double E_pnP(0), EKinP = result.EKin[nP];
62  TVector3 p3M(result.px[nP]/1000,result.py[nP]/1000,result.pz[nP]/1000);
63  TLorentzVector x4null(0.,0.,0.,0.);
64  double m_pnP = 0.5*((result.px[nP])*(result.px[nP]) +
65  (result.py[nP])*(result.py[nP]) +
66  (result.pz[nP])*(result.pz[nP]) -
67  EKinP*EKinP) / (EKinP);
68  if (m_pnP < 10 && result.A[nP] == 0 && result.Z[nP] == 0) { // photon
69  pdg_codeP = 22;
70  E_pnP = TMath::Sqrt((result.px[nP])*(result.px[nP]) +
71  (result.py[nP])*(result.py[nP]) +
72  (result.pz[nP])*(result.pz[nP]) );
73  } else {
74  pdg_codeP = INCLtopdgcode(result.A[nP],result.Z[nP]);
75  double Mass_prodPar = PDGLibrary::Instance()->Find(pdg_codeP)->Mass();
76  E_pnP = EKinP + Mass_prodPar*1000;
77  }
78  TLorentzVector p4tgtf(p3M,E_pnP/1000);
79  return new GHepParticle(pdg_codeP,ist,mom1,mom2,-1,-1,p4tgtf,x4null);
80  }
81 
82 }
83 
84 #endif
85 
86 #endif // __GENIE_INCL_ENABLED__
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
static QCString result
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:57
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:68
#define A
Definition: memgrp.cpp:38
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:75
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
enum genie::EGHepStatus GHepStatus_t