All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbnana/sbnanalysis/ana/SBNOscReco/RecoUtils/RecoUtils.h
Go to the documentation of this file.
1 #ifndef SBNRECOSELECTIONUTILS_H
2 #define SBNRECOSELECTIONUTILS_H
3 
4 
5 ///////////////////////////////////////////////
6 // RecoUtils.h
7 //
8 // A few reco utilities like truth matching
9 // D Brailsford (adapted from work by D Brailsford and M Wallbank), October 2017
10 ///////////////////////////////////////////////
11 
12 // framework
13 #include "art/Framework/Principal/Event.h"
14 #include "fhiclcpp/ParameterSet.h"
15 #include "art/Framework/Principal/Handle.h"
16 #include "canvas/Persistency/Common/Ptr.h"
17 #include "canvas/Persistency/Common/PtrVector.h"
18 #include "canvas/Persistency/Common/FindManyP.h"
19 
20 // LArSoft
21 #include "nusimdata/SimulationBase/MCParticle.h"
22 #include "nusimdata/SimulationBase/MCTruth.h"
25 //#include "lardataobj/RecoBase/Track.h"
26 //#include "lardataobj/RecoBase/Shower.h"
27 //#include "lardataobj/AnalysisBase/MVAPIDResult.h"
28 //#include "lardataobj/AnalysisBase/ParticleID.h"
31 
32 // hacky sbncode stuff
33 #include "core/ProviderManager.hh"
34 
35 // c++
36 #include <vector>
37 #include <map>
38 
39 // ROOT
40 #include "TTree.h"
41 
42 namespace SBNRecoUtils{
43  int TrueParticleID(const core::ProviderManager &manager, const art::Ptr<recob::Hit> hit, bool rollup_unsaved_ids=1); //Returns the geant4 ID which contributes the most to a single reco hit. The matching method looks for true particle which deposits the most true energy in the reco hit. If rollup_unsaved_ids is set to true, any unsaved daughter than contributed energy to the hit has its energy included in its closest ancestor that was saved.
44  int TrueParticleIDFromTotalTrueEnergy(const core::ProviderManager &manager, const std::vector<art::Ptr<recob::Hit> >& hits, bool rollup_unsaved_ids=1); //Returns the geant4 ID which contributes the most to the vector of hits. The matching method looks for which true particle deposits the most true energy in the reco hits
45  int TrueParticleIDFromTotalRecoCharge(const core::ProviderManager &manager, const std::vector<art::Ptr<recob::Hit> >& hits, bool rollup_unsaved_ids=1); //Returns the geant4 ID which contributes the most to the vector of hits. The matching method looks for which true particle contributes the most reconstructed charge to the hit selection (the reco charge of each hit is correlated with each maximally contributing true particle and summed)
46  int TrueParticleIDFromTotalRecoHits(const core::ProviderManager &manager, const std::vector<art::Ptr<recob::Hit> >& hits, bool rollup_unsaved_ids=1); //Returns the geant4 ID which contributes the most to the vector of hits. The matching method looks for which true particle maximally contributes to the most reco hits
47  bool IsInsideTPC(const core::ProviderManager &manager, TVector3 position, double distance_buffer); //Checks if a position is within any of the TPCs in the geometry (user can define some distance buffer from the TPC walls)
48  double CalculateTrackLength(const core::ProviderManager &manager, const art::Ptr<recob::Track> track); //Calculates the total length of a recob::track by summing up the distances between adjacent traj. points
49  double TrackCompletion(const core::ProviderManager &manager, int mcparticle_id, const std::vector<art::Ptr<recob::Hit>> &reco_track_hits);
50 }
51 #endif
Declaration of signal hit object.
process_name use argoneut_mc_hitfinder track
process_name hit
Definition: cheaterreco.fcl:51
double CalculateTrackLength(const core::ProviderManager &manager, const art::Ptr< recob::Track > track)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
Interface to LArSoft services.
double TrackCompletion(const core::ProviderManager &manager, int mcparticle_id, const std::vector< art::Ptr< recob::Hit >> &reco_track_hits)
int TrueParticleIDFromTotalTrueEnergy(const core::ProviderManager &manager, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
bool IsInsideTPC(const core::ProviderManager &manager, TVector3 position, double distance_buffer)
int TrueParticleID(const core::ProviderManager &manager, const art::Ptr< recob::Hit > hit, bool rollup_unsaved_ids=1)
Provides recob::Track data product.
int TrueParticleIDFromTotalRecoHits(const core::ProviderManager &manager, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
art framework interface to geometry description
int TrueParticleIDFromTotalRecoCharge(const core::ProviderManager &manager, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)