48 std::map<std::pair<double, double>, std::vector<geo::WireID>>
fHitToWids;
90 unsigned int nw = planeGeo.Nwires();
91 for (
unsigned int w = 0;
w < nw; ++
w) {
94 if (planeGeo.View() ==
geo::kZ) {
99 auto const xyz = planeGeo.Wire(
w).GetCenter();
100 auto const xyz_next = planeGeo.Wire(
w + 1).GetCenter();
102 if (xyz.Z() == xyz_next.Z()) {
109 for (
unsigned int i = 0; i < np; i++)
120 std::vector<art::Ptr<recob::Hit>> ChHits;
125 const bool doRawDigitAssns =
false;
128 const bool doWireAssns = ChannelHitWires.isValid();
140 for (
size_t h = 0; h < ChHits.size(); h++) {
144 if (doWireAssns) wire = ChannelHitWires.at(h);
147 if (ChHits[h]->View() ==
geo::kZ) {
155 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";
193 unsigned int Ucount(0), Vcount(0);
194 for (
size_t h = 0; h < ChHits.size(); h++) {
196 if (ChHits[h]->View() ==
geo::kZ)
continue;
197 if (ChHits[h]->View() ==
geo::kU)
199 else if (ChHits[h]->View() ==
geo::kV)
202 std::pair<double, double> ChanTime((
double)chit.
Channel(),
206 std::vector<const sim::IDE*> ides;
214 bool hasIDEs = !ides.empty();
227 fHitToWids[ChanTime] = std::vector<geo::WireID>();
235 std::vector<geo::WireID> widsWithIdes;
236 for (
size_t i = 0; i < ides.size(); i++) {
237 geo::Point_t const xyzIde{ides[i]->x, ides[i]->y, ides[i]->z};
244 <<
"IDE at x = " << xyzIde.X() <<
", y = " << xyzIde.Y() <<
", z = " << xyzIde.Z()
245 <<
" does not correspond to a TPC.";
248 unsigned int tpc = tpcID.
TPC, cryo = tpcID.
Cryostat;
260 mf::LogError(
"DisambigCheat") <<
"Detected a point out of its wire plane:\n" 261 << e.what() <<
"\nUsing suggested wire " << IdeWid <<
"\n";
264 bool foundmatch(
false);
265 for (
size_t w = 0;
w < cwids.size();
w++) {
266 if (cwids[
w].TPC != tpc || cwids[
w].Cryostat != cryo)
continue;
267 if ((
unsigned int)
std::abs((
int)(IdeWid.
Wire) - (
int)(cwids[
w].Wire)) <=
269 storethis = cwids[
w];
276 <<
"IDE NearestWire return more than 1 off from channel wids: wire " << IdeWid.
Wire;
280 bool alreadyStored(
false);
281 for (
size_t wid = 0; wid < widsWithIdes.size(); wid++)
282 if (storethis == widsWithIdes[wid]) alreadyStored =
true;
283 if (!alreadyStored) widsWithIdes.push_back(storethis);
292 <<
"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
WireID suggestedWireID() const
Returns a better wire ID.
void InitHitToWids(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &ChHits)
unsigned int NTPC(CryostatID const &cryoid=details::cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
std::vector< unsigned int > fMaxWireShift
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.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
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
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.
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.
Interface for a class providing readout channel mapping to geometry.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
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.
unsigned int Nplanes(TPCID const &tpcid=details::tpc_zero) const
Returns the total number of planes in the specified TPC.
ProducesCollector & producesCollector() noexcept
geo::WireReadoutGeom const * wireReadoutGeom
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.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
virtual std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const =0
Encapsulate the construction of a single detector plane .
Contains all timing reference information for the detector.
std::string fChanHitLabel
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
range_type< T > Iterate() const
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
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified 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)
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 .