Geant4  10.02.p03
CML2Convergence Class Reference

#include <ML2Convergence.hh>

Collaboration diagram for CML2Convergence:

Public Member Functions

 CML2Convergence ()
 
 CML2Convergence (G4int seed, G4int saving_in_Selected_Voxels_every_events, G4String FileExperimentalData, G4String FileExperimentalDataOut, G4bool bCompareExp, G4int maxNumberOfEvents, G4int nRecycling, G4int nMaxLoops)
 
 ~CML2Convergence (void)
 
void add (const G4Step *aStep)
 
G4bool stopRun ()
 
void setMaxNumberOfEvents (G4int val)
 
G4double getMaxNumberOfEvents ()
 
CML2ExpVoxelsgetExpVoxels ()
 
void saveResults ()
 
void setNewGeometry ()
 
int getNMaxLoops ()
 

Private Member Functions

G4bool convergenceCriteria ()
 

Private Attributes

std::vector< Svoxelvoxels
 
CML2ExpVoxelsML2ExpVoxels
 
G4String fileExperimentalData
 
G4bool bCompareExp
 
G4int maxNumberOfEvents
 
G4int nGeometry
 
G4int nAccumulatedEvents
 
int nMaxLoops
 
int idCurrentLoop
 

Detailed Description

Definition at line 52 of file ML2Convergence.hh.

Constructor & Destructor Documentation

◆ CML2Convergence() [1/2]

CML2Convergence::CML2Convergence ( void  )

Definition at line 46 of file ML2Convergence.cc.

47 {}

◆ CML2Convergence() [2/2]

CML2Convergence::CML2Convergence ( G4int  seed,
G4int  saving_in_Selected_Voxels_every_events,
G4String  FileExperimentalData,
G4String  FileExperimentalDataOut,
G4bool  bCompareExp,
G4int  maxNumberOfEvents,
G4int  nRecycling,
G4int  nMaxLoops 
)

Definition at line 49 of file ML2Convergence.cc.

52  :ML2ExpVoxels(0)
53 {
54  nGeometry=0;
55  nMaxLoops=maxLoops;
57  bCompareExp=bComp;
59  if (bCompareExp){nMaxLoops=-1;};
60  fileExperimentalData=FileExperimentalData;
61 
62  // if the flag compareExp if true and the experimental data is given create the class CML2ExpVoxels
64  {
65  ML2ExpVoxels=new CML2ExpVoxels(bCompareExp, saveEvents, seed, FileExperimentalData, FileExperimentalDataOut);
66  if (!ML2ExpVoxels->loadData())
67  {
68  ML2ExpVoxels=0;
69  std::cout <<"I don't have any convergence criteria set, I'll do " << nMaxLoops << " loop(s) for each rotation"<< G4endl;
70  }
71  else
72  {
73  ML2ExpVoxels->setRecycling(nRecycling);
74  }
75  }
76  maxNumberOfEvents=maxNumEvents;
77 }
G4String fileExperimentalData
G4bool loadData()
Definition: ML2ExpVoxels.cc:77
CML2ExpVoxels * ML2ExpVoxels
void setRecycling(int recycling)
Definition: ML2ExpVoxels.hh:66
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ ~CML2Convergence()

CML2Convergence::~CML2Convergence ( void  )

Definition at line 79 of file ML2Convergence.cc.

80 {
81  if (ML2ExpVoxels!=0)
82  {delete ML2ExpVoxels;}
83 
84 }
CML2ExpVoxels * ML2ExpVoxels

Member Function Documentation

◆ add()

void CML2Convergence::add ( const G4Step *  aStep)

Definition at line 85 of file ML2Convergence.cc.

86 {
87  // accumulate events in the CML2ExpVoxels class (if created)
88  if (ML2ExpVoxels!=0)
89  {
90  if (aStep->GetTotalEnergyDeposit()>0.)
91  {ML2ExpVoxels->add(aStep);}
92  }
93 }
CML2ExpVoxels * ML2ExpVoxels
void add(G4ThreeVector pos, G4double depEnergy, G4double density)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convergenceCriteria()

G4bool CML2Convergence::convergenceCriteria ( )
private

Definition at line 112 of file ML2Convergence.cc.

113 {
114  G4bool bStopRun=true;
115  G4int nEventsAccumulated=0;
116  if (bCompareExp)
117  {
118  nEventsAccumulated=ML2ExpVoxels->getMaxNumberOfEvents();
119  // It checks if the maximum number of events is reached at least in one voxel. Having more rotations the limits is incremented each rotation
121  {bStopRun = true; ML2ExpVoxels->resetNEventsInVoxels();}
122  else
123  {bStopRun = false;}
124  }
125  std::cout <<"\n ++++++++++++++++++++ \n";
126  std::cout <<"current geometry: " << nGeometry;
127  std::cout << "\nNumber of events accumulated in the current geometry:"<<
128  nEventsAccumulated<<"\nNumber of events to be accumulated:" <<
129  maxNumberOfEvents<< "\n -------------------------\n";
130  return bStopRun;
131 }
int G4int
Definition: G4Types.hh:78
CML2ExpVoxels * ML2ExpVoxels
void resetNEventsInVoxels()
bool G4bool
Definition: G4Types.hh:79
G4int getMaxNumberOfEvents()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExpVoxels()

CML2ExpVoxels* CML2Convergence::getExpVoxels ( )
inline

Definition at line 62 of file ML2Convergence.hh.

62 {return ML2ExpVoxels;}
CML2ExpVoxels * ML2ExpVoxels

◆ getMaxNumberOfEvents()

G4double CML2Convergence::getMaxNumberOfEvents ( )
inline

Definition at line 61 of file ML2Convergence.hh.

61 {return maxNumberOfEvents;};

◆ getNMaxLoops()

int CML2Convergence::getNMaxLoops ( )
inline

Definition at line 65 of file ML2Convergence.hh.

65 {return nMaxLoops;}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveResults()

void CML2Convergence::saveResults ( )
inline

Definition at line 63 of file ML2Convergence.hh.

CML2ExpVoxels * ML2ExpVoxels
void saveResults(void)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxNumberOfEvents()

void CML2Convergence::setMaxNumberOfEvents ( G4int  val)
inline

Definition at line 60 of file ML2Convergence.hh.

60 {maxNumberOfEvents=val;}

◆ setNewGeometry()

void CML2Convergence::setNewGeometry ( )
inline

Definition at line 64 of file ML2Convergence.hh.

Here is the caller graph for this function:

◆ stopRun()

G4bool CML2Convergence::stopRun ( )

Definition at line 94 of file ML2Convergence.cc.

95 {
96  G4bool bStopRun=false;
97  if (ML2ExpVoxels!=0) // true if the experimental data file exists and is used to check the convergence
98  {
99  bStopRun=convergenceCriteria();
100  return bStopRun;
101  }
102  else // true if no experiemental data file is used. In this case it runs "nMaxLoops" loops.
103  {
104  idCurrentLoop--;
105  if (idCurrentLoop==0)
106  {
107  bStopRun=true;
108  }
109  }
110  return bStopRun;
111 }
CML2ExpVoxels * ML2ExpVoxels
bool G4bool
Definition: G4Types.hh:79
G4bool convergenceCriteria()
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ bCompareExp

G4bool CML2Convergence::bCompareExp
private

Definition at line 74 of file ML2Convergence.hh.

◆ fileExperimentalData

G4String CML2Convergence::fileExperimentalData
private

Definition at line 72 of file ML2Convergence.hh.

◆ idCurrentLoop

int CML2Convergence::idCurrentLoop
private

Definition at line 76 of file ML2Convergence.hh.

◆ maxNumberOfEvents

G4int CML2Convergence::maxNumberOfEvents
private

Definition at line 75 of file ML2Convergence.hh.

◆ ML2ExpVoxels

CML2ExpVoxels* CML2Convergence::ML2ExpVoxels
private

Definition at line 70 of file ML2Convergence.hh.

◆ nAccumulatedEvents

G4int CML2Convergence::nAccumulatedEvents
private

Definition at line 75 of file ML2Convergence.hh.

◆ nGeometry

G4int CML2Convergence::nGeometry
private

Definition at line 75 of file ML2Convergence.hh.

◆ nMaxLoops

int CML2Convergence::nMaxLoops
private

Definition at line 76 of file ML2Convergence.hh.

◆ voxels

std::vector<Svoxel> CML2Convergence::voxels
private

Definition at line 69 of file ML2Convergence.hh.


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