Geant4  10.01.p03
G4NeutronHPEnAngCorrelation.hh
Go to the documentation of this file.
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 //
28 #ifndef G4NeutronHPEnAngCorrelation_h
29 #define G4NeutronHPEnAngCorrelation_h 1
30 
31 #include "globals.hh"
32 #include "G4NeutronHPVector.hh"
33 #include "Randomize.hh"
34 #include "G4ios.hh"
35 #include <fstream>
36 #include "globals.hh"
37 #include "G4NeutronHPProduct.hh"
38 #include "G4ReactionProduct.hh"
39 
40 #include "G4Cache.hh"
41 
43 {
44 
45  struct toBeCached {
49  toBeCached() : theNeutron(NULL),theTarget(NULL), theTotalMeanEnergy(-1.0) {};
50  };
51 
52  public:
54  {
55  theProducts = 0;
56  inCharge = false;
57  toBeCached val;
58  fCache.Put( val );
59  fCache.Get().theTotalMeanEnergy = -1.;
60  }
62  {
63  if(theProducts!=0) delete [] theProducts;
64  }
65 
66  inline void Init(std::istream & aDataFile)
67  {
68  inCharge = true;
69  aDataFile>>targetMass>>frameFlag>>nProducts;
71  for(G4int i=0; i<nProducts; i++)
72  {
73  theProducts[i].Init(aDataFile);
74  }
75  }
76 
78 
80 
81  inline void SetTarget(G4ReactionProduct & aTarget)
82  {
83  fCache.Get().theTarget = &aTarget;
84  for(G4int i=0;i<nProducts;i++)theProducts[i].SetTarget(fCache.Get().theTarget);
85  }
86 
87  inline void SetNeutron(G4ReactionProduct & aNeutron)
88  {
89  fCache.Get().theNeutron = &aNeutron;
90  for(G4int i=0;i<nProducts;i++)theProducts[i].SetNeutron(fCache.Get().theNeutron);
91  }
92 
93  inline G4bool InCharge()
94  {
95  return inCharge;
96  }
97 
98  inline G4double GetTargetMass() { return targetMass; }
99 
101  {
102  // cashed in 'sample' call
103  return fCache.Get().theTotalMeanEnergy;
104  }
105 
106  private:
107 
108  // data members
109 
111  G4int frameFlag; // =1: Target rest frame; =2: CMS system; incident always in lab
115 
116  // Utility quantities
117 
118  //G4ReactionProduct theTarget;
119  //G4ReactionProduct theNeutron;
120 
121  // cashed values
122 
123  //G4double theTotalMeanEnergy;
124  private:
126 
127 };
128 
129 #endif
void SetTarget(G4ReactionProduct &aTarget)
G4ReactionProduct * SampleOne(G4double anEnergy)
int G4int
Definition: G4Types.hh:78
std::vector< G4ReactionProduct * > G4ReactionProductVector
void Init(std::istream &aDataFile)
bool G4bool
Definition: G4Types.hh:79
void SetNeutron(G4ReactionProduct &aNeutron)
G4ReactionProductVector * Sample(G4double anEnergy)
double G4double
Definition: G4Types.hh:76
void Init(std::istream &aDataFile)