AliPhysics  master (3d17d9d)
AliEmcalJetTask.h
Go to the documentation of this file.
1 /**************************************************************************************
2  * Copyright (C) 2016, Copyright Holders of the ALICE Collaboration *
3  * All rights reserved. *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions are met: *
7  * * Redistributions of source code must retain the above copyright *
8  * notice, this list of conditions and the following disclaimer. *
9  * * Redistributions in binary form must reproduce the above copyright *
10  * notice, this list of conditions and the following disclaimer in the *
11  * documentation and/or other materials provided with the distribution. *
12  * * Neither the name of the <organization> nor the *
13  * names of its contributors may be used to endorse or promote products *
14  * derived from this software without specific prior written permission. *
15  * *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19  * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26  **************************************************************************************/
27 #ifndef ALIEMCALJETTASK_H
28 #define ALIEMCALJETTASK_H
29 
30 class TClonesArray;
31 class TObjArray;
32 class AliVEvent;
33 class AliEmcalJetUtility;
34 
35 #include "TF1.h"
36 #include "TRandom3.h"
37 
38 #include <AliLog.h>
39 
40 #include "AliAnalysisTaskEmcal.h"
41 #include "AliFJWrapper.h"
42 #include "FJ_includes.h"
43 #include "AliEmcalJet.h"
44 #include "AliJetContainer.h"
45 #if !(defined(__CINT__) || defined(__MAKECINT__))
47 #endif
48 
49 namespace fastjet {
50  class PseudoJet;
51 }
52 
76  public:
77 
81 
82 #if !defined(__CINT__) && !defined(__MAKECINT__)
83  typedef fastjet::JetAlgorithm FJJetAlgo;
84  typedef fastjet::RecombinationScheme FJRecoScheme;
85 #endif
86 
88  AliEmcalJetTask(const char *name);
89  virtual ~AliEmcalJetTask();
90 
91  Bool_t Run();
92 
93  void SetGhostArea(Double_t gharea) { if (IsLocked()) return; fGhostArea = gharea; }
94  void SetJetsName(const char *n) { if (IsLocked()) return; fJetsTag = n ; }
95  void SetJetsTag(const char *n) { if (IsLocked()) return; fJetsTag = n ; }
96  void SetJetEtaRange(Double_t emi, Double_t ema) { if (IsLocked()) return; fJetEtaMin = emi ; fJetEtaMax = ema; }
97  void SetJetPhiRange(Double_t pmi, Double_t pma) { if (IsLocked()) return; fJetPhiMin = pmi ; fJetPhiMax = pma; }
98  void SetJetAlgo(EJetAlgo_t a) { if (IsLocked()) return; fJetAlgo = a ; }
99  void SetJetType(EJetType_t t) { if (IsLocked()) return; fJetType = t ; }
100  void SetLocked() { fLocked = kTRUE;}
101  void SetMinJetArea(Double_t a) { if (IsLocked()) return; fMinJetArea = a ; }
102  void SetMinJetPt(Double_t j) { if (IsLocked()) return; fMinJetPt = j ; }
103  void SetRecombScheme(ERecoScheme_t scheme) { if (IsLocked()) return; fRecombScheme = scheme; }
104  void SetTrackEfficiency(Double_t t) { if (IsLocked()) return; fTrackEfficiency = t ; }
105  void SetQoverPtShift(Double_t shift) { if (IsLocked()) return; fQoverPtShift = shift; fApplyQoverPtShift = true; }
106  void SetTrackEfficiencyOnlyForEmbedding(Bool_t b) { if (IsLocked()) return; fTrackEfficiencyOnlyForEmbedding = b ; }
107  void SetEnableAliBasicParticleCompatibility(Bool_t b) { if (IsLocked()) return; fEnableAliBasicParticleCompatibility = b; }
108  void SetLegacyMode(Bool_t mode) { if (IsLocked()) return; fLegacyMode = mode ; }
109  void SetFillGhost(Bool_t b=kTRUE) { if (IsLocked()) return; fFillGhost = b ; }
110  void SetRadius(Double_t r) { if (IsLocked()) return; fRadius = r ; }
111 
112  void SetEtaRange(Double_t emi, Double_t ema);
113  void SetMinJetClusPt(Double_t min);
114  void SetMinJetClusE(Double_t min);
115  void SetMinJetTrackPt(Double_t min);
116  void SetPhiRange(Double_t pmi, Double_t pma);
117 
118  AliEmcalJetUtility* AddUtility(AliEmcalJetUtility* utility);
119 
120  Double_t GetGhostArea() { return fGhostArea ; }
121  const char* GetJetsName() { return fJetsName.Data() ; }
122  const char* GetJetsTag() { return fJetsTag.Data() ; }
123  Double_t GetJetEtaMin() { return fJetEtaMin ; }
124  Double_t GetJetEtaMax() { return fJetEtaMax ; }
125  Double_t GetJetPhiMin() { return fJetPhiMin ; }
126  Double_t GetJetPhiMax() { return fJetPhiMax ; }
127  UInt_t GetJetType() { return fJetType ; }
128  UInt_t GetJetAlgo() { return fJetAlgo ; }
129  Bool_t GetLegacyMode() { return fLegacyMode ; }
130  Double_t GetMinJetArea() { return fMinJetArea ; }
131  Double_t GetMinJetPt() { return fMinJetPt ; }
132  Int_t GetMinMCLabel() { return fMinMCLabel ; }
133  Double_t GetRadius() { return fRadius ; }
134  Int_t GetRecombScheme() { return fRecombScheme ; }
135  Double_t GetTrackEfficiency() { return fTrackEfficiency ; }
136  Bool_t GetTrackEfficiencyOnlyForEmbedding() { return fTrackEfficiencyOnlyForEmbedding; }
137 
138  TClonesArray* GetJets() { return fJets ; }
139  TObjArray* GetUtilities() { return fUtilities ; }
140 
141  void FillJetConstituents(AliEmcalJet *jet, std::vector<fastjet::PseudoJet>& constituents,
142  std::vector<fastjet::PseudoJet>& constituents_sub, Int_t flag = 0, TString particlesSubName = "");
143 
144  UInt_t FindJetAcceptanceType(Double_t eta, Double_t phi, Double_t r);
145 
146  void LoadTrackEfficiencyFunction(const std::string & path, const std::string & name);
147 
148  Bool_t IsLocked() const;
149  void SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB);
150  void SetType(Int_t t);
151 
159  void SetFillJetConsituents(Bool_t doFill) { fFillConstituents = doFill; }
160 
161  static AliEmcalJetTask* AddTaskEmcalJet(
162  const TString nTracks = "usedefault",
163  const TString nClusters = "usedefault",
165  const Double_t radius = 0.4,
167  const Double_t minTrPt = 0.15,
168  const Double_t minClPt = 0.30,
169  const Double_t ghostArea = 0.005,
171  const TString tag = "Jet",
172  const Double_t minJetPt = 0.,
173  const Bool_t lockTask = kTRUE,
174  const Bool_t bFillGhosts = kFALSE,
175  const char *suffix = ""
176  );
177 
178 #if !defined(__CINT__) && !defined(__MAKECINT__)
179  static FJJetAlgo ConvertToFJAlgo(EJetAlgo_t algo);
180  static FJRecoScheme ConvertToFJRecoScheme(ERecoScheme_t reco);
181 #endif
182 
183  protected:
184 
185  Int_t FindJets();
186  void FillJetBranch();
187  void ExecOnce();
188  void InitEvent();
189  void InitUtilities();
190  void PrepareUtilities();
191  void ExecuteUtilities(AliEmcalJet* jet, Int_t ij);
192  void TerminateUtilities();
193  Bool_t GetSortedArray(Int_t indexes[], std::vector<fastjet::PseudoJet> array) const;
194  Bool_t IsJetInEmcal(Double_t eta, Double_t phi, Double_t r);
195  Bool_t IsJetInDcal(Double_t eta, Double_t phi, Double_t r);
196  Bool_t IsJetInDcalOnly(Double_t eta, Double_t phi, Double_t r);
197  Bool_t IsJetInPhos(Double_t eta, Double_t phi, Double_t r);
198 
200 
201  EJetType_t fJetType;
202  EJetAlgo_t fJetAlgo;
203  ERecoScheme_t fRecombScheme;
219  TRandom3 fRandom;
222 
230 
231  TClonesArray *fJets;
233 
234  static const Int_t fgkConstIndexShift;
235 
236 #if !(defined(__CINT__) || defined(__MAKECINT__))
237  // Handle mapping between index and containers
240 #endif
241 
242  private:
243  AliEmcalJetTask(const AliEmcalJetTask&); // not implemented
244  AliEmcalJetTask &operator=(const AliEmcalJetTask&); // not implemented
245 
247  ClassDef(AliEmcalJetTask, 30);
249 };
250 #endif
Bool_t fTrackEfficiencyOnlyForEmbedding
Apply aritificial tracking inefficiency only for embedded tracks.
void SetJetsName(const char *n)
void SetRecombScheme(ERecoScheme_t scheme)
TClonesArray * fJets
!jet collection
double Double_t
Definition: External.C:58
Double_t GetJetPhiMax()
Double_t GetJetEtaMin()
void SetMinJetArea(Double_t a)
void SetJetPhiRange(Double_t pmi, Double_t pma)
Double_t fQoverPtShift
artificial q/pt shift
Bool_t fIsEmcPart
!=true if emcal particles are given as input (for clusters)
Bool_t fIsInit
!=true if already initialized
Base task in the EMCAL framework.
Double_t fJetEtaMin
minimum eta to keep jet in output
EJetType_t fJetType
jet type (full, charged, neutral)
AliJetContainer::ERecoScheme_t ERecoScheme_t
Bool_t fApplyArtificialTrackingEfficiency
Flag to apply artificial tracking efficiency.
Bool_t fFillGhost
=true ghost particles will be filled in AliEmcalJet obj
const char * GetJetsName()
void SetLegacyMode(Bool_t mode)
void SetJetType(EJetType_t t)
Double_t GetTrackEfficiency()
void SetMinJetPt(Double_t j)
Double_t GetRadius()
AliEmcalContainerIndexMap< AliParticleContainer, AliVParticle > fParticleContainerIndexMap
! Mapping between index and particle containers
ERecoScheme_t fRecombScheme
recombination scheme used by fastjet
Bool_t fFillConstituents
If true jet consituents will be filled to the AliEmcalJet.
Double_t fTrackEfficiency
artificial tracking inefficiency (0...1)
Double_t GetMinJetArea()
void SetJetAlgo(EJetAlgo_t a)
Bool_t GetTrackEfficiencyOnlyForEmbedding()
void SetTrackEfficiency(Double_t t)
Double_t GetMinJetPt()
General jet finder task implementing a wrapper for FastJet.
void SetJetEtaRange(Double_t emi, Double_t ema)
Bool_t fIsPSelSet
!=true if physics selection was set
Bool_t fLocked
true if lock is set
Double_t fJetPhiMin
minimum phi to keep jet in output
int Int_t
Definition: External.C:63
Bool_t fEnableAliBasicParticleCompatibility
Flag to allow compatibility with AliBasicParticle constituents.
unsigned int UInt_t
Definition: External.C:33
Bool_t fApplyQoverPtShift
Apply Q/pt shift.
TString fJetsTag
tag of jet collection (usually = "Jets")
TObjArray * fUtilities
jet utilities (gen subtractor, constituent subtractor etc.)
TF1 * fTrackEfficiencyFunction
Function that describes the artificial tracking efficiency to be applied on top of the nominal tracki...
void SetTrackEfficiencyOnlyForEmbedding(Bool_t b)
AliEmcalContainerIndexMap< AliClusterContainer, AliVCluster > fClusterContainerIndexMap
! Mapping between index and cluster containers
AliJetContainer::EJetAlgo_t EJetAlgo_t
Double_t fJetEtaMax
maximum eta to keep jet in output
Double_t fGhostArea
ghost area
Int_t mode
Definition: anaM.C:41
TObjArray * GetUtilities()
void SetEnableAliBasicParticleCompatibility(Bool_t b)
void SetGhostArea(Double_t gharea)
EJetAlgo_t fJetAlgo
jet algorithm (kt, akt, etc)
void SetQoverPtShift(Double_t shift)
Double_t fJetPhiMax
maximum phi to keep jet in output
void SetJetsTag(const char *n)
Double_t fMinJetArea
min area to keep jet in output
Bool_t GetLegacyMode()
TString fJetsName
!name of jet collection
void SetFillGhost(Bool_t b=kTRUE)
Double_t fMinJetPt
min jet pt to keep jet in output
TRandom3 fRandom
! Random number generator for artificial tracking efficiency
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
Double_t fRadius
jet radius
Bool_t fLegacyMode
!=true to enable FJ 2.x behavior
Double_t GetJetPhiMin()
Double_t GetJetEtaMax()
fastjet::JetAlgorithm FJJetAlgo
bool Bool_t
Definition: External.C:53
fastjet::RecombinationScheme FJRecoScheme
TClonesArray * GetJets()
void SetFillJetConsituents(Bool_t doFill)
Switch for whether to fill the AliEmcalJetConstituent objects (clusters and particles/tracks) ...
void SetRadius(Double_t r)
AliFJWrapper fFastJetWrapper
!fastjet wrapper
const char * GetJetsTag()
Double_t GetGhostArea()
static const Int_t fgkConstIndexShift
!contituent index shift
AliJetContainer::EJetType_t EJetType_t