All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KHitContainerWireLine.cxx
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////
2 ///
3 /// \file KHitContainerWireLine.cxx
4 ///
5 /// \brief A KHitContainer for KHitWireLine type measurements.
6 ///
7 /// \author H. Greenlee
8 ///
9 ////////////////////////////////////////////////////////////////////////
10 
12 
13 #include "art/Framework/Services/Registry/ServiceHandle.h"
14 #include "cetlib_except/exception.h"
15 
18 
19 namespace trkf {
20 
21  /// Fill container.
22  ///
23  /// Arguments:
24  ///
25  /// hits - RecoBase/Hit collection.
26  /// only_plane - Choose hits from this plane if >= 0.
27  ///
28  /// This method converts the hits in the input collection into
29  /// KHitWireLine objects and inserts them into the base class.
30  ///
31  void
33  const art::PtrVector<recob::Hit>& hits,
34  int only_plane)
35  {
36  // Get services.
37 
38  art::ServiceHandle<geo::Geometry const> geom;
39 
40  // Loop over hits.
41 
42  for (art::PtrVector<recob::Hit>::const_iterator ihit = hits.begin(); ihit != hits.end();
43  ++ihit) {
44  const recob::Hit& hit = **ihit;
45 
46  // Extract the wireid from the Hit.
47  geo::WireID hitWireID = hit.WireID();
48 
49  uint32_t channel = hit.Channel();
50 
51  // Choose plane.
52  if (only_plane >= 0 && hitWireID.Plane != (unsigned int)(only_plane)) continue;
53 
54  // Make a new KHitGroup for each hit.
55 
56  getUnsorted().push_back(KHitGroup());
57  KHitGroup* pgr = &(getUnsorted().back());
58  if (!pgr) {
59  throw cet::exception("KHitContainerWireLine")
60  << __func__ << ": no group map for channel " << channel << "\n";
61  }
62 
63  pgr->addHit(std::make_shared<KHitWireLine>(detProp, *ihit, pgr->getSurface()));
64  }
65  }
66 
67 } // end namespace trkf
void fill(const detinfo::DetectorPropertiesData &detProp, const art::PtrVector< recob::Hit > &hits, int only_plane) override
A KHitContainer for KHitWireLine type measurements.
geo::WireID WireID() const
Definition: Hit.h:233
process_name hit
Definition: cheaterreco.fcl:51
const std::list< KHitGroup > & getUnsorted() const
Definition: KHitContainer.h:75
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
void addHit(const std::shared_ptr< const KHitBase > &hit)
Add a mesaurement into the colleciton.
Definition: KHitGroup.cxx:39
Kalman filter wire-time measurement on a SurfWireLine surface.
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:48
raw::ChannelID_t Channel() const
ID of the readout channel the hit was extracted from.
Definition: Hit.h:230
art framework interface to geometry description
auto const detProp