]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskChargedJetsPA.h
1a1cecc1755939358f14c722861162633df33d13
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskChargedJetsPA.h
1 #ifndef ALIANALYSISTASKCHARGEDJETSPA_H
2 #define ALIANALYSISTASKCHARGEDJETSPA_H
3
4 //#define DEBUGMODE
5
6 class TH1F;
7 class TH2F;
8 class TList;
9 class TClonesArray;
10 class TString;
11 class AliEmcalJet;
12 class AliRhoParameter;
13 class AliVParticle;
14 class AliLog;
15 class AliAnalysisUtils;
16
17 class AliAnalysisTaskChargedJetsPA : public AliAnalysisTaskSE {
18  public:
19   // ######### CONTRUCTORS/DESTRUCTORS AND STD FUNCTIONS
20   AliAnalysisTaskChargedJetsPA(const char *name, const char* trackArrayName, const char* jetArrayName, const char* backgroundJetArrayName);
21   AliAnalysisTaskChargedJetsPA();
22   virtual ~AliAnalysisTaskChargedJetsPA();
23   virtual void     UserCreateOutputObjects();
24   virtual void     UserExec(Option_t *option);
25   virtual void     Terminate(Option_t *);
26
27   // ######### SETTERS/GETTERS
28   void        SetAnalyzeJets(Bool_t val) {fAnalyzeJets = val;}
29   void        SetAnalyzeBackground(Bool_t val) {fAnalyzeBackground = val;}
30   void        SetAnalyzePythia(Bool_t val) {fAnalyzePythia = val;}
31
32   void        SetTrackMinPt(Double_t minPt) {fMinJetPt = minPt;}
33   void        SetSignalJetMinPt(Double_t minPt) {fMinJetPt = minPt;}
34   void        SetSignalJetMinArea(Double_t minArea) {fMinJetArea = minArea;}
35   void        SetBackgroundJetMinPt(Double_t minPt) {fMinBackgroundJetPt = minPt;}
36   void        SetDijetLeadingMinPt(Double_t minPt) {fMinDijetLeadingPt = minPt;}
37   void        SetNumberOfPtHardBins(Int_t count) {fNumPtHardBins = count;}
38   void        SetNumberOfRandConesPerEvent(Int_t count) {fNumberRandCones = count;}
39   void        SetRandConeRadius(Double_t radius) {fRandConeRadius = radius;}
40   void        SetSignalJetRadius(Double_t radius) {fSignalJetRadius = radius;}
41   void        SetBackgroundJetRadius(Double_t radius) {fBackgroundJetRadius = radius;}
42   void        SetTRBackgroundConeRadius(Double_t radius) {fTRBackgroundConeRadius = radius;}
43   void        SetCentralityType(const char* type) {fCentralityType = type;}
44
45   void        SetDijetMaxAngleDeviation(Double_t degrees) {fDijetMaxAngleDeviation = degrees/360.0 * TMath::TwoPi();} // degrees are more comfortable
46   void        SetAcceptanceWindows(Double_t trackEta, Double_t vertexZ, Double_t vertexMaxR, Double_t signalJetRadius, Double_t bgrdJetRadius){fVertexWindow = vertexZ; fVertexMaxR = vertexMaxR; fTrackEtaWindow = trackEta; fSignalJetRadius = signalJetRadius; fBackgroundJetRadius = bgrdJetRadius; fSignalJetEtaWindow = fTrackEtaWindow-fSignalJetRadius; fBackgroundJetEtaWindow = fTrackEtaWindow-fBackgroundJetRadius;}
47   void        SetKTEtaCorrectionFactors(TH2D* histo);
48   void        SetRCEtaCorrectionFactors(TH2D* histo);
49   void        SetTREtaCorrectionFactors(TH2D* histo);
50   Int_t       GetInstanceCounter() {return fTaskInstanceCounter;}
51
52  private:
53   enum EtaCorrectionMode {kNoEtaCorrection, kKTEtaCorrection, kRCEtaCorrection, kTREtaCorrection};
54
55   // ######### MAIN CALCULATION FUNCTIONS
56   void        GetSignalJets();
57   Int_t       GetLeadingJets(TClonesArray* jetArray, Int_t* jetIDArray, Bool_t isSignalJets);
58   Double_t    GetBackgroundEtaCorrFactor(EtaCorrectionMode mode, Double_t eta, Double_t background);
59   Double_t    GetBackgroundEtaBinCorrFactor(EtaCorrectionMode mode, Int_t eta, Double_t background);
60   Double_t    GetCorrectedJetPt(AliEmcalJet* jet, Double_t background, EtaCorrectionMode mode);
61   void        GetDeltaPt(Double_t& deltaPt, Double_t rho, EtaCorrectionMode mode, Bool_t leadingJetExclusion = kTRUE);
62
63   void        GetKTBackgroundDensity(Int_t numberExcludeLeadingJets, Double_t& rhoMedian, Double_t& areaMean, Double_t etaMin = 0, Double_t etaMax = 0);
64   Int_t       GetRCBackgroundDensity(Int_t numberExcludeLeadingJets, Double_t& rhoMean, Double_t& rhoMedian, Double_t etaMin = 0, Double_t etaMax = 0, Int_t numberRandCones = 0);
65   void        GetTRBackgroundDensity(Int_t numberExcludeLeadingJets, Double_t& rhoMean, Double_t& area, Double_t etaMin = 0, Double_t etaMax = 0);
66   void        GetTRBackgroundDensity(Int_t numberExcludeLeadingJets, Double_t& rhoMean, Double_t& area, AliEmcalJet* excludeJet1, AliEmcalJet* excludeJet2, Bool_t doSearchPerpendicular);
67   Double_t    GetConePt(Double_t eta, Double_t phi, Double_t radius);
68   Double_t    GetPtHard();
69   Int_t       GetPtHardBin();
70   void        GetPerpendicularCone(Double_t vecPhi, Double_t vecTheta, Double_t& conePt);
71
72   // ######### CHECK FUNCTIONS
73   Bool_t      IsTrackInAcceptance(AliVParticle* track);
74   Bool_t      IsTrackInCone(AliVTrack* track, Double_t eta, Double_t phi, Double_t radius);
75
76   Bool_t      IsBackgroundJetInAcceptance(AliEmcalJet* jet);
77   Bool_t      IsSignalJetInAcceptance(AliEmcalJet* jet);
78   Bool_t      IsDijet(AliEmcalJet* jet1, AliEmcalJet* jet2);
79   
80   // ######### HELPER FUNCTIONS
81   Double_t    EtaToTheta(Double_t arg);
82   Double_t    ThetaToEta(Double_t arg);
83   Double_t    GetDeltaPhi(Double_t phi1, Double_t phi2);
84   Double_t    MCGetOverlapCircleRectancle(Double_t cPosX, Double_t cPosY, Double_t cRadius, Double_t rPosXmin, Double_t rPosXmax, Double_t rPosYmin, Double_t rPosYmax);
85
86   // ######### HISTOGRAM FUNCTIONS
87   void        FillHistogram(const char * key, Double_t x);
88   void        FillHistogram(const char * key, Double_t x, Double_t y);
89   void        FillHistogram(const char * key, Double_t x, Double_t y, Double_t add);
90   const char* GetHistoName(const char* name)
91   {
92     if (fIsMC)    
93       return Form("H%d_%s_MC", fTaskInstanceCounter, name);
94     return Form("H%d_%s", fTaskInstanceCounter, name);
95   }
96   template <class T> T* AddHistogram1D(const char* name = "CustomHistogram", const char* title = "NO_TITLE", const char* options = "", Int_t xBins = 100, Double_t xMin = 0.0, Double_t xMax = 20.0, const char* xTitle = "x axis", const char* yTitle = "y axis");
97   template <class T> T* AddHistogram2D(const char* name = "CustomHistogram", const char* title = "NO_TITLE", const char* options = "", Int_t xBins = 100, Double_t xMin = 0.0, Double_t xMax = 20.0, Int_t yBins = 100, Double_t yMin = 0.0, Double_t yMax = 20.0, const char* xTitle = "x axis", const char* yTitle = "y axis", const char* zTitle = "z axis");
98
99   // ######### STANDARD FUNCTIONS
100   Bool_t    Notify();
101   void      Calculate(AliVEvent* event);
102   void      ExecOnce();
103   void      Init ();
104
105   TList*              fOutputList;            //! Output list
106   // ########## USAGE TRIGGERS 
107   Bool_t              fAnalyzeJets;           // trigger if jets should be processed
108   Bool_t              fAnalyzeBackground;     // trigger if background should be processed
109   Bool_t              fAnalyzePythia;         // trigger if pythia properties should be processed
110   Bool_t              fHasTracks;             // trigger if tracks are actually valid
111   Bool_t              fHasJets;               // trigger if jets are actually valid
112   Bool_t              fHasBackgroundJets;     // trigger if background is actually valid
113   Bool_t              fIsMC;                  // trigger if data is MC (for naming reasons)
114
115   // ########## SOURCE INFORMATION
116   TClonesArray*       fJetArray;              //! object containing the jets
117   TClonesArray*       fTrackArray;            //! object containing the tracks
118   TClonesArray*       fBackgroundJetArray;    //! object containing background jets
119   TString*            fJetArrayName;          // name of object containing the jets
120   TString*            fTrackArrayName;        // name of object containing the tracks
121   TString*            fBackgroundJetArrayName;// name of object containing event wise bckgrds
122   Int_t               fNumPtHardBins;         // Number of used pt hard bins
123
124   // ########## JET/DIJET/RC PROPERTIES
125   Double_t            fRandConeRadius;        // Radius for the random cones
126   Double_t            fSignalJetRadius;       // Radius for the signal jets
127   Double_t            fBackgroundJetRadius;   // Radius for the KT background jets
128   Double_t            fTRBackgroundConeRadius;// Radius for the jets excluded in track background
129   Int_t               fNumberRandCones;       // Number of random cones to be put into one event
130   Int_t               fNumberExcludedJets;    // Number of jets to be excluded from backgrounds
131   Double_t            fDijetMaxAngleDeviation;// Max angle deviation from pi between two jets to be accept. as dijet
132   TH2D*               fJetKTEtaCorrection;    // Correction factors in bins of rho and eta to correct the eta dependence of the jet background
133   TH2D*               fJetRCEtaCorrection;    // Correction factors in bins of rho and eta to correct the eta dependence of the jet background
134   TH2D*               fJetTREtaCorrection;    // Correction factors in bins of rho and eta to correct the eta dependence of the jet background
135
136   // ########## CUTS 
137   Double_t            fSignalJetEtaWindow;    // +- window in eta for signal jets
138   Double_t            fBackgroundJetEtaWindow;// +- window in eta for background jets
139   Double_t            fTrackEtaWindow;        // +- window in eta for tracks
140   Double_t            fVertexWindow;          // +- window in Z for the vertex
141   Double_t            fVertexMaxR;            // +- window in R for the vertex (distance in xy-plane)
142   Double_t            fMinTrackPt;            // Min track pt to be accepted
143   Double_t            fMinJetPt;              // Min jet pt to be accepted
144   Double_t            fMinJetArea;            // Min jet area to be accepted
145   Double_t            fMinBackgroundJetPt;    // Min jet pt to be accepted as background jet
146   Double_t            fMinDijetLeadingPt;     // Min jet pt to be accepted as constituent of dijet 
147   TString             fCentralityType;        // Used centrality estimate (V0A, V0C, V0M, ...)
148
149   // ########## EVENT PROPERTIES
150   AliEmcalJet*        fFirstLeadingJet;       //! leading jet in event
151   AliEmcalJet*        fSecondLeadingJet;      //! next to leading jet in event
152   Int_t               fNumberSignalJets;      //! Number of signal jets in event
153   AliEmcalJet*        fSignalJets[1024];      //! memory for signal jet pointers
154   Double_t            fCrossSection;          //! value is filled, if pythia header is accessible
155   Double_t            fTrials;                //! value is filled, if pythia header is accessible
156
157   // ########## GENERAL VARS
158   TRandom3*           fRandom;                //! A random number
159   AliAnalysisUtils*   fHelperClass;           //! Vertex selection helper
160   Bool_t              fInitialized;           //! trigger if tracks/jets are loaded
161   Int_t               fTaskInstanceCounter;   // for naming reasons
162   TList*              fHistList;              // Histogram list
163   Int_t               fHistCount;             // Histogram count
164
165   AliAnalysisTaskChargedJetsPA(const AliAnalysisTaskChargedJetsPA&);
166   AliAnalysisTaskChargedJetsPA& operator=(const AliAnalysisTaskChargedJetsPA&);
167
168   ClassDef(AliAnalysisTaskChargedJetsPA, 2); // Charged jet analysis for pA
169
170 };
171 #endif