]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/macros/testDataQA.C
Macro to msetup and use V0 test (Marian)
[u/mrichter/AliRoot.git] / TPC / macros / testDataQA.C
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
12 void testDataQA(Char_t *fileName, Int_t maxevent=10)
13 {
14    AliRawReaderRoot *rawReader = new AliRawReaderRoot(fileName);
15    if ( !rawReader ) return;
16    AliTPCdataQA *calib     = new AliTPCdataQA; 
17    AliTPCdataQA *calibFast = new AliTPCdataQA; 
18    calib->SetRangeTime(1,1000);
19    calibFast->SetRangeTime(1,1000);
20    printf("Processing data\n");
21    Int_t event=0;
22    while (rawReader->NextEvent()){
23      calib->ProcessEvent(rawReader);
24      rawReader->Reset();
25      calibFast->ProcessEventFast(rawReader);
26      event++;
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 //      }
32      if (event>maxevent) break;
33    }
34    calib->Analyse();
35    calibFast->Analyse();
36
37    TFile file1("dataQATestAnalyse.root","recreate");
38    calib->Write("AliTPCdataQA");
39    calibFast->Write("AliTPCdataQAFast");
40    delete rawReader;
41    //   delete calib;
42    delete calibFast;
43
44    file1.Close();
45    //
46    TFile file2("dataQATestAnalyse.root");
47    AliTPCdataQA* cal = (AliTPCdataQA*)file2.Get("AliTPCdataQA");
48    AliTPCdataQA* calFast = (AliTPCdataQA*)file2.Get("AliTPCdataQAFast");
49    
50    AliTPCPreprocessorOnline preprocesor;
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());
72    //
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  );
94    
95    preprocesor.DumpToFile("CalibTreeTestAnalyse.root");
96    AliTPCCalibViewerGUI::ShowGUI("CalibTreeTestAnalyse.root");
97 }
98