17 #include "cetlib/pow.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
21 #include "fhiclcpp/types/Table.h"
32 std::set<std::string>
const& ignore_params)
41 std::set<std::string>
const& ignore_params)
44 mf::LogInfo
debug(
"setupProvider<DetectorPropertiesStandard>");
46 debug <<
"Asked to ignore " << ignore_params.size() <<
" keys:";
47 for (
auto const& key : ignore_params)
48 debug <<
" '" << key <<
"'";
52 ignorable_keys.insert(ignore_params.begin(), ignore_params.end());
55 fhicl::Table<Configuration_t>
const config{
p, ignorable_keys};
64 std::set<geo::View_t> present_views;
72 if (!errors.empty()) {
73 throw cet::exception(
"DetectorPropertiesStandard") <<
"Detected configuration errors: \n"
100 throw cet::exception(
"DetectorPropertiesStandard")
101 <<
"requesting Electric field in a plane gap that is not defined\n";
111 if (temperature == 0.) temperature =
Temperature();
113 return -0.00615 * temperature + 1.928;
137 constexpr
double K = 0.307075;
138 constexpr
double me = 0.510998918;
141 double const bg = mom /
mass;
142 double const gamma = sqrt(1. + bg * bg);
143 double const beta = bg / gamma;
144 double const mer = 0.001 * me /
mass;
146 2. * me * bg * bg / (1. + 2. * gamma * mer + mer * mer);
149 if (tcut == 0. || tcut > tmax) tcut = tmax;
152 double const x = std::log10(bg);
164 0.5 * beta * beta * (1. + tcut / tmax) - 0.5 * delta;
178 constexpr
double K = 0.307075;
179 constexpr
double me = 0.510998918;
182 double const bg = mom /
mass;
183 double const gamma2 = 1. + bg * bg;
184 double const beta2 = bg * bg / gamma2;
204 if (efield == 0.) efield =
Efield();
207 mf::LogWarning(
"DetectorPropertiesStandard")
208 <<
"DriftVelocity Warning! : E-field value of " << efield
209 <<
" kV/cm is outside of range covered by drift"
210 <<
" velocity parameterization. Returned value"
211 <<
" may not be correct";
214 if (temperature == 0.) temperature =
Temperature();
216 if (temperature < 87.0 || temperature > 94.0)
217 mf::LogWarning(
"DetectorPropertiesStandard")
218 <<
"DriftVelocity Warning! : Temperature value of " << temperature
219 <<
" K is outside of range covered by drift velocity"
220 <<
" parameterization. Returned value may not be"
226 double const tshift = -87.203 + temperature;
227 double const xFit = 0.0938163 - 0.0052563 * tshift - 0.0001470 * tshift * tshift;
228 double const uFit = 5.18406 + 0.01448 * tshift - 0.003497 * tshift * tshift -
229 0.000516 * tshift * tshift * tshift;
232 constexpr
double P1 = -0.04640;
233 constexpr
double P2 = 0.01712;
234 constexpr
double P3 = 1.88125;
235 constexpr
double P4 = 0.99408;
236 constexpr
double P5 = 0.01172;
237 constexpr
double P6 = 4.20214;
238 constexpr
double T0 = 105.749;
241 constexpr
double P1W = -0.01481;
242 constexpr
double P2W = -0.0075;
243 constexpr
double P3W = 0.141;
244 constexpr
double P4W = 12.4;
245 constexpr
double P5W = 1.627;
246 constexpr
double P6W = 0.317;
247 constexpr
double T0W = 90.371;
254 else if (efield < 0.619) {
255 vd = ((P1 * (temperature -
T0) + 1) *
256 (P3 * efield * std::log(1 + P4 / efield) + P5 * std::pow(efield, P6)) +
257 P2 * (temperature - T0));
259 else if (efield < 0.699) {
260 vd = 12.5 * (efield - 0.619) *
261 ((P1W * (temperature - T0W) + 1) *
262 (P3W * efield * std::log(1 + P4W / efield) + P5W * std::pow(efield, P6W)) +
263 P2W * (temperature - T0W)) +
264 12.5 * (0.699 - efield) *
265 ((P1 * (temperature -
T0) + 1) *
266 (P3 * efield * std::log(1 + P4 / efield) + P5 * std::pow(efield, P6)) +
267 P2 * (temperature - T0));
270 vd = ((P1W * (temperature - T0W) + 1) *
271 (P3W * efield * std::log(1 + P4W / efield) + P5W * std::pow(efield, P6W)) +
272 P2W * (temperature - T0W));
279 constexpr
double P0 = 0.;
280 constexpr
double P1 = 5.53416;
281 constexpr
double P2 = -6.53093;
282 constexpr
double P3 = 3.20752;
283 constexpr
double P4 = 0.389696;
284 constexpr
double P5 = -0.556184;
285 vd = (1.0 - 0.0184 * (temperature - 89.0)) *
286 (P0 + P1 * cet::pow<1>(efield) + P2 * cet::pow<2>(efield) + P3 * cet::pow<3>(efield) +
287 P4 * cet::pow<4>(efield) + P5 * cet::pow<5>(efield));
320 double const dEdx = dQdx / (A3t / Wion - K3t / E_field * dQdx);
339 double const Beta =
fModBoxB / (rho * E_field);
341 double const dEdx = (
exp(Beta * Wion * dQdx) - Alpha) / Beta;
360 double const efield =
Efield();
362 double const driftVelocity =
DriftVelocity(efield, temperature);
363 double const x_ticks_coefficient = 0.001 * driftVelocity * samplingRate;
367 std::vector<std::vector<std::vector<double>>> x_ticks_offsets(
fGeo->
Ncryostats());
368 std::vector<std::vector<double>> drift_direction(
fGeo->
Ncryostats());
378 drift_direction[cstat][tpc] =
dir;
380 int nplane = tpcgeom.
Nplanes();
381 x_ticks_offsets[cstat][tpc].resize(nplane, 0.);
382 for (
int plane = 0; plane < nplane; ++plane) {
389 x_ticks_offsets[cstat][tpc][plane] =
390 -xyz[0] / (dir * x_ticks_coefficient) + triggerOffset;
395 double driftVelocitygap[3];
396 double x_ticks_coefficient_gap[3];
397 for (
int igap = 0; igap < 3; ++igap) {
398 efieldgap[igap] =
Efield(igap);
399 driftVelocitygap[igap] =
DriftVelocity(efieldgap[igap], temperature);
400 x_ticks_coefficient_gap[igap] = 0.001 * driftVelocitygap[igap] * samplingRate;
414 for (
int ip = 0; ip < plane; ++ip) {
415 x_ticks_offsets[cstat][tpc][plane] +=
416 tpcgeom.
PlanePitch(ip, ip + 1) / x_ticks_coefficient_gap[ip + 1];
419 else if (nplane == 2) {
431 for (
int ip = 0; ip < plane; ++ip) {
432 x_ticks_offsets[cstat][tpc][plane] +=
433 tpcgeom.
PlanePitch(ip, ip + 1) / x_ticks_coefficient_gap[ip + 2];
435 x_ticks_offsets[cstat][tpc][plane] -=
436 tpcgeom.
PlanePitch() * (1 / x_ticks_coefficient - 1 / x_ticks_coefficient_gap[1]);
450 default:
throw cet::exception(__FUNCTION__) <<
"Bad view = " << view <<
"\n";
457 *
this, x_ticks_coefficient, move(x_ticks_offsets), move(drift_direction)};
463 auto const& present_views =
fGeo->
Views();
465 auto view_diff = [&present_views, &requested_views](
geo::View_t const view) {
466 return static_cast<int>(present_views.count(view)) -
467 static_cast<int>(requested_views.count(view));
473 std::ostringstream errors;
474 if (
auto diff = view_diff(
geo::kU); diff > 0) { errors <<
"TimeOffsetU missing for view U.\n"; }
475 if (
auto diff = view_diff(
geo::kV); diff > 0) { errors <<
"TimeOffsetV missing for view V.\n"; }
476 if (
auto diff = view_diff(
geo::kZ); diff > 0) { errors <<
"TimeOffsetZ missing for view Z.\n"; }
477 if (
auto diff = view_diff(
geo::kY); diff > 0) { errors <<
"TimeOffsetY missing for view Y.\n"; }
478 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 ModBoxCorrection(double dQdX) const override
virtual double AtomicNumber() const =0
Atomic number of the liquid.
double PlanePitch(unsigned int p1=0, unsigned int p2=1) const
Encapsulate the construction of a single cyostat.
DetectorPropertiesData DataFor(detinfo::DetectorClocksData const &clock_data) const override
process_name opflash particleana ie x
double fTemperature
kelvin
double Temperature() const override
In kelvin.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned int Nplanes() const
Number of planes in this tpc.
double TimeOffsetY() const override
double Eloss(double mom, double mass, double tcut) const override
Restricted mean energy loss (dE/dx)
void ValidateAndConfigure(fhicl::ParameterSet const &p, std::set< std::string > const &ignore_params)
Configures the provider, first validating the configuration.
std::set< geo::View_t > const & Views() const
Returns a list of possible views in the detector.
Planes which measure X direction.
Geometry information for a single TPC.
unsigned int fNumberTimeSamples
number of clock ticks per event
virtual double Density() const
Returns argon density at the temperature from Temperature()
Planes which measure Z direction.
Drift towards negative X values.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
double cbar
parameter Cbar
virtual double ExcitationEnergy() const =0
Mean excitation energy of the liquid (eV)
Planes which measure Y direction.
Access the description of detector geometry.
View_t View() const
Which coordinate does this plane measure.
constexpr double kGeVToElectrons
23.6eV per ion pair, 1e9 eV/GeV
bool fIncludeInterPlanePitchInXTickOffsets
double ElossVar(double mom, double mass) const override
Energy loss fluctuation ( )
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
SternheimerParameters_t fSternheimerParameters
Sternheimer parameters.
unsigned int NTPC() const
Number of TPCs in this cryostat.
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.
std::string CheckTimeOffsets(std::set< geo::View_t > const &requested_views) const
double TimeOffsetU() const override
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 fElectronlifetime
microseconds
double DriftVelocity(double efield=0., double temperature=0.) const override
cm/us
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.
unsigned int fReadOutWindowSize
number of clock ticks per readout window
constexpr double kRecombk
double BirksCorrection(double dQdX) const override
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
int trigger_offset(DetectorClocksData const &data)
std::vector< double > fEfield
kV/cm (per inter-plane volume) !
Simple utilities for service providers.
double TimeOffsetV() const override
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
constexpr double kRecombA
A constant.
process_name physics producers generator hPHist_pi physics producers generator P0
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
double TimeOffsetZ() const override
const double * PlaneLocation(unsigned int p) const
virtual double AtomicMass() const =0
Atomic mass of the liquid (g/mol)
const geo::GeometryCore * fGeo
double Efield(unsigned int planegap=0) const override
kV/cm
Encapsulate the construction of a single detector plane.
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator T0
double fDriftVelFudgeFactor
bool fUseIcarusMicrobooneDriftModel