source: fact/tools/rootmacros/FPulseTemplate.C@ 13382

Last change on this file since 13382 was 13378, checked in by Jens Buss, 13 years ago
now one can plot different pulse orders
File size: 49.9 KB
Line 
1/********************** FPulseTemplate ***********************
2* read FACT raw data
3* remove spikes
4* calculate baseline
5* find peaks (CFD and normal discriminator)
6* compute pulse height and pulse integral spektrum of the peaks
7+ search for Peaks in data
8+ put peaks into different histos depending und Amplitude
9+ draw histos for single, double, tripple, ....above 100mV Photonpulses
10+ draw Parameterdevelopment depending on photon quantity
11+ form a template (shape depending on number of photons)
12 so it can be used for detection of other peaks
13*************************************************************/
14
15//----------------------------------------------------------------------------
16// root libraries
17//----------------------------------------------------------------------------
18
19#include <TROOT.h>
20#include <TCanvas.h>
21#include <TProfile.h>
22#include <TTimer.h>
23#include <TH1F.h>
24#include <TH2F.h>
25#include <Getline.h>
26#include <TLine.h>
27#include <TBox.h>
28#include <TMath.h>
29#include <TFile.h>
30#include <TStyle.h>
31#include <TString.h>
32#include <TProfile.h>
33
34#include <stdio.h>
35#include <stdint.h>
36#include <cstdio>
37
38#define NPIX 1440
39#define NCELL 1024
40#define FAD_MAX_SAMPLES 1024
41#define MAX_PULS_ORDER 1
42#define HAVE_ZLIB
43
44//----------------------------------------------------------------------------
45// rootmacros
46//----------------------------------------------------------------------------
47
48#include "fits.h"
49
50#include "openFits.h"
51#include "openFits.c"
52
53#include "discriminator.h"
54#include "discriminator.C"
55#include "zerosearch.h"
56#include "zerosearch.C"
57#include "factfir.C"
58
59#include "DrsCalibration.C"
60#include "DrsCalibration.h"
61
62#include "SpikeRemoval.h"
63#include "SpikeRemoval.C"
64
65//----------------------------------------------------------------------------
66// Decleration of global variables
67//----------------------------------------------------------------------------
68
69bool breakout=false;
70
71int gNEvents;
72vector<int16_t> AllPixelDataVector;
73vector<int16_t> StartCellVector;
74unsigned int CurrentEventID;
75size_t PXLxROI;
76UInt_t gRegionOfInterest;
77UInt_t NumberOfPixels;
78TString histotitle;
79
80size_t TriggerOffsetROI, RC;
81size_t drs_n;
82vector<float> drs_basemean;
83vector<float> drs_gainmean;
84vector<float> drs_triggeroffsetmean;
85
86vector<float> Ameas(FAD_MAX_SAMPLES); // copy of the data (measured amplitude
87vector<float> Vcorr(FAD_MAX_SAMPLES); // corrected Values
88vector<float> Vslide(FAD_MAX_SAMPLES); // sliding average result
89vector<float> Vcfd(FAD_MAX_SAMPLES); // CDF result
90vector<float> Vcfd2(FAD_MAX_SAMPLES); // CDF result + 2nd sliding average
91
92float gGainMean = 9;
93float gBSLMean = 0;
94
95typedef struct{
96 float maxAmpl;
97 float countOfMax;
98 } OverlayMaximum;
99
100//typedef struct{
101// TString name;
102// TString title;
103// TString xTitle;
104// TString yTitle;
105// float yMax;
106// float yMin;
107//} histAttrib_t;
108
109//histAttrib_t* gHistoAttrib[MAX_PULS_ORDER];
110//histAttrib_t* gMaximumAttrib[MAX_PULS_ORDER];
111//histAttrib_t* gMaxGausAttrib[MAX_PULS_ORDER];
112//histAttrib_t* gProfileAttrib[MAX_PULS_ORDER];
113
114
115// histograms
116const int Number_Of_Debug_Histo_Types = 7;
117
118const unsigned int
119 Ameas_ = 0,
120 N1mean_ = 1,
121 Vcorr_ = 2,
122 Vtest_ = 3,
123 Vslide_ = 4,
124 Vcfd_ = 5,
125 Vcfd2_ = 6;
126
127//const char* gHistoTypes[8] = {
128// "hPixelOverlay",
129// "hPixelMax",
130// "hPixelEdgeOverlay",
131// "hPixelProfile",
132// "hAllPixelOverlay",
133// "hAllPixelMax",
134// "hAllPixelMaxGaus",
135// "hAllPixelProfile"
136//};
137
138//----------------------------------------------------------------------------
139// Initialisation of histograms
140//----------------------------------------------------------------------------
141
142// Temporary Objects
143TH1F* debugHistos = NULL;
144TH2F* hOverlayTemp = NULL;
145TH1F* hMaximumTemp = NULL;
146TH1D* hProjPeak = NULL;
147TH1F* hTesthisto = NULL;
148
149//Pixelwise Histograms
150TH2F* hPixelOverlay[MAX_PULS_ORDER]= {NULL};//histogrammm for overlay of detected Peaks
151TProfile* hPixelProfile[MAX_PULS_ORDER] = {NULL};//histogrammm for Profile of detected Peaks
152TH1F* hPixelMax[MAX_PULS_ORDER] = {NULL};
153TH2F* hPixelEdgeOverlay[MAX_PULS_ORDER] = {NULL};
154
155//All Pixel Histograms
156TH2F* hAllPixelOverlay[MAX_PULS_ORDER] = {NULL};
157TProfile* hAllPixelProfile[MAX_PULS_ORDER] = {NULL};
158TH1F* hAllPixelMax[MAX_PULS_ORDER] = {NULL};
159TH1F* hAllPixelMaxGaus[MAX_PULS_ORDER] = {NULL};
160
161//Histogram Parameters
162Int_t gPixelOverlayXaxisLeft = 0;
163Int_t gPixelOverlayXaxisRight = 0;
164
165//Root-File Objects
166TObjArray* hList = NULL;
167TObjArray* hAllPixelList = NULL;
168TObjArray* hRootList = NULL;
169
170//Canvases
171TCanvas* cgpPixelPulses[MAX_PULS_ORDER] = {NULL};
172TCanvas* cgpAllPixelPulses[MAX_PULS_ORDER] = {NULL};
173TCanvas* cgpTestHistos = NULL;
174//TCanvas* gpcDevelopment = NULL;
175
176//----------------------------------------------------------------------------
177// Functions
178//----------------------------------------------------------------------------
179
180void BookHistos(int );
181void BookPixelHistos(int );
182void BookTestHistos( int );
183void DeletePixelHistos(int );
184void SaveHistograms( const char*, const char*, TObjArray*, int );
185void FillHistograms(vector<Region>*, int, int);
186void PlotPulseShapeOfMaxPropability(unsigned int, int, int);
187void DrawPulseHistograms(int, int);
188void FitMaxPropabilityPuls( TH1F* , int );
189void DrawMaximumHistograms( int, int );
190void DrawTestHistograms( int);
191
192void UpdateCanvases( int, int);
193void DeletePixelCanvases( int );
194
195void CreateRootFile(const char*, int );
196TFile *OpenRootFile(const char*, int );
197void CloseRootFile(TFile *tf);
198TString CreateSubDirName(int); //creates a String containing the path to the subdirectory in root file
199TString CreateSubDirName(const char* );
200//void SetHistogrammSettings( const char*, int, int , int);
201//void CreatePulseCanvas( TCanvas* , unsigned int, const char* , const char*, const char*, int);
202//void DeletePulseCanvas( TCanvas* , unsigned int);
203
204
205//----------------------------------------------------------------------------
206//----------------------------------------------------------------------------
207// MAIN - Funtion
208//----------------------------------------------------------------------------
209//----------------------------------------------------------------------------
210int FPulseTemplate(
211 char* datafilename = "../data/2011/11/09/20111109_006.fits.gz",
212 const char* drsfilename = "../data/2011/11/09/20111109_003.drs.fits.gz",
213 const char* OutRootFileName = "../analysis/FPulseTemplate/20111109_006/20111109_006.pulses.root",
214 bool ProduceGraphic = true,
215 int refresh_rate = 500, //refresh rate for canvases
216 bool spikeDebug = false,
217 bool debugPixel = true,
218 bool fitdata = false,
219 int verbosityLevel = 1, // different verbosity levels can be implemented here
220 int firstevent = 272,
221 int nevents = 500,
222 int firstpixel = 1100,
223 int npixel = 1,
224 int AmplWindowWidth = 14, //Width of Window for selection of pulses to histograms
225 float GainMean = 8,
226 float BSLMean = -1, //4 Histogramms will be drawn, decide how far pulsehights differ from eachother
227 int avg1 = 8,
228 int avg2 = 8,
229 int OverlayWindowLeft = 70,
230 int OverlayWindowRight = 230
231 )
232{
233 gGainMean = GainMean;
234 gBSLMean = BSLMean;
235//----------------------------------------------------------------------------
236// Save-Root-File Settings
237//----------------------------------------------------------------------------
238 CreateRootFile( OutRootFileName, verbosityLevel );
239
240
241//----------------------------------------------------------------------------
242// root global Settings
243//----------------------------------------------------------------------------
244
245 gPixelOverlayXaxisLeft = OverlayWindowLeft;
246 gPixelOverlayXaxisRight = OverlayWindowRight;
247
248 gStyle->SetPalette(1,0);
249 gROOT->SetStyle("Plain");
250// gPad->SetGrid();
251
252 for (
253 int pulse_order = MAX_PULS_ORDER - 1;
254 pulse_order >= 0 ;
255 pulse_order--
256 )
257 {
258 TString cName ="cgpPixelPulses";
259 cName += pulse_order;
260 TString cTitle ="Pulses of Order: ";
261 cTitle += pulse_order;
262 cgpPixelPulses[pulse_order] = new TCanvas(cName,cTitle, 0,pulse_order*20,800,800);
263 cgpPixelPulses[pulse_order]->Divide(2, 2);
264 cName = "cgpAllPixelPulses";
265 cName += pulse_order;
266 cTitle ="AllPixel average of puls shapes of Order: ";
267 cTitle += pulse_order;
268 cgpAllPixelPulses[pulse_order] = new TCanvas( cName, cTitle, 801, pulse_order*20, 800, 800 );
269 cgpAllPixelPulses[pulse_order]->Divide(2, 2);
270 }
271
272 // Create (pointer to) Canvases, which are used in every run,
273 // also in 'non-debug' runs
274 // Canvases only need if spike Debug, but I want to deklare
275 // the pointers anyway ...
276
277 TCanvas *cFiltered = NULL;
278 if (spikeDebug)
279 {
280 cFiltered = new TCanvas("cFiltered","filtered DRS Waveforms", 1,310,400,300);
281 cFiltered->Divide(1, 3);
282 }
283
284 cgpTestHistos = new TCanvas( "cgpTestHistos", "Test Histograms", 801, 0, 800, 800 );
285 cgpTestHistos->Divide(2,0);
286//-----------------------------------------------------------------------------
287// Filter-Settings
288//-----------------------------------------------------------------------------
289// CFD filter settings
290 int k_cfd = 10;
291 vector<double> a_cfd(k_cfd, 0);
292 double b_cfd = 1.;
293 a_cfd[0]=-0.75;
294 a_cfd[k_cfd-1]=1.;
295
296//-----------------------------------------------------------------------------
297// prepare datafile
298//-----------------------------------------------------------------------------
299
300// Open the data file
301
302 fits * datafile;
303 // Opens the raw data file and 'binds' the variables given as
304 // Parameters to the data file. So they are filled with
305 // raw data as soon as datafile->GetRow(int) is called.
306 gNEvents = openDataFits(
307 datafilename,
308 &datafile,
309 AllPixelDataVector,
310 StartCellVector,
311 CurrentEventID,
312 gRegionOfInterest,
313 NumberOfPixels,
314 PXLxROI,
315 verbosityLevel
316 );
317
318 if (gNEvents == 0)
319 {
320 cout << "return code of OpenDataFile:" << datafilename<< endl;
321 cout << "is zero -> aborting." << endl;
322 return 1;
323 }
324
325 if (verbosityLevel > 0)
326 {
327 cout << endl <<"number of events in file: "<< gNEvents << "\t";
328 }
329
330 if ( nevents == -1 || nevents > gNEvents ) nevents = gNEvents; // -1 means all!
331
332 if (verbosityLevel > 0)
333 {
334 cout <<"of, which "<< nevents << " will be processed"<< endl;
335 cout <<"Total # of Pixel: "<< NumberOfPixels << "\t";
336 }
337
338 if ( npixel == -1 || npixel > (int)NumberOfPixels ) npixel = (int)NumberOfPixels; // -1 means all!
339
340 if (verbosityLevel > 0)
341 {
342 cout <<"of, which "<< npixel << " will be processed"<< endl;
343 }
344
345 //Get the DRS calibration
346 RC = openCalibFits( drsfilename, drs_basemean, drs_gainmean, drs_triggeroffsetmean, TriggerOffsetROI);
347 if (RC == 0)
348 {
349 cout << "return code of openCalibFits:" << drsfilename << endl;
350 cout << "is zero -> aborting." << endl;
351 return 1;
352 }
353
354 // Book the histograms
355 BookHistos(verbosityLevel );
356 BookTestHistos( verbosityLevel );
357//-------------------------------------
358// Loop over every Pixel
359//-------------------------------------
360 for ( int pixel = firstpixel; pixel < firstpixel + npixel; pixel++ )
361 {
362 if (verbosityLevel > 0)
363 {
364 cout << "------------------------------------------------" << endl
365 << "...processing Pixel: " << pixel << endl;
366 }
367
368 BookPixelHistos(verbosityLevel );
369
370//--------------------------------------------------------------------
371// Loops over Every Event of Pixel
372//--------------------------------------------------------------------
373 for ( int ev = firstevent; ev < firstevent + nevents; ev++)
374 {
375 // Get an Event --> consists of 1440 Pixel ...erm....data
376 datafile->GetRow( ev );
377
378 if (verbosityLevel > 0)
379 {
380 cout << "-------------------------------------" << endl
381 << "...processing Event: " << CurrentEventID
382 << "/" << nevents << " of Pixel: " << pixel << endl;
383 }
384
385//-------------------------------------
386// Apply Calibration
387//-------------------------------------
388 if (verbosityLevel > 2) cout << "...applying DrsCalibration";
389 applyDrsCalibration(
390 Ameas,
391 pixel,
392 12,
393 12,
394 drs_basemean,
395 drs_gainmean,
396 drs_triggeroffsetmean,
397 gRegionOfInterest,
398 AllPixelDataVector,
399 StartCellVector
400 );
401 if (verbosityLevel > 2) cout << "...done " << endl;
402
403//-------------------------------------
404// Apply Filters
405//-------------------------------------
406 // finds spikes in the raw data, and interpolates the value
407 // spikes are: 1 or 2 slice wide, positive non physical artifacts
408 if (verbosityLevel > 2) cout << "...removeing Spikes";
409 removeSpikes (Ameas, Vcorr);
410 if (verbosityLevel > 2) cout << "...done " << endl;
411
412 // filter Vcorr with sliding average using FIR filter function
413 if (verbosityLevel > 2) cout << "...applying sliding average filter";
414 sliding_avg(Vcorr, Vslide, avg1);
415 if (verbosityLevel > 2) cout << "...done " << endl;
416
417 // filter Vslide with CFD using FIR filter function
418 if (verbosityLevel > 2) cout << "...apllying factfir filter";
419 factfir(b_cfd , a_cfd, k_cfd, Vslide, Vcfd);
420 if (verbosityLevel > 2) cout << "...done " << endl;
421
422 // filter Vcfd with sliding average using FIR filter function
423 if (verbosityLevel > 2) cout << "...applying 2nd sliding average filter";
424 sliding_avg(Vcfd, Vcfd2, avg2);
425 if (verbosityLevel > 2) cout << "...done " << endl;
426
427//-------------------------------------
428// Search vor Zero crossings
429//-------------------------------------
430 if (verbosityLevel > 2) cout << endl << "...searching zero crossings" ;
431 // peaks in Ameas[] are found by searching for zero crossings
432 // in Vcfd2
433 // first Argument 1 means ... *rising* edge
434 // second Argument 1 means ... search with stepsize 1 ... 10 is okay as well
435 vector<Region>* pZXings = zerosearch( Vcfd2 , 1 , 8);
436 // pZXings means "zero cross ings"
437 EnlargeRegion(*pZXings, 10, 10);
438 findAbsMaxInRegions(*pZXings, Vslide);
439 removeMaximaBelow( *pZXings, 3.0);
440 removeRegionWithMaxOnEdge( *pZXings, 2);
441 removeRegionOnFallingEdge( *pZXings, 100);
442 findTimeOfHalfMaxLeft(*pZXings, Vslide, gBSLMean, 5, 10, verbosityLevel );
443 if (verbosityLevel > 2) cout << "...done" << endl;
444
445//-----------------------------------------------------------------------------
446// Fill Overlay Histos
447//-----------------------------------------------------------------------------
448 FillHistograms(pZXings, AmplWindowWidth, verbosityLevel );
449
450//-----------------------------------------------------------------------------
451// Spike Debug
452//-----------------------------------------------------------------------------
453 if ( spikeDebug )
454 {
455 // TODO do this correct. The vectors should be the rigt ones... this is just luck
456 debugHistos[Ameas_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5);
457 debugHistos[Vcorr_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5);
458 debugHistos[Vslide_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5);
459 debugHistos[Vcfd_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5);
460 debugHistos[Vcfd2_].GetXaxis()->Set(Ameas.size() , -0.5 , Ameas.size()-0.5);
461
462 for ( unsigned int sl = 0; sl < gRegionOfInterest; sl++)
463 {
464 debugHistos[Ameas_].SetBinContent(sl, Ameas[sl]);
465 debugHistos[Vcorr_].SetBinContent(sl, Vcorr[sl]);
466 debugHistos[Vslide_].SetBinContent( sl, Vslide[sl] );
467 debugHistos[Vcfd_].SetBinContent( sl, Vcfd[sl] );
468 debugHistos[Vcfd2_].SetBinContent( sl, Vcfd2[sl] );
469 }
470
471
472 cFiltered->cd(1);
473 gPad->SetGrid();
474 debugHistos[Ameas_].Draw();
475
476 cFiltered->cd(2);
477 gPad->SetGrid();
478 debugHistos[Vcorr_].Draw();
479
480 cFiltered->cd(3);
481 gPad->SetGrid();
482 debugHistos[Vslide_].Draw();
483
484 TBox *OneBox;
485 vector<TBox*> MyBoxes;
486 for (unsigned int i=0; i<pZXings->size(); i++){
487 OneBox = new TBox(
488 pZXings->at(i).maxPos -10 ,
489 pZXings->at(i).maxVal -0.5,
490 pZXings->at(i).maxPos +10 ,
491 pZXings->at(i).maxVal +0.5);
492 OneBox->SetLineColor(kBlue);
493 OneBox->SetLineWidth(1);
494 OneBox->SetFillStyle(0);
495 OneBox->SetFillColor(kRed);
496 MyBoxes.push_back(OneBox);
497 OneBox->Draw();
498 }
499
500// cFiltered->cd(3);
501// gPad->SetGrid();
502// debugHistos[Vcfd2_].Draw();
503// TLine *zeroline = new TLine(0, 0, 1024, 0);
504// zeroline->SetLineColor(kBlue);
505// zeroline->Draw();
506
507 cFiltered->Update();
508
509
510 //Process gui events asynchronously during input
511 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
512 timer.TurnOn();
513 TString input = Getline("Type 'q' to exit, <return> to go on: ");
514 timer.TurnOff();
515 if (input=="q\n") {
516 breakout=true;
517 }
518
519 //TODO!!!!!!!!!
520 // do some Garbage collection ...
521 // all the Objects on the heap should be deleted here.
522
523 }// end of if(spikeDebug)
524
525 delete pZXings;
526 if (breakout) break;
527//-------------------------------------
528// Draw 1. Set of Pixel Histograms
529//-------------------------------------
530 if ((ev % refresh_rate) == 0)
531 {
532 DrawPulseHistograms(
533 verbosityLevel,
534 MAX_PULS_ORDER
535 );
536 DrawTestHistograms(
537 verbosityLevel
538 );
539 if (ProduceGraphic)
540 {
541 UpdateCanvases(
542 verbosityLevel,
543 MAX_PULS_ORDER
544 );
545 }
546 }
547
548 if (breakout) break;
549
550 if (verbosityLevel > 2)
551 {
552 cout << endl << "-------------------------------------"<< endl;
553 }
554 }//End of Loop over Events
555//-------------------------------------
556// end of Loops over Events
557//-------------------------------------
558
559//-------------------------------------
560// Histogramms of Maximas in Overlay Spectra
561//-------------------------------------
562
563 PlotPulseShapeOfMaxPropability(
564 MAX_PULS_ORDER,
565 fitdata,
566 verbosityLevel
567 );
568
569
570 if (verbosityLevel > 2) cout << "...done" << endl;
571 //here is what happends at the end of each loop over all pixels
572 //Save Histograms of Pixel into Output rootfile
573 DrawPulseHistograms(
574 verbosityLevel,
575 MAX_PULS_ORDER
576 );
577
578 DrawMaximumHistograms(
579 verbosityLevel,
580 MAX_PULS_ORDER
581 );
582
583 if (ProduceGraphic)
584 {
585 UpdateCanvases(
586 verbosityLevel,
587 MAX_PULS_ORDER
588 );
589 }
590
591// SaveHistograms(
592// OutRootFileName,
593// CreateSubDirName(pixel),
594// hList,
595// verbosityLevel
596// );
597
598 if (debugPixel)
599 {
600 //Process gui events asynchronously during input
601 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
602 timer.TurnOn();
603 TString input = Getline("Type 'q' to exit, <return> to go on: ");
604 timer.TurnOff();
605 if (input=="q\n") {
606 break;
607 }
608 }
609
610 DeletePixelHistos(verbosityLevel);
611
612 if (verbosityLevel > 2)
613 {
614 cout << endl << "...End of Pixel"
615 << endl << "------------------------------------------------"
616 << endl;
617 }
618 }
619 // End of Loop over all Pixels
620
621//-------------------------------------
622// Draw Histograms
623//-------------------------------------
624
625 SaveHistograms( //save histograms of all pixel into output root file
626 OutRootFileName,
627 CreateSubDirName("All"),
628 hAllPixelList,
629 verbosityLevel
630 );
631
632// SaveHistograms( //save histograms of generell results into output root file
633// OutRootFileName,
634// "root",
635// hRootList,
636// verbosityLevel
637// );
638
639
640
641 if (ProduceGraphic)
642 {
643 UpdateCanvases(
644 verbosityLevel,
645 MAX_PULS_ORDER
646 );
647 }
648
649 DeletePixelCanvases( verbosityLevel );
650 return( 0 );
651}
652//----------------------------------------------------------------------------
653// end of main function
654//-----------------------------------------------------------------------------
655
656
657
658
659//-----------------------------------------------------------------------------
660// Funktions
661//-----------------------------------------------------------------------------
662
663
664void BookPixelHistos( int verbosityLevel)
665{
666 if (verbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
667 hList = new TObjArray;
668 TString histoname;
669 for (int order = 0; order < MAX_PULS_ORDER; order ++)
670 {
671// SetHistogramAttributes(
672// "PeakOverlay",
673// order,
674// gOverlayAttrib,
675// MaxAmplOfFirstPulse
676// );
677 histoname = "hPixelOverlay";
678 histoname += order;
679 if (verbosityLevel > 3) cout << "...booking " << histoname << endl;
680 hPixelOverlay[order] = new TH2F(
681 histoname,
682 "Overlay of detected pulses of one pulse order for one Pixel",
683 gPixelOverlayXaxisLeft + gPixelOverlayXaxisRight ,
684 (-1*gPixelOverlayXaxisLeft)-0.5,
685 gPixelOverlayXaxisRight-0.5 ,
686 512,
687 -55.5,
688 300.5
689 );
690 hPixelOverlay[order]->SetAxisRange(
691 gBSLMean - 5,
692 (gGainMean*(order+1)) + 10,
693 "Y");
694 hPixelOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
695 hPixelOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
696 //hPixelProfile->SetBit(TH2F::kCanRebin);
697 hList->Add( hPixelOverlay[order] );
698
699 //------------------------------------------------------------------------
700// SetHistogramAttributes(
701// "PeakMaximum",
702// order,
703// gMaximumAttrib,
704// MaxAmplOfFirstPulse
705// );
706 histoname = "hPixelMax";
707 histoname += order;
708 if (verbosityLevel > 3) cout << "...booking " << histoname << endl;
709 hPixelMax[order] = new TH1F(
710 histoname,
711 "Maximum value of each slice in overlay plot",
712 gPixelOverlayXaxisLeft + gPixelOverlayXaxisRight ,
713 (-1*gPixelOverlayXaxisLeft)-0.5,
714 gPixelOverlayXaxisRight-0.5
715 );
716 hPixelMax[order]->SetAxisRange(
717 gBSLMean - 5,
718 (gGainMean*(order+1)) + 10,
719 "Y");
720 hPixelMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
721 hPixelMax[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
722 hList->Add( hPixelMax[order] );
723
724 //------------------------------------------------------------------------
725// SetHistogramAttributes(
726// "PeakMaxGaus",
727// order,
728// gMaxGausAttrib,
729// MaxAmplOfFirstPulse
730// );
731 histoname = "hPixelEdgeOverlay";
732 histoname += order;
733 if (verbosityLevel > 3) cout << "...booking " << histoname << endl;
734 hPixelEdgeOverlay[order] = new TH2F(
735 histoname,
736 "Overlay at rising edge of detected pulses of one pulse order for one Pixel ",
737 gPixelOverlayXaxisLeft + gPixelOverlayXaxisRight ,
738 (-1*gPixelOverlayXaxisLeft)-0.5,
739 gPixelOverlayXaxisRight-0.5 ,
740 512,
741 -55.5,
742 300.5
743 );
744
745 hPixelEdgeOverlay[order]->SetAxisRange(
746 gBSLMean - 5,
747 (gGainMean*(order+1)) + 10,
748 "Y");
749 hPixelEdgeOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
750 hPixelEdgeOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
751 hList->Add( hPixelEdgeOverlay[order] );
752
753 //------------------------------------------------------------------------
754// SetHistogramAttributes(
755// "PeakProfile",
756// order,
757// gProfileAttrib,
758// MaxAmplOfFirstPulse
759// );
760 histoname = "hPixelProfile";
761 histoname += order;
762 if (verbosityLevel > 3) cout << "...booking " << histoname << endl;
763 hPixelProfile[order] = new TProfile(
764 histoname,
765 "Mean value of each slice in overlay plot (Tprofile)",
766 gPixelOverlayXaxisLeft + gPixelOverlayXaxisRight ,//nbinsx
767 (-1*gPixelOverlayXaxisLeft)-0.5, //xlow
768 gPixelOverlayXaxisRight-0.5 , //xup
769 // 512, //nbinsy
770 -55.5, //ylow
771 300.5, //yup
772 "s"); //option
773 hPixelMax[order]->SetAxisRange(
774 gBSLMean - 5,
775 (gGainMean*(order+1)) + 10,
776 "Y");
777 hPixelProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
778 hPixelProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
779 //hPixelProfile->SetBit(TH2F::kCanRebin);
780 hList->Add( hPixelProfile[order] );
781 }
782 if (verbosityLevel > 2) cout << "...done" << endl;
783}
784//end of BookPixelHistos
785//----------------------------------------------------------------------------
786
787
788void DeletePixelHistos( int verbosityLevel )
789{
790 if (verbosityLevel > 2) cout << endl << "...delete current pixel histograms" ;
791 for (int order = 0; order < MAX_PULS_ORDER; order ++)
792 {
793 if (verbosityLevel > 3) cout << endl << "...deleting hPixelOverlay" << order;
794 delete hPixelOverlay[order];
795 if (verbosityLevel > 3) cout << endl << "...deleting hPixelMax" << order;
796 delete hPixelMax[order];
797 if (verbosityLevel > 3) cout << endl << "...deleting hPixelEdgeOverlay" << order;
798 delete hPixelEdgeOverlay[order];
799 if (verbosityLevel > 3) cout << endl << "...deleting hPixelProfile" << order;
800 delete hPixelProfile[order];
801 }
802 if (verbosityLevel > 3) cout << endl << "...deleting hList";
803 delete hList;
804 if (verbosityLevel > 2) cout << endl << "...done" << endl;
805}
806//end of DeletePixelHistos
807//----------------------------------------------------------------------------
808
809void BookTestHistos( int verbosityLevel )
810{
811 if (verbosityLevel > 2) cout << endl << "...book pixel histograms" << endl;
812
813 hTesthisto = new TH1F (
814 "hTesthisto",
815 "Deviation of rising edge and maximum",
816 200,
817 -300,
818 300
819 );
820 hTesthisto->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
821 hTesthisto->GetYaxis()->SetTitle( "counts" );
822
823 if (verbosityLevel > 2) cout << "...done" << endl;
824}
825//end of BookTestHistos
826//----------------------------------------------------------------------------
827
828void BookHistos( int verbosityLevel )
829{
830 if (verbosityLevel > 2) cout << endl << "...book histograms" << endl;
831 hAllPixelList = new TObjArray;
832 hRootList = new TObjArray;
833 debugHistos = new TH1F[ Number_Of_Debug_Histo_Types ];
834 for ( int type = 0; type < Number_Of_Debug_Histo_Types; type++){
835 debugHistos[ type ].SetBins(1024, 0, 1024);
836 debugHistos[ type ].SetLineColor(1);
837 debugHistos[ type ].SetLineWidth(2);
838 debugHistos[ type ].SetStats(false);
839
840 // set X axis paras
841 debugHistos[ type ].GetXaxis()->SetLabelSize(0.08);
842 debugHistos[ type ].GetXaxis()->SetTitleSize(0.08);
843 debugHistos[ type ].GetXaxis()->SetTitleOffset(1.0);
844 debugHistos[ type ].GetXaxis()->SetTitle(Form("Time slice [%.1f ns/slice]", 1./2.));
845
846 // set Y axis paras
847 debugHistos[ type ].GetYaxis()->SetLabelSize(0.08);
848 debugHistos[ type ].GetYaxis()->SetTitleSize(0.08);
849 debugHistos[ type ].GetYaxis()->SetTitleOffset(0.3);
850 debugHistos[ type ].GetYaxis()->SetTitle("Amplitude [mV]");
851 }
852
853 // All Pixel Histograms
854 //------------------------------------------------------------------------
855 TString histoname;
856 for (int order = 0; order < MAX_PULS_ORDER; order ++)
857 {
858// SetHistogramAttributes(
859// "AllPixelPeakOverlay",
860// order,
861// gOverlayAttrib,
862// MaxAmplOfFirstPulse
863// );
864 histoname = "hAllPixelOverlay";
865 histoname += order;
866 if (verbosityLevel > 3) cout << "...booking " << histoname << endl;
867 hAllPixelOverlay[order] = new TH2F(
868 histoname,
869 "Overlay of detected Pulses of one Order for All Pixels",
870 gPixelOverlayXaxisLeft + gPixelOverlayXaxisRight ,
871 (-1*gPixelOverlayXaxisLeft)-0.5,
872 gPixelOverlayXaxisRight-0.5 ,
873 512,
874 -55.5,
875 300.5
876 );
877 hAllPixelOverlay[order]->SetAxisRange(
878 gBSLMean - 5,
879 (gGainMean*(order+1)) + 10,
880 "Y");
881 hAllPixelOverlay[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
882 hAllPixelOverlay[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
883 //hAllPixelOverlay->SetBit(TH2F::kCanRebin);
884 hAllPixelList->Add( hAllPixelOverlay[order] );
885
886 //------------------------------------------------------------------------
887
888// SetHistogramAttributes(
889// "AllPixelPeakMax",
890// order,
891// gMaximumAttrib,
892// MaxAmplOfFirstPulse
893// );
894 histoname = "hAllPixelMax";
895 histoname += order;
896 if (verbosityLevel > 3) cout << "...booking " << histoname << endl;
897 hAllPixelMax[order] = new TH1F(
898 histoname,
899 "Maximum value of each slice in overlay plot for All Pixels",
900 gPixelOverlayXaxisLeft + gPixelOverlayXaxisRight ,
901 (-1*gPixelOverlayXaxisLeft)-0.5,
902 gPixelOverlayXaxisRight-0.5
903 );
904 hAllPixelMax[order]->SetAxisRange(
905 gBSLMean - 5,
906 (gGainMean*(order+1)) + 10,
907 "Y");
908 hAllPixelMax[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
909 hAllPixelMax[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
910 hAllPixelList->Add( hAllPixelMax[order] );
911
912 //------------------------------------------------------------------------
913// SetHistogramAttributes(
914// "AllPixelPeakMaxGaus",
915// order,
916// gMaxGausAttrib,
917// MaxAmplOfFirstPulse
918// );
919 histoname = "hAllPixelMaxGaus";
920 histoname += order;
921 if (verbosityLevel > 3) cout << "...booking " << histoname << endl;
922 hAllPixelMaxGaus[order] = new TH1F(
923 histoname,
924 "Mean value of each slice in overlay plot for All Pixels",
925 gPixelOverlayXaxisLeft + gPixelOverlayXaxisRight ,
926 (-1*gPixelOverlayXaxisLeft)-0.5,
927 gPixelOverlayXaxisRight-0.5
928 );
929 hAllPixelMaxGaus[order]->SetAxisRange(
930 gBSLMean - 5,
931 (gGainMean*(order+1)) + 10,
932 "Y");
933 hAllPixelMaxGaus[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
934 hAllPixelMaxGaus[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
935 hAllPixelList->Add( hAllPixelMaxGaus[order] );
936
937 //------------------------------------------------------------------------
938// SetHistogramAttributes(
939// "AllPixelPeakProfile",
940// order,
941// gProfileAttrib,
942// MaxAmplOfFirstPulse
943// );
944 histoname = "hAllPixelProfile";
945 histoname += order;
946 if (verbosityLevel > 3) cout << "...booking " << histoname << endl;
947 hAllPixelProfile[order] = new TProfile(
948 histoname,
949 "Mean value of each slice in overlay plot for All Pixels (Tprofile)",
950 gPixelOverlayXaxisLeft + gPixelOverlayXaxisRight ,//nbinsx
951 (-1*gPixelOverlayXaxisLeft)-0.5, //xlow
952 gPixelOverlayXaxisRight-0.5 , //xup
953 // 512, //nbinsy
954 -55.5, //ylow
955 300.5, //yup
956 "s"); //option
957 hAllPixelProfile[order]->SetAxisRange(
958 gBSLMean - 5,
959 (gGainMean*(order+1)) + 10,
960 "Y");
961 hAllPixelProfile[order]->GetXaxis()->SetTitle( "Timeslices [a.u.]" );
962 hAllPixelProfile[order]->GetYaxis()->SetTitle( "Amplitude [mV]" );
963 //hPixelProfile->SetBit(TH2F::kCanRebin);
964 hAllPixelList->Add( hAllPixelProfile[order] );
965
966
967
968 }//end of for over order
969 if (verbosityLevel > 2) cout << "...done" << endl;
970}
971// end of BookHistos
972//----------------------------------------------------------------------------
973
974
975void CreateRootFile(const char * loc_fname, int verbosityLevel)
976{
977 TFile* tf = new TFile(loc_fname,"UPDATE");
978 if (tf->IsZombie())
979 {
980 cout << "Error opening file" << endl;
981 exit(-1);
982 }
983 else {
984 if (verbosityLevel > 1) cout << "creating root-file successfull" << endl;
985 tf->Close();
986 }
987}
988//end of CreateRootFile
989//----------------------------------------------------------------------------
990
991
992TFile* OpenRootFile(const char * loc_fname, int verbosityLevel)
993{
994 TFile* tf = new TFile(loc_fname,"UPDATE");
995 if (tf->IsZombie())
996 {
997 cout << "Error opening file" << endl;
998 exit(-1);
999 }
1000 else {
1001 if (verbosityLevel > 1) cout << "...opening root-file:"
1002 << loc_fname
1003 << " successfull" << endl;
1004 }
1005 return tf;
1006}
1007//end of OpenRootFile
1008//----------------------------------------------------------------------------
1009
1010
1011void CloseRootFile(TFile* tf)
1012{
1013 if (tf->IsZombie())
1014 {
1015 cout << "Error closing file" << endl;
1016 exit(-1);
1017 } else {
1018 tf->Close();
1019 }
1020}
1021//end of CloseRootFile
1022//----------------------------------------------------------------------------
1023
1024
1025void SaveHistograms(
1026 const char* loc_fname,
1027 const char* subdirectory,
1028 TObjArray* histList,
1029 int verbosityLevel
1030 )
1031{
1032 if (verbosityLevel > 2) cout << endl
1033 << "...saving pixel histograms to subdirectory: "
1034 << subdirectory << endl ;
1035
1036 TFile* tf = OpenRootFile(loc_fname, verbosityLevel);
1037 if ( subdirectory != "root")
1038 {
1039 tf->cd();
1040 tf->mkdir(subdirectory,subdirectory);
1041 tf->cd(subdirectory);
1042 }
1043 else
1044 {
1045 tf->cd();
1046 }
1047 histList->Write(); // write the major histograms into the top level directory
1048 if (verbosityLevel > 3) tf->ls();
1049 CloseRootFile( tf ); // close the file
1050 if (verbosityLevel > 2) cout << "...done" << endl;
1051}
1052// end of SaveHistograms
1053//----------------------------------------------------------------------------
1054
1055
1056TString CreateSubDirName(int pixel)
1057{
1058 TString path = "Pixel_";
1059 path += pixel;
1060// cout << "path " << path << endl ;
1061 return path;
1062}
1063// end of CreateSubDirName
1064//----------------------------------------------------------------------------
1065
1066TString CreateSubDirName(const char* title)
1067{
1068 TString path = title;
1069 path += "_Pixel";
1070// cout << "path " << path << endl ;
1071 return path;
1072}
1073// end of CreateSubDirName
1074//----------------------------------------------------------------------------
1075
1076void FillHistograms(
1077 vector<Region>* pZXings,
1078 int AmplWindowWidth,
1079 int verbosityLevel
1080 )
1081{
1082 if (verbosityLevel > 2) cout << endl << "...filling pulse histograms" ;
1083 bool use_this_peak=false;
1084 int order_of_pulse=0;
1085 vector<Region>::iterator reg;
1086
1087 //Loop over all found zerocrossings in Region
1088 for (reg = pZXings->begin() ; reg < pZXings->end() ; reg++)
1089 {
1090 //skip those who are at the Rim of the ROI
1091 if (reg->maxPos < 12 || (unsigned int) reg->maxPos > gRegionOfInterest-12)
1092 {
1093 if (verbosityLevel > 2) cout << endl << "\t...out of range" << endl;
1094 continue;
1095 }
1096 //domstest->Fill(reg->maxPos);
1097
1098 // Define axis range of Histogram
1099 int Left = reg->maxPos - gPixelOverlayXaxisLeft;
1100 int Right = reg->maxPos + gPixelOverlayXaxisRight;
1101 int EdgeLeft = reg->halfRisingEdgePos - gPixelOverlayXaxisLeft;
1102 int EdgeRight = reg->halfRisingEdgePos + gPixelOverlayXaxisRight;
1103
1104 if (Left < 0) Left =0;
1105 if (Right > (int)Vcorr.size() ) Right=Vcorr.size() ;
1106
1107 hTesthisto->Fill( reg->maxPos - reg->halfRisingEdgePos ) ;
1108
1109 if (verbosityLevel > 2) cout << endl << "\t...choosing Histogram" ;
1110
1111 //determine order of pulse and which histogram shall be filled
1112 if (verbosityLevel > 2) cout << endl << "\t...choosing Histogram" ;
1113 for(int order = 0; order < MAX_PULS_ORDER; order++)
1114 {
1115 if (Ameas[reg->maxPos] >= ((gGainMean*(order+1)) - (AmplWindowWidth/2))
1116 && Ameas[reg->maxPos] < ((gGainMean*(order+1)) + AmplWindowWidth/2))
1117 {
1118 //hOverlayTemp = hPixelOverlay[order];
1119 if (verbosityLevel > 2) cout << "...#" << order ;
1120 order_of_pulse = order;
1121 use_this_peak = true;
1122 break;
1123 }
1124 else if (order >= (MAX_PULS_ORDER - 1)){
1125 use_this_peak = false;
1126 if (verbosityLevel > 2) cout << "...NONE" << endl ;
1127 }
1128 }
1129
1130 //Fill overlay und profile histograms
1131 if (use_this_peak){
1132 if (verbosityLevel > 2) cout << "...filling" ;
1133 for ( int pos = Left; pos < Right; pos++){
1134 hPixelOverlay[order_of_pulse]->Fill( pos - (reg->maxPos), Ameas[pos]) ;
1135 hPixelProfile[order_of_pulse]->Fill( pos - (reg->maxPos), Ameas[pos]) ;
1136 hAllPixelOverlay[order_of_pulse]->Fill( pos - (reg->maxPos), Ameas[pos]) ;
1137 hAllPixelProfile[order_of_pulse]->Fill( pos - (reg->maxPos), Ameas[pos]) ;
1138 }
1139 for ( int pos = EdgeLeft; pos < EdgeRight; pos++){
1140// cout << endl << "###filling edge histo###" << endl;
1141 hPixelEdgeOverlay[order_of_pulse]->Fill( pos - (reg->halfRisingEdgePos), Ameas[pos]) ;
1142// cout << endl << "######" << endl;
1143 }
1144 if (verbosityLevel > 2) cout << "...done" << endl;
1145 }
1146 //Breakout option
1147 if (breakout)
1148 break;
1149 }
1150 if (verbosityLevel > 2) cout << "...done" << endl;
1151}
1152// end of FillHistograms
1153//----------------------------------------------------------------------------
1154
1155void DrawTestHistograms(
1156 int verbosityLevel
1157 )
1158{
1159 if (verbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;
1160
1161 cgpTestHistos->cd(1);
1162 hTesthisto->Draw();
1163}
1164// end of DrawTestHistograms
1165//----------------------------------------------------------------------------
1166
1167void DrawPulseHistograms(
1168 int verbosityLevel,
1169 int max_pulse_order
1170 )
1171{
1172 if (verbosityLevel > 2) cout << endl << "...drawing pulse histograms" ;
1173 for (int pulse_order = 0; pulse_order < max_pulse_order; pulse_order++)
1174 {
1175 cgpPixelPulses[pulse_order]->cd(1);
1176 hPixelOverlay[pulse_order]->Draw("COLZ");
1177 cgpPixelPulses[pulse_order]->cd(2);
1178 hPixelProfile[pulse_order]->Draw("COLZ");
1179 cgpPixelPulses[pulse_order]->cd(3);
1180 hPixelEdgeOverlay[pulse_order]->Draw("COLZ");
1181// cgpPixelPulses[pulse_order]->cd(4);
1182// hTesthisto->Draw();
1183
1184 cgpAllPixelPulses[pulse_order]->cd(1);
1185 hAllPixelOverlay[pulse_order]->Draw("COLZ");
1186 cgpAllPixelPulses[pulse_order]->cd(2);
1187 hAllPixelProfile[pulse_order]->Draw("COLZ");
1188
1189 }
1190}
1191// end of DrawPulseHistograms
1192//----------------------------------------------------------------------------
1193
1194
1195void DrawMaximumHistograms(
1196 int verbosityLevel,
1197 int max_pulse_order
1198 )
1199{
1200 if (verbosityLevel > 2) cout << endl << "...drawing maximum histograms" ;
1201 for (int pulse_order = 0; pulse_order < max_pulse_order; pulse_order++)
1202 {
1203 cgpPixelPulses[pulse_order]->cd(4);
1204 hPixelMax[pulse_order]->Draw("LF2");
1205
1206 cgpAllPixelPulses[pulse_order]->cd(4);
1207 hAllPixelMax[pulse_order]->Draw();
1208// cgpAllPixelPulses[pulse_order]->cd(3);
1209 // hAllPixelMaxGaus[pulse_order]->Draw("COLZ");
1210 }
1211}
1212// end of DrawMaximumHistograms
1213//----------------------------------------------------------------------------
1214
1215
1216void UpdateCanvases(
1217 int verbosityLevel,
1218 int max_pulse_order
1219 )
1220{
1221 if (verbosityLevel > 3) cout << endl << "...updating canvases" ;
1222 for (int pulse_order = 0; pulse_order < max_pulse_order; pulse_order++)
1223 {
1224 cgpPixelPulses[pulse_order]->Modified();
1225 cgpPixelPulses[pulse_order]->Update();
1226 cgpAllPixelPulses[pulse_order]->Modified();
1227 cgpAllPixelPulses[pulse_order]->Update();
1228 cgpTestHistos->Modified();
1229 cgpTestHistos->Update();
1230 }
1231}
1232// end of UpdateCanvases
1233//----------------------------------------------------------------------------
1234
1235
1236
1237void
1238PlotPulseShapeOfMaxPropability(
1239 unsigned int max_pulse_order,
1240 int fitdata,
1241 int verbosityLevel
1242 )
1243{
1244 if (verbosityLevel > 2) cout << endl
1245 << "...calculating pulse shape of max. propability"
1246 << endl;
1247 for (unsigned int pulse_order = 0 ; pulse_order < max_pulse_order ; pulse_order ++)
1248 {
1249 if (verbosityLevel > 2) cout << "\t...calculating of "
1250 << "pulse order " << pulse_order;
1251 // vector max_value_of to number of timeslices in Overlay Spectra
1252 vector<OverlayMaximum> max_value_of;
1253 max_value_of.resize(hPixelOverlay[pulse_order]->GetNbinsX());
1254
1255 for (int TimeSlice = 0;
1256 TimeSlice <= hPixelOverlay[pulse_order]->GetNbinsX();
1257 TimeSlice++ )
1258 {
1259 histotitle = "hproj_py"; //generate title of histogram of which MaxVal
1260 histotitle += pulse_order ; //will be calculated
1261
1262 //put maximumvalue of every Y-projection of every timeslice into vector
1263 hProjPeak = hPixelOverlay[pulse_order]->ProjectionY(histotitle, TimeSlice, TimeSlice, "");
1264 max_value_of[ TimeSlice ].maxAmpl = (hProjPeak->GetMaximumBin() * 0.5) - 3.5;
1265 max_value_of[ TimeSlice ].countOfMax = hProjPeak->GetBinContent( hProjPeak->GetMaximumBin() );
1266 hPixelMax[pulse_order]->SetBinContent(TimeSlice, max_value_of[ TimeSlice ].maxAmpl );
1267 }
1268
1269 if (verbosityLevel > 2) cout << "\t...done" << endl;
1270
1271 if (fitdata)
1272 {
1273 FitMaxPropabilityPuls(
1274 hPixelMax[pulse_order],
1275 verbosityLevel
1276 );
1277 }
1278 }
1279}
1280
1281
1282void
1283FitMaxPropabilityPuls(
1284 TH1F* hMaximumTemp,
1285 int verbosityLevel
1286 )
1287 {
1288 if (verbosityLevel > 2) cout << "...fit Landau in histograms" ;
1289 if (verbosityLevel > 2) cout << "\t...calculating Landaufit" ;
1290 hMaximumTemp->Fit("landau", "", "", -50, 250);
1291 if (verbosityLevel > 2) cout << "...done" << endl;
1292 }
1293
1294
1295//void SetHistogrammSettings(
1296// const char* histoType,
1297// int max_puls_order,
1298// int MaxAmplOfFirstPulse,
1299// int verbosityLevel
1300// )
1301//{
1302// if (verbosityLevel > 2) cout << endl << "...set histogram Settings" << endl;
1303// for (int pulse_order = 1; pulse_order <= max_puls_order; pulse_order++)
1304// {
1305// qHistSetting[pulse_order].yMax = (MaxAmplOfFirstPulse * pulse_order);
1306// cout << "\t Max @ " << gHistSetting[pulse_order].yMax << endl;
1307// gHistSetting[pulse_order].name = "h";
1308// gHistSetting[pulse_order].name += histoType;
1309// gHistSetting[pulse_order].name += "PeakOverlay";
1310// gHistSetting[pulse_order].name += pulse_order;
1311// gHistSetting[pulse_order].title = "PeakOverlay with Amplitude around ";
1312// gHistSetting[pulse_order].title += gHistSetting[pulse_order].yMax;
1313// gHistSetting[pulse_order].title += " mV";
1314// gHistSetting[pulse_order].Mname = "h";
1315// gHistSetting[pulse_order].Mname += histoType;
1316// gHistSetting[pulse_order].Mname += "PeakMaximum";
1317// gHistSetting[pulse_order].Mname += pulse_order;
1318// gHistSetting[pulse_order].Mtitle = "Peak (approx) derived with Maximum of above Spektrum with Max of ";
1319// gHistSetting[pulse_order].Mtitle += gHistSetting[pulse_order].yMax;
1320// gHistSetting[pulse_order].Mtitle += " mV";
1321// }
1322// if (verbosityLevel > 2) cout << "...done" << endl;
1323//}
1324
1325
1326//void CreatePulseCanvas(
1327// TCanvas* array_of_canvases,
1328// unsigned int max_pulse_order,
1329// const char* canvas_name,
1330// const char* canvas_title,
1331// const char* pixel,
1332// int verbosityLevel
1333// )
1334//{
1335// if (verbosityLevel > 2) cout << "...building Canvases" ;
1336
1337// for (
1338// unsigned int pulse_order = 1;
1339// pulse_order <= max_pulse_order;
1340// pulse_order++
1341// )
1342// {
1343// TString name = canvas_name;
1344// name += " ";
1345// name += pulse_order;
1346// name += " ";
1347
1348// TString title = "Order ";
1349// title += pulse_order;
1350// title += " ";
1351// title += canvas_title;
1352// title += " of ";
1353// title += pixel;
1354// title += ". Pixel";
1355
1356// array_of_canvases[pulse_order] = new TCanvas(name, title, 1, 1, 1400, 700);
1357// array_of_canvases[pulse_order].Divide(2,2);
1358// }
1359// if (verbosityLevel > 2) cout << "...done" << endl;
1360//}
1361
1362
1363//void
1364//DeletePulseCanvas(
1365// TCanvas* array_of_canvases,
1366// unsigned int max_pulse_order
1367// )
1368//{
1369// for (
1370// unsigned int pulse_order = 1;
1371// pulse_order <= max_pulse_order;
1372// pulse_order++
1373// )
1374// {
1375// delete array_of_canvases[pulse_order];
1376// }
1377//}
1378
1379
1380
1381
1382void
1383DeletePixelCanvases( int verbosityLevel )
1384{
1385 if (verbosityLevel > 2) cout << endl << "...delete pixel Canvas" ;
1386 for (int pulse_order = 0; pulse_order < MAX_PULS_ORDER; pulse_order ++)
1387 {
1388 delete cgpPixelPulses[pulse_order];
1389 }
1390}
1391
1392//----------------------------------------------------------------------------
1393//----------------------------------------------------------------------------
1394
1395//void SetHistogramAttributes(
1396// const char* histoType,
1397// int pulse_order,
1398// histAttrib_t* histoAttrib,
1399// int max_ampl_of_first_pulse
1400// )
1401//{
1402// histoAttrib[pulse_order].yMax = (max_ampl_of_first_pulse * pulse_order);
1403// histoAttrib[pulse_order].yMin = (histoAttrib[pulse_order].yMax/2);
1404// histoAttrib[pulse_order].name = "h";
1405// histoAttrib[pulse_order].name += histoType;
1406// histoAttrib[pulse_order].name = "_";
1407// histoAttrib[pulse_order].name += pulse_order;
1408
1409// histoAttrib[pulse_order].title += histoType;
1410// histoAttrib[pulse_order].title += " with Amplitude around ";
1411// histoAttrib[pulse_order].title += histoAttrib[pulse_order].yMax;
1412// histoAttrib[pulse_order].title += " mV";
1413
1414// histoAttrib[pulse_order].xTitle += "Timeslices [a.u.]";
1415// histoAttrib[pulse_order].yTitle += "Amplitude [mV]";
1416//}
Note: See TracBrowser for help on using the repository browser.