LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
SimPhotonCounterAlg.cxx
Go to the documentation of this file.
1 
9 #include "SimPhotonCounterAlg.h"
10 #include "OpDetResponseInterface.h"
11 
13 {
14  FillAllRanges( p.get< std::vector<fhicl::ParameterSet> >("SimPhotonCounterParams") );
15 }
16 
17 void opdet::SimPhotonCounterAlg::FillAllRanges(std::vector<fhicl::ParameterSet> const& pv)
18 {
19  fTimeRanges.clear();
20  fWavelengthRanges.clear();
21 
22  fTimeRanges.reserve(pv.size());
23  fWavelengthRanges.reserve(pv.size());
24 
25  for(auto const& p : pv)
26  FillRanges(p);
27 }
28 
30 {
31  std::vector<float> time_range(4);
32  time_range[0] = p.get<float>("MinPromptTime");
33  time_range[1] = p.get<float>("MaxPromptTime");
34  time_range[2] = p.get<float>("MinLateTime");
35  time_range[3] = p.get<float>("MaxLateTime");
36 
37  if( time_range[0]>time_range[1] || time_range[2]>time_range[3] || time_range[1]>time_range[2] )
38  throw std::runtime_error("ERROR in SimPhotonCounterAlg: Bad time range.");
39 
40  fTimeRanges.push_back(time_range);
41 
42  std::vector<float> wavelength_range(2);
43  wavelength_range[0] = p.get<float>("MinWavelength");
44  wavelength_range[1] = p.get<float>("MaxWavelength");
45 
46  if(wavelength_range[0] >= wavelength_range[1])
47  throw std::runtime_error("ERROR in SimPhotonCounterAlg: Bad wavelength range.");
48 
49  fWavelengthRanges.push_back(wavelength_range);
50 
51 }
52 
54  opdet::OpDigiProperties const& opdigip)
55 {
56  fCounters.resize(fTimeRanges.size());
58  for(size_t i=0; i<fCounters.size(); i++)
60  fTimeRanges[i][2],fTimeRanges[i][3],
62  std::vector<float>(odresponse->NOpChannels(),opdigip.QE()));
63 }
64 
66 {
67  if(ph_col.size() != fCounters.at(0).GetVectorSize())
68  throw std::runtime_error("ERROR in SimPhotonCounterAlg: Photon collection size and OpDet size not equal.");
69 
70  for(auto const& photons : ph_col)
71  for(auto & counter : fCounters)
72  counter.AddSimPhotons(photons.second);
73 }
74 
75 void opdet::SimPhotonCounterAlg::AddSimPhotonsVector(std::vector<sim::SimPhotons> const& spv)
76 {
77  for(auto const& photons : spv)
78  for(auto & counter : fCounters)
79  counter.AddSimPhotons(photons);
80 }
81 
83 {
84  for(auto & counter : fCounters)
85  counter.ClearVectors();
86 }
87 
88 std::vector<float> const& opdet::SimPhotonCounterAlg::PromptPhotonVector(size_t i)
89 {
90  return fCounters.at(i).PromptPhotonVector();
91 }
92 
93 std::vector<float> const& opdet::SimPhotonCounterAlg::LatePhotonVector(size_t i)
94 {
95  return fCounters.at(i).LatePhotonVector();
96 }
97 
99 {
100  return fCounters.at(i);
101 }
void InitializeCounters(geo::GeometryCore const &, opdet::OpDigiProperties const &)
std::vector< float > const & LatePhotonVector(size_t)
void FillRanges(fhicl::ParameterSet const &)
SimPhotonCounter const & GetSimPhotonCounter(size_t)
void FillAllRanges(std::vector< fhicl::ParameterSet > const &)
void AddSimPhotonsVector(std::vector< sim::SimPhotons > const &)
std::vector< SimPhotonCounter > fCounters
std::vector< std::vector< float > > fTimeRanges
T get(std::string const &key) const
Definition: ParameterSet.h:231
SimPhotonCounterAlg(fhicl::ParameterSet const &)
Description of geometry of one entire detector.
std::vector< float > const & PromptPhotonVector(size_t)
std::vector< std::vector< float > > fWavelengthRanges
void AddSimPhotonCollection(sim::SimPhotonsCollection const &)
Namespace collecting geometry-related classes utilities.
double QE() const
Returns quantum efficiency.