Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4QuasiElasticChannel Class Reference

#include <G4QuasiElasticChannel.hh>

Public Member Functions

 G4QuasiElasticChannel ()
 
 ~G4QuasiElasticChannel ()
 
G4double GetFraction (G4Nucleus &theNucleus, const G4DynamicParticle &thePrimary)
 
G4KineticTrackVectorScatter (G4Nucleus &theNucleus, const G4DynamicParticle &thePrimary)
 

Detailed Description

Definition at line 52 of file G4QuasiElasticChannel.hh.

Constructor & Destructor Documentation

G4QuasiElasticChannel::G4QuasiElasticChannel ( )

Definition at line 62 of file G4QuasiElasticChannel.cc.

63  : theQuasiElastic(G4QuasiElRatios::GetPointer()),
64  the3DNucleus(new G4Fancy3DNucleus) {}
static G4QuasiElRatios * GetPointer()
G4QuasiElasticChannel::~G4QuasiElasticChannel ( )

Definition at line 66 of file G4QuasiElasticChannel.cc.

67 {
68  delete the3DNucleus;
69 }

Member Function Documentation

G4double G4QuasiElasticChannel::GetFraction ( G4Nucleus theNucleus,
const G4DynamicParticle thePrimary 
)

Definition at line 71 of file G4QuasiElasticChannel.cc.

References G4cout, G4endl, G4Nucleus::GetA_asInt(), G4DynamicParticle::GetDefinition(), G4Nucleus::GetN_asInt(), G4ParticleDefinition::GetPDGEncoding(), G4QuasiElRatios::GetRatios(), G4DynamicParticle::GetTotalMomentum(), and G4Nucleus::GetZ_asInt().

Referenced by G4TheoFSGenerator::ApplyYourself().

73 {
74  #ifdef debug_scatter
75  G4cout << "G4QuasiElasticChannel:: P=" << thePrimary.GetTotalMomentum()
76  << ", pPDG=" << thePrimary.GetDefinition()->GetPDGEncoding()
77  << ", Z = " << theNucleus.GetZ_asInt())
78  << ", N = " << theNucleus.GetN_asInt())
79  << ", A = " << theNucleus.GetA_asInt() << G4endl;
80  #endif
81 
82  std::pair<G4double,G4double> ratios;
83  ratios=theQuasiElastic->GetRatios(thePrimary.GetTotalMomentum(),
84  thePrimary.GetDefinition()->GetPDGEncoding(),
85  theNucleus.GetZ_asInt(),
86  theNucleus.GetN_asInt());
87  #ifdef debug_scatter
88  G4cout << "G4QuasiElasticChannel::ratios " << ratios.first << " x " <<ratios.second
89  << " = " << ratios.first*ratios.second << G4endl;
90  #endif
91 
92  return ratios.first*ratios.second;
93 }
std::pair< G4double, G4double > GetRatios(G4double pIU, G4int prPDG, G4int tgZ, G4int tgN)
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
G4ParticleDefinition * GetDefinition() const
G4double GetTotalMomentum() const
G4GLOB_DLL std::ostream G4cout
G4int GetN_asInt() const
Definition: G4Nucleus.hh:112
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
#define G4endl
Definition: G4ios.hh:61
G4KineticTrackVector * G4QuasiElasticChannel::Scatter ( G4Nucleus theNucleus,
const G4DynamicParticle thePrimary 
)

Definition at line 95 of file G4QuasiElasticChannel.cc.

References CLHEP::HepLorentzVector::e(), G4cout, G4endl, G4lrint(), G4UniformRand, G4DynamicParticle::Get4Momentum(), G4Nucleus::GetA_asInt(), G4DynamicParticle::GetDefinition(), G4IonTable::GetIon(), G4ParticleTable::GetIonTable(), G4V3DNucleus::GetMass(), G4V3DNucleus::GetNucleons(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetPDGCharge(), G4ParticleDefinition::GetPDGEncoding(), G4ParticleDefinition::GetPDGMass(), G4Nucleus::GetZ_asInt(), G4V3DNucleus::Init(), CLHEP::Hep3Vector::mag2(), python.hepunit::MeV, G4Neutron::Neutron(), G4QuasiElRatios::Scatter(), CLHEP::HepLorentzVector::setE(), sqr(), and CLHEP::HepLorentzVector::vect().

Referenced by G4TheoFSGenerator::ApplyYourself().

97 {
98  G4int A=theNucleus.GetA_asInt();
99  G4int Z=theNucleus.GetZ_asInt();
100  // build Nucleus and choose random nucleon to scatter with
101  the3DNucleus->Init(theNucleus.GetA_asInt(),theNucleus.GetZ_asInt());
102  const std::vector<G4Nucleon>& nucleons=the3DNucleus->GetNucleons();
103  G4double targetNucleusMass=the3DNucleus->GetMass();
104  G4LorentzVector targetNucleus4Mom(0.,0.,0.,targetNucleusMass);
105  G4int index;
106  do {
107  index=G4lrint((A-1)*G4UniformRand());
108  } while (index < 0 || index >= static_cast<G4int>(nucleons.size()));
109 
110  G4ParticleDefinition * pDef= nucleons[index].GetDefinition();
111 
112  G4int resA=A - 1;
113  G4int resZ=Z - static_cast<int>(pDef->GetPDGCharge());
114  G4ParticleDefinition* resDef;
115  G4double residualNucleusMass;
116  if(resZ)
117  {
118  resDef=G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(resZ,resA,0);
119  residualNucleusMass=resDef->GetPDGMass();
120  }
121  else {
122  resDef=G4Neutron::Neutron();
123  residualNucleusMass=resA * G4Neutron::Neutron()->GetPDGMass();
124  }
125  #ifdef debug_scatter
126  G4cout<<"G4QElChan::Scatter: neutron - proton? A ="<<A<<", Z="<<Z<<", projName="
127  <<pDef->GetParticleName()<<G4endl;
128  #endif
129 
130  G4LorentzVector pNucleon=nucleons[index].Get4Momentum();
131  G4double residualNucleusEnergy=std::sqrt(sqr(residualNucleusMass) +
132  pNucleon.vect().mag2());
133  pNucleon.setE(targetNucleusMass-residualNucleusEnergy);
134  G4LorentzVector residualNucleus4Mom=targetNucleus4Mom-pNucleon;
135 
136  std::pair<G4LorentzVector,G4LorentzVector> result;
137 
138  result=theQuasiElastic->Scatter(pDef->GetPDGEncoding(),pNucleon,
139  thePrimary.GetDefinition()->GetPDGEncoding(),
140  thePrimary.Get4Momentum());
141  G4LorentzVector scatteredHadron4Mom;
142  if (result.first.e() > 0.)
143  scatteredHadron4Mom=result.second;
144  else { //scatter failed
145  //G4cout << "Warning - G4QuasiElasticChannel::Scatter no scattering" << G4endl;
146  //return 0; //no scatter
147  scatteredHadron4Mom=thePrimary.Get4Momentum();
148  residualNucleus4Mom=G4LorentzVector(0.,0.,0.,targetNucleusMass);
150  }
151 
152 #ifdef debug_scatter
153  G4LorentzVector EpConservation=pNucleon+thePrimary.Get4Momentum()
154  - result.first - result.second;
155  if ( (EpConservation.vect().mag2() > .01*MeV*MeV )
156  || (std::abs(EpConservation.e()) > 0.1 * MeV ) )
157  {
158  G4cout << "Warning - G4QuasiElasticChannel::Scatter E-p non conservation : "
159  << EpConservation << G4endl;
160  }
161 #endif
162 
164  G4KineticTrack * sPrim=new G4KineticTrack(thePrimary.GetDefinition(),
165  0.,G4ThreeVector(0), scatteredHadron4Mom);
166  ktv->push_back(sPrim);
167  if (result.first.e() > 0.)
168  {
169  G4KineticTrack * sNuc=new G4KineticTrack(pDef, 0.,G4ThreeVector(0), result.first);
170  ktv->push_back(sNuc);
171  }
172  if(resZ || resA==1) // For the only neutron or for tnuclei with Z>0
173  {
174  G4KineticTrack * rNuc=new G4KineticTrack(resDef,
175  0.,G4ThreeVector(0), residualNucleus4Mom);
176  ktv->push_back(rNuc);
177  }
178  else // The residual nucleus consists of only neutrons
179  {
180  residualNucleus4Mom/=resA; // Split 4-mom of A*n system equally
181  for(G4int in=0; in<resA; in++) // Loop over neutrons in A*n system.
182  {
183  G4KineticTrack* rNuc=new G4KineticTrack(resDef,
184  0.,G4ThreeVector(0), residualNucleus4Mom);
185  ktv->push_back(rNuc);
186  }
187  }
188 #ifdef debug_scatter
189  G4cout<<"G4QElC::Scat: Nucleon: "<<result.first <<" mass "<<result.first.mag() << G4endl;
190  G4cout<<"G4QElC::Scat: Project: "<<result.second<<" mass "<<result.second.mag()<< G4endl;
191 #endif
192  return ktv;
193 }
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
CLHEP::Hep3Vector G4ThreeVector
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:449
G4ParticleDefinition * GetDefinition() const
int G4int
Definition: G4Types.hh:78
std::pair< G4LorentzVector, G4LorentzVector > Scatter(G4int NPDG, G4LorentzVector N4M, G4int pPDG, G4LorentzVector p4M)
const G4String & GetParticleName() const
G4IonTable * GetIonTable() const
Hep3Vector vect() const
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
virtual void Init(G4int theA, G4int theZ)=0
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4LorentzVector Get4Momentum() const
G4double GetPDGMass() const
static G4ParticleTable * GetParticleTable()
int G4lrint(double ad)
Definition: templates.hh:163
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
double mag2() const
virtual G4double GetMass()=0
virtual const std::vector< G4Nucleon > & GetNucleons()=0
#define G4endl
Definition: G4ios.hh:61
T sqr(const T &x)
Definition: templates.hh:145
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
CLHEP::HepLorentzVector G4LorentzVector

The documentation for this class was generated from the following files: