1 | #include <iostream>
|
---|
2 | #include "TObjArray.h"
|
---|
3 | #include "TCanvas.h"
|
---|
4 |
|
---|
5 | #include "rootfilehandler.h"
|
---|
6 | #include "pixel.h" // class implemented
|
---|
7 | using namespace std;
|
---|
8 |
|
---|
9 | /////////////////////////////// PUBLIC ///////////////////////////////////////
|
---|
10 |
|
---|
11 | //============================= LIFECYCLE ====================================
|
---|
12 |
|
---|
13 | Pixel::Pixel(
|
---|
14 | int pixelID,
|
---|
15 | int maxPulsorder,
|
---|
16 | int verbosityLevel,
|
---|
17 | bool stats,
|
---|
18 | TFile* filename
|
---|
19 | )
|
---|
20 | {
|
---|
21 | mConstructorType = 1;
|
---|
22 | mChid = pixelID;
|
---|
23 | mStats = stats;
|
---|
24 | mMaxPulseOrder = maxPulsorder;
|
---|
25 | mVerbosityLevel = verbosityLevel;
|
---|
26 | mRootFile = filename;
|
---|
27 |
|
---|
28 | hMaxOverlay = new TH2F*[mMaxPulseOrder];
|
---|
29 | hEdgeOverlay = new TH2F*[mMaxPulseOrder];
|
---|
30 | hMaxProfile = new TProfile*[mMaxPulseOrder];
|
---|
31 | hEdgeProfile = new TProfile*[mMaxPulseOrder];
|
---|
32 |
|
---|
33 | hPixelMax = new TH1F*[mMaxPulseOrder];
|
---|
34 | hPixelMedian = new TH1F*[mMaxPulseOrder];
|
---|
35 | hPixelMean = new TH1F*[mMaxPulseOrder];
|
---|
36 |
|
---|
37 | hList = new TObjArray;
|
---|
38 |
|
---|
39 | LoadPulseHistos( );
|
---|
40 | BookTemplateHistos();
|
---|
41 | }
|
---|
42 |
|
---|
43 | Pixel::Pixel(
|
---|
44 | int pixelID,
|
---|
45 | int maxPulsorder,
|
---|
46 | int verbosityLevel,
|
---|
47 | bool stats,
|
---|
48 | TFile* filename,
|
---|
49 | int pixelOverlayXaxisLeft,
|
---|
50 | int pixelOverlayXaxisRight,
|
---|
51 | int bSLMean,
|
---|
52 | int gainMean,
|
---|
53 | TString options
|
---|
54 | )
|
---|
55 | {
|
---|
56 | mConstructorType = 0;
|
---|
57 | mChid = pixelID;
|
---|
58 | mStats = stats; ///TODO: HANDOVER THE VALUE
|
---|
59 | mMaxPulseOrder = maxPulsorder;
|
---|
60 | mVerbosityLevel = verbosityLevel;
|
---|
61 | mOptions = options;
|
---|
62 | mPixelOverlayXaxisLeft = pixelOverlayXaxisLeft;
|
---|
63 | mPixelOverlayXaxisRight = pixelOverlayXaxisRight;
|
---|
64 | mBSLMean = bSLMean;
|
---|
65 | mGainMean = gainMean;
|
---|
66 | mRootFile = filename;
|
---|
67 |
|
---|
68 | hMaxOverlay = new TH2F*[mMaxPulseOrder];
|
---|
69 | hEdgeOverlay = new TH2F*[mMaxPulseOrder];
|
---|
70 | hMaxProfile = new TProfile*[mMaxPulseOrder];
|
---|
71 | hEdgeProfile = new TProfile*[mMaxPulseOrder];
|
---|
72 |
|
---|
73 | if (mOptions.Contains("S") )
|
---|
74 | {
|
---|
75 | hSlopeRisingEdge = new TH1F*[mMaxPulseOrder];
|
---|
76 | }
|
---|
77 |
|
---|
78 | if (mOptions.Contains("R") )
|
---|
79 | {
|
---|
80 | hRisingEdgeToMax = new TH1I*[mMaxPulseOrder];
|
---|
81 | }
|
---|
82 |
|
---|
83 | if (mOptions.Contains("M") )
|
---|
84 | {
|
---|
85 | hPosOfMax = new TH1I*[mMaxPulseOrder];
|
---|
86 | }
|
---|
87 |
|
---|
88 | hList = new TObjArray;
|
---|
89 |
|
---|
90 | BookPixelHistos();
|
---|
91 | BookDistributionHistos();
|
---|
92 | }
|
---|
93 |
|
---|
94 | Pixel::~Pixel()
|
---|
95 | {
|
---|
96 | if (mVerbosityLevel > 1) cout << endl << "...delete histograms of pixel " << mChid ;
|
---|
97 |
|
---|
98 | DeletePixelHistos();
|
---|
99 | if (mConstructorType == 0)
|
---|
100 | {
|
---|
101 | DeleteDistributionHistos();
|
---|
102 | }
|
---|
103 |
|
---|
104 | if (mConstructorType == 1)
|
---|
105 | {
|
---|
106 | DeleteTemplateHistos();
|
---|
107 | }
|
---|
108 | delete hList;
|
---|
109 | hList = NULL;
|
---|
110 |
|
---|
111 | }// ~Pixel
|
---|
112 |
|
---|
113 |
|
---|
114 | //============================= OPERATORS ====================================
|
---|
115 |
|
---|
116 | //XX&
|
---|
117 | //XX::operator=(const XX&);
|
---|
118 | //{
|
---|
119 | // return *this;
|
---|
120 |
|
---|
121 | //}// =
|
---|
122 |
|
---|
123 | //============================= OPERATIONS ===================================
|
---|
124 | void
|
---|
125 | Pixel::BookPixelHistos()
|
---|
126 | {
|
---|
127 | if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
|
---|
128 | for (int order = 0; order < mMaxPulseOrder; order++)
|
---|
129 | {
|
---|
130 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxOverlay", order) << endl;
|
---|
131 | hMaxOverlay[order]=new TH2F(
|
---|
132 | HistoName("hMaxOverlay", order),
|
---|
133 | HistoTitle("Overlay at peak maximum of detected pulses of", order),
|
---|
134 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
|
---|
135 | (-1*mPixelOverlayXaxisLeft)-0.5,
|
---|
136 | mPixelOverlayXaxisRight-0.5 ,
|
---|
137 | 512,
|
---|
138 | -55.5,
|
---|
139 | 200.5
|
---|
140 | );
|
---|
141 |
|
---|
142 | hMaxOverlay[order]->SetAxisRange(
|
---|
143 | mBSLMean - 5,
|
---|
144 | (mGainMean*(order+1)) + 10,
|
---|
145 | "Y");
|
---|
146 | hMaxOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
147 | hMaxOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
148 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
---|
149 | hMaxOverlay[order]->SetStats(mStats);
|
---|
150 | hList->Add( hMaxOverlay[order] );
|
---|
151 |
|
---|
152 | //------------------------------------------------------------------------
|
---|
153 |
|
---|
154 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeOverlay", order) << endl;
|
---|
155 | hEdgeOverlay[order] = new TH2F(
|
---|
156 | HistoName("hEdgeOverlay", order),
|
---|
157 | HistoTitle("Overlay at rising edge of detected pulses of", order),
|
---|
158 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
|
---|
159 | (-1*mPixelOverlayXaxisLeft)-0.5,
|
---|
160 | mPixelOverlayXaxisRight-0.5 ,
|
---|
161 | 512,
|
---|
162 | -55.5,
|
---|
163 | 200.5
|
---|
164 | );
|
---|
165 |
|
---|
166 | hEdgeOverlay[order]->SetAxisRange(
|
---|
167 | mBSLMean - 5,
|
---|
168 | (mGainMean*(order+1)) + 10,
|
---|
169 | "Y");
|
---|
170 | hEdgeOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
171 | hEdgeOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
172 | hEdgeOverlay[order]->SetStats(mStats);
|
---|
173 | hList->Add( hEdgeOverlay[order] );
|
---|
174 |
|
---|
175 | //------------------------------------------------------------------------
|
---|
176 |
|
---|
177 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxProfile", order) << endl;
|
---|
178 | hMaxProfile[order] = new TProfile(
|
---|
179 | HistoName("hMaxProfile", order),
|
---|
180 | HistoTitle("Mean value of each slice in overlay plot (Tprofile)", order),
|
---|
181 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
|
---|
182 | (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
|
---|
183 | mPixelOverlayXaxisRight-0.5 , //xup
|
---|
184 | // 512, //nbinsy
|
---|
185 | -55.5, //ylow
|
---|
186 | 300.5, //yup
|
---|
187 | "s"); //option
|
---|
188 | hMaxProfile[order]->SetAxisRange(
|
---|
189 | mBSLMean - 5,
|
---|
190 | (mGainMean*(order+1)) + 10,
|
---|
191 | "Y");
|
---|
192 | hMaxProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
193 | hMaxProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
194 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
---|
195 | hMaxProfile[order]->SetStats(mStats);
|
---|
196 | hList->Add( hMaxProfile[order] );
|
---|
197 |
|
---|
198 |
|
---|
199 | //------------------------------------------------------------------------
|
---|
200 |
|
---|
201 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeProfile", order) << endl;
|
---|
202 | hEdgeProfile[order] = new TProfile(
|
---|
203 | HistoName("hEdgeProfile", order),
|
---|
204 | HistoTitle("Mean value of each slice in overlay plot (Tprofile)", order),
|
---|
205 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
|
---|
206 | (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
|
---|
207 | mPixelOverlayXaxisRight-0.5 , //xup
|
---|
208 | // 512, //nbinsy
|
---|
209 | -55.5, //ylow
|
---|
210 | 300.5, //yup
|
---|
211 | "s"); //option
|
---|
212 | hEdgeProfile[order]->SetLineColor(kRed);
|
---|
213 | hEdgeProfile[order]->SetAxisRange(
|
---|
214 | mBSLMean - 5,
|
---|
215 | (mGainMean*(order+1)) + 10,
|
---|
216 | "Y");
|
---|
217 | hEdgeProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
218 | hEdgeProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
219 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
---|
220 | hEdgeProfile[order]->SetStats(mStats);
|
---|
221 | hList->Add( hEdgeProfile[order] );
|
---|
222 |
|
---|
223 | }
|
---|
224 | if (mVerbosityLevel > 2) cout << "...done" << endl;
|
---|
225 | }
|
---|
226 | //end of BookPixelHistos
|
---|
227 | //----------------------------------------------------------------------------
|
---|
228 |
|
---|
229 |
|
---|
230 | void
|
---|
231 | Pixel::DrawHistograms(
|
---|
232 | TCanvas** pixelCanvas,
|
---|
233 | int* histoFrameNr
|
---|
234 | )
|
---|
235 | {
|
---|
236 | if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;
|
---|
237 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
|
---|
238 | {
|
---|
239 | pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
|
---|
240 | hMaxOverlay[pulse_order]->Draw("COLZ");
|
---|
241 | pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
|
---|
242 | hMaxProfile[pulse_order]->Draw();
|
---|
243 | hEdgeProfile[pulse_order]->Draw("SAME");
|
---|
244 |
|
---|
245 | pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
|
---|
246 | hEdgeOverlay[pulse_order]->Draw("COLZ");
|
---|
247 | }
|
---|
248 | }
|
---|
249 | // end of DrawPulseHistograms
|
---|
250 | //----------------------------------------------------------------------------
|
---|
251 |
|
---|
252 |
|
---|
253 | void
|
---|
254 | Pixel::BookDistributionHistos( )
|
---|
255 | {
|
---|
256 | if (!mOptions.IsNull() )
|
---|
257 | {
|
---|
258 | int x_min = 0;
|
---|
259 | int x_max = 0;
|
---|
260 |
|
---|
261 | for (int order =0; order < mMaxPulseOrder; order++)
|
---|
262 | {
|
---|
263 | if (mVerbosityLevel > 2) cout << endl
|
---|
264 | << "...book distribution histograms"
|
---|
265 | << endl;
|
---|
266 |
|
---|
267 | if (mOptions.Contains("S"))
|
---|
268 | {
|
---|
269 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hSlopeRisingEdge", order) << endl;
|
---|
270 | hSlopeRisingEdge[order] = new TH1F (
|
---|
271 | HistoName("hSlopeRisingEdge", order),
|
---|
272 | HistoTitle("Distribution of rising edge's slope", order),
|
---|
273 | 600,
|
---|
274 | -10.1,
|
---|
275 | 10.1
|
---|
276 | );
|
---|
277 | hSlopeRisingEdge[order]->SetAxisRange(
|
---|
278 | -1,
|
---|
279 | 7,
|
---|
280 | "X");
|
---|
281 | hSlopeRisingEdge[order]->GetXaxis()->SetTitle( "Slope Amplitude/time [mV/timeslices]" );
|
---|
282 | hSlopeRisingEdge[order]->GetYaxis()->SetTitle( "counts" );
|
---|
283 | hSlopeRisingEdge[order]->SetStats(mStats);
|
---|
284 | hList->Add( hSlopeRisingEdge[order] );
|
---|
285 | }
|
---|
286 |
|
---|
287 | if (mOptions.Contains("R"))
|
---|
288 | {
|
---|
289 | x_min = -15;
|
---|
290 | x_max = 35;
|
---|
291 |
|
---|
292 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hRisingEdgeToMax", order) << endl;
|
---|
293 | hRisingEdgeToMax[order] = new TH1I (
|
---|
294 | HistoName("hRisingEdgeToMax", order),
|
---|
295 | HistoTitle("Distribution of distance between rising edge and pulse's maximum", order),
|
---|
296 | x_max -x_min,
|
---|
297 | x_min,
|
---|
298 | x_max
|
---|
299 | );
|
---|
300 | hSlopeRisingEdge[order]->SetAxisRange(
|
---|
301 | -5,
|
---|
302 | 25,
|
---|
303 | "X");
|
---|
304 | hRisingEdgeToMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
305 | hRisingEdgeToMax[order]->GetYaxis()->SetTitle( "counts" );
|
---|
306 | hRisingEdgeToMax[order]->SetStats(mStats);
|
---|
307 | hList->Add( hRisingEdgeToMax[order] );
|
---|
308 | }
|
---|
309 |
|
---|
310 | if (mOptions.Contains("M"))
|
---|
311 | {
|
---|
312 | x_min = 10;
|
---|
313 | x_max = 290;
|
---|
314 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPosOfMax", order) << endl;
|
---|
315 | hPosOfMax[order] = new TH1I (
|
---|
316 | HistoName("hPosOfMax", order),
|
---|
317 | HistoTitle("Distribution of pulse's maximum's positon", order),
|
---|
318 | x_max - x_min,
|
---|
319 | x_min,
|
---|
320 | x_max
|
---|
321 | );
|
---|
322 | hPosOfMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
323 | hPosOfMax[order]->GetYaxis()->SetTitle( "counts" );
|
---|
324 | hRisingEdgeToMax[order]->SetStats(mStats);
|
---|
325 | hList->Add( hPosOfMax[order] );
|
---|
326 | }
|
---|
327 |
|
---|
328 | if (mVerbosityLevel > 2) cout << "...done" << endl;
|
---|
329 | }
|
---|
330 | }
|
---|
331 | }
|
---|
332 |
|
---|
333 | void
|
---|
334 | Pixel::DrawDistributionHistograms(
|
---|
335 | TCanvas** pixelCanvas,
|
---|
336 | int* histoFrameNr
|
---|
337 | )
|
---|
338 | {
|
---|
339 | if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ;
|
---|
340 | bool nothing_to_fill = true;
|
---|
341 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
|
---|
342 | {
|
---|
343 | if (mOptions.Contains("S") )
|
---|
344 | {
|
---|
345 | pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
|
---|
346 | hSlopeRisingEdge[pulse_order]->Draw();
|
---|
347 | nothing_to_fill = false;
|
---|
348 | }
|
---|
349 |
|
---|
350 | if (mOptions.Contains("R") )
|
---|
351 | {
|
---|
352 | pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
|
---|
353 | hRisingEdgeToMax[pulse_order]->Draw();
|
---|
354 | nothing_to_fill = false;
|
---|
355 | }
|
---|
356 |
|
---|
357 | if (mOptions.Contains("M") )
|
---|
358 | {
|
---|
359 | pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
|
---|
360 | hPosOfMax[pulse_order]->Draw();
|
---|
361 | nothing_to_fill = false;
|
---|
362 | }
|
---|
363 |
|
---|
364 | }
|
---|
365 | if (nothing_to_fill)
|
---|
366 | {
|
---|
367 | cout << endl << "there were NO DISTRIBUTION HISTOGRAMS to fill" << endl;
|
---|
368 | }
|
---|
369 | }
|
---|
370 | // end of DrawDistributionHistograms
|
---|
371 | //----------------------------------------------------------------------------
|
---|
372 |
|
---|
373 | void
|
---|
374 | Pixel::SavePixelHistograms(
|
---|
375 | const char* outRootFileName,
|
---|
376 | bool saveResults
|
---|
377 | )
|
---|
378 | {
|
---|
379 | if (mVerbosityLevel > 2) cout << endl << "Saving histograms of Pixel# " << mChid;
|
---|
380 | if (!saveResults) return;
|
---|
381 | SaveHistograms(
|
---|
382 | outRootFileName,
|
---|
383 | CreateSubDirName( mChid ),
|
---|
384 | hList,
|
---|
385 | saveResults,
|
---|
386 | mVerbosityLevel
|
---|
387 | );
|
---|
388 | }
|
---|
389 | // end of SavePixelHistograms
|
---|
390 | //----------------------------------------------------------------------------
|
---|
391 |
|
---|
392 | void
|
---|
393 | Pixel::DeletePixelHistos()
|
---|
394 | {
|
---|
395 | if (mVerbosityLevel > 2)
|
---|
396 | {
|
---|
397 | cout << endl
|
---|
398 | << "\t...delete current overlay histograms of Pixel# " << mChid;
|
---|
399 | }
|
---|
400 | for (int order = 0;
|
---|
401 | order < mMaxPulseOrder;
|
---|
402 | order ++)
|
---|
403 | {
|
---|
404 | if (mVerbosityLevel > 3)
|
---|
405 | cout << endl << "\t\t...deleting hMaxOverlay"
|
---|
406 | << mChid << "_" << order
|
---|
407 | << " hMaxOverlay[order] adr " << hMaxOverlay[order]
|
---|
408 | << " hMaxOverlay adr " << hMaxOverlay
|
---|
409 | ;
|
---|
410 |
|
---|
411 | delete hMaxOverlay[order];
|
---|
412 | hMaxOverlay[order] = NULL;
|
---|
413 |
|
---|
414 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay"
|
---|
415 | << mChid << "_" << order ;
|
---|
416 | delete hEdgeOverlay[order];
|
---|
417 | hEdgeOverlay[order] = NULL;
|
---|
418 |
|
---|
419 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile"
|
---|
420 | << mChid << "_" << order ;
|
---|
421 | delete hMaxProfile[order];
|
---|
422 | hMaxProfile[order] = NULL;
|
---|
423 |
|
---|
424 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile2"
|
---|
425 | << mChid << "_" << order ;
|
---|
426 | delete hEdgeProfile[order];
|
---|
427 | hEdgeProfile[order] = NULL;
|
---|
428 | }
|
---|
429 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
|
---|
430 |
|
---|
431 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxOverlay";
|
---|
432 | delete[] hMaxOverlay;
|
---|
433 | hMaxOverlay = NULL;
|
---|
434 |
|
---|
435 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay";
|
---|
436 | delete[] hEdgeOverlay;
|
---|
437 | hEdgeOverlay = NULL;
|
---|
438 |
|
---|
439 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile";
|
---|
440 | delete[] hMaxProfile;
|
---|
441 | hMaxProfile = NULL;
|
---|
442 |
|
---|
443 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeProfile";
|
---|
444 | delete[] hEdgeProfile;
|
---|
445 | hEdgeProfile = NULL;
|
---|
446 | }
|
---|
447 | // end of DeletePixelHistos
|
---|
448 | //----------------------------------------------------------------------------
|
---|
449 |
|
---|
450 | void
|
---|
451 | Pixel::DeleteDistributionHistos()
|
---|
452 | {
|
---|
453 | if (mVerbosityLevel > 2)
|
---|
454 | {
|
---|
455 | cout << endl
|
---|
456 | << "\t...delete current distribution histograms" ;
|
---|
457 | }
|
---|
458 |
|
---|
459 | for (int order = 0;
|
---|
460 | order < mMaxPulseOrder;
|
---|
461 | order ++)
|
---|
462 | {
|
---|
463 | if (mOptions.Contains("S"))
|
---|
464 | {
|
---|
465 | if (mVerbosityLevel > 3) cout << endl
|
---|
466 | << "\t\t...deleting hSlopeRisingEdge"
|
---|
467 | << mChid << "_" << order ;
|
---|
468 | delete hSlopeRisingEdge[order];
|
---|
469 | }
|
---|
470 |
|
---|
471 | if (mOptions.Contains("R"))
|
---|
472 | {
|
---|
473 | if (mVerbosityLevel > 3) cout << endl
|
---|
474 | << "\t\t...deleting hRisingEdgeToMax"
|
---|
475 | << mChid << "_" << order ;
|
---|
476 | // delete hRisingEdgeToMax[order];
|
---|
477 | }
|
---|
478 |
|
---|
479 | if (mOptions.Contains("M"))
|
---|
480 | {
|
---|
481 | if (mVerbosityLevel > 3) cout << endl
|
---|
482 | << "\t\t...deleting hPosOfMax"
|
---|
483 | << mChid << "_" << order ;
|
---|
484 |
|
---|
485 | // delete hPosOfMax[order];
|
---|
486 | }
|
---|
487 |
|
---|
488 | }
|
---|
489 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
|
---|
490 |
|
---|
491 | if (mOptions.Contains("S"))
|
---|
492 | {
|
---|
493 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hSlopeRisingEdge";
|
---|
494 | delete[] hSlopeRisingEdge;
|
---|
495 | hSlopeRisingEdge = NULL;
|
---|
496 | }
|
---|
497 |
|
---|
498 | if (mOptions.Contains("R"))
|
---|
499 | {
|
---|
500 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hRisingEdgeToMax";
|
---|
501 | delete[] hRisingEdgeToMax;
|
---|
502 | hRisingEdgeToMax = NULL;
|
---|
503 | }
|
---|
504 |
|
---|
505 | if (mOptions.Contains("M"))
|
---|
506 | {
|
---|
507 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPosOfMax";
|
---|
508 | delete[] hPosOfMax;
|
---|
509 | hPosOfMax = NULL;
|
---|
510 | }
|
---|
511 | }
|
---|
512 | // end of DeletePixelHistos
|
---|
513 | //----------------------------------------------------------------------------
|
---|
514 |
|
---|
515 | void
|
---|
516 | Pixel::LoadPulseHistos()
|
---|
517 | {
|
---|
518 | mRootFile->cd();
|
---|
519 | mRootFile->cd(CreateSubDirName( mChid ));
|
---|
520 | for (int order = 0; order < mMaxPulseOrder; order++)
|
---|
521 | {
|
---|
522 | hMaxOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hMaxOverlay", order) );
|
---|
523 | hEdgeOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hEdgeOverlay", order) );
|
---|
524 | hMaxProfile[order] = (TProfile*)mRootFile->Get( HistoName("hMaxProfile", order) );
|
---|
525 | hEdgeProfile[order] = (TProfile*)mRootFile->Get( HistoName("hEdgeProfile", order) );
|
---|
526 | }
|
---|
527 | }
|
---|
528 |
|
---|
529 | TString
|
---|
530 | Pixel::HistoName(
|
---|
531 | TString histoname,
|
---|
532 | int order
|
---|
533 | )
|
---|
534 | {
|
---|
535 | histoname += mChid;
|
---|
536 | histoname += "_";
|
---|
537 | histoname += order;
|
---|
538 | return histoname;
|
---|
539 | }
|
---|
540 |
|
---|
541 | TString
|
---|
542 | Pixel::HistoTitle(
|
---|
543 | TString histo_title,
|
---|
544 | int order
|
---|
545 | )
|
---|
546 | {
|
---|
547 | histo_title += " [Pixel_Order] ";
|
---|
548 | histo_title += mChid;
|
---|
549 | histo_title += "_";
|
---|
550 | histo_title += order;
|
---|
551 | return histo_title;
|
---|
552 | }
|
---|
553 |
|
---|
554 | void
|
---|
555 | Pixel::BookTemplateHistos()
|
---|
556 | {
|
---|
557 | if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
|
---|
558 | for (int order = 0; order < mMaxPulseOrder; order++)
|
---|
559 | {
|
---|
560 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMax", order) << endl;
|
---|
561 | hPixelMax[order]=new TH1F(
|
---|
562 | HistoName("hPixelMax", order),
|
---|
563 | HistoTitle("Maximum value of each slice in overlay plot of", order),
|
---|
564 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
|
---|
565 | (-1*mPixelOverlayXaxisLeft)-0.5,
|
---|
566 | mPixelOverlayXaxisRight-0.5
|
---|
567 | );
|
---|
568 |
|
---|
569 | hPixelMax[order]->SetAxisRange(
|
---|
570 | mBSLMean - 5,
|
---|
571 | (mGainMean*(order+1)) + 10,
|
---|
572 | "Y");
|
---|
573 | hPixelMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
574 | hPixelMax[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
575 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
---|
576 | hPixelMax[order]->SetStats(mStats);
|
---|
577 | hList->Add( hPixelMax[order] );
|
---|
578 |
|
---|
579 | //------------------------------------------------------------------------
|
---|
580 |
|
---|
581 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMean", order) << endl;
|
---|
582 | hPixelMean[order] = new TH1F(
|
---|
583 | HistoName("hPixelMean", order),
|
---|
584 | HistoTitle("Mean value of each slice in overlay plot of", order),
|
---|
585 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
|
---|
586 | (-1*mPixelOverlayXaxisLeft)-0.5,
|
---|
587 | mPixelOverlayXaxisRight-0.5
|
---|
588 | );
|
---|
589 | hPixelMean[order]->SetLineColor(kBlue);
|
---|
590 | hPixelMean[order]->SetAxisRange(
|
---|
591 | mBSLMean - 5,
|
---|
592 | (mGainMean*(order+1)) + 10,
|
---|
593 | "Y");
|
---|
594 | hPixelMean[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
595 | hPixelMean[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
596 | hPixelMean[order]->SetStats(mStats);
|
---|
597 | hList->Add( hPixelMean[order] );
|
---|
598 |
|
---|
599 | //------------------------------------------------------------------------
|
---|
600 |
|
---|
601 | if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMedian", order) << endl;
|
---|
602 | hPixelMedian[order] = new TH1F(
|
---|
603 | HistoName("hPixelMedian", order),
|
---|
604 | HistoTitle("Median value of each slice in overlay plot of", order),
|
---|
605 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
|
---|
606 | (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
|
---|
607 | mPixelOverlayXaxisRight-0.5 //xup
|
---|
608 | );
|
---|
609 | hPixelMedian[order]->SetLineColor(kRed);
|
---|
610 | hPixelMedian[order]->SetAxisRange(
|
---|
611 | mBSLMean - 5,
|
---|
612 | (mGainMean*(order+1)) + 10,
|
---|
613 | "Y");
|
---|
614 | hPixelMedian[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
615 | hPixelMedian[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
616 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
---|
617 | hPixelMedian[order]->SetStats(mStats);
|
---|
618 | hList->Add( hPixelMedian[order] );
|
---|
619 |
|
---|
620 | }
|
---|
621 | if (mVerbosityLevel > 2) cout << "...done" << endl;
|
---|
622 | }
|
---|
623 | //end of BookTemplateHistos
|
---|
624 | //----------------------------------------------------------------------------
|
---|
625 |
|
---|
626 | void
|
---|
627 | Pixel::DeleteTemplateHistos()
|
---|
628 | {
|
---|
629 | if (mVerbosityLevel > 2)
|
---|
630 | {
|
---|
631 | cout << endl
|
---|
632 | << "\t...delete current template histograms of Pixel# " << mChid;
|
---|
633 | }
|
---|
634 | for (int order = 0;
|
---|
635 | order < mMaxPulseOrder;
|
---|
636 | order ++)
|
---|
637 | {
|
---|
638 | if (mVerbosityLevel > 3)
|
---|
639 | cout << endl << "\t\t...deleting hPixelMax"
|
---|
640 | << mChid << "_" << order
|
---|
641 | << " hPixelMax[order] adr " << hPixelMax[order]
|
---|
642 | << " hPixelMax adr " << hPixelMax
|
---|
643 | ;
|
---|
644 |
|
---|
645 | delete hPixelMax[order];
|
---|
646 | hPixelMax[order] = NULL;
|
---|
647 |
|
---|
648 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMedian"
|
---|
649 | << mChid << "_" << order ;
|
---|
650 | delete hPixelMedian[order];
|
---|
651 | hPixelMedian[order] = NULL;
|
---|
652 |
|
---|
653 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMean"
|
---|
654 | << mChid << "_" << order ;
|
---|
655 | delete hPixelMean[order];
|
---|
656 | hPixelMean[order] = NULL;
|
---|
657 |
|
---|
658 | }
|
---|
659 | if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
|
---|
660 |
|
---|
661 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMax";
|
---|
662 | delete[] hPixelMax;
|
---|
663 | hPixelMax = NULL;
|
---|
664 |
|
---|
665 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMedian";
|
---|
666 | delete[] hPixelMedian;
|
---|
667 | hPixelMedian = NULL;
|
---|
668 |
|
---|
669 | if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMean";
|
---|
670 | delete[] hPixelMean;
|
---|
671 | hPixelMean = NULL;
|
---|
672 | }
|
---|
673 |
|
---|
674 | //============================= ACESS ===================================
|
---|
675 | //============================= INQUIRY ===================================
|
---|
676 | /////////////////////////////// PROTECTED ///////////////////////////////////
|
---|
677 |
|
---|
678 | /////////////////////////////// PRIVATE ///////////////////////////////////
|
---|
679 |
|
---|
680 |
|
---|
681 |
|
---|
682 |
|
---|
683 |
|
---|
684 |
|
---|
685 |
|
---|
686 |
|
---|