ROOT logo

#ifndef ALIPERFORMANCEPTCALIB_H
#define ALIPERFORMANCEPTCALIB_H
//----------------------------------------------------------------------------------------------------
// Class to study systematic shifts in pt and charge/pt respectively.Furthermore a comparison between
// ESD and TPC track momenta is included.
// Track cuts and a user defined shift in charge/pt can be switched on and off by user.
//
// Analysis with class AliPerfAnalyzeInvPt via AliPerformancePtCalib::Analyse(). :
// Projection of charge/pt vs theta and vs phi resp. Histograms will be fitted with either
// polynomial or gaussian fit function to extract minimum position of 1/pt.
// Fit options and theta, phi bins can be set by user.
// Attention: use the Set* functions of AliPerformancePtCalib when running AliPerformancePtCalib::Analyse().
//
// Author: S. Schuchmann 11/13/2009 
//----------------------------------------------------------------------------------------------------

class TString;
class TNamed;
class TCanvas;
class TH1F;
class TH2F;
class TList;

class AliESDVertex;
class AliESDtrack;
class AliMCEvent;
class AliStack;
class AliTrackReference;
class AliESDEvent; 
class AliESDfriend; 
class AliESDfriendTrack; 
class AliMCInfoCuts;
class AliRecInfoCuts;
class AliESDtrackCuts;
class AliESDpid;

#include "THnSparse.h"
#include "AliPerformanceObject.h"

class AliPerformancePtCalib : public AliPerformanceObject {
public:
  AliPerformancePtCalib(const Char_t * name="AliPerformancePtCalib",const Char_t* title ="AliPerformancePtCalib");
   virtual ~AliPerformancePtCalib();

   // Init data members
   virtual void  Init();

   // Execute analysis
   virtual void  Exec(AliMCEvent* const mcEvent, AliESDEvent *const esdEvent, AliESDfriend *const esdFriend, const Bool_t bUseMC, const Bool_t bUseESDfriend);

   // Merge output objects (needed by PROOF) 
   virtual Long64_t Merge(TCollection* const list);

   // Analyse output histograms
   virtual void Analyse();

   // Get analysis folder
   virtual TFolder* GetAnalysisFolder() const {return fAnalysisFolder;}
 
   void SetReadTPCTracks(const Bool_t readTPC)        {fOptTPC   = readTPC;}//read only ESD tracks
   void SetEtaRange(const Double_t eta)               {fEtaAcceptance =  eta ;}//sets eta window
  
   void SetAliESDtrackCuts( AliESDtrackCuts* esdTrackCuts) { fESDTrackCuts = esdTrackCuts;fESDcuts=kTRUE;}//esd track cuts

   void SetAnalysePions(const Bool_t anaPions) {fPions = anaPions;}
   void SetPtShift(const Double_t shiftVal); // set user defined shift in charge/pt

   // setters for analysis with AliPerformancePtCalib::Analyse()  
   void SetProjBinsPhi(const Double_t *pBins,const Int_t sizep,const Double_t minTheta, const Double_t maxTheta);// set phi bins for projection and theta range selection (rad)
   void SetProjBinsTheta(const Double_t *tBins, const Int_t sizet,const Double_t minPhi, const Double_t maxPhi);// set theta bins for projection and phi range selection (rad)
   void SetMakeFitOption(const Bool_t setGausFit, const Double_t exclusionR,const Double_t fitR );//set fit options
   void SetDoRebin(const Int_t rebin){if(rebin) {fDoRebin = kTRUE; fRebin = rebin;}}
   const TList *GetHistoList() {return fList;}// get list of histograms for analysis

   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderPtCalib",TString title = "Analysed PtCalib histograms");

   // Export objects to folder
   TFolder *ExportToFolder(TObjArray * array=0);

   // Selection cuts
   void SetAliRecInfoCuts(AliRecInfoCuts* const cuts=0) {fCutsRC = cuts;}   
   void SetAliMCInfoCuts(AliMCInfoCuts* const cuts=0) {fCutsMC = cuts;}  

   AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;}  
   AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}

protected:
   // variables for fitting in Analyse() function
   Double_t fThetaBins[100];// array of theta bins for projection of 1/pt vs theta
   Double_t fPhiBins[100]; // array of phi bins for projection of 1/pt vs theta

   Int_t fNThetaBins;// sets number of theta bins
   Int_t fNPhiBins ;// sets number of phi bins
   Double_t fMaxPhi;// max phi for 2D projection on theta and charge/pt axis
   Double_t fMinPhi;// min phi for 2D projection on theta and charge/pt axis
   Double_t fMaxTheta;// max theta for 2D projection on phi and charge/pt axis
   Double_t fMinTheta;// min theta for 2D projection on phi and charge/pt axis
   Double_t fRange;// sets fit range
   Double_t fExclRange ;// sets range of rejection of points around 0
   Bool_t fFitGaus ;// flag for usage of gaussian fit function
   Bool_t fDoRebin;// flag for rebin 1D histos before fitting
   Int_t fRebin;// number of bins for rebin
    
private:
   // option for user defined shift in charge/pt
   Bool_t fShift;//flag for shift in charge/pt
   Double_t fDeltaInvP;// shift value of charge/pt
   
   //options for cuts
   Bool_t fOptTPC;// flag for reading of TPC tracks in Exec
   Bool_t fESDcuts;//flag for usage of esd track cuts
   Bool_t fPions;// flag for analzsing pions instead of all charged particles

   //ESD track cut values
   Double_t fEtaAcceptance;//sets value of eta window

   AliRecInfoCuts* fCutsRC;     // selection cuts for reconstructed tracks
   AliMCInfoCuts*  fCutsMC;     // selection cuts for MC tracks
  

    
   TList       *fList;// list of histograms
   
   //histograms and THnSparse
   THnSparseF  *fHistInvPtPtThetaPhi;// is filled with charge/pt, pt, theta, phi for ESD or TPC

   TH1F        *fHistPtShift0;//if shift in charge/pt is set by user, this histogram shows pt wihtout shift
   TH1F        *fHistPrimaryVertexPosX;// primary vertex position x          
   TH1F        *fHistPrimaryVertexPosY;// primary vertex position y        
   TH1F        *fHistPrimaryVertexPosZ;// primary vertex position z        
   TH1F        *fHistTrackMultiplicity; // track multiplicity         
   TH1F        *fHistTrackMultiplicityCuts;//track multiplicity after all cuts are applied

   TH2F        *fHistTPCMomentaPosP;//TPC p vs global esd track p for positive tracks
   TH2F        *fHistTPCMomentaNegP;//TPC p vs global esd track p for negative tracks
   TH2F        *fHistTPCMomentaPosPt;//TPC pt vs global esd track p positive tracks
   TH2F        *fHistTPCMomentaNegPt;//TPC pt vs global esd track p for negative tracks
   

   TH1F        *fHistUserPtShift;// shows the shift value if set by user
   TH2F        *fHistdedxPions;// dEdx vs cahrge*pt
   
   AliESDtrackCuts* fESDTrackCuts;// esd track cuts
   //pid
   AliESDpid *fESDpid;
   // analysis folder 
   TFolder *fAnalysisFolder; // folder for analysed histograms

   AliPerformancePtCalib(const AliPerformancePtCalib&);            // not implemented 
   AliPerformancePtCalib& operator=(const AliPerformancePtCalib&); // not implemented 

   ClassDef(AliPerformancePtCalib, 1); 
};

#endif
 AliPerformancePtCalib.h:1
 AliPerformancePtCalib.h:2
 AliPerformancePtCalib.h:3
 AliPerformancePtCalib.h:4
 AliPerformancePtCalib.h:5
 AliPerformancePtCalib.h:6
 AliPerformancePtCalib.h:7
 AliPerformancePtCalib.h:8
 AliPerformancePtCalib.h:9
 AliPerformancePtCalib.h:10
 AliPerformancePtCalib.h:11
 AliPerformancePtCalib.h:12
 AliPerformancePtCalib.h:13
 AliPerformancePtCalib.h:14
 AliPerformancePtCalib.h:15
 AliPerformancePtCalib.h:16
 AliPerformancePtCalib.h:17
 AliPerformancePtCalib.h:18
 AliPerformancePtCalib.h:19
 AliPerformancePtCalib.h:20
 AliPerformancePtCalib.h:21
 AliPerformancePtCalib.h:22
 AliPerformancePtCalib.h:23
 AliPerformancePtCalib.h:24
 AliPerformancePtCalib.h:25
 AliPerformancePtCalib.h:26
 AliPerformancePtCalib.h:27
 AliPerformancePtCalib.h:28
 AliPerformancePtCalib.h:29
 AliPerformancePtCalib.h:30
 AliPerformancePtCalib.h:31
 AliPerformancePtCalib.h:32
 AliPerformancePtCalib.h:33
 AliPerformancePtCalib.h:34
 AliPerformancePtCalib.h:35
 AliPerformancePtCalib.h:36
 AliPerformancePtCalib.h:37
 AliPerformancePtCalib.h:38
 AliPerformancePtCalib.h:39
 AliPerformancePtCalib.h:40
 AliPerformancePtCalib.h:41
 AliPerformancePtCalib.h:42
 AliPerformancePtCalib.h:43
 AliPerformancePtCalib.h:44
 AliPerformancePtCalib.h:45
 AliPerformancePtCalib.h:46
 AliPerformancePtCalib.h:47
 AliPerformancePtCalib.h:48
 AliPerformancePtCalib.h:49
 AliPerformancePtCalib.h:50
 AliPerformancePtCalib.h:51
 AliPerformancePtCalib.h:52
 AliPerformancePtCalib.h:53
 AliPerformancePtCalib.h:54
 AliPerformancePtCalib.h:55
 AliPerformancePtCalib.h:56
 AliPerformancePtCalib.h:57
 AliPerformancePtCalib.h:58
 AliPerformancePtCalib.h:59
 AliPerformancePtCalib.h:60
 AliPerformancePtCalib.h:61
 AliPerformancePtCalib.h:62
 AliPerformancePtCalib.h:63
 AliPerformancePtCalib.h:64
 AliPerformancePtCalib.h:65
 AliPerformancePtCalib.h:66
 AliPerformancePtCalib.h:67
 AliPerformancePtCalib.h:68
 AliPerformancePtCalib.h:69
 AliPerformancePtCalib.h:70
 AliPerformancePtCalib.h:71
 AliPerformancePtCalib.h:72
 AliPerformancePtCalib.h:73
 AliPerformancePtCalib.h:74
 AliPerformancePtCalib.h:75
 AliPerformancePtCalib.h:76
 AliPerformancePtCalib.h:77
 AliPerformancePtCalib.h:78
 AliPerformancePtCalib.h:79
 AliPerformancePtCalib.h:80
 AliPerformancePtCalib.h:81
 AliPerformancePtCalib.h:82
 AliPerformancePtCalib.h:83
 AliPerformancePtCalib.h:84
 AliPerformancePtCalib.h:85
 AliPerformancePtCalib.h:86
 AliPerformancePtCalib.h:87
 AliPerformancePtCalib.h:88
 AliPerformancePtCalib.h:89
 AliPerformancePtCalib.h:90
 AliPerformancePtCalib.h:91
 AliPerformancePtCalib.h:92
 AliPerformancePtCalib.h:93
 AliPerformancePtCalib.h:94
 AliPerformancePtCalib.h:95
 AliPerformancePtCalib.h:96
 AliPerformancePtCalib.h:97
 AliPerformancePtCalib.h:98
 AliPerformancePtCalib.h:99
 AliPerformancePtCalib.h:100
 AliPerformancePtCalib.h:101
 AliPerformancePtCalib.h:102
 AliPerformancePtCalib.h:103
 AliPerformancePtCalib.h:104
 AliPerformancePtCalib.h:105
 AliPerformancePtCalib.h:106
 AliPerformancePtCalib.h:107
 AliPerformancePtCalib.h:108
 AliPerformancePtCalib.h:109
 AliPerformancePtCalib.h:110
 AliPerformancePtCalib.h:111
 AliPerformancePtCalib.h:112
 AliPerformancePtCalib.h:113
 AliPerformancePtCalib.h:114
 AliPerformancePtCalib.h:115
 AliPerformancePtCalib.h:116
 AliPerformancePtCalib.h:117
 AliPerformancePtCalib.h:118
 AliPerformancePtCalib.h:119
 AliPerformancePtCalib.h:120
 AliPerformancePtCalib.h:121
 AliPerformancePtCalib.h:122
 AliPerformancePtCalib.h:123
 AliPerformancePtCalib.h:124
 AliPerformancePtCalib.h:125
 AliPerformancePtCalib.h:126
 AliPerformancePtCalib.h:127
 AliPerformancePtCalib.h:128
 AliPerformancePtCalib.h:129
 AliPerformancePtCalib.h:130
 AliPerformancePtCalib.h:131
 AliPerformancePtCalib.h:132
 AliPerformancePtCalib.h:133
 AliPerformancePtCalib.h:134
 AliPerformancePtCalib.h:135
 AliPerformancePtCalib.h:136
 AliPerformancePtCalib.h:137
 AliPerformancePtCalib.h:138
 AliPerformancePtCalib.h:139
 AliPerformancePtCalib.h:140
 AliPerformancePtCalib.h:141
 AliPerformancePtCalib.h:142
 AliPerformancePtCalib.h:143
 AliPerformancePtCalib.h:144
 AliPerformancePtCalib.h:145
 AliPerformancePtCalib.h:146
 AliPerformancePtCalib.h:147
 AliPerformancePtCalib.h:148
 AliPerformancePtCalib.h:149
 AliPerformancePtCalib.h:150
 AliPerformancePtCalib.h:151
 AliPerformancePtCalib.h:152
 AliPerformancePtCalib.h:153
 AliPerformancePtCalib.h:154
 AliPerformancePtCalib.h:155
 AliPerformancePtCalib.h:156
 AliPerformancePtCalib.h:157