All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ISCalcSeparate.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // 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
11 ////////////////////////////////////////////////////////////////////////
12 
14 
21 
22 #include "art/Framework/Services/Registry/ServiceHandle.h"
23 #include "messagefacility/MessageLogger/MessageLogger.h"
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.
37  art::ServiceHandle<sim::LArG4Parameters const> LArG4PropHandle;
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
48  double
50  sim::SimEnergyDeposit const& edep)
51  {
52  float e = edep.Energy();
53  float ds = edep.StepLength();
54 
55  double recomb = 0.;
56  double dEdx = (ds <= 0.0) ? 0.0 : e / ds;
57  double EFieldStep = EFieldAtStep(detProp.Efield(), edep);
58 
59  // Guard against spurious values of dE/dx. Note: assumes density of LAr
60  if (dEdx < 1.) { dEdx = 1.; }
61 
62  if (fUseModBoxRecomb) {
63  if (ds > 0) {
64  double const scaled_modboxb = fModBoxB / detProp.Density(detProp.Temperature());
65  double const Xi = scaled_modboxb * dEdx / EFieldStep;
66  recomb = log(fModBoxA + Xi) / Xi;
67  }
68  else {
69  recomb = 0;
70  }
71  }
72  else {
73  double const scaled_recombk = fRecombk / detProp.Density(detProp.Temperature());
74  recomb = fRecombA / (1. + dEdx * scaled_recombk / EFieldStep);
75  }
76 
77  // 1.e-3 converts fEnergyDeposit to GeV
78  auto const numIonElectrons = fGeVToElectrons * 1.e-3 * e * recomb;
79 
80  MF_LOG_DEBUG("ISCalcSeparate")
81  << " Electrons produced for " << edep.Energy() << " MeV deposited with " << recomb
82  << " recombination: " << numIonElectrons << std::endl;
83  return numIonElectrons;
84  }
85 
86  //----------------------------------------------------------------------------
87  std::pair<double, double>
89  {
90  double numScintPhotons = GetScintYield(edep, true) * edep.Energy();
91  return {numScintPhotons, GetScintYieldRatio(edep)};
92  }
93 
94  //----------------------------------------------------------------------------
97  sim::SimEnergyDeposit const& edep)
98  {
99  auto const numElectrons = CalcIon(detProp, edep);
100  auto const [numPhotons, scintYieldRatio] = CalcScint(edep);
101  return {edep.Energy(), numElectrons, numPhotons, scintYieldRatio};
102  }
103  //----------------------------------------------------------------------------
104  double
106  {
107  if (not fSCE->EnableSimEfieldSCE()) { return efield; }
108 
109  auto const eFieldOffsets = fSCE->GetEfieldOffsets(edep.MidPoint());
110  return std::hypot(
111  efield + efield * eFieldOffsets.X(), efield * eFieldOffsets.Y(), efield * eFieldOffsets.Z());
112  }
113 
114 } // namespace
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
static constexpr bool
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)
virtual geo::Vector_t GetEfieldOffsets(geo::Point_t const &point) const =0
double fRecombA
from LArG4Parameters service
geo::Point_t MidPoint() const
double Density(double temperature=0.) const
Returns argon density at a given temperature.
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2687
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.
double fGeVToElectrons
from LArG4Parameters service
do i e
double fModBoxB
from LArG4Parameters service
double GetScintYield(sim::SimEnergyDeposit const &edep, bool prescale)
Definition: ISCalc.cxx:26
double Energy() const
double GetScintYieldRatio(sim::SimEnergyDeposit const &edep)
Definition: ISCalc.cxx:47
virtual bool EnableSimEfieldSCE() const =0
auto const detProp
bool fUseModBoxRecomb
from LArG4Parameters service