196 art::ServiceHandle<geo::Geometry> geo;
203 for(
auto const&
hit : hit_array)
207 std::cout <<
"[IMBECILE!] Skipping truth charge deposition ID " <<
hit.signal_id <<
" @ tick " <<
hit.tick << std::endl;
219 art::Handle<std::vector<raw::RawDigit> > digit_h;
223 for(
auto const& ch :
hit.channel_list) {
225 auto const wid = geo->ChannelToWire(ch).front();
226 _wire = (int)(wid.Wire);
229 for(
auto const& digit : *digit_h) {
230 if((
int)(digit.Channel()) != ch)
continue;
232 auto const& adcs = digit.ADCs();
236 _wf.resize(end-start+1);
237 for(
size_t index=start; index<=
end; ++index)
_wf[index-start] = adcs[index];
244 <<
" ... " << adcs.size() <<
" ADC samples start @ tick=" <<
_start_tick
245 <<
" ... mean=" <<
_mean
255 if(!found)
std::cout <<
"[IMBECILE!] Could not find target channel " <<
_ch
256 <<
" or wire " <<
_wire
269 art::Handle<std::vector<raw::RawDigit> > digit_h;
273 for(
auto const& ch :
hit.channel_list) {
275 auto const wid = geo->ChannelToWire(ch).front();
279 for(
auto const& digit : *digit_h) {
280 if((
int)(digit.Channel()) != ch)
continue;
282 auto const& adcs = digit.ADCs();
285 _wf.resize(end-start+1);
287 for(
size_t index=start; index<=
end; ++index)
_wf[index-start] = adcs[index];
294 <<
" ... " << adcs.size() <<
" ADC samples start @ tick=" <<
_start_tick
295 <<
" ... mean=" <<
_mean
305 if(!found)
std::cout <<
"[IMBECILE!] Could not find target channel " <<
_ch
306 <<
" or wire " <<
_wire
319 art::Handle<std::vector<recob::Wire> > wire_h;
321 if(!wire_h.isValid())
std::cerr <<
"[IMBECILE!] Failed to fetch Wire with label " <<
_wire_producer << std::endl;
323 for(
auto const& ch :
hit.channel_list)
326 auto const wid = geo->ChannelToWire(ch).front();
330 for(
auto const& wire : *wire_h)
332 if((
int)(wire.Channel()) != ch)
continue;
334 auto const& signalROI = wire.SignalROI();
336 for(
const auto& range : signalROI.get_ranges())
339 if(signal_tick < (
int)(range.begin_index()) || signal_tick > (
int)(range.begin_index() + range.data().size()))
343 _wf.reserve(range.data().size());
344 for(
auto const& v : range.data())
_wf.push_back(v);
352 <<
" ... " << range.data().size() <<
" ADC samples start @ tick=" <<
_start_tick
353 <<
" ... mean=" <<
_mean
365 if(!found)
std::cout <<
"[IMBECILE!] Could not find target channel " <<
_ch
366 <<
" or wire " <<
_wire
377 art::Handle<std::vector<recob::Hit> > hit_h;
379 if(!hit_h.isValid())
std::cerr <<
"[IMBECILE!] Failed to fetch Wire with label " <<
_hit_producer << std::endl;
381 for(
auto const& ch :
hit.channel_list)
384 auto const wid = geo->ChannelToWire(ch).front();
389 float diffPeakTime(1000.);
391 for(
auto const& recoHit : *hit_h)
394 if((
int)(recoHit.Channel()) != ch)
continue;
397 if(signal_tick < (
int)(recoHit.PeakTime() - 3.*recoHit.RMS()) || signal_tick > (
int)(recoHit.PeakTime() + 3.*recoHit.RMS()))
continue;
399 if (
std::abs(recoHit.PeakTime() - signal_tick) < diffPeakTime)
405 _rms = recoHit.RMS();
417 if(!found)
std::cout <<
"[IMBECILE!] Could not find target channel " <<
_ch
418 <<
" or wire " <<
_wire
art::InputTag _raw_digit_producer
art::InputTag _hit_producer
static ParamHolder & get()
BEGIN_PROLOG could also be cerr
void compute_params(const std::vector< float > &wf, float &mean, float &rms, float &min, float &max, int &argmin, int &argmax)
auto end(FixedBins< T, C > const &) noexcept
const std::vector< alternative::TruthHit > & TruthHitArray() const
art::InputTag _filtered_digit_producer
TTree * _filtered_digit_tree
art::InputTag _wire_producer
BEGIN_PROLOG could also be cout