All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PIDAAlg.h
Go to the documentation of this file.
1 #ifndef PIDAALG_H
2 #define PIDAALG_H
3 /*!
4  * Title: PIDA Algorithim Class
5  * Author: Wes Ketchum (wketchum@lanl.gov), based on ideas/code from Bruce Baller
6  *
7  * Description: Algorithm that calculates the PIDA from a calorimetry object
8  * Input: anab::Calorimetry
9  * Output: PIDA information
10 */
11 
12 #include <map>
13 #include <string>
14 #include <vector>
15 
16 namespace fhicl { class ParameterSet; }
17 namespace anab { class Calorimetry; }
18 
19 class TH1F;
20 class TTree;
21 
22 namespace util{
23  class NormalDistribution;
24 }
25 
27 
28  public:
30  NormalDistribution(float,float);
31 
32  float getValue(float);
33 
34  private:
35  float fStepSize;
36  float fMaxSigma;
37  std::vector<float> fValues;
38 
39 
40 };
41 
42 namespace pid{
43  class PIDAAlg;
44 }
45 
46 const unsigned int MAX_BANDWIDTHS=100;
47 
49  public:
50  PIDAAlg(fhicl::ParameterSet const& p);
51 
52  void RunPIDAAlg(std::vector<float> const&, std::vector<float> const&);
53  void RunPIDAAlg(anab::Calorimetry const&);
54  void RunPIDAAlg(anab::Calorimetry const&, float&, float&);
55 
56  float getPIDAMean();
57  float getPIDASigma();
58 
59  const std::vector<float>& getPIDAValues();
60  const std::vector<float>& getPIDAErrors();
61 
62  size_t getNKDEBandwidths() { return fKDEBandwidths.size(); }
63  float getKDEBandwidth(const size_t i_b) { return fKDEBandwidths.at(i_b); }
64  float getPIDAKDEMostProbable(const size_t);
65  float getPIDAKDEFullWidthHalfMax(const size_t);
66 
67  void PrintPIDAValues();
68 
69  void setExponentConstant(float const& ex) { fExponentConstant = ex; }
70 
71  void SetPIDATree(TTree*,TH1F*,std::vector<TH1F*>);
72  void FillPIDATree(unsigned int, unsigned int, unsigned int, anab::Calorimetry const&);
73 
74  private:
75 
76  const float fPIDA_BOGUS;
77 
79  float fMinResRange;
80  float fMaxResRange;
84  std::vector<float> fKDEBandwidths;
85 
86  std::vector<float> fpida_values;
87  std::vector<float> fpida_errors;
88  float fpida_mean;
89  float fpida_sigma;
92 
93  void calculatePIDAMean();
94  void calculatePIDASigma();
95  void calculatePIDAIntegral(std::map<double,double> const&);
96 
97  void ClearInternalData();
98 
99  void createKDEs();
100  void createKDE(const size_t);
103  std::vector<float> fpida_kde_mp;
104  std::vector<float> fpida_kde_fwhm;
105  std::vector<float> fpida_kde_b;
106 
107  //this is only for making a histogram later ...
108  std::vector< std::vector<float> > fkde_distribution;
109  std::vector<float> fkde_dist_min;
110  std::vector<float> fkde_dist_max;
111 
113 
114  TTree* fPIDATree;
115  TH1F* hPIDAvalues;
117  unsigned int fPIDAHistNbins;
120  typedef struct PIDAProperties{
121  unsigned int run;
122  unsigned int event;
123  unsigned int calo_index;
124  unsigned int planeid;
125  float trk_range;
126  float calo_KE;
127 
128  unsigned int n_pid_pts;
129  float mean;
130  float sigma;
133 
134  unsigned int n_bandwidths;
138 
139  std::string leaf_structure;
141  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"){}
142 
145  void FillPIDAProperties(unsigned int, unsigned int, unsigned int, anab::Calorimetry const&);
146 
147 };
148 
149 #endif
std::vector< float > fpida_errors
Definition: PIDAAlg.h:87
TH1F * hPIDAKDE[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:116
void SetPIDATree(TTree *, TH1F *, std::vector< TH1F * >)
Definition: PIDAAlg.cxx:57
TH1F * hPIDAvalues
Definition: PIDAAlg.h:115
std::string leaf_structure
Definition: PIDAAlg.h:139
float fPIDAHistMin
Definition: PIDAAlg.h:118
TTree * fPIDATree
Definition: PIDAAlg.h:114
float kde_bandwidth[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:135
float fpida_integral_pida
Definition: PIDAAlg.h:91
void FillPIDATree(unsigned int, unsigned int, unsigned int, anab::Calorimetry const &)
Definition: PIDAAlg.cxx:176
util::NormalDistribution fnormalDist
Definition: PIDAAlg.h:112
pdgs p
Definition: selectors.fcl:22
size_t getNKDEBandwidths()
Definition: PIDAAlg.h:62
void calculatePIDAKDEMostProbable()
float fMaxPIDAValue
Definition: PIDAAlg.h:81
std::vector< float > fkde_dist_min
Definition: PIDAAlg.h:109
PIDAAlg(fhicl::ParameterSet const &p)
Definition: PIDAAlg.cxx:24
float getPIDAMean()
Definition: PIDAAlg.cxx:95
void calculatePIDAKDEFullWidthHalfMax()
std::vector< float > fpida_kde_mp
Definition: PIDAAlg.h:103
float fMinResRange
Definition: PIDAAlg.h:79
void FillPIDAProperties(unsigned int, unsigned int, unsigned int, anab::Calorimetry const &)
Definition: PIDAAlg.cxx:292
void createKDE(const size_t)
Definition: PIDAAlg.cxx:226
float fMaxResRange
Definition: PIDAAlg.h:80
void createKDEs()
Definition: PIDAAlg.cxx:287
unsigned int n_bandwidths
Definition: PIDAAlg.h:134
float fKDEEvalMaxSigma
Definition: PIDAAlg.h:82
const std::vector< float > & getPIDAValues()
Definition: PIDAAlg.cxx:123
float fKDEEvalStepSize
Definition: PIDAAlg.h:83
std::vector< float > fkde_dist_max
Definition: PIDAAlg.h:110
std::vector< float > fpida_kde_fwhm
Definition: PIDAAlg.h:104
unsigned int fPIDAHistNbins
Definition: PIDAAlg.h:117
float kde_fwhm[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:137
float fPIDAHistMax
Definition: PIDAAlg.h:119
float getPIDAKDEMostProbable(const size_t)
Definition: PIDAAlg.cxx:109
const float fPIDA_BOGUS
Definition: PIDAAlg.h:76
float getPIDASigma()
Definition: PIDAAlg.cxx:102
float getValue(float)
Definition: PIDAAlg.cxx:366
void RunPIDAAlg(std::vector< float > const &, std::vector< float > const &)
Definition: PIDAAlg.cxx:146
const unsigned int MAX_BANDWIDTHS
Definition: PIDAAlg.h:46
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
void ClearInternalData()
Definition: PIDAAlg.cxx:41
void PrintPIDAValues()
Definition: PIDAAlg.cxx:336
std::vector< float > fValues
Definition: PIDAAlg.h:37
float getPIDAKDEFullWidthHalfMax(const size_t)
Definition: PIDAAlg.cxx:116
float fpida_sigma
Definition: PIDAAlg.h:89
std::vector< float > fpida_kde_b
Definition: PIDAAlg.h:105
void calculatePIDAIntegral(std::map< double, double > const &)
Definition: PIDAAlg.cxx:208
struct pid::PIDAAlg::PIDAProperties PIDAProperties_t
float fExponentConstant
Definition: PIDAAlg.h:78
void calculatePIDAMean()
Definition: PIDAAlg.cxx:184
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84
std::vector< std::vector< float > > fkde_distribution
Definition: PIDAAlg.h:108
const std::vector< float > & getPIDAErrors()
Definition: PIDAAlg.cxx:127
float getKDEBandwidth(const size_t i_b)
Definition: PIDAAlg.h:63
float fpida_mean
Definition: PIDAAlg.h:88
PIDAProperties_t fPIDAProperties
Definition: PIDAAlg.h:144
float fpida_integral_dedx
Definition: PIDAAlg.h:90
void calculatePIDASigma()
Definition: PIDAAlg.cxx:196
float kde_mp[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:136
void setExponentConstant(float const &ex)
Definition: PIDAAlg.h:69