AliPhysics  c923f52 (c923f52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalJet.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
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  **************************************************************************/
15 
17 
18 #include <TClonesArray.h>
19 #include <TList.h>
20 
21 #include "AliAnalysisManager.h"
22 #include "AliCentrality.h"
23 #include "AliEMCALGeometry.h"
24 #include "AliESDEvent.h"
25 #include "AliEmcalJet.h"
26 #include "AliLog.h"
27 #include "AliRhoParameter.h"
28 #include "AliLocalRhoParameter.h"
29 #include "AliVCluster.h"
30 #include "AliVEventHandler.h"
31 #include "AliVParticle.h"
32 
36 
41  AliAnalysisTaskEmcal("AliAnalysisTaskEmcalJet"),
42  fRhoName(),
43  fLocalRhoName(),
44  fJetCollArray(),
45  fJets(0),
46  fRho(0),
47  fLocalRho(0),
48  fRhoVal(0)
49 {
50  fJetCollArray.SetOwner(kTRUE);
51 }
52 
64  AliAnalysisTaskEmcal(name, histo),
65  fRhoName(),
66  fLocalRhoName(),
67  fJetCollArray(),
68  fJets(0),
69  fRho(0),
70  fLocalRho(0),
71  fRhoVal(0)
72 {
73  fJetCollArray.SetOwner(kTRUE);
74 }
75 
80 {
81 }
82 
90 {
91  AliRhoParameter *rho = 0;
92  TString sname(name);
93  if (!sname.IsNull()) {
94  rho = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(sname));
95  if (!rho) {
96  AliWarning(Form("%s: Could not retrieve rho with name %s!", GetName(), name));
97  return 0;
98  }
99  }
100  return rho;
101 }
102 
110 {
111  // Get local rho from event.
112  AliLocalRhoParameter *rho = 0;
113  TString sname(name);
114  if (!sname.IsNull()) {
115  rho = dynamic_cast<AliLocalRhoParameter*>(InputEvent()->FindListObject(sname));
116  if (!rho) {
117  AliWarning(Form("%s: Could not retrieve local rho with name %s!", GetName(), name));
118  return 0;
119  }
120  }
121  return rho;
122 }
123 
135 {
136  // Init the analysis.
137 
139 
140  if (!fRhoName.IsNull() && !fRho) { // get rho from the event
141  fRho = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fRhoName));
142  if (!fRho) {
143  AliError(Form("%s: Could not retrieve rho %s!", GetName(), fRhoName.Data()));
144  fLocalInitialized = kFALSE;
145  return;
146  }
147  }
148 
149  if (!fLocalRhoName.IsNull() && !fLocalRho) {
150  fLocalRho = dynamic_cast<AliLocalRhoParameter*>(InputEvent()->FindListObject(fLocalRhoName));
151  if (!fLocalRho) {
152  AliError(Form("%s: Could not retrieve local rho %s!", GetName(), fLocalRhoName.Data()));
153  fLocalInitialized = kFALSE;
154  return;
155  }
156  }
157 
158  //Load all requested jet branches - each container knows name already
159  if(fJetCollArray.GetEntriesFast()==0) {
160  AliWarning("There are no jet collections");
161  return;
162  }
163 
164  for(Int_t i =0; i<fJetCollArray.GetEntriesFast(); i++) {
165  AliJetContainer *cont = static_cast<AliJetContainer*>(fJetCollArray.At(i));
166  cont->SetRunNumber(InputEvent()->GetRunNumber());
167  cont->SetArray(InputEvent());
168  cont->LoadRho(InputEvent());
169  }
170 
171  //Get Jets, cuts and rho for first jet container
172  AliJetContainer *cont = GetJetContainer(0);
173 
174  if (!cont->GetArrayName().IsNull()) {
175  fJets = cont->GetArray();
176  if(!fJets && fJetCollArray.GetEntriesFast()>0) {
177  AliError(Form("%s: Could not retrieve first jet branch!", GetName()));
178  fLocalInitialized = kFALSE;
179  return;
180  }
181  }
182 
183  if (!fRho) { // if rho name is not provided, tries to use the rho object of the first jet branch
184  fRhoName = cont->GetRhoName();
185  fRho = cont->GetRhoParameter();
186  }
187 }
188 
197 {
198  for (Int_t i = 0; i < jet->GetNumberOfClusters(); ++i) {
199  Int_t ijetclus = jet->ClusterAt(i);
200  if (sorted && ijetclus > iclus)
201  return kFALSE;
202  if (ijetclus == iclus)
203  return kTRUE;
204  }
205  return kFALSE;
206 }
207 
216 {
217  for (Int_t i = 0; i < jet->GetNumberOfTracks(); ++i) {
218  Int_t ijettrack = jet->TrackAt(i);
219  if (sorted && ijettrack > itrack)
220  return kFALSE;
221  if (ijettrack == itrack)
222  return kTRUE;
223  }
224  return kFALSE;
225 }
226 
233 {
235  return kFALSE;
236 
237  if (fRho) fRhoVal = fRho->GetVal();
238 
239  AliEmcalContainer* cont = 0;
240 
241  TIter nextJetColl(&fJetCollArray);
242  while ((cont = static_cast<AliEmcalContainer*>(nextJetColl()))) cont->NextEvent();
243 
244  return kTRUE;
245 }
246 
259  UInt_t accType, TString tag)
260 {
263 
264  return AddJetContainer(jetType, jetAlgo, recoScheme, radius, accType, partCont, clusCont, tag);
265 }
266 
281  AliParticleContainer* partCont, AliClusterContainer* clusCont, TString tag)
282 {
283  AliJetContainer *cont = new AliJetContainer(jetType, jetAlgo, recoScheme, radius, partCont, clusCont, tag);
284  cont->SetJetAcceptanceType(accType);
285  fJetCollArray.Add(cont);
286 
287  return cont;
288 }
289 
299 {
300  if (TString(n).IsNull()) return 0;
301 
302  AliJetContainer *cont = new AliJetContainer(n);
303  cont->SetJetRadius(jetRadius);
304  cont->SetJetAcceptanceType(accType);
305  fJetCollArray.Add(cont);
306 
307  return cont;
308 }
309 
317 AliJetContainer* AliAnalysisTaskEmcalJet::AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius) {
318 
319  // Add particle container
320  // will be called in AddTask macro
321 
322  if(TString(n).IsNull()) return 0;
323 
325 
326  defaultCutType.ToUpper();
327 
328  if (defaultCutType.IsNull() || defaultCutType.EqualTo("USER")) {
329  acc = AliEmcalJet::kUser;
330  }
331  else if(defaultCutType.EqualTo("TPC")) {
332  acc = AliEmcalJet::kTPC;
333  }
334  else if(defaultCutType.EqualTo("TPCFID")) {
335  acc = AliEmcalJet::kTPCfid;
336  }
337  else if(defaultCutType.EqualTo("EMCAL")) {
338  acc = AliEmcalJet::kEMCAL;
339  }
340  else if(defaultCutType.EqualTo("EMCALFID")) {
342  }
343  else if(defaultCutType.EqualTo("DCAL")) {
344  acc = AliEmcalJet::kDCAL;
345  }
346  else if(defaultCutType.EqualTo("DCALFID")) {
347  acc = AliEmcalJet::kDCALfid;
348  }
349  else {
350  AliWarning(Form("%s: default cut type %s not recognized. Not setting cuts.",GetName(),defaultCutType.Data()));
351  }
352 
353  return AddJetContainer(n, acc, jetRadius);
354 }
355 
362 {
363  if (i < 0 || i >= fJetCollArray.GetEntriesFast()) return 0;
364  AliJetContainer *cont = static_cast<AliJetContainer*>(fJetCollArray.At(i));
365  return cont;
366 }
367 
374 {
375  AliJetContainer *cont = static_cast<AliJetContainer*>(fJetCollArray.FindObject(name));
376  return cont;
377 }
378 
380 {
381  AliJetContainer *cont = GetJetContainer(c);
382  if (cont) {
383  cont->SetJetAcceptanceType(t);
384  }
385  else {
386  AliError(Form("%s in SetJetAcceptanceType(...): container %d not found!",GetName(),c));
387  }
388 }
389 
391 {
392  AliJetContainer *cont = GetJetContainer(c);
393  if (!cont) {
394  AliError(Form("%s in SetJetAcceptanceType(...): container %d not found",GetName(),c));
395  return;
396  }
397 
398  cutType.ToUpper();
399 
400  if(!cutType.IsNull() && !cutType.EqualTo("USER")) {
401  if(cutType.EqualTo("TPC"))
403  else if(cutType.EqualTo("EMCAL"))
405  else
406  AliWarning(Form("%s: default cut type %s not recognized. Not setting cuts.",GetName(),cutType.Data()));
407  } else
409 }
410 
412 {
413  if (c >= 0) {
414  AliJetContainer *cont = GetJetContainer(c);
415  if (cont) cont->SetRhoName(n);
416  else AliError(Form("%s in SetRhoName(...): container %d not found",GetName(),c));
417  }
418  else {
419  fRhoName = n;
420  }
421 }
422 
424 {
425  AliJetContainer *cont = GetJetContainer(c);
426  if (cont) cont->SetJetEtaLimits(min,max);
427  else AliError(Form("%s in SetJetEtaLimits(...): container %d not found",GetName(),c));
428 }
429 
431 {
432  AliJetContainer *cont = GetJetContainer(c);
433  if (cont) cont->SetJetPhiLimits(min,max);
434  else AliError(Form("%s in SetJetPhiLimits(...): container %d not found",GetName(),c));
435 }
436 
438 {
439  AliJetContainer *cont = GetJetContainer(c);
440  if (cont) cont->SetJetAreaCut(cut);
441  else AliError(Form("%s in SetJetAreaCut(...): container %d not found",GetName(),c));
442 }
443 
445 {
446  AliJetContainer *cont = GetJetContainer(c);
447  if (cont) cont->SetPercAreaCut(p);
448  else AliError(Form("%s in SetPercAreaCut(...): container %d not found",GetName(),c));
449 }
450 
452 {
453  AliJetContainer *cont = GetJetContainer(c);
454  if (cont) cont->SetZLeadingCut(zemc,zch);
455  else AliError(Form("%s in SetZLeadingCut(...): container %d not found",GetName(),c));
456 }
457 
459 {
460  AliJetContainer *cont = GetJetContainer(c);
461  if (cont) cont->SetNEFCut(min,max);
462  else AliError(Form("%s in SetNEFCut(...): container %d not found",GetName(),c));
463 }
464 
466 {
467  AliJetContainer *cont = GetJetContainer(c);
468  if (cont) cont->SetAreaEmcCut(a);
469  else AliError(Form("%s in SetAreaEmcCut(...): container %d not found",GetName(),c));
470 }
471 
473 {
474  AliJetContainer *cont = GetJetContainer(c);
475  if (cont) cont->SetJetPtCut(cut);
476  else AliError(Form("%s in SetJetPtCut(...): container %d not found",GetName(),c));
477 }
478 
480 {
481  AliJetContainer *cont = GetJetContainer(c);
482  if (cont) cont->SetJetRadius(r);
483  else AliError(Form("%s in SetJetRadius(...): container %d not found",GetName(),c));
484 }
485 
487 {
488  AliJetContainer *cont = GetJetContainer(c);
489  if (cont) cont->SetMaxClusterPt(cut);
490  else AliError(Form("%s in SetMaxClusterPt(...): container %d not found",GetName(),c));
491 }
492 
494 {
495  AliJetContainer *cont = GetJetContainer(c);
496  if (cont) cont->SetMaxTrackPt(cut);
497  else AliError(Form("%s in SetMaxTrackPt(...): container %d not found",GetName(),c));
498 }
499 
501 {
502  AliJetContainer *cont = GetJetContainer(c);
503  if (cont) cont->SetPtBiasJetClus(cut);
504  else AliError(Form("%s in SetPtBiasJetClus(...): container %d not found",GetName(),c));
505 }
506 
508 {
509  AliJetContainer *cont = GetJetContainer(c);
510  if (cont) cont->SetPtBiasJetTrack(cut);
511  else AliError(Form("%s in SetPtBiasJetTrack(...): container %d not found",GetName(),c));
512 }
513 
515 {
516  AliJetContainer *cont = GetJetContainer(c);
517  if (cont) cont->SetLeadingHadronType(t);
518  else AliError(Form("%s in SetLeadingHadronType(...): container %d not found",GetName(),c));
519 }
520 
522 {
523  AliJetContainer *cont = GetJetContainer(c);
524  if (cont) cont->SetNLeadingJets(t);
525  else AliError(Form("%s in SetNLeadingJets(...): container %d not found",GetName(),c));
526 }
527 
529 {
530  AliJetContainer *cont = GetJetContainer(c);
531  if (cont) cont->SetBitMap(m);
532  else AliError(Form("%s in SetJetBitMap(...): container %d not found",GetName(),c));
533 }
534 
536 {
537  AliJetContainer *cont = GetJetContainer(c);
538  if (cont) cont->SetIsParticleLevel(b);
539  else AliError(Form("%s in SetIsParticleLevel(...): container %d not found",GetName(),c));
540 }
541 
543 {
544  if (c >= 0) {
545  AliJetContainer *cont = GetJetContainer(c);
546  if (cont) return cont->GetRhoName();
547  else { AliError(Form("%s in GetRhoName(...): container %d not found. Returning fRhoName...",GetName(),c)); return fRhoName; }
548  }
549  else {
550  return fRhoName;
551  }
552 }
553 
555 {
556  AliJetContainer *cont = GetJetContainer(i);
557  if (!cont) {
558  AliError(Form("%s:Container %d not found",GetName(),i));
559  return 0;
560  }
561  return cont->GetArray();
562 }
563 
565 {
566  AliJetContainer *cont = GetJetContainer(i);
567  if (!cont) {
568  AliError(Form("%s:Container %d not found",GetName(),i));
569  return 0;
570  }
571 
572  return cont->GetJetRadius();
573 }
574 
576 {
577  AliJetContainer *cont = GetJetContainer(c);
578  if (!cont) {
579  AliError(Form("%s:Container %d not found",GetName(),c));
580  return 0;
581  }
582  AliEmcalJet *jet = cont->GetJet(j);
583 
584  return jet;
585 }
586 
588 {
589  AliJetContainer *cont = GetJetContainer(c);
590  if (!cont) {
591  AliError(Form("%s:Container %d not found",GetName(),c));
592  return 0;
593  }
594  AliEmcalJet *jet = cont->GetAcceptJet(j);
595 
596  return jet;
597 }
598 
600 {
601  AliJetContainer *cont = GetJetContainer(i);
602  if (!cont) {
603  AliError(Form("%s:Container %d not found",GetName(),i));
604  return 0;
605  }
606  return cont->GetNJets();
607 
608 }
609 
611 {
612  AliJetContainer *cont = GetJetContainer(i);
613  if (!cont) {
614  AliError(Form("%s:Container %d not found",GetName(),i));
615  return 0;
616  }
617  return cont->GetRhoVal();
618 }
619 
621 {
622  AliJetContainer *cont = GetJetContainer(c);
623  if (!cont) {
624  AliError(Form("%s:Container %d not found",GetName(),c));
625  return 0;
626  }
627 
628  return cont->GetLeadingHadronPt(jet);
629 }
630 
632 {
633  if (!jet)
634  return kFALSE;
635 
636  AliJetContainer *cont = GetJetContainer(c);
637  if (!cont) {
638  AliError(Form("%s:Container %d not found",GetName(),c));
639  return 0;
640  }
641 
642  UInt_t rejectionReason = 0;
643  return cont->AcceptJet(jet, rejectionReason);
644 }
void SetAreaEmcCut(Double_t a=0.99)
void SetPercAreaCut(Float_t p, Int_t c=0)
void SetMaxClusterPt(Float_t b, Int_t c=0)
Double_t GetRhoVal() const
AliEmcalJet * GetJetFromArray(Int_t j, Int_t c=0) const
const TString & GetRhoName() const
double Double_t
Definition: External.C:58
void LoadRho(const AliVEvent *event)
AliJetContainer * GetJetContainer(Int_t i=0) const
DCal acceptance.
Definition: AliEmcalJet.h:62
const TString & GetRhoName(Int_t c=0) const
void SetJetBitMap(UInt_t m, Int_t c=0)
Base task in the EMCAL framework.
void SetLeadingHadronType(Int_t t)
Bool_t fLocalInitialized
whether or not the task has been already initialized
Int_t GetNJets(Int_t i=0) const
void SetAreaEmcCut(Double_t a=0.99, Int_t c=0)
void SetPtBiasJetTrack(Float_t b)
Double_t GetLeadingHadronPt(AliEmcalJet *jet, Int_t c=0)
virtual Bool_t AcceptJet(Int_t i, UInt_t &rejectionReason) const
Full acceptance, i.e. no acceptance cut applied – left to user.
Definition: AliEmcalJet.h:64
TCanvas * c
Definition: TestFitELoss.C:172
AliJetContainer * AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius=0.4)
AliLocalRhoParameter * GetLocalRhoFromEvent(const char *name)
void SetPercAreaCut(Float_t p)
void SetPtBiasJetClus(Float_t b, Int_t c=0)
TClonesArray * GetJetArray(Int_t i=0) const
void SetPtBiasJetClus(Float_t b)
Container for particles within the EMCAL framework.
Double_t GetJetRadius(Int_t i=0) const
UShort_t GetNumberOfTracks() const
Definition: AliEmcalJet.h:126
Bool_t IsJetTrack(AliEmcalJet *jet, Int_t itrack, Bool_t sorted=kFALSE) const
AliParticleContainer * GetParticleContainer(Int_t i=0) const
TString fLocalRhoName
name for local rho
void SetRhoName(const char *n)
TPC fiducial acceptance (each eta edge narrowed by jet R)
Definition: AliEmcalJet.h:59
void SetLeadingHadronType(Int_t t, Int_t c=0)
Bool_t IsJetCluster(AliEmcalJet *jet, Int_t iclus, Bool_t sorted=kFALSE) const
AliRhoParameter * GetRhoFromEvent(const char *name)
Short_t ClusterAt(Int_t idx) const
Definition: AliEmcalJet.h:124
int Int_t
Definition: External.C:63
UShort_t GetNumberOfClusters() const
Definition: AliEmcalJet.h:125
void SetJetRadius(Float_t r)
void SetJetPtCut(Float_t cut)
TPC acceptance.
Definition: AliEmcalJet.h:58
unsigned int UInt_t
Definition: External.C:33
Double_t GetLeadingHadronPt(const AliEmcalJet *jet) const
void SetPtBiasJetTrack(Float_t b, Int_t c=0)
float Float_t
Definition: External.C:68
void SetNLeadingJets(Int_t t)
void SetJetRadius(Float_t r, Int_t c=0)
void SetJetEtaLimits(Float_t min, Float_t max, Int_t c=0)
void SetJetPhiLimits(Float_t min, Float_t max)
AliRhoParameter * fRho
! event rho
EMCal acceptance.
Definition: AliEmcalJet.h:60
Int_t GetNJets() const
void SetJetAcceptanceType(UInt_t t, Int_t c=0)
AliClusterContainer * GetClusterContainer(Int_t i=0) const
AliLocalRhoParameter * fLocalRho
! local event rho
void SetZLeadingCut(Float_t zemc, Float_t zch, Int_t c=0)
AliEmcalJet * GetAcceptJetFromArray(Int_t j, Int_t c=0) const
virtual void SetRhoName(const char *n, Int_t c=0)
virtual Bool_t RetrieveEventObjects()
TObjArray fJetCollArray
jet collection array
TClonesArray * fJets
! jets
AliRhoParameter * GetRhoParameter()
void SetJetPhiLimits(Float_t min, Float_t max, Int_t c=0)
Double_t GetRhoVal(Int_t i=0) const
void SetJetAreaCut(Float_t cut, Int_t c=0)
Float_t GetJetRadius() const
void SetNLeadingJets(Int_t t, Int_t c=0)
Short_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:147
void SetIsParticleLevel(Bool_t b, Int_t c=0)
void SetArray(const AliVEvent *event)
AliEmcalJet * GetAcceptJet(Int_t i) const
void SetRunNumber(Int_t r)
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:44
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
void SetMaxClusterPt(Float_t b)
void SetJetAcceptanceType(UInt_t type)
virtual Bool_t AcceptJet(AliEmcalJet *jet, Int_t c=0)
DCal fiducial acceptance (each eta, phi edge narrowed by jet R)
Definition: AliEmcalJet.h:63
bool Bool_t
Definition: External.C:53
void SetNEFCut(Float_t min, Float_t max, Int_t c=0)
void SetJetPtCut(Float_t cut, Int_t c=0)
void SetMaxTrackPt(Float_t b, Int_t c=0)
void SetMaxTrackPt(Float_t b)
void SetJetEtaLimits(Float_t min, Float_t max)
Double_t fRhoVal
! event rho value, same for local rho
Container structure for EMCAL clusters.
void SetZLeadingCut(Float_t zemc, Float_t zch)
EMCal fiducial acceptance (each eta, phi edge narrowed by jet R)
Definition: AliEmcalJet.h:61
Container for jet within the EMCAL jet framework.
ClassImp(AliAnalysisTaskCascadeTester) AliAnalysisTaskCascadeTester
void SetJetAreaCut(Float_t cut)
void SetNEFCut(Float_t min=0., Float_t max=1.)
AliEmcalJet * GetJet(Int_t i) const