CTPHelper.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file CTPHelper.h
3 /// \brief Functions to help use the convolutional track PID
4 /// \author Leigh Whitehead - leigh.howard.whitehead@cern.ch
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef CTPHELPER_H
8 #define CTPHELPER_H
9 
10 #include <vector>
11 #include <string>
12 #include <map>
13 
14 #include "TVector3.h"
15 
17 #include "canvas/Persistency/Common/FindManyP.h"
23 
25 
26 namespace ctp
27 {
28 
29  /// Class containing some utility functions for all things CVN
30  class CTPHelper
31  {
32  public:
33  CTPHelper(const fhicl::ParameterSet& pset);
34  ~CTPHelper();
35 
36  // Function to calculate the PID for a given track
38 
39  // Calculate the features for the track PID
40  const std::vector<std::vector<float>> GetNetworkInputs(const art::Ptr<recob::PFParticle>, const art::Event &evt) const;
41  const std::vector<float> GetDeDxVector(const art::Ptr<recob::PFParticle>, const art::Event &evt) const;
42  const std::vector<float> GetVariableVector(const art::Ptr<recob::PFParticle>, const art::Event &evt) const;
43 
44  // Get true PDG code for training
45  const std::pair<const simb::MCParticle*,float> GetTrueParticle(const art::Ptr<recob::PFParticle>, const art::Event &evt) const;
46  const int GetTruePDGCode (const art::Ptr<recob::PFParticle>, const art::Event &evt) const;
47 
48  private:
49 
50  void SmoothDedxVector(std::vector<float> &dedx) const;
51  void PadDedxVector(std::vector<float> &dedx, const float mean, const float sigma) const;
52  void GetDedxMeanAndSigma(const std::vector<float> &dedx, float &mean, float &sigma) const;
53  void GetDeflectionMeanAndSigma(const art::Ptr<recob::Track> track, float &mean, float &sigma) const;
54 
55  void GetChildParticles(const art::Ptr<recob::PFParticle> part, const art::Event &evt, float &nTrack, float &nShower, float &nGrand) const;
56 
57  void NormaliseInputs(std::vector<std::vector<float>> &netInputs) const;
58 
59  // Variables for accessing the network architecture
62 
63  // Module names
68 
69  // Parameters for variable extraction
70  unsigned int fMinTrackPoints;
71  unsigned int fDedxLength;
72  float fQMax; // Maximum allowed charge
73  float fQJump; // Maximum difference between consequetive dEdx values
74 
75  bool fNormalise; // Normalise the inputs for the network
76  };
77 
78 }
79 
80 #endif // CTPHELPER_H
std::string fShowerLabel
Definition: CTPHelper.h:66
unsigned int fDedxLength
Definition: CTPHelper.h:71
Class containing some utility functions for all things CVN.
Definition: CTPHelper.h:30
Class storing the result from the convolutional track PID.
const std::vector< float > GetDeDxVector(const art::Ptr< recob::PFParticle >, const art::Event &evt) const
Definition: CTPHelper.cxx:144
std::string fNetDir
Definition: CTPHelper.h:60
void NormaliseInputs(std::vector< std::vector< float >> &netInputs) const
Definition: CTPHelper.cxx:292
Class containing some utility functions for all things CVN.
Definition: CTPResult.h:16
bool fNormalise
Definition: CTPHelper.h:75
std::string string
Definition: nybbler.cc:12
const int GetTruePDGCode(const art::Ptr< recob::PFParticle >, const art::Event &evt) const
Definition: CTPHelper.cxx:185
const std::vector< std::vector< float > > GetNetworkInputs(const art::Ptr< recob::PFParticle >, const art::Event &evt) const
Definition: CTPHelper.cxx:81
struct vector vector
std::string fTrackLabel
Definition: CTPHelper.h:65
Particle class.
void SmoothDedxVector(std::vector< float > &dedx) const
Definition: CTPHelper.cxx:189
void GetDeflectionMeanAndSigma(const art::Ptr< recob::Track > track, float &mean, float &sigma) const
Definition: CTPHelper.cxx:256
void GetDedxMeanAndSigma(const std::vector< float > &dedx, float &mean, float &sigma) const
Definition: CTPHelper.cxx:246
const std::pair< const simb::MCParticle *, float > GetTrueParticle(const art::Ptr< recob::PFParticle >, const art::Event &evt) const
Definition: CTPHelper.cxx:152
unsigned int fMinTrackPoints
Definition: CTPHelper.h:70
Declaration of signal hit object.
std::string fNetName
Definition: CTPHelper.h:61
float fQJump
Definition: CTPHelper.h:73
std::string fParticleLabel
Definition: CTPHelper.h:64
Class def header for a class GeoAlgo.
std::string fCalorimetryLabel
Definition: CTPHelper.h:67
TCEvent evt
Definition: DataStructs.cxx:7
void GetChildParticles(const art::Ptr< recob::PFParticle > part, const art::Event &evt, float &nTrack, float &nShower, float &nGrand) const
Definition: CTPHelper.cxx:276
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16
const std::vector< float > GetVariableVector(const art::Ptr< recob::PFParticle >, const art::Event &evt) const
Definition: CTPHelper.cxx:148
void PadDedxVector(std::vector< float > &dedx, const float mean, const float sigma) const
Definition: CTPHelper.cxx:224
CTPHelper(const fhicl::ParameterSet &pset)
Definition: CTPHelper.cxx:39
const ctp::CTPResult RunConvolutionalTrackPID(const art::Ptr< recob::PFParticle > particle, const art::Event &evt) const
Definition: CTPHelper.cxx:57