LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
util::DetectorPropertiesServiceArgoNeuT Class Reference

#include "DetectorPropertiesServiceArgoNeuT.h"

Inheritance diagram for util::DetectorPropertiesServiceArgoNeuT:
detinfo::DetectorProperties detinfo::DetectorPropertiesService

Public Types

using provider_type = DetectorPropertiesServiceArgoNeuT
 type of service provider, that is this very same More...
 

Public Member Functions

 DetectorPropertiesServiceArgoNeuT (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
 
virtual void reconfigure (fhicl::ParameterSet const &pset) override
 
virtual const detinfo::DetectorPropertiesprovider () const override
 Returns our service provider, that is this very same class. More...
 
virtual double Efield (unsigned int planegap=0) const override
 < kV/cm More...
 
virtual double DriftVelocity (double efield=0., double temperature=0.) const override
 
virtual double BirksCorrection (double dQdX) const override
 dQ/dX in electrons/cm, returns dE/dX in MeV/cm. More...
 
virtual double ModBoxCorrection (double dQdX) const override
 
virtual double ElectronLifetime () const override
 Returns the attenuation constant for ionization electrons. More...
 
virtual double Temperature () const override
 
virtual double Density (double temperature) const override
 Returns argon density at a given temperature. More...
 
virtual double Density () const override
 Returns argon density at the temperature from Temperature() More...
 
virtual double Eloss (double mom, double mass, double tcut) const override
 Restricted mean energy loss ( $ dE/dx $) More...
 
virtual double ElossVar (double mom, double mass) const override
 Energy loss fluctuation ( $ \sigma_{E}^2 / x $) More...
 
virtual double SamplingRate () const override
 Returns the period of the TPC readout electronics clock. More...
 
virtual double ElectronsToADC () const override
 
virtual unsigned int NumberTimeSamples () const override
 
virtual unsigned int ReadOutWindowSize () const override
 
virtual int TriggerOffset () const override
 
virtual double TimeOffsetU () const override
 
virtual double TimeOffsetV () const override
 
virtual double TimeOffsetZ () const override
 
virtual double TimeOffsetY () const override
 
virtual double ConvertXToTicks (double X, int p, int t, int c) const override
 
virtual double ConvertXToTicks (double X, geo::PlaneID const &planeid) const override
 
virtual double ConvertTicksToX (double ticks, int p, int t, int c) const override
 
virtual double ConvertTicksToX (double ticks, geo::PlaneID const &planeid) const override
 
virtual double GetXTicksOffset (int p, int t, int c) const override
 
virtual double GetXTicksOffset (geo::PlaneID const &planeid) const override
 
virtual double GetXTicksCoefficient (int t, int c) const override
 
virtual double GetXTicksCoefficient (geo::TPCID const &tpcid) const override
 
virtual double GetXTicksCoefficient () const override
 
virtual double ConvertTDCToTicks (double tdc) const override
 
virtual double ConvertTicksToTDC (double ticks) const override
 
virtual bool SimpleBoundary () const override
 

Private Member Functions

void checkDBstatus () const
 
void preProcessEvent (const art::Event &evt)
 
void postOpenFile (std::string const &filename)
 
void CalculateXTicksParams () const
 

Static Private Member Functions

static bool isDetectorPropertiesServiceArgoNeuT (const fhicl::ParameterSet &ps)
 

Private Attributes

double fElectronsToADC
 conversion factor for # of ionization electrons to 1 ADC count More...
 
unsigned int fNumberTimeSamples
 number of clock ticks per event More...
 
unsigned int fReadOutWindowSize
 number of clock ticks per readout window More...
 
double fTimeOffsetU
 time offsets to convert spacepoint More...
 
double fTimeOffsetV
 coordinates to hit times on each More...
 
double fTimeOffsetZ
 view More...
 
bool fInheritNumberTimeSamples
 Flag saying whether to inherit NumberTimeSamples. More...
 
bool fXTicksParamsLoaded
 calculations More...
 
double fXTicksCoefficient
 Parameters for x<–>ticks. More...
 
std::vector< std::vector< std::vector< double > > > fXTicksOffsets
 
std::vector< std::vector< double > > fDriftDirection
 
fhicl::ParameterSet fPS
 Original parameter set. More...
 
bool fAlreadyReadFromDB
 tests whether the values have alread been picked up from the Database More...
 
detinfo::ElecClock fTPCClock
 TPC electronics clock. More...
 
util::LArPropertiesServiceArgoNeuT const * fLP
 Pointer to the specific LArPropertiesServiceArgoNeuT service (provider) More...
 
bool fSimpleBoundary
 

Detailed Description

Definition at line 33 of file DetectorPropertiesServiceArgoNeuT.h.

Member Typedef Documentation

type of service provider, that is this very same

Definition at line 45 of file DetectorPropertiesServiceArgoNeuT.h.

Constructor & Destructor Documentation

util::DetectorPropertiesServiceArgoNeuT::DetectorPropertiesServiceArgoNeuT ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry reg 
)

Definition at line 27 of file DetectorPropertiesServiceArgoNeuT_service.cc.

References art::errors::Configuration, fLP, postOpenFile(), preProcessEvent(), reconfigure(), art::ActivityRegistry::sPostOpenFile, and art::ActivityRegistry::sPreProcessEvent.

29  : fNumberTimeSamples(pset.get< unsigned int >("NumberTimeSamples"))
30  {
31  fLP = dynamic_cast<util::LArPropertiesServiceArgoNeuT const*>
32  (lar::providerFrom<detinfo::LArPropertiesService>());
33  if (!fLP) {
34  // this legacy service works only coupled to the corresponding
35  // LArProperties legacy service:
37  << "DetectorPropertiesServiceArgoNeuT service requires"
38  " LArPropertiesServiceArgoNeuT";
39  }
40 
41  this->reconfigure(pset);
42 
43  // Register for callbacks.
44 
47  }
Properties related to liquid argon environment in the detector.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
unsigned int fNumberTimeSamples
number of clock ticks per event
GlobalSignal< detail::SignalResponseType::FIFO, void(Event const &)> sPreProcessEvent
GlobalSignal< detail::SignalResponseType::LIFO, void(std::string const &)> sPostOpenFile
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
virtual void reconfigure(fhicl::ParameterSet const &pset) override

Member Function Documentation

virtual double util::DetectorPropertiesServiceArgoNeuT::BirksCorrection ( double  dQdX) const
inlineoverridevirtual

dQ/dX in electrons/cm, returns dE/dX in MeV/cm.

Implements detinfo::DetectorProperties.

Definition at line 62 of file DetectorPropertiesServiceArgoNeuT.h.

References util::LArPropertiesServiceArgoNeuT::BirksCorrection(), and fLP.

63  { return fLP->BirksCorrection(dQdX); }
double BirksCorrection(double dQdX) const
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
void util::DetectorPropertiesServiceArgoNeuT::CalculateXTicksParams ( ) const
private

< special case for ArgoNeuT

Definition at line 170 of file DetectorPropertiesServiceArgoNeuT_service.cc.

References geo::GeometryCore::Cryostat(), dir, geo::TPCGeo::DriftDirection(), DriftVelocity(), Efield(), fDriftDirection, fLP, fTimeOffsetU, fTimeOffsetV, fTimeOffsetZ, fXTicksCoefficient, fXTicksOffsets, fXTicksParamsLoaded, geo::kNegX, geo::kU, geo::kV, geo::kZ, geo::GeometryCore::Ncryostats(), geo::TPCGeo::Nplanes(), geo::CryostatGeo::NTPC(), geo::TPCGeo::Plane(), geo::TPCGeo::PlaneLocation(), geo::TPCGeo::PlanePitch(), SamplingRate(), util::LArPropertiesServiceArgoNeuT::Temperature(), geo::CryostatGeo::TPC(), TriggerOffset(), and geo::PlaneGeo::View().

Referenced by ConvertTicksToX(), ConvertXToTicks(), GetXTicksCoefficient(), GetXTicksOffset(), and SimpleBoundary().

171  {
173 
174  double samplingRate = SamplingRate();
175  double efield = Efield();
176  double temperature = fLP->Temperature();
177  double driftVelocity = DriftVelocity(efield, temperature);
178 
179  fXTicksCoefficient = 0.001 * driftVelocity * samplingRate;
180 
181  double triggerOffset = TriggerOffset();
182 
183  fXTicksOffsets.clear();
184  fXTicksOffsets.resize(geo->Ncryostats());
185 
186  fDriftDirection.clear();
187  fDriftDirection.resize(geo->Ncryostats());
188 
189  for(size_t cstat = 0; cstat < geo->Ncryostats(); ++cstat){
190  fXTicksOffsets[cstat].resize(geo->Cryostat(cstat).NTPC());
191  fDriftDirection[cstat].resize(geo->Cryostat(cstat).NTPC());
192 
193  for(size_t tpc = 0; tpc < geo->Cryostat(cstat).NTPC(); ++tpc) {
194  const geo::TPCGeo& tpcgeom = geo->Cryostat(cstat).TPC(tpc);
195 
196  const double dir((tpcgeom.DriftDirection() == geo::kNegX) ? +1.0 :-1.0);
197  fDriftDirection[cstat][tpc] = dir;
198 
199  int nplane = tpcgeom.Nplanes();
200  fXTicksOffsets[cstat][tpc].resize(nplane, 0.);
201  for(int plane = 0; plane < nplane; ++plane) {
202  const geo::PlaneGeo& pgeom = tpcgeom.Plane(plane);
203 
204 
205  // Get field in gap between planes
206  double efieldgap[3];
207  double driftVelocitygap[3];
208  double fXTicksCoefficientgap[3];
209  for (int igap = 0; igap<3; ++igap){
210  efieldgap[igap] = Efield(igap);
211  driftVelocitygap[igap] = DriftVelocity(efieldgap[igap], temperature);
212  fXTicksCoefficientgap[igap] = 0.001 * driftVelocitygap[igap] * samplingRate;
213  }
214 
215  // Calculate geometric time offset.
216  // only works if xyz[0]<=0
217  const double* xyz = tpcgeom.PlaneLocation(0);
218 
219  fXTicksOffsets[cstat][tpc][plane] = -xyz[0]/(dir * fXTicksCoefficient) + triggerOffset;
220 
221  if (nplane==3){
222  /*
223  | ---------- plane = 2 (collection)
224  | Coeff[2]
225  | ---------- plane = 1 (2nd induction)
226  | Coeff[1]
227  | ---------- plane = 0 (1st induction) x = xyz[0]
228  | Coeff[0]
229  | ---------- x = 0
230  V For plane = 0, t offset is -xyz[0]/Coeff[0]
231  x */
232  for (int ip = 0; ip < plane; ++ip){
233  fXTicksOffsets[cstat][tpc][plane] += tpcgeom.PlanePitch(ip,ip+1)/fXTicksCoefficientgap[ip+1];
234  }
235  }
236  else if (nplane==2){
237  /*
238  | ---------- plane = 1 (collection)
239  | Coeff[2]
240  | ---------- plane = 0 (2nd induction) x = xyz[0]
241  | ---------- x = 0, Coeff[1]
242  V ---------- first induction plane
243  x Coeff[0]
244 For plane = 0, t offset is pitch/Coeff[1] - (pitch+xyz[0])/Coeff[0]
245  = -xyz[0]/Coeff[0] - pitch*(1/Coeff[0]-1/Coeff[1])
246  */
247  for (int ip = 0; ip < plane; ++ip){
248  fXTicksOffsets[cstat][tpc][plane] += tpcgeom.PlanePitch(ip,ip+1)/fXTicksCoefficientgap[ip+2];
249  }
250  fXTicksOffsets[cstat][tpc][plane] -= tpcgeom.PlanePitch()*(1/fXTicksCoefficient-1/fXTicksCoefficientgap[1]);
251  }
252 
253  // Add view dependent offset
254  geo::View_t view = pgeom.View();
255  if(view == geo::kU)
256  fXTicksOffsets[cstat][tpc][plane] += fTimeOffsetU;
257  else if(view == geo::kV)
258  fXTicksOffsets[cstat][tpc][plane] += fTimeOffsetV;
259  else if(view == geo::kZ)
260  fXTicksOffsets[cstat][tpc][plane] += fTimeOffsetZ;
261  else
262  throw cet::exception("DetectorPropertiesServiceArgoNeuT") << "Bad view = "
263  << view << "\n" ;
264  }
265  }
266  }
267 
268  fXTicksParamsLoaded=true;
269  }
double PlanePitch(unsigned int p1=0, unsigned int p2=1) const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.cxx:419
double fTimeOffsetU
time offsets to convert spacepoint
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Planes which measure V.
Definition: geo_types.h:77
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
double fTimeOffsetV
coordinates to hit times on each
double fXTicksCoefficient
Parameters for x<–>ticks.
Geometry information for a single TPC.
Definition: TPCGeo.h:37
Planes which measure Z direction.
Definition: geo_types.h:79
Drift towards negative X values.
Definition: geo_types.h:109
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Planes which measure U.
Definition: geo_types.h:76
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:171
virtual double DriftVelocity(double efield=0., double temperature=0.) const override
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
virtual double Efield(unsigned int planegap=0) const override
< kV/cm
unsigned int NTPC() const
Number of TPCs in this cryostat.
Definition: CryostatGeo.h:155
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
std::vector< std::vector< double > > fDriftDirection
DriftDirection_t DriftDirection() const
Returns an enumerator value describing the drift direction.
Definition: TPCGeo.h:127
virtual double SamplingRate() const override
Returns the period of the TPC readout electronics clock.
TDirectory * dir
Definition: macro.C:5
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
std::vector< std::vector< std::vector< double > > > fXTicksOffsets
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
Namespace collecting geometry-related classes utilities.
const double * PlaneLocation(unsigned int p) const
Returns the coordinates of the center of the specified plane [cm].
Definition: TPCGeo.cxx:413
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void util::DetectorPropertiesServiceArgoNeuT::checkDBstatus ( ) const
private

Definition at line 103 of file DetectorPropertiesServiceArgoNeuT_service.cc.

References fAlreadyReadFromDB.

Referenced by SimpleBoundary().

104 {
105  bool fToughErrorTreatment= art::ServiceHandle<util::DatabaseUtil>()->ToughErrorTreatment();
106  bool fShouldConnect = art::ServiceHandle<util::DatabaseUtil>()->ShouldConnect();
107  //Have not read from DB, should read and requested tough treatment
108  if(!fAlreadyReadFromDB && fToughErrorTreatment && fShouldConnect )
109  throw cet::exception("DetectorPropertiesServiceArgoNeuT") << " Extracting values from DetectorPropertiesServiceArgoNeuT before they "
110  << " have been read in from database. \n "
111  << "Set ToughErrorTreatment or ShouldConnect "
112  << " to false in databaseutil.fcl if you want "
113  << " to avoid this. \n";
114  //Have not read from DB, should read and requested soft treatment
115  else if(!fAlreadyReadFromDB && !fToughErrorTreatment && fShouldConnect )
116  mf::LogWarning("DetectorPropertiesServiceArgoNeuT") << "!!! Extracting values from DetectorPropertiesServiceArgoNeuT before they "
117  << " have been read in from the database. \n "
118  << " You may not be using the correct values of "
119  << " T0!"
120  << " You should not be initializing"
121  << " Database originating values in BeginJob()s or constructors."
122  << " You have been warned !!! \n ";
123 
124  //In other cases, either already read from DB, or should not connect so it doesn't matter
125 }
bool fAlreadyReadFromDB
tests whether the values have alread been picked up from the Database
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double util::DetectorPropertiesServiceArgoNeuT::ConvertTDCToTicks ( double  tdc) const
overridevirtual

Implements detinfo::DetectorProperties.

Definition at line 50 of file DetectorPropertiesServiceArgoNeuT_service.cc.

Referenced by GetXTicksCoefficient().

51  {
52  return lar::providerFrom<detinfo::DetectorClocksService>()->TPCTDC2Tick(tdc);
53  }
double util::DetectorPropertiesServiceArgoNeuT::ConvertTicksToTDC ( double  ticks) const
overridevirtual

Implements detinfo::DetectorProperties.

Definition at line 56 of file DetectorPropertiesServiceArgoNeuT_service.cc.

Referenced by GetXTicksCoefficient().

57  {
58  return lar::providerFrom<detinfo::DetectorClocksService>()->TPCTick2TDC(ticks);
59  }
double util::DetectorPropertiesServiceArgoNeuT::ConvertTicksToX ( double  ticks,
int  p,
int  t,
int  c 
) const
overridevirtual
virtual double util::DetectorPropertiesServiceArgoNeuT::ConvertTicksToX ( double  ticks,
geo::PlaneID const &  planeid 
) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 98 of file DetectorPropertiesServiceArgoNeuT.h.

References ConvertTicksToX(), geo::CryostatID::Cryostat, GetXTicksOffset(), geo::PlaneID::Plane, and geo::TPCID::TPC.

99  { return ConvertTicksToX(ticks, planeid.Plane, planeid.TPC, planeid.Cryostat); }
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const override
double util::DetectorPropertiesServiceArgoNeuT::ConvertXToTicks ( double  X,
int  p,
int  t,
int  c 
) const
overridevirtual
virtual double util::DetectorPropertiesServiceArgoNeuT::ConvertXToTicks ( double  X,
geo::PlaneID const &  planeid 
) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 95 of file DetectorPropertiesServiceArgoNeuT.h.

References ConvertTicksToX(), ConvertXToTicks(), geo::CryostatID::Cryostat, geo::PlaneID::Plane, and geo::TPCID::TPC.

96  { return ConvertXToTicks(X, planeid.Plane, planeid.TPC, planeid.Cryostat); }
virtual double ConvertXToTicks(double X, int p, int t, int c) const override
Float_t X
Definition: plot.C:39
virtual double util::DetectorPropertiesServiceArgoNeuT::Density ( double  temperature) const
inlineoverridevirtual

Returns argon density at a given temperature.

Parameters
temperaturethe temperature in kelvin
Returns
argon density in g/cm^3

Implements detinfo::DetectorProperties.

Definition at line 74 of file DetectorPropertiesServiceArgoNeuT.h.

References util::LArPropertiesServiceArgoNeuT::Density(), and fLP.

75  { return fLP->Density(temperature); }
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
double Density(double temperature=0.) const
g/cm^3
virtual double util::DetectorPropertiesServiceArgoNeuT::Density ( ) const
inlineoverridevirtual

Returns argon density at the temperature from Temperature()

Reimplemented from detinfo::DetectorProperties.

Definition at line 76 of file DetectorPropertiesServiceArgoNeuT.h.

References Density(), and Temperature().

Referenced by Density().

76 { return Density(Temperature()); }
virtual double Density() const override
Returns argon density at the temperature from Temperature()
virtual double util::DetectorPropertiesServiceArgoNeuT::DriftVelocity ( double  efield = 0.,
double  temperature = 0. 
) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 58 of file DetectorPropertiesServiceArgoNeuT.h.

References util::LArPropertiesServiceArgoNeuT::DriftVelocity(), and fLP.

Referenced by CalculateXTicksParams().

59  { return fLP->DriftVelocity(efield, temperature); }
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
virtual double util::DetectorPropertiesServiceArgoNeuT::Efield ( unsigned int  planegap = 0) const
inlineoverridevirtual

< kV/cm

Implements detinfo::DetectorProperties.

Definition at line 55 of file DetectorPropertiesServiceArgoNeuT.h.

References util::LArPropertiesServiceArgoNeuT::Efield(), and fLP.

Referenced by CalculateXTicksParams().

56  { return fLP->Efield(planegap); }
double Efield(unsigned int planegap=0) const
kV/cm
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
virtual double util::DetectorPropertiesServiceArgoNeuT::ElectronLifetime ( ) const
inlineoverridevirtual

Returns the attenuation constant for ionization electrons.

Returns
the attenuation constant [µs]

The returned constant τ can be used to know the attenuation the ionization charge undergoes after drifting for a certain time t: $ A(t) = e^{-t/\tau} $ (t is measured in microseconds).

This is a uniform, constant value for the detector.

Implements detinfo::DetectorProperties.

Definition at line 68 of file DetectorPropertiesServiceArgoNeuT.h.

References util::LArPropertiesServiceArgoNeuT::ElectronLifetime(), and fLP.

69  { return fLP->ElectronLifetime(); }
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
virtual double util::DetectorPropertiesServiceArgoNeuT::ElectronsToADC ( ) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 85 of file DetectorPropertiesServiceArgoNeuT.h.

References fElectronsToADC.

85 { return fElectronsToADC; }
double fElectronsToADC
conversion factor for # of ionization electrons to 1 ADC count
virtual double util::DetectorPropertiesServiceArgoNeuT::Eloss ( double  mom,
double  mass,
double  tcut 
) const
inlineoverridevirtual

Restricted mean energy loss ( $ dE/dx $)

Parameters
mommomentum of incident particle [GeV/c]
massmass of incident particle [GeV/c^2]
tcutmaximum kinetic energy of delta rays [MeV]; 0 for unlimited
Returns
the restricted mean energy loss (dE/dx) in units of MeV/cm

Returned value is always positive. For unrestricted mean energy loss, set tcut = 0 (special case), or tcut large.

Implements detinfo::DetectorProperties.

Definition at line 78 of file DetectorPropertiesServiceArgoNeuT.h.

References util::LArPropertiesServiceArgoNeuT::Eloss(), and fLP.

79  { return fLP->Eloss(mom, mass, tcut); }
double Eloss(double mom, double mass, double tcut) const
Restricted mean dE/dx energy loss (MeV/cm).
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
virtual double util::DetectorPropertiesServiceArgoNeuT::ElossVar ( double  mom,
double  mass 
) const
inlineoverridevirtual

Energy loss fluctuation ( $ \sigma_{E}^2 / x $)

Parameters
mommomentum of incident particle in [GeV/c]
massmass of incident particle [GeV/c^2]
Returns
energy loss fluctuation in MeV^2/cm

Implements detinfo::DetectorProperties.

Definition at line 81 of file DetectorPropertiesServiceArgoNeuT.h.

References util::LArPropertiesServiceArgoNeuT::ElossVar(), and fLP.

82  { return fLP->ElossVar(mom, mass); }
double ElossVar(double mom, double mass) const
Energy loss fluctuation (sigma_E^2 / length in MeV^2/cm).
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
double util::DetectorPropertiesServiceArgoNeuT::GetXTicksCoefficient ( int  t,
int  c 
) const
overridevirtual
virtual double util::DetectorPropertiesServiceArgoNeuT::GetXTicksCoefficient ( geo::TPCID const &  tpcid) const
inlineoverridevirtual
double util::DetectorPropertiesServiceArgoNeuT::GetXTicksCoefficient ( ) const
overridevirtual
double util::DetectorPropertiesServiceArgoNeuT::GetXTicksOffset ( int  p,
int  t,
int  c 
) const
overridevirtual
virtual double util::DetectorPropertiesServiceArgoNeuT::GetXTicksOffset ( geo::PlaneID const &  planeid) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 102 of file DetectorPropertiesServiceArgoNeuT.h.

References geo::CryostatID::Cryostat, GetXTicksCoefficient(), GetXTicksOffset(), geo::PlaneID::Plane, and geo::TPCID::TPC.

103  { return GetXTicksOffset(planeid.Plane, planeid.TPC, planeid.Cryostat); }
virtual double GetXTicksOffset(int p, int t, int c) const override
bool util::DetectorPropertiesServiceArgoNeuT::isDetectorPropertiesServiceArgoNeuT ( const fhicl::ParameterSet ps)
staticprivate

Definition at line 404 of file DetectorPropertiesServiceArgoNeuT_service.cc.

References d, DEFINE_ART_SERVICE_INTERFACE_IMPL, fhicl::ParameterSet::get_if_present(), and s.

Referenced by postOpenFile(), and SimpleBoundary().

405  {
406  // This method uses heuristics to determine whether the parameter
407  // set passed as argument is a DetectorPropertiesServiceArgoNeuT configuration
408  // parameter set.
409 
410  std::string s;
411  double d;
412  int i;
413  unsigned int u;
414 
415  bool result = !ps.get_if_present("module_label", s);
416  result = result && ps.get_if_present("TriggerOffset", i);
417  result = result && ps.get_if_present("SamplingRate", d);
418  result = result && ps.get_if_present("NumberTimeSamples", u);
419  result = result && ps.get_if_present("ReadOutWindowSize", u);
420 
421  return result;
422  }
Float_t s
Definition: plot.C:23
Float_t d
Definition: plot.C:237
bool get_if_present(std::string const &key, T &value) const
Definition: ParameterSet.h:208
virtual double util::DetectorPropertiesServiceArgoNeuT::ModBoxCorrection ( double  dQdX) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 65 of file DetectorPropertiesServiceArgoNeuT.h.

References fLP, and util::LArPropertiesServiceArgoNeuT::ModBoxCorrection().

66  { return fLP->ModBoxCorrection(dQdX); }
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
virtual unsigned int util::DetectorPropertiesServiceArgoNeuT::NumberTimeSamples ( ) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 86 of file DetectorPropertiesServiceArgoNeuT.h.

References fNumberTimeSamples.

86 { return fNumberTimeSamples; }
unsigned int fNumberTimeSamples
number of clock ticks per event
void util::DetectorPropertiesServiceArgoNeuT::postOpenFile ( std::string const &  filename)
private

Definition at line 301 of file DetectorPropertiesServiceArgoNeuT_service.cc.

References file, fInheritNumberTimeSamples, fNumberTimeSamples, fPS, fhicl::ParameterSet::get(), isDetectorPropertiesServiceArgoNeuT(), and fhicl::make_ParameterSet().

Referenced by DetectorPropertiesServiceArgoNeuT(), and SimpleBoundary().

302  {
303  // Use this method to figure out whether to inherit configuration
304  // parameters from previous jobs.
305  //
306  // There is no way currently to correlate parameter sets saved in
307  // sqlite RootFileDB with process history (from MetaData tree).
308  // Therefore, we use the approach of scanning every historical
309  // parameter set in RootFileDB, and finding all parameter sets
310  // that appear to be DetectorPropertiesServiceArgoNeuT configurations. If all
311  // historical parameter sets are in agreement about the value of
312  // an inherited parameter, then we accept the historical value,
313  // print a message, and override the configuration parameter. In
314  // cases where the historical configurations are not in agreement
315  // about the value of an inherited parameter, we ignore any
316  // historical parameter values that are the same as the current
317  // configured value of the parameter (that is, we resolve the
318  // conflict in favor of parameters values that are different than
319  // the current configuration). If two or more historical values
320  // differ from the current configuration, throw an exception.
321  // Note that it is possible to give precendence to the current
322  // configuration by disabling inheritance for that configuration
323  // parameter.
324 
325  // Don't do anything if no parameters are supposed to be inherited.
326 
328  return;
329 
330  // The only way to access art service metadata from the input file
331  // is to open it as a separate TFile object. Do that now.
332 
333  if(filename.size() != 0) {
334 
335  TFile* file = TFile::Open(filename.c_str(), "READ");
336  if(file != 0 && !file->IsZombie() && file->IsOpen()) {
337 
338  // Open the sqlite datatabase.
339 
340  art::SQLite3Wrapper sqliteDB(file, "RootFileDB");
341 
342  // Loop over all stored ParameterSets.
343 
344  unsigned int iNumberTimeSamples = 0; // Combined value of NumberTimeSamples.
345  unsigned int nNumberTimeSamples = 0; // Number of NumberTimeSamples parameters seen.
346 
347  sqlite3_stmt * stmt = 0;
348  sqlite3_prepare_v2(sqliteDB, "SELECT PSetBlob from ParameterSets;", -1, &stmt, NULL);
349  while (sqlite3_step(stmt) == SQLITE_ROW) {
351  fhicl::make_ParameterSet(reinterpret_cast<char const *>(sqlite3_column_text(stmt, 0)), ps);
352  // Is this a DetectorPropertiesServiceArgoNeuT parameter set?
353 
354  bool psok = isDetectorPropertiesServiceArgoNeuT(ps);
355  if(psok) {
356 
357  // Check NumberTimeSamples
358 
360  unsigned int newNumberTimeSamples = ps.get<unsigned int>("NumberTimeSamples");
361 
362  // Ignore parameter values that match the current configuration.
363 
364  if(newNumberTimeSamples != fPS.get<unsigned int>("NumberTimeSamples")) {
365  if(nNumberTimeSamples == 0)
366  iNumberTimeSamples = newNumberTimeSamples;
367  else if(newNumberTimeSamples != iNumberTimeSamples) {
368  throw cet::exception("DetectorPropertiesServiceArgoNeuT")
369  << "Historical values of NumberTimeSamples do not agree: "
370  << iNumberTimeSamples << " " << newNumberTimeSamples << "\n" ;
371  }
372  ++nNumberTimeSamples;
373  }
374  }
375  }
376  }
377 
378  // Done looping over parameter sets.
379  // Now decide which parameters we will actually override.
380 
382  nNumberTimeSamples != 0 &&
383  iNumberTimeSamples != fNumberTimeSamples) {
384  mf::LogInfo("DetectorPropertiesServiceArgoNeuT")
385  << "Overriding configuration parameter NumberTimeSamples using historical value.\n"
386  << " Configured value: " << fNumberTimeSamples << "\n"
387  << " Historical (used) value: " << iNumberTimeSamples << "\n";
388  fNumberTimeSamples = iNumberTimeSamples;
389  }
390  }
391 
392  // Close file.
393  if(file != 0) {
394  if(file->IsOpen())
395  file->Close();
396  delete file;
397  }
398  }
399  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void make_ParameterSet(intermediate_table const &tbl, ParameterSet &ps)
bool fInheritNumberTimeSamples
Flag saying whether to inherit NumberTimeSamples.
T get(std::string const &key) const
Definition: ParameterSet.h:231
fhicl::ParameterSet fPS
Original parameter set.
unsigned int fNumberTimeSamples
number of clock ticks per event
static bool isDetectorPropertiesServiceArgoNeuT(const fhicl::ParameterSet &ps)
TFile * file
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void util::DetectorPropertiesServiceArgoNeuT::preProcessEvent ( const art::Event evt)
private

Definition at line 96 of file DetectorPropertiesServiceArgoNeuT_service.cc.

References fTPCClock.

Referenced by DetectorPropertiesServiceArgoNeuT(), and SimpleBoundary().

97  {
98  // Make sure TPC Clock is updated with DetectorClocksService (though in principle it shouldn't change)
99  fTPCClock = lar::providerFrom<detinfo::DetectorClocksService>()->TPCClock();
100  }
detinfo::ElecClock fTPCClock
TPC electronics clock.
virtual const detinfo::DetectorProperties* util::DetectorPropertiesServiceArgoNeuT::provider ( ) const
inlineoverridevirtual

Returns our service provider, that is this very same class.

Implements detinfo::DetectorPropertiesService.

Definition at line 50 of file DetectorPropertiesServiceArgoNeuT.h.

51  { return this; }
virtual unsigned int util::DetectorPropertiesServiceArgoNeuT::ReadOutWindowSize ( ) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 87 of file DetectorPropertiesServiceArgoNeuT.h.

References fReadOutWindowSize, and TriggerOffset().

87 { return fReadOutWindowSize; }
unsigned int fReadOutWindowSize
number of clock ticks per readout window
void util::DetectorPropertiesServiceArgoNeuT::reconfigure ( fhicl::ParameterSet const &  pset)
overridevirtual

Implements detinfo::DetectorPropertiesService.

Definition at line 62 of file DetectorPropertiesServiceArgoNeuT_service.cc.

References d, fElectronsToADC, fInheritNumberTimeSamples, fNumberTimeSamples, fPS, fReadOutWindowSize, fSimpleBoundary, fTimeOffsetU, fTimeOffsetV, fTimeOffsetZ, fTPCClock, fXTicksParamsLoaded, fhicl::ParameterSet::get(), and fhicl::ParameterSet::get_if_present().

Referenced by DetectorPropertiesServiceArgoNeuT().

63  {
64  //fSamplingRate = p.get< double >("SamplingRate" );
65  double d;
66  int i;
67  bool b;
68  if(p.get_if_present<double>("SamplingRate",d))
69  throw cet::exception(__FUNCTION__) << "SamplingRate is a deprecated fcl parameter for DetectorPropertiesServiceArgoNeuT!";
70  if(p.get_if_present<int>("TriggerOffset",i))
71  throw cet::exception(__FUNCTION__) << "TriggerOffset is a deprecated fcl parameter for DetectorPropertiesServiceArgoNeuT!";
72  if(p.get_if_present<bool>("InheritTriggerOffset",b))
73  throw cet::exception(__FUNCTION__) << "InheritTriggerOffset is a deprecated fcl parameter for DetectorPropertiesServiceArgoNeuT!";
74 
75  fElectronsToADC = p.get< double >("ElectronsToADC" );
76  fNumberTimeSamples = p.get< unsigned int >("NumberTimeSamples");
77  fReadOutWindowSize = p.get< unsigned int >("ReadOutWindowSize");
78  fTimeOffsetU = p.get< double >("TimeOffsetU" );
79  fTimeOffsetV = p.get< double >("TimeOffsetV" );
80  fTimeOffsetZ = p.get< double >("TimeOffsetZ" );
81  fInheritNumberTimeSamples = p.get<bool >("InheritNumberTimeSamples", false);
82 
83  fSimpleBoundary = p.get<bool >("SimpleBoundaryProcess", true);
84 
85  fXTicksParamsLoaded = false;
86 
87  fTPCClock = lar::providerFrom<detinfo::DetectorClocksService>()->TPCClock();
88 
89  // Save the parameter set.
90  fPS = p;
91 
92  return;
93  }
double fTimeOffsetU
time offsets to convert spacepoint
double fTimeOffsetV
coordinates to hit times on each
double fElectronsToADC
conversion factor for # of ionization electrons to 1 ADC count
bool fInheritNumberTimeSamples
Flag saying whether to inherit NumberTimeSamples.
Float_t d
Definition: plot.C:237
unsigned int fReadOutWindowSize
number of clock ticks per readout window
fhicl::ParameterSet fPS
Original parameter set.
unsigned int fNumberTimeSamples
number of clock ticks per event
detinfo::ElecClock fTPCClock
TPC electronics clock.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual double util::DetectorPropertiesServiceArgoNeuT::SamplingRate ( ) const
inlineoverridevirtual

Returns the period of the TPC readout electronics clock.

Returns
the period of the TPC readout electronics clock [µs]
See also
detinfo::DetectorClocks::TPCClock()

Implements detinfo::DetectorProperties.

Definition at line 84 of file DetectorPropertiesServiceArgoNeuT.h.

References fTPCClock, and detinfo::ElecClock::TickPeriod().

Referenced by CalculateXTicksParams().

84 { return fTPCClock.TickPeriod() * 1.e3; }
double TickPeriod() const
A single tick period in microseconds.
Definition: ElecClock.h:342
detinfo::ElecClock fTPCClock
TPC electronics clock.
virtual bool util::DetectorPropertiesServiceArgoNeuT::SimpleBoundary ( ) const
inlineoverridevirtual
virtual double util::DetectorPropertiesServiceArgoNeuT::Temperature ( ) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 71 of file DetectorPropertiesServiceArgoNeuT.h.

References fLP, and util::LArPropertiesServiceArgoNeuT::Temperature().

Referenced by Density().

72  { return fLP->Temperature(); }
util::LArPropertiesServiceArgoNeuT const * fLP
Pointer to the specific LArPropertiesServiceArgoNeuT service (provider)
virtual double util::DetectorPropertiesServiceArgoNeuT::TimeOffsetU ( ) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 89 of file DetectorPropertiesServiceArgoNeuT.h.

References fTimeOffsetU.

89 { return fTimeOffsetU; }
double fTimeOffsetU
time offsets to convert spacepoint
virtual double util::DetectorPropertiesServiceArgoNeuT::TimeOffsetV ( ) const
inlineoverridevirtual

Implements detinfo::DetectorProperties.

Definition at line 90 of file DetectorPropertiesServiceArgoNeuT.h.

References fTimeOffsetV.

90 { return fTimeOffsetV; }
double fTimeOffsetV
coordinates to hit times on each
virtual double util::DetectorPropertiesServiceArgoNeuT::TimeOffsetY ( ) const
inlineoverridevirtual

Reimplemented from detinfo::DetectorProperties.

Definition at line 92 of file DetectorPropertiesServiceArgoNeuT.h.

References ConvertXToTicks(), and X.

92 { return 0; }
virtual double util::DetectorPropertiesServiceArgoNeuT::TimeOffsetZ ( ) const
inlineoverridevirtual
int util::DetectorPropertiesServiceArgoNeuT::TriggerOffset ( ) const
overridevirtual

Implements detinfo::DetectorProperties.

Definition at line 128 of file DetectorPropertiesServiceArgoNeuT_service.cc.

References fTPCClock, and detinfo::ElecClock::Ticks().

Referenced by CalculateXTicksParams(), and ReadOutWindowSize().

129 {
130  return fTPCClock.Ticks(lar::providerFrom<detinfo::DetectorClocksService>()->TriggerOffsetTPC() * -1.);
131 }
int Ticks() const
Current clock tick (that is, the number of tick Time() falls in).
Definition: ElecClock.h:235
detinfo::ElecClock fTPCClock
TPC electronics clock.

Member Data Documentation

bool util::DetectorPropertiesServiceArgoNeuT::fAlreadyReadFromDB
private

tests whether the values have alread been picked up from the Database

Definition at line 151 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by checkDBstatus().

std::vector<std::vector<double> > util::DetectorPropertiesServiceArgoNeuT::fDriftDirection
mutableprivate
double util::DetectorPropertiesServiceArgoNeuT::fElectronsToADC
private

conversion factor for # of ionization electrons to 1 ADC count

Definition at line 134 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by ElectronsToADC(), and reconfigure().

bool util::DetectorPropertiesServiceArgoNeuT::fInheritNumberTimeSamples
private

Flag saying whether to inherit NumberTimeSamples.

Definition at line 141 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by postOpenFile(), and reconfigure().

unsigned int util::DetectorPropertiesServiceArgoNeuT::fNumberTimeSamples
private

number of clock ticks per event

Definition at line 135 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by NumberTimeSamples(), postOpenFile(), and reconfigure().

fhicl::ParameterSet util::DetectorPropertiesServiceArgoNeuT::fPS
private

Original parameter set.

Definition at line 149 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by postOpenFile(), and reconfigure().

unsigned int util::DetectorPropertiesServiceArgoNeuT::fReadOutWindowSize
private

number of clock ticks per readout window

Definition at line 136 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by ReadOutWindowSize(), and reconfigure().

bool util::DetectorPropertiesServiceArgoNeuT::fSimpleBoundary
private

Definition at line 158 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by reconfigure(), and SimpleBoundary().

double util::DetectorPropertiesServiceArgoNeuT::fTimeOffsetU
private

time offsets to convert spacepoint

Definition at line 137 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by CalculateXTicksParams(), reconfigure(), and TimeOffsetU().

double util::DetectorPropertiesServiceArgoNeuT::fTimeOffsetV
private

coordinates to hit times on each

Definition at line 138 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by CalculateXTicksParams(), reconfigure(), and TimeOffsetV().

double util::DetectorPropertiesServiceArgoNeuT::fTimeOffsetZ
private

view

Definition at line 139 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by CalculateXTicksParams(), reconfigure(), and TimeOffsetZ().

detinfo::ElecClock util::DetectorPropertiesServiceArgoNeuT::fTPCClock
private

TPC electronics clock.

Definition at line 153 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by preProcessEvent(), reconfigure(), SamplingRate(), and TriggerOffset().

double util::DetectorPropertiesServiceArgoNeuT::fXTicksCoefficient
mutableprivate

Parameters for x<–>ticks.

Definition at line 144 of file DetectorPropertiesServiceArgoNeuT.h.

Referenced by CalculateXTicksParams(), ConvertTicksToX(), ConvertXToTicks(), and GetXTicksCoefficient().

std::vector<std::vector<std::vector<double> > > util::DetectorPropertiesServiceArgoNeuT::fXTicksOffsets
mutableprivate
bool util::DetectorPropertiesServiceArgoNeuT::fXTicksParamsLoaded
mutableprivate

The documentation for this class was generated from the following files: