34 #include "RunAction.hh"
36 #include "DetectorConstruction.hh"
37 #include "PrimaryGeneratorAction.hh"
38 #include "HistoManager.hh"
53 : fDetector(det), fPrimary(prim), fProcCounter(0), fHistoManager(HistM)
73 fHistoManager->
book();
81 size_t nbProc = fProcCounter->size();
83 while ((i<nbProc)&&((*fProcCounter)[i]->GetName()!=procName)) i++;
84 if (i == nbProc) fProcCounter->push_back(
new OneProcessCount(procName));
86 (*fProcCounter)[i]->Count();
94 if (NbOfEvents == 0)
return;
96 std::ios::fmtflags mode =
G4cout.flags();
107 G4cout <<
"\n The run consists of " << NbOfEvents <<
" "<< particle <<
" of "
110 << material->
GetName() <<
" (density: "
115 G4cout <<
"\n Number of process calls --->";
116 for (
size_t i=0; i< fProcCounter->size();i++) {
117 G4String procName = (*fProcCounter)[i]->GetName();
118 if (procName !=
"Transportation") {
119 G4int count = (*fProcCounter)[i]->GetCounter();
120 G4cout <<
"\t" << procName <<
" : " << count;
128 G4double totalCrossSection = countTot/(NbOfEvents*length);
129 G4double MeanFreePath = 1./totalCrossSection;
133 G4cout <<
"\n Simulation: "
134 <<
"total CrossSection = " << totalCrossSection*
cm <<
" /cm"
135 <<
"\t MeanFreePath = " <<
G4BestUnit(MeanFreePath,
"Length")
136 <<
"\t massicCrossSection = " << massCrossSection*
g/
cm2 <<
" cm2/g"
141 if(particle ==
"mu+" || particle ==
"mu-") {
142 totalCrossSection = 0.;
143 for (
size_t i=0; i< fProcCounter->size();i++) {
144 G4String procName = (*fProcCounter)[i]->GetName();
145 if (procName !=
"Transportation")
146 totalCrossSection += ComputeTheory(procName, NbOfEvents);
149 MeanFreePath = 1./totalCrossSection;
150 massCrossSection = totalCrossSection/
density;
153 <<
"total CrossSection = " << totalCrossSection*
cm <<
" /cm"
154 <<
"\t MeanFreePath = " <<
G4BestUnit(MeanFreePath,
"Length")
155 <<
"\t massicCrossSection = " << massCrossSection*
g/
cm2 <<
" cm2/g"
159 G4cout.setf(mode,std::ios::floatfield);
163 while (fProcCounter->size()>0){
165 fProcCounter->pop_back();
170 fHistoManager->
save();
185 if (process ==
"muIoni") {
id = 1; cut = GetEnergyCut(material,1);}
186 else if (process ==
"muPairProd") {
id = 2; cut = 2*(GetEnergyCut(material,1)
188 else if (process ==
"muBrems") {
id = 3; cut = GetEnergyCut(material,0);}
189 else if (process ==
"muNucl")
id = 4;
190 else if (process ==
"hIoni") {
id = 5; cut = GetEnergyCut(material,1);}
191 else if (process ==
"hPairProd") {
id = 6; cut = 2*(GetEnergyCut(material,1)
193 else if (process ==
"hBrems") {
id = 7; cut = GetEnergyCut(material,0);}
194 if (
id == 0)
return 0.;
196 G4int nbOfBins = 100;
197 G4double binMin = -10., binMax = 0., binWidth = (binMax-binMin)/nbOfBins;
203 const G4String label[] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
204 "10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19"};
210 nbOfBins = fHistoManager->
GetNbins(
id);
211 binMin = fHistoManager->
GetVmin (
id);
212 binMax = fHistoManager->
GetVmax (
id);
217 G4int histThId = analysisManager
218 ->CreateH1(labelTh,titleTh,nbOfBins,binMin,binMax);
219 histoTh = analysisManager->GetH1(histThId);
229 const G4double ln10 = std::log(10.);
232 for (
G4int ibin=0; ibin<nbOfBins; ibin++) {
233 lgeps = binMin + (ibin+0.5)*binWidth;
234 etransf = ekin*std::pow(10.,lgeps);
235 sigmaE = crossSections.
CR_Macroscopic(process,material,ekin,etransf);
236 dsigma = sigmaE*etransf*binWidth*ln10;
237 if (etransf > cut) sigmaTot +=
dsigma;
239 if (histoTh) histoTh->fill(lgeps, NbProcess);
262 (index < table->GetTableSize())) index++;