29 class FilterSimPhotonLiteTime;
47 std::vector<std::pair<int, int>>
const 64 ,
fDebug(p.get<
bool>(
"Debug",
false))
77 async<art::InEvent>();
85 std::cout <<
"\tFilterSimPhotonLiteTime: TimeWindows size is " <<
fTimeWindows.size()
90 std::cout <<
"\t\tTimeWindow " 91 <<
"[" << tw.first <<
"," << tw.second <<
"]" << std::endl;
93 if (tw.first > tw.second)
95 <<
"Bad time window initialization: tw.first>tw.second. Reverse the order!" << std::endl;
101 auto const& simPhotonsLiteCollection =
104 std::vector<int> sumNPhotonArray(
fN, 0);
106 const std::vector<sim::SimPhotonsLite>& simPhotonsLiteCollectionReflected =
109 std::vector<sim::SimPhotonsLite>();
111 size_t n_sim_photons = simPhotonsLiteCollection.size() + simPhotonsLiteCollectionReflected.size();
114 std::cout <<
"New event to filter with total # sim photons: " << n_sim_photons << std::endl;
117 for (
size_t i_pc = 0; i_pc < n_sim_photons; i_pc++) {
119 (i_pc < simPhotonsLiteCollection.size()) ?
120 simPhotonsLiteCollection[i_pc] :
121 simPhotonsLiteCollectionReflected[i_pc - simPhotonsLiteCollection.size()];
124 std::cout <<
"\tFilterSimPhotonLiteTime: Processing simphotonslite channel " 125 << simphotonslite.
OpChannel << std::endl;
128 for (
size_t i_tw = 0; i_tw <
fN; i_tw++) {
130 if (photon_pair.first >= tw.first && photon_pair.first <= tw.second) {
133 std::string photon_string =
134 (i_pc < simPhotonsLiteCollection.size()) ?
"Photon" :
"Reflected Photon";
135 std::cout <<
"\t\t" << photon_string <<
" with number " << photon_pair.second
136 <<
" at time " << photon_pair.first <<
" detected." << std::endl;
139 sumNPhotonArray[i_tw] += photon_pair.second;
142 std::cout <<
"\t\tTotal number of photons in this window (" << i_tw <<
") is now " 143 << sumNPhotonArray[i_tw] << std::endl;
152 std::cout <<
"\tFilterSimPhotonLiteTime: Final total numbers are below min of " 154 for (
size_t i_tw = 0; i_tw <
fN; ++i_tw) {
155 std::cout <<
"\t\tTimeWindow " 157 <<
"]: " << sumNPhotonArray[i_tw] << std::endl;
FilterSimPhotonLiteTime & operator=(FilterSimPhotonLiteTime const &)=delete
bool filter(art::Event &e, art::ProcessingFrame const &) override
int const fMinTotalPhotons
Minimum number of photons inside a window to pass the filter.
SharedFilter(fhicl::ParameterSet const &pset)
bool const fUseReflectedPhotons
Whether to include reflected photons in the filter.
std::map< int, int > DetectedPhotons
Number of photons detected at each given time: time tick -> photons.
bool const fDebug
Set to true to print (a lot of) debug information.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Simulation objects for optical detectors.
#define DEFINE_ART_MODULE(klass)
std::string const fReflectedLabel
Label for the reflected photons – "Reflected" by default.
int OpChannel
Optical detector channel associated to this data.
Compact representation of photons on a channel.
std::size_t const fN
Number of time winows.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
FilterSimPhotonLiteTime(fhicl::ParameterSet const &p, art::ProcessingFrame const &)
void serialize(T const &...)
std::string const fSimPhotonsLiteCollectionLabel
Label for the sim::SimPhotonsLite data product.
void CheckTimeWindows() const
cet::coded_exception< error, detail::translate > exception
std::vector< std::pair< int, int > > const fTimeWindows
Time windows used for filtering. Units are the same as in the sim::SimPhotonsLite.