36 template <
typename Left,
typename Right,
typename Metadata>
58 float sigma_peak_time,
60 float sigma_peak_amplitude,
62 float hit_sigma_integral,
64 short int multiplicity,
65 short int local_index,
66 float goodness_of_fit,
85 art::ServiceHandle<
geo::Geometry>()->View(digits.Channel()),
86 art::ServiceHandle<
geo::Geometry>()->SignalType(digits.Channel()),
100 float sigma_peak_time,
101 float peak_amplitude,
102 float sigma_peak_amplitude,
104 float hit_sigma_integral,
106 short int multiplicity,
107 short int local_index,
108 float goodness_of_fit,
119 sigma_peak_amplitude,
128 art::ServiceHandle<
geo::Geometry>()->SignalType(wire.Channel()),
142 float sigma_peak_time,
143 float peak_amplitude,
144 float sigma_peak_amplitude,
146 float hit_sigma_integral,
147 short int multiplicity,
148 short int local_index,
149 float goodness_of_fit,
153 wire, wireID, start_tick, end_tick,
154 rms, peak_time, sigma_peak_time, peak_amplitude, sigma_peak_amplitude,
155 hit_integral, hit_sigma_integral,
157 wire.SignalROI().
begin() + start_tick,
158 wire.SignalROI().
begin() + end_tick,
161 multiplicity, local_index,
173 float sigma_peak_time,
174 float peak_amplitude,
175 float sigma_peak_amplitude,
177 float hit_sigma_integral,
179 short int multiplicity,
180 short int local_index,
181 float goodness_of_fit,
186 wire, wireID, signal.begin_index(), signal.end_index(),
187 rms, peak_time, sigma_peak_time, peak_amplitude, sigma_peak_amplitude,
188 hit_integral, hit_sigma_integral, summedADC, multiplicity, local_index,
200 float sigma_peak_time,
201 float peak_amplitude,
202 float sigma_peak_amplitude,
204 float hit_sigma_integral,
206 short int multiplicity,
207 short int local_index,
208 float goodness_of_fit,
213 wire, wireID, rms, peak_time, sigma_peak_time, peak_amplitude, sigma_peak_amplitude,
214 hit_integral, hit_sigma_integral, summedADC, multiplicity, local_index,
215 goodness_of_fit, dof, wire.SignalROI().range(iSignalRoI)
226 hit.fWireID = wireID;
236 if (
hits)
event->put(std::move(
hits), prod_instance);
237 if (WireAssns)
event->put(std::move(WireAssns), prod_instance);
238 if (RawDigitAssns)
event->put(std::move(RawDigitAssns), prod_instance);
251 hits->emplace_back(std::move(
hit));
253 CreateAssociationsToLastHit(wire, digits);
264 hits->push_back(hit);
266 CreateAssociationsToLastHit(wire, digits);
274 <<
"HitCollectionCreator is trying to put into the event" 275 " a hit collection that was never created!\n";
286 if (!WireAssns && !RawDigitAssns)
return;
289 HitPtr_t hit_ptr(CreatePtrToLastHit());
293 WireAssns->addSingle(wire, hit_ptr);
297 RawDigitAssns->addSingle(digits, hit_ptr);
306 (std::unique_ptr<std::vector<recob::Hit>>&& srchits)
308 hits = std::move(srchits);
314 prepare_associations();
321 (std::vector<recob::Hit>
const& srchits)
323 if (!RawDigitAssns && !WireAssns)
return;
327 if (RawDigitAssns) ClearAssociations(*RawDigitAssns);
328 if (WireAssns) ClearAssociations(*WireAssns);
332 const bool bUseWiresForDigits = RawDigitAssns && (digits_label ==
"");
334 if (WireAssns || bUseWiresForDigits) {
339 =
event->getValidHandle<std::vector<recob::Wire>>(wires_label);
342 std::vector<size_t> WireMap
350 std::unique_ptr<art::FindOneP<raw::RawDigit>> WireToDigit;
351 if (bUseWiresForDigits) {
357 for (
size_t iHit = 0; iHit < srchits.size(); ++iHit) {
360 size_t iChannel = size_t(srchits[iHit].Channel());
364 if (iChannel < WireMap.size()) iWire = WireMap[iChannel];
367 <<
"No wire associated to channel #" << iChannel <<
" whence hit #" 368 << iHit <<
" comes!\n";
374 WireAssns->addSingle(wire, CreatePtr(iHit));
377 if (bUseWiresForDigits) {
382 <<
"No raw digit associated to channel #" << iChannel
383 <<
" whence hit #" << iHit <<
" comes!\n";
387 RawDigitAssns->addSingle(digit, CreatePtr(iHit));
393 if (RawDigitAssns && !bUseWiresForDigits) {
396 =
event->getValidHandle<std::vector<raw::RawDigit>>(digits_label);
399 std::vector<size_t> DigitMap
403 for (
size_t iHit = 0; iHit < srchits.size(); ++iHit) {
406 size_t iChannel = size_t(srchits[iHit].Channel());
410 if (iChannel < DigitMap.size()) iDigit = DigitMap[iChannel];
413 <<
"No raw digit associated to channel #" << iChannel
414 <<
" whence hit #" << iHit <<
" comes!\n";
419 RawDigitAssns->addSingle(digit, CreatePtr(iHit));
431 (std::unique_ptr<std::vector<recob::Hit>>&& srchits)
433 hits = std::move(srchits);
439 prepare_associations();
446 (std::vector<recob::Hit>
const& srchits)
448 if (!RawDigitAssns && !WireAssns)
return;
452 if (RawDigitAssns) ClearAssociations(*RawDigitAssns);
457 =
event->getValidHandle<std::vector<recob::Hit>>(hits_label);
462 ClearAssociations(*WireAssns);
466 if (!HitToWire.isValid()) {
468 <<
"Can't find the associations between hits and wires produced by '" 469 << hits_label <<
"'!\n";
473 std::vector<art::Ptr<recob::Wire>> WireMap;
474 for (
size_t iAssn = 0; iAssn < HitToWire.size(); ++iAssn) {
476 if (wire.
isNull())
continue;
477 size_t channelID = (size_t) wire->
Channel();
478 if (WireMap.size() <= channelID)
479 WireMap.resize(
std::max(channelID + 1, 2 * WireMap.size()), {});
480 WireMap[channelID] = std::move(wire);
484 for (
size_t iHit = 0; iHit < srchits.size(); ++iHit) {
486 size_t channelID = (size_t) hit.
Channel();
489 if ((channelID >= WireMap.size()) || !WireMap[channelID])
continue;
492 WireAssns->addSingle(WireMap[channelID], CreatePtr(iHit));
499 ClearAssociations(*RawDigitAssns);
503 if (!HitToDigits.isValid()) {
505 <<
"Can't find the associations between hits and raw digits" 506 <<
" produced by '" << hits_label <<
"'!\n";
510 std::vector<art::Ptr<raw::RawDigit>> DigitMap;
511 for (
size_t iAssn = 0; iAssn < HitToDigits.size(); ++iAssn) {
513 if (digits.
isNull())
continue;
514 size_t channelID = (size_t) digits->
Channel();
515 if (DigitMap.size() <= channelID)
516 DigitMap.resize(
std::max(channelID + 1, 2 * DigitMap.size()), {});
517 DigitMap[channelID] = std::move(digits);
521 for (
size_t iHit = 0; iHit < srchits.size(); ++iHit) {
523 size_t channelID = (size_t) hit.
Channel();
526 if ((channelID >= DigitMap.size()) || !DigitMap[channelID])
continue;
529 RawDigitAssns->addSingle(DigitMap[channelID], CreatePtr(iHit));
Collection of charge vs time digitized from a single readout channel.
Reconstruction base classes.
void prepare_associations()
Finds out the associations for the current hits.
Declaration of signal hit object.
Procedures to create maps of object locations.
ChannelID_t Channel() const
DAQ channel this raw data was read from.
void use_hits(std::unique_ptr< std::vector< recob::Hit >> &&srchits)
Uses the specified collection as data product.
std::vector< size_t > MakeIndex(Coll const &data, KeyOf key_of=KeyOf())
Creates a map of indices from an existing collection.
void swap(art::Assns< L, R, D > &other)
int TDCtick_t
Type representing a TDC tick.
Class managing the creation of a new recob::Hit object.
Helper functions to create a hit.
void use_hits(std::unique_ptr< std::vector< recob::Hit >> &&srchits)
Uses the specified collection as data product.
void prepare_associations()
Finds out the associations for the current hits.
void put_into()
Moves the data into the event.
raw::ChannelID_t Channel() const
Returns the ID of the channel (or InvalidChannelID)
void put_into()
Moves the data into the event.
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
details::FindAllP< recob::Hit, recob::Wire > HitToWire
Query object connecting a hit to a wire.
void CreateAssociationsToLastHit(art::Ptr< recob::Wire > const &wire, art::Ptr< raw::RawDigit > const &digits)
Creates associations between the last hit and the specified pointers.
void emplace_back(recob::Hit &&hit, art::Ptr< recob::Wire > const &wire=art::Ptr< recob::Wire >(), art::Ptr< raw::RawDigit > const &digits=art::Ptr< raw::RawDigit >())
Adds the specified hit to the data collection.
Detector simulation of raw signals on wires.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
void put_into()
Moves the data into the event.
Class holding the deconvoluted signals from a channel.
HitCreator(raw::RawDigit const &digits, geo::WireID const &wireID, raw::TDCtick_t start_tick, raw::TDCtick_t end_tick, float rms, float peak_time, float sigma_peak_time, float peak_amplitude, float sigma_peak_amplitude, float hit_integral, float hit_sigma_integral, float summedADC, short int multiplicity, short int local_index, float goodness_of_fit, int dof)
Constructor: extracts some information from raw digit.
Declaration of basic channel signal object.
void put_into()
Moves the data into the event.
2D representation of charge deposited in the TDC/wire plane
recob::Wire::RegionsOfInterest_t::datarange_t RegionOfInterest_t
Type of one region of interest.
Namespace collecting geometry-related classes utilities.
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
art framework interface to geometry description
Event finding and building.