LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
hit::DisambigCheater Class Reference
Inheritance diagram for hit::DisambigCheater:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 DisambigCheater (fhicl::ParameterSet const &p)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

void produce (art::Event &e) override
 
void endJob () override
 
void InitHitToWids (detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &ChHits)
 
void MakeDisambigHit (art::Ptr< recob::Hit > const &hit, geo::WireID const &wid, art::Ptr< recob::Wire > const &wire, recob::HitCollectionCreator &hcol)
 

Private Attributes

art::ServiceHandle< geo::Geometry const > geom
 
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
 
geo::WireReadoutGeom const * wireReadoutGeom
 
std::string fChanHitLabel
 
std::string fWidHitLabel
 
std::map< std::pair< double, double >, std::vector< geo::WireID > > fHitToWids
 
unsigned int fFalseChanHits
 
unsigned int fBadIDENearestWire = 0
 
std::vector< unsigned int > fMaxWireShift
 

Detailed Description

Definition at line 32 of file DisambigCheater_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

hit::DisambigCheater::DisambigCheater ( fhicl::ParameterSet const &  p)
explicit

Definition at line 65 of file DisambigCheater_module.cc.

References recob::HitAndAssociationsWriterBase::declare_products(), fChanHitLabel, fMaxWireShift, geom, geo::Iterable< IterationPolicy, Transform >::Iterate(), geo::kZ, geo::GeometryCore::Ncryostats(), geo::WireReadoutGeom::Nplanes(), geo::GeometryCore::NTPC(), art::ProductRegistryHelper::producesCollector(), w, and wireReadoutGeom.

65  : EDProducer{p}
66  {
67  fChanHitLabel = p.get<std::string>("ChanHitLabel");
68 
69  // let HitCollectionCreator declare that we are going to produce
70  // hits and associations with wires and raw digits
71  // (with no particular product label)
73 
74  // Space charge can shift true IDE postiion to far-off channels.
75  // Calculate maximum number of wires to shift hit in order to be on correct channel.
76  // Shift no more than half of the number of channels, as beyond there will
77  // have been a closer wire segment.
78  if (geom->Ncryostats() != 1 || geom->NTPC() < 1) {
79  fMaxWireShift.resize(3);
80  fMaxWireShift[0] = 1;
81  fMaxWireShift[1] = 1;
82  fMaxWireShift[2] = 1;
83  }
84  else {
85  // assume TPC 0 is typical of all in terms of number of channels
86  constexpr geo::TPCID tpcid{0, 0};
87  unsigned int np = wireReadoutGeom->Nplanes(tpcid);
88  fMaxWireShift.resize(np);
89  for (auto const& planeGeo : wireReadoutGeom->Iterate<geo::PlaneGeo>(tpcid)) {
90  unsigned int nw = planeGeo.Nwires();
91  for (unsigned int w = 0; w < nw; ++w) {
92 
93  // for vertical planes
94  if (planeGeo.View() == geo::kZ) {
95  fMaxWireShift[2] = planeGeo.Nwires();
96  break;
97  }
98 
99  auto const xyz = planeGeo.Wire(w).GetCenter();
100  auto const xyz_next = planeGeo.Wire(w + 1).GetCenter();
101 
102  if (xyz.Z() == xyz_next.Z()) {
103  fMaxWireShift[planeGeo.ID().Plane] = w;
104  break;
105  }
106  } // end wire loop
107  } // end plane loop
108 
109  for (unsigned int i = 0; i < np; i++)
110  fMaxWireShift[i] = std::floor(fMaxWireShift[i] / 2);
111  }
112  }
unsigned int NTPC(CryostatID const &cryoid=details::cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
Definition: GeometryCore.h:416
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
std::vector< unsigned int > fMaxWireShift
Planes which measure Z direction.
Definition: geo_types.h:134
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
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.
Definition: HitCreator.cxx:261
art::ServiceHandle< geo::Geometry const > geom
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:67
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
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
range_type< T > Iterate() const
Definition: Iterable.h:121
Float_t w
Definition: plot.C:20

Member Function Documentation

template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void hit::DisambigCheater::endJob ( )
overrideprivatevirtual

Reimplemented from art::EDProducer.

Definition at line 297 of file DisambigCheater_module.cc.

References DEFINE_ART_MODULE, and fFalseChanHits.

298  {
299 
300  if (fFalseChanHits > 0)
301  mf::LogWarning("DisambigCheater")
302  << fFalseChanHits << " hits had no associated IDE or WireIDs";
303  }
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
void hit::DisambigCheater::InitHitToWids ( detinfo::DetectorClocksData const &  clockData,
const std::vector< art::Ptr< recob::Hit >> &  ChHits 
)
private
Todo:
: Why would an IDE xyz position be outside of a TPC?
Todo:
: Why would an IDE ossociated with a hit return a nearest wire not on the hit's channel? Usually only one off.

Definition at line 190 of file DisambigCheater_module.cc.

References util::abs(), bt_serv, recob::Hit::Channel(), geo::WireReadoutGeom::ChannelToWire(), geo::CryostatID::Cryostat, e, fBadIDENearestWire, fHitToWids, geo::GeometryCore::FindTPCAtPosition(), fMaxWireShift, geom, geo::InvalidWireError::hasSuggestedWire(), cheat::BackTrackerService::HitToSimIDEs_Ps(), geo::CryostatID::isValid, geo::kU, geo::kV, geo::kZ, recob::Hit::PeakTime(), recob::Hit::PeakTimeMinusRMS(), recob::Hit::PeakTimePlusRMS(), geo::WireReadoutGeom::Plane(), cheat::BackTrackerService::SimIDEsToXYZ(), geo::InvalidWireError::suggestedWireID(), geo::TPCID::TPC, w, geo::WireID::Wire, and wireReadoutGeom.

Referenced by produce().

192  {
193  unsigned int Ucount(0), Vcount(0);
194  for (size_t h = 0; h < ChHits.size(); h++) {
195  recob::Hit const& chit = *(ChHits[h]);
196  if (ChHits[h]->View() == geo::kZ) continue;
197  if (ChHits[h]->View() == geo::kU)
198  Ucount++;
199  else if (ChHits[h]->View() == geo::kV)
200  Vcount++;
201  std::vector<geo::WireID> cwids = wireReadoutGeom->ChannelToWire(chit.Channel());
202  std::pair<double, double> ChanTime((double)chit.Channel(),
203  (double)chit.PeakTime()); // hit key value
204 
205  // get hit IDEs
206  std::vector<const sim::IDE*> ides;
207  try {
208  ides = bt_serv->HitToSimIDEs_Ps(clockData, chit);
209  }
210  catch (...) {
211  };
212 
213  // catch the hits that have no IDEs
214  bool hasIDEs = !ides.empty();
215  if (hasIDEs) {
216  try {
217  bt_serv->SimIDEsToXYZ(ides);
218  } //What is this supposed to be doing? It get a vector, but never assigns it anywhere. There has to be a better way to do this check
219  catch (...) {
220  hasIDEs = false;
221  }
222  } // if
223  if (!hasIDEs) {
224  mf::LogVerbatim("DisambigCheat")
225  << "Hit on channel " << chit.Channel() << " between " << chit.PeakTimeMinusRMS()
226  << " and " << chit.PeakTimePlusRMS() << " matches no IDEs.";
227  fHitToWids[ChanTime] = std::vector<geo::WireID>();
228  continue;
229  } // if no IDEs
230 
231  // see what wire ID(s) the hit-IDEs are on
232  // if none: hit maps to empty vector
233  // if one: we have a unique hit, vector of size 1
234  // if more than one: make a vector of all wids
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};
238 
239  // Occasionally, ide position is not in TPC
241  geo::TPCID tpcID = geom->FindTPCAtPosition(xyzIde);
242  if (!tpcID.isValid) {
243  mf::LogWarning("DisambigCheat")
244  << "IDE at x = " << xyzIde.X() << ", y = " << xyzIde.Y() << ", z = " << xyzIde.Z()
245  << " does not correspond to a TPC.";
246  continue;
247  }
248  unsigned int tpc = tpcID.TPC, cryo = tpcID.Cryostat;
249 
250  // NearestWire seems to be missing some correction that is applied in LArG4, and is
251  // sometimes off by one or two wires. Use it and then correct it given channel
253  geo::WireID IdeWid;
254  try {
255  IdeWid = wireReadoutGeom->Plane({tpcID, cwids[0].Plane}).NearestWireID(xyzIde);
256  }
257  catch (geo::InvalidWireError const& e) { // adopt suggestion if possible
258  if (!e.hasSuggestedWire()) throw;
259  IdeWid = e.suggestedWireID();
260  mf::LogError("DisambigCheat") << "Detected a point out of its wire plane:\n"
261  << e.what() << "\nUsing suggested wire " << IdeWid << "\n";
262  }
263  geo::WireID storethis = IdeWid; // default...
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)) <=
268  fMaxWireShift[cwids[0].Plane]) {
269  storethis = cwids[w]; // ...apply correction
270  foundmatch = true;
271  break;
272  }
273  }
274  if (!foundmatch) {
275  mf::LogWarning("DisambigCheat")
276  << "IDE NearestWire return more than 1 off from channel wids: wire " << IdeWid.Wire;
278  }
279 
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);
284  } // end loop through ides from HitToSimIdes
285 
286  fHitToWids[ChanTime] = widsWithIdes;
287 
288  } // end U/V channel hit loop
289 
290  if (fHitToWids.size() != Ucount + Vcount) {
291  mf::LogWarning("DisambigCheat")
292  << "Nhits mismatch: " << fHitToWids.size() << " " << Ucount + Vcount;
293  }
294  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
WireID suggestedWireID() const
Returns a better wire ID.
Definition: Exceptions.h:85
Planes which measure V.
Definition: geo_types.h:132
std::vector< unsigned int > fMaxWireShift
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:194
constexpr auto abs(T v)
Returns the absolute value of the argument.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:195
Planes which measure Z direction.
Definition: geo_types.h:134
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:430
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
art::ServiceHandle< geo::Geometry const > geom
Planes which measure U.
Definition: geo_types.h:131
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
std::map< std::pair< double, double >, std::vector< geo::WireID > > fHitToWids
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
float PeakTimeMinusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
Definition: Hit.h:300
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.
Definition: geo_vectors.h:180
float PeakTime() const
Time of the signal peak, in tick units.
Definition: Hit.h:226
virtual std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const =0
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< double > SimIDEsToXYZ(std::vector< sim::IDE > const &ides) const
Exception thrown on invalid wire number.
Definition: Exceptions.h:37
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
Definition: Hit.h:46
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.
Definition: Hit.h:295
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:315
Float_t e
Definition: plot.C:35
bool hasSuggestedWire() const
Returns whether we known a better wire number.
Definition: Exceptions.h:79
Float_t w
Definition: plot.C:20
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Definition: Hit.h:278
void hit::DisambigCheater::MakeDisambigHit ( art::Ptr< recob::Hit > const &  hit,
geo::WireID const &  wid,
art::Ptr< recob::Wire > const &  wire,
recob::HitCollectionCreator hcol 
)
private

Definition at line 172 of file DisambigCheater_module.cc.

References recob::HitCollectionCreator::emplace_back(), geo::CryostatID::isValid, and recob::HitCreator::move().

Referenced by produce().

177  {
178 
179  if (!wid.isValid) {
180  mf::LogWarning("InvalidWireID") << "wid is invalid, hit not being made\n";
181  return;
182  }
183 
184  // create a hit copy of the original one, but with a different wire ID
185  recob::HitCreator hit(*original_hit, wid);
186  hcol.emplace_back(hit.move(), wire);
187  }
Class managing the creation of a new recob::Hit object.
Definition: HitCreator.h:87
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.
Definition: HitCreator.cxx:299
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void hit::DisambigCheater::produce ( art::Event e)
overrideprivatevirtual
Todo:
: Decide how to handle the hits with multiple-wid activity. For now, randomly choose.

Implements art::EDProducer.

Definition at line 115 of file DisambigCheater_module.cc.

References fChanHitLabel, fFalseChanHits, fHitToWids, art::fill_ptr_vector(), art::ProductRetriever::getByLabel(), hits(), InitHitToWids(), geo::kZ, MakeDisambigHit(), recob::HitCollectionCreator::put_into(), and util::size().

116  {
117  // get hits on channels
119  evt.getByLabel(fChanHitLabel, ChanHits);
120  std::vector<art::Ptr<recob::Hit>> ChHits;
121  art::fill_ptr_vector(ChHits, ChanHits);
122 
123  // also get the associated wires and raw digits;
124  // we assume they have been created by the same module as the hits
125  const bool doRawDigitAssns = false;
126 
127  art::FindOneP<recob::Wire> ChannelHitWires(ChanHits, evt, fChanHitLabel);
128  const bool doWireAssns = ChannelHitWires.isValid();
129 
130  // this object contains the hit collection
131  // and its associations to wires and raw digits
132  // (if the original objects have them):
133  recob::HitCollectionCreator hits(evt, doWireAssns, doRawDigitAssns);
134 
135  // find the wireIDs each hit is on
136  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
137  InitHitToWids(clockData, ChHits);
138 
139  // make all of the hits
140  for (size_t h = 0; h < ChHits.size(); h++) {
141 
142  // get the objects associated with this hit
144  if (doWireAssns) wire = ChannelHitWires.at(h);
145 
146  // the trivial Z hits
147  if (ChHits[h]->View() == geo::kZ) {
148  MakeDisambigHit(ChHits[h], ChHits[h]->WireID(), wire, hits);
149  continue;
150  }
151 
152  // make U/V hits if any wire IDs are associated
153  // count hits without a wireID
155  std::pair<double, double> ChanTime(ChHits[h]->Channel() * 1., ChHits[h]->PeakTime() * 1.);
156  if (fHitToWids[ChanTime].size() == 1)
157  MakeDisambigHit(ChHits[h], fHitToWids[ChanTime][0], wire, hits);
158  else if (fHitToWids[ChanTime].size() == 0)
159  fFalseChanHits++;
160  else if (fHitToWids[ChanTime].size() > 1)
161  MakeDisambigHit(ChHits[h], fHitToWids[ChanTime][0], wire, hits); // same thing for now
162 
163  } // for
164 
165  // put the hit collection and associations into the event
166  hits.put_into(evt);
167 
168  fHitToWids.clear();
169  }
void InitHitToWids(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &ChHits)
Planes which measure Z direction.
Definition: geo_types.h:134
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
void hits()
Definition: readHits.C:15
A class handling a collection of hits and its associations.
Definition: HitCreator.h:489
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::map< std::pair< double, double >, std::vector< geo::WireID > > fHitToWids
TCEvent evt
Definition: DataStructs.cxx:8
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
void MakeDisambigHit(art::Ptr< recob::Hit > const &hit, geo::WireID const &wid, art::Ptr< recob::Wire > const &wire, recob::HitCollectionCreator &hcol)
Definition: fwd.h:26
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

art::ServiceHandle<cheat::BackTrackerService const> hit::DisambigCheater::bt_serv
private

Definition at line 41 of file DisambigCheater_module.cc.

Referenced by InitHitToWids().

unsigned int hit::DisambigCheater::fBadIDENearestWire = 0
private

Definition at line 59 of file DisambigCheater_module.cc.

Referenced by InitHitToWids().

std::string hit::DisambigCheater::fChanHitLabel
private

Definition at line 45 of file DisambigCheater_module.cc.

Referenced by DisambigCheater(), and produce().

unsigned int hit::DisambigCheater::fFalseChanHits
private
Initial value:
=
0

Definition at line 57 of file DisambigCheater_module.cc.

Referenced by endJob(), and produce().

std::map<std::pair<double, double>, std::vector<geo::WireID> > hit::DisambigCheater::fHitToWids
private

Definition at line 48 of file DisambigCheater_module.cc.

Referenced by InitHitToWids(), and produce().

std::vector<unsigned int> hit::DisambigCheater::fMaxWireShift
private

Definition at line 61 of file DisambigCheater_module.cc.

Referenced by DisambigCheater(), and InitHitToWids().

std::string hit::DisambigCheater::fWidHitLabel
private

Definition at line 46 of file DisambigCheater_module.cc.

art::ServiceHandle<geo::Geometry const> hit::DisambigCheater::geom
private

Definition at line 40 of file DisambigCheater_module.cc.

Referenced by DisambigCheater(), and InitHitToWids().

geo::WireReadoutGeom const* hit::DisambigCheater::wireReadoutGeom
private
Initial value:

Definition at line 42 of file DisambigCheater_module.cc.

Referenced by DisambigCheater(), and InitHitToWids().


The documentation for this class was generated from the following file: