DetectorPropertiesStandard.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file DetectorPropertiesStandard.h
3 //
4 // \brief service to contain information about detector electronics, etc
5 //
6 // \author brebel@fnal.gov
7 //
8 // Separation of service from Detector info class:
9 // jpaley@fnal.gov
10 ////////////////////////////////////////////////////////////////////////
11 #ifndef DETINFO_DETECTORPROPERTIESSTD_H
12 #define DETINFO_DETECTORPROPERTIESSTD_H
13 
14 // LArSoft libraries
21 
22 // framework libraries
23 #include "fhiclcpp/ParameterSet.h"
24 #include "fhiclcpp/fwd.h"
25 #include "fhiclcpp/types/Atom.h"
28 
29 // C/C++ standard libraries
30 #include <set>
31 
32 /// General LArSoft Utilities
33 namespace detinfo {
34 
36  public:
37  /// List of service providers we depend on
39 
40  /// Structure for configuration parameters
41  struct Configuration_t {
42  using Name = fhicl::Name;
44 
46  Name("Efield"),
47  Comment("electric field in front of each wire plane (the last one is "
48  "the big one!) [kV/cm]")};
49 
51  Comment("electron lifetime in liquid argon [us]")};
52  fhicl::Atom<double> Temperature{Name("Temperature"), Comment("argon temperature [K]")};
54  Name("ElectronsToADC"),
55  Comment("conversion factor: (ADC counts)/(ionization electrons)")};
57  Name("NumberTimeSamples"),
58  Comment("number of TPC readout TDC clock ticks per event")};
60  Name("ReadOutWindowSize"),
61  Comment("number of TPC readout TDC clock ticks per readout window")};
62 
63  // The following are not really "optional": the ones for the views which
64  // are present are mandatory.
66  Name("TimeOffsetU"),
67  Comment("tick offset subtracted to to convert spacepoint coordinates "
68  "to hit times on view U")};
70  Name("TimeOffsetV"),
71  Comment("tick offset subtracted to to convert spacepoint coordinates "
72  "to hit times on view V")};
74  Name("TimeOffsetZ"),
75  Comment("tick offset subtracted to to convert spacepoint coordinates "
76  "to hit times on view Z")};
78  Name("TimeOffsetY"),
79  Comment("tick offset subtracted to to convert spacepoint coordinates "
80  "to hit times on view Y")};
82  Name("TimeOffsetX"),
83  Comment("tick offset subtracted to to convert spacepoint coordinates "
84  "to hit times on view X")};
85 
87  Name("SternheimerA"),
88  Comment("parameter a of Sternheimer correction delta = 2log(10) x - "
89  "cbar + { a (x1-x)^k } theta(x1-x), x = log10(p/m)")};
91  Name("SternheimerK"),
92  Comment("parameter k of Sternheimer correction delta = 2log(10) x - "
93  "cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")};
95  Name("SternheimerX0"),
96  Comment("minimum x = log10(p/m) for the application of Sternheimer "
97  "correction")};
99  Name("SternheimerX1"),
100  Comment("parameter x_1 of Sternheimer correction delta = 2log(10) x - "
101  "cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")};
103  Name("SternheimerCbar"),
104  Comment("parameter cbar of Sternheimer correction delta = 2log(10) x - "
105  "cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")};
107  Name("DriftVelFudgeFactor"),
108  Comment("Allows a scaling factor to fudge the drift velocity "
109  "calculation (as suggested by DriftVel Stancari")};
110 
112  Name("UseIcarusMicrobooneDriftModel"),
113  Comment("Allows user to decide to use the ICARUS+MicroBooNE drift "
114  "model for velocity calculation as in arXiv:2008.09765"),
115  false};
116 
118  Name("IncludeInterPlanePitchInXTickOffsets"),
119  Comment("Historically, ConvertTicksToX has allowed for the drift time "
120  "between the wire planes. This is appropriate for "
121  "recob::RawDigits, and recob::Wires from the 1D unfolding, "
122  "but is not appropriate for recob::Wires from WireCell. "
123  "The default value is 'true', retaining the 'classic' behaviour"),
124  true};
125 
126  fhicl::Atom<bool> SimpleBoundary{Name("SimpleBoundaryProcess"), Comment("")};
127 
128  }; // Configuration_t
129 
131  const geo::GeometryCore* geo,
132  const detinfo::LArProperties* lp,
133  std::set<std::string> const& ignore_params = {});
134 
136  virtual ~DetectorPropertiesStandard() = default;
137 
138  void
139  SetNumberTimeSamples(unsigned int nsamp)
140  {
141  fNumberTimeSamples = nsamp;
142  }
143 
144  // Accessors.
145 
146  double Efield(unsigned int planegap = 0) const override; ///< kV/cm
147 
148  double DriftVelocity(double efield = 0.,
149  double temperature = 0.) const override; ///< cm/us
150 
151  /// dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
152  double BirksCorrection(double dQdX) const override;
153  double BirksCorrection(double dQdX, double EField) const override;
154  double ModBoxCorrection(double dQdX) const override;
155  double ModBoxCorrection(double dQdX, double EField) const override;
156 
157  double
158  ElectronLifetime() const override
159  {
160  return fElectronlifetime; //< microseconds
161  }
162 
163  /**
164  * @brief Returns argon density at a given temperature
165  * @param temperature the temperature in kelvin
166  * @return argon density in g/cm^3
167  *
168  * Density is nearly a linear function of temperature.
169  * See the NIST tables for details
170  * Slope is between -6.2 and -6.1, intercept is 1928 kg/m^3.
171  * This parameterization will be good to better than 0.5%.
172  */
173  double Density(double temperature = 0.) const override; ///< g/cm^3
174 
175  /// In kelvin.
176  double
177  Temperature() const override
178  {
179  return fTemperature;
180  }
181 
182  /**
183  * @brief Restricted mean energy loss (dE/dx)
184  * @param mom momentum of incident particle [GeV/c]
185  * @param mass mass of incident particle [GeV/c^2]
186  * @param tcut maximum kinetic energy of delta rays [MeV]; 0 for unlimited
187  * @return the restricted mean energy loss (dE/dx) in units of MeV/cm
188  *
189  * Returned value is always positive.
190  * For unrestricted mean energy loss, set tcut = 0 (special case),
191  * or tcut large.
192  *
193  * Based on Bethe-Bloch formula as contained in particle data book.
194  * Material parameters are from the configuration.
195  */
196  double Eloss(double mom, double mass, double tcut) const override;
197 
198  /**
199  * @brief Energy loss fluctuation (@f$ \sigma_{E}^2 / x @f$)
200  * @param mom momentum of incident particle in [GeV/c]
201  * @param mass mass of incident particle [GeV/c^2]
202  * @return energy loss fluctuation in MeV^2/cm
203  *
204  * Based on Bichsel formula referred to but not given in PDG.
205  */
206  double ElossVar(double mom, double mass) const override;
207 
208  double
209  ElectronsToADC() const override
210  {
211  return fElectronsToADC;
212  }
213  unsigned int
214  NumberTimeSamples() const override
215  {
216  return fNumberTimeSamples;
217  }
218  unsigned int
219  ReadOutWindowSize() const override
220  {
221  return fReadOutWindowSize;
222  }
223  double
224  TimeOffsetU() const override
225  {
226  return fTimeOffsetU;
227  };
228  double
229  TimeOffsetV() const override
230  {
231  return fTimeOffsetV;
232  };
233  double
234  TimeOffsetZ() const override
235  {
236  return fTimeOffsetZ;
237  };
238  double
239  TimeOffsetY() const override
240  {
241  return fTimeOffsetY;
242  };
243 
244  bool
245  SimpleBoundary() const override
246  {
247  return fSimpleBoundary;
248  }
249 
250  DetectorPropertiesData DataFor(detinfo::DetectorClocksData const& clock_data) const override;
251 
252  private:
253  /**
254  * @brief Configures the provider, first validating the configuration
255  * @param p configuration parameter set
256  * @param ignore_params parameters to be ignored (optional)
257  *
258  * This method will validate the parameter set (except for the parameters
259  * it's explicitly told to ignore) and extract the useful information out
260  * of it.
261  */
263  std::set<std::string> const& ignore_params);
264 
265  std::string CheckTimeOffsets(std::set<geo::View_t> const& requested_views) const;
266 
267  /// Parameters for Sternheimer density effect corrections
269  double a; ///< parameter a
270  double k; ///< parameter k
271  double x0; ///< parameter x0
272  double x1; ///< parameter x1
273  double cbar; ///< parameter Cbar
274  };
275 
276  // service providers we depend on;
277  // in principle could be replaced by a single providerpack_type.
280 
281  std::vector<double> fEfield; ///< kV/cm (per inter-plane volume) !
282  double fElectronlifetime; ///< microseconds
283  double fTemperature; ///< kelvin
284  double fElectronsToADC; ///< conversion factor for # of ionization electrons
285  ///< to 1 ADC count
286  unsigned int fNumberTimeSamples; ///< number of clock ticks per event
287  unsigned int fReadOutWindowSize; ///< number of clock ticks per readout window
288  double fTimeOffsetU; ///< time offset to convert spacepoint coordinates to
289  ///< hit times on view U
290  double fTimeOffsetV; ///< time offset to convert spacepoint coordinates to
291  ///< hit times on view V
292  double fTimeOffsetZ; ///< time offset to convert spacepoint coordinates to
293  ///< hit times on view Z
294  double fTimeOffsetY; ///< time offset to convert spacepoint coordinates to
295  ///< hit times on view Y
296  double fTimeOffsetX; ///< time offset to convert spacepoint coordinates to
297  ///< hit times on view X
298  double fDriftVelFudgeFactor; ///< Scaling factor to allow "fudging" of drift
299  ///< velocity
300 
301  bool fUseIcarusMicrobooneDriftModel; ///< if true, use alternative ICARUS-MicroBooNE drift
302  ///< model instead of Walkowiak-based one
303 
304  /// Historically, ConvertTicksToX has allowed for the drift time between
305  /// the wire planes. This is appropriate for recob::RawDigits, and
306  /// recob::Wires from the 1D unfolding, but is not appropriate for
307  /// recob::Wires from WireCell.
309 
310  SternheimerParameters_t fSternheimerParameters; ///< Sternheimer parameters
311 
312  std::vector<std::vector<double>> fDriftDirection;
313 
315 
316  }; // class DetectorPropertiesStandard
317 } // namespace detinfo
318 
319 #endif // DETINFO_DETECTOR_PROPERTIES_H
unsigned int ReadOutWindowSize() const override
DetectorPropertiesStandard(fhicl::ParameterSet const &pset, const geo::GeometryCore *geo, const detinfo::LArProperties *lp, std::set< std::string > const &ignore_params={})
unsigned int NumberTimeSamples() const override
virtual ~DetectorPropertiesStandard()=default
std::string string
Definition: nybbler.cc:12
void ValidateAndConfigure(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params)
Configures the provider, first validating the configuration.
double ElossVar(double mom, double mass) const override
Energy loss fluctuation ( )
double BirksCorrection(double dQdX) const override
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
unsigned int fNumberTimeSamples
number of clock ticks per event
ChannelGroupService::Name Name
std::vector< std::vector< double > > fDriftDirection
double Temperature() const override
In kelvin.
virtual double Density() const
Returns argon density at the temperature from Temperature()
Data structure containing constant pointers to classes.
DetectorPropertiesData DataFor(detinfo::DetectorClocksData const &clock_data) const override
SternheimerParameters_t fSternheimerParameters
Sternheimer parameters.
p
Definition: test.py:223
std::string CheckTimeOffsets(std::set< geo::View_t > const &requested_views) const
General LArSoft Utilities.
Description of geometry of one entire detector.
Parameters for Sternheimer density effect corrections.
double ModBoxCorrection(double dQdX) const override
double ElectronLifetime() const override
Returns the attenuation constant for ionization electrons.
#define Comment
Contains all timing reference information for the detector.
unsigned int fReadOutWindowSize
number of clock ticks per readout window
Container for a list of pointers to providers.
Definition: ProviderPack.h:114
std::vector< double > fEfield
kV/cm (per inter-plane volume) !
Access the description of detector geometry.
double DriftVelocity(double efield=0., double temperature=0.) const override
cm/us
LArSoft geometry interface.
Definition: ChannelGeo.h:16
pure virtual base interface for detector clocks
double Eloss(double mom, double mass, double tcut) const override
Restricted mean energy loss (dE/dx)