34 #include "RunAction.hh"
36 #include "DetectorConstruction.hh"
37 #include "PrimaryGeneratorAction.hh"
38 #include "HistoManager.hh"
54 fDetector(det), fPrimary(prim), fProcCounter(0), fHistoManager(HistM)
83 while ((i<nbProc)&&((*
fProcCounter)[i]->GetName()!=procName)) i++;
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 --->";
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;
130 G4double massCrossSection =totalCrossSection/density;
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.;
144 G4String procName = (*fProcCounter)[i]->GetName();
145 if (procName !=
"Transportation") {
150 MeanFreePath = 1./totalCrossSection;
151 massCrossSection = totalCrossSection/density;
154 <<
"total CrossSection = " << totalCrossSection*
cm <<
" /cm"
155 <<
"\t MeanFreePath = " <<
G4BestUnit(MeanFreePath,
"Length")
156 <<
"\t massicCrossSection = " << massCrossSection*
g/
cm2 <<
" cm2/g"
160 G4cout.setf(mode,std::ios::floatfield);
186 if (process ==
"muIoni") {
id = 11; cut =
GetEnergyCut(material,1);}
187 else if (process ==
"muPairProd") {
id = 12; cut = 2*(
GetEnergyCut(material,1)
189 else if (process ==
"muBrems") {
id = 13; cut =
GetEnergyCut(material,0);}
190 else if (process ==
"muonNuclear"){
id = 14; }
191 if (
id == 0) {
return 0.; }
193 G4int nbOfBins = 100;
218 G4double lgeps, etransf, sigmaE, dsigma;
223 for (
G4int ibin=0; ibin<nbOfBins; ibin++) {
224 lgeps = binMin + (ibin+0.5)*binWidth;
225 etransf = ekin*std::pow(10.,lgeps);
226 sigmaE = crossSections.
CR_Macroscopic(process,material,ekin,etransf);
227 dsigma = sigmaE*etransf*binWidth*
ln10;
228 if (etransf > cut) sigmaTot += dsigma;
230 G4double NbProcess = NbOfMu*length*dsigma;
231 histoTh->fill(lgeps, NbProcess);
250 (index < table->GetTableSize())) index++;
static G4RunManager * GetRunManager()
void EndOfRunAction(const G4Run *)
G4double ComputeTheory(G4String, G4int)
ProcessesCount * fProcCounter
std::vector< OneProcessCount * > ProcessesCount
tools::histo::h1d G4AnaH1
const G4String & GetParticleName() const
G4double GetBinWidth(G4int id)
G4double GetVmin(G4int id)
G4ParticleGun * GetParticleGun()
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
HistoManager * fHistoManager
void BeginOfRunAction(const G4Run *)
static const G4double ln10
G4int GetNumberOfEvent() const
const G4String & GetName() const
G4double GetEnergyCut(G4Material *, G4int)
static constexpr double g
static constexpr double cm2
void CountProcesses(G4String)
static constexpr double electron_mass_c2
The primary generator action class with particle gun.
G4CsvAnalysisManager G4AnalysisManager
DetectorConstruction * fDetector
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
static G4ProductionCutsTable * GetProductionCutsTable()
void SetRandomNumberStore(G4bool flag)
G4double GetParticleEnergy() const
G4bool HistoExist(G4int id)
PrimaryGeneratorAction * fPrimary
static constexpr double cm
G4GLOB_DLL std::ostream G4cout
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4int GetHistoID(G4int id)
const G4Material * GetMaterial() const
Definition of the MuCrossSections class.
G4ParticleDefinition * GetParticleDefinition() const
G4Material * GetMaterial()
static void showEngineStatus()
Simple detector construction with a box volume placed in a world.
G4double GetVmax(G4int id)
G4double CR_Macroscopic(const G4String &, G4Material *, G4double, G4double)
G4double GetDensity() const