]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/GammaConv/ConvCorrelations/AliAnaConvIsolation.cxx
bug fix error calculation
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / ConvCorrelations / AliAnaConvIsolation.cxx
CommitLineData
fc7e3b59 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 AliAnalysisTaskGammaJet.cxx
17/// @author Svein Lindal
18/// @brief Class used to run isolation studies of conversion gamma/pions
19
20
21#include "AliAnaConvIsolation.h"
22#include "AliAODTrack.h"
23
24#include "TObject.h"
25#include "TClonesArray.h"
26#include "TH2F.h"
27#include "TList.h"
28#include "AliAODConversionParticle.h"
29
30
31#include <iostream>
32
33// Gamma - jet correlation analysis task
34// Author: Svein Lindal
35
36
37using namespace std;
38ClassImp(AliAnaConvIsolation)
39
40//________________________________________________________________________
41AliAnaConvIsolation::AliAnaConvIsolation () : TObject(),
42 fIsoCurve(NULL),
43 fCurveFunction("0.1*x"),
44 fConeSize(0),
45 fMinPt(0.1),
46 fMaxPtThreshold(0),
47 fSumPtThreshold(0),
48 fMaxPtFraction(0),
49 fSumPtFraction(0),
50 fHistograms(NULL),
51 fHistogramMaxPt(50)
52{
4574af57 53 //Constructor
54 for(Int_t i = 0; i < 2; i++){
55 fhMaxPtInCone[i] = NULL;
56 fhSumPtInCone[i] = NULL;
57 fhSumPtVsMaxPt[i] = NULL;
58 fhPtCandidates[i] = NULL;
59 fhTrackMult[i] = NULL;
60 }
61
62
fc7e3b59 63}
64
65//________________________________________________________________________
66AliAnaConvIsolation::AliAnaConvIsolation(Float_t coneSize, Float_t maxPtThreshold, Float_t sumPtThreshold, Float_t maxPtFraction, Float_t sumPtFraction) :
67 TObject(),
68 fIsoCurve(NULL),
69 fCurveFunction("0.1*x"),
70 fConeSize(coneSize),
71 fMinPt(0.1),
72 fMaxPtThreshold(maxPtThreshold),
73 fSumPtThreshold(sumPtThreshold),
74 fMaxPtFraction(maxPtFraction),
75 fSumPtFraction(sumPtFraction),
76 fHistograms(NULL),
77 fHistogramMaxPt(50)
78{
4574af57 79 //Constructor
80 for(Int_t i = 0; i < 2; i++){
81 fhMaxPtInCone[i] = NULL;
82 fhSumPtInCone[i] = NULL;
83 fhSumPtVsMaxPt[i] = NULL;
84 fhPtCandidates[i] = NULL;
85 fhTrackMult[i] = NULL;
86 }
fc7e3b59 87}
88
89
90//________________________________________________________________________________
91AliAnaConvIsolation::~AliAnaConvIsolation() {
4574af57 92 //Destructor
fc7e3b59 93
94}
95
96
97//________________________________________________________________________
98void AliAnaConvIsolation::CreateHistograms()
99{
4574af57 100 //Create histograms
101 if(!fHistograms) fHistograms = new TList();
fc7e3b59 102 fHistograms->SetName(Form("Isolation_histo_cone_%f_maxPt_%f_sumPt_%f", fConeSize, fSumPtThreshold, fMaxPtThreshold));
103
104 fIsoCurve = new TF1("Isolation_curve", fCurveFunction.Data(), 0, 100);
105 fHistograms->Add(fIsoCurve);
106
107 cout << "Creatin isolation histograms conesize :" << fConeSize << endl;
108
109 //Create histograms add, to outputlis
110 for(Int_t i = 0; i < 2; i++){
111 fhMaxPtInCone[i] = new TH2F(Form("fhMaxPtInCone_%s_%f", (i==0)? "nonIso" : "isolated", fConeSize),
112 Form("Max pt nonIso particle in cone %f vs candidate pt", fConeSize),
113 200, 0, fHistogramMaxPt, 200, 0, fHistogramMaxPt);
114 fHistograms->Add(fhMaxPtInCone[i]);
115
116 fhSumPtInCone[i] = new TH2F(Form("fhSumPtInCone_%s_%f", (i==0)? "nonIso" : "isolated", fConeSize),
117 Form("Sum pt in cone %f vs candidate pt %s", fConeSize, (i==0)? "nonIsoay" : "isolated"),
118 200, 0, fHistogramMaxPt, 200, 0, fHistogramMaxPt);
119 fHistograms->Add(fhSumPtInCone[i]);
120
121 fhSumPtVsMaxPt[i] = new TH2F(Form("fhSumPtVsMaxPt_%s_%f", (i==0)? "nonIso" : "isolated", fConeSize),
122 Form("fhSumPtVsMaxPt_%s_%f", (i==0)? "nonIso" : "isolated", fConeSize),
123 200, 0, fHistogramMaxPt, 200, 0, fHistogramMaxPt);
124 fHistograms->Add(fhSumPtVsMaxPt[i]);
125 }
126
127 for(Int_t iIso = 0; iIso < 2; iIso++){
128 fhPtCandidates[iIso] = new TH1F(Form("fhPtCandidates_%s_%f", (iIso==0)? "nonIso" : "isolated", fConeSize),
129 Form("Pt of %s candidates, cone size %f", (iIso==0)? "nonIsolated" : "isolated", fConeSize),
130 200, 0 , fHistogramMaxPt);
131 fhPtCandidates[iIso]->GetXaxis()->SetTitle("P_{T} (GeV/c)");
132 fhPtCandidates[iIso]->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
133 fhPtCandidates[iIso]->SetMarkerStyle(kFullCircle);
134 fHistograms->Add(fhPtCandidates[iIso]);
135 }
136
137 // for(int iDec = 0; iDec < 2; iDec++) {
138 // for(int iIso = 0; iIso < 2; iIso++) {
139
140 // fHistSumPt[iIso][iDec] = new TH1F(Form("fHistSumPt_%f_%s_%s", fConeSize, (iIso==0)?"nonIso":"isolated" , (iDec==0)?"noDec":"decay" ),
141 // Form("P_{T} distribution cone %f %s %s", fConeSize, (iIso==0)?"nonIso":"isolated" , (iDec==0)?"noDec":"decay" ),
142 // 150, 0.1, 50);
143 // fHistSumPt[iIso][iDec]->GetXaxis()->SetTitle("P_{T} (GeV/c)");
144 // fHistSumPt[iIso][iDec]->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
145 // fHistSumPt[iIso][iDec]->SetMarkerStyle(kFullCircle);
146 // fHistograms->Add(fHistSumPt[iIso][iDec]);
147
148
149 // fHistMaxPt[iIso][iDec] = new TH1F(Form("fHistMaxPt_%f_%s_%s", fConeSize, (iIso==0)?"nonIso":"isolated" , (iDec==0)?"noDec":"decay" ),
150 // Form("P_{T} distribution cone %f %s %s", fConeSize, (iIso==0)?"nonIso":"isolated" , (iDec==0)?"noDec":"decay" ),
151 // 150, 0.1, 50);
152 // fHistMaxPt[iIso][iDec]->GetXaxis()->SetTitle("P_{T} (GeV/c)");
153 // fHistMaxPt[iIso][iDec]->GetYaxis()->SetTitle("dN/dP_{T} (c/GeV)");
154 // fHistMaxPt[iIso][iDec]->SetMarkerStyle(kFullCircle);
155 // fHistograms->Add(fHistMaxPt[iIso][iDec]);
156
157
158 // }
159 // }
160
161
162 for(Int_t iIso = 0; iIso < 2; iIso++){
163 fhTrackMult[iIso] = new TH1F(Form("fhTrackMult_%s_%f", (iIso==0)? "nonIso" : "isolated", fConeSize),
164 Form("Pt of %s candidates, cone size %f", (iIso==0)? "nonIsolated" : "isolated", fConeSize),
165 150, 0 , 150);
166 fhTrackMult[iIso]->GetXaxis()->SetTitle("n tracks in event");
167 fhTrackMult[iIso]->GetYaxis()->SetTitle("dN/dNTracks");
168 fhTrackMult[iIso]->SetMarkerStyle(kFullCircle);
169 fHistograms->Add(fhTrackMult[iIso]);
170 }
171
172}
173
174
175//_________________________________________________________________________
176Bool_t AliAnaConvIsolation::IsIsolated(AliAODConversionParticle * particle, const TClonesArray * const tracks, const Int_t nSpawn, const Int_t * const spawn, Bool_t &leading) {
177 //See header file for documentation
178
179 leading = kTRUE;
180
181 Float_t ptSum = 0.0;
182 Float_t ptMax = 0.0;
183
184 for(int it = 0; it < tracks->GetEntriesFast(); it++) {
185 AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(it));
186
187 if (track) {
188
189 if(track->Pt() < fMinPt) continue;
190
191 ///Ignore tracks that are grandchildren of pion
192 if ( particle->IsMySpawn(track->GetID(), nSpawn, spawn))
193 continue;
194
195
196 if ( IsInCone(particle->Eta() - track->Eta(), particle->Phi() - track->Phi(), fConeSize) ) {
197 ptSum += track->Pt();
198 if(track->Pt() > ptMax) ptMax = track->Pt();
199 if(track->Pt() > particle->Pt()) leading = kFALSE;
200 }
201 } else {
202 cout << "Bad track"<<endl;
203 }
204 }
205
206
207 Bool_t isolated = EvaluateIsolationCriteria( ptSum, particle->Pt());
208
209 FillHistograms(particle->Pt(), ptMax, ptSum, isolated, tracks->GetEntriesFast());
210
211 return isolated;
212
213}
214
215
216//_________________________________________________________________________
217Bool_t AliAnaConvIsolation::IsIsolated(const AliAODConversionParticle * const particle, const TClonesArray * const tracks, Bool_t &leading ) {
218 //See header file for documentation
219
220 leading = kTRUE;
221
222 Float_t ptSum = 0.0;
223 Float_t ptMax = 0.0;
224
225 for(int it = 0; it < tracks->GetEntriesFast(); it++) {
226
227 AliAODTrack * track = dynamic_cast<AliAODTrack*>(tracks->At(it));
228
229 if (track) {
230
231 if(track->Pt() < fMinPt) continue;
232
233 if ( (track->GetID() == particle->GetTrackLabel(0)) || track->GetID() == particle->GetTrackLabel(1) )
234 continue;
235
236 if ( IsInCone(particle->Eta() - track->Eta(), particle->Phi() - track->Phi(), fConeSize) ) {
237 ptSum += track->Pt();
238 if(track->Pt() > ptMax) ptMax = track->Pt();
239 if(track->Pt() > particle->Pt()) leading = kFALSE;
240 }
241 } else {
242 cout << "Bad track"<<endl;
243 }
244 }
245
246
247 Bool_t isolated = EvaluateIsolationCriteria( ptSum, particle->Pt());
248
249 FillHistograms(particle->Pt(), ptMax, ptSum, isolated, tracks->GetEntriesFast());
250
251
252 return isolated;
253
254}
255
256///___________________________________________________________________________
257void AliAnaConvIsolation::FillHistograms(Float_t pt, Float_t ptMax, Float_t ptSum, Bool_t isolated, Int_t nTracks) {
4574af57 258 //Fill histograms
fc7e3b59 259 fhMaxPtInCone[isolated]->Fill(pt, ptMax);
260 fhSumPtInCone[isolated]->Fill(pt, ptSum);
261 fhSumPtVsMaxPt[isolated]->Fill(ptMax, ptSum);
262 fhPtCandidates[isolated]->Fill(pt);
263 fhTrackMult[isolated]->Fill(nTracks);
264}
265
266
267///_____________________________________________________________________________
268Bool_t AliAnaConvIsolation::EvaluateIsolationCriteria(Float_t ptSum, Float_t pt) const {
4574af57 269 //Evaluate isolation criteria
fc7e3b59 270 return (ptSum < fIsoCurve->Eval(pt));
271
272}