13 #include "fhiclcpp/ParameterSet.h"
17 FillAllRanges( p.get< std::vector<fhicl::ParameterSet> >(
"SimPhotonCounterParams") );
23 fWavelengthRanges.clear();
25 fTimeRanges.reserve(pv.size());
26 fWavelengthRanges.reserve(pv.size());
28 for(
auto const&
p : pv)
34 std::vector<float> time_range(4);
35 time_range[0] = p.get<
float>(
"MinPromptTime");
36 time_range[1] = p.get<
float>(
"MaxPromptTime");
37 time_range[2] = p.get<
float>(
"MinLateTime");
38 time_range[3] = p.get<
float>(
"MaxLateTime");
40 if( time_range[0]>time_range[1] || time_range[2]>time_range[3] || time_range[1]>time_range[2] )
41 throw std::runtime_error(
"ERROR in SimPhotonCounterAlg: Bad time range.");
43 fTimeRanges.push_back(time_range);
45 std::vector<float> wavelength_range(2);
46 wavelength_range[0] = p.get<
float>(
"MinWavelength");
47 wavelength_range[1] = p.get<
float>(
"MaxWavelength");
49 if(wavelength_range[0] >= wavelength_range[1])
50 throw std::runtime_error(
"ERROR in SimPhotonCounterAlg: Bad wavelength range.");
52 fWavelengthRanges.push_back(wavelength_range);
59 fCounters.resize(fTimeRanges.size());
60 art::ServiceHandle<opdet::OpDetResponseInterface const> odresponse;
61 for(
size_t i=0; i<fCounters.size(); i++)
63 fTimeRanges[i][2],fTimeRanges[i][3],
64 fWavelengthRanges[i][0],fWavelengthRanges[i][1],
65 std::vector<float>(odresponse->NOpChannels(),opdigip.
QE()));
70 if(ph_col.size() != fCounters.at(0).GetVectorSize())
71 throw std::runtime_error(
"ERROR in SimPhotonCounterAlg: Photon collection size and OpDet size not equal.");
73 for(
auto const& photons : ph_col)
75 counter.AddSimPhotons(photons.second);
80 for(
auto const& photons : spv)
93 return fCounters.at(i).PromptPhotonVector();
98 return fCounters.at(i).LatePhotonVector();
103 return fCounters.at(i);
void InitializeCounters(geo::GeometryCore const &, opdet::OpDigiProperties const &)
std::vector< float > const & LatePhotonVector(size_t)
void FillRanges(fhicl::ParameterSet const &)
double QE() const noexcept
Returns quantum efficiency.
SimPhotonCounter const & GetSimPhotonCounter(size_t)
void FillAllRanges(std::vector< fhicl::ParameterSet > const &)
void AddSimPhotonsVector(std::vector< sim::SimPhotons > const &)
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
SimPhotonCounterAlg(fhicl::ParameterSet const &)
Description of geometry of one entire detector.
std::vector< float > const & PromptPhotonVector(size_t)
void AddSimPhotonCollection(sim::SimPhotonsCollection const &)
Collection of sim::SimPhotons, indexed by channel number.