]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/AliAnalysisTaskJetCore.cxx
Fixed methods to store/read whole AliMagWrapCheb content to text file: for transfer...
[u/mrichter/AliRoot.git] / PWGJE / AliAnalysisTaskJetCore.cxx
CommitLineData
568f8fa2 1// ******************************************
2// This task computes several jet observables like
3// the fraction of energy in inner and outer coronnas,
da93bb11 4// jet-track correlations,triggered jet shapes and
568f8fa2 5// correlation strength distribution of particles inside jets.
6// Author: lcunquei@cern.ch
7// *******************************************
8
9
10/**************************************************************************
11 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
12 * *
13 * Author: The ALICE Off-line Project. *
14 * Contributors are mentioned in the code where appropriate. *
15 * *
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 **************************************************************************/
24
25
75bf77e3 26#include "TChain.h"
27#include "TTree.h"
28#include "TMath.h"
29#include "TH1F.h"
30#include "TH2F.h"
31#include "TH3F.h"
32#include "THnSparse.h"
33#include "TCanvas.h"
ccf12e54 34#include "TRandom3.h"
75bf77e3 35#include "AliLog.h"
36
37#include "AliAnalysisTask.h"
38#include "AliAnalysisManager.h"
39
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"
85b5b73e 47#include "AliAODMCParticle.h"
75bf77e3 48#include "AliAnalysisTaskFastEmbedding.h"
75bf77e3 49#include "AliAODEvent.h"
ea693273 50#include "AliAODHandler.h"
75bf77e3 51#include "AliAODJet.h"
52
53#include "AliAnalysisTaskJetCore.h"
54
a7eebe5b 55using std::cout;
56using std::endl;
57
75bf77e3 58ClassImp(AliAnalysisTaskJetCore)
59
60AliAnalysisTaskJetCore::AliAnalysisTaskJetCore() :
61AliAnalysisTaskSE(),
62fESD(0x0),
5bd732d4 63fAODIn(0x0),
64fAODOut(0x0),
ea693273 65fAODExtension(0x0),
75bf77e3 66fBackgroundBranch(""),
ea693273 67fNonStdFile(""),
75bf77e3 68fIsPbPb(kTRUE),
69fOfflineTrgMask(AliVEvent::kAny),
70fMinContribVtx(1),
a9e585a7 71fVtxZMin(-10.),
72fVtxZMax(10.),
75bf77e3 73fEvtClassMin(0),
74fEvtClassMax(4),
8b47ec90 75fFilterMask(0),
41bcb7e7 76fFilterMaskBestPt(0),
d90d5d75 77fFilterType(0),
ea693273 78fRadioFrac(0.2),
79fMinDist(0.1),
75bf77e3 80fCentMin(0.),
81fCentMax(100.),
82fNInputTracksMin(0),
83fNInputTracksMax(-1),
c18b64ea 84fRequireITSRefit(0),
fb5db3fb 85fApplySharedClusterCut(0),
ea693273 86fAngStructCloseTracks(0),
da93bb11 87fCheckMethods(0),
529e2916 88fDoEventMixing(0),
447d2a5b 89fFlagPhiBkg(0),
ca1009f1 90fFlagEtaBkg(0),
16a4c8e8 91fFlagJetHadron(0),
6d494617 92fDodiHadron(0),
4c074aaf 93fFrac(0.8),
94fTTLowRef(11),
95fTTUpRef(13),
96fTTLowSig(15),
97fTTUpSig(19),
ccf12e54 98fHardest(0),
d5e7475c 99fFlagRandom(0),
ae1e07c1 100fFlagOnlyRecoil(0),
41bcb7e7 101fFlagOnlyHardest(1),
85b5b73e 102fTrackTypeRec(kTrackUndef),
d5e7475c 103fRPAngle(0),
41bcb7e7 104fNRPBins(50),
9807c9a1 105fSemigoodCorrect(0),
106fHolePos(4.71),
107fHoleWidth(0.2),
75bf77e3 108fJetEtaMin(-.5),
109fJetEtaMax(.5),
447d2a5b 110fNevents(0),
111fTindex(0),
112fTrigBufferIndex(0),
113fCountAgain(0),
75bf77e3 114fJetPtMin(20.),
115fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
116fJetPtFractionMin(0.5),
117fNMatchJets(4),
118fMatchMaxDist(0.8),
119fKeepJets(kFALSE),
4f6d1cc1 120fRunAnaAzimuthalCorrelation(kFALSE),
75bf77e3 121fkNbranches(2),
122fkEvtClasses(12),
123fOutputList(0x0),
124fbEvent(kTRUE),
125fHistEvtSelection(0x0),
da93bb11 126fhnDeltaR(0x0),
529e2916 127fhnMixedEvents(0x0),
75bf77e3 128fh2JetCoreMethod1C10(0x0),
129fh2JetCoreMethod2C10(0x0),
ea693273 130fh2JetCoreMethod1C20(0x0),
131fh2JetCoreMethod2C20(0x0),
75bf77e3 132fh2JetCoreMethod1C30(0x0),
133fh2JetCoreMethod2C30(0x0),
75bf77e3 134fh2JetCoreMethod1C60(0x0),
135fh2JetCoreMethod2C60(0x0),
d5e7475c 136fh3JetTrackC3060(0x0),
e03c221a 137fh3JetTrackC20(0x0),
ea693273 138fh2AngStructpt1C10(0x0),
139fh2AngStructpt2C10(0x0),
140fh2AngStructpt3C10(0x0),
141fh2AngStructpt4C10(0x0),
142fh2AngStructpt1C20(0x0),
143fh2AngStructpt2C20(0x0),
144fh2AngStructpt3C20(0x0),
145fh2AngStructpt4C20(0x0),
146fh2AngStructpt1C30(0x0),
147fh2AngStructpt2C30(0x0),
148fh2AngStructpt3C30(0x0),
149fh2AngStructpt4C30(0x0),
150fh2AngStructpt1C60(0x0),
151fh2AngStructpt2C60(0x0),
152fh2AngStructpt3C60(0x0),
da93bb11 153fh2AngStructpt4C60(0x0),
a36ea0f9 154fh1TrigRef(0x0),
155fh1TrigSig(0x0),
6d494617 156fh1TrackPhiDistance(0x0),
157fh1TrackRDistance(0x0),
8205e054 158fh2Ntriggers(0x0),
d90d5d75 159fh2Ntriggers2C10(0x0),
160fh2Ntriggers2C20(0x0),
ae1e07c1 161fh3JetDensity(0x0),
162fh3JetDensityA4(0x0),
d90d5d75 163fh2RPJetsC10(0x0),
164fh2RPJetsC20(0x0),
165fh2RPTC10(0x0),
166fh2RPTC20(0x0),
4f6d1cc1 167fHJetSpec(0x0),
168fhTTPt(0x0),
ccf12e54 169fHJetPhiCorr(0x0),
170fRandom(0x0)
da93bb11 171
75bf77e3 172{
173 // default Constructor
174
529e2916 175
176 // Trigger buffer.
177 for(Int_t i=0; i<10; i++) {
447d2a5b 178 for(Int_t j=0; j<6; j++) {
529e2916 179 fTrigBuffer[i][j]=0;
180 }
181 }
182
183
184
185
186
75bf77e3 187 fJetBranchName[0] = "";
188 fJetBranchName[1] = "";
189
190 fListJets[0] = new TList;
191 fListJets[1] = new TList;
192}
193
194AliAnalysisTaskJetCore::AliAnalysisTaskJetCore(const char *name) :
195AliAnalysisTaskSE(name),
196fESD(0x0),
5bd732d4 197fAODIn(0x0),
198fAODOut(0x0),
ea693273 199fAODExtension(0x0),
75bf77e3 200fBackgroundBranch(""),
ea693273 201fNonStdFile(""),
75bf77e3 202fIsPbPb(kTRUE),
203fOfflineTrgMask(AliVEvent::kAny),
204fMinContribVtx(1),
a9e585a7 205fVtxZMin(-10.),
206fVtxZMax(10.),
75bf77e3 207fEvtClassMin(0),
208fEvtClassMax(4),
8b47ec90 209fFilterMask(0),
41bcb7e7 210fFilterMaskBestPt(0),
d90d5d75 211fFilterType(0),
ea693273 212fRadioFrac(0.2),
213fMinDist(0.1),
75bf77e3 214fCentMin(0.),
215fCentMax(100.),
216fNInputTracksMin(0),
217fNInputTracksMax(-1),
c18b64ea 218fRequireITSRefit(0),
fb5db3fb 219fApplySharedClusterCut(0),
ea693273 220fAngStructCloseTracks(0),
da93bb11 221fCheckMethods(0),
529e2916 222fDoEventMixing(0),
447d2a5b 223fFlagPhiBkg(0),
ca1009f1 224fFlagEtaBkg(0),
16a4c8e8 225fFlagJetHadron(0),
6d494617 226fDodiHadron(0),
4c074aaf 227fFrac(0.8),
228fTTLowRef(11),
229fTTUpRef(13),
230fTTLowSig(15),
231fTTUpSig(19),
ccf12e54 232fHardest(0),
d5e7475c 233fFlagRandom(0),
ae1e07c1 234fFlagOnlyRecoil(0),
41bcb7e7 235fFlagOnlyHardest(1),
85b5b73e 236fTrackTypeRec(kTrackUndef),
d5e7475c 237fRPAngle(0),
41bcb7e7 238fNRPBins(50),
9807c9a1 239fSemigoodCorrect(0),
240fHolePos(4.71),
241fHoleWidth(0.2),
75bf77e3 242fJetEtaMin(-.5),
243fJetEtaMax(.5),
447d2a5b 244fNevents(0),
245fTindex(0),
246fTrigBufferIndex(0),
247fCountAgain(0),
75bf77e3 248fJetPtMin(20.),
249fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
250fJetPtFractionMin(0.5),
251fNMatchJets(4),
252fMatchMaxDist(0.8),
253fKeepJets(kFALSE),
4f6d1cc1 254fRunAnaAzimuthalCorrelation(kFALSE),
75bf77e3 255fkNbranches(2),
256fkEvtClasses(12),
257fOutputList(0x0),
258fbEvent(kTRUE),
259fHistEvtSelection(0x0),
da93bb11 260fhnDeltaR(0x0),
529e2916 261fhnMixedEvents(0x0),
75bf77e3 262fh2JetCoreMethod1C10(0x0),
263fh2JetCoreMethod2C10(0x0),
ea693273 264fh2JetCoreMethod1C20(0x0),
265fh2JetCoreMethod2C20(0x0),
75bf77e3 266fh2JetCoreMethod1C30(0x0),
267fh2JetCoreMethod2C30(0x0),
75bf77e3 268fh2JetCoreMethod1C60(0x0),
269fh2JetCoreMethod2C60(0x0),
d5e7475c 270fh3JetTrackC3060(0x0),
e03c221a 271fh3JetTrackC20(0x0),
ea693273 272fh2AngStructpt1C10(0x0),
273fh2AngStructpt2C10(0x0),
274fh2AngStructpt3C10(0x0),
275fh2AngStructpt4C10(0x0),
276fh2AngStructpt1C20(0x0),
277fh2AngStructpt2C20(0x0),
278fh2AngStructpt3C20(0x0),
279fh2AngStructpt4C20(0x0),
280fh2AngStructpt1C30(0x0),
281fh2AngStructpt2C30(0x0),
282fh2AngStructpt3C30(0x0),
283fh2AngStructpt4C30(0x0),
284fh2AngStructpt1C60(0x0),
285fh2AngStructpt2C60(0x0),
286fh2AngStructpt3C60(0x0),
da93bb11 287fh2AngStructpt4C60(0x0),
a36ea0f9 288fh1TrigRef(0x0),
289fh1TrigSig(0x0),
6d494617 290fh1TrackPhiDistance(0x0),
291fh1TrackRDistance(0x0),
8205e054 292fh2Ntriggers(0x0),
d90d5d75 293fh2Ntriggers2C10(0x0),
294fh2Ntriggers2C20(0x0),
ae1e07c1 295fh3JetDensity(0x0),
296fh3JetDensityA4(0x0),
d90d5d75 297fh2RPJetsC10(0x0),
298fh2RPJetsC20(0x0),
299fh2RPTC10(0x0),
300fh2RPTC20(0x0),
4f6d1cc1 301fHJetSpec(0x0),
302fhTTPt(0x0),
ccf12e54 303fHJetPhiCorr(0x0),
304fRandom(0x0)
d5e7475c 305
75bf77e3 306 {
307 // Constructor
308
529e2916 309
310 for(Int_t i=0; i<10; i++) {
447d2a5b 311 for(Int_t j=0; j<6; j++) {
529e2916 312 fTrigBuffer[i][j]=0;
313 }
314 }
315
316
317
75bf77e3 318 fJetBranchName[0] = "";
319 fJetBranchName[1] = "";
320
321 fListJets[0] = new TList;
322 fListJets[1] = new TList;
323
324 DefineOutput(1, TList::Class());
325}
326
327AliAnalysisTaskJetCore::~AliAnalysisTaskJetCore()
328{
329 delete fListJets[0];
330 delete fListJets[1];
331}
332
333void AliAnalysisTaskJetCore::SetBranchNames(const TString &branch1, const TString &branch2)
334{
335 fJetBranchName[0] = branch1;
336 fJetBranchName[1] = branch2;
337}
338
339void AliAnalysisTaskJetCore::Init()
340{
341
342 // check for jet branches
343 if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){
344 AliError("Jet branch name not set.");
345 }
346
347}
348
349void AliAnalysisTaskJetCore::UserCreateOutputObjects()
350{
351 // Create histograms
352 // Called once
353 OpenFile(1);
354 if(!fOutputList) fOutputList = new TList;
355 fOutputList->SetOwner(kTRUE);
356
357 Bool_t oldStatus = TH1::AddDirectoryStatus();
358 TH1::AddDirectory(kFALSE);
359
360
ccf12e54 361 // set seed
362 fRandom = new TRandom3(0);
363
364
365
366
75bf77e3 367 fHistEvtSelection = new TH1I("fHistEvtSelection", "event selection", 6, -0.5, 5.5);
368 fHistEvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
369 fHistEvtSelection->GetXaxis()->SetBinLabel(2,"events IN");
370 fHistEvtSelection->GetXaxis()->SetBinLabel(3,"event selection (rejected)");
371 fHistEvtSelection->GetXaxis()->SetBinLabel(4,"vertex cut (rejected)");
372 fHistEvtSelection->GetXaxis()->SetBinLabel(5,"centrality (rejected)");
373 fHistEvtSelection->GetXaxis()->SetBinLabel(6,"multiplicity (rejected)");
374
529e2916 375 UInt_t entries = 0; // bit coded, see GetDimParams() below
376 entries = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 |1<<7;
da93bb11 377 fhnDeltaR = NewTHnSparseF("fhnDeltaR", entries);
c42c6838 378
20dcc500 379 //change binning in pTtrack
380 Double_t *xPt3 = new Double_t[10];
c42c6838 381 xPt3[0] = 0.;
20dcc500 382 for(int i = 1; i<=9;i++){
4e90d948 383 if(xPt3[i-1]<2)xPt3[i] = xPt3[i-1] + 0.4; // 1 - 5
384 else if(xPt3[i-1]<11)xPt3[i] = xPt3[i-1] + 3; // 5 - 12
20dcc500 385 else xPt3[i] = xPt3[i-1] + 150.; // 18
c42c6838 386 }
387 fhnDeltaR->SetBinEdges(2,xPt3);
388 delete [] xPt3;
389
20dcc500 390 //change binning in HTI
391 Double_t *xPt4 = new Double_t[14];
392 xPt4[0] = 0.;
393 for(int i = 1; i<=13;i++){
394 if(xPt4[i-1]<10)xPt4[i] = xPt4[i-1] + 1; // 1 - 10
395 else if(xPt4[i-1]<20)xPt4[i] = xPt4[i-1] + 5; // 10 - 12
396 else xPt4[i] = xPt4[i-1] + 30.; // 13
397 }
398 fhnDeltaR->SetBinEdges(6,xPt4);
399 delete [] xPt4;
400
401
402
c42c6838 403
404
405
529e2916 406
c42c6838 407 if(fDoEventMixing){
529e2916 408 UInt_t cifras = 0; // bit coded, see GetDimParams() below
447d2a5b 409 cifras = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<7;
c42c6838 410 fhnMixedEvents = NewTHnSparseF("fhnMixedEvents", cifras);}
ea693273 411
da93bb11 412 if(fCheckMethods){
75bf77e3 413 fh2JetCoreMethod1C10 = new TH2F("JetCoreMethod1C10","",150, 0., 150.,100, 0., 1.5);
414 fh2JetCoreMethod2C10 = new TH2F("JetCoreMethod2C10","",150, 0., 150.,100, 0., 1.5);
ea693273 415 fh2JetCoreMethod1C20 = new TH2F("JetCoreMethod1C20","",150, 0., 150.,100, 0., 1.5);
416 fh2JetCoreMethod2C20 = new TH2F("JetCoreMethod2C20","",150, 0., 150.,100, 0., 1.5);
75bf77e3 417 fh2JetCoreMethod1C30 = new TH2F("JetCoreMethod1C30","",150, 0., 150.,100, 0., 1.5);
418 fh2JetCoreMethod2C30 = new TH2F("JetCoreMethod2C30","",150, 0., 150.,100, 0., 1.5);
75bf77e3 419 fh2JetCoreMethod1C60 = new TH2F("JetCoreMethod1C60","",150, 0., 150.,100, 0., 1.5);
da93bb11 420 fh2JetCoreMethod2C60 = new TH2F("JetCoreMethod2C60","",150, 0., 150.,100, 0., 1.5);}
421
ae73f4c9 422 fh3JetTrackC3060=new TH3F("JetTrackC3060","",50,0,50,150,0.,150.,35,0.,3.5);
423 fh3JetTrackC20=new TH3F("JetTrackC20","",50,0,50,150,0.,150.,35,0.,3.5);
da93bb11 424 if(fAngStructCloseTracks>0){
a9e585a7 425 fh2AngStructpt1C10 = new TH2F("Ang struct pt1 C10","",15,0.,1.5,150,0.,10.);
426 fh2AngStructpt2C10 = new TH2F("Ang struct pt2 C10","",15,0.,1.5,150,0.,10.);
427 fh2AngStructpt3C10 = new TH2F("Ang struct pt3 C10","",15,0.,1.5,150,0.,10.);
428 fh2AngStructpt4C10 = new TH2F("Ang struct pt4 C10","",15,0.,1.5,150,0.,10.);
429 fh2AngStructpt1C20 = new TH2F("Ang struct pt1 C20","",15,0.,1.5,150,0.,10.);
430 fh2AngStructpt2C20 = new TH2F("Ang struct pt2 C20","",15,0.,1.5,150,0.,10.);
431 fh2AngStructpt3C20 = new TH2F("Ang struct pt3 C20","",15,0.,1.5,150,0.,10.);
432 fh2AngStructpt4C20 = new TH2F("Ang struct pt4 C20","",15,0.,1.5,150,0.,10.);
433 fh2AngStructpt1C30 = new TH2F("Ang struct pt1 C30","",15,0.,1.5,150,0.,10.);
434 fh2AngStructpt2C30 = new TH2F("Ang struct pt2 C30","",15,0.,1.5,150,0.,10.);
435 fh2AngStructpt3C30 = new TH2F("Ang struct pt3 C30","",15,0.,1.5,150,0.,10.);
436 fh2AngStructpt4C30 = new TH2F("Ang struct pt4 C30","",15,0.,1.5,150,0.,10.);
437 fh2AngStructpt1C60 = new TH2F("Ang struct pt1 C60","",15,0.,1.5,150,0.,10.);
438 fh2AngStructpt2C60 = new TH2F("Ang struct pt2 C60","",15,0.,1.5,150,0.,10.);
439 fh2AngStructpt3C60 = new TH2F("Ang struct pt3 C60","",15,0.,1.5,150,0.,10.);
440 fh2AngStructpt4C60 = new TH2F("Ang struct pt4 C60","",15,0.,1.5,150,0.,10.); }
20dcc500 441
ba143e7f 442
a36ea0f9 443 fh1TrigRef=new TH1D("Trig Ref","",10,0.,10);
444 fh1TrigSig=new TH1D("Trig Sig","",10,0.,10);
6d494617 445 fh1TrackPhiDistance=new TH1D("PhiDistance","",35,0.,3.5);
446 fh1TrackRDistance=new TH1D("RDistance","",10,0.,1);
2bdd7660 447 fh2Ntriggers=new TH2F("# of triggers","",100,0.,100.,50,0.,50.);
d90d5d75 448 fh2Ntriggers2C10=new TH2F("# of triggers2C10","",50,0.,50.,50,0.,50.);
449 fh2Ntriggers2C20=new TH2F("# of triggers2C20","",50,0.,50.,50,0.,50.);
2bdd7660 450 fh3JetDensity=new TH3F("Jet density vs mutliplicity A>0.07","",100,0.,4000.,100,0.,5.,25,0.,50.);
451 fh3JetDensityA4=new TH3F("Jet density vs multiplicity A>0.4","",100,0.,4000.,100,0.,5.,25,0.,50.);
9807c9a1 452 fh2RPJetsC10=new TH2F("RPJetC10","",35,0.,3.5,100,0.,100.);
453 fh2RPJetsC20=new TH2F("RPJetC20","",35,0.,3.5,100,0.,100.);
454 fh2RPTC10=new TH2F("RPTriggerC10","",35,0.,3.5,50,0.,50.);
455 fh2RPTC20=new TH2F("RPTriggerC20","",35,0.,3.5,50,0.,50.);
4f6d1cc1 456
3353f803 457
d5e7475c 458
459
75bf77e3 460 fOutputList->Add(fHistEvtSelection);
a9e585a7 461
da93bb11 462 fOutputList->Add(fhnDeltaR);
463
529e2916 464 fOutputList->Add(fhnMixedEvents);
da93bb11 465
466
467
468 if(fCheckMethods){
529e2916 469
75bf77e3 470 fOutputList->Add(fh2JetCoreMethod1C10);
471 fOutputList->Add(fh2JetCoreMethod2C10);
ea693273 472 fOutputList->Add(fh2JetCoreMethod1C20);
473 fOutputList->Add(fh2JetCoreMethod2C20);
75bf77e3 474 fOutputList->Add(fh2JetCoreMethod1C30);
475 fOutputList->Add(fh2JetCoreMethod2C30);
75bf77e3 476 fOutputList->Add(fh2JetCoreMethod1C60);
da93bb11 477 fOutputList->Add(fh2JetCoreMethod2C60);}
a9e585a7 478
d5e7475c 479 fOutputList->Add(fh3JetTrackC3060);
e03c221a 480 fOutputList->Add(fh3JetTrackC20);
85b5b73e 481
4e90d948 482
75bf77e3 483
a9e585a7 484
485
486 if(fAngStructCloseTracks>0){
ea693273 487 fOutputList->Add(fh2AngStructpt1C10);
488 fOutputList->Add(fh2AngStructpt2C10);
489 fOutputList->Add(fh2AngStructpt3C10);
490 fOutputList->Add(fh2AngStructpt4C10);
491 fOutputList->Add(fh2AngStructpt1C20);
492 fOutputList->Add(fh2AngStructpt2C20);
493 fOutputList->Add(fh2AngStructpt3C20);
494 fOutputList->Add(fh2AngStructpt4C20);
495 fOutputList->Add(fh2AngStructpt1C30);
496 fOutputList->Add(fh2AngStructpt2C30);
497 fOutputList->Add(fh2AngStructpt3C30);
498 fOutputList->Add(fh2AngStructpt4C30);
499 fOutputList->Add(fh2AngStructpt1C60);
500 fOutputList->Add(fh2AngStructpt2C60);
501 fOutputList->Add(fh2AngStructpt3C60);
a9e585a7 502 fOutputList->Add(fh2AngStructpt4C60);}
20dcc500 503
504
d5e7475c 505
5bd732d4 506
a36ea0f9 507 fOutputList->Add(fh1TrigRef);
508 fOutputList->Add(fh1TrigSig);
6d494617 509 fOutputList->Add(fh1TrackPhiDistance);
510 fOutputList->Add(fh1TrackRDistance);
3a00a528 511 fOutputList->Add(fh2Ntriggers);
d90d5d75 512 fOutputList->Add(fh2Ntriggers2C10);
513 fOutputList->Add(fh2Ntriggers2C20);
ae1e07c1 514 fOutputList->Add(fh3JetDensity);
515 fOutputList->Add(fh3JetDensityA4);
d90d5d75 516 fOutputList->Add(fh2RPJetsC10);
517 fOutputList->Add(fh2RPJetsC20);
518 fOutputList->Add(fh2RPTC10);
519 fOutputList->Add(fh2RPTC20);
3353f803 520
4f6d1cc1 521 const Int_t dimSpec = 5;
2bdd7660 522 const Int_t nBinsSpec[dimSpec] = {100,6, 140, 50, fNRPBins};
4f6d1cc1 523 const Double_t lowBinSpec[dimSpec] = {0,0,-80, 0, 0};
2942f542 524 const Double_t hiBinSpec[dimSpec] = {100,1, 200, 50, static_cast<Double_t>(fNRPBins)};
4f6d1cc1 525 fHJetSpec = new THnSparseF("fHJetSpec","Recoil jet spectrum",dimSpec,nBinsSpec,lowBinSpec,hiBinSpec);
2bdd7660 526
527 //change binning in jet area
528 Double_t *xPt6 = new Double_t[7];
529 xPt6[0] = 0.;
530 xPt6[1]=0.07;
531 xPt6[2]=0.2;
532 xPt6[3]=0.4;
533 xPt6[4]=0.6;
534 xPt6[5]=0.8;
535 xPt6[6]=1;
536 fHJetSpec->SetBinEdges(1,xPt6);
537 delete [] xPt6;
538
539
540
541
542
4f6d1cc1 543 fOutputList->Add(fHJetSpec);
544
545
546 if(fRunAnaAzimuthalCorrelation)
547 {
548 fhTTPt = new TH2F("fhTTPt","Trigger track p_{T} vs centrality",10,0,100,100,0,100);
549 fOutputList->Add(fhTTPt);
550
551 const Int_t dimCor = 5;
552 const Int_t nBinsCor[dimCor] = {50, 200, 100, 8, 10};
553 const Double_t lowBinCor[dimCor] = {0, -50, -0.5*TMath::Pi(), 0, 0};
554 const Double_t hiBinCor[dimCor] = {50, 150, 1.5*TMath::Pi(), 0.8, 100};
555 fHJetPhiCorr = new THnSparseF("fHJetPhiCorr","TT p_{T} vs jet p_{T} vs dPhi vs area vs centrality",dimCor,nBinsCor,lowBinCor,hiBinCor);
556 fOutputList->Add(fHJetPhiCorr);
557 }
558
559
560
d5e7475c 561
75bf77e3 562 // =========== Switch on Sumw2 for all histos ===========
563 for (Int_t i=0; i<fOutputList->GetEntries(); ++i) {
564 TH1 *h1 = dynamic_cast<TH1*>(fOutputList->At(i));
565 if (h1){
566 h1->Sumw2();
567 continue;
568 }
ea693273 569 THnSparse *hn = dynamic_cast<THnSparse*>(fOutputList->At(i));
570 if (hn){
571 hn->Sumw2();
572 }
75bf77e3 573 }
574 TH1::AddDirectory(oldStatus);
575
576 PostData(1, fOutputList);
577}
578
579void AliAnalysisTaskJetCore::UserExec(Option_t *)
580{
581
582
583 if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){
584 AliError("Jet branch name not set.");
585 return;
586 }
587
588 fESD=dynamic_cast<AliESDEvent*>(InputEvent());
589 if (!fESD) {
590 AliError("ESD not available");
5bd732d4 591 fAODIn = dynamic_cast<AliAODEvent*>(InputEvent());
592 }
593 fAODOut = dynamic_cast<AliAODEvent*>(AODEvent());
594
595 static AliAODEvent* aod = 0;
596 // take all other information from the aod we take the tracks from
597 if(!aod){
598 if(!fESD)aod = fAODIn;
599 else aod = fAODOut;}
600
601
ea693273 602
603 if(fNonStdFile.Length()!=0){
604 // case that we have an AOD extension we need can fetch the jets from the extended output
605 AliAODHandler *aodH = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
606 fAODExtension = (aodH?aodH->GetExtension(fNonStdFile.Data()):0);
607 if(!fAODExtension){
608 if(fDebug>1)Printf("AODExtension found for %s",fNonStdFile.Data());
609 }}
610
611
75bf77e3 612 // -- event selection --
613 fHistEvtSelection->Fill(1); // number of events before event selection
614
4a7492a4 615
616 Bool_t selected=kTRUE;
617 selected = AliAnalysisHelperJetTasks::Selected();
618 if(!selected){
619 // no selection by the service task, we continue
620 PostData(1,fOutputList);
621 return;}
622
623
624
625 // physics selection: this is now redundant, all should appear as accepted after service task selection
75bf77e3 626 AliInputEventHandler* inputHandler = (AliInputEventHandler*)
627 ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
0a1ffd97 628 std::cout<<inputHandler->IsEventSelected()<<" "<<fOfflineTrgMask<<std::endl;
4f6d1cc1 629 if(!(inputHandler->IsEventSelected() & fOfflineTrgMask)){
630 if(fDebug) Printf(" Trigger Selection: event REJECTED ... ");
631 fHistEvtSelection->Fill(2);
632 PostData(1, fOutputList);
633 return;
634 }
75bf77e3 635
4a7492a4 636
637
75bf77e3 638 // vertex selection
5bd732d4 639 if(!aod){
52721bee 640 if(fDebug) Printf("%s:%d No AOD",(char*)__FILE__,__LINE__);
641 fHistEvtSelection->Fill(3);
642 PostData(1, fOutputList);
643 }
5bd732d4 644 AliAODVertex* primVtx = aod->GetPrimaryVertex();
52721bee 645
646 if(!primVtx){
647 if(fDebug) Printf("%s:%d No primVtx",(char*)__FILE__,__LINE__);
648 fHistEvtSelection->Fill(3);
d27719bf 649 PostData(1, fOutputList);
650 return;
52721bee 651 }
652
75bf77e3 653 Int_t nTracksPrim = primVtx->GetNContributors();
654 if ((nTracksPrim < fMinContribVtx) ||
655 (primVtx->GetZ() < fVtxZMin) ||
656 (primVtx->GetZ() > fVtxZMax) ){
657 if(fDebug) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ());
658 fHistEvtSelection->Fill(3);
659 PostData(1, fOutputList);
660 return;
661 }
662
663 // event class selection (from jet helper task)
664 Int_t eventClass = AliAnalysisHelperJetTasks::EventClass();
665 if(fDebug) Printf("Event class %d", eventClass);
666 if (eventClass < fEvtClassMin || eventClass > fEvtClassMax){
667 fHistEvtSelection->Fill(4);
668 PostData(1, fOutputList);
669 return;
670 }
671
672 // centrality selection
673 AliCentrality *cent = 0x0;
da93bb11 674 Double_t centValue = 0.;
8205e054 675 if(fIsPbPb){
20dcc500 676 if(fESD) {cent = fESD->GetCentrality();
677 if(cent) centValue = cent->GetCentralityPercentile("V0M");}
0a918d8d 678 else centValue=((AliVAODHeader*)aod->GetHeader())->GetCentrality();
20dcc500 679
75bf77e3 680 if(fDebug) printf("centrality: %f\n", centValue);
3353f803 681 if (centValue < fCentMin || centValue > fCentMax){
682 fHistEvtSelection->Fill(4);
683 PostData(1, fOutputList);
684 return;
8205e054 685 }}
75bf77e3 686
687
568f8fa2 688 fHistEvtSelection->Fill(0);
689 // accepted events
75bf77e3 690 // -- end event selection --
ea693273 691
75bf77e3 692 // get background
693 AliAODJetEventBackground* externalBackground = 0;
5bd732d4 694 if(fAODOut&&!externalBackground&&fBackgroundBranch.Length()){
695 externalBackground = (AliAODJetEventBackground*)(fAODOut->FindListObject(fBackgroundBranch.Data()));
75bf77e3 696 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
697 }
ea693273 698 if(fAODExtension&&!externalBackground&&fBackgroundBranch.Length()){
699 externalBackground = (AliAODJetEventBackground*)(fAODExtension->GetAOD()->FindListObject(fBackgroundBranch.Data()));
700 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
701 }
5bd732d4 702
703 if(fAODIn&&!externalBackground&&fBackgroundBranch.Length()){
704 externalBackground = (AliAODJetEventBackground*)(fAODIn->FindListObject(fBackgroundBranch.Data()));
705 if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
706 }
ea693273 707
75bf77e3 708 Float_t rho = 0;
75bf77e3 709
d5e7475c 710 if(fFlagRandom==0){
711 if(externalBackground)rho = externalBackground->GetBackground(0);}
041d03f8 712 if(fFlagRandom==2){
d5e7475c 713 if(externalBackground)rho = externalBackground->GetBackground(2);}
041d03f8 714 if(fFlagRandom==3){
715 if(externalBackground)rho = externalBackground->GetBackground(3);}
75bf77e3 716 // fetch jets
717 TClonesArray *aodJets[2];
ea693273 718 aodJets[0]=0;
5bd732d4 719 if(fAODOut&&!aodJets[0]){
720 aodJets[0] = dynamic_cast<TClonesArray*>(fAODOut->FindListObject(fJetBranchName[0].Data()));
721 aodJets[1] = dynamic_cast<TClonesArray*>(fAODOut->FindListObject(fJetBranchName[1].Data())); }
ea693273 722 if(fAODExtension && !aodJets[0]){
529e2916 723 aodJets[0] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[0].Data()));
724 aodJets[1] = dynamic_cast<TClonesArray*>(fAODExtension->GetAOD()->FindListObject(fJetBranchName[1].Data())); }
5bd732d4 725 if(fAODIn&&!aodJets[0]){
726 aodJets[0] = dynamic_cast<TClonesArray*>(fAODIn->FindListObject(fJetBranchName[0].Data()));
727 aodJets[1] = dynamic_cast<TClonesArray*>(fAODIn->FindListObject(fJetBranchName[1].Data())); }
728
ea693273 729
4c074aaf 730
ccf12e54 731 Int_t nT=0;
ea693273 732 TList ParticleList;
4c074aaf 733 Double_t minT=0;
734 Double_t maxT=0;
a36ea0f9 735 Int_t number=0;
4c074aaf 736 Double_t dice=fRandom->Uniform(0,1);
737 if(dice>fFrac){ minT=fTTLowRef;
738 maxT=fTTUpRef;}
739 if(dice<=fFrac){minT=fTTLowSig;
740 maxT=fTTUpSig;}
741
742
743
744 if(fHardest==1 || fHardest==2) nT = GetListOfTracks(&ParticleList);
a36ea0f9 745 if(fHardest==0) nT=SelectTrigger(&ParticleList,minT,maxT,number);
4c074aaf 746 if(nT<0){
747 PostData(1, fOutputList);
748 return;}
749
a36ea0f9 750 if(dice>fFrac) fh1TrigRef->Fill(number);
de02d50a 751 if(dice<=fFrac)fh1TrigSig->Fill(number);
4c074aaf 752
ea693273 753 for (Int_t iJetType = 0; iJetType < 2; iJetType++) {
75bf77e3 754 fListJets[iJetType]->Clear();
755 if (!aodJets[iJetType]) continue;
75bf77e3 756 if(fDebug) Printf("%s: %d jets",fJetBranchName[iJetType].Data(),aodJets[iJetType]->GetEntriesFast());
75bf77e3 757 for (Int_t iJet = 0; iJet < aodJets[iJetType]->GetEntriesFast(); iJet++) {
758 AliAODJet *jet = dynamic_cast<AliAODJet*>((*aodJets[iJetType])[iJet]);
529e2916 759 if (jet) fListJets[iJetType]->Add(jet);
760 // if(iJetType==0){
761 // ptsub[iJet]=jet->Pt()-rho*jet->EffectiveAreaCharged();}
762 }}
75bf77e3 763
764 Double_t etabig=0;
765 Double_t ptbig=0;
766 Double_t areabig=0;
767 Double_t phibig=0.;
768 Double_t etasmall=0;
769 Double_t ptsmall=0;
105db8c2 770 // Double_t areasmall=0;
75bf77e3 771 Double_t phismall=0.;
a9e585a7 772
da93bb11 773
d5e7475c 774
529e2916 775 Int_t iCount=0;
776 Int_t trigJet=-1;
777 Int_t trigBBTrack=-1;
0a918d8d 778 // Int_t trigInTrack=-1;
779 fRPAngle = ((AliVAODHeader*)aod->GetHeader())->GetEventplane();
85b5b73e 780
4c074aaf 781 if(fHardest==0 || fHardest==1){
41bcb7e7 782 AliVParticle *partback = (AliVParticle*)ParticleList.At(nT);
783 if(!partback){
784 PostData(1, fOutputList);
785 return;}
e22029ea 786
4c074aaf 787 if(fSemigoodCorrect){
788 Double_t disthole=RelativePhi(partback->Phi(),fHolePos);
789 if(TMath::Abs(disthole)+fHoleWidth>TMath::Pi()-0.6){
790 PostData(1, fOutputList);
791 return;}}
792
793
794 }
795
796
797 for(Int_t tt=0;tt<ParticleList.GetEntries();tt++){
798 if(fHardest==0||fHardest==1){if(tt!=nT) continue;}
799 AliVParticle *partback = (AliVParticle*)ParticleList.At(tt);
800 if(!partback) continue;
a36ea0f9 801 if(partback->Pt()<8) continue;
e22029ea 802
8205e054 803 Double_t accep=2.*TMath::Pi()*1.8;
4e90d948 804 Int_t injet4=0;
805 Int_t injet=0;
4c074aaf 806
9807c9a1 807 if(fSemigoodCorrect){
808 Double_t disthole=RelativePhi(partback->Phi(),fHolePos);
4c074aaf 809 if(TMath::Abs(disthole)+fHoleWidth>TMath::Pi()-0.6) continue;}
9807c9a1 810
4c074aaf 811
41bcb7e7 812
39ab56a2 813 fh2Ntriggers->Fill(centValue,partback->Pt());
814 Double_t phiBinT = RelativePhi(partback->Phi(),fRPAngle);
815 if(centValue<20.) fh2RPTC20->Fill(TMath::Abs(phiBinT),partback->Pt());
816 if(centValue<10.) fh2RPTC10->Fill(TMath::Abs(phiBinT),partback->Pt());
817
818
819
75bf77e3 820 for(Int_t i=0; i<fListJets[0]->GetEntries(); ++i){
821 AliAODJet* jetbig = (AliAODJet*)(fListJets[0]->At(i));
822 etabig = jetbig->Eta();
823 phibig = jetbig->Phi();
824 ptbig = jetbig->Pt();
825 if(ptbig==0) continue;
d90d5d75 826 Double_t phiBin = RelativePhi(phibig,fRPAngle);
75bf77e3 827 areabig = jetbig->EffectiveAreaCharged();
ea693273 828 Double_t ptcorr=ptbig-rho*areabig;
75bf77e3 829 if((etabig<fJetEtaMin)||(etabig>fJetEtaMax)) continue;
ae1e07c1 830 if(areabig>=0.07) injet=injet+1;
8205e054 831 if(areabig>=0.4) injet4=injet4+1;
ca1009f1 832 Double_t dphi=RelativePhi(partback->Phi(),phibig);
833
ae1e07c1 834 if(fFlagEtaBkg==1){
ca1009f1 835 Double_t etadif= partback->Eta()-etabig;
836 if(TMath::Abs(etadif)<=0.5){
85b5b73e 837
ca1009f1 838 if(centValue<20.) fh3JetTrackC20->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));
839 if(centValue>30. && centValue<60.) fh3JetTrackC3060->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));}}
ca1009f1 840 if(fFlagEtaBkg==0){
e03c221a 841 if(centValue<20.) fh3JetTrackC20->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));
ca1009f1 842 if(centValue>30. && centValue<60.) fh3JetTrackC3060->Fill(partback->Pt(),ptcorr,TMath::Abs(dphi));}
843
844
16a4c8e8 845 if(fFlagJetHadron==0){
2bdd7660 846 if(fFlagPhiBkg==1) if((TMath::Abs(dphi)<TMath::Pi()/2.-0.1)||(TMath::Abs(dphi)>TMath::Pi()/2.+0.1)) continue;
847 if(fFlagPhiBkg==0) if(TMath::Abs(dphi)<TMath::Pi()-0.6) continue;
848 if(fFlagPhiBkg==2) if(TMath::Abs(dphi)<TMath::Pi()-0.7) continue;
849 if(fFlagPhiBkg==3) if(TMath::Abs(dphi)<TMath::Pi()-0.5) continue;}
16a4c8e8 850
851 if(fFlagJetHadron!=0) if(TMath::Abs(dphi)>0.4) continue;
852
853
d90d5d75 854 if(centValue<10.) fh2RPJetsC10->Fill(TMath::Abs(phiBin), ptcorr);
855 if(centValue<20.) fh2RPJetsC20->Fill(TMath::Abs(phiBin), ptcorr);
75bf77e3 856 Double_t dismin=100.;
857 Double_t ptmax=-10.;
858 Int_t index1=-1;
859 Int_t index2=-1;
4f6d1cc1 860
861 Float_t phitt=partback->Phi();
862 if(phitt<0)phitt+=TMath::Pi()*2.;
863 Int_t phiBintt = GetPhiBin(phitt-fRPAngle);
864
2942f542 865 Double_t fillspec[] = {centValue,jetbig->EffectiveAreaCharged(),ptcorr,partback->Pt(), static_cast<Double_t>(phiBintt)};
4f6d1cc1 866 fHJetSpec->Fill(fillspec);
867
e22029ea 868
3353f803 869
870 if(ptcorr<=0) continue;
16a4c8e8 871
16a4c8e8 872 AliAODTrack* leadtrack=0;
da93bb11 873 Int_t ippt=0;
16a4c8e8 874 Double_t ppt=-10;
875 if(fFlagJetHadron==0){
0bf6381d 876 TRefArray *genTrackList = jetbig->GetRefTracks();
877 Int_t nTracksGenJet = genTrackList->GetEntriesFast();
878 AliAODTrack* genTrack;
879 for(Int_t ir=0; ir<nTracksGenJet; ++ir){
880 genTrack = (AliAODTrack*)(genTrackList->At(ir));
881 if(genTrack->Pt()>ppt){ppt=genTrack->Pt();
882 ippt=ir;}}
883 leadtrack=(AliAODTrack*)(genTrackList->At(ippt));
884 if(!leadtrack) continue;
885 }
16a4c8e8 886
dfaeec0d 887
888
16a4c8e8 889 AliVParticle* leadtrackb=0;
890 if(fFlagJetHadron!=0){
891 Int_t nTb = GetHardestTrackBackToJet(jetbig);
892 leadtrackb = (AliVParticle*)ParticleList.At(nTb);
893 if(!leadtrackb) continue;
894 }
895
896
897
898
d5e7475c 899
0bf6381d 900 //store one trigger info
901 if(iCount==0){
902 trigJet=i;
903 trigBBTrack=nT;
105db8c2 904 // trigInTrack=ippt;
0bf6381d 905 iCount=iCount+1;}
906
d5e7475c 907
0bf6381d 908 if(fCheckMethods){
909 for(Int_t j=0; j<fListJets[1]->GetEntries(); ++j){
910 AliAODJet* jetsmall = (AliAODJet*)(fListJets[1]->At(j));
911 etasmall = jetsmall->Eta();
912 phismall = jetsmall->Phi();
913 ptsmall = jetsmall->Pt();
105db8c2 914 // areasmall = jetsmall->EffectiveAreaCharged();
0bf6381d 915 Double_t tmpDeltaR=(phismall-phibig)*(phismall-phibig)+(etasmall-etabig)*(etasmall-etabig);
916 tmpDeltaR=TMath::Sqrt(tmpDeltaR);
917 //Fraction in the jet core
918 if((ptsmall>ptmax)&&(tmpDeltaR<=fRadioFrac)){ptmax=ptsmall;
919 index2=j;}
ea693273 920 if(tmpDeltaR<=dismin){ dismin=tmpDeltaR;
921 index1=j;}} //en of loop over R=0.2 jets
75bf77e3 922 //method1:most concentric jet=core
923 if(dismin<fMinDist){ AliAODJet* jetmethod1 = (AliAODJet*)(fListJets[1]->At(index1));
ea693273 924 if(centValue<10) fh2JetCoreMethod1C10->Fill(ptcorr,jetmethod1->Pt()/ptbig);
925 if((centValue>20)&&(centValue<40)) fh2JetCoreMethod1C20->Fill(ptcorr,jetmethod1->Pt()/ptbig);
926 if((centValue>30)&&(centValue<60)) fh2JetCoreMethod1C30->Fill(ptcorr,jetmethod1->Pt()/ptbig);
927 if(centValue>60) fh2JetCoreMethod1C60->Fill(ptcorr,jetmethod1->Pt()/ptbig); }
75bf77e3 928 //method2:hardest contained jet=core
929 if(index2!=-1){
930 AliAODJet* jetmethod2 = (AliAODJet*)(fListJets[1]->At(index2));
ea693273 931 if(centValue<10) fh2JetCoreMethod2C10->Fill(ptcorr,jetmethod2->Pt()/ptbig);
932 if((centValue>20)&&(centValue<40)) fh2JetCoreMethod2C20->Fill(ptcorr,jetmethod2->Pt()/ptbig);
933 if((centValue>30)&&(centValue<60)) fh2JetCoreMethod2C30->Fill(ptcorr,jetmethod2->Pt()/ptbig);
da93bb11 934 if(centValue>60) fh2JetCoreMethod2C60->Fill(ptcorr,jetmethod2->Pt()/ptbig); }}
dfaeec0d 935 if(centValue<10&&leadtrack) fh2Ntriggers2C10->Fill(leadtrack->Pt(),partback->Pt());
936 if(centValue<20&&leadtrack) fh2Ntriggers2C20->Fill(leadtrack->Pt(),partback->Pt());
d90d5d75 937 if(fDoEventMixing==0 && fFlagOnlyRecoil==0){
41bcb7e7 938 for(int it = 0;it<ParticleList.GetEntries();++it){
939 AliVParticle *part = (AliVParticle*)ParticleList.At(it);
940 Double_t deltaR = jetbig->DeltaR(part);
941 Double_t deltaEta = etabig-part->Eta();
d90d5d75 942
41bcb7e7 943 Double_t deltaPhi=phibig-part->Phi();
944 if(deltaPhi<-0.5*TMath::Pi()) deltaPhi+=2.*TMath::Pi();
945 if(deltaPhi>3./2.*TMath::Pi()) deltaPhi-=2.*TMath::Pi();
946 Double_t pTcont=0;
947 if(fFlagJetHadron==0) pTcont=leadtrack->Pt();
948 if(fFlagJetHadron!=0) pTcont=leadtrackb->Pt();
949 Double_t jetEntries[8] = {centValue,ptcorr,part->Pt(),deltaR,deltaEta,deltaPhi,pTcont,partback->Pt()};
950 fhnDeltaR->Fill(jetEntries);}
951
952
d90d5d75 953 }
85b5b73e 954
d5e7475c 955
d5e7475c 956 //end of track loop, we only do it if EM is switched off
957
ba143e7f 958
959
960
961
962
963
964
20dcc500 965
966 }
ae1e07c1 967 if(injet>0) fh3JetDensity->Fill(ParticleList.GetEntries(),injet/accep,partback->Pt());
968 if(injet4>0)fh3JetDensityA4->Fill(ParticleList.GetEntries(),injet4/accep,partback->Pt());
529e2916 969 //end of jet loop
970
41bcb7e7 971 //}
529e2916 972
973
447d2a5b 974 if(fDoEventMixing>0){
529e2916 975 //check before if the trigger exists
976 // fTrigBuffer[i][0] = zvtx
977 // fTrigBuffer[i][1] = phi
978 // fTrigBuffer[i][2] = eta
979 // fTrigBuffer[i][3] = pt_jet
980 // fTrigBuffer[i][4] = pt_trig
447d2a5b 981 // fTrigBuffer[i][5]= centrality
982 if(fTindex==10) fTindex=0;
529e2916 983 if(fTrigBuffer[fTindex][3]>0){
984 if (TMath::Abs(fTrigBuffer[fTindex][0]-primVtx->GetZ()<2.)){
447d2a5b 985 if (TMath::Abs(fTrigBuffer[fTindex][5]-centValue<5)){
529e2916 986
987 for(int it = 0;it<nT;++it){
20dcc500 988 AliVParticle *part = (AliVParticle*)ParticleList.At(it);
989 Double_t DPhi = fTrigBuffer[fTindex][1] - part->Phi();
529e2916 990 Double_t DEta = fTrigBuffer[fTindex][2] - part->Eta();
991 Double_t DR=TMath::Sqrt(DPhi*DPhi+DEta*DEta);
992 if(DPhi<-0.5*TMath::Pi()) DPhi+=2.*TMath::Pi();
993 if(DPhi>3./2.*TMath::Pi()) DPhi-=2.*TMath::Pi();
447d2a5b 994 Double_t triggerEntries[7] = {centValue,fTrigBuffer[fTindex][3],part->Pt(),DR,DEta,DPhi,fTrigBuffer[fTindex][4]};
529e2916 995 fhnMixedEvents->Fill(triggerEntries);
996 }
997 fNevents=fNevents+1;
447d2a5b 998 if(fNevents==10) fTindex=fTindex+1;
529e2916 999 }}}
ae1e07c1 1000
447d2a5b 1001 if(fTindex==10&&fNevents==10) fCountAgain=0;
529e2916 1002
1003 // Copy the triggers from the current event into the buffer.
1004 //again, only if the trigger exists:
447d2a5b 1005 if(fCountAgain==0){
529e2916 1006 if(trigJet>-1){
447d2a5b 1007 AliAODJet* jetT = (AliAODJet*)(fListJets[0]->At(trigJet)); AliVParticle *partT = (AliVParticle*)ParticleList.At(trigBBTrack);
529e2916 1008 fTrigBuffer[fTrigBufferIndex][0] = primVtx->GetZ();
1009 fTrigBuffer[fTrigBufferIndex][1] = jetT->Phi();
1010 fTrigBuffer[fTrigBufferIndex][2] = jetT->Eta();
1011 fTrigBuffer[fTrigBufferIndex][3] = jetT->Pt()-rho*jetT->EffectiveAreaCharged();
1012 fTrigBuffer[fTrigBufferIndex][4] = partT->Pt();
447d2a5b 1013 fTrigBuffer[fTrigBufferIndex][5] = centValue;
529e2916 1014 fTrigBufferIndex++;
447d2a5b 1015 if(fTrigBufferIndex==9) {fTrigBufferIndex=0;
1016 fCountAgain=1;}
529e2916 1017 }
447d2a5b 1018 }
529e2916 1019
447d2a5b 1020 }
529e2916 1021
4f6d1cc1 1022 /////////////////////////////////////////////////////////////////////////////
1023 ////////////////////// Rongrong's analysis //////////////////////////////////
1024 if(fRunAnaAzimuthalCorrelation)
1025 {
1026 fhTTPt->Fill(centValue,partback->Pt());
1027 for(Int_t ij=0; ij<fListJets[0]->GetEntries(); ij++)
1028 {
1029 AliAODJet* jet = (AliAODJet*)(fListJets[0]->At(ij));
1030 Double_t jetPt = jet->Pt();
1031 Double_t jetEta = jet->Eta();
1032 Double_t jetPhi = jet->Phi();
1033 if(jetPt==0) continue;
1034 if((jetEta<fJetEtaMin)||(jetEta>fJetEtaMax)) continue;
1035 Double_t jetArea = jet->EffectiveAreaCharged();
1036 Double_t jetPtCorr=jetPt-rho*jetArea;
830b5724 1037 Double_t dPhi=jetPhi-partback->Phi();
4f6d1cc1 1038 if(dPhi>2*TMath::Pi()) dPhi -= 2*TMath::Pi();
830b5724 1039 if(dPhi<-2*TMath::Pi()) dPhi += 2*TMath::Pi();
1040 if(dPhi<-0.5*TMath::Pi()) dPhi += 2*TMath::Pi();
1041 if(dPhi>1.5*TMath::Pi()) dPhi -= 2*TMath::Pi();
1042
4f6d1cc1 1043 Double_t fill[] = {partback->Pt(),jetPtCorr,dPhi,jetArea,centValue};
1044 fHJetPhiCorr->Fill(fill);
1045 }
1046 }
1047 /////////////////////////////////////////////////////////////////////////////
1048 /////////////////////////////////////////////////////////////////////////////
529e2916 1049
da93bb11 1050
ea693273 1051 //////////////////ANGULAR STRUCTURE//////////////////////////////////////
1052
1053 //tracks up to R=0.8 distant from the jet axis
529e2916 1054 // if(fAngStructCloseTracks==1){
1055 // TList CloseTrackList;
1056 // Int_t nn=GetListOfTracksCloseToJet(&CloseTrackList,jetbig);
1057 // Double_t difR=0.04;
1058 // for(Int_t l=0;l<15;l++){
1059 // Double_t rr=l*0.1+0.1;
1060 // for(int it = 0;it<nn;++it){
1061 // AliVParticle *part1 = (AliVParticle*)CloseTrackList.At(it);
1062 // for(int itu=it+1;itu<CloseTrackList.GetEntries();itu++){
1063 // AliVParticle *part2 = (AliVParticle*)CloseTrackList.At(itu);
1064 // Double_t ptm=part1->Pt();
1065 // Double_t ptn=part2->Pt();
1066 // Double_t Rnm = (part1->Eta()-part2->Eta())*(part1->Eta()-part2->Eta())+(part1->Phi()-part2->Phi())*(part1->Phi()-part2->Phi());
1067 // Rnm=TMath::Sqrt(Rnm);
1068 // Double_t deltag=(1./(TMath::Sqrt(2*TMath::Pi())*difR))*TMath::Exp(-1.*(rr-Rnm)*(rr-Rnm)/(2.*difR*difR));
1069 // Double_t stepf=0.5*(1.+TMath::Erf((rr-Rnm)/(TMath::Sqrt(2.)*difR)));
1070 // if((ptcorr<85.) && (ptcorr>=70.)){up1[l]=up1[l]+ptm*ptn*Rnm*Rnm*deltag;
1071 // down1[l]=down1[l]+ptm*ptn*Rnm*Rnm*stepf;}
1072 // if((ptcorr<100.) && (ptcorr>=85.)){up2[l]=up2[l]+ptm*ptn*Rnm*Rnm*deltag;
1073 // down2[l]=down2[l]+ptm*ptn*Rnm*Rnm*stepf;}
1074 // if((ptcorr<120.) && (ptcorr>=100.)){up3[l]=up3[l]+ptm*ptn*Rnm*Rnm*deltag;
1075 // down3[l]=down3[l]+ptm*ptn*Rnm*Rnm*stepf;}
1076 // if((ptcorr<140.) && (ptcorr>=120.)){up4[l]=up4[l]+ptm*ptn*Rnm*Rnm*deltag;
1077 // down4[l]=down4[l]+ptm*ptn*Rnm*Rnm*stepf;}}}}
1078 // }
ea693273 1079
529e2916 1080 // //only jet constituents
1081 // if(fAngStructCloseTracks==2){
ea693273 1082
529e2916 1083 // Double_t difR=0.04;
1084 // for(Int_t l=0;l<15;l++){
1085 // Double_t rr=l*0.1+0.1;
ea693273 1086
1087
529e2916 1088 // AliAODTrack* part1;
1089 // AliAODTrack* part2;
da93bb11 1090
529e2916 1091 // TRefArray *genTrackListb = jetbig->GetRefTracks();
1092 // Int_t nTracksGenJetb = genTrackListb->GetEntriesFast();
da93bb11 1093
1094
1095
529e2916 1096 // for(Int_t it=0; it<nTracksGenJetb; ++it){
1097 // part1 = (AliAODTrack*)(genTrackListb->At(it));
1098 // for(Int_t itu=0; itu<nTracksGenJetb; ++itu){
1099 // part2 = (AliAODTrack*)(genTrackListb->At(itu));
1100 // Double_t ptm=part1->Pt();
1101 // Double_t ptn=part2->Pt();
1102 // Double_t Rnm = (part1->Eta()-part2->Eta())*(part1->Eta()-part2->Eta())+(part1->Phi()-part2->Phi())*(part1->Phi()-part2->Phi());
1103 // Rnm=TMath::Sqrt(Rnm);
1104 // Double_t deltag=(1./(TMath::Sqrt(2*TMath::Pi())*difR))*TMath::Exp(-1.*(rr-Rnm)*(rr-Rnm)/(2.*difR*difR));
1105 // Double_t stepf=0.5*(1.+TMath::Erf((rr-Rnm)/(TMath::Sqrt(2.)*difR)));
1106 // if((ptcorr<85.) && (ptcorr>=70.)){up1[l]=up1[l]+ptm*ptn*Rnm*Rnm*deltag;
1107 // down1[l]=down1[l]+ptm*ptn*Rnm*Rnm*stepf;}
1108 // if((ptcorr<100.) && (ptcorr>=85.)){up2[l]=up2[l]+ptm*ptn*Rnm*Rnm*deltag;
1109 // down2[l]=down2[l]+ptm*ptn*Rnm*Rnm*stepf;}
1110 // if((ptcorr<120.) && (ptcorr>=100.)){up3[l]=up3[l]+ptm*ptn*Rnm*Rnm*deltag;
1111 // down3[l]=down3[l]+ptm*ptn*Rnm*Rnm*stepf;}
1112 // if((ptcorr<140.) && (ptcorr>=120.)){up4[l]=up4[l]+ptm*ptn*Rnm*Rnm*deltag;
1113 // down4[l]=down4[l]+ptm*ptn*Rnm*Rnm*stepf;}}}}}
1114 // }
1115 // //end loop over R=0.4 jets
1116 // if(fAngStructCloseTracks>0){
1117 // for(Int_t l=0;l<15;l++){
1118 // Double_t rr=l*0.1+0.1;
1119 // if(down1[l]!=0){
1120 // if(centValue<10.)fh2AngStructpt1C10->Fill(rr,rr*up1[l]/down1[l]);
1121 // if(centValue>20. && centValue<40.) fh2AngStructpt1C20->Fill(rr,rr*up1[l]/down1[l]);
1122 // if(centValue>30. && centValue<60.) fh2AngStructpt1C30->Fill(rr,rr*up1[l]/down1[l]);
1123 // if(centValue>60.) fh2AngStructpt1C60->Fill(rr,rr*up1[l]/down1[l]);}
1124 // if(down2[l]!=0){
1125 // if(centValue<10.) fh2AngStructpt2C10->Fill(rr,rr*up2[l]/down2[l]);
1126 // if(centValue>20. && centValue<40.) fh2AngStructpt2C20->Fill(rr,rr*up2[l]/down2[l]);
1127 // if(centValue>30. && centValue<60.) fh2AngStructpt2C30->Fill(rr,rr*up2[l]/down2[l]);
1128 // if(centValue>60.) fh2AngStructpt2C60->Fill(rr,rr*up2[l]/down2[l]);}
1129 // if(down3[l]!=0){
1130 // if(centValue<10.) fh2AngStructpt3C10->Fill(rr,rr*up3[l]/down3[l]);
1131 // if(centValue>20. && centValue<40.) fh2AngStructpt3C20->Fill(rr,rr*up3[l]/down3[l]);
1132 // if(centValue>30. && centValue<60.) fh2AngStructpt3C30->Fill(rr,rr*up3[l]/down3[l]);
1133 // if(centValue>60.) fh2AngStructpt3C60->Fill(rr,rr*up3[l]/down3[l]);}
1134 // if(down4[l]!=0){
1135 // if(centValue<10.) fh2AngStructpt4C10->Fill(rr,rr*up4[l]/down4[l]);
1136 // if(centValue>20. && centValue<40.) fh2AngStructpt4C20->Fill(rr,rr*up4[l]/down4[l]);
1137 // if(centValue>30. && centValue<60.) fh2AngStructpt4C30->Fill(rr,rr*up4[l]/down4[l]);
1138 // if(centValue>60.) fh2AngStructpt4C60->Fill(rr,rr*up4[l]/down4[l]);}}}
ea693273 1139
1140
1141
4c074aaf 1142 }
ea693273 1143
75bf77e3 1144
1145
1146 PostData(1, fOutputList);
da93bb11 1147}
75bf77e3 1148
1149void AliAnalysisTaskJetCore::Terminate(const Option_t *)
1150{
1151 // Draw result to the screen
1152 // Called once at the end of the query
1153
1154 if (!GetOutputData(1))
1155 return;
1156}
1157
ea693273 1158
1159
5bd732d4 1160
ea693273 1161
1162
1163Int_t AliAnalysisTaskJetCore::GetListOfTracks(TList *list){
1164
85b5b73e 1165 Int_t iCount = 0;
1166 AliAODEvent *aod = 0;
1167
ba143e7f 1168 if(!fESD)aod = fAODIn;
5bd732d4 1169 else aod = fAODOut;
0bf6381d 1170
1171 if(!aod)return 0;
1172
1173 Int_t index=-1;
8205e054 1174 Double_t ptmax=-10;
85b5b73e 1175
1176
1177
1178 for(int it = 0;it < aod->GetNumberOfTracks();++it){
0a918d8d 1179 AliAODTrack *tr = dynamic_cast<AliAODTrack*>(aod->GetTrack(it));
1180 if(!tr) AliFatal("Not a standard AOD");
ae73f4c9 1181 Bool_t bGood = false;
1182 if(fFilterType == 0)bGood = true;
1183 else if(fFilterType == 1)bGood = tr->IsHybridTPCConstrainedGlobal();
d90d5d75 1184 else if(fFilterType == 2)bGood = tr->IsHybridGlobalConstrainedGlobal();
c18b64ea 1185 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
fb5db3fb 1186 if(fRequireITSRefit==1){if((tr->GetStatus()&AliESDtrack::kITSrefit)==0)continue;}
ae73f4c9 1187 if(bGood==false) continue;
fb5db3fb
ML
1188 if (fApplySharedClusterCut) {
1189 Double_t frac = Double_t(tr->GetTPCnclsS()) /Double_t(tr->GetTPCncls());
1190 if (frac > 0.4) continue;
1191 }
1192 if(TMath::Abs(tr->Eta())>0.9)continue;
ea693273 1193 if(tr->Pt()<0.15)continue;
1194 list->Add(tr);
ea693273 1195 iCount++;
d90d5d75 1196 if(fFilterType==2 && fFilterMaskBestPt>0){// only set the trigger track index for good quality tracks
873306cf 1197 if(tr->TestFilterBit(fFilterMaskBestPt)){
1198 if(tr->Pt()>ptmax){
1199 ptmax=tr->Pt();
1200 index=iCount-1;
1201 }
1202 }
1203 }
1204 else{
1205 if(tr->Pt()>ptmax){
1206 ptmax=tr->Pt();
1207 index=iCount-1;
1208 }
1209 }
85b5b73e 1210 }
ea693273 1211
529e2916 1212
85b5b73e 1213 // else if (type == kTrackAODMCCharged) {
1214 // TClonesArray *tca = dynamic_cast<TClonesArray*>(aod->FindListObject(AliAODMCParticle::StdBranchName()));
1215 // if(!tca)return iCount;
1216 // for(int it = 0;it < tca->GetEntriesFast();++it){
1217 // AliAODMCParticle *part = dynamic_cast<AliAODMCParticle*>(tca->At(it));
1218 // if(!part)continue;
1219 // if(part->Pt()<0.15)continue;
1220 // if(!part->IsPhysicalPrimary())continue;
1221 // if(part->Charge()==0)continue;
1222 // if(TMath::Abs(part->Eta())>0.9)continue;
1223 // list->Add(part);
1224 // iCount++;
1225 // if(part->Pt()>ptmax){ ptmax=part->Pt();
1226 // index=iCount-1;}}}
1227 return index;
ea693273 1228
1229}
1230
ccf12e54 1231
1232
a36ea0f9 1233Int_t AliAnalysisTaskJetCore::SelectTrigger(TList *list,Double_t minT,Double_t maxT,Int_t &number){
ccf12e54 1234 Int_t iCount = 0;
1235 AliAODEvent *aod = 0;
1236 if(!fESD)aod = fAODIn;
1237 else aod = fAODOut;
1238 if(!aod)return 0;
1239 Int_t index=-1;
4c074aaf 1240 Int_t triggers[100];
30ce87df 1241 Int_t triggers2[100];
1242 for(Int_t cr=0;cr<100;cr++){triggers[cr]=-1;
1243 triggers2[cr]=-1;}
ccf12e54 1244 Int_t im=0;
30ce87df 1245 Int_t im2=0;
ccf12e54 1246 for(int it = 0;it < aod->GetNumberOfTracks();++it){
0a918d8d 1247 AliAODTrack *tr = dynamic_cast<AliAODTrack*>(aod->GetTrack(it));
1248 if(!tr) AliFatal("Not a standard AOD");
ccf12e54 1249 Bool_t bGood = false;
1250 if(fFilterType == 0)bGood = true;
1251 else if(fFilterType == 1)bGood = tr->IsHybridTPCConstrainedGlobal();
9f8b6bd1 1252 else if(fFilterType == 2)bGood = tr->IsHybridGlobalConstrainedGlobal();
ccf12e54 1253 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
fb5db3fb 1254 if(fRequireITSRefit==1){if((tr->GetStatus()&AliESDtrack::kITSrefit)==0)continue;}
ccf12e54 1255 if(bGood==false) continue;
fb5db3fb
ML
1256 if (fApplySharedClusterCut) {
1257 Double_t frac = Double_t(tr->GetTPCnclsS()) /Double_t(tr->GetTPCncls());
1258 if (frac > 0.4) continue;
1259 }
ccf12e54 1260 if(TMath::Abs(tr->Eta())>0.9)continue;
1261 if(tr->Pt()<0.15)continue;
1262 list->Add(tr);
1263 iCount++;
1264
4c074aaf 1265 if(tr->Pt()>=minT && tr->Pt()<maxT){
ccf12e54 1266 triggers[im]=iCount-1;
30ce87df 1267 im=im+1;
1268 if(tr->Pt()>=20.){triggers2[im2]=iCount-1;
1269 im2=im2+1;}
ccf12e54 1270
30ce87df 1271 }}
1272
a36ea0f9 1273 number=im;
ccf12e54 1274 Int_t rd=0;
30ce87df 1275 if(im2==0) rd=0;
1276 if(im2>0) rd=fRandom->Integer(im2);
1277 index=triggers2[rd];
1278 AliVParticle *tr1 = (AliVParticle*)list->At(index);
3cdf5238 1279
1280
1281
30ce87df 1282 for(Int_t kk=0;kk<im;kk++){
1283 //if(kk==rd) continue;
1284 if(index==triggers[kk]) continue;
3cdf5238 1285 Int_t lab=triggers[kk];
1286 AliVParticle *tr2 = (AliVParticle*)list->At(lab);
1287
1288 Double_t detat=tr1->Eta()-tr2->Eta();
1289 Double_t dphit=RelativePhi(tr1->Phi(),tr2->Phi());
30ce87df 1290 Double_t deltaRt=TMath::Sqrt(detat*detat+dphit*dphit);
6d494617 1291 fh1TrackPhiDistance->Fill(TMath::Abs(dphit));
1292 fh1TrackRDistance->Fill(deltaRt);
1293
1294 if(fDodiHadron==1) if(deltaRt>0.4) number=number-1;
1295 if(fDodiHadron==2) if((deltaRt>0.4) && (TMath::Abs(dphit)>TMath::Pi()-0.6)) number=number-1;}
1296
ccf12e54 1297
1298
1299
1300
1301
1302 return index;
1303
1304}
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
da93bb11 1321 Int_t AliAnalysisTaskJetCore::GetHardestTrackBackToJet(AliAODJet *jetbig){
5bd732d4 1322
1323 AliAODEvent *aod = 0;
1324 if(!fESD)aod = fAODIn;
1325 else aod = fAODOut;
da93bb11 1326 Int_t index=-1;
1327 Double_t ptmax=-10;
1328 Double_t dphi=0;
105db8c2 1329 // Double_t dif=0;
da93bb11 1330 Int_t iCount=0;
5bd732d4 1331 for(int it = 0;it < aod->GetNumberOfTracks();++it){
0a918d8d 1332 AliAODTrack *tr = dynamic_cast<AliAODTrack*>(aod->GetTrack(it));
1333 if(!tr) AliFatal("Not a standard AOD");
da93bb11 1334 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
1335 if(TMath::Abs(tr->Eta())>0.9)continue;
1336 if(tr->Pt()<0.15)continue;
1337 iCount=iCount+1;
529e2916 1338 dphi=RelativePhi(tr->Phi(),jetbig->Phi());
16a4c8e8 1339 if(TMath::Abs(dphi)<TMath::Pi()-0.6) continue;
da93bb11 1340 if(tr->Pt()>ptmax){ ptmax=tr->Pt();
b6844e9e 1341 index=iCount-1;
105db8c2 1342 // dif=dphi;
1343 }}
da93bb11 1344
1345 return index;
1346
1347 }
1348
1349
1350
1351
1352
1353
1354
1355
1356
ea693273 1357 Int_t AliAnalysisTaskJetCore::GetListOfTracksCloseToJet(TList *list,AliAODJet *jetbig){
1358
1359 Int_t iCount = 0;
5bd732d4 1360 AliAODEvent *aod = 0;
1361 if(!fESD)aod = fAODIn;
1362 else aod = fAODOut;
8b47ec90 1363
16a4c8e8 1364 for(int it = 0;it < aod->GetNumberOfTracks();++it){
0a918d8d 1365 AliAODTrack *tr = dynamic_cast<AliAODTrack*>(aod->GetTrack(it));
1366 if(!tr) AliFatal("Not a standard AOD");
ea693273 1367 if((fFilterMask>0)&&!(tr->TestFilterBit(fFilterMask)))continue;
1368 if(TMath::Abs(tr->Eta())>0.9)continue;
1369 if(tr->Pt()<0.15)continue;
1370 Double_t disR=jetbig->DeltaR(tr);
1371 if(disR>0.8) continue;
1372 list->Add(tr);
1373 //cout<<fAOD->GetNumberOfTracks()<<" "<<tr->Pt()<<endl;
1374 iCount++;
1375 }
1376
1377 list->Sort();
1378 return iCount;
1379
1380}
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
75bf77e3 1392Int_t AliAnalysisTaskJetCore::GetNInputTracks()
1393{
1394
1395 Int_t nInputTracks = 0;
5bd732d4 1396 AliAODEvent *aod = 0;
1397 if(!fESD)aod = fAODIn;
1398 else aod = fAODOut;
75bf77e3 1399 TString jbname(fJetBranchName[1]);
1400 //needs complete event, use jets without background subtraction
1401 for(Int_t i=1; i<=3; ++i){
1402 if(jbname.Contains(Form("B%d",i))) jbname.ReplaceAll(Form("B%d",i),"B0");
1403 }
1404 // use only HI event
1405 if(jbname.Contains("AODextraonly")) jbname.ReplaceAll("AODextraonly","AOD");
1406 if(jbname.Contains("AODextra")) jbname.ReplaceAll("AODextra","AOD");
1407
1408 if(fDebug) Printf("Multiplicity from jet branch %s", jbname.Data());
5bd732d4 1409 TClonesArray *tmpAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(jbname.Data()));
75bf77e3 1410 if(!tmpAODjets){
1411 Printf("Jet branch %s not found", jbname.Data());
1412 Printf("AliAnalysisTaskJetCore::GetNInputTracks FAILED");
1413 return -1;
1414 }
1415
1416 for (Int_t iJet=0; iJet<tmpAODjets->GetEntriesFast(); iJet++){
1417 AliAODJet *jet = dynamic_cast<AliAODJet*>((*tmpAODjets)[iJet]);
1418 if(!jet) continue;
1419 TRefArray *trackList = jet->GetRefTracks();
1420 Int_t nTracks = trackList->GetEntriesFast();
1421 nInputTracks += nTracks;
1422 if(fDebug) Printf("#jet%d: %d tracks", iJet, nTracks);
1423 }
1424 if(fDebug) Printf("---> input tracks: %d", nInputTracks);
1425
1426 return nInputTracks;
1427}
1428
1429
1430
ea693273 1431Double_t AliAnalysisTaskJetCore::RelativePhi(Double_t mphi,Double_t vphi){
1432
1433 if (vphi < -1*TMath::Pi()) vphi += (2*TMath::Pi());
1434 else if (vphi > TMath::Pi()) vphi -= (2*TMath::Pi());
1435 if (mphi < -1*TMath::Pi()) mphi += (2*TMath::Pi());
1436 else if (mphi > TMath::Pi()) mphi -= (2*TMath::Pi());
1437 double dphi = mphi-vphi;
1438 if (dphi < -1*TMath::Pi()) dphi += (2*TMath::Pi());
1439 else if (dphi > TMath::Pi()) dphi -= (2*TMath::Pi());
1440 return dphi;//dphi in [-Pi, Pi]
1441}
1442
d5e7475c 1443Int_t AliAnalysisTaskJetCore::GetPhiBin(Double_t phi)
1444{
1445 Int_t phibin=-1;
1446 if(!(TMath::Abs(phi)<=2*TMath::Pi())){AliError("phi w.r.t. RP out of defined range");return -1;}
1447 Double_t phiwrtrp=TMath::ACos(TMath::Abs(TMath::Cos(phi)));
1448 phibin=Int_t(fNRPBins*phiwrtrp/(0.5*TMath::Pi()));
1449 if(phibin<0||phibin>=fNRPBins){AliError("Phi Bin not defined");}
1450 return phibin;
1451}
1452
1453
75bf77e3 1454
1455
da93bb11 1456THnSparse* AliAnalysisTaskJetCore::NewTHnSparseF(const char* name, UInt_t entries)
1457{
1458 // generate new THnSparseF, axes are defined in GetDimParams()
1459
1460 Int_t count = 0;
1461 UInt_t tmp = entries;
1462 while(tmp!=0){
1463 count++;
1464 tmp = tmp &~ -tmp; // clear lowest bit
1465 }
1466
1467 TString hnTitle(name);
1468 const Int_t dim = count;
1469 Int_t nbins[dim];
1470 Double_t xmin[dim];
1471 Double_t xmax[dim];
1472
1473 Int_t i=0;
1474 Int_t c=0;
1475 while(c<dim && i<32){
1476 if(entries&(1<<i)){
1477
1478 TString label("");
1479 GetDimParams(i, label, nbins[c], xmin[c], xmax[c]);
1480 hnTitle += Form(";%s",label.Data());
1481 c++;
1482 }
1483
1484 i++;
1485 }
1486 hnTitle += ";";
1487
1488 return new THnSparseF(name, hnTitle.Data(), dim, nbins, xmin, xmax);
1489}
1490
1491void AliAnalysisTaskJetCore::GetDimParams(Int_t iEntry, TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax)
1492{
1493 // stores label and binning of axis for THnSparse
1494
1495 const Double_t pi = TMath::Pi();
1496
1497 switch(iEntry){
1498
1499 case 0:
1500 label = "V0 centrality (%)";
1501
1502 nbins = 10;
1503 xmin = 0.;
1504 xmax = 100.;
1505 break;
1506
1507
1508 case 1:
1509 label = "corrected jet pt";
c42c6838 1510 nbins = 20;
da93bb11 1511 xmin = 0.;
1512 xmax = 200.;
1513 break;
1514
1515
1516 case 2:
1517 label = "track pT";
1518
ba143e7f 1519 nbins = 9;
da93bb11 1520 xmin = 0.;
5bd732d4 1521 xmax = 150;
da93bb11 1522 break;
1523
1524
529e2916 1525 case 3:
da93bb11 1526 label = "deltaR";
1527 nbins = 15;
1528 xmin = 0.;
1529 xmax = 1.5;
1530 break;
529e2916 1531
1532
1533
da93bb11 1534 case 4:
1535 label = "deltaEta";
ba143e7f 1536 nbins = 8;
1537 xmin = -1.6;
1538 xmax = 1.6;
da93bb11 1539 break;
1540
1541
5bd732d4 1542 case 5:
da93bb11 1543 label = "deltaPhi";
1544 nbins = 90;
1545 xmin = -0.5*pi;
1546 xmax = 1.5*pi;
1547 break;
1548
1549
529e2916 1550
1551 case 6:
da93bb11 1552 label = "leading track";
ba143e7f 1553 nbins = 13;
da93bb11 1554 xmin = 0;
20dcc500 1555 xmax = 50;
da93bb11 1556 break;
1557
529e2916 1558 case 7:
da93bb11 1559
1560 label = "trigger track";
ba143e7f 1561 nbins =10;
da93bb11 1562 xmin = 0;
1563 xmax = 50;
1564 break;
529e2916 1565
1566
1567
1568
1569
1570
1571
1572
da93bb11 1573 }
1574
1575}
1576