1 #include "art/Framework/Core/EDAnalyzer.h"
2 #include "art/Framework/Core/ModuleMacros.h"
3 #include "art/Framework/Principal/Event.h"
4 #include "art/Framework/Principal/Handle.h"
5 #include "canvas/Utilities/InputTag.h"
6 #include "fhiclcpp/types/Atom.h"
7 #include "messagefacility/MessageLogger/MessageLogger.h"
17 #include "canvas/Persistency/Common/FindManyP.h"
18 #include "canvas/Persistency/Common/FindMany.h"
43 fhicl::Comment(
"data product tag for tracks")
47 fhicl::Comment(
"data product tag for vertices")
51 fhicl::Comment(
"data product tag for track momentum reconstruction")
68 void analyze(art::Event
const &
e)
override;
79 , trkTag(config().trackInputTag())
80 , vtxTag(config().vertexInputTag())
81 , mcsTag(config().mcsInputTag())
93 auto const& vertices = proxy::getCollection<std::vector<recob::Vertex> >(
e,
vtxTag,proxy::withAssociatedMeta<recob::Track, recob::VertexAssnMeta>());
97 auto const&
tracks = proxy::getCollection<proxy::Tracks>(
e,
trkTag,proxy::withParallelData<recob::MCSFitResult>(
mcsTag));
100 for (
const auto& v : vertices) {
101 mf::LogVerbatim(
"ProxyExample") <<
"vertex pos=" << v->position() <<
" chi2=" << v->chi2();
105 for (
const auto& trackAssn : assocTracks) {
108 mf::LogVerbatim(
"ProxyExample") <<
"track with key=" << trackAssn.key() <<
" and length=" << trackAssn->
Length() <<
" has propDist from vertex=" << trackAssn.data().propDist();
116 mf::LogVerbatim(
"ProxyExample") <<
"\tCountValidPoints=" <<
track->CountValidPoints() <<
" and nHits=" <<
track.nHits() <<
" and MCSMom=" << assocMCS.
bestMomentum();
119 if (
track.nHits()<50) {
120 for (
const art::Ptr<recob::Hit>&
h :
track.hits()) {
121 mf::LogVerbatim(
"ProxyExample") <<
"\t\thit wire=" <<
h->WireID() <<
" peak time=" <<
h->PeakTime();
133 auto const& vertexHandle = e.getValidHandle<std::vector<recob::Vertex> >(
vtxTag);
134 auto const& vertexColl = *vertexHandle;
135 art::FindManyP<recob::Track, recob::VertexAssnMeta> assocTracksWithMeta(vertexHandle, e, vtxTag);
138 auto const& trackHandle = e.getValidHandle<std::vector<recob::Track> >(
trkTag);
139 art::FindMany<recob::Hit> assocHits(trackHandle, e, trkTag);
140 auto const& mcsColl = *(e.getValidHandle<std::vector<recob::MCSFitResult> >(
mcsTag));
143 for (
size_t iv=0; iv<vertexColl.size(); ++iv) {
145 mf::LogVerbatim(
"ProxyExample") <<
"vertex pos=" << v.
position() <<
" chi2=" << v.
chi2();
148 auto const& assocTks = assocTracksWithMeta.at(iv);
149 auto const& assocTksMeta = assocTracksWithMeta.data(iv);
150 for (
size_t itk=0;itk<assocTks.size();++itk) {
153 const art::Ptr<recob::Track>& trackAssn = assocTks[itk];
155 mf::LogVerbatim(
"ProxyExample") <<
"track with key=" << trackAssn.key() <<
" and length=" << trackAssn->Length() <<
" has propDist from vertex=" << trackMeta->
propDist();
159 const std::vector<recob::Hit const*>& hits = assocHits.at(trackAssn.key());
162 mf::LogVerbatim(
"ProxyExample") <<
"\tCountValidPoints=" << trackAssn->CountValidPoints() <<
" and nHits=" << hits.size() <<
" and MCSMom=" << assocMCS.
bestMomentum();
165 if (hits.size()<50) {
167 mf::LogVerbatim(
"ProxyExample") <<
"\t\thit wire=" <<
h->WireID() <<
" peak time=" <<
h->PeakTime();
ClusterModuleLabel join with tracks
RecoProxyUsageExample & operator=(RecoProxyUsageExample const &)=delete
process_name use argoneut_mc_hitfinder track
Definition of vertex object for LArSoft.
Offers proxy::Tracks and proxy::Track class for recob::Track access.
void analyze(art::Event const &e) override
float bestMomentum() const
momentum for best direction fit
double Length(size_t p=0) const
Access to various track properties.
Example of analyzer accessing vertices, tracks, and hits, using RecoBaseProxy.
BEGIN_PROLOG vertical distance to the surface Name
Provides recob::Track data product.
Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between ...
fhicl::Atom< art::InputTag > mcsInputTag
fhicl::Atom< art::InputTag > trackInputTag
2D representation of charge deposited in the TDC/wire plane
fhicl::Atom< art::InputTag > vertexInputTag
art::EDAnalyzer::Table< Config > Parameters
const Point_t & position() const
Return vertex 3D position.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
RecoProxyUsageExample(Parameters const &p)