16 #include "cetlib_except/exception.h" 26 std::string
const& instanceName )
28 , fInstanceName(instanceName)
36 std::string
const& instanceName )
40 std::make_unique<art::PtrMaker<recob::SpacePoint>>(event, instanceName);
42 std::make_unique<art::PtrMaker<recob::PointCharge>>(event, instanceName);
78 std::vector<recob::PointCharge>&& charges)
84 if (spacePoints.size() != charges.size()) {
86 <<
"Input collections of inconsistent size:" 87 <<
" " << spacePoints.size() <<
" (space points)" 88 <<
"and " << charges.size() <<
" (charges)" 97 for (
auto&& obj : spacePoints)
102 for (
auto&& obj : charges)
103 fCharges->push_back(std::move(obj));
113 std::vector<recob::SpacePoint>
const& spacePoints,
114 std::vector<recob::PointCharge>
const& charges)
120 if (spacePoints.size() != charges.size()) {
122 <<
"Input collections of inconsistent size:" 123 <<
" " << spacePoints.size() <<
" (space points)" 124 <<
"and " << charges.size() <<
" (charges)" 128 std::copy(spacePoints.begin(), spacePoints.end(), std::back_inserter(*
fSpacePoints));
131 std::copy(charges.begin(), charges.end(), std::back_inserter(*
fCharges));
176 std::string
const& instanceName)
179 producesCollector.
produces<std::vector<recob::SpacePoint>>(instanceName);
180 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!).
Reconstruction base classes.
art::Event & fEvent
The event this object is bound to.
recob::PointCharge const & charge(std::size_t i) const
Returns the last inserted charge; undefined behaviour if empty().
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.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
ChargedSpacePointCollectionCreator(art::Event &event, std::string const &instanceName={})
Constructor binding this object to a specific art event.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
void produces(std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
bool spent() const
Returns whether put() has already been called.
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.
recob::SpacePoint const & spacePoint(std::size_t i) const
Returns the specified space point; undefined behaviour if not there.
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.