source: fact/tools/rootmacros/PulseTemplates/FCalcPulseTemplate.C@ 14745

Last change on this file since 14745 was 14064, checked in by Jens Buss, 12 years ago
modified Canvases, add fitfunctions for pulseshape, add chi2test
File size: 32.0 KB
Line 
1/********************** FPulseTemplate ***********************
2* open a root-file with pulse overlay histograms
3* calculate most propable Pulse-Shape
4* compute pulse height and pulse integral spektrum of the peaks
5+ draw histos for single, double, tripple, ....above 100mV Photonpulses
6+ draw Parameterdevelopment depending on photon quantity
7+ form a template (shape depending on number of photons)
8 so it can be used for detection of other peaks
9*************************************************************/
10
11//----------------------------------------------------------------------------
12// root libraries
13//----------------------------------------------------------------------------
14
15#include <TROOT.h>
16#include <TCanvas.h>
17#include <TTimer.h>
18#include <Getline.h>
19#include <TMath.h>
20#include <TFile.h>
21#include <TStyle.h>
22#include <TString.h>
23#include <TF1.h>
24
25#include <stdio.h>
26#include <stdint.h>
27#include <cstdio>
28#include <iostream>
29#include <fstream>
30using namespace std;
31
32#define NPIX 1440
33#define NCELL 1024
34#define FAD_MAX_SAMPLES 1024
35#define MAX_PULS_ORDER 1
36#define HAVE_ZLIB
37
38//----------------------------------------------------------------------------
39// rootmacros
40//----------------------------------------------------------------------------
41#include "rootfilehandler.h"
42#include "pixel.h"
43#include "pixelsum.h"
44#include "templateextractors.h"
45#include "configfile.h"
46
47//----------------------------------------------------------------------------
48// Decleration of global variables
49//----------------------------------------------------------------------------
50bool breakout=false;
51
52//----------------------------------------------------------------------------
53// Initialisation of Root Objects
54//----------------------------------------------------------------------------
55
56// Temporary Objects
57
58//Pixelwise Histograms
59
60//All Pixel Histograms
61
62//Root-File Objects
63TObjArray* hAllPixelList = NULL;
64TObjArray* hRootList = NULL;
65
66//Canvases
67TCanvas** cgpPixelPulses = NULL;
68TCanvas** cgpAllPixelPulses = NULL;
69TCanvas** cgpDistributions = NULL;
70//TCanvas* cgpTestHistos = NULL;
71
72//----------------------------------------------------------------------------
73// Functions
74//----------------------------------------------------------------------------
75void DeletePixelCanvases( int, int );
76void
77UpdateCanvases(
78 int verbosityLevel,
79 int max_pulse_order,
80 bool testmode
81 );
82
83//----------------------------------------------------------------------------
84//----------------------------------------------------------------------------
85// MAIN - Funtion
86//----------------------------------------------------------------------------
87//----------------------------------------------------------------------------
88int FCalcPulseTemplate(
89 TString InRootFileName = "20120309_018.root",
90 TString InputPath = "analysis/FPulseTemplate/20120309_018/Overlay/",
91 TString OutputRootFileName = "test.root",
92 TString OutPutPath = "analysis/FPulseTemplate/20120309_018/",
93 int firstpixel = 0,
94 int npixel = -1,
95 int pixelSetSize = 200,
96 int maxPulseOrder = 1,
97 TString histoOptions = "SRM",
98 bool ProduceGraphic = true,
99 bool stats = true,
100 bool saveResults = false,
101// bool fitdata = false,
102 bool debugPixel = true,
103// int refresh_rate = 500, //refresh rate for canvases
104 int verbosityLevel = 2 // different verbosity levels can be implemented here
105 )
106{
107
108 InputPath = SetHostsPaths(true, InputPath );
109 OutPutPath = SetHostsPaths(true, OutPutPath );
110
111 TString outFile = OutPutPath;
112 outFile += OutputRootFileName;
113
114//----------------------------------------------------------------------------
115// Open-Root-File Settings
116//----------------------------------------------------------------------------
117 if (verbosityLevel > 0)
118 {
119 cout << endl << "...load root file" << endl;
120 }
121
122 TFile * inputRootFile
123 = LoadRootFile( InputPath, InRootFileName, verbosityLevel );
124
125 if (inputRootFile == NULL)
126 {
127 cerr << "input file not readable, check file path!!!" << endl;
128 return(0);
129 }
130 if (saveResults)
131 {
132 CreateRootFile( outFile, true, verbosityLevel );
133 }
134
135 TFile * outputRootFile
136 = OpenRootFile( OutPutPath, OutputRootFileName, verbosityLevel );
137//----------------------------------------------------------------------------
138// Define operation range
139//----------------------------------------------------------------------------
140 if ( npixel == -1 )
141 {
142 npixel = NPIX - firstpixel;
143 }
144
145
146 if ( pixelSetSize == -1 )
147 {
148 pixelSetSize = firstpixel +npixel;
149 }
150
151// float GainMean = GainMean; // this has to be extracted from root files
152// float BSLMean = BSLMean; // this has to be extracted from root files
153
154//----------------------------------------------------------------------------
155// root global Settings
156//----------------------------------------------------------------------------
157 if (verbosityLevel > 0)
158 {
159 cout << endl << "...setting up root environment" ;
160 }
161
162 gStyle->SetPalette(1,0);
163 gROOT->SetStyle("Plain");
164// gPad->SetGrid();
165
166
167
168//----------------------------------------------------------------------------
169// root Canvas Settings
170//----------------------------------------------------------------------------
171 if (verbosityLevel > 0)
172 {
173 cout << endl << "...preparing canvases" << endl;
174 }
175
176 //Canvas Pad numbering
177 int PixelCanvasFrameNrs[8] =
178 {
179 1, // Top left
180 2, // Top mid left
181 3, // Top mid right
182 4, // Top right
183 5, // bootom left
184 6, // bootom mid left
185 7, // bottom mid right
186 8 // bootom right
187 };
188
189// //Canvas Pad numbering
190// int DistributionCanvasFrameNrs[4] = {
191// 1, // Top left
192// 2, // Top right
193// 3, // bottom left
194// 4 // bootom right
195// };
196
197 if (ProduceGraphic)
198 {
199
200 //Canvases
201 cgpPixelPulses = new TCanvas*[maxPulseOrder];
202 cgpDistributions = new TCanvas*[maxPulseOrder];
203
204 //TCanvas* gpcDevelopment = NULL;
205 TString cName = "";
206 TString cTitle = "";
207
208 //naming of pulse canvases
209 for (
210 int pulse_order = maxPulseOrder - 1;
211 pulse_order >= 0 ;
212 pulse_order--
213 )
214 {
215 cName ="cgpDistributions";
216 cName += pulse_order;
217
218 cTitle ="Distributions of Pulses with Order of: ";
219 cTitle += pulse_order;
220
221 cgpDistributions[pulse_order]
222 = new TCanvas(cName,cTitle, 720,pulse_order*20,720,720);
223// cgpDistributions[pulse_order]->Divide(2, 2);
224
225 cName ="cgpPixelPulses";
226 cName += pulse_order;
227
228 cTitle ="Overlays of Pulses with Order of: ";
229 cTitle += pulse_order;
230
231 cgpPixelPulses[pulse_order]
232 = new TCanvas(cName,cTitle, 0,pulse_order*20,1400,1400);
233 cgpPixelPulses[pulse_order]->Divide(4, 2);
234 }
235 }
236
237//-----------------------------------------------------------------------------
238// Filter-Settings
239//-----------------------------------------------------------------------------
240
241
242//-----------------------------------------------------------------------------
243// prepare datafile
244//-----------------------------------------------------------------------------
245
246//----------------------------------------------------------------------------
247// Initialize Pixels
248//----------------------------------------------------------------------------
249 if (verbosityLevel > 0)
250 {
251 cout << endl << "...preparing pixels" << endl;
252 }
253
254 Pixel** pixel = new Pixel*[NPIX];
255
256 for (int i = 0 ; i < NPIX; i++)
257 {
258 pixel[i] = NULL;
259 }
260
261 PixelSum* wholeCamera = NULL;
262
263 bool first_pass = true;
264
265//-------------------------------------
266// Loop over Pixel Sets
267//-------------------------------------
268 for ( int firstPixelOfSet = firstpixel;
269 firstPixelOfSet < firstpixel + npixel;
270 firstPixelOfSet += pixelSetSize )
271 {
272 if (verbosityLevel >= 0)
273 {
274 cout << "------------------------------------------------"
275 << endl
276 << "...processing Pixel: "
277 << firstPixelOfSet
278 << " to Pixel: "
279 << firstPixelOfSet+pixelSetSize-1
280 << endl;
281 }
282
283 //--------------------------------------------------------------------
284 // Loops over every Pixel of a Set of Pixels
285 //--------------------------------------------------------------------
286 for ( int pixelID = firstPixelOfSet;
287 pixelID < firstPixelOfSet + pixelSetSize
288 && pixelID < firstpixel + npixel;
289 pixelID++ )
290 {
291 if (verbosityLevel >= 0)
292 {
293 cout << "------------------------------------------------"
294 << endl
295 << "...processing Pixel: "
296 << pixelID << "/"
297 << firstPixelOfSet + pixelSetSize - 1
298 << endl;
299 }
300 if (verbosityLevel > 1)
301 {
302 cout << "-------------------------------------"
303 << endl
304 << "...processing Set from Pixel "
305 << firstPixelOfSet
306 << " to Pixel "
307 << firstPixelOfSet+pixelSetSize-1
308 << " Pixel: " << pixelID
309 << "/" << firstpixel + npixel -1
310 << endl;
311 }
312
313 //-------------------------------------
314 // Create individual Pixel
315 //-------------------------------------
316 if (verbosityLevel > 3)
317 {
318 cout << "...creating pixel: " << pixelID << endl;
319 }
320
321 pixel[pixelID] = new Pixel(
322 pixelID,
323 maxPulseOrder, ///One should get this from the file
324 verbosityLevel,
325 stats,
326 "L",
327 70, ///TODO: get it from the root file
328 230, ///TODO: get it from the root file
329 -1, ///TODO: get it from the root file
330 9, ///TODO: get it from the root file
331 inputRootFile,
332 outputRootFile
333 );
334
335 if (breakout) break;
336
337 //Preparing Camera
338 if (first_pass)
339 {
340 if (verbosityLevel > 0)
341 {
342 cout << endl << "...preparing camera" << endl;
343 }
344
345 wholeCamera = new PixelSum(
346 "AllPixel",
347 1440,
348 maxPulseOrder,
349 verbosityLevel,
350 stats,
351 "C",
352 pixel[pixelID]->mPixelOverlayXaxisLeft,
353 pixel[pixelID]->mPixelOverlayXaxisRight ,
354 pixel[pixelID]->mBSLMean ,
355 pixel[pixelID]->mGainMean ,
356 outputRootFile
357 );
358
359 first_pass = false;
360 }
361 //-------------------------------------
362 // Histogramms of Maximas in Overlay Spectra
363 //-------------------------------------
364
365 for ( int pulse_order = 0 ;
366 pulse_order < pixel[pixelID]->mMaxPulseOrder ;
367 pulse_order ++)
368 {
369 if (verbosityLevel > 2)
370 {
371 cout << "-------------------------------------"
372 << endl
373 << "...processing Set from Pixel "
374 << firstPixelOfSet
375 << " to Pixel "
376 << firstPixelOfSet+pixelSetSize-1
377 << " Pixel: " << pixelID
378 << "/" << firstpixel + npixel -1
379 << " Pulse-Order: " << pulse_order
380 << endl;
381 }
382
383 // Calculate Max Prop. Value of each slice
384 //-------------------------------------
385
386 //from Maximum Overlay
387 if (verbosityLevel > 2)
388 {
389 cout << "...extracting templates from Maximum Overlay "
390 << endl;
391 }
392
393 ExtractPulseTemplate(
394 pixel[pixelID],
395 "Maximum",
396 pulse_order,
397 verbosityLevel
398 );
399
400 //from Edge Overlay
401 if (verbosityLevel > 2)
402 {
403 cout << "...extracting templates from Edge Overlay "
404 << endl;
405 }
406 ExtractPulseTemplate(
407 pixel[pixelID],
408 "Edge",
409 pulse_order,
410 verbosityLevel
411 );
412
413 if ( saveResults )
414 {
415 WritePixelTemplateToCsv(
416 pixel[pixelID],
417 OutPutPath,
418 "Maximum",
419 pulse_order,
420 verbosityLevel
421 );
422
423 WritePixelTemplateToCsv(
424 pixel[pixelID],
425 OutPutPath,
426 "Edge",
427 pulse_order,
428 verbosityLevel
429 );
430 }
431
432 if (ProduceGraphic && debugPixel)
433 {
434 pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->SetLimits(
435 0,
436 300
437 );
438// pixel[pixelID]->ShiftHistoInY(
439// pixel[pixelID]->hPixelEdgeMax[pulse_order],
440// 2
441// );
442
443
444 pixel[pixelID]->DrawTemplateHistograms(
445 cgpPixelPulses,
446 PixelCanvasFrameNrs
447 );
448
449 pixel[pixelID]->DrawEdgeTemplateHistograms(
450 cgpPixelPulses,
451 PixelCanvasFrameNrs
452 );
453
454 //-------------------------------------
455 //-------------------------------------
456 // Test Area
457 //-------------------------------------
458 //-------------------------------------
459
460 cgpPixelPulses[pulse_order]->cd(6);
461
462 double fit_parameters[3];
463 FitFallingEdge(
464 "hugo1",
465 pixel[pixelID]->hPixelEdgeMax[pulse_order],
466 pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetMaximumBin(),
467 pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast(),
468 fit_parameters
469 );
470 cout << "Parameters\t" << fit_parameters[0] << "\n"
471 << fit_parameters[1] << "\n"
472 << fit_parameters[2] << "\n" << endl;
473
474// TF1 *func = new TF1("func", template_function, 0, 300, 10);
475
476// func->SetParameters(
477// -0.5, // bsl
478// pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetFirst() + 50,
479// pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetMaximumBin()
480// ); // range
481
482
483
484// func->SetParNames("baseline",
485// "begin of pol3", "begin of exp",
486// "exp-factor", "exp-tau", "ext-t0",
487// "pol3_0", "pol3_1", "pol3_2", "pol3_3"
488// );
489// pixel[pixelID]->hPixelEdgeMax[pulse_order]->Fit(func);
490
491 TH1F* hTest = new TH1F(
492 "hTest",
493 "Test",
494 pixel[pixelID]->mPixelOverlayXaxisLeft
495 + pixel[pixelID]->mPixelOverlayXaxisRight ,
496 (-1*pixel[pixelID]->mPixelOverlayXaxisLeft)-0.5,
497 pixel[pixelID]->mPixelOverlayXaxisRight-0.5
498 );
499
500 hTest->GetXaxis()->SetLimits(
501 0,
502 300
503 );
504
505 for (int bin = 0;
506 bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast();
507 bin++
508 )
509 {
510 hTest->SetBinContent( bin, (-1)*(fit_parameters[0]+TMath::Exp(fit_parameters[1]+fit_parameters[2]*(bin))) );
511 }
512
513 hTest->Add(pixel[pixelID]->hPixelEdgeMax[pulse_order], 1);
514
515 cgpPixelPulses[pulse_order]->cd(7);
516 hTest->Draw();
517
518 for (int bin = 0;
519 bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast();
520 bin++
521 )
522 {
523 hTest->SetBinContent( bin, (-1)*(hTest->GetBinContent(bin)) );
524 }
525
526// pixel[pixelID]->hPixelEdgeMax[pulse_order]->Fit(func);
527
528 double fit_parameters2[3];
529 FitFallingEdge(
530 "hugo2",
531 hTest,
532 hTest->GetXaxis()->GetFirst()+68,
533 hTest->GetXaxis()->GetFirst()+80,
534 fit_parameters2
535 );
536
537 cgpPixelPulses[pulse_order]->cd(8);
538
539 TH1F* hTest2 = new TH1F(
540 "hTest2",
541 "Test",
542 pixel[pixelID]->mPixelOverlayXaxisLeft
543 + pixel[pixelID]->mPixelOverlayXaxisRight ,
544 (-1*pixel[pixelID]->mPixelOverlayXaxisLeft)-0.5,
545 pixel[pixelID]->mPixelOverlayXaxisRight-0.5
546 );
547
548 hTest2->GetXaxis()->SetLimits(
549 0,
550 300
551 );
552
553 for (int bin = 0;
554 bin < pixel[pixelID]->hPixelEdgeMax[pulse_order]->GetXaxis()->GetLast();
555 bin++
556 )
557 {
558 hTest2->SetBinContent( bin, (-1)*(hTest->GetBinContent(bin)) );
559 }
560
561 double fit_parameters3[3];
562 FitRisingEdge(
563 "hugo3",
564 hTest2,
565 hTest2->GetXaxis()->GetFirst()+68,
566 hTest2->GetXaxis()->GetFirst()+80,
567 fit_parameters3
568 );
569
570 hTest2->Draw();
571
572
573 //-------------------------------------
574 //-------------------------------------
575 // EOF Test Area
576 //-------------------------------------
577 //-------------------------------------
578
579
580 }
581// FitMaxPropabilityPuls(
582// pixel[pixelID]->hPixelEdgeMean[pulse_order],
583// verbosityLevel
584// );
585 //-------------------------------------
586 // Fill Histogramms of Camera
587 //-------------------------------------
588
589 wholeCamera->hMaxOverlay[pulse_order]->Add(
590 pixel[pixelID]->hMaxOverlay[pulse_order]
591 );
592
593 wholeCamera->hMaxProfile[pulse_order]->Add(
594 pixel[pixelID]->hMaxProfile[pulse_order]
595 );
596
597 wholeCamera->hEdgeOverlay[pulse_order]->Add(
598 pixel[pixelID]->hEdgeOverlay[pulse_order]
599 );
600
601 wholeCamera->hEdgeProfile[pulse_order]->Add(
602 pixel[pixelID]->hEdgeProfile[pulse_order]
603 );
604
605 //-------------------------------------
606 // Comparisons
607 //-------------------------------------
608
609 //chi2 test
610 float chi2 =
611 pixel[pixelID]->hPixelEdgeMean[pulse_order]->Chi2Test(
612 pixel[pixelID]->hPixelMean[pulse_order],
613 "UUPCHI2"
614 );
615 cout << "p-Value :" << chi2 << endl;
616 wholeCamera->hChi2EdgetoMax[pulse_order]->Fill(chi2);
617 cgpDistributions[pulse_order]->cd();
618 wholeCamera->hChi2EdgetoMax[pulse_order]->Draw();
619
620 if (verbosityLevel > 2)
621 {
622 cout << endl
623 << "...End of pulseorder "
624 << pulse_order
625 << endl;
626 }
627
628 }
629 // End of Loop over pulsorder of current Pixel
630
631 if (ProduceGraphic && debugPixel)
632 {
633 UpdateCanvases(
634 verbosityLevel,
635 MAX_PULS_ORDER,
636 false
637 );
638 }
639
640 if (debugPixel)
641 {
642 //Process gui events asynchronously during input
643 cout << endl;
644 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
645 timer.TurnOn();
646 TString input = Getline("Type 'q' to exit, <return> to go on: ");
647 timer.TurnOff();
648 if (input=="q\n")
649 {
650 return(0);
651 }
652 }
653
654 if ( saveResults )
655 {
656 pixel[pixelID]->SavePixelHistograms(
657 outFile,
658 saveResults
659 );
660 }
661
662 //deleteCurrent Pixel from Heap
663 delete pixel[pixelID];
664 pixel[pixelID] = NULL;
665
666 if (verbosityLevel > 2)
667 {
668 cout << endl
669 << "...End of Pixel"
670 << endl
671 << "------------------------------------------------"
672 << endl;
673 }
674 }
675 // End of Loop over all Pixels of set
676
677 if (verbosityLevel > 1)
678 {
679 cout << endl
680 << "...End of Loop over all Pixels of set"
681 << endl
682 << "------------------------------------------------"
683 << endl;
684 }
685 }
686 // End of Loop over all Pixelsets
687
688 if (verbosityLevel > 0)
689 {
690 cout << endl
691 << "...End of Loop over all Pixelsets"
692 << endl
693 << "------------------------------------------------"
694 << endl;
695 }
696
697 delete[] pixel;
698 pixel = NULL;
699
700//-------------------------------------
701// Draw All Pixel Histograms
702//-------------------------------------
703
704 for ( int pulse_order = 0 ;
705 pulse_order < wholeCamera->mMaxPulseOrder ;
706 pulse_order ++)
707 {
708 if (verbosityLevel > 2)
709 {
710 cout << "-------------------------------------"
711 << endl
712 << "...processing Pulse-Order: "
713 << pulse_order;
714 }
715
716// Calculate Max Prop. Value of each slice
717//-------------------------------------
718
719 //from Maximum Overlay
720 ExtractPulseTemplate(
721 wholeCamera,
722 "Maximum",
723 pulse_order,
724 verbosityLevel
725 );
726 if ( saveResults )
727 {
728 WritePixelTemplateToCsv(
729 wholeCamera,
730 OutPutPath,
731 "Maximum",
732 pulse_order,
733 verbosityLevel
734 );
735 }
736
737 //from Edge Overlay
738 ExtractPulseTemplate(
739 wholeCamera,
740 "Edge",
741 pulse_order,
742 verbosityLevel
743 );
744 if ( saveResults )
745 {
746 WritePixelTemplateToCsv(
747 wholeCamera,
748 OutPutPath,
749 "Edge",
750 pulse_order,
751 verbosityLevel
752 );
753 }
754
755 if (ProduceGraphic)
756 {
757 wholeCamera->DrawTemplateHistograms(
758 cgpPixelPulses,
759 PixelCanvasFrameNrs
760 );
761
762 wholeCamera->DrawEdgeTemplateHistograms(
763 cgpPixelPulses,
764 PixelCanvasFrameNrs
765 );
766 }
767 } //EOF: Draw All Pixel Histograms
768
769
770//-------------------------------------
771// Save All Pixel Histograms
772//-------------------------------------
773 if ( saveResults )
774 {
775 wholeCamera->SavePixelHistograms(
776 outFile,
777 saveResults
778 );
779 }
780
781 if (ProduceGraphic)
782 {
783 UpdateCanvases(
784 verbosityLevel,
785 MAX_PULS_ORDER,
786 false
787 );
788
789 //Process gui events asynchronously during input
790 cout << endl;
791 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
792 timer.TurnOn();
793 TString input = Getline("press <return> to exit: ");
794 timer.TurnOff();
795 cout << input ;
796 }
797
798//-------------------------------------
799// Delete Objects on Heap
800//-------------------------------------
801 delete wholeCamera;
802 if (ProduceGraphic)
803 {
804 DeletePixelCanvases( maxPulseOrder ,verbosityLevel );
805 }
806 delete inputRootFile;
807 delete outputRootFile;
808
809 return( 0 );
810}
811//----------------------------------------------------------------------------
812// end of main function
813//-----------------------------------------------------------------------------
814
815
816
817
818//-----------------------------------------------------------------------------
819// Funktions
820//-----------------------------------------------------------------------------
821void
822DeletePixelCanvases(
823 int maxPulseOrder,
824 int verbosityLevel
825 )
826{
827 if (verbosityLevel > 2)
828 {
829 cout << endl
830 << "...delete pixel Canvases"
831 << endl;
832 }
833
834 for ( int pulse_order = 0; pulse_order < maxPulseOrder; pulse_order++ )
835 {
836 delete cgpPixelPulses[pulse_order];
837 cgpPixelPulses[pulse_order] = NULL;
838
839 delete cgpDistributions[pulse_order];
840 cgpDistributions[pulse_order] = NULL;
841 }
842
843 delete[] cgpPixelPulses;
844 cgpPixelPulses = NULL;
845
846 delete[] cgpDistributions;
847 cgpDistributions = NULL;
848}
849
850void
851UpdateCanvases(
852 int verbosityLevel,
853 int max_pulse_order,
854 bool testmode
855 )
856{
857 if (verbosityLevel > 3)
858 {
859 cout << endl << "...updating canvases" << endl;
860 }
861 for (int pulse_order = 0; pulse_order < max_pulse_order; pulse_order++)
862 {
863 cgpPixelPulses[pulse_order]->Modified();
864 cgpPixelPulses[pulse_order]->Update();
865
866 cgpDistributions[pulse_order]->Modified();
867 cgpDistributions[pulse_order]->Update();
868// if ( testmode )
869// {
870// cgpTestHistos->Modified();
871// cgpTestHistos->Update();
872// }
873 }
874}
875//-----------------------------------------------------------------------------
876// MAIN Funktion for C compilation
877//-----------------------------------------------------------------------------
878
879int main(int argc,char *argv[])
880{
881// Int_t index;
882 TString test;
883 TString rcFileName;
884 TString processType = "template";
885 bool rcFileNameCmdSet = false;
886 int verbLevel = 0; // different verbosity levels can be implemented here
887 bool verbLevelCmdSet = false;
888 bool save = false;
889 bool produceGraphic = false;
890
891// TString inputRootFile = "test.root";
892// TString inputPath = "";
893// TString outputRootFile = "test.root";
894// TString outPutPath = "";
895// int firstPixel = 0;
896// int nPixel = -1;
897// int pixelSetSize = 40;
898// int maxOrder = 3;
899// bool dbgPixel = false;
900// bool fitdata = false;
901// bool printStats = false;
902
903 // decode arguments
904 if(argc < 2)
905 {
906 printf("no arguements given, using standard arguments\n");
907 }
908
909 // set conditions for functions arguments
910 for (int i=1;i<argc;i++)
911 {
912 test = argv[i];
913
914 if (test.Contains("--config-file") || test.Contains("-c"))
915 {
916 cout << "RC-File: \"" << argv[i + 1] << "\"" << endl;
917 rcFileName = argv[i + 1];
918 rcFileNameCmdSet = true;
919 continue;
920 }
921
922 if (test.Contains("--verbosity") || test.Contains("-v"))
923 {
924 cout << "Verbosity Level: \"" << argv[i + 1] << "\"" << endl;
925 verbLevel = atoi(argv[i + 1]);
926 continue;
927 }
928
929 if (test.Contains("--save") || test.Contains("-s"))
930 {
931 cout << "will save results" << endl;
932 save = true;
933 continue;
934 }
935
936 if (test.Contains("--graphics") || test.Contains("-g"))
937 {
938 cout << "will produce graphics" << endl;
939 produceGraphic = true;
940 continue;
941 }
942 }
943
944 // reading rc-File:
945 if (rcFileNameCmdSet)
946 {
947 configfile rcfile( rcFileName, processType );
948
949 if (save)
950 {
951 rcfile.mSave = save;
952 }
953
954 if (verbLevelCmdSet)
955 {
956 rcfile.mVerbLevel = verbLevel;
957 }
958
959 if (produceGraphic)
960 {
961 rcfile.mProduceGraphic = produceGraphic;
962 }
963
964 //
965 FCalcPulseTemplate(
966 rcfile.mInputFile,
967 rcfile.mInputPath,
968 rcfile.mOutputFile,
969 rcfile.mOutputPath,
970 rcfile.mFirstPixel,
971 rcfile.mNumPixel,
972 rcfile.mPixelSetSize,
973 rcfile.mMaxOrder,
974 rcfile.mHistoOptions,
975 rcfile.mProduceGraphic,
976 rcfile.mPrintStats,
977 rcfile.mSave,
978 rcfile.mDbgPixel,
979 rcfile.mVerbLevel
980 );
981 }
982 else
983 {
984 cout << "user: check if configfile is set correctly in cmd" << endl;
985 }
986
987 return 0;
988}
989
990
Note: See TracBrowser for help on using the repository browser.