1 | #include "pixelsum.h" // class implemented
|
---|
2 | using namespace std;
|
---|
3 |
|
---|
4 | /////////////////////////////// PUBLIC ///////////////////////////////////////
|
---|
5 |
|
---|
6 | //============================= LIFECYCLE ====================================
|
---|
7 |
|
---|
8 |
|
---|
9 | PixelSum::PixelSum(
|
---|
10 | TString pixelname,
|
---|
11 | int pixelID,
|
---|
12 | int maxPulsorder,
|
---|
13 | int verbosityLevel,
|
---|
14 | bool stats,
|
---|
15 | TString options,
|
---|
16 | int pixelOverlayXaxisLeft,
|
---|
17 | int pixelOverlayXaxisRight,
|
---|
18 | float bSLMean,
|
---|
19 | float gainMean,
|
---|
20 | TFile* filename
|
---|
21 | )
|
---|
22 | :Pixel(
|
---|
23 | pixelID,
|
---|
24 | maxPulsorder,
|
---|
25 | verbosityLevel,
|
---|
26 | stats,
|
---|
27 | options,
|
---|
28 | pixelOverlayXaxisLeft,
|
---|
29 | pixelOverlayXaxisRight,
|
---|
30 | bSLMean,
|
---|
31 | gainMean,
|
---|
32 | filename
|
---|
33 | )
|
---|
34 | {
|
---|
35 | mName = pixelname;
|
---|
36 |
|
---|
37 | mhMaxByChid = new TH2F*[mMaxPulseOrder];
|
---|
38 | mhMeanByChid = new TH2F*[mMaxPulseOrder];
|
---|
39 | mhMedianByChid = new TH2F*[mMaxPulseOrder];
|
---|
40 |
|
---|
41 | mhDistAmplitude = new TH1F*[mMaxPulseOrder];
|
---|
42 | mhDistSlopeRiseEdge = new TH1F*[mMaxPulseOrder];
|
---|
43 | mhDistSlopeFallEdge = new TH1F*[mMaxPulseOrder];
|
---|
44 |
|
---|
45 | BookSumHistos();
|
---|
46 | // BookSumDistributionHistos();
|
---|
47 | }
|
---|
48 |
|
---|
49 | PixelSum::~PixelSum()
|
---|
50 | {
|
---|
51 | if (mVerbosityLevel > 1)
|
---|
52 | {
|
---|
53 | cout << endl << "...deleting histograms of "
|
---|
54 | << mName << " ID: "<< mChid ;
|
---|
55 | cout << endl << "...mConstructorType = " << mConstructorType << endl;
|
---|
56 | }
|
---|
57 |
|
---|
58 | DeleteSumHistos();
|
---|
59 | // DeleteSumDistributionHistos();
|
---|
60 |
|
---|
61 | if (mVerbosityLevel > 1)
|
---|
62 | {
|
---|
63 | cout << endl << "...histograms of "
|
---|
64 | << mName << " ID: "<< mChid << " deleted";
|
---|
65 | }
|
---|
66 |
|
---|
67 | }// ~PixelSum
|
---|
68 |
|
---|
69 |
|
---|
70 | //============================= OPERATORS ====================================
|
---|
71 |
|
---|
72 | //XX&
|
---|
73 | //XX::operator=(const XX&);
|
---|
74 | //{
|
---|
75 | // return *this;
|
---|
76 |
|
---|
77 | //}// =
|
---|
78 |
|
---|
79 | //============================= OPERATIONS ===================================
|
---|
80 |
|
---|
81 | //============================= ACESS ===================================
|
---|
82 | //============================= INQUIRY ===================================
|
---|
83 | /////////////////////////////// PROTECTED ///////////////////////////////////
|
---|
84 |
|
---|
85 | /////////////////////////////// PRIVATE ///////////////////////////////////
|
---|
86 | void
|
---|
87 | PixelSum::BookSumHistos()
|
---|
88 | {
|
---|
89 | if (mVerbosityLevel > 2) cout << endl << "...book " << mName << " histograms" << endl;
|
---|
90 | for (int order = 0; order < mMaxPulseOrder; order++)
|
---|
91 | {
|
---|
92 | //mhMaxByChid
|
---|
93 | //----------------------------------------
|
---|
94 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("mhMaxByChid", order) << endl;
|
---|
95 | mhMaxByChid[order]=new TH2F();
|
---|
96 |
|
---|
97 | MakeTH2Pretty(
|
---|
98 | mhMaxByChid[order],
|
---|
99 | "mhMaxByChid",
|
---|
100 | "Distribution of Templates extracted with Max",
|
---|
101 | order
|
---|
102 | );
|
---|
103 |
|
---|
104 | hList->Add( mhMaxByChid[order] );
|
---|
105 | //----------------------------------------
|
---|
106 |
|
---|
107 | //mhMeanByChid
|
---|
108 | //----------------------------------------
|
---|
109 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("mhMeanByChid", order) << endl;
|
---|
110 | mhMeanByChid[order]=new TH2F();
|
---|
111 |
|
---|
112 | MakeTH2Pretty(
|
---|
113 | mhMeanByChid[order],
|
---|
114 | "mhMeanByChid",
|
---|
115 | "Distribution of Templates extracted with Mean",
|
---|
116 | order
|
---|
117 | );
|
---|
118 |
|
---|
119 | hList->Add( mhMeanByChid[order] );
|
---|
120 | //----------------------------------------
|
---|
121 |
|
---|
122 | //mhMedianByChid
|
---|
123 | //----------------------------------------
|
---|
124 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("mhMedianByChid", order) << endl;
|
---|
125 | mhMedianByChid[order]=new TH2F();
|
---|
126 |
|
---|
127 | MakeTH2Pretty(
|
---|
128 | mhMedianByChid[order],
|
---|
129 | "mhMedianByChid",
|
---|
130 | "Distribution of Templates extracted with Median",
|
---|
131 | order
|
---|
132 | );
|
---|
133 |
|
---|
134 | hList->Add( mhMedianByChid[order] );
|
---|
135 | //----------------------------------------
|
---|
136 | }
|
---|
137 | if (mVerbosityLevel > 2) cout << "...done" << endl;
|
---|
138 | }
|
---|
139 | // end of BookHistos
|
---|
140 | //----------------------------------------------------------------------------
|
---|
141 |
|
---|
142 | void
|
---|
143 | PixelSum::BookSumDistributionHistos()
|
---|
144 | {
|
---|
145 | if (mVerbosityLevel > 2) cout << endl
|
---|
146 | << "...book pixelsum distibution histograms" << endl;
|
---|
147 | for (int order = 0; order < mMaxPulseOrder; order++)
|
---|
148 | {
|
---|
149 | //mhDistAmplitude
|
---|
150 | //----------------------------------------
|
---|
151 | if (mVerbosityLevel > 3) cout << "\t...booking "
|
---|
152 | << HistoName("mhDistAmplitude", order) << endl;
|
---|
153 | mhDistAmplitude[order]=new TH1F();
|
---|
154 |
|
---|
155 | MakeTH1Pretty(
|
---|
156 | mhDistAmplitude[order],
|
---|
157 | "mhDistAmplitude",
|
---|
158 | "Distribution of Templates extracted with Max",
|
---|
159 | order
|
---|
160 | );
|
---|
161 |
|
---|
162 | hList->Add( mhDistAmplitude[order] );
|
---|
163 | //----------------------------------------
|
---|
164 |
|
---|
165 | //mhDistSlopeRiseEdge
|
---|
166 | //----------------------------------------
|
---|
167 | if (mVerbosityLevel > 3) cout << "\t...booking "
|
---|
168 | << HistoName("mhDistSlopeRiseEdge", order) << endl;
|
---|
169 | mhDistSlopeRiseEdge[order]=new TH1F();
|
---|
170 |
|
---|
171 | MakeTH1Pretty(
|
---|
172 | mhDistSlopeRiseEdge[order],
|
---|
173 | "mhDistSlopeRiseEdge",
|
---|
174 | "Distribution of Templates extracted with Max",
|
---|
175 | order
|
---|
176 | );
|
---|
177 |
|
---|
178 | hList->Add( mhDistSlopeRiseEdge[order] );
|
---|
179 | //----------------------------------------
|
---|
180 |
|
---|
181 | //mhDistSlopeFallEdge
|
---|
182 | //----------------------------------------
|
---|
183 | if (mVerbosityLevel > 3) cout << "\t...booking "
|
---|
184 | << HistoName("mhDistSlopeFallEdge", order) << endl;
|
---|
185 | mhDistSlopeFallEdge[order]=new TH1F();
|
---|
186 |
|
---|
187 | MakeTH1Pretty(
|
---|
188 | mhDistSlopeFallEdge[order],
|
---|
189 | "mhDistSlopeFallEdge",
|
---|
190 | "Distribution of Templates extracted with Max",
|
---|
191 | order
|
---|
192 | );
|
---|
193 |
|
---|
194 | hList->Add( mhDistSlopeFallEdge[order] );
|
---|
195 | //----------------------------------------
|
---|
196 |
|
---|
197 | }
|
---|
198 | if (mVerbosityLevel > 2) cout << "...done" << endl;
|
---|
199 | }
|
---|
200 | // end of BookDistributionHistos
|
---|
201 | //----------------------------------------------------------------------------
|
---|
202 |
|
---|
203 | void
|
---|
204 | PixelSum::DeleteSumHistos()
|
---|
205 | {
|
---|
206 | if (mVerbosityLevel > 2)
|
---|
207 | {
|
---|
208 | cout << endl
|
---|
209 | << "\t...delete current overlay histograms of Pixel# " << mChid;
|
---|
210 | }
|
---|
211 | for (int order = 0;
|
---|
212 | order < mMaxPulseOrder;
|
---|
213 | order ++)
|
---|
214 | {
|
---|
215 | if (mVerbosityLevel > 3)
|
---|
216 | cout << endl << "\t\t...deleting mhMaxByChid"
|
---|
217 | << mChid << "_" << order;
|
---|
218 |
|
---|
219 | delete mhMaxByChid[order];
|
---|
220 | mhMaxByChid[order] = NULL;
|
---|
221 |
|
---|
222 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMeanByChid"
|
---|
223 | << mChid << "_" << order ;
|
---|
224 | delete mhMeanByChid[order];
|
---|
225 | mhMeanByChid[order] = NULL;
|
---|
226 |
|
---|
227 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMedianByChid"
|
---|
228 | << mChid << "_" << order ;
|
---|
229 | delete mhMedianByChid[order];
|
---|
230 | mhMedianByChid[order] = NULL;
|
---|
231 | }
|
---|
232 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
|
---|
233 |
|
---|
234 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMaxByChid";
|
---|
235 | delete[] mhMaxByChid;
|
---|
236 | mhMaxByChid = NULL;
|
---|
237 |
|
---|
238 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMeanByChid";
|
---|
239 | delete[] mhMeanByChid;
|
---|
240 | mhMeanByChid = NULL;
|
---|
241 |
|
---|
242 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting mhMedianByChid";
|
---|
243 | delete[] mhMedianByChid;
|
---|
244 | mhMedianByChid = NULL;
|
---|
245 | }
|
---|
246 | // end of DeletePixelHistos
|
---|
247 | //----------------------------------------------------------------------------
|
---|
248 |
|
---|
249 | void
|
---|
250 | PixelSum::DeleteSumDistributionHistos()
|
---|
251 | {
|
---|
252 | if (mVerbosityLevel > 2)
|
---|
253 | {
|
---|
254 | cout << endl
|
---|
255 | << "\t...delete current distribution histograms" ;
|
---|
256 | }
|
---|
257 |
|
---|
258 | for (int order = 0;
|
---|
259 | order < mMaxPulseOrder;
|
---|
260 | order ++)
|
---|
261 | {
|
---|
262 | if (mOptions.Contains("S"))
|
---|
263 | {
|
---|
264 | if (mVerbosityLevel > 3) cout << endl
|
---|
265 | << "\t\t...deleting mhDistAmplitude"
|
---|
266 | << mChid << "_" << order ;
|
---|
267 | delete mhDistAmplitude[order];
|
---|
268 | }
|
---|
269 |
|
---|
270 | if (mOptions.Contains("R"))
|
---|
271 | {
|
---|
272 | if (mVerbosityLevel > 3) cout << endl
|
---|
273 | << "\t\t...deleting mhDistSlopeRiseEdge"
|
---|
274 | << mChid << "_" << order ;
|
---|
275 | delete mhDistSlopeRiseEdge[order];
|
---|
276 | }
|
---|
277 |
|
---|
278 | if (mOptions.Contains("M"))
|
---|
279 | {
|
---|
280 | if (mVerbosityLevel > 3) cout << endl
|
---|
281 | << "\t\t...deleting mhDistSlopeFallEdge"
|
---|
282 | << mChid << "_" << order ;
|
---|
283 |
|
---|
284 | delete mhDistSlopeFallEdge[order];
|
---|
285 | }
|
---|
286 |
|
---|
287 | }
|
---|
288 |
|
---|
289 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
|
---|
290 |
|
---|
291 | if (mOptions.Contains("S"))
|
---|
292 | {
|
---|
293 | if (mVerbosityLevel > 3)
|
---|
294 | cout << endl << "\t\t...deleting mhDistAmplitude";
|
---|
295 | delete[] mhDistAmplitude;
|
---|
296 | mhDistAmplitude = NULL;
|
---|
297 | }
|
---|
298 |
|
---|
299 | if (mOptions.Contains("R"))
|
---|
300 | {
|
---|
301 | if (mVerbosityLevel > 3)
|
---|
302 | cout << endl << "\t\t...deleting mhDistSlopeRiseEdge";
|
---|
303 | delete[] mhDistSlopeRiseEdge;
|
---|
304 | mhDistSlopeRiseEdge = NULL;
|
---|
305 | }
|
---|
306 |
|
---|
307 | if (mOptions.Contains("M"))
|
---|
308 | {
|
---|
309 | if (mVerbosityLevel > 3)
|
---|
310 | cout << endl << "\t\t...deleting mhDistSlopeFallEdge";
|
---|
311 | delete[] mhDistSlopeFallEdge;
|
---|
312 | mhDistSlopeFallEdge = NULL;
|
---|
313 | }
|
---|
314 | }
|
---|
315 | // end of DeletePixelHistos
|
---|
316 | //----------------------------------------------------------------------------
|
---|
317 |
|
---|
318 | TString
|
---|
319 | PixelSum::CsvFileName(
|
---|
320 | TString path,
|
---|
321 | TString overlayMethod,
|
---|
322 | int order
|
---|
323 | )
|
---|
324 | {
|
---|
325 | path += "CSV/";
|
---|
326 | path += overlayMethod;
|
---|
327 | path += "OverlayTemplate";
|
---|
328 | path += "_";
|
---|
329 | path += mName;
|
---|
330 | path += "_";
|
---|
331 | path += mChid;
|
---|
332 | path += "_";
|
---|
333 | path += order;
|
---|
334 | path += ".csv";
|
---|
335 | return path;
|
---|
336 | }
|
---|
337 | // end of CsvFileName
|
---|
338 | //----------------------------------------------------------------------------
|
---|
339 |
|
---|