G4AdjointCSMatrix Class Reference

#include <G4AdjointCSMatrix.hh>


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)


Detailed Description

Definition at line 60 of file G4AdjointCSMatrix.hh.


Constructor & Destructor Documentation

G4AdjointCSMatrix::G4AdjointCSMatrix ( G4bool  aBool  ) 

Definition at line 38 of file G4AdjointCSMatrix.cc.

00038                                                 {
00039         theLogPrimEnergyVector.clear();
00040         theLogCrossSectionVector.clear();
00041         theLogSecondEnergyMatrix.clear();
00042         theLogProbMatrix.clear();
00043         theLogProbMatrixIndex.clear();
00044         log0Vector.clear();
00045         nb_of_PrimEnergy=0;
00046         is_scat_proj_to_proj_case  =aBool;
00047         dlog =0;
00048 }

G4AdjointCSMatrix::~G4AdjointCSMatrix (  ) 

Definition at line 51 of file G4AdjointCSMatrix.cc.

00051                                      {
00052         theLogPrimEnergyVector.clear();
00053         theLogCrossSectionVector.clear();
00054         theLogSecondEnergyMatrix.clear();
00055         theLogProbMatrix.clear();
00056 }


Member Function Documentation

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.

References G4AdjointInterpolator::FindPosition(), and G4AdjointInterpolator::GetInstance().

00072                                                                                                                               {
00073         
00074         G4AdjointInterpolator* theInterpolator=G4AdjointInterpolator::GetInstance();
00075         
00076         //At this time we consider that the energy is increasing monotically
00077         theLogPrimEnergyVector.push_back(aLogPrimEnergy);
00078         theLogCrossSectionVector.push_back(aLogCS);
00079         theLogSecondEnergyMatrix.push_back(aLogSecondEnergyVector);
00080         theLogProbMatrix.push_back(aLogProbVector);
00081         
00082         std::vector< size_t>* aLogProbVectorIndex = 0;
00083         dlog =0;
00084         
00085         if (n_pro_decade > 0 && aLogProbVector->size()>0) {
00086                 aLogProbVectorIndex = new std::vector< size_t>();
00087                 dlog=std::log(10.)/n_pro_decade;
00088                 G4double log_val = int(std::min((*aLogProbVector)[0],aLogProbVector->back())/dlog)*dlog;
00089                 log0Vector.push_back(log_val);
00090                 
00091                 while(log_val<0.) {
00092                         aLogProbVectorIndex->push_back(theInterpolator->FindPosition(log_val,(*aLogProbVector)));
00093                         log_val+=dlog;
00094                 } 
00095         }
00096         else {
00097                 log0Vector.push_back(0.);
00098         }
00099         theLogProbMatrixIndex.push_back(aLogProbVectorIndex);
00100         
00101         
00102         nb_of_PrimEnergy++;
00103         
00104         
00105 }

void G4AdjointCSMatrix::Clear (  ) 

Definition at line 59 of file G4AdjointCSMatrix.cc.

00060 {
00061         theLogPrimEnergyVector.clear();
00062         theLogCrossSectionVector.clear();
00063         theLogSecondEnergyMatrix.clear();
00064         theLogProbMatrix.clear();
00065         theLogProbMatrixIndex.clear();
00066         log0Vector.clear();
00067         nb_of_PrimEnergy=0;
00068 }

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 108 of file G4AdjointCSMatrix.cc.

Referenced by G4VEmAdjointModel::SampleAdjSecEnergyFromCSMatrix().

00110 {       if (i>= nb_of_PrimEnergy) return false;
00111         //G4cout<<"Test Get Data "<<G4endl;
00112         aLogPrimEnergy = theLogPrimEnergyVector[i];
00113         aLogCS = theLogCrossSectionVector[i];
00114         aLogSecondEnergyVector = theLogSecondEnergyMatrix[i];
00115         aLogProbVector = theLogProbMatrix[i];
00116         aLogProbVectorIndex = theLogProbMatrixIndex[i];
00117         log0=log0Vector[i];
00118         return true;
00119         
00120 }

G4double G4AdjointCSMatrix::GetDlog (  )  [inline]

Definition at line 82 of file G4AdjointCSMatrix.hh.

00082 {return dlog;}  

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

Definition at line 81 of file G4AdjointCSMatrix.hh.

00081 {return &theLogCrossSectionVector;}

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

Definition at line 80 of file G4AdjointCSMatrix.hh.

Referenced by G4VEmAdjointModel::SampleAdjSecEnergyFromCSMatrix().

00080 {return &theLogPrimEnergyVector;}

G4bool G4AdjointCSMatrix::IsScatProjToProjCase (  )  [inline]

Definition at line 83 of file G4AdjointCSMatrix.hh.

Referenced by G4VEmAdjointModel::SampleAdjSecEnergyFromCSMatrix().

00083 {return is_scat_proj_to_proj_case;} 

void G4AdjointCSMatrix::Read ( G4String  file_name  ) 

Definition at line 161 of file G4AdjointCSMatrix.cc.

00162 {       std::fstream FileOutput(file_name, std::ios::in);
00163         size_t n1,n2;
00164         
00165         
00166         theLogPrimEnergyVector.clear();
00167         theLogCrossSectionVector.clear();
00168         theLogSecondEnergyMatrix.clear();
00169         theLogProbMatrix.clear();
00170         FileOutput>>n1;
00171         for (size_t i=0; i<n1;i++){
00172                 G4double E,CS;
00173                 FileOutput>>E>>CS;
00174                 theLogPrimEnergyVector.push_back(E);
00175                 theLogCrossSectionVector.push_back(CS);
00176                 FileOutput>>n2;
00177                 theLogSecondEnergyMatrix.push_back(new std::vector<G4double>());
00178                 theLogProbMatrix.push_back(new std::vector<G4double>());
00179                 
00180                 for (size_t j=0; j<n2;j++){
00181                         G4double E1;
00182                         FileOutput>>E1;
00183                         theLogSecondEnergyMatrix[i]->push_back(E1);
00184                 }
00185                 FileOutput>>n2;
00186                 for (size_t j=0; j<n2;j++){
00187                         G4double prob;
00188                         FileOutput>>prob;
00189                         theLogProbMatrix[i]->push_back(prob);
00190                 }
00191                 
00192                 
00193                 
00194         }
00195         
00196                                   
00197         
00198         
00199 }

void G4AdjointCSMatrix::Write ( G4String  file_name  ) 

Definition at line 123 of file G4AdjointCSMatrix.cc.

References G4endl.

00124 {       std::fstream FileOutput(file_name, std::ios::out);                        
00125         FileOutput<<std::setiosflags(std::ios::scientific);
00126         FileOutput<<std::setprecision(6);
00127         FileOutput<<theLogPrimEnergyVector.size()<<G4endl;
00128         for (size_t i=0;i<theLogPrimEnergyVector.size();i++){
00129                 FileOutput<<std::exp(theLogPrimEnergyVector[i])/MeV<<'\t'<<std::exp(theLogCrossSectionVector[i])<<G4endl;
00130                 size_t j1=0;
00131                 FileOutput<<theLogSecondEnergyMatrix[i]->size()<<G4endl;
00132                 for (size_t j=0;j<theLogSecondEnergyMatrix[i]->size();j++){
00133                         FileOutput<<std::exp((*theLogSecondEnergyMatrix[i])[j]);
00134                         j1++;
00135                         if (j1<10) FileOutput<<'\t';
00136                         else  {
00137                                 FileOutput<<G4endl;
00138                                 j1=0;
00139                         }       
00140                 }
00141                 if (j1>0) FileOutput<<G4endl;
00142                 j1=0;
00143                 FileOutput<<theLogProbMatrix[i]->size()<<G4endl;
00144                 for (size_t j=0;j<theLogProbMatrix[i]->size();j++){
00145                         FileOutput<<std::exp((*theLogProbMatrix[i])[j]);
00146                         j1++;
00147                         if (j1<10) FileOutput<<'\t';
00148                         else  {
00149                                 FileOutput<<G4endl;
00150                                 j1=0;
00151                         }       
00152                 }
00153                 if (j1>0) FileOutput<<G4endl;
00154                 
00155                 
00156         }
00157         
00158 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:24 2013 for Geant4 by  doxygen 1.4.7