All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
TrackAnalysis Class Reference

Track analysis example. More...

#include <TrackAnalysis.h>

Public Member Functions

 TrackAnalysis (fhicl::ParameterSet const &config)
 
void setup (geo::GeometryCore const &geom, TDirectory *outDir)
 
void prepare ()
 
void processTracks (std::vector< recob::Track > const &tracks)
 
void finish ()
 
 TrackAnalysis (fhicl::ParameterSet const &config)
 
void setup (geo::GeometryCore const &geom, TDirectory *outDir)
 
void prepare ()
 
void processTracks (std::vector< recob::Track > const &tracks)
 
void finish ()
 

Private Attributes

geo::GeometryCore const * fGeom = nullptr
 
TDirectory * fDir = nullptr
 
double fMinLength = 0.0
 Minimum length, in centimetres. More...
 
std::unique_ptr< TH1 > fHNTracks
 

Detailed Description

Track analysis example.

Configuration

Definition at line 38 of file icarusalg/icarusalg/gallery/galleryAnalysis/C++/TrackAnalysis.h.

Constructor & Destructor Documentation

TrackAnalysis::TrackAnalysis ( fhicl::ParameterSet const &  config)

Definition at line 22 of file icarusalg/icarusalg/gallery/galleryAnalysis/C++/TrackAnalysis.cpp.

23  : fMinLength(config.get<double>("MinLength", 0.0))
24  {}
double fMinLength
Minimum length, in centimetres.
TrackAnalysis::TrackAnalysis ( fhicl::ParameterSet const &  config)

Member Function Documentation

void TrackAnalysis::finish ( )

Definition at line 48 of file icarusalg/icarusalg/gallery/galleryAnalysis/C++/TrackAnalysis.cpp.

48  {
49  if (fHNTracks) {
50  fDir->cd();
51  fHNTracks->Write();
52  }
53 } // TrackAnalysis::finish()
void TrackAnalysis::finish ( )
void TrackAnalysis::prepare ( )

Definition at line 26 of file icarusalg/icarusalg/gallery/galleryAnalysis/C++/TrackAnalysis.cpp.

26  {
27  if (fDir) {
28  fHNTracks = std::make_unique<TH1F>
29  ("HNTracks", "Number of tracks;number of tracks;events", 50, 0., 50.);
30  fHNTracks->SetDirectory(fDir);
31  }
32  else fHNTracks.reset();
33 } // TrackAnalysis::prepare()
void TrackAnalysis::prepare ( )
void TrackAnalysis::processTracks ( std::vector< recob::Track > const &  tracks)
void TrackAnalysis::processTracks ( std::vector< recob::Track > const &  tracks)

Definition at line 36 of file icarusalg/icarusalg/gallery/galleryAnalysis/C++/TrackAnalysis.cpp.

36  {
37 
38  unsigned int nTracksAboveThreshold = std::count_if(
39  tracks.begin(), tracks.end(),
40  [this](auto const& track){ return track.Length() > fMinLength; }
41  );
42 
43  if (fHNTracks) fHNTracks->Fill(nTracksAboveThreshold);
44 
45 } // TrackAnalysis::processTracks()
process_name use argoneut_mc_hitfinder track
double fMinLength
Minimum length, in centimetres.
void TrackAnalysis::setup ( geo::GeometryCore const &  geom,
TDirectory *  outDir 
)
inline
void TrackAnalysis::setup ( geo::GeometryCore const &  geom,
TDirectory *  outDir 
)
inline

Member Data Documentation

TDirectory * TrackAnalysis::fDir = nullptr
private
geo::GeometryCore const * TrackAnalysis::fGeom = nullptr
private
std::unique_ptr< TH1 > TrackAnalysis::fHNTracks
private
double TrackAnalysis::fMinLength = 0.0
private

Minimum length, in centimetres.

Definition at line 42 of file icarusalg/icarusalg/gallery/galleryAnalysis/C++/TrackAnalysis.h.


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