]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/EMCALTasks/AliAnalysisTaskEMCALPhotonIsolation.cxx
Removing left-over "return".
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliAnalysisTaskEMCALPhotonIsolation.cxx
CommitLineData
1c662fe8 1// $Id$
2//
3// Emcal Neutral Cluster analysis base task.
4//
5// Authors: D.Lodato,L.Ronflette, M.Marquard
6
7
8
9#include <TClonesArray.h>
10#include <TChain.h>
11#include <TList.h>
12#include <TVector3.h>
13#include <TLorentzVector.h>
14#include <TH1D.h>
15#include <TH2D.h>
16#include <THnSparse.h>
17#include "AliAnalysisManager.h"
18#include "AliCentrality.h"
19#include "AliEMCALGeometry.h"
20#include "AliESDEvent.h"
21#include "AliAODEvent.h"
22#include "AliLog.h"
23#include "AliVCluster.h"
24#include "AliVEventHandler.h"
25#include "AliVParticle.h"
26#include "AliClusterContainer.h"
27#include "AliVTrack.h"
28#include "AliEmcalParticle.h"
29#include "AliParticleContainer.h"
30#include "AliAODCaloCluster.h"
31#include "AliESDCaloCluster.h"
32#include "AliVCaloCells.h"
33#include "AliPicoTrack.h"
34
35#include "AliAnalysisTaskEMCALPhotonIsolation.h"
36
e742b9b0 37using std::cout;
38using std::endl;
1c662fe8 39
40ClassImp(AliAnalysisTaskEMCALPhotonIsolation)
41
42//________________________________________________________________________
43AliAnalysisTaskEMCALPhotonIsolation::AliAnalysisTaskEMCALPhotonIsolation() :
44AliAnalysisTaskEmcal("AliAnalysisTaskEMCALPhotonIsolation",kTRUE),
45//fParticleCollArray(),
46fNCluster(0),
47fWho(-1),
48//fOutputList(0),
49fTrackMult(0),
50fTrackMultEMCAL(0),
51fClustMult(0),
52fPVZBefore(0),
53fEtaPhiCell(0),
54fEtaPhiClus(0),
55fClusEvsClusT(0),
56fGoodEventsOnPVZ(0),
57fPT(0),
58fM02(0),
59fNLM(0),
60fDeltaETAClusTrackVSpT(0),
61fDeltaPHIClusTrackVSpT(0),
62fEtIsoCells(0),
63fEtIsoClust(0),
64fPtIsoTrack(0),
65fPtEtIsoTC(0),
66fPhiBandUEClust(0),
67fEtaBandUEClust(0),
68fPhiBandUECells(0),
69fEtaBandUECells(0),
70fPhiBandUETracks(0),
71fEtaBandUETracks(0),
72fPerpConesUETracks(0),
73fTPCWithoutIsoConeB2BbandUE(0),
74fNTotClus10GeV(0),
75fRecoPV(0),
76fEtIsolatedCells(0),
77fEtIsolatedClust(0),
78fEtIsolatedTracks(0),
79fTest(0),
80fOutputTHnS(0),
81fOutPTMAX(0),
82fOutputTree(0),
83fIsoConeRadius(0.4),
84fEtIsoMethod(0),
85fEtIsoThreshold(4),
86fdetacut(0.025),
87fdphicut(0.03),
88fM02mincut(0.1),
89fM02maxcut(0.3),
90fQA(0),
91fIsMC(0),
92fTPC4Iso(0),
93fIsoMethod(0),
94fUEMethod(0),
95fVertex(0),
96fNDimensions(0),
97fisLCAnalysis(0),
98fevents(0),
99flambda0T(0),
100fEtT(0),
101fPtT(0),
102fEtisoT(0),
103fPtisoT(0),
104fetaT(0),
105fphiT(0),
106fsumEtisoconeT(0),
107fsumEtUE(0)
bab35745 108//tracks(0),
1c662fe8 109//clusters(0)
110
111{
112 // Default constructor.
113
bab35745 114 //fParticleCollArray.SetOwner(kTRUE);
115 // for(Int_t i = 0; i < 12; i++) fGeomMatrix[i] = 0;
1c662fe8 116
117 SetMakeGeneralHistograms(kTRUE);
118}
119
120//________________________________________________________________________
121AliAnalysisTaskEMCALPhotonIsolation::AliAnalysisTaskEMCALPhotonIsolation(const char *name, Bool_t histo) :
122AliAnalysisTaskEmcal(name, histo),
123//fParticleCollArray(),
124fNCluster(0),
125fWho(-1),
126//fOutputList(0),
127fTrackMult(0),
128fTrackMultEMCAL(0),
129fClustMult(0),
130fPVZBefore(0),
131fEtaPhiCell(0),
132fEtaPhiClus(0),
133fClusEvsClusT(0),
134fGoodEventsOnPVZ(0),
135fPT(0),
136fM02(0),
137fNLM(0),
138fDeltaETAClusTrackVSpT(0),
139fDeltaPHIClusTrackVSpT(0),
140fEtIsoCells(0),
141fEtIsoClust(0),
142fPtIsoTrack(0),
143fPtEtIsoTC(0),
144fPhiBandUEClust(0),
145fEtaBandUEClust(0),
146fPhiBandUECells(0),
147fEtaBandUECells(0),
148fPhiBandUETracks(0),
149fEtaBandUETracks(0),
150fPerpConesUETracks(0),
151fTPCWithoutIsoConeB2BbandUE(0),
152fNTotClus10GeV(0),
153fRecoPV(0),
154fEtIsolatedCells(0),
155fEtIsolatedClust(0),
156fEtIsolatedTracks(0),
157fTest(0),
158fOutputTHnS(0),
159fOutPTMAX(0),
160fOutputTree(0),
161fIsoConeRadius(0.4),
162fEtIsoMethod(0),
163fEtIsoThreshold(4),
164fdetacut(0.025),
165fdphicut(0.03),
166fM02mincut(0.1),
167fM02maxcut(0.3),
168fQA(0),
169fIsMC(0),
170fTPC4Iso(0),
171fIsoMethod(0),
172fUEMethod(0),
173fVertex(0),
174fNDimensions(0),
175fisLCAnalysis(0),
176fevents(0),
177flambda0T(0),
178fEtT(0),
179fPtT(0),
180fEtisoT(0),
181fPtisoT(0),
182fetaT(0),
183fphiT(0),
184fsumEtisoconeT(0),
185fsumEtUE(0)
bab35745 186//tracks(0),
1c662fe8 187//clusters(0)
188
189{
190 // Standard constructor.
191
bab35745 192 //fParticleCollArray.SetOwner(kTRUE);
193 // for(Int_t i = 0; i < 12; i++) fGeomMatrix[i] = 0;
1c662fe8 194
195 SetMakeGeneralHistograms(kTRUE);
196}
197
198//________________________________________________________________________
199AliAnalysisTaskEMCALPhotonIsolation::~AliAnalysisTaskEMCALPhotonIsolation(){
200 // Destructor
201}
202
203
204//________________________________________________________________________
205void AliAnalysisTaskEMCALPhotonIsolation::UserCreateOutputObjects(){
bab35745 206 // Create ouput histograms and THnSparse and TTree
1c662fe8 207
208 AliAnalysisTaskEmcal::UserCreateOutputObjects();
209
210
211 if ((fIsoMethod == 0 || fIsoMethod == 1) && fTPC4Iso){
212 cout<<"Error: Iso_Methods with CELLS and CLUSTERS work only within EMCAL "<<endl;
213 cout<<"Please Set Iso_Method and TPC4Iso Accordingly!!"<<endl;
214 return;
215 }
216 if ((fIsoMethod == 0 || fIsoMethod == 1) && fUEMethod> 1) {
217 cout<<"Error: UE_Methods with CELLS and CLUSTERS work only within EMCAL"<<endl;
218 cout<<"Please Set Iso_Method and UE_Method Accordingly!!"<<endl;
219 return;
220 }
221
222
223 TString sIsoMethod="\0",sUEMethod="\0",sBoundaries="\0";
224
225 if(fIsoMethod==0)
226 sIsoMethod = "Cells";
227 else if(fIsoMethod==1)
228 sIsoMethod = "Clust";
229 else if(fIsoMethod==2)
230 sIsoMethod = "Tracks";
231
232 if(fUEMethod==0)
233 sUEMethod = "PhiBand";
234 else if(fUEMethod==1)
235 sUEMethod = "EtaBand";
236 else if(fUEMethod==2)
237 sUEMethod = "PerpCones";
238 else if(fUEMethod==3)
239 sUEMethod = "FullTPC";
240
241 if(fTPC4Iso)
242 sBoundaries = "TPC Acceptance";
243 else
244 sBoundaries = "EMCAL Acceptance";
245
246 if(fWho>1 || fWho==-1){
247 cout<<"Error!!! OutputMode Can Only Be 0: TTree; 1: THnSparse"<<endl;
248 return;
249 }
250 else{
251 fOutput = new TList();
252 fOutput->SetOwner();
253 //Initialize the common Output histograms
254 switch (fWho)
255 {
256 case 0:
257 //Initialization by Lucile and Marco
bab35745 258 fOutputTree = new TTree("OutTree","OutTree");
1c662fe8 259 fOutputTree->Branch("fevents",&fevents);
bab35745 260 fOutputTree->Branch("flambda0T",&flambda0T);
1c662fe8 261 fOutputTree->Branch("fEtT",&fEtT);
262 fOutputTree->Branch("fPtT",&fPtT);
263 fOutputTree->Branch("fEtisoT",&fEtisoT);
264 fOutputTree->Branch("fPtTiso",&fPtisoT);
265 fOutputTree->Branch("fetaT",&fetaT);
bab35745 266 fOutputTree->Branch("fphiT",&fphiT);
1c662fe8 267 fOutputTree->Branch("fsumEtisoconeT",&fsumEtisoconeT);
268 fOutputTree->Branch("fsumEtUE",&fsumEtUE);
269
270 fOutput->Add(fOutputTree);
271
272 break;
273 case 1:
274 //Initialization by Davide;
275
276 TString sTitle;
277 Int_t binTrackMult=100, binPT=70, binM02=100, binETiso=100, binETUE=110, binETisoUE=110, binetacl=140,binphicl=100, binPTMC=70;
278 Int_t bins[] = {binTrackMult, binPT, binM02, binETiso, binETUE, binETisoUE, binetacl, binphicl, binPTMC, binPTMC};
279
280 fNDimensions = sizeof(bins)/sizeof(Int_t);
281 const Int_t ndims = fNDimensions;
282
283 Double_t xmin[]= { 0., 0., 0., -10., -10., -10.,-1.0, 1. ,-10.,-10.};
284
285 Double_t xmax[]= {1000., 70., 2., 100., 100., 100., 1.0, 3.5, 60., 60.};
286
287 sTitle = Form("Direct Photons: Track Multiplicity, p_{T} , M02 , E_{T} Iso%s in %s, E_{T} UE %s in %s, E_{T} Iso_%s - E_{T} UE_%s in %s, #eta_{clus} distribution,#phi_{clus} distribution,MC_pT,MC_pT_incone; N_{ch}; p_{T} (GeV/c); M02; E_{T}^{iso%s} (GeV/c) ; E_{T}^{UE%s} (GeV/c); E_{T}^{iso%s}-E_{T}^{UE%s} (GeV/c); #eta_{cl}; #phi_{cl}; MC p_{T}; MC p_{T}^{incone}", sIsoMethod.Data(), sBoundaries.Data(), sUEMethod.Data(), sBoundaries.Data(), sIsoMethod.Data(), sUEMethod.Data(), sBoundaries.Data(), sIsoMethod.Data(), sUEMethod.Data(), sIsoMethod.Data(), sUEMethod.Data());
288
289 fOutputTHnS = new THnSparseF("fHnOutput",sTitle.Data(), ndims, bins, xmin, xmax);
290
291 fOutput->Add(fOutputTHnS);
292
293 Int_t binsbis[] = {binPT, binM02, binETisoUE};
294 Double_t xminbis[] = { 0., 0., -10.};
295 Double_t xmaxbis[] = {100., 2., 100.};
296
297 fOutPTMAX = new THnSparseF ("fOutPTMAX","3D matrix E_{#gamma} VS M02 VS pT_{max}^{cone}; E_{T}^{#gamma} (GeV/c); M02; p_{T}^{Iso}(GeV/c)",3,binsbis,xminbis,xmaxbis);
298
299 fOutput->Add(fOutPTMAX);
300 break;
301 }
302 }
bab35745 303
1c662fe8 304 if(fQA){
305 //Include QA plots to the OutputList //DEFINE BETTER THE BINNING AND THE AXES LIMITS
306 fTrackMult = new TH1D ("hTrackMult","Tracks multiplicity Distribution",250,0.,1000.);
307 fTrackMult->Sumw2();
308 fOutput->Add(fTrackMult);
309
310 fTrackMultEMCAL = new TH1D ("hTrackMultEMCAL","Tracks multiplicity Distribution inside EMCAL acceptance",250,0.,1000.);
311 fTrackMultEMCAL->Sumw2();
312 fOutput->Add(fTrackMultEMCAL);
313
314 fClustMult = new TH1D ("hClustMult","Clusters multiplicity Distribution",250,0.,1000.);
315 fClustMult->Sumw2();
316 fOutput->Add(fClustMult);
317
318 fRecoPV = new TH1D("hRecoPV","Prim. vert. reconstruction (yes or no);reco (0=no, 1=yes) ;",2,-0.5,1.5);
319 fRecoPV->Sumw2();
320 fOutput->Add(fRecoPV);
321
322 fPVZBefore = new TH1D ("hPVZDistr","Z Distribution for the Reconstructed Vertex",200,0.,40.);
323 fPVZBefore->Sumw2();
324 fOutput->Add(fPVZBefore);
325
326 fEtaPhiCell = new TH2D ("hEtaPhiCellActivity","",250,0.,1000., 250, 0., 1000.);
327 fEtaPhiCell->Sumw2();
328 fOutput->Add(fEtaPhiCell);
329
330 fEtaPhiClus = new TH2D ("hEtaPhiClusActivity","",250,0.,1000., 250, 0., 1000.);
331 fEtaPhiClus->Sumw2();
332 fOutput->Add(fEtaPhiClus);
333
334 fClusEvsClusT = new TH2D ("hEnVSTime","",250,0.,1000., 250,0.,1000.);
335 fClusEvsClusT->Sumw2();
336 fOutput->Add(fClusEvsClusT);
337
338 fDeltaETAClusTrackVSpT = new TH2D("hTC_Dz","Track-Cluster Dz vs pT of Cluster",100,0.,100.,100,-0.05,0.05);
339 fDeltaETAClusTrackVSpT->Sumw2();
340 fOutput->Add(fDeltaETAClusTrackVSpT);
341
342 fDeltaPHIClusTrackVSpT = new TH2D("hTC_Dx","Track-Cluster Dx vs pT of Cluster",100,0.,100.,100,-0.05,0.05);
343 fDeltaPHIClusTrackVSpT->Sumw2();
344 fOutput->Add(fDeltaPHIClusTrackVSpT);
345
346 }
347 //Initialize only the Common THistos for the Three different output
348
349 fGoodEventsOnPVZ = new TH1D ("hGOODwrtPVZ","Number of Selected Events wrt Cut on Primary Vertex Z (0=disregarded,1=selected)",2,0.,2.);
350 fGoodEventsOnPVZ->Sumw2();
351 fOutput->Add(fGoodEventsOnPVZ);
352
353 fPT = new TH1D("hPt_NC","P_{T} distribution for Neutral Clusters",100,0.,100.);
354 fPT->Sumw2();
355 fOutput->Add(fPT);
356
357 fM02 = new TH2D("hM02_NC","M02 distribution for Neutral Clusters vs E",100,0.,100.,500,0.,5.);
358 fM02->Sumw2();
359 fOutput->Add(fM02);
360
361 fNLM = new TH1D("hNLM_NC","NLM distribution for Neutral Clusters",200,0.,4.);
362 fNLM->Sumw2();
363 fOutput->Add(fNLM);
364
365 fEtIsoCells = new TH1D("hEtIsoCell_NC","E_{T}^{iso cone} in iso cone distribution for Neutral Clusters with EMCAL Cells",100,0.,100.);
366 fEtIsoCells->SetXTitle("#Sigma E_{T}^{iso cone} (GeV/c)");
367 fEtIsoCells->Sumw2();
368 fOutput->Add(fEtIsoCells);
369
370 fEtIsoClust = new TH1D("hEtIsoClus_NC","#Sigma E_{T}^{iso cone} in iso cone distribution for Neutral Clusters with EMCAL Clusters",100,0.,100.);
371 fEtIsoClust->SetXTitle("#Sigma E_{T}^{iso cone} (GeV/c)");
372 fEtIsoClust->Sumw2();
373 fOutput->Add(fEtIsoClust);
374
375 fPtIsoTrack = new TH1D("hPtIsoTrack_NC"," #Sigma P_{T}^{iso cone} in iso cone distribution for Neutral Clusters with Tracks",100,0.,100.);
376 fPtIsoTrack->SetXTitle("#Sigma P_{T}^{iso cone} (GeV/c)");
377 fPtIsoTrack->Sumw2();
378 fOutput->Add(fPtIsoTrack);
379
380 fPtEtIsoTC = new TH1D("hPtEtIsoTrackClust_NC","#Sigma P_{T}^{iso cone} + #Sigma E_{T}^{iso cone} in iso cone distribution for Neutral Clusters with Tracks and Clusters",100,0.,100.);
381 fPtEtIsoTC->SetXTitle("#Sigma P_{T}^{iso cone} + #Sigma E_{T}^{iso cone} (GeV/c)");
382 fPtEtIsoTC->Sumw2();
383 fOutput->Add(fPtEtIsoTC);
384
385 fPhiBandUEClust = new TH2D(Form("hPhiBandUE_Cluster"),Form("UE Estimation with Phi Band Clusters"),100,0.,100.,100,0.,100.);
386 fPhiBandUEClust->SetXTitle("E_{T}");
387 fPhiBandUEClust->SetYTitle("#Sigma E_{T}^{UE}");
388 fPhiBandUEClust->Sumw2();
389 fOutput->Add(fPhiBandUEClust);
390
391 fEtaBandUEClust = new TH2D(Form("hEtaBandUE_Cluster"),Form("UE Estimation with Phi Band Clusters"),100,0.,100.,100,0.,100.);
392 fEtaBandUEClust->SetXTitle("E_{T}");
393 fEtaBandUEClust->SetYTitle("#Sigma E_{T}^{UE}");
394 fEtaBandUEClust->Sumw2();
395 fOutput->Add(fEtaBandUEClust);
396
397 fPhiBandUECells = new TH2D(Form("hPhiBandUE_CELLS"),Form("UE Estimation with Phi Band CELLS"),100,0.,100.,100,0.,100.);
398 fPhiBandUECells->SetXTitle("E_{T}");
399 fPhiBandUECells->SetYTitle("#Sigma E_{T}^{UE}");
400 fPhiBandUECells->Sumw2();
401 fOutput->Add(fPhiBandUECells);
402
403 fEtaBandUECells = new TH2D(Form("hEtaBandUE_CELLS"),Form("UE Estimation with Phi Band and CELLS"),100,0.,100.,100,0.,100.);
404 fEtaBandUECells->SetXTitle("E_{T}");
405 fEtaBandUECells->SetYTitle("#Sigma E_{T}^{UE}");
406 fEtaBandUECells->Sumw2();
407 fOutput->Add(fEtaBandUECells);
408
409 fPhiBandUETracks = new TH2D(Form("hPhiBandUE_TPC"),Form("UE Estimation with Phi Band TPC "),100,0.,100.,100,0.,100.);
410 fPhiBandUETracks->SetXTitle("E_{T}");
411 fPhiBandUETracks->SetYTitle("#Sigma P_{T}^{UE}");
412 fPhiBandUETracks->Sumw2();
413 fOutput->Add(fPhiBandUETracks);
414
415 fEtaBandUETracks = new TH2D(Form("hEtaBandUE_TPC"),Form("UE Estimation with Phi Band and TPC"),100,0.,100.,100,0.,100.);
416 fEtaBandUETracks->SetXTitle("E_{T}");
417 fEtaBandUETracks->SetYTitle("#Sigma P_{T}^{UE}");
418 fEtaBandUETracks->Sumw2();
419 fOutput->Add(fEtaBandUETracks);
420
421 fPerpConesUETracks = new TH2D("hConesUE","UE Estimation with Perpendicular Cones in TPC",100,0.,100.,100,0.,100.);
422 fPerpConesUETracks->SetXTitle("E_{T}");
423 fPerpConesUETracks->SetYTitle("#Sigma P_{T}^{UE}");
424 fPerpConesUETracks->Sumw2();
425 fOutput->Add(fPerpConesUETracks);
426
427 fTPCWithoutIsoConeB2BbandUE = new TH2D("hFullTPCUE","UE Estimation with almost Full TPC",100,0.,100.,100,0.,100.);
428 fPhiBandUEClust->SetXTitle("E_{T}");
429 fPhiBandUEClust->SetYTitle("#Sigma E_{T}^{UE}");
430 fTPCWithoutIsoConeB2BbandUE->Sumw2();
431 fOutput->Add(fTPCWithoutIsoConeB2BbandUE);
432
433 fEtIsolatedClust = new TH1D("hEtIsolatedClust","E_{T} distribution for Isolated Photons with clusters; #Sigma E_{T}^{iso cone}<Ethres",100,0.,100.);
434 fEtIsolatedClust->SetXTitle("E_{T}^{iso}");
435 fEtIsolatedClust->Sumw2();
436 fOutput->Add(fEtIsolatedClust);
437
438 fEtIsolatedCells = new TH1D("hEtIsolatedCells","E_{T} distribution for Isolated Photons with cells; #Sigma E_{T}^{iso cone}<Ethres",100,0.,100.);
439 fEtIsolatedCells->SetXTitle("E_{T}^{iso}");
440 fEtIsolatedCells->Sumw2();
441 fOutput->Add(fEtIsolatedCells);
442
443 fEtIsolatedTracks = new TH1D("hEtIsolatedTracks","E_{T} distribution for Isolated Photons with tracks; #Sigma P_{T}^{iso cone}<Pthres",100,0.,100.);
444 fEtIsolatedTracks->SetXTitle("E_{T}^{iso}");
445 fEtIsolatedTracks->Sumw2();
446 fOutput->Add(fEtIsolatedTracks);
447
448 fTest = new TH1D ("hTest","test cluster collection",100,-2.,6.);
449 fTest->Sumw2();
450 fOutput->Add(fTest);
451
452
1c662fe8 453 PostData(1, fOutput);
454 // return;
455}
456
bab35745 457//________________________________________________________________________
1c662fe8 458Float_t* AliAnalysisTaskEMCALPhotonIsolation::GenerateFixedBinArray(Int_t n, Float_t min, Float_t max) const
459{
bab35745 460 // Generate the bin array for the ThnSparse
461
1c662fe8 462 Float_t *bins = new Float_t[n+1];
463
464 Float_t binWidth = (max-min)/n;
465 bins[0] = min;
466 for (Int_t i = 1; i <= n; i++) {
467 bins[i] = bins[i-1]+binWidth;
468 }
469
470 return bins;
471}
472
473//________________________________________________________________________
474void AliAnalysisTaskEMCALPhotonIsolation::ExecOnce()
475{
476 // Init the analysis.
477
478
479
480 if (fParticleCollArray.GetEntriesFast()<2) {
481 AliError(Form("Wrong number of particle collections (%d), required 2",fParticleCollArray.GetEntriesFast()));
482 return;
483 }
484
485
bab35745 486 // for (Int_t i = 0; i < 2; i++) {
487 // AliParticleContainer *contain = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
488 // // contain->GetClassName("AliEmcalParticle");
489 // }
490
491
1c662fe8 492
493 AliAnalysisTaskEmcal::ExecOnce();
494 if (!fInitialized) {
495
496 AliError(Form("AliAnalysisTask not initialized"));
497 return;
498 }
499
500 fevents+=1;
501
502}
503
504//______________________________________________________________________________________
505Bool_t AliAnalysisTaskEMCALPhotonIsolation::Run()
506{
bab35745 507 // Run the analysis
1c662fe8 508
509
510 AliParticleContainer *clusters = static_cast<AliParticleContainer*>(fParticleCollArray.At(1));
511 AliEmcalParticle *emccluster = 0;
512
513 // delete output USEFUL LATER FOR CONTAINER CREATION !!
514 //fOutClusters->Delete();
515
516 //Int_t clusCount = 0; AliError(Form("Should be here each time"));
517 // loop over all clusters
518 clusters->ResetCurrentID();
519 Int_t index=-1;
520
521 //Double_t ETleadingclust = 0., M02leadingcluster = 0., lambda0cluster = 0., phileadingclust = 0., etaleadingclust = 0., ptmc = 0.,mcptsum = 0.;
522 //Int_t Ntracks;
523 //Definition of the Array for Davide's Output
524 //const Int_t ndims = fNDimensions;
525 //Double_t outputValues[ndims];
526
527
1c662fe8 528 if (fisLCAnalysis) {
529 // AliError(Form("Check the loop"));
530 // get the leading particle
531
532
1c662fe8 533 emccluster = static_cast<AliEmcalParticle*>(clusters->GetLeadingParticle());
534
535 if(!emccluster){
536
537 AliError(Form("no leading one"));
538 return kTRUE;
539 }
540
541
542
543 // emccluster = clusters->GetLeadingParticle();
544 index = emccluster->IdInCollection();
545
546 //add a command to get the index of the leading cluster!
547 if (!emccluster->IsEMCAL()) return kTRUE;
548
bab35745 549 AliVCluster *coi = emccluster->GetCluster();
550 if (!coi) return kTRUE;
1c662fe8 551
bab35745 552 TLorentzVector vecCOI;
553 coi->GetMomentum(vecCOI,fVertex);
1c662fe8 554
555
bab35745 556 if(!CheckBoundaries(vecCOI))
1c662fe8 557 return kTRUE;
558
bab35745 559 if(ClustTrackMatching(coi))
1c662fe8 560 return kTRUE;
561
562 else
bab35745 563 FillGeneralHistograms(coi,vecCOI, index);
1c662fe8 564 }
565 else{
566 //get the entries of the Cluster Container
567 //whatever is a RETURN in LCAnalysis here is a CONTINUE,
568 //since there are more than 1 Cluster per Event
569
570 while((emccluster = static_cast<AliEmcalParticle*>(clusters->GetNextAcceptParticle()))){
571 index++;
572 if (!emccluster->IsEMCAL()) return kTRUE;
573
bab35745 574 AliVCluster *coi = emccluster->GetCluster();
575 if(!coi) return kTRUE;
1c662fe8 576
bab35745 577 TLorentzVector vecCOI;
578 coi->GetMomentum(vecCOI,fVertex);
1c662fe8 579
bab35745 580 if(!CheckBoundaries(vecCOI))
1c662fe8 581 return kTRUE;
582
bab35745 583 if(ClustTrackMatching(coi))
1c662fe8 584 continue;
1c662fe8 585 else
bab35745 586 FillGeneralHistograms(coi,vecCOI, index);
1c662fe8 587
588 }
589 }
590 // PostData(1, fOutput);
591 return kTRUE;
592}
593
594
bab35745 595//__________________________________________________________________________
1c662fe8 596Bool_t AliAnalysisTaskEMCALPhotonIsolation::ClustTrackMatching(AliVCluster *cluster) {
bab35745 597 // Check if the cluster match to a track
1c662fe8 598
599 Double_t deta=999;
600 Double_t dphi=999;
601
bab35745 602 AliParticleContainer *tracks = static_cast<AliParticleContainer*>(fParticleCollArray.At(0));
1c662fe8 603 // for an incoming cluster reject it if there is a track corresponding with a deta and dphi lower than the cuts
604 TLorentzVector nPart;
605 cluster->GetMomentum(nPart, fVertex);
606
607 AliVTrack *mt = NULL;
608 AliAODCaloCluster *acl = dynamic_cast<AliAODCaloCluster*>(cluster);
609 if(acl) {
610 if(acl->GetNTracksMatched()>1)
611 mt = static_cast<AliVTrack*>(acl->GetTrackMatched(0));
612 }
613 else {
614 AliESDCaloCluster *ecl = dynamic_cast<AliESDCaloCluster*>(cluster);
bab35745 615 if(!ecl){
616 AliError("ClusTrack matching did not work");
617 return kTRUE;
618 }
1c662fe8 619 Int_t im = ecl->GetTrackMatchedIndex();
bab35745 620 if(tracks && im>=0) {
621 mt = static_cast<AliVTrack*>(tracks->GetParticle(im));
1c662fe8 622 }
623 }
bab35745 624 // if(mt && mt->TestFilterBit(768)) { //Hybrid tracks with AOD
1c662fe8 625 AliPicoTrack::GetEtaPhiDiff(mt, cluster, dphi, deta);
626 fDeltaETAClusTrackVSpT->Fill(nPart.Pt(), deta);
627 fDeltaPHIClusTrackVSpT->Fill(nPart.Pt(), dphi);
628
629
1c662fe8 630 if(mt) return kTRUE;
631
632 else return kFALSE;
633
634}
635
636
637
638//__________________________________________________________________________
bab35745 639void AliAnalysisTaskEMCALPhotonIsolation::EtIsoCellPhiBand(TLorentzVector c, Float_t &etIso, Float_t &phiBandcells){
640 // Underlying events study with EMCAL cells in phi band
1c662fe8 641
bab35745 642 AliEMCALGeometry* emcalGeom = AliEMCALGeometry::GetInstance();
1c662fe8 643
644 Float_t sumEnergyPhiBandCells=0., sumEnergyConeCells=0.;
645
646
647 // check the cell corresponding to the leading cluster
648 Int_t absId = 999;
649 //maybe best to call it LeadingCellIdinClus or better maxId since it won't be used anywhere else ???
bab35745 650 Bool_t cellLeadingClustID = emcalGeom->GetAbsCellIdFromEtaPhi(c.Eta(),c.Phi(),absId);
651 if(!cellLeadingClustID) return;
1c662fe8 652
653 else{
654 Int_t iTower = -1;
655 Int_t iModule = -1;
656 Int_t imEta=-1, imPhi=-1;
bab35745 657 Int_t iEta =-1, iPhi =-1;
1c662fe8 658
bab35745 659 emcalGeom->GetCellIndex(absId,iModule,iTower,imPhi,imEta); // to get the module, the tower, eta and phi for the cell corresponding to the leading cluster
660 emcalGeom->GetCellPhiEtaIndexInSModule(iModule,iTower,imPhi,imEta,iPhi,iEta); // to get the cell eta and phi in the super module for the cell coming from the leading cluster
1c662fe8 661
662 // Get the row and the column of the cell corresponding to the leading cluster in EMCAL
bab35745 663 Int_t colCellLeadingClust = iEta;
664 if(iModule % 2) colCellLeadingClust = AliEMCALGeoParams::fgkEMCALCols + iEta ; // if the SM number is even you need to translate to have the one corresponding in EMCAL
665 Int_t rowCellLeadingClust = iPhi + AliEMCALGeoParams::fgkEMCALRows*int(iModule/2); // to have the corresponding row in EMCAL
1c662fe8 666
667 // total number or rows and columns in EMCAL
bab35745 668 Int_t nTotalRows = AliEMCALGeoParams::fgkEMCALRows*16/3 ; // 5 + 2/3 supermodules in a row
669 Int_t nTotalCols = 2*AliEMCALGeoParams::fgkEMCALCols; // 2 supermodules in a column
1c662fe8 670
bab35745 671 Int_t nbConeSize = int(fIsoConeRadius/0.0143); //0.0143 tower acceptance
1c662fe8 672
673 // Get the cells
674 AliVCaloCells * cells =InputEvent()->GetEMCALCells();
675
676 // define the max and min row and column corresponding to the isolation cone around the seed cell from the leading cluster
bab35745 677 Int_t iRowMinCone = rowCellLeadingClust-nbConeSize;
678 if(iRowMinCone<0) iRowMinCone=0;
1c662fe8 679
bab35745 680 Int_t iRowMaxCone = rowCellLeadingClust+nbConeSize;
681 if(iRowMaxCone>AliEMCALGeoParams::fgkEMCALRows) iRowMaxCone=AliEMCALGeoParams::fgkEMCALRows; // AliEMCALGeoParams::fgkEMCALRows = 24 in a supermodule
1c662fe8 682
bab35745 683 Int_t iColMinCone = colCellLeadingClust - nbConeSize;
684 if(iColMinCone<0) iColMinCone = 0;
1c662fe8 685
bab35745 686 Int_t iColMaxCone = colCellLeadingClust+nbConeSize;
687 if(iColMaxCone>AliEMCALGeoParams::fgkEMCALCols) iColMaxCone=AliEMCALGeoParams::fgkEMCALCols; // AliEMCALGeoParams::fgkEMCALCols = 48 in a supermodule
1c662fe8 688
689 // loop on all cells
bab35745 690 for(Int_t iCol=0; iCol<nTotalCols; iCol++){
691 for(Int_t iRow=0; iRow<nTotalRows; iRow++){
1c662fe8 692 // now recover the cell indexes in a supermodule
bab35745 693 Int_t iSector = int(iRow/AliEMCALGeoParams::fgkEMCALRows); // check in which SM is the cell
1c662fe8 694 if(iSector==5) continue; //
695 Int_t inModule = -1;
bab35745 696 Int_t iColLoc = -1;
697 if(iCol < AliEMCALGeoParams::fgkEMCALCols){ // if the SM number is odd the column is the one corresponding in the supermodule
494479c2 698 inModule = 2*iSector + 1;
bab35745 699 iColLoc = iCol;
1c662fe8 700 }
bab35745 701 else if(iCol > AliEMCALGeoParams::fgkEMCALCols - 1){ // if the SM number is even the column isn't the one corresponding in the supermodule
1c662fe8 702 inModule = 2*iSector;
bab35745 703 iColLoc = iCol-AliEMCALGeoParams::fgkEMCALCols;
1c662fe8 704 }
1c662fe8 705
bab35745 706 Int_t iRowLoc = iRow - AliEMCALGeoParams::fgkEMCALRows*iSector ;
707
708 if(TMath::Abs(iCol-colCellLeadingClust)<nbConeSize && TMath::Abs(iCol+colCellLeadingClust)>nbConeSize){
709 if(iRow<iRowMaxCone && iRow>iRowMinCone){
494479c2 710 Int_t iabsId = emcalGeom->GetAbsCellIdFromCellIndexes(inModule,iRowLoc,iColLoc); // verifier les iRow et iCol
1c662fe8 711 sumEnergyPhiBandCells+=cells->GetAmplitude(iabsId); //should be Et
712 }
713 }
bab35745 714 else if (TMath::Abs(iCol-colCellLeadingClust)>nbConeSize && TMath::Abs(iCol+colCellLeadingClust)<nbConeSize){
494479c2 715 Int_t iabsId = emcalGeom->GetAbsCellIdFromCellIndexes(inModule,iRowLoc,iColLoc); // verifier les iRow et iCol
1c662fe8 716 sumEnergyConeCells+=cells->GetAmplitude(iabsId); //should be Et
717 }
718 }
719 }
720 }
bab35745 721 etIso = sumEnergyConeCells;
722 phiBandcells = sumEnergyPhiBandCells;
1c662fe8 723}
724
725
726//__________________________________________________________________________
bab35745 727void AliAnalysisTaskEMCALPhotonIsolation::EtIsoCellEtaBand(TLorentzVector c, Float_t &etIso, Float_t &etaBandcells){
728 // Underlying events study with EMCAL cell in eta band
1c662fe8 729
730
bab35745 731 AliEMCALGeometry* emcalGeom = AliEMCALGeometry::GetInstance();
1c662fe8 732
733 Float_t sumEnergyEtaBandCells=0., sumEnergyConeCells=0.;
734
735
736
737 // check the cell corresponding to the leading cluster
738 Int_t absId = 999;
739 //maybe best to call it LeadingCellIdinClus or better maxId since it won't be used anywhere else ???
bab35745 740 Bool_t cellLeadingClustID = emcalGeom->GetAbsCellIdFromEtaPhi(c.Eta(),c.Phi(),absId);
741 if(!cellLeadingClustID) return;
1c662fe8 742
743 else{
744
745 Int_t iTower = -1;
746 Int_t iModule = -1;
747 Int_t imEta=-1, imPhi=-1;
bab35745 748 Int_t iEta =-1, iPhi =-1;
1c662fe8 749
bab35745 750 emcalGeom->GetCellIndex(absId,iModule,iTower,imPhi,imEta); // to get the module, the tower, eta and phi for the cell corresponding to the leading cluster
751 emcalGeom->GetCellPhiEtaIndexInSModule(iModule,iTower,imPhi,imEta,iPhi,iEta); // to get the cell eta and phi in the super module for the cell coming from the leading cluster
1c662fe8 752
753 // Get the row and the column of the cell corresponding to the leading cluster in EMCAL
bab35745 754 Int_t colCellLeadingClust = iEta;
755 if(iModule % 2) colCellLeadingClust = AliEMCALGeoParams::fgkEMCALCols + iEta ; // if the SM number is even you need to translate to have the one corresponding in EMCAL
756 Int_t rowCellLeadingClust = iPhi + AliEMCALGeoParams::fgkEMCALRows*int(iModule/2); // to have the corresponding row in EMCAL
1c662fe8 757
758 // total number or rows and columns in EMCAL
bab35745 759 Int_t nTotalRows = AliEMCALGeoParams::fgkEMCALRows*16/3 ; // 5 + 2/3 supermodules in a row
760 Int_t nTotalCols = 2*AliEMCALGeoParams::fgkEMCALCols; // 2 supermodules in a column
1c662fe8 761
bab35745 762 Int_t nbConeSize = int(fIsoConeRadius/0.0143); //0.0143 tower acceptance
1c662fe8 763
764 // Get the cells
765 AliVCaloCells * cells =InputEvent()->GetEMCALCells();
766
767 // define the max and min row and column corresponding to the isolation cone around the seed cell from the leading cluster
bab35745 768 Int_t iRowMinCone = rowCellLeadingClust-nbConeSize;
769 if(iRowMinCone<0) iRowMinCone=0;
1c662fe8 770
bab35745 771 Int_t iRowMaxCone = rowCellLeadingClust+nbConeSize;
772 if(iRowMaxCone>AliEMCALGeoParams::fgkEMCALRows) iRowMaxCone=AliEMCALGeoParams::fgkEMCALRows; // AliEMCALGeoParams::fgkEMCALRows = 24 in a supermodule
1c662fe8 773
bab35745 774 Int_t iColMinCone = colCellLeadingClust-nbConeSize;
775 if(iColMinCone<0) iColMinCone = 0;
1c662fe8 776
bab35745 777 Int_t iColMaxCone = colCellLeadingClust+nbConeSize;
778 if(iColMaxCone>AliEMCALGeoParams::fgkEMCALCols) iColMaxCone=AliEMCALGeoParams::fgkEMCALCols; // AliEMCALGeoParams::fgkEMCALCols = 48 in a supermodule
1c662fe8 779
780 // loop on all cells
bab35745 781 for(Int_t iCol=0; iCol<nTotalCols; iCol++)
1c662fe8 782 {
bab35745 783 for(Int_t iRow=0; iRow<nTotalRows; iRow++)
1c662fe8 784 {
785 // now recover the cell indexes in a supermodule
bab35745 786 Int_t iSector = int(iRow/AliEMCALGeoParams::fgkEMCALRows); // check in which SM is the cell
1c662fe8 787 if(iSector==5) continue; //
788 Int_t inModule = -1;
bab35745 789 Int_t iColLoc = -1;
790 if(iCol < AliEMCALGeoParams::fgkEMCALCols){ // if the SM number is odd the column is the one corresponding in the supermodule
494479c2 791 inModule = 2*iSector + 1;
bab35745 792 iColLoc = iCol;
1c662fe8 793 }
bab35745 794 else if(iCol > AliEMCALGeoParams::fgkEMCALCols - 1){ // if the SM number is even the column isn't the one corresponding in the supermodule
1c662fe8 795 inModule = 2*iSector;
bab35745 796 iColLoc = iCol-AliEMCALGeoParams::fgkEMCALCols;
1c662fe8 797 }
798
bab35745 799 Int_t iRowLoc = iRow - AliEMCALGeoParams::fgkEMCALRows*iSector ;
1c662fe8 800
bab35745 801 if(TMath::Abs(iCol-colCellLeadingClust)<nbConeSize && TMath::Abs(iCol+colCellLeadingClust)>nbConeSize){
802 if(iCol<iColMaxCone && iCol>iColMinCone){
494479c2 803 Int_t iabsId = emcalGeom->GetAbsCellIdFromCellIndexes(inModule,iRowLoc,iColLoc); // verifier les iRow et iCol
1c662fe8 804 sumEnergyEtaBandCells+=cells->GetAmplitude(iabsId); //should be Et
805 }
806 }
bab35745 807 else if (TMath::Abs(iCol-colCellLeadingClust)>nbConeSize && TMath::Abs(iCol+colCellLeadingClust)<nbConeSize){
494479c2 808 Int_t iabsId = emcalGeom->GetAbsCellIdFromCellIndexes(inModule,iRowLoc,iColLoc); // verifier les iRow et iCol
1c662fe8 809 sumEnergyConeCells+=cells->GetAmplitude(iabsId); //should be Et
810 }
811 }
812 }
813 }
bab35745 814 etIso = sumEnergyConeCells;
815 etaBandcells = sumEnergyEtaBandCells;
1c662fe8 816}
817
818
819//__________________________________________________________________________
bab35745 820void AliAnalysisTaskEMCALPhotonIsolation::EtIsoClusPhiBand(TLorentzVector c, Float_t &etIso, Float_t &phiBandclus, Int_t index){
821 // Underlying events study with clusters in phi band
1c662fe8 822
823 Float_t sumEnergyPhiBandClus=0., sumEnergyConeClus=0.;
824
825 //needs a check on the same cluster
826 AliParticleContainer *clusters = static_cast<AliParticleContainer*>(fParticleCollArray.At(1));
827 AliEmcalParticle *clust;
828
bab35745 829 Int_t localIndex=-1;
1c662fe8 830 while((clust = static_cast<AliEmcalParticle*>(clusters->GetNextAcceptParticle()))){ //check the position of other clusters in respect to the leading cluster
bab35745 831 localIndex++;
832 if(localIndex==index) continue;
1c662fe8 833
834 AliVCluster *cluster= clust->GetCluster();
835
836 TLorentzVector nClust; //STILL NOT INITIALIZED
837 cluster->GetMomentum(nClust,fVertex);
bab35745 838 Float_t phiClust =nClust.Phi();
839 Float_t etaClust= nClust.Eta();
1c662fe8 840 //redefine phi/c.Eta() from the cluster we passed to the function
841
bab35745 842 Float_t radius = TMath::Sqrt(TMath::Power(phiClust- c.Phi(),2)+TMath::Power(etaClust-c.Eta(),2)); // define the radius between the leading cluster and the considered cluster
1c662fe8 843
844 if(radius>fIsoConeRadius){ // the cluster is outside the isolation cone in this case study UE
845
846 // actually phi band here
bab35745 847 if(TMath::Abs(etaClust - c.Eta()) < fIsoConeRadius){
1c662fe8 848 sumEnergyPhiBandClus += nClust.Pt();
849 }
850 }
851 else // if the cluster is in the isolation cone, add the cluster pT
852 sumEnergyConeClus += nClust.Pt();
853
854 }
bab35745 855 etIso = sumEnergyConeClus;
856 phiBandclus = sumEnergyPhiBandClus;
1c662fe8 857}
858
859
860//__________________________________________________________________________
bab35745 861void AliAnalysisTaskEMCALPhotonIsolation::EtIsoClusEtaBand(TLorentzVector c, Float_t &etIso, Float_t &etaBandclus, Int_t index){
862 // Underlying events study with clusters in eta band
1c662fe8 863
864 Float_t sumEnergyEtaBandClus =0., sumEnergyConeClus=0.;
865 AliParticleContainer *clusters = static_cast<AliParticleContainer*>(fParticleCollArray.At(1));
866
867 AliEmcalParticle *clust;
868
bab35745 869 Int_t localIndex=-1;
1c662fe8 870 while((clust = static_cast<AliEmcalParticle*>(clusters->GetNextAcceptParticle()))){ //check the position of other clusters in respect to the leading cluster
bab35745 871 localIndex++;
872 if(localIndex==index) continue;
1c662fe8 873
874 AliVCluster *cluster= clust->GetCluster();
875
876 TLorentzVector nClust; //STILL NOT INITIALIZED
877 cluster->GetMomentum(nClust,fVertex);
878
bab35745 879 Float_t phiClust =nClust.Phi();
880 Float_t etaClust= nClust.Eta();
1c662fe8 881 //redefine phi/c.Eta() from the cluster we passed to the function
882
883 // define the radius between the leading cluster and the considered cluster
bab35745 884 Float_t radius = TMath::Sqrt(TMath::Power(phiClust-c.Phi(),2)+TMath::Power(etaClust-c.Eta(),2));
1c662fe8 885
886 if(radius>fIsoConeRadius){ // the cluster is outside the isolation cone in this case study UE
887
888 // actually eta band here
bab35745 889 if(TMath::Abs(etaClust - c.Eta()) < fIsoConeRadius){
1c662fe8 890 sumEnergyEtaBandClus += nClust.Pt();
891 }
892 }
893 else // if the cluster is in the isolation cone, add the cluster pT
894 sumEnergyConeClus += nClust.Pt();
895
896 }
bab35745 897 etIso = sumEnergyConeClus;
898 etaBandclus = sumEnergyEtaBandClus;
1c662fe8 899}
900
901
902//__________________________________________________________________________
bab35745 903void AliAnalysisTaskEMCALPhotonIsolation::PtIsoTrackPhiBand(TLorentzVector c, Float_t &ptIso, Float_t &phiBandtrack){
904 // Underlying events study with tracks in phi band in EMCAL acceptance
1c662fe8 905
906 //INSERT BOUNDARIES ACCORDING TO THE FLAG WE WANT TO USE
907 Float_t sumpTConeCharged=0., sumpTPhiBandTrack=0.;
bab35745 908 Float_t minPhi= 0., maxPhi= 2*TMath::Pi(), minEta = -0.9, maxEta= 0.9;
1c662fe8 909
bab35745 910 AliParticleContainer *tracks = static_cast<AliParticleContainer*>(fParticleCollArray.At(0));
1c662fe8 911
912 if(!fTPC4Iso){
bab35745 913 minEta = -0.7;
914 maxEta = 0.7;
915 minPhi = 1.4;
916 maxPhi = TMath::Pi();
1c662fe8 917 }
918
bab35745 919 AliVParticle *track = tracks->GetNextAcceptParticle(0);
1c662fe8 920
921 while(track){
922
923 //CHECK IF TRACK IS IN BOUNDARIES
bab35745 924 Float_t phiTrack = track->Phi();
925 Float_t etaTrack = track->Eta();
1c662fe8 926 // define the radius between the leading cluster and the considered cluster
927 //redefine phi/c.Eta() from the cluster we passed to the function
bab35745 928 if(phiTrack < maxPhi && phiTrack > minPhi && etaTrack < maxEta && etaTrack > minEta){
929 Float_t radius = TMath::Sqrt(TMath::Power(phiTrack - c.Phi(),2)+TMath::Power(etaTrack - c.Eta(),2));
1c662fe8 930
931 if(radius>fIsoConeRadius){ // if tracks are outside the isolation cone study
932
933 // actually phi band here --- ADD Boundaries conditions
bab35745 934 if(TMath::Abs(etaTrack - c.Eta()) < fIsoConeRadius){
1c662fe8 935 sumpTPhiBandTrack += track->Pt();
936 }
937 }
938 else
939 sumpTConeCharged+=track->Pt(); // should not double count if the track matching is already done
940 }
bab35745 941 track=tracks->GetNextAcceptParticle();
1c662fe8 942 }
bab35745 943 ptIso = sumpTConeCharged;
944 phiBandtrack = sumpTPhiBandTrack;
1c662fe8 945}
946
947
948//__________________________________________________________________________
bab35745 949void AliAnalysisTaskEMCALPhotonIsolation::PtIsoTrackEtaBand(TLorentzVector c, Float_t &ptIso, Float_t &etaBandtrack){
950 // Underlying events study with tracks in eta band in EMCAL acceptance
1c662fe8 951
952 //INSERT BOUNDARIES ACCORDING TO THE FLAG WE WANT TO USE
953 Float_t sumpTConeCharged=0., sumpTEtaBandTrack=0.;
bab35745 954 Float_t minPhi= 0., maxPhi= 2*TMath::Pi(), minEta = -0.9, maxEta= 0.9;
1c662fe8 955
bab35745 956 AliParticleContainer *tracks = static_cast<AliParticleContainer*>(fParticleCollArray.At(0));
1c662fe8 957
958
959 if(!fTPC4Iso){
bab35745 960 minEta = -0.7;
961 maxEta = 0.7;
962 minPhi = 1.4;
963 maxPhi = TMath::Pi();
1c662fe8 964 }
965
966
bab35745 967 AliVParticle *track = tracks->GetNextAcceptParticle(0);
1c662fe8 968
969 while(track){
970
bab35745 971 Float_t phiTrack = track->Phi();
972 Float_t etaTrack = track->Eta();
1c662fe8 973 //redefine phi/c.Eta() from the cluster we passed to the function
bab35745 974 if(phiTrack < maxPhi && phiTrack > minPhi && etaTrack < maxEta && etaTrack > minEta){
975 Float_t radius = TMath::Sqrt(TMath::Power(phiTrack-c.Phi(),2)+TMath::Power(etaTrack-c.Eta(),2)); // define the radius between the leading cluster and the considered cluster
1c662fe8 976 if(radius>fIsoConeRadius){ // if tracks are outside the isolation cone study UE
977
978 // actually eta band here --- ADD Boundaries conditions
bab35745 979 if(TMath::Abs(phiTrack - c.Phi()) < fIsoConeRadius){
1c662fe8 980 sumpTEtaBandTrack += track->Pt();
981 }
982 }
983 else
984 sumpTConeCharged += track->Pt(); // should not double count if the track matching is already done
985 }
bab35745 986 track=tracks->GetNextAcceptParticle();
1c662fe8 987 }
bab35745 988 ptIso = sumpTConeCharged;
989 etaBandtrack = sumpTEtaBandTrack;
1c662fe8 990}
991
992
993//__________________________________________________________________________
bab35745 994void AliAnalysisTaskEMCALPhotonIsolation::PtIsoTrackOrthCones(TLorentzVector c, Float_t &ptIso, Float_t &cones){
995 // Underlying events study with tracks in orthogonal cones in TPC
1c662fe8 996
997 Float_t sumpTConeCharged=0., sumpTPerpConeTrack=0.;
998
bab35745 999 AliParticleContainer *tracks = static_cast<AliParticleContainer*>(fParticleCollArray.At(0));
1c662fe8 1000
bab35745 1001 Float_t etaClus = c.Eta();
1002 Float_t phiClus = c.Phi();
1003 Float_t phiCone1 = phiClus - TMath::PiOver2();
1004 Float_t phiCone2 = phiClus + TMath::PiOver2();
1c662fe8 1005
bab35745 1006 if (phiCone1 < 0.) phiCone1 += 2*TMath::Pi();
1c662fe8 1007
bab35745 1008 AliVParticle *track = tracks->GetNextAcceptParticle(0);
1c662fe8 1009
1010 while(track){
1011
bab35745 1012 Float_t phiTrack = track->Phi();
1013 Float_t etaTrack = track->Eta();
1c662fe8 1014
bab35745 1015 Float_t dist2Clust = TMath::Sqrt(TMath::Power(etaTrack-etaClus, 2)+TMath::Power(phiTrack-phiClus, 2));
1016 if (dist2Clust<fIsoConeRadius)// if tracks are inside the IsoCone
1c662fe8 1017 sumpTConeCharged += track->Pt();
1018
1019 else{//tracks outside the IsoCone
1020 //Distances from the centres of the two Orthogonal Cones
bab35745 1021 Float_t dist2Cone1 = TMath::Sqrt(TMath::Power(etaTrack-etaClus, 2)+TMath::Power(phiTrack-phiCone1, 2));
1022 Float_t dist2Cone2 = TMath::Sqrt(TMath::Power(etaTrack-etaClus, 2)+TMath::Power(phiTrack-phiCone2, 2));
1c662fe8 1023
1024 //Is the Track Inside one of the two Cones ->Add to UE
bab35745 1025 if((dist2Cone1 < fIsoConeRadius) || (dist2Cone2 < fIsoConeRadius))
1c662fe8 1026 sumpTPerpConeTrack += track->Pt();
1027 }
bab35745 1028 track=tracks->GetNextAcceptParticle();
1c662fe8 1029 }
bab35745 1030 ptIso = sumpTConeCharged;
1031 cones = sumpTPerpConeTrack;
1c662fe8 1032}
1033
1034//__________________________________________________________________________
bab35745 1035void AliAnalysisTaskEMCALPhotonIsolation::PtIsoTrackFullTPC(TLorentzVector c, Float_t &ptIso, Float_t &full){
1036 // Underlying events study with tracks in full TPC except back to back bands
1c662fe8 1037
1038 Float_t sumpTConeCharged=0., sumpTTPCexceptB2B=0.;
1039
bab35745 1040 AliParticleContainer *tracks = static_cast<AliParticleContainer*>(fParticleCollArray.At(0));
1041 AliVParticle *track = tracks->GetNextAcceptParticle(0);
1c662fe8 1042
1043 while(track){
1044
bab35745 1045 Float_t phiTrack = track->Phi();
1046 Float_t etaTrack = track->Eta();
1c662fe8 1047 //redefine phi/c.Eta() from the cluster we passed to the function
1048
bab35745 1049 Float_t radius = TMath::Sqrt(TMath::Power(phiTrack-c.Phi(),2)+TMath::Power(etaTrack-c.Eta(),2)); // define the radius between the leading cluster and the considered cluster
1c662fe8 1050 if(radius>fIsoConeRadius){ // if tracks are outside the isolation cone study UE
bab35745 1051 Double_t dphiUp = c.Phi() + TMath::Pi() - fIsoConeRadius;
1052 Double_t dphiDown = c.Phi() + TMath::Pi() + fIsoConeRadius;
1c662fe8 1053 // TPC except B2B
bab35745 1054 if(TMath::Power(phiTrack-c.Phi(),2) +TMath::Power(etaTrack-c.Eta(),2) > TMath::Power((fIsoConeRadius+0.1),2) && phiTrack < dphiDown && phiTrack> dphiUp)
1c662fe8 1055 sumpTTPCexceptB2B += track->Pt();
1056 }
1057 else
1058 sumpTConeCharged += track->Pt(); // should not double count if the track matching is already done
1059
bab35745 1060 track=tracks->GetNextAcceptParticle();
1c662fe8 1061 }
bab35745 1062 ptIso = sumpTConeCharged;
1063 full = sumpTTPCexceptB2B;
1c662fe8 1064}
1065
1066//__________________________________________________________________________
bab35745 1067Bool_t AliAnalysisTaskEMCALPhotonIsolation::CheckBoundaries(TLorentzVector vecCOI){
1068 // Check if the cone around the considered cluster is in EMCAL acceptance
1c662fe8 1069
bab35745 1070 Float_t minPhiBound= 1.5 , minEtaBound= -0.5, maxPhiBound= TMath::Pi()-0.1, maxEtaBound= 0.5;
1c662fe8 1071 Bool_t isINBoundaries;
1072
1073 if(!fTPC4Iso){
bab35745 1074 minPhiBound = 1.4+0.4; //to be changed with fIsoConeR
1075 maxPhiBound = TMath::Pi()-0.4;
1076 minEtaBound = -0.7+0.4;
1077 maxEtaBound = 0.7-0.4;
1c662fe8 1078 }
bab35745 1079
1080 if(vecCOI.Eta() > maxEtaBound || vecCOI.Eta() < minEtaBound || vecCOI.Phi() > maxPhiBound || vecCOI.Phi() >minPhiBound)
1c662fe8 1081 isINBoundaries=kFALSE;
1082 else
1083 isINBoundaries=kTRUE;
1084
1085 return isINBoundaries;
1086}
1087
1088//__________________________________________________________________________
bab35745 1089Bool_t AliAnalysisTaskEMCALPhotonIsolation::FillGeneralHistograms(AliVCluster *coi, TLorentzVector vecCOI, Int_t index){
1090 // Fill the histograms for underlying events and isolation studies
1c662fe8 1091
bab35745 1092 AliParticleContainer *tracks = static_cast<AliParticleContainer*>(fParticleCollArray.At(0));
1c662fe8 1093
bab35745 1094 AliEmcalParticle *emcTrack = 0;
1c662fe8 1095
bab35745 1096 int nTracks=0;
1097 tracks->ResetCurrentID();
1098 while ((emcTrack = static_cast<AliEmcalParticle*>(tracks->GetNextAcceptParticle()))) {
1099 AliVTrack *track = emcTrack->GetTrack();
1c662fe8 1100 if(!track) continue;
1101 // if(!(track->TestFilterBit("kHybrid"))) continue;
1102
bab35745 1103 nTracks++;
1c662fe8 1104 }
1105
494479c2 1106 Double_t eTCOI = 0., m02COI = 0., lambda0cluster = 0., ptmc = 0., mcptsum = 0.;
1c662fe8 1107 //Int_t Ntracks;
1108 //Definition of the Array for Davide's Output
1109 const Int_t ndims = fNDimensions;
1110 Double_t outputValues[ndims];
1111
bab35745 1112 eTCOI = vecCOI.Et();
1113 m02COI = coi->GetM02();
494479c2 1114
1c662fe8 1115
1116 // ******** Isolation and UE calculation with different methods *********
1117
bab35745 1118 Double_t eTThreshold = 5;
1c662fe8 1119
1120 switch(fEtIsoMethod)
1121 {
1122 case 0: // SumEt<EtThr
bab35745 1123 if(fM02mincut < m02COI && m02COI < fM02maxcut) // photon candidate, cuts have to be decided after studies
1c662fe8 1124 {
bab35745 1125 eTThreshold = fEtIsoThreshold;
1c662fe8 1126 }
1127 break;
1128
1129 case 1: // SumEt<%Ephoton
bab35745 1130 if(fM02mincut < m02COI && m02COI < fM02maxcut) // photon candidate, cuts have to be decided after studies
1c662fe8 1131 {
bab35745 1132 eTThreshold = fEtIsoThreshold * eTCOI;
1c662fe8 1133 }
1134 break;
1135
bab35745 1136 case 2: // Etmax<eTThreshold
1137 eTThreshold = fEtIsoThreshold;
1138 if(fM02mincut < m02COI && m02COI < fM02maxcut && eTCOI<eTThreshold) // photon candidate, cuts have to be decided after studies
1c662fe8 1139 {
bab35745 1140 fEtIsolatedClust->Fill(eTCOI);
1c662fe8 1141 }
1142 break;
1143 }
1144
1145 //DO NOT CHANGE EVER AGAIN THE FOLLOWING DEFINITIONS
bab35745 1146 Float_t isoConeArea = TMath::Pi()*fIsoConeRadius*fIsoConeRadius;
1147 Float_t etaBandArea = (1.4 - 2.*fIsoConeRadius)*2.*fIsoConeRadius;
1148 Float_t phiBandArea = ((5./9.)*TMath::Pi()- 2.*fIsoConeRadius)*2.*fIsoConeRadius;
1149 Float_t etaBandAreaTr = (1.8 - 2.*fIsoConeRadius)*2.*fIsoConeRadius;
1150 Float_t phiBandAreaTr = (2.*TMath::Pi() - 4.*fIsoConeRadius)*2.*fIsoConeRadius;//there is a 2 more because of the JET CONE B2B
1151 Float_t perpConesArea = 2.*isoConeArea;
1152 Float_t fullTPCArea = 1.8*2.*TMath::Pi()-fIsoConeRadius*(TMath::Pi()*fIsoConeRadius + 3.6);
1c662fe8 1153
bab35745 1154 Float_t isolation, ue;
1c662fe8 1155
1156 if(!fTPC4Iso){ //EMCAL Only for Acceptance of Clusters
1157 switch(fIsoMethod)
1158 {
1159 case 0: //EMCAL CELLS
1160
1161 switch (fUEMethod)
1162 {
1163 case 0: //phi band
bab35745 1164 EtIsoCellPhiBand(vecCOI, isolation, ue);
1165 //Normalisation ue wrt Area - TO DO-
1166 ue = ue * (isoConeArea / phiBandArea);
1167 fPhiBandUECells->Fill(vecCOI.Pt() , ue);
1168 fEtIsoCells->Fill(isolation);
1169 if(isolation<eTThreshold)
1c662fe8 1170 {
bab35745 1171 fEtIsolatedCells->Fill(eTCOI);
1172 fEtisoT=eTCOI;
1173 fPtisoT=vecCOI.Pt();
1c662fe8 1174 }
1175 break;
1176 case 1: //eta band
bab35745 1177 EtIsoCellEtaBand(vecCOI, isolation, ue);
1178 //Normalisation ue wrt Area - TO DO-
1179 ue = ue * (isoConeArea / etaBandArea);
1180 fEtaBandUECells->Fill(vecCOI.Pt() , ue);
1181 fEtIsoCells->Fill(isolation);
1182 if(isolation<eTThreshold)
1c662fe8 1183 {
bab35745 1184 fEtIsolatedCells->Fill(eTCOI);
1185 fEtisoT=eTCOI;
1186 fPtisoT=vecCOI.Pt();
1c662fe8 1187 }
1188 break;
1189 }
1190 break;
1191
1192 case 1: //EMCAL CLUSTERS
1193
1194 switch (fUEMethod)
1195 {
1196 case 0: //phi band
bab35745 1197 EtIsoClusPhiBand(vecCOI, isolation, ue,index);
1198 //Normalisation ue wrt Area - TO DO-
1199 ue = ue * (isoConeArea / phiBandArea);
1200 fPhiBandUEClust->Fill(vecCOI.Pt() , ue);
1201 fEtIsoClust->Fill(isolation);
1c662fe8 1202 break;
1203 case 1: //eta band
bab35745 1204 EtIsoClusEtaBand(vecCOI, isolation, ue,index);
1205 //Normalisation ue wrt Area - TO DO-
1206 ue = ue * (isoConeArea / etaBandArea);
1207 fEtaBandUEClust->Fill(vecCOI.Pt() , ue);
1208 fEtIsoClust->Fill(isolation);
1209 if(isolation<eTThreshold)
1c662fe8 1210 {
bab35745 1211 fEtIsolatedClust->Fill(eTCOI);
1212 fEtisoT=eTCOI;
1213 fPtisoT=vecCOI.Pt();
1c662fe8 1214 }
1215 break;
1216 }
bab35745 1217 case 2: //TRACKS (TBD which tracks) //EMCAL tracks
1c662fe8 1218 switch (fUEMethod)
1219 {
1220 case 0: //phi band
bab35745 1221 PtIsoTrackPhiBand(vecCOI, isolation, ue);
1222 //Normalisation ue wrt Area - TO DO-
1223 ue = ue * (isoConeArea / phiBandAreaTr);
1224 fPhiBandUETracks->Fill(vecCOI.Pt() , ue);
1225 fPtIsoTrack->Fill(isolation);
1226 if(isolation<eTThreshold)
1c662fe8 1227 {
bab35745 1228 fEtIsolatedTracks->Fill(eTCOI);
1229 fEtisoT=eTCOI;
1230 fPtisoT=vecCOI.Pt();
1c662fe8 1231 }
1232 break;
1233 case 1: //eta band
bab35745 1234 PtIsoTrackEtaBand(vecCOI, isolation, ue);
1235 //Normalisation ue wrt Area - TO DO-
1236 ue = ue * (isoConeArea / etaBandAreaTr);
1237 fEtaBandUETracks->Fill(vecCOI.Pt() , ue);
1238 fPtIsoTrack->Fill(isolation);
1239 if(isolation<eTThreshold)
1c662fe8 1240 {
bab35745 1241 fEtIsolatedTracks->Fill(eTCOI);
1242 fEtisoT=eTCOI;
1243 fPtisoT=vecCOI.Pt();
1c662fe8 1244 }
1245 break;
1246 // case 2: //Cones
bab35745 1247 // PtIsoTrackOrthCones(vecCOI, absId, isolation, ue);
1c662fe8 1248 // break;
1249 // case 3: //Full TPC
bab35745 1250 // PtIsoTrackFullTPC(vecCOI, absId, isolation, ue);
1c662fe8 1251 // break;
1252 }
1253 }
1254 }
bab35745 1255 else{ //EMCAL + TPC (Only tracks for the Isolation since IsoCone Goes Out of EMCAL)
1c662fe8 1256 switch (fUEMethod)
1257 {
1258 case 0: //phi band
bab35745 1259 PtIsoTrackPhiBand(vecCOI, isolation, ue);
1260 //Normalisation ue wrt Area - TO DO-
1261 ue = ue * (isoConeArea / phiBandAreaTr);
1262 fPhiBandUETracks->Fill(vecCOI.Pt() , ue);
1263 fPtIsoTrack->Fill(isolation);
1264 if(isolation<eTThreshold)
1c662fe8 1265 {
bab35745 1266 fEtIsolatedTracks->Fill(eTCOI);
1267 fEtisoT=eTCOI;
1268 fPtisoT=vecCOI.Pt();
1c662fe8 1269 }
1270 break;
1271 case 1: //eta band
bab35745 1272 PtIsoTrackEtaBand(vecCOI, isolation, ue);
1273 //Normalisation ue wrt Area - TO DO-
1274 ue = ue * (isoConeArea / etaBandAreaTr);
1275 fEtaBandUETracks->Fill(vecCOI.Pt() , ue);
1276 fPtIsoTrack->Fill(isolation);
1277 if(isolation<eTThreshold)
1c662fe8 1278 {
bab35745 1279 fEtIsolatedTracks->Fill(eTCOI);
1280 fEtisoT=eTCOI;
1281 fPtisoT=vecCOI.Pt();
1c662fe8 1282 }
1283 break;
1284 case 2: //Cones
bab35745 1285 PtIsoTrackOrthCones(vecCOI, isolation, ue);
1286 //Normalisation ue wrt Area - TO DO-
1287 ue = ue * (isoConeArea / perpConesArea);
1288 fPerpConesUETracks ->Fill(vecCOI.Pt() , ue);
1289 fPtIsoTrack->Fill(isolation);
1290 if(isolation<eTThreshold)
1c662fe8 1291 {
bab35745 1292 fEtIsolatedTracks->Fill(eTCOI);
1293 fEtisoT=eTCOI;
1294 fPtisoT=vecCOI.Pt();
1c662fe8 1295 }
1296 break;
1297 case 3: //Full TPC
bab35745 1298 PtIsoTrackFullTPC(vecCOI, isolation, ue);
1299 //Normalisation ue wrt Area - TO DO-
1300 ue = ue * (isoConeArea / fullTPCArea);
1301 fTPCWithoutIsoConeB2BbandUE->Fill(vecCOI.Pt() , ue);
1302 fPtIsoTrack->Fill(isolation);
1303 if(isolation<eTThreshold)
1c662fe8 1304 {
bab35745 1305 fEtIsolatedTracks->Fill(eTCOI);
1306 fEtisoT=eTCOI;
1307 fPtisoT=vecCOI.Pt();
1c662fe8 1308 }
1309 break;
1310 }
1311 }
1312
1313
1314 //Here we should call something to know the number of tracks...
1315 //Soon I'll put in this version the "old way"; please let me know if
1316 //any of you could do the same with the JET framework
1317
1318 switch(fWho) {
1319 case 0:
bab35745 1320 flambda0T=m02COI;
1321 fEtT=vecCOI.Et();
1322 fPtT=vecCOI.Pt();
1323 fetaT=vecCOI.Eta();
1324 fphiT=vecCOI.Phi();
1325 fsumEtisoconeT=isolation;
1c662fe8 1326 // AliError(Form("lambda 0 %f",flambda0T));
bab35745 1327 fsumEtUE=ue;
1c662fe8 1328
1329 fOutputTree->Fill();
1330 break;
1331
1332 case 1:
bab35745 1333 outputValues[0] = nTracks;
1334 outputValues[1] = eTCOI;
1c662fe8 1335 outputValues[2] = lambda0cluster;
bab35745 1336 outputValues[3] = isolation;
1337 outputValues[4] = ue;
1338 outputValues[5] = isolation-ue;
1339 outputValues[6] = vecCOI.Eta();
1340 outputValues[7] = vecCOI.Phi();
1c662fe8 1341 if (fIsMC) {
1342 outputValues[8] = ptmc;
1343 outputValues[9] = mcptsum;
1344 }
1345 fOutputTHnS -> Fill(outputValues);
1346 break;
1347 // // fOutPTMAX -> Fill(outputValues[1],outputValues[2],);
1348 }
1349 return kTRUE;
1350}
1351
1352
1353