13 #include "AliAnalysisTask.h"
14 #include "AliAnalysisManager.h"
16 #include "AliESDEvent.h"
17 #include "AliESDHeader.h"
18 #include "AliESDUtils.h"
19 #include "AliESDInputHandler.h"
20 #include "AliCentrality.h"
21 #include "AliESDpid.h"
22 #include "AliKFParticle.h"
24 #include "AliMCEventHandler.h"
25 #include "AliMCEvent.h"
27 #include "TParticle.h"
30 #include "AliESDtrackCuts.h"
32 #include "AliV0vertexer.h"
33 #include "AliESDCaloCluster.h"
34 #include "AliESDCaloCells.h"
35 #include "AliEMCALGeometry.h"
36 #include "AliEMCALRecoUtils.h"
37 #include "AliVCluster.h"
38 #include "AliAnalysisTaskEMCALClusterizeFast.h"
39 #include "TLorentzVector.h"
42 #include "AliAnalysisTaskEMCALPhoton.h"
46 ClassImp(AliAnalysisTaskEMCALPhoton)
48 //________________________________________________________________________
49 AliAnalysisTaskEMCALPhoton::AliAnalysisTaskEMCALPhoton(const char *name)
50 : AliAnalysisTaskSE(name),
68 fGeoName("EMCAL_COMPLETEV1"),
75 fCaloClustersName("EmcalClusterv2"),
86 fNV0sBefAndAftRerun(0),
96 // Define input and output slots here
97 // Input slot #0 works with a TChain
98 DefineInput(0, TChain::Class());
99 // Output slot #0 id reserved by the base class for AOD
100 // Output slot #1 writes into a TH1 container
101 DefineOutput(1, TList::Class());
103 //________________________________________________________________________
104 void AliAnalysisTaskEMCALPhoton::UserCreateOutputObjects()
109 fSelTracks = new TObjArray();
111 fSelPrimTracks = new TObjArray();
113 if (TClass::GetClass("AliPhotonHeaderObj"))
114 TClass::GetClass("AliPhotonHeaderObj")->IgnoreTObjectStreamer();
115 fHeader = new AliPhotonHeaderObj;
117 if (TClass::GetClass("AliPhotonConvObj"))
118 TClass::GetClass("AliPhotonConvObj")->IgnoreTObjectStreamer();
119 fPhotConvArray = new TClonesArray("AliPhotonConvObj");
121 if (TClass::GetClass("AliPhotonClusterObj"))
122 TClass::GetClass("AliPhotonClusterObj")->IgnoreTObjectStreamer();
123 fMyClusts = new TClonesArray("AliPhotonClusterObj");
125 if (TClass::GetClass("AliPhotonCellObj"))
126 TClass::GetClass("AliPhotonCellObj")->IgnoreTObjectStreamer();
127 fMyCells = new TClonesArray("AliPhotonCellObj");
129 if (TClass::GetClass("AliPhotonTrackObj"))
130 TClass::GetClass("AliPhotonTrackObj")->IgnoreTObjectStreamer();
131 fMyTracks = new TClonesArray("AliPhotonTrackObj");
133 if (fClusterizer || fIsTrain){
135 fCaloClustersName = fClusterizer->GetNewClusterArrayName();
137 if(fPeriod.Contains("10h") || fPeriod.Contains("11h"))
138 fCaloClustersName = "EmcalClustersv1";
140 fCaloClustersName = "EmcalClustersv2";
142 if (TClass::GetClass("AliPhotonClusterObj"))
143 TClass::GetClass("AliPhotonClusterObj")->IgnoreTObjectStreamer();
144 fMyAltClusts = new TClonesArray("AliPhotonClusterObj");
146 cout<<fCaloClustersName<<endl;
148 if (TClass::GetClass("AliPhotonMcPartObj"))
149 TClass::GetClass("AliPhotonMcPartObj")->IgnoreTObjectStreamer();
150 fMyMcParts = new TClonesArray("AliPhotonMcPartObj");
153 fCaloClusters = new TRefArray();
155 fOutputList = new TList();
156 fOutputList->SetOwner();// Container cleans up all histos (avoids leaks in merging)
159 TFile *f = OpenFile(1);
160 TDirectory::TContext context(f);
162 f->SetCompressionLevel(2);
163 fTree = new TTree("photon_ana_out", "StandaloneTree");
164 fTree->SetDirectory(f);
166 fTree->SetAutoFlush(-2*1024*1024);
167 fTree->SetAutoSave(0);
169 fTree->SetAutoFlush(-32*1024*1024);
170 fTree->SetAutoSave(0);
173 fTree->Branch("header", &fHeader, 16*1024, 99);
174 fTree->Branch("conversions", &fPhotConvArray, 8*16*1024, 99);
175 fTree->Branch("clusters", &fMyClusts, 8*16*1024, 99);
176 if(fClusterizer || fIsTrain)
177 fTree->Branch(fCaloClustersName, &fMyAltClusts, 8*16*1024, 99);
178 fTree->Branch("cells", &fMyCells, 8*16*1024, 99);
179 fTree->Branch("HighPtTracks", &fMyTracks, 8*16*1024, 99);
181 fTree->Branch("mcparts", &fMyMcParts, 8*16*1024, 99);
184 if(fIsGrid)fOutputList->Add(fTree);
185 fGeom = AliEMCALGeometry::GetInstance(fGeoName);
188 fNV0sBefAndAftRerun = new TH2F("hNV0sBefAndAftRerun","check if the number of v0s change with rerun;old v0 n;new v0 n",50,0.5,50.5,50,0.5,50.5);
189 fOutputList->Add(fNV0sBefAndAftRerun);
191 fConversionVtxXY = new TH2F("hConversionVtxXY","x and y of conversion vertex candidates;x;y",1000,-100,100,1000,-100,100);
192 fOutputList->Add(fConversionVtxXY);
194 fInvMassV0 = new TH1F("hInvMassV0","v0->GetEffMass();v0->GetEffMass();dN/dM",400,0,4);
195 fOutputList->Add(fInvMassV0);
197 fInvMassV0KF = new TH1F("hInvMassV0KF","Inv. mass calculated from AliKFParticle made of V0 tracks;mass_{TrTr};dN/dM",400,0,4);
198 fOutputList->Add(fInvMassV0KF);
200 fInvMassV0SS = new TH1F("hInvMassV0SS","Inv. mass (same sign) calculated from AliKFParticle made of V0 tracks;mass_{TrTr};dN/dM",400,0,4);
201 fOutputList->Add(fInvMassV0SS);
203 fDedxPAll = new TH2F("hDedxPAll","dE/dx vs p (all selected tracks);p (GeV/c);dE/dx (a.u.)",400,0,40, 150,0,150);
204 fOutputList->Add(fDedxPAll);
207 PostData(1, fOutputList);
210 //________________________________________________________________________
211 void AliAnalysisTaskEMCALPhoton::UserExec(Option_t *)
213 //event trigger selection
214 Bool_t isSelected = 0;
215 if(fPeriod.Contains("11")){
216 if(fPeriod.Contains("11a"))
217 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC1);
218 if(fPeriod.Contains("11c") ||fPeriod.Contains("11d") )
219 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC7);
220 if(fPeriod.Contains("11h") )
221 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMCEGA);
229 // Called for each event
232 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
234 printf("ERROR: fESD not available, returning...\n");
240 AliESDVertex *pv = (AliESDVertex*)fESD->GetPrimaryVertex();
243 if(TMath::Abs(pv->GetZ())>15)
245 //fCaloClustersNew = dynamic_cast<TClonesArray*>(fESD->FindListObject(fCaloClustersName));
248 // Track loop to fill a pT spectrum
249 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
250 AliESDtrack* track = fESD->GetTrack(iTracks);
255 if (fTrCuts && fTrCuts->IsSelected(track)){
256 fSelTracks->Add(track);
257 fDedxPAll->Fill(track->P(), track->GetTPCsignal());
259 if (fPrTrCuts && fPrTrCuts->IsSelected(track))
260 fSelPrimTracks->Add(track);
265 fHeader->fTrClassMask = fESD->GetHeader()->GetTriggerMask();
266 fHeader->fTrCluster = fESD->GetHeader()->GetTriggerCluster();
267 AliCentrality *cent = InputEvent()->GetCentrality();
268 fHeader->fV0Cent = cent->GetCentralityPercentileUnchecked("V0M");
269 fHeader->fCl1Cent = cent->GetCentralityPercentileUnchecked("CL1");
270 fHeader->fTrCent = cent->GetCentralityPercentileUnchecked("TRK");
272 for(Int_t mod=0; mod < (fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
273 if(fGeoName=="EMCAL_FIRSTYEARV1" && mod>3)
275 fGeom->SetMisalMatrix(fESD->GetEMCALMatrix(mod), mod);
278 fESD->GetEMCALClusters(fCaloClusters);
279 fHeader->fNClus = fCaloClusters->GetEntries();
280 fEMCalCells = fESD->GetEMCALCells();
281 fHeader->fNCells = fEMCalCells->GetNumberOfCells();
282 fMCEvent = MCEvent();
284 fStack = (AliStack*)fMCEvent->Stack();
288 // cout<<"****calling FillMyCells()...\n";
290 // cout<<"****calling FillMyClus...\n";
294 // cout<<"****calling FillHighPt...\n";
301 fSelPrimTracks->Clear();
302 fPhotConvArray->Clear();
305 fMyAltClusts->Clear();
310 fCaloClusters->Clear();
312 fCaloClustersNew->Clear();
313 PostData(1, fOutputList);
316 //________________________________________________________________________
317 void AliAnalysisTaskEMCALPhoton::FindConversions()
322 Int_t nV0Orig = fESD->GetNumberOfV0s();
323 Int_t ntracks = fESD->GetNumberOfTracks();
325 AliV0vertexer lV0vtxer;
326 lV0vtxer.Tracks2V0vertices(fESD);
327 Int_t nV0s = fESD->GetNumberOfV0s();
328 fNV0sBefAndAftRerun->Fill(nV0Orig, nV0s);
329 for(Int_t iv0=0; iv0<nV0s; iv0++){
330 AliESDv0 * v0 = fESD->GetV0(iv0);
334 fInvMassV0->Fill(v0->GetEffMass());
335 v0->GetXYZ(vpos[0], vpos[1], vpos[2]);
336 Int_t ipos = v0->GetPindex();
337 Int_t ineg = v0->GetNindex();
338 if(ipos<0 || ipos> ntracks)
340 if(ineg<0 || ineg> ntracks)
342 AliESDtrack *pos = static_cast<AliESDtrack*>(fESD->GetTrack(ipos));
343 AliESDtrack *neg = static_cast<AliESDtrack*>(fESD->GetTrack(ineg));
346 if (!fTrCuts->IsSelected(pos) || !fTrCuts->IsSelected(neg))
348 /*if(pos->GetTPCsignal()<65 || neg->GetTPCsignal()<65)
350 const AliExternalTrackParam * paramPos = v0->GetParamP() ;
351 const AliExternalTrackParam * paramNeg = v0->GetParamN() ;
352 if(!paramPos || !paramNeg)
354 if(pos->GetSign() <0){//change tracks
356 neg=fESD->GetTrack(v0->GetPindex()) ;
358 paramNeg=v0->GetParamP() ;
360 AliKFParticle negKF(*paramNeg,11);
361 AliKFParticle posKF(*paramPos,-11);
362 AliKFParticle photKF(negKF,posKF) ;
365 if( neg->GetKinkIndex(0) > 0 || pos->GetKinkIndex(0) > 0)
369 if(pos->GetSign() == neg->GetSign()){
370 fInvMassV0SS->Fill(photKF.GetMass());
373 fInvMassV0KF->Fill(photKF.GetMass());
374 TLorentzVector photLV(photKF.GetPx(), photKF.GetPy(),photKF.GetPz(), photKF.GetE());
375 if(photLV.M()>0.05 || photLV.M()<0)
377 fConversionVtxXY->Fill(vpos[0], vpos[1]);//negKF.GetX(), negKF.GetY());
378 Double_t convPhi = TMath::ATan2(photLV.Py(),photLV.Px());
380 convPhi+=TMath::TwoPi();
381 TVector3 vecpos(vpos);
386 v0Phi+=TMath::TwoPi();
387 AliPhotonConvObj *myconv = static_cast<AliPhotonConvObj*>(fPhotConvArray->New(iconv++));
388 myconv->fPt = photLV.Pt();
389 myconv->fEta = photLV.Eta();
390 myconv->fPhi = convPhi;
391 myconv->fVR = vecpos.Perp();
393 myconv->fVEta = vecpos.Eta();
394 myconv->fVPhi = v0Phi;
395 myconv->fMass = photLV.M();
396 myconv->fMcLabel = -3; //WARNING: include the correct labeling
398 myconv->fNegPt = negKF.GetPt();
399 myconv->fNegEta = negKF.GetEta();
400 Double_t trackPhi = negKF.GetPhi();
402 trackPhi+=TMath::TwoPi();
403 myconv->fNegPhi = trackPhi;
404 myconv->fNegDedx = neg->GetTPCsignal();
405 myconv->fNegMcLabel = neg->GetLabel();
407 myconv->fPosPt = posKF.GetPt();
408 myconv->fPosEta = posKF.GetEta();
409 trackPhi = posKF.GetPhi();
411 trackPhi+=TMath::TwoPi();
412 myconv->fPosPhi = trackPhi;
413 myconv->fPosDedx = pos->GetTPCsignal();
414 myconv->fPosMcLabel = pos->GetLabel();
418 //________________________________________________________________________
419 void AliAnalysisTaskEMCALPhoton::FillMyCells()
423 // cout<<"++++FillMyCells starts!\n";
424 Int_t ncells = fEMCalCells->GetNumberOfCells();
426 for(Int_t icell = 0; icell<ncells; icell++){
427 Int_t absID = TMath::Abs(fEMCalCells->GetCellNumber(icell));
428 AliPhotonCellObj *mycell = static_cast<AliPhotonCellObj*>(fMyCells->New(mcel++));
429 Float_t eta=-1, phi=-1;
431 cout<<"+++fGeom not found! MyCells branch will not be filled for this event!+++\n";
436 if(!fIsMC)fGeom->EtaPhiFromIndex(absID,eta,phi);
437 Float_t theta = 2*TMath::ATan(TMath::Exp(-eta));
438 mycell->fAbsID = absID;
439 mycell->fE = fEMCalCells->GetCellAmplitude(absID);
440 mycell->fEt = fEMCalCells->GetCellAmplitude(absID)*TMath::Sin(theta);
443 mycell->fTime = fEMCalCells->GetCellTime(absID);
445 // cout<<"++++FillMyCells done!\n";
447 //________________________________________________________________________
448 void AliAnalysisTaskEMCALPhoton::FillMyClusters()
452 Int_t nclus = fCaloClusters->GetEntries();
454 for(Int_t ic=0; ic < nclus; ic++){
455 AliESDCaloCluster *clus = static_cast<AliESDCaloCluster*>(fCaloClusters->At(ic));
460 if(clus->E() < fClusThresh)
463 clus->GetPosition(pos);
466 AliPhotonClusterObj *myclus = static_cast<AliPhotonClusterObj*>(fMyClusts->New(mcl++));
467 myclus->fE = clus->E();
468 myclus->fEt = clus->E()*TMath::Sin(cpos.Theta());
469 myclus->fR = cpos.Perp();
470 myclus->fEta = cpos.Eta();
471 myclus->fPhi = cpos.Phi();
473 myclus->fPhi+=TMath::TwoPi();
475 myclus->fN = clus->GetNCells();
477 myclus->fEmax = GetMaxCellEnergy( clus, id);
479 myclus->fTmax = fEMCalCells->GetCellTime(id);
480 myclus->fEcross = GetCrossEnergy( clus, id);
481 myclus->fDisp = clus->GetDispersion();
482 myclus->fM20 = clus->GetM20();
483 myclus->fM02 = clus->GetM02();
484 myclus->fTrDEta = clus->GetTrackDz();
485 myclus->fTrDPhi = clus->GetTrackDx();
486 myclus->fTrIso01 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.1, 0.);
487 myclus->fTrIso02 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.2, 0.);
488 myclus->fTrIso03 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.3, 0.);
489 myclus->fTrIso04 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.4, 0.);
490 myclus->fTrPhiBand01 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.1, 0.);
491 myclus->fTrPhiBand02 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.2, 0.);
492 myclus->fTrPhiBand03 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.3, 0.);
493 myclus->fTrPhiBand04 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.4, 0.);
494 for(Int_t icell=0;icell<myclus->fN;icell++){
495 Int_t absID = clus->GetCellAbsId(icell);
496 cellsAbsID.Append(Form("%d",absID));
497 cellsAbsID.Append(";");
499 myclus->fCellsAbsId = cellsAbsID;
500 myclus->fMcLabel = clus->GetLabel();
501 Int_t matchIndex = clus->GetTrackMatchedIndex();
502 if(matchIndex<0 || matchIndex>fESD->GetNumberOfTracks()){
506 AliESDtrack* track = static_cast<AliESDtrack*>(fESD->GetTrack(matchIndex));
515 if(!fPrTrCuts->IsSelected(track)){
519 myclus->fTrEp = clus->E()/track->P();
523 //________________________________________________________________________
524 void AliAnalysisTaskEMCALPhoton::FillMyAltClusters()
526 if(!fCaloClustersNew)
528 Int_t nclus = fCaloClustersNew->GetEntries();
530 for(Int_t ic=0; ic < nclus; ic++){
531 AliESDCaloCluster *clus = static_cast<AliESDCaloCluster*>(fCaloClustersNew->At(ic));
536 if(clus->E() < fClusThresh)
539 clus->GetPosition(pos);
542 AliPhotonClusterObj *myclus = static_cast<AliPhotonClusterObj*>(fMyAltClusts->New(mcl++));
543 myclus->fE = clus->E();
544 myclus->fEt = clus->E()*TMath::Sin(cpos.Theta());
545 myclus->fR = cpos.Perp();
546 myclus->fEta = cpos.Eta();
547 myclus->fPhi = cpos.Phi();
549 myclus->fPhi+=TMath::TwoPi();
551 myclus->fN = clus->GetNCells();
552 myclus->fDisp = clus->GetDispersion();
553 myclus->fM20 = clus->GetM20();
554 myclus->fM02 = clus->GetM02();
555 myclus->fTrDEta = clus->GetTrackDz();
556 myclus->fTrDPhi = clus->GetTrackDx();
557 myclus->fTrIso01 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.1, 0.);
558 myclus->fTrIso02 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.2, 0.);
559 myclus->fTrIso03 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.3, 0.);
560 myclus->fTrIso04 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.4, 0.);
561 for(Int_t icell=0;icell<myclus->fN;icell++){
562 Int_t absID = clus->GetCellAbsId(icell);
563 cellsAbsID.Append(Form("%d",absID));
564 cellsAbsID.Append(";");
566 myclus->fCellsAbsId = cellsAbsID;
567 myclus->fMcLabel = clus->GetLabel();
568 Int_t matchIndex = clus->GetTrackMatchedIndex();
569 if(matchIndex<0 || matchIndex>fESD->GetNumberOfTracks()){
573 AliESDtrack* track = static_cast<AliESDtrack*>(fESD->GetTrack(matchIndex));
582 if(!fPrTrCuts->IsSelected(track)){
586 myclus->fTrEp = clus->E()/track->P();
590 //________________________________________________________________________
591 void AliAnalysisTaskEMCALPhoton::FillHighPtTracks()
595 Int_t ntracks = fSelPrimTracks->GetEntries();
597 for(Int_t it=0;it<ntracks; it++){
598 AliESDtrack *track = static_cast<AliESDtrack*>(fSelPrimTracks->At(it));
603 AliPhotonTrackObj *mtr = static_cast<AliPhotonTrackObj*>(fMyTracks->New(imtr++));
604 mtr->fPt = track->Pt();
605 mtr->fEta = track->Eta();
606 mtr->fPhi = track->Phi();
607 mtr->fDedx = track->GetTPCsignal();
608 mtr->fMcLabel = track->GetLabel();
611 //________________________________________________________________________
612 void AliAnalysisTaskEMCALPhoton::GetMcParts()
616 // cout<<"++++Get - MC starts!\n";
618 const AliVVertex *evtVtx = fMCEvent->GetPrimaryVertex();
622 Int_t nTracks = fStack->GetNtrack();
623 for (Int_t iTrack = 0; iTrack<nTracks; ++iTrack) {
624 TParticle *mcP = static_cast<TParticle*>(fStack->Particle(iTrack));
628 Double_t dR = TMath::Sqrt((mcP->Vx()-evtVtx->GetX())*(mcP->Vx()-evtVtx->GetX()) +
629 (mcP->Vy()-evtVtx->GetY())*(mcP->Vy()-evtVtx->GetY()) +
630 (mcP->Vz()-evtVtx->GetZ())*(mcP->Vz()-evtVtx->GetZ()));
635 Double_t pt = mcP->Pt() ;
638 Double_t eta = mcP->Eta();
639 if (eta<-0.7||eta>0.7)
641 Double_t phi = mcP->Phi();
642 if (phi<1.0||phi>3.3)
644 // pion or eta meson or direct photon
645 if(mcP->GetPdgCode() == 111) {
646 } else if(mcP->GetPdgCode() == 221) {
647 } else if(mcP->GetPdgCode() == 22 ) {
650 bool checkIfAlreadySaved = false;
651 for(Int_t imy=0;imy<fMyMcParts->GetEntries();imy++){
652 AliPhotonMcPartObj *mymc = static_cast<AliPhotonMcPartObj*>(fMyMcParts->At(imy));
655 if(mymc->fLabel == iTrack)
656 checkIfAlreadySaved = true;
658 if(!checkIfAlreadySaved)
659 FillMcPart(mcP, ipart++, iTrack);
660 for(Int_t id=mcP->GetFirstDaughter(); id <= mcP->GetLastDaughter(); id++){
661 if(id<=mcP->GetMother(0))
663 if(id<0 || id>nTracks)
665 TParticle *mcD = static_cast<TParticle*>(fStack->Particle(id));
668 FillMcPart(mcD, ipart++, id);
671 // cout<<"++++Get - MC done!\n";
674 //________________________________________________________________________
675 void AliAnalysisTaskEMCALPhoton::FillMcPart(TParticle *mcP, Int_t ipart, Int_t itrack)
679 TVector3 vmcv(mcP->Vx(),mcP->Vy(), mcP->Vz());
680 AliPhotonMcPartObj *mcp = static_cast<AliPhotonMcPartObj*>(fMyMcParts->New(ipart));
681 mcp->fLabel = itrack ;
682 mcp->fPdg = mcP->GetPdgCode() ;
683 mcp->fPt = mcP->Pt() ;
684 mcp->fEta = mcP->Eta() ;
685 mcp->fPhi = mcP->Phi() ;
686 mcp->fVR = vmcv.Perp();
688 mcp->fVEta = vmcv.Eta() ;
689 mcp->fVPhi = vmcv.Phi() ;
691 mcp->fMother = mcP->GetMother(0) ;
693 //________________________________________________________________________
694 Double_t AliAnalysisTaskEMCALPhoton::GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius, Double_t pt) const
696 // Compute isolation based on tracks.
698 Double_t trkIsolation = 0;
699 Double_t rad2 = radius*radius;
700 Int_t ntrks = fSelPrimTracks->GetEntries();
701 for(Int_t j = 0; j<ntrks; ++j) {
702 AliVTrack *track = static_cast<AliVTrack*>(fSelPrimTracks->At(j));
708 Float_t eta = track->Eta();
709 Float_t phi = track->Phi();
710 Double_t phidiff = TVector2::Phi_mpi_pi(phi-cPhi);
711 Double_t dist = (eta-cEta)*(eta-cEta)+phidiff*phidiff;
714 trkIsolation += track->Pt();
718 //________________________________________________________________________
719 Double_t AliAnalysisTaskEMCALPhoton::GetPhiBandEt(Double_t eta, Double_t phi, Double_t R, Double_t minpt) const
723 Int_t ntracks = fSelPrimTracks->GetEntries();
724 Double_t loweta = eta - R;
725 Double_t upeta = eta + R;
726 Double_t upphi = phi + R;
727 Double_t lowphi = phi - R;
729 for(Int_t itr=0; itr<ntracks; itr++){
730 AliESDtrack *track = static_cast<AliESDtrack*>(fSelPrimTracks->At(itr));
733 if(track->Pt()<minpt)
735 if((track->Eta() < upeta) && (track->Eta() > loweta))
737 if((track->Phi() > upphi) || (track->Phi() < lowphi))
743 //________________________________________________________________________
744 Double_t AliAnalysisTaskEMCALPhoton::GetCrossEnergy(const AliVCluster *cluster, Short_t &idmax)
746 // Calculate the energy of cross cells around the leading cell.
748 AliVCaloCells *cells = 0;
749 cells = fESD->GetEMCALCells();
766 Double_t crossEnergy = 0;
768 fGeom->GetCellIndex(idmax,iSupMod,iTower,iIphi,iIeta);
769 fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphis,ietas);
771 Int_t ncells = cluster->GetNCells();
772 for (Int_t i=0; i<ncells; i++) {
773 Int_t cellAbsId = cluster->GetCellAbsId(i);
774 fGeom->GetCellIndex(cellAbsId,iSupMod,iTower,iIphi,iIeta);
775 fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta);
776 Int_t aphidiff = TMath::Abs(iphi-iphis);
779 Int_t aetadiff = TMath::Abs(ieta-ietas);
782 if ( (aphidiff==1 && aetadiff==0) ||
783 (aphidiff==0 && aetadiff==1) ) {
784 crossEnergy += cells->GetCellAmplitude(cellAbsId);
793 //________________________________________________________________________
794 Double_t AliAnalysisTaskEMCALPhoton ::GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const
796 // Get maximum energy of attached cell.
800 AliVCaloCells *cells = 0;
801 cells = fESD->GetEMCALCells();
806 Int_t ncells = cluster->GetNCells();
807 for (Int_t i=0; i<ncells; i++) {
808 Double_t e = cells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i)));
811 id = cluster->GetCellAbsId(i);
816 //________________________________________________________________________
817 void AliAnalysisTaskEMCALPhoton::Terminate(Option_t *)
819 // Draw result to the screen
820 // Called once at the end of the query
824 TFile *f = OpenFile(1);
825 TDirectory::TContext context(f);