LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
KHitContainerWireX.cxx
Go to the documentation of this file.
1 
11 #include <map>
12 
14 #include "cetlib_except/exception.h"
15 
19 
20 namespace trkf {
21 
36  int only_plane)
37  {
38  // Get services.
39 
41 
42  // Make a temporary map from channel number to KHitGroup objects.
43  // The KHitGroup pointers are borrowed references to KHitGroup
44  // objects stored by value in the base class.
45 
46  std::map<unsigned int, KHitGroup*> group_map;
47 
48  // Loop over hits.
49 
50  for (art::PtrVector<recob::Hit>::const_iterator ihit = hits.begin(); ihit != hits.end();
51  ++ihit) {
52  const recob::Hit& hit = **ihit;
53 
54  // Extract the wire id from the Hit.
55  geo::WireID hitWireID = hit.WireID();
56 
57  uint32_t channel = hit.Channel();
58 
59  // Choose plane.
60  if (only_plane >= 0 && hitWireID.Plane != (unsigned int)(only_plane)) continue;
61 
62  // See if we need to make a new KHitGroup.
63 
64  KHitGroup* pgr = 0;
65  if (group_map.count(channel) == 0) {
66  getUnsorted().push_back(KHitGroup());
67  pgr = &(getUnsorted().back());
68  group_map[channel] = pgr;
69  }
70  else
71  pgr = group_map[channel];
72  if (!pgr) {
73  throw cet::exception("KHitContainerWireX")
74  << __func__ << ": no group map for channel " << channel << "\n";
75  }
76 
77  pgr->addHit(std::make_shared<KHitWireX>(detProp, *ihit, pgr->getSurface()));
78  }
79  }
80 
81 } // end namespace trkf
void fill(const detinfo::DetectorPropertiesData &clock_data, const art::PtrVector< recob::Hit > &hits, int only_plane) override
A KHitContainer for KHitWireX type measurements.
iterator begin()
Definition: PtrVector.h:217
Kalman filter wire-time measurement on a SurfWireX surface.
geo::WireID const & WireID() const
Initial tdc tick for hit.
Definition: Hit.h:280
void hits()
Definition: readHits.C:15
typename data_t::const_iterator const_iterator
Definition: PtrVector.h:55
iterator end()
Definition: PtrVector.h:231
const std::list< KHitGroup > & getUnsorted() const
Definition: KHitContainer.h:70
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:481
Detector simulation of raw signals on wires.
void addHit(const std::shared_ptr< const KHitBase > &hit)
Add a mesaurement into the colleciton.
Definition: KHitGroup.cxx:34
const std::shared_ptr< const Surface > & getSurface() const
Surface accessor.
Definition: KHitGroup.h:48
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:46
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Definition: Hit.h:268
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33