1 | // |
---|
2 | // |
---|
3 | // Definition of classes |
---|
4 | // |
---|
5 | #ifndef _PLOTSCURVESALLDIFFFIT_H_ |
---|
6 | #define _PLOTSCURVESALLDIFFFIT_H_ |
---|
7 | |
---|
8 | #include <iostream> |
---|
9 | #include "TString.h" |
---|
10 | #include "PlotScurvesAll-diffFitConst.h" |
---|
11 | |
---|
12 | |
---|
13 | class TCanvas; |
---|
14 | class TH1D; |
---|
15 | class TF1; |
---|
16 | |
---|
17 | void PlotScurve( |
---|
18 | Int_t kDrawCh=31, |
---|
19 | TString fname=kFname, |
---|
20 | TString fname_ped=kFnamePed, //ASIC_D ped_file |
---|
21 | Double_t dac_half_spe_fix = -1, |
---|
22 | TString fname_gain="gain-org.txt", |
---|
23 | Int_t fit_min=kFitMin, |
---|
24 | Int_t fit_max=kFitMax, |
---|
25 | Int_t fit_min_scurve=kFitMinS, |
---|
26 | Int_t fit_max_scurve=kFitMaxS, |
---|
27 | Bool_t kBoard=0, //0:ASIC_C, 1:ASIC_D |
---|
28 | Int_t kChRef=kRefCh,//ASIC_C |
---|
29 | Bool_t checkAve=0 //0:use ref pix, 1:check average |
---|
30 | ); |
---|
31 | |
---|
32 | |
---|
33 | //------------------------------------------------------------- |
---|
34 | // Same work presented inside the analysis class |
---|
35 | // |
---|
36 | // |
---|
37 | //------------------------------------------------------------- |
---|
38 | |
---|
39 | class Analysis |
---|
40 | { |
---|
41 | public: |
---|
42 | |
---|
43 | Analysis(); // construtor to clean variables, and create object on the heap |
---|
44 | |
---|
45 | ~Analysis(); // destructor to clean object form the heap |
---|
46 | |
---|
47 | // Main analysis function to be called from outside |
---|
48 | |
---|
49 | void Menu(); |
---|
50 | void Help(); |
---|
51 | void PlotScurve( |
---|
52 | Int_t kDrawCh=31, |
---|
53 | TString fname=kFname, |
---|
54 | TString fname_ped=kFnamePed, //ASIC_D ped_file |
---|
55 | Double_t dac_half_spe_fix = -1, |
---|
56 | TString fname_gain="gain-org.txt", |
---|
57 | Int_t fit_min=kFitMin, |
---|
58 | Int_t fit_max=kFitMax, |
---|
59 | Int_t fit_min_scurve=kFitMinS, |
---|
60 | Int_t fit_max_scurve=kFitMaxS, |
---|
61 | Bool_t kBoard=0, //0:ASIC_C, 1:ASIC_D |
---|
62 | Int_t kChRef=kRefCh,//ASIC_C |
---|
63 | Bool_t checkAve=0 //0:use ref pix, 1:check average |
---|
64 | ); |
---|
65 | /* |
---|
66 | void PlotScurve( |
---|
67 | Int_t kDrawCh, |
---|
68 | TString fname, |
---|
69 | TString fname_ped, //ASIC_D ped_file |
---|
70 | Double_t dac_half_spe_fix, |
---|
71 | TString fname_gain, |
---|
72 | Int_t fit_min, |
---|
73 | Int_t fit_max, |
---|
74 | Int_t fit_min_scurve, |
---|
75 | Int_t fit_max_scurve, |
---|
76 | Bool_t kBoard, //0:ASIC_C, 1:ASIC_D |
---|
77 | Int_t kChRef,//ASIC_C |
---|
78 | Bool_t checkAve //0:use ref pix, 1:check average |
---|
79 | ); |
---|
80 | |
---|
81 | */ |
---|
82 | |
---|
83 | |
---|
84 | private: |
---|
85 | |
---|
86 | void Init(); |
---|
87 | void OpenGainFile(const TString); |
---|
88 | void FillHistoName(); |
---|
89 | void ReadGainFile(const TString,Bool_t); |
---|
90 | void ProcessSingleChannel( |
---|
91 | Int_t kDrawCh, |
---|
92 | TString fname, |
---|
93 | TString fname_ped, //ASIC_D ped_file |
---|
94 | Double_t dac_half_spe_fix, |
---|
95 | TString fname_gain, |
---|
96 | Int_t fit_min, |
---|
97 | Int_t fit_max, |
---|
98 | Int_t fit_min_scurve, |
---|
99 | Int_t fit_max_scurve, |
---|
100 | Bool_t kBoard, //0:ASIC_C, 1:ASIC_D |
---|
101 | Int_t kChRef//ASIC_C |
---|
102 | ); |
---|
103 | void ComputeDACAverage(Double_t dac_half_spe_fix ,Int_t kChRef,Bool_t checkAve); //0:use ref pix, 1:check average) |
---|
104 | void OutputGain(const TString fname_out); |
---|
105 | |
---|
106 | // common variables to the analysis |
---|
107 | TString *input; |
---|
108 | TString *input_ped; |
---|
109 | Int_t ch; // index on current channel under analysis |
---|
110 | Float_t dac_half_sum; |
---|
111 | Float_t dac_ped_sum; |
---|
112 | Float_t dac_spe_sum; |
---|
113 | Float_t dac_sfit_sum; |
---|
114 | Float_t diff_sum; |
---|
115 | Float_t mean_sum; |
---|
116 | Float_t maxBinSum; |
---|
117 | |
---|
118 | // output of the PlotScurve Analysis |
---|
119 | Double_t dac_half[kNch]; |
---|
120 | Double_t dac_ped[kNch]; |
---|
121 | Double_t dac_spe[kNch]; |
---|
122 | Double_t dac_sfit[kNch]; |
---|
123 | Double_t mean_diff[kNch]; |
---|
124 | Double_t gain_org[kNch]; // array containing the initial gain values |
---|
125 | Double_t sfit_chiS[kNch]; |
---|
126 | Double_t flag_fit[kNch]; |
---|
127 | |
---|
128 | //canvas pointers |
---|
129 | |
---|
130 | TCanvas *c1; //smoothed S-curves |
---|
131 | TCanvas *c2; //differentiated histograms of smoothed s-curves |
---|
132 | TCanvas *c5; |
---|
133 | TCanvas *c3; |
---|
134 | TCanvas *c4; |
---|
135 | |
---|
136 | //histograms |
---|
137 | |
---|
138 | TString name_hist[kNch]; |
---|
139 | TString name_hist_ped[kNch]; |
---|
140 | TString name_hist_diff[kNch]; |
---|
141 | TString name_hist_diff_fit[kNch]; |
---|
142 | TString name_fit_diff[kNch]; |
---|
143 | TH1D *hist_scurve; // smoothed S-curves |
---|
144 | TH1D *hist_scurve_ped; // S-curves for pedestal runs |
---|
145 | TH1D *hist_diff; // differentiated histograms of smoothed s-curves |
---|
146 | TH1D *hist_diff_fit; // differentiated histograms of fitted s-curves |
---|
147 | TF1 *fit_sdiff; // function fitted on differentiated histograms of fitted s-curves |
---|
148 | |
---|
149 | Int_t trigger; |
---|
150 | Int_t trigger_fit; |
---|
151 | Int_t trigger_mean; |
---|
152 | Int_t trigger_sfit; |
---|
153 | |
---|
154 | Float_t dac_ped_ave ; //absolute value |
---|
155 | Float_t dac_half_ave ; |
---|
156 | Float_t dac_spe_ave ; |
---|
157 | Float_t dac_sfit_ave; |
---|
158 | Float_t mean_diff_ave ;//dac_sfit of ch31 of ASIC_C with the 180 for lower gain pixels |
---|
159 | |
---|
160 | Double_t dac_half_spe; |
---|
161 | |
---|
162 | }; |
---|
163 | |
---|
164 | #endif |
---|
165 | |
---|
166 | //------------------------------------------------------------------------------------------------- |
---|
167 | // Configure (x)emacs for this file ... |
---|
168 | // Local Variables: |
---|
169 | // mode: c++ |
---|
170 | // compile-command: "(make;) " |
---|
171 | // End: |
---|