FEDRA emulsion software from the OPERA Collaboration
ERTools.h
Go to the documentation of this file.
1 #ifndef EDB_ROOT_TOOLS_H
2 #define EDB_ROOT_TOOLS_H
3 
4 #include "TMath.h"
5 #include "TProfile2D.h"
6 #include "TH1D.h"
7 #include "TH2D.h"
8 #include "TTree.h"
9 
10 namespace ERTools {
11  // peaks search
12  struct PeakInfo {
13  int bin_id;
14  double peak_position;
15  double peak_height;
17  double window_mean;
18  double window_rms;
19  };
20  std::vector<PeakInfo> FindPeaksWithIntegral(TH1* hist, int window_size, double threshold, int from_bin, int to_bin);
21 
22  TH1D* get_h_var( TTree *tree, const char *var, const char *hname, double bin, const char *cut );
23  TH2D* get_h2_var( TTree *tree, const char *var1, const char *var2, const char *hname, double bin1, double bin2 );
24 
25  // Histogram utilities
26  double GetMaxBinHeight(const TH1* hist);
27  TH1D* RebinHistogram(const TH1* hist, int group);
28  void DiffProfile2D(const TProfile2D* prof1, const TProfile2D* prof2, TH2D *hDiff);
29 
30  // Statistical functions
31  double ComputeAsymmetry(TH1* hist1, TH1* hist2);
32 
33  // Peak finding
34  std::vector<double> FindPeaksTSpectrum(TH1* hist, int npeaks=5);
35 
36  // Helper functions (not exposed to interpreter)
37  namespace Internal {
38  bool ValidateHistogram(const TH1* hist);
39  }
40 
41 }
42 
43 #endif
TCut cut
Definition: check_shower.C:6
float bin
Definition: emthickness.cpp:98
void hist()
Definition: init.C:23
bool ValidateHistogram(const TH1 *hist)
Definition: ERTools.cpp:165
Definition: ERTools.h:10
TH2D * get_h2_var(TTree *tree, const char *var1, const char *var2, const char *hname, double bin1, double bin2)
Definition: ERTools.cpp:126
TH1D * get_h_var(TTree *tree, const char *var, const char *hname, double bin, const char *cut)
Definition: ERTools.cpp:93
double ComputeAsymmetry(TH1 *hist1, TH1 *hist2)
std::vector< double > FindPeaksTSpectrum(TH1 *hist, int npeaks=5)
Definition: ERTools.cpp:154
double GetMaxBinHeight(const TH1 *hist)
Definition: ERTools.cpp:142
std::vector< PeakInfo > FindPeaksWithIntegral(TH1 *hist, int window_size, double threshold, int from_bin, int to_bin)
Definition: ERTools.cpp:9
TH1D * RebinHistogram(const TH1 *hist, int group)
Definition: ERTools.cpp:147
void DiffProfile2D(const TProfile2D *prof1, const TProfile2D *prof2, TH2D *hDiff)
Definition: ERTools.cpp:76
Definition: ERTools.h:12
int bin_id
Definition: ERTools.h:13
double window_rms
Definition: ERTools.h:18
double peak_height
Definition: ERTools.h:15
double window_integral
Definition: ERTools.h:16
double peak_position
Definition: ERTools.h:14
double window_mean
Definition: ERTools.h:17