LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
DetectorPropertiesServiceArgoNeuT.h
Go to the documentation of this file.
1 // \file DetectorPropertiesServiceArgoNeuT.h
3 //
4 // \brief service to contain information about detector electronics, etc
5 //
6 // \author brebel@fnal.gov
7 //
8 // From the original DetectorProperties.h ; this one preserves the dependency on
9 // DatabaseUtil service and the ability to read information from a database
10 // with direct DB connection.
11 // For new experiments, an indirect connection should be used instead.
12 //
13 // PLEASE DO NOT take this as a model to develop a service:
14 // this is just a backward-compatible hack.
15 //
17 #ifndef UTIL_DETECTORPROPERTIESSERVICEARGONEUT_H
18 #define UTIL_DETECTORPROPERTIESSERVICEARGONEUT_H
19 
24 
25 #include "fhiclcpp/ParameterSet.h"
30 
32 namespace util{
34  : public detinfo::DetectorProperties // implements provider interface
35  , public detinfo::DetectorPropertiesService // implements service interface
36  {
37  public:
38 
40 
41  //------------------------------------------------------------------------
42  //--- art service interface
43 
46 
47  virtual void reconfigure(fhicl::ParameterSet const& pset) override;
48 
50  virtual const detinfo::DetectorProperties* provider() const override
51  { return this; }
52 
53  //------------------------------------------------------------------------
54  //--- service provider interface
55  virtual double Efield(unsigned int planegap=0) const override
56  { return fLP->Efield(planegap); }
57 
58  virtual double DriftVelocity(double efield=0., double temperature=0.) const override
59  { return fLP->DriftVelocity(efield, temperature); }
60 
62  virtual double BirksCorrection(double dQdX) const override
63  { return fLP->BirksCorrection(dQdX); }
64 
65  virtual double ModBoxCorrection(double dQdX) const override
66  { return fLP->ModBoxCorrection(dQdX); }
67 
68  virtual double ElectronLifetime() const override
69  { return fLP->ElectronLifetime(); }
70 
71  virtual double Temperature() const override
72  { return fLP->Temperature(); }
73 
74  virtual double Density(double temperature) const override
75  { return fLP->Density(temperature); }
76  virtual double Density() const override { return Density(Temperature()); }
77 
78  virtual double Eloss(double mom, double mass, double tcut) const override
79  { return fLP->Eloss(mom, mass, tcut); }
80 
81  virtual double ElossVar(double mom, double mass) const override
82  { return fLP->ElossVar(mom, mass); }
83 
84  virtual double SamplingRate() const override { return fTPCClock.TickPeriod() * 1.e3; }
85  virtual double ElectronsToADC() const override { return fElectronsToADC; }
86  virtual unsigned int NumberTimeSamples() const override { return fNumberTimeSamples; }
87  virtual unsigned int ReadOutWindowSize() const override { return fReadOutWindowSize; }
88  virtual int TriggerOffset() const override;
89  virtual double TimeOffsetU() const override { return fTimeOffsetU; }
90  virtual double TimeOffsetV() const override { return fTimeOffsetV; }
91  virtual double TimeOffsetZ() const override { return fTimeOffsetZ; }
92  virtual double TimeOffsetY() const override { return 0; }
93 
94  virtual double ConvertXToTicks(double X, int p, int t, int c) const override;
95  virtual double ConvertXToTicks(double X, geo::PlaneID const& planeid) const override
96  { return ConvertXToTicks(X, planeid.Plane, planeid.TPC, planeid.Cryostat); }
97  virtual double ConvertTicksToX(double ticks, int p, int t, int c) const override;
98  virtual double ConvertTicksToX(double ticks, geo::PlaneID const& planeid) const override
99  { return ConvertTicksToX(ticks, planeid.Plane, planeid.TPC, planeid.Cryostat); }
100 
101  virtual double GetXTicksOffset(int p, int t, int c) const override;
102  virtual double GetXTicksOffset(geo::PlaneID const& planeid) const override
103  { return GetXTicksOffset(planeid.Plane, planeid.TPC, planeid.Cryostat); }
104  virtual double GetXTicksCoefficient(int t, int c) const override;
105  virtual double GetXTicksCoefficient(geo::TPCID const& tpcid) const override
106  { return GetXTicksCoefficient(tpcid.TPC, tpcid.Cryostat); }
107  virtual double GetXTicksCoefficient() const override;
108 
109  // The following methods convert between TDC counts (SimChannel time) and
110  // ticks (RawDigit/Wire time).
111  virtual double ConvertTDCToTicks(double tdc) const override;
112  virtual double ConvertTicksToTDC(double ticks) const override;
113 
114  virtual bool SimpleBoundary() const override { return fSimpleBoundary; }
115 
116  //------------------------------------------------------------------------
117 
118  // Accessors.
119 
120  private:
121 
122  // Callbacks.
123  void checkDBstatus() const;
124 
125  void preProcessEvent(const art::Event& evt);
126 
127  void postOpenFile(std::string const& filename);
128 
129  void CalculateXTicksParams() const;
130 
132 
133  // double fSamplingRate; ///< in ns
135  unsigned int fNumberTimeSamples;
136  unsigned int fReadOutWindowSize;
137  double fTimeOffsetU;
138  double fTimeOffsetV;
139  double fTimeOffsetZ;
140 
142  mutable bool fXTicksParamsLoaded;
143 
144  mutable double fXTicksCoefficient;
145 
146  mutable std::vector<std::vector<std::vector<double> > > fXTicksOffsets;
147  mutable std::vector<std::vector<double> > fDriftDirection;
148 
150 
152 
154 
157 
159 
160  }; // class DetectorPropertiesServiceArgoNeuT
161 } //namespace util
163 #endif // UTIL_DETECTORPROPERTIESSERVICEARGONEUT_H
164 
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
double fTimeOffsetU
time offsets to convert spacepoint
virtual double ConvertTDCToTicks(double tdc) const override
double fTimeOffsetV
coordinates to hit times on each
double fElectronsToADC
conversion factor for # of ionization electrons to 1 ADC count
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
virtual double ConvertTicksToX(double ticks, geo::PlaneID const &planeid) const override
double ElossVar(double mom, double mass) const
Energy loss fluctuation (sigma_E^2 / length in MeV^2/cm).
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:130
DetectorPropertiesServiceArgoNeuT(fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const override
virtual double GetXTicksOffset(geo::PlaneID const &planeid) const override
virtual double ConvertXToTicks(double X, int p, int t, int c) const override
bool fInheritNumberTimeSamples
Flag saying whether to inherit NumberTimeSamples.
double Efield(unsigned int planegap=0) const
kV/cm
virtual double BirksCorrection(double dQdX) const override
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
Properties related to liquid argon environment in the detector.
virtual double DriftVelocity(double efield=0., double temperature=0.) const override
virtual unsigned int ReadOutWindowSize() const override
virtual double Efield(unsigned int planegap=0) const override
< kV/cm
virtual const detinfo::DetectorProperties * provider() const override
Returns our service provider, that is this very same class.
unsigned int fReadOutWindowSize
number of clock ticks per readout window
virtual unsigned int NumberTimeSamples() const override
std::vector< std::vector< double > > fDriftDirection
virtual double ModBoxCorrection(double dQdX) const override
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
Definition of data types for geometry description.
virtual double ElossVar(double mom, double mass) const override
Energy loss fluctuation ( )
fhicl::ParameterSet fPS
Original parameter set.
virtual double SamplingRate() const override
Returns the period of the TPC readout electronics clock.
double BirksCorrection(double dQdX) const
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
bool fAlreadyReadFromDB
tests whether the values have alread been picked up from the Database
virtual double GetXTicksOffset(int p, int t, int c) const override
virtual double GetXTicksCoefficient(geo::TPCID const &tpcid) const override
double TickPeriod() const
A single tick period in microseconds.
Definition: ElecClock.h:342
double Eloss(double mom, double mass, double tcut) const
Restricted mean dE/dx energy loss (MeV/cm).
unsigned int fNumberTimeSamples
number of clock ticks per event
virtual double Eloss(double mom, double mass, double tcut) const override
Restricted mean energy loss ( )
std::vector< std::vector< std::vector< double > > > fXTicksOffsets
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
static bool isDetectorPropertiesServiceArgoNeuT(const fhicl::ParameterSet &ps)
Class def header for a class ElecClock.
double Density(double temperature=0.) const
g/cm^3
detinfo::ElecClock fTPCClock
TPC electronics clock.
virtual double Density() const override
Returns argon density at the temperature from Temperature()
virtual double ConvertTicksToTDC(double ticks) const override
Class representing the time measured by an electronics clock.
Definition: ElecClock.h:91
TCEvent evt
Definition: DataStructs.cxx:5
virtual void reconfigure(fhicl::ParameterSet const &pset) override
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:203
bool override
Float_t X
Definition: plot.C:39
virtual double Density(double temperature) const override
Returns argon density at a given temperature.
virtual double ConvertXToTicks(double X, geo::PlaneID const &planeid) const override
#define DECLARE_ART_SERVICE_INTERFACE_IMPL(svc, iface, scope)
virtual double ElectronLifetime() const override
Returns the attenuation constant for ionization electrons.