ROOT logo
#ifndef ALIPERFORMANCEMATCH_H
#define ALIPERFORMANCEMATCH_H

//------------------------------------------------------------------------------
// Class keeps matching information between 
// central barrel detectors.   
// 
// Author: J.Otwinowski 17/10/2009  
// Changes by M.Knichel 22/10/2010
//------------------------------------------------------------------------------

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

class AliESDVertex;
class AliESDtrack;
class AliMCEvent;
class AliStack;
class AliTrackReference;
class AliESDEvent; 
class AliESDfriend; 
class AliESDfriendTrack; 
class AliMCEvent;
class AliMCParticle;
class AliMCInfoCuts;
class AliRecInfoCuts;
class AliExternalTrackParam;

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

class AliPerformanceMatch : public AliPerformanceObject {
public :
  AliPerformanceMatch(const Char_t* name="AliPerformanceMatch", const Char_t* title="AliPerformanceMatch",Int_t analysisMode=0,Bool_t hptGenerator=kFALSE);
  virtual ~AliPerformanceMatch();

  // 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);

  // Project Histograms store in AnalysisFolder
  virtual void Analyse();
  
  // Analyse Projected Histograms to create Efficiency and AddToFolder
  //  virtual void AnalyseFinal();

  // Get analysis folder
  virtual TFolder* GetAnalysisFolder() const {return fAnalysisFolder;}

  // Process matching
  void ProcessTPCITS(AliStack* const stack, AliESDtrack *const esdTrack);
  void ProcessTPCTRD(AliStack* const stack, AliESDtrack *const esdTrack, AliESDfriendTrack *const friendTrack);
  void ProcessITSTPC(Int_t trackIdx, AliESDEvent* const esdEvent, AliStack* const stack, AliESDtrack *const esdTrack);
  void ProcessTPCConstrain(AliStack* const stack, AliESDEvent *const esdEvent, AliESDtrack *const esdTrack); // - 01.11.2011

  // Fill histogrrams
  void FillHistograms(AliESDtrack *const refParam, AliESDtrack *const param, Bool_t isRec);

  // Create folder for analysed histograms
  TFolder *CreateFolder(TString folder = "folderRes",TString title = "Analysed Resolution 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;}  

  TH1F*  MakeResol(TH2F * his, Int_t integ=0, Bool_t type=kFALSE, Int_t cut=0); 

  // getters
  //
  THnSparse *GetResolHisto() const  { return fResolHisto; }
  THnSparse *GetPullHisto()  const  { return fPullHisto; }
  THnSparse *GetTrackEffHisto() const  { return fTrackingEffHisto; }
  THnSparse *GetTPCConstrain() const { return fTPCConstrain; }

  TObjArray* GetHistos() const { return fFolderObj; }
  
  static Bool_t GetMergeTHnSparse() { return fgMergeTHnSparse; }
  static void SetMergeTHnSparse(Bool_t mergeTHnSparse) {fgUseMergeTHnSparse = kTRUE; fgMergeTHnSparse = mergeTHnSparse; }
  
  void SetUseHLT(Bool_t useHLT = kTRUE) {fUseHLT = useHLT;}
  Bool_t GetUseHLT() { return fUseHLT; }  

private:

  static Bool_t fgMergeTHnSparse;
  static Bool_t fgUseMergeTHnSparse;

  //
  // Control histograms
  // 5 track parameters (details in STEER/AliExternalTrackParam.h)
  // + isRec flag to determine ITS/TRD tracking efficiency
  // w.r.t TPC

  // resolution histogram
  THnSparseF *fResolHisto; //-> res_y:res_z:res_phi:res_lambda:res_pt:y:z:phi:eta:pt:isRec

  // pull histogram
  THnSparseF *fPullHisto;  //-> pull_y:pull_z:pull_snp:pull_tgl:pull_1pt:y:z:snp:tgl:1pt:isRec

  // tracking efficiency using ITS stand-alone tracks histogram
  THnSparseF *fTrackingEffHisto;  //-> has match:y:z:snp:tgl:phi:pt:ITSclusters

  // TPC Inner constrained to global tracks - 01.11.2011
  THnSparseF *fTPCConstrain;  //-> pull_phi:phi,pt,eta

  
  TObjArray* fFolderObj; // array of analysed histograms  

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

  // analysis folder 
  TFolder *fAnalysisFolder; // folder for analysed histograms
  
  Bool_t fUseHLT; // use HLT ESD

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

  ClassDef(AliPerformanceMatch,3);
};

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