Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
pid::PIDAAlg Class Reference

#include <PIDAAlg.h>

Classes

struct  PIDAProperties
 

Public Member Functions

 PIDAAlg (fhicl::ParameterSet const &p)
 
void RunPIDAAlg (std::vector< float > const &, std::vector< float > const &)
 
void RunPIDAAlg (anab::Calorimetry const &)
 
void RunPIDAAlg (anab::Calorimetry const &, float &, float &)
 
float getPIDAMean ()
 
float getPIDASigma ()
 
const std::vector< float > & getPIDAValues ()
 
const std::vector< float > & getPIDAErrors ()
 
size_t getNKDEBandwidths ()
 
float getKDEBandwidth (const size_t i_b)
 
float getPIDAKDEMostProbable (const size_t)
 
float getPIDAKDEFullWidthHalfMax (const size_t)
 
void PrintPIDAValues ()
 
void setExponentConstant (float const &ex)
 
void SetPIDATree (TTree *, TH1F *, std::vector< TH1F * >)
 
void FillPIDATree (unsigned int, unsigned int, unsigned int, anab::Calorimetry const &)
 

Private Types

typedef struct pid::PIDAAlg::PIDAProperties PIDAProperties_t
 

Private Member Functions

void calculatePIDAMean ()
 
void calculatePIDASigma ()
 
void calculatePIDAIntegral (std::map< double, double > const &)
 
void ClearInternalData ()
 
void createKDEs ()
 
void createKDE (const size_t)
 
void calculatePIDAKDEMostProbable ()
 
void calculatePIDAKDEFullWidthHalfMax ()
 
void FillPIDAProperties (unsigned int, unsigned int, unsigned int, anab::Calorimetry const &)
 

Private Attributes

const float fPIDA_BOGUS
 
float fExponentConstant
 
float fMinResRange
 
float fMaxResRange
 
float fMaxPIDAValue
 
float fKDEEvalMaxSigma
 
float fKDEEvalStepSize
 
std::vector< float > fKDEBandwidths
 
std::vector< float > fpida_values
 
std::vector< float > fpida_errors
 
float fpida_mean
 
float fpida_sigma
 
float fpida_integral_dedx
 
float fpida_integral_pida
 
std::vector< float > fpida_kde_mp
 
std::vector< float > fpida_kde_fwhm
 
std::vector< float > fpida_kde_b
 
std::vector< std::vector< float > > fkde_distribution
 
std::vector< float > fkde_dist_min
 
std::vector< float > fkde_dist_max
 
util::NormalDistribution fnormalDist
 
TTree * fPIDATree
 
TH1F * hPIDAvalues
 
TH1F * hPIDAKDE [MAX_BANDWIDTHS]
 
unsigned int fPIDAHistNbins
 
float fPIDAHistMin
 
float fPIDAHistMax
 
PIDAProperties_t fPIDAProperties
 

Detailed Description

Definition at line 48 of file PIDAAlg.h.

Member Typedef Documentation

Constructor & Destructor Documentation

pid::PIDAAlg::PIDAAlg ( fhicl::ParameterSet const &  p)

Title: PIDA Algorithim Class Author: Wes Ketchum (wketc.nosp@m.hum@.nosp@m.lanl..nosp@m.gov), based on ideas/code from Bruce Baller

Description: Algorithm that calculates the PIDA from a calorimetry object Input: anab::Calorimetry Output: PIDA information

Definition at line 24 of file PIDAAlg.cxx.

24  :
25  fPIDA_BOGUS(-9999),
26  fExponentConstant(p.get<float>("ExponentConstant",0.42)),
27  fMinResRange(p.get<float>("MinResRange",0)),
28  fMaxResRange(p.get<float>("MaxResRange",30)),
29  fMaxPIDAValue(p.get<float>("MaxPIDAValue",50)),
30  fKDEEvalMaxSigma(p.get<float>("KDEEvalMaxSigma",3)),
31  fKDEEvalStepSize(p.get<float>("KDEEvalStepSize",0.01)),
32  fKDEBandwidths(p.get< std::vector<float> >("KDEBandwidths")),
34  fPIDAHistNbins(p.get<unsigned int>("PIDAHistNbins",100)),
35  fPIDAHistMin(p.get<float>("PIDAHistMin",0.0)),
36  fPIDAHistMax(p.get<float>("PIDAHistMax",50.0))
37 {
39 }
float fPIDAHistMin
Definition: PIDAAlg.h:118
util::NormalDistribution fnormalDist
Definition: PIDAAlg.h:112
float fMaxPIDAValue
Definition: PIDAAlg.h:81
float fMinResRange
Definition: PIDAAlg.h:79
float fMaxResRange
Definition: PIDAAlg.h:80
float fKDEEvalMaxSigma
Definition: PIDAAlg.h:82
float fKDEEvalStepSize
Definition: PIDAAlg.h:83
unsigned int fPIDAHistNbins
Definition: PIDAAlg.h:117
float fPIDAHistMax
Definition: PIDAAlg.h:119
const float fPIDA_BOGUS
Definition: PIDAAlg.h:76
p
Definition: test.py:223
void ClearInternalData()
Definition: PIDAAlg.cxx:41
float fExponentConstant
Definition: PIDAAlg.h:78
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84

Member Function Documentation

void pid::PIDAAlg::calculatePIDAIntegral ( std::map< double, double > const &  range_dEdx_map)
private

Definition at line 208 of file PIDAAlg.cxx.

208  {
209 
210  if(range_dEdx_map.size()<2) return;
211 
213 
214  for( std::map<double,double>::const_iterator map_iter = range_dEdx_map.begin();
215  map_iter != std::prev(range_dEdx_map.end());
216  map_iter++)
217  {
218  double range_width = std::next(map_iter)->first - map_iter->first;
219  fpida_integral_dedx += range_width*( std::next(map_iter)->second + 0.5*(map_iter->second-std::next(map_iter)->second));
220  }
221 
223  std::pow( (std::prev(range_dEdx_map.end())->first - range_dEdx_map.begin()->first),(fExponentConstant-1) );
224 }
float fpida_integral_pida
Definition: PIDAAlg.h:91
constexpr T pow(T x)
Definition: pow.h:72
intermediate_table::const_iterator const_iterator
float fExponentConstant
Definition: PIDAAlg.h:78
float fpida_integral_dedx
Definition: PIDAAlg.h:90
void pid::PIDAAlg::calculatePIDAKDEFullWidthHalfMax ( )
private
void pid::PIDAAlg::calculatePIDAKDEMostProbable ( )
private
void pid::PIDAAlg::calculatePIDAMean ( )
private

Definition at line 184 of file PIDAAlg.cxx.

184  {
185 
186  if(fpida_values.size()==0)
187  throw "pid::PIDAAlg --- PIDA Values not filled!";
188 
189  fpida_mean = 0;
190  for(auto const& val : fpida_values)
191  fpida_mean += val;
192  fpida_mean /= fpida_values.size();
193 
194 }
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
float fpida_mean
Definition: PIDAAlg.h:88
void pid::PIDAAlg::calculatePIDASigma ( )
private

Definition at line 196 of file PIDAAlg.cxx.

196  {
197 
200 
201  fpida_sigma = 0;
202  for(auto const& val : fpida_values)
204 
205  fpida_sigma = std::sqrt(fpida_sigma)/fpida_values.size();
206 }
const float fPIDA_BOGUS
Definition: PIDAAlg.h:76
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
float fpida_sigma
Definition: PIDAAlg.h:89
void calculatePIDAMean()
Definition: PIDAAlg.cxx:184
float fpida_mean
Definition: PIDAAlg.h:88
void pid::PIDAAlg::ClearInternalData ( )
private

Definition at line 41 of file PIDAAlg.cxx.

41  {
46  fpida_values.clear();
47  fpida_errors.clear();
48 
49  fpida_kde_mp = std::vector<float>(fKDEBandwidths.size(),fPIDA_BOGUS);
50  fpida_kde_fwhm = std::vector<float>(fKDEBandwidths.size(),fPIDA_BOGUS);
51  fpida_kde_b = std::vector<float>(fKDEBandwidths.size(),fPIDA_BOGUS);
52  fkde_distribution = std::vector< std::vector<float> >(fKDEBandwidths.size());
53  fkde_dist_min = std::vector<float>(fKDEBandwidths.size(),fPIDA_BOGUS);
54  fkde_dist_max = std::vector<float>(fKDEBandwidths.size(),fPIDA_BOGUS);
55 }
std::vector< float > fpida_errors
Definition: PIDAAlg.h:87
float fpida_integral_pida
Definition: PIDAAlg.h:91
std::vector< float > fkde_dist_min
Definition: PIDAAlg.h:109
std::vector< float > fpida_kde_mp
Definition: PIDAAlg.h:103
std::vector< float > fkde_dist_max
Definition: PIDAAlg.h:110
std::vector< float > fpida_kde_fwhm
Definition: PIDAAlg.h:104
const float fPIDA_BOGUS
Definition: PIDAAlg.h:76
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
float fpida_sigma
Definition: PIDAAlg.h:89
std::vector< float > fpida_kde_b
Definition: PIDAAlg.h:105
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84
std::vector< std::vector< float > > fkde_distribution
Definition: PIDAAlg.h:108
float fpida_mean
Definition: PIDAAlg.h:88
float fpida_integral_dedx
Definition: PIDAAlg.h:90
void pid::PIDAAlg::createKDE ( const size_t  i_b)
private

Definition at line 226 of file PIDAAlg.cxx.

226  {
227 
228  if(fpida_values.size()==0)
229  throw "pid::PIDAAlg --- PIDA Values not filled!";
230 
231  //if( fkde_distribution[i_b].size()!=0 ) return;
232 
233  if(fKDEBandwidths[i_b]<=0) {
235  float bandwidth = fpida_sigma*1.06*std::pow((float)(fpida_values.size()),-0.2);
236  fpida_errors = std::vector<float>(fpida_values.size(),bandwidth);
237  fpida_kde_b[i_b] = bandwidth;
238  }
239  else{
240  fpida_errors = std::vector<float>(fpida_values.size(),fKDEBandwidths[i_b]);
241  fpida_kde_b[i_b] = fKDEBandwidths[i_b];
242  }
243 
244  const auto min_pida_iterator = std::min_element(fpida_values.begin(),fpida_values.end());
245  const size_t min_pida_location = std::distance(fpida_values.begin(),min_pida_iterator);
246  fkde_dist_min[i_b] = fpida_values[min_pida_location] - fKDEEvalMaxSigma*fpida_errors[min_pida_location];
247 
248  const auto max_pida_iterator = std::max_element(fpida_values.begin(),fpida_values.end());
249  const size_t max_pida_location = std::distance(fpida_values.begin(),max_pida_iterator);
250  fkde_dist_max[i_b] = fpida_values[max_pida_location] + fKDEEvalMaxSigma*fpida_errors[max_pida_location];
251 
252  //make the kde distribution, and get the max value
253  const size_t kde_dist_size = (size_t)( (fkde_dist_max[i_b] - fkde_dist_min[i_b])/fKDEEvalStepSize ) + 1;
254  fkde_distribution[i_b].resize(kde_dist_size);
255  float kde_max=0;
256  size_t step_max=0;
257  for(size_t i_step=0; i_step<kde_dist_size; i_step++){
258  float pida_val = fkde_dist_min[i_b] + i_step*fKDEEvalStepSize;
259  fkde_distribution[i_b][i_step]=0;
260 
261  for(size_t i_pida=0; i_pida<fpida_values.size(); i_pida++)
262  fkde_distribution[i_b][i_step] += fnormalDist.getValue((fpida_values[i_pida]-pida_val)/fpida_errors[i_pida])/fpida_errors[i_pida];
263 
264  if(fkde_distribution[i_b][i_step]>kde_max){
265  kde_max = fkde_distribution[i_b][i_step];
266  step_max = i_step;
267  fpida_kde_mp[i_b] = pida_val;
268  }
269  }
270 
271  //now get fwhm
272  float half_max = 0.5*fpida_kde_mp[i_b];
273  float low_width=0;
274  for(size_t i_step=step_max; i_step>0; i_step--){
275  if(fkde_distribution[i_b][i_step] < half_max) break;
276  low_width += fKDEEvalStepSize;
277  }
278  float high_width=0;
279  for(size_t i_step=step_max; i_step<kde_dist_size; i_step++){
280  if(fkde_distribution[i_b][i_step] < half_max) break;
281  high_width += fKDEEvalStepSize;
282  }
283  fpida_kde_fwhm[i_b] = low_width+high_width;
284 
285 }
std::vector< float > fpida_errors
Definition: PIDAAlg.h:87
util::NormalDistribution fnormalDist
Definition: PIDAAlg.h:112
constexpr T pow(T x)
Definition: pow.h:72
std::vector< float > fkde_dist_min
Definition: PIDAAlg.h:109
std::vector< float > fpida_kde_mp
Definition: PIDAAlg.h:103
float fKDEEvalMaxSigma
Definition: PIDAAlg.h:82
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
float getValue(float)
Definition: PIDAAlg.cxx:366
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
float fpida_sigma
Definition: PIDAAlg.h:89
std::vector< float > fpida_kde_b
Definition: PIDAAlg.h:105
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84
std::vector< std::vector< float > > fkde_distribution
Definition: PIDAAlg.h:108
void calculatePIDASigma()
Definition: PIDAAlg.cxx:196
void pid::PIDAAlg::createKDEs ( )
private

Definition at line 287 of file PIDAAlg.cxx.

287  {
288  for(size_t i_b=0; i_b < fKDEBandwidths.size(); i_b++)
289  createKDE(i_b);
290 }
void createKDE(const size_t)
Definition: PIDAAlg.cxx:226
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84
void pid::PIDAAlg::FillPIDAProperties ( unsigned int  run,
unsigned int  event,
unsigned int  calo_index,
anab::Calorimetry const &  calo 
)
private

Definition at line 292 of file PIDAAlg.cxx.

295  {
296 
299  fPIDAProperties.calo_index = calo_index;
300  fPIDAProperties.planeid = calo.PlaneID().Plane;
301  fPIDAProperties.trk_range = calo.Range();
302  fPIDAProperties.calo_KE = calo.KineticEnergy();
303 
305  for(size_t i_b=0; i_b<fPIDAProperties.n_bandwidths; i_b++)
306 
311 
314 
315  createKDEs();
316  for(size_t i_b=0; i_b<fPIDAProperties.n_bandwidths; i_b++){
317  fPIDAProperties.kde_mp[i_b] = fpida_kde_mp[i_b];
320  }
321 
322  hPIDAvalues->Reset();
323  for(auto const& val: fpida_values)
324  hPIDAvalues->Fill(val);
325 
326  for(size_t i_b=0; i_b<fPIDAProperties.n_bandwidths; i_b++){
327  hPIDAKDE[i_b]->Reset();
328  for(size_t i_step=0; i_step<fkde_distribution[i_b].size(); i_step++)
329  hPIDAKDE[i_b]->AddBinContent(hPIDAKDE[i_b]->FindBin(i_step*fKDEEvalStepSize+fkde_dist_min[i_b]),
330  fkde_distribution[i_b][i_step]);
331  }
332 
333  fPIDATree->Fill();
334 }
TH1F * hPIDAKDE[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:116
TH1F * hPIDAvalues
Definition: PIDAAlg.h:115
TTree * fPIDATree
Definition: PIDAAlg.h:114
float kde_bandwidth[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:135
float fpida_integral_pida
Definition: PIDAAlg.h:91
std::vector< float > fkde_dist_min
Definition: PIDAAlg.h:109
int FindBin(double value, std::vector< double > binning)
std::vector< float > fpida_kde_mp
Definition: PIDAAlg.h:103
void createKDEs()
Definition: PIDAAlg.cxx:287
unsigned int n_bandwidths
Definition: PIDAAlg.h:134
float fKDEEvalStepSize
Definition: PIDAAlg.h:83
std::vector< float > fpida_kde_fwhm
Definition: PIDAAlg.h:104
float kde_fwhm[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:137
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
float fpida_sigma
Definition: PIDAAlg.h:89
std::vector< float > fpida_kde_b
Definition: PIDAAlg.h:105
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84
std::vector< std::vector< float > > fkde_distribution
Definition: PIDAAlg.h:108
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
calorimetry
void pid::PIDAAlg::FillPIDATree ( unsigned int  run,
unsigned int  event,
unsigned int  calo_index,
anab::Calorimetry const &  calo 
)

Definition at line 176 of file PIDAAlg.cxx.

179  {
180  RunPIDAAlg(calo);
181  FillPIDAProperties(run,event,calo_index,calo);
182 }
void FillPIDAProperties(unsigned int, unsigned int, unsigned int, anab::Calorimetry const &)
Definition: PIDAAlg.cxx:292
void RunPIDAAlg(std::vector< float > const &, std::vector< float > const &)
Definition: PIDAAlg.cxx:146
calorimetry
Event finding and building.
float pid::PIDAAlg::getKDEBandwidth ( const size_t  i_b)
inline

Definition at line 63 of file PIDAAlg.h.

63 { return fKDEBandwidths.at(i_b); }
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84
size_t pid::PIDAAlg::getNKDEBandwidths ( )
inline

Definition at line 62 of file PIDAAlg.h.

62 { return fKDEBandwidths.size(); }
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84
const std::vector< float > & pid::PIDAAlg::getPIDAErrors ( )

Definition at line 127 of file PIDAAlg.cxx.

127  {
128  return fpida_errors;
129 }
std::vector< float > fpida_errors
Definition: PIDAAlg.h:87
float pid::PIDAAlg::getPIDAKDEFullWidthHalfMax ( const size_t  i_b)

Definition at line 116 of file PIDAAlg.cxx.

116  {
117  if(fpida_kde_fwhm[i_b]==fPIDA_BOGUS)
118  createKDE(i_b);
119 
120  return fpida_kde_fwhm[i_b];
121 }
void createKDE(const size_t)
Definition: PIDAAlg.cxx:226
std::vector< float > fpida_kde_fwhm
Definition: PIDAAlg.h:104
const float fPIDA_BOGUS
Definition: PIDAAlg.h:76
float pid::PIDAAlg::getPIDAKDEMostProbable ( const size_t  i_b)

Definition at line 109 of file PIDAAlg.cxx.

109  {
110  if(fpida_kde_mp[i_b]==fPIDA_BOGUS)
111  createKDE(i_b);
112 
113  return fpida_kde_mp[i_b];
114 }
std::vector< float > fpida_kde_mp
Definition: PIDAAlg.h:103
void createKDE(const size_t)
Definition: PIDAAlg.cxx:226
const float fPIDA_BOGUS
Definition: PIDAAlg.h:76
float pid::PIDAAlg::getPIDAMean ( )

Definition at line 95 of file PIDAAlg.cxx.

95  {
98 
99  return fpida_mean;
100 }
const float fPIDA_BOGUS
Definition: PIDAAlg.h:76
void calculatePIDAMean()
Definition: PIDAAlg.cxx:184
float fpida_mean
Definition: PIDAAlg.h:88
float pid::PIDAAlg::getPIDASigma ( )

Definition at line 102 of file PIDAAlg.cxx.

102  {
105 
106  return fpida_sigma;
107 }
const float fPIDA_BOGUS
Definition: PIDAAlg.h:76
float fpida_sigma
Definition: PIDAAlg.h:89
void calculatePIDASigma()
Definition: PIDAAlg.cxx:196
const std::vector< float > & pid::PIDAAlg::getPIDAValues ( )

Definition at line 123 of file PIDAAlg.cxx.

123  {
124  return fpida_values;
125 }
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
void pid::PIDAAlg::PrintPIDAValues ( )

Definition at line 336 of file PIDAAlg.cxx.

336  {
337  for(size_t i_pida=0; i_pida<fpida_values.size(); i_pida++)
338  std::cout << "\tPIDA --- " << i_pida << "\t" << fpida_values[i_pida] << std::endl;
339 }
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
QTextStream & endl(QTextStream &s)
void pid::PIDAAlg::RunPIDAAlg ( std::vector< float > const &  resRange,
std::vector< float > const &  dEdx 
)

Definition at line 146 of file PIDAAlg.cxx.

147  {
148 
150 
151  fpida_values.reserve( resRange.size() );
152  fpida_errors.reserve( resRange.size() );
153 
154  std::map<double,double> range_dEdx_map;
155 
156  for(size_t i_r=0; i_r<resRange.size(); i_r++){
157  if(resRange[i_r]>fMaxResRange || resRange[i_r]<fMinResRange) continue;
158 
159  range_dEdx_map[ resRange[i_r] ] = dEdx[i_r];
160 
161  float val = dEdx[i_r]*std::pow(resRange[i_r],fExponentConstant);
162  if(val < fMaxPIDAValue){
163  fpida_values.push_back(val);
164  //fpida_errors.push_back(0);
165  }
166 
167  }
168 
169  calculatePIDAIntegral(range_dEdx_map);
170 
171  if(fpida_values.size()==0)
172  fpida_values.push_back(-99);
173 
174 }
std::vector< float > fpida_errors
Definition: PIDAAlg.h:87
constexpr T pow(T x)
Definition: pow.h:72
float fMaxPIDAValue
Definition: PIDAAlg.h:81
float fMinResRange
Definition: PIDAAlg.h:79
float fMaxResRange
Definition: PIDAAlg.h:80
std::vector< float > fpida_values
Definition: PIDAAlg.h:86
void ClearInternalData()
Definition: PIDAAlg.cxx:41
void calculatePIDAIntegral(std::map< double, double > const &)
Definition: PIDAAlg.cxx:208
float fExponentConstant
Definition: PIDAAlg.h:78
void pid::PIDAAlg::RunPIDAAlg ( anab::Calorimetry const &  calo)

Definition at line 131 of file PIDAAlg.cxx.

131  {
132  std::vector<float> const& resRange = calo.ResidualRange();
133  std::vector<float> const& dEdx = calo.dEdx();
134  RunPIDAAlg(resRange,dEdx);
135 }
double dEdx(float dqdx, float Efield)
Definition: doAna.cpp:21
void RunPIDAAlg(std::vector< float > const &, std::vector< float > const &)
Definition: PIDAAlg.cxx:146
calorimetry
void pid::PIDAAlg::RunPIDAAlg ( anab::Calorimetry const &  calo,
float &  mean,
float &  sigma 
)

Definition at line 137 of file PIDAAlg.cxx.

140 {
141  RunPIDAAlg(calo);
142  mean = getPIDAMean();
143  sigma = getPIDASigma();
144 }
float getPIDAMean()
Definition: PIDAAlg.cxx:95
float getPIDASigma()
Definition: PIDAAlg.cxx:102
void RunPIDAAlg(std::vector< float > const &, std::vector< float > const &)
Definition: PIDAAlg.cxx:146
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16
calorimetry
void pid::PIDAAlg::setExponentConstant ( float const &  ex)
inline

Definition at line 69 of file PIDAAlg.h.

69 { fExponentConstant = ex; }
float fExponentConstant
Definition: PIDAAlg.h:78
void pid::PIDAAlg::SetPIDATree ( TTree *  tree,
TH1F *  hist_vals,
std::vector< TH1F * >  hist_kde 
)

Definition at line 57 of file PIDAAlg.cxx.

57  {
58 
59  if(hist_kde.size()>MAX_BANDWIDTHS)
60  throw "Error: input histograms larger than max allowed bandwidths.";
61  if(hist_kde.size()!=fKDEBandwidths.size())
62  throw "Error: input histograms do not have same size as bandwidths.";
63 
64  fPIDATree = tree;
65 
66  hPIDAvalues = hist_vals;
67  hPIDAvalues->SetNameTitle("hPIDAvalues","PIDA Distribution");
69 
70  for(size_t i_hist=0; i_hist<hist_kde.size(); i_hist++){
71  hPIDAKDE[i_hist] = hist_kde[i_hist];
72 
73  std::stringstream hname,htitle;
74  hname << "hPIDAKDE_" << i_hist;
75  htitle << "PIDA KDE-smoothed Distribution, Bandwidth=" << fKDEBandwidths.at(i_hist);
76 
77  hPIDAKDE[i_hist]->SetNameTitle(hname.str().c_str(),htitle.str().c_str());
79  }
80 
82  fPIDATree->Branch("hpida_vals","TH1F",hPIDAvalues);
83  fPIDATree->Branch("n_bandwidths",&(fPIDAProperties.n_bandwidths),"n_bandwidths/i");
84  fPIDATree->Branch("kde_bandwidth",fPIDAProperties.kde_bandwidth,"kde_bandwidth[n_bandwidths]/F");
85  fPIDATree->Branch("kde_mp",fPIDAProperties.kde_mp,"kde_mp[n_bandwidths]/F");
86  fPIDATree->Branch("kde_fwhm",fPIDAProperties.kde_fwhm,"kde_fwhm[n_bandwidths]/F");
87  for(size_t i_hist=0; i_hist<hist_kde.size(); i_hist++){
88  std::stringstream bname;
89  bname << "hpida_kde_" << i_hist;
90  fPIDATree->Branch(bname.str().c_str(),"TH1F",hPIDAKDE[i_hist]);
91  }
92 
93 }
TH1F * hPIDAKDE[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:116
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
unsigned int n_bandwidths
Definition: PIDAAlg.h:134
unsigned int fPIDAHistNbins
Definition: PIDAAlg.h:117
float kde_fwhm[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:137
float fPIDAHistMax
Definition: PIDAAlg.h:119
const unsigned int MAX_BANDWIDTHS
Definition: PIDAAlg.h:46
std::vector< float > fKDEBandwidths
Definition: PIDAAlg.h:84
PIDAProperties_t fPIDAProperties
Definition: PIDAAlg.h:144
float kde_mp[MAX_BANDWIDTHS]
Definition: PIDAAlg.h:136

Member Data Documentation

float pid::PIDAAlg::fExponentConstant
private

Definition at line 78 of file PIDAAlg.h.

std::vector<float> pid::PIDAAlg::fkde_dist_max
private

Definition at line 110 of file PIDAAlg.h.

std::vector<float> pid::PIDAAlg::fkde_dist_min
private

Definition at line 109 of file PIDAAlg.h.

std::vector< std::vector<float> > pid::PIDAAlg::fkde_distribution
private

Definition at line 108 of file PIDAAlg.h.

std::vector<float> pid::PIDAAlg::fKDEBandwidths
private

Definition at line 84 of file PIDAAlg.h.

float pid::PIDAAlg::fKDEEvalMaxSigma
private

Definition at line 82 of file PIDAAlg.h.

float pid::PIDAAlg::fKDEEvalStepSize
private

Definition at line 83 of file PIDAAlg.h.

float pid::PIDAAlg::fMaxPIDAValue
private

Definition at line 81 of file PIDAAlg.h.

float pid::PIDAAlg::fMaxResRange
private

Definition at line 80 of file PIDAAlg.h.

float pid::PIDAAlg::fMinResRange
private

Definition at line 79 of file PIDAAlg.h.

util::NormalDistribution pid::PIDAAlg::fnormalDist
private

Definition at line 112 of file PIDAAlg.h.

const float pid::PIDAAlg::fPIDA_BOGUS
private

Definition at line 76 of file PIDAAlg.h.

std::vector<float> pid::PIDAAlg::fpida_errors
private

Definition at line 87 of file PIDAAlg.h.

float pid::PIDAAlg::fpida_integral_dedx
private

Definition at line 90 of file PIDAAlg.h.

float pid::PIDAAlg::fpida_integral_pida
private

Definition at line 91 of file PIDAAlg.h.

std::vector<float> pid::PIDAAlg::fpida_kde_b
private

Definition at line 105 of file PIDAAlg.h.

std::vector<float> pid::PIDAAlg::fpida_kde_fwhm
private

Definition at line 104 of file PIDAAlg.h.

std::vector<float> pid::PIDAAlg::fpida_kde_mp
private

Definition at line 103 of file PIDAAlg.h.

float pid::PIDAAlg::fpida_mean
private

Definition at line 88 of file PIDAAlg.h.

float pid::PIDAAlg::fpida_sigma
private

Definition at line 89 of file PIDAAlg.h.

std::vector<float> pid::PIDAAlg::fpida_values
private

Definition at line 86 of file PIDAAlg.h.

float pid::PIDAAlg::fPIDAHistMax
private

Definition at line 119 of file PIDAAlg.h.

float pid::PIDAAlg::fPIDAHistMin
private

Definition at line 118 of file PIDAAlg.h.

unsigned int pid::PIDAAlg::fPIDAHistNbins
private

Definition at line 117 of file PIDAAlg.h.

PIDAProperties_t pid::PIDAAlg::fPIDAProperties
private

Definition at line 144 of file PIDAAlg.h.

TTree* pid::PIDAAlg::fPIDATree
private

Definition at line 114 of file PIDAAlg.h.

TH1F* pid::PIDAAlg::hPIDAKDE[MAX_BANDWIDTHS]
private

Definition at line 116 of file PIDAAlg.h.

TH1F* pid::PIDAAlg::hPIDAvalues
private

Definition at line 115 of file PIDAAlg.h.


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