36 #include "DetectorConstruction.hh"
37 #include "PrimaryGeneratorAction.hh"
38 #include "RunActionMessenger.hh"
39 #include "EmAcceptance.hh"
54 :
G4Run(),fDet(det),fKin(kin),
65 f_dEdL.resize(f_nLbin);
66 fSumELongit.resize(f_nLbin);
67 fSumELongitCumul.resize(f_nLbin);
68 fSumE2Longit.resize(f_nLbin);
69 fSumE2LongitCumul.resize(f_nLbin);
72 f_dEdR.resize(f_nRbin);
73 fSumERadial.resize(f_nRbin);
74 fSumERadialCumul.resize(f_nRbin);
75 fSumE2Radial.resize(f_nRbin);
76 fSumE2RadialCumul.resize(f_nRbin);
85 for (
G4int i=0; i<f_nLbin; i++)
86 fSumELongit[i]=fSumE2Longit[i]=fSumELongitCumul[i]=fSumE2LongitCumul[i]=0.;
88 for (
G4int j=0; j<f_nRbin; j++)
89 fSumERadial[j]=fSumE2Radial[j]=fSumERadialCumul[j]=fSumE2RadialCumul[j]=0.;
92 fSumChargTrLength=fSum2ChargTrLength=fSumNeutrTrLength=fSum2NeutrTrLength=0.;
106 for (
G4int i=0; i<f_nLbin; i++)
109 for (
G4int j=0; j<f_nRbin; j++)
113 fChargTrLength = fNeutrTrLength = 0.;
123 for (
G4int i=0; i<f_nLbin; i++)
125 fSumELongit[i] += f_dEdL[i];
126 fSumE2Longit[i] += f_dEdL[i]*f_dEdL[i];
127 dLCumul += f_dEdL[i];
128 fSumELongitCumul[i] += dLCumul;
129 fSumE2LongitCumul[i] += dLCumul*dLCumul;
133 for (
G4int j=0; j<f_nRbin; j++)
135 fSumERadial[j] += f_dEdR[j];
136 fSumE2Radial[j] += f_dEdR[j]*f_dEdR[j];
137 dRCumul += f_dEdR[j];
138 fSumERadialCumul[j] += dRCumul;
139 fSumE2RadialCumul[j] += dRCumul*dRCumul;
142 fSumChargTrLength += fChargTrLength;
143 fSum2ChargTrLength += fChargTrLength*fChargTrLength;
144 fSumNeutrTrLength += fNeutrTrLength;
145 fSum2NeutrTrLength += fNeutrTrLength*fNeutrTrLength;
155 analysisManager->FillH1(1, 100.*dLCumul/(Ekin+mass));
156 analysisManager->FillH1(2, fChargTrLength/radl);
157 analysisManager->FillH1(3, fNeutrTrLength/radl);
164 const Run* localRun =
static_cast<const Run*
>(run);
166 fChargedStep += localRun->fChargedStep;
167 fNeutralStep += localRun->fNeutralStep;
169 for (
G4int i=0; i<f_nLbin; i++) {
170 fSumELongit[i] += localRun->fSumELongit[i];
171 fSumE2Longit[i] += localRun->fSumE2Longit[i];
172 fSumELongitCumul[i] += localRun->fSumELongitCumul[i];
173 fSumE2LongitCumul[i] += localRun->fSumE2LongitCumul[i];
176 for (
G4int j=0; j<f_nRbin; j++) {
177 fSumERadial[j] += localRun->fSumERadial[j];
178 fSumE2Radial[j] += localRun->fSumE2Radial[j];
179 fSumERadialCumul[j] += localRun->fSumERadialCumul[j];
180 fSumE2RadialCumul[j] += localRun->fSumE2RadialCumul[j];
183 fSumChargTrLength += localRun->fSumChargTrLength;
184 fSum2ChargTrLength += localRun->fSum2ChargTrLength;
185 fSumNeutrTrLength += localRun->fSumNeutrTrLength;
186 fSum2NeutrTrLength += localRun->fSum2NeutrTrLength;
198 assert(NbOfEvents*kinEnergy > 0);
200 fChargedStep /=
G4double(NbOfEvents);
201 fNeutralStep /=
G4double(NbOfEvents);
204 G4double norme = 100./(NbOfEvents*(kinEnergy+mass));
210 MyVector MeanELongit(f_nLbin), rmsELongit(f_nLbin);
211 MyVector MeanELongitCumul(f_nLbin), rmsELongitCumul(f_nLbin);
216 for (i=0; i<f_nLbin; i++) {
217 MeanELongit[i] = norme*fSumELongit[i];
219 norme*std::sqrt(std::abs(NbOfEvents*fSumE2Longit[i]
220 - fSumELongit[i]*fSumELongit[i]));
222 MeanELongitCumul[i] = norme*fSumELongitCumul[i];
223 rmsELongitCumul[i] = norme*std::sqrt(std::abs(NbOfEvents*
224 fSumE2LongitCumul[i] - fSumELongitCumul[i]*fSumELongitCumul[i]));
226 analysisManager->FillH1(4, bin,MeanELongit[i]/dLradl);
227 analysisManager->FillH1(5, bin, rmsELongit[i]/dLradl);
229 analysisManager->FillH1(6, bin,MeanELongitCumul[i]);
230 analysisManager->FillH1(7, bin, rmsELongitCumul[i]);
237 MyVector MeanERadial(f_nRbin), rmsERadial(f_nRbin);
238 MyVector MeanERadialCumul(f_nRbin), rmsERadialCumul(f_nRbin);
240 for (i=0; i<f_nRbin; i++) {
241 MeanERadial[i] = norme*fSumERadial[i];
242 rmsERadial[i] = norme*std::sqrt(std::abs(NbOfEvents*fSumE2Radial[i]
243 - fSumERadial[i]*fSumERadial[i]));
245 MeanERadialCumul[i] = norme*fSumERadialCumul[i];
247 norme*std::sqrt(std::abs(NbOfEvents*fSumE2RadialCumul[i]
248 - fSumERadialCumul[i]*fSumERadialCumul[i]));
251 analysisManager->FillH1(8, bin,MeanERadial[i]/dRradl);
252 analysisManager->FillH1(9, bin, rmsERadial[i]/dRradl);
254 analysisManager->FillH1(10, bin,MeanERadialCumul[i]);
255 analysisManager->FillH1(11, bin, rmsERadialCumul[i]);
262 if ((MeanERadialCumul[0] <= EMoliere) &&
263 (MeanERadialCumul[f_nRbin-1] >= EMoliere)) {
265 while( (imin < f_nRbin-1) && (MeanERadialCumul[imin] < EMoliere) )
267 G4double ratio = (EMoliere - MeanERadialCumul[imin]) /
268 (MeanERadialCumul[imin+1] - MeanERadialCumul[imin]);
269 iMoliere = 1. + imin + ratio;
275 G4double MeanChargTrLength = norme*fSumChargTrLength;
277 norme*std::sqrt(std::fabs(NbOfEvents*fSum2ChargTrLength
278 - fSumChargTrLength*fSumChargTrLength));
280 G4double MeanNeutrTrLength = norme*fSumNeutrTrLength;
282 norme*std::sqrt(std::fabs(NbOfEvents*fSum2NeutrTrLength
283 - fSumNeutrTrLength*fSumNeutrTrLength));
286 std::ios::fmtflags mode =
G4cout.flags();
287 G4cout.setf(std::ios::fixed,std::ios::floatfield);
292 G4cout <<
" LOGITUDINAL PROFILE "
293 <<
" CUMULATIVE LOGITUDINAL PROFILE" <<
G4endl <<
G4endl;
295 G4cout <<
" bin " <<
" Mean rms "
296 <<
" bin " <<
" Mean rms \n" <<
G4endl;
298 for (i=0; i<f_nLbin; i++) {
299 G4double inf=i*dLradl, sup=inf+dLradl;
301 G4cout << std::setw(8) << inf <<
"->"
302 << std::setw(5) << sup <<
" radl: "
303 << std::setw(7) << MeanELongit[i] <<
"% "
304 << std::setw(9) << rmsELongit[i] <<
"% "
305 <<
" 0->" << std::setw(5) << sup <<
" radl: "
306 << std::setw(7) << MeanELongitCumul[i] <<
"% "
307 << std::setw(7) << rmsELongitCumul[i] <<
"% "
313 G4cout <<
" RADIAL PROFILE "
314 <<
" CUMULATIVE RADIAL PROFILE" << G4endl <<
G4endl;
316 G4cout <<
" bin " <<
" Mean rms "
317 <<
" bin " <<
" Mean rms \n" <<
G4endl;
319 for (i=0; i<f_nRbin; i++) {
320 G4double inf=i*dRradl, sup=inf+dRradl;
322 G4cout << std::setw(8) << inf <<
"->"
323 << std::setw(5) << sup <<
" radl: "
324 << std::setw(7) << MeanERadial[i] <<
"% "
325 << std::setw(9) << rmsERadial[i] <<
"% "
326 <<
" 0->" << std::setw(5) << sup <<
" radl: "
327 << std::setw(7) << MeanERadialCumul[i] <<
"% "
328 << std::setw(7) << rmsERadialCumul[i] <<
"% "
335 G4cout <<
" Total number pf events: " << NbOfEvents <<
"\n"
336 <<
" Mean number of charged steps: " << fChargedStep <<
G4endl;
337 G4cout <<
" Mean number of neutral steps: " << fNeutralStep
340 G4cout <<
" energy deposit : "
341 << std::setw(7) << MeanELongitCumul[f_nLbin-1] <<
" % E0 +- "
342 << std::setw(7) << rmsELongitCumul[f_nLbin-1] <<
" % E0" <<
G4endl;
343 G4cout <<
" charged traklen: "
344 << std::setw(7) << MeanChargTrLength <<
" radl +- "
345 << std::setw(7) << rmsChargTrLength <<
" radl" <<
G4endl;
346 G4cout <<
" neutral traklen: "
347 << std::setw(7) << MeanNeutrTrLength <<
" radl +- "
348 << std::setw(7) << rmsNeutrTrLength <<
" radl" <<
G4endl;
350 if (iMoliere > 0. ) {
353 G4cout <<
"\n " << EMoliere <<
" % confinement: radius = "
354 << RMoliere1 <<
" radl ("
358 G4cout.setf(mode,std::ios::floatfield);
367 G4double e = MeanELongitCumul[nLbin-1]/100.;
368 G4double r = rmsELongitCumul[nLbin-1]/100.;
virtual void Merge(const G4Run *)
void EmAcceptanceGauss(const G4String &title, G4int stat, G4double avr, G4double avr0, G4double rms, G4double limit)
void InitializePerEvent()
void BeginOfAcceptance(const G4String &title, G4int stat)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
std::vector< G4double > MyVector
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
G4Material * GetMaterial()
ExG4HbookAnalysisManager G4AnalysisManager
G4double GetRadlen() const
G4double GetPDGMass() const
G4ParticleGun * GetParticleGun()
G4ParticleDefinition * GetParticleDefinition() const
virtual void Merge(const G4Run *)
G4double GetParticleEnergy() const
Run(DetectorConstruction *)