TimingFit_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file TimingFit_module.cc
3 // \brief Determine the direction of tracks using timing
4 // \author Christopher Backhouse - bckhouse@caltech.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 // NOvASoft includes
8 #include "RecoBase/Track.h"
9 #include "Utilities/AssociationUtil.h"
10 
11 // Framework includes
18 #include "fhiclcpp/ParameterSet.h"
19 
20 #include "TimingFit/TimingFitAlg.h"
21 
22 /// Timing fit
23 namespace tf
24 {
25  struct Pt;
26 
27  /// Determine the direction of tracks using timing
28  class TimingFit: public art::EDProducer
29  {
30  public:
31  explicit TimingFit(const fhicl::ParameterSet& pset);
32  ~TimingFit();
33 
34  virtual void reconfigure(const fhicl::ParameterSet& pset);
35  virtual void produce(art::Event& evt);
36  protected:
38 
40  };
41 
42  //......................................................................
44  {
45  reconfigure(pset);
46 
47  produces<std::vector<tf::TimingFitResult>>();
48  produces<art::Assns<tf::TimingFitResult, rb::Track>>();
49  }
50 
51  //......................................................................
53  {
54  }
55 
56  //......................................................................
58  {
59  fTrackLabel = pset.get<std::string>("TrackLabel");
60  }
61 
62  //......................................................................
64  {
65  std::unique_ptr<std::vector<tf::TimingFitResult>> rescol(new std::vector<tf::TimingFitResult>);
66  std::unique_ptr<art::Assns<tf::TimingFitResult, rb::Track>> assns(new art::Assns<tf::TimingFitResult, rb::Track>);
67 
69  evt.getByLabel(fTrackLabel, tracks);
70 
71  const unsigned int trackMax = tracks->size();
72  for(unsigned int trackIdx = 0; trackIdx < trackMax; ++trackIdx){
73  art::Ptr<rb::Track> track(tracks, trackIdx);
74 
75  rescol->push_back(fTimingFitAlg.HoughFit(track.get()));
76  util::CreateAssn(*this, evt, *rescol, track, *assns);
77  } // end for trackIdx
78 
79  evt.put(std::move(rescol));
80  evt.put(std::move(assns));
81  }
82 
84 
85 } // namespace tf
86 ////////////////////////////////////////////////////////////////////////
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
Represent one distance/time pair on a track.
Definition: TimingFitAlg.h:19
Determine the direction of tracks using timing.
TimingFit(const fhicl::ParameterSet &pset)
TimingFitAlg fTimingFitAlg
Algorithm to determine the direction of tracks using timing.
Definition: TimingFitAlg.h:26
DEFINE_ART_MODULE(TestTMapFile)
Timing fit.
TimingFitResult HoughFit(const rb::Track *track) const
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::string fTrackLabel
virtual void reconfigure(const fhicl::ParameterSet &pset)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
T const * get() const
Definition: Ptr.h:321
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
virtual void produce(art::Event &evt)
Float_t track
Definition: plot.C:35