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

Public Member Functions

 CRTTrackMatching (fhicl::ParameterSet const &p)
 
 CRTTrackMatching (CRTTrackMatching const &)=delete
 
 CRTTrackMatching (CRTTrackMatching &&)=delete
 
CRTTrackMatchingoperator= (CRTTrackMatching const &)=delete
 
CRTTrackMatchingoperator= (CRTTrackMatching &&)=delete
 
void produce (art::Event &e) override
 
void beginJob () override
 
void endJob () override
 
void reconfigure (fhicl::ParameterSet const &p)
 

Private Attributes

art::InputTag fTpcTrackModuleLabel
 name of track producer More...
 
art::InputTag fCrtTrackModuleLabel
 name of crt producer More...
 
CRTTrackMatchAlg trackAlg
 
TPCGeoAlg fTpcGeo
 

Detailed Description

Definition at line 61 of file CRTTrackMatching_module.cc.

Constructor & Destructor Documentation

sbnd::CRTTrackMatching::CRTTrackMatching ( fhicl::ParameterSet const &  p)
explicit

Definition at line 97 of file CRTTrackMatching_module.cc.

98  : EDProducer(p), trackAlg(p.get<fhicl::ParameterSet>("CrtTrackAlg"))
99  // Initialize member data here, if know don't want to reconfigure on the fly
100  {
101 
102  // Call appropriate produces<>() functions here.
103  produces< std::vector<anab::T0> >();
104  produces< art::Assns<recob::Track , anab::T0> >();
105  //produces< art::Assns<recob::Track , sbn::crt::CRTTrack> >();
106 
107  reconfigure(p);
108 
109  } // CRTTrackMatching()
pdgs p
Definition: selectors.fcl:22
void reconfigure(fhicl::ParameterSet const &p)
sbnd::CRTTrackMatching::CRTTrackMatching ( CRTTrackMatching const &  )
delete
sbnd::CRTTrackMatching::CRTTrackMatching ( CRTTrackMatching &&  )
delete

Member Function Documentation

void sbnd::CRTTrackMatching::beginJob ( )
override

Definition at line 121 of file CRTTrackMatching_module.cc.

122  {
123  // Implementation of optional member function here.
124  art::ServiceHandle<art::TFileService> tfs;
125 
126  } // CRTTrackMatching::beginJob()
art::ServiceHandle< art::TFileService > tfs
void sbnd::CRTTrackMatching::endJob ( )
override

Definition at line 189 of file CRTTrackMatching_module.cc.

190  {
191 
192  } // CRTTrackMatching::endJob()
CRTTrackMatching& sbnd::CRTTrackMatching::operator= ( CRTTrackMatching const &  )
delete
CRTTrackMatching& sbnd::CRTTrackMatching::operator= ( CRTTrackMatching &&  )
delete
void sbnd::CRTTrackMatching::produce ( art::Event &  e)
override

Definition at line 129 of file CRTTrackMatching_module.cc.

130  {
131 
132  // Create anab::T0 objects and make association with recob::Track
133  std::unique_ptr< std::vector<anab::T0> > T0col( new std::vector<anab::T0>);
134  std::unique_ptr< art::Assns<recob::Track, anab::T0> > Trackassn( new art::Assns<recob::Track, anab::T0>);
135  //std::unique_ptr< art::Assns<recob::Track, sbn::crt::CRTTrack> > Crtassn( new art::Assns<recob::Track, sbn::crt::CRTTrack>);
136 
137  // Get TPC tracks
138  art::Handle< std::vector<recob::Track> > tpcTrackListHandle;
139  std::vector<art::Ptr<recob::Track> > tpcTrackList;
140  if (event.getByLabel(fTpcTrackModuleLabel, tpcTrackListHandle))
141  art::fill_ptr_vector(tpcTrackList, tpcTrackListHandle);
142 
143  // Get track to hit associations
144  //art::FindManyP<recob::Hit> findManyHits(tpcTrackListHandle, event, fTpcTrackModuleLabel);
145 
146  // Get CRT tracks
147  art::Handle< std::vector<sbn::crt::CRTTrack> > crtTrackListHandle;
148  std::vector<art::Ptr<sbn::crt::CRTTrack> > crtTrackList;
149  if (event.getByLabel(fCrtTrackModuleLabel, crtTrackListHandle))
150  art::fill_ptr_vector(crtTrackList, crtTrackListHandle);
151 
152  std::vector<sbn::crt::CRTTrack> crtTracks;
153  for(auto const& crtTrack : crtTrackList){
154  crtTracks.push_back(*crtTrack);
155  }
156 
157  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event);
158 
159  // Validity check
160  if (tpcTrackListHandle.isValid() && crtTrackListHandle.isValid() ){
161 
162  mf::LogInfo("CRTTrackMatching")
163  <<"Number of TPC tracks = "<<tpcTrackList.size()<<"\n"
164  <<"Number of CRT tracks = "<<crtTrackList.size();
165  for (size_t tpc_i = 0; tpc_i < tpcTrackList.size(); tpc_i++){
166 
167  std::pair<int,double> matchedResult = trackAlg.GetMatchedCRTTrackIdAndScore(detProp,
168  *tpcTrackList[tpc_i], crtTracks, event);
169  int matchedID = matchedResult.first;
170  double matchedScore = matchedResult.second;
171 
172  if(matchedID != -99999){
173  double crtTime = ((double)(int)crtTracks.at(matchedID).ts1_ns); // [ns]
174  T0col->push_back(anab::T0(crtTime, 0, tpcTrackList[tpc_i]->ID(), (*T0col).size(), matchedScore));
175  util::CreateAssn(*this, event, *T0col, tpcTrackList[tpc_i], *Trackassn);
176  //util::CreateAssn(*this, event, crtTrackList[matchedID], tpcTrackList[tpc_i], *Crtassn);
177  }
178  }
179 
180  } // Validity check
181 
182  event.put(std::move(T0col));
183  event.put(std::move(Trackassn));
184  //event.put(std::move(Crtassn));
185 
186  } // CRTTrackMatching::produce()
art::InputTag fCrtTrackModuleLabel
name of crt producer
Definition: T0.h:16
art::InputTag fTpcTrackModuleLabel
name of track producer
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.
std::pair< int, double > GetMatchedCRTTrackIdAndScore(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::vector< sbn::crt::CRTTrack > crtTracks, const art::Event &event)
auto const detProp
void sbnd::CRTTrackMatching::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 112 of file CRTTrackMatching_module.cc.

113  {
114 
115  fTpcTrackModuleLabel = (p.get<art::InputTag> ("TpcTrackModuleLabel"));
116  fCrtTrackModuleLabel = (p.get<art::InputTag> ("CrtTrackModuleLabel"));
117 
118  } // CRTTrackMatching::reconfigure()
art::InputTag fCrtTrackModuleLabel
name of crt producer
pdgs p
Definition: selectors.fcl:22
art::InputTag fTpcTrackModuleLabel
name of track producer

Member Data Documentation

art::InputTag sbnd::CRTTrackMatching::fCrtTrackModuleLabel
private

name of crt producer

Definition at line 89 of file CRTTrackMatching_module.cc.

TPCGeoAlg sbnd::CRTTrackMatching::fTpcGeo
private

Definition at line 92 of file CRTTrackMatching_module.cc.

art::InputTag sbnd::CRTTrackMatching::fTpcTrackModuleLabel
private

name of track producer

Definition at line 88 of file CRTTrackMatching_module.cc.

CRTTrackMatchAlg sbnd::CRTTrackMatching::trackAlg
private

Definition at line 91 of file CRTTrackMatching_module.cc.


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