LArSoft  v09_90_00
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
 
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 31 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 62 of file DisambigCheater_module.cc.

References recob::HitAndAssociationsWriterBase::declare_products(), fChanHitLabel, fMaxWireShift, geom, geo::kZ, geo::GeometryCore::Ncryostats(), geo::TPCGeo::Nplanes(), geo::GeometryCore::NTPC(), geo::PlaneGeo::Nwires(), geo::GeometryCore::Plane(), art::ProductRegistryHelper::producesCollector(), geo::GeometryCore::TPC(), and w.

62  : EDProducer{p}
63  {
64  fChanHitLabel = p.get<std::string>("ChanHitLabel");
65 
66  // let HitCollectionCreator declare that we are going to produce
67  // hits and associations with wires and raw digits
68  // (with no particular product label)
70 
71  // Space charge can shift true IDE postiion to far-off channels.
72  // Calculate maximum number of wires to shift hit in order to be on correct channel.
73  // Shift no more than half of the number of channels, as beyond there will
74  // have been a closer wire segment.
75  if (geom->Ncryostats() != 1 || geom->NTPC() < 1) {
76  fMaxWireShift.resize(3);
77  fMaxWireShift[0] = 1;
78  fMaxWireShift[1] = 1;
79  fMaxWireShift[2] = 1;
80  }
81  else {
82  // assume TPC 0 is typical of all in terms of number of channels
83  unsigned int np = geom->TPC().Nplanes();
84  fMaxWireShift.resize(np);
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) {
89 
90  // for vertical planes
91  if (planeGeo.View() == geo::kZ) {
92  fMaxWireShift[2] = planeGeo.Nwires();
93  break;
94  }
95 
96  auto const xyz = planeGeo.Wire(w).GetCenter();
97  auto const xyz_next = planeGeo.Wire(w + 1).GetCenter();
98 
99  if (xyz.Z() == xyz_next.Z()) {
100  fMaxWireShift[p] = w;
101  break;
102  }
103  } // end wire loop
104  } // end plane loop
105 
106  for (unsigned int i = 0; i < np; i++)
107  fMaxWireShift[i] = std::floor(fMaxWireShift[i] / 2);
108  }
109  }
unsigned int NTPC(CryostatID const &cryoid=cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
Definition: GeometryCore.h:686
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
std::vector< unsigned int > fMaxWireShift
Planes which measure Z direction.
Definition: geo_types.h:138
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:430
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:248
art::ServiceHandle< geo::Geometry const > geom
TPCGeo const & TPC(TPCID const &tpcid=tpc_zero) const
Returns the specified TPC.
Definition: GeometryCore.h:722
PlaneGeo const & Plane(PlaneID const &planeid) const
Returns the specified wire.
ProducesCollector & producesCollector() noexcept
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:242
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 295 of file DisambigCheater_module.cc.

References DEFINE_ART_MODULE, and fFalseChanHits.

296  {
297 
298  if (fFalseChanHits > 0)
299  mf::LogWarning("DisambigCheater")
300  << fFalseChanHits << " hits had no associated IDE or WireIDs";
301  }
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 187 of file DisambigCheater_module.cc.

References util::abs(), bt_serv, recob::Hit::Channel(), geo::GeometryCore::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, geo::GeometryCore::NearestWireID(), recob::Hit::PeakTime(), recob::Hit::PeakTimeMinusRMS(), recob::Hit::PeakTimePlusRMS(), cheat::BackTrackerService::SimIDEsToXYZ(), geo::InvalidWireError::suggestedWireID(), geo::TPCID::TPC, w, and geo::WireID::Wire.

Referenced by produce().

189  {
190 
191  unsigned int Ucount(0), Vcount(0);
192  for (size_t h = 0; h < ChHits.size(); h++) {
193  recob::Hit const& chit = *(ChHits[h]);
194  if (ChHits[h]->View() == geo::kZ) continue;
195  if (ChHits[h]->View() == geo::kU)
196  Ucount++;
197  else if (ChHits[h]->View() == geo::kV)
198  Vcount++;
199  std::vector<geo::WireID> cwids = geom->ChannelToWire(chit.Channel());
200  std::pair<double, double> ChanTime((double)chit.Channel(),
201  (double)chit.PeakTime()); // hit key value
202 
203  // get hit IDEs
204  std::vector<const sim::IDE*> ides;
205  try {
206  ides = bt_serv->HitToSimIDEs_Ps(clockData, chit);
207  }
208  catch (...) {
209  };
210 
211  // catch the hits that have no IDEs
212  bool hasIDEs = !ides.empty();
213  if (hasIDEs) {
214  try {
215  bt_serv->SimIDEsToXYZ(ides);
216  } //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
217  catch (...) {
218  hasIDEs = false;
219  }
220  } // if
221  if (!hasIDEs) {
222  mf::LogVerbatim("DisambigCheat")
223  << "Hit on channel " << chit.Channel() << " between " << chit.PeakTimeMinusRMS()
224  << " and " << chit.PeakTimePlusRMS() << " matches no IDEs.";
225  fHitToWids[ChanTime] = std::vector<geo::WireID>();
226  continue;
227  } // if no IDEs
228 
229  // see what wire ID(s) the hit-IDEs are on
230  // if none: hit maps to empty vector
231  // if one: we have a unique hit, vector of size 1
232  // if more than one: make a vector of all wids
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};
236 
237  // Occasionally, ide position is not in TPC
239  geo::TPCID tpcID = geom->FindTPCAtPosition(xyzIde);
240  if (!tpcID.isValid) {
241  mf::LogWarning("DisambigCheat")
242  << "IDE at x = " << xyzIde.X() << ", y = " << xyzIde.Y() << ", z = " << xyzIde.Z()
243  << " does not correspond to a TPC.";
244  continue;
245  }
246  unsigned int tpc = tpcID.TPC, cryo = tpcID.Cryostat;
247 
248  // NearestWire seems to be missing some correction that is applied in LArG4, and is
249  // sometimes off by one or two wires. Use it and then correct it given channel
251  geo::WireID IdeWid;
252  try {
253  IdeWid = geom->NearestWireID(xyzIde, geo::PlaneID{tpcID, cwids[0].Plane});
254  }
255  catch (geo::InvalidWireError const& e) { // adopt suggestion if possible
256  if (!e.hasSuggestedWire()) throw;
257  IdeWid = e.suggestedWireID();
258  mf::LogError("DisambigCheat") << "Detected a point out of its wire plane:\n"
259  << e.what() << "\nUsing suggested wire " << IdeWid << "\n";
260  }
261  geo::WireID storethis = IdeWid; // default...
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)) <=
266  fMaxWireShift[cwids[0].Plane]) {
267  storethis = cwids[w]; // ...apply correction
268  foundmatch = true;
269  break;
270  }
271  }
272  if (!foundmatch) {
273  mf::LogWarning("DisambigCheat")
274  << "IDE NearestWire return more than 1 off from channel wids: wire " << IdeWid.Wire;
276  }
277 
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);
282  } // end loop through ides from HitToSimIdes
283 
284  fHitToWids[ChanTime] = widsWithIdes;
285 
286  } // end U/V channel hit loop
287 
288  if (fHitToWids.size() != Ucount + Vcount) {
289  mf::LogWarning("DisambigCheat")
290  << "Nhits mismatch: " << fHitToWids.size() << " " << Ucount + Vcount;
291  }
292  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
art::ServiceHandle< cheat::BackTrackerService const > bt_serv
Planes which measure V.
Definition: geo_types.h:136
std::vector< unsigned int > fMaxWireShift
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:210
constexpr auto abs(T v)
Returns the absolute value of the argument.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:211
Planes which measure Z direction.
Definition: geo_types.h:138
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:563
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
art::ServiceHandle< geo::Geometry const > geom
Planes which measure U.
Definition: geo_types.h:135
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:381
float PeakTimeMinusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
Definition: Hit.h:290
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:220
WireID NearestWireID(Point_t const &point, PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
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:39
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
float PeakTimePlusRMS(float sigmas=+1.) const
Returns a time sigmas RMS away from the peak time.
Definition: Hit.h:285
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:399
Float_t e
Definition: plot.C:35
geo::WireID suggestedWireID() const
Returns a better wire ID.
Definition: Exceptions.h:87
bool hasSuggestedWire() const
Returns whether we known a better wire number.
Definition: Exceptions.h:81
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:268
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 169 of file DisambigCheater_module.cc.

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

Referenced by produce().

174  {
175 
176  if (!wid.isValid) {
177  mf::LogWarning("InvalidWireID") << "wid is invalid, hit not being made\n";
178  return;
179  }
180 
181  // create a hit copy of the original one, but with a different wire ID
182  recob::HitCreator hit(*original_hit, wid);
183  hcol.emplace_back(hit.move(), wire);
184  }
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:286
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 112 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().

113  {
114  // get hits on channels
116  evt.getByLabel(fChanHitLabel, ChanHits);
117  std::vector<art::Ptr<recob::Hit>> ChHits;
118  art::fill_ptr_vector(ChHits, ChanHits);
119 
120  // also get the associated wires and raw digits;
121  // we assume they have been created by the same module as the hits
122  const bool doRawDigitAssns = false;
123 
124  art::FindOneP<recob::Wire> ChannelHitWires(ChanHits, evt, fChanHitLabel);
125  const bool doWireAssns = ChannelHitWires.isValid();
126 
127  // this object contains the hit collection
128  // and its associations to wires and raw digits
129  // (if the original objects have them):
130  recob::HitCollectionCreator hits(evt, doWireAssns, doRawDigitAssns);
131 
132  // find the wireIDs each hit is on
133  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
134  this->InitHitToWids(clockData, ChHits);
135 
136  // make all of the hits
137  for (size_t h = 0; h < ChHits.size(); h++) {
138 
139  // get the objects associated with this hit
141  if (doWireAssns) wire = ChannelHitWires.at(h);
142 
143  // the trivial Z hits
144  if (ChHits[h]->View() == geo::kZ) {
145  this->MakeDisambigHit(ChHits[h], ChHits[h]->WireID(), wire, hits);
146  continue;
147  }
148 
149  // make U/V hits if any wire IDs are associated
150  // count hits without a wireID
152  std::pair<double, double> ChanTime(ChHits[h]->Channel() * 1., ChHits[h]->PeakTime() * 1.);
153  if (fHitToWids[ChanTime].size() == 1)
154  this->MakeDisambigHit(ChHits[h], fHitToWids[ChanTime][0], wire, hits);
155  else if (fHitToWids[ChanTime].size() == 0)
156  fFalseChanHits++;
157  else if (fHitToWids[ChanTime].size() > 1)
158  this->MakeDisambigHit(ChHits[h], fHitToWids[ChanTime][0], wire, hits); // same thing for now
159 
160  } // for
161 
162  // put the hit collection and associations into the event
163  hits.put_into(evt);
164 
165  fHitToWids.clear();
166  }
void InitHitToWids(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &ChHits)
Planes which measure Z direction.
Definition: geo_types.h:138
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:481
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 40 of file DisambigCheater_module.cc.

Referenced by InitHitToWids().

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

Definition at line 56 of file DisambigCheater_module.cc.

Referenced by InitHitToWids().

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

Definition at line 42 of file DisambigCheater_module.cc.

Referenced by DisambigCheater(), and produce().

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

Definition at line 54 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 45 of file DisambigCheater_module.cc.

Referenced by InitHitToWids(), and produce().

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

Definition at line 58 of file DisambigCheater_module.cc.

Referenced by DisambigCheater(), and InitHitToWids().

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

Definition at line 43 of file DisambigCheater_module.cc.

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

Definition at line 39 of file DisambigCheater_module.cc.

Referenced by DisambigCheater(), and InitHitToWids().


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