LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
larg4::IonizationAndScintillation Class Reference

#include "IonizationAndScintillation.h"

Public Member Functions

void Reset (const G4Step *step)
 
double EnergyDeposit () const
 
double VisibleEnergyDeposit () const
 
double NumberIonizationElectrons () const
 
double NumberScintillationPhotons () const
 
double StepSizeLimit () const
 

Static Public Member Functions

static IonizationAndScintillationCreateInstance (detinfo::DetectorPropertiesData const &detProp, CLHEP::HepRandomEngine &engine)
 
static IonizationAndScintillationInstance ()
 

Private Member Functions

 IonizationAndScintillation (detinfo::DetectorPropertiesData const &detProp, CLHEP::HepRandomEngine &engine)
 

Private Attributes

std::unique_ptr< larg4::ISCalculationfISCalc
 
std::string fISCalculator
 name of calculator to use, NEST or Separate More...
 
G4Step const * fStep {nullptr}
 pointer to the current G4 step More...
 
int fStepNumber {-1}
 last StepNumber checked More...
 
int fTrkID {-1}
 last TrkID checked More...
 
TH1F * fElectronsPerStep {nullptr}
 histogram of electrons per step More...
 
TH1F * fStepSize {nullptr}
 histogram of the step sizes More...
 
TH1F * fPhotonsPerStep {nullptr}
 histogram of the photons per step More...
 
TH1F * fEnergyPerStep {nullptr}
 histogram of the energy deposited per step More...
 
TH1F * fElectronsPerLength
 histogram of electrons per cm More...
 
TH1F * fPhotonsPerLength
 histogram of photons per cm More...
 
TH1F * fElectronsPerEDep
 histogram of electrons per MeV deposited More...
 
TH1F * fPhotonsPerEDep
 histogram of photons per MeV deposited More...
 
TH2F * fElectronsVsPhotons {nullptr}
 histogram of electrons vs photons per step More...
 
CLHEP::HepRandomEngine & fEngine
 random engine (needed for NEST) More...
 

Detailed Description

Definition at line 31 of file IonizationAndScintillation.h.

Constructor & Destructor Documentation

larg4::IonizationAndScintillation::IonizationAndScintillation ( detinfo::DetectorPropertiesData const &  detProp,
CLHEP::HepRandomEngine &  engine 
)
private

Definition at line 52 of file IonizationAndScintillation.cxx.

References fElectronsPerEDep, fElectronsPerLength, fElectronsPerStep, fElectronsVsPhotons, fEnergyPerStep, fEngine, fISCalc, fISCalculator, fPhotonsPerEDep, fPhotonsPerLength, fPhotonsPerStep, fStepNumber, fStepSize, fTrkID, and sim::LArG4Parameters::IonAndScintCalculator().

Referenced by CreateInstance().

55  : fEngine{engine}
56  {
59 
60  if (fISCalculator == "Separate")
61  fISCalc = std::make_unique<larg4::ISCalculationSeparate>();
62  else if (fISCalculator == "Correlated")
63  fISCalc = std::make_unique<larg4::ISCalculationCorrelated>(detProp);
64  else if (fISCalculator == "NEST")
65  fISCalc = std::make_unique<larg4::ISCalculationNEST>(fEngine);
66  else
67  mf::LogWarning("IonizationAndScintillation") << "No ISCalculation set, this can't be good.";
68 
69  // Reset the values for the electrons, photons, and energy to 0
70  // in the calculator
71  fISCalc->Reset();
72  //set the current track and step number values to bogus so that it will run the first reset:
73  fStepNumber = -1;
74  fTrkID = -1;
75 
76  // make the histograms
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);
82  fElectronsPerLength = tfs->make<TH1F>(
83  "electronsPerLength", ";Electrons #times 10^{3}/CLHEP::cm;Steps", 1000, 0., 1000.);
84  fPhotonsPerLength = tfs->make<TH1F>(
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.);
90 
92  tfs->make<TH2F>("electronsVsPhotons", ";Photons;Electrons", 500, 0., 5000., 500, 0., 5000.);
93  }
const std::string & IonAndScintCalculator() const
TH1F * fPhotonsPerEDep
histogram of photons per MeV deposited
TH1F * fElectronsPerEDep
histogram of electrons per MeV deposited
TH1F * fElectronsPerLength
histogram of electrons per cm
std::unique_ptr< larg4::ISCalculation > fISCalc
CLHEP::HepRandomEngine & fEngine
random engine (needed for NEST)
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
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

Member Function Documentation

IonizationAndScintillation * larg4::IonizationAndScintillation::CreateInstance ( detinfo::DetectorPropertiesData const &  detProp,
CLHEP::HepRandomEngine &  engine 
)
static

Definition at line 34 of file IonizationAndScintillation.cxx.

References larg4::gInstance, and IonizationAndScintillation().

Referenced by larg4::LArG4::beginJob().

37  {
38  if (!gInstance) gInstance = new IonizationAndScintillation(detProp, engine);
39  return gInstance;
40  }
static IonizationAndScintillation * gInstance
IonizationAndScintillation(detinfo::DetectorPropertiesData const &detProp, CLHEP::HepRandomEngine &engine)
double larg4::IonizationAndScintillation::EnergyDeposit ( ) const
inline

Definition at line 42 of file IonizationAndScintillation.h.

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons().

42 { return fISCalc->EnergyDeposit(); }
std::unique_ptr< larg4::ISCalculation > fISCalc
IonizationAndScintillation * larg4::IonizationAndScintillation::Instance ( )
static
double larg4::IonizationAndScintillation::NumberIonizationElectrons ( ) const
inline

Definition at line 44 of file IonizationAndScintillation.h.

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons().

44 { return fISCalc->NumberIonizationElectrons(); }
std::unique_ptr< larg4::ISCalculation > fISCalc
double larg4::IonizationAndScintillation::NumberScintillationPhotons ( ) const
inline

Definition at line 45 of file IonizationAndScintillation.h.

Referenced by larg4::OpFastScintillation::PostStepDoIt().

45 { return fISCalc->NumberScintillationPhotons(); }
std::unique_ptr< larg4::ISCalculation > fISCalc
void larg4::IonizationAndScintillation::Reset ( const G4Step *  step)

Definition at line 96 of file IonizationAndScintillation.cxx.

References fElectronsPerEDep, fElectronsPerLength, fElectronsPerStep, fElectronsVsPhotons, fEnergyPerStep, fISCalc, fPhotonsPerEDep, fPhotonsPerLength, fPhotonsPerStep, fStep, fStepNumber, fStepSize, fTrkID, and MF_LOG_DEBUG.

Referenced by larg4::OpFastScintillation::PostStepDoIt(), larg4::LArVoxelReadout::ProcessHits(), and larg4::IonizationAndScintillationAction::SteppingAction().

97  {
98 
99  if (fStepNumber == step->GetTrack()->GetCurrentStepNumber() &&
100  fTrkID == step->GetTrack()->GetTrackID())
101  return;
102 
103  fStepNumber = step->GetTrack()->GetCurrentStepNumber();
104  fTrkID = step->GetTrack()->GetTrackID();
105 
106  fStep = step;
107 
108  fISCalc->Reset();
109 
110  // check the material for this step and be sure it is LAr
111  if (step->GetTrack()->GetMaterial()->GetName() != "LAr") return;
112 
113  // double check that the energy deposit is non-zero
114  // then do the calculation if it is
115  if (step->GetTotalEnergyDeposit() > 0) {
116 
117  fISCalc->CalculateIonizationAndScintillation(fStep);
118 
119  MF_LOG_DEBUG("IonizationAndScintillation")
120  << "Step Size: " << fStep->GetStepLength() / CLHEP::cm
121  << "\nEnergy: " << fISCalc->EnergyDeposit()
122  << "\nElectrons: " << fISCalc->NumberIonizationElectrons()
123  << "\nPhotons: " << fISCalc->NumberScintillationPhotons();
124 
125  G4ThreeVector totstep = fStep->GetPostStepPoint()->GetPosition();
126  totstep -= fStep->GetPreStepPoint()->GetPosition();
127 
128  // Fill the histograms
129  fStepSize->Fill(totstep.mag() / CLHEP::cm);
130  fEnergyPerStep->Fill(fISCalc->EnergyDeposit());
131  fElectronsPerStep->Fill(fISCalc->NumberIonizationElectrons());
132  fPhotonsPerStep->Fill(fISCalc->NumberScintillationPhotons());
133  fElectronsVsPhotons->Fill(fISCalc->NumberScintillationPhotons(),
134  fISCalc->NumberIonizationElectrons());
135  double const stepSize = totstep.mag() / CLHEP::cm;
136  if (stepSize > 0.0) {
137  fElectronsPerLength->Fill(fISCalc->NumberIonizationElectrons() * 1.e-3 / stepSize);
138  fPhotonsPerLength->Fill(fISCalc->NumberScintillationPhotons() * 1.e-3 / stepSize);
139  }
140  double const energyDep = fISCalc->EnergyDeposit();
141  if (energyDep) {
142  fElectronsPerEDep->Fill(fISCalc->NumberIonizationElectrons() * 1.e-3 / energyDep);
143  fPhotonsPerEDep->Fill(fISCalc->NumberScintillationPhotons() * 1.e-3 / energyDep);
144  }
145 
146  } // end if the energy deposition is non-zero
147 
148  return;
149  }
TH1F * fPhotonsPerEDep
histogram of photons per MeV deposited
TH1F * fElectronsPerEDep
histogram of electrons per MeV deposited
G4Step const * fStep
pointer to the current G4 step
TH1F * fElectronsPerLength
histogram of electrons per cm
std::unique_ptr< larg4::ISCalculation > fISCalc
TH1F * fStepSize
histogram of the step sizes
TH1F * fElectronsPerStep
histogram of electrons per step
TH1F * fPhotonsPerStep
histogram of the photons per step
#define MF_LOG_DEBUG(id)
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
double larg4::IonizationAndScintillation::StepSizeLimit ( ) const
inline

Definition at line 46 of file IonizationAndScintillation.h.

Referenced by larg4::LArVoxelReadoutGeometry::LArVoxelReadoutGeometry().

46 { return fISCalc->StepSizeLimit(); }
std::unique_ptr< larg4::ISCalculation > fISCalc
double larg4::IonizationAndScintillation::VisibleEnergyDeposit ( ) const
inline

Definition at line 43 of file IonizationAndScintillation.h.

Referenced by larg4::OpFastScintillation::RecordPhotonsProduced().

43 { return fISCalc->VisibleEnergyDeposit(); }
std::unique_ptr< larg4::ISCalculation > fISCalc

Member Data Documentation

TH1F* larg4::IonizationAndScintillation::fElectronsPerEDep
private

histogram of electrons per MeV deposited

Definition at line 66 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

TH1F* larg4::IonizationAndScintillation::fElectronsPerLength
private

histogram of electrons per cm

Definition at line 64 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

TH1F* larg4::IonizationAndScintillation::fElectronsPerStep {nullptr}
private

histogram of electrons per step

Definition at line 60 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

TH2F* larg4::IonizationAndScintillation::fElectronsVsPhotons {nullptr}
private

histogram of electrons vs photons per step

Definition at line 68 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

TH1F* larg4::IonizationAndScintillation::fEnergyPerStep {nullptr}
private

histogram of the energy deposited per step

Definition at line 63 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

CLHEP::HepRandomEngine& larg4::IonizationAndScintillation::fEngine
private

random engine (needed for NEST)

Definition at line 69 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation().

std::unique_ptr<larg4::ISCalculation> larg4::IonizationAndScintillation::fISCalc
private

object to calculate ionization and scintillation produced by an energy deposition

Definition at line 53 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

std::string larg4::IonizationAndScintillation::fISCalculator
private

name of calculator to use, NEST or Separate

Definition at line 55 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation().

TH1F* larg4::IonizationAndScintillation::fPhotonsPerEDep
private

histogram of photons per MeV deposited

Definition at line 67 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

TH1F* larg4::IonizationAndScintillation::fPhotonsPerLength
private

histogram of photons per cm

Definition at line 65 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

TH1F* larg4::IonizationAndScintillation::fPhotonsPerStep {nullptr}
private

histogram of the photons per step

Definition at line 62 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

G4Step const* larg4::IonizationAndScintillation::fStep {nullptr}
private

pointer to the current G4 step

Definition at line 56 of file IonizationAndScintillation.h.

Referenced by Reset().

int larg4::IonizationAndScintillation::fStepNumber {-1}
private

last StepNumber checked

Definition at line 57 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

TH1F* larg4::IonizationAndScintillation::fStepSize {nullptr}
private

histogram of the step sizes

Definition at line 61 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().

int larg4::IonizationAndScintillation::fTrkID {-1}
private

last TrkID checked

Definition at line 58 of file IonizationAndScintillation.h.

Referenced by IonizationAndScintillation(), and Reset().


The documentation for this class was generated from the following files: