LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ShowerEnergyAlg.cxx
Go to the documentation of this file.
1 // Class: ShowerEnergyAlg
3 // File: ShowerEnergyAlg.cxx
4 // Author: Mike Wallbank (m.wallbank@sheffield.ac.uk), November 2015
5 //
6 // Shower energy finding class
8 
10 
12  : detprop(lar::providerFrom<detinfo::DetectorPropertiesService>())
13 {
14  fUGradient = pset.get<double>("UGradient");
15  fUIntercept = pset.get<double>("UIntercept");
16  fVGradient = pset.get<double>("VGradient");
17  fVIntercept = pset.get<double>("VIntercept");
18  fZGradient = pset.get<double>("ZGradient");
19  fZIntercept = pset.get<double>("ZIntercept");
20 }
21 
23 
24  double totalCharge = 0, totalEnergy = 0;
25 
26  for (art::PtrVector<recob::Hit>::const_iterator hit = hits.begin(); hit != hits.end(); ++hit){
27  if (int((*hit)->WireID().Plane)!=plane) continue;
28  totalCharge += ( (*hit)->Integral() * TMath::Exp( (detprop->SamplingRate() * (*hit)->PeakTime()) / (detprop->ElectronLifetime()*1e3) ) );
29  }
30 
31  switch (plane) {
32  case 0:
33  totalEnergy = (totalCharge * fUGradient) + fUIntercept;
34  break;
35  case 1:
36  totalEnergy = (totalCharge * fVGradient) + fVIntercept;
37  break;
38  case 2:
39  totalEnergy = (totalCharge * fZGradient) + fZIntercept;
40  break;
41  }
42 
43  return totalEnergy;
44 
45 }
double ShowerEnergy(std::vector< art::Ptr< recob::Hit > > const &hits, int plane)
Finds the total energy deposited by the shower in this view.
detinfo::DetectorProperties const * detprop
T::provider_type const * providerFrom()
Returns a constant pointer to the provider of specified service.
Definition: ServiceUtil.h:77
virtual double SamplingRate() const =0
Returns the period of the TPC readout electronics clock.
ShowerEnergyAlg(fhicl::ParameterSet const &pset)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
void hits()
Definition: readHits.C:15
T get(std::string const &key) const
Definition: ParameterSet.h:231
General LArSoft Utilities.
Detector simulation of raw signals on wires.
data_t::const_iterator const_iterator
Definition: PtrVector.h:61
LArSoft-specific namespace.
virtual double ElectronLifetime() const =0
Returns the attenuation constant for ionization electrons.