ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ParticleHPEnAngCorrelation.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ParticleHPEnAngCorrelation.hh
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 //
27 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
28 //
29 #ifndef G4ParticleHPEnAngCorrelation_h
30 #define G4ParticleHPEnAngCorrelation_h 1
31 
32 #include <fstream>
33 
34 #include "globals.hh"
35 #include "G4ParticleHPVector.hh"
36 #include "Randomize.hh"
37 #include "G4ios.hh"
38 #include "globals.hh"
39 #include "G4ParticleHPProduct.hh"
40 #include "G4ReactionProduct.hh"
41 #include "G4Cache.hh"
42 
44 
46 {
47  struct toBeCached
48  {
54  };
55 
56 public:
57 
58  G4ParticleHPEnAngCorrelation() // for G4ParticleHPCaptureFS::theMF6FinalState
59  {
61  theProducts = 0;
62  inCharge = false;
63  toBeCached val;
64  fCache.Put( val );
65  //theTotalMeanEnergy = -1.;
66  fCache.Get().theTotalMeanEnergy = -1.;
67  targetMass = 0.0;
68  frameFlag = 0;
69  nProducts = 0;
70  bAdjustFinalState = true;
71  }
72 
74  : theProjectile(proj)
75  {
76  theProducts = 0;
77  inCharge = false;
78  toBeCached val;
79  fCache.Put( val );
80  //theTotalMeanEnergy = -1.;
81  fCache.Get().theTotalMeanEnergy = -1.;
82  targetMass = 0.0;
83  frameFlag = 0;
84  nProducts = 0;
85  bAdjustFinalState = true;
86  }
87 
89  {
90  if(theProducts!=0) delete [] theProducts;
91  }
92 
93  inline void Init(std::istream & aDataFile)
94  {
95  bAdjustFinalState = true;
96  const char* ctmp = std::getenv("G4PHP_DO_NOT_ADJUST_FINAL_STATE");
97  if( ctmp && G4String(ctmp) == "1" )
98  {
99  bAdjustFinalState = false;
100  }
101 
102 // T.K. Comment out following line to keep the condition at the
103 // validation efforts comparing NeutronHP and PartileHP for neutrons (2015 Sep.)
104 //#ifdef PHP_AS_HP
105 // bAdjustFinalState = false;
106 //#endif
107 
108  inCharge = true;
109  aDataFile>>targetMass>>frameFlag>>nProducts;
111  for(G4int i=0; i<nProducts; i++)
112  {
113  theProducts[i].Init(aDataFile,theProjectile);
114  }
115  }
116 
118 
120 
121  inline void SetTarget(G4ReactionProduct & aTarget)
122  {
123  fCache.Get().theTarget = &aTarget;
124  for (G4int i=0;i<nProducts;i++)
125  theProducts[i].SetTarget(fCache.Get().theTarget);
126  }
127 
128  inline void SetProjectileRP(G4ReactionProduct & aIncidentPart)
129  {
130  fCache.Get().theProjectileRP = &aIncidentPart;
131  for (G4int i=0;i<nProducts;i++)
132  theProducts[i].SetProjectileRP(fCache.Get().theProjectileRP);
133  }
134 
135  inline G4bool InCharge()
136  {
137  return inCharge;
138  }
139 
141  {
142  return targetMass;
143  }
144 
146  {
147  return fCache.Get().theTotalMeanEnergy; // cached in 'sample' call
148  }
149 
150 private:
151 
152  // data members
153 
155  G4int frameFlag; // =1: Target rest frame; =2: CMS system; incident in lab
159 
160  // cached values
161  //
163 
165 
167 };
168 
169 #endif