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;
98 : EDProducer(p), trackAlg(p.
get<fhicl::ParameterSet>(
"CrtTrackAlg"))
103 produces< std::vector<anab::T0> >();
104 produces< art::Assns<recob::Track , anab::T0> >();
124 art::ServiceHandle<art::TFileService>
tfs;
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>);
138 art::Handle< std::vector<recob::Track> > tpcTrackListHandle;
139 std::vector<art::Ptr<recob::Track> > tpcTrackList;
141 art::fill_ptr_vector(tpcTrackList, tpcTrackListHandle);
147 art::Handle< std::vector<sbn::crt::CRTTrack> > crtTrackListHandle;
148 std::vector<art::Ptr<sbn::crt::CRTTrack> > crtTrackList;
150 art::fill_ptr_vector(crtTrackList, crtTrackListHandle);
152 std::vector<sbn::crt::CRTTrack> crtTracks;
153 for(
auto const& crtTrack : crtTrackList){
154 crtTracks.push_back(*crtTrack);
157 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event);
160 if (tpcTrackListHandle.isValid() && crtTrackListHandle.isValid() ){
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++){
168 *tpcTrackList[tpc_i], crtTracks, event);
169 int matchedID = matchedResult.first;
170 double matchedScore = matchedResult.second;
172 if(matchedID != -99999){
173 double crtTime = ((double)(
int)crtTracks.at(matchedID).ts1_ns);
174 T0col->push_back(
anab::T0(crtTime, 0, tpcTrackList[tpc_i]->ID(), (*T0col).size(), matchedScore));
182 event.put(std::move(T0col));
183 event.put(std::move(Trackassn));
art::InputTag fCrtTrackModuleLabel
name of crt producer
CRTTrackMatching & operator=(CRTTrackMatching const &)=delete
Declaration of signal hit object.
void produce(art::Event &e) override
Access the description of detector geometry.
void reconfigure(fhicl::ParameterSet const &p)
CRTTrackMatching(fhicl::ParameterSet const &p)
art::InputTag fTpcTrackModuleLabel
name of track producer
Provides recob::Track data product.
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.
stream1 can override from command line with o or output services user sbnd
art::ServiceHandle< art::TFileService > tfs
CRTTrackMatchAlg trackAlg
Collection of Physical constants used in LArSoft.
std::pair< int, double > GetMatchedCRTTrackIdAndScore(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::vector< sbn::crt::CRTTrack > crtTracks, const art::Event &event)
art framework interface to geometry description