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  : EDProducer(pset)
45  {
46  reconfigure(pset);
47 
48  produces<std::vector<tf::TimingFitResult>>();
49  produces<art::Assns<tf::TimingFitResult, rb::Track>>();
50  }
51 
52  //......................................................................
54  {
55  }
56 
57  //......................................................................
59  {
60  fTrackLabel = pset.get<std::string>("TrackLabel");
61  }
62 
63  //......................................................................
65  {
66  std::unique_ptr<std::vector<tf::TimingFitResult>> rescol(new std::vector<tf::TimingFitResult>);
67  std::unique_ptr<art::Assns<tf::TimingFitResult, rb::Track>> assns(new art::Assns<tf::TimingFitResult, rb::Track>);
68 
70  evt.getByLabel(fTrackLabel, tracks);
71 
72  const unsigned int trackMax = tracks->size();
73  for(unsigned int trackIdx = 0; trackIdx < trackMax; ++trackIdx){
74  art::Ptr<rb::Track> track(tracks, trackIdx);
75 
76  rescol->push_back(fTimingFitAlg.HoughFit(track.get()));
77  util::CreateAssn(evt, *rescol, track, *assns);
78  } // end for trackIdx
79 
80  evt.put(std::move(rescol));
81  evt.put(std::move(assns));
82  }
83 
85 
86 } // namespace tf
87 ////////////////////////////////////////////////////////////////////////
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
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
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
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
T get(std::string const &key) const
Definition: ParameterSet.h:231
int evt
std::string fTrackLabel
virtual void reconfigure(const fhicl::ParameterSet &pset)
virtual void produce(art::Event &evt)
T const * get() const
Definition: Ptr.h:149
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
Float_t track
Definition: plot.C:35
enum BeamMode string