14 #include "canvas/Persistency/Common/FindOneP.h" 45 std::map<std::pair<double, double>, std::vector<geo::WireID>>
fHitToWids;
85 for (
unsigned int p = 0;
p < np; ++
p) {
87 double xyz_next[3] = {0.};
89 for (
unsigned int w = 0;
w < nw; ++
w) {
100 if (xyz[2] == xyz_next[2]) {
107 for (
unsigned int i = 0; i < np; i++)
119 std::vector<art::Ptr<recob::Hit>> ChHits;
124 const bool doRawDigitAssns =
false;
126 art::FindOneP<recob::Wire> ChannelHitWires(ChanHits, evt,
fChanHitLabel);
127 const bool doWireAssns = ChannelHitWires.isValid();
139 for (
size_t h = 0;
h < ChHits.size();
h++) {
143 if (doWireAssns) wire = ChannelHitWires.at(
h);
154 std::pair<double, double> ChanTime(ChHits[
h]->Channel() * 1., ChHits[
h]->PeakTime() * 1.);
180 mf::LogWarning(
"InvalidWireID") <<
"wid is invalid, hit not being made\n";
195 unsigned int Ucount(0), Vcount(0);
196 for (
size_t h = 0;
h < ChHits.size();
h++) {
204 std::pair<double, double> ChanTime((
double)chit.
Channel(),
208 std::vector<const sim::IDE*> ides;
216 bool hasIDEs = !ides.empty();
229 fHitToWids[ChanTime] = std::vector<geo::WireID>();
237 std::vector<geo::WireID> widsWithIdes;
238 for (
size_t i = 0; i < ides.size(); i++) {
239 const double xyzIde[] = {ides[i]->x, ides[i]->y, ides[i]->z};
246 <<
"IDE at x = " << xyzIde[0] <<
", y = " << xyzIde[1] <<
", z = " << xyzIde[2]
247 <<
" does not correspond to a TPC.";
250 unsigned int tpc = tpcID.
TPC, cryo = tpcID.
Cryostat;
262 mf::LogError(
"DisambigCheat") <<
"Detected a point out of its wire plane:\n" 263 << e.what() <<
"\nUsing suggested wire " << IdeWid <<
"\n";
266 bool foundmatch(
false);
267 for (
size_t w = 0;
w < cwids.size();
w++) {
268 if (cwids[
w].
TPC != tpc || cwids[
w].Cryostat != cryo)
continue;
269 if ((
unsigned int)
std::abs((
int)(IdeWid.
Wire) - (
int)(cwids[
w].Wire)) <=
271 storethis = cwids[
w];
278 <<
"IDE NearestWire return more than 1 off from channel wids: wire " << IdeWid.
Wire;
282 bool alreadyStored(
false);
283 for (
size_t wid = 0; wid < widsWithIdes.size(); wid++)
284 if (storethis == widsWithIdes[wid]) alreadyStored =
true;
285 if (!alreadyStored) widsWithIdes.push_back(storethis);
294 <<
"Nhits mismatch: " <<
fHitToWids.size() <<
" " << Ucount + Vcount;
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void produce(art::Event &e) override
DisambigCheater(fhicl::ParameterSet const &p)
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
AdcChannelData::View View
void InitHitToWids(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &ChHits)
WireGeo const & Wire(unsigned int iwire) const
unsigned int Nplanes() const
Number of planes in this tpc.
EDProducer(fhicl::ParameterSet const &pset)
std::vector< unsigned int > fMaxWireShift
bool isValid
Whether this ID points to a valid element.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
Planes which measure Z direction.
WireID_t Wire
Index of the wire within its plane.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
art framework interface to geometry description
art::ServiceHandle< geo::Geometry const > geom
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
unsigned int fBadIDENearestWire
Class managing the creation of a new recob::Hit object.
Helper functions to create a hit.
View_t View() const
Which coordinate does this plane measure.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
A class handling a collection of hits and its associations.
#define DEFINE_ART_MODULE(klass)
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
Collection of exceptions for Geometry system.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
std::map< std::pair< double, double >, std::vector< geo::WireID > > fHitToWids
void emplace_back(recob::Hit &&hit, art::Ptr< recob::Wire > const &wire=art::Ptr< recob::Wire >(), art::Ptr< raw::RawDigit > const &digits=art::Ptr< raw::RawDigit >())
Adds the specified hit to the data collection.
The data type to uniquely identify a TPC.
Definition of data types for geometry description.
unsigned int fFalseChanHits
float PeakTimeMinusRMS(float sigmas=+1.) const
void put_into(art::Event &)
Moves the data into an event.
Detector simulation of raw signals on wires.
ProducesCollector & producesCollector() noexcept
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
float PeakTime() const
Time of the signal peak, in tick units.
Declaration of signal hit object.
Encapsulate the construction of a single detector plane.
Contains all timing reference information for the detector.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
std::string fChanHitLabel
unsigned int Nwires() const
Number of wires in this plane.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< double > SimIDEsToXYZ(std::vector< sim::IDE > const &ides) const
Exception thrown on invalid wire number.
geo::WireID NearestWireID(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
Declaration of basic channel signal object.
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
2D representation of charge deposited in the TDC/wire plane
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
float PeakTimePlusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
void MakeDisambigHit(art::Ptr< recob::Hit > const &hit, geo::WireID const &wid, art::Ptr< recob::Wire > const &wire, recob::HitCollectionCreator &hcol)
geo::WireID suggestedWireID() const
Returns a better wire ID.
recob::tracking::Plane Plane
bool hasSuggestedWire() const
Returns whether we known a better wire number.
recob::Hit && move()
Prepares the constructed hit to be moved away.
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Encapsulate the construction of a single detector plane.