Geant4  10.02.p03
B03RunAction Class Reference

#include <B03RunAction.hh>

Inheritance diagram for B03RunAction:
Collaboration diagram for B03RunAction:

Public Member Functions

 B03RunAction ()
 
virtual ~B03RunAction ()
 
virtual G4RunGenerateRun ()
 
virtual void BeginOfRunAction (const G4Run *)
 
virtual void EndOfRunAction (const G4Run *)
 
void PrintHeader (std::ostream *out)
 
std::string FillString (const std::string &name, char c, G4int n, G4bool back=true)
 
- Public Member Functions inherited from G4UserRunAction
 G4UserRunAction ()
 
virtual ~G4UserRunAction ()
 
void SetMaster (G4bool val=true)
 
G4bool IsMaster () const
 

Private Attributes

std::vector< G4StringfSDName
 
G4int fFieldValue
 

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster
 

Detailed Description

Definition at line 49 of file B03RunAction.hh.

Constructor & Destructor Documentation

◆ B03RunAction()

B03RunAction::B03RunAction ( )

Definition at line 52 of file B03RunAction.cc.

52  :
54  // fFieldName(15),
55  fFieldValue(14)
56 {
57  // - Prepare data member for B03Run.
58  // vector represents a list of MultiFunctionalDetector names.
59  fSDName.push_back(G4String("ConcreteSD"));
60 }
G4int fFieldValue
Definition: B03RunAction.hh:72
std::vector< G4String > fSDName
Definition: B03RunAction.hh:70

◆ ~B03RunAction()

B03RunAction::~B03RunAction ( )
virtual

Definition at line 65 of file B03RunAction.cc.

66 {
67  fSDName.clear();
68 }
std::vector< G4String > fSDName
Definition: B03RunAction.hh:70

Member Function Documentation

◆ BeginOfRunAction()

void B03RunAction::BeginOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 82 of file B03RunAction.cc.

83 {
84  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
85 }
G4GLOB_DLL std::ostream G4cout
G4int GetRunID() const
Definition: G4Run.hh:76
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ EndOfRunAction()

void B03RunAction::EndOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 89 of file B03RunAction.cc.

90 {
91  G4cout << " ###### EndOfRunAction " <<G4endl;
92  //- B03Run object.
93  B03Run* b02Run = (B03Run*)aRun;
94  //--- Dump all socred quantities involved in B03Run.
95  // b02Run->DumpAllScorer();
96  //---
98  //
99 
100  for ( G4int i = 0; i < (G4int)fSDName.size(); i++ ){
101  const G4VUserDetectorConstruction* vdet =
103  // B03DetectorConstruction* bdet = (B03DetectorConstruction*)vdet;
106  //
107 
108  //---------------------------------------------
109  // Dump accumulated quantities for this RUN.
110  // (Display only central region of x-y plane)
111  // 0 ConcreteSD/Collisions
112  // 1 ConcreteSD/CollWeight
113  // 2 ConcreteSD/Population
114  // 3 ConcreteSD/TrackEnter
115  // 4 ConcreteSD/SL
116  // 5 ConcreteSD/SLW
117  // 6 ConcreteSD/SLWE
118  // 7 ConcreteSD/SLW_V
119  // 8 ConcreteSD/SLWE_V
120  //---------------------------------------------
121  G4THitsMap<G4double>* Collisions =
122  b02Run->GetHitsMap(fSDName[i]+"/Collisions");
123  G4THitsMap<G4double>* CollWeight =
124  b02Run->GetHitsMap(fSDName[i]+"/CollWeight");
125  G4THitsMap<G4double>* Population =
126  b02Run->GetHitsMap(fSDName[i]+"/Population");
127  G4THitsMap<G4double>* TrackEnter =
128  b02Run->GetHitsMap(fSDName[i]+"/TrackEnter");
130  b02Run->GetHitsMap(fSDName[i]+"/SL");
131  G4THitsMap<G4double>* SLW =
132  b02Run->GetHitsMap(fSDName[i]+"/SLW");
133  G4THitsMap<G4double>* SLWE =
134  b02Run->GetHitsMap(fSDName[i]+"/SLWE");
135  G4THitsMap<G4double>* SLW_V =
136  b02Run->GetHitsMap(fSDName[i]+"/SLW_V");
137  G4THitsMap<G4double>* SLWE_V =
138  b02Run->GetHitsMap(fSDName[i]+"/SLWE_V");
139 
140  if (IsMaster())
141  {
142  G4cout <<
143  "\n--------------------End of Global Run-----------------------" <<
144  G4endl;
145  G4cout <<
146  " Number of event processed : "<< aRun->GetNumberOfEvent() << G4endl;
147  }
148  else
149  {
150  G4cout <<
151  "\n--------------------End of Local Run------------------------" <<
152  G4endl;
153  G4cout << " Number of event processed : "<< aRun->GetNumberOfEvent() <<
154  G4endl;
155  }
156 
157  G4cout << "============================================================="
158  <<G4endl;
159  G4cout << "============================================================="
160  <<G4endl;
161 
162 
163  std::ostream *myout = &G4cout;
164  PrintHeader(myout);
165 
166  for ( G4int iz = 0; iz < 20; iz++){
167  G4double* SumCollisions = (*Collisions)[iz];
168  G4double* SumCollWeight = (*CollWeight)[iz];
169  G4double* Populations = (*Population)[iz];
170  G4double* TrackEnters = (*TrackEnter)[iz];
171  G4double* SLs = (*SL)[iz];
172  G4double* SLWs = (*SLW)[iz];
173  G4double* SLWEs = (*SLWE)[iz];
174  G4double* SLW_Vs = (*SLW_V)[iz];
175  G4double* SLWE_Vs = (*SLWE_V)[iz];
176  if ( !SumCollisions ) SumCollisions = new G4double(0.0);
177  if ( !SumCollWeight ) SumCollWeight = new G4double(0.0);
178  if ( !Populations ) Populations = new G4double(0.0);
179  if ( !TrackEnters ) { G4cout << " NO TRACKS - WHY? " << G4endl;
180  TrackEnters = new G4double(0.0);}
181  if ( !SLs ) SLs = new G4double(0.0);
182  if ( !SLWs ) SLWs = new G4double(0.0);
183  if ( !SLWEs ) SLWEs = new G4double(0.0);
184  if ( !SLW_Vs ) SLW_Vs = new G4double(0.0);
185  if ( !SLWE_Vs ) SLWE_Vs = new G4double(0.0);
186  G4double NumWeightedEnergy =0.0;
187  G4double FluxWeightedEnergy=0.0;
188  G4double AverageTrackWeight=0.0;
189  if ( *SLW_Vs !=0. ) NumWeightedEnergy = (*SLWE_Vs)/(*SLW_Vs);
190  if ( *SLWs !=0. ) FluxWeightedEnergy = (*SLWEs)/(*SLWs);
191  if ( *SLs !=0. ) AverageTrackWeight = (*SLWs)/(*SLs);
192  G4String cname = bdet->GetCellName(iz);
193  G4cout
194  << std::setw(fFieldValue) << cname << " |"
195  << std::setw(fFieldValue) << (*TrackEnters) << " |"
196  << std::setw(fFieldValue) << (*Populations) << " |"
197  << std::setw(fFieldValue) << (*SumCollisions) << " |"
198  << std::setw(fFieldValue) << (*SumCollWeight) << " |"
199  << std::setw(fFieldValue) << NumWeightedEnergy << " |"
200  << std::setw(fFieldValue) << FluxWeightedEnergy << " |"
201  << std::setw(fFieldValue) << AverageTrackWeight << " |"
202  << std::setw(fFieldValue) << (*SLs) << " |"
203  << std::setw(fFieldValue) << (*SLWs) << " |"
204  << std::setw(fFieldValue) << (*SLW_Vs) << " |"
205  << std::setw(fFieldValue) << (*SLWEs) << " |"
206  << std::setw(fFieldValue) << (*SLWE_Vs) << " |"
207  << G4endl;
208  }
209  G4cout << "============================================="<<G4endl;
210  }
211 }
Definition: B03Run.hh:50
int G4int
Definition: G4Types.hh:78
G4bool IsMaster() const
void PrintHeader(std::ostream *out)
G4GLOB_DLL std::ostream G4cout
G4int fFieldValue
Definition: B03RunAction.hh:72
G4double iz
Definition: TRTMaterials.hh:39
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
static const G4double * SL[nLA]
#define G4endl
Definition: G4ios.hh:61
G4int GetNumberOfEvent() const
Definition: G4Run.hh:79
double G4double
Definition: G4Types.hh:76
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
G4THitsMap< G4double > * GetHitsMap(G4int i)
Definition: B03Run.hh:70
std::vector< G4String > fSDName
Definition: B03RunAction.hh:70
Here is the call graph for this function:

◆ FillString()

std::string B03RunAction::FillString ( const std::string &  name,
char  c,
G4int  n,
G4bool  back = true 
)

Definition at line 250 of file B03RunAction.cc.

252 {
253  std::string fname("");
254  G4int k = n - name.size();
255  if (k > 0) {
256  if (back) {
257  fname = name;
258  fname += std::string(k,c);
259  }
260  else {
261  fname = std::string(k,c);
262  fname += name;
263  }
264  }
265  else {
266  fname = name;
267  }
268  return fname;
269 }
G4String name
Definition: TRTMaterials.hh:40
int G4int
Definition: G4Types.hh:78
Char_t n[5]

◆ GenerateRun()

G4Run * B03RunAction::GenerateRun ( void  )
virtual

Reimplemented from G4UserRunAction.

Definition at line 72 of file B03RunAction.cc.

73 {
74  // Generate new RUN object, which is specially
75  // dedicated for MultiFunctionalDetector scheme.
76  // Detail description can be found in B03Run.hh/cc.
77  return new B03Run(fSDName);
78 }
Definition: B03Run.hh:50
std::vector< G4String > fSDName
Definition: B03RunAction.hh:70

◆ PrintHeader()

void B03RunAction::PrintHeader ( std::ostream *  out)

Definition at line 215 of file B03RunAction.cc.

216 {
217  std::vector<G4String> vecScoreName;
218  vecScoreName.push_back("Tr.Entering");
219  vecScoreName.push_back("Population");
220  vecScoreName.push_back("Collisions");
221  vecScoreName.push_back("Coll*WGT");
222  vecScoreName.push_back("NumWGTedE");
223  vecScoreName.push_back("FluxWGTedE");
224  vecScoreName.push_back("Av.Tr.WGT");
225  vecScoreName.push_back("SL");
226  vecScoreName.push_back("SLW");
227  vecScoreName.push_back("SLW_v");
228  vecScoreName.push_back("SLWE");
229  vecScoreName.push_back("SLWE_v");
230 
231  // head line
232  //std::string vname = FillString("Volume", ' ', FieldName+1);
233  //*out << vname << '|';
234  std::string vname;
235  *out << std::setw(fFieldValue) << "Volume" << " |";
236  for (std::vector<G4String>::iterator it = vecScoreName.begin();
237  it != vecScoreName.end(); it++) {
238  //vname = FillString((*it),
239 // ' ',
240 // fFieldValue+1,
241 // false);
242 // *out << vname << '|';
243  *out << std::setw(fFieldValue) << (*it) << " |";
244  }
245  *out << G4endl;
246 }
G4int fFieldValue
Definition: B03RunAction.hh:72
#define G4endl
Definition: G4ios.hh:61
Here is the caller graph for this function:

Member Data Documentation

◆ fFieldValue

G4int B03RunAction::fFieldValue
private

Definition at line 72 of file B03RunAction.hh.

◆ fSDName

std::vector<G4String> B03RunAction::fSDName
private

Definition at line 70 of file B03RunAction.hh.


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