LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
calo::CalorimetryAlg Class Reference

#include "CalorimetryAlg.h"

Classes

struct  Config
 

Public Member Functions

 CalorimetryAlg (const fhicl::ParameterSet &pset)
 
 CalorimetryAlg (const Config &config)
 
double dEdx_AMP (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
 
double dEdx_AMP (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx, double time, unsigned int plane, double T0=0) const
 
double dEdx_AMP (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0, double EField, double phi=90) const
 
double dEdx_AMP (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx, double time, unsigned int plane, double T0, double EField, double phi=90) const
 
double dEdx_AREA (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
 
double dEdx_AREA (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx, double time, unsigned int plane, double T0=0) const
 
double dEdx_AREA (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0, double EField, double phi=90) const
 
double dEdx_AREA (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx, double time, unsigned int plane, double T0, double EField, double phi=90) const
 
double ElectronsFromADCPeak (double adc, unsigned short plane) const
 
double ElectronsFromADCArea (double area, unsigned short plane) const
 
double LifetimeCorrection (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
 
double BirksCorrection (double dQdx, double phi, double rho, double E_field) const
 
double ModBoxCorrection (double dQdx, double phi, double rho, double E_field) const
 

Private Member Functions

double dEdx_from_dQdx_e (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx_e, double time, double T0=0) const
 
double dEdx_from_dQdx_e (detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx_e, double time, double T0, double EField, double phi=90) const
 

Private Attributes

art::ServiceHandle< geo::Geometry const > geom
 
std::vector< double > const fCalAmpConstants
 
std::vector< double > const fCalAreaConstants
 
bool const fUseModBox
 
int const fLifeTimeForm
 
bool const fDoLifeTimeCorrection
 
double fModBoxA
 
TF1 fModBoxBF
 
double fBirksA
 
TF1 fBirksKF
 

Detailed Description

Definition at line 37 of file CalorimetryAlg.h.

Constructor & Destructor Documentation

calo::CalorimetryAlg::CalorimetryAlg ( const fhicl::ParameterSet pset)
inline

Definition at line 89 of file CalorimetryAlg.h.

91  {}
CalorimetryAlg(const fhicl::ParameterSet &pset)
calo::CalorimetryAlg::CalorimetryAlg ( const Config config)

Definition at line 23 of file CalorimetryAlg.cxx.

References calo::CalorimetryAlg::Config::CalAmpConstants, fBirksA, fBirksKF, fCalAreaConstants, fDoLifeTimeCorrection, fLifeTimeForm, fModBoxA, fModBoxBF, fUseModBox, util::kModBoxB, and util::kRecombk.

24  : fCalAmpConstants{config.CalAmpConstants()}
25  , fCalAreaConstants{config.CalAreaConstants()}
26  , fUseModBox{config.CaloUseModBox()}
27  , fLifeTimeForm{config.CaloLifeTimeForm()}
28  , fDoLifeTimeCorrection{config.CaloDoLifeTimeCorrection()}
29  , fModBoxA{config.ModBoxA()}
30  , fModBoxBF("ModBoxB", config.ModBoxBTF1().c_str(), 0, 90)
31  , fBirksA{config.BirksA()}
32  , fBirksKF("BirksK", config.BirksKTF1().c_str(), 0, 90)
33  {
34  if (fLifeTimeForm != 0 and fLifeTimeForm != 1) {
35  throw cet::exception("CalorimetryAlg")
36  << "Unknow CaloLifeTimeForm " << fLifeTimeForm << '\n'
37  << "Must select either '0' for exponential or '1' for exponential + "
38  "constant.\n";
39  }
40 
41  // Set the parameters for the TF1s
42  std::vector<double> modboxb_param;
43  if (!config.ModBoxBParam(modboxb_param)) modboxb_param = {util::kModBoxB};
44 
45  for (unsigned i = 0; i < modboxb_param.size(); i++) {
46  fModBoxBF.SetParameter(i, modboxb_param[i]);
47  }
48 
49  std::vector<double> birksk_param;
50  if (!config.BirksKParam(birksk_param)) birksk_param = {util::kRecombk};
51 
52  for (unsigned i = 0; i < birksk_param.size(); i++) {
53  fBirksKF.SetParameter(i, birksk_param[i]);
54  }
55  }
std::vector< double > const fCalAreaConstants
constexpr double kModBoxB
Modified Box Beta in g/(MeV cm²)*kV/cm.
bool const fDoLifeTimeCorrection
std::vector< double > const fCalAmpConstants
constexpr double kRecombk
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Function Documentation

double calo::CalorimetryAlg::BirksCorrection ( double  dQdx,
double  phi,
double  rho,
double  E_field 
) const

Definition at line 262 of file CalorimetryAlg.cxx.

References tca::dEdx(), fBirksA, fBirksKF, and util::kGeVToElectrons.

Referenced by dEdx_from_dQdx_e().

266  {
267  // from: S.Amoruso et al., NIM A 523 (2004) 275
268 
269  double A = fBirksA;
270  double K = fBirksKF.Eval(phi); // in KV/cm*(g/cm^2)/MeV
271  constexpr double Wion = 1000. / util::kGeVToElectrons; // 23.6 eV = 1e, Wion in MeV/e
272  K /= rho; // KV/MeV
273  double const dEdx = dQdx / (A / Wion - K / E_field * dQdx); // MeV/cm
274 
275  return dEdx;
276  }
constexpr double kGeVToElectrons
23.6eV per ion pair, 1e9 eV/GeV
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2675
double calo::CalorimetryAlg::dEdx_AMP ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
recob::Hit const &  hit,
double  pitch,
double  T0 = 0 
) const

Definition at line 60 of file CalorimetryAlg.cxx.

References detinfo::DetectorPropertiesData::Efield(), recob::Hit::PeakAmplitude(), recob::Hit::PeakTime(), geo::PlaneID::Plane, and recob::Hit::WireID().

Referenced by dEdx_AMP(), shwf::ShowerReco::LongTransEnergy(), calo::Calorimetry::produce(), calo::GnocchiCalorimetry::produce(), and showerreco::ShowerRecoAlg::RecoOneShower().

65  {
66  return dEdx_AMP(clock_data,
67  det_prop,
68  hit.PeakAmplitude() / pitch,
69  hit.PeakTime(),
70  hit.WireID().Plane,
71  T0,
72  det_prop.Efield());
73  }
double dEdx_AMP(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
Detector simulation of raw signals on wires.
double calo::CalorimetryAlg::dEdx_AMP ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
double  dQdx,
double  time,
unsigned int  plane,
double  T0 = 0 
) const

Definition at line 76 of file CalorimetryAlg.cxx.

References dEdx_from_dQdx_e(), detinfo::DetectorPropertiesData::Efield(), and fCalAmpConstants.

82  {
83  double const fADCtoEl = fCalAmpConstants[plane];
84  double const dQdx_e = dQdx / fADCtoEl; // Conversion from ADC/cm to e/cm
85  return dEdx_from_dQdx_e(clock_data, det_prop, dQdx_e, time, T0, det_prop.Efield());
86  }
std::vector< double > const fCalAmpConstants
double dEdx_from_dQdx_e(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx_e, double time, double T0=0) const
double calo::CalorimetryAlg::dEdx_AMP ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
recob::Hit const &  hit,
double  pitch,
double  T0,
double  EField,
double  phi = 90 
) const

Definition at line 91 of file CalorimetryAlg.cxx.

References dEdx_AMP(), recob::Hit::PeakAmplitude(), recob::Hit::PeakTime(), geo::PlaneID::Plane, and recob::Hit::WireID().

98  {
99  return dEdx_AMP(clock_data,
100  det_prop,
101  hit.PeakAmplitude() / pitch,
102  hit.PeakTime(),
103  hit.WireID().Plane,
104  T0,
105  EField,
106  phi);
107  }
double dEdx_AMP(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
Detector simulation of raw signals on wires.
double calo::CalorimetryAlg::dEdx_AMP ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
double  dQdx,
double  time,
unsigned int  plane,
double  T0,
double  EField,
double  phi = 90 
) const

Definition at line 110 of file CalorimetryAlg.cxx.

References dEdx_from_dQdx_e(), and fCalAmpConstants.

118  {
119  double const fADCtoEl = fCalAmpConstants[plane];
120  double const dQdx_e = dQdx / fADCtoEl; // Conversion from ADC/cm to e/cm
121  return dEdx_from_dQdx_e(clock_data, det_prop, dQdx_e, time, T0, EField, phi);
122  }
std::vector< double > const fCalAmpConstants
double dEdx_from_dQdx_e(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx_e, double time, double T0=0) const
double calo::CalorimetryAlg::dEdx_AREA ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
recob::Hit const &  hit,
double  pitch,
double  T0 = 0 
) const

Definition at line 127 of file CalorimetryAlg.cxx.

References detinfo::DetectorPropertiesData::Efield(), recob::Hit::Integral(), recob::Hit::PeakTime(), geo::PlaneID::Plane, and recob::Hit::WireID().

Referenced by calo::TrackCalorimetryAlg::AnalyzeHit(), mvapid::MVAAlg::CalcSegmentdEdxDist(), ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), ShowerRecoTools::ShowerTrajPointdEdx::CalculateElement(), ems::EMShower3D::ConvertFrom(), ems::EMShower3D::ConvertFrom2(), tca::dEdx(), dEdx_AREA(), shower::EMShowerAlg::FinddEdx_(), shwf::ShowerReco::LongTransEnergy(), shower::EMShowerAlg::MakeShower(), calo::ShowerCalorimetry::produce(), calo::Calorimetry::produce(), calo::GnocchiCalorimetry::produce(), and showerreco::ShowerRecoAlg::RecoOneShower().

132  {
133  return dEdx_AREA(clock_data,
134  det_prop,
135  hit.Integral() / pitch,
136  hit.PeakTime(),
137  hit.WireID().Plane,
138  T0,
139  det_prop.Efield());
140  }
Detector simulation of raw signals on wires.
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
double calo::CalorimetryAlg::dEdx_AREA ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
double  dQdx,
double  time,
unsigned int  plane,
double  T0 = 0 
) const

Definition at line 143 of file CalorimetryAlg.cxx.

References dEdx_from_dQdx_e(), detinfo::DetectorPropertiesData::Efield(), and fCalAreaConstants.

149  {
150  double const fADCtoEl = fCalAreaConstants[plane];
151  double const dQdx_e = dQdx / fADCtoEl; // Conversion from ADC/cm to e/cm
152  return dEdx_from_dQdx_e(clock_data, det_prop, dQdx_e, time, T0, det_prop.Efield());
153  }
std::vector< double > const fCalAreaConstants
double dEdx_from_dQdx_e(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx_e, double time, double T0=0) const
double calo::CalorimetryAlg::dEdx_AREA ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
recob::Hit const &  hit,
double  pitch,
double  T0,
double  EField,
double  phi = 90 
) const

Definition at line 158 of file CalorimetryAlg.cxx.

References dEdx_AREA(), recob::Hit::Integral(), recob::Hit::PeakTime(), geo::PlaneID::Plane, and recob::Hit::WireID().

165  {
166  return dEdx_AREA(clock_data,
167  det_prop,
168  hit.Integral() / pitch,
169  hit.PeakTime(),
170  hit.WireID().Plane,
171  T0,
172  EField,
173  phi);
174  }
Detector simulation of raw signals on wires.
double dEdx_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
double calo::CalorimetryAlg::dEdx_AREA ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
double  dQdx,
double  time,
unsigned int  plane,
double  T0,
double  EField,
double  phi = 90 
) const

Definition at line 177 of file CalorimetryAlg.cxx.

References dEdx_from_dQdx_e(), and fCalAreaConstants.

185  {
186  double const fADCtoEl = fCalAreaConstants[plane];
187  double const dQdx_e = dQdx / fADCtoEl; // Conversion from ADC/cm to e/cm
188  return dEdx_from_dQdx_e(clock_data, det_prop, dQdx_e, time, T0, EField, phi);
189  }
std::vector< double > const fCalAreaConstants
double dEdx_from_dQdx_e(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx_e, double time, double T0=0) const
double calo::CalorimetryAlg::dEdx_from_dQdx_e ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
double  dQdx_e,
double  time,
double  T0 = 0 
) const
private

Definition at line 192 of file CalorimetryAlg.cxx.

References detinfo::DetectorPropertiesData::Efield().

Referenced by dEdx_AMP(), and dEdx_AREA().

197  {
198  return dEdx_from_dQdx_e(clock_data, det_prop, dQdx_e, time, T0, det_prop.Efield());
199  }
double dEdx_from_dQdx_e(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double dQdx_e, double time, double T0=0) const
double calo::CalorimetryAlg::dEdx_from_dQdx_e ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
double  dQdx_e,
double  time,
double  T0,
double  EField,
double  phi = 90 
) const
private

Definition at line 200 of file CalorimetryAlg.cxx.

References BirksCorrection(), detinfo::DetectorPropertiesData::Density(), fDoLifeTimeCorrection, fUseModBox, LifetimeCorrection(), and ModBoxCorrection().

207  {
208  if (fDoLifeTimeCorrection) {
209  dQdx_e *= LifetimeCorrection(clock_data, det_prop, time, T0); // (dQdx_e in e/cm)
210  }
211 
212  if (fUseModBox) { return ModBoxCorrection(dQdx_e, phi, det_prop.Density(), EField); }
213 
214  return BirksCorrection(dQdx_e, phi, det_prop.Density(), EField);
215  }
bool const fDoLifeTimeCorrection
double BirksCorrection(double dQdx, double phi, double rho, double E_field) const
double ModBoxCorrection(double dQdx, double phi, double rho, double E_field) const
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
double calo::CalorimetryAlg::ElectronsFromADCArea ( double  area,
unsigned short  plane 
) const
inline

Definition at line 155 of file CalorimetryAlg.h.

Referenced by ShowerRecoTools::ShowerNumElectronsEnergy::CalculateEnergy(), and showerreco::ShowerRecoAlg::RecoOneShower().

156  {
157  return area / fCalAreaConstants[plane];
158  }
std::vector< double > const fCalAreaConstants
double calo::CalorimetryAlg::ElectronsFromADCPeak ( double  adc,
unsigned short  plane 
) const
inline

Definition at line 150 of file CalorimetryAlg.h.

Referenced by img::DataProviderAlg::DataProviderAlg(), and showerreco::ShowerRecoAlg::RecoOneShower().

151  {
152  return adc / fCalAmpConstants[plane];
153  }
std::vector< double > const fCalAmpConstants
double calo::CalorimetryAlg::LifetimeCorrection ( detinfo::DetectorClocksData const &  clock_data,
detinfo::DetectorPropertiesData const &  det_prop,
double  time,
double  T0 = 0 
) const

Definition at line 221 of file CalorimetryAlg.cxx.

References e, detinfo::DetectorPropertiesData::ElectronLifetime(), fLifeTimeForm, detinfo::sampling_rate(), and detinfo::trigger_offset().

Referenced by ShowerRecoTools::ShowerNumElectronsEnergy::CalculateEnergy(), nnet::PointIdEffTest::countPfpDep(), dEdx_from_dQdx_e(), shower::TCShowerElectronLikelihood::getShowerProfile(), showerreco::ShowerRecoAlg::RecoOneShower(), img::DataProviderAlg::resizeView(), shower::TCShowerTemplateMaker::showerProfile(), and nnet::PointIdEffTest::testCNN().

225  {
226  float const t = time - trigger_offset(clock_data);
227  double const timetick = sampling_rate(clock_data) * 1.e-3; // time sample in microsec
228  double const adjusted_time = t * timetick - T0 * 1e-3; // (in microsec)
229 
230  assert(fLifeTimeForm < 2);
231  if (fLifeTimeForm == 0) {
232  // Exponential form
233  double const tau = det_prop.ElectronLifetime();
234  return exp(adjusted_time / tau);
235  }
236 
237  // Exponential+constant form
238  auto const& elifetime_provider =
240  return elifetime_provider.Lifetime(adjusted_time);
241  }
int trigger_offset(DetectorClocksData const &data)
Float_t e
Definition: plot.C:35
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
double calo::CalorimetryAlg::ModBoxCorrection ( double  dQdx,
double  phi,
double  rho,
double  E_field 
) const

Definition at line 247 of file CalorimetryAlg.cxx.

References tca::dEdx(), fModBoxA, fModBoxBF, and util::kGeVToElectrons.

Referenced by dEdx_from_dQdx_e().

251  {
252  // Modified Box model correction has better behavior than the Birks
253  // correction at high values of dQ/dx.
254  constexpr double Wion = 1000. / util::kGeVToElectrons; // 23.6 eV = 1e, Wion in MeV/e
255  double const Beta = fModBoxBF.Eval(phi) / (rho * E_field);
256  double const Alpha = fModBoxA;
257  double const dEdx = (exp(Beta * Wion * dQdx) - Alpha) / Beta;
258 
259  return dEdx;
260  }
constexpr double kGeVToElectrons
23.6eV per ion pair, 1e9 eV/GeV
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
Definition: PFPUtils.cxx:2675

Member Data Documentation

double calo::CalorimetryAlg::fBirksA
private

Definition at line 194 of file CalorimetryAlg.h.

Referenced by BirksCorrection(), and CalorimetryAlg().

TF1 calo::CalorimetryAlg::fBirksKF
private

Definition at line 195 of file CalorimetryAlg.h.

Referenced by BirksCorrection(), and CalorimetryAlg().

std::vector<double> const calo::CalorimetryAlg::fCalAmpConstants
private

Definition at line 185 of file CalorimetryAlg.h.

Referenced by dEdx_AMP().

std::vector<double> const calo::CalorimetryAlg::fCalAreaConstants
private

Definition at line 186 of file CalorimetryAlg.h.

Referenced by CalorimetryAlg(), and dEdx_AREA().

bool const calo::CalorimetryAlg::fDoLifeTimeCorrection
private

Definition at line 189 of file CalorimetryAlg.h.

Referenced by CalorimetryAlg(), and dEdx_from_dQdx_e().

int const calo::CalorimetryAlg::fLifeTimeForm
private

Definition at line 188 of file CalorimetryAlg.h.

Referenced by CalorimetryAlg(), and LifetimeCorrection().

double calo::CalorimetryAlg::fModBoxA
private

Definition at line 192 of file CalorimetryAlg.h.

Referenced by CalorimetryAlg(), and ModBoxCorrection().

TF1 calo::CalorimetryAlg::fModBoxBF
private

Definition at line 193 of file CalorimetryAlg.h.

Referenced by CalorimetryAlg(), and ModBoxCorrection().

bool const calo::CalorimetryAlg::fUseModBox
private

Definition at line 187 of file CalorimetryAlg.h.

Referenced by CalorimetryAlg(), and dEdx_from_dQdx_e().

art::ServiceHandle<geo::Geometry const> calo::CalorimetryAlg::geom
private

Definition at line 170 of file CalorimetryAlg.h.


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