ElectronDriftAlg.cxx
Go to the documentation of this file.
1 //
2 // ElectronDriftAlg.cxx
3 // garsoft-mrb
4 //
5 // Created by Brian Rebel on 11/18/16.
6 //
7 
11 #include "CoreUtils/ServiceUtil.h"
12 
14 #include "fhiclcpp/ParameterSet.h"
15 
16 namespace gar {
17  namespace rosim {
18 
19  //--------------------------------------------------------------------------
21  {
22  return;
23  }
24 
25  //--------------------------------------------------------------------------
26  void ElectronDriftInfo::Reset(std::vector<double> & xPos,
27  std::vector<double> & yPos,
28  std::vector<double> & zPos,
29  std::vector<double> & time,
30  std::vector<int > & size)
31  {
32  fClusterXPos.clear();
33  fClusterYPos.clear();
34  fClusterZPos.clear();
35  fClusterTime.clear();
36  fClusterSize.clear();
37 
38  fClusterXPos.swap(xPos);
39  fClusterYPos.swap(yPos);
40  fClusterZPos.swap(zPos);
41  fClusterTime.swap(time);
42  fClusterSize.swap(size);
43 
44  if(fClusterXPos.size() != fClusterYPos.size() ||
45  fClusterXPos.size() != fClusterZPos.size() ||
46  fClusterXPos.size() != fClusterTime.size() ||
47  fClusterXPos.size() != fClusterSize.size() )
48  throw cet::exception("ElectronDriftInfo")
49  << "ElectronDriftInfo vector sizes are not consistent: "
50  << "\n\tX:"
51  << fClusterXPos.size()
52  << "\n\tY:"
53  << fClusterYPos.size()
54  << "\n\tZ:"
55  << fClusterZPos.size()
56  << "\n\tT:"
57  << fClusterTime.size()
58  << "\n\tSize:"
59  << fClusterSize.size();
60 
61  return;
62  }
63 
64 
65  //--------------------------------------------------------------------------
66  // The parameter set is in case a derived algorithm needs to be configured
67  // beyond what is available from either DetectorPropertiesService or
68  // GArPropertiesService.
69  ElectronDriftAlg::ElectronDriftAlg(CLHEP::HepRandomEngine & engine,
70  fhicl::ParameterSet const& /*pset*/)
71  : fEngine(engine)
72  {
73  // get the corrections and constants from the necessary places
74  auto detProp = gar::providerFrom<detinfo::DetectorPropertiesService>();
75  auto garProp = gar::providerFrom<detinfo::GArPropertiesService>();
76 
77  fDriftVelocity = detProp->DriftVelocity(detProp->Efield(),
78  detProp->Temperature());
79  fLifetimeCorrection = -1000. * detProp->ElectronLifetime();
80  fLongitudinalDiffusion = garProp->LongitudinalDiffusion();
81  fTransverseDiffusion = garProp->TransverseDiffusion();
82  fFanoFactor = garProp->FanoFactor();
83 
85 
86  // fLongitudinalDiffusion and fTransverseDiffusion are in microns/sqrt(cm)
87 
88  fLongDiffConst = fLongitudinalDiffusion * 1E-4; // in sqrt(cm)
89  fTransDiffConst = fTransverseDiffusion * 1E-4; // in sqrt(cm)
90 
91  return;
92  }
93 
94  //--------------------------------------------------------------------------
96  {
97  }
98 
99 
100 
101  }
102 } // rosim
double fInverseVelocity
stored for computational convenience
void Reset(std::vector< double > &xPos, std::vector< double > &yPos, std::vector< double > &zPos, std::vector< double > &time, std::vector< int > &size)
double fFanoFactor
Fano factor.
double fLongitudinalDiffusion
diffusion along the drift in microns/sqrt(cm)
double fLongDiffConst
stored for computational convenience in sqrt(cm)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
std::vector< double > fClusterXPos
x positions of each cluster drifted
std::vector< double > fClusterYPos
y positions of each cluster drifted
std::vector< double > fClusterTime
arrival time of each cluster drifted
double fLifetimeCorrection
electron lifetime correction in negative ms
std::vector< int > fClusterSize
size of each cluster drifted
std::vector< double > fClusterZPos
z positions of each cluster drifted
General GArSoft Utilities.
ElectronDriftAlg(CLHEP::HepRandomEngine &engine, fhicl::ParameterSet const &pset)
double fTransDiffConst
stored for computational convenience in sqrt(cm)
double fDriftVelocity
electron drift velocity
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double fTransverseDiffusion
diffusion transverse to the drift in microns/sqrt(cm)