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