Geant4  10.02.p03
G4AdjointCSMatrix Class Reference

#include <G4AdjointCSMatrix.hh>

Collaboration diagram for G4AdjointCSMatrix:

Public Member Functions

 G4AdjointCSMatrix (G4bool aBool)
 
 ~G4AdjointCSMatrix ()
 
void Clear ()
 
void AddData (G4double aPrimEnergy, G4double aCS, std::vector< double > *aLogSecondEnergyVector, std::vector< double > *aLogProbVector, size_t n_pro_decade=0)
 
G4bool GetData (unsigned int i, G4double &aPrimEnergy, G4double &aCS, G4double &log0, std::vector< double > *&aLogSecondEnergyVector, std::vector< double > *&aLogProbVector, std::vector< size_t > *&aLogProbVectorIndex)
 
std::vector< double > * GetLogPrimEnergyVector ()
 
std::vector< double > * GetLogCrossSectionvector ()
 
G4double GetDlog ()
 
G4bool IsScatProjToProjCase ()
 
void Write (G4String file_name)
 
void Read (G4String file_name)
 

Private Attributes

std::vector< double > theLogPrimEnergyVector
 
std::vector< double > theLogCrossSectionVector
 
std::vector< std::vector< double > *> theLogSecondEnergyMatrix
 
std::vector< std::vector< double > *> theLogProbMatrix
 
std::vector< std::vector< size_t > *> theLogProbMatrixIndex
 
std::vector< double > log0Vector
 
unsigned int nb_of_PrimEnergy
 
G4bool is_scat_proj_to_proj_case
 
G4double dlog
 

Detailed Description

Definition at line 60 of file G4AdjointCSMatrix.hh.

Constructor & Destructor Documentation

◆ G4AdjointCSMatrix()

G4AdjointCSMatrix::G4AdjointCSMatrix ( G4bool  aBool)

Definition at line 38 of file G4AdjointCSMatrix.cc.

38  {
39  theLogPrimEnergyVector.clear();
42  theLogProbMatrix.clear();
43  theLogProbMatrixIndex.clear();
44  log0Vector.clear();
47  dlog =0;
48 }
std::vector< double > theLogCrossSectionVector
std::vector< double > theLogPrimEnergyVector
unsigned int nb_of_PrimEnergy
std::vector< double > log0Vector
std::vector< std::vector< double > *> theLogProbMatrix
std::vector< std::vector< double > *> theLogSecondEnergyMatrix
std::vector< std::vector< size_t > *> theLogProbMatrixIndex

◆ ~G4AdjointCSMatrix()

G4AdjointCSMatrix::~G4AdjointCSMatrix ( )

Definition at line 51 of file G4AdjointCSMatrix.cc.

51  {
52  theLogPrimEnergyVector.clear();
55  theLogProbMatrix.clear();
56 }
std::vector< double > theLogCrossSectionVector
std::vector< double > theLogPrimEnergyVector
std::vector< std::vector< double > *> theLogProbMatrix
std::vector< std::vector< double > *> theLogSecondEnergyMatrix

Member Function Documentation

◆ AddData()

void G4AdjointCSMatrix::AddData ( G4double  aPrimEnergy,
G4double  aCS,
std::vector< double > *  aLogSecondEnergyVector,
std::vector< double > *  aLogProbVector,
size_t  n_pro_decade = 0 
)

Definition at line 71 of file G4AdjointCSMatrix.cc.

72  {
73 
75 
76  //At this time we consider that the energy is increasing monotically
77  theLogPrimEnergyVector.push_back(aLogPrimEnergy);
78  theLogCrossSectionVector.push_back(aLogCS);
79  theLogSecondEnergyMatrix.push_back(aLogSecondEnergyVector);
80  theLogProbMatrix.push_back(aLogProbVector);
81 
82  std::vector< size_t>* aLogProbVectorIndex = 0;
83  dlog =0;
84 
85  if (n_pro_decade > 0 && aLogProbVector->size()>0) {
86  aLogProbVectorIndex = new std::vector< size_t>();
87  dlog=std::log(10.)/n_pro_decade;
88  G4double log_val = int(std::min((*aLogProbVector)[0],aLogProbVector->back())/dlog)*dlog;
89  log0Vector.push_back(log_val);
90 
91  // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
92  while(log_val<0.) {
93  aLogProbVectorIndex->push_back(theInterpolator->FindPosition(log_val,(*aLogProbVector)));
94  log_val+=dlog;
95  }
96  }
97  else {
98  log0Vector.push_back(0.);
99  }
100  theLogProbMatrixIndex.push_back(aLogProbVectorIndex);
101 
102 
104 
105 
106 }
std::vector< double > theLogCrossSectionVector
std::vector< double > theLogPrimEnergyVector
unsigned int nb_of_PrimEnergy
std::vector< double > log0Vector
std::vector< std::vector< double > *> theLogProbMatrix
std::vector< std::vector< double > *> theLogSecondEnergyMatrix
size_t FindPosition(G4double &x, std::vector< G4double > &x_vec, size_t ind_min=0, size_t ind_max=0)
std::vector< std::vector< size_t > *> theLogProbMatrixIndex
static G4AdjointInterpolator * GetInstance()
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Clear()

void G4AdjointCSMatrix::Clear ( )

Definition at line 59 of file G4AdjointCSMatrix.cc.

60 {
61  theLogPrimEnergyVector.clear();
64  theLogProbMatrix.clear();
65  theLogProbMatrixIndex.clear();
66  log0Vector.clear();
68 }
std::vector< double > theLogCrossSectionVector
std::vector< double > theLogPrimEnergyVector
unsigned int nb_of_PrimEnergy
std::vector< double > log0Vector
std::vector< std::vector< double > *> theLogProbMatrix
std::vector< std::vector< double > *> theLogSecondEnergyMatrix
std::vector< std::vector< size_t > *> theLogProbMatrixIndex

◆ GetData()

G4bool G4AdjointCSMatrix::GetData ( unsigned int  i,
G4double aPrimEnergy,
G4double aCS,
G4double log0,
std::vector< double > *&  aLogSecondEnergyVector,
std::vector< double > *&  aLogProbVector,
std::vector< size_t > *&  aLogProbVectorIndex 
)

Definition at line 109 of file G4AdjointCSMatrix.cc.

111 { if (i>= nb_of_PrimEnergy) return false;
112  //G4cout<<"Test Get Data "<<G4endl;
113  aLogPrimEnergy = theLogPrimEnergyVector[i];
114  aLogCS = theLogCrossSectionVector[i];
115  aLogSecondEnergyVector = theLogSecondEnergyMatrix[i];
116  aLogProbVector = theLogProbMatrix[i];
117  aLogProbVectorIndex = theLogProbMatrixIndex[i];
118  log0=log0Vector[i];
119  return true;
120 
121 }
std::vector< double > theLogCrossSectionVector
std::vector< double > theLogPrimEnergyVector
unsigned int nb_of_PrimEnergy
std::vector< double > log0Vector
std::vector< std::vector< double > *> theLogProbMatrix
std::vector< std::vector< double > *> theLogSecondEnergyMatrix
std::vector< std::vector< size_t > *> theLogProbMatrixIndex
Here is the caller graph for this function:

◆ GetDlog()

G4double G4AdjointCSMatrix::GetDlog ( )
inline

Definition at line 82 of file G4AdjointCSMatrix.hh.

82 {return dlog;}

◆ GetLogCrossSectionvector()

std::vector< double>* G4AdjointCSMatrix::GetLogCrossSectionvector ( )
inline

Definition at line 81 of file G4AdjointCSMatrix.hh.

81 {return &theLogCrossSectionVector;}
std::vector< double > theLogCrossSectionVector

◆ GetLogPrimEnergyVector()

std::vector< double>* G4AdjointCSMatrix::GetLogPrimEnergyVector ( )
inline

Definition at line 80 of file G4AdjointCSMatrix.hh.

80 {return &theLogPrimEnergyVector;}
std::vector< double > theLogPrimEnergyVector
Here is the caller graph for this function:

◆ IsScatProjToProjCase()

G4bool G4AdjointCSMatrix::IsScatProjToProjCase ( )
inline

Definition at line 83 of file G4AdjointCSMatrix.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read()

void G4AdjointCSMatrix::Read ( G4String  file_name)

Definition at line 162 of file G4AdjointCSMatrix.cc.

163 { std::fstream FileOutput(file_name, std::ios::in);
164  size_t n1,n2;
165 
166 
167  theLogPrimEnergyVector.clear();
168  theLogCrossSectionVector.clear();
169  theLogSecondEnergyMatrix.clear();
170  theLogProbMatrix.clear();
171  FileOutput>>n1;
172  for (size_t i=0; i<n1;i++){
173  G4double E,CS;
174  FileOutput>>E>>CS;
175  theLogPrimEnergyVector.push_back(E);
176  theLogCrossSectionVector.push_back(CS);
177  FileOutput>>n2;
178  theLogSecondEnergyMatrix.push_back(new std::vector<G4double>());
179  theLogProbMatrix.push_back(new std::vector<G4double>());
180 
181  for (size_t j=0; j<n2;j++){
182  G4double E1;
183  FileOutput>>E1;
184  theLogSecondEnergyMatrix[i]->push_back(E1);
185  }
186  FileOutput>>n2;
187  for (size_t j=0; j<n2;j++){
188  G4double prob;
189  FileOutput>>prob;
190  theLogProbMatrix[i]->push_back(prob);
191  }
192 
193 
194 
195  }
196 
197 
198 
199 
200 }
std::vector< double > theLogCrossSectionVector
ifstream in
Definition: comparison.C:7
std::vector< double > theLogPrimEnergyVector
std::vector< std::vector< double > *> theLogProbMatrix
std::vector< std::vector< double > *> theLogSecondEnergyMatrix
double G4double
Definition: G4Types.hh:76
Here is the caller graph for this function:

◆ Write()

void G4AdjointCSMatrix::Write ( G4String  file_name)

Definition at line 124 of file G4AdjointCSMatrix.cc.

125 { std::fstream FileOutput(file_name, std::ios::out);
126  FileOutput<<std::setiosflags(std::ios::scientific);
127  FileOutput<<std::setprecision(6);
128  FileOutput<<theLogPrimEnergyVector.size()<<G4endl;
129  for (size_t i=0;i<theLogPrimEnergyVector.size();i++){
130  FileOutput<<std::exp(theLogPrimEnergyVector[i])/MeV<<'\t'<<std::exp(theLogCrossSectionVector[i])<<G4endl;
131  size_t j1=0;
132  FileOutput<<theLogSecondEnergyMatrix[i]->size()<<G4endl;
133  for (size_t j=0;j<theLogSecondEnergyMatrix[i]->size();j++){
134  FileOutput<<std::exp((*theLogSecondEnergyMatrix[i])[j]);
135  j1++;
136  if (j1<10) FileOutput<<'\t';
137  else {
138  FileOutput<<G4endl;
139  j1=0;
140  }
141  }
142  if (j1>0) FileOutput<<G4endl;
143  j1=0;
144  FileOutput<<theLogProbMatrix[i]->size()<<G4endl;
145  for (size_t j=0;j<theLogProbMatrix[i]->size();j++){
146  FileOutput<<std::exp((*theLogProbMatrix[i])[j]);
147  j1++;
148  if (j1<10) FileOutput<<'\t';
149  else {
150  FileOutput<<G4endl;
151  j1=0;
152  }
153  }
154  if (j1>0) FileOutput<<G4endl;
155 
156 
157  }
158 
159 }
static const double MeV
Definition: G4SIunits.hh:211
std::vector< double > theLogCrossSectionVector
std::vector< double > theLogPrimEnergyVector
std::vector< std::vector< double > *> theLogProbMatrix
std::vector< std::vector< double > *> theLogSecondEnergyMatrix
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

Member Data Documentation

◆ dlog

G4double G4AdjointCSMatrix::dlog
private

Definition at line 101 of file G4AdjointCSMatrix.hh.

◆ is_scat_proj_to_proj_case

G4bool G4AdjointCSMatrix::is_scat_proj_to_proj_case
private

Definition at line 100 of file G4AdjointCSMatrix.hh.

◆ log0Vector

std::vector< double> G4AdjointCSMatrix::log0Vector
private

Definition at line 97 of file G4AdjointCSMatrix.hh.

◆ nb_of_PrimEnergy

unsigned int G4AdjointCSMatrix::nb_of_PrimEnergy
private

Definition at line 99 of file G4AdjointCSMatrix.hh.

◆ theLogCrossSectionVector

std::vector< double> G4AdjointCSMatrix::theLogCrossSectionVector
private

Definition at line 92 of file G4AdjointCSMatrix.hh.

◆ theLogPrimEnergyVector

std::vector< double> G4AdjointCSMatrix::theLogPrimEnergyVector
private

Definition at line 91 of file G4AdjointCSMatrix.hh.

◆ theLogProbMatrix

std::vector< std::vector< double>* > G4AdjointCSMatrix::theLogProbMatrix
private

Definition at line 94 of file G4AdjointCSMatrix.hh.

◆ theLogProbMatrixIndex

std::vector< std::vector< size_t >* > G4AdjointCSMatrix::theLogProbMatrixIndex
private

Definition at line 96 of file G4AdjointCSMatrix.hh.

◆ theLogSecondEnergyMatrix

std::vector< std::vector< double>* > G4AdjointCSMatrix::theLogSecondEnergyMatrix
private

Definition at line 93 of file G4AdjointCSMatrix.hh.


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