All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbndcode/sbndcode/gallery/galleryAnalysis/MCAssociations.h
Go to the documentation of this file.
1 /**
2  * @file MCAssociations.h
3  * @brief This algorithm attempts to decode Track and Hit <--> MCParticle assocations
4  * @author Tracy Usher (usher@slac.stanford.edu)
5  * @date October 25, 2017
6  * @see galleryAnalysis.cpp
7  *
8  */
9 
10 #ifndef MCAssociations_H
11 #define MCAssociations_H
12 
13 // LArSoft libraries
14 #include "gallery/Event.h"
17 #include "nusimdata/SimulationBase/MCParticle.h"
19 
20 // canvas libraries
21 #include "fhiclcpp/ParameterSet.h"
22 
23 // ROOT libraries
24 #include "TDirectory.h"
25 #include "TH1.h"
26 #include "TH2.h"
27 #include "TProfile.h"
28 
29 // C/C++ standard libraries
30 #include <vector>
31 #include <memory> // std::unique_ptr<>
32 
33 
34 /**
35  * @brief Track analysis example.
36  *
37  * Configuration
38  * --------------
39  *
40  * * *MinLength* (real, default: 0): minimum track length, in centimetres
41  *
42  */
43 class MCAssociations
44 {
45 public:
46 
47  MCAssociations(fhicl::ParameterSet const& config);
48 
49  void setup(const geo::GeometryCore&,
51  TDirectory*);
52 
53  void prepare();
54 
55  void doTrackHitMCAssociations(gallery::Event&);
56 
57  void finish();
58 
59 private:
60  double length(const recob::Track*) const;
61  double length(const simb::MCParticle& part, double dx,
62  TVector3& start, TVector3& end, TVector3& startmom, TVector3& endmom,
63  unsigned int tpc = 0, unsigned int cstat = 0) const;
64 
65  art::InputTag fHitProducerLabel;
66  art::InputTag fMCTruthProducerLabel;
67  art::InputTag fAssnsProducerLabel;
68  art::InputTag fTrackProducerLabel;
69  std::string fLocalDirName;
70 
71  geo::GeometryCore const* fGeometry = nullptr;
72  /// Detector properties data pointer cannot point to a temporary object!
74  TDirectory* fDir = nullptr;
75 
76  std::unique_ptr<TH1> fNTracks;
77  std::unique_ptr<TH1> fNHitsPerTrack;
78  std::unique_ptr<TH1> fTrackLength;
79  std::unique_ptr<TH2> fTrackLenVsHits;
80 
81  std::unique_ptr<TH1> fNHitsPerPrimary;
82  std::unique_ptr<TH1> fPrimaryLength;
83  std::unique_ptr<TH2> fPrimaryLenVsHits;
84 
85  std::unique_ptr<TH1> fNHitsPerReco;
86  std::unique_ptr<TH1> fDeltaNHits;
87  std::unique_ptr<TH1> fPrimaryRecoLength;
88  std::unique_ptr<TH1> fDeltaTrackLen;
89 
90  std::unique_ptr<TH1> fPrimaryEfficiency;
91  std::unique_ptr<TH1> fPrimaryCompleteness;
92  std::unique_ptr<TH1> fPrimaryPurity;
93 
94  std::unique_ptr<TProfile> fPrimaryEffVsMom;
95  std::unique_ptr<TProfile> fPrimaryCompVsMom;
96  std::unique_ptr<TProfile> fPrimaryPurityVsMom;
97 
98  std::unique_ptr<TProfile> fPrimaryEffVsLen;
99  std::unique_ptr<TProfile> fPrimaryCompVsLen;
100  std::unique_ptr<TProfile> fPrimaryPurityVsLen;
101 
102  std::unique_ptr<TProfile> fPrimaryEffVsHits;
103  std::unique_ptr<TProfile> fPrimaryCompVsHits;
104  std::unique_ptr<TProfile> fPrimaryPurityVsHits;
105  std::unique_ptr<TProfile> fPrimaryEffVsLogHits;
106  std::unique_ptr<TProfile> fPrimaryCompVsLogHits;
107  std::unique_ptr<TProfile> fPrimaryPurityVsLogHits;
108 }; // class MCAssociations
109 
110 #endif // MCAssociations_H
Access the description of detector geometry.
std::unique_ptr< detinfo::DetectorPropertiesData const > fDetectorProperties
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
Description of geometry of one entire detector.
Provides recob::Track data product.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track:
void setup(const geo::GeometryCore &, const detinfo::DetectorPropertiesData &, TDirectory *)