17 #include "canvas/Persistency/Common/FindManyP.h" 18 #include "canvas/Persistency/Common/FindMany.h" 51 fhicl::Comment(
"data product tag for track momentum reconstruction")
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();
111 const auto& track =
tracks[trackAssn.key()];
116 mf::LogVerbatim(
"ProxyExample") <<
"\tCountValidPoints=" << track->CountValidPoints() <<
" and nHits=" << track.nHits() <<
" and MCSMom=" << assocMCS.
bestMomentum();
119 if (track.nHits()<50) {
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) {
148 auto const& assocTks = assocTracksWithMeta.at(iv);
149 auto const& assocTksMeta = assocTracksWithMeta.data(iv);
150 for (
size_t itk=0;itk<assocTks.size();++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());
165 if (hits.size()<50) {
167 mf::LogVerbatim(
"ProxyExample") <<
"\t\thit wire=" <<
h->WireID() <<
" peak time=" <<
h->PeakTime();
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
ChannelGroupService::Name Name
RecoProxyUsageExample & operator=(RecoProxyUsageExample const &)=delete
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition of vertex object for LArSoft.
Offers proxy::Tracks and proxy::Track class for recob::Track access.
void analyze(art::Event const &e) override
unsigned int CountValidPoints() const
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.
#define DEFINE_ART_MODULE(klass)
key_type key() const noexcept
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
Provides recob::Track data product.
2D representation of charge deposited in the TDC/wire plane
fhicl::Atom< art::InputTag > vertexInputTag
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)