28 #include "art_root_io/RootDB/SQLite3Wrapper.h" 29 #include "ifdh_art/IFDHService/IFDH_service.h" 51 inline T sqr(
T v) {
return v*v; }
66 std::set<std::string>
const& ignore_params
73 debug <<
"Asked to ignore " << ignore_params.size() <<
" keys:";
74 for (
auto const&
key: ignore_params) debug <<
" '" <<
key <<
"'";
84 std::set<std::string>
const& ignore_params
87 providers.
get<
geo::GeometryCore>(),
99 if ((run > 5903) & (run < 6930)){
102 else if (run >= 6930)
119 auto metadata=ifdh->getMetadata(filename);
121 std::string window_str=
"DUNE_data.readout_window: ";
122 if(
metadata.find(window_str)!=std::string::npos){
124 n1 += window_str.length();
126 double window=std::stod(
metadata.substr(n1, n2-n1));
130 std::cout<<
"Setting ReadOutWindowSize and NumberTimeSamples as : "<<
fReadOutWindowSize<<
" (Ticks), Value retrieved from Metadata"<<
std::endl;
133 std::cout<<
"Run has no specific readout window size entry in Metadata, default to fcl configured value : "<<
fReadOutWindowSize<<
" (Ticks)"<<
std::endl;
157 auto metadata=ifdh->getMetadata(filename);
161 if(
metadata.find(run_str)!=std::string::npos){
163 n1 += run_str.length();
165 run = std::stoi(
metadata.substr(n1, n2-n1));
166 std::cout<<
"Run number from metadata: "<<run<<
std::endl;
170 if(
metadata.find(hv_str)!=std::string::npos){
172 n1 += hv_str.length();
176 std::cout<<
"Using HV on cathode as: "<<
fHV_cath<<
"KV, Value retreived from samweb MetaData"<<
std::endl;
179 std::cout<<
"HV Metadata entry not found"<<
std::endl;
180 std::cout<<
"Run has no nomninal HV value entered in Metadata, default to 180KV"<<
std::endl;
186 double Gplane_bias=(-0.665);
187 double Uplane_bias=(-0.370);
188 double Vplane_bias=0;
189 double Xplane_bias=(0.820);
196 fEfield={
fHV_cath/360,std::fabs(Gplane_bias-Uplane_bias)/0.47625,std::fabs(Uplane_bias-Vplane_bias)/0.47625,std::fabs(Vplane_bias-Xplane_bias)/0.47625};
260 std::set<std::string>
const& ignore_params
263 ignorable_keys.insert(ignore_params.begin(), ignore_params.end());
275 std::set<std::string>
const& ignore_params
296 throw cet::exception(
"DetectorPropertiesStandard") <<
"requesting Electric field in a plane gap that is not defined\n";
307 if(temperature == 0.)
310 double density = -0.00615*temperature + 1.928;
338 double me = 0.510998918;
342 double bg = mom / mass;
343 double gamma = sqrt(1. + bg*bg);
345 double mer = 0.001 * me / mass;
346 double tmax = 2.*me* bg*bg / (1. + 2.*gamma*mer + mer*mer);
350 if(tcut == 0. || tcut > tmax)
355 double x = std::log10(bg);
366 - 0.5 * beta*beta * (1. + tcut / tmax) - 0.5 * delta;
388 double me = 0.510998918;
392 double bg = mom / mass;
393 double gamma2 = 1. + bg*bg;
394 double beta2 = bg*bg / gamma2;
413 mf::LogWarning(
"DetectorPropertiesStandard") <<
"DriftVelocity Warning! : E-field value of " 415 <<
" kV/cm is outside of range covered by drift" 416 <<
" velocity parameterization. Returned value" 417 <<
" may not be correct";
419 if(temperature == 0.)
421 if(temperature < 87.0 || temperature > 94.0)
422 mf::LogWarning(
"DetectorPropertiesStandard") <<
"DriftVelocity Warning! : Temperature value of " 424 <<
" K is outside of range covered by drift velocity" 425 <<
" parameterization. Returned value may not be" 427 double tshift = -87.203+temperature;
428 double xFit = 0.0938163-0.0052563*tshift-0.0001470*tshift*tshift;
429 double uFit = 5.18406+0.01448*tshift-0.003497*tshift*tshift-0.000516*tshift*tshift*tshift;
432 double P1 = -0.04640;
440 double P1W = -0.01481;
441 double P2W = -0.0075;
450 if (efield < xFit) vd=efield*uFit;
451 else if (efield<0.619) {
452 vd = ((P1*(temperature-T0)+1)
453 *(P3*efield*std::log(1+P4/efield) + P5*
std::pow(efield,P6))
454 +P2*(temperature-T0));
456 else if (efield<0.699) {
457 vd = 12.5*(efield-0.619)*((P1W*(temperature-T0W)+1)
458 *(P3W*efield*std::log(1+P4W/efield) + P5W*
std::pow(efield,P6W))
459 +P2W*(temperature-T0W))+
460 12.5*(0.699-efield)*((P1*(temperature-T0)+1)
461 *(P3*efield*std::log(1+P4/efield) + P5*
std::pow(efield,P6))
462 +P2*(temperature-T0));
465 vd = ((P1W*(temperature-T0W)+1)
466 *(P3W*efield*std::log(1+P4W/efield) + P5W*
std::pow(efield,P6W))
467 +P2W*(temperature-T0W));
496 double dEdx = dQdx/(A3t/Wion-K3t/E_field*dQdx);
515 double dEdx = (exp(Beta * Wion * dQdx ) - Alpha) / Beta;
525 if (!
fLP)
throw cet::exception(__FUNCTION__) <<
"LArPropertiesStandard is uninitialized!";
542 double const x_ticks_coefficient = 0.001 * driftVelocity * samplingRate;
544 std::vector<std::vector<std::vector<double>>> x_ticks_offsets(
fGeo->
Ncryostats());
545 std::vector<std::vector<double>> drift_direction(
fGeo->
Ncryostats());
552 drift_direction[cstat][tpc] =
dir;
553 int nplane = tpcgeom.
Nplanes();
554 x_ticks_offsets[cstat][tpc].resize(nplane, 0.);
556 for(
int plane = 0; plane < nplane; ++plane) {
559 x_ticks_offsets[cstat][tpc][plane] = -xyz[0]/(dir * x_ticks_coefficient) + triggerOffset;
581 throw cet::exception(__FUNCTION__) <<
"Bad view = " << view <<
"\n" ;
594 std::ostringstream errors;
599 errors <<
"TimeOffsetU has been specified, but no U view is present.\n";
601 errors <<
"TimeOffsetU missing for view U.\n";
605 errors <<
"TimeOffsetV has been specified, but no V view is present.\n";
607 errors <<
"TimeOffsetV missing for view Z.\n";
611 errors <<
"TimeOffsetZ has been specified, but no Z view is present.\n";
613 errors <<
"TimeOffsetZ missing for view Z.\n";
617 errors <<
"TimeOffsetY has been specified, but no Y view is present.\n";
619 errors <<
"TimeOffsetY missing for view Y.\n";
623 errors <<
"TimeOffsetX has been specified, but no X view is present.\n";
625 errors <<
"TimeOffsetX missing for view X.\n";
639 if (!errors.empty()) {
641 <<
"Detected configuration errors: \n" << errors;
bool UpdateReadoutWindowSize(detinfo::DetectorClocksData const &clockData, std::string filename)
bool UpdateHV(std::string filename)
double fTimeOffsetZ
time offset to convert spacepoint coordinates to hit times on view Z
bool fUseRunDependentTemperature
fhicl::Atom< double > Electronlifetime
double beta(double KE, const simb::MCParticle *part)
std::string CheckTimeOffsetConfigurationAfterSetup() const
Checks the configuration of time offsets.
void Configure(Configuration_t const &config)
Extracts the relevant configuration from the specified object.
Encapsulate the construction of a single cyostat.
void CheckConfigurationAfterSetup() const
double fTimeOffsetX
time offset to convert spacepoint coordinates to hit times on view X
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
fhicl::OptionalAtom< double > TimeOffsetY
fhicl::Atom< unsigned int > ReadOutWindowSize
unsigned int Nplanes() const
Number of planes in this tpc.
double fHasTimeOffsetU
whether time offset was configured for view U
std::set< geo::View_t > const & Views() const
Returns a list of possible views in the detector.
double fTimeOffsetU
time offset to convert spacepoint coordinates to hit times on view U
fhicl::Atom< unsigned int > NumberTimeSamples
fhicl::Sequence< double > Efield
Planes which measure X direction.
Geometry information for a single TPC.
virtual double BirksCorrection(double dQdX) const override
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
fhicl::OptionalAtom< double > TimeOffsetX
DetectorPropertiesProtoDUNEsp()
double fElectronsToADC
conversion factor for # of ionization electrons to 1 ADC count
Planes which measure Z direction.
Provider const * get() const
Returns the provider with the specified type.
fhicl::Atom< double > ElectronsToADC
void ValidateAndConfigure(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params={})
Configures the provider, first validating the configuration.
Drift towards negative X values.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
fhicl::Atom< double > SternheimerCbar
double fHasTimeOffsetZ
whether time offset was configured for view Z
tick ticks
Alias for common language habits.
double fTimeOffsetY
time offset to convert spacepoint coordinates to hit times on view Y
fhicl::Atom< bool > fGetReadOutWindowSizefromMetaData
Planes which measure Y direction.
fhicl::OptionalAtom< double > TimeOffsetV
detinfo::DetectorPropertiesData DataFor(const detinfo::DetectorClocksData &clockData) const override
art framework interface to geometry description
bool fGetReadOutWindowSizefromMetaData
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Structure for configuration parameters.
virtual double ExcitationEnergy() const =0
Mean excitation energy of the liquid (eV)
detinfo::DetectorPropertiesData CalculateXTicksParams(detinfo::DetectorClocksData const &clockData) const
View_t View() const
Which coordinate does this plane measure.
virtual double DriftVelocity(double efield=0., double temperature=0.) const override
cm/us
virtual double AtomicMass() const =0
Atomic mass of the liquid (g/mol)
fhicl::Atom< bool > SimpleBoundary
constexpr double kGeVToElectrons
23.6eV per ion pair, 1e9 eV/GeV
virtual double Eloss(double mom, double mass, double tcut) const override
Restricted mean energy loss (dE/dx)
double dEdx(float dqdx, float Efield)
double cbar
parameter Cbar
double fHasTimeOffsetX
whether time offset was configured for view X
fhicl::Atom< double > Temperature
constexpr double kModBoxB
Modified Box Beta in g/(MeV cm²)*kV/cm.
bool fGetHVDriftfromMetaData
double fElectronlifetime
microseconds
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
void SetGeometry(const geo::GeometryCore *g)
General LArSoft Utilities.
std::vector< double > fEfield
kV/cm (per inter-plane volume)
unsigned int NTPC() const
Number of TPCs in this cryostat.
ElecClock const & TPCClock() const noexcept
Borrow a const TPC clock with time set to Trigger time [us].
std::set< std::string > const & IgnorableProviderConfigKeys()
Returns a list of configuration keys that providers should ignore.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
unsigned int fNumberTimeSamples
number of clock ticks per event
const geo::GeometryCore * fGeo
virtual double ModBoxCorrection(double dQdX) const override
General LArSoft Utilities.
Description of geometry of one entire detector.
double gamma(double KE, const simb::MCParticle *part)
DriftDirection_t DriftDirection() const
Returns an enumerator value describing the drift direction.
fhicl::Atom< double > SternheimerA
fhicl::OptionalAtom< double > TimeOffsetZ
unsigned int fReadOutWindowSize
number of clock ticks per readout window
fhicl::Atom< double > SternheimerX1
Configuration_t ValidateConfiguration(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params={})
Validates the specified configuration.
virtual double Efield(unsigned int planegap=0) const override
kV/cm
Encapsulate the construction of a single detector plane.
Contains all timing reference information for the detector.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
double fTimeOffsetV
time offset to convert spacepoint coordinates to hit times on view V
void CheckIfConfigured() const
const detinfo::LArProperties * fLP
double fTemperature
kelvin
Container for a list of pointers to providers.
virtual double AtomicNumber() const =0
Atomic number of the liquid.
constexpr double kRecombk
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
fhicl::Atom< bool > fGetHVDriftfromMetaData
int trigger_offset(DetectorClocksData const &data)
virtual double Temperature() const override
In kelvin.
Access the description of detector geometry.
fhicl::Atom< double > SternheimerK
SternheimerParameters_t fSternheimerParameters
Sternheimer parameters.
virtual double ElossVar(double mom, double mass) const override
Energy loss fluctuation ( )
fhicl::Atom< double > SternheimerX0
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
constexpr double kRecombA
A constant.
auto const & get(AssnsNode< L, R, D > const &r)
constexpr double kModBoxA
Modified Box Alpha.
Collection of Physical constants used in LArSoft.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
LArSoft geometry interface.
void Setup(providers_type providers)
Sets all the providers at once.
const double * PlaneLocation(unsigned int p) const
virtual double Density() const override
Returns argon density at the temperature from Temperature()
double fHasTimeOffsetY
whether time offset was configured for view Y
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
fhicl::Atom< bool > fUseRunDependentTemperature
Encapsulate the construction of a single detector plane.
fhicl::OptionalAtom< double > TimeOffsetU
void SetLArProperties(const detinfo::LArProperties *lp)
double fHasTimeOffsetV
whether time offset was configured for view V