CalorimetryAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \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 //
8 ////////////////////////////////////////////////////////////////////////
9 #ifndef UTIL_CALORIMETRYALG_H
10 #define UTIL_CALORIMETRYALG_H
11 
12 #include "fhiclcpp/types/Atom.h"
14 #include "fhiclcpp/types/Table.h"
15 
19 
20 #include <vector>
21 
22 namespace detinfo {
23  class DetectorClocksData;
24  class DetectorPropertiesData;
25 }
26 
27 namespace recob {
28  class Hit;
29 }
30 
31 /// General LArSoft Utilities
32 namespace calo {
34  public:
35  struct Config {
36  using Name = fhicl::Name;
38 
39  fhicl::Sequence<double> CalAmpConstants{
40  Name("CalAmpConstants"),
41  Comment("ADC to electrons constants for each plane.")};
42 
43  fhicl::Sequence<double> CalAreaConstants{
44  Name("CalAreaConstants"),
45  Comment("Area to electrons constants for each plane.")};
46 
47  fhicl::Atom<bool> CaloUseModBox{Name("CaloUseModBox"),
48  Comment("Use modified box model if true, birks otherwise")};
49 
50  fhicl::Atom<int> CaloLifeTimeForm{Name("CaloLifeTimeForm"),
51  Comment("0 = exponential, 1 = exponential + constant")};
52 
53  fhicl::Atom<bool> CaloDoLifeTimeCorrection{Name("CaloDoLifeTimeCorrection"),
54  Comment("Apply lifetime correction if true")};
55  };
56 
58  : CalorimetryAlg(fhicl::Table<Config>(pset, {})())
59  {}
60 
62 
63  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
64  detinfo::DetectorPropertiesData const& det_prop,
65  recob::Hit const& hit,
66  double pitch,
67  double T0 = 0) const;
68  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
69  detinfo::DetectorPropertiesData const& det_prop,
70  double dQ,
71  double time,
72  double pitch,
73  unsigned int plane,
74  double T0 = 0) const;
75  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
76  detinfo::DetectorPropertiesData const& det_prop,
77  double dQdx,
78  double time,
79  unsigned int plane,
80  double T0 = 0) const;
81 
82  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
83  detinfo::DetectorPropertiesData const& det_prop,
84  recob::Hit const& hit,
85  double pitch,
86  double T0,
87  double EField) const;
88  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
89  detinfo::DetectorPropertiesData const& det_prop,
90  double dQ,
91  double time,
92  double pitch,
93  unsigned int plane,
94  double T0,
95  double EField) const;
96  double dEdx_AMP(detinfo::DetectorClocksData const& clock_data,
97  detinfo::DetectorPropertiesData const& det_prop,
98  double dQdx,
99  double time,
100  unsigned int plane,
101  double T0,
102  double EField) const;
103 
104  // FIXME: How may of these are actually used?
105  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
106  detinfo::DetectorPropertiesData const& det_prop,
107  recob::Hit const& hit,
108  double pitch,
109  double T0 = 0) const;
110  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
111  detinfo::DetectorPropertiesData const& det_prop,
112  double dQ,
113  double time,
114  double pitch,
115  unsigned int plane,
116  double T0 = 0) const;
117  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
118  detinfo::DetectorPropertiesData const& det_prop,
119  double dQdx,
120  double time,
121  unsigned int plane,
122  double T0 = 0) const;
123 
124  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
125  detinfo::DetectorPropertiesData const& det_prop,
126  recob::Hit const& hit,
127  double pitch,
128  double T0,
129  double EField) const;
130  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
131  detinfo::DetectorPropertiesData const& det_prop,
132  double dQ,
133  double time,
134  double pitch,
135  unsigned int plane,
136  double T0,
137  double EField) const;
138  double dEdx_AREA(detinfo::DetectorClocksData const& clock_data,
139  detinfo::DetectorPropertiesData const& det_prop,
140  double dQdx,
141  double time,
142  unsigned int plane,
143  double T0,
144  double EField) const;
145 
146  double
147  ElectronsFromADCPeak(double adc, unsigned short plane) const
148  {
149  return adc / fCalAmpConstants[plane];
150  }
151 
152  double
153  ElectronsFromADCArea(double area, unsigned short plane) const
154  {
155  return area / fCalAreaConstants[plane];
156  }
157 
158  double LifetimeCorrection(detinfo::DetectorClocksData const& clock_data,
159  detinfo::DetectorPropertiesData const& det_prop,
160  double time,
161  double T0 = 0) const;
162 
163  private:
165 
166  double dEdx_from_dQdx_e(detinfo::DetectorClocksData const& clock_data,
167  detinfo::DetectorPropertiesData const& det_prop,
168  double dQdx_e,
169  double time,
170  double T0 = 0) const;
171  double dEdx_from_dQdx_e(detinfo::DetectorClocksData const& clock_data,
172  detinfo::DetectorPropertiesData const& det_prop,
173  double dQdx_e,
174  double time,
175  double T0,
176  double EField) const;
177 
178  std::vector<double> const fCalAmpConstants;
179  std::vector<double> const fCalAreaConstants;
180  bool const fUseModBox;
181  int const fLifeTimeForm;
183 
184  }; // class CalorimetryAlg
185 } // namespace calo
186 #endif // UTIL_CALORIMETRYALG_H
std::vector< double > const fCalAreaConstants
Reconstruction base classes.
ChannelGroupService::Name Name
int16_t adc
Definition: CRTFragment.hh:202
art framework interface to geometry description
double ElectronsFromADCArea(double area, unsigned short plane) const
double ElectronsFromADCPeak(double adc, unsigned short plane) const
art::ServiceHandle< geo::Geometry const > geom
static Config * config
Definition: config.cpp:1054
bool const fDoLifeTimeCorrection
General LArSoft Utilities.
std::vector< double > const fCalAmpConstants
Detector simulation of raw signals on wires.
CalorimetryAlg(const fhicl::ParameterSet &pset)
Declaration of signal hit object.
#define Comment
Contains all timing reference information for the detector.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
calorimetry