Adding macros to check the raw data (Marian)
[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)
13{
14 AliRawReaderRoot *rawReader = new AliRawReaderRoot(fileName);
15 if ( !rawReader ) return;
16 AliTPCdataQA *calib = new AliTPCdataQA;
17 calib->SetRangeTime(200,800);
18 AliTPCCalibPulser *calibPulser = new AliTPCCalibPulser;
19 calibPulser->SetRangeTime(5,300);
20 printf("Processing data\n");
21 Int_t event=0;
22 while (rawReader->NextEvent()){
23 calib->ProcessEvent(rawReader);
24 rawReader->Reset();
25 calibPulser->ProcessEvent(rawReader);
26 printf("Processing event\t%d\n",event);
27 event++;
28 if (event>maxevent) break;
29 }
30 calibPulser->Analyse();
31 TFile f("dataQA.root","recreate");
32 calibPulser->Write("Pulser");
33 calib->Write("AliTPCdataQA");
34 delete rawReader;
35 delete calib;
36 delete calibPulser;
37
38 f.Close();
39 //
40 TFile f2("dataQA.root");
41 AliTPCdataQA* ped = (AliTPCdataQA*)f2.Get("AliTPCdataQA");
42 AliTPCCalibPulser* pedPulser = (AliTPCCalibPulser*)f2.Get("Pulser");
43
44 AliTPCPreprocessorOnline preprocesor;
45 preprocesor.AddComponent(ped->GetMaxCharge());
46 preprocesor.AddComponent(ped->GetOverThreshold0());
47 preprocesor.AddComponent(ped->GetOverThreshold5());
48 preprocesor.AddComponent(ped->GetOverThreshold10());
49 preprocesor.AddComponent(ped->GetOverThreshold20());
50 preprocesor.AddComponent(ped->GetOverThreshold30());
51 //
52 AliTPCCalPad * pad0 = new AliTPCCalPad(pedPulser->GetCalPadT0());
53 AliTPCCalPad * pad1 = new AliTPCCalPad(pedPulser->GetCalPadQ());
54 AliTPCCalPad * pad2 = new AliTPCCalPad(pedPulser->GetCalPadRMS());
55 pad0->SetName("PulserT0");
56 pad1->SetName("PulserQ");
57 pad2->SetName("PulserRMS");
58
59 preprocesor.AddComponent(pad0);
60 preprocesor.AddComponent(pad1);
61 preprocesor.AddComponent(pad2);
62
63 preprocesor.DumpToFile("CalibTree2.root");
64 AliTPCCalibViewerGUI::ShowGUI("CalibTree2.root");
65}
66