137 const std::vector<art::Handle<std::vector<sim::SimPhotonsLite>>> &photon_handles = *
fPhotonLiteHandles;
150 std::unordered_map<std::string, std::unordered_map<int, sim::SimPhotonsLite> > AllPhotonsMap;
151 AllPhotonsMap[
"Direct"] = std::unordered_map<int, sim::SimPhotonsLite>();
152 AllPhotonsMap[
"Reflected"] = std::unordered_map<int, sim::SimPhotonsLite>();
153 for (
const art::Handle<std::vector<sim::SimPhotonsLite>> &opdetHandle : photon_handles) {
154 const bool Reflected = (opdetHandle.provenance()->productInstanceName() ==
"Reflected");
155 for (
auto const& litesimphotons : (*opdetHandle)){
158 auto it = AllPhotonsMap[
"Reflected"].find(litesimphotons.OpChannel);
159 if(it==AllPhotonsMap[
"Reflected"].
end())
160 AllPhotonsMap[
"Reflected"][litesimphotons.OpChannel] = litesimphotons;
162 AllPhotonsMap[
"Reflected"][litesimphotons.OpChannel] += litesimphotons;
166 auto it = AllPhotonsMap[
"Direct"].find(litesimphotons.OpChannel);
167 if(it==AllPhotonsMap[
"Direct"].
end())
168 AllPhotonsMap[
"Direct"][litesimphotons.OpChannel] = litesimphotons;
170 AllPhotonsMap[
"Direct"][litesimphotons.OpChannel] += litesimphotons;
177 std::unordered_map<int, sim::SimPhotonsLite> DirectPhotonsMap;
178 std::unordered_map<int, sim::SimPhotonsLite> ReflectedPhotonsMap;
179 std::unordered_set<short unsigned int> coatedpmts_todigitize;
183 for (
auto const& simphotons_cols : AllPhotonsMap){
185 const bool Reflected = (simphotons_cols.first==
"Reflected");
186 for (
auto const& simphotons_map : simphotons_cols.second) {
188 auto const& litesimphotons = simphotons_map.second;
190 std::vector<short unsigned int> waveform;
192 const unsigned ch = litesimphotons.OpChannel;
196 if (ch < start || ch >= start + n)
continue;
199 if( pdtype ==
"pmt_coated" ){
201 ReflectedPhotonsMap.insert(std::make_pair(ch, litesimphotons));
203 DirectPhotonsMap.insert(std::make_pair(ch, litesimphotons));
205 coatedpmts_todigitize.insert(ch);
207 else if( (Reflected) && (pdtype ==
"pmt_uncoated") ) {
220 else if((pdtype ==
"xarapuca_vuv" && !Reflected) ||
221 (pdtype ==
"xarapuca_vis" && Reflected) ) {
254 for(
auto ch : coatedpmts_todigitize){
255 std::vector<short unsigned int> waveform;
264 const std::vector<art::Handle<std::vector<sim::SimPhotons>>> &photon_handles = *
fPhotonHandles;
267 std::unordered_map<std::string, std::unordered_map<int, sim::SimPhotons> > AllPhotonsMap;
268 AllPhotonsMap[
"Direct"] = std::unordered_map<int, sim::SimPhotons>();
269 AllPhotonsMap[
"Reflected"] = std::unordered_map<int, sim::SimPhotons>();
270 for (
const art::Handle<std::vector<sim::SimPhotons>> &opdetHandle : photon_handles) {
271 const bool Reflected = (opdetHandle.provenance()->productInstanceName() ==
"Reflected");
272 for (
auto const& simphotons : (*opdetHandle)){
275 auto it = AllPhotonsMap[
"Reflected"].find(simphotons.OpChannel());
276 if(it==AllPhotonsMap[
"Reflected"].
end())
277 AllPhotonsMap[
"Reflected"][simphotons.OpChannel()] = simphotons;
279 AllPhotonsMap[
"Reflected"][simphotons.OpChannel()] += simphotons;
283 auto it = AllPhotonsMap[
"Direct"].find(simphotons.OpChannel());
284 if(it==AllPhotonsMap[
"Direct"].
end())
285 AllPhotonsMap[
"Direct"][simphotons.OpChannel()] = simphotons;
287 AllPhotonsMap[
"Direct"][simphotons.OpChannel()] += simphotons;
294 std::unordered_map<int, sim::SimPhotons> DirectPhotonsMap;
295 std::unordered_map<int, sim::SimPhotons> ReflectedPhotonsMap;
296 std::unordered_set<short unsigned int> coatedpmts_todigitize;
302 for (
auto const& simphotons_cols : AllPhotonsMap){
304 const bool Reflected = (simphotons_cols.first==
"Reflected");
305 for (
auto const& simphotons_map : simphotons_cols.second) {
307 auto const& simphotons = simphotons_map.second;
309 std::vector<short unsigned int> waveform;
310 const unsigned ch = simphotons.OpChannel();
314 if (ch < start || ch >= start + n)
continue;
316 if( pdtype ==
"pmt_coated" ){
318 ReflectedPhotonsMap.insert(std::make_pair(ch, simphotons));
320 DirectPhotonsMap.insert(std::make_pair(ch, simphotons));
322 coatedpmts_todigitize.insert(ch);
325 else if(Reflected && pdtype ==
"pmt_uncoated") {
338 if((pdtype ==
"xarapuca_vuv" && !Reflected) ||
339 (pdtype ==
"xarapuca_vis" && Reflected)) {
370 for(
auto ch : coatedpmts_todigitize){
371 std::vector<short unsigned int> waveform;
unsigned StartChannelToProcess(unsigned n) const
std::vector< raw::OpDetWaveform > * fWaveforms
void ConstructWaveform(int ch, sim::SimPhotons const &simphotons, std::vector< short unsigned int > &waveform, std::string pdtype, double start_time, unsigned n_sample)
void ConstructWaveformLiteCoatedPMT(int ch, std::vector< short unsigned int > &waveform, std::unordered_map< int, sim::SimPhotonsLite > &DirectPhotonsMap, std::unordered_map< int, sim::SimPhotonsLite > &ReflectedPhotonsMap, double start_time, unsigned n_sample)
const std::vector< art::Handle< std::vector< sim::SimPhotonsLite > > > * fPhotonLiteHandles
void ConstructWaveformLite(int ch, sim::SimPhotonsLite const &litesimphotons, std::vector< short unsigned int > &waveform, std::string pdtype, double start_time, unsigned n_sample)
opdet::sbndPDMapAlg pdsMap
std::array< double, 2 > EnableWindow
unsigned NChannelsToProcess(unsigned n) const
void ConstructWaveformLite(int ch, sim::SimPhotonsLite const &litesimphotons, std::vector< short unsigned int > &waveform, std::string pdtype, bool is_daphne, double start_time, unsigned n_samples)
auto end(FixedBins< T, C > const &) noexcept
void ConstructWaveformCoatedPMT(int ch, std::vector< short unsigned int > &waveform, std::unordered_map< int, sim::SimPhotons > &DirectPhotonsMap, std::unordered_map< int, sim::SimPhotons > &ReflectedPhotonsMap, double start_time, unsigned n_sample)
bool isElectronics(size_t ch, std::string pdname) const
const std::vector< art::Handle< std::vector< sim::SimPhotons > > > * fPhotonHandles
std::string pdType(size_t ch) const override
void ConstructWaveform(int ch, sim::SimPhotons const &simphotons, std::vector< short unsigned int > &waveform, std::string pdtype, bool is_daphne, double start_time, unsigned n_samples)
unsigned int Nsamples_Daphne