LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
cheat::RecoCheckAna Class Reference
Inheritance diagram for cheat::RecoCheckAna:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 RecoCheckAna (fhicl::ParameterSet const &p)
 
virtual ~RecoCheckAna ()
 
virtual void analyze (art::Event const &e)
 
virtual void reconfigure (fhicl::ParameterSet const &p)
 
virtual void beginRun (art::Run const &r)
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

void CheckReco (int const &colID, std::vector< art::Ptr< recob::Hit > > const &allhits, std::vector< art::Ptr< recob::Hit > > const &colHits, std::map< std::pair< int, int >, std::pair< double, double > > &g4RecoBaseIDToPurityEfficiency)
 
void CheckRecoClusters (art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Cluster > > const &clscol, std::vector< art::Ptr< recob::Hit > > const &allhits)
 
void CheckRecoTracks (art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Track > > const &tcol, std::vector< art::Ptr< recob::Hit > > const &allhits)
 
void CheckRecoShowers (art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Shower > > const &scol, std::vector< art::Ptr< recob::Hit > > const &allhits)
 
void CheckRecoVertices (art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Vertex > > const &vtxcol, std::vector< art::Ptr< recob::Hit > > const &allhits)
 
void CheckRecoEvents (art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Event > > const &evtcol, std::vector< art::Ptr< recob::Hit > > const &allhits)
 
void FillResults (std::vector< art::Ptr< recob::Hit > > const &allhits)
 
void FlattenMap (std::map< std::pair< int, int >, std::pair< double, double > > const &g4RecoBaseIDToPurityEfficiency, std::map< int, std::vector< std::pair< int, std::pair< double, double > > > > &g4IDToRecoBasePurityEfficiency, TH1D *purity, TH1D *efficiency, TH1D *purityEfficiency, TH2D *purityEfficiency2D)
 

Private Attributes

art::ServiceHandle< cheat::BackTrackerServicefBT
 the back tracker service More...
 
art::ServiceHandle< cheat::ParticleInventoryServicefPI
 the back tracker service More...
 
std::string fHitModuleLabel
 label for module making the hits More...
 
std::string fClusterModuleLabel
 label for module making the clusters More...
 
std::string fShowerModuleLabel
 label for module making the showers More...
 
std::string fTrackModuleLabel
 label for module making the tracks More...
 
std::string fVertexModuleLabel
 label for module making the vertices More...
 
std::string fEventModuleLabel
 label for module making the events More...
 
bool fCheckClusters
 should we check the reconstruction of clusters? More...
 
bool fCheckShowers
 should we check the reconstruction of showers? More...
 
bool fCheckTracks
 should we check the reconstruction of tracks? More...
 
bool fCheckVertices
 should we check the reconstruction of vertices? More...
 
bool fCheckEvents
 should we check the reconstruction of events? More...
 
TH1D * fClusterPurity
 histogram of cluster purity More...
 
TH1D * fClusterEfficiency
 histogram of cluster efficiency More...
 
TH1D * fClusterPurityEfficiency
 histogram of cluster efficiency times purity More...
 
TH2D * fClusterPurityEfficiency2D
 scatter histogram of cluster purity and efficiency More...
 
TH1D * fShowerPurity
 histogram of shower purity More...
 
TH1D * fShowerEfficiency
 histogram of shower efficiency More...
 
TH1D * fShowerPurityEfficiency
 histogram of shower efficiency times purity More...
 
TH2D * fShowerPurityEfficiency2D
 scatter histogram of cluster purity and efficiency More...
 
TH1D * fTrackPurity
 histogram of track purity More...
 
TH1D * fTrackEfficiency
 histogram of track efficiency More...
 
TH1D * fTrackPurityEfficiency
 histogram of track efficiency times purity More...
 
TH2D * fTrackPurityEfficiency2D
 scatter histogram of cluster purity and efficiency More...
 
TH1D * fVertexPurity
 histogram of vertex purity More...
 
TH1D * fVertexEfficiency
 histogram of vertex efficiency More...
 
TH1D * fVertexPurityEfficiency
 histogram of vertex efficiency times purity More...
 
TH1D * fEventPurity
 histogram of event purity More...
 
TH1D * fEventEfficiency
 histogram of event efficiency More...
 
TH1D * fEventPurityEfficiency
 histogram of event efficiency times purity More...
 
std::map< std::pair< int, int >, std::pair< double, double > > fG4ClusterIDToPurityEfficiency
 
std::map< std::pair< int, int >, std::pair< double, double > > fG4ShowerIDToPurityEfficiency
 
std::map< std::pair< int, int >, std::pair< double, double > > fG4TrackIDToPurityEfficiency
 
TTree * fTree
 TTree to save efficiencies. More...
 
int frun
 run number More...
 
int fevent
 event number More...
 
int ftrackid
 geant track ID More...
 
int fpdg
 particle pdg code More...
 
double fpmom
 particle momentum More...
 
double fhiteff
 hitfinder efficiency for this particle More...
 
int fnclu
 number of clusters for this particle More...
 
std::vector< double > fclueff
 cluster efficiencies More...
 
std::vector< double > fclupur
 cluster purities More...
 
std::vector< int > fcluid
 cluster IDs More...
 
int fnshw
 number of showers for this particle More...
 
std::vector< double > fshweff
 shower efficiencies More...
 
std::vector< double > fshwpur
 shower purities More...
 
std::vector< int > fshwid
 shower IDs More...
 
int fntrk
 number of tracks for this particle More...
 
std::vector< double > ftrkeff
 track efficiencies More...
 
std::vector< double > ftrkpur
 track purities More...
 
std::vector< int > ftrkid
 track IDs More...
 

Detailed Description

Definition at line 42 of file RecoCheckAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

cheat::RecoCheckAna::RecoCheckAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 156 of file RecoCheckAna_module.cc.

References reconfigure().

157  : EDAnalyzer(p)
158 {
159  this->reconfigure(p);
160 }
virtual void reconfigure(fhicl::ParameterSet const &p)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
cheat::RecoCheckAna::~RecoCheckAna ( )
virtual

Definition at line 163 of file RecoCheckAna_module.cc.

164 {
165  // Clean up dynamic memory and other resources here.
166 }

Member Function Documentation

void cheat::RecoCheckAna::analyze ( art::Event const &  e)
virtual

Implements art::EDAnalyzer.

Definition at line 169 of file RecoCheckAna_module.cc.

References CheckRecoClusters(), CheckRecoEvents(), CheckRecoShowers(), CheckRecoTracks(), CheckRecoVertices(), art::EventID::event(), art::Handle< T >::failedToGet(), fCheckClusters, fCheckEvents, fCheckShowers, fCheckTracks, fCheckVertices, fClusterModuleLabel, fevent, fEventModuleLabel, fHitModuleLabel, art::fill_ptr_vector(), FillResults(), frun, fShowerModuleLabel, fTrackModuleLabel, fVertexModuleLabel, art::DataViewImpl::getByLabel(), art::Event::id(), art::Event::isRealData(), and art::Event::run().

170 {
171  // check that this is MC, stop if it isn't
172  if(e.isRealData()){
173  mf::LogWarning("RecoVetter") << "attempting to run MC truth check on "
174  << "real data, bail";
175  return;
176  }
177 
178  // get all hits in the event to figure out how many there are
180  e.getByLabel(fHitModuleLabel, hithdl);
181  std::vector< art::Ptr<recob::Hit> > allhits;
182  art::fill_ptr_vector(allhits, hithdl);
183 
184  // define variables to hold the reconstructed objects
190 
191  if(fCheckClusters){
192  e.getByLabel(fClusterModuleLabel, clscol);
193  if( !clscol.failedToGet() ) this->CheckRecoClusters(e, fClusterModuleLabel, clscol, allhits);
194  }
195  if(fCheckTracks){
196  e.getByLabel(fTrackModuleLabel, trkcol);
197  if( !trkcol.failedToGet() ) this->CheckRecoTracks(e, fTrackModuleLabel, trkcol, allhits);
198  }
199  if(fCheckShowers){
200  e.getByLabel(fShowerModuleLabel, shwcol);
201  if( !shwcol.failedToGet() ) this->CheckRecoShowers(e, fShowerModuleLabel, shwcol, allhits);
202  }
203  if(fCheckVertices){
204  e.getByLabel(fVertexModuleLabel, vtxcol);
205  if( !vtxcol.failedToGet() ) this->CheckRecoVertices(e, fVertexModuleLabel, vtxcol, allhits);
206  }
207  if(fCheckEvents){
208  e.getByLabel(fEventModuleLabel, evtcol);
209  if( !evtcol.failedToGet() ) this->CheckRecoEvents(e, fEventModuleLabel, evtcol, allhits);
210  }
211 
212  frun = e.run();
213  fevent = e.id().event();
214 
215  this->FillResults(allhits);
216 
217  return;
218 
219 }
bool fCheckVertices
should we check the reconstruction of vertices?
void CheckRecoShowers(art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Shower > > const &scol, std::vector< art::Ptr< recob::Hit > > const &allhits)
void FillResults(std::vector< art::Ptr< recob::Hit > > const &allhits)
bool fCheckEvents
should we check the reconstruction of events?
void CheckRecoVertices(art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Vertex > > const &vtxcol, std::vector< art::Ptr< recob::Hit > > const &allhits)
bool fCheckClusters
should we check the reconstruction of clusters?
void CheckRecoClusters(art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Cluster > > const &clscol, std::vector< art::Ptr< recob::Hit > > const &allhits)
void CheckRecoTracks(art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Track > > const &tcol, std::vector< art::Ptr< recob::Hit > > const &allhits)
bool fCheckTracks
should we check the reconstruction of tracks?
std::string fTrackModuleLabel
label for module making the tracks
bool fCheckShowers
should we check the reconstruction of showers?
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::string fClusterModuleLabel
label for module making the clusters
std::string fShowerModuleLabel
label for module making the showers
std::string fEventModuleLabel
label for module making the events
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
std::string fVertexModuleLabel
label for module making the vertices
Float_t e
Definition: plot.C:34
void CheckRecoEvents(art::Event const &evt, std::string const &label, art::Handle< std::vector< recob::Event > > const &evtcol, std::vector< art::Ptr< recob::Hit > > const &allhits)
bool failedToGet() const
Definition: Handle.h:197
std::string fHitModuleLabel
label for module making the hits
void cheat::RecoCheckAna::beginRun ( art::Run const &  r)
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 239 of file RecoCheckAna_module.cc.

References fCheckClusters, fCheckEvents, fCheckShowers, fCheckTracks, fCheckVertices, fclueff, fcluid, fclupur, fClusterEfficiency, fClusterPurity, fClusterPurityEfficiency, fClusterPurityEfficiency2D, fevent, fEventEfficiency, fEventPurity, fEventPurityEfficiency, fhiteff, fnclu, fnshw, fntrk, fpdg, fpmom, frun, fShowerEfficiency, fShowerPurity, fShowerPurityEfficiency, fShowerPurityEfficiency2D, fshweff, fshwid, fshwpur, fTrackEfficiency, ftrackid, fTrackPurity, fTrackPurityEfficiency, fTrackPurityEfficiency2D, fTree, ftrkeff, ftrkid, ftrkpur, fVertexEfficiency, fVertexPurity, fVertexPurityEfficiency, and art::TFileDirectory::make().

240 {
242 
243  if(fCheckEvents){
244  fEventPurity = tfs->make<TH1D>("eventPurity", ";Purity;Events", 100, 0., 1.1);
245  fEventEfficiency = tfs->make<TH1D>("eventEfficiency", ";Efficiency;Events", 100, 0., 1.1);
246  fEventPurityEfficiency = tfs->make<TH1D>("eventPurityEfficiency", ";purityEfficiency;Events", 110, 0., 1.1);
247  }
248  if(fCheckVertices){
249  fVertexPurity = tfs->make<TH1D>("vertexPurity", ";Purity;Vertices", 100, 0., 1.1);
250  fVertexEfficiency = tfs->make<TH1D>("vertexEfficiency", ";Efficiency;Vertices", 100, 0., 1.1);
251  fVertexPurityEfficiency = tfs->make<TH1D>("vertexPurityEfficiency", ";purityEfficiency;Vertex", 110, 0., 1.1);
252  }
253  if(fCheckTracks){
254  fTrackPurity = tfs->make<TH1D>("trackPurity", ";Purity;Tracks", 100, 0., 1.1);
255  fTrackEfficiency = tfs->make<TH1D>("trackEfficiency", ";Efficiency;Tracks", 100, 0., 1.1);
256  fTrackPurityEfficiency = tfs->make<TH1D>("trackPurityEfficiency", ";purityEfficiency;Tracks", 110, 0., 1.1);
257  fTrackPurityEfficiency2D = tfs->make<TH2D>("trackPurityEfficiency2D", ";purity;efficiency", 110, 0., 1.1, 110, 0., 1.1);
258  }
259  if(fCheckShowers){
260  fShowerPurity = tfs->make<TH1D>("showerPurity", ";Purity;Showers", 100, 0., 1.1);
261  fShowerEfficiency = tfs->make<TH1D>("showerEfficiency", ";Efficiency;Showers", 100, 0., 1.1);
262  fShowerPurityEfficiency = tfs->make<TH1D>("showerPurityEfficiency", ";purityEfficiency;Showers", 110, 0., 1.1);
263  fShowerPurityEfficiency2D= tfs->make<TH2D>("showerPurityEfficiency2D", ";purity;efficiency", 110, 0., 1.1, 110, 0., 1.1);
264  }
265  if(fCheckClusters){
266  fClusterPurity = tfs->make<TH1D>("clusterPurity", ";Purity;Clusters", 110, 0., 1.1);
267  fClusterEfficiency = tfs->make<TH1D>("clusterEfficiency", ";Efficiency;Clusters", 110, 0., 1.1);
268  fClusterPurityEfficiency = tfs->make<TH1D>("clusterPurityEfficiency", ";purityEfficiency;Clusters", 110, 0., 1.1);
269  fClusterPurityEfficiency2D = tfs->make<TH2D>("clusterPurityEfficiency2D", ";purity;efficiency", 110, 0., 1.1, 110, 0., 1.1);
270  }
271 
272  fTree = tfs->make<TTree>("cheatertree","cheater tree");
273  fTree->Branch("run", &frun, "run/I" );
274  fTree->Branch("event", &fevent, "event/I" );
275  fTree->Branch("trackid", &ftrackid, "trackid/I");
276  fTree->Branch("pdg", &fpdg, "pdg/I" );
277  fTree->Branch("pmom", &fpmom, "pmom/D" );
278  fTree->Branch("hiteff", &fhiteff, "hiteff/D" );
279  fTree->Branch("nclu", &fnclu, "nclu/I" );
280  fTree->Branch("clueff", &fclueff );
281  fTree->Branch("clupur", &fclupur );
282  fTree->Branch("cluid", &fcluid );
283  fTree->Branch("nshw", &fnshw, "nshw/I" );
284  fTree->Branch("shweff", &fshweff );
285  fTree->Branch("shwpur", &fshwpur );
286  fTree->Branch("shwid", &fshwid );
287  fTree->Branch("ntrk", &fntrk, "ntrk/I" );
288  fTree->Branch("trkeff", &ftrkeff );
289  fTree->Branch("trkpur", &ftrkpur );
290  fTree->Branch("trkid", &ftrkid );
291 
292  return;
293 }
int fpdg
particle pdg code
int fnshw
number of showers for this particle
TH1D * fTrackPurityEfficiency
histogram of track efficiency times purity
bool fCheckVertices
should we check the reconstruction of vertices?
double fhiteff
hitfinder efficiency for this particle
TH1D * fClusterPurityEfficiency
histogram of cluster efficiency times purity
int fnclu
number of clusters for this particle
int fntrk
number of tracks for this particle
TH1D * fEventPurity
histogram of event purity
bool fCheckEvents
should we check the reconstruction of events?
TH2D * fTrackPurityEfficiency2D
scatter histogram of cluster purity and efficiency
TH1D * fEventEfficiency
histogram of event efficiency
TH1D * fVertexPurity
histogram of vertex purity
TH1D * fEventPurityEfficiency
histogram of event efficiency times purity
TH1D * fVertexPurityEfficiency
histogram of vertex efficiency times purity
std::vector< double > fclupur
cluster purities
std::vector< double > fshweff
shower efficiencies
bool fCheckClusters
should we check the reconstruction of clusters?
std::vector< double > fshwpur
shower purities
TTree * fTree
TTree to save efficiencies.
std::vector< int > fshwid
shower IDs
TH1D * fVertexEfficiency
histogram of vertex efficiency
std::vector< int > ftrkid
track IDs
std::vector< double > ftrkeff
track efficiencies
bool fCheckTracks
should we check the reconstruction of tracks?
std::vector< double > fclueff
cluster efficiencies
double fpmom
particle momentum
std::vector< int > fcluid
cluster IDs
std::vector< double > ftrkpur
track purities
bool fCheckShowers
should we check the reconstruction of showers?
T * make(ARGS...args) const
int ftrackid
geant track ID
TH1D * fShowerPurityEfficiency
histogram of shower efficiency times purity
TH1D * fClusterPurity
histogram of cluster purity
TH1D * fClusterEfficiency
histogram of cluster efficiency
TH1D * fShowerPurity
histogram of shower purity
TH1D * fShowerEfficiency
histogram of shower efficiency
TH1D * fTrackPurity
histogram of track purity
TH2D * fClusterPurityEfficiency2D
scatter histogram of cluster purity and efficiency
TH1D * fTrackEfficiency
histogram of track efficiency
TH2D * fShowerPurityEfficiency2D
scatter histogram of cluster purity and efficiency
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

Referenced by art::EDAnalyzer::doEvent(), and art::OutputModule::doWriteEvent().

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
void cheat::RecoCheckAna::CheckReco ( int const &  colID,
std::vector< art::Ptr< recob::Hit > > const &  allhits,
std::vector< art::Ptr< recob::Hit > > const &  colHits,
std::map< std::pair< int, int >, std::pair< double, double > > &  g4RecoBaseIDToPurityEfficiency 
)
private

Definition at line 298 of file RecoCheckAna_module.cc.

References fBT, cheat::BackTrackerService::GetSetOfTrackIds(), cheat::BackTrackerService::HitCollectionEfficiency(), and cheat::BackTrackerService::HitCollectionPurity().

Referenced by CheckRecoClusters(), CheckRecoShowers(), and CheckRecoTracks().

302 {
303 
304  // grab the set of track IDs for these hits
305  std::set<int> trackIDs = fBT->GetSetOfTrackIds(colHits);
306 
307  geo::View_t view = colHits[0]->View();
308 
309  std::set<int>::iterator itr = trackIDs.begin();
310  while( itr != trackIDs.end() ){
311 
312  //std::cout << "*itr: " << *itr << std::endl;
313 
314  std::set<int> id;
315  id.insert(*itr);
316 
317  // use the cheat::BackTrackerService to find purity and efficiency for these hits
318  double purity = fBT->HitCollectionPurity(id, colHits);
319  double efficiency = fBT->HitCollectionEfficiency(id, colHits, allhits, view);
320 
321  // make the purity and efficiency pair
322  std::pair<double, double> pe(purity, efficiency);
323 
324  // make the pair of the RecoBase object id to the pair of purity/efficiency
325  std::pair<int, int> g4reco(*itr, colID);
326 
327  // insert idpe into the map
328  g4RecoBaseIDToPurityEfficiency[g4reco] = pe;
329 
330  itr++;
331 
332  } // end loop over eveIDs
333 
334  return;
335 }
intermediate_table::iterator iterator
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const std::set< int > GetSetOfTrackIds()
const double HitCollectionEfficiency(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 double HitCollectionPurity(std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit > > const &hits)
art::ServiceHandle< cheat::BackTrackerService > fBT
the back tracker service
void cheat::RecoCheckAna::CheckRecoClusters ( art::Event const &  evt,
std::string const &  label,
art::Handle< std::vector< recob::Cluster > > const &  clscol,
std::vector< art::Ptr< recob::Hit > > const &  allhits 
)
private

Definition at line 338 of file RecoCheckAna_module.cc.

References CheckReco(), fG4ClusterIDToPurityEfficiency, and hits().

Referenced by analyze().

342 {
343 
344  art::FindManyP<recob::Hit> fmh(clscol, evt, label);
345 
346  for(size_t c = 0; c < clscol->size(); ++c){
347 
348  // get the hits associated with this event
349  std::vector< art::Ptr< recob::Hit > > hits = fmh.at(c);
350 
351  this->CheckReco(clscol->at(c).ID(), allhits, hits, fG4ClusterIDToPurityEfficiency);
352 
353  }// end loop over clusters
354 
355  return;
356 }
void hits()
Definition: readHits.C:15
std::map< std::pair< int, int >, std::pair< double, double > > fG4ClusterIDToPurityEfficiency
TCEvent evt
Definition: DataStructs.cxx:5
void CheckReco(int const &colID, std::vector< art::Ptr< recob::Hit > > const &allhits, std::vector< art::Ptr< recob::Hit > > const &colHits, std::map< std::pair< int, int >, std::pair< double, double > > &g4RecoBaseIDToPurityEfficiency)
void cheat::RecoCheckAna::CheckRecoEvents ( art::Event const &  evt,
std::string const &  label,
art::Handle< std::vector< recob::Event > > const &  evtcol,
std::vector< art::Ptr< recob::Hit > > const &  allhits 
)
private
Todo:
need to divy it up in the case where there is more than 1 true interaction in a spill

Definition at line 461 of file RecoCheckAna_module.cc.

References d, simb::MCParticle::Daughter(), fBT, fEventEfficiency, fEventPurity, fEventPurityEfficiency, fPI, cheat::BackTrackerService::HitCollectionEfficiency(), cheat::BackTrackerService::HitCollectionPurity(), hits(), geo::k3D, simb::MCParticle::NumberDaughters(), part, and cheat::ParticleInventoryService::ParticleList().

Referenced by analyze().

465 {
466  const sim::ParticleList& plist = fPI->ParticleList();
467 
468  // loop over all primaries in the plist and grab them and their daughters to put into
469  // the set of track ids to pass on to the back tracker
470  std::set<int> ids;
471  for (const auto& PartPair: plist) {
472  auto trackID = PartPair.first;
473  if (!plist.IsPrimary(trackID)) continue;
474  const simb::MCParticle& part = *(PartPair.second);
475  ids.insert(trackID);
476  for(int d = 0; d < part.NumberDaughters(); ++d)
477  ids.insert(part.Daughter(d));
478  }// end loop over primaries
479 
480 
481 
482  art::FindManyP<recob::Hit> fmh(evtcol, evt, label);
483 
484  for(size_t ev = 0; ev < evtcol->size(); ++ev){
485 
486  // get the hits associated with this event
487  std::vector< art::Ptr< recob::Hit > > hits = fmh.at(ev);
488 
489  // use the cheat::BackTrackerService to find purity and efficiency for these hits
490  double purity = fBT->HitCollectionPurity(ids, hits);
491  double efficiency = fBT->HitCollectionEfficiency(ids, hits, allhits, geo::k3D);
492 
493  fEventPurity ->Fill(purity);
494  fEventEfficiency->Fill(efficiency);
495  fEventPurityEfficiency->Fill(purity*efficiency);
496 
497  }// end loop over events
498 
499  return;
500 }
TH1D * fEventPurity
histogram of event purity
TH1D * fEventEfficiency
histogram of event efficiency
int NumberDaughters() const
Definition: MCParticle.h:221
int Daughter(const int i) const
Definition: MCParticle.cxx:112
TH1D * fEventPurityEfficiency
histogram of event efficiency times purity
3-dimensional objects, potentially hits, clusters, prongs, etc.
Definition: geo_types.h:82
void hits()
Definition: readHits.C:15
TString part[npart]
Definition: Style.C:32
Float_t d
Definition: plot.C:237
const double HitCollectionEfficiency(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 double HitCollectionPurity(std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit > > const &hits)
art::ServiceHandle< cheat::BackTrackerService > fBT
the back tracker service
TCEvent evt
Definition: DataStructs.cxx:5
art::ServiceHandle< cheat::ParticleInventoryService > fPI
the back tracker service
void cheat::RecoCheckAna::CheckRecoShowers ( art::Event const &  evt,
std::string const &  label,
art::Handle< std::vector< recob::Shower > > const &  scol,
std::vector< art::Ptr< recob::Hit > > const &  allhits 
)
private

Definition at line 380 of file RecoCheckAna_module.cc.

References CheckReco(), fG4ShowerIDToPurityEfficiency, and hits().

Referenced by analyze().

384 {
385 
386  art::FindManyP<recob::Hit> fmh(scol, evt, label);
387 
388  for(size_t p = 0; p < scol->size(); ++p){
389 
390  // get the hits associated with this event
391  std::vector< art::Ptr< recob::Hit > > hits = fmh.at(p);
392 
393  this->CheckReco(scol->at(p).ID(), allhits, hits, fG4ShowerIDToPurityEfficiency);
394 
395  }// end loop over events
396 
397  return;
398 }
std::map< std::pair< int, int >, std::pair< double, double > > fG4ShowerIDToPurityEfficiency
void hits()
Definition: readHits.C:15
TCEvent evt
Definition: DataStructs.cxx:5
void CheckReco(int const &colID, std::vector< art::Ptr< recob::Hit > > const &allhits, std::vector< art::Ptr< recob::Hit > > const &colHits, std::map< std::pair< int, int >, std::pair< double, double > > &g4RecoBaseIDToPurityEfficiency)
void cheat::RecoCheckAna::CheckRecoTracks ( art::Event const &  evt,
std::string const &  label,
art::Handle< std::vector< recob::Track > > const &  tcol,
std::vector< art::Ptr< recob::Hit > > const &  allhits 
)
private

Definition at line 359 of file RecoCheckAna_module.cc.

References CheckReco(), fG4TrackIDToPurityEfficiency, and hits().

Referenced by analyze().

363 {
364 
365  art::FindManyP<recob::Hit> fmh(tcol, evt, label);
366 
367  for(size_t p = 0; p < tcol->size(); ++p){
368 
369  // get the hits associated with this event
370  std::vector< art::Ptr< recob::Hit > > hits = fmh.at(p);
371 
372  this->CheckReco(tcol->at(p).ID(), allhits, hits, fG4TrackIDToPurityEfficiency);
373 
374  }// end loop over tracks
375 
376  return;
377 }
std::map< std::pair< int, int >, std::pair< double, double > > fG4TrackIDToPurityEfficiency
void hits()
Definition: readHits.C:15
TCEvent evt
Definition: DataStructs.cxx:5
void CheckReco(int const &colID, std::vector< art::Ptr< recob::Hit > > const &allhits, std::vector< art::Ptr< recob::Hit > > const &colHits, std::map< std::pair< int, int >, std::pair< double, double > > &g4RecoBaseIDToPurityEfficiency)
void cheat::RecoCheckAna::CheckRecoVertices ( art::Event const &  evt,
std::string const &  label,
art::Handle< std::vector< recob::Vertex > > const &  vtxcol,
std::vector< art::Ptr< recob::Hit > > const &  allhits 
)
private

Definition at line 403 of file RecoCheckAna_module.cc.

References d, simb::MCParticle::Daughter(), fBT, fPI, fVertexEfficiency, fVertexPurity, fVertexPurityEfficiency, cheat::BackTrackerService::HitCollectionEfficiency(), cheat::BackTrackerService::HitCollectionPurity(), hits(), geo::k3D, simb::MCParticle::NumberDaughters(), part, and cheat::ParticleInventoryService::ParticleList().

Referenced by analyze().

407 {
408  const sim::ParticleList& plist = fPI->ParticleList();
409 
410  std::vector< std::set<int> > ids(1);
411  // loop over all primary particles and put their ids into the first set of the
412  // vector. add another set for each primary particle that also has daughters
413  // and put those daughters into the new set
414  // PartPair is a (track ID, particle pointer) pair
415  for (const auto& PartPair: plist) {
416  auto trackID = PartPair.first;
417  if (!plist.IsPrimary(trackID)) continue;
418  const simb::MCParticle& part = *(PartPair.second);
419  ids[0].insert(trackID);
420  if(part.NumberDaughters() > 0){
421  std::set<int> dv;
422  for(int d = 0; d < part.NumberDaughters(); ++d)
423  dv.insert(part.Daughter(d));
424  ids.push_back(std::move(dv));
425  }//end if this primary particle has daughters
426  }// end loop over primaries
427 
428  art::FindManyP<recob::Hit> fmh(vtxcol, evt, label);
429 
430  for(size_t v = 0; v < vtxcol->size(); ++v){
431 
432  // get the hits associated with this event
433  std::vector< art::Ptr< recob::Hit > > hits = fmh.at(v);
434 
435  double maxPurity = -1.;
436  double maxEfficiency = -1.;
437 
438  for(size_t tv = 0; tv < ids.size(); ++tv){
439 
440  // use the cheat::BackTrackerService to find purity and efficiency for these hits
441  double purity = fBT->HitCollectionPurity(ids[tv], hits);
442  double efficiency = fBT->HitCollectionEfficiency(ids[tv], hits, allhits, geo::k3D);
443 
444  if(purity > maxPurity ) maxPurity = purity;
445  if(efficiency > maxEfficiency) maxEfficiency = efficiency;
446  }
447 
448  fVertexPurity ->Fill(maxPurity);
449  fVertexEfficiency->Fill(maxEfficiency);
450  fVertexPurityEfficiency->Fill(maxPurity*maxEfficiency);
451 
452  }// end loop over vertices
453 
454  return;
455 }
int NumberDaughters() const
Definition: MCParticle.h:221
TH1D * fVertexPurity
histogram of vertex purity
int Daughter(const int i) const
Definition: MCParticle.cxx:112
3-dimensional objects, potentially hits, clusters, prongs, etc.
Definition: geo_types.h:82
TH1D * fVertexPurityEfficiency
histogram of vertex efficiency times purity
void hits()
Definition: readHits.C:15
TString part[npart]
Definition: Style.C:32
TH1D * fVertexEfficiency
histogram of vertex efficiency
Float_t d
Definition: plot.C:237
const double HitCollectionEfficiency(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 double HitCollectionPurity(std::set< int > const &trackIds, std::vector< art::Ptr< recob::Hit > > const &hits)
art::ServiceHandle< cheat::BackTrackerService > fBT
the back tracker service
TCEvent evt
Definition: DataStructs.cxx:5
art::ServiceHandle< cheat::ParticleInventoryService > fPI
the back tracker service
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CurrentProcessingContext const * art::EDAnalyzer::currentContext ( ) const
protectedinherited

Definition at line 114 of file EDAnalyzer.cc.

References art::EDAnalyzer::current_context_.

Referenced by art::EDAnalyzer::workerType().

115  {
116  return current_context_.get();
117  }
CPC_exempt_ptr current_context_
Definition: EDAnalyzer.h:179
void cheat::RecoCheckAna::FillResults ( std::vector< art::Ptr< recob::Hit > > const &  allhits)
private

Definition at line 560 of file RecoCheckAna_module.cc.

References DEFINE_ART_MODULE, e, energy, fBT, fCheckClusters, fCheckShowers, fCheckTracks, fclueff, fcluid, fclupur, fClusterEfficiency, fClusterPurity, fClusterPurityEfficiency, fClusterPurityEfficiency2D, fG4ClusterIDToPurityEfficiency, fG4ShowerIDToPurityEfficiency, fG4TrackIDToPurityEfficiency, fhiteff, FlattenMap(), fnclu, fnshw, fntrk, fpdg, fPI, fpmom, fShowerEfficiency, fShowerPurity, fShowerPurityEfficiency, fShowerPurityEfficiency2D, fshweff, fshwid, fshwpur, fTrackEfficiency, ftrackid, fTrackPurity, fTrackPurityEfficiency, fTrackPurityEfficiency2D, fTree, ftrkeff, ftrkid, ftrkpur, cheat::BackTrackerService::GetSetOfTrackIds(), cheat::BackTrackerService::HitToTrackIDEs(), simb::MCParticle::P(), part, simb::MCParticle::PdgCode(), s, cheat::ParticleInventoryService::TrackIdToParticle_P(), and cheat::BackTrackerService::TrackIdToSimIDEs_Ps().

Referenced by analyze().

561 {
562  // map the g4 track id to energy deposited in a hit
563  std::map<int, double> g4IDToHitEnergy;
564  for(size_t h = 0; h < allhits.size(); ++h){
565  const std::vector<sim::TrackIDE> hitTrackIDs = fBT->HitToTrackIDEs(allhits[h]);
566  for(size_t e = 0; e < hitTrackIDs.size(); ++e){
567  g4IDToHitEnergy[hitTrackIDs[e].trackID] += hitTrackIDs[e].energy;
568  }
569  } // end loop over hits to fill map
570 
571  // flatten the G4RecoBaseIDToPurityEfficiency maps to have just the g4ID as the key and the
572  // rest of the information in vector form
573  std::map<int, std::vector< std::pair<int, std::pair<double, double> > > > g4IDToClusterPurityEfficiency;
574  std::map<int, std::vector< std::pair<int, std::pair<double, double> > > > g4IDToShowerPurityEfficiency;
575  std::map<int, std::vector< std::pair<int, std::pair<double, double> > > > g4IDToTrackPurityEfficiency;
576  std::map<int, std::vector< std::pair<int, std::pair<double, double> > > >::iterator g4peItr;
577 
581 
582  // fill the tree vectors
583  // get all the eveIDs from this event
584  std::set<int> trackIDs = fBT->GetSetOfTrackIds();
585  std::set<int>::const_iterator trackItr = trackIDs.begin();
586 
587  // loop over them
588  while( trackItr != trackIDs.end() ){
589 
590  const simb::MCParticle* part = fPI->TrackIdToParticle_P(*trackItr);
591 
592  ftrackid = std::abs(*trackItr);
593  fpdg = part->PdgCode();
594  fpmom = part->P();
595 
596  // figure out how much of the energy deposited from this particle is stored in hits
597  std::vector<const sim::IDE*> ides = fBT->TrackIdToSimIDEs_Ps(*trackItr);
598  double totalDep = 0.;
599  for(size_t i = 0; i < ides.size(); ++i) totalDep += ides[i]->energy;
600 
601  if(totalDep > 0.)
602  fhiteff = g4IDToHitEnergy[*trackItr]/totalDep;
603 
604  std::vector< std::pair<int, std::pair<double, double> > > clVec;
605  std::vector< std::pair<int, std::pair<double, double> > > shVec;
606  std::vector< std::pair<int, std::pair<double, double> > > trVec;
607 
608 
609  if( g4IDToClusterPurityEfficiency.find(*trackItr) != g4IDToClusterPurityEfficiency.end() )
610  clVec = g4IDToClusterPurityEfficiency.find(*trackItr)->second;
611 
612  if( g4IDToShowerPurityEfficiency.find(*trackItr) != g4IDToShowerPurityEfficiency.end() )
613  shVec = g4IDToShowerPurityEfficiency.find(*trackItr)->second;
614 
615  if( g4IDToTrackPurityEfficiency.find(*trackItr) != g4IDToTrackPurityEfficiency.end() )
616  trVec = g4IDToTrackPurityEfficiency.find(*trackItr)->second;
617 
618  fnclu = clVec.size();
619  fnshw = shVec.size();
620  fntrk = trVec.size();
621 
622  for(size_t c = 0; c < clVec.size(); ++c){
623  fcluid .push_back(clVec[c].first);
624  fclupur.push_back(clVec[c].second.first);
625  fclueff.push_back(clVec[c].second.second);
626  }
627 
628  for(size_t s = 0; s < shVec.size(); ++s){
629  fshwid .push_back(shVec[s].first);
630  fshwpur.push_back(shVec[s].second.first);
631  fshweff.push_back(shVec[s].second.second);
632  }
633 
634  for(size_t t = 0; t < trVec.size(); ++t){
635  ftrkid .push_back(trVec[t].first);
636  ftrkpur.push_back(trVec[t].second.first);
637  ftrkeff.push_back(trVec[t].second.second);
638  }
639 
640  fTree->Fill();
641 
642  trackItr++;
643  }
644 
645  // clean up for the next event
646 
647  // clear the maps of G4 track id to efficiency and purity for
648  // various RecoBase objects
652 
653  // clear the vectors hooked up to the tree
654  fclueff.clear();
655  fclupur.clear();
656  fcluid .clear();
657  ftrkeff.clear();
658  ftrkpur.clear();
659  ftrkid .clear();
660  fshweff.clear();
661  fshwpur.clear();
662  fshwid .clear();
663 
664  return;
665 }
int fpdg
particle pdg code
Float_t s
Definition: plot.C:23
const simb::MCParticle * TrackIdToParticle_P(int const &id)
int fnshw
number of showers for this particle
int PdgCode() const
Definition: MCParticle.h:216
TH1D * fTrackPurityEfficiency
histogram of track efficiency times purity
const std::vector< sim::TrackIDE > HitToTrackIDEs(recob::Hit const &hit)
std::map< std::pair< int, int >, std::pair< double, double > > fG4ShowerIDToPurityEfficiency
double fhiteff
hitfinder efficiency for this particle
TH1D * fClusterPurityEfficiency
histogram of cluster efficiency times purity
int fnclu
number of clusters for this particle
int fntrk
number of tracks for this particle
TH2D * fTrackPurityEfficiency2D
scatter histogram of cluster purity and efficiency
const std::set< int > GetSetOfTrackIds()
const std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id)
std::map< std::pair< int, int >, std::pair< double, double > > fG4TrackIDToPurityEfficiency
intermediate_table::const_iterator const_iterator
std::vector< double > fclupur
cluster purities
std::vector< double > fshweff
shower efficiencies
bool fCheckClusters
should we check the reconstruction of clusters?
double P(const int i=0) const
Definition: MCParticle.h:238
std::vector< double > fshwpur
shower purities
TString part[npart]
Definition: Style.C:32
TTree * fTree
TTree to save efficiencies.
std::vector< int > fshwid
shower IDs
double energy
Definition: plottest35.C:25
std::vector< int > ftrkid
track IDs
std::vector< double > ftrkeff
track efficiencies
bool fCheckTracks
should we check the reconstruction of tracks?
std::vector< double > fclueff
cluster efficiencies
double fpmom
particle momentum
std::vector< int > fcluid
cluster IDs
std::vector< double > ftrkpur
track purities
bool fCheckShowers
should we check the reconstruction of showers?
void FlattenMap(std::map< std::pair< int, int >, std::pair< double, double > > const &g4RecoBaseIDToPurityEfficiency, std::map< int, std::vector< std::pair< int, std::pair< double, double > > > > &g4IDToRecoBasePurityEfficiency, TH1D *purity, TH1D *efficiency, TH1D *purityEfficiency, TH2D *purityEfficiency2D)
int ftrackid
geant track ID
TH1D * fShowerPurityEfficiency
histogram of shower efficiency times purity
TH1D * fClusterPurity
histogram of cluster purity
std::map< std::pair< int, int >, std::pair< double, double > > fG4ClusterIDToPurityEfficiency
TH1D * fClusterEfficiency
histogram of cluster efficiency
TH1D * fShowerPurity
histogram of shower purity
TH1D * fShowerEfficiency
histogram of shower efficiency
art::ServiceHandle< cheat::BackTrackerService > fBT
the back tracker service
TH1D * fTrackPurity
histogram of track purity
TH2D * fClusterPurityEfficiency2D
scatter histogram of cluster purity and efficiency
Float_t e
Definition: plot.C:34
TH1D * fTrackEfficiency
histogram of track efficiency
TH2D * fShowerPurityEfficiency2D
scatter histogram of cluster purity and efficiency
art::ServiceHandle< cheat::ParticleInventoryService > fPI
the back tracker service
void cheat::RecoCheckAna::FlattenMap ( std::map< std::pair< int, int >, std::pair< double, double > > const &  g4RecoBaseIDToPurityEfficiency,
std::map< int, std::vector< std::pair< int, std::pair< double, double > > > > &  g4IDToRecoBasePurityEfficiency,
TH1D *  purity,
TH1D *  efficiency,
TH1D *  purityEfficiency,
TH2D *  purityEfficiency2D 
)
private

Definition at line 503 of file RecoCheckAna_module.cc.

Referenced by FillResults().

509 {
510 
511  std::map<std::pair<int, int>, std::pair<double, double> >::const_iterator rbItr = g4RecoBaseIDToPurityEfficiency.begin();
512 
513  // map of key cluster ID to pair of purity, efficiency
514  std::map<int, std::pair<double, double> > recoBIDToPurityEfficiency;
515  std::map<int, std::pair<double, double> >::iterator rbpeItr;
516 
517  while( rbItr != g4RecoBaseIDToPurityEfficiency.end() ){
518 
519 
520  // trackID, cluster ID
521  std::pair<int, int> g4cl = rbItr->first;
522  // purity, efficiency
523  std::pair<double, double> pe = rbItr->second;
524 
525  // add the efficiency and purity values for clusters corresponding
526  // to the current g4 id to the map
527  // pair of cluster id, pair of purity, efficiency
528  std::pair<int, std::pair<double, double> > clpe(g4cl.second, pe);
529  // g4IDToRecoBasePurityEfficiency is a map with key of trackID of a vector of clusterIDs of pairs of purity and efficiency
530  g4IDToRecoBasePurityEfficiency[g4cl.first].push_back(clpe);
531 
532  // now find the maximum purity to determine the purity and efficiency
533  // for this RecoBase object
534  rbpeItr = recoBIDToPurityEfficiency.find(g4cl.second);
535  if( rbpeItr != recoBIDToPurityEfficiency.end() ){
536  std::pair<double, double> curpe = rbpeItr->second;
537  if(pe.first > curpe.first) recoBIDToPurityEfficiency[g4cl.second] = pe;
538  }
539  else
540  recoBIDToPurityEfficiency[g4cl.second] = pe;
541 
542  rbItr++;
543  }
544 
545  rbpeItr = recoBIDToPurityEfficiency.begin();
546 
547  // now fill the histograms,
548  while(rbpeItr != recoBIDToPurityEfficiency.end() ){
549  purity ->Fill(rbpeItr->second.first);
550  efficiency->Fill(rbpeItr->second.second);
551  purityEfficiency->Fill(rbpeItr->second.first*rbpeItr->second.second);
552  purityEfficiency2D->Fill(rbpeItr->second.first,rbpeItr->second.second);
553  rbpeItr++;
554  }
555 
556  return;
557 }
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

Referenced by art::OutputModule::doWriteEvent().

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:34
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void cheat::RecoCheckAna::reconfigure ( fhicl::ParameterSet const &  p)
virtual

Definition at line 222 of file RecoCheckAna_module.cc.

References fCheckClusters, fCheckEvents, fCheckShowers, fCheckTracks, fCheckVertices, fClusterModuleLabel, fEventModuleLabel, fHitModuleLabel, fShowerModuleLabel, fTrackModuleLabel, fVertexModuleLabel, and fhicl::ParameterSet::get().

Referenced by RecoCheckAna().

223 {
224  fHitModuleLabel = p.get< std::string >("HitModuleLabel");
225  fClusterModuleLabel = p.get< std::string >("ClusterModuleLabel");
226  fShowerModuleLabel = p.get< std::string >("ShowerModuleLabel" );
227  fTrackModuleLabel = p.get< std::string >("TrackModuleLabel" );
228  fVertexModuleLabel = p.get< std::string >("VertexModuleLabel" );
229  fEventModuleLabel = p.get< std::string >("EventModuleLabel" );
230 
231  fCheckClusters = p.get< bool >("CheckClusters");
232  fCheckShowers = p.get< bool >("CheckShowers" );
233  fCheckTracks = p.get< bool >("CheckTracks" );
234  fCheckVertices = p.get< bool >("CheckVertices");
235  fCheckEvents = p.get< bool >("CheckEvents" );
236 }
bool fCheckVertices
should we check the reconstruction of vertices?
bool fCheckEvents
should we check the reconstruction of events?
bool fCheckClusters
should we check the reconstruction of clusters?
bool fCheckTracks
should we check the reconstruction of tracks?
std::string fTrackModuleLabel
label for module making the tracks
bool fCheckShowers
should we check the reconstruction of showers?
std::string fClusterModuleLabel
label for module making the clusters
std::string fShowerModuleLabel
label for module making the showers
std::string fEventModuleLabel
label for module making the events
std::string fVertexModuleLabel
label for module making the vertices
std::string fHitModuleLabel
label for module making the hits
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

Referenced by art::RootOutputFile::writeOne().

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

art::ServiceHandle<cheat::BackTrackerService> cheat::RecoCheckAna::fBT
private

the back tracker service

Definition at line 91 of file RecoCheckAna_module.cc.

Referenced by CheckReco(), CheckRecoEvents(), CheckRecoVertices(), and FillResults().

bool cheat::RecoCheckAna::fCheckClusters
private

should we check the reconstruction of clusters?

Definition at line 101 of file RecoCheckAna_module.cc.

Referenced by analyze(), beginRun(), FillResults(), and reconfigure().

bool cheat::RecoCheckAna::fCheckEvents
private

should we check the reconstruction of events?

Definition at line 105 of file RecoCheckAna_module.cc.

Referenced by analyze(), beginRun(), and reconfigure().

bool cheat::RecoCheckAna::fCheckShowers
private

should we check the reconstruction of showers?

Definition at line 102 of file RecoCheckAna_module.cc.

Referenced by analyze(), beginRun(), FillResults(), and reconfigure().

bool cheat::RecoCheckAna::fCheckTracks
private

should we check the reconstruction of tracks?

Definition at line 103 of file RecoCheckAna_module.cc.

Referenced by analyze(), beginRun(), FillResults(), and reconfigure().

bool cheat::RecoCheckAna::fCheckVertices
private

should we check the reconstruction of vertices?

Definition at line 104 of file RecoCheckAna_module.cc.

Referenced by analyze(), beginRun(), and reconfigure().

std::vector<double> cheat::RecoCheckAna::fclueff
private

cluster efficiencies

Definition at line 141 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::vector<int> cheat::RecoCheckAna::fcluid
private

cluster IDs

Definition at line 143 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::vector<double> cheat::RecoCheckAna::fclupur
private

cluster purities

Definition at line 142 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH1D* cheat::RecoCheckAna::fClusterEfficiency
private

histogram of cluster efficiency

Definition at line 108 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::string cheat::RecoCheckAna::fClusterModuleLabel
private

label for module making the clusters

Definition at line 95 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().

TH1D* cheat::RecoCheckAna::fClusterPurity
private

histogram of cluster purity

Definition at line 107 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH1D* cheat::RecoCheckAna::fClusterPurityEfficiency
private

histogram of cluster efficiency times purity

Definition at line 109 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH2D* cheat::RecoCheckAna::fClusterPurityEfficiency2D
private

scatter histogram of cluster purity and efficiency

Definition at line 110 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

int cheat::RecoCheckAna::fevent
private

event number

Definition at line 135 of file RecoCheckAna_module.cc.

Referenced by analyze(), and beginRun().

TH1D* cheat::RecoCheckAna::fEventEfficiency
private

histogram of event efficiency

Definition at line 123 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and CheckRecoEvents().

std::string cheat::RecoCheckAna::fEventModuleLabel
private

label for module making the events

Definition at line 99 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().

TH1D* cheat::RecoCheckAna::fEventPurity
private

histogram of event purity

Definition at line 122 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and CheckRecoEvents().

TH1D* cheat::RecoCheckAna::fEventPurityEfficiency
private

histogram of event efficiency times purity

Definition at line 124 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and CheckRecoEvents().

std::map< std::pair<int, int>, std::pair<double, double> > cheat::RecoCheckAna::fG4ClusterIDToPurityEfficiency
private

Definition at line 129 of file RecoCheckAna_module.cc.

Referenced by CheckRecoClusters(), and FillResults().

std::map< std::pair<int, int>, std::pair<double, double> > cheat::RecoCheckAna::fG4ShowerIDToPurityEfficiency
private

Definition at line 130 of file RecoCheckAna_module.cc.

Referenced by CheckRecoShowers(), and FillResults().

std::map< std::pair<int, int>, std::pair<double, double> > cheat::RecoCheckAna::fG4TrackIDToPurityEfficiency
private

Definition at line 131 of file RecoCheckAna_module.cc.

Referenced by CheckRecoTracks(), and FillResults().

double cheat::RecoCheckAna::fhiteff
private

hitfinder efficiency for this particle

Definition at line 139 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::string cheat::RecoCheckAna::fHitModuleLabel
private

label for module making the hits

Definition at line 94 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().

int cheat::RecoCheckAna::fnclu
private

number of clusters for this particle

Definition at line 140 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

int cheat::RecoCheckAna::fnshw
private

number of showers for this particle

Definition at line 144 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

int cheat::RecoCheckAna::fntrk
private

number of tracks for this particle

Definition at line 148 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

int cheat::RecoCheckAna::fpdg
private

particle pdg code

Definition at line 137 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

art::ServiceHandle<cheat::ParticleInventoryService> cheat::RecoCheckAna::fPI
private

the back tracker service

Definition at line 92 of file RecoCheckAna_module.cc.

Referenced by CheckRecoEvents(), CheckRecoVertices(), and FillResults().

double cheat::RecoCheckAna::fpmom
private

particle momentum

Definition at line 138 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

int cheat::RecoCheckAna::frun
private

run number

Definition at line 134 of file RecoCheckAna_module.cc.

Referenced by analyze(), and beginRun().

TH1D* cheat::RecoCheckAna::fShowerEfficiency
private

histogram of shower efficiency

Definition at line 112 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::string cheat::RecoCheckAna::fShowerModuleLabel
private

label for module making the showers

Definition at line 96 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().

TH1D* cheat::RecoCheckAna::fShowerPurity
private

histogram of shower purity

Definition at line 111 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH1D* cheat::RecoCheckAna::fShowerPurityEfficiency
private

histogram of shower efficiency times purity

Definition at line 113 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH2D* cheat::RecoCheckAna::fShowerPurityEfficiency2D
private

scatter histogram of cluster purity and efficiency

Definition at line 114 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::vector<double> cheat::RecoCheckAna::fshweff
private

shower efficiencies

Definition at line 145 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::vector<int> cheat::RecoCheckAna::fshwid
private

shower IDs

Definition at line 147 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::vector<double> cheat::RecoCheckAna::fshwpur
private

shower purities

Definition at line 146 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH1D* cheat::RecoCheckAna::fTrackEfficiency
private

histogram of track efficiency

Definition at line 116 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

int cheat::RecoCheckAna::ftrackid
private

geant track ID

Definition at line 136 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::string cheat::RecoCheckAna::fTrackModuleLabel
private

label for module making the tracks

Definition at line 97 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().

TH1D* cheat::RecoCheckAna::fTrackPurity
private

histogram of track purity

Definition at line 115 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH1D* cheat::RecoCheckAna::fTrackPurityEfficiency
private

histogram of track efficiency times purity

Definition at line 117 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH2D* cheat::RecoCheckAna::fTrackPurityEfficiency2D
private

scatter histogram of cluster purity and efficiency

Definition at line 118 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TTree* cheat::RecoCheckAna::fTree
private

TTree to save efficiencies.

Definition at line 133 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::vector<double> cheat::RecoCheckAna::ftrkeff
private

track efficiencies

Definition at line 149 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::vector<int> cheat::RecoCheckAna::ftrkid
private

track IDs

Definition at line 151 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

std::vector<double> cheat::RecoCheckAna::ftrkpur
private

track purities

Definition at line 150 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and FillResults().

TH1D* cheat::RecoCheckAna::fVertexEfficiency
private

histogram of vertex efficiency

Definition at line 120 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and CheckRecoVertices().

std::string cheat::RecoCheckAna::fVertexModuleLabel
private

label for module making the vertices

Definition at line 98 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().

TH1D* cheat::RecoCheckAna::fVertexPurity
private

histogram of vertex purity

Definition at line 119 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and CheckRecoVertices().

TH1D* cheat::RecoCheckAna::fVertexPurityEfficiency
private

histogram of vertex efficiency times purity

Definition at line 121 of file RecoCheckAna_module.cc.

Referenced by beginRun(), and CheckRecoVertices().


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