LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
DetectorPropertiesStandard.h
Go to the documentation of this file.
1 // \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
11 #ifndef DETINFO_DETECTORPROPERTIESSTD_H
12 #define DETINFO_DETECTORPROPERTIESSTD_H
13 
14 // LArSoft libraries
20 
21 // framework libraries
22 #include "fhiclcpp/ParameterSet.h"
24 #include "fhiclcpp/types/Table.h"
25 #include "fhiclcpp/types/Atom.h"
27 
28 // C/C++ standard libraries
29 #include <set>
30 
32 namespace detinfo{
33 
35  public:
41  >;
42 
44  struct Configuration_t {
45  using Name = fhicl::Name;
47 
49  "electric field in front of each wire plane (the last one is the big one!) [kV/cm]")
50  };
51 
53  Name("Electronlifetime" ),
54  Comment("electron lifetime in liquid argon [us]")
55  };
57  Name("Temperature" ),
58  Comment("argon temperature [K]")
59  };
61  Name("ElectronsToADC" ),
62  Comment("conversion factor: (ADC counts)/(ionization electrons)")
63  };
65  Name("NumberTimeSamples" ),
66  Comment("number of TPC readout TDC clock ticks per event")
67  };
69  Name("ReadOutWindowSize" ),
70  Comment("number of TPC readout TDC clock ticks per readout window")
71  };
72 
73  // The following are not really "optional": the ones for the views which
74  // are present are mandatory.
76  Name("TimeOffsetU" ),
77  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view U")
78  };
80  Name("TimeOffsetV" ),
81  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view V")
82  };
84  Name("TimeOffsetZ" ),
85  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view Z")
86  };
88  Name("TimeOffsetY" ),
89  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view Y")
90  };
92  Name("TimeOffsetX" ),
93  Comment("tick offset subtracted to to convert spacepoint coordinates to hit times on view X")
94  };
95 
97  Name("SternheimerA"),
98  Comment("parameter a of Sternheimer correction delta = 2log(10) x - cbar + { a (x1-x)^k } theta(x1-x), x = log10(p/m)")
99  };
101  Name("SternheimerK"),
102  Comment("parameter k of Sternheimer correction delta = 2log(10) x - cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")
103  };
105  Name("SternheimerX0"),
106  Comment("minimum x = log10(p/m) for the application of Sternheimer correction")
107  };
109  Name("SternheimerX1"),
110  Comment("parameter x_1 of Sternheimer correction delta = 2log(10) x - cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")
111  };
113  Name("SternheimerCbar"),
114  Comment("parameter cbar of Sternheimer correction delta = 2log(10) x - cbar + { a (x_1-x)^k } theta(x1-x), x = log10(p/m)")
115  };
116 
117  fhicl::Atom<bool> SimpleBoundary { Name("SimpleBoundaryProcess" ), Comment("") };
118 
119  }; // Configuration_t
120 
123  const geo::GeometryCore* geo,
124  const detinfo::LArProperties* lp,
125  const detinfo::DetectorClocks* c,
126  std::set<std::string> const& ignore_params = {}
127  );
138  providers_type providers,
139  std::set<std::string> const& ignore_params = {});
141  virtual ~DetectorPropertiesStandard() = default;
142 
153  fhicl::ParameterSet const& p,
154  std::set<std::string> const& ignore_params = {}
155  );
156 
157 
159  void Configure(Configuration_t const& config);
160 
173  fhicl::ParameterSet const& p,
174  std::set<std::string> const& ignore_params = {}
175  );
176 
177  bool Update(uint64_t ts);
178  bool UpdateClocks(const detinfo::DetectorClocks* clks);
179 
193  void Setup(providers_type providers);
194 
195  void SetGeometry(const geo::GeometryCore* g) { fGeo = g; }
196  void SetLArProperties(const detinfo::LArProperties* lp) { fLP = lp; }
197  void SetDetectorClocks(const detinfo::DetectorClocks* clks) { fClocks = clks; }
198 
199  void SetNumberTimeSamples(unsigned int nsamp) { fNumberTimeSamples=nsamp;}
200  // Accessors.
201 
202  virtual double Efield(unsigned int planegap=0) const override;
203 
204  virtual double DriftVelocity(double efield=0., double temperature=0.) const override;
205 
207  virtual double BirksCorrection(double dQdX) const override;
208  virtual double ModBoxCorrection(double dQdX) const override;
209 
210  virtual double ElectronLifetime() const override { return fElectronlifetime; } //< microseconds
211 
212 
223  virtual double Density(double temperature) const override;
224 
225  // need to provide a definition, since the override above hides the inherited one
226  virtual double Density() const override { return Density(Temperature()); }
227 
229  virtual double Temperature() const override { return fTemperature; }
230 
245  virtual double Eloss(double mom, double mass, double tcut) const override;
246 
255  virtual double ElossVar(double mom, double mass) const override;
256 
257  virtual double SamplingRate() const override { return fTPCClock.TickPeriod() * 1.e3; }
258  virtual double ElectronsToADC() const override { return fElectronsToADC; }
259  virtual unsigned int NumberTimeSamples() const override { return fNumberTimeSamples; }
260  virtual unsigned int ReadOutWindowSize() const override { return fReadOutWindowSize; }
261  virtual int TriggerOffset() const override;
262  virtual double TimeOffsetU() const override{ return fTimeOffsetU; };
263  virtual double TimeOffsetV() const override { return fTimeOffsetV; };
264  virtual double TimeOffsetZ() const override{ return fTimeOffsetZ; };
265  virtual double TimeOffsetY() const override{ return fTimeOffsetY; };
266 
267  virtual double ConvertXToTicks(double X, int p, int t, int c) const override;
268  virtual double ConvertXToTicks(double X, geo::PlaneID const& planeid) const override
269  { return ConvertXToTicks(X, planeid.Plane, planeid.TPC, planeid.Cryostat); }
270  virtual double ConvertTicksToX(double ticks, int p, int t, int c) const override;
271  virtual double ConvertTicksToX(double ticks, geo::PlaneID const& planeid) const override
272  { return ConvertTicksToX(ticks, planeid.Plane, planeid.TPC, planeid.Cryostat); }
273 
274  virtual double GetXTicksOffset(int p, int t, int c) const override;
275  virtual double GetXTicksOffset(geo::PlaneID const& planeid) const override
276  { return GetXTicksOffset(planeid.Plane, planeid.TPC, planeid.Cryostat); }
277  virtual double GetXTicksCoefficient(int t, int c) const override;
278  virtual double GetXTicksCoefficient(geo::TPCID const& tpcid) const override
279  { return GetXTicksCoefficient(tpcid.TPC, tpcid.Cryostat); }
280  virtual double GetXTicksCoefficient() const override;
281 
282  // The following methods convert between TDC counts (SimChannel time) and
283  // ticks (RawDigit/Wire time).
284  virtual double ConvertTDCToTicks(double tdc) const override;
285  virtual double ConvertTicksToTDC(double ticks) const override;
286 
287 
288  virtual bool SimpleBoundary() const override { return fSimpleBoundary; }
289 
292  void CheckIfConfigured() const;
293 
294  protected:
295 
296 
299  double a;
300  double k;
301  double x0;
302  double x1;
303  double cbar;
304  }; // SternheimerParameters_t
305 
306  void CalculateXTicksParams();
307 
308  // service providers we depend on;
309  // in principle could be replaced by a single providerpacl_type.
310  const detinfo::LArProperties* fLP;
312  const geo::GeometryCore* fGeo;
313 
314  std::vector< double > fEfield;
316  double fTemperature;
317  double fSamplingRate;
319  unsigned int fNumberTimeSamples;
320  unsigned int fReadOutWindowSize;
321  double fTimeOffsetU;
322  double fTimeOffsetV;
323  double fTimeOffsetZ;
324  double fTimeOffsetY;
325  double fTimeOffsetX;
326  double fHasTimeOffsetU = false;
327  double fHasTimeOffsetV = false;
328  double fHasTimeOffsetZ = false;
329  double fHasTimeOffsetY = false;
330  double fHasTimeOffsetX = false;
331 
333 
335 
336  std::vector<std::vector<std::vector<double> > > fXTicksOffsets;
337  std::vector<std::vector<double> > fDriftDirection;
338 
340 
342 
344  std::string CheckTimeOffsetConfigurationAfterSetup() const;
345 
348  void CheckConfigurationAfterSetup() const;
349 
351  void DoUpdateClocks();
352 
353  }; // class DetectorPropertiesStandard
354 } //namespace detinfo
355 
356 #endif // DETINFO_DETECTOR_PROPERTIES_H
double fTimeOffsetZ
time offset to convert spacepoint coordinates to hit times on view Z
virtual double ConvertTicksToTDC(double ticks) const override
virtual double Temperature() const override
In kelvin.
virtual double GetXTicksCoefficient() const override
double fXTicksCoefficient
Parameters for x<–>ticks.
virtual double GetXTicksCoefficient(geo::TPCID const &tpcid) const override
virtual double ConvertTDCToTicks(double tdc) const override
virtual double TimeOffsetY() const override
virtual ~DetectorPropertiesStandard()=default
double fElectronsToADC
conversion factor for # of ionization electrons to 1 ADC count
void DoUpdateClocks()
Time-independent implementation of clock updates.
void ValidateAndConfigure(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params={})
Configures the provider, first validating the configuration.
virtual double ElossVar(double mom, double mass) const override
Energy loss fluctuation ( )
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
bool UpdateClocks(const detinfo::DetectorClocks *clks)
virtual 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
void SetDetectorClocks(const detinfo::DetectorClocks *clks)
std::vector< std::vector< double > > fDriftDirection
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:130
double fTimeOffsetU
time offset to convert spacepoint coordinates to hit times on view U
virtual double GetXTicksOffset(geo::PlaneID const &planeid) const override
double fHasTimeOffsetV
whether time offset was configured for view V
std::vector< std::vector< std::vector< double > > > fXTicksOffsets
double fTimeOffsetY
time offset to convert spacepoint coordinates to hit times on view Y
pure virtual base interface for detector clocks
void SetGeometry(const geo::GeometryCore *g)
double fHasTimeOffsetX
whether time offset was configured for view X
void Configure(Configuration_t const &config)
Extracts the relevant configuration from the specified object.
double fTimeOffsetV
time offset to convert spacepoint coordinates to hit times on view V
Access the description of detector geometry.
virtual double TimeOffsetU() const override
void SetLArProperties(const detinfo::LArProperties *lp)
std::vector< double > fEfield
kV/cm (per inter-plane volume)
virtual double SamplingRate() const override
Returns the period of the TPC readout electronics clock.
virtual unsigned int ReadOutWindowSize() const override
SternheimerParameters_t fSternheimerParameters
Sternheimer parameters.
std::string CheckTimeOffsetConfigurationAfterSetup() const
Checks the configuration of time offsets.
double fHasTimeOffsetZ
whether time offset was configured for view Z
virtual double GetXTicksOffset(int p, int t, int c) const override
General LArSoft Utilities.
The data type to uniquely identify a TPC.
Definition: geo_types.h:195
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
Description of geometry of one entire detector.
double fHasTimeOffsetU
whether time offset was configured for view U
Parameters for Sternheimer density effect corrections.
virtual double TimeOffsetV() const override
Conversion of times between different formats and references.
::detinfo::ElecClock fTPCClock
TPC electronics clock.
virtual double ModBoxCorrection(double dQdX) const override
virtual double ConvertXToTicks(double X, int p, int t, int c) const override
double TickPeriod() const
A single tick period in microseconds.
Definition: ElecClock.h:342
virtual unsigned int NumberTimeSamples() const override
unsigned int fReadOutWindowSize
number of clock ticks per readout window
Container for a list of pointers to providers.
Definition: ProviderPack.h:114
virtual double ConvertXToTicks(double X, geo::PlaneID const &planeid) const override
double fTimeOffsetX
time offset to convert spacepoint coordinates to hit times on view X
virtual double ConvertTicksToX(double ticks, geo::PlaneID const &planeid) const override
const detinfo::DetectorClocks * fClocks
Data structure containing constant pointers to classes.
Configuration_t ValidateConfiguration(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params={})
Validates the specified configuration.
virtual double ElectronLifetime() const override
Returns the attenuation constant for ionization electrons.
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const override
Class representing the time measured by an electronics clock.
Definition: ElecClock.h:91
virtual double DriftVelocity(double efield=0., double temperature=0.) const override
cm/us
virtual double ElectronsToADC() const override
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:203
virtual double TimeOffsetZ() const override
virtual double Density() const override
Returns argon density at the temperature from Temperature()
virtual bool SimpleBoundary() const override
Float_t X
Definition: plot.C:39
Namespace collecting geometry-related classes utilities.
double fHasTimeOffsetY
whether time offset was configured for view Y
void Setup(providers_type providers)
Sets all the providers at once.
virtual double Eloss(double mom, double mass, double tcut) const override
Restricted mean energy loss (dE/dx)