All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
trkf::TCTrack Class Reference
Inheritance diagram for trkf::TCTrack:

Public Member Functions

 TCTrack (fhicl::ParameterSet const &pset)
 

Private Member Functions

void produce (art::Event &evt) override
 

Private Attributes

SpacePointAlg fSptalg
 
art::InputTag fPFPtag
 

Detailed Description

Definition at line 32 of file TCTrack_module.cc.

Constructor & Destructor Documentation

trkf::TCTrack::TCTrack ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 46 of file TCTrack_module.cc.

47  : EDProducer{pset}
48  , fSptalg{pset.get<fhicl::ParameterSet>("SpacePointAlg")}
49  , fPFPtag{pset.get<std::string>("PFPModuleLabel")}
50  {
51  produces<std::vector<recob::SpacePoint>>();
52  produces<art::Assns<recob::SpacePoint, recob::Hit>>();
53  }
SpacePointAlg fSptalg
art::InputTag fPFPtag

Member Function Documentation

void trkf::TCTrack::produce ( art::Event &  evt)
overrideprivate

Definition at line 57 of file TCTrack_module.cc.

58  {
59  // all data products are assumed to be produced by the same module that produced the PFParticles -> TrajCluster_module
60  auto pfpHandle = evt.getValidHandle<std::vector<recob::PFParticle>>(fPFPtag);
61  auto clsHandle = evt.getValidHandle<std::vector<recob::Cluster>>(fPFPtag);
62 
63  art::FindManyP<recob::Cluster> pfp_cls(pfpHandle, evt, fPFPtag);
64  art::FindManyP<recob::Hit> cls_hit(clsHandle, evt, fPFPtag);
65 
66  auto sphitassn = std::make_unique<art::Assns<recob::SpacePoint, recob::Hit>>();
67  auto spts = std::make_unique<std::vector<recob::SpacePoint>>();
68 
69  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
70  auto const detProp =
71  art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clockData);
72 
73  art::PtrVector<recob::Hit> hits;
74  for (unsigned short ipfp = 0; ipfp < pfpHandle->size(); ++ipfp) {
75  // Get the clusters associated with this PFParticle - there should be one in each plane
76  std::vector<art::Ptr<recob::Cluster>> clsList;
77  pfp_cls.get(ipfp, clsList);
78  hits.clear();
79  std::cout << "PFP " << ipfp << "\n";
80  for (unsigned short icl = 0; icl < clsList.size(); ++icl) {
81  std::vector<art::Ptr<recob::Hit>> hitList;
82  unsigned int clsIndex = clsList[icl]->ID() - 1;
83  cls_hit.get(clsIndex, hitList);
84  std::cout << " cls index " << clsIndex << " hits size " << hitList.size() << " "
85  << (int)clsList[icl]->StartWire() << ":" << (int)clsList[icl]->StartTick()
86  << " EndWire " << (int)clsList[icl]->EndWire() << ":"
87  << (int)clsList[icl]->EndTick() << "\n";
88  hits.reserve(hits.size() + hitList.size());
89  hits.insert(hits.end(), hitList.begin(), hitList.end());
90  } // icl
91  // make new space points using these hits
92  std::vector<recob::SpacePoint> new_spts;
93  fSptalg.makeSpacePoints(clockData, detProp, hits, new_spts);
94  if (new_spts.empty()) continue;
95 
96  int nspt = spts->size();
97  spts->insert(spts->end(), new_spts.begin(), new_spts.end());
98  // associate the hits with the spacepoints
99  art::PtrVector<recob::SpacePoint> sptvec;
100  for (unsigned int ispt = nspt; ispt < spts->size(); ++ispt) {
101  const recob::SpacePoint& spt = (*spts)[ispt];
102  const art::PtrVector<recob::Hit>& hits = fSptalg.getAssociatedHits(spt);
103  util::CreateAssn(evt, *spts, hits, *sphitassn, ispt);
104  } // ispt
105  } // ipfp
106 
107  evt.put(std::move(spts));
108  evt.put(std::move(sphitassn));
109 
110  } // TCTrack::produce()
SpacePointAlg fSptalg
BEGIN_PROLOG StartTick
const art::PtrVector< recob::Hit > & getAssociatedHits(const recob::SpacePoint &spt) const
void makeSpacePoints(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::PtrVector< recob::Hit > &hits, std::vector< recob::SpacePoint > &spts) const
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
art::InputTag fPFPtag
TCEvent evt
Definition: DataStructs.cxx:8
BEGIN_PROLOG could also be cout
auto const detProp

Member Data Documentation

art::InputTag trkf::TCTrack::fPFPtag
private

Definition at line 42 of file TCTrack_module.cc.

SpacePointAlg trkf::TCTrack::fSptalg
private

Definition at line 40 of file TCTrack_module.cc.


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