45 std::map<std::pair<double, double>, std::vector<geo::WireID>>
fHitToWids;
85 for (
unsigned int p = 0; p < np; ++p) {
86 auto const& planeGeo =
geom->
Plane({0, 0, p});
87 unsigned int nw = planeGeo.
Nwires();
88 for (
unsigned int w = 0;
w < nw; ++
w) {
91 if (planeGeo.View() ==
geo::kZ) {
96 auto const xyz = planeGeo.Wire(
w).GetCenter();
97 auto const xyz_next = planeGeo.Wire(
w + 1).GetCenter();
99 if (xyz.Z() == xyz_next.Z()) {
106 for (
unsigned int i = 0; i < np; i++)
117 std::vector<art::Ptr<recob::Hit>> ChHits;
122 const bool doRawDigitAssns =
false;
125 const bool doWireAssns = ChannelHitWires.isValid();
137 for (
size_t h = 0; h < ChHits.size(); h++) {
141 if (doWireAssns) wire = ChannelHitWires.at(h);
144 if (ChHits[h]->View() ==
geo::kZ) {
152 std::pair<double, double> ChanTime(ChHits[h]->Channel() * 1., ChHits[h]->PeakTime() * 1.);
177 mf::LogWarning(
"InvalidWireID") <<
"wid is invalid, hit not being made\n";
191 unsigned int Ucount(0), Vcount(0);
192 for (
size_t h = 0; h < ChHits.size(); h++) {
194 if (ChHits[h]->View() ==
geo::kZ)
continue;
195 if (ChHits[h]->View() ==
geo::kU)
197 else if (ChHits[h]->View() ==
geo::kV)
200 std::pair<double, double> ChanTime((
double)chit.
Channel(),
204 std::vector<const sim::IDE*> ides;
212 bool hasIDEs = !ides.empty();
225 fHitToWids[ChanTime] = std::vector<geo::WireID>();
233 std::vector<geo::WireID> widsWithIdes;
234 for (
size_t i = 0; i < ides.size(); i++) {
235 geo::Point_t const xyzIde{ides[i]->x, ides[i]->y, ides[i]->z};
242 <<
"IDE at x = " << xyzIde.X() <<
", y = " << xyzIde.Y() <<
", z = " << xyzIde.Z()
243 <<
" does not correspond to a TPC.";
246 unsigned int tpc = tpcID.
TPC, cryo = tpcID.
Cryostat;
258 mf::LogError(
"DisambigCheat") <<
"Detected a point out of its wire plane:\n" 259 << e.what() <<
"\nUsing suggested wire " << IdeWid <<
"\n";
262 bool foundmatch(
false);
263 for (
size_t w = 0;
w < cwids.size();
w++) {
264 if (cwids[
w].TPC != tpc || cwids[
w].Cryostat != cryo)
continue;
265 if ((
unsigned int)
std::abs((
int)(IdeWid.
Wire) - (
int)(cwids[
w].Wire)) <=
267 storethis = cwids[
w];
274 <<
"IDE NearestWire return more than 1 off from channel wids: wire " << IdeWid.
Wire;
278 bool alreadyStored(
false);
279 for (
size_t wid = 0; wid < widsWithIdes.size(); wid++)
280 if (storethis == widsWithIdes[wid]) alreadyStored =
true;
281 if (!alreadyStored) widsWithIdes.push_back(storethis);
290 <<
"Nhits mismatch: " <<
fHitToWids.size() <<
" " << Ucount + Vcount;
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
unsigned int NTPC(CryostatID const &cryoid=cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
void produce(art::Event &e) override
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
DisambigCheater(fhicl::ParameterSet const &p)
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
void InitHitToWids(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &ChHits)
unsigned int Nplanes() const
Number of planes in this tpc.
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
std::vector< unsigned int > fMaxWireShift
The data type to uniquely identify a Plane.
bool isValid
Whether this ID points to a valid element.
constexpr auto abs(T v)
Returns the absolute value of the argument.
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::ServiceHandle< geo::Geometry const > geom
TPCGeo const & TPC(TPCID const &tpcid=tpc_zero) const
Returns the specified TPC.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
unsigned int fBadIDENearestWire
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Class managing the creation of a new recob::Hit object.
Helper functions to create a hit.
PlaneGeo const & Plane(PlaneID const &planeid) const
Returns the specified wire.
Collection of exceptions for Geometry system.
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
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.
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
Returns a time sigmas RMS away from the peak time.
void put_into(art::Event &)
Moves the data into an event.
Detector simulation of raw signals on wires.
ProducesCollector & producesCollector() noexcept
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
float PeakTime() const
Time of the signal peak, in tick units.
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
Encapsulate the construction of a single detector plane.
Contains all timing reference information for the detector.
std::string fChanHitLabel
unsigned int Nwires() const
Number of wires in this plane.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
object containing MC truth information necessary for making RawDigits and doing back tracking ...
std::vector< double > SimIDEsToXYZ(std::vector< sim::IDE > const &ides) const
Exception thrown on invalid wire number.
Declaration of basic channel signal object.
std::vector< const sim::IDE * > HitToSimIDEs_Ps(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
2D representation of charge deposited in the TDC/wire plane
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.
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.
art framework interface to geometry description
Encapsulate the construction of a single detector plane.