LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
KHitContainerWireX.cxx
Go to the documentation of this file.
1 
11 #include <map>
12 
14 
15 #include "cetlib_except/exception.h"
16 
19 
20 namespace trkf {
21 
24  {}
25 
28  {}
29 
43  int only_plane)
44  {
45  // Get services.
46 
48 
49  // Make a temporary map from channel number to KHitGroup objects.
50  // The KHitGroup pointers are borrowed references to KHitGroup
51  // objects stored by value in the base class.
52 
53  std::map<unsigned int, KHitGroup*> group_map;
54 
55  // Loop over hits.
56 
58  ihit != hits.end(); ++ihit) {
59  const recob::Hit& hit = **ihit;
60 
61  // Extract the wire id from the Hit.
62  geo::WireID hitWireID = hit.WireID();
63 
64  uint32_t channel = hit.Channel();
65 
66  // Choose plane.
67  if(only_plane >= 0 && hitWireID.Plane != (unsigned int)(only_plane))
68  continue;
69 
70  // See if we need to make a new KHitGroup.
71 
72  KHitGroup* pgr = 0;
73  if(group_map.count(channel) == 0) {
74  getUnsorted().push_back(KHitGroup());
75  pgr = &(getUnsorted().back());
76  group_map[channel] = pgr;
77  }
78  else
79  pgr = group_map[channel];
80  if (!pgr) {
81  throw cet::exception("KHitContainerWireX")
82  << __func__ << ": no group map for channel " << channel << "\n";
83  }
84 
85  // Get surface from KHitGroup (might be null pointer).
86 
87  const std::shared_ptr<const Surface>& psurf = pgr->getSurface();
88 
89  // Construct KHitWireX object.
90 
91  std::shared_ptr<const KHitBase> phit(new KHitWireX(*ihit, psurf));
92 
93  // Insert hit into KHitGroup.
94 
95  pgr->addHit(phit);
96  }
97  }
98 
99 } // end namespace trkf
A KHitContainer for KHitWireX type measurements.
geo::WireID WireID() const
Initial tdc tick for hit.
Definition: Hit.h:234
iterator begin()
Definition: PtrVector.h:223
Kalman filter wire-time measurement on a SurfWireX surface.
virtual ~KHitContainerWireX()
Destructor.
void hits()
Definition: readHits.C:15
KHitContainerWireX()
Default constructor.
iterator end()
Definition: PtrVector.h:237
const std::list< KHitGroup > & getUnsorted() const
Unsorted list.
Definition: KHitContainer.h:72
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane) override
Fill container.
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
Detector simulation of raw signals on wires.
data_t::const_iterator const_iterator
Definition: PtrVector.h:61
void addHit(const std::shared_ptr< const KHitBase > &hit)
Add a mesaurement into the colleciton.
Definition: KHitGroup.cxx:39
const std::shared_ptr< const Surface > & getSurface() const
Surface accessor.
Definition: KHitGroup.h:50
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Definition: Hit.h:231
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33