All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
icaruscode/icaruscode/CRT/CRTUtils/RecoUtils.h
Go to the documentation of this file.
1 #ifndef FDSELECTIONUTILS_H_SEEN
2 #define FDSELECTIONUTILS_H_SEEN
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 "art/Framework/Services/Registry/ServiceHandle.h"
19 #include "art_root_io/TFileService.h"
20 #include "art_root_io/TFileDirectory.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
22 #include "canvas/Persistency/Common/FindManyP.h"
23 
24 // LArSoft
25 #include "nusimdata/SimulationBase/MCParticle.h"
26 #include "nusimdata/SimulationBase/MCTruth.h"
29 //#include "lardataobj/RecoBase/Track.h"
30 //#include "lardataobj/RecoBase/Shower.h"
31 //#include "lardataobj/AnalysisBase/MVAPIDResult.h"
32 //#include "lardataobj/AnalysisBase/ParticleID.h"
35 namespace detinfo { class DetectorClocksData; }
36 
37 
38 // c++
39 #include <vector>
40 #include <map>
41 
42 // ROOT
43 #include "TTree.h"
44 
45 
46 namespace RecoUtils{
47 
48  // Returns the geant4 ID which contributes the most to a single reco hit.
49  // The matching method looks for true particle which deposits the most true energy in the reco hit.
50  // If rollup_unsaved_ids is set to true, any unsaved daughter than
51  // contributed energy to the hit has its energy included in its closest ancestor that was saved.
52 
53  int TrueParticleID(detinfo::DetectorClocksData const& clockData, const art::Ptr<recob::Hit> hit, bool rollup_unsaved_ids=1);
54 
55  // Returns the geant4 ID which contributes the most to the vector of hits.
56  // The matching method looks for which true particle deposits the most true energy in the reco hits
57 
58  int TrueParticleIDFromTotalTrueEnergy(detinfo::DetectorClocksData const& clockData, const std::vector<art::Ptr<recob::Hit> >& hits, bool rollup_unsaved_ids=1);
59 
60  // Returns the geant4 ID which contributes the most to the vector of hits.
61  // The matching method looks for which true particle contributes the most reconstructed charge to the hit selection
62  // (the reco charge of each hit is correlated with each maximally contributing true particle and summed)
63 
64  int TrueParticleIDFromTotalRecoCharge(detinfo::DetectorClocksData const& clockData, const std::vector<art::Ptr<recob::Hit> >& hits, bool rollup_unsaved_ids=1);
65 
66  // Returns the geant4 ID which contributes the most to the vector of hits.
67  // The matching method looks for which true particle maximally contributes to the most reco hits
68 
69  int TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const& clockData, const std::vector<art::Ptr<recob::Hit> >& hits, bool rollup_unsaved_ids=1);
70 
71  // Checks if a position is within any of the TPCs in the geometry (user can define some distance buffer from the TPC walls)
72 
73  bool IsInsideTPC(TVector3 position, double distance_buffer);
74 
75  // Calculates the total length of a recob::track by summing up the distances between adjacent traj. points
76 
77  double CalculateTrackLength(const art::Ptr<recob::Track> track);
78 
79 }
80 
81 #endif
int TrueParticleIDFromTotalTrueEnergy(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
double CalculateTrackLength(const art::Ptr< recob::Track > track)
Declaration of signal hit object.
process_name use argoneut_mc_hitfinder track
process_name hit
Definition: cheaterreco.fcl:51
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
int TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
Provides recob::Track data product.
Contains all timing reference information for the detector.
int TrueParticleIDFromTotalRecoCharge(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
art framework interface to geometry description
int TrueParticleID(detinfo::DetectorClocksData const &clockData, const art::Ptr< recob::Hit > hit, bool rollup_unsaved_ids=1)
bool IsInsideTPC(TVector3 position, double distance_buffer)