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"
49 ClassImp(AliAnalysisTaskEMCALPhoton)
51 //________________________________________________________________________
52 AliAnalysisTaskEMCALPhoton::AliAnalysisTaskEMCALPhoton() :
71 fGeoName("EMCAL_COMPLETEV1"),
78 fCaloClustersName("EmcalClusterv2"),
84 fNV0sBefAndAftRerun(0),
91 // Default constructor.
94 //________________________________________________________________________
95 AliAnalysisTaskEMCALPhoton::AliAnalysisTaskEMCALPhoton(const char *name) :
96 AliAnalysisTaskSE(name),
114 fGeoName("EMCAL_COMPLETEV1"),
121 fCaloClustersName("EmcalClusterv2"),
127 fNV0sBefAndAftRerun(0),
136 // Define input and output slots here
137 // Input slot #0 works with a TChain
138 DefineInput(0, TChain::Class());
139 // Output slot #0 id reserved by the base class for AOD
140 // Output slot #1 writes into a TH1 container
141 DefineOutput(1, TList::Class());
144 //________________________________________________________________________
145 void AliAnalysisTaskEMCALPhoton::UserCreateOutputObjects()
147 // Create histograms, called once.
149 fSelTracks = new TObjArray();
151 fSelPrimTracks = new TObjArray();
153 if (TClass::GetClass("AliPhotonHeaderObj"))
154 TClass::GetClass("AliPhotonHeaderObj")->IgnoreTObjectStreamer();
155 fHeader = new AliPhotonHeaderObj;
157 if (TClass::GetClass("AliPhotonConvObj"))
158 TClass::GetClass("AliPhotonConvObj")->IgnoreTObjectStreamer();
159 fPhotConvArray = new TClonesArray("AliPhotonConvObj");
161 if (TClass::GetClass("AliPhotonClusterObj"))
162 TClass::GetClass("AliPhotonClusterObj")->IgnoreTObjectStreamer();
163 fMyClusts = new TClonesArray("AliPhotonClusterObj");
165 if (TClass::GetClass("AliPhotonCellObj"))
166 TClass::GetClass("AliPhotonCellObj")->IgnoreTObjectStreamer();
167 fMyCells = new TClonesArray("AliPhotonCellObj");
169 if (TClass::GetClass("AliPhotonTrackObj"))
170 TClass::GetClass("AliPhotonTrackObj")->IgnoreTObjectStreamer();
171 fMyTracks = new TClonesArray("AliPhotonTrackObj");
173 if (fClusterizer || fIsTrain){
175 fCaloClustersName = fClusterizer->GetNewClusterArrayName();
177 if(fPeriod.Contains("10h") || fPeriod.Contains("11h"))
178 fCaloClustersName = "EmcalClustersv1";
180 fCaloClustersName = "EmcalClustersv2";
182 if (TClass::GetClass("AliPhotonClusterObj"))
183 TClass::GetClass("AliPhotonClusterObj")->IgnoreTObjectStreamer();
184 fMyAltClusts = new TClonesArray("AliPhotonClusterObj");
186 cout<<fCaloClustersName<<endl;
188 if (TClass::GetClass("AliPhotonMcPartObj"))
189 TClass::GetClass("AliPhotonMcPartObj")->IgnoreTObjectStreamer();
190 fMyMcParts = new TClonesArray("AliPhotonMcPartObj");
193 fCaloClusters = new TRefArray();
195 fOutputList = new TList();
196 fOutputList->SetOwner();// Container cleans up all histos (avoids leaks in merging)
199 TFile *f = OpenFile(1);
200 TDirectory::TContext context(f);
202 f->SetCompressionLevel(2);
203 fTree = new TTree("photon_ana_out", "StandaloneTree");
204 fTree->SetDirectory(f);
206 fTree->SetAutoFlush(-2*1024*1024);
207 fTree->SetAutoSave(0);
209 fTree->SetAutoFlush(-32*1024*1024);
210 fTree->SetAutoSave(0);
213 fTree->Branch("header", &fHeader, 16*1024, 99);
214 fTree->Branch("conversions", &fPhotConvArray, 8*16*1024, 99);
215 fTree->Branch("clusters", &fMyClusts, 8*16*1024, 99);
216 if(fClusterizer || fIsTrain)
217 fTree->Branch(fCaloClustersName, &fMyAltClusts, 8*16*1024, 99);
218 fTree->Branch("cells", &fMyCells, 8*16*1024, 99);
219 fTree->Branch("HighPtTracks", &fMyTracks, 8*16*1024, 99);
221 fTree->Branch("mcparts", &fMyMcParts, 8*16*1024, 99);
224 if(fIsGrid)fOutputList->Add(fTree);
225 fGeom = AliEMCALGeometry::GetInstance(fGeoName);
228 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);
229 fOutputList->Add(fNV0sBefAndAftRerun);
231 fConversionVtxXY = new TH2F("hConversionVtxXY","x and y of conversion vertex candidates;x;y",1000,-100,100,1000,-100,100);
232 fOutputList->Add(fConversionVtxXY);
234 fInvMassV0 = new TH1F("hInvMassV0","v0->GetEffMass();v0->GetEffMass();dN/dM",400,0,4);
235 fOutputList->Add(fInvMassV0);
237 fInvMassV0KF = new TH1F("hInvMassV0KF","Inv. mass calculated from AliKFParticle made of V0 tracks;mass_{TrTr};dN/dM",400,0,4);
238 fOutputList->Add(fInvMassV0KF);
240 fInvMassV0SS = new TH1F("hInvMassV0SS","Inv. mass (same sign) calculated from AliKFParticle made of V0 tracks;mass_{TrTr};dN/dM",400,0,4);
241 fOutputList->Add(fInvMassV0SS);
243 fDedxPAll = new TH2F("hDedxPAll","dE/dx vs p (all selected tracks);p (GeV/c);dE/dx (a.u.)",400,0,40, 150,0,150);
244 fOutputList->Add(fDedxPAll);
247 PostData(1, fOutputList);
250 //________________________________________________________________________
251 void AliAnalysisTaskEMCALPhoton::UserExec(Option_t *)
253 // User exec, called once per event.
255 Bool_t isSelected = 0;
256 if(fPeriod.Contains("11")){
257 if(fPeriod.Contains("11a"))
258 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC1);
259 if(fPeriod.Contains("11c") ||fPeriod.Contains("11d") )
260 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC7);
261 if(fPeriod.Contains("11h") )
262 isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMCEGA);
269 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
271 printf("ERROR: fESD not available, returning...\n");
275 AliESDVertex *pv = (AliESDVertex*)fESD->GetPrimaryVertex();
278 if(TMath::Abs(pv->GetZ())>15)
281 // Track loop to fill a pT spectrum
282 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
283 AliESDtrack* track = fESD->GetTrack(iTracks);
288 if (fTrCuts && fTrCuts->IsSelected(track)){
289 fSelTracks->Add(track);
290 fDedxPAll->Fill(track->P(), track->GetTPCsignal());
292 if (fPrTrCuts && fPrTrCuts->IsSelected(track))
293 fSelPrimTracks->Add(track);
296 fHeader->fTrClassMask = fESD->GetHeader()->GetTriggerMask();
297 fHeader->fTrCluster = fESD->GetHeader()->GetTriggerCluster();
298 AliCentrality *cent = InputEvent()->GetCentrality();
299 fHeader->fV0Cent = cent->GetCentralityPercentileUnchecked("V0M");
300 fHeader->fCl1Cent = cent->GetCentralityPercentileUnchecked("CL1");
301 fHeader->fTrCent = cent->GetCentralityPercentileUnchecked("TRK");
303 for(Int_t mod=0; mod < (fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
304 if(fGeoName=="EMCAL_FIRSTYEARV1" && mod>3)
306 fGeom->SetMisalMatrix(fESD->GetEMCALMatrix(mod), mod);
309 fESD->GetEMCALClusters(fCaloClusters);
310 fHeader->fNClus = fCaloClusters->GetEntries();
311 fEMCalCells = fESD->GetEMCALCells();
312 fHeader->fNCells = fEMCalCells->GetNumberOfCells();
313 fMCEvent = MCEvent();
315 fStack = (AliStack*)fMCEvent->Stack();
329 fSelPrimTracks->Clear();
330 fPhotConvArray->Clear();
333 fMyAltClusts->Clear();
338 fCaloClusters->Clear();
340 fCaloClustersNew->Clear();
341 PostData(1, fOutputList);
344 //________________________________________________________________________
345 void AliAnalysisTaskEMCALPhoton::FindConversions()
352 Int_t nV0Orig = fESD->GetNumberOfV0s();
353 Int_t ntracks = fESD->GetNumberOfTracks();
355 AliV0vertexer lV0vtxer;
356 lV0vtxer.Tracks2V0vertices(fESD);
357 Int_t nV0s = fESD->GetNumberOfV0s();
358 fNV0sBefAndAftRerun->Fill(nV0Orig, nV0s);
359 for(Int_t iv0=0; iv0<nV0s; iv0++){
360 AliESDv0 * v0 = fESD->GetV0(iv0);
364 fInvMassV0->Fill(v0->GetEffMass());
365 v0->GetXYZ(vpos[0], vpos[1], vpos[2]);
366 Int_t ipos = v0->GetPindex();
367 Int_t ineg = v0->GetNindex();
368 if(ipos<0 || ipos> ntracks)
370 if(ineg<0 || ineg> ntracks)
372 AliESDtrack *pos = static_cast<AliESDtrack*>(fESD->GetTrack(ipos));
373 AliESDtrack *neg = static_cast<AliESDtrack*>(fESD->GetTrack(ineg));
376 if (!fTrCuts->IsSelected(pos) || !fTrCuts->IsSelected(neg))
378 /*if(pos->GetTPCsignal()<65 || neg->GetTPCsignal()<65)
380 const AliExternalTrackParam * paramPos = v0->GetParamP() ;
381 const AliExternalTrackParam * paramNeg = v0->GetParamN() ;
382 if(!paramPos || !paramNeg)
384 if(pos->GetSign() <0){//change tracks
386 neg=fESD->GetTrack(v0->GetPindex()) ;
388 paramNeg=v0->GetParamP() ;
390 AliKFParticle negKF(*paramNeg,11);
391 AliKFParticle posKF(*paramPos,-11);
392 AliKFParticle photKF(negKF,posKF) ;
394 if( neg->GetKinkIndex(0) > 0 || pos->GetKinkIndex(0) > 0)
397 if(pos->GetSign() == neg->GetSign()){
398 fInvMassV0SS->Fill(photKF.GetMass());
401 fInvMassV0KF->Fill(photKF.GetMass());
402 TLorentzVector photLV(photKF.GetPx(), photKF.GetPy(),photKF.GetPz(), photKF.GetE());
403 if(photLV.M()>0.05 || photLV.M()<0)
405 fConversionVtxXY->Fill(vpos[0], vpos[1]);//negKF.GetX(), negKF.GetY());
406 Double_t convPhi = TMath::ATan2(photLV.Py(),photLV.Px());
408 convPhi+=TMath::TwoPi();
409 TVector3 vecpos(vpos);
414 v0Phi+=TMath::TwoPi();
415 AliPhotonConvObj *myconv = static_cast<AliPhotonConvObj*>(fPhotConvArray->New(iconv++));
416 myconv->fPt = photLV.Pt();
417 myconv->fEta = photLV.Eta();
418 myconv->fPhi = convPhi;
419 myconv->fVR = vecpos.Perp();
421 myconv->fVEta = vecpos.Eta();
422 myconv->fVPhi = v0Phi;
423 myconv->fMass = photLV.M();
424 myconv->fMcLabel = -3; //WARNING: include the correct labeling
426 myconv->fNegPt = negKF.GetPt();
427 myconv->fNegEta = negKF.GetEta();
428 Double_t trackPhi = negKF.GetPhi();
430 trackPhi+=TMath::TwoPi();
431 myconv->fNegPhi = trackPhi;
432 myconv->fNegDedx = neg->GetTPCsignal();
433 myconv->fNegMcLabel = neg->GetLabel();
435 myconv->fPosPt = posKF.GetPt();
436 myconv->fPosEta = posKF.GetEta();
437 trackPhi = posKF.GetPhi();
439 trackPhi+=TMath::TwoPi();
440 myconv->fPosPhi = trackPhi;
441 myconv->fPosDedx = pos->GetTPCsignal();
442 myconv->fPosMcLabel = pos->GetLabel();
447 //________________________________________________________________________
448 void AliAnalysisTaskEMCALPhoton::FillMyCells()
454 Int_t ncells = fEMCalCells->GetNumberOfCells();
456 for(Int_t icell = 0; icell<ncells; icell++){
457 Int_t absID = TMath::Abs(fEMCalCells->GetCellNumber(icell));
458 AliPhotonCellObj *mycell = static_cast<AliPhotonCellObj*>(fMyCells->New(mcel++));
459 Float_t eta=-1, phi=-1;
461 cout<<"+++fGeom not found! MyCells branch will not be filled for this event!+++\n";
466 if(!fIsMC)fGeom->EtaPhiFromIndex(absID,eta,phi);
467 Float_t theta = 2*TMath::ATan(TMath::Exp(-eta));
468 mycell->fAbsID = absID;
469 mycell->fE = fEMCalCells->GetCellAmplitude(absID);
470 mycell->fEt = fEMCalCells->GetCellAmplitude(absID)*TMath::Sin(theta);
473 mycell->fTime = fEMCalCells->GetCellTime(absID);
477 //________________________________________________________________________
478 void AliAnalysisTaskEMCALPhoton::FillMyClusters()
484 Int_t nclus = fCaloClusters->GetEntries();
486 for(Int_t ic=0; ic < nclus; ic++){
487 AliESDCaloCluster *clus = static_cast<AliESDCaloCluster*>(fCaloClusters->At(ic));
492 if(clus->E() < fClusThresh)
495 clus->GetPosition(pos);
498 AliPhotonClusterObj *myclus = static_cast<AliPhotonClusterObj*>(fMyClusts->New(mcl++));
499 myclus->fE = clus->E();
500 myclus->fEt = clus->E()*TMath::Sin(cpos.Theta());
501 myclus->fR = cpos.Perp();
502 myclus->fEta = cpos.Eta();
503 myclus->fPhi = cpos.Phi();
505 myclus->fPhi+=TMath::TwoPi();
507 myclus->fN = clus->GetNCells();
509 myclus->fEmax = GetMaxCellEnergy( clus, id);
511 myclus->fTmax = fEMCalCells->GetCellTime(id);
512 myclus->fEcross = GetCrossEnergy( clus, id);
513 myclus->fDisp = clus->GetDispersion();
514 myclus->fM20 = clus->GetM20();
515 myclus->fM02 = clus->GetM02();
516 myclus->fTrDEta = clus->GetTrackDz();
517 myclus->fTrDPhi = clus->GetTrackDx();
518 myclus->fTrIso01 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.1, 0.);
519 myclus->fTrIso02 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.2, 0.);
520 myclus->fTrIso03 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.3, 0.);
521 myclus->fTrIso04 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.4, 0.);
522 myclus->fTrPhiBand01 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.1, 0.);
523 myclus->fTrPhiBand02 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.2, 0.);
524 myclus->fTrPhiBand03 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.3, 0.);
525 myclus->fTrPhiBand04 = GetPhiBandEt( cpos.Eta(), cpos.Phi(), 0.4, 0.);
526 for(Int_t icell=0;icell<myclus->fN;icell++){
527 Int_t absID = clus->GetCellAbsId(icell);
528 cellsAbsID.Append(Form("%d",absID));
529 cellsAbsID.Append(";");
531 myclus->fCellsAbsId = cellsAbsID;
532 myclus->fMcLabel = clus->GetLabel();
533 Int_t matchIndex = clus->GetTrackMatchedIndex();
534 if(matchIndex<0 || matchIndex>fESD->GetNumberOfTracks()){
538 AliESDtrack* track = static_cast<AliESDtrack*>(fESD->GetTrack(matchIndex));
547 if(!fPrTrCuts->IsSelected(track)){
551 myclus->fTrEp = clus->E()/track->P();
555 //________________________________________________________________________
556 void AliAnalysisTaskEMCALPhoton::FillMyAltClusters()
560 if(!fCaloClustersNew)
562 Int_t nclus = fCaloClustersNew->GetEntries();
564 for(Int_t ic=0; ic < nclus; ic++){
565 AliESDCaloCluster *clus = static_cast<AliESDCaloCluster*>(fCaloClustersNew->At(ic));
570 if(clus->E() < fClusThresh)
573 clus->GetPosition(pos);
576 AliPhotonClusterObj *myclus = static_cast<AliPhotonClusterObj*>(fMyAltClusts->New(mcl++));
577 myclus->fE = clus->E();
578 myclus->fEt = clus->E()*TMath::Sin(cpos.Theta());
579 myclus->fR = cpos.Perp();
580 myclus->fEta = cpos.Eta();
581 myclus->fPhi = cpos.Phi();
583 myclus->fPhi+=TMath::TwoPi();
585 myclus->fN = clus->GetNCells();
586 myclus->fDisp = clus->GetDispersion();
587 myclus->fM20 = clus->GetM20();
588 myclus->fM02 = clus->GetM02();
589 myclus->fTrDEta = clus->GetTrackDz();
590 myclus->fTrDPhi = clus->GetTrackDx();
591 myclus->fTrIso01 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.1, 0.);
592 myclus->fTrIso02 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.2, 0.);
593 myclus->fTrIso03 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.3, 0.);
594 myclus->fTrIso04 = GetTrackIsolation( cpos.Eta(), cpos.Phi(), 0.4, 0.);
595 for(Int_t icell=0;icell<myclus->fN;icell++){
596 Int_t absID = clus->GetCellAbsId(icell);
597 cellsAbsID.Append(Form("%d",absID));
598 cellsAbsID.Append(";");
600 myclus->fCellsAbsId = cellsAbsID;
601 myclus->fMcLabel = clus->GetLabel();
602 Int_t matchIndex = clus->GetTrackMatchedIndex();
603 if(matchIndex<0 || matchIndex>fESD->GetNumberOfTracks()){
607 AliESDtrack* track = static_cast<AliESDtrack*>(fESD->GetTrack(matchIndex));
616 if(!fPrTrCuts->IsSelected(track)){
620 myclus->fTrEp = clus->E()/track->P();
624 //________________________________________________________________________
625 void AliAnalysisTaskEMCALPhoton::FillHighPtTracks()
627 // Fill high pt tracks.
631 Int_t ntracks = fSelPrimTracks->GetEntries();
633 for(Int_t it=0;it<ntracks; it++){
634 AliESDtrack *track = static_cast<AliESDtrack*>(fSelPrimTracks->At(it));
639 AliPhotonTrackObj *mtr = static_cast<AliPhotonTrackObj*>(fMyTracks->New(imtr++));
640 mtr->fPt = track->Pt();
641 mtr->fEta = track->Eta();
642 mtr->fPhi = track->Phi();
643 mtr->fDedx = track->GetTPCsignal();
644 mtr->fMcLabel = track->GetLabel();
648 //________________________________________________________________________
649 void AliAnalysisTaskEMCALPhoton::GetMcParts()
656 const AliVVertex *evtVtx = fMCEvent->GetPrimaryVertex();
660 Int_t nTracks = fStack->GetNtrack();
661 for (Int_t iTrack = 0; iTrack<nTracks; ++iTrack) {
662 TParticle *mcP = static_cast<TParticle*>(fStack->Particle(iTrack));
666 Double_t dR = TMath::Sqrt((mcP->Vx()-evtVtx->GetX())*(mcP->Vx()-evtVtx->GetX()) +
667 (mcP->Vy()-evtVtx->GetY())*(mcP->Vy()-evtVtx->GetY()) +
668 (mcP->Vz()-evtVtx->GetZ())*(mcP->Vz()-evtVtx->GetZ()));
673 Double_t pt = mcP->Pt() ;
676 Double_t eta = mcP->Eta();
677 if (eta<-0.7||eta>0.7)
679 Double_t phi = mcP->Phi();
680 if (phi<1.0||phi>3.3)
682 // pion or eta meson or direct photon
683 if(mcP->GetPdgCode() == 111) {
684 } else if(mcP->GetPdgCode() == 221) {
685 } else if(mcP->GetPdgCode() == 22 ) {
688 bool checkIfAlreadySaved = false;
689 for(Int_t imy=0;imy<fMyMcParts->GetEntries();imy++){
690 AliPhotonMcPartObj *mymc = static_cast<AliPhotonMcPartObj*>(fMyMcParts->At(imy));
693 if(mymc->fLabel == iTrack)
694 checkIfAlreadySaved = true;
696 if(!checkIfAlreadySaved)
697 FillMcPart(mcP, ipart++, iTrack);
698 for(Int_t id=mcP->GetFirstDaughter(); id <= mcP->GetLastDaughter(); id++){
699 if(id<=mcP->GetMother(0))
701 if(id<0 || id>nTracks)
703 TParticle *mcD = static_cast<TParticle*>(fStack->Particle(id));
706 FillMcPart(mcD, ipart++, id);
711 //________________________________________________________________________
712 void AliAnalysisTaskEMCALPhoton::FillMcPart(TParticle *mcP, Int_t ipart, Int_t itrack)
714 // Fill MC particles.
718 TVector3 vmcv(mcP->Vx(),mcP->Vy(), mcP->Vz());
719 AliPhotonMcPartObj *mcp = static_cast<AliPhotonMcPartObj*>(fMyMcParts->New(ipart));
720 mcp->fLabel = itrack ;
721 mcp->fPdg = mcP->GetPdgCode() ;
722 mcp->fPt = mcP->Pt() ;
723 mcp->fEta = mcP->Eta() ;
724 mcp->fPhi = mcP->Phi() ;
725 mcp->fVR = vmcv.Perp();
727 mcp->fVEta = vmcv.Eta() ;
728 mcp->fVPhi = vmcv.Phi() ;
730 mcp->fMother = mcP->GetMother(0) ;
733 //________________________________________________________________________
734 Double_t AliAnalysisTaskEMCALPhoton::GetTrackIsolation(Double_t cEta, Double_t cPhi, Double_t radius, Double_t pt) const
736 // Compute isolation based on tracks.
738 Double_t trkIsolation = 0;
739 Double_t rad2 = radius*radius;
740 Int_t ntrks = fSelPrimTracks->GetEntries();
741 for(Int_t j = 0; j<ntrks; ++j) {
742 AliVTrack *track = static_cast<AliVTrack*>(fSelPrimTracks->At(j));
748 Float_t eta = track->Eta();
749 Float_t phi = track->Phi();
750 Double_t phidiff = TVector2::Phi_mpi_pi(phi-cPhi);
751 Double_t dist = (eta-cEta)*(eta-cEta)+phidiff*phidiff;
754 trkIsolation += track->Pt();
759 //________________________________________________________________________
760 Double_t AliAnalysisTaskEMCALPhoton::GetPhiBandEt(Double_t eta, Double_t phi, Double_t R, Double_t minpt) const
766 Int_t ntracks = fSelPrimTracks->GetEntries();
767 Double_t loweta = eta - R;
768 Double_t upeta = eta + R;
769 Double_t upphi = phi + R;
770 Double_t lowphi = phi - R;
772 for(Int_t itr=0; itr<ntracks; itr++){
773 AliESDtrack *track = static_cast<AliESDtrack*>(fSelPrimTracks->At(itr));
776 if(track->Pt()<minpt)
778 if((track->Eta() < upeta) && (track->Eta() > loweta))
780 if((track->Phi() > upphi) || (track->Phi() < lowphi))
787 //________________________________________________________________________
788 Double_t AliAnalysisTaskEMCALPhoton::GetCrossEnergy(const AliVCluster *cluster, Short_t &idmax)
790 // Calculate the energy of cross cells around the leading cell.
792 AliVCaloCells *cells = 0;
793 cells = fESD->GetEMCALCells();
809 Double_t crossEnergy = 0;
811 fGeom->GetCellIndex(idmax,iSupMod,iTower,iIphi,iIeta);
812 fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphis,ietas);
814 Int_t ncells = cluster->GetNCells();
815 for (Int_t i=0; i<ncells; i++) {
816 Int_t cellAbsId = cluster->GetCellAbsId(i);
817 fGeom->GetCellIndex(cellAbsId,iSupMod,iTower,iIphi,iIeta);
818 fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi, iIeta,iphi,ieta);
819 Int_t aphidiff = TMath::Abs(iphi-iphis);
822 Int_t aetadiff = TMath::Abs(ieta-ietas);
825 if ( (aphidiff==1 && aetadiff==0) ||
826 (aphidiff==0 && aetadiff==1) ) {
827 crossEnergy += cells->GetCellAmplitude(cellAbsId);
834 //________________________________________________________________________
835 Double_t AliAnalysisTaskEMCALPhoton ::GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const
837 // Get maximum energy of attached cell.
841 AliVCaloCells *cells = 0;
842 cells = fESD->GetEMCALCells();
847 Int_t ncells = cluster->GetNCells();
848 for (Int_t i=0; i<ncells; i++) {
849 Double_t e = cells->GetCellAmplitude(TMath::Abs(cluster->GetCellAbsId(i)));
852 id = cluster->GetCellAbsId(i);
858 //________________________________________________________________________
859 void AliAnalysisTaskEMCALPhoton::Terminate(Option_t *)
861 // Called once at the end of the query
865 TFile *f = OpenFile(1);
866 TDirectory::TContext context(f);