Renamed
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskPhiCorr.cxx
CommitLineData
1d24927a 1
2#include "TH1F.h"
3#include "TList.h"
4#include "TCanvas.h"
5#include "AliAODEvent.h"
6#include "AliAODTrack.h"
7#include "AliAnalysisTaskPhiCorr.h"
cd17c2ba 8#include "AliMultiEventInputHandler.h"
1d24927a 9
10ClassImp(AliAnalysisTaskPhiCorr)
11
12//________________________________________________________________________
13AliAnalysisTaskPhiCorr::AliAnalysisTaskPhiCorr(const char *name)
14 : AliAnalysisTaskME(name), fHists(0), fHistDphiCO(0), fHistDphiUC(0)
15{
16 // Constructor
17 // Define input and output slots here
18 DefineOutput(1, TList::Class());
19}
20
21
22//________________________________________________________________________
23void AliAnalysisTaskPhiCorr::UserCreateOutputObjects()
24{
25 // Create histograms
26 // Called once
27
28 fHistDphiCO = new TH1F("fHistDPhiCO", "#Delta #Phi distribution", 64, 0., 3.2);
29 fHistDphiCO->GetXaxis()->SetTitle("#Delta#Phi [rad]");
30 fHistDphiCO->GetYaxis()->SetTitle("dN/d#Phi");
31 fHistDphiCO->SetMarkerStyle(kFullCircle);
32
33 fHistDphiUC = new TH1F("fHistDPhiUC", "#Delta #Phi distribution", 64, 0., 3.2);
34 fHistDphiUC->GetXaxis()->SetTitle("#Delta#Phi [rad]");
35 fHistDphiUC->GetYaxis()->SetTitle("dN/d#Phi");
36 fHistDphiUC->SetMarkerStyle(kOpenCircle);
37
38 fHists = new TList();
39 fHists->Add(fHistDphiCO);
40 fHists->Add(fHistDphiUC);
41}
42
43//________________________________________________________________________
44void AliAnalysisTaskPhiCorr::UserExec(Option_t *)
45{
46 // Main loop
47 // Called for each event
48 // Uncorrelated tracks
49 Int_t nev = fInputHandler->GetBufferSize();
50 Float_t wgt = 1./(nev*(nev-1));
976f2793 51 fMixedEvent.Reset();
a9764b55 52
53
1d24927a 54 for (Int_t iev = 0; iev < nev; iev++) {
976f2793 55 AliAODEvent* aod = (AliAODEvent*) GetEvent(iev);
56 fMixedEvent.AddEvent(aod);
1d24927a 57 }
976f2793 58 fMixedEvent.Init();
59 Int_t ntrack = fMixedEvent.GetNumberOfTracks();
60 if (ntrack > 1) {
61 for (Int_t itr = 0; itr < ntrack -1; itr++) {
62 for (Int_t jtr = itr+1; jtr < ntrack; jtr++) {
63 AliVParticle* track1 = fMixedEvent.GetTrack(itr);
64 AliVParticle* track2 = fMixedEvent.GetTrack(jtr);
65 Int_t iev1 = fMixedEvent.EventIndex(itr);
66 Int_t iev2 = fMixedEvent.EventIndex(jtr);
cd17c2ba 67
976f2793 68 Float_t phi1 = track1->Phi();
69 Float_t phi2 = track2->Phi();
70 Float_t dphi = TMath::Abs(phi1 - phi2);
71 if (dphi > TMath::Pi()) dphi = 2. * TMath::Pi() - dphi;
72 if (iev1 != iev2) {
73 fHistDphiUC->Fill(dphi, wgt);
74 } else {
75 fHistDphiCO->Fill(dphi, 0.5);
76 }
77 } // tarcks
78 } // tracks
79 } // more than 1
a9764b55 80
1d24927a 81 PostData(1, fHists);
82}
83
84//________________________________________________________________________
85void AliAnalysisTaskPhiCorr::Terminate(Option_t *)
86{
87 // Draw result to the screen
88 // Called once at the end of the query
89
976f2793 90 TCanvas *c1 = new TCanvas("AliAnalysisTaskPt","Pt",10,10,510,510);
1d24927a 91 c1->cd(1)->SetLogy();
976f2793 92 fHistDphiCO->DrawCopy("E");
93 fHistDphiUC->DrawCopy("Esame");
1d24927a 94}