Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
cheat::RecoCheckAna Class Reference
Inheritance diagram for cheat::RecoCheckAna:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Classes

struct  Plots
 

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 beginJob ()
 
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< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (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< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (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< TmayConsumeView (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 CheckRecoClusters (std::vector< art::Ptr< rb::Cluster > > const &clscol, art::PtrVector< rb::CellHit > const &allhits, Plots &plots)
 
double TotalLengthInDetector (const sim::Particle *part, geo::View_t view) const
 Total length in either 2D or 3D. More...
 
std::set< intFindVisibleProngs (const art::PtrVector< rb::CellHit > &allhits, std::set< int > ids) const
 

Private Attributes

std::string fClusterAssnLabel
 label for module clusters, showers, and tracks are associated with More...
 
std::string fShowerModuleLabel
 label for module making the showers More...
 
std::string fTrackModuleLabel
 label for module making the tracks More...
 
bool fCheckShowers
 should we check the reconstruction of showers? More...
 
bool fCheckTracks
 should we check the reconstruction of tracks? More...
 
bool fLinkByMaxEff
 
std::vector< PlotsfPlots
 
Plots fClusterPlots
 
Plots fShowerPlots
 

Detailed Description

Definition at line 33 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 87 of file RecoCheckAna_module.cc.

References reconfigure().

88  : EDAnalyzer(p)
89 {
90  this->reconfigure(p);
91 }
const char * p
Definition: xmltok.h:285
virtual void reconfigure(fhicl::ParameterSet const &p)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
cheat::RecoCheckAna::~RecoCheckAna ( )
virtual

Definition at line 94 of file RecoCheckAna_module.cc.

95 {
96 }

Member Function Documentation

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

Implements art::EDAnalyzer.

Definition at line 110 of file RecoCheckAna_module.cc.

References CheckRecoClusters(), art::Handle< T >::failedToGet(), fCheckShowers, fCheckTracks, fClusterAssnLabel, fPlots, fShowerModuleLabel, fShowerPlots, fTrackModuleLabel, art::DataViewImpl::getByLabel(), art::Event::isRealData(), and getGoodRuns4SAM::n.

111 {
112  // check that this is MC, stop if it isn't
113  if(e.isRealData()){
114  mf::LogWarning("RecoCheckAna") << "attempting to run MC truth check on "
115  << "real data, bail";
116  return;
117  }
118 
119 
120  // get a handle on the clusters that the clusters/tracks/showers are associated with (slices)
122  e.getByLabel(fClusterAssnLabel, hslices);
123  if(hslices.failedToGet()){
124  mf::LogWarning("RecoCheckAna") << "could not recover slices";
125  }
126 
127 
128  // get all the association finder objects
131 
132  // loop over the slices
133  for(unsigned int islc = 0; islc < hslices->size(); ++islc){
134  art::PtrVector<rb::CellHit> allhits = hslices->at(islc).AllCells();
135  if(fCheckTracks){
136  if(fmtrack.isValid()){
137  std::vector< art::Ptr<rb::Track> > trkcol = fmtrack.at(islc);
138  std::vector< art::Ptr<rb::Cluster> > tracks;
139  for(unsigned int itrk = 0; itrk < trkcol.size(); ++itrk){
140  tracks.push_back(trkcol[itrk]);
141  }
142  for(unsigned int n = 0; n < fPlots.size(); ++n){
143  CheckRecoClusters(tracks, allhits, fPlots[n]);
144  }
145  }
146  else{
147  mf::LogWarning("RecoCheckAna") << "could not recover tracks";
148  }
149  }
150 
151  if(fCheckShowers){
152  if(fmprong.isValid()){
153  std::vector< art::Ptr<rb::Prong> > shwcol = fmprong.at(islc);
154  std::vector< art::Ptr<rb::Cluster> > shws;
155  for(unsigned int ishw = 0; ishw < shwcol.size(); ++ishw){
156  shws.push_back(shwcol[ishw]);
157  }
158  this->CheckRecoClusters(shws, allhits, fShowerPlots);
159  }
160  else{
161  mf::LogWarning("RecoCheckAna") << "could not recover showers";
162  }
163  }
164 
165  }
166 
167 }
std::vector< Plots > fPlots
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 fClusterAssnLabel
label for module clusters, showers, and tracks are associated with
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::string fShowerModuleLabel
label for module making the showers
Float_t e
Definition: plot.C:35
void CheckRecoClusters(std::vector< art::Ptr< rb::Cluster > > const &clscol, art::PtrVector< rb::CellHit > const &allhits, Plots &plots)
bool failedToGet() const
Definition: Handle.h:196
void cheat::RecoCheckAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 182 of file RecoCheckAna_module.cc.

References cheat::RecoCheckAna::Plots::allowedDaughters, cheat::RecoCheckAna::Plots::deltaLength, cheat::RecoCheckAna::Plots::deltaLengthVsLength, cheat::RecoCheckAna::Plots::efficiency, cheat::RecoCheckAna::Plots::efficiencyVsLength, cheat::RecoCheckAna::Plots::effvpur, fCheckShowers, fCheckTracks, fPlots, fShowerPlots, art::TFileDirectory::make(), getGoodRuns4SAM::n, cheat::RecoCheckAna::Plots::pdgs, cheat::RecoCheckAna::Plots::purity, cheat::RecoCheckAna::Plots::purityVsLength, and string.

183 {
185 
186  if(fCheckTracks){
187  for(int n = 0; n < 4; ++n){
189  std::set<int> pdgs;
190  std::set<int> allowedDaughters;
191 
192  switch(n){
193  case 0:
194  name = "all";
195  break;
196  case 1:
197  name = "muon";
198  pdgs.insert(-13); pdgs.insert(+13);
199  allowedDaughters.insert(-11); allowedDaughters.insert(+11);
200  break;
201  case 2:
202  name = "proton";
203  pdgs.insert(-2212); pdgs.insert(+2212);
204  break;
205  case 3:
206  name = "piPlusMinus";
207  pdgs.insert(-211); pdgs.insert(+211);
208  break;
209  }
210 
211  Plots p;
212  p.purity = tfs->make<TH1D>((name+"Purity").c_str(), ";Purity;Tracks", 110, 0, 1.1);
213  p.efficiency = tfs->make<TH1D>((name+"Efficiency").c_str(), ";Efficiency;Tracks", 110, 0, 1.1);
214  p.deltaLength = tfs->make<TH1D>((name+"DeltaLength").c_str(), ";#DeltaL (cm);Tracks", 100, -50, +50);
215  p.purityVsLength = tfs->make<TH2D>((name+"PurityVsLength").c_str(), ";True length (cm);Purity;Tracks", 300, 0, 1500, 110, 0, 1.1);
216  p.efficiencyVsLength = tfs->make<TH2D>((name+"EfficiencyVsLength").c_str(), ";True length (cm);Efficiency;Tracks", 300, 0, 1500, 110, 0, 1.1);
217  p.deltaLengthVsLength = tfs->make<TH2D>((name+"DeltaLengthVsLength").c_str(), ";True length (cm);#DeltaL (cm);Tracks", 300, 0, 1500, 100, -50, +50);
218  p.effvpur = tfs->make<TH2D>((name+"EffvPurity").c_str(), ";Efficiency;Purity", 110, 0, 1.1, 110, 0, 1.1);
219  p.pdgs = pdgs;
220  p.allowedDaughters = allowedDaughters;
221 
222  fPlots.push_back(p);
223  }
224  }
225 
226  if(fCheckShowers){
227  fShowerPlots.purity = tfs->make<TH1D>("showerPurity", ";Purity;Showers", 110, 0., 1.1);
228  fShowerPlots.efficiency = tfs->make<TH1D>("showerEfficiency", ";Efficiency;Showers", 110, 0., 1.1);
229  }
230 
231 }
const XML_Char * name
Definition: expat.h:151
std::vector< Plots > fPlots
const char * p
Definition: xmltok.h:285
bool fCheckTracks
should we check the reconstruction of tracks?
bool fCheckShowers
should we check the reconstruction of showers?
T * make(ARGS...args) const
enum BeamMode string
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
void cheat::RecoCheckAna::CheckRecoClusters ( std::vector< art::Ptr< rb::Cluster > > const &  clscol,
art::PtrVector< rb::CellHit > const &  allhits,
Plots plots 
)
private

Definition at line 235 of file RecoCheckAna_module.cc.

References rb::Cluster::AllCells(), cheat::RecoCheckAna::Plots::allowedDaughters, ana::assert(), plot_validation_datamc::c, simb::MCParticle::Daughter(), cheat::RecoCheckAna::Plots::deltaLength, cheat::RecoCheckAna::Plots::deltaLengthVsLength, e, cheat::RecoCheckAna::Plots::efficiency, cheat::RecoCheckAna::Plots::efficiencyVsLength, cheat::RecoCheckAna::Plots::effvpur, febshutoff_auto::end, FindVisibleProngs(), fLinkByMaxEff, cheat::BackTracker::GetTrackIDList(), cheat::BackTracker::HitCollectionEfficiency(), cheat::BackTracker::HitCollectionPurity(), hits(), MECModelEnuComparisons::i, it, geo::kX, geo::kXorY, simb::MCParticle::NumberDaughters(), make_root_from_grid_output::pdg, simb::MCParticle::PdgCode(), cheat::RecoCheckAna::Plots::pdgs, cheat::RecoCheckAna::Plots::purity, cheat::RecoCheckAna::Plots::purityVsLength, TotalLengthInDetector(), cheat::BackTracker::TrackIDToParticle(), POTSpillRate::view, rb::Cluster::View(), and ana::weight.

Referenced by analyze().

238 {
239  // grab the set of eve IDs for this plist
241  std::set<int> trackIDs = bt->GetTrackIDList();
242 
243  // Only keep the ones associated with not completely unreasonable tracks
244  trackIDs = FindVisibleProngs(allhits, trackIDs);
245 
246  // Empty set means accept all PDGs. Otherwise, filter out the unwanted ones
247  if(!plots.pdgs.empty()){
248  std::set<int> newTrackIDs;
249  for(std::set<int>::iterator it = trackIDs.begin(); it != trackIDs.end(); ++it){
250  const int pdg = bt->TrackIDToParticle(*it)->PdgCode();
251  if(plots.pdgs.find(pdg) != plots.pdgs.end()) newTrackIDs.insert(*it);
252  } // end for it
253  trackIDs = newTrackIDs;
254  }
255 
256  std::map<int, int> parents;
257  if(!plots.allowedDaughters.empty()){
258  for(std::set<int>::iterator it = trackIDs.begin(); it != trackIDs.end(); ++it){
259  const sim::Particle* mother = bt->TrackIDToParticle(*it);
260  if(!mother) continue; // Can this happen?
261 
262  for(int i = 0; i < mother->NumberDaughters(); ++i){
263  const int id = mother->Daughter(i);
264  assert(bt->TrackIDToParticle(id));
265  if(plots.allowedDaughters.count(bt->TrackIDToParticle(id)->PdgCode())){
266  parents[id] = *it;
267  }
268  } // end for i
269  } // end for it
270  } // end if
271 
272  // Indexed by what view they're in. X, Y, or 3D
273  assert(geo::kXorY == 2); // Ensure enum still works how we think
274  std::map<int, double> bestPur[3], bestEff[3], bestLength[3];
275 
276  // Go through each reconstructed object, accumulating the best scores seen
277  // for each trackID we're interested in.
278  for(size_t c = 0; c < clscol.size(); ++c){
279  const rb::Cluster* cls = clscol[c].get();
280  const geo::View_t view = cls->View();
281 
282  // get the hits associated with this object
284 
285  // use the cheat::BackTracker to find purity and efficiency for these
286  // hits for each particle ID
287  std::map<int, double> purMap, effMap;
288  bt->HitCollectionPurity(trackIDs, hits, &purMap, &parents);
289  bt->HitCollectionEfficiency(trackIDs, hits, allhits, view, &effMap);
290 
291  for(std::set<int>::iterator it = trackIDs.begin(); it != trackIDs.end(); ++it){
292  const double p = purMap[*it];
293  const double e = effMap[*it];
294 
295  if(( fLinkByMaxEff && e > bestEff[view][*it]) ||
296  (!fLinkByMaxEff && p > bestPur[view][*it])) {
297  bestEff[view][*it] = e;
298  bestPur[view][*it] = p;
299 
300  // If we were told to fill a track length histogram then downcast
301  // should be safe.
302  if(plots.deltaLength) bestLength[view][*it] = ((rb::Track*)cls)->TotalLength();
303  }
304  } // end for it
305  } // end for c
306 
307  // For every track. If it was matched in 3D, fill the histograms.
308  // If there is no 3D match look for 2 2D matches and fill with weight 0.5
309  // If required we can add a flag to only try 3D or only try 2D.
310  for(std::set<int>::iterator it = trackIDs.begin(); it != trackIDs.end(); ++it){
311  // Try 3D first
312  for(int view = geo::kXorY; view >= geo::kX; --view){
313  // If no 3D match, continue to two 2D options
314  if(view == geo::kXorY && bestEff[view].find(*it) == bestEff[view].end()) continue;
315 
316  const double weight = (view == geo::kXorY) ? 1 : 0.5;
317 
318  if(plots.purity) plots.purity->Fill(bestPur[view][*it], weight);
319  if(plots.efficiency) plots.efficiency->Fill(bestEff[view][*it], weight);
320  if(plots.effvpur) plots.effvpur->Fill(bestEff[view][*it], bestPur[view][*it], weight);
321 
322  const double trueLength = TotalLengthInDetector(bt->TrackIDToParticle(*it), geo::View_t(view));
323 
324  if(plots.purityVsLength) plots.purityVsLength->Fill(trueLength, bestPur[view][*it], weight);
325  if(plots.efficiencyVsLength) plots.efficiencyVsLength->Fill(trueLength, bestEff[view][*it], weight);
326 
327  if(plots.deltaLength) plots.deltaLength->Fill(bestLength[view][*it]-trueLength, weight);
328  if(plots.deltaLengthVsLength) plots.deltaLengthVsLength->Fill(trueLength, bestLength[view][*it]-trueLength, weight);
329 
330  // If we did find a 3D match, don't try 2D
331  if(bestEff[geo::kXorY].find(*it) != bestEff[geo::kXorY].end()) break;
332  } // end for view
333  } // end for it
334 }
::xsd::cxx::tree::id< char, ncname > id
Definition: Database.h:165
virtual geo::View_t View() const
kXorY for 3D clusters.
Definition: Cluster.h:99
int PdgCode() const
Definition: MCParticle.h:211
set< int >::iterator it
const Var weight
X or Y views.
Definition: PlaneGeo.h:30
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
A collection of associated CellHits.
Definition: Cluster.h:47
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
int NumberDaughters() const
Definition: MCParticle.h:216
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
double HitCollectionEfficiency(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, const std::vector< const rb::CellHit * > &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
Returns the fraction of all energy in an event from a specific set of Geant4 track IDs that are repre...
int Daughter(const int i) const
Definition: MCParticle.cxx:112
void hits()
Definition: readHits.C:15
std::set< int > FindVisibleProngs(const art::PtrVector< rb::CellHit > &allhits, std::set< int > ids) const
const std::vector< Plot > plots
double HitCollectionPurity(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, std::map< int, double > *purMap=0, std::map< int, int > *parents=0, bool energyPur=false) const
Returns the fraction of hits in a collection that come from the specified Geant4 track ids...
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
const std::set< int > GetTrackIDList() const
Get all G4 track ids present in the event.
Definition: BackTracker.h:750
assert(nhit_max >=nhit_nbins)
double TotalLengthInDetector(const sim::Particle *part, geo::View_t view) const
Total length in either 2D or 3D.
Float_t e
Definition: plot.C:35
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 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

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

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
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 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDAnalyzer::currentContext ( ) const
protectedinherited
std::set< int > cheat::RecoCheckAna::FindVisibleProngs ( const art::PtrVector< rb::CellHit > &  allhits,
std::set< int ids 
) const
private

Definition at line 387 of file RecoCheckAna_module.cc.

References plot_validation_datamc::c, DEFINE_ART_MODULE(), cheat::BackTracker::HitToTrackIDE(), MECModelEnuComparisons::i, it, calib::j, sim::kNoiseId, geo::kX, geo::kY, Counts::nHits, Counts::nOnlyHits, runNovaSAM::ret, art::PtrVector< T >::size(), trackID, and rb::CellHit::View().

Referenced by CheckRecoClusters().

389 {
390  std::map<int, Counts> counts;
391 
393 
394  // loop over all hits and check if this track id contributed to them
395  for(unsigned int i = 0; i < allhits.size(); ++i){
396  //get vector of track id's that contribute to this hit
397  const art::Ptr<rb::CellHit> hit = allhits[i];
398  const std::vector<TrackIDE> trackIDs = bt->HitToTrackIDE(hit);
399  // loop over all the returned track ids
400  int nTracks = 0; // number of tracks that contributed energy to the hit
401  int loneID = -1; // Which ID it was if there was only one
402  for(unsigned int j = 0; j < trackIDs.size(); ++j){
403  const int trackID = trackIDs[j].trackID;
404  if(trackID != sim::kNoiseId){
405  ++nTracks;
406  loneID = trackID;
407  }
408 
409  // check if the current id matches the input track id
410  if(ids.find(trackID) != ids.end()){
411  ++counts[trackID].nHits[hit->View()];
412  }
413  } // end for j
414  if(nTracks == 1){
415  ++counts[loneID].nOnlyHits[hit->View()];
416  }
417  } // end for i
418 
419  const int kMinHits = 2; // minimum number of hits to be considered visible
420  const int kMinOnlyHit = 1; // minimum number of hits in which it is only particle contributing energy to be visible
421 
422  std::set<int> ret;
423  for(std::set<int>::iterator it = ids.begin(); it != ids.end(); ++it){
424  const Counts c = counts[*it];
425  // Check if this track passes the visible prong requirements
426  if(c.nOnlyHits[geo::kX] >= kMinOnlyHit &&
427  c.nOnlyHits[geo::kY] >= kMinOnlyHit){
428 
429  if(c.nHits[geo::kX] >= kMinHits && c.nHits[geo::kY] >= 1)
430  ret.insert(*it);
431 
432  if(c.nHits[geo::kY] >= kMinHits && c.nHits[geo::kX] >= 1)
433  ret.insert(*it);
434  }
435  }
436  return ret;
437 }
set< int >::iterator it
std::vector< TrackIDE > HitToTrackIDE(const rb::CellHit &hit, bool useBirksE=false) const
Convenience function. HitsToTrackIDE but for a single hit.
static const int kNoiseId
flag for noise id
Definition: Simulation.h:13
geo::View_t View() const
Definition: CellHit.h:41
Vertical planes which measure X.
Definition: PlaneGeo.h:28
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
const double j
Definition: BetheBloch.cxx:29
size_type size() const
Definition: PtrVector.h:308
Definition: structs.h:12
Int_t trackID
Definition: plot.C:84
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
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_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
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 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

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

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
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 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

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

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void cheat::RecoCheckAna::reconfigure ( fhicl::ParameterSet const &  p)
virtual

Definition at line 170 of file RecoCheckAna_module.cc.

References fCheckShowers, fCheckTracks, fClusterAssnLabel, fLinkByMaxEff, fShowerModuleLabel, fTrackModuleLabel, fhicl::ParameterSet::get(), and string.

Referenced by RecoCheckAna().

171 {
172  fClusterAssnLabel = p.get< std::string >("ClusterAssnLabel" );
173  fShowerModuleLabel = p.get< std::string >("ShowerModuleLabel" );
174  fTrackModuleLabel = p.get< std::string >("TrackModuleLabel" );
175 
176  fCheckShowers = p.get< bool >("CheckShowers" );
177  fCheckTracks = p.get< bool >("CheckTracks" );
178  fLinkByMaxEff = p.get< bool >("LinkByMaxEff" );
179 }
const char * p
Definition: xmltok.h:285
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 fClusterAssnLabel
label for module clusters, showers, and tracks are associated with
std::string fShowerModuleLabel
label for module making the showers
enum BeamMode string
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

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

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

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

Referenced by art::RootOutput::endJob().

double cheat::RecoCheckAna::TotalLengthInDetector ( const sim::Particle part,
geo::View_t  view 
) const
private

Total length in either 2D or 3D.

Definition at line 337 of file RecoCheckAna_module.cc.

References geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), dist, stan::math::fabs(), geom(), geo::kX, geo::kY, Mag(), getGoodRuns4SAM::n, simb::MCParticle::NumberTrajectoryPoints(), PandAna.Demos.pi0_spectra::p0, plot_validation_datamc::p1, and simb::MCParticle::Position().

Referenced by CheckRecoClusters().

339 {
340  const unsigned int N = p->NumberTrajectoryPoints();
341 
342  if(N < 2){
343  mf::LogWarning("RecoCheckAna") << "Particle has no trajectory points";
344  return 0;
345  }
346 
348 
349  double dist = 0;
350 
351  for(unsigned int n = 0; n < N-1; ++n){
352  TVector3 p0 = p->Position(n).Vect();
353  TVector3 p1 = p->Position(n+1).Vect();
354  if(p0.Z() < 0 || p1.Z() < 0 ||
355  p0.Z() > geom->DetLength() || p1.Z() > geom->DetLength() ||
356  fabs(p0.X()) > geom->DetHalfWidth() || fabs(p1.X()) > geom->DetHalfWidth() ||
357  fabs(p0.Y()) > geom->DetHalfHeight() || fabs(p1.Y()) > geom->DetHalfHeight()) continue;
358 
359  if(view == geo::kX){
360  p0.SetY(0);
361  p1.SetY(0);
362  }
363  if(view == geo::kY){
364  p0.SetX(0);
365  p1.SetX(0);
366  }
367  dist += (p1-p0).Mag();
368  }
369 
370  return dist;
371 }
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
double DetLength() const
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
double dist
Definition: runWimpSim.h:113
double DetHalfHeight() const
double DetHalfWidth() const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void geom(int which=0)
Definition: geom.C:163
float Mag() const
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

Referenced by art::RootOutput::RootOutput().

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

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

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
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

bool cheat::RecoCheckAna::fCheckShowers
private

should we check the reconstruction of showers?

Definition at line 73 of file RecoCheckAna_module.cc.

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

bool cheat::RecoCheckAna::fCheckTracks
private

should we check the reconstruction of tracks?

Definition at line 74 of file RecoCheckAna_module.cc.

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

std::string cheat::RecoCheckAna::fClusterAssnLabel
private

label for module clusters, showers, and tracks are associated with

Definition at line 69 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().

Plots cheat::RecoCheckAna::fClusterPlots
private

Definition at line 81 of file RecoCheckAna_module.cc.

bool cheat::RecoCheckAna::fLinkByMaxEff
private

If set to true, finds mc particle with max efficiency and plots the corresponding efficiency and purity. If set to false, finds mc particle with the max purity and plots the corresponding efficiency and purity.

Definition at line 75 of file RecoCheckAna_module.cc.

Referenced by CheckRecoClusters(), and reconfigure().

std::vector<Plots> cheat::RecoCheckAna::fPlots
private

Definition at line 80 of file RecoCheckAna_module.cc.

Referenced by analyze(), and beginJob().

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

label for module making the showers

Definition at line 70 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().

Plots cheat::RecoCheckAna::fShowerPlots
private

Definition at line 82 of file RecoCheckAna_module.cc.

Referenced by analyze(), and beginJob().

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

label for module making the tracks

Definition at line 71 of file RecoCheckAna_module.cc.

Referenced by analyze(), and reconfigure().


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