Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ParticleHPEnAngCorrelation Class Reference

#include <G4ParticleHPEnAngCorrelation.hh>

Public Member Functions

 G4ParticleHPEnAngCorrelation ()
 
 G4ParticleHPEnAngCorrelation (G4ParticleDefinition *proj)
 
 ~G4ParticleHPEnAngCorrelation ()
 
void Init (std::istream &aDataFile)
 
G4ReactionProductSampleOne (G4double anEnergy)
 
G4ReactionProductVectorSample (G4double anEnergy)
 
void SetTarget (G4ReactionProduct &aTarget)
 
void SetProjectileRP (G4ReactionProduct &aIncidentPart)
 
G4bool InCharge ()
 
G4double GetTargetMass ()
 
G4double GetTotalMeanEnergy ()
 

Detailed Description

Definition at line 43 of file G4ParticleHPEnAngCorrelation.hh.

Constructor & Destructor Documentation

G4ParticleHPEnAngCorrelation::G4ParticleHPEnAngCorrelation ( )
inline

Definition at line 54 of file G4ParticleHPEnAngCorrelation.hh.

55  {
56  theProjectile = G4Neutron::Neutron();
57  theProducts = 0;
58  inCharge = false;
59  toBeCached val;
60  fCache.Put( val );
61  //theTotalMeanEnergy = -1.;
62  fCache.Get().theTotalMeanEnergy = -1.;
63  targetMass = 0.0;
64  frameFlag = 0;
65  nProducts = 0;
66  bAdjustFinalState = true;
67  }
value_type & Get() const
Definition: G4Cache.hh:282
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
void Put(const value_type &val) const
Definition: G4Cache.hh:286

Here is the call graph for this function:

G4ParticleHPEnAngCorrelation::G4ParticleHPEnAngCorrelation ( G4ParticleDefinition proj)
inline

Definition at line 68 of file G4ParticleHPEnAngCorrelation.hh.

69  : theProjectile(proj)
70  {
71  theProducts = 0;
72  inCharge = false;
73  toBeCached val;
74  fCache.Put( val );
75  //theTotalMeanEnergy = -1.;
76  fCache.Get().theTotalMeanEnergy = -1.;
77  targetMass = 0.0;
78  frameFlag = 0;
79  nProducts = 0;
80  bAdjustFinalState = true;
81  }
value_type & Get() const
Definition: G4Cache.hh:282
void Put(const value_type &val) const
Definition: G4Cache.hh:286

Here is the call graph for this function:

G4ParticleHPEnAngCorrelation::~G4ParticleHPEnAngCorrelation ( )
inline

Definition at line 83 of file G4ParticleHPEnAngCorrelation.hh.

84  {
85  if(theProducts!=0) delete [] theProducts;
86  }

Member Function Documentation

G4double G4ParticleHPEnAngCorrelation::GetTargetMass ( )
inline

Definition at line 131 of file G4ParticleHPEnAngCorrelation.hh.

131 { return targetMass; }

Here is the caller graph for this function:

G4double G4ParticleHPEnAngCorrelation::GetTotalMeanEnergy ( )
inline

Definition at line 133 of file G4ParticleHPEnAngCorrelation.hh.

134  {
135  // cashed in 'sample' call
136  return fCache.Get().theTotalMeanEnergy;
137  }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4ParticleHPEnAngCorrelation::InCharge ( )
inline

Definition at line 126 of file G4ParticleHPEnAngCorrelation.hh.

127  {
128  return inCharge;
129  }
void G4ParticleHPEnAngCorrelation::Init ( std::istream &  aDataFile)
inline

Definition at line 88 of file G4ParticleHPEnAngCorrelation.hh.

89  {
90  bAdjustFinalState = true;
91  const char* ctmp = getenv("G4PHP_DO_NOT_ADJUST_FINAL_STATE");
92  if( ctmp && G4String(ctmp) == "1" ) {
93  bAdjustFinalState = false;
94  }
95 //T.K. Comment out following line to keep the condition at the validation efforts compairng NeutronHP and PartileHP for neutrons (2015 Sep.)
96 //#ifdef PHP_AS_HP
97 // bAdjustFinalState = false;
98 //#endif
99 
100  inCharge = true;
101  aDataFile>>targetMass>>frameFlag>>nProducts;
102  theProducts = new G4ParticleHPProduct[nProducts];
103  for(G4int i=0; i<nProducts; i++)
104  {
105  theProducts[i].Init(aDataFile,theProjectile);
106  }
107 
108  }
void Init(std::istream &aDataFile, G4ParticleDefinition *projectile)
int G4int
Definition: G4Types.hh:78

Here is the call graph for this function:

Here is the caller graph for this function:

G4ReactionProductVector * G4ParticleHPEnAngCorrelation::Sample ( G4double  anEnergy)

Definition at line 75 of file G4ParticleHPEnAngCorrelation.cc.

76 {
78  G4int i;
80  G4ReactionProduct theCMS;
82 
83  if(frameFlag==2
84  || frameFlag==3) // Added for particle HP
85  {
86  // simplify and double check @
87  G4ThreeVector the3IncidentPart = fCache.Get().theProjectileRP->GetMomentum(); //theProjectileRP has value in LAB
88  G4double nEnergy = fCache.Get().theProjectileRP->GetTotalEnergy();
89  G4ThreeVector the3Target = fCache.Get().theTarget->GetMomentum(); //theTarget has value in LAB
90  G4double tEnergy = fCache.Get().theTarget->GetTotalEnergy();
91  G4double totE = nEnergy+tEnergy;
92  G4ThreeVector the3CMS = the3Target+the3IncidentPart;
93  theCMS.SetMomentum(the3CMS);
94  G4double cmsMom = std::sqrt(the3CMS*the3CMS);
95  G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
96  theCMS.SetMass(sqrts);
97  theCMS.SetTotalEnergy(totE);
98  G4ReactionProduct aIncidentPart;
99  aIncidentPart.Lorentz(*fCache.Get().theProjectileRP, theCMS);
100  //TKDB 100413
101  //ENDF-6 Formats Manual ENDF-102
102  //CHAPTER 6. FILE 6: PRODUCT ENERGY-ANGLE DISTRIBUTIONS
103  //LCT Reference system for secondary energy and angle (incident energy is always given in the LAB system)
104  //anEnergy = aIncidentPart.GetKineticEnergy();
105  anEnergy = fCache.Get().theProjectileRP->GetKineticEnergy(); //should be same argumment of "anEnergy"
106 
107  G4LorentzVector Ptmp (aIncidentPart.GetMomentum(), aIncidentPart.GetTotalEnergy());
108 
109  toZ.rotateZ(-1*Ptmp.phi());
110  toZ.rotateY(-1*Ptmp.theta());
111  }
112  fCache.Get().theTotalMeanEnergy=0;
113  G4LorentzRotation toLab(toZ.inverse()); //toLab only change axis NOT to LAB system
114  //- get first number of particles, to check if sum of Z and N is not bigger than target values
115  std::vector<int> nParticles;
116  bool bNPOK = true;
117 //TKDB_PHP_150507
118 #ifdef PHP_AS_HP
119 #endif
120 //TKDB_PHP_161107
121  G4int iTry(0);
122 //TKDB_PHP_161107
123 //TKDB_PHP_150507
124  do {
125  G4int sumZ = 0;
126  G4int sumA = 0;
127  nParticles.clear();
128  for(i=0; i<nProducts; i++)
129  {
130  G4int massCode = G4int(theProducts[i].GetMassCode());
131  G4int nPart;
132  nPart = theProducts[i].GetMultiplicity(anEnergy);
133  sumZ += massCode/1000 * nPart;
134  sumA += massCode % 1000 * nPart;
135 #ifdef G4PHPDEBUG
136  if( getenv("G4ParticleHPDebug") ) G4cout << i << " G4ParticleHPEnAngCorrelation::MULTIPLICITY " << massCode << " sumZ " << sumZ << " sumA " << sumA << " NPART " << nPart << G4endl;
137 #endif
138  nParticles.push_back( nPart );
139  }
140  bNPOK = true;
141  double targetZ = fCache.Get().theTarget->GetDefinition()->GetAtomicNumber();
142  double targetA = fCache.Get().theTarget->GetDefinition()->GetAtomicMass();
143  targetZ += fCache.Get().theProjectileRP->GetDefinition()->GetAtomicNumber();
144  targetA += fCache.Get().theProjectileRP->GetDefinition()->GetAtomicMass();
145  if( bAdjustFinalState ) {
146  if ( (sumZ != targetZ || sumA != targetA ) &&
147  (sumZ > targetZ || sumA > targetA
148  || ! G4IonTable::GetIonTable()->GetIon ( int(targetZ - sumZ), (int)(targetA - sumA), 0.0 ) ) ){ // e.g. Z=3, A=2
149  bNPOK = false;
150  //nParticles.clear();
151 #ifdef G4PHPDEBUG
152  if( getenv("G4ParticleHPDebug") )
153  G4cerr << " WRONG MULTIPLICITY Z= " << sumZ
154  << " > " << targetZ
155  << " A= " << sumA
156  << " > " << targetA << G4endl;
157 #endif
158  }
159  }
160 //TKDB_PHP_150507
161 #ifdef PHP_AS_HP
162 #endif
163 //TKDB_PHP_161107
164  iTry++;
165  if ( iTry > 1024 ) {
166  G4Exception("G4ParticleHPEnAngCorrelation::Sample",
167  "Warning",
168  JustWarning,
169  "Too many trials were done. Exiting current loop by force. You may have Probably, the result violating (baryon number) conservation law will be obtained.");
170  bNPOK=true;
171  }
172 //TKDB_PHP_161107
173 //TKDB_PHP_150507
174 
175  }while(!bNPOK); // Loop checking, 11.05.2015, T. Koi
176 
177  for(i=0; i<nProducts; i++)
178  {
179  //- if( nParticles[i] == 0 ) continue;
180  it = theProducts[i].Sample(anEnergy,nParticles[i]);
181  G4double aMeanEnergy = theProducts[i].MeanEnergyOfThisInteraction();
182  // if( getenv("G4PHPTEST") ) G4cout << " EnAnG energy sampled " << it->operator[](0)->GetKineticEnergy() << " aMeanEnergy " << aMeanEnergy << G4endl; // GDEB
183  //if(aMeanEnergy>0)
184  //151120 TK Modified for solving reproducibility problem
185  //This change may have side effect.
186  if(aMeanEnergy>=0)
187  {
188  fCache.Get().theTotalMeanEnergy += aMeanEnergy;
189  }
190  else
191  {
192  fCache.Get().theTotalMeanEnergy = anEnergy/nProducts+theProducts[i].GetQValue();
193  }
194  if(it!=0)
195  {
196  for(unsigned int ii=0; ii<it->size(); ii++)
197  {
198  //if(!getenv("G4PHP_NO_LORENTZ_BOOST")) {
199  G4LorentzVector pTmp1 (it->operator[](ii)->GetMomentum(),
200  it->operator[](ii)->GetTotalEnergy());
201  pTmp1 = toLab*pTmp1;
202  if( getenv("G4PHPTEST") ) G4cout << " G4particleHPEnAngCorrelation COS THETA " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
203  it->operator[](ii)->SetMomentum(pTmp1.vect());
204  it->operator[](ii)->SetTotalEnergy(pTmp1.e());
205  if( getenv("G4PHPTEST") ) G4cout << " G4particleHPEnAngCorrelation COS THETA after toLab " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
206 
207  if(frameFlag==1) // target rest //TK 100413 should be LAB?
208  {
209  it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*fCache.Get().theTarget)); //TK 100413 Is this really need?
210  }
211  else if(frameFlag==2 ) // CMS
212  {
213 #ifdef G4PHPDEBUG
214  if( getenv("G4ParticleHPDebug") )
215  G4cout <<"G4ParticleHPEnAngCorrelation: before Lorentz boost "<<
216  it->at(ii)->GetKineticEnergy()<<" "<<
217  it->at(ii)->GetMomentum()<<G4endl;
218 #endif
219  it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
220 #ifdef G4PHPDEBUG
221  if( getenv("G4ParticleHPDebug") )
222  G4cout <<"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
223  it->at(ii)->GetKineticEnergy()<<" "<<
224  it->at(ii)->GetMomentum()<<G4endl;
225 #endif
226  }
227  //TK120515 migrate frameFlag (MF6 LCT) = 3
228  else if(frameFlag==3) // CMS A<=4 other LAB
229  {
230  if ( theProducts[i].GetMassCode() > 4 ) //Alpha AWP 3.96713
231  {
232  //LAB
233  it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*fCache.Get().theTarget)); //TK 100413 Is this really need?
234 #ifdef G4PHPDEBUG
235  if( getenv("G4ParticleHPDebug") )
236  G4cout <<"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
237  it->at(ii)->GetKineticEnergy()<<" "<<
238  it->at(ii)->GetMomentum()<<G4endl;
239 #endif
240  }
241  else
242  {
243  //CMS
244  it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
245 #ifdef G4PHPDEBUG
246  if( getenv("G4ParticleHPDebug") )
247  G4cout <<"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
248  it->at(ii)->GetKineticEnergy()<<" "<<
249  it->at(ii)->GetMomentum()<<G4endl;
250 #endif
251  }
252  }
253  else
254  {
255  throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPEnAngCorrelation::Sample: The frame of the finalstate is not specified");
256  }
257  if( getenv("G4PHPTEST") ) G4cout << frameFlag << " G4particleHPEnAngCorrelation COS THETA after Lorentz " << std::cos(it->operator[](ii)->GetMomentum().theta()) << G4endl;
258 
259  // }//getenv("G4PHP_NO_LORENTZ_BOOST"))
260  // G4cout << ii << " EnAnG energy after boost " << it->operator[](ii)->GetKineticEnergy() << G4endl; //GDEB
261  result->push_back(it->operator[](ii));
262  }
263  delete it;
264  }
265  }
266 
267  return result;
268 }
G4double G4ParticleHPJENDLHEData::G4double result
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetMomentum(const G4double x, const G4double y, const G4double z)
value_type & Get() const
Definition: G4Cache.hh:282
G4double MeanEnergyOfThisInteraction()
int G4int
Definition: G4Types.hh:78
HepLorentzRotation & rotateY(double delta)
std::vector< G4ReactionProduct * > G4ReactionProductVector
void SetMass(const G4double mas)
G4GLOB_DLL std::ostream G4cout
void SetTotalEnergy(const G4double en)
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
HepLorentzRotation & rotateZ(double delta)
G4double GetTotalEnergy() const
G4int GetMultiplicity(G4double anEnergy)
G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles)
G4ThreeVector GetMomentum() const
#define G4endl
Definition: G4ios.hh:61
HepLorentzRotation inverse() const
double G4double
Definition: G4Types.hh:76
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

G4ReactionProduct * G4ParticleHPEnAngCorrelation::SampleOne ( G4double  anEnergy)

Definition at line 40 of file G4ParticleHPEnAngCorrelation.cc.

41 {
43 
44  // do we have an appropriate distribution
45  if(nProducts!=1) throw G4HadronicException(__FILE__, __LINE__, "More than one product in SampleOne");
46 
47  // get the result
48  G4ReactionProductVector * temp=0;
49  G4int i=0;
50 
51  G4int icounter=0;
52  G4int icounter_max=1024;
53  while(temp == 0) {
54  icounter++;
55  if ( icounter > icounter_max ) {
56  G4cout << "Loop-counter exceeded the threshold value at " << __LINE__ << "th line of " << __FILE__ << "." << G4endl;
57  break;
58  }
59  temp = theProducts[i++].Sample(anEnergy,1);
60  }
61 
62  // is the multiplicity correct
63  if(temp->size()!=1) throw G4HadronicException(__FILE__, __LINE__, "SampleOne: Yield not correct");
64 
65  // fill result
66  result = temp->operator[](0);
67 
68  // some garbage collection
69  delete temp;
70 
71  // return result
72  return result;
73 }
G4double G4ParticleHPJENDLHEData::G4double result
int G4int
Definition: G4Types.hh:78
std::vector< G4ReactionProduct * > G4ReactionProductVector
G4GLOB_DLL std::ostream G4cout
G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles)
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

void G4ParticleHPEnAngCorrelation::SetProjectileRP ( G4ReactionProduct aIncidentPart)
inline

Definition at line 120 of file G4ParticleHPEnAngCorrelation.hh.

121  {
122  fCache.Get().theProjectileRP = &aIncidentPart;
123  for(G4int i=0;i<nProducts;i++)theProducts[i].SetProjectileRP(fCache.Get().theProjectileRP);
124  }
void SetProjectileRP(G4ReactionProduct &aIncidentPart)
value_type & Get() const
Definition: G4Cache.hh:282
int G4int
Definition: G4Types.hh:78

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ParticleHPEnAngCorrelation::SetTarget ( G4ReactionProduct aTarget)
inline

Definition at line 114 of file G4ParticleHPEnAngCorrelation.hh.

115  {
116  fCache.Get().theTarget = &aTarget;
117  for(G4int i=0;i<nProducts;i++)theProducts[i].SetTarget(fCache.Get().theTarget);
118  }
value_type & Get() const
Definition: G4Cache.hh:282
int G4int
Definition: G4Types.hh:78
void SetTarget(G4ReactionProduct &aTarget)

Here is the call graph for this function:

Here is the caller graph for this function:


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