35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
49 fParticle(0), fEkin(0.)
51 fEnergyDeposit = fEnergyDeposit2 = 0.;
52 fTrakLenCharged = fTrakLenCharged2 = 0.;
53 fTrakLenNeutral = fTrakLenNeutral2 = 0.;
54 fNbStepsCharged = fNbStepsCharged2 = 0.;
55 fNbStepsNeutral = fNbStepsNeutral2 = 0.;
56 fMscProjecTheta = fMscProjecTheta2 = 0.;
57 fMscThetaCentral = 0.;
59 fNbGamma = fNbElect = fNbPosit = 0;
61 fTransmit[0] = fTransmit[1] = fReflect[0] = fReflect[1] = 0;
65 fEnergyLeak[0] = fEnergyLeak[1] = fEnergyLeak2[0] = fEnergyLeak2[1] = 0.;
88 const Run* localRun =
static_cast<const Run*
>(run);
91 fParticle = localRun->fParticle;
92 fEkin = localRun->fEkin;
94 fMscThetaCentral = localRun->fMscThetaCentral;
98 fEnergyDeposit += localRun->fEnergyDeposit;
99 fEnergyDeposit2 += localRun->fEnergyDeposit2;
100 fTrakLenCharged += localRun->fTrakLenCharged;
101 fTrakLenCharged2 += localRun->fTrakLenCharged2;
102 fTrakLenNeutral += localRun->fTrakLenNeutral;
103 fTrakLenNeutral2 += localRun->fTrakLenNeutral2;
104 fNbStepsCharged += localRun->fNbStepsCharged;
105 fNbStepsCharged2 += localRun->fNbStepsCharged2;
106 fNbStepsNeutral += localRun->fNbStepsNeutral;
107 fNbStepsNeutral2 += localRun->fNbStepsNeutral2;
109 fNbGamma += localRun->fNbGamma;
110 fNbElect += localRun->fNbElect;
111 fNbPosit += localRun->fNbPosit;
113 fTransmit[0] += localRun->fTransmit[0];
114 fTransmit[1] += localRun->fTransmit[1];
115 fReflect[0] += localRun->fReflect[0];
116 fReflect[1] += localRun->fReflect[1];
118 fMscEntryCentral += localRun->fMscEntryCentral;
120 fEnergyLeak[0] += localRun->fEnergyLeak[0];
121 fEnergyLeak[1] += localRun->fEnergyLeak[1];
122 fEnergyLeak2[0] += localRun->fEnergyLeak2[0];
123 fEnergyLeak2[1] += localRun->fEnergyLeak2[1];
135 if (TotNbofEvents == 0)
return;
137 G4double EnergyBalance = fEnergyDeposit + fEnergyLeak[0] + fEnergyLeak[1];
138 EnergyBalance /= TotNbofEvents;
140 fEnergyDeposit /= TotNbofEvents; fEnergyDeposit2 /= TotNbofEvents;
141 G4double rmsEdep = fEnergyDeposit2 - fEnergyDeposit*fEnergyDeposit;
142 if (rmsEdep>0.) rmsEdep = std::sqrt(rmsEdep/TotNbofEvents);
145 fTrakLenCharged /= TotNbofEvents; fTrakLenCharged2 /= TotNbofEvents;
146 G4double rmsTLCh = fTrakLenCharged2 - fTrakLenCharged*fTrakLenCharged;
147 if (rmsTLCh>0.) rmsTLCh = std::sqrt(rmsTLCh/TotNbofEvents);
150 fTrakLenNeutral /= TotNbofEvents; fTrakLenNeutral2 /= TotNbofEvents;
151 G4double rmsTLNe = fTrakLenNeutral2 - fTrakLenNeutral*fTrakLenNeutral;
152 if (rmsTLNe>0.) rmsTLNe = std::sqrt(rmsTLNe/TotNbofEvents);
155 fNbStepsCharged /= TotNbofEvents; fNbStepsCharged2 /= TotNbofEvents;
156 G4double rmsStCh = fNbStepsCharged2 - fNbStepsCharged*fNbStepsCharged;
157 if (rmsStCh>0.) rmsStCh = std::sqrt(rmsTLCh/TotNbofEvents);
160 fNbStepsNeutral /= TotNbofEvents; fNbStepsNeutral2 /= TotNbofEvents;
161 G4double rmsStNe = fNbStepsNeutral2 - fNbStepsNeutral*fNbStepsNeutral;
162 if (rmsStNe>0.) rmsStNe = std::sqrt(rmsTLCh/TotNbofEvents);
170 transmit[0] = 100.*fTransmit[0]/TotNbofEvents;
171 transmit[1] = 100.*fTransmit[1]/TotNbofEvents;
174 reflect[0] = 100.*fReflect[0]/TotNbofEvents;
175 reflect[1] = 100.*fReflect[1]/TotNbofEvents;
178 if (fMscEntryCentral > 0) {
179 fMscProjecTheta /= fMscEntryCentral; fMscProjecTheta2 /= fMscEntryCentral;
180 rmsMsc = fMscProjecTheta2 - fMscProjecTheta*fMscProjecTheta;
181 if (rmsMsc > 0.) { rmsMsc = std::sqrt(rmsMsc); }
182 if(fTransmit[1] > 0.0) {
183 tailMsc = 100.- (100.*fMscEntryCentral)/(2*fTransmit[1]);
187 fEnergyLeak[0] /= TotNbofEvents; fEnergyLeak2[0] /= TotNbofEvents;
188 G4double rmsEl0 = fEnergyLeak2[0] - fEnergyLeak[0]*fEnergyLeak[0];
189 if (rmsEl0>0.) rmsEl0 = std::sqrt(rmsEl0/TotNbofEvents);
192 fEnergyLeak[1] /= TotNbofEvents; fEnergyLeak2[1] /= TotNbofEvents;
193 G4double rmsEl1 = fEnergyLeak2[1] - fEnergyLeak[1]*fEnergyLeak[1];
194 if (rmsEl1>0.) rmsEl1 = std::sqrt(rmsEl1/TotNbofEvents);
206 G4double dEdxTable = 0., dEdxFull = 0.;
208 dEdxTable = emCalculator.
GetDEDX(fEkin,fParticle,material);
216 G4double meandEdx = fEnergyDeposit/length;
219 G4cout <<
"\n ======================== run summary ======================\n";
223 G4cout <<
"\n The run was " << TotNbofEvents <<
" " << partName <<
" of "
226 << material->
GetName() <<
" (density: "
231 G4cout <<
"\n Total energy deposit in absorber per event = "
232 <<
G4BestUnit(fEnergyDeposit,
"Energy") <<
" +- "
236 G4cout <<
"\n -----> Mean dE/dx = " << meandEdx/(
MeV/
cm) <<
" MeV/cm"
237 <<
"\t(" << stopPower/(
MeV*
cm2/
g) <<
" MeV*cm2/g)"
241 G4cout <<
" restricted dEdx = " << dEdxTable/(
MeV/
cm) <<
" MeV/cm"
242 <<
"\t(" << stopTable/(
MeV*
cm2/
g) <<
" MeV*cm2/g)"
245 G4cout <<
" full dEdx = " << dEdxFull/(
MeV/
cm) <<
" MeV/cm"
246 <<
"\t(" << stopFull/(
MeV*
cm2/
g) <<
" MeV*cm2/g)"
249 G4cout <<
"\n Leakage : primary = "
250 <<
G4BestUnit(fEnergyLeak[0],
"Energy") <<
" +- "
253 <<
G4BestUnit(fEnergyLeak[1],
"Energy") <<
" +- "
257 G4cout <<
" Energy balance : edep + eleak = "
261 G4cout <<
"\n Total track length (charged) in absorber per event = "
262 <<
G4BestUnit(fTrakLenCharged,
"Length") <<
" +- "
265 G4cout <<
" Total track length (neutral) in absorber per event = "
266 <<
G4BestUnit(fTrakLenNeutral,
"Length") <<
" +- "
269 G4cout <<
"\n Number of steps (charged) in absorber per event = "
270 << fNbStepsCharged <<
" +- " << rmsStCh <<
G4endl;
272 G4cout <<
" Number of steps (neutral) in absorber per event = "
273 << fNbStepsNeutral <<
" +- " << rmsStNe <<
G4endl;
275 G4cout <<
"\n Number of secondaries per event : Gammas = " << Gamma
276 <<
"; electrons = " << Elect
277 <<
"; positrons = " << Posit <<
G4endl;
279 G4cout <<
"\n Number of events with the primary particle transmitted = "
280 << transmit[1] <<
" %" <<
G4endl;
282 G4cout <<
" Number of events with at least 1 particle transmitted "
283 <<
"(same charge as primary) = " << transmit[0] <<
" %" <<
G4endl;
285 G4cout <<
"\n Number of events with the primary particle reflected = "
286 << reflect[1] <<
" %" <<
G4endl;
288 G4cout <<
" Number of events with at least 1 particle reflected "
289 <<
"(same charge as primary) = " << reflect[0] <<
" %" <<
G4endl;
293 G4cout <<
"\n MultipleScattering:"
294 <<
"\n rms proj angle of transmit primary particle = "
295 << rmsMsc/
mrad <<
" mrad (central part only)" <<
G4endl;
297 G4cout <<
" computed theta0 (Highland formula) = "
300 G4cout <<
" central part defined as +- "
301 << fMscThetaCentral/
mrad <<
" mrad; "
302 <<
" Tail ratio = " << tailMsc <<
" %" <<
G4endl;
325 G4double teta0 = 13.6*
MeV*z*std::sqrt(t)*(1.+0.038*std::log(t))/bpc;
virtual void Merge(const G4Run *)
const G4String & GetName() const
G4double ComputeMscHighland()
G4double GetDensity() const
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
#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
void PrintSummary() const
G4Material * GetAbsorberMaterial()
G4double GetAbsorberThickness()
G4double GetRadlen() const
G4double GetPDGMass() const
void SetPrimary(G4ParticleDefinition *particle, G4double energy)
G4double GetPDGCharge() const
virtual void Merge(const G4Run *)
Run(DetectorConstruction *)