35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "HistoManager.hh"
50 fParticle(0), fEkin(0.)
89 const Run* localRun =
static_cast<const Run*
>(run);
136 if (TotNbofEvents == 0)
return;
139 EnergyBalance /= TotNbofEvents;
143 if (rmsEdep>0.) rmsEdep = std::sqrt(rmsEdep/TotNbofEvents);
148 if (rmsTLCh>0.) rmsTLCh = std::sqrt(rmsTLCh/TotNbofEvents);
153 if (rmsTLNe>0.) rmsTLNe = std::sqrt(rmsTLNe/TotNbofEvents);
158 if (rmsStCh>0.) rmsStCh = std::sqrt(rmsTLCh/TotNbofEvents);
163 if (rmsStNe>0.) rmsStNe = std::sqrt(rmsTLCh/TotNbofEvents);
171 transmit[0] = 100.*
fTransmit[0]/TotNbofEvents;
172 transmit[1] = 100.*
fTransmit[1]/TotNbofEvents;
175 reflect[0] = 100.*
fReflect[0]/TotNbofEvents;
176 reflect[1] = 100.*
fReflect[1]/TotNbofEvents;
182 if (rmsMsc > 0.) { rmsMsc = std::sqrt(rmsMsc); }
188 fEnergyLeak[0] /= TotNbofEvents;
fEnergyLeak2[0] /= TotNbofEvents;
190 if (rmsEl0>0.) rmsEl0 = std::sqrt(rmsEl0/TotNbofEvents);
193 fEnergyLeak[1] /= TotNbofEvents;
fEnergyLeak2[1] /= TotNbofEvents;
195 if (rmsEl1>0.) rmsEl1 = std::sqrt(rmsEl1/TotNbofEvents);
207 G4double dEdxTable = 0., dEdxFull = 0.;
217 G4double meandEdx = fEnergyDeposit/length;
220 G4cout <<
"\n ======================== run summary ======================\n";
224 G4cout <<
"\n The run was " << TotNbofEvents <<
" " << partName <<
" of "
227 << material->
GetName() <<
" (density: "
232 G4cout <<
"\n Total energy deposit in absorber per event = "
233 <<
G4BestUnit(fEnergyDeposit,
"Energy") <<
" +- "
237 G4cout <<
"\n -----> Mean dE/dx = " << meandEdx/(
MeV/
cm) <<
" MeV/cm"
238 <<
"\t(" << stopPower/(
MeV*
cm2/
g) <<
" MeV*cm2/g)"
242 G4cout <<
" restricted dEdx = " << dEdxTable/(
MeV/
cm) <<
" MeV/cm"
243 <<
"\t(" << stopTable/(
MeV*
cm2/
g) <<
" MeV*cm2/g)"
246 G4cout <<
" full dEdx = " << dEdxFull/(
MeV/
cm) <<
" MeV/cm"
247 <<
"\t(" << stopFull/(
MeV*
cm2/
g) <<
" MeV*cm2/g)"
250 G4cout <<
"\n Leakage : primary = "
251 <<
G4BestUnit(fEnergyLeak[0],
"Energy") <<
" +- "
254 <<
G4BestUnit(fEnergyLeak[1],
"Energy") <<
" +- "
258 G4cout <<
" Energy balance : edep + eleak = "
262 G4cout <<
"\n Total track length (charged) in absorber per event = "
263 <<
G4BestUnit(fTrakLenCharged,
"Length") <<
" +- "
266 G4cout <<
" Total track length (neutral) in absorber per event = "
267 <<
G4BestUnit(fTrakLenNeutral,
"Length") <<
" +- "
270 G4cout <<
"\n Number of steps (charged) in absorber per event = "
271 << fNbStepsCharged <<
" +- " << rmsStCh <<
G4endl;
273 G4cout <<
" Number of steps (neutral) in absorber per event = "
274 << fNbStepsNeutral <<
" +- " << rmsStNe <<
G4endl;
276 G4cout <<
"\n Number of secondaries per event : Gammas = " << Gamma
277 <<
"; electrons = " << Elect
278 <<
"; positrons = " << Posit <<
G4endl;
280 G4cout <<
"\n Number of events with the primary particle transmitted = "
281 << transmit[1] <<
" %" <<
G4endl;
283 G4cout <<
" Number of events with at least 1 particle transmitted "
284 <<
"(same charge as primary) = " << transmit[0] <<
" %" <<
G4endl;
286 G4cout <<
"\n Number of events with the primary particle reflected = "
287 << reflect[1] <<
" %" <<
G4endl;
289 G4cout <<
" Number of events with at least 1 particle reflected "
290 <<
"(same charge as primary) = " << reflect[0] <<
" %" <<
G4endl;
294 G4cout <<
"\n MultipleScattering:"
295 <<
"\n rms proj angle of transmit primary particle = "
296 << rmsMsc/
mrad <<
" mrad (central part only)" <<
G4endl;
298 G4cout <<
" computed theta0 (Highland formula) = "
301 G4cout <<
" central part defined as +- "
303 <<
" Tail ratio = " << tailMsc <<
" %" <<
G4endl;
310 G4double binWidth = analysisManager->GetH1Width(ih);
311 G4double unit = analysisManager->GetH1Unit(ih);
313 analysisManager->ScaleH1(ih,fac);
316 binWidth = analysisManager->GetH1Width(ih);
317 unit = analysisManager->GetH1Unit(ih);
318 fac = unit/(TotNbofEvents*binWidth);
319 analysisManager->ScaleH1(ih,fac);
322 analysisManager->ScaleH1(ih,1./TotNbofEvents);
345 G4double teta0 = 13.6*
MeV*z*std::sqrt(t)*(1.+0.038*std::log(t))/bpc;
virtual void Merge(const G4Run *)
G4double fMscThetaCentral
G4double fTrakLenNeutral2
const G4String & GetName() const
G4double ComputeMscHighland()
G4double GetDensity() const
G4double fNbStepsCharged2
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
G4double fTrakLenCharged2
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4String & GetParticleName() const
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4GLOB_DLL std::ostream G4cout
G4Material * GetAbsorberMaterial()
ExG4HbookAnalysisManager G4AnalysisManager
G4double fMscProjecTheta2
G4double GetAbsorberThickness()
G4double GetRadlen() const
G4double GetPDGMass() const
G4double energy(const ThreeVector &p, const G4double m)
DetectorConstruction * fDetector
static const G4double fac
Detector construction class to demonstrate various ways of placement.
G4ParticleDefinition * fParticle
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
static const double eplus
std::vector< G4double > fEnergyDeposit[MaxAbsor]
G4double GetPDGCharge() const
G4double fNbStepsNeutral2
virtual void Merge(const G4Run *)