9 #include "art/Framework/Core/EDProducer.h"
10 #include "art/Framework/Principal/Event.h"
11 #include "canvas/Persistency/Common/FindManyP.h"
12 #include "messagefacility/MessageLogger/MessageLogger.h"
32 art::PtrVector<recob::Hit>
GetHitsFromEvent(std::string HitModuleLabel, art::Event& evt);
34 std::string ClusterModuleLabel,
47 #include "art/Framework/Core/ModuleMacros.h"
50 DEFINE_ART_MODULE(SeedFinderModule)
57 : EDProducer{pset}, fSeedAlg(pset.get<fhicl::ParameterSet>(
"SeedAlg"))
59 fInputModuleLabel = pset.get<std::string>(
"InputModuleLabel");
60 fInputSource = pset.get<
int>(
"InputSource");
62 produces<std::vector<recob::Seed>>();
69 auto seeds = std::make_unique<std::vector<recob::Seed>>();
71 std::vector<std::vector<recob::SpacePoint>> SpacePointsWithSeeds;
74 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
76 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clockData);
80 std::vector<std::vector<art::PtrVector<recob::Hit>>> HitsPerSeed;
82 std::vector<std::vector<art::PtrVector<recob::Hit>>> SortedHits;
85 std::vector<std::vector<recob::Seed>> Seeds =
88 for (
size_t i = 0; i != Seeds.size(); ++i)
89 for (
size_t j = 0; j != Seeds.at(i).size(); ++j)
90 SeedVector.push_back(Seeds.at(i).at(j));
97 std::vector<art::PtrVector<recob::Hit>> HitCatalogue;
101 throw cet::exception(
"SeedFinderModule") <<
"Unkown source mode " <<
fInputSource <<
"\n";
104 if (SeedVector.size() > 0) {
105 for (
size_t i = 0; i != SeedVector.size(); ++i) {
106 seeds->push_back(SeedVector.at(i));
110 mf::LogInfo(
"SeedFinder") <<
"Seed finder made no seeds : no space points in event"
113 evt.put(std::move(
seeds));
122 std::string ClusterModuleLabel,
128 SortedHits.resize(3);
129 std::vector<art::Ptr<recob::Cluster>> Clusters;
131 art::Handle<std::vector<recob::Cluster>> clusterh;
132 evt.getByLabel(ClusterModuleLabel, clusterh);
134 if (clusterh.isValid()) { art::fill_ptr_vector(Clusters, clusterh); }
136 art::FindManyP<recob::Hit> fm(clusterh, evt, ClusterModuleLabel);
138 for (
size_t iclus = 0; iclus < Clusters.size(); ++iclus) {
139 art::Ptr<recob::Cluster> ThisCluster = Clusters.at(iclus);
141 std::vector<art::Ptr<recob::Hit>> ihits = fm.at(iclus);
143 art::PtrVector<recob::Hit> HitsThisCluster;
144 for (
std::vector<art::Ptr<recob::Hit>>::const_iterator i = ihits.begin(); i != ihits.end();
146 HitsThisCluster.push_back(*i);
148 SortedHits[ThisCluster->View()].push_back(HitsThisCluster);
155 art::PtrVector<recob::Hit>
159 art::PtrVector<recob::Hit> TheHits;
160 art::Handle<std::vector<recob::Hit>> hith;
161 evt.getByLabel(HitModuleLabel, hith);
162 for (
unsigned int i = 0; i < hith->size(); ++i) {
163 art::Ptr<recob::Hit>
hit(hith, i);
164 TheHits.push_back(hit);
Declaration of signal hit object.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< art::Ptr< recob::Seed > > SeedVector
Declaration of cluster object.
std::vector< recob::Seed > GetSeedsFromUnSortedHits(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, art::PtrVector< recob::Hit > const &, std::vector< art::PtrVector< recob::Hit >> &, unsigned int StopAfter=0) const
std::vector< TrajPoint > seeds
art::PtrVector< recob::Hit > Hits
void GetSortedHitsFromClusters(std::string ClusterModuleLabel, art::Event &evt, std::vector< std::vector< art::PtrVector< recob::Hit >>> &SortedHits)
std::string fInputModuleLabel
SeedFinderModule(fhicl::ParameterSet const &pset)
art::PtrVector< recob::Hit > GetHitsFromEvent(std::string HitModuleLabel, art::Event &evt)
SeedFinderAlgorithm fSeedAlg
std::vector< std::vector< recob::Seed > > GetSeedsFromSortedHits(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< std::vector< art::PtrVector< recob::Hit >>> const &SortedHits, std::vector< std::vector< art::PtrVector< recob::Hit >>> &HitsPerSeed, unsigned int StopAfter=0) const
void produce(art::Event &evt) override
art framework interface to geometry description