LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
opdet::SimPhotonCounterAlg Class Reference

#include "SimPhotonCounterAlg.h"

Public Member Functions

 SimPhotonCounterAlg (fhicl::ParameterSet const &)
 
void InitializeCounters (geo::GeometryCore const &, opdet::OpDigiProperties const &)
 
void AddSimPhotonCollection (sim::SimPhotonsCollection const &)
 
void AddSimPhotonsVector (std::vector< sim::SimPhotons > const &)
 
void ClearCounters ()
 
SimPhotonCounter const & GetSimPhotonCounter (size_t)
 
std::vector< float > const & PromptPhotonVector (size_t)
 
std::vector< float > const & LatePhotonVector (size_t)
 

Private Member Functions

void FillAllRanges (std::vector< fhicl::ParameterSet > const &)
 
void FillRanges (fhicl::ParameterSet const &)
 

Private Attributes

std::vector< std::vector< float > > fWavelengthRanges
 
std::vector< std::vector< float > > fTimeRanges
 
std::vector< SimPhotonCounterfCounters
 

Detailed Description

Definition at line 29 of file SimPhotonCounterAlg.h.

Constructor & Destructor Documentation

opdet::SimPhotonCounterAlg::SimPhotonCounterAlg ( fhicl::ParameterSet const &  p)

Title: SimPhotonCounterALG Class Author: Wes Ketchum (wketc.nosp@m.hum@.nosp@m.lanl..nosp@m.gov)

Description: Alg class that counts up sim photons, leading towards comparisons with flashes and flash hypotheses.

Definition at line 15 of file SimPhotonCounterAlg.cxx.

References FillAllRanges(), and fhicl::ParameterSet::get().

16 {
17  FillAllRanges(p.get<std::vector<fhicl::ParameterSet>>("SimPhotonCounterParams"));
18 }
void FillAllRanges(std::vector< fhicl::ParameterSet > const &)

Member Function Documentation

void opdet::SimPhotonCounterAlg::AddSimPhotonCollection ( sim::SimPhotonsCollection const &  ph_col)

Definition at line 71 of file SimPhotonCounterAlg.cxx.

References util::counter(), and fCounters.

72 {
73  if (ph_col.size() != fCounters.at(0).GetVectorSize())
74  throw std::runtime_error(
75  "ERROR in SimPhotonCounterAlg: Photon collection size and OpDet size not equal.");
76 
77  for (auto const& photons : ph_col)
78  for (auto& counter : fCounters)
79  counter.AddSimPhotons(photons.second);
80 }
std::vector< SimPhotonCounter > fCounters
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:295
void opdet::SimPhotonCounterAlg::AddSimPhotonsVector ( std::vector< sim::SimPhotons > const &  spv)

Definition at line 82 of file SimPhotonCounterAlg.cxx.

References util::counter(), and fCounters.

Referenced by opdet::FlashHypothesisAnaAlg::RunComparison().

83 {
84  for (auto const& photons : spv)
85  for (auto& counter : fCounters)
86  counter.AddSimPhotons(photons);
87 }
std::vector< SimPhotonCounter > fCounters
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:295
void opdet::SimPhotonCounterAlg::ClearCounters ( )

Definition at line 89 of file SimPhotonCounterAlg.cxx.

References util::counter(), and fCounters.

90 {
91  for (auto& counter : fCounters)
92  counter.ClearVectors();
93 }
std::vector< SimPhotonCounter > fCounters
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
Definition: counter.h:295
void opdet::SimPhotonCounterAlg::FillAllRanges ( std::vector< fhicl::ParameterSet > const &  pv)
private

Definition at line 20 of file SimPhotonCounterAlg.cxx.

References FillRanges(), fTimeRanges, and fWavelengthRanges.

Referenced by SimPhotonCounterAlg().

21 {
22  fTimeRanges.clear();
23  fWavelengthRanges.clear();
24 
25  fTimeRanges.reserve(pv.size());
26  fWavelengthRanges.reserve(pv.size());
27 
28  for (auto const& p : pv)
29  FillRanges(p);
30 }
void FillRanges(fhicl::ParameterSet const &)
std::vector< std::vector< float > > fWavelengthRanges
std::vector< std::vector< float > > fTimeRanges
void opdet::SimPhotonCounterAlg::FillRanges ( fhicl::ParameterSet const &  p)
private

Definition at line 32 of file SimPhotonCounterAlg.cxx.

References fTimeRanges, fWavelengthRanges, and fhicl::ParameterSet::get().

Referenced by FillAllRanges().

33 {
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");
39 
40  if (time_range[0] > time_range[1] || time_range[2] > time_range[3] ||
41  time_range[1] > time_range[2])
42  throw std::runtime_error("ERROR in SimPhotonCounterAlg: Bad time range.");
43 
44  fTimeRanges.push_back(time_range);
45 
46  std::vector<float> wavelength_range(2);
47  wavelength_range[0] = p.get<float>("MinWavelength");
48  wavelength_range[1] = p.get<float>("MaxWavelength");
49 
50  if (wavelength_range[0] >= wavelength_range[1])
51  throw std::runtime_error("ERROR in SimPhotonCounterAlg: Bad wavelength range.");
52 
53  fWavelengthRanges.push_back(wavelength_range);
54 }
std::vector< std::vector< float > > fWavelengthRanges
std::vector< std::vector< float > > fTimeRanges
opdet::SimPhotonCounter const & opdet::SimPhotonCounterAlg::GetSimPhotonCounter ( size_t  i)

Definition at line 105 of file SimPhotonCounterAlg.cxx.

References fCounters.

Referenced by opdet::FlashHypothesisAnaAlg::RunComparison().

106 {
107  return fCounters.at(i);
108 }
std::vector< SimPhotonCounter > fCounters
void opdet::SimPhotonCounterAlg::InitializeCounters ( geo::GeometryCore const &  geo,
opdet::OpDigiProperties const &  opdigip 
)

Definition at line 56 of file SimPhotonCounterAlg.cxx.

References fCounters, fTimeRanges, fWavelengthRanges, opdet::OpDetResponseInterface::NOpChannels(), and opdet::OpDigiProperties::QE().

Referenced by opdet::FlashHypothesisAnaAlg::RunComparison().

58 {
59  fCounters.resize(fTimeRanges.size());
61  for (size_t i = 0; i < fCounters.size(); i++)
62  fCounters[i] = SimPhotonCounter(fTimeRanges[i][0],
63  fTimeRanges[i][1],
64  fTimeRanges[i][2],
65  fTimeRanges[i][3],
66  fWavelengthRanges[i][0],
67  fWavelengthRanges[i][1],
68  std::vector<float>(odresponse->NOpChannels(), opdigip.QE()));
69 }
std::vector< std::vector< float > > fWavelengthRanges
std::vector< SimPhotonCounter > fCounters
std::vector< std::vector< float > > fTimeRanges
std::vector< float > const & opdet::SimPhotonCounterAlg::LatePhotonVector ( size_t  i)

Definition at line 100 of file SimPhotonCounterAlg.cxx.

References fCounters.

101 {
102  return fCounters.at(i).LatePhotonVector();
103 }
std::vector< SimPhotonCounter > fCounters
std::vector< float > const & opdet::SimPhotonCounterAlg::PromptPhotonVector ( size_t  i)

Definition at line 95 of file SimPhotonCounterAlg.cxx.

References fCounters.

96 {
97  return fCounters.at(i).PromptPhotonVector();
98 }
std::vector< SimPhotonCounter > fCounters

Member Data Documentation

std::vector<SimPhotonCounter> opdet::SimPhotonCounterAlg::fCounters
private
std::vector<std::vector<float> > opdet::SimPhotonCounterAlg::fTimeRanges
private

Definition at line 47 of file SimPhotonCounterAlg.h.

Referenced by FillAllRanges(), FillRanges(), and InitializeCounters().

std::vector<std::vector<float> > opdet::SimPhotonCounterAlg::fWavelengthRanges
private

Definition at line 46 of file SimPhotonCounterAlg.h.

Referenced by FillAllRanges(), FillRanges(), and InitializeCounters().


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