ROOT logo
#ifndef AliEPSELECTIONTASK_H
#define AliEPSELECTIONTASK_H

/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

//*****************************************************
//   Class AliEPSelectionTask
//   author: Alberica Toia, Johanna Gramling
//*****************************************************

#include "AliAnalysisTaskSE.h"

class TFile;
class TH1F;
class TH2F;
class TList;
class TString;
class TVector2;

class AliESDEvent;
class AliESDtrackCuts;
class AliESDtrack;
class AliEventplane;
class AliOADBContainer;
class AliVTrack;
class THnSparse;
class TProfile;

class AliEPSelectionTask : public AliAnalysisTaskSE {

 public:
  
  enum ResoMethod{kRandom,kEta,kCharge};

  AliEPSelectionTask();
  AliEPSelectionTask(const char *name);
  virtual ~AliEPSelectionTask();

  // Implementation of interface methods
  virtual void UserCreateOutputObjects();
  virtual void UserExec(Option_t *option);
  virtual void Terminate(Option_t *option);
  
  TVector2 GetQ(AliEventplane* EP, TObjArray* event);
  void GetQsub(TVector2& Qsub1, TVector2& Qsub2, TObjArray* event,AliEventplane* EP);
  Double_t GetWeight(TObject* track1);
  Double_t GetPhiWeight(TObject* track1);
  void Recenter(Int_t var, Double_t * values);

  virtual void  SetDebugLevel(Int_t level)   {fDebug = level;}
  void SetInput(const char* input)           {fAnalysisInput = input;}
  void SetUseMCRP()			     {fUseMCRP = kTRUE;}
  void SetUsePhiWeight(Bool_t usephi = kTRUE){fUsePhiWeight = usephi;}
  void SetUsePtWeight()			     {fUsePtWeight = kTRUE;}
  void SetUseRecentering()		     {fUseRecentering = kTRUE;}
  void SetSaveTrackContribution()	     {fSaveTrackContribution = kTRUE;}
  void SetTrackType(TString tracktype);
  void SetPhiDist();
  void SetQvectorDist();
  void SetPersonalESDtrackCuts(AliESDtrackCuts* trackcuts);
  void SetPersonalAODtrackCuts(UInt_t filterbit = 1, Float_t etalow = -0.8, Float_t etaup = 0.8, Float_t ptlow = 0.15, Float_t ptup = 20., Int_t ntpc = 50);
  void SetPersonalPhiDistribution(const char* filename, char* listname);
  void SetEtaGap(Float_t etagap)             {fEtaGap = etagap;}
  void SetSubeventsSplitMethod(Int_t method) {fSplitMethod = method;}
  
 private:
   
  AliEPSelectionTask(const AliEPSelectionTask& ep);
  AliEPSelectionTask& operator= (const AliEPSelectionTask& ep); 

  TObjArray* GetAODTracksAndMaxID(AliAODEvent* aod, Int_t& maxid);
  void SetOADBandPeriod();
  TH1F* SelectPhiDist(AliVTrack *track);
  TObjArray* GetTracksForLHC11h(AliESDEvent* esd);

  TString  fAnalysisInput; 		// "ESD", "AOD"
  TString  fTrackType;			// "GLOBAL", "TPC"
  TString  fPeriod;	                // "LHC11h","LHC10h"
  Double_t fCentrality;                 // centrality percentile from "V0M"
  Bool_t   fUseMCRP;			// i.e. usable for Therminator, when MC RP is provided
  Bool_t   fUsePhiWeight;		// use of phi weights
  Bool_t   fUsePtWeight;		// use of pT weights
  Bool_t   fUseRecentering;		// use of mean & rms of q vector components for recentering
  Bool_t   fSaveTrackContribution;	// storage of contribution of each track to Q-Vector
  Bool_t   fUserphidist;		// bool, if personal phi distribution should be used
  Bool_t   fUsercuts;			// bool, if personal cuts should be used
  Int_t    fRunNumber;			// runnumber
  UInt_t   fAODfilterbit;               // AOD filter bit for AOD track selection  
  Float_t  fEtaGap;                     // Eta Gap between Subevent A and B
  Int_t    fSplitMethod;                // Splitting Method for subevents
  

  AliESDtrackCuts* fESDtrackCuts;       // track cuts
  
  AliOADBContainer* fEPContainer;	//! OADB Container
  AliOADBContainer* fQxContainer;	//! OADB Container for Q_x vector
  AliOADBContainer* fQyContainer;	//! OADB Container for Q_y vector
  TH1F*	 fPhiDist[4];			// array of Phi distributions used to calculate phi weights
  THnSparse *fSparseDist;               //! THn for eta-charge phi-weighting
  TProfile* fQDist[2];			// array of TProfiles with mean+rms for recentering
  TH1F *fHruns;                         // information about runwise statistics of phi-weights

  TVector2* fQVector;			//! Q-Vector of the event  
  Double_t* fQContributionX;		//! array of the tracks' contributions to X component of Q-Vector - index = track ID
  Double_t* fQContributionY;		//! array of the tracks' contributions to Y component of Q-Vector - index = track ID
  Double_t  fEventplaneQ; 		//! Event plane angle from Q-Vector
  TVector2* fQsub1;			//! Q-Vector of sub-event 1
  TVector2* fQsub2;			//! Q-Vector of sub-event 2
  Double_t  fQsubRes;			//! Difference of EP angles of subevents
  
  TList* fOutputList;                   // Output histograms
  TH1F*  fHOutEventplaneQ;    		//! control histogram: Event Plane angle
  TH1F*  fHOutPhi;			//! control histogram: original phi distribution
  TH1F*	 fHOutPhiCorr;			//! control histogram: corrected phi distribution
  TH2F*  fHOutsub1sub2;			//! control histogram: correlation of EP from subevents
  TH2F*  fHOutNTEPRes;			//! control histogram: Difference of EP angles of subevents vs Nch
  TH2F*  fHOutPTPsi;			//! control histogram: Difference of EP angle and emission angle of track vs track pT
  TH2F*	 fHOutDiff;			//! control histogram: Difference of MC RP and EP - only filled if fUseMCRP is true!
  TH2F*  fHOutleadPTPsi;		//! control histogram: emission angle of leading pT track vs EP angle

  ClassDef(AliEPSelectionTask,4); 
};

#endif

 AliEPSelectionTask.h:1
 AliEPSelectionTask.h:2
 AliEPSelectionTask.h:3
 AliEPSelectionTask.h:4
 AliEPSelectionTask.h:5
 AliEPSelectionTask.h:6
 AliEPSelectionTask.h:7
 AliEPSelectionTask.h:8
 AliEPSelectionTask.h:9
 AliEPSelectionTask.h:10
 AliEPSelectionTask.h:11
 AliEPSelectionTask.h:12
 AliEPSelectionTask.h:13
 AliEPSelectionTask.h:14
 AliEPSelectionTask.h:15
 AliEPSelectionTask.h:16
 AliEPSelectionTask.h:17
 AliEPSelectionTask.h:18
 AliEPSelectionTask.h:19
 AliEPSelectionTask.h:20
 AliEPSelectionTask.h:21
 AliEPSelectionTask.h:22
 AliEPSelectionTask.h:23
 AliEPSelectionTask.h:24
 AliEPSelectionTask.h:25
 AliEPSelectionTask.h:26
 AliEPSelectionTask.h:27
 AliEPSelectionTask.h:28
 AliEPSelectionTask.h:29
 AliEPSelectionTask.h:30
 AliEPSelectionTask.h:31
 AliEPSelectionTask.h:32
 AliEPSelectionTask.h:33
 AliEPSelectionTask.h:34
 AliEPSelectionTask.h:35
 AliEPSelectionTask.h:36
 AliEPSelectionTask.h:37
 AliEPSelectionTask.h:38
 AliEPSelectionTask.h:39
 AliEPSelectionTask.h:40
 AliEPSelectionTask.h:41
 AliEPSelectionTask.h:42
 AliEPSelectionTask.h:43
 AliEPSelectionTask.h:44
 AliEPSelectionTask.h:45
 AliEPSelectionTask.h:46
 AliEPSelectionTask.h:47
 AliEPSelectionTask.h:48
 AliEPSelectionTask.h:49
 AliEPSelectionTask.h:50
 AliEPSelectionTask.h:51
 AliEPSelectionTask.h:52
 AliEPSelectionTask.h:53
 AliEPSelectionTask.h:54
 AliEPSelectionTask.h:55
 AliEPSelectionTask.h:56
 AliEPSelectionTask.h:57
 AliEPSelectionTask.h:58
 AliEPSelectionTask.h:59
 AliEPSelectionTask.h:60
 AliEPSelectionTask.h:61
 AliEPSelectionTask.h:62
 AliEPSelectionTask.h:63
 AliEPSelectionTask.h:64
 AliEPSelectionTask.h:65
 AliEPSelectionTask.h:66
 AliEPSelectionTask.h:67
 AliEPSelectionTask.h:68
 AliEPSelectionTask.h:69
 AliEPSelectionTask.h:70
 AliEPSelectionTask.h:71
 AliEPSelectionTask.h:72
 AliEPSelectionTask.h:73
 AliEPSelectionTask.h:74
 AliEPSelectionTask.h:75
 AliEPSelectionTask.h:76
 AliEPSelectionTask.h:77
 AliEPSelectionTask.h:78
 AliEPSelectionTask.h:79
 AliEPSelectionTask.h:80
 AliEPSelectionTask.h:81
 AliEPSelectionTask.h:82
 AliEPSelectionTask.h:83
 AliEPSelectionTask.h:84
 AliEPSelectionTask.h:85
 AliEPSelectionTask.h:86
 AliEPSelectionTask.h:87
 AliEPSelectionTask.h:88
 AliEPSelectionTask.h:89
 AliEPSelectionTask.h:90
 AliEPSelectionTask.h:91
 AliEPSelectionTask.h:92
 AliEPSelectionTask.h:93
 AliEPSelectionTask.h:94
 AliEPSelectionTask.h:95
 AliEPSelectionTask.h:96
 AliEPSelectionTask.h:97
 AliEPSelectionTask.h:98
 AliEPSelectionTask.h:99
 AliEPSelectionTask.h:100
 AliEPSelectionTask.h:101
 AliEPSelectionTask.h:102
 AliEPSelectionTask.h:103
 AliEPSelectionTask.h:104
 AliEPSelectionTask.h:105
 AliEPSelectionTask.h:106
 AliEPSelectionTask.h:107
 AliEPSelectionTask.h:108
 AliEPSelectionTask.h:109
 AliEPSelectionTask.h:110
 AliEPSelectionTask.h:111
 AliEPSelectionTask.h:112
 AliEPSelectionTask.h:113
 AliEPSelectionTask.h:114
 AliEPSelectionTask.h:115
 AliEPSelectionTask.h:116
 AliEPSelectionTask.h:117
 AliEPSelectionTask.h:118
 AliEPSelectionTask.h:119
 AliEPSelectionTask.h:120
 AliEPSelectionTask.h:121
 AliEPSelectionTask.h:122
 AliEPSelectionTask.h:123
 AliEPSelectionTask.h:124
 AliEPSelectionTask.h:125
 AliEPSelectionTask.h:126