]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/Correlations/DPhi/AliAnalysisTaskPhiCorrelations.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGCF / Correlations / DPhi / AliAnalysisTaskPhiCorrelations.h
1 #ifndef AliAnalysisTaskPhiCorrelations_H
2 #define AliAnalysisTaskPhiCorrelations_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 ////////////////////////////////////////////////////////////////////////
8 //
9 // Analysis class for Underlying Event studies w.r.t. leading track
10 //
11 // Look for correlations on the tranverse regions w.r.t
12 // the leading track in the event
13 //
14 // This class needs input AODs.
15 // The output is a list of analysis-specific containers.
16 //
17 // The AOD can be either connected to the InputEventHandler  
18 // for a chain of AOD files 
19 // or 
20 // to the OutputEventHandler
21 // for a chain of ESD files,
22 // in this case the class should be in the train after the jet-finder
23 //
24 //    Authors:
25 //    Jan Fiete Grosse-Oetringhaus
26 // 
27 ////////////////////////////////////////////////////////////////////////
28
29 #include "AliAnalysisTask.h"
30 #include "AliUEHist.h"
31 #include "TString.h"
32 #include "AliVParticle.h"
33 #include "AliLog.h"
34 #include "THn.h" // in cxx file causes .../THn.h:257: error: conflicting declaration ‘typedef class THnT<float> THnF’
35
36 class AliAODEvent;
37 class AliAnalyseLeadingTrackUE;
38 class AliInputEventHandler;
39 class AliMCEvent;
40 class AliMCEventHandler;
41 class AliUEHistograms;
42 class AliVParticle;
43 class TH1;
44 class TObjArray;
45 class AliEventPoolManager;
46 class AliESDEvent;
47 class AliHelperPID;
48 class AliAnalysisUtils;
49 class TFormula;
50 class TMap;
51 class AliGenEventHeader;
52
53
54 class  AliAnalysisTaskPhiCorrelations : public AliAnalysisTask
55   {
56   public:
57     AliAnalysisTaskPhiCorrelations(const char* name="AliAnalysisTaskPhiCorrelations");
58     virtual           ~AliAnalysisTaskPhiCorrelations();
59        
60       
61     // Implementation of interace methods
62     virtual     void   ConnectInputData(Option_t *);
63     virtual     void   CreateOutputObjects();
64     virtual     void   Exec(Option_t *option);
65
66     // Setters/Getters
67     // general configuration
68     virtual     void    SetDebugLevel( Int_t level )  { fDebug = level; }
69     virtual     void    SetMode(Int_t mode)           { fMode  = mode;  }
70     virtual     void    SetReduceMemoryFootprint(Bool_t flag) { fReduceMemoryFootprint = flag; }
71     virtual     void    SetEventMixing(Bool_t flag) { fFillMixed = flag; }
72     virtual     void    SetMixingTracks(Int_t tracks) { fMixingTracks = tracks; }
73     virtual     void    SetTwoTrackEfficiencyStudy(Bool_t flag) { fTwoTrackEfficiencyStudy = flag; }
74     virtual     void    SetTwoTrackEfficiencyCut(Float_t value = 0.02, Float_t min = 0.8) { fTwoTrackEfficiencyCut = value; fTwoTrackCutMinRadius = min; }
75     virtual     void    SetUseVtxAxis(Int_t flag) { fUseVtxAxis = flag; }
76     virtual     void    SetCourseCentralityBinning(Bool_t flag) { fCourseCentralityBinning = flag; }
77     virtual     void    SetSkipTrigger(Bool_t flag) { fSkipTrigger = flag; }
78     virtual     void    SetInjectedSignals(Bool_t flag) { fInjectedSignals = flag; }
79     void SetRandomizeReactionPlane(Bool_t flag) { fRandomizeReactionPlane = flag; }
80     
81     // histogram settings
82     void SetEfficiencyCorrectionTriggers(THnF* hist) { fEfficiencyCorrectionTriggers = hist; }
83     void SetEfficiencyCorrectionAssociated(THnF* hist) { fEfficiencyCorrectionAssociated = hist; }
84     void SetCentralityWeights(TH1* hist) { fCentralityWeights = hist; }
85
86     // for event QA
87     void   SetTracksInVertex( Int_t val ){ fnTracksVertex = val; }
88     void   SetZVertex( Double_t val )    { fZVertex = val; }
89     
90     // track cuts
91     void   SetTrackEtaCut( Double_t val )    { fTrackEtaCut = val; }
92     void   SetTrackEtaCutMin( Double_t val )    { fTrackEtaCutMin = val; }
93     void   SetOnlyOneEtaSide(Int_t flag)     { fOnlyOneEtaSide = flag; }
94     void   SetPtMin(Double_t val)            { fPtMin = val; }
95     void   SetFilterBit( UInt_t val )        { fFilterBit = val;  }
96     void   SetDCAXYCut(TFormula* value)      { fDCAXYCut = value; }
97     void   SetSharedClusterCut(Float_t value) { fSharedClusterCut = value; }
98     void   SetTrackStatus(UInt_t status)     { fTrackStatus = status; }
99     void   SetCheckMotherPDG(Bool_t checkpdg) { fCheckMotherPDG = checkpdg; }
100     
101     void   SetEventSelectionBit( UInt_t val )        { fSelectBit = val;  }
102     void   SetUseChargeHadrons( Bool_t val ) { fUseChargeHadrons = val; }
103     void   SetSelectParticleSpecies( Int_t trigger, Int_t associated ) { fParticleSpeciesTrigger = trigger; fParticleSpeciesAssociated = associated; }
104     void   SetSelectCharge(Int_t selectCharge) { fSelectCharge = selectCharge; }
105     void   SetSelectTriggerCharge(Int_t selectCharge) { fTriggerSelectCharge = selectCharge; }
106     void   SetSelectAssociatedCharge(Int_t selectCharge) { fAssociatedSelectCharge = selectCharge; }
107     void   SetTriggerRestrictEta(Float_t eta) { fTriggerRestrictEta = eta; }
108     void   SetEtaOrdering(Bool_t flag) { fEtaOrdering = flag; }
109     void   SetPairCuts(Bool_t conversions, Bool_t resonances) { fCutConversions = conversions; fCutResonances = resonances; }
110     void   SetRejectResonanceDaughters(Int_t value) { fRejectResonanceDaughters = value; }
111     void   SetCentralityMethod(const char* method) { fCentralityMethod = method; }
112     void   SetFillpT(Bool_t flag) { fFillpT = flag; }
113     void   SetStepsFillSkip(Bool_t step0, Bool_t step6) { fFillOnlyStep0 = step0; fSkipStep6 = step6; }
114     void   SetRejectCentralityOutliers(Bool_t flag = kTRUE) { fRejectCentralityOutliers = flag; }
115     void   SetRejectZeroTrackEvents(Bool_t flag)    { fRejectZeroTrackEvents = flag; }
116     void   SetRemoveWeakDecays(Bool_t flag = kTRUE) { fRemoveWeakDecays = flag; }
117     void   SetRemoveDuplicates(Bool_t flag = kTRUE) { fRemoveDuplicates = flag; }
118     void   SetSkipFastCluster(Bool_t flag = kTRUE)  { fSkipFastCluster = flag; }
119     void   SetWeightPerEvent(Bool_t flag = kTRUE)   { fWeightPerEvent = flag; }
120     void   SetCustomBinning(const char* binningStr) { fCustomBinning = binningStr; }
121     void   SetPtOrder(Bool_t flag) { fPtOrder = flag; }
122     void   SetTriggersFromDetector(Int_t flag) { fTriggersFromDetector = flag; }
123     void   SetMCUseUncheckedCentrality(Bool_t flag) { fMCUseUncheckedCentrality = flag; }
124     
125     AliHelperPID* GetHelperPID() { return fHelperPID; }
126     void   SetHelperPID(AliHelperPID* pid){ fHelperPID = pid; }
127    
128     AliAnalysisUtils* GetAnalysisUtils() { return fAnalysisUtils; }
129     void   SetAnalysisUtils(AliAnalysisUtils* utils){ fAnalysisUtils = utils; }
130    
131     TMap* GetMap() { return fMap; }
132     void   SetMap(TMap* map){ fMap = map; }
133     
134   private:
135     AliAnalysisTaskPhiCorrelations(const  AliAnalysisTaskPhiCorrelations &det);
136     AliAnalysisTaskPhiCorrelations&   operator=(const  AliAnalysisTaskPhiCorrelations &det);
137     void            AddSettingsTree();                                  // add list of settings to output list
138     // Analysis methods
139     void            AnalyseCorrectionMode();                            // main algorithm to get correction maps
140     void            AnalyseDataMode();                                  // main algorithm to get raw distributions
141     void            Initialize();                                       // initialize some common pointer
142     TObjArray* CloneAndReduceTrackList(TObjArray* tracks);
143     void RemoveDuplicates(TObjArray* tracks);
144     void CleanUp(TObjArray* tracks, TObject* mcObj, Int_t maxLabel);
145     void SelectCharge(TObjArray* tracks);
146     AliGenEventHeader* GetFirstHeader();
147     Bool_t AcceptEventCentralityWeight(Double_t centrality);
148     void ShiftTracks(TObjArray* tracks, Double_t angle);
149
150     // General configuration
151     Int_t               fDebug;           //  Debug flag
152     Int_t               fMode;            //  fMode = 0: data-like analysis 
153                                           //  fMode = 1: corrections analysis   
154     Bool_t              fReduceMemoryFootprint; // reduce memory consumption by writing less debug histograms
155     Bool_t              fFillMixed;             // enable event mixing (default: ON)
156     Int_t               fMixingTracks;          // size of track buffer for event mixing
157     Bool_t              fTwoTrackEfficiencyStudy; // two-track efficiency study on
158     Float_t             fTwoTrackEfficiencyCut;   // enable two-track efficiency cut
159     Float_t             fTwoTrackCutMinRadius;    // minimum radius for two-track efficiency cut
160     Int_t               fUseVtxAxis;              // use z vtx as axis (needs 7-10 times more memory!)
161     Bool_t              fCourseCentralityBinning; // less centrality bins
162     Bool_t              fSkipTrigger;             // skip trigger selection
163     Bool_t              fInjectedSignals;         // check header to skip injected signals in MC
164     Bool_t              fRandomizeReactionPlane;  // change the orientation of the RP by a random value by shifting all tracks
165     
166     AliHelperPID*     fHelperPID;      // points to class for PID
167     AliAnalysisUtils*     fAnalysisUtils;      // points to class with common analysis utilities
168     TMap*     fMap;                   // points to TMap class containing scaling factors for VZERO A signal
169  
170    // Pointers to external UE classes
171     AliAnalyseLeadingTrackUE*     fAnalyseUE;      //! points to class containing common analysis algorithms
172     AliUEHistograms*  fHistos;       //! points to class to handle histograms/containers  
173     AliUEHistograms*  fHistosMixed;       //! points to class to handle mixed histograms/containers  
174     
175     THnF* fEfficiencyCorrectionTriggers;     // if non-0 this efficiency correction is applied on the fly to the filling for trigger particles. The factor is multiplicative, i.e. should contain 1/efficiency. Axes: eta, pT, centrality, z-vtx
176     THnF* fEfficiencyCorrectionAssociated;   // if non-0 this efficiency correction is applied on the fly to the filling for associated particles. The factor is multiplicative, i.e. should contain 1/efficiency. Axes: eta, pT, centrality, z-vtx
177     TH1* fCentralityWeights;                 // for centrality flattening
178     
179     // Handlers and events
180     AliAODEvent*             fAOD;             //! AOD Event 
181     AliESDEvent*             fESD;             //! ESD Event 
182     TClonesArray*            fArrayMC;         //! Array of MC particles 
183     AliInputEventHandler*    fInputHandler;    //! Generic InputEventHandler 
184     AliMCEvent*              fMcEvent;         //! MC event
185     AliInputEventHandler*    fMcHandler;       //! MCEventHandler 
186     AliEventPoolManager*     fPoolMgr;         //! event pool manager
187     
188     // Histogram settings
189     TList*              fListOfHistos;    //  Output list of containers 
190     
191     // Event QA cuts
192     Int_t               fnTracksVertex;        // QA tracks pointing to principal vertex
193     Double_t            fZVertex;              // Position of Vertex in Z direction
194     TString             fCentralityMethod;     // Method to determine centrality
195     
196     // Track cuts
197     Double_t            fTrackEtaCut;          // Maximum Eta cut on particles
198     Double_t            fTrackEtaCutMin;          // Minimum Eta cut on particles
199     Int_t               fOnlyOneEtaSide;       // decides that only trigger particle from one eta side are considered (0 = all; -1 = negative, 1 = positive)
200     Double_t            fPtMin;                // Min pT to start correlations
201     TFormula*           fDCAXYCut;             // additional pt dependent cut on DCA XY (only for AOD)
202     Double_t            fSharedClusterCut;  // cut on shared clusters (only for AOD)
203     UInt_t              fFilterBit;            // Select tracks from an specific track cut 
204     UInt_t              fTrackStatus;          // if non-0, the bits set in this variable are required for each track
205     UInt_t              fSelectBit;            // Select events according to AliAnalysisTaskJetServices bit maps 
206     Bool_t              fUseChargeHadrons;     // Only use charge hadrons
207     Int_t               fParticleSpeciesTrigger; // Select which particle to use for the trigger [ -1 (all, default) 0 (pions) 1 (kaons) 2 (protons) 3 (others) particles ]
208     Int_t               fParticleSpeciesAssociated; // Select which particle to use for the associated [ -1 (all, default) 0 (pions) 1 (kaons) 2 (protons) 3 (others) particles ]
209     Bool_t             fCheckMotherPDG;     // Check the PDG code of mother for secondaries 
210
211     Int_t fSelectCharge;           // (un)like sign selection when building correlations: 0: no selection; 1: unlike sign; 2: like sign
212     Int_t fTriggerSelectCharge;    // select charge of trigger particle: 1: positive; -1 negative
213     Int_t fAssociatedSelectCharge; // select charge of associated particle: 1: positive; -1 negative
214     Float_t fTriggerRestrictEta;   // restrict eta range for trigger particle (default: -1 [off])
215     Bool_t fEtaOrdering;           // eta ordering, see AliUEHistograms.h for documentation
216     Bool_t fCutConversions;        // cut on conversions (inv mass)
217     Bool_t fCutResonances;         // cut on resonances (inv mass)
218     Int_t fRejectResonanceDaughters; // reject all daughters of all resonance candidates (1: test method (cut at m_inv=0.9); 2: k0; 3: lambda)
219     Bool_t fFillOnlyStep0;         // fill only step 0
220     Bool_t fSkipStep6;             // skip step 6 when filling
221     Bool_t fRejectCentralityOutliers;  // enable rejection of outliers in centrality vs no track correlation
222     Bool_t fRejectZeroTrackEvents;  // reject events which have no tracks (using the eta, pT cuts defined)
223     Bool_t fRemoveWeakDecays;      // remove secondaries from weak decays from tracks and particles
224     Bool_t fRemoveDuplicates;      // remove particles with the same label (double reconstruction)
225     Bool_t fSkipFastCluster;       // skip kFastOnly flagged events (only for data)
226     Bool_t fWeightPerEvent;        // weight with the number of trigger particles per event
227     TString fCustomBinning;        // supersedes default binning if set, see AliUEHist::GetBinning or AliUEHistograms::AliUEHistograms for syntax and examples
228     Bool_t fPtOrder;               // apply pT,a < pt,t condition; default: kTRUE
229     Int_t fTriggersFromDetector;   // 0 = tracks (default); 1 = VZERO_A; 2 = VZERO_C
230     Bool_t fMCUseUncheckedCentrality; // use unchecked centrality (only applies to MC); default: kFALSE
231     
232     Bool_t fFillpT;                // fill sum pT instead of number density
233     
234     ClassDef(AliAnalysisTaskPhiCorrelations, 42); // Analysis task for delta phi correlations
235   };
236
237 class AliDPhiBasicParticle : public AliVParticle
238 {
239   public:
240     AliDPhiBasicParticle(Float_t eta, Float_t phi, Float_t pt, Short_t charge)
241       : fEta(eta), fPhi(phi), fpT(pt), fCharge(charge)
242     {
243     }
244     ~AliDPhiBasicParticle() {}
245     
246     // kinematics
247     virtual Double_t Px() const { AliFatal("Not implemented"); return 0; }
248     virtual Double_t Py() const { AliFatal("Not implemented"); return 0; }
249     virtual Double_t Pz() const { AliFatal("Not implemented"); return 0; }
250     virtual Double_t Pt() const { return fpT; }
251     virtual Double_t P() const { AliFatal("Not implemented"); return 0; }
252     virtual Bool_t   PxPyPz(Double_t[3]) const { AliFatal("Not implemented"); return 0; }
253
254     virtual Double_t Xv() const { AliFatal("Not implemented"); return 0; }
255     virtual Double_t Yv() const { AliFatal("Not implemented"); return 0; }
256     virtual Double_t Zv() const { AliFatal("Not implemented"); return 0; }
257     virtual Bool_t   XvYvZv(Double_t[3]) const { AliFatal("Not implemented"); return 0; }
258
259     virtual Double_t OneOverPt()  const { AliFatal("Not implemented"); return 0; }
260     virtual Double_t Phi()        const { return fPhi; }
261     virtual Double_t Theta()      const { AliFatal("Not implemented"); return 0; }
262
263
264     virtual Double_t E()          const { AliFatal("Not implemented"); return 0; }
265     virtual Double_t M()          const { AliFatal("Not implemented"); return 0; }
266     
267     virtual Double_t Eta()        const { return fEta; }
268     virtual Double_t Y()          const { AliFatal("Not implemented"); return 0; }
269     
270     virtual Short_t Charge()      const { return fCharge; }
271     virtual Int_t   GetLabel()    const { AliFatal("Not implemented"); return 0; }
272     // PID
273     virtual Int_t   PdgCode()     const { AliFatal("Not implemented"); return 0; }      
274     virtual const Double_t *PID() const { AliFatal("Not implemented"); return 0; }
275     
276     virtual Bool_t IsEqual(const TObject* obj) const { return (obj->GetUniqueID() == GetUniqueID()); }
277     
278     virtual void SetPhi(Double_t phi) { fPhi = phi; }
279     
280   private:
281     Float_t fEta;      // eta
282     Float_t fPhi;      // phi
283     Float_t fpT;       // pT
284     Short_t fCharge;   // charge
285     
286     ClassDef( AliDPhiBasicParticle, 1); // class which contains only quantities requires for this analysis to reduce memory consumption for event mixing
287 };
288   
289 #endif
290
291