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