1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 // task compares jets in two branches,
18 // written for analysis of jet embedding in HI events
29 #include "THnSparse.h"
34 #include "AliAnalysisTask.h"
35 #include "AliAnalysisManager.h"
37 #include "AliVEvent.h"
38 #include "AliESDEvent.h"
39 #include "AliESDInputHandler.h"
40 #include "AliCentrality.h"
41 #include "AliAnalysisHelperJetTasks.h"
42 #include "AliInputEventHandler.h"
43 #include "AliAODJetEventBackground.h"
44 #include "AliAnalysisTaskFastEmbedding.h"
46 #include "AliAODEvent.h"
47 #include "AliAODJet.h"
49 #include "AliAnalysisTaskJetResponseV2.h"
51 ClassImp(AliAnalysisTaskJetResponseV2)
53 AliAnalysisTaskJetResponseV2::AliAnalysisTaskJetResponseV2() :
57 fBackgroundBranch(""),
59 fOfflineTrgMask(AliVEvent::kAny),
72 fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
73 fJetPtFractionMin(0.5),
81 fbJetsMismatch1(kTRUE),
82 fbJetsMismatch2(kTRUE),
88 fbJetsBeforeCut1(kTRUE),
89 fbJetsBeforeCut2(kTRUE),
90 fHistEvtSelection(0x0),
91 fHistJetSelection(0x0),
94 fhnJetsMismatch1(0x0),
95 fhnJetsMismatch2(0x0),
101 fhnJetsBeforeCut1(0x0),
102 fhnJetsBeforeCut2(0x0)
104 // default Constructor
106 fJetBranchName[0] = "";
107 fJetBranchName[1] = "";
109 fListJets[0] = new TList;
110 fListJets[1] = new TList;
113 AliAnalysisTaskJetResponseV2::AliAnalysisTaskJetResponseV2(const char *name) :
114 AliAnalysisTaskSE(name),
117 fBackgroundBranch(""),
119 fOfflineTrgMask(AliVEvent::kAny),
128 fNInputTracksMax(-1),
132 fJetTriggerExcludeMask(AliAODJet::kHighTrackPtTriggered),
133 fJetPtFractionMin(0.5),
141 fbJetsMismatch1(kTRUE),
142 fbJetsMismatch2(kTRUE),
144 fbJetsDeltaPt(kTRUE),
148 fbJetsBeforeCut1(kTRUE),
149 fbJetsBeforeCut2(kTRUE),
150 fHistEvtSelection(0x0),
151 fHistJetSelection(0x0),
152 fh2JetSelection(0x0),
154 fhnJetsMismatch1(0x0),
155 fhnJetsMismatch2(0x0),
161 fhnJetsBeforeCut1(0x0),
162 fhnJetsBeforeCut2(0x0)
166 fJetBranchName[0] = "";
167 fJetBranchName[1] = "";
169 fListJets[0] = new TList;
170 fListJets[1] = new TList;
172 DefineOutput(1, TList::Class());
175 AliAnalysisTaskJetResponseV2::~AliAnalysisTaskJetResponseV2()
181 void AliAnalysisTaskJetResponseV2::SetBranchNames(const TString &branch1, const TString &branch2)
183 fJetBranchName[0] = branch1;
184 fJetBranchName[1] = branch2;
187 void AliAnalysisTaskJetResponseV2::Init()
190 // check for jet branches
191 if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){
192 AliError("Jet branch name not set.");
197 void AliAnalysisTaskJetResponseV2::UserCreateOutputObjects()
202 if(!fOutputList) fOutputList = new TList;
203 fOutputList->SetOwner(kTRUE);
205 Bool_t oldStatus = TH1::AddDirectoryStatus();
206 TH1::AddDirectory(kFALSE);
209 fHistEvtSelection = new TH1I("fHistEvtSelection", "event selection", 6, -0.5, 5.5);
210 fHistEvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
211 fHistEvtSelection->GetXaxis()->SetBinLabel(2,"events IN");
212 fHistEvtSelection->GetXaxis()->SetBinLabel(3,"event selection (rejected)");
213 fHistEvtSelection->GetXaxis()->SetBinLabel(4,"vertex cut (rejected)");
214 fHistEvtSelection->GetXaxis()->SetBinLabel(5,"centrality (rejected)");
215 fHistEvtSelection->GetXaxis()->SetBinLabel(6,"multiplicity (rejected)");
217 fHistJetSelection = new TH1I("fHistJetSelection", "jet selection", 8, -0.5, 7.5);
218 fHistJetSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
219 fHistJetSelection->GetXaxis()->SetBinLabel(2,"probes IN");
220 fHistJetSelection->GetXaxis()->SetBinLabel(3,"no matching jet");
221 fHistJetSelection->GetXaxis()->SetBinLabel(4,"not in list");
222 fHistJetSelection->GetXaxis()->SetBinLabel(5,"fraction cut");
223 fHistJetSelection->GetXaxis()->SetBinLabel(6,"acceptance cut");
224 fHistJetSelection->GetXaxis()->SetBinLabel(7,"p_{T} cut");
225 fHistJetSelection->GetXaxis()->SetBinLabel(8,"trigger exclude mask");
227 fh2JetSelection = new TH2F("fh2JetSelection", "jet selection", 8, -0.5, 7.5,100,0.,200.);
228 fh2JetSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
229 fh2JetSelection->GetXaxis()->SetBinLabel(2,"probes IN");
230 fh2JetSelection->GetXaxis()->SetBinLabel(3,"no matching jet");
231 fh2JetSelection->GetXaxis()->SetBinLabel(4,"not in list");
232 fh2JetSelection->GetXaxis()->SetBinLabel(5,"fraction cut");
233 fh2JetSelection->GetXaxis()->SetBinLabel(6,"acceptance cut");
234 fh2JetSelection->GetXaxis()->SetBinLabel(7,"p_{T} cut");
235 fh2JetSelection->GetXaxis()->SetBinLabel(8,"trigger exclude mask");
238 UInt_t entries = 0; // bit coded, see GetDimParams() below
239 UInt_t opt = 0; // bit coded, default (0) or high resolution (1)
242 entries = 1<<0 | 1<<1 | 1<<2 | 1<<26; // cent : nInpTrks : rp psi : pT hard bin
243 opt = 1<<0 | 1<<1; // centrality and nInpTrks in high resolution
244 fhnEvent = NewTHnSparseF("fhnEvent", entries, opt);
247 if(fbJetsMismatch1){ // real mismatch (no related rec jet found)
248 // cent : nInpTrks : rp bins : probe pt : probe eta : probe phi : probe area : pT hard bin
249 entries = 1<<0 | 1<<1 | 1<<3 | 1<<6 | 1<<8 | 1<<10 | 1<<12 | 1<<26;
250 opt = 1<<6 | 1<<8 | 1<<10;
251 fhnJetsMismatch1 = NewTHnSparseF("fhnJetsMismatch1", entries, opt);
254 if(fbJetsMismatch2){ // acceptance + fraction cut
255 // cent : nInpTrks : rp bins : jetPt(2x) : jetEta(2x) : deltaEta : deltaR : fraction : pT hard bin
256 entries = 1<<0 | 1<<1 | 1<<3 | 1<<6 | 1<<7 | 1<<8 | 1<<9 | 1<<15 | 1<<17 | 1<<19 | 1<<26;
257 opt = 1<<6 | 1<<7 | 1<<8 | 1<<9;
258 fhnJetsMismatch2 = NewTHnSparseF("fhnJetsMismatch2", entries, opt);
264 // cent : nInpTrks : rp bins : rp wrt jet(2x) : probe pT : probe area: deltaPt : rp phi : rho : correction for RP : local rho
266 entries = 1<<0 | 1<<1 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<12 | 1<<14 | 1<<2 | 1<<22 | 1<<23 | 1<<24 | 1<<25;
268 // cent : nInpTrks : rp bins : rp wrt jet(2x) : probe pT : deltaPt : rp phi : rho : correction for RP | pT hard bin
269 entries = 1<<0 | 1<<1 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<14 | 1<<2 | 1<<22 | 1<<23 | 1<<26;
271 fhnJetsRp = NewTHnSparseF("fhnJetsRp", entries, opt);
274 // cent : nInpTrks : rp bins: deltaPt : jetPt(2x) : deltaArea : pT hard bin (hr delta pt)
276 entries = 1<<0 | 1<<1 | 1<<3 | 1<<14 | 1<<6 | 1<<7 | 1<<18 | 1<<26;
277 opt = 1<<1 | 1<<14 | 1<<6 | 1<<7 | 1<<18;
278 fhnJetsDeltaPt = NewTHnSparseF("fhnJetsDeltaPt", entries, opt);
281 // cent : nInpTrks : rp bins : deltaPt : jetPt(2x) : deltaR : deltaEta : jetEta(2x) : pT hard bin (hr for eta)
283 entries = 1<<0 | 1<<1 | 1<<3 | 1<<14 | 1<<6 | 1<<7 | 1<<17 | 1<<15 | 1<<8 | 1<<9 | 1<<26;
284 opt = 1<<15 | 1<<8 | 1<<9;
285 fhnJetsEta = NewTHnSparseF("fhnJetsEta", entries, opt);
288 // cent : nInpTrks : rp bins : jetPt(2x) : jetPhi(2x) : deltaPt : deltaPhi : pT hard bin
290 entries = 1<<0 | 1<<1 | 1<<3 | 1<<6 | 1<<7 | 1<<10 | 1<<11 | 1<<14 | 1<<16 | 1<<26;
292 fhnJetsPhi = NewTHnSparseF("fhnJetsPhi", entries, opt);
295 // cent : nInpTrks : rp bins : deltaArea : jetArea(2x) : deltaR : fraction : distance next rec jet : pT next jet : deltaPt : jetPt(2x) : pT hard bin (hr for area)
297 entries = 1<<0 | 1<<1 | 1<<3 | 1<<18 | 1<<12 | 1<<13 | 1<<17 | 1<<19 | 1<<20 | 1<<21 | 1<<14 | 1<<6 | 1<<7 | 1<<26;
298 opt = 1<<18 | 1<<12 | 1<<13;
299 fhnJetsArea = NewTHnSparseF("fhnJetsArea", entries, opt);
305 // cent : nInpTrks : rp bins : fraction : jetPt(2x) : jetEta(2x) : jetPhi(2x) (low resolution) (with fraction, eta, phi, pt cuts possible)
306 if(fbJetsBeforeCut1){
307 entries = 1<<0 | 1<<1 | 1<<3 | 1<<19 | 1<<6 | 1<<7 | 1<<8 | 1<<9 | 1<<10 | 1<<11;
309 fhnJetsBeforeCut1 = NewTHnSparseF("fhnJetsBeforeCut1", entries, opt);
312 // cent : nInpTrks : rp bins : deltaPt : jetPt(2x) : deltaR : deltaEta : jetEta(2x) (low resolution)
313 if(fbJetsBeforeCut2){
314 entries = 1<<0 | 1<<1 | 1<<3 | 1<<14 | 1<<6 | 1<<7 | 1<<17 | 1<<15 | 1<<8 | 1<<9;
316 fhnJetsBeforeCut2 = NewTHnSparseF("fhnJetsBeforeCut2", entries, opt);
319 fOutputList->Add(fHistEvtSelection);
320 fOutputList->Add(fHistJetSelection);
321 fOutputList->Add(fh2JetSelection);
322 if(fbEvent) fOutputList->Add(fhnEvent);
323 if(fbJetsMismatch1) fOutputList->Add(fhnJetsMismatch1);
324 if(fbJetsMismatch2) fOutputList->Add(fhnJetsMismatch2);
325 if(fbJetsRp) fOutputList->Add(fhnJetsRp);
326 if(fbJetsDeltaPt) fOutputList->Add(fhnJetsDeltaPt);
327 if(fbJetsEta) fOutputList->Add(fhnJetsEta);
328 if(fbJetsPhi) fOutputList->Add(fhnJetsPhi);
329 if(fbJetsArea) fOutputList->Add(fhnJetsArea);
330 if(fbJetsBeforeCut1) fOutputList->Add(fhnJetsBeforeCut1);
331 if(fbJetsBeforeCut2) fOutputList->Add(fhnJetsBeforeCut2);
333 // =========== Switch on Sumw2 for all histos ===========
334 for (Int_t i=0; i<fOutputList->GetEntries(); ++i) {
335 TH1 *h1 = dynamic_cast<TH1*>(fOutputList->At(i));
340 THnSparse *hn = dynamic_cast<THnSparse*>(fOutputList->At(i));
345 TH1::AddDirectory(oldStatus);
347 PostData(1, fOutputList);
350 void AliAnalysisTaskJetResponseV2::UserExec(Option_t *)
352 // load events, apply event cuts, then compare leading jets
354 if(!strlen(fJetBranchName[0].Data()) || !strlen(fJetBranchName[1].Data())){
355 AliError("Jet branch name not set.");
359 fESD=dynamic_cast<AliESDEvent*>(InputEvent());
361 AliError("ESD not available");
362 fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
364 fAOD = dynamic_cast<AliAODEvent*>(AODEvent());
367 AliError("AOD not available");
371 // -- event selection --
372 fHistEvtSelection->Fill(1); // number of events before event selection
375 AliInputEventHandler* inputHandler = (AliInputEventHandler*)
376 ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
377 if(!(inputHandler->IsEventSelected() & fOfflineTrgMask)){
378 if(fDebug) Printf(" Trigger Selection: event REJECTED ... ");
379 fHistEvtSelection->Fill(2);
380 PostData(1, fOutputList);
385 AliAODVertex* primVtx = fAOD->GetPrimaryVertex();
386 Int_t nTracksPrim = primVtx->GetNContributors();
387 if ((nTracksPrim < fMinContribVtx) ||
388 (primVtx->GetZ() < fVtxZMin) ||
389 (primVtx->GetZ() > fVtxZMax) ){
390 if(fDebug) Printf("%s:%d primary vertex z = %f: event REJECTED...",(char*)__FILE__,__LINE__,primVtx->GetZ());
391 fHistEvtSelection->Fill(3);
392 PostData(1, fOutputList);
396 // event class selection (from jet helper task)
397 Int_t eventClass = AliAnalysisHelperJetTasks::EventClass();
398 if(fDebug) Printf("Event class %d", eventClass);
399 if (eventClass < fEvtClassMin || eventClass > fEvtClassMax){
400 fHistEvtSelection->Fill(4);
401 PostData(1, fOutputList);
405 // centrality selection
406 AliCentrality *cent = 0x0;
407 Float_t centValue = 0.;
408 if(fESD) cent = fESD->GetCentrality();
409 if(cent) centValue = cent->GetCentralityPercentile("V0M");
410 if(fDebug) printf("centrality: %f\n", centValue);
411 if (centValue < fCentMin || centValue > fCentMax){
412 fHistEvtSelection->Fill(4);
413 PostData(1, fOutputList);
418 // multiplicity due to input tracks
419 Int_t nInputTracks = GetNInputTracks();
421 if (nInputTracks < fNInputTracksMin || (fNInputTracksMax > -1 && nInputTracks > fNInputTracksMax)){
422 fHistEvtSelection->Fill(5);
423 PostData(1, fOutputList);
428 fHistEvtSelection->Fill(0); // accepted events
429 // -- end event selection --
432 Double_t pthard = AliAnalysisTaskFastEmbedding::GetPtHard();
433 Int_t pthardbin = GetPtHardBin(pthard);
436 Double_t rp = AliAnalysisHelperJetTasks::ReactionPlane(kFALSE);
438 Double_t eventEntries[3] = { (Double_t)centValue, (Double_t)nInputTracks, rp };
439 fhnEvent->Fill(eventEntries);
444 AliAODJetEventBackground* externalBackground = 0;
445 if(!externalBackground&&fBackgroundBranch.Length()){
446 externalBackground = (AliAODJetEventBackground*)(fAOD->FindListObject(fBackgroundBranch.Data()));
447 //if(!externalBackground)Printf("%s:%d Background branch not found %s",(char*)__FILE__,__LINE__,fBackgroundBranch.Data());;
450 if(externalBackground)rho = externalBackground->GetBackground(0);
454 TClonesArray *aodJets[2];
455 aodJets[0] = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fJetBranchName[0].Data())); // in general: embedded jet
456 aodJets[1] = dynamic_cast<TClonesArray*>(fAOD->FindListObject(fJetBranchName[1].Data())); // in general: embedded jet + UE
460 for (Int_t iJetType = 0; iJetType < 2; iJetType++) {
461 fListJets[iJetType]->Clear();
462 if (!aodJets[iJetType]) continue;
464 if(fDebug) Printf("%s: %d jets",fJetBranchName[iJetType].Data(),aodJets[iJetType]->GetEntriesFast());
466 for (Int_t iJet = 0; iJet < aodJets[iJetType]->GetEntriesFast(); iJet++) {
467 AliAODJet *jet = dynamic_cast<AliAODJet*>((*aodJets[iJetType])[iJet]);
468 if (jet) fListJets[iJetType]->Add(jet);
470 fListJets[iJetType]->Sort();
475 static TArrayI aMatchIndex(fListJets[0]->GetEntries());
476 static TArrayF aPtFraction(fListJets[0]->GetEntries());
477 if(aMatchIndex.GetSize()<fListJets[0]->GetEntries()) aMatchIndex.Set(fListJets[0]->GetEntries());
478 if(aPtFraction.GetSize()<fListJets[0]->GetEntries()) aPtFraction.Set(fListJets[0]->GetEntries());
480 // stores matched jets in 'aMatchIndex' and fraction of pT in 'aPtFraction'
481 AliAnalysisHelperJetTasks::GetJetMatching(fListJets[0], TMath::Min((Int_t)fNMatchJets,(Int_t)fListJets[0]->GetEntries()),
482 fListJets[1], TMath::Min((Int_t)fNMatchJets,(Int_t)fListJets[1]->GetEntries()),
483 aMatchIndex, aPtFraction, fDebug, fMatchMaxDist, fIsPbPb?1:2);
485 // loop over matched jets
486 Int_t ir = -1; // index of matched reconstruced jet
487 Float_t fraction = -1.;
488 AliAODJet *jet[2] = { 0x0, 0x0 };
489 Float_t jetEta[2] = { -990., -990. };
490 Float_t jetPhi[2] = { -990., -990. };
491 Float_t jetPt[2] = { -990., -990. };
492 Float_t jetArea[2] = { -990., -990. };
493 Float_t rpJet[2] = { -990., -990. };
496 for(Int_t ig=0; ig<fListJets[0]->GetEntries(); ++ig){
497 ir = aMatchIndex[ig];
500 jet[0] = (AliAODJet*)(fListJets[0]->At(ig));
501 if(ir>=0) jet[1] = (AliAODJet*)(fListJets[1]->At(ir));
504 for(Int_t i=0; i<fkNbranches; ++i){
511 if(i==1) rpBin = -990;
514 jetEta[i] = jet[i]->Eta();
515 jetPhi[i] = jet[i]->Phi();
516 jetPt[i] = GetPt(jet[i], i);
517 jetArea[i] = jet[i]->EffectiveAreaCharged();
518 rpJet[i] = TVector2::Phi_mpi_pi(rp-jetPhi[i]);
519 if(i==1) rpBin = AliAnalysisHelperJetTasks::GetPhiBin(TVector2::Phi_mpi_pi(rp-jetPhi[i]), 3);
522 fraction = aPtFraction[ig];
525 fHistJetSelection->Fill(1); // all probe jets
526 if(jet[0]) fh2JetSelection->Fill(1.,jetPt[0]); // all probe jets
529 fHistJetSelection->Fill(2);
530 if(jet[0]) fh2JetSelection->Fill(2.,jetPt[0]);
533 if(!jet[0]) continue;
534 Double_t jetEntriesMismatch1[7] = {
535 (Double_t)centValue, (Double_t)nInputTracks, (Double_t)rpBin,
536 (Double_t)jetPt[0], (Double_t)jetEta[0], (Double_t)jetPhi[0], (Double_t)jetArea[0]
538 fhnJetsMismatch1->Fill(jetEntriesMismatch1);
544 if(!jet[0] || !jet[1]){
545 fHistJetSelection->Fill(3);
546 if(jet[0]) fh2JetSelection->Fill(3.,jetPt[0]);
550 // look for distance to next rec jet
551 Float_t distNextJet = -0.01; // no neighbor
552 Float_t ptNextJet = -1.;
553 for(Int_t r=0; r<fListJets[1]->GetEntries(); ++r){
555 Float_t tmpDeltaR = jet[1]->DeltaR((AliAODJet*)fListJets[1]->At(r));
556 if(distNextJet<0. || distNextJet>tmpDeltaR){
557 distNextJet = tmpDeltaR;
558 if(fKeepJets) ptNextJet = ((AliAODJet*)fListJets[1]->At(r))->GetPtSubtracted(0);
559 else ptNextJet = ((AliAODJet*)fListJets[1]->At(r))->Pt();
565 //Float_t localRho = jetArea[1]>0. ? (jetPt[1]+rho*jetArea[1] - jetPt[0]) / jetArea[1] : 0.;
566 //Float_t relRho = rho>0. ? localRho / rho : 0.;
569 // calculate parameters of associated jets
570 /* from Leticia, kT clusterizer
571 Float_t par0[4] = { 0.00409, 0.01229, 0.05, 0.26 };
572 Float_t par1[4] = { -2.97035e-03, -2.03182e-03, -1.25702e-03, -9.95107e-04 };
573 Float_t par2[4] = { 1.02865e-01, 1.49039e-01, 1.53910e-01, 1.51109e-01 };
575 // own, from embedded tracks
576 Float_t par0[4] = { 0.02841, 0.05039, 0.09092, 0.24089 };
577 Float_t par1[4] = { -4.26725e-04, -1.15273e-03, -1.56827e-03, -3.08003e-03 };
578 Float_t par2[4] = { 4.95415e-02, 9.79538e-02, 1.32814e-01, 1.71743e-01 };
582 if(eventClass>0&&eventClass<4){
583 rpCorr = par0[eventClass-1] + par1[eventClass-1] * 2*TMath::Cos(rpJet[1]) + par2[eventClass-1] * 2*TMath::Cos(2*rpJet[1]);
584 rpCorr *= rho * jetArea[1];
587 Float_t deltaPt = jetPt[1]-jetPt[0];
588 Float_t deltaEta = jetEta[1]-jetEta[0];
589 Float_t deltaPhi = TVector2::Phi_mpi_pi(jetPhi[1]-jetPhi[0]);
590 Float_t deltaR = TMath::Sqrt(deltaEta*deltaEta+deltaPhi*deltaPhi);
591 Float_t deltaArea = jetArea[1]-jetArea[0];
594 // fill thnsparse before acceptance cut
595 if(fbJetsBeforeCut1){
596 Double_t jetBeforeCutEntries1[10] = {
597 (Double_t)centValue, (Double_t)nInputTracks, (Double_t)rpBin,
598 (Double_t)jetPt[0], (Double_t)jetPt[1], (Double_t)jetEta[0], (Double_t)jetEta[1],
599 (Double_t)jetPhi[0], (Double_t)jetPhi[1], (Double_t)fraction
601 fhnJetsBeforeCut1->Fill(jetBeforeCutEntries1);
604 if(fbJetsBeforeCut2){
605 Double_t jetBeforeCutEntries2[10] = {
606 (Double_t)centValue, (Double_t)nInputTracks, (Double_t)rpBin,
607 (Double_t)jetPt[0], (Double_t)jetPt[1],
608 (Double_t)jetEta[0], (Double_t)jetEta[1],
609 (Double_t)deltaPt, (Double_t)deltaEta, (Double_t)deltaR
611 fhnJetsBeforeCut2->Fill(jetBeforeCutEntries2);
615 Bool_t jetAccepted = kTRUE;
616 // minimum fraction required
617 if(fraction<fJetPtFractionMin){
618 fHistJetSelection->Fill(4);
619 fh2JetSelection->Fill(4.,jetPt[0]);
620 jetAccepted = kFALSE;
624 // jet acceptance + minimum pT check
625 if(jetEta[0]>fJetEtaMax || jetEta[0]<fJetEtaMin ||
626 jetEta[1]>fJetEtaMax || jetEta[1]<fJetEtaMin){
629 Printf("Jet not in eta acceptance.");
630 Printf("[0]: jet %d eta %.2f", ig, jetEta[0]);
631 Printf("[1]: jet %d eta %.2f", ir, jetEta[1]);
633 fHistJetSelection->Fill(5);
634 fh2JetSelection->Fill(5.,jetPt[0]);
635 jetAccepted = kFALSE;
639 if(jetPt[1] < fJetPtMin){
640 if(fDebug) Printf("Jet %d (pT %.1f GeV/c) has less than required pT.", ir, jetPt[1]);
641 fHistJetSelection->Fill(6);
642 fh2JetSelection->Fill(6.,jetPt[0]);
643 jetAccepted = kFALSE;
648 if(jet[1]->Trigger()&fJetTriggerExcludeMask){
649 fHistJetSelection->Fill(7);
650 fh2JetSelection->Fill(7.,jetPt[0]);
651 jetAccepted = kFALSE;
658 Double_t jetEntriesMismatch2[10] = {
659 (Double_t)centValue, (Double_t)nInputTracks, (Double_t)rpBin,
660 (Double_t)jetPt[0], (Double_t)jetPt[1],
661 (Double_t)jetEta[0], (Double_t)jetEta[1],
662 (Double_t)deltaEta, (Double_t)deltaR,
665 fhnJetsMismatch2->Fill(jetEntriesMismatch2);
671 fHistJetSelection->Fill(0);
672 fh2JetSelection->Fill(0.,jetPt[0]);
676 Double_t jetEntriesRp[11] = {
677 (Double_t)centValue, (Double_t)nInputTracks, (Double_t) rp,
678 (Double_t)rpBin, (Double_t)rpJet[0], (Double_t)rpJet[1],
679 (Double_t)jetPt[0], (Double_t)deltaPt, (Double_t)rho, (Double_t)rpCorr,
682 fhnJetsRp->Fill(jetEntriesRp);
686 Double_t jetEntriesDeltaPt[8] = {
687 (Double_t)centValue, (Double_t)nInputTracks, (Double_t)rpBin,
688 (Double_t)jetPt[0], (Double_t)jetPt[1], (Double_t)deltaPt, (Double_t)deltaArea,
691 fhnJetsDeltaPt->Fill(jetEntriesDeltaPt);
695 Double_t jetEntriesEta[11] = {
696 (Double_t)centValue, (Double_t)nInputTracks, (Double_t)rpBin,
697 (Double_t)jetPt[0], (Double_t)jetPt[1], (Double_t)jetEta[0], (Double_t)jetEta[1],
698 (Double_t)deltaPt, (Double_t)deltaEta, (Double_t)deltaR,
701 fhnJetsEta->Fill(jetEntriesEta);
705 Double_t jetEntriesPhi[10] = {
706 (Double_t)centValue, (Double_t)nInputTracks, (Double_t)rpBin,
707 (Double_t)jetPt[0], (Double_t)jetPt[1], (Double_t)jetPhi[0], (Double_t)jetPhi[1],
708 (Double_t)deltaPt, (Double_t)deltaPhi,
711 fhnJetsPhi->Fill(jetEntriesPhi);
715 Double_t jetEntriesArea[14] = {
716 (Double_t)centValue, (Double_t)nInputTracks, (Double_t)rpBin,
717 (Double_t)jetPt[0], (Double_t)jetPt[1], (Double_t)jetArea[0], (Double_t)jetArea[1],
718 (Double_t)deltaPt, (Double_t)deltaR, (Double_t)deltaArea,
719 (Double_t)fraction, (Double_t)distNextJet, (Double_t)ptNextJet,
722 fhnJetsArea->Fill(jetEntriesArea);
727 PostData(1, fOutputList);
730 void AliAnalysisTaskJetResponseV2::Terminate(const Option_t *)
732 // Draw result to the screen
733 // Called once at the end of the query
735 if (!GetOutputData(1))
739 Int_t AliAnalysisTaskJetResponseV2::GetNInputTracks()
741 // number of tracks in the event, obtained via jet finder
743 Int_t nInputTracks = 0;
745 TString jbname(fJetBranchName[1]);
746 //needs complete event, use jets without background subtraction
747 for(Int_t i=1; i<=3; ++i){
748 if(jbname.Contains(Form("B%d",i))) jbname.ReplaceAll(Form("B%d",i),"B0");
751 if(jbname.Contains("AODextraonly")) jbname.ReplaceAll("AODextraonly","AOD");
752 if(jbname.Contains("AODextra")) jbname.ReplaceAll("AODextra","AOD");
754 if(fDebug) Printf("Multiplicity from jet branch %s", jbname.Data());
755 TClonesArray *tmpAODjets = dynamic_cast<TClonesArray*>(fAOD->FindListObject(jbname.Data()));
757 Printf("Jet branch %s not found", jbname.Data());
758 Printf("AliAnalysisTaskJetResponseV2::GetNInputTracks FAILED");
762 for (Int_t iJet=0; iJet<tmpAODjets->GetEntriesFast(); iJet++){
763 AliAODJet *jet = dynamic_cast<AliAODJet*>((*tmpAODjets)[iJet]);
765 TRefArray *trackList = jet->GetRefTracks();
766 Int_t nTracks = trackList->GetEntriesFast();
767 nInputTracks += nTracks;
768 if(fDebug) Printf("#jet%d: %d tracks", iJet, nTracks);
770 if(fDebug) Printf("---> input tracks: %d", nInputTracks);
775 THnSparse* AliAnalysisTaskJetResponseV2::NewTHnSparseF(const char* name, UInt_t entries, UInt_t opt)
777 // generate new THnSparseF, axes are defined in GetDimParams()
780 UInt_t tmp = entries;
783 tmp = tmp &~ -tmp; // clear lowest bit
786 TString hnTitle(name);
787 const Int_t dim = count;
794 while(c<dim && i<32){
796 Bool_t highres = opt&(1<<i);
798 GetDimParams(i, highres, label, nbins[c], xmin[c], xmax[c]);
799 hnTitle += Form(";%s",label.Data());
807 return new THnSparseF(name, hnTitle.Data(), dim, nbins, xmin, xmax);
810 void AliAnalysisTaskJetResponseV2::GetDimParams(Int_t iEntry, Bool_t hr, TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax)
812 // stores label and binning of axis for THnSparse
814 const Double_t pi = TMath::Pi();
819 label = "V0 centrality (%)";
833 label = "nb. of input tracks";
853 label = "event plane #psi";
867 label = "event plane bin";
876 if(iEntry==4)label = "#Delta#phi(RP-jet) (probe)";
877 if(iEntry==5)label = "#Delta#phi(RP-jet) (rec)";
886 if(iEntry==6)label = "probe p_{T} (GeV/c)";
887 if(iEntry==7)label = "rec p_{T} (GeV/c)";
902 if(iEntry==8)label = "probe #eta";
903 if(iEntry==9)label = "rec #eta";
918 if(iEntry==10)label = "probe #phi";
919 if(iEntry==11)label = "rec #phi";
921 nbins = 90; // modulo 18 (sectors)
934 if(iEntry==12)label = "probe area";
935 if(iEntry==13)label = "rec area";
948 label = "#Delta p_{T}";
961 label = "#Delta#eta";
975 label = "#Delta#phi";
1003 label = "#Deltaarea";
1031 label = "distance to closest rec jet";
1045 label = "p_{T} of closest rec jet";
1059 label = "abs. correction of #rho for RP";
1066 label = "local #rho";
1073 label = "local #rho / #rho";
1080 label = "p_{T,hard} bin";
1090 //____________________________________________________________________________
1091 Int_t AliAnalysisTaskJetResponseV2::GetPtHardBin(Double_t ptHard){
1093 // returns pt hard bin (for LHC10e14, LHC11a1x, LHC11a2x simulations)
1095 const Int_t nBins = 10;
1096 Double_t binLimits[nBins] = { 5., 11., 21., 36., 57., 84., 117., 156., 200., 249. }; // lower limits
1099 while(bin<nBins-1 && binLimits[bin+1]<ptHard){
1106 //____________________________________________________________________________
1107 Double_t AliAnalysisTaskJetResponseV2::GetPt(AliAODJet *j, Int_t mode=0){
1109 // returns jet pt, also negative pt after background subtraction if available
1113 if(fKeepJets && mode==1){ // background subtracted pt, can be negative
1114 pt = j->GetPtSubtracted(0);
1117 pt = j->Pt(); // if negative, pt=0.01