]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrBase.cxx
Moving gamma jet ana to separate folder. Addding several ana processors.
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / ConvCorrelations / AliAnaConvCorrBase.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * ALICE Experiment at CERN, All rights reserved.                         *
4  *                                                                        *
5  * Primary Author: Svein Lindal <slindal@fys.uio.no>                      *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /// @file   AliAnaConvCorrBase.cxx
17 /// @author Svein Lindal
18 /// @brief  Base class for analysation of conversion particle - track correlations
19
20
21 #include "AliAnaConvCorrBase.h"
22 #include "AliAODTrack.h"
23
24 #include "TClonesArray.h"
25 #include "TH1F.h"
26 #include "TH1I.h"
27 #include "TH2F.h"
28 #include "TList.h"
29 #include "TNtuple.h"
30 #include "AliAODConversionParticle.h"
31
32
33 #include <iostream>
34
35 // Gamma - jet correlation analysis task
36 // Authors: Svein Lindal
37
38
39 using namespace std;
40 ClassImp(AliAnaConvCorrBase)
41
42 //________________________________________________________________________
43 AliAnaConvCorrBase::AliAnaConvCorrBase(TString name) : TObject(),
44   fName(name),
45   fHistograms(NULL),
46   fTriggerPt(0), 
47   fCorrelatedPt(0),
48   fNPhiBins(32)
49 {
50   //Constructor
51   fTBins[0] = 7.0;
52   fTBins[1] = 5.0;
53   fTBins[2] = 3.0;
54
55   fCBins[0] = 5.0;
56   fCBins[1] = 3.0;
57   fCBins[2] = 1.5;
58   
59 }
60
61
62 //________________________________________________________________________________
63 AliAnaConvCorrBase::~AliAnaConvCorrBase() {
64   
65   ///destructor
66   // delete[] fCBins;
67   // delete[] fTBins;
68
69 }
70
71
72 //________________________________________________________________________
73 void AliAnaConvCorrBase::CreateHistograms() {
74   //Create histograms add, to outputlis
75
76   fHistograms = new TList();
77   fHistograms->SetOwner(kFALSE);
78   fHistograms->SetName(fName);
79
80
81
82   for(int iIso = 0; iIso < 2; iIso++) {
83     fHEtaPhiPt[iIso] = new TH2F(
84                                   Form("%s_deta_dphi_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
85                                   Form("%s_deta_dphi_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
86                                   200, -2., 2., fNPhiBins, -TMath::PiOver2(), 3*TMath::PiOver2());
87       fHistograms->Add(fHEtaPhiPt[iIso]);
88   }
89
90   for(int iIso = 0; iIso < 2; iIso++) {
91     fHdEta[iIso] = new TH1F(Form("%s_deta_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
92                             Form("%s_deta_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
93                             200, -2, 2);
94     fHistograms->Add(fHdEta[iIso]);
95   }
96
97   for(int iIso = 0; iIso < 2; iIso++) {
98     fHdPhi[iIso] = new TH1F(Form("%s_dphi_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
99                             Form("%s_dphi_corr_%s", fName.Data(),  (iIso==0)?"nonIso":"isolated"),
100                             fNPhiBins, -TMath::PiOver2(), 3*TMath::PiOver2());
101     fHistograms->Add(fHdPhi[iIso]);
102   }
103   
104   for(int iIso = 0; iIso < 2; iIso++) {
105       fHNTriggers[iIso] = new TH1I(Form("%s_%s_fNTriggers", fName.Data(), (iIso==0)?"nonIso":"isolated"), 
106                                    Form("%s_%s_fNTriggers", fName.Data(), (iIso==0)?"nonIso":"isolated"), 
107                                    fNTBins, 0, fNTBins );
108       fHistograms->Add(fHNTriggers[iIso]);
109   }
110
111
112   for(int iIso = 0; iIso < 2; iIso++) {
113     for(Int_t tBin = 0; tBin < fNTBins; tBin++) {
114       for(Int_t cBin = 0; cBin < fNCBins; cBin++) {
115         fHdPhiBins[iIso][tBin][cBin] =  new TH1F(Form("%s_%s_phi_corr_tBin_%d_cBin_%d", fName.Data(), (iIso==0)?"nonIso":"isolated", tBin, cBin),
116                                                  Form("%s particles dPhi %f<tPt< %f  %f<cPt<%f", (iIso==0)?"not isolated":"isolated", GetLowerBinLimit(tBin, fTBins), GetUpperBinLimit(tBin, fTBins), 
117                                                       GetLowerBinLimit(cBin, fCBins), GetUpperBinLimit(cBin, fCBins)),
118                                                  fNPhiBins, -TMath::PiOver2(), 3*TMath::PiOver2());
119         fHistograms->Add(fHdPhiBins[iIso][tBin][cBin]);
120       }
121     }
122   }
123 }
124
125
126 ///____________________________________________________________________________
127 void AliAnaConvCorrBase::FillTriggerCounters(Float_t tPt, Bool_t isolated){ 
128   //Fill histogram with trigger counters
129   fHNTriggers[0]->Fill(GetTriggerBin(tPt));
130   if(isolated)   fHNTriggers[isolated]->Fill(GetTriggerBin(tPt));
131
132
133 }
134
135 ///_____________________________________________________________________________
136 void AliAnaConvCorrBase::FillHistograms(Float_t tPt, Float_t cPt, Float_t dPhi, Float_t dEta, Bool_t isolated) {
137   //Fill histograms
138   Float_t ptFrac = cPt/tPt;
139
140   Int_t triggerBin = GetTriggerBin(tPt);
141   Int_t corrBin = GetCorrBin(cPt);
142
143   if(triggerBin < 0 ||corrBin < 0) return;
144
145   fHEtaPhiPt[0]->Fill(dEta, dPhi, cPt);
146   fHdEta[0]->Fill(dEta, cPt);
147   fHdPhi[0]->Fill(dPhi, cPt);
148   fHdPhiBins[0][triggerBin][corrBin]->Fill(dPhi);
149   
150
151   if(isolated) {
152     fHEtaPhiPt[isolated]->Fill(dEta, dPhi, cPt);
153     fHdEta[isolated]->Fill(dEta, ptFrac);
154     fHdPhi[isolated]->Fill(dPhi, ptFrac);
155     fHdPhiBins[isolated][triggerBin][corrBin]->Fill(dPhi);
156
157   }
158 }
159
160 ///____________________________________________________________________________
161 Int_t AliAnaConvCorrBase::GetTriggerBin(Float_t pt) const {
162   //Get trigger bin
163   for(Int_t i = 0; i < fNTBins; i++) {
164     if(pt > fTBins[i]) return i;
165   }
166
167   return -1;
168 }
169
170 ///____________________________________________________________________________
171 Int_t AliAnaConvCorrBase::GetCorrBin(Float_t pt) const {
172   //Get correlation particle bin
173   for(Int_t i = 0; i < fNCBins; i++) {
174     if(pt > fCBins[i]) return i;
175   }
176
177   return -1;
178 }
179
180
181
182 ///______________________________________________________________________________
183 Float_t AliAnaConvCorrBase::GetLowerBinLimit(const Int_t bin, const Float_t * const bins) const {
184   //Get lower bin limit for bin 
185   return bins[bin];
186 }
187
188 ///______________________________________________________________________________
189 Float_t AliAnaConvCorrBase::GetUpperBinLimit(const Int_t bin, const Float_t * const bins) const {
190   //Get upper bin limit for bin 
191
192   Float_t limit = -999;
193   if(bin < 1)
194     limit = 999;
195   else
196     limit = bins[bin -1];
197
198   return limit;
199
200 }
201
202
203 //_______________________________________________________________________________
204
205 void AliAnaConvCorrBase::PrintStatistics()  { 
206   //Print some statistics between each file
207   
208   for(int i = 0; i < fNTBins; i++) {
209     Int_t nTrig = fHNTriggers[0]->GetBinContent(i+1);
210     cout << "triggers: " << nTrig << endl;
211     for(int j = 0; j < fNCBins; j++) {
212       cout << fHdPhiBins[0][i][j]->GetEntries() << "/" << ((nTrig>0)? fHdPhiBins[0][i][j]->GetEntries()/nTrig : 0) << ";  ";
213     }
214     cout << endl;
215   }
216 }