All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PropagationTimeModel Class Reference

#include <PropagationTimeModel.h>

Public Member Functions

 PropagationTimeModel (fhicl::ParameterSet VUVTimingParams, fhicl::ParameterSet VISTimingParams, CLHEP::HepRandomEngine &ScintTimeEngine, bool doReflectedLight=false, bool GeoPropTimeOnly=false)
 
void propagationTime (std::vector< double > &arrival_time_dist, geo::Point_t const &x0, const size_t OpChannel, bool Reflected=false)
 

Private Member Functions

void Initialization ()
 
void getVUVTimes (std::vector< double > &arrivalTimes, const double distance_in_cm, const size_t angle_bin)
 
void getVUVTimesGeo (std::vector< double > &arrivalTimes, const double distance_in_cm)
 
void generateParam (const size_t index, const size_t angle_bin)
 
void getVISTimes (std::vector< double > &arrivalTimes, const TVector3 &ScintPoint, const TVector3 &OpDetPoint)
 
double fast_acos (double x) const
 
double interpolate (const std::vector< double > &xData, const std::vector< double > &yData, double x, bool extrapolate, size_t i=0) const
 
void interpolate3 (std::array< double, 3 > &inter, const std::vector< double > &xData, const std::vector< double > &yData1, const std::vector< double > &yData2, const std::vector< double > &yData3, double x, bool extrapolate)
 

Static Private Member Functions

static double finter_d (const double *x, const double *par)
 
static double model_close (const double *x, const double *par)
 
static double model_far (const double *x, const double *par)
 

Private Attributes

const fhicl::ParameterSet fVUVTimingParams
 
const fhicl::ParameterSet fVISTimingParams
 
const bool fdoReflectedLight
 
const bool fGeoPropTimeOnly
 
larg4::ISTPC fISTPC
 
CLHEP::HepRandomEngine & fScintTimeEngine
 
CLHEP::RandFlat fUniformGen
 
double fplane_depth
 
TVector3 fcathode_centre
 
std::vector< geo::BoxBoundedGeofActiveVolumes
 
size_t nOpDets
 
std::vector< geo::Point_tfOpDetCenter
 
std::vector< int > fOpDetOrientation
 
double fstep_size
 
double fmax_d
 
double fmin_d
 
double fvuv_vgroup_mean
 
double fvuv_vgroup_max
 
double finflexion_point_distance
 
double fangle_bin_timing_vuv
 
std::vector< std::vector
< double > > 
fparameters [7]
 
std::vector< std::vector< TF1 > > fVUV_timing
 
std::vector< std::vector
< double > > 
fVUV_max
 
std::vector< std::vector
< double > > 
fVUV_min
 
double fvis_vmean
 
double fangle_bin_timing_vis
 
std::vector< double > fdistances_refl
 
std::vector< double > fradial_distances_refl
 
std::vector< std::vector
< std::vector< double > > > 
fcut_off_pars
 
std::vector< std::vector
< std::vector< double > > > 
ftau_pars
 

Detailed Description

Definition at line 34 of file PropagationTimeModel.h.

Constructor & Destructor Documentation

PropagationTimeModel::PropagationTimeModel ( fhicl::ParameterSet  VUVTimingParams,
fhicl::ParameterSet  VISTimingParams,
CLHEP::HepRandomEngine &  ScintTimeEngine,
bool  doReflectedLight = false,
bool  GeoPropTimeOnly = false 
)

Definition at line 21 of file PropagationTimeModel.cxx.

22  :
23  fVUVTimingParams(VUVTimingParams)
24  , fVISTimingParams(VISTimingParams)
25  , fdoReflectedLight(doReflectedLight)
26  , fGeoPropTimeOnly(GeoPropTimeOnly)
27  , fISTPC{*(lar::providerFrom<geo::Geometry>())}
28  , fScintTimeEngine(ScintTimeEngine)
30 {
31  // initialise parameters and geometry
32  mf::LogInfo("PropagationTimeModel") << "Photon propagation time model initalized." << std::endl;
34 }
CLHEP::HepRandomEngine & fScintTimeEngine
const fhicl::ParameterSet fVUVTimingParams
const fhicl::ParameterSet fVISTimingParams

Member Function Documentation

double PropagationTimeModel::fast_acos ( double  x) const
private

Definition at line 425 of file PropagationTimeModel.cxx.

426 {
427  double negate = double(x < 0);
428  x = std::abs(x);
429  x -= double(x > 1.0) * (x - 1.0); // <- equivalent to min(1.0,x), but faster
430  double ret = -0.0187293;
431  ret = ret * x;
432  ret = ret + 0.0742610;
433  ret = ret * x;
434  ret = ret - 0.2121144;
435  ret = ret * x;
436  ret = ret + 1.5707288;
437  ret = ret * std::sqrt(1.0 - x);
438  ret = ret - 2. * negate * ret;
439  return negate * 3.14159265358979 + ret;
440 }
process_name opflash particleana ie x
T abs(T value)
double PropagationTimeModel::finter_d ( const double *  x,
const double *  par 
)
staticprivate

Definition at line 526 of file PropagationTimeModel.cxx.

527 {
528  double y1 = par[2] * TMath::Landau(x[0], par[0], par[1]);
529  double y2 = TMath::Exp(par[3] + x[0] * par[4]);
530 
531  return TMath::Abs(y1 - y2);
532 }
process_name opflash particleana ie x
void PropagationTimeModel::generateParam ( const size_t  index,
const size_t  angle_bin 
)
private

Definition at line 212 of file PropagationTimeModel.cxx.

213 {
214  // get distance
215  double distance_in_cm = (index * fstep_size) + fmin_d;
216 
217  // time range
218  const double signal_t_range = 5000.;
219 
220  // parameterisation TF1
221  TF1 VUVTiming;
222 
223  // direct path transport time
224  double t_direct_mean = distance_in_cm / fvuv_vgroup_mean;
225  double t_direct_min = distance_in_cm / fvuv_vgroup_max;
226 
227  // Defining the model function(s) describing the photon transportation timing vs distance
228  // Getting the landau parameters from the time parametrization
229  std::array<double, 3> pars_landau;
230  interpolate3(pars_landau,
231  fparameters[0][0],
232  fparameters[2][angle_bin],
233  fparameters[3][angle_bin],
234  fparameters[1][angle_bin],
235  distance_in_cm,
236  true);
237  // Deciding which time model to use (depends on the distance)
238  // defining useful times for the VUV arrival time shapes
239  if (distance_in_cm >= finflexion_point_distance) {
240  double pars_far[4] = {t_direct_min, pars_landau[0], pars_landau[1], pars_landau[2]};
241  // Set model: Landau
242  VUVTiming = TF1("VUVTiming", model_far, 0, signal_t_range, 4);
243  VUVTiming.SetParameters(pars_far);
244  }
245  else {
246  // Set model: Landau + Exponential
247  VUVTiming = TF1("VUVTiming", model_close, 0, signal_t_range, 7);
248  // Exponential parameters
249  double pars_expo[2];
250  // Getting the exponential parameters from the time parametrization
251  pars_expo[1] = interpolate(fparameters[4][0], fparameters[5][angle_bin], distance_in_cm, true);
252  pars_expo[0] = interpolate(fparameters[4][0], fparameters[6][angle_bin], distance_in_cm, true);
253  pars_expo[0] *= pars_landau[2];
254  pars_expo[0] = std::log(pars_expo[0]);
255  // this is to find the intersection point between the two functions:
256  TF1 fint = TF1("fint", finter_d, pars_landau[0], 4 * t_direct_mean, 5);
257  double parsInt[5] = {
258  pars_landau[0], pars_landau[1], pars_landau[2], pars_expo[0], pars_expo[1]};
259  fint.SetParameters(parsInt);
260  double t_int = fint.GetMinimumX();
261  double minVal = fint.Eval(t_int);
262  // the functions must intersect - output warning if they don't
263  if (minVal > 0.015) {
264  mf::LogWarning("PropagationTimeModel")
265  << "WARNING: Parametrization of VUV light discontinuous for distance = "
266  << distance_in_cm << std::endl;
267  mf::LogWarning("PropagationTimeModel")
268  << "WARNING: This shouldn't be happening " << std::endl;
269  }
270  double parsfinal[7] = {t_int,
271  pars_landau[0],
272  pars_landau[1],
273  pars_landau[2],
274  pars_expo[0],
275  pars_expo[1],
276  t_direct_min};
277  VUVTiming.SetParameters(parsfinal);
278  }
279 
280  // set the number of points used to sample parameterisation
281  // for shorter distances, peak is sharper so more sensitive sampling required
282  int fsampling;
283  if (distance_in_cm < 50) fsampling = 10000;
284  else if (distance_in_cm < 100) fsampling = 5000;
285  else fsampling = 1000;
286  VUVTiming.SetNpx(fsampling);
287 
288  // calculate max and min distance relevant to sample parameterisation
289  // max
290  const size_t nq_max = 1;
291  double xq_max[nq_max];
292  double yq_max[nq_max];
293  xq_max[0] = 0.975; // include 97.5% of tail
294  VUVTiming.GetQuantiles(nq_max, yq_max, xq_max);
295  double max = yq_max[0];
296  // min
297  double min = t_direct_min;
298 
299  // store TF1 and min/max, this allows identical TF1 to be used every time sampling
300  // the first call of GetRandom generates the timing sampling and stores it in the TF1 object, this is the slow part
301  // all subsequent calls check if it has been generated previously and are ~100+ times quicker
302  fVUV_timing[angle_bin][index] = VUVTiming;
303  fVUV_max[angle_bin][index] = max;
304  fVUV_min[angle_bin][index] = min;
305 }
static double model_close(const double *x, const double *par)
static double finter_d(const double *x, const double *par)
void interpolate3(std::array< double, 3 > &inter, const std::vector< double > &xData, const std::vector< double > &yData1, const std::vector< double > &yData2, const std::vector< double > &yData3, double x, bool extrapolate)
double interpolate(const std::vector< double > &xData, const std::vector< double > &yData, double x, bool extrapolate, size_t i=0) const
static double model_far(const double *x, const double *par)
std::vector< std::vector< double > > fVUV_max
std::vector< std::vector< double > > fparameters[7]
std::vector< std::vector< TF1 > > fVUV_timing
std::vector< std::vector< double > > fVUV_min
void PropagationTimeModel::getVISTimes ( std::vector< double > &  arrivalTimes,
const TVector3 &  ScintPoint,
const TVector3 &  OpDetPoint 
)
private

Definition at line 310 of file PropagationTimeModel.cxx.

313 {
314  // *************************************************************************************************
315  // Calculation of earliest arrival times and corresponding unsmeared
316  // distribution
317  // *************************************************************************************************
318 
319  // set plane_depth for correct TPC:
320  double plane_depth;
321  if (ScintPoint[0] < 0) plane_depth = -fplane_depth;
322  else plane_depth = fplane_depth;
323 
324  // calculate point of reflection for shortest path
325  TVector3 bounce_point(plane_depth,ScintPoint[1],ScintPoint[2]);
326 
327  // calculate distance travelled by VUV light and by vis light
328  double VUVdist = (bounce_point - ScintPoint).Mag();
329  double Visdist = (OpDetPoint - bounce_point).Mag();
330 
331  // calculate times taken by VUV part of path
332  int angle_bin_vuv = 0; // on-axis by definition
333  getVUVTimes(arrivalTimes, VUVdist, angle_bin_vuv);
334 
335  // sum parts to get total transport times times
336  for (size_t i = 0; i < arrivalTimes.size(); ++i) {
337  arrivalTimes[i] += Visdist / fvis_vmean;
338  }
339 
340  // *************************************************************************************************
341  // Smearing of arrival time distribution
342  // *************************************************************************************************
343  // calculate fastest time possible
344  // vis part
345  double vis_time = Visdist / fvis_vmean;
346  // vuv part
347  double vuv_time;
348  if (VUVdist < fmin_d) {
349  vuv_time = VUVdist / fvuv_vgroup_max;
350  }
351  else {
352  // find index of required parameterisation
353  const size_t index = std::round((VUVdist - fmin_d) / fstep_size);
354  // find shortest time
355  vuv_time = fVUV_min[angle_bin_vuv][index];
356  }
357  // sum
358  double fastest_time = vis_time + vuv_time;
359 
360  // calculate angle theta between bound_point and optical detector
361  double cosine_theta = std::abs(OpDetPoint[0] - bounce_point[0]) / Visdist;
362  double theta = fast_acos(cosine_theta) * 180. / CLHEP::pi;
363 
364  // determine smearing parameters using interpolation of generated points:
365  // 1). tau = exponential smearing factor, varies with distance and angle
366  // 2). cutoff = largest smeared time allowed, preventing excessively large
367  // times caused by exponential distance to cathode
368  double distance_cathode_plane = std::abs(plane_depth - ScintPoint[0]);
369  // angular bin
370  size_t theta_bin = theta / fangle_bin_timing_vis;
371  // radial distance from centre of TPC (y,z plane)
372  double r = std::hypot(ScintPoint[1] - fcathode_centre[1], ScintPoint[2] - fcathode_centre[2]);
373 
374  // cut-off and tau
375  // cut-off
376  // interpolate in d_c for each r bin
377  std::vector<double> interp_vals(fcut_off_pars[theta_bin].size(), 0.0);
378  for (size_t i = 0; i < fcut_off_pars[theta_bin].size(); i++){
379  interp_vals[i] = interpolate(fdistances_refl, fcut_off_pars[theta_bin][i], distance_cathode_plane, true);
380  }
381  // interpolate in r
382  double cutoff = interpolate(fradial_distances_refl, interp_vals, r, true);
383 
384  // tau
385  // interpolate in x for each r bin
386  std::vector<double> interp_vals_tau(ftau_pars[theta_bin].size(), 0.0);
387  for (size_t i = 0; i < ftau_pars[theta_bin].size(); i++){
388  interp_vals_tau[i] = interpolate(fdistances_refl, ftau_pars[theta_bin][i], distance_cathode_plane, true);
389  }
390  // interpolate in r
391  double tau = interpolate(fradial_distances_refl, interp_vals_tau, r, true);
392 
393  // apply smearing:
394  for (size_t i = 0; i < arrivalTimes.size(); ++i) {
395  double arrival_time_smeared;
396  // if time is already greater than cutoff, do not apply smearing
397  if (arrivalTimes[i] >= cutoff) { continue; }
398  // otherwise smear
399  else {
400  unsigned int counter = 0;
401  // loop until time generated is within cutoff limit
402  // most are within single attempt, very few take more than two
403  do {
404  // don't attempt smearings too many times
405  if (counter >= 10) {
406  arrival_time_smeared = arrivalTimes[i]; // don't smear
407  break;
408  }
409  else {
410  // generate random number in appropriate range
411  double x = fUniformGen.fire(0.5, 1.0);
412  // apply the exponential smearing
413  arrival_time_smeared =
414  arrivalTimes[i] + (arrivalTimes[i] - fastest_time) * (std::pow(x, -tau) - 1);
415  }
416  counter++;
417  } while (arrival_time_smeared > cutoff);
418  }
419  arrivalTimes[i] = arrival_time_smeared;
420  }
421 }
process_name opflash particleana ie x
void getVUVTimes(std::vector< double > &arrivalTimes, const double distance_in_cm, const size_t angle_bin)
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
double interpolate(const std::vector< double > &xData, const std::vector< double > &yData, double x, bool extrapolate, size_t i=0) const
T abs(T value)
std::vector< std::vector< std::vector< double > > > ftau_pars
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:285
std::vector< double > fradial_distances_refl
pdgs pi
Definition: selectors.fcl:22
double fast_acos(double x) const
std::vector< std::vector< std::vector< double > > > fcut_off_pars
std::vector< std::vector< double > > fVUV_min
std::vector< double > fdistances_refl
esac echo uname r
void PropagationTimeModel::getVUVTimes ( std::vector< double > &  arrivalTimes,
const double  distance_in_cm,
const size_t  angle_bin 
)
private

Definition at line 178 of file PropagationTimeModel.cxx.

179 {
180  if (distance < fmin_d) {
181  // times are fixed shift i.e. direct path only
182  double t_prop_correction = distance / fvuv_vgroup_mean;
183  for (size_t i = 0; i < arrivalTimes.size(); ++i) {
184  arrivalTimes[i] = t_prop_correction;
185  }
186  }
187  else {
188  // determine nearest parameterisation in discretisation
189  int index = std::round((distance - fmin_d) / fstep_size);
190  // randomly sample parameterisation for each photon
191  for (size_t i = 0; i < arrivalTimes.size(); ++i) {
192  arrivalTimes[i] = fVUV_timing[angle_bin][index].GetRandom(fVUV_min[angle_bin][index], fVUV_max[angle_bin][index]);
193  }
194  }
195 }
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
std::vector< std::vector< double > > fVUV_max
std::vector< std::vector< TF1 > > fVUV_timing
std::vector< std::vector< double > > fVUV_min
void PropagationTimeModel::getVUVTimesGeo ( std::vector< double > &  arrivalTimes,
const double  distance_in_cm 
)
private

Definition at line 200 of file PropagationTimeModel.cxx.

201 {
202  // times are fixed shift i.e. direct path only
203  double t_prop_correction = distance / fvuv_vgroup_mean;
204  for (size_t i = 0; i < arrivalTimes.size(); ++i) {
205  arrivalTimes[i] = t_prop_correction;
206  }
207 }
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
void PropagationTimeModel::Initialization ( )
private

Definition at line 38 of file PropagationTimeModel.cxx.

39 {
40  // load photon propagation time model parameters
41  if (!fGeoPropTimeOnly) {
42 
43  // Direct / VUV
44  mf::LogInfo("PropagationTimeModel") << "Using VUV timing parameterization";
45 
46  fparameters[0] = std::vector(1, fVUVTimingParams.get<std::vector<double>>("Distances_landau"));
47  fparameters[1] = fVUVTimingParams.get<std::vector<std::vector<double>>>("Norm_over_entries");
48  fparameters[2] = fVUVTimingParams.get<std::vector<std::vector<double>>>("Mpv");
49  fparameters[3] = fVUVTimingParams.get<std::vector<std::vector<double>>>("Width");
50  fparameters[4] = std::vector(1, fVUVTimingParams.get<std::vector<double>>("Distances_exp"));
51  fparameters[5] = fVUVTimingParams.get<std::vector<std::vector<double>>>("Slope");
52  fparameters[6] = fVUVTimingParams.get<std::vector<std::vector<double>>>("Expo_over_Landau_norm");
53 
54  fstep_size = fVUVTimingParams.get<double>("step_size");
55  fmax_d = fVUVTimingParams.get<double>("max_d");
56  fmin_d = fVUVTimingParams.get<double>("min_d");
57  fvuv_vgroup_mean = fVUVTimingParams.get<double>("vuv_vgroup_mean");
58  fvuv_vgroup_max = fVUVTimingParams.get<double>("vuv_vgroup_max");
59  finflexion_point_distance = fVUVTimingParams.get<double>("inflexion_point_distance");
60  fangle_bin_timing_vuv = fVUVTimingParams.get<double>("angle_bin_timing_vuv");
61 
62  // create vector of empty TF1s that will be replaced with the sampled
63  // parameterisations that are generated as they are required
64  const size_t num_params = (fmax_d - fmin_d) / fstep_size; // for d < fmin_d, no parameterisaton, a delta function is used instead
65  const size_t num_angles = std::round(90/fangle_bin_timing_vuv);
66  fVUV_timing = std::vector(num_angles, std::vector(num_params, TF1()));
67 
68  // initialise vectors to contain range parameterisations sampled to in each case
69  // when using TF1->GetRandom(xmin,xmax), must be in same range otherwise sampling
70  // is regenerated, this is the slow part!
71  fVUV_max = std::vector(num_angles, std::vector(num_params, 0.0));
72  fVUV_min = std::vector(num_angles, std::vector(num_params, 0.0));
73 
74  // generate VUV parameters
75  for (size_t angle_bin=0; angle_bin < num_angles; ++angle_bin) {
76  for (size_t index=0; index < num_params; ++index) {
77  generateParam(index, angle_bin);
78  }
79  }
80 
81  // Reflected / Visible
82  if (fdoReflectedLight) {
83  mf::LogInfo("PropagationTimeModel") << "Using VIS (reflected) timing parameterization";
84 
85  fdistances_refl = fVISTimingParams.get<std::vector<double>>("Distances_refl");
86  fradial_distances_refl = fVISTimingParams.get<std::vector<double>>("Distances_radial_refl");
87  fcut_off_pars = fVISTimingParams.get<std::vector<std::vector<std::vector<double>>>>("Cut_off");
88  ftau_pars = fVISTimingParams.get<std::vector<std::vector<std::vector<double>>>>("Tau");
89  fvis_vmean = fVISTimingParams.get<double>("vis_vmean");
90  fangle_bin_timing_vis = fVISTimingParams.get<double>("angle_bin_timing_vis");
91  }
92 
93  }
94 
95  if (fGeoPropTimeOnly) {
96  mf::LogInfo("PropagationTimeModel") << "Using geometric VUV time propagation";
97  fvuv_vgroup_mean = fVUVTimingParams.get<double>("vuv_vgroup_mean");
98  }
99 
100  // access information from the geometry service
101  geo::GeometryCore const& geom = *(lar::providerFrom<geo::Geometry>());
102 
103  // get TPC information
104  fplane_depth = std::abs(geom.TPC(0, 0).GetCathodeCenter().X());
106  fcathode_centre = {geom.TPC(0, 0).GetCathodeCenter().X(),
107  fActiveVolumes[0].CenterY(),
108  fActiveVolumes[0].CenterZ()};
109 
110  // get PDS information
111  nOpDets = geom.NOpDets();
112 
113  fOpDetOrientation.reserve(nOpDets); fOpDetCenter.reserve(nOpDets);
114  for (size_t const i : util::counter(nOpDets)) {
115 
116  geo::OpDetGeo const& opDet = geom.OpDetGeoFromOpDet(i);
117  fOpDetCenter.push_back(opDet.GetCenter());
118 
119  if (opDet.isSphere()) { // dome PMTs
120  fOpDetOrientation.push_back(0);
121  }
122  else if (opDet.isBar()) {
123  // determine orientation to get correction OpDet dimensions
124  if (opDet.Width() > opDet.Height()) { // laterals, Y dimension smallest
125  fOpDetOrientation.push_back(1);
126  }
127  else { // anode/cathode (default), X dimension smallest
128  fOpDetOrientation.push_back(0);
129  }
130  }
131  else {
132  fOpDetOrientation.push_back(0);
133  }
134  }
135 }
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
static std::vector< geo::BoxBoundedGeo > extractActiveLArVolume(geo::GeometryCore const &geom)
Definition: ISTPC.cxx:51
bool isBar() const
Returns whether the detector shape is a bar (TGeoBBox).
Definition: OpDetGeo.h:195
Point GetCathodeCenter() const
Definition: TPCGeo.h:298
void GetCenter(double *xyz, double localz=0.0) const
Definition: OpDetGeo.cxx:40
std::vector< geo::Point_t > fOpDetCenter
bool isSphere() const
Returns whether the detector shape is a hemisphere (TGeoSphere).
Definition: OpDetGeo.h:198
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
T abs(T value)
std::vector< std::vector< std::vector< double > > > ftau_pars
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:285
std::vector< double > fradial_distances_refl
std::vector< geo::BoxBoundedGeo > fActiveVolumes
std::vector< int > fOpDetOrientation
Description of geometry of one entire detector.
std::vector< std::vector< double > > fVUV_max
unsigned int NOpDets() const
Number of OpDets in the whole detector.
std::vector< std::vector< double > > fparameters[7]
const fhicl::ParameterSet fVUVTimingParams
std::vector< std::vector< std::vector< double > > > fcut_off_pars
std::vector< std::vector< TF1 > > fVUV_timing
std::vector< std::vector< double > > fVUV_min
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
std::vector< double > fdistances_refl
double Width() const
Definition: OpDetGeo.h:82
double Height() const
Definition: OpDetGeo.h:83
void generateParam(const size_t index, const size_t angle_bin)
const fhicl::ParameterSet fVISTimingParams
double PropagationTimeModel::interpolate ( const std::vector< double > &  xData,
const std::vector< double > &  yData,
double  x,
bool  extrapolate,
size_t  i = 0 
) const
private

Definition at line 448 of file PropagationTimeModel.cxx.

453 {
454  if (i == 0) {
455  size_t size = xData.size();
456  if (x >= xData[size - 2]) { // special case: beyond right end
457  i = size - 2;
458  }
459  else {
460  while (x > xData[i + 1])
461  i++;
462  }
463  }
464  double xL = xData[i];
465  double xR = xData[i + 1];
466  double yL = yData[i];
467  double yR = yData[i + 1]; // points on either side (unless beyond ends)
468  if (!extrapolate) { // if beyond ends of array and not extrapolating
469  if (x < xL) return yL;
470  if (x > xR) return yL;
471  }
472  const double dydx = (yR - yL) / (xR - xL); // gradient
473  return yL + dydx * (x - xL); // linear interpolation
474 }
process_name opflash particleana ie x
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void PropagationTimeModel::interpolate3 ( std::array< double, 3 > &  inter,
const std::vector< double > &  xData,
const std::vector< double > &  yData1,
const std::vector< double > &  yData2,
const std::vector< double > &  yData3,
double  x,
bool  extrapolate 
)
private

Definition at line 478 of file PropagationTimeModel.cxx.

485 {
486  size_t size = xData.size();
487  size_t i = 0; // find left end of interval for interpolation
488  if (x >= xData[size - 2]) { // special case: beyond right end
489  i = size - 2;
490  }
491  else {
492  while (x > xData[i + 1])
493  i++;
494  }
495  double xL = xData[i];
496  double xR = xData[i + 1]; // points on either side (unless beyond ends)
497  double yL1 = yData1[i];
498  double yR1 = yData1[i + 1];
499  double yL2 = yData2[i];
500  double yR2 = yData2[i + 1];
501  double yL3 = yData3[i];
502  double yR3 = yData3[i + 1];
503 
504  if (!extrapolate) { // if beyond ends of array and not extrapolating
505  if (x < xL) {
506  inter[0] = yL1;
507  inter[1] = yL2;
508  inter[2] = yL3;
509  return;
510  }
511  if (x > xR) {
512  inter[0] = yL1;
513  inter[1] = yL2;
514  inter[2] = yL3;
515  return;
516  }
517  }
518  const double m = (x - xL) / (xR - xL);
519  inter[0] = m * (yR1 - yL1) + yL1;
520  inter[1] = m * (yR2 - yL2) + yL2;
521  inter[2] = m * (yR3 - yL3) + yL3;
522 }
process_name opflash particleana ie x
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
double PropagationTimeModel::model_close ( const double *  x,
const double *  par 
)
staticprivate

Definition at line 536 of file PropagationTimeModel.cxx.

537 {
538  // par0 = joining point
539  // par1 = Landau MPV
540  // par2 = Landau width
541  // par3 = normalization
542  // par4 = Expo cte
543  // par5 = Expo tau
544  // par6 = t_min
545 
546  double y1 = par[3] * TMath::Landau(x[0], par[1], par[2]);
547  double y2 = TMath::Exp(par[4] + x[0] * par[5]);
548  if (x[0] <= par[6] || x[0] > par[0]) y1 = 0.;
549  if (x[0] < par[0]) y2 = 0.;
550 
551  return (y1 + y2);
552 }
process_name opflash particleana ie x
double PropagationTimeModel::model_far ( const double *  x,
const double *  par 
)
staticprivate

Definition at line 556 of file PropagationTimeModel.cxx.

557 {
558  // par1 = Landau MPV
559  // par2 = Landau width
560  // par3 = normalization
561  // par0 = t_min
562 
563  double y = par[3] * TMath::Landau(x[0], par[1], par[2]);
564  if (x[0] <= par[0]) y = 0.;
565 
566  return y;
567 }
process_name opflash particleana ie x
process_name opflash particleana ie ie y
void PropagationTimeModel::propagationTime ( std::vector< double > &  arrival_time_dist,
geo::Point_t const &  x0,
const size_t  OpChannel,
bool  Reflected = false 
)

Definition at line 140 of file PropagationTimeModel.cxx.

144 {
145  if (!fGeoPropTimeOnly) {
146  // Get VUV photons transport time distribution from the parametrization
147  geo::Point_t const& opDetCenter = fOpDetCenter[OpChannel];
148  if (!Reflected) {
149  double distance = std::hypot(x0.X() - opDetCenter.X(), x0.Y() - opDetCenter.Y(), x0.Z() - opDetCenter.Z());
150  double cosine;
151  if (fOpDetOrientation[OpChannel] == 1) cosine = std::abs(x0.Y() - opDetCenter.Y()) / distance;
152  else cosine = std::abs(x0.X() - opDetCenter.X()) / distance;
153 
154  double theta = fast_acos(cosine)*180./CLHEP::pi;
155  int angle_bin = theta/fangle_bin_timing_vuv;
156  getVUVTimes(arrival_time_dist, distance, angle_bin); // in ns
157  }
158  else {
159  getVISTimes(arrival_time_dist, geo::vect::toTVector3(x0),
160  geo::vect::toTVector3(opDetCenter)); // in ns
161  }
162  }
163  else if (fGeoPropTimeOnly && !Reflected) {
164  // Get VUV photons arrival time geometrically
165  geo::Point_t const& opDetCenter = fOpDetCenter[OpChannel];
166  double distance = std::hypot(x0.X() - opDetCenter.X(), x0.Y() - opDetCenter.Y(), x0.Z() - opDetCenter.Z());
167  getVUVTimesGeo(arrival_time_dist, distance); // in ns
168  }
169  else {
170  throw cet::exception("PropagationTimeModel")
171  << "Propagation time model not found.";
172  }
173 }
void getVUVTimes(std::vector< double > &arrivalTimes, const double distance_in_cm, const size_t angle_bin)
void getVISTimes(std::vector< double > &arrivalTimes, const TVector3 &ScintPoint, const TVector3 &OpDetPoint)
std::vector< geo::Point_t > fOpDetCenter
T abs(T value)
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
pdgs pi
Definition: selectors.fcl:22
double fast_acos(double x) const
std::vector< int > fOpDetOrientation
void getVUVTimesGeo(std::vector< double > &arrivalTimes, const double distance_in_cm)
TVector3 toTVector3(Vector const &v)
Converts a vector into a TVector3.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184

Member Data Documentation

std::vector<geo::BoxBoundedGeo> PropagationTimeModel::fActiveVolumes
private

Definition at line 113 of file PropagationTimeModel.h.

double PropagationTimeModel::fangle_bin_timing_vis
private

Definition at line 130 of file PropagationTimeModel.h.

double PropagationTimeModel::fangle_bin_timing_vuv
private

Definition at line 121 of file PropagationTimeModel.h.

TVector3 PropagationTimeModel::fcathode_centre
private

Definition at line 112 of file PropagationTimeModel.h.

std::vector<std::vector<std::vector<double> > > PropagationTimeModel::fcut_off_pars
private

Definition at line 133 of file PropagationTimeModel.h.

std::vector<double> PropagationTimeModel::fdistances_refl
private

Definition at line 131 of file PropagationTimeModel.h.

const bool PropagationTimeModel::fdoReflectedLight
private

Definition at line 100 of file PropagationTimeModel.h.

const bool PropagationTimeModel::fGeoPropTimeOnly
private

Definition at line 101 of file PropagationTimeModel.h.

double PropagationTimeModel::finflexion_point_distance
private

Definition at line 121 of file PropagationTimeModel.h.

larg4::ISTPC PropagationTimeModel::fISTPC
private

Definition at line 104 of file PropagationTimeModel.h.

double PropagationTimeModel::fmax_d
private

Definition at line 121 of file PropagationTimeModel.h.

double PropagationTimeModel::fmin_d
private

Definition at line 121 of file PropagationTimeModel.h.

std::vector<geo::Point_t> PropagationTimeModel::fOpDetCenter
private

Definition at line 117 of file PropagationTimeModel.h.

std::vector<int> PropagationTimeModel::fOpDetOrientation
private

Definition at line 118 of file PropagationTimeModel.h.

std::vector<std::vector<double> > PropagationTimeModel::fparameters[7]
private

Definition at line 122 of file PropagationTimeModel.h.

double PropagationTimeModel::fplane_depth
private

Definition at line 111 of file PropagationTimeModel.h.

std::vector<double> PropagationTimeModel::fradial_distances_refl
private

Definition at line 132 of file PropagationTimeModel.h.

CLHEP::HepRandomEngine& PropagationTimeModel::fScintTimeEngine
private

Definition at line 107 of file PropagationTimeModel.h.

double PropagationTimeModel::fstep_size
private

Definition at line 121 of file PropagationTimeModel.h.

std::vector<std::vector<std::vector<double> > > PropagationTimeModel::ftau_pars
private

Definition at line 134 of file PropagationTimeModel.h.

CLHEP::RandFlat PropagationTimeModel::fUniformGen
private

Definition at line 108 of file PropagationTimeModel.h.

double PropagationTimeModel::fvis_vmean
private

Definition at line 130 of file PropagationTimeModel.h.

const fhicl::ParameterSet PropagationTimeModel::fVISTimingParams
private

Definition at line 97 of file PropagationTimeModel.h.

std::vector<std::vector<double> > PropagationTimeModel::fVUV_max
private

Definition at line 126 of file PropagationTimeModel.h.

std::vector<std::vector<double> > PropagationTimeModel::fVUV_min
private

Definition at line 127 of file PropagationTimeModel.h.

std::vector<std::vector<TF1> > PropagationTimeModel::fVUV_timing
private

Definition at line 124 of file PropagationTimeModel.h.

double PropagationTimeModel::fvuv_vgroup_max
private

Definition at line 121 of file PropagationTimeModel.h.

double PropagationTimeModel::fvuv_vgroup_mean
private

Definition at line 121 of file PropagationTimeModel.h.

const fhicl::ParameterSet PropagationTimeModel::fVUVTimingParams
private

Definition at line 96 of file PropagationTimeModel.h.

size_t PropagationTimeModel::nOpDets
private

Definition at line 116 of file PropagationTimeModel.h.


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