1 // ******************************************
2 // This task computes several jet observables like
3 // the fraction of energy in inner and outer coronnas,
4 // jet-track correlations,triggered jet shapes and
5 // correlation strength distribution of particles inside jets.
6 // Author: lcunquei@cern.ch
7 // *******************************************
10 /**************************************************************************
11 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
13 * Author: The ALICE Off-line Project. *
14 * Contributors are mentioned in the code where appropriate. *
16 * Permission to use, copy, modify and distribute this software and its *
17 * documentation strictly for non-commercial purposes is hereby granted *
18 * without fee, provided that the above copyright notice appears in all *
19 * copies and that both the copyright notice and this permission notice *
20 * appear in the supporting documentation. The authors make no claims *
21 * about the suitability of this software for any purpose. It is *
22 * provided "as is" without express or implied warranty. *
23 **************************************************************************/
32 #include "THnSparse.h"
34 #include "TMatrixDSym.h"
35 #include "TMatrixDSymEigen.h"
40 #include "AliAnalysisTask.h"
41 #include "AliAnalysisManager.h"
43 #include "AliVEvent.h"
44 #include "AliESDEvent.h"
45 #include "AliESDInputHandler.h"
46 #include "AliCentrality.h"
47 #include "AliAnalysisHelperJetTasks.h"
48 #include "AliInputEventHandler.h"
49 #include "AliAODJetEventBackground.h"
50 #include "AliAODMCParticle.h"
51 #include "AliAnalysisTaskFastEmbedding.h"
52 #include "AliAODEvent.h"
53 #include "AliAODHandler.h"
54 #include "AliAODJet.h"
56 #include "AliAnalysisTaskJetAntenna.h"
61 ClassImp(AliAnalysisTaskJetAntenna)
63 AliAnalysisTaskJetAntenna::AliAnalysisTaskJetAntenna() :
69 fBackgroundBranch(""),
72 fOfflineTrgMask(AliVEvent::kAny),
86 fApplySharedClusterCut(0),
87 fTrackTypeRec(kTrackUndef),
100 fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
101 fJetPtFractionMin(0.5),
108 fHistEvtSelection(0x0),
114 // default Constructor
116 fJetBranchName[0] = "";
117 fJetBranchName[1] = "";
119 fListJets[0] = new TList;
120 fListJets[1] = new TList;
123 AliAnalysisTaskJetAntenna::AliAnalysisTaskJetAntenna(const char *name) :
124 AliAnalysisTaskSE(name),
129 fBackgroundBranch(""),
132 fOfflineTrgMask(AliVEvent::kAny),
139 fFilterMaskBestPt(0),
144 fNInputTracksMax(-1),
146 fApplySharedClusterCut(0),
147 fTrackTypeRec(kTrackUndef),
160 fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
161 fJetPtFractionMin(0.5),
168 fHistEvtSelection(0x0),
177 fJetBranchName[0] = "";
178 fJetBranchName[1] = "";
180 fListJets[0] = new TList;
181 fListJets[1] = new TList;
183 DefineOutput(1, TList::Class());
186 AliAnalysisTaskJetAntenna::~AliAnalysisTaskJetAntenna()
192 void AliAnalysisTaskJetAntenna::SetBranchNames(const TString &branch1, const TString &branch2)
194 fJetBranchName[0] = branch1;
195 fJetBranchName[1] = branch2;
198 void AliAnalysisTaskJetAntenna::Init()
201 // check for jet branches
202 if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){
203 AliError("Jet branch name not set.");
208 void AliAnalysisTaskJetAntenna::UserCreateOutputObjects()
213 if(!fOutputList) fOutputList = new TList;
214 fOutputList->SetOwner(kTRUE);
216 Bool_t oldStatus = TH1::AddDirectoryStatus();
217 TH1::AddDirectory(kFALSE);
219 fHistEvtSelection = new TH1I("fHistEvtSelection", "event selection", 6, -0.5, 5.5);
220 fHistEvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
221 fHistEvtSelection->GetXaxis()->SetBinLabel(2,"events IN");
222 fHistEvtSelection->GetXaxis()->SetBinLabel(3,"event selection (rejected)");
223 fHistEvtSelection->GetXaxis()->SetBinLabel(4,"vertex cut (rejected)");
224 fHistEvtSelection->GetXaxis()->SetBinLabel(5,"centrality (rejected)");
225 fHistEvtSelection->GetXaxis()->SetBinLabel(6,"multiplicity (rejected)");
226 fOutputList->Add(fHistEvtSelection);
227 fh2JetEntries=new TH2F("JetEntries","",150,0,150,10,-0.5,9.5);
228 fOutputList->Add(fh2JetEntries);
229 fh2Circularity=new TH2F("Circcularity","",10,0,1,150,0,150);
230 fOutputList->Add(fh2Circularity);
231 fh2JetAxisPhi=new TH2F("JetAxisSmearPhi","",9,0,TMath::Pi(),10,-0.5,9.5);
232 fOutputList->Add(fh2JetAxisPhi);
235 Int_t nbinsJet[10]={3,9,75,9,36,5,7,10,50,2};
236 Double_t binlowJet[10]= {0,0, 0, 0,-0.5*TMath::Pi(),0,0,-0.5,0,0};
237 Double_t binupJet[10]= {100,0.9, 150,150,1.5*TMath::Pi(),1,150,9.5,200,2};
238 fhnJetTM = new THnSparseF("fhnJetTM", "fhnJetTM; cent;dr;pt_jet;pt_track;phi;circ;ptrue;pthard;ptlead;isemebed",10,nbinsJet,binlowJet,binupJet);
240 Double_t *xPt3=new Double_t[10];
242 for(Int_t i = 1;i<=9;i++){
243 if(xPt3[i-1]<2)xPt3[i] = xPt3[i-1] + 0.4; // 1 - 5
244 else if(xPt3[i-1]<11)xPt3[i] = xPt3[i-1] + 3; // 5 - 12
245 else xPt3[i] = xPt3[i-1] + 150.; // 18
247 fhnJetTM->SetBinEdges(3,xPt3);
249 // Double_t *xPt2=new Double_t[10];
259 //fhnJetTM->SetBinEdges(2,xPt2);
262 Double_t *xPt4=new Double_t[4];
269 fhnJetTM->SetBinEdges(0,xPt4);
271 Double_t *xPt5=new Double_t[10];
281 fhnJetTM->SetBinEdges(6,xPt5);
284 fOutputList->Add(fhnJetTM);
289 // =========== Switch on Sumw2 for all histos ===========
290 for (Int_t i=0; i<fOutputList->GetEntries(); ++i) {
291 TH1 *h1 = dynamic_cast<TH1*>(fOutputList->At(i));
296 THnSparse *hn = dynamic_cast<THnSparse*>(fOutputList->At(i));
301 TH1::AddDirectory(oldStatus);
303 PostData(1, fOutputList);
306 void AliAnalysisTaskJetAntenna::UserExec(Option_t *)
310 if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){
311 AliError("Jet branch name not set.");
315 fESD=dynamic_cast<AliESDEvent*>(InputEvent());
317 AliError("ESD not available");
318 fAODIn = dynamic_cast<AliAODEvent*>(InputEvent());
320 fAODOut = dynamic_cast<AliAODEvent*>(AODEvent());
322 static AliAODEvent* aod = 0;
323 // take all other information from the aod we take the tracks from
325 if(!fESD)aod = fAODIn;
330 if(fNonStdFile.Length()!=0){
331 // case that we have an AOD extension we need can fetch the jets from the extended output
332 AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
333 fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);
335 if(fDebug>1)Printf("AODExtension found for %s",fNonStdFile.Data());
340 // -- event selection --
341 fHistEvtSelection->Fill(1); // number of events before event selection
344 Bool_t selected=kTRUE;
345 selected = AliAnalysisHelperJetTasks::Selected();
347 // no selection by the service task, we continue
348 PostData(1,fOutputList);
353 // physics selection: this is now redundant, all should appear as accepted after service task selection
354 AliInputEventHandler* inputHandler = (AliInputEventHandler*)
355 ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
356 std::cout<<inputHandler->IsEventSelected()<<" "<<fOfflineTrgMask<<std::endl;
357 if(!(inputHandler->IsEventSelected() & fOfflineTrgMask)){
358 if(fDebug) Printf(" Trigger Selection: event REJECTED ... ");
359 fHistEvtSelection->Fill(2);
360 PostData(1, fOutputList);
368 if(fDebug) Printf("%s:%d No AOD",(char*)__FILE__,__LINE__);
369 fHistEvtSelection->Fill(3);
370 PostData(1, fOutputList);
372 AliAODVertex* primVtx = aod->GetPrimaryVertex();
375 if(fDebug) Printf("%s:%d No primVtx",(char*)__FILE__,__LINE__);
376 fHistEvtSelection->Fill(3);
377 PostData(1, fOutputList);
381 Int_t nTracksPrim = primVtx->GetNContributors();
382 if ((nTracksPrim < fMinContribVtx) ||
383 (primVtx->GetZ() < fVtxZMin) ||
384 (primVtx->GetZ() > fVtxZMax) ){
385 if(fDebug) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ());
386 fHistEvtSelection->Fill(3);
387 PostData(1, fOutputList);
393 // centrality selection
394 AliCentrality *cent = 0x0;
395 Double_t centValue = 0.;
397 if(fESD) {cent = fESD->GetCentrality();
398 if(cent) centValue = cent->GetCentralityPercentile("V0M");}
399 else centValue=((AliVAODHeader*)aod->GetHeader())->GetCentrality();
401 if(fDebug) printf("centrality: %f\n", centValue);
402 if (centValue < fCentMin || centValue > fCentMax){
403 fHistEvtSelection->Fill(4);
404 PostData(1, fOutputList);
409 fHistEvtSelection->Fill(0);
411 // -- end event selection --
414 Double_t pthardbin=0;
416 pthard = AliAnalysisTaskFastEmbedding::GetPtHard();
417 pthardbin = GetPtHardBin(pthard);}
419 AliAODJetEventBackground* externalBackground = 0;
420 if(fAODOut&&!externalBackground&&fBackgroundBranch.Length()){
421 externalBackground = (AliAODJetEventBackground*)(fAODOut->FindListObject(fBackgroundBranch.Data()));
422 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
424 if(fAODExtension&&!externalBackground&&fBackgroundBranch.Length()){
425 externalBackground = (AliAODJetEventBackground*)(fAODExtension->GetAOD()->FindListObject(fBackgroundBranch.Data()));
426 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
429 if(fAODIn&&!externalBackground&&fBackgroundBranch.Length()){
430 externalBackground = (AliAODJetEventBackground*)(fAODIn->FindListObject(fBackgroundBranch.Data()));
431 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
437 if(externalBackground)rho = externalBackground->GetBackground(0);
440 TClonesArray *aodJets[2];
442 if(fAODOut&&!aodJets[0]){
443 aodJets[0] = dynamic_cast<TClonesArray*>(fAODOut->FindListObject(fJetBranchName[0].Data()));
444 aodJets[1] = dynamic_cast<TClonesArray*>(fAODOut->FindListObject(fJetBranchName[1].Data()));
446 if(fAODExtension && !aodJets[0]){
447 aodJets[0] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[0].Data()));
448 aodJets[1] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[1].Data()));
450 if(fAODIn&&!aodJets[0]){
451 aodJets[0] = dynamic_cast<TClonesArray*>(fAODIn->FindListObject(fJetBranchName[0].Data()));
452 aodJets[1] = dynamic_cast<TClonesArray*>(fAODIn->FindListObject(fJetBranchName[1].Data()));
459 if(!fDoMatching) nT = GetListOfTracks(&ParticleList);
460 if(fDoMatching)nT=GetListOfTracksExtra(&ParticleList);
462 PostData(1, fOutputList);
466 for (Int_t iJetType = 0; iJetType < 2; iJetType++) {
467 fListJets[iJetType]->Clear();
468 if (!aodJets[iJetType]) continue;
469 if(fDebug) Printf("%s: %d jets",fJetBranchName[iJetType].Data(),aodJets[iJetType]->GetEntriesFast());
470 for (Int_t iJet = 0; iJet < aodJets[iJetType]->GetEntriesFast(); iJet++) {
471 AliAODJet *jet = dynamic_cast<AliAODJet*>((*aodJets[iJetType])[iJet]);
472 if (jet) fListJets[iJetType]->Add(jet);
477 static TArrayI aMatchIndex(fListJets[0]->GetEntries());
478 static TArrayF aPtFraction(fListJets[0]->GetEntries());
479 if(aMatchIndex.GetSize()<fListJets[0]->GetEntries()) aMatchIndex.Set(fListJets[0]->GetEntries());
480 if(aPtFraction.GetSize()<fListJets[0]->GetEntries()) aPtFraction.Set(fListJets[0]->GetEntries());
485 // stores matched jets in 'aMatchIndex' and fraction of pT in 'aPtFraction'
486 AliAnalysisHelperJetTasks::GetJetMatching(fListJets[0], TMath::Min((Int_t)fNMatchJets,(Int_t)fListJets[0]->GetEntries()),
487 fListJets[1], TMath::Min((Int_t)fNMatchJets,(Int_t)fListJets[1]->GetEntries()),
488 aMatchIndex, aPtFraction, fDebug, fMatchMaxDist, fIsPbPb?1:2);}
495 // loop over matched jets
496 Int_t ir = -1; // index of matched reconstruced jet
497 Float_t fraction = -1.;
498 AliAODJet *jetmatched =0x0;
504 for(Int_t i=0; i<fListJets[0]->GetEntries(); ++i){
510 Double_t pxbig,pybig,pzbig;
515 AliAODJet* jetbig = (AliAODJet*)(fListJets[0]->At(i));
516 etabig = jetbig->Eta();
517 phibig = jetbig->Phi();
520 ptbig = jetbig->Pt();
521 if(ptbig==0) continue;
522 areabig = jetbig->EffectiveAreaCharged();
523 if(!fDoMatching) ptbig=ptbig-rho*areabig;
524 if((etabig<fJetEtaMin)||(etabig>fJetEtaMax)) continue;
526 if(fSemigoodCorrect){
527 if((phibig>fHolePos-fHoleWidth) && (phibig<fHolePos+fHoleWidth)) continue;
534 Bool_t jetAccepted=kTRUE;
536 if(ir>=0) jetmatched = (AliAODJet*)(fListJets[1]->At(ir));
538 fraction = aPtFraction[i];
539 // minimum fraction required
541 if(fraction<fJetPtFractionMin) jetAccepted = kFALSE;
543 // jet acceptance + minimum pT check
544 if(jetmatched->Eta()>fJetEtaMax || jetmatched->Eta()<fJetEtaMin) jetAccepted = kFALSE;
548 if(!jetAccepted) continue;
550 etabig=jetmatched->Eta();
551 phibig=jetmatched->Phi();
552 pxbig=jetmatched->Px();
553 pybig=jetmatched->Py();
554 pzbig=jetmatched->Pz();
555 ptbig=jetmatched->Pt()-rho*jetmatched->EffectiveAreaCharged();
561 smearphi=RelativePhi(phitrue,jetmatched->Phi());
562 smearphi=TMath::Abs(smearphi);
570 TVector3 ppJ1(pxbig, pybig, pzbig);
571 TVector3 ppJ3(- pxbig * pzbig, - pybig * pzbig, pxbig * pxbig + pybig * pybig);
573 TVector3 ppJ2(-pybig, pxbig, 0);
585 for(int it = 0;it<ParticleList.GetEntries();++it){
586 AliVParticle *track = (AliVParticle*)ParticleList.At(it);
587 TVector3 pp(track->Px(), track->Py(), track->Pz());
588 Float_t phi = track->Phi();
589 Float_t eta = track->Eta();
590 Float_t pt = track->Pt();
591 Float_t deta = eta - etabig;
592 Float_t dphi = RelativePhi(phi,phibig);
593 if(TMath::Abs(dphi)>=0.5*TMath::Pi()) continue;
594 Float_t r = TMath::Sqrt(dphi * dphi + deta * deta);
596 if (r < 0.4 && pt>fCutTM) {
597 //longitudinal and perpendicular component of the track pT in the
599 if(pt>ptmax) ptmax=pt;
600 TVector3 pLong = pp.Dot(ppJ1) / ppJ1.Mag2() * ppJ1;
601 TVector3 pPerp = pp - pLong;
602 //projection onto the two perpendicular vectors defined above
603 Float_t ppjX = pPerp.Dot(ppJ2);
604 Float_t ppjY = pPerp.Dot(ppJ3);
605 Float_t ppjT = TMath::Sqrt(ppjX * ppjX + ppjY * ppjY);
606 //components of the 2D symmetrical sphericity matrix
607 mxx += (ppjX * ppjX / ppjT);
608 myy += (ppjY * ppjY / ppjT);
609 mxy += (ppjX * ppjY / ppjT);
619 const Double_t ele[4] = {mxx / sump2, mxy / sump2, mxy / sump2, myy / sump2};
620 TMatrixDSym m0(2,ele);
622 TMatrixDSymEigen m(m0);
624 TMatrixD evecm = m.GetEigenVectors();
625 eval = m.GetEigenValues();
626 // Largest eigenvector
628 if (eval[0] < eval[1]) jev = 1;
631 evec0 = TMatrixDColumn(evecm, jev);
632 TVector2 evec(evec0[0], evec0[1]);
634 if(jev==1) circ=2*eval[0];
635 if(jev==0) circ=2*eval[1];
636 fh2Circularity->Fill(circ,ptbig);
637 fh2JetEntries->Fill(ptbig,pthardbin);
640 if(fDoMatching) fh2JetAxisPhi->Fill(smearphi,pthardbin);
644 for (Int_t ip = 0; ip < ParticleList.GetEntries(); ip++) {
645 AliVParticle *track = (AliVParticle*)ParticleList.At(ip);
647 if(fDoMatching) if(ip<nT) isembed=1.5;
648 TVector3 pp(track->Px(), track->Py(), track->Pz());
649 Float_t phi = track->Phi();
650 Float_t eta = track->Eta();
651 Float_t pt = track->Pt();
653 Float_t deta = eta - etabig;
654 Float_t dphi = RelativePhi(phi,phibig);
655 if(TMath::Abs(dphi)>=0.5*TMath::Pi()) continue;
657 Float_t dRR = TMath::Sqrt(dphi * dphi + deta * deta);
658 TVector3 pLong = pp.Dot(ppJ1) / ppJ1.Mag2() * ppJ1;
659 TVector3 pPerp = pp - pLong;
660 Float_t ppjX = pPerp.Dot(ppJ2);
661 Float_t ppjY = pPerp.Dot(ppJ3);
662 TVector2 vr(ppjX, ppjY) ;
663 //and this is the angle between the particle and the TM axis.
664 float phistr=evec.Phi()-vr.Phi();
665 if(phistr>2*TMath::Pi()) phistr -= 2*TMath::Pi();
666 if(phistr<-2*TMath::Pi()) phistr += 2*TMath::Pi();
667 if(phistr<-0.5*TMath::Pi()) phistr += 2*TMath::Pi();
668 if(phistr>1.5*TMath::Pi()) phistr -= 2*TMath::Pi();
670 double jetEntries[10] = {centValue,dRR,ptbig,pt,phistr,circ,ptrue,pthardbin,ptmax,isembed};
671 fhnJetTM->Fill(jetEntries);
676 PostData(1, fOutputList);
679 void AliAnalysisTaskJetAntenna::Terminate(const Option_t *)
681 // Draw result to the screen
682 // Called once at the end of the query
684 if (!GetOutputData(1))
689 Int_t AliAnalysisTaskJetAntenna::GetListOfTracks(TList *list){
692 AliAODEvent *aod = 0;
694 if(!fESD)aod = fAODIn;
699 for(int it = 0;it < aod->GetNumberOfTracks();++it){
700 AliAODTrack *tr = aod->GetTrack(it);
701 Bool_t bGood = false;
702 if(fFilterType == 0)bGood = true;
703 else if(fFilterType == 1)bGood = tr->IsHybridTPCConstrainedGlobal();
704 else if(fFilterType == 2)bGood = tr->IsHybridGlobalConstrainedGlobal();
705 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
706 if(fRequireITSRefit==1){if((tr->GetStatus()&AliESDtrack::kITSrefit)==0)continue;}
707 if(bGood==false) continue;
708 if (fApplySharedClusterCut) {
709 Double_t frac = Double_t(tr->GetTPCnclsS()) /Double_t(tr->GetTPCncls());
710 if (frac > 0.4) continue;
712 if(TMath::Abs(tr->Eta())>0.9)continue;
713 if(tr->Pt()<0.15)continue;
723 Int_t AliAnalysisTaskJetAntenna::GetListOfTracksExtra(TList *list){
727 AliAODEvent *aod = 0;
729 if(!fESD)aod = fAODIn;
734 TClonesArray *aodExtraTracks = dynamic_cast<TClonesArray*>(aod->FindListObject("aodExtraTracks"));
735 if(!aodExtraTracks)return iCount;
736 for(int it =0; it<aodExtraTracks->GetEntries(); it++) {
737 AliVParticle *track = dynamic_cast<AliVParticle*> ((*aodExtraTracks)[it]);
738 if (!track) continue;
739 AliAODTrack *trackAOD = dynamic_cast<AliAODTrack*> (track);
740 if(!trackAOD)continue;
741 Bool_t bGood = false;
742 if(fFilterType == 0)bGood = true;
743 else if(fFilterType == 1)bGood = trackAOD->IsHybridTPCConstrainedGlobal();
744 else if(fFilterType == 2)bGood = trackAOD->IsHybridGlobalConstrainedGlobal();
745 if((fFilterMask>0)&&((!trackAOD->TestFilterBit(fFilterMask)||(!bGood))))continue;
746 if(fRequireITSRefit){if((trackAOD->GetStatus()&AliESDtrack::kITSrefit)==0)continue;}
747 if (fApplySharedClusterCut) {
748 Double_t frac = Double_t(trackAOD->GetTPCnclsS()) /Double_t(trackAOD->GetTPCncls());
749 if (frac > 0.4) continue;
752 if(TMath::Abs(trackAOD->Eta())>0.9) continue;
753 if(trackAOD->Pt()<0.15) continue;
754 if(fDebug) printf("pt extra track %.2f \n", trackAOD->Pt());
764 for(int it = 0;it < aod->GetNumberOfTracks();++it){
765 AliAODTrack *tr = aod->GetTrack(it);
766 Bool_t bGood = false;
767 if(fFilterType == 0)bGood = true;
768 else if(fFilterType == 1)bGood = tr->IsHybridTPCConstrainedGlobal();
769 else if(fFilterType == 2)bGood = tr->IsHybridGlobalConstrainedGlobal();
770 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
771 if(fRequireITSRefit==1){if((tr->GetStatus()&AliESDtrack::kITSrefit)==0)continue;}
772 if(bGood==false) continue;
773 if (fApplySharedClusterCut) {
774 Double_t frac = Double_t(tr->GetTPCnclsS()) /Double_t(tr->GetTPCncls());
775 if (frac > 0.4) continue;
777 if(TMath::Abs(tr->Eta())>0.9)continue;
778 if(tr->Pt()<0.15)continue;
786 Double_t AliAnalysisTaskJetAntenna::RelativePhi(Double_t mphi,Double_t vphi){
788 if (vphi < -1*TMath::Pi()) vphi += (2*TMath::Pi());
789 else if (vphi > TMath::Pi()) vphi -= (2*TMath::Pi());
790 if (mphi < -1*TMath::Pi()) mphi += (2*TMath::Pi());
791 else if (mphi > TMath::Pi()) mphi -= (2*TMath::Pi());
792 double dphi = mphi-vphi;
793 if (dphi < -1*TMath::Pi()) dphi += (2*TMath::Pi());
794 else if (dphi > TMath::Pi()) dphi -= (2*TMath::Pi());
795 return dphi;//dphi in [-Pi, Pi]
798 Int_t AliAnalysisTaskJetAntenna::GetPhiBin(Double_t phi)
801 if(!(TMath::Abs(phi)<=2*TMath::Pi())){AliError("phi w.r.t. RP out of defined range");return -1;}
802 Double_t phiwrtrp=TMath::ACos(TMath::Abs(TMath::Cos(phi)));
803 phibin=Int_t(fNRPBins*phiwrtrp/(0.5*TMath::Pi()));
804 if(phibin<0||phibin>=fNRPBins){AliError("Phi Bin not defined");}
808 Int_t AliAnalysisTaskJetAntenna::GetPtHardBin(Double_t ptHard){
810 const Int_t nBins = 10;
811 Double_t binLimits[nBins] = { 5., 11., 21., 36., 57., 84., 117., 156., 200., 249. }; // lower limits
814 while(bin<nBins-1 && binLimits[bin+1]<ptHard){