17 #include "cetlib/pow.h" 32 std::set<std::string>
const& ignore_params)
40 std::set<std::string>
const& ignore_params)
45 debug <<
"Asked to ignore " << ignore_params.size() <<
" keys:";
46 for (
auto const& key : ignore_params)
47 debug <<
" '" << key <<
"'";
51 ignorable_keys.insert(ignore_params.begin(), ignore_params.end());
63 std::set<geo::View_t> present_views;
71 if (!errors.empty()) {
72 throw cet::exception(
"DetectorPropertiesStandard") <<
"Detected configuration errors: \n" 99 <<
"requesting Electric field in a plane gap that is not defined\n";
108 if (temperature == 0.) temperature =
Temperature();
110 return -0.00615 * temperature + 1.928;
133 constexpr
double K = 0.307075;
134 constexpr
double me = 0.510998918;
137 double const bg = mom / mass;
138 double const gamma = sqrt(1. + bg * bg);
139 double const beta = bg / gamma;
140 double const mer = 0.001 * me / mass;
142 2. * me * bg * bg / (1. + 2. * gamma * mer + mer * mer);
145 if (tcut == 0. || tcut > tmax) tcut = tmax;
148 double const x = std::log10(bg);
160 0.5 * beta * beta * (1. + tcut / tmax) - 0.5 * delta;
173 constexpr
double K = 0.307075;
174 constexpr
double me = 0.510998918;
177 double const bg = mom / mass;
178 double const gamma2 = 1. + bg * bg;
179 double const beta2 = bg * bg / gamma2;
198 if (efield == 0.) efield =
Efield();
202 <<
"DriftVelocity Warning! : E-field value of " << efield
203 <<
" kV/cm is outside of range covered by drift" 204 <<
" velocity parameterization. Returned value" 205 <<
" may not be correct";
208 if (temperature == 0.) temperature =
Temperature();
210 if (temperature < 87.0 || temperature > 94.0)
212 <<
"DriftVelocity Warning! : Temperature value of " << temperature
213 <<
" K is outside of range covered by drift velocity" 214 <<
" parameterization. Returned value may not be" 220 double const tshift = -87.203 + temperature;
221 double const xFit = 0.0938163 - 0.0052563 * tshift - 0.0001470 * tshift * tshift;
222 double const uFit = 5.18406 + 0.01448 * tshift - 0.003497 * tshift * tshift -
223 0.000516 * tshift * tshift * tshift;
226 constexpr
double P1 = -0.04640;
227 constexpr
double P2 = 0.01712;
228 constexpr
double P3 = 1.88125;
229 constexpr
double P4 = 0.99408;
230 constexpr
double P5 = 0.01172;
231 constexpr
double P6 = 4.20214;
232 constexpr
double T0 = 105.749;
235 constexpr
double P1W = -0.01481;
236 constexpr
double P2W = -0.0075;
237 constexpr
double P3W = 0.141;
238 constexpr
double P4W = 12.4;
239 constexpr
double P5W = 1.627;
240 constexpr
double P6W = 0.317;
241 constexpr
double T0W = 90.371;
248 else if (efield < 0.619) {
249 vd = ((P1 * (temperature - T0) + 1) *
250 (P3 * efield * std::log(1 + P4 / efield) + P5 * std::pow(efield, P6)) +
251 P2 * (temperature - T0));
253 else if (efield < 0.699) {
254 vd = 12.5 * (efield - 0.619) *
255 ((P1W * (temperature - T0W) + 1) *
256 (P3W * efield * std::log(1 + P4W / efield) + P5W * std::pow(efield, P6W)) +
257 P2W * (temperature - T0W)) +
258 12.5 * (0.699 - efield) *
259 ((P1 * (temperature - T0) + 1) *
260 (P3 * efield * std::log(1 + P4 / efield) + P5 * std::pow(efield, P6)) +
261 P2 * (temperature - T0));
264 vd = ((P1W * (temperature - T0W) + 1) *
265 (P3W * efield * std::log(1 + P4W / efield) + P5W * std::pow(efield, P6W)) +
266 P2W * (temperature - T0W));
273 constexpr
double P0 = 0.;
274 constexpr
double P1 = 5.53416;
275 constexpr
double P2 = -6.53093;
276 constexpr
double P3 = 3.20752;
277 constexpr
double P4 = 0.389696;
278 constexpr
double P5 = -0.556184;
279 vd = (1.0 - 0.0184 * (temperature - 89.0)) *
280 (P0 + P1 * cet::pow<1>(efield) + P2 * cet::pow<2>(efield) + P3 * cet::pow<3>(efield) +
281 P4 * cet::pow<4>(efield) + P5 * cet::pow<5>(efield));
312 double const dEdx = dQdx / (A3t / Wion - K3t / E_field * dQdx);
329 double const Beta =
fModBoxB / (rho * E_field);
331 double const dEdx = (exp(Beta * Wion * dQdx) - Alpha) / Beta;
350 double const efield =
Efield();
352 double const driftVelocity =
DriftVelocity(efield, temperature);
353 double const x_ticks_coefficient = 0.001 * driftVelocity * samplingRate;
357 std::vector<std::vector<std::vector<double>>> x_ticks_offsets(
fGeo->
Ncryostats());
358 std::vector<std::vector<double>> drift_direction(
fGeo->
Ncryostats());
362 x_ticks_offsets[cstat].resize(cryostat.NTPC());
363 drift_direction[cstat].resize(cryostat.NTPC());
365 for (
size_t tpc = 0; tpc < cryostat.NTPC(); ++tpc) {
369 drift_direction[cstat][tpc] =
dir;
371 int nplane = tpcgeom.
Nplanes();
372 x_ticks_offsets[cstat][tpc].resize(nplane, 0.);
373 for (
int plane = 0; plane < nplane; ++plane) {
381 unsigned int planeToPropagateTo =
387 x_ticks_offsets[cstat][tpc][plane] =
388 -xyz.X() / (dir * x_ticks_coefficient) + triggerOffset;
393 double driftVelocitygap[3];
394 double x_ticks_coefficient_gap[3];
395 for (
int igap = 0; igap < 3; ++igap) {
396 efieldgap[igap] =
Efield(igap);
397 driftVelocitygap[igap] =
DriftVelocity(efieldgap[igap], temperature);
398 x_ticks_coefficient_gap[igap] = 0.001 * driftVelocitygap[igap] * samplingRate;
412 for (
int ip = 0; ip < plane; ++ip) {
413 x_ticks_offsets[cstat][tpc][plane] +=
414 tpcgeom.
PlanePitch(ip, ip + 1) / x_ticks_coefficient_gap[ip + 1];
417 else if (nplane == 2) {
429 for (
int ip = 0; ip < plane; ++ip) {
430 x_ticks_offsets[cstat][tpc][plane] +=
431 tpcgeom.
PlanePitch(ip, ip + 1) / x_ticks_coefficient_gap[ip + 2];
433 x_ticks_offsets[cstat][tpc][plane] -=
434 tpcgeom.
PlanePitch() * (1 / x_ticks_coefficient - 1 / x_ticks_coefficient_gap[1]);
448 default:
throw cet::exception(__FUNCTION__) <<
"Bad view = " << view <<
"\n";
455 *
this, x_ticks_coefficient, move(x_ticks_offsets), move(drift_direction)};
459 std::set<geo::View_t>
const& requested_views)
const 461 auto const& present_views =
fGeo->
Views();
463 auto view_diff = [&present_views, &requested_views](
geo::View_t const view) {
464 return static_cast<int>(present_views.count(view)) -
465 static_cast<int>(requested_views.count(view));
471 std::ostringstream errors;
472 if (
auto diff = view_diff(
geo::kU); diff > 0) { errors <<
"TimeOffsetU missing for view U.\n"; }
473 if (
auto diff = view_diff(
geo::kV); diff > 0) { errors <<
"TimeOffsetV missing for view V.\n"; }
474 if (
auto diff = view_diff(
geo::kZ); diff > 0) { errors <<
"TimeOffsetZ missing for view Z.\n"; }
475 if (
auto diff = view_diff(
geo::kY); diff > 0) { errors <<
"TimeOffsetY missing for view Y.\n"; }
476 if (
auto diff = view_diff(
geo::kX); diff > 0) { errors <<
"TimeOffsetX missing for view X.\n"; }
DetectorPropertiesStandard(fhicl::ParameterSet const &pset, const geo::GeometryCore *geo, const detinfo::LArProperties *lp, std::set< std::string > const &ignore_params={})
const detinfo::LArProperties * fLP
double TimeOffsetU() const override
double PlanePitch(unsigned int p1=0, unsigned int p2=1) const
Returns the center of the TPC volume in world coordinates [cm].
Encapsulate the construction of a single cyostat.
Point_t const & GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
double fTemperature
kelvin
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
double Efield(unsigned int planegap=0) const override
kV/cm
unsigned int Nplanes() const
Number of planes in this tpc.
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()
Planes which measure Z direction.
double TimeOffsetZ() const override
Drift towards negative X values.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
CryostatGeo const & Cryostat(CryostatID const &cryoid=cryostat_zero) const
Returns the specified cryostat.
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 detector geometry.
View_t View() const
Which coordinate does this plane measure.
virtual double AtomicMass() const =0
Atomic mass of the liquid (g/mol)
constexpr double kGeVToElectrons
23.6eV per ion pair, 1e9 eV/GeV
bool fIncludeInterPlanePitchInXTickOffsets
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
std::set< std::string > const & IgnorableProviderConfigKeys()
Returns a list of configuration keys that providers should ignore.
std::string CheckTimeOffsets(std::set< geo::View_t > const &requested_views) const
General LArSoft Utilities.
Description of geometry of one entire detector.
DriftDirection_t DriftDirection() const
Returns an enumerator value describing the drift direction.
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
double TimeOffsetV() const override
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
int trigger_offset(DetectorClocksData const &data)
std::vector< double > fEfield
kV/cm (per inter-plane volume) !
std::set< View_t > const & Views() const
Returns a list of possible views in the detector.
Simple utilities for service providers.
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
constexpr double kRecombA
A constant.
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.
Namespace collecting geometry-related classes utilities.
cet::coded_exception< error, detail::translate > exception
const geo::GeometryCore * fGeo
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