All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CrtCal.h
Go to the documentation of this file.
1 #ifndef CRT_CAL_H
2 #define CRT_CAL_H
3 
4 //c++ includes
5 #include <vector>
6 #include <map>
7 #include <string>
8 #include <climits>
9 
10 //ROOT includes
11 #include<TH1F.h>
12 #include <TTree.h>
13 #include <TFile.h>
14 #include <TCanvas.h>
15 #include <TStyle.h>
16 #include <TF1.h>
17 #include <TImage.h>
18 #include <TSystem.h>
19 #include <TSpectrum.h>
20 #include <TGraphErrors.h>
21 
22 namespace icarus {
23  namespace crt {
24  class CrtCal;
25  }
26 }
27 
28 using std::to_string;
29 using std::string;
30 using std::vector;
31 using std::map;
32 
34 
35  public:
36  //CrtCal(string runName);
37  CrtCal(const vector<TH1F*>* histos);
38  ~CrtCal();
39 
40  void Cal();
41  void PedCal();
42  void GainCal();
43  void GainFit(TH1F* h, size_t chan, float** statsarr, bool save);
44  void PedFit(TH1F* h, size_t chan, float* statsarr, bool save);
45  bool IsActive(TH1F*);
46 
47  void ParsePedStats(const float* statarr, float& pedXsqr, float& ped, float& pedErr,
48  float& pedNorm, float& pedNormErr, float& pedSigma, float& pedSigmaErr,
49  short& pedNdf);
50 
51  void ParseGainStats(float** statarr, float& gainXsqr, short& gainNdf, float& gain, float& gainErr,
52  float& gainPed, float& gainPedErr, short& nPeak, float* peakXsqr,
53  float* peakMean, float* peakMeanErr, float* peakNorm, float* peakNormErr,
54  float* peakSigma, float* peakSigmaErr,short* peakNdf);
55 
56  int FindThreshADC(TH1F* h);
57  float FindThreshPE(TH1F* h);
58  int FindNabove(TH1F *h, int thresh);
59 
60  bool* GetActive() const;
61  float* GetPed() const;
62  float* GetPedErr() const;
63  float* GetPedXsqr() const;
64  short* GetPedNdf() const;
65  float* GetPedNorm() const;
66  float* GetPedNormErr() const;
67  float* GetPedSigma() const;
68  float* GetPedSigmaErr() const;
69  float* GetGain() const;
70  float* GetGainErr() const;
71  float* GetGainXsqr() const;
72  short* GetGainNdf() const;
73  float* GetGainPed() const;
74  float* GetGainPedErr () const;
75  short* GetNpeak() const;
76  int* GetThreshADC() const;
77  float* GetThreshPE() const;
78  int* GetNabove() const;
79  float** GetPeakNorm() const;
80  float** GetPeakNormErr() const;
81  float** GetPeakSigma() const;
82  float** GetPeakSigmaErr() const;
83  float** GetPeakMean() const;
84  float** GetPeakMeanErr() const;
85  float** GetPeakXsqr() const;
86  short** GetPeakNdf() const;
87  long* GetChanStats() const;
88 
89  double* GetLangausWidth() const;
90  double* GetLangausWidthErr() const;
91  double* GetLangausLandauMP() const;
92  double* GetLangausLandauMPErr() const;
93  double* GetLangausArea() const;
94  double* GetLangausAreaErr() const;
95  double* GetLangausGaussSigma() const;
96  double* GetLangausGaussSigmaErr() const;
97  double* GetLangausXsqr() const;
98  double* GetLangausNdf() const;
99 
100 
101  private:
102  void IndexToMacChan();
103 
104  const vector<TH1F*>* fHistos;
105  //string fRunName;
106  //string fOutDir;
107  map<uint8_t,uint8_t> fChanMap;
108 
113 
114  uint8_t fMac5;
115  bool* fActive;
116  float* fGain;
117  float* fGainErr;
118  float* fGainXsqr;
119  short* fGainNdf;
120  float* fGainPed;
121  float* fGainPedErr;
122  short* fNpeak;
123  float** fPeakNorm;
124  float** fPeakNormErr;
125  float** fPeakSigma;
126  float** fPeakSigmaErr;
127  float** fPeakMean;
128  float** fPeakMeanErr;
129  float** fPeakXsqr;
130  short** fPeakNdf;
131  float* fPed;
132  float* fPedErr;
133  float* fPedXsqr;
134  short* fPedNdf;
135  float* fPedSigma;
136  float* fPedSigmaErr;
137  float* fPedNorm;
138  float* fPedNormErr;
140  float* fThreshPE;
141  int* fNabove;
142  long* fChanStats;
143 
144  double* fLangausWidth;
148  double* fLangausArea;
152  double* fLangausXsqr;
153  double* fLangausNdf;
154 
155 
156  TF1 *langaufit(TH1F *his, Double_t *fitrange, Double_t *startvalues, Double_t *parlimitslo, Double_t *parlimitshi, Double_t *fitparams, Double_t *fiterrors, Double_t *ChiSqr, Int_t *NDF);
157  void langaus_fit(TH1F* h, double& lang_lan_wid, double& lang_lan_wid_err, double& lang_lan_mp, double& lang_lan_mp_err, double& lang_area, double& lang_area_err, double& lang_gauss_sigma, double& lang_gauss_sigma_err, double& lang_chisq, double& lang_ndf);
158 
159 
160 
161 };
162 
163 #endif
164 
short * fPedNdf
Definition: CrtCal.h:134
double * GetLangausNdf() const
Definition: CrtCal.cc:1191
float * GetPedXsqr() const
Definition: CrtCal.cc:986
CrtCal(const vector< TH1F * > *histos)
Definition: CrtCal.cc:8
float * fPedSigma
Definition: CrtCal.h:135
map< uint8_t, uint8_t > fChanMap
Definition: CrtCal.h:107
int * GetNabove() const
Definition: CrtCal.cc:1077
long * GetChanStats() const
Definition: CrtCal.cc:1083
double * fLangausGaussSigma
Definition: CrtCal.h:150
float ** fPeakNorm
Definition: CrtCal.h:123
void ParseGainStats(float **statarr, float &gainXsqr, short &gainNdf, float &gain, float &gainErr, float &gainPed, float &gainPedErr, short &nPeak, float *peakXsqr, float *peakMean, float *peakMeanErr, float *peakNorm, float *peakNormErr, float *peakSigma, float *peakSigmaErr, short *peakNdf)
Definition: CrtCal.cc:808
float * fPedNormErr
Definition: CrtCal.h:138
void PedFit(TH1F *h, size_t chan, float *statsarr, bool save)
Definition: CrtCal.cc:336
double * fLangausWidthErr
Definition: CrtCal.h:145
TF1 * langaufit(TH1F *his, Double_t *fitrange, Double_t *startvalues, Double_t *parlimitslo, Double_t *parlimitshi, Double_t *fitparams, Double_t *fiterrors, Double_t *ChiSqr, Int_t *NDF)
Definition: CrtCal.cc:891
double * fLangausWidth
Definition: CrtCal.h:144
float ** fPeakSigmaErr
Definition: CrtCal.h:126
double * fLangausArea
Definition: CrtCal.h:148
double * GetLangausWidthErr() const
Definition: CrtCal.cc:1161
double * fLangausLandauMP
Definition: CrtCal.h:146
float * fThreshPE
Definition: CrtCal.h:140
void GainFit(TH1F *h, size_t chan, float **statsarr, bool save)
Definition: CrtCal.cc:453
short * GetPedNdf() const
Definition: CrtCal.cc:992
double * GetLangausGaussSigmaErr() const
Definition: CrtCal.cc:1179
float * GetPed() const
Definition: CrtCal.cc:972
double * GetLangausLandauMPErr() const
Definition: CrtCal.cc:1167
double * fLangausLandauMPErr
Definition: CrtCal.h:147
float ** GetPeakSigmaErr() const
Definition: CrtCal.cc:1107
while getopts h
float * fGainErr
Definition: CrtCal.h:117
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
long * fChanStats
Definition: CrtCal.h:142
float * GetPedNormErr() const
Definition: CrtCal.cc:1004
double * GetLangausArea() const
Definition: CrtCal.cc:1149
float FindThreshPE(TH1F *h)
float * fPedSigmaErr
Definition: CrtCal.h:136
float ** GetPeakNorm() const
Definition: CrtCal.cc:1089
float * GetGainPed() const
Definition: CrtCal.cc:1047
float ** fPeakMeanErr
Definition: CrtCal.h:128
float ** GetPeakMean() const
Definition: CrtCal.cc:1113
float * fGainXsqr
Definition: CrtCal.h:118
float * fPedNorm
Definition: CrtCal.h:137
float ** GetPeakXsqr() const
Definition: CrtCal.cc:1125
float ** fPeakSigma
Definition: CrtCal.h:125
short ** fPeakNdf
Definition: CrtCal.h:130
short * fGainNdf
Definition: CrtCal.h:119
float * GetGainErr() const
Definition: CrtCal.cc:1028
float * fPedXsqr
Definition: CrtCal.h:133
double * fLangausAreaErr
Definition: CrtCal.h:149
const vector< TH1F * > * fHistos
Definition: CrtCal.h:104
float ** fPeakMean
Definition: CrtCal.h:127
double * GetLangausWidth() const
Definition: CrtCal.cc:1137
bool IsActive(TH1F *)
Definition: CrtCal.cc:240
float * GetThreshPE() const
Definition: CrtCal.cc:1071
int FindNabove(TH1F *h, int thresh)
Definition: CrtCal.cc:265
double * GetLangausLandauMP() const
Definition: CrtCal.cc:1143
int * GetThreshADC() const
Definition: CrtCal.cc:1065
float * GetPedSigma() const
Definition: CrtCal.cc:1010
double * fLangausNdf
Definition: CrtCal.h:153
float * GetPedErr() const
Definition: CrtCal.cc:979
void ParsePedStats(const float *statarr, float &pedXsqr, float &ped, float &pedErr, float &pedNorm, float &pedNormErr, float &pedSigma, float &pedSigmaErr, short &pedNdf)
Definition: CrtCal.cc:792
float * GetGain() const
Definition: CrtCal.cc:1022
float * fPedErr
Definition: CrtCal.h:132
double * GetLangausXsqr() const
Definition: CrtCal.cc:1185
float * GetPedSigmaErr() const
Definition: CrtCal.cc:1016
float * fGainPedErr
Definition: CrtCal.h:121
void IndexToMacChan()
Definition: CrtCal.cc:181
double * fLangausGaussSigmaErr
Definition: CrtCal.h:151
float ** fPeakXsqr
Definition: CrtCal.h:129
std::string to_string(WindowPattern const &pattern)
int FindThreshADC(TH1F *h)
Definition: CrtCal.cc:253
float ** GetPeakMeanErr() const
Definition: CrtCal.cc:1119
float * fGainPed
Definition: CrtCal.h:120
double * GetLangausAreaErr() const
Definition: CrtCal.cc:1173
float * GetPedNorm() const
Definition: CrtCal.cc:998
void langaus_fit(TH1F *h, double &lang_lan_wid, double &lang_lan_wid_err, double &lang_lan_mp, double &lang_lan_mp_err, double &lang_area, double &lang_area_err, double &lang_gauss_sigma, double &lang_gauss_sigma_err, double &lang_chisq, double &lang_ndf)
Definition: CrtCal.cc:939
short * GetGainNdf() const
Definition: CrtCal.cc:1040
float * GetGainPedErr() const
Definition: CrtCal.cc:1053
float ** GetPeakNormErr() const
Definition: CrtCal.cc:1095
process_name crt
float ** GetPeakSigma() const
Definition: CrtCal.cc:1101
short ** GetPeakNdf() const
Definition: CrtCal.cc:1131
float ** fPeakNormErr
Definition: CrtCal.h:124
bool * GetActive() const
Definition: CrtCal.cc:965
short * GetNpeak() const
Definition: CrtCal.cc:1059
short * fNpeak
Definition: CrtCal.h:122
double * fLangausXsqr
Definition: CrtCal.h:152
float * GetGainXsqr() const
Definition: CrtCal.cc:1034
double * GetLangausGaussSigma() const
Definition: CrtCal.cc:1155