]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/Correlations/DPhi/FourierDecomposition/CheckOutput.C
Updates
[u/mrichter/AliRoot.git] / PWGCF / Correlations / DPhi / FourierDecomposition / CheckOutput.C
1 // "$MYDATA/gsi/gsi.root"
2
3 const char* fileName = "$MYDATA/gsi02/gsi02a.root";
4 const char* listName = "Cont_cloizide_DhcAna";
5
6 // const char* fileName = "dhctask_output_etamax1.root";
7 // const char* listName = "dhclist";
8
9 // From AliDhcTask.h...keep current!
10 const Int_t nPairAxes = 6;
11 const Int_t nEvtAxes  = 3;
12 const Int_t nTrkAxes  = 2;
13 //const Int_t nExtra    = 3;
14
15 TString sCorrAxes[] = {"#Delta#eta", "assoc. p_{T}", "trig. p_{T}", 
16                        "Centrality", "#Delta#phi (rad)",
17                        "z-vertex (cm)", "Charge Comb."};
18 TString sEvtAxes[] = {"z-vertex", "V0M Centrality (%)", "CL1 Centrality"};
19 TString sTrkAxes[] = {"phi", "eta"};
20
21 enum ePairHistAxes  {kDeta, kPtAssc, kPtTrig, kCent, kDphi,
22                      kZvtx};
23 enum eEventHistAxes {kZvtxEvt, kCentV0M, kCentCL1};
24 enum eTrackHistAxes {kPhiTrk, kEtaTrk};
25
26 TObjArray* hists = new TObjArray();
27
28 //gROOT->LoadMacro("../../../common/ProjectionUtils.C+");
29 void CheckOutput()
30 {
31   gStyle->SetOptTitle(0);
32
33   TFile* inFile = new TFile(fileName, "read");
34   TList* dhcList = inFile->Get(listName);
35   if (!dhcList) {
36     Error("","No List %s in %s", fileName, listName);
37     return;
38   }
39
40   THnSparse* hs = dhcList->FindObject("fHS");
41   THnSparse* hm = dhcList->FindObject("fHM");
42
43   if (!hs) {
44     Error("","No hs in list %s", listName);
45     return;
46   }
47
48   TH2F* hEvt = dhcList->FindObject("fHEvt");
49   TH2F* hTrk = dhcList->FindObject("fHTrk");
50   hists->Add(hEvt);
51   hists->Add(hTrk);
52   TH1D* heta = hTrk->ProjectionY();
53   hists->Add(heta);
54
55   TH1D* hzvtx = hEvt->ProjectionX("hzvtx", 1, 90);
56   hists->Add(hzvtx);
57   TH1D* hcent = hEvt->ProjectionY("hcent");
58   hists->Add(hcent);
59   // Correlation projections
60
61   // hs->GetAxis(kZvtx)->SetRangeUser(-1.9, 1.9);
62   // hm->GetAxis(kZvtx)->SetRangeUser(-1.9, 1.9);
63
64   // hs->GetAxis(kCent)->SetRangeUser(0, 4.99);
65   // hm->GetAxis(kCent)->SetRangeUser(0, 4.99);
66
67   TH2D* sig = hs->Projection(kDeta,kDphi); sig->SetName("sig");
68   TH2D* bkg = hm->Projection(kDeta,kDphi); sig->SetName("bkg");
69   sig->Sumw2(); bkg->Sumw2();
70   sig->Scale(1./sig->Integral()); 
71   bkg->Scale(1./bkg->Integral()); 
72   sig->Divide(bkg);
73   sig->GetYaxis()->SetRangeUser(-1.999, 1.999); 
74   TH2D* hcz = hs->Projection(kZvtx, kCent);
75   hcz->SetName("zvtx_vs_cent");
76
77   // 1D
78   TH1D* hzr = 0;
79
80   TH1D *hsVar[nPairAxes], *hmVar[nPairAxes], *evtVar[nEvtAxes], 
81     *trkVar[nTrkAxes];
82
83   for (int i=0; i<nPairAxes; i++) {
84
85     hsVar[i] = hs->Projection(i);
86     hsVar[i]->SetFillColor(kRed-7);
87     hsVar[i]->Sumw2();
88     hsVar[i]->SetTitle(Form("title;%s;same-evt. pairs", sCorrAxes[i].Data()));
89     hmVar[i] = hm->Projection(i);
90     hmVar[i]->SetFillColor(kAzure-9);
91     hmVar[i]->Sumw2();
92     hmVar[i]->SetTitle(Form("title;%s;mixed-evt. pairs", sCorrAxes[i].Data()));
93     hists->Add(hsVar[i]);
94     hists->Add(hmVar[i]);
95     if(i==kZvtx) {
96       hzr = (TH1D*) hsVar[i]->Clone();
97       hzr->SetFillColor(kYellow);
98       hzr->Divide(hmVar[i]);
99       hzr->SetTitle("track count ratio;z-vertex (cm);same/mixed evt track multiplicity");
100       hists->Add(hzr);
101     }
102   }
103   hists->Add(sig);
104
105   /*
106   for (int i=0; i<nEvtAxes; i++) {
107     evtVar[i] = hEvt->Projection(i);
108     evtVar[i]->SetFillColor(kGray);
109     evtVar[i]->SetTitle(Form("title;%s;events", sEvtAxes[i].Data()));
110     hists->Add(evtVar[i]);
111     if (i==1) cout << evtVar[i]->Integral(1, 89) << endl;
112   }
113   for (int i=0; i<nTrkAxes; i++) {
114     trkVar[i] = hTrk->Projection(i);
115     trkVar[i]->SetTitle(Form("title;%s;tracks", sTrkAxes[i].Data()));
116     hists->Add(trkVar[i]);
117   }
118
119   //hists->Add(hcz);
120   */
121
122   for (int n=0; n<hists->GetEntries(); n++) {
123     TCanvas* c = new TCanvas(Form("c%d",n), Form("c%d",n), 
124                        10*n, 10*n, 700, 500);
125     TObject* obj = hists->At(n);
126     if (obj->InheritsFrom("TH2")) {
127       TH2* h2 = (TH2*) obj;
128       h2->Draw("surf1");
129     }
130     else if (obj->InheritsFrom("TH1")) {
131       TH1* h = (TH1*) obj;
132       h->SetLineWidth(2);
133       h->SetFillStyle(1001); // solid
134       if(h->GetFillColor()==kNone) {
135         h->SetFillColor(kGreen-9);
136       }
137       h->Draw("histf");
138       h->Draw("histepsame");
139     }
140   }
141
142   return;
143 }