18 #include "cetlib/pow.h" 28 std::string CheckTimeOffsets(std::set<geo::View_t>
const& requested_views,
31 auto const& present_views = wireReadoutGeom.
Views();
33 auto view_diff = [&present_views, &requested_views](
geo::View_t const view) {
34 return static_cast<int>(present_views.count(view)) -
35 static_cast<int>(requested_views.count(view));
41 std::ostringstream errors;
42 if (
auto diff = view_diff(
geo::kU); diff > 0) { errors <<
"TimeOffsetU missing for view U.\n"; }
43 if (
auto diff = view_diff(
geo::kV); diff > 0) { errors <<
"TimeOffsetV missing for view V.\n"; }
44 if (
auto diff = view_diff(
geo::kZ); diff > 0) { errors <<
"TimeOffsetZ missing for view Z.\n"; }
45 if (
auto diff = view_diff(
geo::kY); diff > 0) { errors <<
"TimeOffsetY missing for view Y.\n"; }
46 if (
auto diff = view_diff(
geo::kX); diff > 0) { errors <<
"TimeOffsetX missing for view X.\n"; }
59 std::set<std::string>
const& ignore_params)
60 : fLP(lp), fGeo(geo), fChannelMap(wireReadoutGeom)
67 std::set<std::string>
const& ignore_params)
72 debug <<
"Asked to ignore " << ignore_params.size() <<
" keys:";
73 for (
auto const& key : ignore_params)
74 debug <<
" '" << key <<
"'";
78 ignorable_keys.insert(ignore_params.begin(), ignore_params.end());
90 std::set<geo::View_t> present_views;
97 std::string
const errors = CheckTimeOffsets(present_views, *
fChannelMap);
98 if (!errors.empty()) {
99 throw cet::exception(
"DetectorPropertiesStandard") <<
"Detected configuration errors: \n" 124 if (planegap >=
fEfield.size())
126 <<
"requesting Electric field in a plane gap that is not defined\n";
135 if (temperature == 0.) temperature =
Temperature();
137 return -0.00615 * temperature + 1.928;
160 constexpr
double K = 0.307075;
161 constexpr
double me = 0.510998918;
164 double const bg = mom / mass;
165 double const gamma = sqrt(1. + bg * bg);
166 double const beta = bg / gamma;
167 double const mer = 0.001 * me / mass;
169 2. * me * bg * bg / (1. + 2. * gamma * mer + mer * mer);
172 if (tcut == 0. || tcut > tmax) tcut = tmax;
175 double const x = std::log10(bg);
187 0.5 * beta * beta * (1. + tcut / tmax) - 0.5 * delta;
200 constexpr
double K = 0.307075;
201 constexpr
double me = 0.510998918;
204 double const bg = mom / mass;
205 double const gamma2 = 1. + bg * bg;
206 double const beta2 = bg * bg / gamma2;
225 if (efield == 0.) efield =
Efield();
229 <<
"DriftVelocity Warning! : E-field value of " << efield
230 <<
" kV/cm is outside of range covered by drift velocity parameterization. Returned value " 231 "may not be correct";
234 if (temperature == 0.) temperature =
Temperature();
236 if (temperature < 87.0 || temperature > 94.0)
238 <<
"DriftVelocity Warning! : Temperature value of " << temperature
239 <<
" K is outside of range covered by drift velocity parameterization. Returned value may " 245 double const tshift = -87.203 + temperature;
246 double const xFit = 0.0938163 - 0.0052563 * tshift - 0.0001470 * tshift * tshift;
247 double const uFit = 5.18406 + 0.01448 * tshift - 0.003497 * tshift * tshift -
248 0.000516 * tshift * tshift * tshift;
251 constexpr
double P1 = -0.04640;
252 constexpr
double P2 = 0.01712;
253 constexpr
double P3 = 1.88125;
254 constexpr
double P4 = 0.99408;
255 constexpr
double P5 = 0.01172;
256 constexpr
double P6 = 4.20214;
257 constexpr
double T0 = 105.749;
260 constexpr
double P1W = -0.01481;
261 constexpr
double P2W = -0.0075;
262 constexpr
double P3W = 0.141;
263 constexpr
double P4W = 12.4;
264 constexpr
double P5W = 1.627;
265 constexpr
double P6W = 0.317;
266 constexpr
double T0W = 90.371;
273 else if (efield < 0.619) {
274 vd = ((P1 * (temperature - T0) + 1) *
275 (P3 * efield * std::log(1 + P4 / efield) + P5 * std::pow(efield, P6)) +
276 P2 * (temperature - T0));
278 else if (efield < 0.699) {
279 vd = 12.5 * (efield - 0.619) *
280 ((P1W * (temperature - T0W) + 1) *
281 (P3W * efield * std::log(1 + P4W / efield) + P5W * std::pow(efield, P6W)) +
282 P2W * (temperature - T0W)) +
283 12.5 * (0.699 - efield) *
284 ((P1 * (temperature - T0) + 1) *
285 (P3 * efield * std::log(1 + P4 / efield) + P5 * std::pow(efield, P6)) +
286 P2 * (temperature - T0));
289 vd = ((P1W * (temperature - T0W) + 1) *
290 (P3W * efield * std::log(1 + P4W / efield) + P5W * std::pow(efield, P6W)) +
291 P2W * (temperature - T0W));
298 constexpr
double P0 = 0.;
299 constexpr
double P1 = 5.53416;
300 constexpr
double P2 = -6.53093;
301 constexpr
double P3 = 3.20752;
302 constexpr
double P4 = 0.389696;
303 constexpr
double P5 = -0.556184;
304 vd = (1.0 - 0.0184 * (temperature - 89.0)) *
305 (P0 + P1 * cet::pow<1>(efield) + P2 * cet::pow<2>(efield) + P3 * cet::pow<3>(efield) +
306 P4 * cet::pow<4>(efield) + P5 * cet::pow<5>(efield));
337 double const dEdx = dQdx / (A3t / Wion - K3t / E_field * dQdx);
354 double const Beta =
fModBoxB / (rho * E_field);
356 double const dEdx = (exp(Beta * Wion * dQdx) - Alpha) / Beta;
375 double const efield =
Efield();
377 double const driftVelocity =
DriftVelocity(efield, temperature);
378 double const x_ticks_coefficient = 0.001 * driftVelocity * samplingRate;
382 std::vector<std::vector<std::vector<double>>> x_ticks_offsets(
fGeo->
Ncryostats());
383 std::vector<std::vector<double>> drift_direction(
fGeo->
Ncryostats());
387 x_ticks_offsets[cstat].resize(cryostat.NTPC());
388 drift_direction[cstat].resize(cryostat.NTPC());
390 for (
size_t tpc = 0; tpc < cryostat.NTPC(); ++tpc) {
392 auto const& tpcid = tpcgeom.
ID();
395 drift_direction[cstat][tpc] =
dir;
398 x_ticks_offsets[cstat][tpc].resize(nplane, 0.);
407 auto const xyz =
fChannelMap->
Plane({tpcid, planeToPropagateTo}).GetCenter();
409 unsigned int const plane = pgeom.
ID().
Plane;
410 x_ticks_offsets[cstat][tpc][plane] =
411 -xyz.X() / (dir * x_ticks_coefficient) + triggerOffset;
416 double driftVelocitygap[3];
417 double x_ticks_coefficient_gap[3];
418 for (
int igap = 0; igap < 3; ++igap) {
419 efieldgap[igap] =
Efield(igap);
420 driftVelocitygap[igap] =
DriftVelocity(efieldgap[igap], temperature);
421 x_ticks_coefficient_gap[igap] = 0.001 * driftVelocitygap[igap] * samplingRate;
435 for (
unsigned int ip = 0; ip < plane; ++ip) {
436 x_ticks_offsets[cstat][tpc][plane] +=
440 else if (nplane == 2) {
452 for (
unsigned int ip = 0; ip < plane; ++ip) {
453 x_ticks_offsets[cstat][tpc][plane] +=
456 x_ticks_offsets[cstat][tpc][plane] -=
458 (1 / x_ticks_coefficient - 1 / x_ticks_coefficient_gap[1]);
472 default:
throw cet::exception(__FUNCTION__) <<
"Bad view = " << view <<
"\n";
479 *
this, x_ticks_coefficient, move(x_ticks_offsets), move(drift_direction)};
double TimeOffsetU() const override
Encapsulate the construction of a single cyostat .
DetectorPropertiesStandard(fhicl::ParameterSet const &pset, geo::GeometryCore const *geo, geo::WireReadoutGeom const *wireReadoutGeom, detinfo::LArProperties const *lp, std::set< std::string > const &ignore_params={})
double fTemperature
kelvin
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
double Efield(unsigned int planegap=0) const override
kV/cm
void ValidateAndConfigure(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params)
Configures the provider, first validating the configuration.
double ElossVar(double mom, double mass) const override
Energy loss fluctuation ( )
Planes which measure X direction.
Geometry information for a single TPC.
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
double Temperature() const override
In kelvin.
virtual double Density() const
Returns argon density at the temperature from Temperature()
double PlanePitch(TPCID const &tpcid, unsigned int p1=0, unsigned int p2=1) const
Planes which measure Z direction.
double TimeOffsetZ() const override
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
double cbar
parameter Cbar
DetectorPropertiesData DataFor(detinfo::DetectorClocksData const &clock_data) const override
Planes which measure Y direction.
virtual double ExcitationEnergy() const =0
Mean excitation energy of the liquid (eV)
Access the description of the physical detector geometry.
virtual double AtomicMass() const =0
Atomic mass of the liquid (g/mol)
constexpr double kGeVToElectrons
23.6eV per ion pair, 1e9 eV/GeV
std::set< View_t > const & Views() const
Returns a list of possible views in the detector.
bool fIncludeInterPlanePitchInXTickOffsets
Interface for a class providing readout channel mapping to geometry.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
SternheimerParameters_t fSternheimerParameters
Sternheimer parameters.
double TimeOffsetY() const override
constexpr int to_int(Coordinate const coord) noexcept
Enumerate the possible plane projections.
std::set< std::string > const & IgnorableProviderConfigKeys()
Returns a list of configuration keys that providers should ignore.
geo::GeometryCore const * fGeo
General LArSoft Utilities.
geo::DriftSign DriftSign() const
Returns the expected drift direction based on geometry.
PlaneID_t Plane
Index of the plane within its TPC.
Description of the physical geometry of one entire detector.
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
CryostatGeo const & Cryostat(CryostatID const &cryoid=details::cryostat_zero) const
Returns the specified cryostat.
detinfo::LArProperties const * fLP
double TimeOffsetV() const override
unsigned int Nplanes(TPCID const &tpcid=details::tpc_zero) const
Returns the total number of planes in the specified TPC.
double ModBoxCorrection(double dQdX) const override
double fElectronlifetime
microseconds
Encapsulate the construction of a single detector plane .
Contains all timing reference information for the detector.
unsigned int fReadOutWindowSize
number of clock ticks per readout window
virtual double AtomicNumber() const =0
Atomic number of the liquid.
constexpr double kRecombk
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
range_type< T > Iterate() const
int trigger_offset(DetectorClocksData const &data)
std::vector< double > fEfield
kV/cm (per inter-plane volume) !
Simple utilities for service providers.
geo::WireReadoutGeom const * fChannelMap
constexpr double kRecombA
A constant.
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
double DriftVelocity(double efield=0., double temperature=0.) const override
cm/us
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
TPCID const & ID() const
Returns the identifier of this TPC.
PlaneID const & ID() const
Returns the identifier of this plane.
Interface to geometry for wire readouts .
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane .
double Eloss(double mom, double mass, double tcut) const override
Restricted mean energy loss (dE/dx)
The data type to uniquely identify a cryostat.
double fDriftVelFudgeFactor
bool fUseIcarusMicrobooneDriftModel