ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ParticleHPContEnergyAngular.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ParticleHPContEnergyAngular.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // particle_hp -- source file
27 // J.P. Wellisch, Nov-1996
28 // A prototype of the low energy neutron transport model.
29 //
30 // 080721 To be "ClearHistories" effective, the selection scheme of angular distribution is modified by T. Koi
31 //
32 // P. Arce, Dec-2014 Conversion neutron_hp to particle_hp
33 //
35 
37 {
38  G4ReactionProduct * result;
39  G4int i(0);
40  G4int it(0);
41  for(i=0;i<nEnergy;i++)
42  {
43  it = i;
44 #ifdef PHP_AS_HP
45  if(theAngular[i].GetEnergy()>anEnergy) break;
46 #else
47  if(theAngular[i].GetEnergy()>=anEnergy) break;
48 #endif
49  }
50  if( std::getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular dataE " << theAngular[i].GetEnergy() << " > " << anEnergy << " it_theAngular " << it << " interpolation " << theInterpolation << G4endl; //GDEB
51  G4double targetMass = GetTarget()->GetMass();
52  if(it==0)
53  {
57  result = theAngular[0].Sample(anEnergy, massCode, targetMass,
60  }
61  else
62  {
63  // interpolation through alternating sampling. This needs improvement @@@
64  // This is the cause of the He3 problem !!!!!!!!
65  // See to it, if you can improve this.
66  //080714 TK commnet Randomizing use angular distribution
67  //080714 TK Always use the upper side distribution. enabling ClearHistories method.
68  //G4double random = G4UniformRand();
69  //G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
70  //G4double offset = theAngular[it].GetEnergy()-anEnergy;
71  //if(random<offset/deltaE) it--;
72  //--- create new
73  // if( theManager.GetScheme(0) != LINLIN ) { // asserted in G4ParticleHPContEnergyAngular::init there is only one range
74 #ifdef PHP_AS_HP
78  result = theAngular[it].Sample(anEnergy, massCode, targetMass,
81 #else
82  if( std::getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular To BUILDBYINTERPOLATION " << it << " : " << theAngular[it].GetEnergy()<< " , " << theAngular[it].GetNEnergies() << " " << it-1 << " : " << theAngular[it-1].GetEnergy()<< " : " << theAngular[it-1].GetNEnergies() << G4endl; //GDEB
83 
84 // G4ParticleHPContAngularPar * fAngular = new G4ParticleHPContAngularPar(theProjectile ); //fix start
85  if (fCacheAngular.Get() == NULL) {
87  fCacheAngular.Put(angpar);
88  }
94  result = fCacheAngular.Get()->Sample(anEnergy, massCode, targetMass,
98 
99 // delete fAngular; //fix end
100 
101 #endif
102  }
103 
104  // G4cout << " 0 0 @@@ G4ParticleHPContEnergyAngular::Sample " << result->GetDefinition()->GetParticleName() << " E= " << result->GetKineticEnergy() << G4endl;//GDEB
105  return result;
106 }
107 
110 {
111  G4double result(0);
112  if(currentMeanEnergy.Get()<-1)
113  {
114  throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPContEnergyAngular: Logical error in Product class");
115  }
116  else
117  {
118  result = currentMeanEnergy.Get();
119  }
120  currentMeanEnergy.Put( -2 );
121  return result;
122 }
123 
124 
125 
127 {
128  if ( theAngular!= NULL )
129  {
130  for ( G4int i = 0 ; i< nEnergy ; i++ )
132  }
133 }