added protection
[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)
37142f87 13{
14 AliLog::SetClassDebugLevel("AliTPCRawStream",-5);
15 AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
16 AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
17 AliLog::SetModuleDebugLevel("RAW",-5);
18 AliLog::SetGlobalLogLevel(3);
19
f364a74d 20 AliRawReaderRoot *rawReader = new AliRawReaderRoot(fileName);
21 if ( !rawReader ) return;
22 AliTPCdataQA *calib = new AliTPCdataQA;
23 calib->SetRangeTime(200,800);
24 AliTPCCalibPulser *calibPulser = new AliTPCCalibPulser;
25 calibPulser->SetRangeTime(5,300);
26 printf("Processing data\n");
27 Int_t event=0;
28 while (rawReader->NextEvent()){
29 calib->ProcessEvent(rawReader);
30 rawReader->Reset();
31 calibPulser->ProcessEvent(rawReader);
32 printf("Processing event\t%d\n",event);
33 event++;
34 if (event>maxevent) break;
35 }
36 calibPulser->Analyse();
37 TFile f("dataQA.root","recreate");
38 calibPulser->Write("Pulser");
39 calib->Write("AliTPCdataQA");
40 delete rawReader;
41 delete calib;
42 delete calibPulser;
43
44 f.Close();
45 //
46 TFile f2("dataQA.root");
47 AliTPCdataQA* ped = (AliTPCdataQA*)f2.Get("AliTPCdataQA");
48 AliTPCCalibPulser* pedPulser = (AliTPCCalibPulser*)f2.Get("Pulser");
49
50 AliTPCPreprocessorOnline preprocesor;
51 preprocesor.AddComponent(ped->GetMaxCharge());
52 preprocesor.AddComponent(ped->GetOverThreshold0());
53 preprocesor.AddComponent(ped->GetOverThreshold5());
54 preprocesor.AddComponent(ped->GetOverThreshold10());
55 preprocesor.AddComponent(ped->GetOverThreshold20());
56 preprocesor.AddComponent(ped->GetOverThreshold30());
57 //
58 AliTPCCalPad * pad0 = new AliTPCCalPad(pedPulser->GetCalPadT0());
59 AliTPCCalPad * pad1 = new AliTPCCalPad(pedPulser->GetCalPadQ());
60 AliTPCCalPad * pad2 = new AliTPCCalPad(pedPulser->GetCalPadRMS());
61 pad0->SetName("PulserT0");
62 pad1->SetName("PulserQ");
63 pad2->SetName("PulserRMS");
64
65 preprocesor.AddComponent(pad0);
66 preprocesor.AddComponent(pad1);
67 preprocesor.AddComponent(pad2);
68
69 preprocesor.DumpToFile("CalibTree2.root");
70 AliTPCCalibViewerGUI::ShowGUI("CalibTree2.root");
71}
72
37142f87 73AliTPCCalibViewerGUI * gui=0;
74
75void UpdateGUI(const char *fname="dataQA.root"){
76 //
77 //
78 //
79 TFile f2(fname);
80 AliTPCdataQA* ped = (AliTPCdataQA*)f2.Get("AliTPCdataQA");
81 ped->MakeTree("CalibTree.root");
82 if (!gui){
83 gui = (AliTPCCalibViewerGUI)AliTPCCalibViewerGUI::ShowGUI("CalibTree.root")->At(0);
84 }else{
85 gui->GetViewer();
86 AliTPCCalibViewer *nviewer = new AliTPCCalibViewer("CalibTree.root", "calPads");
87 gui->Initialize(nviewer);
88 }
89}