]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.h
from redmer
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskRhoVnModulation.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
2 /* See cxx source for full Copyright notice */
3 /* $Id$ */
4
5 #ifndef ALIANALYSISTASKRHOVNMODULATION_H
6 #define ALIANALYSISTASKRHOVNMODULATION_H
7
8 #include <AliAnalysisTaskEmcalJet.h>
9 #include <AliEmcalJet.h>
10 #include <AliVEvent.h>
11 #include <AliVTrack.h>
12 #include <AliVCluster.h>
13 #include <TClonesArray.h>
14 #include <TMath.h>
15 #include <TRandom3.h>
16
17 class TF1;
18 class THF1;
19 class THF2;
20 class TProfile;
21
22 class AliAnalysisTaskRhoVnModulation : public AliAnalysisTaskEmcalJet
23 {
24     public:
25          // enumerators
26         enum fitModulationType  { kNoFit, kV2, kV3, kCombined, kUser, kFourierSeries }; // fit type
27         enum runModeType        { kLocal, kGrid };                      // run mode type
28         enum dataType           { kESD, kAOD, kESDMC, kAODMC };         // data type
29         enum detectorType       { kTPC, kTPCSUB, kVZEROA, kVZEROC };    // detector that was used
30         // constructors, destructor
31                                 AliAnalysisTaskRhoVnModulation();
32                                 AliAnalysisTaskRhoVnModulation(const char *name, runModeType type);
33         virtual                 ~AliAnalysisTaskRhoVnModulation();
34        
35         // setting up the task and technical aspects
36         Bool_t                  InitializeAnalysis();
37         virtual void            UserCreateOutputObjects();
38         virtual Bool_t          Run();
39         TH1F*                   BookTH1F(const char* name, const char* x, Int_t bins, Double_t min, Double_t max, Int_t c = -1, Bool_t append = kTRUE);
40         TH2F*                   BookTH2F(const char* name, const char* x, const char* y, Int_t binsx, Double_t minx, Double_t maxx, Int_t binsy, Double_t miny, Double_t maxy, Int_t c = -1, Bool_t append = kTRUE);
41         /* inline */    Double_t PhaseShift(Double_t x) const {  
42             while (x>=TMath::TwoPi())x-=TMath::TwoPi();
43             while (x<0.)x+=TMath::TwoPi();
44             return x; }
45         /* inline */    Double_t ChiSquarePDF(Int_t ndf, Double_t x) const {
46             Double_t n(ndf/2.), denom(TMath::Power(2, n)*TMath::Gamma(n));
47             if (denom!=0)  return ((1./denom)*TMath::Power(x, n-1)*TMath::Exp(-x/2.)); 
48             return -999; }
49         // note that the cdf of the chisquare distribution is the normalized lower incomplete gamma function
50         /* inline */    Double_t ChiSquareCDF(Int_t ndf, Double_t x) const { return TMath::Gamma(ndf/2., x/2.); }
51         /* inline */    Double_t RhoVal() const { return (fRho) ? fRho->GetVal(): -999.;}                 
52         /* inline */    Double_t RhoVal(Double_t phi, Double_t r, Double_t n) const {
53             if(!fFitModulation) return RhoVal(); // coverity
54             switch (fFitModulationType) {
55                 case kNoFit : return RhoVal();
56                 default : {
57                     Double_t denom(2*r*fFitModulation->GetParameter(0));
58                     return  (denom <= 0.) ? RhoVal() : n*(fFitModulation->Integral(phi-r, phi+r)/denom); 
59                 }
60             }
61         }
62         // setters - analysis setup
63         void                    SetDebugMode(Int_t d)                           {fDebug = d;}
64         void                    SetFillQAHistograms(Bool_t qa)                  {fFillQAHistograms = qa;}
65         void                    SetCentralityClasses(TArrayI* c)                {fCentralityClasses = c;}
66         void                    SetNameJetClones(const char* name)              {fNameJetClones = name; }
67         void                    SetNamePicoTrackClones(const char* name)        {fNamePicoTrackClones = name; }
68         void                    SetNameRho(const char* name)                    {fNameRho = name; }
69         void                    SetRandomSeed(TRandom3* r)                      {if (fRandom) delete fRandom; fRandom = r; }
70         void                    SetModulationFit(TF1* fit)                      {if (fFitModulation) delete fFitModulation;
71                                                                                  fFitModulation = fit; }
72         void                    SetModulationFitMinMaxP(Float_t m, Float_t n)   {fMinPvalue = m; fMaxPvalue = n; }
73         void                    SetModulationFitType(fitModulationType type)    {fFitModulationType = type; }
74         void                    SetModulationFitOptions(TString opt)            {fFitModulationOptions = opt; }
75         void                    SetReferenceDetector(detectorType type)         {fDetectorType = type; }
76         void                    SetUsePtWeight(Bool_t w)                        {fUsePtWeight = w; }
77         void                    SetRunModeType(runModeType type)                {fRunModeType = type; }
78         void                    SetAbsVertexZ(Float_t v)                        {fAbsVertexZ = v; }
79         void                    SetMinDistanceRctoLJ(Float_t m)                 {fMinDisanceRCtoLJ = m; }
80         void                    SetRandomConeRadius(Float_t r)                  {fRandomConeRadius = r; }
81         void                    SetForceAbsVnHarmonics(Bool_t f)                {fAbsVnHarmonics = f; }
82         void                    SetExcludeLeadingJetsFromFit(Float_t n)         {fExcludeLeadingJetsFromFit = n; }
83         void                    SetRebinSwapHistoOnTheFly(Bool_t r)             {fRebinSwapHistoOnTheFly = r; }
84         void                    SetSaveThisPercentageOfFits(Float_t p)          {fPercentageOfFits = p; }
85         // 'trivial' helper calculations
86         void                    CalculateEventPlaneVZERO(Double_t vzero[2][2]) const;
87         void                    CalculateEventPlaneTPC(Double_t* tpc);
88         void                    CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t* tpc) const;
89         void                    CalculateRandomCone(Float_t &pt, Float_t &eta, Float_t &phi, AliEmcalJet* jet = 0x0, Bool_t randomize = 0) const;
90         // analysis details
91         Bool_t                  CorrectRho(Double_t* params, Double_t psi2, Double_t psi3, Double_t psi2b, Double_t psi3b);
92         // event and track selection
93         /* inline */    Bool_t PassesCuts(const AliVTrack* track) const {
94             if(!track) return kFALSE;
95             return (track->Pt() < fTrackPtCut || track->Eta() < fTrackMinEta || track->Eta() > fTrackMaxEta || track->Phi() < fTrackMinPhi || track->Phi() > fTrackMaxPhi) ? kFALSE : kTRUE; }
96         /* inline */    Bool_t PassesCuts(const AliEmcalJet* jet) const {
97             if(!jet || fJetRadius <= 0) return kFALSE;
98             return (jet->Pt() < fJetPtCut || jet->Area()/(fJetRadius*fJetRadius*TMath::Pi()) < fPercAreaCut || jet->Eta() < fJetMinEta || jet->Eta() > fJetMaxEta || jet->Phi() < fJetMinPhi || jet->Phi() > fJetMaxPhi) ? kFALSE : kTRUE; }
99         Bool_t                  PassesCuts(AliVEvent* event);
100         Bool_t                  PassesCuts(const AliVCluster* track) const;
101         // filling histograms
102         void                    FillHistogramsAfterSubtraction(Double_t vzero[2][2], Double_t* tpc) const;
103         void                    FillTrackHistograms() const;
104         void                    FillClusterHistograms() const;
105         void                    FillCorrectedClusterHistograms() const;
106         void                    FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* tpc) const;
107         void                    FillRhoHistograms() const;
108         void                    FillDeltaPtHistograms(Double_t psi2, Double_t psi3) const; 
109         void                    FillJetHistograms(Double_t vzero[2][2], Double_t* psi) const;
110         void                    FillDeltaPhiHistograms(Double_t vzero[2][2], Double_t* tpc) const;
111         void                    FillQAHistograms(AliVTrack* vtrack) const;
112         void                    FillQAHistograms(AliVEvent* vevent);
113         virtual void            Terminate(Option_t* option);
114     private:
115         // analysis flags and settings
116         Int_t                   fDebug;                 // debug level (0 none, 1 fcn calls, 2 verbose)
117         Bool_t                  fInitialized;           //! is the analysis initialized?
118         Bool_t                  fFillQAHistograms;      // fill qa histograms
119         TArrayI*                fCentralityClasses;     //-> centrality classes (maximum 10)
120         // members
121         Int_t                   fNAcceptedTracks;       //! number of accepted tracks
122         fitModulationType       fFitModulationType;     // fit modulation type
123         Bool_t                  fUsePtWeight;           // use dptdphi instead of dndphi
124         detectorType            fDetectorType;          // type of detector used for modulation fit
125         TString                 fFitModulationOptions;  // fit options for modulation fit
126         runModeType             fRunModeType;           // run mode type 
127         dataType                fDataType;              // datatype 
128         TRandom3*               fRandom;                //-> dont use gRandom to not interfere with other tasks
129         Int_t                   fMappedRunNumber;       //! mapped runnumer (for QA)
130         Int_t                   fInCentralitySelection; //! centrality bin
131         TF1*                    fFitModulation;         //-> modulation fit for rho
132         Float_t                 fMinPvalue;             // minimum value of p
133         Float_t                 fMaxPvalue;             // maximum value of p
134         const char*             fNameJetClones;         //! collection of tclones array with jets
135         const char*             fNamePicoTrackClones;   //! collection of tclones with pico tracks
136         const char*             fNameRho;               //! name of rho
137         // event cuts
138         Float_t                 fAbsVertexZ;            // cut on zvertex
139         // general qa histograms
140         TH1F*                   fHistCentrality;        //! accepted centrality
141         TH1F*                   fHistVertexz;           //! accepted verte
142         TH2F*                   fHistRunnumbersPhi;     //! run numbers averaged phi
143         TH2F*                   fHistRunnumbersEta;     //! run numbers averaged eta
144         TH1F*                   fHistPvaluePDF;         //! pdf value of chisquare p
145         TH1F*                   fHistPvalueCDF;         //! cdf value of chisquare p
146         // general settings
147         Float_t                 fMinDisanceRCtoLJ;      // min distance between rc and leading jet
148         Float_t                 fRandomConeRadius;      // radius of random cone
149         Bool_t                  fAbsVnHarmonics;        // force postive local rho
150         Float_t                 fExcludeLeadingJetsFromFit;    // exclude n leading jets from fit
151         Bool_t                  fRebinSwapHistoOnTheFly;       // rebin swap histo on the fly
152         Float_t                 fPercentageOfFits;      // save this percentage of fits
153         // transient object pointers
154         TList*                  fOutputList;            //! output list
155         TList*                  fOutputListGood;        //! output list for local analysis
156         TList*                  fOutputListBad;         //! output list for local analysis
157         TH1F*                   fHistAnalysisSummary;   //! analysis summary
158         TH1F*                   fHistSwap;              //! swap histogram
159         TProfile*               fProfV2;                //! extracted v2
160         TProfile*               fProfV2Resolution[10];  //! resolution parameters for v2
161         TProfile*               fProfV3;                //! extracted v3
162         TProfile*               fProfV3Resolution[10];  //! resolution parameters for v3
163         // qa histograms for accepted pico tracks
164         TH1F*                   fHistPicoTrackPt[10];    //! pt of all charged tracks
165         TH2F*                   fHistPicoCat1[10];       //! pico tracks spd hit and refit
166         TH2F*                   fHistPicoCat2[10];       //! pico tracks wo spd hit w refit, constrained
167         TH2F*                   fHistPicoCat3[10];       //! pico tracks wo spd hit wo refit, constrained
168         // qa histograms for accepted emcal clusters
169         /* TH1F*                   fHistClusterPt[10];      //! pt uncorrected emcal clusters */
170         /* TH1F*                   fHistClusterPhi[10];     //! phi uncorrected emcal clusters */
171         /* TH1F*                   fHistClusterEta[10];     //! eta uncorrected emcal clusters */
172         // qa histograms for accepted emcal clusters aftehadronic correction
173         /* TH1F*                   fHistClusterCorrPt[10];  //! pt corrected emcal clusters */
174         /* TH1F*                   fHistClusterCorrPhi[10]; //! phi corrected emcal clusters */
175         /* TH1F*                   fHistClusterCorrEta[10]; //! eta corrected emcal clusters */
176         // qa event planes
177         TProfile*               fHistPsiControl;         //! event plane control histogram
178         TProfile*               fHistPsiSpread;          //! event plane spread histogram
179         TH1F*                   fHistPsiVZEROA;          //! psi 2 from vzero a
180         TH1F*                   fHistPsiVZEROC;          //! psi 2 from vzero c
181         TH1F*                   fHistPsiTPC;             //! psi 2 from tpc
182         TH1F*                   fHistPsiTPCSUBA;         //! psi 2 from tpc subevent a
183         TH1F*                   fHistPsiTPCSUBB;         //! psi 2 from tpc subevent b        
184         // background
185         TH1F*                   fHistRhoPackage[10];     //! rho as estimated by emcal jet package
186         TH1F*                   fHistRho[10];            //! background
187         TH2F*                   fHistRhoVsMult;          //! rho versus multiplicity
188         TH2F*                   fHistRhoVsCent;          //! rho veruss centrality
189         TH2F*                   fHistRhoAVsMult;         //! rho * A vs multiplicity for all jets
190         TH2F*                   fHistRhoAVsCent;         //! rho * A vs centrality for all jets
191         // delta pt distributions
192         TH2F*                   fHistRCPhiEta[10];              //! random cone eta and phi
193         TH2F*                   fHistRhoVsRCPt[10];             //! rho * A vs rcpt
194         TH1F*                   fHistRCPt[10];                  //! rcpt
195         TH2F*                   fHistDeltaPtDeltaPhi2[10];      //! dpt vs dphi
196         TH2F*                   fHistDeltaPtDeltaPhi3[10];
197         TH2F*                   fHistRCPhiEtaExLJ[10];          //! random cone eta and phi, excl leading jet
198         TH2F*                   fHistRhoVsRCPtExLJ[10];         //! rho * A vs rcpt, excl leading jet
199         TH1F*                   fHistRCPtExLJ[10];              //! rcpt, excl leading jet
200         TH2F*                   fHistDeltaPtDeltaPhi2ExLJ[10];  //! dpt vs dphi, excl leading jet
201         TH2F*                   fHistDeltaPtDeltaPhi3ExLJ[10];  //! dpt vs dphi, excl leading jet
202         TH2F*                   fHistRCPhiEtaRand[10];          //! random cone eta and phi, randomized
203         TH2F*                   fHistRhoVsRCPtRand[10];         //! rho * A vs rcpt, randomized
204         TH1F*                   fHistRCPtRand[10];              //! rcpt, randomized
205         TH2F*                   fHistDeltaPtDeltaPhi2Rand[10];  //! dpt vs dphi, randomized
206         TH2F*                   fHistDeltaPtDeltaPhi3Rand[10];  //! dpt vs dphi, randomized
207         // jet histograms (after kinematic cuts)
208         TH1F*                   fHistJetPtRaw[10];              //! jet pt - no background subtraction
209         TH1F*                   fHistJetPt[10];                 //! pt of found jets (background subtracted)
210         TH2F*                   fHistJetEtaPhi[10];             //! eta and phi correlation
211         TH2F*                   fHistJetPtArea[10];             //! jet pt versus area
212         TH2F*                   fHistJetPtConstituents[10];     //! jet pt versus number of constituents
213         TH2F*                   fHistJetEtaRho[10];             //! jet eta versus jet rho
214         // in plane, out of plane jet spectra
215         TH2F*                   fHistJetPsiTPCPt[10];            //! psi tpc versus pt
216         TH2F*                   fHistJetPsiVZEROAPt[10];         //! psi vzeroa versus pt
217         TH2F*                   fHistJetPsiVZEROCPt[10];         //! psi vzeroc versus pt
218         // phi minus psi 
219         TH1F*                   fHistDeltaPhi2VZEROA[10];       //! phi minus psi_A
220         TH1F*                   fHistDeltaPhi2VZEROC[10];       //! phi minus psi_C
221         TH1F*                   fHistDeltaPhi2TPC[10];          //! phi minus psi_TPC
222         TH1F*                   fHistDeltaPhi3VZEROA[10];       //! phi minus psi_A
223         TH1F*                   fHistDeltaPhi3VZEROC[10];       //! phi minus psi_C
224         TH1F*                   fHistDeltaPhi3TPC[10];          //! phi minus psi_TPC
225
226         AliAnalysisTaskRhoVnModulation(const AliAnalysisTaskRhoVnModulation&);                  // not implemented
227         AliAnalysisTaskRhoVnModulation& operator=(const AliAnalysisTaskRhoVnModulation&);       // not implemented
228
229         ClassDef(AliAnalysisTaskRhoVnModulation, 5);
230 };
231
232 #endif