129 std::unique_ptr< std::vector<anab::T0> > T0col(
new std::vector<anab::T0>);
130 std::unique_ptr< art::Assns<recob::Track, anab::T0> > Trackassn(
new art::Assns<recob::Track, anab::T0>);
131 std::unique_ptr< art::Assns <sbn::crt::CRTHit, anab::T0> > t0_crthit_assn(
new art::Assns<sbn::crt::CRTHit, anab::T0> );
134 art::Handle<std::vector<sbn::crt::CRTHit>> crtListHandle;
135 std::vector<art::Ptr<sbn::crt::CRTHit>> crtList;
137 art::fill_ptr_vector(crtList, crtListHandle);
139 std::vector<sbn::crt::CRTHit> crtHits;
140 for (
auto const& crtHit : crtList){
141 crtHits.push_back(*crtHit);
145 art::Handle< std::vector<recob::Track> > trackListHandle;
146 std::vector<art::Ptr<recob::Track> > trackList;
148 art::fill_ptr_vector(trackList, trackListHandle);
150 mf::LogInfo(
"CRTT0Matching")
151 <<
"Number of reconstructed tracks = "<<trackList.size()<<
"\n"
152 <<
"Number of CRT hits = "<<crtList.size();
154 if (trackListHandle.isValid() && crtListHandle.isValid() ){
156 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event);
158 for(
size_t track_i = 0; track_i < trackList.size(); track_i++) {
163 if(closest.dca >=0 ){
164 mf::LogInfo(
"CRTT0Matching")
165 <<
"Matched time = "<<closest.
t0<<
" [us] to track "<<trackList[track_i]->ID()<<
" with DCA = "<<closest.dca;
166 T0col->push_back(
anab::T0(closest.t0*1e3, trackList[track_i]->ID(), closest.thishit.plane, (int)closest.extrapLen, closest.dca));
171 unsigned CRThitIndex = std::numeric_limits<unsigned>::max();
172 for (
int ic=0; ic<(int)crtList.size(); ++ic){
173 if (crtList[ic]->ts0_ns==closest.thishit.ts0_ns && crtList[ic]->z_pos==closest.thishit.z_pos && crtList[ic]->peshit==closest.thishit.peshit)
176 if (CRThitIndex != std::numeric_limits<unsigned>::max())
177 util::CreateAssn(*
this, event, *T0col, crtList[CRThitIndex], *t0_crthit_assn);
185 event.put(std::move(T0col));
186 event.put(std::move(Trackassn));
187 event.put(std::move(t0_crthit_assn));
art::InputTag fCrtHitModuleLabel
name of crt producer
matchCand GetClosestCRTHit(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::pair< double, double > t0MinMax, std::vector< sbn::crt::CRTHit > crtHits, int driftDirection)
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.