14 #include "cetlib_except/exception.h" 26 , fInstanceName(instanceName)
27 , fSpacePoints(std::make_unique<std::vector<recob::SpacePoint>>())
28 , fCharges(std::make_unique<std::vector<recob::PointCharge>>())
40 fSpacePoints->push_back(spacePoint);
41 fCharges->push_back(charge);
43 assert(fSpacePoints->size() == fCharges->size());
56 fSpacePoints->push_back(std::move(spacePoint));
57 fCharges->push_back(std::move(charge));
59 assert(fSpacePoints->size() == fCharges->size());
66 std::vector<recob::SpacePoint>&& spacePoints,
67 std::vector<recob::PointCharge>&& charges
74 if (spacePoints.size() != charges.size()) {
76 <<
"Input collections of inconsistent size:" 77 <<
" " << spacePoints.size() <<
" (space points)" 78 <<
"and " << charges.size() <<
" (charges)" 87 for (
auto&& obj: spacePoints)
fSpacePoints->push_back(std::move(obj));
91 for (
auto&& obj: charges)
fCharges->push_back(std::move(obj));
102 std::vector<recob::SpacePoint>
const& spacePoints,
103 std::vector<recob::PointCharge>
const& charges
111 if (spacePoints.size() != charges.size()) {
113 <<
"Input collections of inconsistent size:" 114 <<
" " << spacePoints.size() <<
" (space points)" 115 <<
"and " << charges.size() <<
" (charges)" 120 (spacePoints.begin(), spacePoints.end(), std::back_inserter(*
fSpacePoints));
123 std::copy(charges.begin(), charges.end(), std::back_inserter(*
fCharges));
156 (std::size_t i)
const 166 (std::size_t i)
const 177 producer.
produces<std::vector<recob::SpacePoint>>(instanceName);
178 producer.
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.
std::string fInstanceName
Instance name of all the data products.
void produces(std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
std::unique_ptr< art::PtrMaker< recob::SpacePoint > > fSpacePointPtrMaker
Space point pointer maker.
static void produces(art::ProducerBase &producer, std::string const &instanceName={})
Declares the data products being produced.
ProductID put(std::unique_ptr< PROD > &&product)
ChargedSpacePointCollectionCreator(art::Event &event, std::string const &instanceName={})
Constructor binding this object to a specific art event.
bool spent() const
Returns whether put() has already been called.
bool empty() const
Returns whether there are currently no space points in the collection.
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.