2 // Jet trigger QA analysis task.
6 #include <TClonesArray.h>
10 #include <THnSparse.h>
12 #include <TLorentzVector.h>
14 #include "AliVCluster.h"
15 #include "AliVTrack.h"
16 #include "AliEmcalJet.h"
17 #include "AliRhoParameter.h"
19 #include "AliAnalysisUtils.h"
20 #include "AliEmcalParticle.h"
21 #include "AliAODCaloTrigger.h"
22 #include "AliEMCALGeometry.h"
23 #include "AliVCaloCells.h"
24 #include "AliJetContainer.h"
25 #include "AliClusterContainer.h"
27 #include "AliAnalysisTaskEmcalJetTriggerQA.h"
29 ClassImp(AliAnalysisTaskEmcalJetTriggerQA)
31 //________________________________________________________________________
32 AliAnalysisTaskEmcalJetTriggerQA::AliAnalysisTaskEmcalJetTriggerQA() :
33 AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetTriggerQA", kTRUE),
46 fh3PtEtaPhiJetFull(0),
47 fh3PtEtaPhiJetCharged(0),
50 fh3PtEtaAreaJetFull(0),
51 fh3PtEtaAreaJetCharged(0),
52 fh2PtNConstituentsCharged(0),
53 fh2PtNConstituents(0),
54 fh2PtMeanPtConstituentsCharged(0),
55 fh2PtMeanPtConstituentsNeutral(0),
58 fh2NEFNConstituentsCharged(0),
59 fh2NEFNConstituentsNeutral(0),
62 fh2PtLeadJet1VsLeadJet2(0),
64 fh3PtLeadJet1VsPatchEnergy(0),
65 fh3PtLeadJet2VsPatchEnergy(0),
66 fh3PatchEnergyEtaPhiCenter(0),
67 fh2CellEnergyVsTime(0),
68 fh3EClusELeadingCellVsTime(0)
70 // Default constructor.
72 SetMakeGeneralHistograms(kTRUE);
75 //________________________________________________________________________
76 AliAnalysisTaskEmcalJetTriggerQA::AliAnalysisTaskEmcalJetTriggerQA(const char *name) :
77 AliAnalysisTaskEmcalJet(name, kTRUE),
90 fh3PtEtaPhiJetFull(0),
91 fh3PtEtaPhiJetCharged(0),
94 fh3PtEtaAreaJetFull(0),
95 fh3PtEtaAreaJetCharged(0),
96 fh2PtNConstituentsCharged(0),
97 fh2PtNConstituents(0),
98 fh2PtMeanPtConstituentsCharged(0),
99 fh2PtMeanPtConstituentsNeutral(0),
102 fh2NEFNConstituentsCharged(0),
103 fh2NEFNConstituentsNeutral(0),
106 fh2PtLeadJet1VsLeadJet2(0),
107 fh3EEtaPhiCluster(0),
108 fh3PtLeadJet1VsPatchEnergy(0),
109 fh3PtLeadJet2VsPatchEnergy(0),
110 fh3PatchEnergyEtaPhiCenter(0),
111 fh2CellEnergyVsTime(0),
112 fh3EClusELeadingCellVsTime(0)
114 // Standard constructor.
116 SetMakeGeneralHistograms(kTRUE);
119 //________________________________________________________________________
120 AliAnalysisTaskEmcalJetTriggerQA::~AliAnalysisTaskEmcalJetTriggerQA()
125 //________________________________________________________________________
126 void AliAnalysisTaskEmcalJetTriggerQA::ExecOnce()
128 // Init the analysis.
130 AliAnalysisTaskEmcalJet::ExecOnce();
132 // Initialize analysis util class for vertex selection
134 if(!fAnalysisUtils) fAnalysisUtils = new AliAnalysisUtils();
135 fAnalysisUtils->SetMinVtxContr(2);
136 fAnalysisUtils->SetMaxVtxZ(10.);
141 //________________________________________________________________________
142 Bool_t AliAnalysisTaskEmcalJetTriggerQA::SelectEvent() {
144 // Decide if event should be selected for analysis
147 fhNEvents->Fill(0.5);
150 if(!fAnalysisUtils->IsVertexSelected2013pA(InputEvent()))
153 fhNEvents->Fill(2.5);
155 if(fAnalysisUtils->IsPileUpEvent(InputEvent()))
160 AliError("fAnalysisUtils not initialized. Call AliAnalysisTaskEmcalJetTriggerQA::ExecOnce()");
163 fhNEvents->Fill(3.5);
165 if(!fTriggerClass.IsNull()) {
166 //Check if requested trigger was fired
167 TString firedTrigClass = InputEvent()->GetFiredTriggerClasses();
168 if(!firedTrigClass.Contains(fTriggerClass))
172 fhNEvents->Fill(1.5);
178 //________________________________________________________________________
179 void AliAnalysisTaskEmcalJetTriggerQA::FindTriggerPatch() {
181 //Code to get position of trigger
184 fGeom = AliEMCALGeometry::GetInstance();
187 TString firedTrigClass = InputEvent()->GetFiredTriggerClasses();
189 AliAODCaloTrigger *trg = dynamic_cast<AliAODCaloTrigger*>(InputEvent()->GetCaloTrigger("EMCAL"));
192 int col, row; //FASTOR position
194 Int_t nPatchNotEmpty = 0; //counter number of patches which are not empty
195 fMaxPatchEnergy = 0.;
199 trg->GetPosition(col, row); //col (0 to 63), row (0 to 47)
201 if (col > -1 && row > -1)
203 Int_t id = -1; //FASTOR index
204 Int_t cellIndex[4] = {-1};
205 fGeom->GetAbsFastORIndexFromPositionInEMCAL(col,row,id); //phi is column, eta is row
208 fGeom->GetCellIndexFromFastORIndex(id,cellIndex);
211 trg->GetL1TimeSum(ts);
214 trg->GetAmplitude(ampTrg);
218 trg->GetTriggerBits(bit);
220 Bool_t bTrigJ = TestFilterBit(bit,fBitJ1|fBitJ2);
224 Bool_t bTrigJ1 = TestFilterBit(bit,fBitJ1);
225 Bool_t bTrigJ2 = TestFilterBit(bit,fBitJ2);
227 if(bTrigJ1) fTriggerType = 0;
228 if(bTrigJ2) fTriggerType = 1;
229 if(!bTrigJ1 && !bTrigJ2) fTriggerType = -1;
231 Double_t minPhiPatch = 10.;
232 Double_t maxPhiPatch = -10.;
233 Double_t minEtaPatch = 10.;
234 Double_t maxEtaPatch = -10.;
236 //Get energy in trigger patch 8x8 FASTOR
237 Double_t patchEnergy = 0.;
238 Double_t sumAmp = 0.;
239 // const Int_t nFastOR = 8;//16;
240 for(Int_t fastrow = 0; fastrow<fNFastOR; fastrow++) {
241 for(Int_t fastcol = 0; fastcol<fNFastOR; fastcol++) {
242 Int_t nrow = row+fastrow;
243 Int_t ncol = col+fastcol;
244 fGeom->GetAbsFastORIndexFromPositionInEMCAL(ncol,nrow,id);
247 AliWarning(Form("%s: id smaller than 0 %d",GetName(),id));
251 fGeom->GetCellIndexFromFastORIndex(id,cellIndex);
252 for(Int_t icell=0; icell<4; icell++) {
254 if(!fGeom->CheckAbsCellId(cellIndex[icell])) continue;
256 Double_t amp =0., time = 0., efrac = 0;
259 Int_t nSupMod = -1, nModule = -1, nIphi = -1, nIeta = -1;
261 fGeom->GetCellIndex(cellIndex[icell], nSupMod, nModule, nIphi, nIeta );
263 fCaloCells->GetCell(cellIndex[icell], absId, amp, time,mclabel,efrac);
266 fGeom->EtaPhiFromIndex(cellIndex[icell], eta, phi);
268 if(phi<minPhiPatch) minPhiPatch = phi;
269 if(phi>maxPhiPatch) maxPhiPatch = phi;
270 if(eta<minEtaPatch) minEtaPatch = eta;
271 if(eta>maxEtaPatch) maxEtaPatch = eta;
273 sumAmp+=fCaloCells->GetAmplitude(cellIndex[icell]);
276 }//cells in fastor loop
280 Double_t etaCent = minEtaPatch + 0.5*(maxEtaPatch-minEtaPatch);
281 Double_t phiCent = minPhiPatch + 0.5*(maxPhiPatch-minPhiPatch);
282 fh3PatchEnergyEtaPhiCenter->Fill(patchEnergy,etaCent,phiCent);
285 if(fDebug>2) AliInfo(Form("%s: patch edges eta: %f - %f phi: %f - %f ampTrg: %f patchEnergy: %f sumAmp: %f",GetName(),minEtaPatch,maxEtaPatch,minPhiPatch,maxPhiPatch,ampTrg,patchEnergy,sumAmp));
287 if(patchEnergy>0) nPatchNotEmpty++;
289 if(patchEnergy>fMaxPatchEnergy) fMaxPatchEnergy=patchEnergy;
296 //________________________________________________________________________
297 void AliAnalysisTaskEmcalJetTriggerQA::LoadExtraBranches() {
299 // load extra brances
304 //________________________________________________________________________
305 void AliAnalysisTaskEmcalJetTriggerQA::UserCreateOutputObjects()
307 // Create user output.
309 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
311 Bool_t oldStatus = TH1::AddDirectoryStatus();
312 TH1::AddDirectory(kFALSE);
314 fhNEvents = new TH1F("fhNEvents","fhNEvents;selection;N_{evt}",5,0,5);
315 fOutput->Add(fhNEvents);
318 Double_t minPt = -20.;
319 Double_t maxPt = 100.;
320 Int_t nBinsEta = 100;
321 Double_t minEta = -1.;
322 Double_t maxEta = 1.;
323 Int_t nBinsPhi = 18*8;
324 Double_t minPhi = 0.;
325 Double_t maxPhi = TMath::TwoPi();
326 Int_t nBinsArea = 100;
327 Double_t minArea = 0.;
328 Double_t maxArea = 1.;
330 fh3PtEtaPhiJetFull = new TH3F("fh3PtEtaPhiJetFull","fh3PtEtaPhiJetFull;#it{p}_{T}^{jet};#eta;#varphi",nBinsPt,minPt,maxPt,nBinsEta,minEta,maxEta,nBinsPhi,minPhi,maxPhi);
331 fOutput->Add(fh3PtEtaPhiJetFull);
333 fh3PtEtaPhiJetCharged = new TH3F("fh3PtEtaPhiJetCharged","fh3PtEtaPhiJetCharged;#it{p}_{T}^{jet};#eta;#varphi",nBinsPt,minPt,maxPt,nBinsEta,minEta,maxEta,nBinsPhi,minPhi,maxPhi);
334 fOutput->Add(fh3PtEtaPhiJetCharged);
336 fh2NJetsPtFull = new TH2F("fh2NJetsPtFull","fh2NJetsPtFull;N_{jets};#it{p}_{T}^{jet}",20,-0.5,19.5,nBinsPt,minPt,maxPt);
337 fOutput->Add(fh2NJetsPtFull);
339 fh2NJetsPtCharged = new TH2F("fh2NJetsPtCharged","fh2NJetsPtCharged;N_{jets};#it{p}_{T}^{jet}",20,-0.5,19.5,nBinsPt,minPt,maxPt);
340 fOutput->Add(fh2NJetsPtCharged);
342 fh3PtEtaAreaJetFull = new TH3F("fh3PtEtaAreaJetFull","fh3PtEtaAreaJetFull;#it{p}_{T}^{jet};#eta;A",nBinsPt,minPt,maxPt,nBinsEta,minEta,maxEta,nBinsArea,minArea,maxArea);
343 fOutput->Add(fh3PtEtaAreaJetFull);
345 fh3PtEtaAreaJetCharged = new TH3F("fh3PtEtaAreaJetCharged","fh3PtEtaAreaJetCharged;#it{p}_{T}^{jet};#eta;A",nBinsPt,minPt,maxPt,nBinsEta,minEta,maxEta,nBinsArea,minArea,maxArea);
346 fOutput->Add(fh3PtEtaAreaJetCharged);
348 Int_t nBinsConst =100;
349 Double_t minConst = 0.;
350 Double_t maxConst = 100.;
352 Int_t nBinsMeanPt = 200;
353 Double_t minMeanPt = 0.;
354 Double_t maxMeanPt = 20.;
356 Int_t nBinsNEF = 101;
357 Double_t minNEF = 0.;
358 Double_t maxNEF = 1.01;
362 Double_t maxz = 1.01;
364 Int_t nBinsECluster =100;
365 Double_t minECluster = 0.;
366 Double_t maxECluster = 100.;
369 fh2PtNConstituentsCharged = new TH2F("fh2PtNConstituentsCharged","fh2PtNConstituentsCharged;#it{p}_{T}^{jet};N_{charged constituents}",nBinsPt,minPt,maxPt,nBinsConst,minConst,maxConst);
370 fOutput->Add(fh2PtNConstituentsCharged);
372 fh2PtNConstituents = new TH2F("fh2PtNConstituents","fh2PtNConstituents;#it{p}_{T}^{jet};N_{constituents}",nBinsPt,minPt,maxPt,nBinsConst,minConst,maxConst);
373 fOutput->Add(fh2PtNConstituents);
375 fh2PtMeanPtConstituentsCharged = new TH2F("fh2PtMeanPtConstituentsCharged","fh2PtMeanPtConstituentsCharged;#it{p}_{T}^{jet};charged #langle #it{p}_{T} #rangle",nBinsPt,minPt,maxPt,nBinsMeanPt,minMeanPt,maxMeanPt);
376 fOutput->Add(fh2PtMeanPtConstituentsCharged);
378 fh2PtMeanPtConstituentsNeutral = new TH2F("fh2PtMeanPtConstituentsNeutral","fh2PtMeanPtConstituentsNeutral;#it{p}_{T}^{jet};neutral langle #it{p}_{T} #rangle",nBinsPt,minPt,maxPt,nBinsMeanPt,minMeanPt,maxMeanPt);
379 fOutput->Add(fh2PtMeanPtConstituentsNeutral);
381 fh2PtNEF = new TH2F("fh2PtNEF","fh2PtNEF;#it{p}_{T}^{jet};NEF",nBinsPt,minPt,maxPt,nBinsNEF,minNEF,maxNEF);
382 fOutput->Add(fh2PtNEF);
384 fh3NEFEtaPhi = new TH3F("fh3NEFEtaPhi","fh3NEFEtaPhi;NEF;#eta;#varphi",nBinsNEF,minNEF,maxNEF,nBinsEta,minEta,maxEta,nBinsPhi,minPhi,maxPhi);
385 fOutput->Add(fh3NEFEtaPhi);
387 fh2NEFNConstituentsCharged = new TH2F("fh2NEFNConstituentsCharged","fh2NEFNConstituentsCharged;NEF;N_{charged constituents}",nBinsNEF,minNEF,maxNEF,nBinsConst,minConst,maxConst);
388 fOutput->Add(fh2NEFNConstituentsCharged);
390 fh2NEFNConstituentsNeutral = new TH2F("fh2NEFNConstituentsNeutral","fh2NEFNConstituentsNeutral;NEF;N_{clusters}",nBinsNEF,minNEF,maxNEF,nBinsConst,minConst,maxConst);
391 fOutput->Add(fh2NEFNConstituentsNeutral);
393 fh2Ptz = new TH2F("fh2Ptz","fh2Ptz;#it{p}_{T}^{jet};z=p_{t,trk}^{proj}/p_{jet}",nBinsPt,minPt,maxPt,nBinsz,minz,maxz);
394 fOutput->Add(fh2Ptz);
396 fh2PtzCharged = new TH2F("fh2PtzCharged","fh2Ptz;#it{p}_{T}^{ch jet};z=p_{t,trk}^{proj}/p_{ch jet}",nBinsPt,minPt,maxPt,nBinsz,minz,maxz);
397 fOutput->Add(fh2PtzCharged);
399 fh2PtLeadJet1VsLeadJet2 = new TH2F("fh2PtLeadJet1VsLeadJet2","fh2PtLeadJet1VsLeadJet2;#it{p}_{T}^{jet 1};#it{p}_{T}^{jet 2}",nBinsPt,minPt,maxPt,nBinsPt,minPt,maxPt);
400 fOutput->Add(fh2PtLeadJet1VsLeadJet2);
402 fh3EEtaPhiCluster = new TH3F("fh3EEtaPhiCluster","fh3EEtaPhiCluster;E_{clus};#eta;#phi",nBinsECluster,minECluster,maxECluster,nBinsEta,minEta,maxEta,nBinsPhi,minPhi,maxPhi);
403 fOutput->Add(fh3EEtaPhiCluster);
405 fh3PtLeadJet1VsPatchEnergy = new TH3F("fh3PtLeadJet1VsPatchEnergy","fh3PtLeadJet1VsPatchEnergy;#it{p}_{T}^{jet 1};Amplitude_{patch};trig type",nBinsPt,minPt,maxPt,nBinsPt,minPt,maxPt,2,-0.5,1.5);
406 fOutput->Add(fh3PtLeadJet1VsPatchEnergy);
407 fh3PtLeadJet2VsPatchEnergy = new TH3F("fh3PtLeadJet2VsPatchEnergy","fh3PtLeadJet2VsPatchEnergy;#it{p}_{T}^{jet 1};Amplitude_{patch};trig type",nBinsPt,minPt,maxPt,nBinsPt,minPt,maxPt,2,-0.5,1.5);
408 fOutput->Add(fh3PtLeadJet2VsPatchEnergy);
410 fh3PatchEnergyEtaPhiCenter = new TH3F("fh3PatchEnergyEtaPhiCenter","fh3PatchEnergyEtaPhiCenter;E_{patch};#eta;#phi",nBinsPt,minPt,maxPt,nBinsEta,minEta,maxEta,nBinsPhi,minPhi,maxPhi);
411 fOutput->Add(fh3PatchEnergyEtaPhiCenter);
413 fh2CellEnergyVsTime = new TH2F("fh2CellEnergyVsTime","fh2CellEnergyVsTime;E_{cell};time",100,0.,100.,700,-400,1000);
414 fOutput->Add(fh2CellEnergyVsTime);
416 fh3EClusELeadingCellVsTime = new TH3F("fh3EClusELeadingCellVsTime","fh3EClusELeadingCellVsTime;E_{cluster};E_{leading cell};time_{leading cell}",100,0.,100.,100.,0.,100.,700,-400.,1000.);
417 fOutput->Add(fh3EClusELeadingCellVsTime);
420 // =========== Switch on Sumw2 for all histos ===========
421 for (Int_t i=0; i<fOutput->GetEntries(); ++i) {
422 TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i));
427 TH2 *h2 = dynamic_cast<TH2*>(fOutput->At(i));
432 TH3 *h3 = dynamic_cast<TH3*>(fOutput->At(i));
437 THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i));
441 TH1::AddDirectory(oldStatus);
443 PostData(1, fOutput); // Post data for ALL output slots > 0 here.
446 //________________________________________________________________________
447 Bool_t AliAnalysisTaskEmcalJetTriggerQA::FillHistograms()
451 AliClusterContainer *clusCont = GetClusterContainer(0);
453 Int_t nclusters = clusCont->GetNClusters();
454 TString arrName = clusCont->GetArrayName();
455 for (Int_t ic = 0; ic < nclusters; ic++) {
456 AliVCluster *cluster = static_cast<AliVCluster*>(clusCont->GetCluster(ic));
458 AliDebug(2,Form("Could not receive cluster %d", ic));
461 if (!cluster->IsEMCAL()) {
462 AliDebug(2,Form("%s: Cluster is not emcal",GetName()));
467 cluster->GetMomentum(lp, const_cast<Double_t*>(fVertex));
469 //Fill eta,phi,E of clusters here
470 fh3EEtaPhiCluster->Fill(lp.E(),lp.Eta(),lp.Phi());
473 Double_t leadCellE = GetEnergyLeadingCell(cluster);
474 Double_t leadCellT = cluster->GetTOF();//fCaloCells->GetCellTime(absId);
475 fh3EClusELeadingCellVsTime->Fill(lp.E(),leadCellE,leadCellT*1e9);
481 const Short_t nCells = fCaloCells->GetNumberOfCells();
483 for(Int_t iCell=0; iCell<nCells; ++iCell) {
484 Short_t cellId = fCaloCells->GetCellNumber(iCell);
485 Double_t cellE = fCaloCells->GetCellAmplitude(cellId);
486 Double_t cellT = fCaloCells->GetCellTime(cellId);
488 AliDebug(2,Form("cell energy = %f time = %f",cellE,cellT*1e9));
489 fh2CellEnergyVsTime->Fill(cellE,cellT*1e9);
493 Double_t ptLeadJet1 = 0.;
494 Double_t ptLeadJet2 = 0.;
496 TArrayI *nJetsArr = new TArrayI(fh2NJetsPtFull->GetNbinsY()+1);
498 nJetsArr->Set(fh2NJetsPtFull->GetNbinsY()+1);
500 if (GetJetContainer(fContainerFull)) {
501 const Int_t njets = GetNJets(fContainerFull);
502 for (Int_t ij = 0; ij < njets; ij++) {
504 AliEmcalJet* jet = GetAcceptJetFromArray(ij,fContainerFull);
506 continue; //jet not selected
508 Double_t jetPt = jet->Pt();
509 if(jetPt>ptLeadJet1) ptLeadJet1=jetPt;
510 fh3PtEtaPhiJetFull->Fill(jetPt,jet->Eta(),jet->Phi());
511 fh3PtEtaAreaJetFull->Fill(jetPt,jet->Eta(),jet->Area());
513 //count jets above certain pT threshold
514 Int_t ptbin = fh2NJetsPtFull->GetYaxis()->FindBin(jetPt);
515 for(Int_t iptbin = ptbin; iptbin<=fh2NJetsPtFull->GetNbinsY(); iptbin++)
516 nJetsArr->AddAt(nJetsArr->At(iptbin)+1,iptbin);
518 fh2PtNConstituentsCharged->Fill(jetPt,jet->GetNumberOfTracks());
519 fh2PtNConstituents->Fill(jetPt,jet->GetNumberOfConstituents());
521 fh2PtNEF->Fill(jetPt,jet->NEF());
522 fh3NEFEtaPhi->Fill(jet->NEF(),jet->Eta(),jet->Phi());
523 fh2NEFNConstituentsCharged->Fill(jet->NEF(),jet->GetNumberOfTracks());
524 fh2NEFNConstituentsNeutral->Fill(jet->NEF(),jet->GetNumberOfClusters());
527 Double_t sumPtCh = 0.;
528 for(Int_t icc=0; icc<jet->GetNumberOfTracks(); icc++) {
529 vp = static_cast<AliVParticle*>(jet->TrackAt(icc, fTracks));
531 fh2Ptz->Fill(jetPt,GetZ(vp,jet));
535 if(jet->GetNumberOfTracks()>0)
536 fh2PtMeanPtConstituentsCharged->Fill(jetPt,sumPtCh/(double)(jet->GetNumberOfTracks()) );
539 AliVCluster *vc = 0x0;
540 Double_t sumPtNe = 0.;
542 for(Int_t icc=0; icc<jet->GetNumberOfClusters(); icc++) {
543 vc = static_cast<AliVCluster*>(clusCont->GetCluster(icc));
547 vc->GetMomentum(lp, const_cast<Double_t*>(fVertex));
552 if(jet->GetNumberOfClusters()>0)
553 fh2PtMeanPtConstituentsNeutral->Fill(jetPt,sumPtNe/(double)(jet->GetNumberOfClusters()) );
557 for(Int_t i=1; i<=fh2NJetsPtFull->GetNbinsY(); i++) {
558 Int_t nJetsInEvent = nJetsArr->At(i);
559 fh2NJetsPtFull->Fill(nJetsInEvent,fh2NJetsPtFull->GetYaxis()->GetBinCenter(i));
564 //Reset array to zero to also count charged jets
567 //Loop over charged jets
568 if (GetJetContainer(fContainerCharged)) {
569 const Int_t njets = GetNJets(fContainerCharged);
570 for (Int_t ij = 0; ij < njets; ij++) {
572 AliEmcalJet* jet = GetAcceptJetFromArray(ij,fContainerCharged);
574 continue; //jet not selected
576 Double_t jetPt = jet->Pt();
577 if(jetPt>ptLeadJet2) ptLeadJet2=jetPt;
578 fh3PtEtaPhiJetCharged->Fill(jetPt,jet->Eta(),jet->Phi());
579 fh3PtEtaAreaJetCharged->Fill(jetPt,jet->Eta(),jet->Area());
582 for(Int_t icc=0; icc<jet->GetNumberOfTracks(); icc++) {
583 vp = static_cast<AliVParticle*>(jet->TrackAt(icc, fTracks));
585 fh2PtzCharged->Fill(jetPt,GetZ(vp,jet));
588 //count jets above certain pT threshold
589 Int_t ptbin = fh2NJetsPtCharged->GetYaxis()->FindBin(jetPt);
590 for(Int_t iptbin = ptbin; iptbin<=fh2NJetsPtCharged->GetNbinsY(); iptbin++)
591 nJetsArr->AddAt(nJetsArr->At(iptbin)+1,iptbin);
594 for(Int_t i=1; i<=fh2NJetsPtCharged->GetNbinsY(); i++) {
595 Int_t nJetsInEvent = nJetsArr->At(i);
596 fh2NJetsPtCharged->Fill(nJetsInEvent,fh2NJetsPtCharged->GetYaxis()->GetBinCenter(i));
600 if(GetJetContainer(fContainerFull) && GetJetContainer(fContainerCharged)) {
601 fh2PtLeadJet1VsLeadJet2->Fill(ptLeadJet1,ptLeadJet2);
604 fh3PtLeadJet1VsPatchEnergy->Fill(ptLeadJet1,fMaxPatchEnergy,fTriggerType);
605 fh3PtLeadJet2VsPatchEnergy->Fill(ptLeadJet2,fMaxPatchEnergy,fTriggerType);
607 if(nJetsArr) delete nJetsArr;
612 //________________________________________________________________________
613 Bool_t AliAnalysisTaskEmcalJetTriggerQA::Run()
615 // Run analysis code here, if needed. It will be executed before FillHistograms().
617 //Check if event is selected (vertex & pile-up)
623 if(!fTriggerClass.IsNull())
626 return kTRUE; // If return kFALSE FillHistogram() will NOT be executed.
629 //_______________________________________________________________________
630 void AliAnalysisTaskEmcalJetTriggerQA::Terminate(Option_t *)
632 // Called once at the end of the analysis.
634 //________________________________________________________________________
635 Double_t AliAnalysisTaskEmcalJetTriggerQA::GetZ(const AliVParticle *trk, const AliEmcalJet *jet) const
637 // Get Z of constituent trk
639 return GetZ(trk->Px(),trk->Py(),trk->Pz(),jet->Px(),jet->Py(),jet->Pz());
642 //________________________________________________________________________
643 Double_t AliAnalysisTaskEmcalJetTriggerQA::GetZ(const Double_t trkPx, const Double_t trkPy, const Double_t trkPz, const Double_t jetPx, const Double_t jetPy, const Double_t jetPz) const
646 // Get the z of a constituent inside of a jet
649 Double_t pJetSq = jetPx*jetPx+jetPy*jetPy+jetPz*jetPz;
652 return (trkPx*jetPx+trkPy*jetPy+trkPz*jetPz)/pJetSq;
654 AliWarning(Form("%s: strange, pjet*pjet seems to be zero pJetSq: %f",GetName(), pJetSq));
659 //________________________________________________________________________
660 Int_t AliAnalysisTaskEmcalJetTriggerQA::GetLeadingCellId(const AliVCluster *clus) const
662 //Get energy of leading cell in cluster
668 Int_t iCellAbsIdMax = -1;
669 Int_t nCells = clus->GetNCells();
670 for(Int_t i = 0; i<nCells; i++) {
671 Int_t absId = clus->GetCellAbsId(i);
672 Double_t cellE = fCaloCells->GetCellAmplitude(absId);
675 iCellAbsIdMax = absId;
679 return iCellAbsIdMax;
682 //________________________________________________________________________
683 Double_t AliAnalysisTaskEmcalJetTriggerQA::GetEnergyLeadingCell(const AliVCluster *clus) const
685 //Get energy of leading cell in cluster
689 Int_t absID = GetLeadingCellId(clus);
691 return fCaloCells->GetCellAmplitude(absID);