8 #ifndef CLUSTER_CLUSTERCHEATER_H 9 #define CLUSTER_CLUSTERCHEATER_H 15 #include "TStopwatch.h" 97 produces< std::vector<recob::Cluster> >();
98 produces< art::Assns<recob::Cluster, recob::Hit> >();
112 fMinHits = pset.
get<
unsigned int >(
"MinHits", 1 );
130 std::vector< art::Ptr<recob::Hit> >
hits;
142 std::map< eveLoc, std::vector< art::Ptr<recob::Hit> > > eveHitMap;
145 for(
auto const& itr : hits ){
150 for(
size_t e = 0;
e < eveides.size(); ++
e){
154 if( eveides[
e].energyFrac < 0.1)
continue;
157 itr->WireID().planeID());
159 eveHitMap[el].push_back(itr);
166 std::unique_ptr< std::vector<recob::Cluster> > clustercol(
new std::vector<recob::Cluster>);
174 for(
auto hitMapItr : eveHitMap){
179 if(hitMapItr.second.size() <
fMinHits)
continue;
182 double xyz[3] = {0.};
183 double xyz2[3] = {0.};
184 double local[3] = {0.};
185 unsigned int cryostat = hitMapItr.first.planeID.Cryostat;
186 unsigned int tpc = hitMapItr.first.planeID.TPC;
187 unsigned int plane = hitMapItr.first.planeID.Plane;
190 LOG_DEBUG(
"ClusterCheater") <<
"make cluster for eveID: " << hitMapItr.first.eveID
191 <<
" in cryostat: " << cryostat
193 <<
" plane: " << plane
194 <<
" view: " << hitMapItr.second.at(0)->View();
207 xyz2[1] = xyz[1] + 10.*part->
Py()/part->
P();
208 xyz2[2] = xyz[2] + 10.*part->
Pz()/part->
P();
218 w1 = atoi(e.explain_self().substr(e.explain_self().find(
"#")+1,5).c_str());
224 w2 = atoi(e.explain_self().substr(e.explain_self().find(
"#")+1,5).c_str());
229 std::sort(hitMapItr.second.rbegin(), hitMapItr.second.rend(),
sortHitsByWire);
231 std::sort(hitMapItr.second.begin(), hitMapItr.second.end(),
sortHitsByWire);
234 double startWire = hitMapItr.second.front()->WireID().Wire;
235 double startTime = hitMapItr.second.front()->PeakTimeMinusRMS();
236 double endWire = hitMapItr.second.back()->WireID().Wire;
237 double endTime = hitMapItr.second.back()->PeakTimePlusRMS();
244 hitMapItr.first.eveID
251 ClusterParamAlgo.
ImportHits(hitMapItr.second);
265 hitMapItr.second.at(0)->View(),
270 clustercol->emplace_back(
cluster.move());
275 mf::LogInfo(
"ClusterCheater") <<
"adding cluster: \n" 276 << clustercol->back()
277 <<
"\nto collection.";
281 evt.
put(std::move(clustercol));
282 evt.
put(std::move(assn));
const simb::MCParticle * TrackIdToParticle_P(int const &id)
virtual ~ClusterCheater()
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)
bool operator<(CryostatID const &a, CryostatID const &b)
Order cryostats with increasing ID.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
geo::WireID WireID() const
Initial tdc tick for hit.
Declaration of signal hit object.
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.
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.
bool sortHitsByWire(art::Ptr< recob::Hit > a, art::Ptr< recob::Hit > b)
ProductID put(std::unique_ptr< PROD > &&product)
ClusterCheater(fhicl::ParameterSet const &pset)
void produce(art::Event &evt)
#define DEFINE_ART_MODULE(klass)
void reconfigure(fhicl::ParameterSet const &pset)
Helper functions to create a cluster.
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
double P(const int i=0) const
T get(std::string const &key) 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.
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.
Declaration of cluster object.
Definition of data types for geometry description.
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...
const std::vector< sim::TrackIDE > HitToEveTrackIDEs(recob::Hit const &hit)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
void ImportHits(Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
double Pz(const int i=0) const
double Vz(const int i=0) const
const sim::ParticleList & ParticleList()
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.
Namespace collecting geometry-related classes utilities.
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
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.