]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/AliEmcalJetTask.h
Adapt add macro and particle/cluster containers for the analysis on jets
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / AliEmcalJetTask.h
CommitLineData
914d486c 1#ifndef ALIEMCALJETTASK_H
2#define ALIEMCALJETTASK_H
48d874ff 3
48d874ff 4class TClonesArray;
b65fac7a 5class AliVEvent;
8082a80b 6class AliRhoParameter;
48d874ff 7
7030f36f 8namespace fastjet {
9 class PseudoJet;
10}
11
d14d6e2c 12#include "AliLog.h"
48d874ff 13#include "AliAnalysisTaskSE.h"
8082a80b 14#include "AliFJWrapper.h"
bf9072ca 15#include "AliAODMCParticle.h"
b9ccc456 16#include "AliEmcalJet.h"
914d486c 17class AliEmcalJetTask : public AliAnalysisTaskSE {
48d874ff 18 public:
6a20534a 19
20 enum JetType {
21 kNone=0,
22 kKT=1<<0,
23 kAKT=1<<1,
24 kFullJet=1<<2,
25 kChargedJet=1<<3,
26 kNeutralJet=1<<4,
27 kR020Jet=1<<5,
28 kR030Jet=1<<6,
29 kR040Jet=1<<7,
30 kRX1Jet=1<<8, // user defined radii, use SetRadius(Double_t)
31 kRX2Jet=1<<9,
d1f2e0d9 32 kRX3Jet=1<<10
6a20534a 33 };
34
35
914d486c 36 AliEmcalJetTask();
37 AliEmcalJetTask(const char *name);
38 virtual ~AliEmcalJetTask();
48d874ff 39
b65fac7a 40 void UserCreateOutputObjects();
41 void UserExec(Option_t *option);
42 void Terminate(Option_t *option);
b9ccc456 43
83c097da 44 Bool_t IsLocked() { if(fLocked) {AliFatal("Jet finder task is locked! Changing properties is not allowed."); return kTRUE;} else return kFALSE;};
45 void SetLocked() { fLocked = kTRUE;}
df803211 46 void SelectConstituents(UInt_t constSel, UInt_t MCconstSel) { fConstSel = constSel; fMCConstSel = MCconstSel; };
83c097da 47 void SetAlgo(Int_t a) { if(IsLocked()) return; if (a==0) fJetType |= kKT; else fJetType |= kAKT; } // for backward compatibility only
48 void SetClusName(const char *n) { if(IsLocked()) return; fCaloName = n ; }
49 void SetJetsName(const char *n) { if(IsLocked()) return; fJetsName = n ; }
8082a80b 50 void SetJetsSubName(const char *n) { fJetsSubName = n ; }
83c097da 51 void SetJetType(UInt_t t) { if(IsLocked()) return; fJetType = t ; }
52 void SetMarkConstituents(UInt_t m) { if(IsLocked()) return; fMarkConst = m ; }
53 void SetMinJetArea(Double_t a) { if(IsLocked()) return; fMinJetArea = a ; }
54 void SetMinJetClusPt(Double_t min) { if(IsLocked()) return; fMinJetClusPt = min ; }
55 void SetMinJetPt(Double_t j) { if(IsLocked()) return; fMinJetPt = j ; }
56 void SetMinJetTrackPt(Double_t min) { if(IsLocked()) return; fMinJetTrackPt = min ; }
57 void SetRadius(Double_t r) { if(IsLocked()) return; fRadius = r ; if ((fJetType & (kRX1Jet|kRX2Jet|kRX3Jet)) == 0) AliWarning("Radius value will be ignored if jet type is not set to a user defined radius (kRX1Jet,kRX2Jet,kRX3Jet)."); }
58 void SetTrackEfficiency(Double_t t) { if(IsLocked()) return; fTrackEfficiency = t ; }
59 void SetTracksName(const char *n) { if(IsLocked()) return; fTracksName = n ; }
60 void SetType(Int_t t) { if(IsLocked()) return;
61 if (t==0) fJetType |= kFullJet;
6a20534a 62 else if (t==1) fJetType |= kChargedJet;
63 else if (t==2) fJetType |= kNeutralJet; } // for backward compatibility only
83c097da 64 void SetEtaRange(Double_t emi, Double_t ema) {if(IsLocked()) return; fEtaMin = emi; fEtaMax = ema; }
65 void SetPhiRange(Double_t pmi, Double_t pma) {if(IsLocked()) return; fPhiMin = pmi; fPhiMax = pma; }
66 void SetJetEtaRange(Double_t emi, Double_t ema) {if(IsLocked()) return; fJetEtaMin = emi; fJetEtaMax = ema; }
67 void SetJetPhiRange(Double_t pmi, Double_t pma) {if(IsLocked()) return; fJetPhiMin = pmi; fJetPhiMax = pma; }
68 void SetGhostArea(Double_t gharea) { if(IsLocked()) return; fGhostArea = gharea; }
69 void SetMinMCLabel(Int_t s) { if(IsLocked()) return; fMinMCLabel = s ; }
70 void SetRecombScheme(Int_t scheme) { if(IsLocked()) return; fRecombScheme = scheme; }
6421eeb0 71 void SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB)
d14d6e2c 72 {
73 if(!fIsPSelSet)
74 {
75 fIsPSelSet = kTRUE;
76 fOfflineTriggerMask = offlineTriggerMask;
77 }
78 else
79 {
80 AliWarning("Manually setting the event selection for jet finders is not allowed! Using trigger=old_trigger | your_trigger");
81 fOfflineTriggerMask = fOfflineTriggerMask | offlineTriggerMask;
82 }
83 }
bf9072ca 84 void SetLegacyMode(Bool_t mode) { if(IsLocked()) return; fLegacyMode = mode; }
85 void SetMCFlag(UInt_t m) { if(IsLocked()) return; fMCFlag = m ; }
86 void SelectHIJING(Bool_t s) { if(IsLocked()) return; if (s) fGeneratorIndex = 0; else fGeneratorIndex = -1; }
87 void SetGeneratorIndex(Short_t i) { if(IsLocked()) return; fGeneratorIndex = i; }
88 void SelectPhysicalPrimaries(Bool_t s) { if(IsLocked()) return;
89 if (s) fMCFlag |= AliAODMCParticle::kPhysicalPrim ;
90 else fMCFlag &= ~AliAODMCParticle::kPhysicalPrim ; }
91
b6600fde 92 void SetCodeDebug(Bool_t val) { fCodeDebug = val ; }
93 void SetForceIsMcPart(Bool_t b) { fIsMcPart = b ; }
1e9d5955 94 void SetPionMassForClusters(Bool_t b) { fPionMassClusters = b ; }
6a20534a 95
8082a80b 96 void SetRhoName(const char *n) { fRhoName = n ; }
97 void SetRhomName(const char *n) { fRhomName = n ; }
726c9488 98 void SetGenericSubtractionJetMass(Bool_t b) { fDoGenericSubtractionJetMass = b; }
99 void SetGenericSubtractionGR(Bool_t b, Double_t rmax = 2., Double_t dr = 0.04, Double_t ptmin = 0.) { fDoGenericSubtractionGR = b; fRMax=rmax; fDRStep=dr; fPtMinGR=ptmin;}
8082a80b 100 void SetConstituentSubtraction(Bool_t b) { fDoConstituentSubtraction = b; }
b6600fde 101 void SetGenericSubtractionExtraJetShapes(Bool_t b) { fDoGenericSubtractionExtraJetShapes =b;}
8082a80b 102 void SetUseExternalBkg(Bool_t b, Double_t rho, Double_t rhom) { fUseExternalBkg = b; fRho = rho; fRhom = rhom;}
103
6a20534a 104 UInt_t GetJetType() { return fJetType; }
5d0a5007 105 Bool_t GetLegacyMode() { return fLegacyMode; }
8082a80b 106 TString GetJetsSubName() { return fJetsSubName; }
6a20534a 107
bf287539 108 const char* GetJetsName() { return fJetsName.Data(); }
109 Double_t GetRadius() { return fRadius; }
110 const char* GetTracksName() { return fTracksName.Data(); }
111 const char* GetClusName() { return fCaloName.Data(); }
83e18127 112 const char* GetRhoName() { return fRhoName.Data(); }
bf287539 113 UInt_t GetMarkConstituents() { return fMarkConst; }
114 Double_t GetMinJetArea() { return fMinJetArea; }
115 Double_t GetMinJetClusPt() { return fMinJetClusPt; }
116 Double_t GetMinJetPt() { return fMinJetPt; }
117 Double_t GetMinJetTrackPt() { return fMinJetTrackPt; }
118 Double_t GetTrackEfficiency() { return fTrackEfficiency; }
119 Double_t GetGhostArea() { return fGhostArea; }
120 Int_t GetMinMCLabel() { return fMinMCLabel; }
121 Int_t GetRecombScheme() { return fRecombScheme; }
122 Double_t GetEtaMin() { return fEtaMin; }
123 Double_t GetEtaMax() { return fEtaMax; }
124 Double_t GetPhiMin() { return fPhiMin; }
125 Double_t GetPhiMax() { return fPhiMax; }
126 Double_t GetJetEtaMin() { return fJetEtaMin; }
127 Double_t GetJetEtaMax() { return fJetEtaMax; }
128 Double_t GetJetPhiMin() { return fJetPhiMin; }
129 Double_t GetJetPhiMax() { return fJetPhiMax; }
130
131 AliVEvent* GetEvent() { return fEvent;}
132 TClonesArray* GetClusters() { return fClus;}
133 TClonesArray* GetTracks() { return fTracks;}
134 TClonesArray* GetJets() { return fJets;}
135
48d874ff 136 protected:
04905231 137 void FindJets();
138 Bool_t DoInit();
ca5c29fa 139 Bool_t GetSortedArray(Int_t indexes[], std::vector<fastjet::PseudoJet> array) const;
48d874ff 140
b00cebf9 141 void FillJetConstituents(std::vector<fastjet::PseudoJet>& constituents,AliEmcalJet *jet,Double_t vertex[3],UInt_t jetCount,Int_t& nt,Int_t& nc,Double_t& maxCh,Double_t& maxNe,Int_t& ncharged,Int_t& nneutral,Double_t& neutralE,Double_t& mcpt,Int_t& cemc,Double_t& emcpt,Int_t& gall,Int_t& gemc,std::vector<fastjet::PseudoJet>& constituentsunsub,Int_t flag);
142 Int_t GetIndexSub(Double_t ptsub,std::vector<fastjet::PseudoJet>& constituentsunsub);
900f5135 143 TString fTracksName; // name of track collection
144 TString fCaloName; // name of calo cluster collection
7efbea04 145 TString fJetsName; // name of jet collection
8082a80b 146 TString fJetsSubName; // name of subtracted jet collection
6a20534a 147 UInt_t fJetType; // jet type (algorithm, radius, constituents)
148 UInt_t fConstSel; // select constituents from a previous jet finding
149 UInt_t fMCConstSel; // select MC constituents (label!=0) from a previous jet finding
7030f36f 150 UInt_t fMarkConst; // constituents are marked (via TObject::SetBit) as belonging to the # leading jets
48d874ff 151 Double_t fRadius; // jet radius
f5f3c8e9 152 Double_t fMinJetTrackPt; // min jet track momentum (applied before clustering)
153 Double_t fMinJetClusPt; // min jet cluster momentum (applied before clustering)
04905231 154 Double_t fPhiMin; // minimum phi for constituents (applied before clustering)
155 Double_t fPhiMax; // maximum phi for constituents (applied before clustering)
156 Double_t fEtaMin; // minimum eta for constituents (applied before clustering)
157 Double_t fEtaMax; // maximum eta for constituents (applied before clustering)
f5f3c8e9 158 Double_t fMinJetArea; // min area to keep jet in output
159 Double_t fMinJetPt; // min jet pt to keep jet in output
c9ad772c 160 Double_t fJetPhiMin; // minimum phi to keep jet in output
161 Double_t fJetPhiMax; // maximum phi to keep jet in output
162 Double_t fJetEtaMin; // minimum eta to keep jet in output
163 Double_t fJetEtaMax; // maximum eta to keep jet in output
1f9c287f 164 Double_t fGhostArea; // ghost area
a7477843 165 Int_t fMinMCLabel; // minimum MC label value for the tracks/clusters being considered MC particles
7071e730 166 Int_t fRecombScheme; // recombination scheme used by fastjet
6421eeb0 167 Double_t fTrackEfficiency; // artificial tracking inefficiency (0...1)
bf9072ca 168 UInt_t fMCFlag; // select MC particles with flags
169 Short_t fGeneratorIndex; // select MC particles with generator index (default = -1 = switch off selection)
04905231 170 Bool_t fIsInit; //!=true if already initialized
83c097da 171 Bool_t fLocked; // true if lock is set
d14d6e2c 172 Bool_t fIsPSelSet; //!=true if physics selection was set
04905231 173 Bool_t fIsMcPart; //!=true if MC particles are given as input
174 Bool_t fIsEmcPart; //!=true if emcal particles are given as input (for clusters)
5d0a5007 175 Bool_t fLegacyMode; //! if true, enable FJ 2.x behavior
ffdca6aa 176 Bool_t fCodeDebug; // use nontested code changes
1b063995 177 Bool_t fPionMassClusters; // assume pion mass for clusters
8082a80b 178
3ec5da8e 179 Bool_t fDoGenericSubtractionJetMass; // calculate generic subtraction
180 Bool_t fDoGenericSubtractionGR; // calculate generic subtraction for angular structure function GR
181 Bool_t fDoGenericSubtractionExtraJetShapes; //calculate generic subtraction for other jet shapes like radialmoment,pTD etc
182 Bool_t fDoConstituentSubtraction; // calculate constituent subtraction
183 Bool_t fUseExternalBkg; // use external background for generic subtractor
184 TString fRhoName; // name of rho
185 TString fRhomName; // name of rhom
186 Double_t fRho; // pT background density
187 Double_t fRhom; // mT background density
188 Double_t fRMax; // R max for GR calculation
189 Double_t fDRStep; // step width for GR calculation
190 Double_t fPtMinGR; // min pT for GR calculation
726c9488 191
8082a80b 192
48d874ff 193 TClonesArray *fJets; //!jet collection
8082a80b 194 TClonesArray *fJetsSub; //!subtracted jet collection
b65fac7a 195 AliVEvent *fEvent; //!current event
04905231 196 TClonesArray *fTracks; //!tracks collection
197 TClonesArray *fClus; //!cluster collection
8082a80b 198 AliRhoParameter *fRhoParam; //!event rho
199 AliRhoParameter *fRhomParam; //!event rhom
48d874ff 200
201 private:
914d486c 202 AliEmcalJetTask(const AliEmcalJetTask&); // not implemented
203 AliEmcalJetTask &operator=(const AliEmcalJetTask&); // not implemented
48d874ff 204
1e9d5955 205 ClassDef(AliEmcalJetTask, 16) // Jet producing task
48d874ff 206};
207#endif