source: fact/tools/rootmacros/PulseTemplates/pixel.C@ 13702

Last change on this file since 13702 was 13659, checked in by Jens Buss, 13 years ago
add functions make histogramsPritty
File size: 34.3 KB
Line 
1#include <iostream>
2
3#include "rootfilehandler.h"
4#include "pixel.h" // class implemented
5using namespace std;
6
7/////////////////////////////// PUBLIC ///////////////////////////////////////
8
9//============================= LIFECYCLE ====================================
10
11
12Pixel::Pixel(
13 int pixelID,
14 int maxPulsorder,
15 int verbosityLevel,
16 bool stats,
17 TFile* filename
18 )
19{
20 mConstructorType = 1; //important for deletion 0 delete distribution 1 delete TemplateHistos
21 mChid = pixelID;
22 mStats = stats;
23 mMaxPulseOrder = maxPulsorder;
24 mVerbosityLevel = verbosityLevel;
25 mRootFile = filename;
26
27 hMaxOverlay = new TH2F*[mMaxPulseOrder];
28 hEdgeOverlay = new TH2F*[mMaxPulseOrder];
29 hMaxProfile = new TProfile*[mMaxPulseOrder];
30 hEdgeProfile = new TProfile*[mMaxPulseOrder];
31
32 hPixelMax = new TH1F*[mMaxPulseOrder];
33 hPixelMedian = new TH1F*[mMaxPulseOrder];
34 hPixelMean = new TH1F*[mMaxPulseOrder];
35
36 hPixelEdgeMax = new TH1F*[mMaxPulseOrder];
37 hPixelEdgeMedian = new TH1F*[mMaxPulseOrder];
38 hPixelEdgeMean = new TH1F*[mMaxPulseOrder];
39
40 hList = new TObjArray;
41
42 LoadPulseHistos( );
43 BookTemplateHistos();
44}
45
46Pixel::Pixel(
47 int pixelID,
48 int maxPulsorder,
49 int verbosityLevel,
50 bool stats,
51 TFile* filename,
52 int pixelOverlayXaxisLeft,
53 int pixelOverlayXaxisRight,
54 float bSLMean,
55 float gainMean,
56 TString options
57 )
58{
59 mConstructorType = 0;
60 mChid = pixelID;
61 mStats = stats; ///TODO: HANDOVER THE VALUE
62 mMaxPulseOrder = maxPulsorder;
63 mVerbosityLevel = verbosityLevel;
64 mOptions = options;
65 mPixelOverlayXaxisLeft = pixelOverlayXaxisLeft;
66 mPixelOverlayXaxisRight = pixelOverlayXaxisRight;
67 mBSLMean = bSLMean;
68 mGainMean = gainMean;
69 mRootFile = filename;
70
71 hMaxOverlay = new TH2F*[mMaxPulseOrder];
72 hEdgeOverlay = new TH2F*[mMaxPulseOrder];
73 hMaxProfile = new TProfile*[mMaxPulseOrder];
74 hEdgeProfile = new TProfile*[mMaxPulseOrder];
75
76 if (mOptions.Contains("S") )
77 {
78 hSlopeRisingEdge = new TH1F*[mMaxPulseOrder];
79 }
80
81 if (mOptions.Contains("R") )
82 {
83 hRisingEdgeToMax = new TH1I*[mMaxPulseOrder];
84 }
85
86 if (mOptions.Contains("M") )
87 {
88 hPosOfMax = new TH1I*[mMaxPulseOrder];
89 }
90
91 hList = new TObjArray;
92
93 BookPixelHistos();
94 BookDistributionHistos();
95}
96
97Pixel::~Pixel()
98{
99 if (mVerbosityLevel > 1) cout << endl << "...delete histograms of pixel " << mChid ;
100
101 DeletePixelHistos();
102 if (mConstructorType == 0)
103 {
104 DeleteDistributionHistos();
105 }
106
107 if (mConstructorType == 1)
108 {
109 DeleteTemplateHistos();
110 }
111 delete hList;
112 hList = NULL;
113
114}// ~Pixel
115
116
117//============================= OPERATORS ====================================
118
119//XX&
120//XX::operator=(const XX&);
121//{
122// return *this;
123
124//}// =
125
126//============================= OPERATIONS ===================================
127void
128Pixel::DrawOverlayHistograms(
129 TCanvas** pixelCanvas,
130 int* histoFrameNr
131 )
132{
133 if (mVerbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;
134 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
135 {
136 pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
137 hMaxOverlay[pulse_order]->Draw("COLZ");
138 pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
139 hMaxProfile[pulse_order]->Draw();
140 hEdgeProfile[pulse_order]->Draw("SAME");
141
142 pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
143 hEdgeOverlay[pulse_order]->Draw("COLZ");
144 }
145}
146// end of DrawOverlayHistograms
147//----------------------------------------------------------------------------
148
149void
150Pixel::DrawDistributionHistograms(
151 TCanvas** pixelCanvas,
152 int* histoFrameNr
153 )
154{
155 if (mVerbosityLevel > 2) cout << endl << "...drawing distribution histograms" ;
156 bool nothing_to_fill = true;
157 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
158 {
159 if (mOptions.Contains("S") )
160 {
161 pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
162 hSlopeRisingEdge[pulse_order]->Draw();
163 nothing_to_fill = false;
164 }
165
166 if (mOptions.Contains("R") )
167 {
168 pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
169 hRisingEdgeToMax[pulse_order]->Draw();
170 nothing_to_fill = false;
171 }
172
173 if (mOptions.Contains("M") )
174 {
175 pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
176 hPosOfMax[pulse_order]->Draw();
177 nothing_to_fill = false;
178 }
179
180 }
181 if (nothing_to_fill)
182 {
183 cout << endl << "there were NO DISTRIBUTION HISTOGRAMS to fill" << endl;
184 }
185}
186// end of DrawDistributionHistograms
187//----------------------------------------------------------------------------
188
189void
190Pixel::DrawTemplateHistograms(
191 TCanvas** pixelCanvas,
192 int* histoFrameNr
193 )
194{
195 if (mVerbosityLevel > 2) cout << endl << "...drawing Template histograms" ;
196 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
197 {
198 pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
199 hPixelMax[pulse_order]->Draw();
200
201 pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
202 hPixelMedian[pulse_order]->Draw();
203
204 pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
205 hPixelMean[pulse_order]->Draw();
206
207 }
208}
209// end of DrawTemplateHistograms
210//----------------------------------------------------------------------------
211
212void
213Pixel::DrawEdgeTemplateHistograms(
214 TCanvas** pixelCanvas,
215 int* histoFrameNr
216 )
217{
218 if (mVerbosityLevel > 2) cout << endl << "...drawing Template histograms" ;
219 for (int pulse_order = 0; pulse_order < mMaxPulseOrder; pulse_order++)
220 {
221 pixelCanvas[pulse_order]->cd( histoFrameNr[0] );
222 hPixelEdgeMax[pulse_order]->Draw();
223
224 pixelCanvas[pulse_order]->cd( histoFrameNr[1] );
225 hPixelEdgeMedian[pulse_order]->Draw();
226
227 pixelCanvas[pulse_order]->cd( histoFrameNr[2] );
228 hPixelEdgeMean[pulse_order]->Draw();
229
230 }
231}
232// end of DrawTemplateHistograms
233//----------------------------------------------------------------------------
234
235
236
237
238void
239Pixel::SavePixelHistograms(
240 TString outRootFileName,
241 bool saveResults
242 )
243{
244 if (mVerbosityLevel > 2) cout << endl << "Saving histograms of Pixel# " << mChid;
245 if (!saveResults) return;
246 SaveHistograms(
247 outRootFileName,
248 CreateSubDirName( mChid ),
249 hList,
250 saveResults,
251 mVerbosityLevel
252 );
253}
254// end of SavePixelHistograms
255//----------------------------------------------------------------------------
256
257
258
259TString
260Pixel::HistoName(
261 TString histoname,
262 int order
263 )
264{
265 histoname += mChid;
266 histoname += "_";
267 histoname += order;
268 return histoname;
269}
270
271TString
272Pixel::HistoTitle(
273 TString histo_title,
274 int order
275 )
276{
277 histo_title += " [Pixel_Order] ";
278 histo_title += mChid;
279 histo_title += "_";
280 histo_title += order;
281 return histo_title;
282}
283
284TString
285Pixel::CsvFileName(
286 TString path,
287 TString overlayMethod,
288 int order
289 )
290{
291 path += "CSV/";
292 path += overlayMethod;
293 path += "OverlayTemplate";
294 path += "_";
295 path += mChid;
296 path += "_";
297 path += order;
298 path += ".csv";
299 return path;
300}
301
302
303//============================= ACESS ===================================
304//============================= INQUIRY ===================================
305/////////////////////////////// PROTECTED ///////////////////////////////////
306
307/////////////////////////////// PRIVATE ///////////////////////////////////
308
309void
310Pixel::BookPixelHistos()
311{
312 if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
313 for (int order = 0; order < mMaxPulseOrder; order++)
314 {
315 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxOverlay", order) << endl;
316 hMaxOverlay[order]=new TH2F(
317 HistoName("hMaxOverlay", order),
318 HistoTitle("Overlay at peak maximum of detected pulses of", order),
319 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
320 (-1*mPixelOverlayXaxisLeft)-0.5,
321 mPixelOverlayXaxisRight-0.5 ,
322 512,
323 -55.5,
324 200.5
325 );
326
327 hMaxOverlay[order]->SetAxisRange(
328 mBSLMean - 5,
329 (mGainMean*(order+1)) + 10,
330 "Y");
331 hMaxOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
332 hMaxOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
333 //hMaxProfile->SetBit(TH2F::kCanRebin);
334 hMaxOverlay[order]->SetStats(mStats);
335 hList->Add( hMaxOverlay[order] );
336
337//------------------------------------------------------------------------
338
339 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeOverlay", order) << endl;
340 hEdgeOverlay[order] = new TH2F(
341 HistoName("hEdgeOverlay", order),
342 HistoTitle("Overlay at rising edge of detected pulses of", order),
343 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
344 (-1*mPixelOverlayXaxisLeft)-0.5,
345 mPixelOverlayXaxisRight-0.5 ,
346 512,
347 -55.5,
348 200.5
349 );
350
351 hEdgeOverlay[order]->SetAxisRange(
352 mBSLMean - 5,
353 (mGainMean*(order+1)) + 10,
354 "Y");
355 hEdgeOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
356 hEdgeOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
357 hEdgeOverlay[order]->SetStats(mStats);
358 hList->Add( hEdgeOverlay[order] );
359
360 //------------------------------------------------------------------------
361
362 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxProfile", order) << endl;
363 hMaxProfile[order] = new TProfile(
364 HistoName("hMaxProfile", order),
365 HistoTitle("Mean value of each slice in overlay plot (Tprofile)", order),
366 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
367 (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
368 mPixelOverlayXaxisRight-0.5 , //xup
369 // 512, //nbinsy
370 -55.5, //ylow
371 300.5, //yup
372 "s"); //option
373 hMaxProfile[order]->SetAxisRange(
374 mBSLMean - 5,
375 (mGainMean*(order+1)) + 10,
376 "Y");
377 hMaxProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
378 hMaxProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
379 //hMaxProfile->SetBit(TH2F::kCanRebin);
380 hMaxProfile[order]->SetStats(mStats);
381 hList->Add( hMaxProfile[order] );
382
383
384 //------------------------------------------------------------------------
385
386 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeProfile", order) << endl;
387 hEdgeProfile[order] = new TProfile(
388 HistoName("hEdgeProfile", order),
389 HistoTitle("Mean value of each slice in overlay plot (Tprofile)", order),
390 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
391 (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
392 mPixelOverlayXaxisRight-0.5 , //xup
393 // 512, //nbinsy
394 -55.5, //ylow
395 300.5, //yup
396 "s"); //option
397 hEdgeProfile[order]->SetLineColor(kRed);
398 hEdgeProfile[order]->SetAxisRange(
399 mBSLMean - 5,
400 (mGainMean*(order+1)) + 10,
401 "Y");
402 hEdgeProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
403 hEdgeProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
404 //hMaxProfile->SetBit(TH2F::kCanRebin);
405 hEdgeProfile[order]->SetStats(mStats);
406 hList->Add( hEdgeProfile[order] );
407
408 }
409 if (mVerbosityLevel > 2) cout << "...done" << endl;
410}
411//end of BookPixelHistos
412//----------------------------------------------------------------------------
413
414void
415Pixel::BookDistributionHistos( )
416{
417 if (!mOptions.IsNull() )
418 {
419 int x_min = 0;
420 int x_max = 0;
421
422 for (int order =0; order < mMaxPulseOrder; order++)
423 {
424 if (mVerbosityLevel > 2) cout << endl
425 << "...book distribution histograms"
426 << endl;
427
428 if (mOptions.Contains("S"))
429 {
430 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hSlopeRisingEdge", order) << endl;
431 hSlopeRisingEdge[order] = new TH1F (
432 HistoName("hSlopeRisingEdge", order),
433 HistoTitle("Distribution of rising edge's slope", order),
434 600,
435 -10.1,
436 10.1
437 );
438 hSlopeRisingEdge[order]->SetAxisRange(
439 -1,
440 7,
441 "X");
442 hSlopeRisingEdge[order]->GetXaxis()->SetTitle( "Slope Amplitude/time [mV/timeslices]" );
443 hSlopeRisingEdge[order]->GetYaxis()->SetTitle( "counts" );
444 hSlopeRisingEdge[order]->SetStats(mStats);
445 hList->Add( hSlopeRisingEdge[order] );
446 }
447
448 if (mOptions.Contains("R"))
449 {
450 x_min = -15;
451 x_max = 35;
452
453 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hRisingEdgeToMax", order) << endl;
454 hRisingEdgeToMax[order] = new TH1I (
455 HistoName("hRisingEdgeToMax", order),
456 HistoTitle("Distribution of distance between rising edge and pulse's maximum", order),
457 x_max -x_min,
458 x_min,
459 x_max
460 );
461 hSlopeRisingEdge[order]->SetAxisRange(
462 -5,
463 25,
464 "X");
465 hRisingEdgeToMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
466 hRisingEdgeToMax[order]->GetYaxis()->SetTitle( "counts" );
467 hRisingEdgeToMax[order]->SetStats(mStats);
468 hList->Add( hRisingEdgeToMax[order] );
469 }
470
471 if (mOptions.Contains("M"))
472 {
473 x_min = 10;
474 x_max = 290;
475 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPosOfMax", order) << endl;
476 hPosOfMax[order] = new TH1I (
477 HistoName("hPosOfMax", order),
478 HistoTitle("Distribution of pulse's maximum's positon", order),
479 x_max - x_min,
480 x_min,
481 x_max
482 );
483 hPosOfMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
484 hPosOfMax[order]->GetYaxis()->SetTitle( "counts" );
485 hRisingEdgeToMax[order]->SetStats(mStats);
486 hList->Add( hPosOfMax[order] );
487 }
488
489 if (mVerbosityLevel > 2) cout << "...done" << endl;
490 }
491 }
492}
493//end of BookDistributionHistos
494//----------------------------------------------------------------------------
495
496void
497Pixel::BookTemplateHistos()
498{
499 if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
500 for (int order = 0; order < mMaxPulseOrder; order++)
501 {
502 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMax", order) << endl;
503 hPixelMax[order]=new TH1F(
504 HistoName("hPixelMax", order),
505 HistoTitle("Maximum value of each slice in overlay plot of", order),
506 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
507 (-1*mPixelOverlayXaxisLeft)-0.5,
508 mPixelOverlayXaxisRight-0.5
509 );
510
511 hPixelMax[order]->SetAxisRange(
512 mBSLMean - 5,
513 (mGainMean*(order+1)) + 10,
514 "Y");
515 hPixelMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
516 hPixelMax[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
517 //hMaxProfile->SetBit(TH2F::kCanRebin);
518 hPixelMax[order]->SetStats(mStats);
519 hList->Add( hPixelMax[order] );
520
521//------------------------------------------------------------------------
522
523 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMean", order) << endl;
524 hPixelMean[order] = new TH1F(
525 HistoName("hPixelMean", order),
526 HistoTitle("Mean value of each slice in overlay plot of", order),
527 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
528 (-1*mPixelOverlayXaxisLeft)-0.5,
529 mPixelOverlayXaxisRight-0.5
530 );
531 hPixelMean[order]->SetLineColor(kBlue);
532 hPixelMean[order]->SetAxisRange(
533 mBSLMean - 5,
534 (mGainMean*(order+1)) + 10,
535 "Y");
536 hPixelMean[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
537 hPixelMean[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
538 hPixelMean[order]->SetStats(mStats);
539 hList->Add( hPixelMean[order] );
540
541 //------------------------------------------------------------------------
542
543 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelMedian", order) << endl;
544 hPixelMedian[order] = new TH1F(
545 HistoName("hPixelMedian", order),
546 HistoTitle("Median value of each slice in overlay plot of", order),
547 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
548 (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
549 mPixelOverlayXaxisRight-0.5 //xup
550 );
551 hPixelMedian[order]->SetLineColor(kRed);
552 hPixelMedian[order]->SetAxisRange(
553 mBSLMean - 5,
554 (mGainMean*(order+1)) + 10,
555 "Y");
556 hPixelMedian[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
557 hPixelMedian[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
558 //hMaxProfile->SetBit(TH2F::kCanRebin);
559 hPixelMedian[order]->SetStats(mStats);
560 hList->Add( hPixelMedian[order] );
561
562 }
563 if (mVerbosityLevel > 2) cout << "...done" << endl;
564}
565//end of BookTemplateHistos
566//----------------------------------------------------------------------------
567
568void
569Pixel::BookEdgeTemplateHistos()
570{
571 if (mVerbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
572 for (int order = 0; order < mMaxPulseOrder; order++)
573 {
574 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelEdgeMax", order) << endl;
575 hPixelEdgeMax[order]=new TH1F(
576 HistoName("hPixelEdgeMax", order),
577 HistoTitle("Maximum value of each slice in overlay plot of", order),
578 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
579 (-1*mPixelOverlayXaxisLeft)-0.5,
580 mPixelOverlayXaxisRight-0.5
581 );
582
583 hPixelEdgeMax[order]->SetAxisRange(
584 mBSLMean - 5,
585 (mGainMean*(order+1)) + 10,
586 "Y");
587 hPixelEdgeMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
588 hPixelEdgeMax[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
589 //hMaxProfile->SetBit(TH2F::kCanRebin);
590 hPixelEdgeMax[order]->SetStats(mStats);
591 hList->Add( hPixelEdgeMax[order] );
592
593//------------------------------------------------------------------------
594
595 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelEdgeMean", order) << endl;
596 hPixelEdgeMean[order] = new TH1F(
597 HistoName("hPixelEdgeMean", order),
598 HistoTitle("Mean value of each slice in overlay plot of", order),
599 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
600 (-1*mPixelOverlayXaxisLeft)-0.5,
601 mPixelOverlayXaxisRight-0.5
602 );
603 hPixelEdgeMean[order]->SetLineColor(kBlue);
604 hPixelEdgeMean[order]->SetAxisRange(
605 mBSLMean - 5,
606 (mGainMean*(order+1)) + 10,
607 "Y");
608 hPixelEdgeMean[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
609 hPixelEdgeMean[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
610 hPixelEdgeMean[order]->SetStats(mStats);
611 hList->Add( hPixelEdgeMean[order] );
612
613 //------------------------------------------------------------------------
614
615 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hPixelEdgeMedian", order) << endl;
616 hPixelEdgeMedian[order] = new TH1F(
617 HistoName("hPixelEdgeMedian", order),
618 HistoTitle("Median value of each slice in overlay plot of", order),
619 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,//nbinsx
620 (-1*mPixelOverlayXaxisLeft)-0.5, //xlow
621 mPixelOverlayXaxisRight-0.5 //xup
622 );
623 hPixelEdgeMedian[order]->SetLineColor(kRed);
624 hPixelEdgeMedian[order]->SetAxisRange(
625 mBSLMean - 5,
626 (mGainMean*(order+1)) + 10,
627 "Y");
628 hPixelEdgeMedian[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
629 hPixelEdgeMedian[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
630 //hMaxProfile->SetBit(TH2F::kCanRebin);
631 hPixelEdgeMedian[order]->SetStats(mStats);
632 hList->Add( hPixelEdgeMedian[order] );
633
634 }
635 if (mVerbosityLevel > 2) cout << "...done" << endl;
636}
637//end of BookEdgeTemplateHistos
638//----------------------------------------------------------------------------
639
640void
641Pixel::LoadPulseHistos()
642{
643 mRootFile->cd();
644 mRootFile->cd(CreateSubDirName( mChid ));
645 if (mVerbosityLevel > 2) cout << endl << "...load pixel histograms" << endl;
646 for (int order = 0; order < mMaxPulseOrder; order++)
647 {
648
649 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxOverlay", order) << endl;
650 hMaxOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hMaxOverlay", order) );
651
652 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeOverlay", order) << endl;
653 hEdgeOverlay[order] = (TH2F*)mRootFile->Get( HistoName("hEdgeOverlay", order) );
654
655 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hMaxProfile", order) << endl;
656 hMaxProfile[order] = (TProfile*)mRootFile->Get( HistoName("hMaxProfile", order) );
657
658 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName("hEdgeProfile", order) << endl;
659 hEdgeProfile[order] = (TProfile*)mRootFile->Get( HistoName("hEdgeProfile", order) );
660 }
661}
662// end of LoadPulseHistos
663//----------------------------------------------------------------------------
664
665void
666Pixel::DeletePixelHistos()
667{
668 if (mVerbosityLevel > 2)
669 {
670 cout << endl
671 << "\t...delete current overlay histograms of Pixel# " << mChid;
672 }
673 for (int order = 0;
674 order < mMaxPulseOrder;
675 order ++)
676 {
677 if (mVerbosityLevel > 3)
678 cout << endl << "\t\t...deleting hMaxOverlay"
679 << mChid << "_" << order
680 << " hMaxOverlay[order] adr " << hMaxOverlay[order]
681 << " hMaxOverlay adr " << hMaxOverlay
682 ;
683
684 delete hMaxOverlay[order];
685 hMaxOverlay[order] = NULL;
686
687 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay"
688 << mChid << "_" << order ;
689 delete hEdgeOverlay[order];
690 hEdgeOverlay[order] = NULL;
691
692 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile"
693 << mChid << "_" << order ;
694 delete hMaxProfile[order];
695 hMaxProfile[order] = NULL;
696
697 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile2"
698 << mChid << "_" << order ;
699 delete hEdgeProfile[order];
700 hEdgeProfile[order] = NULL;
701 }
702 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
703
704 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxOverlay";
705 delete[] hMaxOverlay;
706 hMaxOverlay = NULL;
707
708 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeOverlay";
709 delete[] hEdgeOverlay;
710 hEdgeOverlay = NULL;
711
712 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hMaxProfile";
713 delete[] hMaxProfile;
714 hMaxProfile = NULL;
715
716 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hEdgeProfile";
717 delete[] hEdgeProfile;
718 hEdgeProfile = NULL;
719}
720// end of DeletePixelHistos
721//----------------------------------------------------------------------------
722
723void
724Pixel::DeleteDistributionHistos()
725{
726 if (mVerbosityLevel > 2)
727 {
728 cout << endl
729 << "\t...delete current distribution histograms" ;
730 }
731
732 for (int order = 0;
733 order < mMaxPulseOrder;
734 order ++)
735 {
736 if (mOptions.Contains("S"))
737 {
738 if (mVerbosityLevel > 3) cout << endl
739 << "\t\t...deleting hSlopeRisingEdge"
740 << mChid << "_" << order ;
741 delete hSlopeRisingEdge[order];
742 }
743
744 if (mOptions.Contains("R"))
745 {
746 if (mVerbosityLevel > 3) cout << endl
747 << "\t\t...deleting hRisingEdgeToMax"
748 << mChid << "_" << order ;
749 delete hRisingEdgeToMax[order];
750 }
751
752 if (mOptions.Contains("M"))
753 {
754 if (mVerbosityLevel > 3) cout << endl
755 << "\t\t...deleting hPosOfMax"
756 << mChid << "_" << order ;
757
758 delete hPosOfMax[order];
759 }
760
761 }
762 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
763
764 if (mOptions.Contains("S"))
765 {
766 if (mVerbosityLevel > 3)
767 cout << endl << "\t\t...deleting hSlopeRisingEdge";
768 delete[] hSlopeRisingEdge;
769 hSlopeRisingEdge = NULL;
770 }
771
772 if (mOptions.Contains("R"))
773 {
774 if (mVerbosityLevel > 3)
775 cout << endl << "\t\t...deleting hRisingEdgeToMax";
776 delete[] hRisingEdgeToMax;
777 hRisingEdgeToMax = NULL;
778 }
779
780 if (mOptions.Contains("M"))
781 {
782 if (mVerbosityLevel > 3)
783 cout << endl << "\t\t...deleting hPosOfMax";
784 delete[] hPosOfMax;
785 hPosOfMax = NULL;
786 }
787}
788// end of DeletePixelHistos
789//----------------------------------------------------------------------------
790
791void
792Pixel::DeleteTemplateHistos()
793{
794 if (mVerbosityLevel > 2)
795 {
796 cout << endl
797 << "\t...delete current template histograms of Pixel# " << mChid;
798 }
799 for (int order = 0;
800 order < mMaxPulseOrder;
801 order ++)
802 {
803 if (mVerbosityLevel > 3)
804 cout << endl << "\t\t...deleting hPixelMax"
805 << mChid << "_" << order;
806 delete hPixelMax[order];
807 hPixelMax[order] = NULL;
808
809 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMedian"
810 << mChid << "_" << order ;
811 delete hPixelMedian[order];
812 hPixelMedian[order] = NULL;
813
814 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMean"
815 << mChid << "_" << order ;
816 delete hPixelMean[order];
817 hPixelMean[order] = NULL;
818
819 }
820 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
821
822 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMax";
823 delete[] hPixelMax;
824 hPixelMax = NULL;
825
826 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMedian";
827 delete[] hPixelMedian;
828 hPixelMedian = NULL;
829
830 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelMean";
831 delete[] hPixelMean;
832 hPixelMean = NULL;
833}
834// end of DeleteTemplateHistos
835//----------------------------------------------------------------------------
836
837void
838Pixel::DeleteEdgeTemplateHistos()
839{
840 if (mVerbosityLevel > 2)
841 {
842 cout << endl
843 << "\t...delete current template histograms of Pixel# " << mChid;
844 }
845 for (int order = 0;
846 order < mMaxPulseOrder;
847 order ++)
848 {
849 if (mVerbosityLevel > 3)
850 cout << endl << "\t\t...deleting hPixelEdgeMax"
851 << mChid << "_" << order
852 << " hPixelEdgeMax[order] adr " << hPixelEdgeMax[order]
853 << " hPixelEdgeMax adr " << hPixelEdgeMax
854 ;
855
856 delete hPixelEdgeMax[order];
857 hPixelEdgeMax[order] = NULL;
858
859 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMedian"
860 << mChid << "_" << order ;
861 delete hPixelEdgeMedian[order];
862 hPixelEdgeMedian[order] = NULL;
863
864 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMean"
865 << mChid << "_" << order ;
866 delete hPixelEdgeMean[order];
867 hPixelEdgeMean[order] = NULL;
868
869 }
870 if (mVerbosityLevel > 3) cout << endl << "\t...deleting histogram Arrays";
871
872 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMax";
873 delete[] hPixelEdgeMax;
874 hPixelEdgeMax = NULL;
875
876 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMedian";
877 delete[] hPixelEdgeMedian;
878 hPixelEdgeMedian = NULL;
879
880 if (mVerbosityLevel > 3) cout << endl << "\t\t...deleting hPixelEdgeMean";
881 delete[] hPixelEdgeMean;
882 hPixelEdgeMean = NULL;
883}
884// end of DeleteTemplateHistos
885//----------------------------------------------------------------------------
886
887void
888Pixel::MakeTH1Pretty(
889 TH1* histo,
890 TString histName,
891 TString histTitle,
892 int order
893 )
894{
895 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName(histName, order) << endl;
896
897 histo->SetNameTitle(
898 HistoName(histName, order),
899 HistoTitle(histTitle, order)
900 );
901
902 histo->SetBins(
903 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
904 (-1*mPixelOverlayXaxisLeft)-0.5,
905 mPixelOverlayXaxisRight-0.5
906 );
907
908 histo->SetAxisRange(
909 mBSLMean - 5,
910 (mGainMean*(order+1)) + 10,
911 "Y");
912
913 histo->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
914 histo->GetYaxis()->SetTitle( "Amplitude [mV]" );
915 //histo->SetBit(TH2F::kCanRebin);
916 histo->SetStats(mStats);
917}
918// end of MakeTH2Pretty
919//----------------------------------------------------------------------------
920
921
922void
923Pixel::MakeTH2Pretty(
924 TH2* histo,
925 TString histName,
926 TString histTitle,
927 int order
928 )
929{
930 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName(histName, order) << endl;
931
932 histo->SetNameTitle(
933 HistoName(histName, order),
934 HistoTitle(histTitle, order)
935 );
936
937 histo->SetBins(
938 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
939 (-1*mPixelOverlayXaxisLeft)-0.5,
940 mPixelOverlayXaxisRight-0.5 ,
941 512,
942 -55.5,
943 200.5
944 );
945
946 histo->SetAxisRange(
947 mBSLMean - 5,
948 (mGainMean*(order+1)) + 10,
949 "Y");
950
951 histo->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
952 histo->GetYaxis()->SetTitle( "Amplitude [mV]" );
953 //histo->SetBit(TH2F::kCanRebin);
954 histo->SetStats(mStats);
955}
956// end of MakeTH2Pretty
957//----------------------------------------------------------------------------
958
959void
960Pixel::MakeTProfilePretty(
961 TProfile* histo,
962 TString histName,
963 TString histTitle,
964 int order
965 )
966{
967 if (mVerbosityLevel > 3) cout << "\t...booking " << HistoName(histName, order) << endl;
968
969 histo->SetNameTitle(
970 HistoName(histName, order),
971 HistoTitle(histTitle, order)
972 );
973
974 histo->SetBins(
975 mPixelOverlayXaxisLeft + mPixelOverlayXaxisRight ,
976 (-1*mPixelOverlayXaxisLeft)-0.5,
977 mPixelOverlayXaxisRight-0.5
978 );
979 histo->SetOption( "s" );
980
981 histo->SetAxisRange(
982 mBSLMean - 5,
983 (mGainMean*(order+1)) + 10,
984 "Y");
985
986 histo->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
987 histo->GetYaxis()->SetTitle( "Amplitude [mV]" );
988 //histo->SetBit(TH2F::kCanRebin);
989 histo->SetStats(mStats);
990}
991// end of MakeTProfilePretty
992//----------------------------------------------------------------------------
993
994
995
Note: See TracBrowser for help on using the repository browser.