AliPhysics  e6d2b2b (e6d2b2b)
AliAnaConvCorrBase.cxx
Go to the documentation of this file.
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 
19 
20 
21 #include "AliAnaConvCorrBase.h"
22 #include "AliAODTrack.h"
23 
24 #include "TClonesArray.h"
25 #include "TH1F.h"
26 #include "TH3.h"
27 #include "TList.h"
29 
30 #include <iostream>
31 
32 // Gamma - jet correlation analysis task
33 // Authors: Svein Lindal
34 
35 
36 using namespace std;
37 ClassImp(AliAnaConvCorrBase)
38 
39 //________________________________________________________________________
41  fHistograms(NULL),
42  fAxesList(),
43  fTrigAxisList(),
44  fTrackAxisList(),
45  fAxistPt(),
46  fAxiscPt(),
47  fAxisdEta(),
48  fAxisdPhi(),
49  fAxisIso(),
50  fAxisCent(),
51  fAxisZ(),
52  fAxisTrigEta(),
53  fAxisAssEta(),
54  fAxisMEPhi(),
55  fCorrSparse(NULL),
56  fTrigSparse(NULL),
57  fTrackSparse(NULL)
58 {
59  //Constructor
60  fAxesList.SetOwner(kFALSE);
61  fTrackAxisList.SetOwner(kFALSE);
62  fTrigAxisList.SetOwner(kFALSE);
63  SetUpDefaultBins();
64 
65 }
66 
67 
68 //________________________________________________________________________________
71 }
72 
73 //________________________________________________________________________________
75  CreateBaseHistograms();
76 }
77 
80  //Set up default bins
81  fAxisdEta.Set(32, -1.6, 1.6);
82  fAxisdEta.SetNameTitle("dEta", "delta eta");
83 
84  fAxisTrigEta.SetNameTitle("tEta", "Eta");
85  fAxisTrigEta.Set(320, -0.8, 0.8);
86 
87  fAxisAssEta.SetNameTitle("aEta", "Eta");
88  fAxisAssEta.Set(360, -0.9, 0.9);
89 
90  fAxisdPhi.Set(32, -TMath::PiOver2(), 3*TMath::PiOver2());
91  fAxisdPhi.SetNameTitle("dPhi", "delta Phi");
92 
93  Double_t tptbins[15] = {2.0, 3.0, 3.5, 4.0, 5.0, 6.0, 8.0, 10.0, 12.5, 15, 20, 25, 30, 50, 100};
94  fAxistPt.Set(13, tptbins);
95  fAxistPt.SetNameTitle("tPt", "trigger Pt");
96 
97  Double_t cptbins[19] = {0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 6.0, 8.0, 10.0, 12.5, 15, 20, 25, 30, 50, 100};
98  fAxiscPt.Set(18, cptbins);
99  fAxiscPt.SetNameTitle("cPt", "track Pt");
100 
101  fAxisCent.SetNameTitle("centrality", "centrality");
102  fAxisCent.Set(1, -999, 999);
103  fAxisZ.SetNameTitle("vtxz", "vtxz");
104  Double_t zbins[6] = {-10, -5, -1.5, 1.5, 5, 10 };
105  fAxisZ.Set(5, zbins);
106 
107  fAxisIso.Set(1, -0.5, 2.5);
108  fAxisIso.SetNameTitle("iso", "isolation");
109 
110  fAxesList.AddAt(&fAxisdEta, 0);
111  fAxesList.AddAt(&fAxisdPhi, 1);
112  fAxesList.AddAt(&fAxistPt, 2);
113  fAxesList.AddAt(&fAxiscPt, 3);
114  fAxesList.AddAt(&fAxisCent, 4);
115  fAxesList.AddAt(&fAxisZ, 5);
116 
117  fTrackAxisList.AddAt(&fAxisAssEta, 0);
118  fTrackAxisList.AddAt(&fAxistPt, 1);
119  fTrackAxisList.AddAt(&fAxiscPt, 2);
120  fTrackAxisList.AddAt(&fAxisCent, 3);
121  fTrackAxisList.AddAt(&fAxisZ, 4);
122 
123  fTrigAxisList.AddAt(&fAxisTrigEta, 0);
124  fTrigAxisList.AddAt(&fAxistPt, 1);
125  fTrigAxisList.AddAt(&fAxisCent, 2);
126  fTrigAxisList.AddAt(&fAxisZ, 3);
127 
128 
129 }
130 
131 
132 //________________________________________________________________________
134  //Create histograms add, to outputlis
135 
136  //cout << "Creating histograms for "<< GetName() << endl;
137 
138  fHistograms = new TList();
139  fHistograms->SetOwner(kTRUE);
140  fHistograms->SetName(fName);
141 
142 
143 
144  fCorrSparse = CreateSparse(GetName(), GetTitle(), &fAxesList);
145  fHistograms->Add(fCorrSparse);
146 
147  fTrackSparse = CreateSparse(Form("%s_%s", GetName(), "METrack"), Form("%s %s", GetTitle(), "ME Tracks"), &fTrackAxisList);
148  fHistograms->Add(fTrackSparse);
149 
150  fTrigSparse = CreateSparse(Form("%s_%s", GetName(), "METrig"), Form("%s %s", GetTitle(), "ME Triggers"), &fTrigAxisList);
151  fHistograms->Add(fTrigSparse);
152 
153 }
154 
156 THnSparseF * AliAnaConvCorrBase::CreateSparse(TString nameString, TString titleString, TList * axesList) {
157  //Create sparse
158  const Int_t dim = axesList->GetSize();
159 
160  //cout << nameString << " " << titleString << " " << " dimesion: " << dim << endl;
161 
162  TAxis * axes[dim];
163  Int_t bins[dim];
164  Double_t min[dim];
165  Double_t max[dim];
166 
167  for(Int_t i = 0; i<dim; i++) {
168  TAxis * axis = dynamic_cast<TAxis*>(axesList->At(i));
169  if(axis) axes[i] = axis;
170  else {
171  cout << "AliAnalysisTaskdPhi::CreateSparse: Error error, all the axes are not present in axis list" << endl;
172  return NULL;
173  }
174  }
175 
176  for(Int_t i = 0; i<dim; i++) {
177  //cout << axes[i]->GetTitle() << endl;
178  bins[i] = axes[i]->GetNbins();
179  min[i] = axes[i]->GetBinLowEdge(1);
180  max[i] = axes[i]->GetBinUpEdge(axes[i]->GetNbins());
181  }
182 
183  THnSparseF * sparse = new THnSparseF(Form("%s", nameString.Data()),
184  Form("%s", titleString.Data()),
185  dim, bins, min, max);
186 
187  for(Int_t i = 0; i<dim; i++) {
188  sparse->GetAxis(i)->SetNameTitle(axes[i]->GetName(), axes[i]->GetTitle() );
189  if(axes[i]->GetXbins()->GetSize() > 0) {
190  sparse->SetBinEdges(i, axes[i]->GetXbins()->GetArray() );
191  }
192  }
193  return sparse;
194 }
195 
196 
197 
198 //_______________________________________________________________________________
199 void AliAnaConvCorrBase::FillCounters(TObjArray * particles, TObjArray * tracks, Float_t cent, Float_t vtxz) {
200  //Fill ME Counters
201  const Int_t nbins = fAxistPt.GetNbins();
202  Bool_t tmap[nbins];
203  for(Int_t ptbin = 0; ptbin < nbins; ptbin++){
204  tmap[ptbin] = kFALSE;
205  }
206 
207 
208  Double_t trackValues[fTrackAxisList.GetSize()];
209  trackValues[3] = cent;
210  trackValues[4] = vtxz;
211 
212  for(Int_t ip = 0; ip < particles->GetEntriesFast(); ip++){
213  AliAODConversionParticle * particle = static_cast<AliAODConversionParticle*>(particles->At(ip));
214 
215  Int_t tbin = fAxistPt.FindFixBin(particle->Pt());
216  if (tbin > 0 && tbin < nbins + 1) {
217  if(tmap[tbin - 1] == kTRUE) {
218  continue;
219  } else {
220  tmap[tbin -1 ] = kTRUE;
221 
222  if( fTrackAxisList.GetSize() > 5){
223  trackValues[5] = particle->M();
224  }
225 
226  for(int ij = 0; ij < tracks->GetEntriesFast(); ij++) {
227  AliVTrack * track = static_cast<AliVTrack*>(tracks->UncheckedAt(ij));
228  trackValues[0] = track->Eta();
229  trackValues[1] = particle->Pt();
230  trackValues[2] = track->Pt();
231  fTrackSparse->Fill(trackValues);
232  }
233  }
234  }
235  }
236 }
237 
238 //________________________________________________________________
240  //Correlate particle with tracks
241 
242 
243  const Int_t nDim = fAxesList.GetSize();
244  Double_t dphivalues[nDim];
245  dphivalues[4] = cent;
246  dphivalues[5] = vtxz;
247 
248 
249  Double_t trigValues[fTrigAxisList.GetSize()];
250  trigValues[0] = particle->Eta();
251  trigValues[1] = particle->Pt();
252  trigValues[2] = cent;
253  trigValues[3] = vtxz;
254 
255  if(nDim > 6) {
256  dphivalues[6] = particle->M();
257  trigValues[4] = particle->M();
258  }
259 
260  fTrigSparse->Fill(trigValues);
261 
262  for(int ij = 0; ij < tracks->GetEntriesFast(); ij++) {
263  AliVTrack * track = static_cast<AliVTrack*>(tracks->UncheckedAt(ij));
264 
265  Int_t tid = track->GetID();
266 
267  if((tid > 0) && (tid == tIDs[0] || tid == tIDs[1] || tid == tIDs[2] || tid == tIDs[3]) ) {
268  continue;
269  }
270 
271  dphivalues[0] = particle->Eta() - track->Eta();
272  dphivalues[1] = GetDPhi(particle->Phi() - track->Phi());
273  dphivalues[2] = particle->Pt();
274  dphivalues[3] = track->Pt();
275  fCorrSparse->Fill(dphivalues);
276  }
277 }
278 
double Double_t
Definition: External.C:58
THnSparseF * CreateSparse(TString name, TString title, TList *axes)
const char * title
Definition: MakeQAPdf.C:27
virtual void CreateHistograms()
int Int_t
Definition: External.C:63
void FillCounters(TObjArray *particles, TObjArray *tracks, Float_t cent, Float_t vtxz)
float Float_t
Definition: External.C:68
const Int_t nbins
bool Bool_t
Definition: External.C:53
void CorrelateWithTracks(AliAODConversionParticle *particle, TObjArray *tracks, const Int_t tIDs[4], Float_t cent, Float_t vtxz)