]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/PHOSTasks/PHOS_PbPb/macros/MakePHOSflat.C
added macro for copying LEGO run files from grid
[u/mrichter/AliRoot.git] / PWGGA / PHOSTasks / PHOS_PbPb / macros / MakePHOSflat.C
1 void MakePHOSflat(const Char_t *run = "167915")
2 {
3
4   //Fills PHOS flattening parameters into OADB
5   //Each run-dependent object contains list of 3 objects:
6   //Flattening for TPC, V0A, V0C
7   //Input histograms are read from the file Pi0Flow_*.root
8   // which is the output of the analysis task AliAnalysisTaskPi0Flow
9   // Produced root file should go to
10   //"$ALICE_ROOT/OADB/PHOS/PHOSflat.root"
11
12   /* $Id$ */
13
14   gSystem->Load("libANALYSIS");
15   gSystem->Load("libANALYSISalice");
16   gSystem->Load("libPWGGAPHOSTasks");
17
18
19   TFile * f = TFile::Open(Form("Pi0Flow_%s.root",run)) ;
20   TList * l = (TList*)f->Get("PHOSPi0Flow") ;
21   TH2F *h1 = (TH2F*)l->FindObject("phiRP") ;
22   TH2F *h2 = (TH2F*)l->FindObject("phiRPV0A") ;
23   TH2F *h3 = (TH2F*)l->FindObject("phiRPV0C") ;
24   
25   TF1 * flat = new TF1("flat2","[0]*(1.+2.*[1]*cos(x)+2.*[2]*sin(x)+2.*[3]*cos(2.*x)+2.*[4]*sin(2.*x)+2.*[5]*cos(3.*x)+2.*[6]*sin(3.*x)+2.*[7]*cos(4.*x)+2.*[8]*sin(4.*x))",0.,5.) ;
26   
27   TH2D * hTPC = new TH2D("hTPC","TPC EP",20,0.,100.,8,0.,8.) ;
28   TH2D * hV0A = new TH2D("hV0A","V0A EP",20,0.,100.,8,0.,8.) ;
29   TH2D * hV0C = new TH2D("hV0C","V0C EP",20,0.,100.,8,0.,8.) ;
30   
31   Int_t nCent = h1->GetNbinsY();
32   for(Int_t i=1; i<=nCent; i++){
33     TH1D * h1D = h1->ProjectionX("a",i,i) ;
34     if (h1D->Integral() > 0) {
35       h1D->Sumw2() ;
36       h1D->Fit(flat,"0") ;
37       for(Int_t j=1; j<9; j++)
38         hTPC->SetBinContent(i,j,flat->GetParameter(j)) ;
39     }
40     delete h1D ;
41     
42     h1D = h2->ProjectionX("a",i,i) ;
43     if (h1D->Integral() > 0) {
44       h1D->Sumw2() ;
45       h1D->Fit(flat,"0") ;
46       for(Int_t j=1; j<9; j++)
47         hV0A->SetBinContent(i,j,flat->GetParameter(j)) ;   
48     }
49     delete h1D ;
50     
51     h1D = h3->ProjectionX("a",i,i) ;
52     if (h1D->Integral() > 0) {
53       h1D->Sumw2() ;
54       h1D->Fit(flat,"0") ;
55       for(Int_t j=1; j<9; j++)
56         hV0C->SetBinContent(i,j,flat->GetParameter(j)) ;   
57     }
58     delete h1D ;
59   }
60    
61   AliOADBContainer calibContainer("phosFlat");
62
63   AliPHOSEPFlattener * tpc = new AliPHOSEPFlattener("TPC") ;
64   tpc->SetParameterization(hTPC) ;
65   AliPHOSEPFlattener * v0a = new AliPHOSEPFlattener("V0A") ;
66   v0a->SetParameterization(hV0A) ;
67   AliPHOSEPFlattener * v0c = new AliPHOSEPFlattener("V0C") ;
68   v0c->SetParameterization(hV0C) ;
69   
70
71   // 
72   TObjArray * lhc11h = new TObjArray(3); 
73   lhc11h->SetName("PHOSflat_LHC11h");
74   lhc11h->AddAt(tpc,0) ; //pass 3 reconstruction
75   lhc11h->AddAt(v0a,1) ; //pass 3 reconstruction
76   lhc11h->AddAt(v0c,2) ; //pass 3 reconstruction
77   calibContainer.AppendObject(lhc11h,167693,170593) ;
78
79   calibContainer.WriteToFile("PHOSCflat.root");
80
81
82 }