Adding new classes for numerical debugging
[u/mrichter/AliRoot.git] / TPC / macros / testDataQA.C
CommitLineData
f364a74d 1/*
2 Simple macro to make pedstal calibration
3 and visualize calibration data
4
5 .L $ALICE_ROOT/TPC/macros/testDataQA.C
6
7*/
8
9
10
11
12void testDataQA(Char_t *fileName, Int_t maxevent=10)
266f8637 13{
f364a74d 14 AliRawReaderRoot *rawReader = new AliRawReaderRoot(fileName);
15 if ( !rawReader ) return;
266f8637 16 AliTPCdataQA *calib = new AliTPCdataQA;
17 AliTPCdataQA *calibFast = new AliTPCdataQA;
18 calib->SetRangeTime(1,1000);
19 calibFast->SetRangeTime(1,1000);
f364a74d 20 printf("Processing data\n");
21 Int_t event=0;
22 while (rawReader->NextEvent()){
23 calib->ProcessEvent(rawReader);
24 rawReader->Reset();
266f8637 25 calibFast->ProcessEventFast(rawReader);
f364a74d 26 event++;
266f8637 27 // if you wann to check the handling of Analyse updates uncomment this
28// if(gRandom->Rndm()<0.3) {
29// calib->Analyse();
30// calibFast->Analyse();
31// }
f364a74d 32 if (event>maxevent) break;
33 }
266f8637 34 calib->Analyse();
35 calibFast->Analyse();
36
37 TFile file1("dataQATestAnalyse.root","recreate");
f364a74d 38 calib->Write("AliTPCdataQA");
266f8637 39 calibFast->Write("AliTPCdataQAFast");
f364a74d 40 delete rawReader;
266f8637 41 // delete calib;
42 delete calibFast;
f364a74d 43
266f8637 44 file1.Close();
f364a74d 45 //
266f8637 46 TFile file2("dataQATestAnalyse.root");
47 AliTPCdataQA* cal = (AliTPCdataQA*)file2.Get("AliTPCdataQA");
48 AliTPCdataQA* calFast = (AliTPCdataQA*)file2.Get("AliTPCdataQAFast");
f364a74d 49
50 AliTPCPreprocessorOnline preprocesor;
266f8637 51 preprocesor.AddComponent(cal->GetNoThreshold());
52 preprocesor.AddComponent(cal->GetOverThreshold10());
53 preprocesor.AddComponent(cal->GetOverThreshold20());
54 preprocesor.AddComponent(cal->GetOverThreshold30());
55 preprocesor.AddComponent(cal->GetNLocalMaxima());
56 preprocesor.AddComponent(cal->GetMeanCharge());
57 preprocesor.AddComponent(cal->GetMaxCharge());
58 preprocesor.AddComponent(cal->GetNTimeBins());
59 preprocesor.AddComponent(cal->GetNPads());
60 preprocesor.AddComponent(cal->GetTimePosition());
61
62 AliTPCCalPad* calPadNoThr= new AliTPCCalPad(*calFast->GetNoThreshold());
63 AliTPCCalPad* calPadThr10= new AliTPCCalPad(*calFast->GetOverThreshold10());
64 AliTPCCalPad* calPadThr20= new AliTPCCalPad(*calFast->GetOverThreshold20());
65 AliTPCCalPad* calPadThr30= new AliTPCCalPad(*calFast->GetOverThreshold30());
66 AliTPCCalPad* calNLocal = new AliTPCCalPad(*calFast->GetNLocalMaxima());
67 AliTPCCalPad* calPadMean = new AliTPCCalPad(*calFast->GetMeanCharge());
68 AliTPCCalPad* calPadMax = new AliTPCCalPad(*calFast->GetMaxCharge());
69 AliTPCCalPad* calNTime = new AliTPCCalPad(*calFast->GetNTimeBins());
70 AliTPCCalPad* calNPad = new AliTPCCalPad(*calFast->GetNPads());
71 AliTPCCalPad* calTimePos = new AliTPCCalPad(*calFast->GetTimePosition());
f364a74d 72 //
266f8637 73 calPadNoThr ->SetName(Form("%sFast", calPadNoThr->GetName()));
74 calPadThr10 ->SetName(Form("%sFast", calPadThr10->GetName()));
75 calPadThr20 ->SetName(Form("%sFast", calPadThr20->GetName()));
76 calPadThr30 ->SetName(Form("%sFast", calPadThr30->GetName()));
77 calNLocal ->SetName(Form("%sFast", calNLocal ->GetName()));
78 calPadMean ->SetName(Form("%sFast", calPadMean ->GetName()));
79 calPadMax ->SetName(Form("%sFast", calPadMax ->GetName()));
80 calNTime ->SetName(Form("%sFast", calNTime ->GetName()));
81 calNPad ->SetName(Form("%sFast", calNPad ->GetName()));
82 calTimePos ->SetName(Form("%sFast", calTimePos ->GetName()));
83
84 preprocesor.AddComponent(calPadNoThr );
85 preprocesor.AddComponent(calPadThr10 );
86 preprocesor.AddComponent(calPadThr20 );
87 preprocesor.AddComponent(calPadThr30 );
88 preprocesor.AddComponent(calNLocal );
89 preprocesor.AddComponent(calPadMean );
90 preprocesor.AddComponent(calPadMax );
91 preprocesor.AddComponent(calNTime );
92 preprocesor.AddComponent(calNPad );
93 preprocesor.AddComponent(calTimePos );
f364a74d 94
266f8637 95 preprocesor.DumpToFile("CalibTreeTestAnalyse.root");
96 AliTPCCalibViewerGUI::ShowGUI("CalibTreeTestAnalyse.root");
f364a74d 97}
98