All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
13 #include "fhiclcpp/types/Sequence.h"
14 #include "fhiclcpp/types/Table.h"
15 
16 #include "art/Framework/Services/Registry/ServiceHandle.h"
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;
37  using Comment = fhicl::Comment;
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 
57  CalorimetryAlg(const fhicl::ParameterSet& pset)
58  : CalorimetryAlg(fhicl::Table<Config>(pset, {})())
59  {}
60 
61  CalorimetryAlg(const Config& config);
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:
164  art::ServiceHandle<geo::Geometry const> geom;
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
fhicl::Atom< bool > CaloDoLifeTimeCorrection
Declaration of signal hit object.
process_name hit
Definition: cheaterreco.fcl:51
process_name can override from command line with o or output calo
Definition: pid.fcl:40
double ElectronsFromADCArea(double area, unsigned short plane) const
double ElectronsFromADCPeak(double adc, unsigned short plane) const
double dEdx_AMP(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
art::ServiceHandle< geo::Geometry const > geom
bool const fDoLifeTimeCorrection
BEGIN_PROLOG vertical distance to the surface Name
std::vector< double > const fCalAmpConstants
CalorimetryAlg(const fhicl::ParameterSet &pset)
fhicl::Sequence< double > CalAreaConstants
Contains all timing reference information for the detector.
fhicl::Atom< bool > CaloUseModBox
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_AREA(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, recob::Hit const &hit, double pitch, double T0=0) const
fhicl::Atom< int > CaloLifeTimeForm
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
double LifetimeCorrection(detinfo::DetectorClocksData const &clock_data, detinfo::DetectorPropertiesData const &det_prop, double time, double T0=0) const
fhicl::Sequence< double > CalAmpConstants
art framework interface to geometry description
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator T0
Definition: gen_protons.fcl:45