16 #include "cetlib_except/exception.h" 28 , fInstanceName(instanceName)
29 , fSpacePoints(std::make_unique<std::vector<recob::SpacePoint>>())
30 , fCharges(std::make_unique<std::vector<recob::PointCharge>>())
42 (
event, instanceName);
43 creator.
fChargePtrMaker = std::make_unique<art::PtrMaker<recob::PointCharge>>
44 (
event, instanceName);
57 fSpacePoints->push_back(spacePoint);
58 fCharges->push_back(charge);
60 assert(fSpacePoints->size() == fCharges->size());
73 fSpacePoints->push_back(
std::move(spacePoint));
76 assert(fSpacePoints->size() == fCharges->size());
83 std::vector<recob::SpacePoint>&& spacePoints,
84 std::vector<recob::PointCharge>&& charges
91 if (spacePoints.size() != charges.size()) {
93 <<
"Input collections of inconsistent size:" 94 <<
" " << spacePoints.size() <<
" (space points)" 95 <<
"and " << charges.size() <<
" (charges)" 119 std::vector<recob::SpacePoint>
const& spacePoints,
120 std::vector<recob::PointCharge>
const& charges
128 if (spacePoints.size() != charges.size()) {
130 <<
"Input collections of inconsistent size:" 131 <<
" " << spacePoints.size() <<
" (space points)" 132 <<
"and " << charges.size() <<
" (charges)" 137 (spacePoints.begin(), spacePoints.end(), std::back_inserter(*
fSpacePoints));
173 (std::size_t i)
const 183 (std::size_t i)
const 194 producesCollector.
produces<std::vector<recob::SpacePoint>>(instanceName);
195 producesCollector.
produces<std::vector<recob::PointCharge>>(instanceName);
art::Ptr< recob::SpacePoint > spacePointPtr(std::size_t i) const
Returns an art pointer to the specified space point (no check done!).
art::Event & fEvent
The event this object is bound to.
std::unique_ptr< std::vector< recob::SpacePoint > > fSpacePoints
Space point data.
static void produces(art::ProducesCollector &producesCollector, std::string const &instanceName={})
Declares the data products being produced.
std::string fInstanceName
Instance name of all the data products.
std::unique_ptr< art::PtrMaker< recob::SpacePoint > > fSpacePointPtrMaker
Space point pointer maker.
ChargedSpacePointCollectionCreator(art::Event &event, std::string const &instanceName={})
Constructor binding this object to a specific art event.
void produces(std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
bool spent() const
Returns whether put() has already been called.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool empty() const
Returns whether there are currently no space points in the collection.
static ChargedSpacePointCollectionCreator forPtrs(art::Event &event, std::string const &instanceName={})
Static function binding a new object to a specific art event.
Creates a collection of space points with associated charge.
art::Ptr< recob::PointCharge > chargePtr(std::size_t i) const
Returns an art pointer to the specified charge (no check done!).
std::unique_ptr< std::vector< recob::PointCharge > > fCharges
Charge data.
void addAll(std::vector< recob::SpacePoint > &&spacePoints, std::vector< recob::PointCharge > &&charges)
Inserts all the space points and associated data from the vectors into the collection.
Helpers to create space points with associated charge.
void put()
Puts all data products into the event, leaving the creator empty().
void clear()
Removes all data from the collection, making it empty().
void add(recob::SpacePoint const &spacePoint, recob::PointCharge const &charge)
Inserts the specified space point and associated data into the collection.
cet::coded_exception< error, detail::translate > exception
Event finding and building.
std::unique_ptr< art::PtrMaker< recob::PointCharge > > fChargePtrMaker
Charge pointer maker.
Charge reconstructed in the active volume.