Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 53 of file IonizationAndScintillation.cxx.

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

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 43 of file IonizationAndScintillation.h.

44  {
45  return fISCalc->EnergyDeposit();
46  }
std::unique_ptr< larg4::ISCalculation > fISCalc
IonizationAndScintillation * larg4::IonizationAndScintillation::Instance ( void  )
static

Definition at line 44 of file IonizationAndScintillation.cxx.

45  {
46  // the instance must have been created already by CreateInstance()
47  assert(gInstance);
48  return gInstance;
49  }
static IonizationAndScintillation * gInstance
double larg4::IonizationAndScintillation::NumberIonizationElectrons ( ) const
inline

Definition at line 53 of file IonizationAndScintillation.h.

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

Definition at line 58 of file IonizationAndScintillation.h.

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

Definition at line 98 of file IonizationAndScintillation.cxx.

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

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

Definition at line 48 of file IonizationAndScintillation.h.

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

Member Data Documentation

TH1F* larg4::IonizationAndScintillation::fElectronsPerEDep
private

histogram of electrons per MeV deposited

Definition at line 86 of file IonizationAndScintillation.h.

TH1F* larg4::IonizationAndScintillation::fElectronsPerLength
private

histogram of electrons per cm

Definition at line 84 of file IonizationAndScintillation.h.

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

histogram of electrons per step

Definition at line 80 of file IonizationAndScintillation.h.

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

histogram of electrons vs photons per step

Definition at line 88 of file IonizationAndScintillation.h.

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

histogram of the energy deposited per step

Definition at line 83 of file IonizationAndScintillation.h.

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

random engine (needed for NEST)

Definition at line 89 of file IonizationAndScintillation.h.

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

object to calculate ionization and scintillation produced by an energy deposition

Definition at line 73 of file IonizationAndScintillation.h.

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

name of calculator to use, NEST or Separate

Definition at line 75 of file IonizationAndScintillation.h.

TH1F* larg4::IonizationAndScintillation::fPhotonsPerEDep
private

histogram of photons per MeV deposited

Definition at line 87 of file IonizationAndScintillation.h.

TH1F* larg4::IonizationAndScintillation::fPhotonsPerLength
private

histogram of photons per cm

Definition at line 85 of file IonizationAndScintillation.h.

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

histogram of the photons per step

Definition at line 82 of file IonizationAndScintillation.h.

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

pointer to the current G4 step

Definition at line 76 of file IonizationAndScintillation.h.

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

last StepNumber checked

Definition at line 77 of file IonizationAndScintillation.h.

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

histogram of the step sizes

Definition at line 81 of file IonizationAndScintillation.h.

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

last TrkID checked

Definition at line 78 of file IonizationAndScintillation.h.


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