12 #include "nusimdata/SimulationBase/MCParticle.h"
15 #include "art/Framework/Core/EDAnalyzer.h"
16 #include "art/Framework/Core/ModuleMacros.h"
17 #include "art/Framework/Principal/Event.h"
18 #include "art/Framework/Principal/Handle.h"
19 #include "canvas/Persistency/Common/FindOneP.h"
20 #include "canvas/Persistency/Common/Assns.h"
21 #include "canvas/Persistency/Common/Ptr.h"
22 #include "canvas/Utilities/InputTag.h"
23 #include "messagefacility/MessageLogger/MessageLogger.h"
24 #include "fhiclcpp/types/Atom.h"
25 #include "cetlib_except/exception.h"
28 #include <boost/test/test_tools.hpp>
33 namespace lar::example::tests {
65 Comment(
"label of the data product with the cheat tracks")
69 Name(
"expectedCount"),
70 Comment(
"number of expected tracks in the data product")
79 : art::EDAnalyzer(config)
83 consumes<std::vector<lar::example::CheatTrack>>(
fTrackTag);
84 consumes<art::Assns<lar::example::CheatTrack, simb::MCParticle>>
89 void analyze(art::Event
const& event)
override;
111 auto const& trackHandle
112 =
event.getValidHandle<std::vector<lar::example::CheatTrack>>(
fTrackTag);
113 auto const&
tracks = *trackHandle;
114 art::FindOneP<simb::MCParticle> trackToPart{ trackHandle, event,
fTrackTag };
116 std::size_t
const nTracks = tracks.size();
120 for (std::size_t iTrack = 0U; iTrack < nTracks; ++iTrack) {
123 art::Ptr<simb::MCParticle>
const& partPtr = trackToPart.at(iTrack);
125 mf::LogVerbatim log(
"DumpCheatTracks");
126 log <<
"[#" << iTrack <<
"] " <<
track;
128 log <<
" associated to particle:\n " << *partPtr;
131 log <<
" not associated to any particle";
ClusterModuleLabel join with tracks
fhicl::Atom< art::InputTag > tracks
DumpCheatTracks(Parameters const &config)
Constructor; see the class documentation for the configuration.
fhicl::Atom< unsigned int > expectedCount
void analyze(art::Event const &event) override
process_name use argoneut_mc_hitfinder track
Pseudo-track data product for TotallyCheatTracks example.
Pseudo-track object for TotallyCheatTracks example.
art::EDAnalyzer::Table< Config > Parameters
BEGIN_PROLOG vertical distance to the surface Name
unsigned int fExpectedCount
Expected number of tracks.
Dumps lar::example::CheatTrack data product and associations.
art::InputTag fTrackTag
Label of the input data product.