80 fG4ModuleLabel = pset.get<std::string>(
"G4ModuleLabel",
"largeant");
81 fMinHits = pset.get<
unsigned int>(
"MinHits", 1);
83 produces<std::vector<recob::Cluster>>();
84 produces<art::Assns<recob::Cluster, recob::Hit>>();
100 std::vector<art::Ptr<recob::Hit>>
hits;
112 std::map<eveLoc, std::vector<art::Ptr<recob::Hit>>> eveHitMap;
117 for (
auto const& itr : hits) {
122 for (
size_t e = 0;
e < eveides.size(); ++
e) {
126 if (eveides[
e].energyFrac < 0.1)
continue;
128 eveLoc el(eveides[
e].trackID, itr->WireID().planeID());
130 eveHitMap[el].push_back(itr);
137 std::unique_ptr<std::vector<recob::Cluster>> clustercol(
new std::vector<recob::Cluster>);
138 std::unique_ptr<art::Assns<recob::Cluster, recob::Hit>> assn(
150 for (
auto hitMapItr : eveHitMap) {
155 if (hitMapItr.second.size() <
fMinHits)
continue;
158 auto const& planeID = hitMapItr.first.planeID;
159 unsigned int cryostat = planeID.Cryostat;
160 unsigned int tpc = planeID.TPC;
161 unsigned int plane = planeID.Plane;
165 <<
"make cluster for eveID: " << hitMapItr.first.eveID <<
" in cryostat: " << cryostat
166 <<
" tpc: " << tpc <<
" plane: " << plane <<
" view: " << hitMapItr.second.at(0)->View();
176 xyz.SetY(part->
Vy());
177 xyz.SetZ(part->
Vz());
179 xyz2.SetY(xyz.Y() + 10. * part->
Py() / part->
P());
180 xyz2.SetZ(xyz.Z() + 10. * part->
Pz() / part->
P());
190 w1 = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
196 w2 = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
201 std::sort(hitMapItr.second.rbegin(), hitMapItr.second.rend(),
sortHitsByWire);
203 std::sort(hitMapItr.second.begin(), hitMapItr.second.end(),
sortHitsByWire);
206 double startWire = hitMapItr.second.front()->WireID().Wire;
207 double startTime = hitMapItr.second.front()->PeakTimeMinusRMS();
208 double endWire = hitMapItr.second.back()->WireID().Wire;
209 double endTime = hitMapItr.second.back()->PeakTimePlusRMS();
215 (((hitMapItr.first.eveID) * 10 + planeID.Plane) * 10 +
222 ClusterParamAlgo.
ImportHits(gser, hitMapItr.second);
236 hitMapItr.second.at(0)->View(),
241 clustercol->emplace_back(
cluster.move());
246 mf::LogInfo(
"ClusterCheater") <<
"adding cluster: \n" 247 << clustercol->back() <<
"\nto collection.";
251 evt.
put(std::move(clustercol));
252 evt.
put(std::move(assn));
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
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
void SetEveIdCalculator(sim::EveIdCalculator *ec)
The data type to uniquely identify a Plane.
WireID_t Wire
Index of the wire within its plane.
geo::WireID const & WireID() const
Initial tdc tick for hit.
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
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)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
ClusterCheater(fhicl::ParameterSet const &pset)
PlaneGeo const & Plane(PlaneID const &planeid) const
Returns the specified wire.
Point_t GetBoxCenter() const
Returns the centre of the box representing the plane.
#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
Wrapper for ClusterParamsAlgBase objects to accept arbitrary input.
Declaration of cluster object.
Definition of data types for geometry description.
const sim::ParticleList & ParticleList() const
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.
WireID NearestWireID(Point_t const &point, PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
Encapsulate the construction of a single detector plane.
Example routine for calculating the "ultimate e-m mother" of a particle in a simulated event...
std::vector< sim::TrackIDE > HitToEveTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
double Pz(const int i=0) const
friend bool operator<(eveLoc const &a, eveLoc const &b)
double Vz(const int i=0) const
Interface to class computing cluster parameters.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Namespace collecting geometry-related classes utilities.
std::string fG4ModuleLabel
label for module running G4 and making particles, etc
double Vy(const int i=0) const
art framework interface to geometry description
int ID_t
Type of cluster ID.
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane.