31 #include "RunAction.hh"
33 #include "PrimaryGeneratorAction.hh"
34 #include "HistoManager.hh"
47 :detector(det), primary(prim), histoManager(hist)
66 CLHEP::HepRandom::showEngineStatus();
72 if (size < nbPixels) {
80 for (
G4int k=0; k<nbPixels; k++) {
93 for (
G4int k=0; k<n1pxl; k++) {
180 G4cout <<
" The run was " <<
nbEvents <<
" " << partName <<
" of "
183 G4cout <<
"------------------------------------------------------------"
192 std::ios::fmtflags mode =
G4cout.flags();
199 G4double varNbRadL = meanNbRadL2 - meanNbRadL*meanNbRadL;
201 if (varNbRadL > 0.) rmsNbRadL = std::sqrt(varNbRadL);
205 <<
"\n Calor : mean number of Rad Length = "
206 << meanNbRadL <<
" +- "<< rmsNbRadL
207 <<
" --> Effective Rad Length = "
210 G4cout <<
"------------------------------------------------------------"
216 <<
"visible Energy (rms/mean) "
217 <<
"total Energy (rms/mean)" <<
G4endl;
219 G4double meanEvis,meanEvis2,varianceEvis,rmsEvis,resEvis;
220 G4double meanEtot,meanEtot2,varianceEtot,rmsEtot,resEtot;
224 for (
G4int i1=0; i1<n1pxl; i1++) {
228 varianceEvis = meanEvis2 - meanEvis*meanEvis;
230 if (varianceEvis > 0.) rmsEvis = std::sqrt(varianceEvis);
231 resEvis = meanEvis ? 100*rmsEvis/meanEvis : 0.;
237 varianceEtot = meanEtot2 - meanEtot*meanEtot;
239 if (varianceEtot > 0.) rmsEtot = std::sqrt(varianceEtot);
240 resEtot = 100*rmsEtot/meanEtot;
246 <<
"\n layer " << i1 <<
": "
247 << std::setprecision(5)
248 << std::setw(6) <<
G4BestUnit(meanEvis,
"Energy") <<
" +- "
249 << std::setprecision(4)
250 << std::setw(5) <<
G4BestUnit( rmsEvis,
"Energy") <<
" ("
251 << std::setprecision(2)
252 << std::setw(3) << resEvis <<
" %)"
254 << std::setprecision(5)
255 << std::setw(6) <<
G4BestUnit(meanEtot,
"Energy") <<
" +- "
256 << std::setprecision(4)
257 << std::setw(5) <<
G4BestUnit( rmsEtot,
"Energy") <<
" ("
258 << std::setprecision(2)
259 << std::setw(3) << resEtot <<
" %)";
266 varianceEvis = meanEvis2 - meanEvis*meanEvis;
268 if (varianceEvis > 0.) rmsEvis = std::sqrt(varianceEvis);
269 resEvis = 100*rmsEvis/meanEvis;
274 varianceEtot = meanEtot2 - meanEtot*meanEtot;
276 if (varianceEtot > 0.) rmsEtot = std::sqrt(varianceEtot);
277 resEtot = 100*rmsEtot/meanEtot;
282 <<
"\n total calor : "
283 << std::setprecision(5)
284 << std::setw(6) <<
G4BestUnit(meanEvis,
"Energy") <<
" +- "
285 << std::setprecision(4)
286 << std::setw(5) <<
G4BestUnit( rmsEvis,
"Energy") <<
" ("
287 << std::setprecision(2)
288 << std::setw(3) << resEvis <<
" %)"
290 << std::setprecision(5)
291 << std::setw(6) <<
G4BestUnit(meanEtot,
"Energy") <<
" +- "
292 << std::setprecision(4)
293 << std::setw(5) <<
G4BestUnit( rmsEtot,
"Energy") <<
" ("
294 << std::setprecision(2)
295 << std::setw(3) << resEtot <<
" %)";
297 G4cout <<
"\n------------------------------------------------------------"
301 G4double meanEleak,meanEleak2,varianceEleak,rmsEleak,ratio;
304 varianceEleak = meanEleak2 - meanEleak*meanEleak;
306 if (varianceEleak > 0.) rmsEleak = std::sqrt(varianceEleak);
307 ratio = 100*meanEleak/
energy;
316 << std::setprecision(5)
317 << std::setw(6) <<
G4BestUnit(meanEleak,
"Energy") <<
" +- "
318 << std::setprecision(4)
319 << std::setw(5) <<
G4BestUnit( rmsEleak,
"Energy")
320 <<
"\n Eleak/Ebeam ="
321 << std::setprecision(3)
322 << std::setw(4) << ratio <<
" % ( forward ="
323 << std::setw(4) << forward <<
" %; backward ="
324 << std::setw(4) << bakward <<
" %; lateral ="
325 << std::setw(4) << lateral <<
" %)"
328 G4cout.setf(mode,std::ios::floatfield);
335 CLHEP::HepRandom::showEngineStatus();
347 G4String fileName = name +
".pixels.ascii";
349 std::ofstream File(fileName, std::ios::out);
356 File << noEvents <<
" " << n1pxl <<
" " << n2pxl <<
" " << n1shift
std::vector< G4double > totalEnergy2
void fillNbRadLen(G4double)
void BeginOfRunAction(const G4Run *)
HistoManager * histoManager
void FillHisto(G4int id, G4double bin, G4double weight=1.0)
std::vector< G4double > layerEvis
G4double GetCalorThickness()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetRandomNumberStore(G4bool flag)
void fillPerEvent_1(G4int, G4double, G4double)
void fillPerEvent_2(G4int, G4double, G4double)
const G4Run * GetCurrentRun() const
const G4String & GetParticleName() const
std::vector< G4double > layerEvis2
G4GLOB_DLL std::ostream G4cout
std::vector< G4double > layerEtot
void EndOfRunAction(const G4Run *)
static G4RunManager * GetRunManager()
G4int GetSizeVectorPixels()
void fillDetailedLeakage(G4int, G4double)
G4ParticleGun * GetParticleGun()
std::vector< G4double > totalEnergy
G4double energy(const ThreeVector &p, const G4double m)
PrimaryGeneratorAction * primary
G4ParticleDefinition * GetParticleDefinition() const
static G4Geantino * Geantino()
G4int GetNumberOfEventToBeProcessed() const
DetectorConstruction * detector
Detector construction class to demonstrate various ways of placement.
std::vector< G4double > visibleEnergy
void fillPerEvent_3(G4double, G4double, G4double)
void PrintCalorParameters()
std::vector< G4double > layerEtot2
std::vector< G4double > visibleEnergy2
G4double GetParticleEnergy() const