LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CalorimetryAlg.h
Go to the documentation of this file.
1 // \file CalorimetryAlg.h
3 //
4 // \brief Functions to calculate dE/dx. Based on code in Calorimetry.cxx
5 //
6 // \author andrzej.szelc@yale.edu
7 //
9 #ifndef UTIL_CALORIMETRYALG_H
10 #define UTIL_CALORIMETRYALG_H
11 
12 #include "fhiclcpp/types/Atom.h"
15 #include "fhiclcpp/types/Table.h"
16 
21 
22 #include "TF1.h"
23 
24 #include <vector>
25 
26 namespace detinfo {
27  class DetectorClocksData;
28  class DetectorPropertiesData;
29 }
30 
31 namespace recob {
32  class Hit;
33 }
34 
36 namespace calo {
38  public:
39  struct Config {
40  using Name = fhicl::Name;
42 
43  fhicl::Sequence<double> CalAmpConstants{
44  Name("CalAmpConstants"),
45  Comment("ADC to electrons constants for each plane.")};
46 
47  fhicl::Sequence<double> CalAreaConstants{
48  Name("CalAreaConstants"),
49  Comment("Area to electrons constants for each plane.")};
50 
51  fhicl::Atom<bool> CaloUseModBox{Name("CaloUseModBox"),
52  Comment("Use modified box model if true, birks otherwise")};
53 
54  fhicl::Atom<int> CaloLifeTimeForm{Name("CaloLifeTimeForm"),
55  Comment("0 = exponential, 1 = exponential + constant")};
56 
57  fhicl::Atom<bool> CaloDoLifeTimeCorrection{Name("CaloDoLifeTimeCorrection"),
58  Comment("Apply lifetime correction if true")};
59 
60  fhicl::Atom<double> ModBoxA{Name("ModBoxA"),
61  Comment("Alpha value in modified box recombination."),
63 
65  Name("ModBoxBTF1"),
66  Comment(
67  "String compiled into a TF1. Should return the Mod-Box beta value as a function of phi."),
68  "[0]"};
69 
71  Name("ModBoxBParam"),
72  Comment("Parameters for the ModBoxBTF1 function.")};
73 
74  fhicl::Atom<double> BirksA{Name("BirksA"),
75  Comment("Alpha value in modified box recombination."),
77 
79  Name("BirksKTF1"),
80  Comment(
81  "String compiled into a TF1. Should return the Birks k value as a function of phi."),
82  "[0]"};
83 
85  Name("BirksKParam"),
86  Comment("Parameters for the BirksKTF1 function. List of doubles.")};
87  };
88 
90  : CalorimetryAlg(fhicl::Table<Config>(pset, {})())
91  {}
92 
93  CalorimetryAlg(const Config& config);
94 
95  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
96  detinfo::DetectorPropertiesData const& det_prop,
97  recob::Hit const& hit,
98  double pitch,
99  double T0 = 0) const;
100  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
101  detinfo::DetectorPropertiesData const& det_prop,
102  double dQdx,
103  double time,
104  unsigned int plane,
105  double T0 = 0) const;
106  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
107  detinfo::DetectorPropertiesData const& det_prop,
108  recob::Hit const& hit,
109  double pitch,
110  double T0,
111  double EField,
112  double phi = 90) const;
113  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
114  detinfo::DetectorPropertiesData const& det_prop,
115  double dQdx,
116  double time,
117  unsigned int plane,
118  double T0,
119  double EField,
120  double phi = 90) const;
121 
122  // FIXME: How may of these are actually used?
123  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
124  detinfo::DetectorPropertiesData const& det_prop,
125  recob::Hit const& hit,
126  double pitch,
127  double T0 = 0) const;
128  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
129  detinfo::DetectorPropertiesData const& det_prop,
130  double dQdx,
131  double time,
132  unsigned int plane,
133  double T0 = 0) const;
134  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
135  detinfo::DetectorPropertiesData const& det_prop,
136  recob::Hit const& hit,
137  double pitch,
138  double T0,
139  double EField,
140  double phi = 90) const;
141  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
142  detinfo::DetectorPropertiesData const& det_prop,
143  double dQdx,
144  double time,
145  unsigned int plane,
146  double T0,
147  double EField,
148  double phi = 90) const;
149 
150  double ElectronsFromADCPeak(double adc, unsigned short plane) const
151  {
152  return adc / fCalAmpConstants[plane];
153  }
154 
155  double ElectronsFromADCArea(double area, unsigned short plane) const
156  {
157  return area / fCalAreaConstants[plane];
158  }
159 
160  double LifetimeCorrection(detinfo::DetectorClocksData const& clock_data,
161  detinfo::DetectorPropertiesData const& det_prop,
162  double time,
163  double T0 = 0) const;
164 
165  // Recombination corrections
166  double BirksCorrection(double dQdx, double phi, double rho, double E_field) const;
167  double ModBoxCorrection(double dQdx, double phi, double rho, double E_field) const;
168 
169  private:
171 
172  double dEdx_from_dQdx_e(detinfo::DetectorClocksData const& clock_data,
173  detinfo::DetectorPropertiesData const& det_prop,
174  double dQdx_e,
175  double time,
176  double T0 = 0) const;
177  double dEdx_from_dQdx_e(detinfo::DetectorClocksData const& clock_data,
178  detinfo::DetectorPropertiesData const& det_prop,
179  double dQdx_e,
180  double time,
181  double T0,
182  double EField,
183  double phi = 90) const;
184 
185  std::vector<double> const fCalAmpConstants;
186  std::vector<double> const fCalAreaConstants;
187  bool const fUseModBox;
188  int const fLifeTimeForm;
190 
191  // Recombination parameters
192  double fModBoxA; // Mod-Box alpha
193  TF1 fModBoxBF; // Function of phi to get the Mod-Box beta value
194  double fBirksA; // Birks A cosntant
195  TF1 fBirksKF; // Function of phi to get the Birks-k value
196 
197  }; // class CalorimetryAlg
198 } // namespace calo
199 #endif // UTIL_CALORIMETRYALG_H
std::vector< double > const fCalAreaConstants
Reconstruction base classes.
Declaration of signal hit object.
double ElectronsFromADCArea(double area, unsigned short plane) const
double ElectronsFromADCPeak(double adc, unsigned short plane) const
art::ServiceHandle< geo::Geometry const > geom
parameter set interface
bool const fDoLifeTimeCorrection
General LArSoft Utilities.
std::vector< double > const fCalAmpConstants
Detector simulation of raw signals on wires.
CalorimetryAlg(const fhicl::ParameterSet &pset)
Contains all timing reference information for the detector.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
constexpr double kRecombA
A constant.
constexpr double kModBoxA
Modified Box Alpha.
Collection of Physical constants used in LArSoft.
art framework interface to geometry description
calorimetry
map< int, array< map< int, double >, 2 >> Table
Definition: plot.C:18