.so cleanup: removed from gSystem->Load()
[u/mrichter/AliRoot.git] / PWGPP / VZERO / FillVZEROEPOADBFull.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include "TFile.h"
3 #include "TString.h"
4 #include "TProfile.h"
5 #include "TList.h"
6 #include "TSystem.h"
7
8 #include "AliOADBContainer.h"
9 #include "AliAnalysisManager.h"
10 #endif
11
12 void FillVZEROEPOADBFull(const char* filename = "AOD083.txt", Bool_t mbOnly = kFALSE)
13 {
14   gSystem->Load("libCore");
15   gSystem->Load("libTree");
16   gSystem->Load("libGeom");
17   gSystem->Load("libVMC");
18   gSystem->Load("libPhysics");
19   gSystem->Load("libMinuit");
20   gSystem->Load("libSTEERBase");
21   gSystem->Load("libESD");
22   gSystem->Load("libAOD");
23   gSystem->Load("libANALYSIS");
24   gSystem->Load("libANALYSISalice");   
25   gSystem->Load("libOADB");
26
27   AliOADBContainer * oadbCont = new AliOADBContainer("vzeroEP");
28
29   {
30     TList *defaultList = new TList;
31     defaultList->SetName("Default");
32     TProfile *profHisto = NULL;
33     TFile fInputDefault("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000170162.root");
34     TList *inputList = (TList*)fInputDefault.Get("coutput");
35     for(Int_t i = 0; i < 11; ++i) {
36       profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
37       profHisto->SetDirectory(0);
38       defaultList->Add(profHisto);
39       profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
40       profHisto->SetDirectory(0);
41       defaultList->Add(profHisto);
42       profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
43       profHisto->SetDirectory(0);
44       defaultList->Add(profHisto);
45       profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
46       profHisto->SetDirectory(0);
47       defaultList->Add(profHisto);
48     }
49     fInputDefault.Close();
50     oadbCont->AddDefaultObject(defaultList);
51     printf("Run 170162 filled\n");
52   }
53
54   {
55     TList *list1 = new TList;
56     TProfile *profHisto = NULL;
57     TFile fInput1("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000169683.root");
58     TList *inputList = (TList*)fInput1.Get("coutput");
59     for(Int_t i = 0; i < 11; ++i) {
60       profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
61       profHisto->SetDirectory(0);
62       list1->Add(profHisto);
63       profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
64       profHisto->SetDirectory(0);
65       list1->Add(profHisto);
66       profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
67       profHisto->SetDirectory(0);
68       list1->Add(profHisto);
69       profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
70       profHisto->SetDirectory(0);
71       list1->Add(profHisto);
72     }
73     oadbCont->AppendObject(list1, 169683, 169683);
74     printf("Run 169683 filled\n");
75   }
76
77   // loop of over all other runs
78   Int_t runList[500];
79   ifstream *fruns = new ifstream (filename);
80   if (!*fruns) return;
81   TString strLine;
82   Int_t count = 0;
83   while (strLine.ReadLine(*fruns)) {
84     runList[count++] = strLine.Atoi();
85   }
86   delete fruns;
87
88   for(Int_t irun = 0; irun < count; ++irun) {
89     TList *list2 = new TList;
90     TProfile *profHisto = NULL;
91     TFile fInput2(Form("csemi/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun]));
92     TList *inputList = (TList*)fInput2.Get("coutput");
93     TFile fInput3(Form("cpbi2/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun]));
94     TList *inputListBis = (TList*)fInput3.Get("coutput");
95     for(Int_t i = 0; i < 11; ++i) {
96       profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
97       profHisto->SetDirectory(0);
98       Int_t ibin = profHisto->FindBin(62.5);
99       profHisto->SetBinContent(ibin,0);
100       profHisto->SetBinError(ibin,0);
101       profHisto->SetBinEntries(ibin,0);
102       if (mbOnly) {
103         profHisto = (TProfile*)inputListBis->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
104         profHisto->SetDirectory(0);
105       }
106       else
107         profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2_%d",i)));
108       list2->Add(profHisto);
109
110       profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
111       profHisto->SetDirectory(0);
112       profHisto->SetBinContent(ibin,0);
113       profHisto->SetBinError(ibin,0);
114       profHisto->SetBinEntries(ibin,0);
115       if (mbOnly) {
116         profHisto = (TProfile*)inputListBis->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
117         profHisto->SetDirectory(0);
118       }
119       else
120         profHisto->Add((TProfile*)inputListBis->FindObject(Form("fY2_%d",i)));
121       list2->Add(profHisto);
122
123       profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
124       profHisto->SetDirectory(0);
125       profHisto->SetBinContent(ibin,0);
126       profHisto->SetBinError(ibin,0);
127       profHisto->SetBinEntries(ibin,0);
128       if (mbOnly) {
129         profHisto = (TProfile*)inputListBis->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
130         profHisto->SetDirectory(0);
131       }
132       else
133         profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2Y2_%d",i)));
134       list2->Add(profHisto);
135
136       profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
137       profHisto->SetDirectory(0);
138       profHisto->SetBinContent(ibin,0);
139       profHisto->SetBinError(ibin,0);
140       profHisto->SetBinEntries(ibin,0);
141       if (mbOnly) {
142         profHisto = (TProfile*)inputListBis->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
143         profHisto->SetDirectory(0);
144       }
145       else
146         profHisto->Add((TProfile*)inputListBis->FindObject(Form("fCos8Psi_%d",i)));
147       list2->Add(profHisto);
148     }
149     oadbCont->AppendObject(list2, runList[irun], runList[irun]);
150     printf("Run %d filled\n",runList[irun]);
151   }
152
153   TString oadbFileName = Form("%s/COMMON/EVENTPLANE/data/vzero.root", AliAnalysisManager::GetOADBPath());
154   oadbCont->WriteToFile(oadbFileName.Data());
155 }