20 #include "art_root_io/TFileService.h" 26 #include "CLHEP/Units/SystemOfUnits.h" 27 #include "Geant4/G4Step.hh" 36 CLHEP::HepRandomEngine& engine)
55 CLHEP::HepRandomEngine& engine)
62 fISCalc = std::make_unique<larg4::ISCalculationSeparate>();
64 fISCalc = std::make_unique<larg4::ISCalculationCorrelated>(detProp);
68 mf::LogWarning(
"IonizationAndScintillation") <<
"No ISCalculation set, this can't be good.";
79 fElectronsPerStep = tfs->make<TH1F>(
"electronsPerStep",
";Electrons;Steps", 500, 0., 5000.);
80 fPhotonsPerStep = tfs->make<TH1F>(
"photonsPerStep",
";Photons;Steps", 500, 0., 5000.);
81 fEnergyPerStep = tfs->make<TH1F>(
"energyPerStep",
";Energy (MeV);Steps", 100, 0., 0.5);
82 fStepSize = tfs->make<TH1F>(
"stepSize",
";Step Size (CLHEP::cm);Steps", 500, 0., 0.2);
84 "electronsPerLength",
";Electrons #times 10^{3}/CLHEP::cm;Steps", 1000, 0., 1000.);
86 "photonsPerLength",
";Photons #times 10^{3}/CLHEP::cm;Steps", 1000, 0., 1000.);
88 tfs->make<TH1F>(
"electronsPerEDep",
";Electrons #times 10^{3}/MeV;Steps", 1000, 0., 1000.);
90 tfs->make<TH1F>(
"photonsPerEDep",
";Photons #times 10^{3}/MeV;Steps", 1000, 0., 1000.);
93 tfs->make<TH2F>(
"electronsVsPhotons",
";Photons;Electrons", 500, 0., 5000., 500, 0., 5000.);
101 if (
fStepNumber == step->GetTrack()->GetCurrentStepNumber() &&
102 fTrkID == step->GetTrack()->GetTrackID())
105 fStepNumber = step->GetTrack()->GetCurrentStepNumber();
106 fTrkID = step->GetTrack()->GetTrackID();
113 if (step->GetTrack()->GetMaterial()->GetName() !=
"LAr")
return;
117 if (step->GetTotalEnergyDeposit() > 0) {
123 <<
"\nEnergy: " <<
fISCalc->EnergyDeposit()
124 <<
"\nElectrons: " <<
fISCalc->NumberIonizationElectrons()
125 <<
"\nPhotons: " <<
fISCalc->NumberScintillationPhotons();
127 G4ThreeVector totstep =
fStep->GetPostStepPoint()->GetPosition();
128 totstep -=
fStep->GetPreStepPoint()->GetPosition();
136 fISCalc->NumberIonizationElectrons());
137 double const stepSize = totstep.mag() /
CLHEP::cm;
138 if (stepSize > 0.0) {
142 double const energyDep =
fISCalc->EnergyDeposit();
static constexpr double cm
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
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
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)