1 | #include "pixel.h" // class implemented
|
---|
2 | using namespace std;
|
---|
3 |
|
---|
4 | /////////////////////////////// PUBLIC ///////////////////////////////////////
|
---|
5 |
|
---|
6 | //============================= LIFECYCLE ====================================
|
---|
7 |
|
---|
8 | //Pixel::Pixel(int pixelID)
|
---|
9 | //{
|
---|
10 | // Chid = pixelID;
|
---|
11 | // max_puslse_order = 1;
|
---|
12 | // hMaxOverlay = NULL;
|
---|
13 | // hEdgeOverlay = NULL;
|
---|
14 | // hMaxProfile = NULL;
|
---|
15 | // hEdgeProfile = NULL;
|
---|
16 | // hList = NULL;
|
---|
17 |
|
---|
18 | //}
|
---|
19 |
|
---|
20 | Pixel::Pixel(
|
---|
21 | int pixelID,
|
---|
22 | int maxPulsorder,
|
---|
23 | int verbosityLevel,
|
---|
24 | int pixelOverlayXaxisLeft,
|
---|
25 | int pixelOverlayXaxisRight,
|
---|
26 | int bSLMean,
|
---|
27 | int gainMean,
|
---|
28 | TString options
|
---|
29 | )
|
---|
30 | {
|
---|
31 | mChid = pixelID;
|
---|
32 | mMaxPulseOrder = maxPulsorder;
|
---|
33 | mVerbosityLevel = verbosityLevel;
|
---|
34 | mOptions = options;
|
---|
35 | mPixelOverlayXaxisLeft = pixelOverlayXaxisLeft;
|
---|
36 | mPixelOverlayXaxisRight = pixelOverlayXaxisRight;
|
---|
37 | mBSLMean = bSLMean;
|
---|
38 | mGainMean = gainMean;
|
---|
39 |
|
---|
40 | // hMaxOverlay = (TH2F*) calloc(mMaxPulseOrder, sizeof(TH2F*));
|
---|
41 | hMaxOverlay = new TH2F*[mMaxPulseOrder];
|
---|
42 | // hEdgeOverlay = (TH2F*) calloc(mMaxPulseOrder, sizeof(TH2F*));
|
---|
43 | hEdgeOverlay = new TH2F*[mMaxPulseOrder];
|
---|
44 | // hMaxProfile = (TProfile*) calloc(mMaxPulseOrder, sizeof(TProfile));
|
---|
45 | hMaxProfile = new TProfile*[mMaxPulseOrder];
|
---|
46 | // hEdgeProfile = (TProfile*) calloc(mMaxPulseOrder, sizeof(TProfile));
|
---|
47 | hEdgeProfile = new TProfile*[mMaxPulseOrder];
|
---|
48 | if (mOptions == "S")
|
---|
49 | {
|
---|
50 | // hSlopeRisingEdge= (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F));
|
---|
51 | hSlopeRisingEdge = new TH1F*[mMaxPulseOrder];
|
---|
52 | }
|
---|
53 | if (mOptions == "R")
|
---|
54 | {
|
---|
55 | // hRisingEdgeToMax= (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F));
|
---|
56 | hRisingEdgeToMax = new TH1F*[mMaxPulseOrder];
|
---|
57 | }
|
---|
58 | if (mOptions == "P")
|
---|
59 | {
|
---|
60 | // hPosOfMax = (TH1F*) calloc(mMaxPulseOrder, sizeof(TH1F));
|
---|
61 | hPosOfMax = new TH1F*[mMaxPulseOrder];
|
---|
62 | }
|
---|
63 |
|
---|
64 | hList = new TObjArray;
|
---|
65 |
|
---|
66 | BookPixelHistos();
|
---|
67 | BookDistributionHistos();
|
---|
68 | }
|
---|
69 |
|
---|
70 | Pixel::~Pixel()
|
---|
71 | {
|
---|
72 | if (mVerbosityLevel > 2) cout << endl << "...delete current pixel histograms" ;
|
---|
73 |
|
---|
74 | DeletePixelHistos();
|
---|
75 | DeleteDistributionHistos();
|
---|
76 | delete hList;
|
---|
77 | hList = NULL;
|
---|
78 |
|
---|
79 | }// ~Pixel
|
---|
80 |
|
---|
81 |
|
---|
82 | //============================= OPERATORS ====================================
|
---|
83 |
|
---|
84 | //XX&
|
---|
85 | //XX::operator=(const XX&);
|
---|
86 | //{
|
---|
87 | // return *this;
|
---|
88 |
|
---|
89 | //}// =
|
---|
90 |
|
---|
91 | //============================= OPERATIONS ===================================
|
---|
92 | void
|
---|
93 | Pixel::BookPixelHistos()
|
---|
94 | {
|
---|
95 | if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
|
---|
96 | TString histo_name;
|
---|
97 |
|
---|
98 | for (int order =0; order > mMaxPulseOrder; order++)
|
---|
99 | {
|
---|
100 | histo_name = "hMaxOverlay";
|
---|
101 | histo_name += order;
|
---|
102 | hMaxOverlay[order]=new TH2F(
|
---|
103 | histo_name,
|
---|
104 | "Overlay of detected pulses of one pulse order for one Pixel",
|
---|
105 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
|
---|
106 | (-1*mPixelOverlayXaxisLeft)-0.5,
|
---|
107 | mPixelOverlayXaxisRight-0.5 ,
|
---|
108 | 512,
|
---|
109 | -55.5,
|
---|
110 | 200.5
|
---|
111 | );
|
---|
112 | /*
|
---|
113 | SetHistogramAttributes(
|
---|
114 | "PeakMaxGaus",
|
---|
115 | order,
|
---|
116 | gMaxGausAttrib,
|
---|
117 | MaxAmplOfFirstPulse
|
---|
118 | );
|
---|
119 | */
|
---|
120 | if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl;
|
---|
121 | hMaxOverlay[order]->SetAxisRange(
|
---|
122 | mBSLMean - 5,
|
---|
123 | (mGainMean*(order+1)) + 10,
|
---|
124 | "Y");
|
---|
125 | hMaxOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
126 | hMaxOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
127 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
---|
128 | hList->Add( hMaxOverlay[order] );
|
---|
129 | }
|
---|
130 |
|
---|
131 | for (int order = 0; order < mMaxPulseOrder; order ++)
|
---|
132 | {
|
---|
133 |
|
---|
134 | //------------------------------------------------------------------------
|
---|
135 | /*
|
---|
136 | SetHistogramAttributes(
|
---|
137 | "PeakMaxGaus",
|
---|
138 | order,
|
---|
139 | gMaxGausAttrib,
|
---|
140 | MaxAmplOfFirstPulse
|
---|
141 | );
|
---|
142 | */
|
---|
143 | histo_name = "hEdgeOverlay";
|
---|
144 | histo_name += order;
|
---|
145 | if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl;
|
---|
146 | hEdgeOverlay[order] = new TH2F(
|
---|
147 | histo_name,
|
---|
148 | "Overlay at rising edge of detected pulses of one pulse order for one Pixel ",
|
---|
149 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
|
---|
150 | (-1*mPixelOverlayXaxisLeft)-0.5,
|
---|
151 | mPixelOverlayXaxisRight-0.5 ,
|
---|
152 | 512,
|
---|
153 | -55.5,
|
---|
154 | 200.5
|
---|
155 | );
|
---|
156 |
|
---|
157 | hEdgeOverlay[order]->SetAxisRange(
|
---|
158 | mBSLMean - 5,
|
---|
159 | (mGainMean*(order+1)) + 10,
|
---|
160 | "Y");
|
---|
161 | hEdgeOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
162 | hEdgeOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
163 | hList->Add( hEdgeOverlay[order] );
|
---|
164 |
|
---|
165 | //------------------------------------------------------------------------
|
---|
166 | /*
|
---|
167 | SetHistogramAttributes(
|
---|
168 | "PeakMaxGaus",
|
---|
169 | order,
|
---|
170 | gMaxGausAttrib,
|
---|
171 | MaxAmplOfFirstPulse
|
---|
172 | );
|
---|
173 | */
|
---|
174 | histo_name = "hMaxProfile";
|
---|
175 | histo_name += order;
|
---|
176 | if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl;
|
---|
177 | hMaxProfile[order] = new TProfile(
|
---|
178 | histo_name,
|
---|
179 | "Mean value of each slice in overlay plot (Tprofile)",
|
---|
180 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
|
---|
181 | (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
|
---|
182 | mPixelOverlayXaxisRight-0.5 , //xup
|
---|
183 | // 512, //nbinsy
|
---|
184 | -55.5, //ylow
|
---|
185 | 300.5, //yup
|
---|
186 | "s"); //option
|
---|
187 | hMaxProfile[order]->SetAxisRange(
|
---|
188 | mBSLMean - 5,
|
---|
189 | (mGainMean*(order+1)) + 10,
|
---|
190 | "Y");
|
---|
191 | hMaxProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
192 | hMaxProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
193 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
---|
194 | hList->Add( hMaxProfile[order] );
|
---|
195 |
|
---|
196 |
|
---|
197 | //------------------------------------------------------------------------
|
---|
198 | /*
|
---|
199 | SetHistogramAttributes(
|
---|
200 | "PeakMaxGaus",
|
---|
201 | order,
|
---|
202 | gMaxGausAttrib,
|
---|
203 | MaxAmplOfFirstPulse
|
---|
204 | );
|
---|
205 | */
|
---|
206 | histo_name = "hEdgeProfile";
|
---|
207 | histo_name += order;
|
---|
208 | if (mVerbosityLevel > 3) cout << "...booking " << histo_name << endl;
|
---|
209 | hEdgeProfile[order] = new TProfile(
|
---|
210 | histo_name,
|
---|
211 | "Mean value of each slice in overlay plot (Tprofile)",
|
---|
212 | mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
|
---|
213 | (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
|
---|
214 | mPixelOverlayXaxisRight-0.5 , //xup
|
---|
215 | // 512, //nbinsy
|
---|
216 | -55.5, //ylow
|
---|
217 | 300.5, //yup
|
---|
218 | "s"); //option
|
---|
219 | hEdgeProfile[order]->SetLineColor(kRed);
|
---|
220 | hEdgeProfile[order]->SetAxisRange(
|
---|
221 | mBSLMean - 5,
|
---|
222 | (mGainMean*(order+1)) + 10,
|
---|
223 | "Y");
|
---|
224 | hEdgeProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
225 | hEdgeProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
|
---|
226 | //hMaxProfile->SetBit(TH2F::kCanRebin);
|
---|
227 | hList->Add( hEdgeProfile[order] );
|
---|
228 |
|
---|
229 | }
|
---|
230 | if (mVerbosityLevel > 2) cout << "...done" << endl;
|
---|
231 | }
|
---|
232 | //end of BookPixelHistos
|
---|
233 | //----------------------------------------------------------------------------
|
---|
234 |
|
---|
235 |
|
---|
236 | void
|
---|
237 | Pixel::DrawHistograms(
|
---|
238 | TCanvas* pixelCanvas,
|
---|
239 | int* histoFrameNr
|
---|
240 | )
|
---|
241 | {
|
---|
242 | if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;
|
---|
243 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
|
---|
244 | {
|
---|
245 | pixelCanvas[pulse_order].cd( histoFrameNr[0] );
|
---|
246 | hMaxOverlay[pulse_order]->Draw("COLZ");
|
---|
247 | pixelCanvas[pulse_order].cd( histoFrameNr[2] );
|
---|
248 | hMaxProfile[pulse_order]->Draw("COLZ");
|
---|
249 | hEdgeProfile[pulse_order]->Draw("SAME");
|
---|
250 |
|
---|
251 | pixelCanvas[pulse_order].cd( histoFrameNr[1] );
|
---|
252 | hEdgeOverlay[pulse_order]->Draw("COLZ");
|
---|
253 | }
|
---|
254 | }
|
---|
255 | // end of DrawPulseHistograms
|
---|
256 | //----------------------------------------------------------------------------
|
---|
257 |
|
---|
258 |
|
---|
259 | void
|
---|
260 | Pixel::BookDistributionHistos( )
|
---|
261 | {
|
---|
262 | if (mOptions != "")
|
---|
263 | {
|
---|
264 | TString histo_name;
|
---|
265 | for (int order =0; order > mMaxPulseOrder; order++)
|
---|
266 | {
|
---|
267 | if (mVerbosityLevel > 2) cout << endl
|
---|
268 | << "...book distribution histograms"
|
---|
269 | << endl;
|
---|
270 |
|
---|
271 | if (mOptions.Contains("S"))
|
---|
272 | {
|
---|
273 | histo_name = "hSlopeRisingEdge";
|
---|
274 | histo_name += order;
|
---|
275 | hSlopeRisingEdge[order] = new TH1F (
|
---|
276 | histo_name,
|
---|
277 | "Distribution of rising edge",
|
---|
278 | 600,
|
---|
279 | -10.1,
|
---|
280 | 10.1
|
---|
281 | );
|
---|
282 | hSlopeRisingEdge[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
283 | hSlopeRisingEdge[order]->GetYaxis()->SetTitle( "counts" );
|
---|
284 | hList->Add( hSlopeRisingEdge[order] );
|
---|
285 | }
|
---|
286 |
|
---|
287 | if (mOptions.Contains("R"))
|
---|
288 | {
|
---|
289 | histo_name = "hRisingEdgeToMax";
|
---|
290 | histo_name += order;
|
---|
291 | hRisingEdgeToMax[order] = new TH1F (
|
---|
292 | histo_name,
|
---|
293 | "Deviation of rising edge and maximum",
|
---|
294 | 600,
|
---|
295 | -10.1,
|
---|
296 | 10.1
|
---|
297 | );
|
---|
298 | hRisingEdgeToMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
299 | hRisingEdgeToMax[order]->GetYaxis()->SetTitle( "counts" );
|
---|
300 | hList->Add( hRisingEdgeToMax[order] );
|
---|
301 | }
|
---|
302 |
|
---|
303 | if (mOptions.Contains("P"))
|
---|
304 | {
|
---|
305 | histo_name = "hPosOfMax";
|
---|
306 | histo_name += order;
|
---|
307 | hPosOfMax[order] = new TH1F (
|
---|
308 | histo_name,
|
---|
309 | "Deviation of rising edge and maximum",
|
---|
310 | 600,
|
---|
311 | -10.1,
|
---|
312 | 10.1
|
---|
313 | );
|
---|
314 | hPosOfMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
|
---|
315 | hPosOfMax[order]->GetYaxis()->SetTitle( "counts" );
|
---|
316 | hList->Add( hPosOfMax[order] );
|
---|
317 | }
|
---|
318 |
|
---|
319 | if (mVerbosityLevel > 2) cout << "...done" << endl;
|
---|
320 | }
|
---|
321 | }
|
---|
322 | }
|
---|
323 |
|
---|
324 | void
|
---|
325 | Pixel::DrawDistributionHistograms(
|
---|
326 | TCanvas* pixelCanvas,
|
---|
327 | int* histoFrameNr
|
---|
328 | )
|
---|
329 | {
|
---|
330 | if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ;
|
---|
331 | for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
|
---|
332 | {
|
---|
333 | pixelCanvas[pulse_order].cd( histoFrameNr[0] );
|
---|
334 | hSlopeRisingEdge[pulse_order]->Draw();
|
---|
335 | pixelCanvas[pulse_order].cd( histoFrameNr[1] );
|
---|
336 | hRisingEdgeToMax[pulse_order]->Draw();
|
---|
337 |
|
---|
338 | pixelCanvas[pulse_order].cd( histoFrameNr[2] );
|
---|
339 | hPosOfMax[pulse_order]->Draw();
|
---|
340 | }
|
---|
341 | }
|
---|
342 | // end of DrawDistributionHistograms
|
---|
343 | //----------------------------------------------------------------------------
|
---|
344 |
|
---|
345 | void
|
---|
346 | Pixel::SavePixelHistograms(
|
---|
347 | const char* outRootFileName,
|
---|
348 | bool saveResults
|
---|
349 | )
|
---|
350 | {
|
---|
351 | if (!saveResults) return;
|
---|
352 | SaveHistograms(
|
---|
353 | outRootFileName,
|
---|
354 | CreateSubDirName( mChid ),
|
---|
355 | hList,
|
---|
356 | saveResults,
|
---|
357 | mVerbosityLevel
|
---|
358 | );
|
---|
359 | }
|
---|
360 | // end of SavePixelHistograms
|
---|
361 | //----------------------------------------------------------------------------
|
---|
362 |
|
---|
363 | void
|
---|
364 | Pixel::DeletePixelHistos()
|
---|
365 | {
|
---|
366 | if (mVerbosityLevel > 2) cout << endl << "...delete current overlay histograms" ;
|
---|
367 |
|
---|
368 | for (int order = 0;
|
---|
369 | order < mMaxPulseOrder;
|
---|
370 | order ++)
|
---|
371 | {
|
---|
372 | if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxOverlay";
|
---|
373 | delete hMaxOverlay[order];
|
---|
374 |
|
---|
375 | if (mVerbosityLevel > 3) cout << endl << "...deleting hEdgeOverlay";
|
---|
376 | delete hEdgeOverlay[order];
|
---|
377 |
|
---|
378 | if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile";
|
---|
379 | delete hMaxProfile[order];
|
---|
380 |
|
---|
381 | if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile2";
|
---|
382 | delete hEdgeProfile[order];
|
---|
383 | }
|
---|
384 | if (mVerbosityLevel > 3) cout << endl << "...deleting histogram Arrays";
|
---|
385 | delete[] hMaxOverlay;
|
---|
386 | hMaxOverlay = NULL;
|
---|
387 |
|
---|
388 | delete[] hEdgeOverlay;
|
---|
389 | hEdgeOverlay = NULL;
|
---|
390 |
|
---|
391 | delete[] hMaxProfile;
|
---|
392 | hMaxProfile = NULL;
|
---|
393 |
|
---|
394 | delete[] hEdgeProfile;
|
---|
395 | hEdgeProfile = NULL;
|
---|
396 | }
|
---|
397 | // end of DeletePixelHistos
|
---|
398 | //----------------------------------------------------------------------------
|
---|
399 |
|
---|
400 | void
|
---|
401 | Pixel::DeleteDistributionHistos()
|
---|
402 | {
|
---|
403 | if (mVerbosityLevel > 2) cout << endl << "...delete current distribution histograms" ;
|
---|
404 |
|
---|
405 | for (int order = 0;
|
---|
406 | order < mMaxPulseOrder;
|
---|
407 | order ++)
|
---|
408 | {
|
---|
409 | if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxOverlay";
|
---|
410 | delete hSlopeRisingEdge[order];
|
---|
411 |
|
---|
412 | if (mVerbosityLevel > 3) cout << endl << "...deleting hEdgeOverlay";
|
---|
413 | delete hRisingEdgeToMax[order];
|
---|
414 |
|
---|
415 | if (mVerbosityLevel > 3) cout << endl << "...deleting hMaxProfile";
|
---|
416 | delete hPosOfMax[order];
|
---|
417 |
|
---|
418 | }
|
---|
419 | if (mVerbosityLevel > 3) cout << endl << "...deleting histogram Arrays";
|
---|
420 |
|
---|
421 |
|
---|
422 | delete[] hSlopeRisingEdge;
|
---|
423 | hSlopeRisingEdge = NULL;
|
---|
424 |
|
---|
425 | delete[] hRisingEdgeToMax;
|
---|
426 | hRisingEdgeToMax = NULL;
|
---|
427 |
|
---|
428 | delete[] hPosOfMax;
|
---|
429 | hPosOfMax = NULL;
|
---|
430 | }
|
---|
431 | // end of DeletePixelHistos
|
---|
432 | //----------------------------------------------------------------------------
|
---|
433 |
|
---|
434 | //============================= ACESS ===================================
|
---|
435 | //============================= INQUIRY ===================================
|
---|
436 | /////////////////////////////// PROTECTED ///////////////////////////////////
|
---|
437 |
|
---|
438 | /////////////////////////////// PRIVATE ///////////////////////////////////
|
---|
439 |
|
---|
440 |
|
---|
441 |
|
---|
442 |
|
---|
443 |
|
---|
444 |
|
---|
445 |
|
---|
446 |
|
---|