Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
pdune::RecoEff Class Reference
Inheritance diagram for pdune::RecoEff:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Classes

struct  Config
 

Public Types

enum  EFilterMode { kCosmic, kBeam, kPrimary, kSecondary }
 
using Parameters = art::EDAnalyzer::Table< Config >
 
- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

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

Private Member Functions

void ResetVars ()
 
double GetLengthInTPC (detinfo::DetectorClocksData const &clockData, simb::MCParticle part)
 
TVector3 GetPositionInTPC (detinfo::DetectorClocksData const &clockData, simb::MCParticle part, int MCHit)
 
double GetdEdX (simb::MCTrajectory traj, size_t this_step)
 

Private Attributes

TH1D * fDenominatorHist
 
TH1D * fNominatorHist
 
TH1D * fEnergyDenominatorHist
 
TH1D * fEnergyNominatorHist
 
TH1D * fLengthDenominatorHist
 
TH1D * fLengthNominatorHist
 
TH1D * fDepDenominatorHist
 
TH1D * fDepNominatorHist
 
TTree * fEventTree
 
TTree * fTrkTree
 
TTree * fTrkIDETree
 
TTree * fParticleTree
 
int fRun
 
int fEvent
 
short fNRecoTracks
 
short fReconstructable
 
short fMatched
 
float fEnGen
 
float fEkGen
 
float fT0
 
float fTrkPurityPerPlane [3]
 
float fTrkCompletnessPerPlane [3]
 
float fTrkPurity
 
float fTrkCompletness
 
int fTrkPid
 
short fTrkSize
 
short fTrkMatched
 
double fTrkLength
 
int fTrkID
 
double fTrkEnergy
 
double fTrkX [10000]
 
double fTrkY [10000]
 
double fTrkZ [10000]
 
double fT0Corr [10000]
 
int nT0s
 
std::vector< int > fTrkIDEs
 
int fTrkNIDEs
 
std::vector< double > fTrkContribs
 
double fTrueTrkE
 
double fTrueTrkLength
 
double fTrueTrkDep
 
int fTrueTrkPID
 
int fTrueTrkID
 
int fTrueTrkSize
 
int track_step
 
double fTrueTrkdEdX [10000]
 
double fTrueTrkStepE [10000]
 
double fTrueTrkX [10000]
 
double fTrueTrkY [10000]
 
double fTrueTrkZ [10000]
 
int fTrueTrkOrigin
 
bool fTrueTrkCrossCPA
 
int fTrueTrkRecoGuess
 
double fTrueTrkEnergyGuess
 
std::vector< int > fTrueTrkRecos
 
int fTrueTrkNRecos
 
std::vector< double > fTrueTrkContribs
 
double MCTruthT0
 
double TickT0
 
TH1D * fHitDx
 
TH1D * fHitDy
 
TH1D * fHitDz
 
TH1D * fHitDist3D
 
art::InputTag fSimulationLabel
 
art::InputTag fHitModuleLabel
 
art::InputTag fTrackModuleLabel
 
art::InputTag fTempTrackModuleLabel
 
size_t fMinHitsPerPlane
 
std::vector< EFilterModefFilters
 
std::vector< int > fPdg
 
size_t fEffHitMax
 
size_t fEffHitBins
 
size_t fEffEMax
 
size_t fEffEBins
 
size_t fEffDepMax
 
size_t fEffDepBins
 
size_t fEffLengthMax
 
size_t fEffLengthBins
 
bool fEnableParticleTree
 
bool fEnableIDETree
 
int fPartStatus
 
int fPartPID
 
int fPartID
 
int fOrigin
 
double fPartLength
 
double fTotLength
 
std::string fProcess
 
std::string fEndProcess
 
art::ServiceHandle< geo::Geometrygeom
 
double XDriftVelocity {}
 
double WindowSize {}
 

Additional Inherited Members

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

Detailed Description

Definition at line 62 of file RecoEff_module.cc.

Member Typedef Documentation

Definition at line 99 of file RecoEff_module.cc.

Member Enumeration Documentation

Enumerator
kCosmic 
kBeam 
kPrimary 
kSecondary 

Definition at line 65 of file RecoEff_module.cc.

Constructor & Destructor Documentation

pdune::RecoEff::RecoEff ( Parameters const &  config)
explicit

Definition at line 224 of file RecoEff_module.cc.

224  : EDAnalyzer(config),
225  fSimulationLabel(config().SimulationLabel()),
226  fHitModuleLabel(config().HitModuleLabel()),
227  fTrackModuleLabel(config().TrackModuleLabel()),
228 
229 
230  fMinHitsPerPlane(config().MinHitsPerPlane()),
231  fPdg(config().Pdg()),
232  fEffHitMax(config().EffHitMax()),
233  fEffHitBins(config().EffHitBins()),
234 
235  fEffEMax(config().EffEMax()),
236  fEffEBins(config().EffEBins()),
237 
238  fEffDepMax(config().EffDepMax()),
239  fEffDepBins(config().EffDepBins()),
240 
241  fEffLengthMax(config().EffLengthMax()),
242  fEffLengthBins(config().EffLengthBins()),
243 
244  fEnableParticleTree(config().EnableParticleTree()),
245  fEnableIDETree(config().EnableIDETree())
246 // fEnableParticleTree(config().EnableParticleTree),
247 // fEnableIDETree(config().EnableIDETree)
248 
249 {
250  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataForJob();
251  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataForJob(clockData);
252  XDriftVelocity = detProp.DriftVelocity()*1e-3; //cm/ns
253  WindowSize = detProp.NumberTimeSamples() * clockData.TPCClock().TickPeriod() * 1e3;
254 
255  auto flt = config().Filters();
256  for (const auto & s : flt)
257  {
258  if (s == "cosmic") { fFilters.push_back(pdune::RecoEff::kCosmic); }
259  else if (s == "beam") { fFilters.push_back(pdune::RecoEff::kBeam); }
260  else if (s == "primary") { fFilters.push_back(pdune::RecoEff::kPrimary); }
261  else if (s == "second") { fFilters.push_back(pdune::RecoEff::kSecondary); }
262  else { std::cout << "unsupported filter name: " << s << std::endl; }
263  }
264 }
std::vector< EFilterMode > fFilters
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
const double e
art::InputTag fSimulationLabel
static Config * config
Definition: config.cpp:1054
fhicl::Sequence< std::string > Filters
art::InputTag fHitModuleLabel
art::InputTag fTrackModuleLabel
std::vector< int > fPdg
static QCString * s
Definition: config.cpp:1042
QTextStream & endl(QTextStream &s)
pdune::RecoEff::RecoEff ( RecoEff const &  )
delete
pdune::RecoEff::RecoEff ( RecoEff &&  )
delete

Member Function Documentation

void pdune::RecoEff::analyze ( art::Event const &  evt)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 387 of file RecoEff_module.cc.

388 {
389  ResetVars();
390 
391  fRun = evt.run();
392  fEvent = evt.id().event();
393 
396 
397  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(evt);
398  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataFor(evt, clockData);
399 
401  //Particle List diagnostics
402  const sim::ParticleList& plist = pi_serv->ParticleList();
403  for ( sim::ParticleList::const_iterator ipar = plist.begin(); ipar!=plist.end(); ++ipar){
404 
405  simb::MCParticle * part = ipar->second;
406 
407  fPartPID = part->PdgCode();
408  if(fPartPID > 2212) {continue;}
409 
410  fPartStatus = part->StatusCode();
411  fPartID = part->TrackId();
412  fPartLength = GetLengthInTPC(clockData, *part);
413  fTotLength = part->Trajectory().TotalLength();
414  fProcess = part->Process();
415  fEndProcess = part->EndProcess();
416  fOrigin = pi_serv->ParticleToMCTruth_P(part)->Origin();
417 
418  fParticleTree->Fill();
419  }
420  }
421 
422  // we are going to look only for these MC truth particles, which contributed to hits
423  // and normalize efficiency to things which indeed generated activity and hits in TPC's:
424  // - need a vector of hits associated to these MC particles,
425  // - need the energy deposit corresponding to the particle part seen i these hits.
426  std::unordered_map<int, std::vector<recob::Hit> > mapTrackIDtoHits;
427  std::unordered_map<int, double> mapTrackIDtoHitsEnergyPerPlane[3];
428  std::unordered_map<int, double> mapTrackIDtoHitsEnergy;
429 
430  std::unordered_map<int, double> mapTrackIDtoLength;
431  const auto hitListHandle = evt.getValidHandle< std::vector<recob::Hit> >(fHitModuleLabel);
432  for (auto const & h : *hitListHandle)
433  {
434  std::unordered_map<int, double> particleID_E;
435 
436  for (auto const & id : bt_serv->HitToTrackIDEs(clockData,h)) // loop over std::vector< sim::TrackIDE > contributing to hit h
437  {
438 
439  // select only hadronic and muon track, skip EM activity (electron's pdg, negative track id)
440  if ((id.trackID > 0) && (abs((pi_serv->TrackIdToParticle_P(id.trackID))->PdgCode()) != 11))
441  {
442  particleID_E[id.trackID] += id.energy;
443  const simb::MCParticle * part = pi_serv->TrackIdToParticle_P(id.trackID);
444  mapTrackIDtoLength[id.trackID] = GetLengthInTPC(clockData, *part);
445  }
446  }
447 
448  int best_id = 0;
449  double max_e = 0;
450  for (auto const & contrib : particleID_E)
451  {
452  if (contrib.second > max_e) // find particle TrackID corresponding to max energy contribution
453  {
454  max_e = contrib.second;
455  best_id = contrib.first;
456  }
457  }
458 
459  if (max_e > 0)
460  {
461  mapTrackIDtoHits[best_id].push_back(h);
462  mapTrackIDtoHitsEnergyPerPlane[h.WireID().Plane][best_id] += max_e;
463  mapTrackIDtoHitsEnergy[best_id] += max_e;
464  }
465  }
466 
467  // ---------------------------------------------------------------------------------------
468 
469 
470  // now lets map particles to their associated hits, but with some filtering of things
471  // which have a minimal chance to be reconstructed: so at least some hits in two views
472  std::unordered_map<int, std::vector< recob::Hit >> mapTrackIDtoHits_filtered;
473  for (auto const & p : mapTrackIDtoHits)
474  {
475  bool skip = false;
476  auto origin = pi_serv->TrackIdToMCTruth_P(p.first)->Origin();
477  for (auto f : fFilters)
478  {
479  switch (f)
480  {
481  case pdune::RecoEff::kCosmic: if (origin != simb::kCosmicRay) { skip = true; } break;
482  case pdune::RecoEff::kBeam: if (origin != simb::kSingleParticle) { skip = true; } break;
483 
485  if (pi_serv->TrackIdToParticle_P(p.first)->Process() != "primary") { skip = true; }
486  break;
487 
489  {
490  int mId = pi_serv->TrackIdToParticle_P(p.first)->Mother();
491  const simb::MCParticle * mother = pi_serv->TrackIdToParticle_P(mId);
492  if ((mother == 0) || (mother->Process() != "primary")) { skip = true; }
493  break;
494  }
495 
496  default: break;
497  }
498  }
499  if (skip) { continue; } // skip if any condition failed
500 
501  if (!fPdg.empty())
502  {
503  skip = true;
504  for (int code : fPdg) { if (pi_serv->TrackIdToParticle_P(p.first)->PdgCode() == code) { skip = false; break; } }
505  if (skip) { continue; } // skip only if no PDG is matching
506  }
507 
508  std::unordered_map<geo::View_t, size_t> hit_count;
509  for (auto const & h : p.second) { hit_count[h.View()]++; }
510 
511  size_t nviews = 0;
512  for (auto const & n : hit_count) { if (n.second > fMinHitsPerPlane) { nviews++; } }
513  if (nviews >= 2)
514  {
515  // passed all conditions, move to filtered maps
516  mapTrackIDtoHits_filtered.emplace(p);
517  }
518  }
519  fReconstructable = mapTrackIDtoHits_filtered.size();
520 
521  std::cout << "------------ event: " << fEvent << " has reconstructable: " << fReconstructable << std::endl;
522  for (auto const &p : mapTrackIDtoHits_filtered)
523  {
524 
525  //Want to get the initial energy of the particle
526  int this_code = pi_serv->TrackIdToParticle_P(p.first)->PdgCode();
527  double this_energy = pi_serv->TrackIdToParticle_P(p.first)->E(0);
528  double this_length = mapTrackIDtoLength[p.first];
529 
530  std::cout << " : id " << p.first << " size " << p.second.size() << " en: " << mapTrackIDtoHitsEnergy[p.first] << " init en: " << this_energy << " PDG: " << this_code << " Length: " << this_length << std::endl;
531 
532  fDenominatorHist->Fill(p.second.size());
533  fEnergyDenominatorHist->Fill(this_energy);
534  fLengthDenominatorHist->Fill(this_length);
535  fDepDenominatorHist->Fill(mapTrackIDtoHitsEnergy[p.first]);
536  }
537  // ---------------------------------------------------------------------------------------
538 
539 
540  // match reconstructed tracks to MC particles
541  const auto trkHandle = evt.getValidHandle< std::vector<recob::Track> >(fTrackModuleLabel);
542  fNRecoTracks = trkHandle->size();
543 
544 
545  art::FindManyP< recob::Hit > hitsFromTracks(trkHandle, evt, fTrackModuleLabel);
546  art::FindManyP< recob::SpacePoint > spFromHits(hitListHandle, evt, fTempTrackModuleLabel);
547 // art::FindMany< anab::T0 > t0sFromTracks(trkHandle, evt, fTempTrackModuleLabel );
548 
549 
550  //Make map from G4Track (IDE) ID to track index
551  std::unordered_map<int, int> mapIDEtoRecoTrack;
552  std::unordered_map<int, double> mapIDEtoRecoEnergy;
553  std::unordered_map<int, std::vector< std::pair<int, double > > > mapIDEtoTrackContribs;
554 
555  for (size_t t = 0; t < trkHandle->size(); ++t) // loop over tracks
556  {
557  // *** here you should select if the reconstructed track is interesting, eg:
558  // - associated PFParticle has particlular PDG code
559  // - or just the recob::Track has interesting ParticleID
560 
561  std::unordered_map<int, double> trkID_E_perPlane[3]; // map filtered MC particles to their energy contributed to track t in each plane
562  std::unordered_map<int, double> trkID_E; // map filtered MC particles to their energy contributed to track t
563  double totE_anyMC_inPlane[3] = { 0, 0, 0 };
564  double totE_anyMC = 0;
565  const auto & hits = hitsFromTracks.at(t);
566  for (const auto & h : hits) // loop over hits assigned to track t
567  {
568  size_t plane = h->WireID().Plane;
569  for (auto const & ide : bt_serv->HitToTrackIDEs(clockData, h)) // loop over std::vector< sim::TrackIDE >, for a hit h
570  {
571  if (mapTrackIDtoHits_filtered.find(ide.trackID) != mapTrackIDtoHits_filtered.end())
572  {
573  trkID_E_perPlane[plane][ide.trackID] += ide.energy; // ...and sum energies contributed to this reco track
574  trkID_E[ide.trackID] += ide.energy; // by MC particles which we considered as reconstructable
575  }
576  totE_anyMC_inPlane[plane] += ide.energy;
577  totE_anyMC += ide.energy;
578  }
579  }
580 
581  // find MC particle which cotributed maximum energy to track t
582  int best_id = 0;
583  double max_e = 0;
584  std::array< double, 3 > e_inPlane = {{ 0, 0, 0 }};
585  for (auto const & entry : trkID_E)
586  {
587  mapIDEtoTrackContribs[entry.first].push_back(std::make_pair(t, entry.second));
588  fTrkIDEs.push_back(entry.first);
589  fTrkContribs.push_back(entry.second);
590  if (entry.second > max_e) // find track ID corresponding to max energy
591  {
592  max_e = entry.second;
593  best_id = entry.first;
594 
595  for (size_t i = 0; i < 3; ++i)
596  {
597  e_inPlane[i] = trkID_E_perPlane[i][entry.first];
598  }
599  }
600  }
601  //'Best guess'
602  if(max_e == 0){
603  mapIDEtoRecoTrack[best_id] = -1;
604  }
605  else{
606  mapIDEtoRecoTrack[best_id] = t;
607  }
608  mapIDEtoRecoEnergy[best_id] = max_e;
609 
610  // check if reco track is matching to MC particle:
611  if ((max_e > 0.5 * totE_anyMC) && // MC particle has more than 50% energy contribution to the track
612  (max_e > 0.5 * mapTrackIDtoHitsEnergy[best_id])) // track covers more than 50% of energy deposited by MC particle in hits
613  {
614  fNominatorHist->Fill(mapTrackIDtoHits_filtered[best_id].size());
615 
616  double this_length = mapTrackIDtoLength[best_id];
617 
618  //Get Energy of this track
619  std::cout << " id: " << best_id << " init energy: " << pi_serv->TrackIdToParticle_P(best_id)->E(0) << " Length: " << this_length << std::endl;
620  fEnergyNominatorHist->Fill(pi_serv->TrackIdToParticle_P(best_id)->E(0));
621  fLengthNominatorHist->Fill(this_length);
622  fDepNominatorHist->Fill(mapTrackIDtoHitsEnergy[best_id]);
623  fTrkMatched = 1; fMatched++;
624  }
625  else { fTrkMatched = 0; }
626 
627  fTrkPurity = max_e / totE_anyMC;
628  fTrkCompletness = max_e / mapTrackIDtoHitsEnergy[best_id];
629  for (size_t i = 0; i < 3; ++i)
630  {
631  if (totE_anyMC_inPlane[i] > 0) { fTrkPurityPerPlane[i] = e_inPlane[i] / totE_anyMC_inPlane[i]; }
632  else { fTrkPurityPerPlane[i] = 0; }
633 
634  if (mapTrackIDtoHitsEnergyPerPlane[i][best_id] > 0) { fTrkCompletnessPerPlane[i] = e_inPlane[i] / mapTrackIDtoHitsEnergyPerPlane[i][best_id]; }
635  else fTrkCompletnessPerPlane[i] = 0;
636  }
637 
638  fTrkPid = (*trkHandle)[t].ParticleId();
639  fTrkSize = hits.size();
640  fTrkLength = (*trkHandle)[t].Length();
641  fTrkID = t;
642  fTrkEnergy = totE_anyMC;
643 
644  //T0 stuff
645 // std::vector<const anab::T0*> T0s = t0sFromTracks.at(t);
646  std::vector<const anab::T0*> T0s;
647  nT0s = T0s.size();
648  std::cout << "Got " << nT0s << " T0s" <<std::endl;
649 
650  if(nT0s > 0){
651  std::cout << "T0s size: " << nT0s << std::endl;
652  MCTruthT0 = T0s[0]->Time();
653  }
654  else{
655  std::cout << "No T0s found" << std::endl;
656  MCTruthT0 = 0;
657  }
658  TickT0 = MCTruthT0 / sampling_rate(clockData);
659 
660 
661  int track_step = 0;
662  for(auto const & pos : (((*trkHandle)[t].Trajectory()).Trajectory()).Positions()){
663  if (track_step > 9999) break;
664 // fTrkX[track_step] = pos.X(); //need to correct t0
665  auto const this_wire = hits[hits.size() - (1 + track_step)]->WireID();
666  double t0Correction = detProp.ConvertTicksToX( TickT0, this_wire.Plane, this_wire.TPC, this_wire.Cryostat );
667  std::cout << "Correction: " << t0Correction << " " << sampling_rate(clockData) << std::endl;
668  fT0Corr[track_step] = t0Correction;
669  fTrkX[track_step] = (pos.X()/* - t0Correction*/);
670  fTrkY[track_step] = pos.Y();
671  fTrkZ[track_step] = pos.Z();
672  track_step++;
673  }
674 
675  fTrkNIDEs = fTrkIDEs.size();
676  fTrkTree->Fill();
677  for(int track_step = 0; track_step < 10000; ++track_step){
678  fTrkX[track_step] = 0;
679  fTrkY[track_step] = 0;
680  fTrkZ[track_step] = 0;
681  }
682 
683  fTrkIDEs.clear();
684  fTrkContribs.clear();
685 
686 
687  if (fTrkMatched == 1)
688  {
689  for (const auto & h : hits) // loop over hits assigned to matched track
690  {
691  const auto & sps = spFromHits.at(h.key());
692  if (sps.empty()) { continue; }
693  const auto & sp = *sps.front();
694 
695  std::vector< sim::IDE > ides = bt_serv->HitToAvgSimIDEs(clockData, *h);
696 
697  std::array< double, 3 > hitpos = {{0, 0, 0}};
698  double hitE = 0;
699  for (auto const & ide : ides)
700  {
701  if (ide.trackID == best_id)
702  {
703  hitpos[0] += ide.x * ide.energy;
704  hitpos[1] += ide.y * ide.energy;
705  hitpos[2] += ide.z * ide.energy;
706  hitE += ide.energy;
707  }
708  }
709  if (hitE > 0)
710  {
711  hitpos[0] /= hitE; hitpos[1] /= hitE; hitpos[2] /= hitE;
712  double dx = 0; // sp.XYZ()[0] - hitpos[0]; // --- need t0 correction
713  double dy = sp.XYZ()[1] - hitpos[1];
714  double dz = sp.XYZ()[2] - hitpos[2];
715  //fHitDx->Fill(dx); // --- need t0 correction
716  fHitDy->Fill(dy);
717  fHitDz->Fill(dz);
718  fHitDist3D->Fill(sqrt(dx*dx + dy*dy + dz*dz));
719  }
720  }
721  }
722  }
723 
724  if(fEnableIDETree){
725  std::cout << "IDE Tree"<< std::endl;
726  //Note: mapTrackIDtoHits -> filtered?
727  //Add in branch that includes the 'max_e' from above
728  //as well as 'best guess' reco track
729  //keep thinking about this
730  for (auto const & p : mapTrackIDtoHits_filtered)
731  {
732  fTrueTrkID = p.first;
733  fTrueTrkSize = p.second.size();
734  const simb::MCParticle * part = pi_serv->TrackIdToParticle_P(fTrueTrkID);
735  fTrueTrkE = part->E(0);
736  fTrueTrkLength = mapTrackIDtoLength[fTrueTrkID];
737  fTrueTrkDep = mapTrackIDtoHitsEnergy[fTrueTrkID];
738  fTrueTrkPID = part->PdgCode();
739 
741 
742  fTrueTrkRecoGuess = mapIDEtoRecoTrack[p.first];
743  fTrueTrkEnergyGuess = mapIDEtoRecoEnergy[p.first];
744 
745  std::vector<std::pair<int, double>> TrackContribs;
746  TrackContribs = mapIDEtoTrackContribs[p.first];
747  for (auto const & tc : TrackContribs){
748  fTrueTrkRecos.push_back(tc.first);
749  fTrueTrkContribs.push_back(tc.second);
750  }
751 
752  auto const traj = part->Trajectory();
753 
754  track_step = 0;
755  for(size_t step = 0; step < traj.size(); ++step){
756  //Don't know if I need this break, but just to be sure...
757  if (track_step > 9999) break;
758 
759  TVector3 pos = GetPositionInTPC(clockData, *part, step);
760 
761  if( (pos != TVector3(-1,-1,-1)) && (pos != TVector3(0,0,0))){
762  fTrueTrkX[track_step] = pos.X();
763  fTrueTrkY[track_step] = pos.Y();
764  fTrueTrkZ[track_step] = pos.Z();
765  fTrueTrkStepE[track_step] = part->E(step);
766  if(track_step > 0){
767  fTrueTrkdEdX[track_step] = GetdEdX(traj, step);
768  }
769  track_step++;
770  }
771  }
772 
773  if(fTrueTrkX[0] < 0 && fTrueTrkX[track_step - 1] > 0){
774  fTrueTrkCrossCPA = true;
775  }
776  else if(fTrueTrkX[0] > 0 && fTrueTrkX[track_step - 1] < 0){
777  fTrueTrkCrossCPA = true;
778  }
779  else{fTrueTrkCrossCPA = false;}
780 
781  fTrueTrkNRecos = fTrueTrkRecos.size();
782  fTrkIDETree->Fill();
783  for(size_t step = 0; step < 10000; ++step){
784  fTrueTrkX[step] = 0;
785  fTrueTrkY[step] = 0;
786  fTrueTrkZ[step] = 0;
787  fTrueTrkStepE[step] = 0;
788  fTrueTrkdEdX[step] = 0;
789  }
790  fTrueTrkRecos.clear();
791  fTrueTrkContribs.clear();
792  }
793  }
794 
796  {
797  std::cout << "WARNING: matched more reco tracks than selected MC particles: " << fMatched << " > " << fReconstructable << std::endl;
798  }
799 
800 
801  std::cout << "------------ reconstructed: " << fNRecoTracks << " and then matched to MC particles: " << fMatched
802  << " (reconstructable: " << fReconstructable << ")" << std::endl;
803  fEventTree->Fill();
804 }
double E(const int i=0) const
Definition: MCParticle.h:233
std::string fProcess
int PdgCode() const
Definition: MCParticle.h:212
double GetLengthInTPC(detinfo::DetectorClocksData const &clockData, simb::MCParticle part)
unsigned int event
Definition: DataStructs.h:636
QList< Entry > entry
unsigned int run
Definition: DataStructs.h:637
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
const simb::MCParticle * TrackIdToParticle_P(int id) const
int Mother() const
Definition: MCParticle.h:213
TH1D * fLengthNominatorHist
simb::Origin_t Origin() const
Definition: MCTruth.h:74
double fTrkX[10000]
double fTrkY[10000]
std::vector< int > fTrueTrkRecos
int StatusCode() const
Definition: MCParticle.h:211
intermediate_table::const_iterator const_iterator
std::vector< int > fTrkIDEs
std::vector< EFilterMode > fFilters
std::string Process() const
Definition: MCParticle.h:215
const art::Ptr< simb::MCTruth > & ParticleToMCTruth_P(const simb::MCParticle *p) const
std::vector< double > fTrueTrkContribs
TH1D * fEnergyDenominatorHist
TH1D * fDepNominatorHist
int TrackId() const
Definition: MCParticle.h:210
QCollection::Item first()
Definition: qglist.cpp:807
double fTrkZ[10000]
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
T abs(T value)
int PdgCode(Resonance_t res, int Q)
(resonance id, charge) -> PDG code
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
std::string EndProcess() const
Definition: MCParticle.h:216
const art::Ptr< simb::MCTruth > & TrackIdToMCTruth_P(int id) const
std::void_t< T > n
single particles thrown at the detector
Definition: MCTruth.h:26
float fTrkCompletnessPerPlane[3]
std::vector< double > fTrkContribs
p
Definition: test.py:223
CodeOutputInterface * code
double fTrueTrkZ[10000]
double fT0Corr[10000]
std::string fEndProcess
double fTrueTrkEnergyGuess
art::InputTag fTempTrackModuleLabel
const sim::ParticleList & ParticleList() const
TVector3 GetPositionInTPC(detinfo::DetectorClocksData const &clockData, simb::MCParticle part, int MCHit)
art::InputTag fHitModuleLabel
double TotalLength() const
double fTrueTrkX[10000]
std::vector< sim::IDE > HitToAvgSimIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
art::InputTag fTrackModuleLabel
double fTrueTrkY[10000]
float fTrkPurityPerPlane[3]
double fTrueTrkdEdX[10000]
std::vector< int > fPdg
TCEvent evt
Definition: DataStructs.cxx:7
TH1D * fDepDenominatorHist
TH1D * fLengthDenominatorHist
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:227
Cosmic rays.
Definition: MCTruth.h:24
QTextStream & endl(QTextStream &s)
double fTrueTrkStepE[10000]
double GetdEdX(simb::MCTrajectory traj, size_t this_step)
TH1D * fEnergyNominatorHist
void pdune::RecoEff::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 266 of file RecoEff_module.cc.

267 {
269 
270  fDenominatorHist = tfs->make<TH1D>("Denominator", "all reconstructable particles", fEffHitBins, 0., fEffHitMax);
271  fNominatorHist = tfs->make<TH1D>("Nominator", "reconstructed and matched tracks", fEffHitBins, 0., fEffHitMax);
272 
273  fEnergyDenominatorHist = tfs->make<TH1D>("EnergyDenominator", "all reconstructable particles", fEffEBins, 0., fEffEMax);
274  fEnergyNominatorHist = tfs->make<TH1D>("EnergyNominator", "reconstructed and matched tracks", fEffEBins, 0., fEffEMax);
275 
276  fLengthDenominatorHist = tfs->make<TH1D>("LengthDenominator", "all reconstructable particles", fEffLengthBins, 0., fEffLengthMax);
277  fLengthNominatorHist = tfs->make<TH1D>("LengthNominator", "reconstructed and matched tracks", fEffLengthBins, 0., fEffLengthMax);
278 
279  fDepDenominatorHist = tfs->make<TH1D>("DepDenominator", "all reconstructable particles", fEffDepBins, 0., fEffDepMax);
280  fDepNominatorHist = tfs->make<TH1D>("DepNominator", "reconstructed and matched tracks", fEffDepBins, 0., fEffDepMax);
281 
282  fEventTree = tfs->make<TTree>("events", "summary tree");
283  fEventTree->Branch("fRun", &fRun, "fRun/I");
284  fEventTree->Branch("fEvent", &fEvent, "fEvent/I");
285  fEventTree->Branch("fEnGen", &fEnGen, "fEnGen/F");
286  fEventTree->Branch("fEkGen", &fEkGen, "fEkGen/F");
287  fEventTree->Branch("fT0", &fT0, "fT0/F");
288  fEventTree->Branch("fNRecoTracks", &fNRecoTracks, "fNRecoTracks/S");
289  fEventTree->Branch("fReconstructable", &fReconstructable, "fReconstructable/S");
290  fEventTree->Branch("fMatched", &fMatched, "fMatched/S");
291 
292  fTrkTree = tfs->make<TTree>("tracks", "track metrics");
293  fTrkTree->Branch("fTrkPurity", &fTrkPurity, "fTrkPurity/F");
294  fTrkTree->Branch("fTrkCompletness", &fTrkCompletness, "fTrkCompletness/F");
295  fTrkTree->Branch("fTrkPurityPerPlane", &fTrkPurityPerPlane, "fTrkPurityPerPlane[3]/F");
296  fTrkTree->Branch("fTrkCompletnessPerPlane", &fTrkCompletnessPerPlane, "fTrkCompletnessPerPlane[3]/F");
297  fTrkTree->Branch("fTrkPid", &fTrkPid, "fTrkPid/I");
298  fTrkTree->Branch("fTrkID", &fTrkID, "fTrkID/I");
299  fTrkTree->Branch("fTrkSize", &fTrkSize, "fTrkSize/S");
300  fTrkTree->Branch("fTrkMatched", &fTrkMatched, "fTrkMatched/S");
301  fTrkTree->Branch("fTrkLength", &fTrkLength, "fTrkLength/D");
302  fTrkTree->Branch("fTrkIDEs", &fTrkIDEs);
303  fTrkTree->Branch("fTrkContribs", &fTrkContribs);
304  fTrkTree->Branch("fTrkNIDEs", &fTrkNIDEs);
305  fTrkTree->Branch("fEvent", &fEvent);
306  fTrkTree->Branch("fTrkEnergy", &fTrkEnergy);
307  fTrkTree->Branch("fTrkX", &fTrkX, "fTrkX[10000]/D");
308  fTrkTree->Branch("fTrkY", &fTrkY, "fTrkY[10000]/D");
309  fTrkTree->Branch("fTrkZ", &fTrkZ, "fTrkZ[10000]/D");
310  fTrkTree->Branch("fT0Corr", &fT0Corr, "fT0Corr[10000]/D");
311  fTrkTree->Branch("nT0s", &nT0s);
312 
314  fParticleTree = tfs->make<TTree>("particles","Particles");
315 
316  fParticleTree->Branch("fPID",&fPartPID);
317  fParticleTree->Branch("fStatus",&fPartStatus);
318  fParticleTree->Branch("fID",&fPartID);
319  fParticleTree->Branch("fLength",&fPartLength);
320  fParticleTree->Branch("fTotLength",&fTotLength);
321  fParticleTree->Branch("fEvent",&fEvent);
322  fParticleTree->Branch("fOrigin",&fOrigin);
323  fParticleTree->Branch("fProcess",&fProcess);
324  fParticleTree->Branch("fEndProcess",&fEndProcess);
325  }
326 
327  if(fEnableIDETree){
328  fTrkIDETree = tfs->make<TTree>("trackIDEs","trackIDE metrics");
329 
330  fTrkIDETree->Branch("fTrkE", &fTrueTrkE, "fTrkE/D");
331  fTrkIDETree->Branch("fTrkLength", &fTrueTrkLength, "fTrkLength/D");
332  fTrkIDETree->Branch("fTrkDep", &fTrueTrkDep, "fTrkDep/D");
333  fTrkIDETree->Branch("fTrkPID", &fTrueTrkPID, "fTrkPID/I");
334  fTrkIDETree->Branch("fTrkID", &fTrueTrkID, "fTrkID/I");
335  fTrkIDETree->Branch("fTrkSize", &fTrueTrkSize, "fTrkSize/I");
336  fTrkIDETree->Branch("fTrkX", &fTrueTrkX, "fTrkX[10000]/D");
337  fTrkIDETree->Branch("fTrkY", &fTrueTrkY, "fTrkY[10000]/D");
338  fTrkIDETree->Branch("fTrkZ", &fTrueTrkZ, "fTrkZ[10000]/D");
339  fTrkIDETree->Branch("fT0Corr", &fT0Corr, "fT0Corr[10000]/D");
340  fTrkIDETree->Branch("fTrkdEdX", &fTrueTrkdEdX, "fTrkdEdX[10000]/D");
341  fTrkIDETree->Branch("fTrkStepE", &fTrueTrkStepE, "fTrkStepE[10000]/D");
342  fTrkIDETree->Branch("fTrkSteps", &track_step, "fTrkSteps/D");
343  fTrkIDETree->Branch("fEvent", &fEvent, "fEvent/I");
344  fTrkIDETree->Branch("fTrkOrigin",&fTrueTrkOrigin);
345  fTrkIDETree->Branch("fTrkRecoGuess", &fTrueTrkRecoGuess);
346  fTrkIDETree->Branch("fTrkEnergyGuess",&fTrueTrkEnergyGuess);
347  fTrkIDETree->Branch("fTrkRecos", &fTrueTrkRecos);
348  fTrkIDETree->Branch("fTrkNRecos", &fTrueTrkNRecos);
349  fTrkIDETree->Branch("fTrkContribs", &fTrueTrkContribs);
350  fTrkIDETree->Branch("fTrkCrossCPA", &fTrueTrkCrossCPA);
351  }
352 
353  fHitDist3D = tfs->make<TH1D>("HitD3D", "MC-reco 3D distance", 400, 0., 10.0);
354  fHitDx = tfs->make<TH1D>("HitDx", "MC-reco X distance", 400, 0., 10.0);
355  fHitDy = tfs->make<TH1D>("HitDy", "MC-reco Y distance", 400, 0., 10.0);
356  fHitDz = tfs->make<TH1D>("HitDz", "MC-reco Z distance", 400, 0., 10.0);
357 
358  //Need to correct for name in space point branch
359  if(fTrackModuleLabel == "pandoraTrack"){
360  fTempTrackModuleLabel = "pandora";
361  }
362  else{
364  }
365 }
std::string fProcess
TH1D * fLengthNominatorHist
double fTrkX[10000]
double fTrkY[10000]
std::vector< int > fTrueTrkRecos
std::vector< int > fTrkIDEs
std::vector< double > fTrueTrkContribs
TH1D * fEnergyDenominatorHist
TH1D * fDepNominatorHist
double fTrkZ[10000]
float fTrkCompletnessPerPlane[3]
std::vector< double > fTrkContribs
double fTrueTrkZ[10000]
double fT0Corr[10000]
std::string fEndProcess
double fTrueTrkEnergyGuess
art::InputTag fTempTrackModuleLabel
double fTrueTrkX[10000]
art::InputTag fTrackModuleLabel
double fTrueTrkY[10000]
float fTrkPurityPerPlane[3]
double fTrueTrkdEdX[10000]
TH1D * fDepDenominatorHist
TH1D * fLengthDenominatorHist
double fTrueTrkStepE[10000]
TH1D * fEnergyNominatorHist
void pdune::RecoEff::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 367 of file RecoEff_module.cc.

368 {
369  for (int i = 0; i < fDenominatorHist->GetNbinsX(); ++i)
370  {
371  double nom = fNominatorHist->GetBinContent(i);
372  double den = fDenominatorHist->GetBinContent(i);
373  std::cout << "nhits: " << i << " nom:" << nom << " den:" << den << std::endl;
374  if (nom > den) { fNominatorHist->SetBinContent(i, den); }
375  }
377  TEfficiency* fEfficiency = tfs->makeAndRegister<TEfficiency>("Efficiency", "tracking efficiency", *fNominatorHist, *fDenominatorHist);
378  TEfficiency* fEnergyEfficiency = tfs->makeAndRegister<TEfficiency>("EnergyEfficiency", "tracking efficiency", *fEnergyNominatorHist, *fEnergyDenominatorHist);
379  std::cout << "Efficiency created: " << fEfficiency->GetTitle() << " " << fEnergyEfficiency->GetTitle() << std::endl;
380  TEfficiency* fLengthEfficiency = tfs->makeAndRegister<TEfficiency>("LengthEfficiency", "tracking efficiency", *fLengthNominatorHist, *fLengthDenominatorHist);
381  std::cout << "Efficiency created: " << fEfficiency->GetTitle() << " " << fLengthEfficiency->GetTitle() << std::endl;
382  TEfficiency* fDepEfficiency = tfs->makeAndRegister<TEfficiency>("DepEfficiency", "tracking efficiency", *fDepNominatorHist, *fDepDenominatorHist);
383  std::cout << "Efficiency created: " << fEfficiency->GetTitle() << " " << fDepEfficiency->GetTitle() << std::endl;
384 
385 }
TH1D * fLengthNominatorHist
TH1D * fEnergyDenominatorHist
TH1D * fDepNominatorHist
TH1D * fDepDenominatorHist
TH1D * fLengthDenominatorHist
QTextStream & endl(QTextStream &s)
TH1D * fEnergyNominatorHist
double pdune::RecoEff::GetdEdX ( simb::MCTrajectory  traj,
size_t  this_step 
)
private

Definition at line 928 of file RecoEff_module.cc.

928  {
929  size_t prev_step = this_step - 1;
930  size_t next_step = this_step + 1;
931 
932  double dE_prev = fabs( traj.E(this_step) - traj.E(prev_step) );
933  double dE_next = fabs( traj.E(this_step) - traj.E(next_step) );
934 
935  double dX_prev = sqrt( pow( (traj.X(this_step) - traj.X(prev_step)), 2 )
936  + pow( (traj.X(this_step) - traj.X(prev_step)), 2 )
937  + pow( (traj.X(this_step) - traj.X(prev_step)), 2 ));
938 
939  double dX_next = sqrt( pow( (traj.X(this_step) - traj.X(next_step)), 2 )
940  + pow( (traj.X(this_step) - traj.X(next_step)), 2 )
941  + pow( (traj.X(this_step) - traj.X(next_step)), 2 ));
942  return (dE_prev + dE_next)/(dX_prev + dX_next);
943 }
double X(const size_type i) const
Definition: MCTrajectory.h:149
double E(const size_type i) const
Definition: MCTrajectory.h:156
constexpr T pow(T x)
Definition: pow.h:72
double pdune::RecoEff::GetLengthInTPC ( detinfo::DetectorClocksData const &  clockData,
simb::MCParticle  part 
)
private

Definition at line 861 of file RecoEff_module.cc.

862  {
863 
864  unsigned int nTrajectoryPoints = part.NumberTrajectoryPoints();
865  std::vector<double> TPCLengthHits(nTrajectoryPoints,0);
866 
867  bool BeenInVolume = false;
868  int FirstHit = 0, LastHit = 0;
869  double TPCLength = 0;
870 
871  for(unsigned int MCHit=0; MCHit < nTrajectoryPoints; ++MCHit) {
872  const TLorentzVector& tmpPosition = part.Position(MCHit);
873  double const tmpPosArray[] = {tmpPosition[0], tmpPosition[1], tmpPosition[2]};
874 
875  if (MCHit!=0) TPCLengthHits[MCHit] = pow ( pow( (part.Vx(MCHit-1)-part.Vx(MCHit)),2)
876  + pow( (part.Vy(MCHit-1)-part.Vy(MCHit)),2)
877  + pow( (part.Vz(MCHit-1)-part.Vz(MCHit)),2)
878  , 0.5 );
879  // check if in TPC
880  geo::TPCID tpcid = geom->FindTPCAtPosition(tmpPosArray);
881  if(tpcid.isValid){
882  geo::CryostatGeo const & cryo = geom->Cryostat(tpcid.Cryostat);
883  geo::TPCGeo const & tpc = cryo.TPC(tpcid.TPC);
884  double XPlanePosition = tpc.PlaneLocation(0)[0];
885  double DriftTimeCorrection = fabs( tmpPosition[0] - XPlanePosition )/ XDriftVelocity;
886  double TimeAtPlane = part.T() + DriftTimeCorrection;
887  if( TimeAtPlane < trigger_offset(clockData) || TimeAtPlane > trigger_offset(clockData) + WindowSize){
888  continue;}
889  //Good hit in TPC
890  LastHit = MCHit;
891  if( !BeenInVolume ){
892  BeenInVolume = true;
893  FirstHit = MCHit;
894  }
895  }
896  }
897  for (int Hit = FirstHit+1; Hit <= LastHit; ++Hit ) {
898  TPCLength += TPCLengthHits[Hit];
899  }
900  return TPCLength;
901 }
unsigned int NumberTrajectoryPoints() const
Definition: MCParticle.h:218
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:219
art::ServiceHandle< geo::Geometry > geom
constexpr T pow(T x)
Definition: pow.h:72
Geometry information for a single TPC.
Definition: TPCGeo.h:38
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
double T(const int i=0) const
Definition: MCParticle.h:224
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
double Vx(const int i=0) const
Definition: MCParticle.h:221
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:93
double Vz(const int i=0) const
Definition: MCParticle.h:223
int trigger_offset(DetectorClocksData const &data)
const double * PlaneLocation(unsigned int p) const
Definition: TPCGeo.cxx:382
double Vy(const int i=0) const
Definition: MCParticle.h:222
TVector3 pdune::RecoEff::GetPositionInTPC ( detinfo::DetectorClocksData const &  clockData,
simb::MCParticle  part,
int  MCHit 
)
private

Definition at line 903 of file RecoEff_module.cc.

904  {
905 
906  const TLorentzVector& tmpPosition = part.Position(MCHit);
907  double const tmpPosArray[] = {tmpPosition[0], tmpPosition[1], tmpPosition[2]};
908 
909  // check if in TPC
910  geo::TPCID tpcid = geom->FindTPCAtPosition(tmpPosArray);
911  if(tpcid.isValid){
912  geo::CryostatGeo const & cryo = geom->Cryostat(tpcid.Cryostat);
913  geo::TPCGeo const & tpc = cryo.TPC(tpcid.TPC);
914  double XPlanePosition = tpc.PlaneLocation(0)[0];
915  double DriftTimeCorrection = fabs( tmpPosition[0] - XPlanePosition )/ XDriftVelocity;
916  double TimeAtPlane = part.T() + DriftTimeCorrection;
917  if( TimeAtPlane < trigger_offset(clockData) || TimeAtPlane > trigger_offset(clockData) + WindowSize){
918  return TVector3(-1,-1,-1);}
919  }
920  else{
921  return TVector3(-1,-1,-1);
922  }
923 
924  TVector3 posInTPC(tmpPosArray);
925  return posInTPC;
926 }
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:219
art::ServiceHandle< geo::Geometry > geom
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:211
Geometry information for a single TPC.
Definition: TPCGeo.h:38
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
double T(const int i=0) const
Definition: MCParticle.h:224
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:93
int trigger_offset(DetectorClocksData const &data)
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:406
const double * PlaneLocation(unsigned int p) const
Definition: TPCGeo.cxx:382
RecoEff& pdune::RecoEff::operator= ( RecoEff const &  )
delete
RecoEff& pdune::RecoEff::operator= ( RecoEff &&  )
delete
void pdune::RecoEff::ResetVars ( void  )
private

Definition at line 806 of file RecoEff_module.cc.

807 {
808  fRun = 0; fEvent = 0;
809 
810  fEnGen = 0; fEkGen = 0;
811  fT0 = 0;
812 
813  for (size_t i = 0; i < 3; ++i)
814  {
815  fTrkPurityPerPlane[i] = 0;
817  }
818 
819  fTrkPurity = 0; fTrkCompletness = 0;
820  fTrkPid = 0; fTrkSize = 0; fTrkMatched = 0;
821  fTrkLength = 0;
822  fMatched = 0;
823  fNRecoTracks = 0;
824  fReconstructable = 0;
825  fTrkID = 0;
826  fTrkIDEs.clear();
827  fTrkContribs.clear();
828 
829  if(fEnableIDETree){
830  fTrueTrkE = 0;
831  fTrueTrkID = 0;
832  fTrueTrkLength = 0;
833  fTrueTrkDep = 0;
834  fTrueTrkPID = 0;
835  fTrueTrkOrigin = -1;
836  for(size_t i = 0; i < 10000; ++i){
837  fTrueTrkX[i] = 0;
838  fTrueTrkY[i] = 0;
839  fTrueTrkZ[i] = 0;
840  }
841 
842  fTrueTrkRecoGuess = 0;
844  fTrueTrkRecos.clear();
845  fTrueTrkContribs.clear();
846  }
847 
848 
850  fPartStatus = 0;
851  fPartPID = 0;
852  fPartID = 0;
853  fPartLength = 0;
854  fTotLength = 0;
855  fOrigin = -1;
856  fProcess = "";
857  fEndProcess = "";
858  }
859 }
std::string fProcess
std::vector< int > fTrueTrkRecos
std::vector< int > fTrkIDEs
std::vector< double > fTrueTrkContribs
float fTrkCompletnessPerPlane[3]
std::vector< double > fTrkContribs
double fTrueTrkZ[10000]
std::string fEndProcess
double fTrueTrkEnergyGuess
double fTrueTrkX[10000]
double fTrueTrkY[10000]
float fTrkPurityPerPlane[3]

Member Data Documentation

TH1D* pdune::RecoEff::fDenominatorHist
private

Definition at line 120 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fDepDenominatorHist
private

Definition at line 129 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fDepNominatorHist
private

Definition at line 130 of file RecoEff_module.cc.

size_t pdune::RecoEff::fEffDepBins
private

Definition at line 205 of file RecoEff_module.cc.

size_t pdune::RecoEff::fEffDepMax
private

Definition at line 205 of file RecoEff_module.cc.

size_t pdune::RecoEff::fEffEBins
private

Definition at line 204 of file RecoEff_module.cc.

size_t pdune::RecoEff::fEffEMax
private

Definition at line 204 of file RecoEff_module.cc.

size_t pdune::RecoEff::fEffHitBins
private

Definition at line 203 of file RecoEff_module.cc.

size_t pdune::RecoEff::fEffHitMax
private

Definition at line 203 of file RecoEff_module.cc.

size_t pdune::RecoEff::fEffLengthBins
private

Definition at line 206 of file RecoEff_module.cc.

size_t pdune::RecoEff::fEffLengthMax
private

Definition at line 206 of file RecoEff_module.cc.

float pdune::RecoEff::fEkGen
private

Definition at line 144 of file RecoEff_module.cc.

bool pdune::RecoEff::fEnableIDETree
private

Definition at line 207 of file RecoEff_module.cc.

bool pdune::RecoEff::fEnableParticleTree
private

Definition at line 207 of file RecoEff_module.cc.

std::string pdune::RecoEff::fEndProcess
private

Definition at line 217 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fEnergyDenominatorHist
private

Definition at line 123 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fEnergyNominatorHist
private

Definition at line 124 of file RecoEff_module.cc.

float pdune::RecoEff::fEnGen
private

Definition at line 144 of file RecoEff_module.cc.

int pdune::RecoEff::fEvent
private

Definition at line 139 of file RecoEff_module.cc.

TTree* pdune::RecoEff::fEventTree
private

Definition at line 132 of file RecoEff_module.cc.

std::vector< EFilterMode > pdune::RecoEff::fFilters
private

Definition at line 200 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fHitDist3D
private

Definition at line 191 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fHitDx
private

Definition at line 188 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fHitDy
private

Definition at line 189 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fHitDz
private

Definition at line 190 of file RecoEff_module.cc.

art::InputTag pdune::RecoEff::fHitModuleLabel
private

Definition at line 194 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fLengthDenominatorHist
private

Definition at line 126 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fLengthNominatorHist
private

Definition at line 127 of file RecoEff_module.cc.

short pdune::RecoEff::fMatched
private

Definition at line 142 of file RecoEff_module.cc.

size_t pdune::RecoEff::fMinHitsPerPlane
private

Definition at line 198 of file RecoEff_module.cc.

TH1D* pdune::RecoEff::fNominatorHist
private

Definition at line 121 of file RecoEff_module.cc.

short pdune::RecoEff::fNRecoTracks
private

Definition at line 140 of file RecoEff_module.cc.

int pdune::RecoEff::fOrigin
private

Definition at line 213 of file RecoEff_module.cc.

TTree* pdune::RecoEff::fParticleTree
private

Definition at line 137 of file RecoEff_module.cc.

int pdune::RecoEff::fPartID
private

Definition at line 212 of file RecoEff_module.cc.

double pdune::RecoEff::fPartLength
private

Definition at line 214 of file RecoEff_module.cc.

int pdune::RecoEff::fPartPID
private

Definition at line 211 of file RecoEff_module.cc.

int pdune::RecoEff::fPartStatus
private

Definition at line 210 of file RecoEff_module.cc.

std::vector< int > pdune::RecoEff::fPdg
private

Definition at line 201 of file RecoEff_module.cc.

std::string pdune::RecoEff::fProcess
private

Definition at line 216 of file RecoEff_module.cc.

short pdune::RecoEff::fReconstructable
private

Definition at line 141 of file RecoEff_module.cc.

int pdune::RecoEff::fRun
private

Definition at line 139 of file RecoEff_module.cc.

art::InputTag pdune::RecoEff::fSimulationLabel
private

Definition at line 193 of file RecoEff_module.cc.

float pdune::RecoEff::fT0
private

Definition at line 145 of file RecoEff_module.cc.

double pdune::RecoEff::fT0Corr[10000]
private

Definition at line 158 of file RecoEff_module.cc.

art::InputTag pdune::RecoEff::fTempTrackModuleLabel
private

Definition at line 196 of file RecoEff_module.cc.

double pdune::RecoEff::fTotLength
private

Definition at line 215 of file RecoEff_module.cc.

art::InputTag pdune::RecoEff::fTrackModuleLabel
private

Definition at line 195 of file RecoEff_module.cc.

float pdune::RecoEff::fTrkCompletness
private

Definition at line 148 of file RecoEff_module.cc.

float pdune::RecoEff::fTrkCompletnessPerPlane[3]
private

Definition at line 147 of file RecoEff_module.cc.

std::vector<double> pdune::RecoEff::fTrkContribs
private

Definition at line 163 of file RecoEff_module.cc.

double pdune::RecoEff::fTrkEnergy
private

Definition at line 154 of file RecoEff_module.cc.

int pdune::RecoEff::fTrkID
private

Definition at line 153 of file RecoEff_module.cc.

std::vector<int> pdune::RecoEff::fTrkIDEs
private

Definition at line 161 of file RecoEff_module.cc.

TTree* pdune::RecoEff::fTrkIDETree
private

Definition at line 136 of file RecoEff_module.cc.

double pdune::RecoEff::fTrkLength
private

Definition at line 152 of file RecoEff_module.cc.

short pdune::RecoEff::fTrkMatched
private

Definition at line 151 of file RecoEff_module.cc.

int pdune::RecoEff::fTrkNIDEs
private

Definition at line 162 of file RecoEff_module.cc.

int pdune::RecoEff::fTrkPid
private

Definition at line 149 of file RecoEff_module.cc.

float pdune::RecoEff::fTrkPurity
private

Definition at line 148 of file RecoEff_module.cc.

float pdune::RecoEff::fTrkPurityPerPlane[3]
private

Definition at line 147 of file RecoEff_module.cc.

short pdune::RecoEff::fTrkSize
private

Definition at line 150 of file RecoEff_module.cc.

TTree* pdune::RecoEff::fTrkTree
private

Definition at line 133 of file RecoEff_module.cc.

double pdune::RecoEff::fTrkX[10000]
private

Definition at line 155 of file RecoEff_module.cc.

double pdune::RecoEff::fTrkY[10000]
private

Definition at line 156 of file RecoEff_module.cc.

double pdune::RecoEff::fTrkZ[10000]
private

Definition at line 157 of file RecoEff_module.cc.

std::vector<double> pdune::RecoEff::fTrueTrkContribs
private

Definition at line 185 of file RecoEff_module.cc.

bool pdune::RecoEff::fTrueTrkCrossCPA
private

Definition at line 178 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkdEdX[10000]
private

Definition at line 172 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkDep
private

Definition at line 167 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkE
private

Definition at line 165 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkEnergyGuess
private

Definition at line 182 of file RecoEff_module.cc.

int pdune::RecoEff::fTrueTrkID
private

Definition at line 169 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkLength
private

Definition at line 166 of file RecoEff_module.cc.

int pdune::RecoEff::fTrueTrkNRecos
private

Definition at line 184 of file RecoEff_module.cc.

int pdune::RecoEff::fTrueTrkOrigin
private

Definition at line 177 of file RecoEff_module.cc.

int pdune::RecoEff::fTrueTrkPID
private

Definition at line 168 of file RecoEff_module.cc.

int pdune::RecoEff::fTrueTrkRecoGuess
private

Definition at line 181 of file RecoEff_module.cc.

std::vector<int> pdune::RecoEff::fTrueTrkRecos
private

Definition at line 183 of file RecoEff_module.cc.

int pdune::RecoEff::fTrueTrkSize
private

Definition at line 170 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkStepE[10000]
private

Definition at line 173 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkX[10000]
private

Definition at line 174 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkY[10000]
private

Definition at line 175 of file RecoEff_module.cc.

double pdune::RecoEff::fTrueTrkZ[10000]
private

Definition at line 176 of file RecoEff_module.cc.

art::ServiceHandle<geo::Geometry> pdune::RecoEff::geom
private

Definition at line 219 of file RecoEff_module.cc.

double pdune::RecoEff::MCTruthT0
private

Definition at line 187 of file RecoEff_module.cc.

int pdune::RecoEff::nT0s
private

Definition at line 159 of file RecoEff_module.cc.

double pdune::RecoEff::TickT0
private

Definition at line 187 of file RecoEff_module.cc.

int pdune::RecoEff::track_step
private

Definition at line 171 of file RecoEff_module.cc.

double pdune::RecoEff::WindowSize {}
private

Definition at line 221 of file RecoEff_module.cc.

double pdune::RecoEff::XDriftVelocity {}
private

Definition at line 220 of file RecoEff_module.cc.


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