Public Member Functions | Private Attributes | List of all members
cheat::CheckBackTracking Class Reference
Inheritance diagram for cheat::CheckBackTracking:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 CheckBackTracking (fhicl::ParameterSet const &pset)
 
void analyze (art::Event const &evt)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::string fHitModuleLabel
 label for module creating recob::Hit objects More...
 
std::string fG4ModuleLabel
 label for module running G4 and making particles, etc More...
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 31 of file CheckBackTracking_module.cc.

Constructor & Destructor Documentation

cheat::CheckBackTracking::CheckBackTracking ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 46 of file CheckBackTracking_module.cc.

47  : EDAnalyzer(pset)
48  , fHitModuleLabel{pset.get<std::string>("HitModuleLabel", "ffthit")}
49  , fG4ModuleLabel{pset.get<std::string>("G4ModuleLabel", "largeant")}
50  {}
std::string fHitModuleLabel
label for module creating recob::Hit objects
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::string fG4ModuleLabel
label for module running G4 and making particles, etc

Member Function Documentation

void cheat::CheckBackTracking::analyze ( art::Event const &  evt)
virtual

Implements art::EDAnalyzer.

Definition at line 54 of file CheckBackTracking_module.cc.

55  {
56 
57  // grab the hits that have been reconstructed
59  evt.getByLabel(fHitModuleLabel, hitcol);
60 
61  // make a vector of them - we aren't writing anything out to a file
62  // so no need for a art::PtrVector here
63  std::vector<art::Ptr<recob::Hit>> hits;
64  art::fill_ptr_vector(hits, hitcol);
65 
66  // loop over the hits and figure out which particle contributed to each one
67  std::vector<art::Ptr<recob::Hit>>::iterator itr = hits.begin();
68 
71 
72  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
73 
74  // make a collection of the distinct eve ID values
75  std::set<int> eveIDs;
76 
77  while (itr != hits.end()) {
78 
79  // print the truth information for this hit
80  mf::LogInfo("CheckBackTracking") << *((*itr).get()) << "\n channel is: " << (*itr)->Channel();
81 
82  std::vector<sim::TrackIDE> trackides = bt_serv->HitToTrackIDEs(clockData, *itr);
83  std::vector<sim::TrackIDE> eveides = bt_serv->HitToEveTrackIDEs(clockData, *itr);
84  std::vector<double> xyz = bt_serv->HitToXYZ(clockData, *itr);
85 
86  mf::LogInfo("CheckBackTracking")
87  << "hit weighted mean position is (" << xyz[0] << "," << xyz[1] << "," << xyz[2] << ")";
88 
89  for (size_t t = 0; t < trackides.size(); ++t) {
90 
91  // find the Eve particle for the current trackID
92  int eveID = pi_serv->ParticleList().EveId(trackides[t].trackID);
93 
94  mf::LogInfo("CheckBackTracking")
95  << "track id: " << trackides[t].trackID << " contributed " << trackides[t].energy << "/"
96  << trackides[t].energyFrac << " to the current hit and has eveID: " << eveID;
97  }
98 
99  for (size_t e = 0; e < eveides.size(); ++e) {
100  mf::LogInfo("CheckBackTracking")
101  << "eve id: " << eveides[e].trackID << " contributed " << eveides[e].energy << "/"
102  << eveides[e].energyFrac << " to the current hit";
103 
104  if (eveIDs.find(eveides[e].trackID) == eveIDs.end()) eveIDs.insert(eveides[e].trackID);
105  }
106 
107  itr++;
108  } // end loop over hits
109 
110  // loop over the eveID values and calculate the purity and efficiency for
111  // each
112  std::set<int>::iterator setitr = eveIDs.begin();
113  while (setitr != eveIDs.end()) {
114 
115  std::set<int> id;
116  id.insert(*setitr);
117  mf::LogInfo("CheckBackTracking")
118  << "eve ID: " << *setitr << " purity: " << bt_serv->HitCollectionPurity(clockData, id, hits)
119  << " efficiency: " << bt_serv->HitCollectionEfficiency(clockData, id, hits, hits, geo::k3D);
120 
121  setitr++;
122  }
123 
124  return;
125 
126  } // end analyze
intermediate_table::iterator iterator
std::string fHitModuleLabel
label for module creating recob::Hit objects
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
double HitCollectionEfficiency(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits, std::vector< art::Ptr< recob::Hit >> const &allhits, geo::View_t const &view) const
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
3-dimensional objects, potentially hits, clusters, prongs, etc.
Definition: geo_types.h:135
const double e
double HitCollectionPurity(detinfo::DetectorClocksData const &clockData, std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit >> const &hits) const
const sim::ParticleList & ParticleList() const
std::vector< sim::TrackIDE > HitToEveTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297

Member Data Documentation

std::string cheat::CheckBackTracking::fG4ModuleLabel
private

label for module running G4 and making particles, etc

Definition at line 39 of file CheckBackTracking_module.cc.

std::string cheat::CheckBackTracking::fHitModuleLabel
private

label for module creating recob::Hit objects

Definition at line 38 of file CheckBackTracking_module.cc.


The documentation for this class was generated from the following file: