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)
70 CLHEP::HepRandom::showEngineStatus();
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;
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);
174 CLHEP::HepRandom::showEngineStatus();
186 if (process ==
"muIoni") {
id = 11; cut =
GetEnergyCut(material,1);}
187 else if (process ==
"muPairProd") {
id = 12; cut = 2*(
GetEnergyCut(material,1)
188 + electron_mass_c2); }
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++;
std::vector< OneProcessCount * > ProcessesCount
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
void BeginOfRunAction(const G4Run *)
G4double CR_Macroscopic(const G4String &, G4Material *, G4double, G4double)
const G4String & GetName() const
G4double GetDensity() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
Definition of the MuCrossSections class.
void SetRandomNumberStore(G4bool flag)
void CountProcesses(G4String procName)
G4double GetVmin(G4int id)
DetectorConstruction * fDetector
const G4String & GetParticleName() const
HistoManager * fHistoManager
G4double GetVmax(G4int id)
static const G4double ln10
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
G4Material * GetMaterial()
void EndOfRunAction(const G4Run *)
ExG4HbookAnalysisManager G4AnalysisManager
G4int GetHistoID(G4int id)
G4bool HistoExist(G4int id)
std::map< G4String, G4int > fProcCounter
G4double GetEnergyCut(G4Material *, G4int)
static G4RunManager * GetRunManager()
static G4ProductionCutsTable * GetProductionCutsTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4ParticleGun * GetParticleGun()
G4double energy(const ThreeVector &p, const G4double m)
G4ParticleDefinition * GetParticleDefinition() const
G4double GetBinWidth(G4int id)
G4double ComputeTheory(G4String, G4int)
Detector construction class to demonstrate various ways of placement.
G4double GetParticleEnergy() const
PrimaryGeneratorAction * fPrimary
const G4Material * GetMaterial() const