20 #include "art_root_io/TFileService.h" 26 #include "CLHEP/Units/SystemOfUnits.h" 27 #include "Geant4/G4Step.hh" 36 CLHEP::HepRandomEngine& engine)
54 CLHEP::HepRandomEngine& engine)
61 fISCalc = std::make_unique<larg4::ISCalculationSeparate>();
63 fISCalc = std::make_unique<larg4::ISCalculationCorrelated>(detProp);
67 mf::LogWarning(
"IonizationAndScintillation") <<
"No ISCalculation set, this can't be good.";
78 fElectronsPerStep = tfs->make<TH1F>(
"electronsPerStep",
";Electrons;Steps", 500, 0., 5000.);
79 fPhotonsPerStep = tfs->make<TH1F>(
"photonsPerStep",
";Photons;Steps", 500, 0., 5000.);
80 fEnergyPerStep = tfs->make<TH1F>(
"energyPerStep",
";Energy (MeV);Steps", 100, 0., 0.5);
81 fStepSize = tfs->make<TH1F>(
"stepSize",
";Step Size (CLHEP::cm);Steps", 500, 0., 0.2);
83 "electronsPerLength",
";Electrons #times 10^{3}/CLHEP::cm;Steps", 1000, 0., 1000.);
85 "photonsPerLength",
";Photons #times 10^{3}/CLHEP::cm;Steps", 1000, 0., 1000.);
87 tfs->make<TH1F>(
"electronsPerEDep",
";Electrons #times 10^{3}/MeV;Steps", 1000, 0., 1000.);
89 tfs->make<TH1F>(
"photonsPerEDep",
";Photons #times 10^{3}/MeV;Steps", 1000, 0., 1000.);
92 tfs->make<TH2F>(
"electronsVsPhotons",
";Photons;Electrons", 500, 0., 5000., 500, 0., 5000.);
99 if (
fStepNumber == step->GetTrack()->GetCurrentStepNumber() &&
100 fTrkID == step->GetTrack()->GetTrackID())
103 fStepNumber = step->GetTrack()->GetCurrentStepNumber();
104 fTrkID = step->GetTrack()->GetTrackID();
111 if (step->GetTrack()->GetMaterial()->GetName() !=
"LAr")
return;
115 if (step->GetTotalEnergyDeposit() > 0) {
120 <<
"Step Size: " <<
fStep->GetStepLength() / CLHEP::cm
121 <<
"\nEnergy: " <<
fISCalc->EnergyDeposit()
122 <<
"\nElectrons: " <<
fISCalc->NumberIonizationElectrons()
123 <<
"\nPhotons: " <<
fISCalc->NumberScintillationPhotons();
125 G4ThreeVector totstep =
fStep->GetPostStepPoint()->GetPosition();
126 totstep -=
fStep->GetPreStepPoint()->GetPosition();
129 fStepSize->Fill(totstep.mag() / CLHEP::cm);
134 fISCalc->NumberIonizationElectrons());
135 double const stepSize = totstep.mag() / CLHEP::cm;
136 if (stepSize > 0.0) {
140 double const energyDep =
fISCalc->EnergyDeposit();
Store parameters for running LArG4.
const std::string & IonAndScintCalculator() const
TH1F * fPhotonsPerEDep
histogram of photons per MeV deposited
TH1F * fElectronsPerEDep
histogram of electrons per MeV deposited
int fStepNumber
last StepNumber checked
void Reset(const G4Step *step)
G4Step const * fStep
pointer to the current G4 step
TH1F * fElectronsPerLength
histogram of electrons per cm
std::unique_ptr< larg4::ISCalculation > fISCalc
Interface to algorithm class for a specific calculation of ionization electrons and scintillation pho...
CLHEP::HepRandomEngine & fEngine
random engine (needed for NEST)
static IonizationAndScintillation * Instance()
TH1F * fStepSize
histogram of the step sizes
TH1F * fElectronsPerStep
histogram of electrons per step
TH1F * fPhotonsPerStep
histogram of the photons per step
Singleton to access a unified treatment of ionization and scintillation in LAr.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
static IonizationAndScintillation * CreateInstance(detinfo::DetectorPropertiesData const &detProp, CLHEP::HepRandomEngine &engine)
TH1F * fEnergyPerStep
histogram of the energy deposited per step
TH1F * fPhotonsPerLength
histogram of photons per cm
TH2F * fElectronsVsPhotons
histogram of electrons vs photons per step
std::string fISCalculator
name of calculator to use, NEST or Separate
static IonizationAndScintillation * gInstance
int fTrkID
last TrkID checked
IonizationAndScintillation(detinfo::DetectorPropertiesData const &detProp, CLHEP::HepRandomEngine &engine)