Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / EMCAL / macros / QaDB / makeEMCALQARef.C
1 /* 
2
3   JLKlay 04-July-2008
4
5   Example macro to store QA reference data from simulations into OCDB
6
7   All EMCAL.QA.<runnumber>.*.root files are merged by the qas.Merge(runNumber)
8   method, then stored into the local directory
9   $ALICE_ROOT/EMCAL/Ref/Sim/Run0_999999999_v0_s0.root
10
11 */
12
13
14 void makeEMCALQARef(Int_t runNumber = 0, Int_t viewHistos = 0) {
15
16   // Save QA data generated by DataMaker into OCDB
17   AliCDBManager * man = AliCDBManager::Instance();
18   man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
19   // where ?
20   AliQA::SetQARefStorage("local://$ALICE_ROOT/OCDB");
21   // what ?
22   AliQA::SetQARefDataDirName("Sim") ; //Data, Pedestals, BlackEvent,.....
23
24   AliQADataMakerSteer qas ;
25   //Find all files of the type EMCAL.QA.<runNumber>.*.root and add
26   //them together
27   qas.Merge(runNumber);
28   //Save to OCDB
29   qas.Save2OCDB(runNumber) ;
30
31   if(viewHistos) {
32     TFile *f = new TFile("Merged.QA.0.root");
33   
34     if(f) {
35       //Simulation hits
36       TH1F* hHitE = (TH1F*)f->Get("EMCAL/Hits/hEmcalHits");
37       hHitE->SetDirectory(0);
38       TH1I* hHitM = (TH1I*)f->Get("EMCAL/Hits/hEmcalHitsMul");
39       hHitM->SetDirectory(0);
40       
41       TCanvas *c1 = new TCanvas("c1_hits","Hits",20,20,800,400);
42       c1->Divide(2,1);
43       c1->cd(1);
44       hHitE->Draw();
45       c1->cd(2);
46       hHitM->Draw();
47       
48       //Simulation SDigits
49       TH1F* hSDigE = (TH1F*)f->Get("EMCAL/SDigits/hEmcalSDigits");
50       hSDigE->SetDirectory(0);
51       TH1I* hSDigM = (TH1I*)f->Get("EMCAL/SDigits/hEmcalSDigitsMul");
52       hSDigM->SetDirectory(0);
53       
54       TCanvas *c2 = new TCanvas("c2_sdigits","SDigits",40,40,800,400);
55       c2->Divide(2,1);
56       c2->cd(1);
57       hSDigE->Draw();
58       c2->cd(2);
59       hSDigM->Draw();
60       
61       //Simulation Digits
62       TH1I* hDigA = (TH1I*)f->Get("EMCAL/Digits/hEmcalDigits");
63       hDigA->SetDirectory(0);
64       TH1I* hDigM = (TH1I*)f->Get("EMCAL/Digits/hEmcalDigitsMul");
65       hDigM->SetDirectory(0);
66       
67       TCanvas *c3 = new TCanvas("c3_digits","Digits",60,60,800,400);
68       c3->Divide(2,1);
69       c3->cd(1);
70       hDigA->Draw();
71       c3->cd(2);
72       hDigM->Draw();
73       
74       //RecPoints
75       TH1F* hRpE = (TH1F*)f->Get("EMCAL/RecPoints/hEMCALRpE");
76       hRpE->SetDirectory(0);
77       TH1I* hRpM = (TH1I*)f->Get("EMCAL/RecPoints/hEMCALRpM");
78       hRpM->SetDirectory(0);
79       TH1I* hRpDigM = (TH1I*)f->Get("EMCAL/RecPoints/hEMCALRpDigM");
80       hRpDigM->SetDirectory(0);
81       
82       TCanvas* c4 = new TCanvas("c4_recpoints","RecPoints",80,80,800,800);
83       c4->Divide(2,2);
84       c4->cd(1);
85       hRpE->Draw();
86       c4->cd(2);
87       hRpM->Draw();
88       c4->cd(3);
89       hRpDigM->Draw();
90       
91       //ESDs
92       TH1F* hCClusE = (TH1F*)f->Get("EMCAL/ESDs/hESDCaloClusterE");
93       hCClusE->SetDirectory(0);
94       TH1I* hCClusM = (TH1I*)f->Get("EMCAL/ESDs/hESDCaloClusterM");
95       hCClusM->SetDirectory(0);
96       TH1F* hCCellE = (TH1F*)f->Get("EMCAL/ESDs/hESDCaloCellE");
97       hCCellE->SetDirectory(0);
98       TH1I* hCCellM = (TH1I*)f->Get("EMCAL/ESDs/hESDCaloCellM");
99       hCCellM->SetDirectory(0);
100       
101       TCanvas* c5 = new TCanvas("c5_esds","ESDs",100,100,800,800);
102       c5->Divide(2,2);
103       c5->cd(1);
104       hCClusE->Draw();
105       c5->cd(2);
106       hCClusM->Draw();
107       c5->cd(3);
108       hCCellE->Draw();
109       c5->cd(4);
110       hCCellM->Draw();
111     }
112   }
113
114 }