LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PIDAAlg.h
Go to the documentation of this file.
1 #ifndef PIDAALG_H
2 #define PIDAALG_H
3 
11 #include "fhiclcpp/ParameterSet.h"
13 
14 #include "TTree.h"
15 #include "TH1F.h"
16 
17 namespace util{
18  class NormalDistribution;
19 }
20 
22 
23  public:
25  NormalDistribution(float,float);
26 
27  float getValue(float);
28 
29  private:
30  float fStepSize;
31  float fMaxSigma;
32  std::vector<float> fValues;
33 
34 
35 };
36 
37 namespace pid{
38  class PIDAAlg;
39 }
40 
41 const unsigned int MAX_BANDWIDTHS=100;
42 
44  public:
46  fPIDA_BOGUS(-9999)
47  { this->reconfigure(p); }
48 
49  void reconfigure(fhicl::ParameterSet const& p);
50 
51  void RunPIDAAlg(std::vector<double> const&, std::vector<double> const&);
52  void RunPIDAAlg(anab::Calorimetry const&);
53  void RunPIDAAlg(anab::Calorimetry const&, float&, float&);
54 
55  float getPIDAMean();
56  float getPIDASigma();
57 
58  const std::vector<float>& getPIDAValues();
59  const std::vector<float>& getPIDAErrors();
60 
61  size_t getNKDEBandwidths() { return fKDEBandwidths.size(); }
62  float getKDEBandwidth(const size_t i_b) { return fKDEBandwidths.at(i_b); }
63  float getPIDAKDEMostProbable(const size_t);
64  float getPIDAKDEFullWidthHalfMax(const size_t);
65 
66  void PrintPIDAValues();
67 
68  void setExponentConstant(float const& ex) { fExponentConstant = ex; }
69 
70  void SetPIDATree(TTree*,TH1F*,std::vector<TH1F*>);
71  void FillPIDATree(unsigned int, unsigned int, unsigned int, anab::Calorimetry const&);
72 
73  private:
74 
75  const float fPIDA_BOGUS;
76 
78  float fMinResRange;
79  float fMaxResRange;
83  std::vector<float> fKDEBandwidths;
84 
85  std::vector<float> fpida_values;
86  std::vector<float> fpida_errors;
87  float fpida_mean;
88  float fpida_sigma;
91 
92  void calculatePIDAMean();
93  void calculatePIDASigma();
94  void calculatePIDAIntegral(std::map<double,double> const&);
95 
96  void ClearInternalData();
97 
98  void createKDEs();
99  void createKDE(const size_t);
100  void calculatePIDAKDEMostProbable();
101  void calculatePIDAKDEFullWidthHalfMax();
102  std::vector<float> fpida_kde_mp;
103  std::vector<float> fpida_kde_fwhm;
104  std::vector<float> fpida_kde_b;
105 
106  //this is only for making a histogram later ...
107  std::vector< std::vector<float> > fkde_distribution;
108  std::vector<float> fkde_dist_min;
109  std::vector<float> fkde_dist_max;
110 
112 
113  TTree* fPIDATree;
114  TH1F* hPIDAvalues;
115  TH1F* hPIDAKDE[MAX_BANDWIDTHS];
116  unsigned int fPIDAHistNbins;
118  float fPIDAHistMax;
119  typedef struct PIDAProperties{
120  unsigned int run;
121  unsigned int event;
122  unsigned int calo_index;
123  unsigned int planeid;
124  float trk_range;
125  float calo_KE;
126 
127  unsigned int n_pid_pts;
128  float mean;
129  float sigma;
132 
133  unsigned int n_bandwidths;
134  float kde_bandwidth[MAX_BANDWIDTHS];
135  float kde_mp[MAX_BANDWIDTHS];
136  float kde_fwhm[MAX_BANDWIDTHS];
137 
138  std::string leaf_structure;
140  leaf_structure("run/i:event/i:calo_index/i:planeid/i:trk_range/F:calo_KE/F:n_pid_pts/i:mean/F:sigma/F:integral_dedx/F:integral_pida/F"){}
141 
144  void FillPIDAProperties(unsigned int, unsigned int, unsigned int, anab::Calorimetry const&);
145 
146 };
147 
148 #endif
std::vector< float > fpida_errors
Definition: PIDAAlg.h:86
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
TH1F * hPIDAvalues
Definition: PIDAAlg.h:114
std::string leaf_structure
Definition: PIDAAlg.h:138
float fPIDAHistMin
Definition: PIDAAlg.h:117
TTree * fPIDATree
Definition: PIDAAlg.h:113
float fpida_integral_pida
Definition: PIDAAlg.h:90
util::NormalDistribution fnormalDist
Definition: PIDAAlg.h:111
size_t getNKDEBandwidths()
Definition: PIDAAlg.h:61
float fMaxPIDAValue
Definition: PIDAAlg.h:80
std::vector< float > fkde_dist_min
Definition: PIDAAlg.h:108
PIDAAlg(fhicl::ParameterSet const &p)
Definition: PIDAAlg.h:45
std::vector< float > fpida_kde_mp
Definition: PIDAAlg.h:102
float fMinResRange
Definition: PIDAAlg.h:78
float fMaxResRange
Definition: PIDAAlg.h:79
unsigned int n_bandwidths
Definition: PIDAAlg.h:133
float fKDEEvalMaxSigma
Definition: PIDAAlg.h:81
float fKDEEvalStepSize
Definition: PIDAAlg.h:82
std::vector< float > fkde_dist_max
Definition: PIDAAlg.h:109
std::vector< float > fpida_kde_fwhm
Definition: PIDAAlg.h:103
unsigned int fPIDAHistNbins
Definition: PIDAAlg.h:116
float fPIDAHistMax
Definition: PIDAAlg.h:118
const float fPIDA_BOGUS
Definition: PIDAAlg.h:75
float getValue(float)
Definition: PIDAAlg.cxx:360
const unsigned int MAX_BANDWIDTHS
Definition: PIDAAlg.h:41
std::vector< float > fpida_values
Definition: PIDAAlg.h:85
std::vector< float > fValues
Definition: PIDAAlg.h:32
float fpida_sigma
Definition: PIDAAlg.h:88
std::vector< float > fpida_kde_b
Definition: PIDAAlg.h:104
float fExponentConstant
Definition: PIDAAlg.h:77
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:83
std::vector< std::vector< float > > fkde_distribution
Definition: PIDAAlg.h:107
float getKDEBandwidth(const size_t i_b)
Definition: PIDAAlg.h:62
float fpida_mean
Definition: PIDAAlg.h:87
PIDAProperties_t fPIDAProperties
Definition: PIDAAlg.h:143
float fpida_integral_dedx
Definition: PIDAAlg.h:89
void setExponentConstant(float const &ex)
Definition: PIDAAlg.h:68