7 #include "AliAnalysisTask.h"
8 #include "AliAnalysisManager.h"
10 #include "AliESDEvent.h"
11 #include "AliESDHeader.h"
12 #include "AliESDUtils.h"
13 #include "AliESDInputHandler.h"
14 #include "AliCentrality.h"
15 #include "AliESDpid.h"
16 #include "AliKFParticle.h"
18 #include "AliMCEventHandler.h"
19 #include "AliMCEvent.h"
21 #include "TParticle.h"
24 #include "AliESDtrackCuts.h"
26 #include "AliV0vertexer.h"
27 #include "AliESDCaloCluster.h"
28 #include "AliESDCaloCells.h"
29 #include "AliEMCALGeometry.h"
30 #include "AliEMCALRecoUtils.h"
31 #include "AliVCluster.h"
32 #include "AliAnalysisTaskEMCALClusterizeFast.h"
33 #include "TLorentzVector.h"
36 #include "AliAnalysisTaskEMCALPhoton.h"
40 ClassImp(AliAnalysisTaskEMCALPhoton)
42 //________________________________________________________________________
43 AliAnalysisTaskEMCALPhoton::AliAnalysisTaskEMCALPhoton(const char *name)
44 : AliAnalysisTaskSE(name),
62 fGeoName("EMCAL_COMPLETEV1"),
69 fCaloClustersName("EmcalClusterv2"),
80 fNV0sBefAndAftRerun(0),
90 // Define input and output slots here
91 // Input slot #0 works with a TChain
92 DefineInput(0, TChain::Class());
93 // Output slot #0 id reserved by the base class for AOD
94 // Output slot #1 writes into a TH1 container
95 DefineOutput(1, TList::Class());
97 //________________________________________________________________________
98 void AliAnalysisTaskEMCALPhoton::UserCreateOutputObjects()
103 fSelTracks = new TObjArray();
105 fSelPrimTracks = new TObjArray();
107 if (TClass::GetClass("AliPhotonHeaderObj"))
108 TClass::GetClass("AliPhotonHeaderObj")->IgnoreTObjectStreamer();
109 fHeader = new AliPhotonHeaderObj;
111 if (TClass::GetClass("AliPhotonConvObj"))
112 TClass::GetClass("AliPhotonConvObj")->IgnoreTObjectStreamer();
113 fPhotConvArray = new TClonesArray("AliPhotonConvObj");
115 if (TClass::GetClass("AliPhotonClusterObj"))
116 TClass::GetClass("AliPhotonClusterObj")->IgnoreTObjectStreamer();
117 fMyClusts = new TClonesArray("AliPhotonClusterObj");
119 if (TClass::GetClass("AliPhotonCellObj"))
120 TClass::GetClass("AliPhotonCellObj")->IgnoreTObjectStreamer();
121 fMyCells = new TClonesArray("AliPhotonCellObj");
123 if (TClass::GetClass("AliPhotonTrackObj"))
124 TClass::GetClass("AliPhotonTrackObj")->IgnoreTObjectStreamer();
125 fMyTracks = new TClonesArray("AliPhotonTrackObj");
127 if (fClusterizer || fIsTrain){
129 fCaloClustersName = fClusterizer->GetNewClusterArrayName();
131 if(fPeriod.Contains("10h") || fPeriod.Contains("11h"))
132 fCaloClustersName = "EmcalClustersv1";
134 fCaloClustersName = "EmcalClustersv2";
136 if (TClass::GetClass("AliPhotonClusterObj"))
137 TClass::GetClass("AliPhotonClusterObj")->IgnoreTObjectStreamer();
138 fMyAltClusts = new TClonesArray("AliPhotonClusterObj");
140 cout<<fCaloClustersName<<endl;
142 if (TClass::GetClass("AliPhotonMcPartObj"))
143 TClass::GetClass("AliPhotonMcPartObj")->IgnoreTObjectStreamer();
144 fMyMcParts = new TClonesArray("AliPhotonMcPartObj");
147 fCaloClusters = new TRefArray();
149 fOutputList = new TList();
150 fOutputList->SetOwner();// Container cleans up all histos (avoids leaks in merging)
153 TFile *f = OpenFile(1);
154 TDirectory::TContext context(f);
156 f->SetCompressionLevel(2);
157 fTree = new TTree("photon_ana_out", "StandaloneTree");
158 fTree->SetDirectory(f);
160 fTree->SetAutoFlush(-2*1024*1024);
161 fTree->SetAutoSave(0);
163 fTree->SetAutoFlush(-32*1024*1024);
164 fTree->SetAutoSave(0);
167 fTree->Branch("header", &fHeader, 16*1024, 99);
168 fTree->Branch("conversions", &fPhotConvArray, 8*16*1024, 99);
169 fTree->Branch("clusters", &fMyClusts, 8*16*1024, 99);
170 if(fClusterizer || fIsTrain)
171 fTree->Branch(fCaloClustersName, &fMyAltClusts, 8*16*1024, 99);
172 fTree->Branch("cells", &fMyCells, 8*16*1024, 99);
173 fTree->Branch("HighPtTracks", &fMyTracks, 8*16*1024, 99);
175 fTree->Branch("mcparts", &fMyMcParts, 8*16*1024, 99);
178 if(fIsGrid)fOutputList->Add(fTree);
179 fGeom = AliEMCALGeometry::GetInstance(fGeoName);
182 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);
183 fOutputList->Add(fNV0sBefAndAftRerun);
185 fConversionVtxXY = new TH2F("hConversionVtxXY","x and y of conversion vertex candidates;x;y",1000,-100,100,1000,-100,100);
186 fOutputList->Add(fConversionVtxXY);
188 fInvMassV0 = new TH1F("hInvMassV0","v0->GetEffMass();v0->GetEffMass();dN/dM",400,0,4);
189 fOutputList->Add(fInvMassV0);
191 fInvMassV0KF = new TH1F("hInvMassV0KF","Inv. mass calculated from AliKFParticle made of V0 tracks;mass_{TrTr};dN/dM",400,0,4);
192 fOutputList->Add(fInvMassV0KF);
194 fInvMassV0SS = new TH1F("hInvMassV0SS","Inv. mass (same sign) calculated from AliKFParticle made of V0 tracks;mass_{TrTr};dN/dM",400,0,4);
195 fOutputList->Add(fInvMassV0SS);
197 fDedxPAll = new TH2F("hDedxPAll","dE/dx vs p (all selected tracks);p (GeV/c);dE/dx (a.u.)",400,0,40, 150,0,150);
198 fOutputList->Add(fDedxPAll);
201 PostData(1, fOutputList);
204 //________________________________________________________________________
205 void AliAnalysisTaskEMCALPhoton::UserExec(Option_t *)
207 //event trigger selection
208 Bool_t isSelected = 0;
209 if(fPeriod.Contains("11")){
210 if(fPeriod.Contains("11a"))
211 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC1);
212 if(fPeriod.Contains("11c") ||fPeriod.Contains("11d") )
213 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC7);
214 if(fPeriod.Contains("11h") )
215 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMCEGA);
223 // Called for each event
226 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
228 printf("ERROR: fESD not available, returning...\n");
234 AliESDVertex *pv = (AliESDVertex*)fESD->GetPrimaryVertex();
237 if(TMath::Abs(pv->GetZ())>15)
239 //fCaloClustersNew = dynamic_cast<TClonesArray*>(fESD->FindListObject(fCaloClustersName));
242 // Track loop to fill a pT spectrum
243 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
244 AliESDtrack* track = fESD->GetTrack(iTracks);
249 if (fTrCuts && fTrCuts->IsSelected(track)){
250 fSelTracks->Add(track);
251 fDedxPAll->Fill(track->P(), track->GetTPCsignal());
253 if (fPrTrCuts && fPrTrCuts->IsSelected(track))
254 fSelPrimTracks->Add(track);
259 fHeader->fTrClassMask = fESD->GetHeader()->GetTriggerMask();
260 fHeader->fTrCluster = fESD->GetHeader()->GetTriggerCluster();
261 AliCentrality *cent = InputEvent()->GetCentrality();
262 fHeader->fV0Cent = cent->GetCentralityPercentileUnchecked("V0M");
263 fHeader->fCl1Cent = cent->GetCentralityPercentileUnchecked("CL1");
264 fHeader->fTrCent = cent->GetCentralityPercentileUnchecked("TRK");
266 for(Int_t mod=0; mod < (fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
267 if(fGeoName=="EMCAL_FIRSTYEARV1" && mod>3)
269 fGeom->SetMisalMatrix(fESD->GetEMCALMatrix(mod), mod);
272 fESD->GetEMCALClusters(fCaloClusters);
273 fHeader->fNClus = fCaloClusters->GetEntries();
274 fEMCalCells = fESD->GetEMCALCells();
275 fHeader->fNCells = fEMCalCells->GetNumberOfCells();
276 fMCEvent = MCEvent();
278 fStack = (AliStack*)fMCEvent->Stack();
282 // cout<<"****calling FillMyCells()...\n";
284 // cout<<"****calling FillMyClus...\n";
288 // cout<<"****calling FillHighPt...\n";
295 fSelPrimTracks->Clear();
296 fPhotConvArray->Clear();
299 fMyAltClusts->Clear();
304 fCaloClusters->Clear();
306 fCaloClustersNew->Clear();
307 PostData(1, fOutputList);
310 //________________________________________________________________________
311 void AliAnalysisTaskEMCALPhoton::FindConversions()
316 Int_t nV0Orig = fESD->GetNumberOfV0s();
317 Int_t ntracks = fESD->GetNumberOfTracks();
319 AliV0vertexer lV0vtxer;
320 lV0vtxer.Tracks2V0vertices(fESD);
321 Int_t nV0s = fESD->GetNumberOfV0s();
322 fNV0sBefAndAftRerun->Fill(nV0Orig, nV0s);
323 for(Int_t iv0=0; iv0<nV0s; iv0++){
324 AliESDv0 * v0 = fESD->GetV0(iv0);
328 fInvMassV0->Fill(v0->GetEffMass());
329 v0->GetXYZ(vpos[0], vpos[1], vpos[2]);
330 Int_t ipos = v0->GetPindex();
331 Int_t ineg = v0->GetNindex();
332 if(ipos<0 || ipos> ntracks)
334 if(ineg<0 || ineg> ntracks)
336 AliESDtrack *pos = static_cast<AliESDtrack*>(fESD->GetTrack(ipos));
337 AliESDtrack *neg = static_cast<AliESDtrack*>(fESD->GetTrack(ineg));
340 if (!fTrCuts->IsSelected(pos) || !fTrCuts->IsSelected(neg))
342 /*if(pos->GetTPCsignal()<65 || neg->GetTPCsignal()<65)
344 const AliExternalTrackParam * paramPos = v0->GetParamP() ;
345 const AliExternalTrackParam * paramNeg = v0->GetParamN() ;
346 if(!paramPos || !paramNeg)
348 if(pos->GetSign() <0){//change tracks
350 neg=fESD->GetTrack(v0->GetPindex()) ;
352 paramNeg=v0->GetParamP() ;
354 AliKFParticle negKF(*paramNeg,11);
355 AliKFParticle posKF(*paramPos,-11);
356 AliKFParticle photKF(negKF,posKF) ;
359 if( neg->GetKinkIndex(0) > 0 || pos->GetKinkIndex(0) > 0)
363 if(pos->GetSign() == neg->GetSign()){
364 fInvMassV0SS->Fill(photKF.GetMass());
367 fInvMassV0KF->Fill(photKF.GetMass());
368 TLorentzVector photLV(photKF.GetPx(), photKF.GetPy(),photKF.GetPz(), photKF.GetE());
369 if(photLV.M()>0.05 || photLV.M()<0)
371 fConversionVtxXY->Fill(vpos[0], vpos[1]);//negKF.GetX(), negKF.GetY());
372 Double_t convPhi = TMath::ATan2(photLV.Py(),photLV.Px());
374 convPhi+=TMath::TwoPi();
375 TVector3 vecpos(vpos);
380 v0Phi+=TMath::TwoPi();
381 AliPhotonConvObj *myconv = static_cast<AliPhotonConvObj*>(fPhotConvArray->New(iconv++));
382 myconv->fPt = photLV.Pt();
383 myconv->fEta = photLV.Eta();
384 myconv->fPhi = convPhi;
385 myconv->fVR = vecpos.Perp();
387 myconv->fVEta = vecpos.Eta();
388 myconv->fVPhi = v0Phi;
389 myconv->fMass = photLV.M();
390 myconv->fMcLabel = -3; //WARNING: include the correct labeling
392 myconv->fNegPt = negKF.GetPt();
393 myconv->fNegEta = negKF.GetEta();
394 Double_t trackPhi = negKF.GetPhi();
396 trackPhi+=TMath::TwoPi();
397 myconv->fNegPhi = trackPhi;
398 myconv->fNegDedx = neg->GetTPCsignal();
399 myconv->fNegMcLabel = neg->GetLabel();
401 myconv->fPosPt = posKF.GetPt();
402 myconv->fPosEta = posKF.GetEta();
403 trackPhi = posKF.GetPhi();
405 trackPhi+=TMath::TwoPi();
406 myconv->fPosPhi = trackPhi;
407 myconv->fPosDedx = pos->GetTPCsignal();
408 myconv->fPosMcLabel = pos->GetLabel();
412 //________________________________________________________________________
413 void AliAnalysisTaskEMCALPhoton::FillMyCells()
417 // cout<<"++++FillMyCells starts!\n";
418 Int_t ncells = fEMCalCells->GetNumberOfCells();
420 for(Int_t icell = 0; icell<ncells; icell++){
421 Int_t absID = TMath::Abs(fEMCalCells->GetCellNumber(icell));
422 AliPhotonCellObj *mycell = static_cast<AliPhotonCellObj*>(fMyCells->New(mcel++));
423 Float_t eta=-1, phi=-1;
425 cout<<"+++fGeom not found! MyCells branch will not be filled for this event!+++\n";
430 if(!fIsMC)fGeom->EtaPhiFromIndex(absID,eta,phi);
431 Float_t theta = 2*TMath::ATan(TMath::Exp(-eta));
432 mycell->fAbsID = absID;
433 mycell->fE = fEMCalCells->GetCellAmplitude(absID);
434 mycell->fEt = fEMCalCells->GetCellAmplitude(absID)*TMath::Sin(theta);
437 mycell->fTime = fEMCalCells->GetCellTime(absID);
439 // cout<<"++++FillMyCells done!\n";
441 //________________________________________________________________________
442 void AliAnalysisTaskEMCALPhoton::FillMyClusters()
446 Int_t nclus = fCaloClusters->GetEntries();
448 for(Int_t ic=0; ic < nclus; ic++){
449 AliESDCaloCluster *clus = static_cast<AliESDCaloCluster*>(fCaloClusters->At(ic));
454 if(clus->E() < fClusThresh)
457 clus->GetPosition(pos);
460 AliPhotonClusterObj *myclus = static_cast<AliPhotonClusterObj*>(fMyClusts->New(mcl++));
461 myclus->fE = clus->E();
462 myclus->fEt = clus->E()*TMath::Sin(cpos.Theta());
463 myclus->fR = cpos.Perp();
464 myclus->fEta = cpos.Eta();
465 myclus->fPhi = cpos.Phi();
467 myclus->fPhi+=TMath::TwoPi();
469 myclus->fN = clus->GetNCells();
471 myclus->fEmax = GetMaxCellEnergy( clus, id);
473 myclus->fTmax = fEMCalCells->GetCellTime(id);
474 myclus->fEcross = GetCrossEnergy( clus, id);
475 myclus->fDisp = clus->GetDispersion();
476 myclus->fM20 = clus->GetM20();
477 myclus->fM02 = clus->GetM02();
478 myclus->fTrDEta = clus->GetTrackDz();
479 myclus->fTrDPhi = clus->GetTrackDx();
480 myclus->fTrIso01 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.1, 0.);
481 myclus->fTrIso02 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.2, 0.);
482 myclus->fTrIso03 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.3, 0.);
483 myclus->fTrIso04 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.4, 0.);
484 myclus->fTrPhiBand01 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.1, 0.);
485 myclus->fTrPhiBand02 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.2, 0.);
486 myclus->fTrPhiBand03 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.3, 0.);
487 myclus->fTrPhiBand04 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.4, 0.);
488 for(Int_t icell=0;icell<myclus->fN;icell++){
489 Int_t absID = clus->GetCellAbsId(icell);
490 cellsAbsID.Append(Form("%d",absID));
491 cellsAbsID.Append(";");
493 myclus->fCellsAbsId = cellsAbsID;
494 myclus->fMcLabel = clus->GetLabel();
495 Int_t matchIndex = clus->GetTrackMatchedIndex();
496 if(matchIndex<0 || matchIndex>fESD->GetNumberOfTracks()){
500 AliESDtrack* track = static_cast<AliESDtrack*>(fESD->GetTrack(matchIndex));
509 if(!fPrTrCuts->IsSelected(track)){
513 myclus->fTrEp = clus->E()/track->P();
517 //________________________________________________________________________
518 void AliAnalysisTaskEMCALPhoton::FillMyAltClusters()
520 if(!fCaloClustersNew)
522 Int_t nclus = fCaloClustersNew->GetEntries();
524 for(Int_t ic=0; ic < nclus; ic++){
525 AliESDCaloCluster *clus = static_cast<AliESDCaloCluster*>(fCaloClustersNew->At(ic));
530 if(clus->E() < fClusThresh)
533 clus->GetPosition(pos);
536 AliPhotonClusterObj *myclus = static_cast<AliPhotonClusterObj*>(fMyAltClusts->New(mcl++));
537 myclus->fE = clus->E();
538 myclus->fEt = clus->E()*TMath::Sin(cpos.Theta());
539 myclus->fR = cpos.Perp();
540 myclus->fEta = cpos.Eta();
541 myclus->fPhi = cpos.Phi();
543 myclus->fPhi+=TMath::TwoPi();
545 myclus->fN = clus->GetNCells();
546 myclus->fDisp = clus->GetDispersion();
547 myclus->fM20 = clus->GetM20();
548 myclus->fM02 = clus->GetM02();
549 myclus->fTrDEta = clus->GetTrackDz();
550 myclus->fTrDPhi = clus->GetTrackDx();
551 myclus->fTrIso01 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.1, 0.);
552 myclus->fTrIso02 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.2, 0.);
553 myclus->fTrIso03 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.3, 0.);
554 myclus->fTrIso04 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.4, 0.);
555 for(Int_t icell=0;icell<myclus->fN;icell++){
556 Int_t absID = clus->GetCellAbsId(icell);
557 cellsAbsID.Append(Form("%d",absID));
558 cellsAbsID.Append(";");
560 myclus->fCellsAbsId = cellsAbsID;
561 myclus->fMcLabel = clus->GetLabel();
562 Int_t matchIndex = clus->GetTrackMatchedIndex();
563 if(matchIndex<0 || matchIndex>fESD->GetNumberOfTracks()){
567 AliESDtrack* track = static_cast<AliESDtrack*>(fESD->GetTrack(matchIndex));
576 if(!fPrTrCuts->IsSelected(track)){
580 myclus->fTrEp = clus->E()/track->P();
584 //________________________________________________________________________
585 void AliAnalysisTaskEMCALPhoton::FillHighPtTracks()
589 Int_t ntracks = fSelPrimTracks->GetEntries();
591 for(Int_t it=0;it<ntracks; it++){
592 AliESDtrack *track = static_cast<AliESDtrack*>(fSelPrimTracks->At(it));
597 AliPhotonTrackObj *mtr = static_cast<AliPhotonTrackObj*>(fMyTracks->New(imtr++));
598 mtr->fPt = track->Pt();
599 mtr->fEta = track->Eta();
600 mtr->fPhi = track->Phi();
601 mtr->fDedx = track->GetTPCsignal();
602 mtr->fMcLabel = track->GetLabel();
605 //________________________________________________________________________
606 void AliAnalysisTaskEMCALPhoton::GetMcParts()
610 // cout<<"++++Get - MC starts!\n";
612 const AliVVertex *evtVtx = fMCEvent->GetPrimaryVertex();
616 Int_t nTracks = fStack->GetNtrack();
617 for (Int_t iTrack = 0; iTrack<nTracks; ++iTrack) {
618 TParticle *mcP = static_cast<TParticle*>(fStack->Particle(iTrack));
622 Double_t dR = TMath::Sqrt((mcP->Vx()-evtVtx->GetX())*(mcP->Vx()-evtVtx->GetX()) +
623 (mcP->Vy()-evtVtx->GetY())*(mcP->Vy()-evtVtx->GetY()) +
624 (mcP->Vz()-evtVtx->GetZ())*(mcP->Vz()-evtVtx->GetZ()));
629 Double_t pt = mcP->Pt() ;
632 Double_t eta = mcP->Eta();
633 if (eta<-0.7||eta>0.7)
635 Double_t phi = mcP->Phi();
636 if (phi<1.0||phi>3.3)
638 // pion or eta meson or direct photon
639 if(mcP->GetPdgCode() == 111) {
640 } else if(mcP->GetPdgCode() == 221) {
641 } else if(mcP->GetPdgCode() == 22 ) {
644 bool checkIfAlreadySaved = false;
645 for(Int_t imy=0;imy<fMyMcParts->GetEntries();imy++){
646 AliPhotonMcPartObj *mymc = static_cast<AliPhotonMcPartObj*>(fMyMcParts->At(imy));
649 if(mymc->fLabel == iTrack)
650 checkIfAlreadySaved = true;
652 if(!checkIfAlreadySaved)
653 FillMcPart(mcP, ipart++, iTrack);
654 for(Int_t id=mcP->GetFirstDaughter(); id <= mcP->GetLastDaughter(); id++){
655 if(id<=mcP->GetMother(0))
657 if(id<0 || id>nTracks)
659 TParticle *mcD = static_cast<TParticle*>(fStack->Particle(id));
662 FillMcPart(mcD, ipart++, id);
665 // cout<<"++++Get - MC done!\n";
668 //________________________________________________________________________
669 void AliAnalysisTaskEMCALPhoton::FillMcPart(TParticle *mcP, Int_t ipart, Int_t itrack)
673 TVector3 vmcv(mcP->Vx(),mcP->Vy(), mcP->Vz());
674 AliPhotonMcPartObj *mcp = static_cast<AliPhotonMcPartObj*>(fMyMcParts->New(ipart));
675 mcp->fLabel = itrack ;
676 mcp->fPdg = mcP->GetPdgCode() ;
677 mcp->fPt = mcP->Pt() ;
678 mcp->fEta = mcP->Eta() ;
679 mcp->fPhi = mcP->Phi() ;
680 mcp->fVR = vmcv.Perp();
682 mcp->fVEta = vmcv.Eta() ;
683 mcp->fVPhi = vmcv.Phi() ;
685 mcp->fMother = mcP->GetMother(0) ;
687 //________________________________________________________________________
688 Double_t AliAnalysisTaskEMCALPhoton::GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius, Double_t pt) const
690 // Compute isolation based on tracks.
692 Double_t trkIsolation = 0;
693 Double_t rad2 = radius*radius;
694 Int_t ntrks = fSelPrimTracks->GetEntries();
695 for(Int_t j = 0; j<ntrks; ++j) {
696 AliVTrack *track = static_cast<AliVTrack*>(fSelPrimTracks->At(j));
702 Float_t eta = track->Eta();
703 Float_t phi = track->Phi();
704 Double_t phidiff = TVector2::Phi_mpi_pi(phi-cPhi);
705 Double_t dist = (eta-cEta)*(eta-cEta)+phidiff*phidiff;
708 trkIsolation += track->Pt();
712 //________________________________________________________________________
713 Double_t AliAnalysisTaskEMCALPhoton::GetPhiBandEt(Double_t eta, Double_t phi, Double_t R, Double_t minpt) const
717 Int_t ntracks = fSelPrimTracks->GetEntries();
718 Double_t loweta = eta - R;
719 Double_t upeta = eta + R;
720 Double_t upphi = phi + R;
721 Double_t lowphi = phi - R;
723 for(Int_t itr=0; itr<ntracks; itr++){
724 AliESDtrack *track = static_cast<AliESDtrack*>(fSelPrimTracks->At(itr));
727 if(track->Pt()<minpt)
729 if((track->Eta() < upeta) && (track->Eta() > loweta))
731 if((track->Phi() > upphi) || (track->Phi() < lowphi))
737 //________________________________________________________________________
738 Double_t AliAnalysisTaskEMCALPhoton::GetCrossEnergy(const AliVCluster *cluster, Short_t &idmax)
740 // Calculate the energy of cross cells around the leading cell.
742 AliVCaloCells *cells = 0;
743 cells = fESD->GetEMCALCells();
760 Double_t crossEnergy = 0;
762 fGeom->GetCellIndex(idmax,iSupMod,iTower,iIphi,iIeta);
763 fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphis,ietas);
765 Int_t ncells = cluster->GetNCells();
766 for (Int_t i=0; i<ncells; i++) {
767 Int_t cellAbsId = cluster->GetCellAbsId(i);
768 fGeom->GetCellIndex(cellAbsId,iSupMod,iTower,iIphi,iIeta);
769 fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta);
770 Int_t aphidiff = TMath::Abs(iphi-iphis);
773 Int_t aetadiff = TMath::Abs(ieta-ietas);
776 if ( (aphidiff==1 && aetadiff==0) ||
777 (aphidiff==0 && aetadiff==1) ) {
778 crossEnergy += cells->GetCellAmplitude(cellAbsId);
787 //________________________________________________________________________
788 Double_t AliAnalysisTaskEMCALPhoton ::GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const
790 // Get maximum energy of attached cell.
794 AliVCaloCells *cells = 0;
795 cells = fESD->GetEMCALCells();
800 Int_t ncells = cluster->GetNCells();
801 for (Int_t i=0; i<ncells; i++) {
802 Double_t e = cells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i)));
805 id = cluster->GetCellAbsId(i);
810 //________________________________________________________________________
811 void AliAnalysisTaskEMCALPhoton::Terminate(Option_t *)
813 // Draw result to the screen
814 // Called once at the end of the query
818 TFile *f = OpenFile(1);
819 TDirectory::TContext context(f);