20 #include "nug4/ParticleNavigation/ParticleList.h"
23 #include "art/Framework/Core/EDAnalyzer.h"
24 #include "art/Framework/Core/ModuleMacros.h"
25 #include "art/Framework/Principal/Event.h"
26 #include "art/Framework/Principal/Handle.h"
27 #include "art/Framework/Services/Registry/ServiceHandle.h"
28 #include "canvas/Persistency/Common/Ptr.h"
29 #include "fhiclcpp/ParameterSet.h"
30 #include "messagefacility/MessageLogger/MessageLogger.h"
50 , fHitModuleLabel{pset.get<std::string>(
"HitModuleLabel",
"ffthit")}
51 ,
fG4ModuleLabel{pset.get<std::string>(
"G4ModuleLabel",
"largeant")}
60 art::Handle<std::vector<recob::Hit>> hitcol;
65 std::vector<art::Ptr<recob::Hit>> hits;
66 art::fill_ptr_vector(hits, hitcol);
69 std::vector<art::Ptr<recob::Hit>>::iterator itr = hits.begin();
71 art::ServiceHandle<cheat::BackTrackerService const> bt_serv;
72 art::ServiceHandle<cheat::ParticleInventoryService const> pi_serv;
74 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
79 while (itr != hits.end()) {
82 mf::LogInfo(
"CheckBackTracking") << *((*itr).get()) <<
"\n channel is: " << (*itr)->Channel();
84 std::vector<sim::TrackIDE> trackides = bt_serv->HitToTrackIDEs(clockData, *itr);
85 std::vector<sim::TrackIDE> eveides = bt_serv->HitToEveTrackIDEs(clockData, *itr);
86 std::vector<double> xyz = bt_serv->HitToXYZ(clockData, *itr);
88 mf::LogInfo(
"CheckBackTracking")
89 <<
"hit weighted mean position is (" << xyz[0] <<
"," << xyz[1] <<
"," << xyz[2] <<
")";
91 for (
size_t t = 0; t < trackides.size(); ++t) {
94 int eveID = pi_serv->ParticleList().EveId(trackides[t].trackID);
96 mf::LogInfo(
"CheckBackTracking")
97 <<
"track id: " << trackides[t].trackID <<
" contributed " << trackides[t].energy <<
"/"
98 << trackides[t].energyFrac <<
" to the current hit and has eveID: " << eveID;
101 for (
size_t e = 0;
e < eveides.size(); ++
e) {
102 mf::LogInfo(
"CheckBackTracking")
103 <<
"eve id: " << eveides[
e].trackID <<
" contributed " << eveides[
e].energy <<
"/"
104 << eveides[
e].energyFrac <<
" to the current hit";
106 if (eveIDs.find(eveides[
e].trackID) == eveIDs.end()) eveIDs.insert(eveides[e].trackID);
114 std::set<int>::iterator setitr = eveIDs.begin();
115 while (setitr != eveIDs.end()) {
119 mf::LogInfo(
"CheckBackTracking")
120 <<
"eve ID: " << *setitr <<
" purity: " << bt_serv->HitCollectionPurity(clockData,
id, hits)
121 <<
" efficiency: " << bt_serv->HitCollectionEfficiency(clockData,
id, hits, hits,
geo::k3D);
std::string fHitModuleLabel
label for module creating recob::Hit objects
Declaration of signal hit object.
CheckBackTracking(fhicl::ParameterSet const &pset)
3-dimensional objects, potentially hits, clusters, prongs, etc.
std::string fG4ModuleLabel
label for module running G4 and making particles, etc
Definition of data types for geometry description.
object containing MC truth information necessary for making RawDigits and doing back tracking ...
void analyze(art::Event const &evt)