LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ISCalcSeparate.cxx
Go to the documentation of this file.
1 // Class: ISCalcSeparate
3 // Plugin Type: algorithm
4 // File: ISCalcSeparate.h and ISCalcSeparate.cxx
5 // Description:
6 // Interface to algorithm class for a specific calculation of ionization electrons and scintillation photons
7 // assuming there is no correlation between the two
8 // Input: 'sim::SimEnergyDeposit'
9 // Output: num of Photons and Electrons
10 // Sept.16 by Mu Wei
12 
14 
21 
24 
25 #include <numeric>
26 
27 namespace larg4 {
28  //----------------------------------------------------------------------------
30  {
31  fSCE = lar::providerFrom<spacecharge::SpaceChargeService>();
32 
33  // the recombination coefficient is in g/(MeVcm^2), but we report
34  // energy depositions in MeV/cm, need to divide Recombk from the
35  // LArG4Parameters service by the density of the argon we got
36  // above; this is done in 'CalcIon' function below.
38  fRecombA = LArG4PropHandle->RecombA();
39  fRecombk = LArG4PropHandle->Recombk();
40  fModBoxA = LArG4PropHandle->ModBoxA();
41  fModBoxB = LArG4PropHandle->ModBoxB();
42  fUseModBoxRecomb = (bool)LArG4PropHandle->UseModBoxRecomb();
43  fGeVToElectrons = LArG4PropHandle->GeVToElectrons();
44  }
45 
46  //----------------------------------------------------------------------------
47  // fNumIonElectrons returns a value that is not corrected for life time effects
50  {
51  float e = edep.Energy();
52  float ds = edep.StepLength();
53 
54  double recomb = 0.;
55  double dEdx = (ds <= 0.0) ? 0.0 : e / ds;
56  double EFieldStep = EFieldAtStep(detProp.Efield(), edep);
57 
58  // Guard against spurious values of dE/dx. Note: assumes density of LAr
59  if (dEdx < 1.) { dEdx = 1.; }
60 
61  if (fUseModBoxRecomb) {
62  if (ds > 0) {
63  double const scaled_modboxb = fModBoxB / detProp.Density(detProp.Temperature());
64  double const Xi = scaled_modboxb * dEdx / EFieldStep;
65  recomb = log(fModBoxA + Xi) / Xi;
66  }
67  else {
68  recomb = 0;
69  }
70  }
71  else {
72  double const scaled_recombk = fRecombk / detProp.Density(detProp.Temperature());
73  recomb = fRecombA / (1. + dEdx * scaled_recombk / EFieldStep);
74  }
75 
76  // 1.e-3 converts fEnergyDeposit to GeV
77  auto const numIonElectrons = fGeVToElectrons * 1.e-3 * e * recomb;
78 
79  MF_LOG_DEBUG("ISCalcSeparate")
80  << " Electrons produced for " << edep.Energy() << " MeV deposited with " << recomb
81  << " recombination: " << numIonElectrons << std::endl;
82  return numIonElectrons;
83  }
84 
85  //----------------------------------------------------------------------------
86  std::pair<double, double> ISCalcSeparate::CalcScint(sim::SimEnergyDeposit const& edep)
87  {
88  double numScintPhotons = GetScintYield(edep, true) * edep.Energy();
89  return {numScintPhotons, GetScintYieldRatio(edep)};
90  }
91 
92  //----------------------------------------------------------------------------
95  {
96  auto const numElectrons = CalcIon(detProp, edep);
97  auto const [numPhotons, scintYieldRatio] = CalcScint(edep);
98  return {edep.Energy(), numElectrons, numPhotons, scintYieldRatio};
99  }
100  //----------------------------------------------------------------------------
102  {
103  if (not fSCE->EnableSimEfieldSCE()) { return efield; }
104 
105  auto const eFieldOffsets = fSCE->GetEfieldOffsets(edep.MidPoint());
106  return std::hypot(
107  efield + efield * eFieldOffsets.X(), efield * eFieldOffsets.Y(), efield * eFieldOffsets.Z());
108  }
109 
110 } // namespace
virtual bool EnableSimEfieldSCE() const =0
Store parameters for running LArG4.
geo::Length_t StepLength() const
Utilities related to art service access.
std::pair< double, double > CalcScint(sim::SimEnergyDeposit const &edep)
double Temperature() const
In kelvin.
double fModBoxA
from LArG4Parameters service
Geant4 interface.
ISCalcData CalcIonAndScint(detinfo::DetectorPropertiesData const &detProp, sim::SimEnergyDeposit const &edep) override
double fRecombk
from LArG4Parameters service
double Efield(unsigned int planegap=0) const
kV/cm
double CalcIon(detinfo::DetectorPropertiesData const &detProp, sim::SimEnergyDeposit const &edep)
double fRecombA
from LArG4Parameters service
geo::Point_t MidPoint() const
double Density(double temperature=0.) const
Returns argon density at a given temperature.
Double_t edep
Definition: macro.C:13
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2675
virtual geo::Vector_t GetEfieldOffsets(geo::Point_t const &point) const =0
double EFieldAtStep(double efield, sim::SimEnergyDeposit const &edep) override
const spacecharge::SpaceCharge * fSCE
contains information for a single step in the detector simulation
Energy deposition in the active material.
#define MF_LOG_DEBUG(id)
double fGeVToElectrons
from LArG4Parameters service
double fModBoxB
from LArG4Parameters service
double GetScintYield(sim::SimEnergyDeposit const &edep, bool prescale)
Definition: ISCalc.cxx:21
double Energy() const
Float_t e
Definition: plot.C:35
double GetScintYieldRatio(sim::SimEnergyDeposit const &edep)
Definition: ISCalc.cxx:41
bool fUseModBoxRecomb
from LArG4Parameters service