43 #include "art/Framework/Core/EDProducer.h"
44 #include "art/Framework/Core/ModuleMacros.h"
45 #include "art/Framework/Principal/Event.h"
46 #include "art/Framework/Services/Registry/ServiceHandle.h"
72 art::ServiceHandle<geo::Geometry const>
geom;
96 : EDProducer{pset}, fSmallClusterFinderAlg(pset.get<fhicl::ParameterSet>(
"smallClustAlg"))
98 fHitFinderModuleLabel = pset.get<std::string>(
"HitFinderModuleLabel");
99 verbose = pset.get<
bool>(
"Verbose");
101 produces<std::vector<recob::Cluster>>();
102 produces<art::Assns<recob::Cluster, recob::Hit>>();
121 art::Handle<std::vector<recob::Hit>> HitListHandle;
125 std::vector<art::Ptr<recob::Hit>> hitlist;
129 std::cout <<
" ++++ Hitsreceived received " << HitListHandle->size() <<
" +++++ "
132 if (HitListHandle->size() == 0) {
136 hitlist.resize(HitListHandle->size());
139 for (
unsigned int iHit = 0; iHit < hitlist.size(); iHit++) {
140 hitlist[iHit] = art::Ptr<recob::Hit>(HitListHandle, iHit);
146 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
148 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clockData);
154 auto assn = std::make_unique<art::Assns<recob::Cluster, recob::Hit>>();
161 for (
unsigned int iplane = 0; iplane <
fNPlanes; iplane++) {
166 if (leftoverHits.size() != 0) {
168 geo::PlaneID planeID = leftoverHits.front()->WireID().planeID();
170 std::cout <<
"Writing leftover hits to cluster ID: " << iplane * 100 << std::endl;
172 ClusterParamAlgo.ImportHits(gser, leftoverHits);
197 for (
unsigned int i = 0; i < smallClusters.size(); i++) {
200 if (!smallClusters.empty()) planeID = smallClusters[i].
front()->WireID().planeID();
202 ClusterParamAlgo.ImportHits(gser, smallClusters[i]);
215 iplane * 100 + i + 1,
228 evt.put(std::move(assn));
Class managing the creation of a new recob::Cluster object.
void produce(art::Event &evt) override
SmallClusterFinderAlg fSmallClusterFinderAlg
Declaration of signal hit object.
The data type to uniquely identify a Plane.
SmallClusterFinder(fhicl::ParameterSet const &pset)
CryostatID_t Cryostat
Index of cryostat.
void FindSmallClusters(util::GeometryUtilities const &gser, detinfo::DetectorClocksData const &dataClocks, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> allHits)
static const SentryArgument_t Sentry
An instance of the sentry object.
Helper functions to create a cluster.
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
std::vector< art::Ptr< recob::Hit > > GetLeftoversByPlane(unsigned int iPlane)
Wrapper for ClusterParamsAlgBase objects to accept arbitrary input.
Declaration of cluster object.
std::string fHitFinderModuleLabel
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
int GetPlaneAndTPC(art::Ptr< recob::Hit > a, unsigned int &p, unsigned int &cs, unsigned int &t, unsigned int &w)
Encapsulate the construction of a single detector plane.
std::vector< std::vector< art::Ptr< recob::Hit > > > GetSmallClustersByPlane(unsigned int iPlane)
art::ServiceHandle< geo::Geometry const > geom
Interface to class computing cluster parameters.
TPCID_t TPC
Index of the TPC within its cryostat.
BEGIN_PROLOG could also be cout