]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/AliEmcalJetTask.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / AliEmcalJetTask.h
1 #ifndef ALIEMCALJETTASK_H
2 #define ALIEMCALJETTASK_H
3
4 class TClonesArray;
5 class AliVEvent;
6 class AliRhoParameter;
7
8 namespace fastjet {
9   class PseudoJet;
10 }
11
12 #include "AliLog.h"
13 #include "AliAnalysisTaskSE.h"
14 #include "AliFJWrapper.h"
15
16 class AliEmcalJetTask : public AliAnalysisTaskSE {
17  public:
18
19   enum JetType {
20     kNone=0,
21     kKT=1<<0,
22     kAKT=1<<1,
23     kFullJet=1<<2,
24     kChargedJet=1<<3,
25     kNeutralJet=1<<4,
26     kR020Jet=1<<5,
27     kR030Jet=1<<6,
28     kR040Jet=1<<7,
29     kRX1Jet=1<<8,  // user defined radii, use SetRadius(Double_t)
30     kRX2Jet=1<<9,
31     kRX3Jet=1<<10
32   };
33
34
35   AliEmcalJetTask();
36   AliEmcalJetTask(const char *name);
37   virtual ~AliEmcalJetTask();
38
39   void                   UserCreateOutputObjects();
40   void                   UserExec(Option_t *option);
41   void                   Terminate(Option_t *option);
42
43   Bool_t                 IsLocked()                       { if(fLocked) {AliFatal("Jet finder task is locked! Changing properties is not allowed."); return kTRUE;} else return kFALSE;};
44   void                   SetLocked()                      { fLocked = kTRUE;}
45   void                   SelectConstituents(UInt_t constSel, UInt_t MCconstSel)  { fConstSel = constSel; fMCConstSel = MCconstSel; };
46   void                   SetAlgo(Int_t a)                 { if(IsLocked()) return; if (a==0) fJetType |= kKT; else fJetType |= kAKT; }  // for backward compatibility only
47   void                   SetClusName(const char *n)       { if(IsLocked()) return; fCaloName      = n     ; }
48   void                   SetJetsName(const char *n)       { if(IsLocked()) return; fJetsName      = n     ; }
49   void                   SetJetsSubName(const char *n)    { fJetsSubName   = n     ; }
50   void                   SetJetType(UInt_t t)             { if(IsLocked()) return; fJetType       = t     ; }
51   void                   SetMarkConstituents(UInt_t m)    { if(IsLocked()) return; fMarkConst     = m     ; }
52   void                   SetMinJetArea(Double_t a)        { if(IsLocked()) return; fMinJetArea    = a     ; }
53   void                   SetMinJetClusPt(Double_t min)    { if(IsLocked()) return; fMinJetClusPt  = min   ; }
54   void                   SetMinJetPt(Double_t j)          { if(IsLocked()) return; fMinJetPt      = j     ; }
55   void                   SetMinJetTrackPt(Double_t min)   { if(IsLocked()) return; fMinJetTrackPt = min   ; }
56   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)."); }
57   void                   SetTrackEfficiency(Double_t t)   { if(IsLocked()) return; fTrackEfficiency = t   ; }
58   void                   SetTracksName(const char *n)     { if(IsLocked()) return; fTracksName    = n     ; }
59   void                   SetType(Int_t t)                 { if(IsLocked()) return; 
60                                                             if (t==0) fJetType |= kFullJet; 
61                                                             else if (t==1) fJetType |= kChargedJet; 
62                                                             else if (t==2) fJetType |= kNeutralJet; } // for backward compatibility only
63   void                   SetEtaRange(Double_t emi, Double_t ema) {if(IsLocked()) return; fEtaMin = emi; fEtaMax = ema; }
64   void                   SetPhiRange(Double_t pmi, Double_t pma) {if(IsLocked()) return; fPhiMin = pmi; fPhiMax = pma; }
65   void                   SetJetEtaRange(Double_t emi, Double_t ema) {if(IsLocked()) return; fJetEtaMin = emi; fJetEtaMax = ema; }
66   void                   SetJetPhiRange(Double_t pmi, Double_t pma) {if(IsLocked()) return; fJetPhiMin = pmi; fJetPhiMax = pma; }
67   void                   SetGhostArea(Double_t gharea)    { if(IsLocked()) return; fGhostArea      = gharea;  }
68   void                   SetMinMCLabel(Int_t s)           { if(IsLocked()) return; fMinMCLabel     = s     ;  }
69   void                   SetRecombScheme(Int_t scheme)    { if(IsLocked()) return; fRecombScheme   = scheme;  }
70   void                   SelectCollisionCandidates(UInt_t offlineTriggerMask = AliVEvent::kMB)
71   {
72     if(!fIsPSelSet)
73     {
74       fIsPSelSet = kTRUE;
75       fOfflineTriggerMask = offlineTriggerMask;
76     }
77     else
78     {
79       AliWarning("Manually setting the event selection for jet finders is not allowed! Using trigger=old_trigger | your_trigger");  
80       fOfflineTriggerMask = fOfflineTriggerMask | offlineTriggerMask;
81     }
82   }
83   void                   SetLegacyMode(Bool_t mode)       { if(IsLocked()) return; fLegacyMode = mode; }
84   void                   SetCodeDebug(Bool_t val)         { fCodeDebug = val; }
85
86   void                   SetRhoName(const char *n)              { fRhoName      = n            ; }
87   void                   SetRhomName(const char *n)             { fRhomName     = n            ; }
88   void                   SetGenericSubtraction(Bool_t b)        { fDoGenericSubtraction     = b; }
89   void                   SetConstituentSubtraction(Bool_t b)    { fDoConstituentSubtraction = b; }
90   void                   SetUseExternalBkg(Bool_t b, Double_t rho, Double_t rhom) { fUseExternalBkg = b; fRho = rho; fRhom = rhom;}
91
92   UInt_t                 GetJetType()                     { return fJetType; }
93   Bool_t                 GetLegacyMode()                  { return fLegacyMode; }
94   TString                GetJetsSubName()                 { return fJetsSubName; }
95
96   const char*            GetJetsName()                    { return fJetsName.Data(); }
97   Double_t               GetRadius()                      { return fRadius; }
98   const char*            GetTracksName()                  { return fTracksName.Data(); }
99   const char*            GetClusName()                    { return fCaloName.Data(); }
100   UInt_t                 GetMarkConstituents()            { return fMarkConst; }
101   Double_t               GetMinJetArea()                  { return fMinJetArea; }
102   Double_t               GetMinJetClusPt()                { return fMinJetClusPt; }
103   Double_t               GetMinJetPt()                    { return fMinJetPt; }
104   Double_t               GetMinJetTrackPt()               { return fMinJetTrackPt; }
105   Double_t               GetTrackEfficiency()             { return fTrackEfficiency; }
106   Double_t               GetGhostArea()                   { return fGhostArea; }
107   Int_t                  GetMinMCLabel()                  { return fMinMCLabel; }
108   Int_t                  GetRecombScheme()                { return fRecombScheme; }
109   Double_t               GetEtaMin()                      { return fEtaMin; }
110   Double_t               GetEtaMax()                      { return fEtaMax; }
111   Double_t               GetPhiMin()                      { return fPhiMin; }
112   Double_t               GetPhiMax()                      { return fPhiMax; }
113   Double_t               GetJetEtaMin()                   { return fJetEtaMin; }
114   Double_t               GetJetEtaMax()                   { return fJetEtaMax; }
115   Double_t               GetJetPhiMin()                   { return fJetPhiMin; }
116   Double_t               GetJetPhiMax()                   { return fJetPhiMax; }
117
118   AliVEvent*             GetEvent()                       { return fEvent;}
119   TClonesArray*          GetClusters()                    { return fClus;}
120   TClonesArray*          GetTracks()                      { return fTracks;}
121   TClonesArray*          GetJets()                        { return fJets;}
122
123  protected:
124   void                   FindJets();
125   Bool_t                 DoInit();
126   Bool_t                 GetSortedArray(Int_t indexes[], std::vector<fastjet::PseudoJet> array) const;
127
128   TString                fTracksName;             // name of track collection
129   TString                fCaloName;               // name of calo cluster collection
130   TString                fJetsName;               // name of jet collection
131   TString                fJetsSubName;            // name of subtracted jet collection
132   UInt_t                 fJetType;                // jet type (algorithm, radius, constituents)
133   UInt_t                 fConstSel;               // select constituents from a previous jet finding
134   UInt_t                 fMCConstSel;             // select MC constituents (label!=0) from a previous jet finding
135   UInt_t                 fMarkConst;              // constituents are marked (via TObject::SetBit) as belonging to the # leading jets
136   Double_t               fRadius;                 // jet radius
137   Double_t               fMinJetTrackPt;          // min jet track momentum   (applied before clustering)
138   Double_t               fMinJetClusPt;           // min jet cluster momentum (applied before clustering)
139   Double_t               fPhiMin;                 // minimum phi for constituents (applied before clustering)
140   Double_t               fPhiMax;                 // maximum phi for constituents (applied before clustering)
141   Double_t               fEtaMin;                 // minimum eta for constituents (applied before clustering)
142   Double_t               fEtaMax;                 // maximum eta for constituents (applied before clustering)
143   Double_t               fMinJetArea;             // min area to keep jet in output
144   Double_t               fMinJetPt;               // min jet pt to keep jet in output
145   Double_t               fJetPhiMin;              // minimum phi to keep jet in output
146   Double_t               fJetPhiMax;              // maximum phi to keep jet in output
147   Double_t               fJetEtaMin;              // minimum eta to keep jet in output
148   Double_t               fJetEtaMax;              // maximum eta to keep jet in output
149   Double_t               fGhostArea;              // ghost area
150   Int_t                  fMinMCLabel;             // minimum MC label value for the tracks/clusters being considered MC particles
151   Int_t                  fRecombScheme;           // recombination scheme used by fastjet
152   Double_t               fTrackEfficiency;        // artificial tracking inefficiency (0...1)
153   Bool_t                 fIsInit;                 //!=true if already initialized
154   Bool_t                 fLocked;                 // true if lock is set
155   Bool_t                 fIsPSelSet;              //!=true if physics selection was set
156   Bool_t                 fIsMcPart;               //!=true if MC particles are given as input
157   Bool_t                 fIsEmcPart;              //!=true if emcal particles are given as input (for clusters)
158   Bool_t                 fLegacyMode;             //! if true, enable FJ 2.x behavior
159   Bool_t                 fCodeDebug;              // use nontested code changes 
160
161   Bool_t                 fDoGenericSubtraction;   // calculate generic subtraction
162   Bool_t                 fDoConstituentSubtraction; // calculate constituent subtraction
163   Bool_t                 fUseExternalBkg;         // use external background for generic subtractor
164   TString                fRhoName;                // name of rho
165   TString                fRhomName;               // name of rhom
166   Double_t               fRho;                    // pT background density
167   Double_t               fRhom;                   // mT background density
168
169   TClonesArray          *fJets;                   //!jet collection
170   TClonesArray          *fJetsSub;                //!subtracted jet collection
171   AliVEvent             *fEvent;                  //!current event
172   TClonesArray          *fTracks;                 //!tracks collection
173   TClonesArray          *fClus;                   //!cluster collection
174   AliRhoParameter       *fRhoParam;               //!event rho
175   AliRhoParameter       *fRhomParam;              //!event rhom
176
177  private:
178   AliEmcalJetTask(const AliEmcalJetTask&);            // not implemented
179   AliEmcalJetTask &operator=(const AliEmcalJetTask&); // not implemented
180
181   ClassDef(AliEmcalJetTask, 13) // Jet producing task
182 };
183 #endif