1 // **************************************
2 // Task used for the correction of determiantion of reconstructed jet spectra
3 // Compares input (gen) and output (rec) jets
4 // *******************************************
7 /**************************************************************************
8 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
10 * Author: The ALICE Off-line Project. *
11 * Contributors are mentioned in the code where appropriate. *
13 * Permission to use, copy, modify and distribute this software and its *
14 * documentation strictly for non-commercial purposes is hereby granted *
15 * without fee, provided that the above copyright notice appears in all *
16 * copies and that both the copyright notice and this permission notice *
17 * appear in the supporting documentation. The authors make no claims *
18 * about the suitability of this software for any purpose. It is *
19 * provided "as is" without express or implied warranty. *
20 **************************************************************************/
26 #include <THnSparse.h>
28 #include <TInterpreter.h>
30 #include <TLorentzVector.h>
31 #include <TRefArray.h>
32 #include "TDatabasePDG.h"
34 #include "AliAnalysisTaskJetBackgroundSubtract.h"
35 #include "AliAnalysisManager.h"
36 #include "AliAODHandler.h"
37 #include "AliAODTrack.h"
38 #include "AliAODJet.h"
39 #include "AliAODEvent.h"
40 #include "AliInputEventHandler.h"
41 #include "AliAODJetEventBackground.h"
44 ClassImp(AliAnalysisTaskJetBackgroundSubtract)
46 AliAnalysisTaskJetBackgroundSubtract::~AliAnalysisTaskJetBackgroundSubtract(){
48 delete fOutJetArrayList;
49 delete fInJetArrayList;
52 AliAnalysisTaskJetBackgroundSubtract::AliAnalysisTaskJetBackgroundSubtract():
57 fJBArray(new TObjArray()),
58 fBackgroundBranch(""),
60 fReplaceString1("B0"),
61 fReplaceString2("B%d"),
64 fOutJetArrayList(0x0),
71 fh2ShiftEtaLeading(0x0),
72 fh2ShiftPhiLeading(0x0),
78 AliAnalysisTaskJetBackgroundSubtract::AliAnalysisTaskJetBackgroundSubtract(const char* name):
80 AliAnalysisTaskSE(name),
84 fJBArray(new TObjArray()),
85 fBackgroundBranch(""),
87 fReplaceString1("B0"),
88 fReplaceString2("B%d"),
91 fOutJetArrayList(0x0),
98 fh2ShiftEtaLeading(0x0),
99 fh2ShiftPhiLeading(0x0),
102 DefineOutput(1, TList::Class());
107 Bool_t AliAnalysisTaskJetBackgroundSubtract::Notify()
110 fAODIn = dynamic_cast<AliAODEvent*>(InputEvent());
114 // Now we also have the Input Event Available! Fillvthe pointers in the list
116 fInJetArrayList->Clear();
117 fOutJetArrayList->Clear();
119 for(int iJB = 0;iJB<fJBArray->GetEntries();iJB++){
120 TObjString *ostr = (TObjString*)fJBArray->At(iJB);
123 TClonesArray* jarray = 0;
124 if(!jarray&&fAODOut){
125 jarray = (TClonesArray*)(fAODOut->FindListObject(ostr->GetString().Data()));
127 if(!jarray&&fAODExtension){
128 jarray = (TClonesArray*)(fAODExtension->GetAOD()->FindListObject(ostr->GetString().Data()));
131 jarray = (TClonesArray*)(fAODIn->FindListObject(ostr->GetString().Data()));
136 Printf("%s:%d Input jet branch %s not found",(char*)__FILE__,__LINE__,ostr->GetString().Data());
141 TString newName(ostr->GetString().Data());
142 newName.ReplaceAll(fReplaceString1.Data(),Form(fReplaceString2.Data(),fSubtraction));
143 TClonesArray* jarrayOut = 0;
144 if(!jarrayOut&&fAODOut){
145 jarrayOut = (TClonesArray*)(fAODOut->FindListObject(newName.Data()));
147 if(!jarrayOut&&fAODExtension){
148 jarrayOut = (TClonesArray*)(fAODExtension->GetAOD()->FindListObject(newName.Data()));
153 Printf("%s:%d Output jet branch %s not found",(char*)__FILE__,__LINE__,newName.Data());
158 if(jarrayOut&&jarray){
159 fOutJetArrayList->Add(jarrayOut);
160 fInJetArrayList->Add(jarray);
166 void AliAnalysisTaskJetBackgroundSubtract::UserCreateOutputObjects()
170 // Create the output container
174 if (fDebug > 1) printf("AnalysisTaskJetBackgroundSubtract::UserCreateOutputObjects() \n");
178 if(fNonStdFile.Length()!=0){
180 // case that we have an AOD extension we need to fetch the jets from the extended output
181 // we identifay the extension aod event by looking for the branchname
182 AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
184 fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);
187 if(fDebug>1)Printf("AODExtension found for %s",fNonStdFile.Data());
190 fAODOut = AODEvent();
192 // usually we do not have the input already here
194 if(!fInJetArrayList)fInJetArrayList =new TList();
195 if(!fOutJetArrayList)fOutJetArrayList =new TList();
197 for(int iJB = 0;iJB<fJBArray->GetEntries();iJB++){
198 TObjString *ostr = (TObjString*)fJBArray->At(iJB);
199 TString newName(ostr->GetString().Data());
200 if(!newName.Contains(fReplaceString1.Data())){
201 Printf("%s:%d cannot replace string %s in %s",(char*)__FILE__,__LINE__,fReplaceString1.Data(),
206 // add a new branch to the output for the background subtracted jets take the names from
207 // the input jets and replace the background flag names
208 TClonesArray *tca = new TClonesArray("AliAODJet", 0);
209 newName.ReplaceAll(fReplaceString1.Data(),Form(fReplaceString2.Data(),fSubtraction));
211 Printf("%s:%d created branch \n %s from \n %s",(char*)__FILE__,__LINE__,newName.Data(),
212 ostr->GetString().Data());
214 tca->SetName(newName.Data());
215 AddAODBranch("TClonesArray",&tca,fNonStdFile.Data());
219 if(!fHistList)fHistList = new TList();
220 fHistList->SetOwner();
221 PostData(1, fHistList); // post data in any case once
223 for(int iJB = 0;iJB<fJBArray->GetEntries();iJB++){
224 TObjString *ostr = (TObjString*)fJBArray->At(iJB);
225 TString oldName(ostr->GetString().Data());
226 TString newName(ostr->GetString().Data());
227 if(!newName.Contains(fReplaceString1.Data())){
228 Printf("%s:%d cannot replace string %s in %s",(char*)__FILE__,__LINE__,fReplaceString1.Data(),
232 newName.ReplaceAll(fReplaceString1.Data(),Form(fReplaceString2.Data(),fSubtraction));
233 TH2F *hTmp = new TH2F(Form("h2PtInPtOut_%d",iJB),Form(";%s p_{T}; %s p_{T}",oldName.Data(),newName.Data()),200,0,200.,400,-200.,200.);
234 fHistList->Add(hTmp);
237 Bool_t oldStatus = TH1::AddDirectoryStatus();
238 TH1::AddDirectory(kFALSE);
241 // Histogram booking, add som control histograms here
245 fh2CentvsRho = new TH2F("fh2CentvsRho","centrality vs background density",100,0.,100.,2000,0.,200.);
246 fh2CentvsSigma = new TH2F("fh2CentvsSigma","centrality vs backgroun sigma",100,0.,100.,1000,0.,50.);
247 fHistList->Add(fh2CentvsRho);
248 fHistList->Add(fh2CentvsSigma);
250 fh2MultvsRho = new TH2F("fh2MultvsRho","mult vs background density",4000,0.,4000.,2000,0.,200.);
251 fh2MultvsSigma = new TH2F("fh2MultvsSigma","mult vs backgroun sigma",4000,0.,4000.,1000,0.,50.);
252 fHistList->Add(fh2MultvsRho);
253 fHistList->Add(fh2MultvsSigma);
255 if(fSubtraction==k4Area){
256 fh2ShiftEta = new TH2F("fh2ShiftEta","extended correction Eta",100,-0.9,0.9,100,-0.9,0.9);
257 fh2ShiftPhi = new TH2F("fh2ShiftPhi","extended correction Phi",100,0.,6.5,100,0.,6.5);
258 fh2ShiftEtaLeading = new TH2F("fh2ShiftEtaLeading","extended correction Eta",100,-0.9,0.9,100,-0.9,0.9);
259 fh2ShiftPhiLeading = new TH2F("fh2ShiftPhiLeading","extended correction Phi",100,0.,6.5,100,0.,6.5);
260 fHistList->Add(fh2ShiftEta);
261 fHistList->Add(fh2ShiftPhi);
262 fHistList->Add(fh2ShiftEtaLeading);
263 fHistList->Add(fh2ShiftPhiLeading);
267 // =========== Switch on Sumw2 for all histos ===========
268 for (Int_t i=0; i<fHistList->GetEntries(); ++i) {
269 TH1 *h1 = dynamic_cast<TH1*>(fHistList->At(i));
274 THnSparse *hn = dynamic_cast<THnSparse*>(fHistList->At(i));
277 TH1::AddDirectory(oldStatus);
279 if(fBackgroundBranch.Length()==0)
280 AliError(Form("%s:%d No BackgroundBranch defined",(char*)__FILE__,__LINE__));
281 if(fJBArray->GetEntries()==0)
282 AliError(Form("%s:%d No Jet Branches defined defined",(char*)__FILE__,__LINE__));
285 void AliAnalysisTaskJetBackgroundSubtract::Init()
290 if (fDebug > 1) printf("AnalysisTaskJetBackgroundSubtract::Init() \n");
293 void AliAnalysisTaskJetBackgroundSubtract::UserExec(Option_t */*option*/)
296 if (fDebug > 1) printf("AnalysisTaskJetBackgroundSubtract::UserExec() \n");
298 if(fBackgroundBranch.Length()==0||fJBArray->GetEntries()==0){
299 if(fDebug)Printf("%s:%d No background subtraction done",(char*)__FILE__,__LINE__);
300 PostData(1,fHistList);
302 if(fJBArray->GetEntries()!=fInJetArrayList->GetEntries()){
303 if(fDebug)Printf("%s:%d different Array sizes %d %d %d",(char*)__FILE__,__LINE__,fJBArray->GetEntries(),fInJetArrayList->GetEntries(),fOutJetArrayList->GetEntries());
304 PostData(1,fHistList);
309 AliAODJetEventBackground* evBkg = 0;
310 TClonesArray* bkgClusters = 0;
311 TClonesArray* bkgClustersRC = 0;
312 TString bkgClusterName(fBackgroundBranch.Data());
313 bkgClusterName.ReplaceAll(Form("%s_",AliAODJetEventBackground::StdBranchName()),"");
314 TString bkgClusterRCName(Form("%s%s",bkgClusterName.Data(),"RandomCone"));
316 if(!evBkg&&!bkgClusters&&!bkgClustersRC&&fAODOut){
317 evBkg = (AliAODJetEventBackground*)(fAODOut->FindListObject(fBackgroundBranch.Data()));
318 bkgClusters = (TClonesArray*)(fAODOut->FindListObject(bkgClusterName.Data()));
319 bkgClustersRC = (TClonesArray*)(fAODOut->FindListObject(bkgClusterRCName.Data()));
321 if(fDebug&&bkgClusters)Printf("%s:%d Background cluster branch %s found",(char*)__FILE__,__LINE__,bkgClusterName.Data());
322 if(fDebug&&bkgClustersRC)Printf("%s:%d Background cluster RC branch %s found",(char*)__FILE__,__LINE__,bkgClusterRCName.Data());
323 if(fDebug&&evBkg)Printf("%s:%d Backgroundbranch %s found",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());
325 if(!evBkg&&!bkgClusters&&!bkgClustersRC&&fAODExtension){
326 evBkg = (AliAODJetEventBackground*)(fAODExtension->GetAOD()->FindListObject(fBackgroundBranch.Data()));
327 bkgClusters = (TClonesArray*)(fAODExtension->GetAOD()->FindListObject(bkgClusterName.Data()));
328 bkgClustersRC = (TClonesArray*)(fAODExtension->GetAOD()->FindListObject(bkgClusterRCName.Data()));
329 if(fDebug&&bkgClusters)Printf("%s:%d Background cluster branch %s found",(char*)__FILE__,__LINE__,bkgClusterName.Data());
330 if(fDebug&&bkgClustersRC)Printf("%s:%d Background cluster RC branch %s found",(char*)__FILE__,__LINE__,bkgClusterRCName.Data());
332 if(fDebug&&evBkg)Printf("%s:%d Backgroundbranch %s found",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());
335 if(!evBkg&&!bkgClusters&&!bkgClustersRC&&fAODIn){
336 evBkg = (AliAODJetEventBackground*)(fAODIn->FindListObject(fBackgroundBranch.Data()));
337 bkgClusters = (TClonesArray*)(fAODIn->FindListObject(bkgClusterName.Data()));
338 bkgClustersRC = (TClonesArray*)(fAODIn->FindListObject(bkgClusterRCName.Data()));
340 if(fDebug&&bkgClusters)Printf("%s:%d Background cluster branch %s found",(char*)__FILE__,__LINE__,bkgClusterName.Data());
341 if(fDebug&&bkgClustersRC)Printf("%s:%d Background cluster RC branch %s found",(char*)__FILE__,__LINE__,bkgClusterRCName.Data());
342 if(fDebug&&evBkg)Printf("%s:%d Backgroundbranch %s found",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());
345 if(!evBkg&&(fSubtraction==kArea||fSubtraction==kRhoRecalc||fSubtraction==k4Area)){
347 Printf("%s:%d Backgroundbranch %s not found",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());
350 PostData(1,fHistList);
354 if(!bkgClusters&&(fSubtraction==kRhoRecalc)){
356 Printf("%s:%d Background cluster branch %s not found",(char*)__FILE__,__LINE__,bkgClusterName.Data());
359 PostData(1,fHistList);
363 if(!bkgClustersRC&&(fSubtraction==kRhoRC)){
365 Printf("%s:%d Background cluster RC branch %s not found",(char*)__FILE__,__LINE__,bkgClusterRCName.Data());
368 PostData(1,fHistList);
371 // LOOP over all jet branches and subtract the background
375 Double_t meanarea = 0;
376 TLorentzVector backgroundv;
379 if(fAODOut)cent = fAODOut->GetHeader()->GetCentrality();
380 if(evBkg)sigma=evBkg->GetSigma(1);
382 if(fSubtraction==kArea) rho = evBkg->GetBackground(1);
383 if(fSubtraction==k4Area){
384 rho = evBkg->GetBackground(0);
385 sigma=evBkg->GetSigma(0);
388 if(fSubtraction==kRhoRecalc){
389 meanarea=evBkg->GetMeanarea(1);
390 rho =RecalcRho(bkgClusters,meanarea);
392 if(fSubtraction==kRhoRC) rho=RhoRC(bkgClustersRC);
395 for(int iJB = 0;iJB<fInJetArrayList->GetEntries();iJB++){
396 TClonesArray* jarray = (TClonesArray*)fInJetArrayList->At(iJB);
398 TString tmp(jarray->GetName());
399 if(tmp.Contains("cluster")){
400 mult = MultFromJetRefs(jarray);
406 fh2CentvsRho->Fill(cent,rho);
407 fh2CentvsSigma->Fill(cent,sigma);
409 fh2MultvsRho->Fill(mult,rho);
410 fh2MultvsSigma->Fill(mult,sigma);
412 for(int iJB = 0;iJB<fInJetArrayList->GetEntries();iJB++){
413 TClonesArray* jarray = (TClonesArray*)fInJetArrayList->At(iJB);
414 TClonesArray* jarrayOut = (TClonesArray*)fOutJetArrayList->At(iJB);
416 if(!jarray||!jarrayOut){
417 Printf("%s:%d Array not found %d: %p %p",(char*)__FILE__,__LINE__,iJB,jarray,jarrayOut);
420 TH2F* h2PtInOut = (TH2F*)fHistList->FindObject(Form("h2PtInPtOut_%d",iJB));
421 // loop over all jets
425 for(int i = 0;i < jarray->GetEntriesFast();i++){
426 AliAODJet *jet = (AliAODJet*)jarray->At(i);
427 AliAODJet tmpNewJet(*jet);
431 if(fSubtraction==kArea){
432 Double_t background = rho * jet->EffectiveAreaCharged();
433 Float_t ptSub = jet->Pt() - background;
435 Printf("%s:%d Jet %d %3.3f %3.3f",(char*)__FILE__,__LINE__,i,jet->Pt(),ptSub);
438 // optionally rescale it and keep??
439 bAdd = false; // RescaleJetMomentum(&tmpNewJet,0.1);
440 if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
443 bAdd = RescaleJetMomentum(&tmpNewJet,ptSub);
444 if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
446 // add background estimates to the new jet object
447 // allows to recover old p_T and rho...
448 tmpNewJet.SetBgEnergy(background,0);
450 else if(fSubtraction==kRhoRecalc){
451 Double_t background = rho * jet->EffectiveAreaCharged();
452 Float_t ptSub = jet->Pt() - background;
454 Printf("%s:%d Jet %d %3.3f %3.3f %3.3f %3.3f",(char*)__FILE__,__LINE__,i,jet->Pt(),ptSub,background,rho);}
456 // optionally rescale it and keep??
457 bAdd = false;// RescaleJetMomentum(&tmpNewJet,0.1);
458 if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
461 bAdd = RescaleJetMomentum(&tmpNewJet,ptSub);
462 if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
464 // add background estimates to the new jet object
465 // allows to recover old p_T and rho...
466 tmpNewJet.SetBgEnergy(background,0);
469 else if(fSubtraction==kRhoRC){
470 Double_t background = rho * jet->EffectiveAreaCharged();
471 Float_t ptSub = jet->Pt() - background;
472 if(fDebug>2){ Printf("%s:%d Jet %d %3.3f %3.3f %3.3f %3.3f",(char*)__FILE__,__LINE__,i,jet->Pt(),ptSub,background,rho);}
474 // optionally rescale it and keep??
475 bAdd = false; // RescaleJetMomentum(&tmpNewJet,0.1);
476 if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
479 bAdd = RescaleJetMomentum(&tmpNewJet,ptSub);
480 if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),ptSub);
482 // add background estimates to the new jet object
483 // allows to recover old p_T and rho...
484 tmpNewJet.SetBgEnergy(background,0);
488 else if(fSubtraction==k4Area&&jet->VectorAreaCharged()){
491 backgroundv.SetPxPyPzE(rho*(jet->VectorAreaCharged())->Px(),rho*(jet->VectorAreaCharged())->Py(),rho*(jet->VectorAreaCharged())->Pz(),rho*(jet->VectorAreaCharged())->E());
492 if((backgroundv.E()>jet->E())&&(backgroundv.Pt()>jet->Pt())){
494 // optionally rescale it and keep??
495 bAdd = false; // RescaleJetMomentum(&tmpNewJet,0.1);
496 if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),jet->Pt()-backgroundv.Pt());
499 bAdd = RescaleJet4vector(&tmpNewJet,backgroundv);
501 // add background estimates to the new jet object
502 // allows to recover old p_T and rho...
503 tmpNewJet.SetBgEnergy(backgroundv.P(),0);
513 AliAODJet *newJet = new ((*jarrayOut)[nOut++]) AliAODJet(tmpNewJet);
514 // what about track references, clear for now...
515 if(fSubtraction==k4Area){
516 if(h2PtInOut)h2PtInOut->Fill(jet->Pt(),jet->Pt()-newJet->Pt());
517 fh2ShiftEta->Fill(jet->Eta(),newJet->Eta());
518 fh2ShiftPhi->Fill(jet->Phi(),newJet->Phi());
519 if(i==0){fh2ShiftEtaLeading->Fill(jet->Eta(),newJet->Eta());
520 fh2ShiftPhiLeading->Fill(jet->Phi(),newJet->Phi());}}
522 // set the references
523 newJet->GetRefTracks()->Clear();
524 TRefArray *refs = jet->GetRefTracks();
525 for(Int_t ir=0;ir<refs->GetEntriesFast();ir++){
526 AliVParticle *vp = dynamic_cast<AliVParticle*>(refs->At(ir));
527 if(vp)newJet->AddTrack(vp);
531 if(jarrayOut)jarrayOut->Sort();
534 PostData(1, fHistList);
537 void AliAnalysisTaskJetBackgroundSubtract::Terminate(Option_t */*option*/)
539 // Terminate analysis
541 if (fDebug > 1) printf("AnalysisJetBackgroundSubtract: Terminate() \n");
544 Bool_t AliAnalysisTaskJetBackgroundSubtract::RescaleJetMomentum(AliAODJet *jet,Float_t pT){
545 // keep the direction and the jet mass
546 if(pT<=0)return kFALSE;
547 Double_t pTold = jet->Pt();
548 Double_t scale = pT/pTold;
549 Double_t mass = jet->M();
550 Double_t pNew = jet->P() * scale;
551 jet->SetPxPyPzE(scale*jet->Px(),scale*jet->Py(),scale*jet->Pz(),TMath::Sqrt(mass*mass+pNew*pNew));
558 Bool_t AliAnalysisTaskJetBackgroundSubtract::RescaleJet4vector(AliAODJet *jet,TLorentzVector backgroundv){
560 if(backgroundv.Pt()<0.) return kFALSE;
561 jet->SetPxPyPzE(jet->Px()-backgroundv.Px(),jet->Py()-backgroundv.Py(),jet->Pz()-backgroundv.Pz(),jet->E()-backgroundv.E());
573 Double_t AliAnalysisTaskJetBackgroundSubtract::RecalcRho(TClonesArray* bkgClusters,Double_t meanarea){
578 const Double_t Rlimit2=0.8*0.8; //2*jet radius.
579 TClonesArray* jarray=0;
581 for(int iJB = 0;iJB<fInJetArrayList->GetEntries();iJB++){
582 TObjString *ostr = (TObjString*)fInJetArrayList->At(iJB);
583 TString jetref=ostr->GetString().Data();
584 if(jetref.Contains("ANTIKT04")){
585 jarray = (TClonesArray*)fInJetArrayList->At(iJB);
588 if(!jarray)return rho;
589 if(jarray->GetEntries()>=2){
590 AliAODJet *first = (AliAODJet*)(jarray->At(0));
591 AliAODJet *second= (AliAODJet*)(jarray->At(1));
592 for(Int_t k=0;k<bkgClusters->GetEntriesFast();k++){
593 AliAODJet *clus = (AliAODJet*)(bkgClusters->At(k));
594 if(TMath::Abs(clus->Eta())>0.5) continue;
595 if((clus->EffectiveAreaCharged())<0.1*meanarea) continue;
596 Double_t distance1=(first->Eta()-clus->Eta())*(first->Eta()-clus->Eta())+
597 (first->Phi()-clus->Phi())*(first->Phi()-clus->Phi());
598 Double_t distance2= (second->Eta()-clus->Eta())*(second->Eta()-clus->Eta())+
599 (second->Phi()-clus->Phi())*(second->Phi()-clus->Phi());
600 if((distance1<Rlimit2)||(distance2<Rlimit2)) continue;
601 ptarea=ptarea+clus->Pt()/clus->EffectiveAreaCharged();
603 if(count!=0) rho=ptarea/count;
608 Double_t AliAnalysisTaskJetBackgroundSubtract::RhoRC(TClonesArray* bkgClustersRC){
613 const Double_t Rlimit2=0.8*0.8; //2*jet radius.
614 TClonesArray* jarray=0;
615 for(int iJB = 0;iJB<fInJetArrayList->GetEntries();iJB++){
616 TObjString *ostr = (TObjString*)fInJetArrayList->At(iJB);
617 TString jetref=ostr->GetString().Data();
618 if(jetref.Contains("ANTIKT04")){
619 jarray = (TClonesArray*)fInJetArrayList->At(iJB);
622 if(!jarray)return rho;
624 if(jarray->GetEntries()>=2){
625 AliAODJet *first = (AliAODJet*)(jarray->At(0));
626 AliAODJet *second=(AliAODJet*)(jarray->At(1));
627 for(Int_t k=0;k<bkgClustersRC->GetEntriesFast();k++){
628 AliAODJet *clus = (AliAODJet*)(bkgClustersRC->At(k));
629 if(TMath::Abs(clus->Eta())>0.5) continue;
630 Double_t distance1=(first->Eta()-clus->Eta())*(first->Eta()-clus->Eta())+
631 (first->Phi()-clus->Phi())*(first->Phi()-clus->Phi());
632 Double_t distance2= (second->Eta()-clus->Eta())*(second->Eta()-clus->Eta())+
633 (second->Phi()-clus->Phi())*(second->Phi()-clus->Phi());
634 if((distance1<Rlimit2)||(distance2<Rlimit2)) continue;
635 ptarea=ptarea+clus->Pt()/clus->EffectiveAreaCharged();
637 if(count!=0) rho=ptarea/count; }
649 void AliAnalysisTaskJetBackgroundSubtract::ResetOutJets(){
650 if(!fOutJetArrayList)return;
651 for(int iJB = 0;iJB<fOutJetArrayList->GetEntries();iJB++){
652 TClonesArray* jarray = (TClonesArray*)fOutJetArrayList->At(iJB);
653 if(jarray)jarray->Delete();
658 void AliAnalysisTaskJetBackgroundSubtract::PrintAODContents(){
660 Printf("%s:%d >>>>>> Input",(char*)__FILE__,__LINE__);
664 Printf("%s:%d >>>>>> Extenstion",(char*)__FILE__,__LINE__);
665 fAODExtension->GetAOD()->Print();
668 Printf("%s:%d >>>>>> Output",(char*)__FILE__,__LINE__);
673 Int_t AliAnalysisTaskJetBackgroundSubtract::MultFromJetRefs(TClonesArray* jets){
677 for(int ij = 0;ij < jets->GetEntries();++ij){
678 AliAODJet* jet = (AliAODJet*)jets->At(ij);
680 TRefArray *refs = jet->GetRefTracks();
682 refMult += refs->GetEntries();