3 #include "AliAnalysisTaskEMCALIsoPhoton.h"
11 #include <THnSparse.h>
12 #include <TLorentzVector.h>
15 #include "AliAnalysisManager.h"
16 #include "AliAnalysisTask.h"
17 #include "AliEMCALGeometry.h"
18 #include "AliEMCALRecoUtils.h"
19 #include "AliESDCaloCells.h"
20 #include "AliESDCaloCluster.h"
21 #include "AliESDEvent.h"
22 #include "AliESDHeader.h"
23 #include "AliESDInputHandler.h"
24 #include "AliESDUtils.h"
25 #include "AliESDtrack.h"
26 #include "AliESDtrackCuts.h"
27 #include "AliAODEvent.h"
28 #include "AliAODTrack.h"
29 #include "AliMCEvent.h"
30 #include "AliMCEventHandler.h"
32 #include "AliVEvent.h"
33 #include "AliVTrack.h"
34 #include "AliV0vertexer.h"
35 #include "AliVCluster.h"
36 #include "AliOADBContainer.h"
42 ClassImp(AliAnalysisTaskEMCALIsoPhoton)
44 //________________________________________________________________________
45 AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton() :
55 fGeoName("EMCAL_COMPLETEV1"),
72 fImportGeometryFromFile(0),
73 fImportGeometryFilePath(""),
80 fClusIdFromTracks(""),
81 fCpvFromTrack(kFALSE),
84 fPtBinHighEdge(99.75),
85 fRemMatchClus(kFALSE),
103 fMCDirPhotonPtEtaPhi(0),
104 fMCIsoDirPhotonPtEtaPhi(0),
105 fMCDirPhotonPtEtIso(0),
115 fMcPtInConeBGnoUE(0),
116 fMcPtInConeSBGnoUE(0),
117 fMcPtInConeTrBGnoUE(0),
118 fMcPtInConeTrSBGnoUE(0),
119 fMcPtInConeMcPhoPt(0),
121 fAllIsoNoUeEtMcGamma(0),
122 fMCDirPhotonPtEtaPhiNoClus(0),
134 fEmcClusEClusCuts(0),
145 // Default constructor.
146 for(Int_t i = 0; i < 12; i++) fGeomMatrix[i] = 0;
149 //________________________________________________________________________
150 AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton(const char *name) :
151 AliAnalysisTaskSE(name),
160 fGeoName("EMCAL_COMPLETEV1"),
177 fImportGeometryFromFile(0),
178 fImportGeometryFilePath(""),
185 fClusIdFromTracks(""),
186 fCpvFromTrack(kFALSE),
188 fPtBinLowEdge(-0.25),
189 fPtBinHighEdge(99.75),
190 fRemMatchClus(kFALSE),
208 fMCDirPhotonPtEtaPhi(0),
209 fMCIsoDirPhotonPtEtaPhi(0),
210 fMCDirPhotonPtEtIso(0),
220 fMcPtInConeBGnoUE(0),
221 fMcPtInConeSBGnoUE(0),
222 fMcPtInConeTrBGnoUE(0),
223 fMcPtInConeTrSBGnoUE(0),
224 fMcPtInConeMcPhoPt(0),
226 fAllIsoNoUeEtMcGamma(0),
227 fMCDirPhotonPtEtaPhiNoClus(0),
239 fEmcClusEClusCuts(0),
252 // Define input and output slots here
253 // Input slot #0 works with a TChain
254 DefineInput(0, TChain::Class());
255 // Output slot #0 id reserved by the base class for AOD
256 // Output slot #1 writes into a TH1 container
257 DefineOutput(1, TList::Class());
258 DefineOutput(2, TList::Class());
261 //________________________________________________________________________
262 void AliAnalysisTaskEMCALIsoPhoton::UserCreateOutputObjects()
264 // Create histograms, called once.
266 fESDClusters = new TObjArray();
267 fSelPrimTracks = new TObjArray();
270 fOutputList = new TList();
271 fOutputList->SetOwner();// Container cleans up all histos (avoids leaks in merging)
273 fGeom = AliEMCALGeometry::GetInstance(fGeoName.Data());
274 fOADBContainer = new AliOADBContainer("AliEMCALgeo");
275 fOADBContainer->InitFromFile(Form("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root"),"AliEMCALgeo");
277 fEvtSel = new TH1F("hEvtSel","Event selection counter (0=all trg, 1=pvz cut) ;evt cut ;dN/dcut}",2,0,2);
278 fOutputList->Add(fEvtSel);
280 fNClusEt10 = new TH1F("hNClusEt10","# of cluster with E_{T}>10 per event;E;",101,-0.5,100.5);
281 fOutputList->Add(fNClusEt10);
283 fRecoPV = new TH1F("hRecoPV","Prim. vert. reconstruction (yes or no);reco (0=no, 1=yes) ;",2,-0.5,1.5);
284 fOutputList->Add(fRecoPV);
286 fPVtxZ = new TH1F("hPVtxZ","primary vertex Z before cut;prim-vz(cm) ;",200,-100,100);
287 fOutputList->Add(fPVtxZ);
289 fTrMultDist = new TH1F("fTrMultDist","track multiplicity;tracks/event;#events",200,0.5,200.5);
290 fOutputList->Add(fTrMultDist);
292 fClusEtCPVSBGISO = new TH2F("hClusEtCPVSBGISO","ISO^{TRK+EMC} vs. E_{T}^{clus} (after CPV and 0.1<#lambda_{0}^{2}<0.3;E_{T}^{clus} [GeV];ISO^{TRK+EMC} [GeV]",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,1000,0,100);
293 fClusEtCPVSBGISO->Sumw2();
294 fOutputList->Add(fClusEtCPVSBGISO);
296 fClusEtCPVBGISO = new TH2F("hClusEtCPVBGISO","ISO^{TRK+EMC} vs. E_{T}^{clus} (after CPV and 0.5<#lambda_{0}^{2}<2.0;E_{T}^{clus} [GeV];ISO^{TRK+EMC} [GeV]",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,1000,0,100);
297 fClusEtCPVBGISO->Sumw2();
298 fOutputList->Add(fClusEtCPVBGISO);
300 fMCDirPhotonPtEtaPhi = new TH3F("hMCDirPhotonPtEtaPhi","photon (gq->#gammaq) p_{T}, #eta, #phi;GeV/c;#eta;#phi",100,-0.5,99.5,154,-0.77,0.77,130,1.38,3.20);
301 fMCDirPhotonPtEtaPhi->Sumw2();
302 fOutputList->Add(fMCDirPhotonPtEtaPhi);
304 fMCIsoDirPhotonPtEtaPhi = new TH3F("hMCIsoDirPhotonPtEtaPhi","photon (gq->#gammaq, isolated@MC) p_{T}, #eta, #phi;GeV/c;#eta;#phi",100,-0.5,99.5,154,-0.77,0.77,130,1.38,3.20);
305 fMCIsoDirPhotonPtEtaPhi->Sumw2();
306 fOutputList->Add(fMCIsoDirPhotonPtEtaPhi);
308 fMCDirPhotonPtEtIso = new TH2F("hMCDirPhotonPtEtIso",Form("photon (gq->#gammaq @MC) p_{T}, E_{T}^{ISO} (R=%1.1f);GeV/c;E_{T}^{ISO} GeV/c",fIsoConeR),100,-0.5,99.5,20,-0.25,9.75);
309 fMCDirPhotonPtEtIso->Sumw2();
310 fOutputList->Add(fMCDirPhotonPtEtIso);
313 fDecayPhotonPtMC = new TH1F("hDecayPhotonPtMC","decay photon p_{T};GeV/c;dN/dp_{T} (c GeV^{-1})",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge);
314 fDecayPhotonPtMC->Sumw2();
315 fOutputList->Add(fDecayPhotonPtMC);
317 fCellAbsIdVsAmpl = new TH2F("hCellAbsIdVsAmpl","cell abs id vs cell amplitude (energy);E (GeV);ID",200,0,100,24*48*10,-0.5,24*48*10-0.5);
318 fOutputList->Add(fCellAbsIdVsAmpl);
320 fNClusHighClusE = new TH2F("hNClusHighClusE","total number of clusters vs. highest clus energy in the event;E (GeV);NClus",200,0,100,301,-0.5,300.5);
321 fOutputList->Add(fNClusHighClusE);
323 fHigherPtConeM02 = new TH2F("hHigherPtConeM02","#lambda_{0}^{2} vs. in-cone-p_{T}^{max};p_{T}^{max} (GeV/c, in the cone);#lambda_{0}^{2}",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,400,0,4);
324 fOutputList->Add(fHigherPtConeM02);
326 fClusEtMcPt = new TH2F("hClusEtMcPt","E_{T}^{clus} vs. p_{T}^{mc}; p_{T}^{mc};E_{T}^{clus}",500,0,100,500,0,100);
327 fOutputList->Add(fClusEtMcPt);
329 fClusMcDetaDphi = new TH2F("hClusMcDetaDphi","#Delta#phi vs. #Delta#eta (reco-mc);#Delta#eta;#Delta#phi",100,-.7,.7,100,-.7,.7);
330 fOutputList->Add(fClusMcDetaDphi);
332 fNClusPerPho = new TH2F("hNClusPerPho","Number of clusters per prompt photon;p_{T}^{MC};N_{clus}",500,0,100,11,-0.5,10.5);
333 fOutputList->Add(fNClusPerPho);
335 fMcPtInConeBG = new TH2F("hMcPtInConeBG","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK+EMC} (BG template);ISO^{TRK+EMC} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100);
336 fOutputList->Add(fMcPtInConeBG);
338 fMcPtInConeSBG = new TH2F("hMcPtInConeSBG","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK+EMC} (SBG range);ISO^{TRK+EMC} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100);
339 fOutputList->Add(fMcPtInConeSBG);
341 fMcPtInConeBGnoUE = new TH2F("hMcPtInConeBGnoUE","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK+EMC} (BG template);ISO^{TRK+EMC} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100);
342 fOutputList->Add(fMcPtInConeBGnoUE);
344 fMcPtInConeSBGnoUE = new TH2F("hMcPtInConeSBGnoUE","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK+EMC} (SBG range);ISO^{TRK+EMC} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100);
345 fOutputList->Add(fMcPtInConeSBGnoUE);
347 fMcPtInConeTrBGnoUE = new TH2F("hMcPtInConeTrBGnoUE","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK} (BG template);ISO^{TRK} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100);
348 fOutputList->Add(fMcPtInConeTrBGnoUE);
350 fMcPtInConeTrSBGnoUE = new TH2F("hMcPtInConeTrSBGnoUE","#sum_{in-cone}p_{T}^{mc-primaries} vs. ISO^{TRK} (SBG range);ISO^{TRK} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",600,-10,50,1000,0,100);
351 fOutputList->Add(fMcPtInConeTrSBGnoUE);
353 fMcPtInConeMcPhoPt = new TH2F("hMcPtInConeMcPhoPt","#sum_{in-cone}p_{T}^{mc-primaries} vs. prompt photon p_{T};p_{T}^{mc-#gamma} (GeV);#sum_{in-cone}p_{T}^{mc-primaries}",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,200,-0.25,99.75);
354 fOutputList->Add(fMcPtInConeMcPhoPt);
356 fAllIsoEtMcGamma = new TH2F("hAllIsoEtMcGammaE","ISO^{TRK+EMC} vs. E_{T}^{clus} for clusters comming from a MC prompt #gamma; E_{T}^{clus} (GeV);ISO^{TRK+EMC} (GeV);",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,600,-10,50);
357 fOutputList->Add(fAllIsoEtMcGamma);
359 fAllIsoNoUeEtMcGamma = new TH2F("hAllIsoNoUeEtMcGammaE","ISO^{TRK+EMC}_{noue} vs. E_{T}^{clus} for clusters comming from a MC prompt #gamma; E_{T}^{clus} (GeV);ISO^{TRK+EMC}_{noue} (GeV);",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,600,-10,50);
360 fOutputList->Add(fAllIsoNoUeEtMcGamma);
363 fMCDirPhotonPtEtaPhiNoClus = new TH3F("hMCDirPhotonPhiEtaNoClus","p_{T}, #eta and #phi of prompt photons with no reco clusters;p_{T};#eta;#phi",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,154,-0.77,0.77,130,1.38,3.20);
364 fOutputList->Add(fMCDirPhotonPtEtaPhiNoClus);
366 Int_t nEt=fNBinsPt*5, nM02=400, nCeIso=1000, nTrIso=1000, nAllIso=1000, nCeIsoNoUE=1000, nAllIsoNoUE=1000, nTrClDphi=200, nTrClDeta=100, nClEta=140, nClPhi=128, nTime=60, nMult=100, nPhoMcPt=100;
367 Int_t bins[] = {nEt, nM02, nCeIso, nTrIso, nAllIso, nCeIsoNoUE, nAllIsoNoUE, nTrClDphi, nTrClDeta,nClEta,nClPhi,nTime,nMult,nPhoMcPt};
368 fNDimensions = sizeof(bins)/sizeof(Int_t);
369 const Int_t ndims = fNDimensions;
370 Double_t xmin[] = { fPtBinLowEdge, 0., -10., -10., -10., -10., -10., -0.1,-0.05, -0.7, 1.4,-0.15e-06,-0.5,-0.5};
371 Double_t xmax[] = { fPtBinHighEdge, 4., 190., 190., 190., 190., 190., 0.1, 0.05, 0.7, 3.192, 0.15e-06,99.5,99.5};
372 if(fPeriod.Contains("11h")){
375 fHnOutput = new THnSparseF("fHnOutput","Output matrix: E_{T},M02,CeIso,TrIso,AllIso, CeIsoNoUESub, AllIsoNoUESub, d#phi_{trk},d#eta_{trk},#eta_{clus},#phi_{clus},T_{max},mult,mc-p_{T}^{#gamma}", ndims, bins, xmin, xmax);
376 fOutputList->Add(fHnOutput);
379 fQAList = new TList();
380 fQAList->SetOwner();// Container cleans up all histos (avoids leaks in merging)
382 fNTracks = new TH1F("hNTracks","# of selected tracks;n-tracks;counts",120,-0.5,119.5);
384 fQAList->Add(fNTracks);
386 fEmcNCells = new TH1F("fEmcNCells",";n/event;count",120,-0.5,119.5);
388 fQAList->Add(fEmcNCells);
389 fEmcNClus = new TH1F("fEmcNClus",";n/event;count",120,-0.5,119.5);
391 fQAList->Add(fEmcNClus);
392 fEmcNClusCut = new TH1F("fEmcNClusCut",";n/event;count",120,-0.5,119.5);
393 fEmcNClusCut->Sumw2();
394 fQAList->Add(fEmcNClusCut);
395 fNTracksECut = new TH1F("fNTracksECut",";n/event;count",120,-0.5,119.5);
396 fNTracksECut->Sumw2();
397 fQAList->Add(fNTracksECut);
398 fEmcNCellsCut = new TH1F("fEmcNCellsCut",";n/event;count",120,-0.5,119.5);
399 fEmcNCellsCut->Sumw2();
400 fQAList->Add(fEmcNCellsCut);
401 fEmcClusETM1 = new TH1F("fEmcClusETM1","(method clus->GetTrackDx,z);GeV;counts",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge);
402 fEmcClusETM1->Sumw2();
403 fQAList->Add(fEmcClusETM1);
404 fEmcClusETM2 = new TH1F("fEmcClusETM2","(method track->GetEMCALcluster());GeV;counts",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge);
405 fEmcClusETM2->Sumw2();
406 fQAList->Add(fEmcClusETM2);
407 fEmcClusNotExo = new TH1F("fEmcClusNotExo","exotics removed;GeV;counts",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge);
408 fEmcClusNotExo->Sumw2();
409 fQAList->Add(fEmcClusNotExo);
410 fEmcClusEPhi = new TH2F("fEmcClusEPhi",";GeV;#phi",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,63,0,6.3);
411 fEmcClusEPhi->Sumw2();
412 fQAList->Add(fEmcClusEPhi);
413 fEmcClusEPhiCut = new TH2F("fEmcClusEPhiCut",";GeV;#phi",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,63,0,6.3);
414 fEmcClusEPhiCut->Sumw2();
415 fQAList->Add(fEmcClusEPhiCut);
416 fEmcClusEEta = new TH2F("fEmcClusEEta",";GeV;#eta",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,19,-0.9,0.9);
417 fEmcClusEEta->Sumw2();
418 fQAList->Add(fEmcClusEEta);
419 fEmcClusEEtaCut = new TH2F("fEmcClusEEtaCut",";GeV;#eta",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,18,-0.9,0.9);
420 fEmcClusEEtaCut->Sumw2();
421 fQAList->Add(fEmcClusEEtaCut);
422 fTrackPtPhi = new TH2F("fTrackPtPhi",";p_{T} [GeV/c];#phi",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,63,0,6.3);
423 fTrackPtPhi->Sumw2();
424 fQAList->Add(fTrackPtPhi);
425 fTrackPtPhiCut = new TH2F("fTrackPtPhiCut",";p_{T} [GeV/c];#phi",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,63,0,6.3);
426 fTrackPtPhiCut->Sumw2();
427 fQAList->Add(fTrackPtPhiCut);
428 fTrackPtEta = new TH2F("fTrackPtEta",";p_{T} [GeV/c];#eta",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,18,-0.9,0.9);
429 fTrackPtEta->Sumw2();
430 fQAList->Add(fTrackPtEta);
431 fTrackPtEtaCut = new TH2F("fTrackPtEtaCut",";p_{T} [GeV/c];#eta",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,18,-0.9,0.9);
432 fTrackPtEtaCut->Sumw2();
433 fQAList->Add(fTrackPtEtaCut);
434 fEmcClusEClusCuts = new TH2F("fEmcClusEClusCuts",";GeV;cut",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,fNCuts,-0.5,fNCuts-0.5);
435 fEmcClusEClusCuts->Sumw2();
436 fQAList->Add(fEmcClusEClusCuts);
438 fMaxCellEPhi = new TH2F("fMaxCellEPhi","Most energetic cell in event; GeV;#phi",fNBinsPt, fPtBinLowEdge,fPtBinHighEdge,63,0,6.3);
439 fMaxCellEPhi->Sumw2();
440 fQAList->Add(fMaxCellEPhi);
442 PostData(1, fOutputList);
443 PostData(2, fQAList);
446 //________________________________________________________________________
447 void AliAnalysisTaskEMCALIsoPhoton::UserExec(Option_t *)
449 // Main loop, called for each event.
454 // event trigger selection
455 Bool_t isSelected = 0;
456 if(fPeriod.Contains("11a")){
457 if(fTrigBit.Contains("kEMC"))
458 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC1);
460 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
463 if(fTrigBit.Contains("kEMC"))
464 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC7);
466 if(fTrigBit.Contains("kMB"))
467 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
469 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kINT7);
471 if(fPeriod.Contains("11h")){
472 if(fTrigBit.Contains("kAny"))
473 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kAny);
474 if(fTrigBit.Contains("kAnyINT"))
475 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kAnyINT);
480 printf("isSelected = %d, fIsMC=%d\n", isSelected, fIsMc);
484 TTree *tree = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetTree();
485 TFile *file = (TFile*)tree->GetCurrentFile();
486 TString filename = file->GetName();
487 if(!filename.Contains(fPathStrOpt.Data()))
490 fVEvent = (AliVEvent*)InputEvent();
492 printf("ERROR: event not available\n");
495 Int_t runnumber = InputEvent()->GetRunNumber() ;
497 printf("run number = %d\n",runnumber);
499 fESD = dynamic_cast<AliESDEvent*>(fVEvent);
501 fAOD = dynamic_cast<AliAODEvent*>(fVEvent);
503 printf("ERROR: Invalid type of event!!!\n");
507 printf("AOD EVENT!\n");
512 printf("event is ok,\n run number=%d\n",runnumber);
515 AliVVertex *pv = (AliVVertex*)fVEvent->GetPrimaryVertex();
516 Bool_t pvStatus = kTRUE;
518 AliESDVertex *esdv = (AliESDVertex*)fESD->GetPrimaryVertex();
519 pvStatus = esdv->GetStatus();
522 AliAODVertex *aodv = (AliAODVertex*)fAOD->GetPrimaryVertex();
523 pvStatus = aodv->GetStatus();
531 fPVtxZ->Fill(pv->GetZ());
532 if(TMath::Abs(pv->GetZ())>10)
535 printf("passed vertex cut\n");
539 fTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("Tracks"));
541 fTracks = dynamic_cast<TClonesArray*>(fAOD->GetTracks());
544 AliError("Track array in event is NULL!");
546 printf("returning due to not finding tracks!\n");
549 // Track loop to fill a pT spectrum
550 const Int_t Ntracks = fTracks->GetEntriesFast();
551 for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) {
552 // for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
553 //AliESDtrack* track = (AliESDtrack*)fESD->GetTrack(iTracks);
554 AliVTrack *track = (AliVTrack*)fTracks->At(iTracks);
557 AliAODTrack *aodTrack = dynamic_cast<AliAODTrack*>(track);
558 AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
560 if(esdTrack->GetEMCALcluster()>0)
561 fClusIdFromTracks.Append(Form("%d ",esdTrack->GetEMCALcluster()));
562 if (fPrTrCuts && fPrTrCuts->IsSelected(track)){
563 fSelPrimTracks->Add(track);
567 if (fSelHybrid && !aodTrack->IsHybridGlobalConstrainedGlobal())
569 if(!fSelHybrid && !aodTrack->TestFilterBit(fFilterBit))
571 fSelPrimTracks->Add(track);
572 /*if(fTrackMaxPt<track->Pt())
573 fTrackMaxPt = track->Pt();*/
577 TObjArray *matEMCAL=(TObjArray*)fOADBContainer->GetObject(runnumber,"EmcalMatrices");
578 for(Int_t mod=0; mod < (fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
579 if(fGeoName=="EMCAL_FIRSTYEARV1" && mod>3)
582 fGeom->SetMisalMatrix(fESD->GetEMCALMatrix(mod), mod);
584 // if(fVEvent->GetEMCALMatrix(mod))
585 fGeomMatrix[mod] = (TGeoHMatrix*) matEMCAL->At(mod);
586 fGeom->SetMisalMatrix(fGeomMatrix[mod] , mod);
590 AliESDtrackCuts *fTrackCuts = new AliESDtrackCuts();
591 fTrackMult = fTrackCuts->GetReferenceMultiplicity(fESD);//kTrackletsITSTPC ,0.5);
593 printf("ESD Track mult= %d\n",fTrackMult);
596 fTrackMult = Ntracks;
598 printf("AOD Track mult= %d\n",fTrackMult);
600 fTrMultDist->Fill(fTrackMult);
603 TList *l = fESD->GetList();
604 fESDClusters = dynamic_cast<TClonesArray*>(l->FindObject("CaloClusters"));
605 fESDCells = fESD->GetEMCALCells();
607 printf("ESD cluster mult= %d\n",fESDClusters->GetEntriesFast());
610 fAODClusters = dynamic_cast<TClonesArray*>(fAOD->GetCaloClusters());
611 fAODCells = fAOD->GetEMCALCells();
613 printf("AOD cluster mult= %d\n",fAODClusters->GetEntriesFast());
617 fMCEvent = MCEvent();
620 std::cout<<"MCevent exists\n";
621 fStack = (AliStack*)fMCEvent->Stack();
625 std::cout<<"ERROR: NO MC EVENT!!!!!!\n";
630 printf("passed calling of FollowGamma\n");
633 printf("passed calling of FillClusHists\n");
636 printf("passed calling of FillMcHists\n");
640 printf("passed calling of FillQA\n");
642 fESDClusters->Clear();*/
643 fSelPrimTracks->Clear();
646 fClusIdFromTracks = "";
648 PostData(1, fOutputList);
649 PostData(2, fQAList);
652 //________________________________________________________________________
653 void AliAnalysisTaskEMCALIsoPhoton::FillClusHists()
656 printf("Inside FillClusHists()....\n");
657 // Fill cluster histograms.
658 TObjArray *clusters = fESDClusters;
661 clusters = fAODClusters;
663 printf("ESD clusters empty...");
667 printf(" and AOD clusters as well!!!\n");
673 const Int_t nclus = clusters->GetEntries();
677 printf("Inside FillClusHists and there are %d clusters\n",nclus);
681 for(Int_t ic=0;ic<nclus;ic++){
683 AliVCluster *c = static_cast<AliVCluster*>(clusters->At(ic));
690 if(fCpvFromTrack && fClusIdFromTracks.Contains(Form("%d",ic)))
695 Double_t Emax = GetMaxCellEnergy( c, id);
697 printf("cluster max cell E=%1.1f",Emax);
698 Float_t clsPos[3] = {0,0,0};
699 c->GetPosition(clsPos);
700 TVector3 clsVec(clsPos);
701 Double_t Et = c->E()*TMath::Sin(clsVec.Theta());
703 printf("\tcluster eta=%1.1f,phi=%1.1f,E=%1.1f\n",clsVec.Eta(),clsVec.Phi(),c->E());
706 Float_t ceiso, cephiband, cecore;
707 Float_t triso, trphiband, trcore;
708 Float_t alliso, allphiband;//, allcore;
709 Float_t phibandArea = (1.4 - 2*fIsoConeR)*2*fIsoConeR;
710 Float_t netConeArea = TMath::Pi()*(fIsoConeR*fIsoConeR - 0.04*0.04);
711 GetCeIso(clsVec, id, ceiso, cephiband, cecore);
712 GetTrIso(clsVec, triso, trphiband, trcore);
713 Double_t dr = TMath::Sqrt(c->GetTrackDx()*c->GetTrackDx() + c->GetTrackDz()*c->GetTrackDz());
714 if(Et>10 && Et<15 && dr>0.025){
715 fHigherPtConeM02->Fill(fHigherPtCone,c->GetM02());
717 printf("\t\tHigher track pt inside the cone: %1.1f GeV/c; M02=%1.2f\n",fHigherPtCone,c->GetM02());
719 alliso = ceiso + triso;
720 allphiband = cephiband + trphiband;
721 //allcore = cecore + trcore;
722 Float_t ceisoue = cephiband/phibandArea*netConeArea;
723 Float_t trisoue = trphiband/phibandArea*netConeArea;
724 Float_t allisoue = allphiband/phibandArea*netConeArea;
725 Float_t mcptsum = GetMcPtSumInCone(clsVec.Eta(), clsVec.Phi(),fIsoConeR);
727 printf("\t alliso=%1.1f, Et=%1.1f=-=-=-=-=\n",alliso,Et);
728 if(c->GetM02()>0.5 && c->GetM02()<2.0){
729 fMcPtInConeBG->Fill(alliso-allisoue, mcptsum);
730 fMcPtInConeBGnoUE->Fill(alliso, mcptsum);
731 fMcPtInConeTrBGnoUE->Fill(triso, mcptsum);
733 if(c->GetM02()>0.1 && c->GetM02()<0.3 && dr>0.03){
734 fMcPtInConeSBG->Fill(alliso-allisoue, mcptsum);
735 fMcPtInConeSBGnoUE->Fill(alliso, mcptsum);
736 fMcPtInConeTrSBGnoUE->Fill(triso, mcptsum);
737 if(fMcIdFamily.Contains((Form("%d",c->GetLabel())))){
738 fAllIsoEtMcGamma->Fill(Et, alliso-cecore-allisoue);
739 fAllIsoNoUeEtMcGamma->Fill(Et, alliso-cecore);
742 Bool_t isCPV = kFALSE;
743 if(TMath::Abs(c->GetTrackDx())>0.03 || TMath::Abs(c->GetTrackDz())>0.02)
745 if(c->GetM02()>0.1 && c->GetM02()<0.3 && isCPV)
746 fClusEtCPVSBGISO->Fill(Et,alliso - trcore);
747 if(c->GetM02()>0.5 && c->GetM02()<2.0 && isCPV)
748 fClusEtCPVBGISO->Fill(Et,alliso - trcore);
749 const Int_t ndims = fNDimensions;
750 Double_t outputValues[ndims];
752 ptmc = GetClusSource(c);
755 outputValues[0] = Et;
756 outputValues[1] = c->GetM02();
757 outputValues[2] = ceiso/*cecore*/-ceisoue;
758 outputValues[3] = triso-trisoue;
759 outputValues[4] = alliso/*cecore*/-allisoue - trcore;
760 outputValues[5] = ceiso;
761 outputValues[6] = alliso - trcore;
763 printf("track-cluster dphi=%1.3f, deta=%1.3f\n",c->GetTrackDx(),c->GetTrackDz());
764 if(TMath::Abs(c->GetTrackDx())<0.1)
765 outputValues[7] = c->GetTrackDx();
767 outputValues[7] = 0.099*c->GetTrackDx()/TMath::Abs(c->GetTrackDx());
768 if(TMath::Abs(c->GetTrackDz())<0.05)
769 outputValues[8] = c->GetTrackDz();
771 outputValues[8] = 0.049*c->GetTrackDz()/TMath::Abs(c->GetTrackDz());
772 outputValues[9] = clsVec.Eta();
773 outputValues[10] = clsVec.Phi();
775 outputValues[11] = fESDCells->GetCellTime(id);
777 outputValues[11] = fAODCells->GetCellTime(id);
778 outputValues[12] = fTrackMult;
779 outputValues[13] = ptmc;
780 fHnOutput->Fill(outputValues);
784 fNClusHighClusE->Fill(maxE,nclus);
786 fNClusEt10->Fill(nclus10);
787 fNClusPerPho->Fill(fDirPhoPt,fNClusForDirPho);
790 //________________________________________________________________________
791 void AliAnalysisTaskEMCALIsoPhoton::GetCeIso(TVector3 vec, Int_t maxid, Float_t &iso, Float_t &phiband, Float_t &core)
793 // Get cell isolation.
794 AliVCaloCells *cells = fESDCells;
798 printf("ESD cells empty...");
802 printf(" and AOD cells are empty as well!!!\n");
806 TObjArray *clusters = fESDClusters;
808 clusters = fAODClusters;
813 const Int_t nclus = clusters->GetEntries();
814 //const Int_t ncells = cells->GetNumberOfCells();
818 Float_t etacl = vec.Eta();
819 Float_t phicl = vec.Phi();
820 Float_t maxtcl = cells->GetCellTime(maxid);
822 phicl+=TMath::TwoPi();
824 Float_t eta=-1, phi=-1;
825 for(int icell=0;icell<ncells;icell++){
826 absid = TMath::Abs(cells->GetCellNumber(icell));
827 Float_t celltime = cells->GetCellTime(absid);
828 //if(TMath::Abs(celltime)>2e-8 && (!fIsMc))
829 if(TMath::Abs(celltime-maxtcl)>2e-8 )
833 fGeom->EtaPhiFromIndex(absid,eta,phi);
834 Float_t dphi = TMath::Abs(phi-phicl);
835 Float_t deta = TMath::Abs(eta-etacl);
836 Float_t R = TMath::Sqrt(deta*deta + dphi*dphi);*/
837 for(int ic=0;ic<nclus;ic++){
838 AliVCluster *c = static_cast<AliVCluster*>(clusters->At(ic));
843 if(c->E()<fMinIsoClusE)
846 GetMaxCellEnergy( c, id);
847 Double_t maxct = cells->GetCellTime(id);
848 if(TMath::Abs(maxct)>fClusTDiff/*2.5e-9*/ && (!fIsMc))
850 Float_t clsPos[3] = {0,0,0};
851 c->GetPosition(clsPos);
853 Double_t Et = c->E()*TMath::Sin(cv.Theta());
854 Float_t dphi = TMath::Abs(cv.Phi()-phicl);
855 Float_t deta = TMath::Abs(cv.Eta()-etacl);
856 Float_t R = TMath::Sqrt(deta*deta + dphi*dphi);
861 Double_t matchedpt = GetTrackMatchedPt(c->GetTrackMatchedIndex());
862 if(matchedpt>0 && fRemMatchClus)
864 Double_t nEt = TMath::Max(Et-matchedpt, 0.0);
866 printf("nEt=%1.1f\n",nEt);
884 //________________________________________________________________________
885 void AliAnalysisTaskEMCALIsoPhoton::GetTrIso(TVector3 vec, Float_t &iso, Float_t &phiband, Float_t &core)
887 // Get track isolation.
892 const Int_t ntracks = fSelPrimTracks->GetEntries();
896 Double_t etacl = vec.Eta();
897 Double_t phicl = vec.Phi();
899 phicl+=TMath::TwoPi();
900 for(int itrack=0;itrack<ntracks;itrack++){
901 AliVTrack *track = static_cast<AliVTrack*> (fSelPrimTracks->At(itrack));
904 Double_t dphi = TMath::Abs(track->Phi()-phicl);
905 Double_t deta = TMath::Abs(track->Eta()-etacl);
906 Double_t R = TMath::Sqrt(deta*deta + dphi*dphi);
907 Double_t pt = track->Pt();
911 totiso += track->Pt();
912 if(R<0.04 && this->fTrCoreRem)
920 totband += track->Pt();
928 //________________________________________________________________________
929 Double_t AliAnalysisTaskEMCALIsoPhoton::GetCrossEnergy(const AliVCluster *cluster, Short_t &idmax)
931 // Calculate the energy of cross cells around the leading cell.
933 AliVCaloCells *cells = 0;
952 Double_t crossEnergy = 0;
954 fGeom->GetCellIndex(idmax,iSupMod,iTower,iIphi,iIeta);
955 fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphis,ietas);
957 Int_t ncells = cluster->GetNCells();
958 for (Int_t i=0; i<ncells; i++) {
959 Int_t cellAbsId = cluster->GetCellAbsId(i);
960 fGeom->GetCellIndex(cellAbsId,iSupMod,iTower,iIphi,iIeta);
961 fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta);
962 Int_t aphidiff = TMath::Abs(iphi-iphis);
965 Int_t aetadiff = TMath::Abs(ieta-ietas);
968 if ( (aphidiff==1 && aetadiff==0) ||
969 (aphidiff==0 && aetadiff==1) ) {
970 crossEnergy += cells->GetCellAmplitude(cellAbsId);
977 //________________________________________________________________________
978 Double_t AliAnalysisTaskEMCALIsoPhoton ::GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const
980 // Get maximum energy of attached cell.
984 AliVCaloCells *cells = 0;
992 Int_t ncells = cluster->GetNCells();
993 for (Int_t i=0; i<ncells; i++) {
994 Double_t e = cells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i)));
997 id = cluster->GetCellAbsId(i);
1003 //________________________________________________________________________
1004 void AliAnalysisTaskEMCALIsoPhoton ::FillMcHists()
1008 Int_t nTracks = fStack->GetNtrack();
1010 printf("Inside FillMcHists and there are %d mcparts\n",nTracks);
1011 for(Int_t iTrack=0;iTrack<nTracks;iTrack++){
1012 TParticle *mcp = static_cast<TParticle*>(fStack->Particle(iTrack));
1015 Int_t pdg = mcp->GetPdgCode();
1018 if(TMath::Abs(mcp->Eta())>0.7 ||mcp->Phi()<1.4 || mcp->Phi()>3.2)
1020 Int_t imom = mcp->GetMother(0);
1021 if(imom<0 || imom>nTracks)
1023 TParticle *mcmom = static_cast<TParticle*>(fStack->Particle(imom));
1026 Int_t pdgMom = mcmom->GetPdgCode();
1027 Double_t mcphi = mcp->Phi();
1028 Double_t mceta = mcp->Eta();
1029 if((imom==6 || imom==7) && pdgMom==22) {
1030 fMCDirPhotonPtEtaPhi->Fill(mcp->Pt(),mcp->Eta(),mcp->Phi());
1031 Float_t ptsum = GetMcPtSumInCone(mcp->Eta(), mcp->Phi(), fIsoConeR);
1032 fMcPtInConeMcPhoPt->Fill(mcp->Pt(),ptsum);
1034 fMCIsoDirPhotonPtEtaPhi->Fill(mcp->Pt(),mcp->Eta(),mcp->Phi());
1035 if(mcphi<(3.14-fIsoConeR) && mcphi>(1.4+fIsoConeR) && TMath::Abs(mceta)<(0.7-fIsoConeR))
1036 fMCDirPhotonPtEtIso->Fill(mcp->Pt(),ptsum);
1037 if(fNClusForDirPho==0)
1038 fMCDirPhotonPtEtaPhiNoClus->Fill(mcp->Pt(),mcp->Eta(),mcp->Phi());
1040 printf("Found \"photonic\" parton at position %d, with pt=%1.1f, eta=%1.1f and phi=%1.1f, and status=%d,\n",imom,mcmom->Pt(), mcmom->Eta(), mcmom->Phi(), mcmom->GetStatusCode());
1041 printf("with a final photon at position %d, with pt=%1.1f, eta=%1.1f and phi=%1.1f, and status=%d\n",iTrack,mcp->Pt(), mcp->Eta(), mcp->Phi(),mcp->GetStatusCode());
1045 if(TMath::Abs(pdgMom)>100 && TMath::Abs(pdgMom)<1000)
1046 fDecayPhotonPtMC->Fill(mcp->Pt());
1050 //________________________________________________________________________
1051 Float_t AliAnalysisTaskEMCALIsoPhoton::GetClusSource(const AliVCluster *c)
1057 Int_t nmcp = fStack->GetNtrack();
1058 Int_t clabel = c->GetLabel();
1059 if(fDebug && fMcIdFamily.Contains(Form("%d",clabel)))
1060 printf("\n\t ==== Label %d is a descendent of the prompt photon ====\n\n",clabel);
1061 if(!fMcIdFamily.Contains(Form("%d",clabel)))
1064 TString partonposstr = (TSubString)fMcIdFamily.operator()(0,1);
1065 Int_t partonpos = partonposstr.Atoi();
1067 printf("\t^^^^ parton position = %d ^^^^\n",partonpos);
1068 if(clabel<0 || clabel>nmcp)
1070 Float_t clsPos[3] = {0,0,0};
1071 c->GetPosition(clsPos);
1072 TVector3 clsVec(clsPos);
1073 Double_t Et = c->E()*TMath::Sin(clsVec.Theta());
1074 TParticle *mcp = static_cast<TParticle*>(fStack->Particle(partonpos));
1078 printf("\tclus mc truth eta=%1.1f,phi=%1.1f,E=%1.1f, pdgcode=%d, stackpos=%d\n",mcp->Eta(),mcp->Phi(),mcp->Energy(),mcp->GetPdgCode(),clabel);
1080 Int_t lab1 = mcp->GetFirstDaughter();
1081 if(lab1<0 || lab1>nmcp)
1083 TParticle *mcd = static_cast<TParticle*>(fStack->Particle(lab1));
1087 printf("\t\tmom mc truth eta=%1.1f,phi=%1.1f,E=%1.1f, pdgcode=%d, stackpos=%d\n",mcd->Eta(),mcd->Phi(),mcd->Energy(),mcd->GetPdgCode(),lab1);
1088 if(mcd->GetPdgCode()==22){
1089 fClusEtMcPt->Fill(mcd->Pt(), Et);
1090 fClusMcDetaDphi->Fill(clsVec.Eta() - mcd->Eta(), clsVec.Phi() - mcd->Phi());
1093 printf("Warning: daughter of photon parton is not a photon\n");
1098 //________________________________________________________________________
1099 void AliAnalysisTaskEMCALIsoPhoton::FollowGamma()
1104 TParticle *mcp = static_cast<TParticle*>(fStack->Particle(selfid));
1107 if(mcp->GetPdgCode()!=22){
1108 mcp = static_cast<TParticle*>(fStack->Particle(++selfid));
1112 Int_t daug0f = mcp->GetFirstDaughter();
1113 Int_t daug0l = mcp->GetLastDaughter();
1114 Int_t nd0 = daug0l - daug0f;
1116 printf("\n\tGenerated gamma (%d) eta=%1.1f,phi=%1.1f,E=%1.1f, pdgcode=%d, n-daug=%d\n",selfid,mcp->Eta(),mcp->Phi(),mcp->Energy(),mcp->GetPdgCode(),nd0+1);
1117 fMcIdFamily = Form("%d,",selfid);
1118 GetDaughtersInfo(daug0f,daug0l, selfid,"");
1120 printf("\t---- end of the prompt gamma's family tree ----\n\n");
1121 printf("Family id string = %s,\n\n",fMcIdFamily.Data());
1123 TParticle *md = static_cast<TParticle*>(fStack->Particle(daug0f));
1126 fDirPhoPt = md->Pt();
1128 //________________________________________________________________________
1129 void AliAnalysisTaskEMCALIsoPhoton::GetDaughtersInfo(int firstd, int lastd, int selfid, const char *inputind)
1131 int nmcp = fStack->GetNtrack();
1132 if(firstd<0 || firstd>nmcp)
1134 if(lastd<0 || lastd>nmcp)
1137 printf("WARNING: First daughter > last (%d,%d)\n",firstd,lastd);
1140 TString indenter = Form("\t%s",inputind);
1141 TParticle *dp = 0x0;
1143 printf("\t%s--- Daughters of particle %d ---\n", indenter.Data(), selfid);
1144 for(int id=firstd; id<lastd+1; id++){
1145 dp = static_cast<TParticle*>(fStack->Particle(id));
1148 Int_t dfd = dp->GetFirstDaughter();
1149 Int_t dld = dp->GetLastDaughter();
1150 Int_t dnd = dld - dfd + 1;
1151 Float_t vr = TMath::Sqrt(dp->Vx()*dp->Vx()+dp->Vy()*dp->Vy());
1153 printf("\t%sParticle daughter(%d) eta=%1.1f,phi=%1.1f,E=%1.1f, vR=%1.1f, pdgcode=%d, n-daug=%d(%d,%d)\n", indenter.Data(),id, dp->Eta(), dp->Phi(), dp->Energy(), vr, dp->GetPdgCode(), dnd, dfd, dld);
1154 fMcIdFamily += Form("%d,",id);
1155 GetDaughtersInfo(dfd,dld,id,indenter.Data());
1159 //________________________________________________________________________
1160 Float_t AliAnalysisTaskEMCALIsoPhoton::GetMcPtSumInCone(Float_t etaclus, Float_t phiclus, Float_t R)
1165 printf("Inside GetMcPtSumInCone!!\n");
1166 Int_t nTracks = fStack->GetNtrack();
1168 TString addpartlabels = "";
1169 for(Int_t iTrack=9;iTrack<nTracks;iTrack++){
1170 TParticle *mcp = static_cast<TParticle*>(fStack->Particle(iTrack));
1173 Int_t status = mcp->GetStatusCode();
1176 Float_t mcvr = TMath::Sqrt(mcp->Vx()*mcp->Vx()+ mcp->Vy()* mcp->Vy() + mcp->Vz()*mcp->Vz());
1181 printf(" >>>> mcp Rho, Vx, Vy, Vz = %1.1f,%1.1f,%1.1f,%1.1f.......\n",mcp->Rho(),mcp->Vx(), mcp->Vy(),mcp->Vz());
1183 Float_t dphi = mcp->Phi() - phiclus;
1184 Float_t deta = mcp->Eta() - etaclus;
1185 if(fDebug && TMath::Abs(dphi)<0.01)
1186 printf(" >>>> mcphi = %1.1f, mceta = %1.1f\n>>>> dphi = %1.1f, deta = %1.1f\n", mcp->Phi(), mcp->Eta(),dphi,deta);
1188 if(deta>R || dphi>R)
1190 Float_t dR = TMath::Sqrt(dphi*dphi + deta*deta);
1193 addpartlabels += Form("%d,",iTrack);
1200 //________________________________________________________________________
1201 void AliAnalysisTaskEMCALIsoPhoton::FillQA()
1204 TObjArray *clusters = fESDClusters;
1205 //"none", "exotic", "exo+cpv1", "exo+cpv1+time", "exo+cpv1+time+m02"),
1207 clusters = fAODClusters;
1209 printf("ESD clusters empty...");
1213 printf(" and AOD clusters as well!!!\n");
1218 const int ntracks = fSelPrimTracks->GetEntriesFast();
1219 const int ncells = fNCells50;//fESDCells->GetNumberOfCells();
1220 const Int_t nclus = clusters->GetEntries();
1221 fNTracks->Fill(ntracks);
1222 fEmcNCells->Fill(ncells);
1223 fEmcNClus->Fill(nclus);
1224 if(fMaxEClus>fECut){
1225 fNTracksECut->Fill(ntracks);
1226 fEmcNCellsCut->Fill(ncells);
1227 fEmcNClusCut->Fill(nclus);
1229 for(int it=0;it<ntracks;it++){
1230 AliVTrack *t = (AliVTrack*)fSelPrimTracks->At(it);
1233 fTrackPtPhi->Fill(t->Pt(),t->Phi());
1234 fTrackPtEta->Fill(t->Pt(),t->Eta());
1235 if(fMaxEClus>fECut){
1236 fTrackPtPhiCut->Fill(t->Pt(), t->Phi());
1237 fTrackPtEtaCut->Fill(t->Pt(), t->Eta());
1240 for(int ic=0;ic<nclus;ic++){
1241 AliVCluster *c = dynamic_cast<AliVCluster*>(clusters->At(ic));
1242 //AliESDCaloCluster *c = (AliESDCaloCluster*)clusters->At(ic);
1247 Float_t clsPos[3] = {0,0,0};
1248 c->GetPosition(clsPos);
1249 TVector3 clsVec(clsPos);
1250 Double_t cphi = clsVec.Phi();
1251 Double_t ceta = clsVec.Eta();
1253 GetMaxCellEnergy( c, id);
1254 fEmcClusEClusCuts->Fill(c->E(),0);
1255 fEmcClusEPhi->Fill(c->E(), cphi);
1256 fEmcClusEEta->Fill(c->E(), ceta);
1257 if(fMaxEClus>fECut){
1258 fEmcClusEPhiCut->Fill(c->E(), cphi);
1259 fEmcClusEEtaCut->Fill(c->E(), ceta);
1263 maxt = fESDCells->GetCellTime(id);
1265 maxt = fAODCells->GetCellTime(id);
1268 fEmcClusNotExo->Fill(c->E());
1269 fEmcClusEClusCuts->Fill(c->E(),1);
1270 if(fClusIdFromTracks.Contains(Form("%d",ic)))
1271 fEmcClusETM2->Fill(c->E());
1272 if(TMath::Abs(c->GetTrackDx())<0.03 && TMath::Abs(c->GetTrackDz())<0.02){
1273 fEmcClusETM1->Fill(c->E());
1276 fEmcClusEClusCuts->Fill(c->E(),2);
1277 if(TMath::Abs(maxt)>30e-9)
1279 fEmcClusEClusCuts->Fill(c->E(),3);
1281 fEmcClusEClusCuts->Fill(c->E(),4);
1284 //________________________________________________________________________
1285 Double_t AliAnalysisTaskEMCALIsoPhoton::GetTrackMatchedPt(Int_t matchIndex)
1290 if(matchIndex<0 || matchIndex>fTracks->GetEntries()){
1292 printf("track-matched index out of track array range!!!\n");
1295 AliVTrack* track = static_cast<AliVTrack*>(fTracks->At(matchIndex));
1298 printf("track-matched pointer does not exist!!!\n");
1304 if(!fPrTrCuts->IsSelected(track))
1310 //________________________________________________________________________
1311 void AliAnalysisTaskEMCALIsoPhoton::LoopOnCells()
1313 AliVCaloCells *cells = 0;
1320 Double_t maxphi = -10;
1321 Int_t ncells = cells->GetNumberOfCells();
1323 for (Int_t i=0; i<ncells; i++) {
1324 Short_t absid = TMath::Abs(cells->GetCellNumber(i));
1325 Double_t e = cells->GetCellAmplitude(absid);
1330 fGeom->EtaPhiFromIndex(absid,eta,phi);
1336 fMaxCellEPhi->Fill(maxe,maxphi);
1339 //________________________________________________________________________
1340 bool AliAnalysisTaskEMCALIsoPhoton::IsExotic(AliVCluster *c)
1344 Double_t Emax = GetMaxCellEnergy( c, id);
1345 Double_t Ecross = GetCrossEnergy( c, id);
1346 if((1-Ecross/Emax)>fExoticCut)
1350 //________________________________________________________________________
1351 void AliAnalysisTaskEMCALIsoPhoton::Terminate(Option_t *)
1353 // Called once at the end of the query.