10 #ifndef LARDATA_ARTDATAHELPERS_HITCREATOR_H
11 #define LARDATA_ARTDATAHELPERS_HITCREATOR_H
19 #include "art/Framework/Core/ProducesCollector.h"
20 #include "art/Persistency/Common/PtrMaker.h"
21 #include "canvas/Persistency/Common/Assns.h"
22 #include "canvas/Persistency/Common/Ptr.h"
23 #include "canvas/Utilities/InputTag.h"
24 #include "canvas/Utilities/Exception.h"
31 namespace geo {
struct WireID; }
32 namespace raw {
class RawDigit; }
34 class ProducesCollector;
121 float sigma_peak_time,
122 float peak_amplitude,
123 float sigma_peak_amplitude,
125 float hit_sigma_integral,
127 short int multiplicity,
128 short int local_index,
129 float goodness_of_fit,
165 float sigma_peak_time,
166 float peak_amplitude,
167 float sigma_peak_amplitude,
169 float hit_sigma_integral,
171 short int multiplicity,
172 short int local_index,
173 float goodness_of_fit,
211 float sigma_peak_time,
212 float peak_amplitude,
213 float sigma_peak_amplitude,
215 float hit_sigma_integral,
216 short int multiplicity,
217 short int local_index,
218 float goodness_of_fit,
254 float sigma_peak_time,
255 float peak_amplitude,
256 float sigma_peak_amplitude,
258 float hit_sigma_integral,
260 short int multiplicity,
261 short int local_index,
262 float goodness_of_fit,
299 float sigma_peak_time,
300 float peak_amplitude,
301 float sigma_peak_amplitude,
303 float hit_sigma_integral,
305 short int multiplicity,
306 short int local_index,
307 float goodness_of_fit,
432 std::vector<recob::Hit>
const&
peek()
const {
return *
hits; }
455 art::ProducesCollector& collector, std::string instance_name =
"",
456 bool doWireAssns =
true,
bool doRawDigitAssns =
true
465 std::unique_ptr<std::vector<recob::Hit>>
hits;
467 std::unique_ptr<art::Assns<recob::Wire, recob::Hit>>
WireAssns;
471 art::Event*
event =
nullptr;
488 std::string instance_name,
489 bool doWireAssns,
bool doRawDigitAssns
525 std::string instance_name =
"",
526 bool doWireAssns =
true,
bool doRawDigitAssns =
true
538 bool doWireAssns,
bool doRawDigitAssns
561 art::Ptr<recob::Wire>
const& wire = art::Ptr<recob::Wire>(),
562 art::Ptr<raw::RawDigit>
const& digits = art::Ptr<raw::RawDigit>()
576 art::Ptr<recob::Wire>
const& wire = art::Ptr<recob::Wire>(),
577 art::Ptr<raw::RawDigit>
const& digits = art::Ptr<raw::RawDigit>()
592 art::Ptr<recob::Wire>
const& wire = art::Ptr<recob::Wire>(),
593 art::Ptr<raw::RawDigit>
const& digits = art::Ptr<raw::RawDigit>()
607 {
emplace_back(std::move(hit), art::Ptr<recob::Wire>(), digits); }
619 {
emplace_back(std::move(hit), art::Ptr<recob::Wire>(), digits); }
630 (
HitCreator const& hit, art::Ptr<raw::RawDigit>
const& digits)
665 std::vector<recob::Hit>
const&
peek()
const {
return *
hits; }
677 art::Ptr<recob::Wire>
const& wire, art::Ptr<raw::RawDigit>
const& digits
710 std::string instance_name,
712 art::InputTag
const& RawDigitModuleLabel
728 art::InputTag
const& WireModuleLabel,
729 art::InputTag
const& RawDigitModuleLabel
732 (event,
"", WireModuleLabel, RawDigitModuleLabel)
750 std::string instance_name,
751 art::InputTag
const& WireModuleLabel,
769 art::InputTag
const& WireModuleLabel,
773 (event,
"", WireModuleLabel, doRawDigitAssns)
789 void use_hits(std::unique_ptr<std::vector<recob::Hit>>&& srchits);
859 art::InputTag
const& HitModuleLabel,
860 std::string instance_name =
"",
861 bool doWireAssns =
true,
bool doRawDigitAssns =
true
875 art::InputTag
const& HitModuleLabel,
876 bool doWireAssns,
bool doRawDigitAssns =
true
879 (event, HitModuleLabel,
"", doWireAssns, doRawDigitAssns)
895 void use_hits(std::unique_ptr<std::vector<recob::Hit>>&& srchits);
976 template <
typename Writer>
1001 art::ProducesCollector& collector, std::string
instanceName =
"",
1002 bool doWireAssns =
true,
bool doRawDigitAssns =
true
1024 art::ProducesCollector& collector, std::string
instanceName =
"",
1025 bool doWireAssns =
true,
bool doRawDigitAssns =
true
1066 template <
typename Writer>
1070 art::ProducesCollector& collector, std::string instanceName ,
1071 bool doWireAssns ,
bool doRawDigitAssns
1075 (collector, instanceName, doWireAssns, doRawDigitAssns);
1080 template <
typename Writer>
1083 art::ProducesCollector& collector, std::string instanceName ,
1084 bool doWireAssns ,
bool doRawDigitAssns
1090 throw art::Exception(art::errors::LogicError)
1091 <<
"HitAndAssociationsWriter<> has already declared its products.";
1093 collector_p = &collector;
1094 prodInstance = instanceName;
1095 hasWireAssns = doWireAssns;
1096 hasRawDigitAssns = doRawDigitAssns;
1097 HitAndAssociationsWriterBase::declare_products
1098 (collector, prodInstance, hasWireAssns, hasRawDigitAssns);
1103 template <
typename Writer>
1106 (art::Event& event)
const
1111 throw art::Exception(art::errors::LogicError)
1112 <<
"HitAndAssociationsWriter<>::collectionWriter() called"
1113 " before products are declared.";
1116 { event, prodInstance, hasWireAssns, hasRawDigitAssns };
1122 #endif // LARDATA_ARTDATAHELPERS_HITCREATOR_H
size_t size() const
Returns the number of hits currently in the collection.
HitPtr_t CreatePtrToLastHit() const
Creates an art pointer to the hit with the last index.
Collection of charge vs time digitized from a single readout channel.
HitAndAssociationsWriterBase::HitPtr_t HitPtr_t
void put_into(art::Event &)
Moves the data into the event.
recob::Hit const & copy() const
Returns the constructed wire.
void prepare_associations()
Finds out the associations for the current hits.
HitAndAssociationsWriterBase(art::Event &event, std::string instance_name, bool doWireAssns, bool doRawDigitAssns)
Constructor: sets instance name and whether to build associations.
std::string prod_instance
Tame of the instance for data products.
art::PtrMaker< recob::Hit > hitPtrMaker
Tool to create hit pointers,.
Writer_t collectionWriter(art::Event &event) const
Returns a new writer already configured.
art::InputTag wires_label
Label of the collection of wires to associate.
Declaration of signal hit object.
A helper to centralise creation of a hit collection data product.
std::unique_ptr< art::Assns< recob::Wire, recob::Hit > > WireAssns
Associations with wires.
Definition of basic raw digits.
void use_hits(std::unique_ptr< std::vector< recob::Hit >> &&srchits)
Uses the specified collection as data product.
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
art::Event * event
Pointer to the event we are using.
recob::Hit hit
Local instance of the hit being constructed.
process_name ccluster WireModuleLabel
int TDCtick_t
Type representing a TDC tick.
HitRefinerAssociator(art::Event &event, art::InputTag const &HitModuleLabel, bool doWireAssns, bool doRawDigitAssns=true)
Constructor: sets instance name and whether to build associations.
Class managing the creation of a new recob::Hit object.
void use_hits(std::unique_ptr< std::vector< recob::Hit >> &&srchits)
Uses the specified collection as data product.
void emplace_back(HitCreator &&hit, art::Ptr< raw::RawDigit > const &digits)
Adds the specified hit to the data collection.
A class handling a collection of hits and its associations.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
void prepare_associations()
Finds out the associations for the current hits.
void put_into()
Moves the data into the event.
art::Ptr< recob::Hit > HitPtr_t
Type of art pointer to Hit.
void reserve(size_t new_size)
Prepares the collection to host at least new_size hits.
void put_into(art::Event &)
Moves the data into the event.
void put_into()
Moves the data into the event.
void declareProducts(art::ProducesCollector &collector, std::string instanceName="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
A class handling a collection of hits and its associations.
HitPtr_t CreatePtr(size_t index) const
Creates an art pointer to the hit with the specified index.
void CreateAssociationsToLastHit(art::Ptr< recob::Wire > const &wire, art::Ptr< raw::RawDigit > const &digits)
Creates associations between the last hit and the specified pointers.
A class handling a collection of hits and its associations.
HitCollectionCreator(art::Event &event, bool doWireAssns, bool doRawDigitAssns)
Constructor: no product instance name.
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.
Writer Writer_t
Type of managed hit collection writer.
void emplace_back(HitCreator &&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.
void put_into(art::Event &)
Moves the data into an event.
bool ready() const noexcept
Returns whether the class is fully configured.
HitRefinerAssociator(art::Event &event, art::InputTag const &HitModuleLabel, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Constructor: sets instance name and whether to build associations.
bool hasWireAssns
Whether we produce hit-wire associations.
HitCollectionAssociator(art::Event &event, art::InputTag const &WireModuleLabel, bool doRawDigitAssns)
Constructor: sets instance name and whether to build associations.
art::InputTag hits_label
Label of the collection of hits.
HitCollectionAssociator(art::Event &event, std::string instance_name, art::InputTag const &WireModuleLabel, art::InputTag const &RawDigitModuleLabel)
Constructor: sets instance name and whether to build associations.
size_t size() const
Returns the number of hits currently in the collection.
void put_into()
Moves the data into the event.
art::ProducesCollector * collector_p
Collector this manager is bound to.
HitCollectionCreator(art::Event &event, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Constructor: sets instance name and whether to build associations.
bool hasRawDigitAssns
Whether we produce hit-digit associations.
void put_into(art::Event &)
Moves the data into the event.
Class holding the regions of interest of signal 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.
art::InputTag digits_label
Label of raw digits collection to associate.
std::vector< recob::Hit > const & peek() const
Returns a read-only reference to the current list of hits.
Declaration of basic channel signal object.
std::unique_ptr< art::Assns< raw::RawDigit, recob::Hit > > RawDigitAssns
Associations with raw digits.
HitCollectionAssociator(art::Event &event, art::InputTag const &WireModuleLabel, art::InputTag const &RawDigitModuleLabel)
Constructor: sets instance name and whether to build associations.
std::string prodInstance
Tame of the instance for data products.
void put_into()
Moves the data into the event.
2D representation of charge deposited in the TDC/wire plane
std::vector< recob::Hit > const & peek() const
Returns a read-only reference to the current list of hits.
recob::Wire::RegionsOfInterest_t::datarange_t RegionOfInterest_t
Type of one region of interest.
std::unique_ptr< std::vector< recob::Hit > > hits
Collection of hits.
std::string instanceName() const
Returns the configured product instance name.
HitAndAssociationsWriterManager()=default
Constructor: does not declare anything.
recob::Hit && move()
Prepares the constructed hit to be moved away.
Base class handling a collection of hits and its associations.
void emplace_back(recob::Hit &&hit, art::Ptr< raw::RawDigit > const &digits)
Adds the specified hit to the data collection.