28 #include "nug4/ParticleNavigation/EmEveIdCalculator.h" 83 fMinHits = pset.get<
unsigned int>(
"MinHits", 1);
85 produces<std::vector<recob::Cluster>>();
86 produces<art::Assns<recob::Cluster, recob::Hit>>();
103 std::vector<art::Ptr<recob::Hit>> hits;
115 std::map<eveLoc, std::vector<art::Ptr<recob::Hit>>> eveHitMap;
120 for (
auto const& itr : hits) {
125 for (
size_t e = 0;
e < eveides.size(); ++
e) {
129 if (eveides[
e].energyFrac < 0.1)
continue;
131 eveLoc el(eveides[
e].trackID, itr->WireID().planeID());
133 eveHitMap[el].push_back(itr);
140 std::unique_ptr<std::vector<recob::Cluster>> clustercol(
new std::vector<recob::Cluster>);
141 std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> assn(
153 for (
auto hitMapItr : eveHitMap) {
158 if (hitMapItr.second.size() <
fMinHits)
continue;
161 double xyz[3] = {0.};
162 double xyz2[3] = {0.};
163 double local[3] = {0.};
164 unsigned int cryostat = hitMapItr.first.planeID.Cryostat;
165 unsigned int tpc = hitMapItr.first.planeID.TPC;
166 unsigned int plane = hitMapItr.first.planeID.Plane;
170 <<
"make cluster for eveID: " << hitMapItr.first.eveID <<
" in cryostat: " << cryostat
171 <<
" tpc: " << tpc <<
" plane: " << plane <<
" view: " << hitMapItr.second.at(0)->View();
184 xyz2[1] = xyz[1] + 10. * part->
Py() / part->
P();
185 xyz2[2] = xyz[2] + 10. * part->
Pz() / part->
P();
195 w1 = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
201 w2 = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
206 std::sort(hitMapItr.second.rbegin(), hitMapItr.second.rend(),
sortHitsByWire);
208 std::sort(hitMapItr.second.begin(), hitMapItr.second.end(),
sortHitsByWire);
211 double startWire = hitMapItr.second.front()->WireID().Wire;
212 double startTime = hitMapItr.second.front()->PeakTimeMinusRMS();
213 double endWire = hitMapItr.second.back()->WireID().Wire;
214 double endTime = hitMapItr.second.back()->PeakTimePlusRMS();
221 (((hitMapItr.first.eveID) * 10 + planeID.
Plane) * 10 +
228 ClusterParamAlgo.
ImportHits(gser, hitMapItr.second);
242 hitMapItr.second.at(0)->View(),
247 clustercol->emplace_back(
cluster.move());
252 mf::LogInfo(
"ClusterCheater") <<
"adding cluster: \n" 253 << clustercol->back() <<
"\nto collection.";
double Py(const int i=0) const
Class managing the creation of a new recob::Cluster object.
std::string fMCGeneratorLabel
label for module to get MC truth information
Encapsulate the construction of a single cyostat.
eveLoc(int id, geo::PlaneID plnID)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
const simb::MCParticle * TrackIdToParticle_P(int id) const
geo::WireID WireID() const
EDProducer(fhicl::ParameterSet const &pset)
void SetEveIdCalculator(sim::EveIdCalculator *ec)
The data type to uniquely identify a Plane.
CryostatID_t Cryostat
Index of cryostat.
WireID_t Wire
Index of the wire within its plane.
void produce(art::Event &evt) override
Cluster finding and building.
unsigned int fMinHits
minimum number of hits to make a cluster
std::string fHitModuleLabel
label for module creating recob::Hit objects
art framework interface to geometry description
static const SentryArgument_t Sentry
An instance of the sentry object.
void ImportHits(util::GeometryUtilities const &gser, Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
bool sortHitsByWire(art::Ptr< recob::Hit > a, art::Ptr< recob::Hit > b)
ClusterCheater(fhicl::ParameterSet const &pset)
bool operator<(ProductInfo const &a, ProductInfo const &b)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
Helper functions to create a cluster.
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
double P(const int i=0) const
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
Wrapper for ClusterParamsAlgBase objects to accept arbitrary input.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
PlaneID_t Plane
Index of the plane within its TPC.
Definition of data types for geometry description.
const sim::ParticleList & ParticleList() const
Declaration of signal hit object.
Encapsulate the construction of a single detector plane.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
std::vector< sim::TrackIDE > HitToEveTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
double Pz(const int i=0) const
double Vz(const int i=0) const
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Interface to class computing cluster parameters.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
LArSoft geometry interface.
std::string fG4ModuleLabel
label for module running G4 and making particles, etc
void LocalToWorld(const double *plane, double *world) const
Transform point from local plane frame to world frame.
double Vy(const int i=0) const
int ID_t
Type of cluster ID.
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane.