17 #include "art/Framework/Core/EDProducer.h"
18 #include "art/Framework/Core/ModuleMacros.h"
19 #include "canvas/Persistency/Common/FindManyP.h"
20 #include "art/Framework/Principal/Handle.h"
21 #include "art/Framework/Principal/Event.h"
22 #include "canvas/Persistency/Common/Ptr.h"
23 #include "canvas/Persistency/Common/PtrVector.h"
24 #include "art/Framework/Principal/Run.h"
25 #include "art/Framework/Principal/SubRun.h"
26 #include "art_root_io/TFileService.h"
27 #include "art_root_io/TFileDirectory.h"
29 #include "canvas/Utilities/InputTag.h"
30 #include "fhiclcpp/ParameterSet.h"
31 #include "messagefacility/MessageLogger/MessageLogger.h"
76 void produce(art::Event &
e)
override;
97 : EDProducer(p), t0Alg(p.
get<fhicl::ParameterSet>(
"T0Alg"))
102 produces< std::vector<anab::T0> >();
103 produces< art::Assns<recob::Track , anab::T0> >();
104 produces< art::Assns<sbn::crt::CRTHit, anab::T0> >();
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;
171 unsigned CRThitIndex = std::numeric_limits<unsigned>::max();
172 for (
int ic=0; ic<(int)crtList.size(); ++ic){
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));
void produce(art::Event &e) override
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
int plane
Name of the CRT wall (in the form of numbers).
float peshit
Total photo-electron (PE) in a crt hit.
void reconfigure(fhicl::ParameterSet const &p)
Declaration of signal hit object.
float z_pos
position in z-direction (cm).
double ts0_ns
Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch...
Access the description of detector geometry.
Provides recob::Track data product.
Encapsulate the geometry of a wire.
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.
CRTT0Matching & operator=(CRTT0Matching const &)=delete
Encapsulate the construction of a single detector plane.
stream1 can override from command line with o or output services user sbnd
Collection of Physical constants used in LArSoft.
art framework interface to geometry description
CRTT0Matching(fhicl::ParameterSet const &p)