Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NeutronHPChannel.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 // $Id$
28 //
29  // Hadronic Process: Very Low Energy Neutron X-Sections
30  // original by H.P. Wellisch, TRIUMF, 14-Feb-97
31  // Builds and has the Cross-section data for one element and channel.
32 //
33 // Bug fixes and workarounds in the destructor, F.W.Jones 06-Jul-1999
34 // 070612 Fix memory leaking by T. Koi
35 //
36 // 080520 Delete unnecessary dependencies by T. Koi
37 
38 #ifndef G4NeutronHPChannel_h
39 #define G4NeutronHPChannel_h 1
40 #include "globals.hh"
41 #include "G4NeutronHPIsoData.hh"
42 #include "G4NeutronHPVector.hh"
43 #include "G4Material.hh"
44 #include "G4HadProjectile.hh"
45 //#include "G4NeutronInelasticProcess.hh"
46 //#include "G4HadronFissionProcess.hh"
47 //#include "G4HadronElasticProcess.hh"
48 //#include "G4HadronCaptureProcess.hh"
49 #include "G4StableIsotopes.hh"
50 #include "G4NeutronHPCaptureFS.hh"
51 #include "G4NeutronHPFinalState.hh"
52 #include "G4Element.hh"
53 
55 {
56 public:
57 
59  {
60  theChannelData = new G4NeutronHPVector;
61  theBuffer = 0;
62  theIsotopeWiseData = 0;
63  theFinalStates = 0;
64  active = 0;
65  registerCount = -1;
66  }
67 
69  {
70  delete theChannelData;
71  // Following statement disabled to avoid SEGV
72  // theBuffer is also deleted as "theChannelData" in
73  // ~G4NeutronHPIsoData. FWJ 06-Jul-1999
74  //if(theBuffer != 0) delete theBuffer;
75  if(theIsotopeWiseData != 0) delete [] theIsotopeWiseData;
76  // Deletion of FinalStates disabled to avoid endless looping
77  // in the destructor heirarchy. FWJ 06-Jul-1999
78  //if(theFinalStates != 0)
79  //{
80  // for(i=0; i<niso; i++)
81  // {
82  // delete theFinalStates[i];
83  // }
84  // delete [] theFinalStates;
85  //}
86  // FWJ experiment
87  //if(active!=0) delete [] active;
88 // T.K.
89  if ( theFinalStates != 0 )
90  {
91  for ( G4int i = 0 ; i < niso ; i++ )
92  {
93  delete theFinalStates[i];
94  }
95  delete [] theFinalStates;
96  }
97  if ( active != 0 ) delete [] active;
98 
99  }
100 
102 
104 
106 
107  inline G4bool IsActive(G4int isoNumber) { return active[isoNumber]; }
108 
109  inline G4bool HasFSData(G4int isoNumber) { return theFinalStates[isoNumber]->HasFSData(); }
110 
111  inline G4bool HasAnyData(G4int isoNumber) { return theFinalStates[isoNumber]->HasAnyData(); }
112 
114 
115  void Init(G4Element * theElement, const G4String dirName);
116 
117  void Init(G4Element * theElement, const G4String dirName, const G4String fsType);
118 
119  //void UpdateData(G4int A, G4int Z, G4int index, G4double abundance);
120  void UpdateData(G4int A, G4int Z, G4int index, G4double abundance) { G4int M = 0; UpdateData( A, Z, M, index, abundance); };
121  void UpdateData(G4int A, G4int Z, G4int M, G4int index, G4double abundance);
122 
123  void Harmonise(G4NeutronHPVector *& theStore, G4NeutronHPVector * theNew);
124 
125  G4HadFinalState * ApplyYourself(const G4HadProjectile & theTrack, G4int isoNumber=-1);
126 
127  inline G4int GetNiso() {return niso;}
128 
129  inline G4double GetN(G4int i) {return theFinalStates[i]->GetN();}
130  inline G4double GetZ(G4int i) {return theFinalStates[i]->GetZ();}
131 
133  {
134  G4bool result = false;
135  G4int i;
136  for(i=0; i<niso; i++)
137  {
138  if(theFinalStates[i]->HasAnyData()) result = true;
139  }
140  return result;
141  }
142 
143 private:
144  G4NeutronHPVector * theChannelData; // total (element) cross-section for this channel
145  G4NeutronHPVector * theBuffer;
146 
147  G4NeutronHPIsoData * theIsotopeWiseData; // these are the isotope-wise cross-sections for each final state.
148  G4NeutronHPFinalState ** theFinalStates; // also these are isotope-wise pionters, parallel to the above.
149  G4bool * active;
150  G4int niso;
151 
152  G4StableIsotopes theStableOnes;
153 
154  G4String theDir;
155  G4String theFSType;
156  G4Element * theElement;
157 
158  G4int registerCount;
159 
160 };
161 
162 #endif