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"
37 #include "AliAnalysisTask.h"
38 #include "AliAnalysisManager.h"
40 #include "AliVEvent.h"
41 #include "AliESDEvent.h"
42 #include "AliESDInputHandler.h"
43 #include "AliCentrality.h"
44 #include "AliAnalysisHelperJetTasks.h"
45 #include "AliInputEventHandler.h"
46 #include "AliAODJetEventBackground.h"
47 #include "AliAODMCParticle.h"
48 #include "AliAnalysisTaskFastEmbedding.h"
49 #include "AliAODEvent.h"
50 #include "AliAODHandler.h"
51 #include "AliAODJet.h"
53 #include "AliAnalysisTaskJetCore.h"
58 ClassImp(AliAnalysisTaskJetCore)
60 AliAnalysisTaskJetCore::AliAnalysisTaskJetCore() :
66 fBackgroundBranch(""),
69 fOfflineTrgMask(AliVEvent::kAny),
85 fApplySharedClusterCut(0),
86 fAngStructCloseTracks(0),
101 fTrackTypeRec(kTrackUndef),
114 fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
115 fJetPtFractionMin(0.5),
119 fRunAnaAzimuthalCorrelation(kFALSE),
124 fHistEvtSelection(0x0),
127 fh2JetCoreMethod1C10(0x0),
128 fh2JetCoreMethod2C10(0x0),
129 fh2JetCoreMethod1C20(0x0),
130 fh2JetCoreMethod2C20(0x0),
131 fh2JetCoreMethod1C30(0x0),
132 fh2JetCoreMethod2C30(0x0),
133 fh2JetCoreMethod1C60(0x0),
134 fh2JetCoreMethod2C60(0x0),
135 fh3JetTrackC3060(0x0),
137 fh2AngStructpt1C10(0x0),
138 fh2AngStructpt2C10(0x0),
139 fh2AngStructpt3C10(0x0),
140 fh2AngStructpt4C10(0x0),
141 fh2AngStructpt1C20(0x0),
142 fh2AngStructpt2C20(0x0),
143 fh2AngStructpt3C20(0x0),
144 fh2AngStructpt4C20(0x0),
145 fh2AngStructpt1C30(0x0),
146 fh2AngStructpt2C30(0x0),
147 fh2AngStructpt3C30(0x0),
148 fh2AngStructpt4C30(0x0),
149 fh2AngStructpt1C60(0x0),
150 fh2AngStructpt2C60(0x0),
151 fh2AngStructpt3C60(0x0),
152 fh2AngStructpt4C60(0x0),
156 fh2Ntriggers2C10(0x0),
157 fh2Ntriggers2C20(0x0),
159 fh3JetDensityA4(0x0),
170 // default Constructor
174 for(Int_t i=0; i<10; i++) {
175 for(Int_t j=0; j<6; j++) {
184 fJetBranchName[0] = "";
185 fJetBranchName[1] = "";
187 fListJets[0] = new TList;
188 fListJets[1] = new TList;
191 AliAnalysisTaskJetCore::AliAnalysisTaskJetCore(const char *name) :
192 AliAnalysisTaskSE(name),
197 fBackgroundBranch(""),
200 fOfflineTrgMask(AliVEvent::kAny),
207 fFilterMaskBestPt(0),
214 fNInputTracksMax(-1),
216 fApplySharedClusterCut(0),
217 fAngStructCloseTracks(0),
232 fTrackTypeRec(kTrackUndef),
245 fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
246 fJetPtFractionMin(0.5),
250 fRunAnaAzimuthalCorrelation(kFALSE),
255 fHistEvtSelection(0x0),
258 fh2JetCoreMethod1C10(0x0),
259 fh2JetCoreMethod2C10(0x0),
260 fh2JetCoreMethod1C20(0x0),
261 fh2JetCoreMethod2C20(0x0),
262 fh2JetCoreMethod1C30(0x0),
263 fh2JetCoreMethod2C30(0x0),
264 fh2JetCoreMethod1C60(0x0),
265 fh2JetCoreMethod2C60(0x0),
266 fh3JetTrackC3060(0x0),
268 fh2AngStructpt1C10(0x0),
269 fh2AngStructpt2C10(0x0),
270 fh2AngStructpt3C10(0x0),
271 fh2AngStructpt4C10(0x0),
272 fh2AngStructpt1C20(0x0),
273 fh2AngStructpt2C20(0x0),
274 fh2AngStructpt3C20(0x0),
275 fh2AngStructpt4C20(0x0),
276 fh2AngStructpt1C30(0x0),
277 fh2AngStructpt2C30(0x0),
278 fh2AngStructpt3C30(0x0),
279 fh2AngStructpt4C30(0x0),
280 fh2AngStructpt1C60(0x0),
281 fh2AngStructpt2C60(0x0),
282 fh2AngStructpt3C60(0x0),
283 fh2AngStructpt4C60(0x0),
287 fh2Ntriggers2C10(0x0),
288 fh2Ntriggers2C20(0x0),
290 fh3JetDensityA4(0x0),
304 for(Int_t i=0; i<10; i++) {
305 for(Int_t j=0; j<6; j++) {
312 fJetBranchName[0] = "";
313 fJetBranchName[1] = "";
315 fListJets[0] = new TList;
316 fListJets[1] = new TList;
318 DefineOutput(1, TList::Class());
321 AliAnalysisTaskJetCore::~AliAnalysisTaskJetCore()
327 void AliAnalysisTaskJetCore::SetBranchNames(const TString &branch1, const TString &branch2)
329 fJetBranchName[0] = branch1;
330 fJetBranchName[1] = branch2;
333 void AliAnalysisTaskJetCore::Init()
336 // check for jet branches
337 if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){
338 AliError("Jet branch name not set.");
343 void AliAnalysisTaskJetCore::UserCreateOutputObjects()
348 if(!fOutputList) fOutputList = new TList;
349 fOutputList->SetOwner(kTRUE);
351 Bool_t oldStatus = TH1::AddDirectoryStatus();
352 TH1::AddDirectory(kFALSE);
356 fRandom = new TRandom3(0);
361 fHistEvtSelection = new TH1I("fHistEvtSelection", "event selection", 6, -0.5, 5.5);
362 fHistEvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
363 fHistEvtSelection->GetXaxis()->SetBinLabel(2,"events IN");
364 fHistEvtSelection->GetXaxis()->SetBinLabel(3,"event selection (rejected)");
365 fHistEvtSelection->GetXaxis()->SetBinLabel(4,"vertex cut (rejected)");
366 fHistEvtSelection->GetXaxis()->SetBinLabel(5,"centrality (rejected)");
367 fHistEvtSelection->GetXaxis()->SetBinLabel(6,"multiplicity (rejected)");
369 UInt_t entries = 0; // bit coded, see GetDimParams() below
370 entries = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 |1<<7;
371 fhnDeltaR = NewTHnSparseF("fhnDeltaR", entries);
373 //change binning in pTtrack
374 Double_t *xPt3 = new Double_t[10];
376 for(int i = 1; i<=9;i++){
377 if(xPt3[i-1]<2)xPt3[i] = xPt3[i-1] + 0.4; // 1 - 5
378 else if(xPt3[i-1]<11)xPt3[i] = xPt3[i-1] + 3; // 5 - 12
379 else xPt3[i] = xPt3[i-1] + 150.; // 18
381 fhnDeltaR->SetBinEdges(2,xPt3);
384 //change binning in HTI
385 Double_t *xPt4 = new Double_t[14];
387 for(int i = 1; i<=13;i++){
388 if(xPt4[i-1]<10)xPt4[i] = xPt4[i-1] + 1; // 1 - 10
389 else if(xPt4[i-1]<20)xPt4[i] = xPt4[i-1] + 5; // 10 - 12
390 else xPt4[i] = xPt4[i-1] + 30.; // 13
392 fhnDeltaR->SetBinEdges(6,xPt4);
402 UInt_t cifras = 0; // bit coded, see GetDimParams() below
403 cifras = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<7;
404 fhnMixedEvents = NewTHnSparseF("fhnMixedEvents", cifras);}
407 fh2JetCoreMethod1C10 = new TH2F("JetCoreMethod1C10","",150, 0., 150.,100, 0., 1.5);
408 fh2JetCoreMethod2C10 = new TH2F("JetCoreMethod2C10","",150, 0., 150.,100, 0., 1.5);
409 fh2JetCoreMethod1C20 = new TH2F("JetCoreMethod1C20","",150, 0., 150.,100, 0., 1.5);
410 fh2JetCoreMethod2C20 = new TH2F("JetCoreMethod2C20","",150, 0., 150.,100, 0., 1.5);
411 fh2JetCoreMethod1C30 = new TH2F("JetCoreMethod1C30","",150, 0., 150.,100, 0., 1.5);
412 fh2JetCoreMethod2C30 = new TH2F("JetCoreMethod2C30","",150, 0., 150.,100, 0., 1.5);
413 fh2JetCoreMethod1C60 = new TH2F("JetCoreMethod1C60","",150, 0., 150.,100, 0., 1.5);
414 fh2JetCoreMethod2C60 = new TH2F("JetCoreMethod2C60","",150, 0., 150.,100, 0., 1.5);}
416 fh3JetTrackC3060=new TH3F("JetTrackC3060","",50,0,50,150,0.,150.,35,0.,3.5);
417 fh3JetTrackC20=new TH3F("JetTrackC20","",50,0,50,150,0.,150.,35,0.,3.5);
418 if(fAngStructCloseTracks>0){
419 fh2AngStructpt1C10 = new TH2F("Ang struct pt1 C10","",15,0.,1.5,150,0.,10.);
420 fh2AngStructpt2C10 = new TH2F("Ang struct pt2 C10","",15,0.,1.5,150,0.,10.);
421 fh2AngStructpt3C10 = new TH2F("Ang struct pt3 C10","",15,0.,1.5,150,0.,10.);
422 fh2AngStructpt4C10 = new TH2F("Ang struct pt4 C10","",15,0.,1.5,150,0.,10.);
423 fh2AngStructpt1C20 = new TH2F("Ang struct pt1 C20","",15,0.,1.5,150,0.,10.);
424 fh2AngStructpt2C20 = new TH2F("Ang struct pt2 C20","",15,0.,1.5,150,0.,10.);
425 fh2AngStructpt3C20 = new TH2F("Ang struct pt3 C20","",15,0.,1.5,150,0.,10.);
426 fh2AngStructpt4C20 = new TH2F("Ang struct pt4 C20","",15,0.,1.5,150,0.,10.);
427 fh2AngStructpt1C30 = new TH2F("Ang struct pt1 C30","",15,0.,1.5,150,0.,10.);
428 fh2AngStructpt2C30 = new TH2F("Ang struct pt2 C30","",15,0.,1.5,150,0.,10.);
429 fh2AngStructpt3C30 = new TH2F("Ang struct pt3 C30","",15,0.,1.5,150,0.,10.);
430 fh2AngStructpt4C30 = new TH2F("Ang struct pt4 C30","",15,0.,1.5,150,0.,10.);
431 fh2AngStructpt1C60 = new TH2F("Ang struct pt1 C60","",15,0.,1.5,150,0.,10.);
432 fh2AngStructpt2C60 = new TH2F("Ang struct pt2 C60","",15,0.,1.5,150,0.,10.);
433 fh2AngStructpt3C60 = new TH2F("Ang struct pt3 C60","",15,0.,1.5,150,0.,10.);
434 fh2AngStructpt4C60 = new TH2F("Ang struct pt4 C60","",15,0.,1.5,150,0.,10.); }
437 fh1TrigRef=new TH1D("Trig Ref","",10,0.,10);
438 fh1TrigSig=new TH1D("Trig Sig","",10,0.,10);
439 fh2Ntriggers=new TH2F("# of triggers","",100,0.,100.,50,0.,50.);
440 fh2Ntriggers2C10=new TH2F("# of triggers2C10","",50,0.,50.,50,0.,50.);
441 fh2Ntriggers2C20=new TH2F("# of triggers2C20","",50,0.,50.,50,0.,50.);
442 fh3JetDensity=new TH3F("Jet density vs mutliplicity A>0.07","",100,0.,4000.,100,0.,5.,25,0.,50.);
443 fh3JetDensityA4=new TH3F("Jet density vs multiplicity A>0.4","",100,0.,4000.,100,0.,5.,25,0.,50.);
444 fh2RPJetsC10=new TH2F("RPJetC10","",35,0.,3.5,100,0.,100.);
445 fh2RPJetsC20=new TH2F("RPJetC20","",35,0.,3.5,100,0.,100.);
446 fh2RPTC10=new TH2F("RPTriggerC10","",35,0.,3.5,50,0.,50.);
447 fh2RPTC20=new TH2F("RPTriggerC20","",35,0.,3.5,50,0.,50.);
452 fOutputList->Add(fHistEvtSelection);
454 fOutputList->Add(fhnDeltaR);
456 fOutputList->Add(fhnMixedEvents);
462 fOutputList->Add(fh2JetCoreMethod1C10);
463 fOutputList->Add(fh2JetCoreMethod2C10);
464 fOutputList->Add(fh2JetCoreMethod1C20);
465 fOutputList->Add(fh2JetCoreMethod2C20);
466 fOutputList->Add(fh2JetCoreMethod1C30);
467 fOutputList->Add(fh2JetCoreMethod2C30);
468 fOutputList->Add(fh2JetCoreMethod1C60);
469 fOutputList->Add(fh2JetCoreMethod2C60);}
471 fOutputList->Add(fh3JetTrackC3060);
472 fOutputList->Add(fh3JetTrackC20);
478 if(fAngStructCloseTracks>0){
479 fOutputList->Add(fh2AngStructpt1C10);
480 fOutputList->Add(fh2AngStructpt2C10);
481 fOutputList->Add(fh2AngStructpt3C10);
482 fOutputList->Add(fh2AngStructpt4C10);
483 fOutputList->Add(fh2AngStructpt1C20);
484 fOutputList->Add(fh2AngStructpt2C20);
485 fOutputList->Add(fh2AngStructpt3C20);
486 fOutputList->Add(fh2AngStructpt4C20);
487 fOutputList->Add(fh2AngStructpt1C30);
488 fOutputList->Add(fh2AngStructpt2C30);
489 fOutputList->Add(fh2AngStructpt3C30);
490 fOutputList->Add(fh2AngStructpt4C30);
491 fOutputList->Add(fh2AngStructpt1C60);
492 fOutputList->Add(fh2AngStructpt2C60);
493 fOutputList->Add(fh2AngStructpt3C60);
494 fOutputList->Add(fh2AngStructpt4C60);}
499 fOutputList->Add(fh1TrigRef);
500 fOutputList->Add(fh1TrigSig);
501 fOutputList->Add(fh2Ntriggers);
502 fOutputList->Add(fh2Ntriggers2C10);
503 fOutputList->Add(fh2Ntriggers2C20);
504 fOutputList->Add(fh3JetDensity);
505 fOutputList->Add(fh3JetDensityA4);
506 fOutputList->Add(fh2RPJetsC10);
507 fOutputList->Add(fh2RPJetsC20);
508 fOutputList->Add(fh2RPTC10);
509 fOutputList->Add(fh2RPTC20);
511 const Int_t dimSpec = 5;
512 const Int_t nBinsSpec[dimSpec] = {100,6, 140, 50, fNRPBins};
513 const Double_t lowBinSpec[dimSpec] = {0,0,-80, 0, 0};
514 const Double_t hiBinSpec[dimSpec] = {100,1, 200, 50, fNRPBins};
515 fHJetSpec = new THnSparseF("fHJetSpec","Recoil jet spectrum",dimSpec,nBinsSpec,lowBinSpec,hiBinSpec);
517 //change binning in jet area
518 Double_t *xPt6 = new Double_t[7];
526 fHJetSpec->SetBinEdges(1,xPt6);
533 fOutputList->Add(fHJetSpec);
536 if(fRunAnaAzimuthalCorrelation)
538 fhTTPt = new TH2F("fhTTPt","Trigger track p_{T} vs centrality",10,0,100,100,0,100);
539 fOutputList->Add(fhTTPt);
541 const Int_t dimCor = 5;
542 const Int_t nBinsCor[dimCor] = {50, 200, 100, 8, 10};
543 const Double_t lowBinCor[dimCor] = {0, -50, -0.5*TMath::Pi(), 0, 0};
544 const Double_t hiBinCor[dimCor] = {50, 150, 1.5*TMath::Pi(), 0.8, 100};
545 fHJetPhiCorr = new THnSparseF("fHJetPhiCorr","TT p_{T} vs jet p_{T} vs dPhi vs area vs centrality",dimCor,nBinsCor,lowBinCor,hiBinCor);
546 fOutputList->Add(fHJetPhiCorr);
552 // =========== Switch on Sumw2 for all histos ===========
553 for (Int_t i=0; i<fOutputList->GetEntries(); ++i) {
554 TH1 *h1 = dynamic_cast<TH1*>(fOutputList->At(i));
559 THnSparse *hn = dynamic_cast<THnSparse*>(fOutputList->At(i));
564 TH1::AddDirectory(oldStatus);
566 PostData(1, fOutputList);
569 void AliAnalysisTaskJetCore::UserExec(Option_t *)
573 if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){
574 AliError("Jet branch name not set.");
578 fESD=dynamic_cast<AliESDEvent*>(InputEvent());
580 AliError("ESD not available");
581 fAODIn = dynamic_cast<AliAODEvent*>(InputEvent());
583 fAODOut = dynamic_cast<AliAODEvent*>(AODEvent());
585 static AliAODEvent* aod = 0;
586 // take all other information from the aod we take the tracks from
588 if(!fESD)aod = fAODIn;
593 if(fNonStdFile.Length()!=0){
594 // case that we have an AOD extension we need can fetch the jets from the extended output
595 AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
596 fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);
598 if(fDebug>1)Printf("AODExtension found for %s",fNonStdFile.Data());
602 // -- event selection --
603 fHistEvtSelection->Fill(1); // number of events before event selection
606 Bool_t selected=kTRUE;
607 selected = AliAnalysisHelperJetTasks::Selected();
609 // no selection by the service task, we continue
610 PostData(1,fOutputList);
615 // physics selection: this is now redundant, all should appear as accepted after service task selection
616 AliInputEventHandler* inputHandler = (AliInputEventHandler*)
617 ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
618 std::cout<<inputHandler->IsEventSelected()<<" "<<fOfflineTrgMask<<std::endl;
619 if(!(inputHandler->IsEventSelected() & fOfflineTrgMask)){
620 if(fDebug) Printf(" Trigger Selection: event REJECTED ... ");
621 fHistEvtSelection->Fill(2);
622 PostData(1, fOutputList);
630 if(fDebug) Printf("%s:%d No AOD",(char*)__FILE__,__LINE__);
631 fHistEvtSelection->Fill(3);
632 PostData(1, fOutputList);
634 AliAODVertex* primVtx = aod->GetPrimaryVertex();
637 if(fDebug) Printf("%s:%d No primVtx",(char*)__FILE__,__LINE__);
638 fHistEvtSelection->Fill(3);
639 PostData(1, fOutputList);
643 Int_t nTracksPrim = primVtx->GetNContributors();
644 if ((nTracksPrim < fMinContribVtx) ||
645 (primVtx->GetZ() < fVtxZMin) ||
646 (primVtx->GetZ() > fVtxZMax) ){
647 if(fDebug) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ());
648 fHistEvtSelection->Fill(3);
649 PostData(1, fOutputList);
653 // event class selection (from jet helper task)
654 Int_t eventClass = AliAnalysisHelperJetTasks::EventClass();
655 if(fDebug) Printf("Event class %d", eventClass);
656 if (eventClass < fEvtClassMin || eventClass > fEvtClassMax){
657 fHistEvtSelection->Fill(4);
658 PostData(1, fOutputList);
662 // centrality selection
663 AliCentrality *cent = 0x0;
664 Double_t centValue = 0.;
666 if(fESD) {cent = fESD->GetCentrality();
667 if(cent) centValue = cent->GetCentralityPercentile("V0M");}
668 else centValue=aod->GetHeader()->GetCentrality();
670 if(fDebug) printf("centrality: %f\n", centValue);
671 if (centValue < fCentMin || centValue > fCentMax){
672 fHistEvtSelection->Fill(4);
673 PostData(1, fOutputList);
678 fHistEvtSelection->Fill(0);
680 // -- end event selection --
683 AliAODJetEventBackground* externalBackground = 0;
684 if(fAODOut&&!externalBackground&&fBackgroundBranch.Length()){
685 externalBackground = (AliAODJetEventBackground*)(fAODOut->FindListObject(fBackgroundBranch.Data()));
686 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
688 if(fAODExtension&&!externalBackground&&fBackgroundBranch.Length()){
689 externalBackground = (AliAODJetEventBackground*)(fAODExtension->GetAOD()->FindListObject(fBackgroundBranch.Data()));
690 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
693 if(fAODIn&&!externalBackground&&fBackgroundBranch.Length()){
694 externalBackground = (AliAODJetEventBackground*)(fAODIn->FindListObject(fBackgroundBranch.Data()));
695 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
701 if(externalBackground)rho = externalBackground->GetBackground(0);}
703 if(externalBackground)rho = externalBackground->GetBackground(2);}
706 TClonesArray *aodJets[2];
708 if(fAODOut&&!aodJets[0]){
709 aodJets[0] = dynamic_cast<TClonesArray*>(fAODOut->FindListObject(fJetBranchName[0].Data()));
710 aodJets[1] = dynamic_cast<TClonesArray*>(fAODOut->FindListObject(fJetBranchName[1].Data())); }
711 if(fAODExtension && !aodJets[0]){
712 aodJets[0] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[0].Data()));
713 aodJets[1] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[1].Data())); }
714 if(fAODIn&&!aodJets[0]){
715 aodJets[0] = dynamic_cast<TClonesArray*>(fAODIn->FindListObject(fJetBranchName[0].Data()));
716 aodJets[1] = dynamic_cast<TClonesArray*>(fAODIn->FindListObject(fJetBranchName[1].Data())); }
725 Double_t dice=fRandom->Uniform(0,1);
726 if(dice>fFrac){ minT=fTTLowRef;
728 if(dice<=fFrac){minT=fTTLowSig;
733 if(fHardest==1 || fHardest==2) nT = GetListOfTracks(&ParticleList);
734 if(fHardest==0) nT=SelectTrigger(&ParticleList,minT,maxT,number);
736 PostData(1, fOutputList);
739 if(dice>fFrac) fh1TrigRef->Fill(number);
740 if(dice<=fFrac)fh1TrigSig->Fill(number);
742 for (Int_t iJetType = 0; iJetType < 2; iJetType++) {
743 fListJets[iJetType]->Clear();
744 if (!aodJets[iJetType]) continue;
745 if(fDebug) Printf("%s: %d jets",fJetBranchName[iJetType].Data(),aodJets[iJetType]->GetEntriesFast());
746 for (Int_t iJet = 0; iJet < aodJets[iJetType]->GetEntriesFast(); iJet++) {
747 AliAODJet *jet = dynamic_cast<AliAODJet*>((*aodJets[iJetType])[iJet]);
748 if (jet) fListJets[iJetType]->Add(jet);
750 // ptsub[iJet]=jet->Pt()-rho*jet->EffectiveAreaCharged();}
759 Double_t areasmall=0;
760 Double_t phismall=0.;
766 Int_t trigBBTrack=-1;
767 Int_t trigInTrack=-1;
768 fRPAngle = aod->GetHeader()->GetEventplane();
770 if(fHardest==0 || fHardest==1){
771 AliVParticle *partback = (AliVParticle*)ParticleList.At(nT);
773 PostData(1, fOutputList);
776 if(fSemigoodCorrect){
777 Double_t disthole=RelativePhi(partback->Phi(),fHolePos);
778 if(TMath::Abs(disthole)+fHoleWidth>TMath::Pi()-0.6){
779 PostData(1, fOutputList);
786 for(Int_t tt=0;tt<ParticleList.GetEntries();tt++){
787 if(fHardest==0||fHardest==1){if(tt!=nT) continue;}
788 AliVParticle *partback = (AliVParticle*)ParticleList.At(tt);
789 if(!partback) continue;
790 if(partback->Pt()<8) continue;
792 Double_t accep=2.*TMath::Pi()*1.8;
796 if(fSemigoodCorrect){
797 Double_t disthole=RelativePhi(partback->Phi(),fHolePos);
798 if(TMath::Abs(disthole)+fHoleWidth>TMath::Pi()-0.6) continue;}
802 fh2Ntriggers->Fill(centValue,partback->Pt());
803 Double_t phiBinT = RelativePhi(partback->Phi(),fRPAngle);
804 if(centValue<20.) fh2RPTC20->Fill(TMath::Abs(phiBinT),partback->Pt());
805 if(centValue<10.) fh2RPTC10->Fill(TMath::Abs(phiBinT),partback->Pt());
809 for(Int_t i=0; i<fListJets[0]->GetEntries(); ++i){
810 AliAODJet* jetbig = (AliAODJet*)(fListJets[0]->At(i));
811 etabig = jetbig->Eta();
812 phibig = jetbig->Phi();
813 ptbig = jetbig->Pt();
814 if(ptbig==0) continue;
815 Double_t phiBin = RelativePhi(phibig,fRPAngle);
816 areabig = jetbig->EffectiveAreaCharged();
817 Double_t ptcorr=ptbig-rho*areabig;
818 if((etabig<fJetEtaMin)||(etabig>fJetEtaMax)) continue;
819 if(areabig>=0.07) injet=injet+1;
820 if(areabig>=0.4) injet4=injet4+1;
821 Double_t dphi=RelativePhi(partback->Phi(),phibig);
824 Double_t etadif= partback->Eta()-etabig;
825 if(TMath::Abs(etadif)<=0.5){
827 if(centValue<20.) fh3JetTrackC20->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));
828 if(centValue>30. && centValue<60.) fh3JetTrackC3060->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));}}
830 if(centValue<20.) fh3JetTrackC20->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));
831 if(centValue>30. && centValue<60.) fh3JetTrackC3060->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));}
834 if(fFlagJetHadron==0){
835 if(fFlagPhiBkg==1) if((TMath::Abs(dphi)<TMath::Pi()/2.-0.1)||(TMath::Abs(dphi)>TMath::Pi()/2.+0.1)) continue;
836 if(fFlagPhiBkg==0) if(TMath::Abs(dphi)<TMath::Pi()-0.6) continue;
837 if(fFlagPhiBkg==2) if(TMath::Abs(dphi)<TMath::Pi()-0.7) continue;
838 if(fFlagPhiBkg==3) if(TMath::Abs(dphi)<TMath::Pi()-0.5) continue;}
840 if(fFlagJetHadron!=0) if(TMath::Abs(dphi)>0.4) continue;
843 if(centValue<10.) fh2RPJetsC10->Fill(TMath::Abs(phiBin), ptcorr);
844 if(centValue<20.) fh2RPJetsC20->Fill(TMath::Abs(phiBin), ptcorr);
845 Double_t dismin=100.;
850 Float_t phitt=partback->Phi();
851 if(phitt<0)phitt+=TMath::Pi()*2.;
852 Int_t phiBintt = GetPhiBin(phitt-fRPAngle);
854 Double_t fillspec[] = {centValue,jetbig->EffectiveAreaCharged(),ptcorr,partback->Pt(),phiBintt};
855 fHJetSpec->Fill(fillspec);
859 if(ptcorr<=0) continue;
861 AliAODTrack* leadtrack=0;
864 if(fFlagJetHadron==0){
865 TRefArray *genTrackList = jetbig->GetRefTracks();
866 Int_t nTracksGenJet = genTrackList->GetEntriesFast();
867 AliAODTrack* genTrack;
868 for(Int_t ir=0; ir<nTracksGenJet; ++ir){
869 genTrack = (AliAODTrack*)(genTrackList->At(ir));
870 if(genTrack->Pt()>ppt){ppt=genTrack->Pt();
872 leadtrack=(AliAODTrack*)(genTrackList->At(ippt));
873 if(!leadtrack) continue;
878 AliVParticle* leadtrackb=0;
879 if(fFlagJetHadron!=0){
880 Int_t nTb = GetHardestTrackBackToJet(jetbig);
881 leadtrackb = (AliVParticle*)ParticleList.At(nTb);
882 if(!leadtrackb) continue;
889 //store one trigger info
898 for(Int_t j=0; j<fListJets[1]->GetEntries(); ++j){
899 AliAODJet* jetsmall = (AliAODJet*)(fListJets[1]->At(j));
900 etasmall = jetsmall->Eta();
901 phismall = jetsmall->Phi();
902 ptsmall = jetsmall->Pt();
903 areasmall = jetsmall->EffectiveAreaCharged();
904 Double_t tmpDeltaR=(phismall-phibig)*(phismall-phibig)+(etasmall-etabig)*(etasmall-etabig);
905 tmpDeltaR=TMath::Sqrt(tmpDeltaR);
906 //Fraction in the jet core
907 if((ptsmall>ptmax)&&(tmpDeltaR<=fRadioFrac)){ptmax=ptsmall;
909 if(tmpDeltaR<=dismin){ dismin=tmpDeltaR;
910 index1=j;}} //en of loop over R=0.2 jets
911 //method1:most concentric jet=core
912 if(dismin<fMinDist){ AliAODJet* jetmethod1 = (AliAODJet*)(fListJets[1]->At(index1));
913 if(centValue<10) fh2JetCoreMethod1C10->Fill(ptcorr,jetmethod1->Pt()/ptbig);
914 if((centValue>20)&&(centValue<40)) fh2JetCoreMethod1C20->Fill(ptcorr,jetmethod1->Pt()/ptbig);
915 if((centValue>30)&&(centValue<60)) fh2JetCoreMethod1C30->Fill(ptcorr,jetmethod1->Pt()/ptbig);
916 if(centValue>60) fh2JetCoreMethod1C60->Fill(ptcorr,jetmethod1->Pt()/ptbig); }
917 //method2:hardest contained jet=core
919 AliAODJet* jetmethod2 = (AliAODJet*)(fListJets[1]->At(index2));
920 if(centValue<10) fh2JetCoreMethod2C10->Fill(ptcorr,jetmethod2->Pt()/ptbig);
921 if((centValue>20)&&(centValue<40)) fh2JetCoreMethod2C20->Fill(ptcorr,jetmethod2->Pt()/ptbig);
922 if((centValue>30)&&(centValue<60)) fh2JetCoreMethod2C30->Fill(ptcorr,jetmethod2->Pt()/ptbig);
923 if(centValue>60) fh2JetCoreMethod2C60->Fill(ptcorr,jetmethod2->Pt()/ptbig); }}
924 if(centValue<10&&leadtrack) fh2Ntriggers2C10->Fill(leadtrack->Pt(),partback->Pt());
925 if(centValue<20&&leadtrack) fh2Ntriggers2C20->Fill(leadtrack->Pt(),partback->Pt());
926 if(fDoEventMixing==0 && fFlagOnlyRecoil==0){
927 for(int it = 0;it<ParticleList.GetEntries();++it){
928 AliVParticle *part = (AliVParticle*)ParticleList.At(it);
929 Double_t deltaR = jetbig->DeltaR(part);
930 Double_t deltaEta = etabig-part->Eta();
932 Double_t deltaPhi=phibig-part->Phi();
933 if(deltaPhi<-0.5*TMath::Pi()) deltaPhi+=2.*TMath::Pi();
934 if(deltaPhi>3./2.*TMath::Pi()) deltaPhi-=2.*TMath::Pi();
936 if(fFlagJetHadron==0) pTcont=leadtrack->Pt();
937 if(fFlagJetHadron!=0) pTcont=leadtrackb->Pt();
938 Double_t jetEntries[8] = {centValue,ptcorr,part->Pt(),deltaR,deltaEta,deltaPhi,pTcont,partback->Pt()};
939 fhnDeltaR->Fill(jetEntries);}
945 //end of track loop, we only do it if EM is switched off
956 if(injet>0) fh3JetDensity->Fill(ParticleList.GetEntries(),injet/accep,partback->Pt());
957 if(injet4>0)fh3JetDensityA4->Fill(ParticleList.GetEntries(),injet4/accep,partback->Pt());
963 if(fDoEventMixing>0){
964 //check before if the trigger exists
965 // fTrigBuffer[i][0] = zvtx
966 // fTrigBuffer[i][1] = phi
967 // fTrigBuffer[i][2] = eta
968 // fTrigBuffer[i][3] = pt_jet
969 // fTrigBuffer[i][4] = pt_trig
970 // fTrigBuffer[i][5]= centrality
971 if(fTindex==10) fTindex=0;
972 if(fTrigBuffer[fTindex][3]>0){
973 if (TMath::Abs(fTrigBuffer[fTindex][0]-primVtx->GetZ()<2.)){
974 if (TMath::Abs(fTrigBuffer[fTindex][5]-centValue<5)){
976 for(int it = 0;it<nT;++it){
977 AliVParticle *part = (AliVParticle*)ParticleList.At(it);
978 Double_t DPhi = fTrigBuffer[fTindex][1] - part->Phi();
979 Double_t DEta = fTrigBuffer[fTindex][2] - part->Eta();
980 Double_t DR=TMath::Sqrt(DPhi*DPhi+DEta*DEta);
981 if(DPhi<-0.5*TMath::Pi()) DPhi+=2.*TMath::Pi();
982 if(DPhi>3./2.*TMath::Pi()) DPhi-=2.*TMath::Pi();
983 Double_t triggerEntries[7] = {centValue,fTrigBuffer[fTindex][3],part->Pt(),DR,DEta,DPhi,fTrigBuffer[fTindex][4]};
984 fhnMixedEvents->Fill(triggerEntries);
987 if(fNevents==10) fTindex=fTindex+1;
990 if(fTindex==10&&fNevents==10) fCountAgain=0;
992 // Copy the triggers from the current event into the buffer.
993 //again, only if the trigger exists:
996 AliAODJet* jetT = (AliAODJet*)(fListJets[0]->At(trigJet)); AliVParticle *partT = (AliVParticle*)ParticleList.At(trigBBTrack);
997 fTrigBuffer[fTrigBufferIndex][0] = primVtx->GetZ();
998 fTrigBuffer[fTrigBufferIndex][1] = jetT->Phi();
999 fTrigBuffer[fTrigBufferIndex][2] = jetT->Eta();
1000 fTrigBuffer[fTrigBufferIndex][3] = jetT->Pt()-rho*jetT->EffectiveAreaCharged();
1001 fTrigBuffer[fTrigBufferIndex][4] = partT->Pt();
1002 fTrigBuffer[fTrigBufferIndex][5] = centValue;
1004 if(fTrigBufferIndex==9) {fTrigBufferIndex=0;
1011 /////////////////////////////////////////////////////////////////////////////
1012 ////////////////////// Rongrong's analysis //////////////////////////////////
1013 if(fRunAnaAzimuthalCorrelation)
1015 fhTTPt->Fill(centValue,partback->Pt());
1016 for(Int_t ij=0; ij<fListJets[0]->GetEntries(); ij++)
1018 AliAODJet* jet = (AliAODJet*)(fListJets[0]->At(ij));
1019 Double_t jetPt = jet->Pt();
1020 Double_t jetEta = jet->Eta();
1021 Double_t jetPhi = jet->Phi();
1022 if(jetPt==0) continue;
1023 if((jetEta<fJetEtaMin)||(jetEta>fJetEtaMax)) continue;
1024 Double_t jetArea = jet->EffectiveAreaCharged();
1025 Double_t jetPtCorr=jetPt-rho*jetArea;
1026 Double_t dPhi=jetPhi-partback->Phi();
1027 if(dPhi>2*TMath::Pi()) dPhi -= 2*TMath::Pi();
1028 if(dPhi<-2*TMath::Pi()) dPhi += 2*TMath::Pi();
1029 if(dPhi<-0.5*TMath::Pi()) dPhi += 2*TMath::Pi();
1030 if(dPhi>1.5*TMath::Pi()) dPhi -= 2*TMath::Pi();
1032 Double_t fill[] = {partback->Pt(),jetPtCorr,dPhi,jetArea,centValue};
1033 fHJetPhiCorr->Fill(fill);
1036 /////////////////////////////////////////////////////////////////////////////
1037 /////////////////////////////////////////////////////////////////////////////
1040 //////////////////ANGULAR STRUCTURE//////////////////////////////////////
1042 //tracks up to R=0.8 distant from the jet axis
1043 // if(fAngStructCloseTracks==1){
1044 // TList CloseTrackList;
1045 // Int_t nn=GetListOfTracksCloseToJet(&CloseTrackList,jetbig);
1046 // Double_t difR=0.04;
1047 // for(Int_t l=0;l<15;l++){
1048 // Double_t rr=l*0.1+0.1;
1049 // for(int it = 0;it<nn;++it){
1050 // AliVParticle *part1 = (AliVParticle*)CloseTrackList.At(it);
1051 // for(int itu=it+1;itu<CloseTrackList.GetEntries();itu++){
1052 // AliVParticle *part2 = (AliVParticle*)CloseTrackList.At(itu);
1053 // Double_t ptm=part1->Pt();
1054 // Double_t ptn=part2->Pt();
1055 // Double_t Rnm = (part1->Eta()-part2->Eta())*(part1->Eta()-part2->Eta())+(part1->Phi()-part2->Phi())*(part1->Phi()-part2->Phi());
1056 // Rnm=TMath::Sqrt(Rnm);
1057 // Double_t deltag=(1./(TMath::Sqrt(2*TMath::Pi())*difR))*TMath::Exp(-1.*(rr-Rnm)*(rr-Rnm)/(2.*difR*difR));
1058 // Double_t stepf=0.5*(1.+TMath::Erf((rr-Rnm)/(TMath::Sqrt(2.)*difR)));
1059 // if((ptcorr<85.) && (ptcorr>=70.)){up1[l]=up1[l]+ptm*ptn*Rnm*Rnm*deltag;
1060 // down1[l]=down1[l]+ptm*ptn*Rnm*Rnm*stepf;}
1061 // if((ptcorr<100.) && (ptcorr>=85.)){up2[l]=up2[l]+ptm*ptn*Rnm*Rnm*deltag;
1062 // down2[l]=down2[l]+ptm*ptn*Rnm*Rnm*stepf;}
1063 // if((ptcorr<120.) && (ptcorr>=100.)){up3[l]=up3[l]+ptm*ptn*Rnm*Rnm*deltag;
1064 // down3[l]=down3[l]+ptm*ptn*Rnm*Rnm*stepf;}
1065 // if((ptcorr<140.) && (ptcorr>=120.)){up4[l]=up4[l]+ptm*ptn*Rnm*Rnm*deltag;
1066 // down4[l]=down4[l]+ptm*ptn*Rnm*Rnm*stepf;}}}}
1069 // //only jet constituents
1070 // if(fAngStructCloseTracks==2){
1072 // Double_t difR=0.04;
1073 // for(Int_t l=0;l<15;l++){
1074 // Double_t rr=l*0.1+0.1;
1077 // AliAODTrack* part1;
1078 // AliAODTrack* part2;
1080 // TRefArray *genTrackListb = jetbig->GetRefTracks();
1081 // Int_t nTracksGenJetb = genTrackListb->GetEntriesFast();
1085 // for(Int_t it=0; it<nTracksGenJetb; ++it){
1086 // part1 = (AliAODTrack*)(genTrackListb->At(it));
1087 // for(Int_t itu=0; itu<nTracksGenJetb; ++itu){
1088 // part2 = (AliAODTrack*)(genTrackListb->At(itu));
1089 // Double_t ptm=part1->Pt();
1090 // Double_t ptn=part2->Pt();
1091 // Double_t Rnm = (part1->Eta()-part2->Eta())*(part1->Eta()-part2->Eta())+(part1->Phi()-part2->Phi())*(part1->Phi()-part2->Phi());
1092 // Rnm=TMath::Sqrt(Rnm);
1093 // Double_t deltag=(1./(TMath::Sqrt(2*TMath::Pi())*difR))*TMath::Exp(-1.*(rr-Rnm)*(rr-Rnm)/(2.*difR*difR));
1094 // Double_t stepf=0.5*(1.+TMath::Erf((rr-Rnm)/(TMath::Sqrt(2.)*difR)));
1095 // if((ptcorr<85.) && (ptcorr>=70.)){up1[l]=up1[l]+ptm*ptn*Rnm*Rnm*deltag;
1096 // down1[l]=down1[l]+ptm*ptn*Rnm*Rnm*stepf;}
1097 // if((ptcorr<100.) && (ptcorr>=85.)){up2[l]=up2[l]+ptm*ptn*Rnm*Rnm*deltag;
1098 // down2[l]=down2[l]+ptm*ptn*Rnm*Rnm*stepf;}
1099 // if((ptcorr<120.) && (ptcorr>=100.)){up3[l]=up3[l]+ptm*ptn*Rnm*Rnm*deltag;
1100 // down3[l]=down3[l]+ptm*ptn*Rnm*Rnm*stepf;}
1101 // if((ptcorr<140.) && (ptcorr>=120.)){up4[l]=up4[l]+ptm*ptn*Rnm*Rnm*deltag;
1102 // down4[l]=down4[l]+ptm*ptn*Rnm*Rnm*stepf;}}}}}
1104 // //end loop over R=0.4 jets
1105 // if(fAngStructCloseTracks>0){
1106 // for(Int_t l=0;l<15;l++){
1107 // Double_t rr=l*0.1+0.1;
1109 // if(centValue<10.)fh2AngStructpt1C10->Fill(rr,rr*up1[l]/down1[l]);
1110 // if(centValue>20. && centValue<40.) fh2AngStructpt1C20->Fill(rr,rr*up1[l]/down1[l]);
1111 // if(centValue>30. && centValue<60.) fh2AngStructpt1C30->Fill(rr,rr*up1[l]/down1[l]);
1112 // if(centValue>60.) fh2AngStructpt1C60->Fill(rr,rr*up1[l]/down1[l]);}
1114 // if(centValue<10.) fh2AngStructpt2C10->Fill(rr,rr*up2[l]/down2[l]);
1115 // if(centValue>20. && centValue<40.) fh2AngStructpt2C20->Fill(rr,rr*up2[l]/down2[l]);
1116 // if(centValue>30. && centValue<60.) fh2AngStructpt2C30->Fill(rr,rr*up2[l]/down2[l]);
1117 // if(centValue>60.) fh2AngStructpt2C60->Fill(rr,rr*up2[l]/down2[l]);}
1119 // if(centValue<10.) fh2AngStructpt3C10->Fill(rr,rr*up3[l]/down3[l]);
1120 // if(centValue>20. && centValue<40.) fh2AngStructpt3C20->Fill(rr,rr*up3[l]/down3[l]);
1121 // if(centValue>30. && centValue<60.) fh2AngStructpt3C30->Fill(rr,rr*up3[l]/down3[l]);
1122 // if(centValue>60.) fh2AngStructpt3C60->Fill(rr,rr*up3[l]/down3[l]);}
1124 // if(centValue<10.) fh2AngStructpt4C10->Fill(rr,rr*up4[l]/down4[l]);
1125 // if(centValue>20. && centValue<40.) fh2AngStructpt4C20->Fill(rr,rr*up4[l]/down4[l]);
1126 // if(centValue>30. && centValue<60.) fh2AngStructpt4C30->Fill(rr,rr*up4[l]/down4[l]);
1127 // if(centValue>60.) fh2AngStructpt4C60->Fill(rr,rr*up4[l]/down4[l]);}}}
1135 PostData(1, fOutputList);
1138 void AliAnalysisTaskJetCore::Terminate(const Option_t *)
1140 // Draw result to the screen
1141 // Called once at the end of the query
1143 if (!GetOutputData(1))
1152 Int_t AliAnalysisTaskJetCore::GetListOfTracks(TList *list){
1155 AliAODEvent *aod = 0;
1157 if(!fESD)aod = fAODIn;
1167 for(int it = 0;it < aod->GetNumberOfTracks();++it){
1168 AliAODTrack *tr = aod->GetTrack(it);
1169 Bool_t bGood = false;
1170 if(fFilterType == 0)bGood = true;
1171 else if(fFilterType == 1)bGood = tr->IsHybridTPCConstrainedGlobal();
1172 else if(fFilterType == 2)bGood = tr->IsHybridGlobalConstrainedGlobal();
1173 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
1174 if(fRequireITSRefit==1){if((tr->GetStatus()&AliESDtrack::kITSrefit)==0)continue;}
1175 if(bGood==false) continue;
1176 if (fApplySharedClusterCut) {
1177 Double_t frac = Double_t(tr->GetTPCnclsS()) /Double_t(tr->GetTPCncls());
1178 if (frac > 0.4) continue;
1180 if(TMath::Abs(tr->Eta())>0.9)continue;
1181 if(tr->Pt()<0.15)continue;
1184 if(fFilterType==2 && fFilterMaskBestPt>0){// only set the trigger track index for good quality tracks
1185 if(tr->TestFilterBit(fFilterMaskBestPt)){
1201 // else if (type == kTrackAODMCCharged) {
1202 // TClonesArray *tca = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
1203 // if(!tca)return iCount;
1204 // for(int it = 0;it < tca->GetEntriesFast();++it){
1205 // AliAODMCParticle *part = dynamic_cast<AliAODMCParticle*>(tca->At(it));
1206 // if(!part)continue;
1207 // if(part->Pt()<0.15)continue;
1208 // if(!part->IsPhysicalPrimary())continue;
1209 // if(part->Charge()==0)continue;
1210 // if(TMath::Abs(part->Eta())>0.9)continue;
1213 // if(part->Pt()>ptmax){ ptmax=part->Pt();
1214 // index=iCount-1;}}}
1221 Int_t AliAnalysisTaskJetCore::SelectTrigger(TList *list,Double_t minT,Double_t maxT,Int_t &number){
1223 AliAODEvent *aod = 0;
1224 if(!fESD)aod = fAODIn;
1228 Int_t triggers[100];
1229 for(Int_t cr=0;cr<100;cr++){triggers[cr]=-1;}
1231 for(int it = 0;it < aod->GetNumberOfTracks();++it){
1232 AliAODTrack *tr = aod->GetTrack(it);
1233 Bool_t bGood = false;
1234 if(fFilterType == 0)bGood = true;
1235 else if(fFilterType == 1)bGood = tr->IsHybridTPCConstrainedGlobal();
1236 else if(fFilterType == 2)bGood = tr->IsHybridGlobalConstrainedGlobal();
1237 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
1238 if(fRequireITSRefit==1){if((tr->GetStatus()&AliESDtrack::kITSrefit)==0)continue;}
1239 if(bGood==false) continue;
1240 if (fApplySharedClusterCut) {
1241 Double_t frac = Double_t(tr->GetTPCnclsS()) /Double_t(tr->GetTPCncls());
1242 if (frac > 0.4) continue;
1244 if(TMath::Abs(tr->Eta())>0.9)continue;
1245 if(tr->Pt()<0.15)continue;
1249 if(tr->Pt()>=minT && tr->Pt()<maxT){
1250 triggers[im]=iCount-1;
1257 if(im>0) rd=fRandom->Integer(im);
1283 Int_t AliAnalysisTaskJetCore::GetHardestTrackBackToJet(AliAODJet *jetbig){
1285 AliAODEvent *aod = 0;
1286 if(!fESD)aod = fAODIn;
1293 for(int it = 0;it < aod->GetNumberOfTracks();++it){
1294 AliAODTrack *tr = aod->GetTrack(it);
1295 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
1296 if(TMath::Abs(tr->Eta())>0.9)continue;
1297 if(tr->Pt()<0.15)continue;
1299 dphi=RelativePhi(tr->Phi(),jetbig->Phi());
1300 if(TMath::Abs(dphi)<TMath::Pi()-0.6) continue;
1301 if(tr->Pt()>ptmax){ ptmax=tr->Pt();
1317 Int_t AliAnalysisTaskJetCore::GetListOfTracksCloseToJet(TList *list,AliAODJet *jetbig){
1320 AliAODEvent *aod = 0;
1321 if(!fESD)aod = fAODIn;
1324 for(int it = 0;it < aod->GetNumberOfTracks();++it){
1325 AliAODTrack *tr = aod->GetTrack(it);
1326 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
1327 if(TMath::Abs(tr->Eta())>0.9)continue;
1328 if(tr->Pt()<0.15)continue;
1329 Double_t disR=jetbig->DeltaR(tr);
1330 if(disR>0.8) continue;
1332 //cout<<fAOD->GetNumberOfTracks()<<" "<<tr->Pt()<<endl;
1351 Int_t AliAnalysisTaskJetCore::GetNInputTracks()
1354 Int_t nInputTracks = 0;
1355 AliAODEvent *aod = 0;
1356 if(!fESD)aod = fAODIn;
1358 TString jbname(fJetBranchName[1]);
1359 //needs complete event, use jets without background subtraction
1360 for(Int_t i=1; i<=3; ++i){
1361 if(jbname.Contains(Form("B%d",i))) jbname.ReplaceAll(Form("B%d",i),"B0");
1363 // use only HI event
1364 if(jbname.Contains("AODextraonly")) jbname.ReplaceAll("AODextraonly","AOD");
1365 if(jbname.Contains("AODextra")) jbname.ReplaceAll("AODextra","AOD");
1367 if(fDebug) Printf("Multiplicity from jet branch %s", jbname.Data());
1368 TClonesArray *tmpAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(jbname.Data()));
1370 Printf("Jet branch %s not found", jbname.Data());
1371 Printf("AliAnalysisTaskJetCore::GetNInputTracks FAILED");
1375 for (Int_t iJet=0; iJet<tmpAODjets->GetEntriesFast(); iJet++){
1376 AliAODJet *jet = dynamic_cast<AliAODJet*>((*tmpAODjets)[iJet]);
1378 TRefArray *trackList = jet->GetRefTracks();
1379 Int_t nTracks = trackList->GetEntriesFast();
1380 nInputTracks += nTracks;
1381 if(fDebug) Printf("#jet%d: %d tracks", iJet, nTracks);
1383 if(fDebug) Printf("---> input tracks: %d", nInputTracks);
1385 return nInputTracks;
1390 Double_t AliAnalysisTaskJetCore::RelativePhi(Double_t mphi,Double_t vphi){
1392 if (vphi < -1*TMath::Pi()) vphi += (2*TMath::Pi());
1393 else if (vphi > TMath::Pi()) vphi -= (2*TMath::Pi());
1394 if (mphi < -1*TMath::Pi()) mphi += (2*TMath::Pi());
1395 else if (mphi > TMath::Pi()) mphi -= (2*TMath::Pi());
1396 double dphi = mphi-vphi;
1397 if (dphi < -1*TMath::Pi()) dphi += (2*TMath::Pi());
1398 else if (dphi > TMath::Pi()) dphi -= (2*TMath::Pi());
1399 return dphi;//dphi in [-Pi, Pi]
1402 Int_t AliAnalysisTaskJetCore::GetPhiBin(Double_t phi)
1405 if(!(TMath::Abs(phi)<=2*TMath::Pi())){AliError("phi w.r.t. RP out of defined range");return -1;}
1406 Double_t phiwrtrp=TMath::ACos(TMath::Abs(TMath::Cos(phi)));
1407 phibin=Int_t(fNRPBins*phiwrtrp/(0.5*TMath::Pi()));
1408 if(phibin<0||phibin>=fNRPBins){AliError("Phi Bin not defined");}
1415 THnSparse* AliAnalysisTaskJetCore::NewTHnSparseF(const char* name, UInt_t entries)
1417 // generate new THnSparseF, axes are defined in GetDimParams()
1420 UInt_t tmp = entries;
1423 tmp = tmp &~ -tmp; // clear lowest bit
1426 TString hnTitle(name);
1427 const Int_t dim = count;
1434 while(c<dim && i<32){
1438 GetDimParams(i, label, nbins[c], xmin[c], xmax[c]);
1439 hnTitle += Form(";%s",label.Data());
1447 return new THnSparseF(name, hnTitle.Data(), dim, nbins, xmin, xmax);
1450 void AliAnalysisTaskJetCore::GetDimParams(Int_t iEntry, TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax)
1452 // stores label and binning of axis for THnSparse
1454 const Double_t pi = TMath::Pi();
1459 label = "V0 centrality (%)";
1468 label = "corrected jet pt";
1511 label = "leading track";
1519 label = "trigger track";