DetectorPropertiesProtoDUNEsp.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_DETECTORPROPERTIES_PROTODUNESP_H
12 #define DETINFO_DETECTORPROPERTIES_PROTODUNESP_H
13 // LArSoft libraries
14 
18 
19 
20 // #include "canvas/Persistency/Utilities/TypeID.h"
21 
22 
26 
33 
35 // framework libraries
36 #include "fhiclcpp/ParameterSet.h"
38 #include "fhiclcpp/types/Table.h"
39 #include "fhiclcpp/types/Atom.h"
41 // C/C++ standard libraries
42 #include <set>
43 
44 
45 
46 
47 
48 
49 
51 
52 
53 
54 
55 
56 ///General LArSoft Utilities
57 namespace spdp{
58 
60  public:
61  /// List of service providers we depend on
65  >;
66 
67  /// Structure for configuration parameters
68  struct Configuration_t {
69  using Name = fhicl::Name;
71 
73  "electric field in front of each wire plane (the last one is the big one!) [kV/cm]")
74  };
75 
76 
78  Name("GetHVDriftfromSamweb"),
79  Comment("option to get HV drift field from MetaData")
80  };
82  Name("GetReadOutWindowSizefromSamweb"),
83  Comment("option to get ReadoutWindowSize and NumberTimeSamples from MetaData")
84  };
85 
87  Name("UseRunDependentTemperature"),
88  Comment("option to update temperature based on run number, used for Data")
89  };
90 
92  Name("Electronlifetime" ),
93  Comment("electron lifetime in liquid argon [us]")
94  };
96  Name("Temperature" ),
97  Comment("argon temperature [K]")
98  };
100  Name("ElectronsToADC" ),
101  Comment("conversion factor: (ADC counts)/(ionization electrons)")
102  };
104  Name("NumberTimeSamples" ),
105  Comment("number of TPC readout TDC clock ticks per event")
106  };
108  Name("ReadOutWindowSize" ),
109  Comment("number of TPC readout TDC clock ticks per readout window")
110  };
111 
112  // The following are not really "optional": the ones for the views which
113  // are present are mandatory.
115  Name("TimeOffsetU" ),
116  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view U")
117  };
119  Name("TimeOffsetV" ),
120  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view V")
121  };
123  Name("TimeOffsetZ" ),
124  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view Z")
125  };
127  Name("TimeOffsetY" ),
128  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view Y")
129  };
131  Name("TimeOffsetX" ),
132  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view X")
133  };
134 
136  Name("SternheimerA"),
137  Comment("parameter a of Sternheimer correction delta = 2log(10) x - cbar + { a (x1-x)^k } theta(x1-x), x = log10(p/m)")
138  };
140  Name("SternheimerK"),
141  Comment("parameter k of Sternheimer correction delta = 2log(10) x - cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")
142  };
144  Name("SternheimerX0"),
145  Comment("minimum x = log10(p/m) for the application of Sternheimer correction")
146  };
148  Name("SternheimerX1"),
149  Comment("parameter x_1 of Sternheimer correction delta = 2log(10) x - cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")
150  };
152  Name("SternheimerCbar"),
153  Comment("parameter cbar of Sternheimer correction delta = 2log(10) x - cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")
154  };
155  fhicl::Atom<bool> SimpleBoundary { Name("SimpleBoundaryProcess" ), Comment("") };
156 
157  }; // Configuration_t
158 
161  const geo::GeometryCore* geo,
162  const detinfo::LArProperties* lp,
163  std::set<std::string> const& ignore_params = {}
164  );
165  /**
166  * @brief Constructs the provider and sets up the dependencies
167  * @param pset FHiCL parameter set for provider configuration
168  * @param providers pack of providers `DetectorPropertiesStandard` depends
169  * on
170  * @param ignore_params unknown configuration keys in `pset` to be
171  * tolerated
172  * @see Setup()
173  */
175  providers_type providers,
176  std::set<std::string> const& ignore_params = {});
178  virtual ~DetectorPropertiesProtoDUNEsp() = default;
179 
180  /**
181  * @brief Configures the provider, first validating the configuration
182  * @param p configuration parameter set
183  * @param ignore_params parameters to be ignored (optional)
184  *
185  * This method will validate the parameter set (except for the parameters
186  * it's explicitly told to ignore) and extract the useful information out
187  * of it.
188  */
190  fhicl::ParameterSet const& p,
191  std::set<std::string> const& ignore_params = {}
192  );
193 
194  /// Extracts the relevant configuration from the specified object
195  void Configure(Configuration_t const& config);
196 
197  /**
198  * @brief Validates the specified configuration
199  * @param p configuration parameter set
200  * @param ignore_params parameters to be ignored (optional)
201  * @return a parsed configuration object
202  * @see ValidateAndConfigure(), Configure()
203  *
204  * This method will validate the parameter set (except for the parameters
205  * it's explicitly told to ignore) and it returns an object ready to
206  * be used with Configure().
207  */
209  fhicl::ParameterSet const& p,
210  std::set<std::string> const& ignore_params = {}
211  );
214  std::string filename);
215  bool UpdateTemp(int run);
217 
218  /**
219  * @brief Sets all the providers at once
220  * @param providers the pack of service providers we depend on
221  *
222  * Example:
223  *
224  * lar::DetectorPropertiesStandard::providers_type providers;
225  * providers.set(lar::providerFrom<geo::Geometry>());
226  * providers.set(lar::providerFrom<detinfo::LArPropertiesService>());
227  * providers.set(lar::providerFrom<detinfo::DetectorClocksService>());
228  * detprop->Setup(providers);
229  *
230  */
231  void Setup(providers_type providers);
232 
233  void SetGeometry(const geo::GeometryCore* g) { fGeo = g; }
234  void SetLArProperties(const detinfo::LArProperties* lp) { fLP = lp; }
235  void SetNumberTimeSamples(unsigned int nsamp) { fNumberTimeSamples=nsamp;}
236  // Accessors.
237  virtual double Efield(unsigned int planegap=0) const override; ///< kV/cm
238  virtual double DriftVelocity(double efield=0., double temperature=0.) const override; ///< cm/us
239 
240  /// dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
241  virtual double BirksCorrection(double dQdX) const override;
242  virtual double BirksCorrection(double dQdX, double EField) const override;
243  virtual double ModBoxCorrection(double dQdX) const override;
244  virtual double ModBoxCorrection(double dQdX, double EField) const override;
245  virtual double ElectronLifetime() const override { return fElectronlifetime; } //< microseconds
246 
247 
248  /**
249  * @brief Returns argon density at a given temperature
250  * @param temperature the temperature in kelvin
251  * @return argon density in g/cm^3
252  *
253  * Density is nearly a linear function of temperature.
254  * See the NIST tables for details
255  * Slope is between -6.2 and -6.1, intercept is 1928 kg/m^3.
256  * This parameterization will be good to better than 0.5%.
257  */
258  virtual double Density(double temperature) const override; ///< g/cm^3
259 
260  // need to provide a definition, since the override above hides the inherited one
261  virtual double Density() const override { return Density(Temperature()); }
262 
263  /// In kelvin.
264  virtual double Temperature() const override { return fTemperature; }
265 
266  /**
267  * @brief Restricted mean energy loss (dE/dx)
268  * @param mom momentum of incident particle [GeV/c]
269  * @param mass mass of incident particle [GeV/c^2]
270  * @param tcut maximum kinetic energy of delta rays [MeV]; 0 for unlimited
271  * @return the restricted mean energy loss (dE/dx) in units of MeV/cm
272  *
273  * Returned value is always positive.
274  * For unrestricted mean energy loss, set tcut = 0 (special case),
275  * or tcut large.
276  *
277  * Based on Bethe-Bloch formula as contained in particle data book.
278  * Material parameters are from the configuration.
279  */
280  virtual double Eloss(double mom, double mass, double tcut) const override;
281 
282  /**
283  * @brief Energy loss fluctuation (@f$ \sigma_{E}^2 / x @f$)
284  * @param mom momentum of incident particle in [GeV/c]
285  * @param mass mass of incident particle [GeV/c^2]
286  * @return energy loss fluctuation in MeV^2/cm
287  *
288  * Based on Bichsel formula referred to but not given in PDG.
289  */
290  virtual double ElossVar(double mom, double mass) const override;
291  virtual double ElectronsToADC() const override { return fElectronsToADC; }
292  virtual unsigned int NumberTimeSamples() const override { return fNumberTimeSamples; }
293  virtual unsigned int ReadOutWindowSize() const override { return fReadOutWindowSize; }
294  virtual double TimeOffsetU() const override{ return fTimeOffsetU; };
295  virtual double TimeOffsetV() const override { return fTimeOffsetV; };
296  virtual double TimeOffsetZ() const override{ return fTimeOffsetZ; };
297  virtual double TimeOffsetY() const override{ return fTimeOffsetY; };
298  // The following methods convert between TDC counts (SimChannel time) and
299  // ticks (RawDigit/Wire time).
300 
301  virtual bool SimpleBoundary() const override { return fSimpleBoundary; }
302 
303  /// Verifies that the provider is in a fully configured status
304  /// @throw cet::exception (category DetectorPropertiesStandard) if not ok
305  void CheckIfConfigured() const;
306 
307  protected:
308 
309 
310  /// Parameters for Sternheimer density effect corrections
312  double a; ///< parameter a
313  double k; ///< parameter k
314  double x0; ///< parameter x0
315  double x1; ///< parameter x1
316  double cbar; ///< parameter Cbar
317  }; // SternheimerParameters_t
318 
320 
321  // service providers we depend on;
322  // in principle could be replaced by a single providerpacl_type.
324  const geo::GeometryCore* fGeo;
325 
326 
327 
331  double fHV_cath; // <KV
332  std::vector<double> fEfield; ///< kV/cm (per inter-plane volume)
333  double fElectronlifetime; ///< microseconds
334  double fTemperature; ///< kelvin
335  double fSamplingRate; ///< in ns
336  double fElectronsToADC; ///< conversion factor for # of ionization electrons to 1 ADC count
337  unsigned int fNumberTimeSamples; ///< number of clock ticks per event
338  unsigned int fReadOutWindowSize; ///< number of clock ticks per readout window
339  double fTimeOffsetU; ///< time offset to convert spacepoint coordinates to hit times on view U
340  double fTimeOffsetV; ///< time offset to convert spacepoint coordinates to hit times on view V
341  double fTimeOffsetZ; ///< time offset to convert spacepoint coordinates to hit times on view Z
342  double fTimeOffsetY; ///< time offset to convert spacepoint coordinates to hit times on view Y
343  double fTimeOffsetX; ///< time offset to convert spacepoint coordinates to hit times on view X
344  double fHasTimeOffsetU = false; ///< whether time offset was configured for view U
345  double fHasTimeOffsetV = false; ///< whether time offset was configured for view V
346  double fHasTimeOffsetZ = false; ///< whether time offset was configured for view Z
347  double fHasTimeOffsetY = false; ///< whether time offset was configured for view Y
348  double fHasTimeOffsetX = false; ///< whether time offset was configured for view X
349 
350  SternheimerParameters_t fSternheimerParameters; ///< Sternheimer parameters
351 
353  /// Checks the configuration of time offsets.
355 
356  /// Checks that provider configuration is complete, using setup
357  /// information.
358  void CheckConfigurationAfterSetup() const;
359 
360  }; // class DetectorPropertiesStandard
361 } //namespace detinfo
362 #endif // DETINFO_DETECTOR_PROPERTIES_H
bool UpdateReadoutWindowSize(detinfo::DetectorClocksData const &clockData, std::string filename)
double fTimeOffsetZ
time offset to convert spacepoint coordinates to hit times on view Z
std::string CheckTimeOffsetConfigurationAfterSetup() const
Checks the configuration of time offsets.
void Configure(Configuration_t const &config)
Extracts the relevant configuration from the specified object.
static constexpr double g
Definition: Units.h:144
double fTimeOffsetX
time offset to convert spacepoint coordinates to hit times on view X
std::string string
Definition: nybbler.cc:12
double fHasTimeOffsetU
whether time offset was configured for view U
double fTimeOffsetU
time offset to convert spacepoint coordinates to hit times on view U
ChannelGroupService::Name Name
virtual double ElectronsToADC() const override
virtual double BirksCorrection(double dQdX) const override
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
double fElectronsToADC
conversion factor for # of ionization electrons to 1 ADC count
Data structure containing constant pointers to classes.
void ValidateAndConfigure(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params={})
Configures the provider, first validating the configuration.
string filename
Definition: train.py:213
double fHasTimeOffsetZ
whether time offset was configured for view Z
double fTimeOffsetY
time offset to convert spacepoint coordinates to hit times on view Y
detinfo::DetectorPropertiesData DataFor(const detinfo::DetectorClocksData &clockData) const override
virtual unsigned int NumberTimeSamples() const override
Parameters for Sternheimer density effect corrections.
detinfo::DetectorPropertiesData CalculateXTicksParams(detinfo::DetectorClocksData const &clockData) const
virtual double DriftVelocity(double efield=0., double temperature=0.) const override
cm/us
virtual double Eloss(double mom, double mass, double tcut) const override
Restricted mean energy loss (dE/dx)
double fHasTimeOffsetX
whether time offset was configured for view X
static Config * config
Definition: config.cpp:1054
virtual double ElectronLifetime() const override
Returns the attenuation constant for ionization electrons.
void SetGeometry(const geo::GeometryCore *g)
General LArSoft Utilities.
std::vector< double > fEfield
kV/cm (per inter-plane volume)
p
Definition: test.py:223
unsigned int fNumberTimeSamples
number of clock ticks per event
virtual double ModBoxCorrection(double dQdX) const override
Description of geometry of one entire detector.
unsigned int fReadOutWindowSize
number of clock ticks per readout window
#define Comment
Configuration_t ValidateConfiguration(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params={})
Validates the specified configuration.
virtual unsigned int ReadOutWindowSize() const override
Contains all timing reference information for the detector.
double fTimeOffsetV
time offset to convert spacepoint coordinates to hit times on view V
Container for a list of pointers to providers.
Definition: ProviderPack.h:114
virtual double Temperature() const override
In kelvin.
Access the description of detector geometry.
SternheimerParameters_t fSternheimerParameters
Sternheimer parameters.
virtual double ElossVar(double mom, double mass) const override
Energy loss fluctuation ( )
virtual ~DetectorPropertiesProtoDUNEsp()=default
LArSoft geometry interface.
Definition: ChannelGeo.h:16
void Setup(providers_type providers)
Sets all the providers at once.
virtual double Density() const override
Returns argon density at the temperature from Temperature()
double fHasTimeOffsetY
whether time offset was configured for view Y
pure virtual base interface for detector clocks
void SetLArProperties(const detinfo::LArProperties *lp)
double fHasTimeOffsetV
whether time offset was configured for view V