1. Using the THnSparse instead of THx and TProfiles
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Mar 2009 13:59:06 +0000 (13:59 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Mar 2009 13:59:06 +0000 (13:59 +0000)
(Jacek)

12 files changed:
PWG1/AliComparisonDCA.cxx
PWG1/AliComparisonDCA.h
PWG1/AliComparisonDEdx.cxx
PWG1/AliComparisonDEdx.h
PWG1/AliComparisonEff.cxx
PWG1/AliComparisonEff.h
PWG1/AliComparisonObject.cxx
PWG1/AliComparisonObject.h
PWG1/AliComparisonRes.cxx
PWG1/AliComparisonRes.h
PWG1/Macros/RunAliComparisonTask.C
PWG1/Macros/RunGSI.C

index a562039..5358edc 100644 (file)
 
 */
 
-#include <iostream>
-
-#include "TFile.h"
-#include "TH3F.h"
-#include "TH2F.h"
-#include "TF1.h"
-#include "TProfile.h"
-#include "TProfile2D.h"
 #include "TGraph2D.h"
 #include "TCanvas.h"
 #include "TGraph.h"
-// 
+
 #include "AliTracker.h"   
 #include "AliESDEvent.h"   
-#include "AliESD.h"
-#include "AliESDfriend.h"
-#include "AliESDfriendTrack.h"
 #include "AliRecInfoCuts.h" 
 #include "AliMCInfoCuts.h" 
 #include "AliLog.h" 
 #include "AliESDVertex.h" 
-//
 #include "AliMathBase.h"
-#include "AliTreeDraw.h" 
 
 #include "AliMCInfo.h" 
 #include "AliESDRecInfo.h" 
@@ -71,12 +58,40 @@ AliComparisonDCA::AliComparisonDCA():
   AliComparisonObject("AliComparisonDCA"),
 
   // DCA histograms
+  fDCAHisto(0),
+  /*
+  fD0TanSPtTPCITS(0),
+  fD1TanSPtTPCITS(0),
+  fD0TanSPt(0),
+  fD1TanSPt(0),
+  fD0TanSPtTPC(0),
+  fD1TanSPtTPC(0),
+  */
+
+  // Cuts 
+  fCutsRC(0), 
+  fCutsMC(0),  
+
+  // histogram folder 
+  fAnalysisFolder(0)
+{
+  // default constructor       
+}
+
+//_____________________________________________________________________________
+AliComparisonDCA::AliComparisonDCA(Char_t* name="AliComparisonDCA", Char_t* title="AliComparisonDCA",Int_t analysisMode=0, Bool_t hptGenerator=kFALSE):
+  AliComparisonObject(name,title),
+
+  // DCA histograms
+  fDCAHisto(0),
+  /*
   fD0TanSPtTPCITS(0),
   fD1TanSPtTPCITS(0),
   fD0TanSPt(0),
   fD1TanSPt(0),
   fD0TanSPtTPC(0),
   fD1TanSPtTPC(0),
+  */
 
   // Cuts 
   fCutsRC(0), 
@@ -85,19 +100,27 @@ AliComparisonDCA::AliComparisonDCA():
   // histogram folder 
   fAnalysisFolder(0)
 {
+  // named constructor  
+
+  SetAnalysisMode(analysisMode);
+  SetHptGenerator(hptGenerator);
   Init();
 }
 
+
 //_____________________________________________________________________________
 AliComparisonDCA::~AliComparisonDCA()
 {
-  //
+  // destructor
+  if(fDCAHisto)  delete fDCAHisto; fDCAHisto=0; 
+  /*
   if(fD0TanSPtTPCITS) delete fD0TanSPtTPCITS; fD0TanSPtTPCITS=0;
   if(fD1TanSPtTPCITS) delete fD1TanSPtTPCITS; fD1TanSPtTPCITS=0;
   if(fD0TanSPt) delete fD0TanSPt; fD0TanSPt=0;
   if(fD1TanSPt) delete fD1TanSPt; fD1TanSPt=0;
   if(fD0TanSPtTPC) delete fD0TanSPtTPC; fD0TanSPtTPC=0;
   if(fD1TanSPtTPC) delete fD1TanSPtTPC; fD1TanSPtTPC=0;
+  */
   if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
 
 }
@@ -106,6 +129,31 @@ AliComparisonDCA::~AliComparisonDCA()
 void AliComparisonDCA::Init()
 {
   // DCA histograms
+
+ Int_t nPBins = 31;
+    Double_t binsP[32] = {0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,2.25,2.5,2.75,3.,3.5,4.,5.,6.,8.,10.};
+    Double_t pMin = 0., pMax = 10.;
+
+    if(IsHptGenerator() == kTRUE) {
+      nPBins = 100;
+      pMin = 0.; pMax = 100.;
+    }
+
+   //dca_r, dca_z, eta, pt
+   Int_t binsQA[4]    = {100,100,20,nPBins};
+   Double_t xminQA[4] = {-10.,-10.,-1., pMin};
+   Double_t xmaxQA[4] = {10.,10.,1., pMax};
+
+   fDCAHisto = new THnSparseF("fDCAHisto","dca_r:dca_z:eta:pt",4,binsQA,xminQA,xmaxQA);
+   if(!IsHptGenerator()) fDCAHisto->SetBinEdges(3,binsP);
+
+   fDCAHisto->GetAxis(0)->SetTitle("dca_r (cm)");
+   fDCAHisto->GetAxis(1)->SetTitle("dca_z (cm)");
+   fDCAHisto->GetAxis(2)->SetTitle("eta");
+   fDCAHisto->GetAxis(3)->SetTitle("pt (GeV/c)");
+   fDCAHisto->Sumw2();
+       
+  /*   
   fD0TanSPtTPCITS = new TH3F("DCAyTanSPtTPCITS","DCAyTanSPt",40,-2,2, 10,0.3,3, 100,-1,1);
   fD0TanSPtTPCITS->SetXTitle("tan(#theta)");
   fD0TanSPtTPCITS->SetYTitle("#sqrt{p_{t}(GeV)}");
@@ -135,6 +183,7 @@ void AliComparisonDCA::Init()
   fD1TanSPtTPC->SetXTitle("tan(#theta)");
   fD1TanSPtTPC->SetYTitle("#sqrt{p_{t}(GeV)}");
   fD1TanSPtTPC->SetZTitle("DCA_{z}");
+  */
 
   // init cuts
   if(!fCutsMC) 
@@ -147,20 +196,18 @@ void AliComparisonDCA::Init()
 }
 
 //_____________________________________________________________________________
-void AliComparisonDCA::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
+void AliComparisonDCA::ProcessTPC(AliMCInfo* const infoMC, AliESDRecInfo * const infoRC)
 {
   // Fill DCA comparison information
   AliExternalTrackParam *track = 0;
   Double_t field      = AliTracker::GetBz(); // nominal Bz field [kG]
   Double_t kMaxD      = 123456.0; // max distance
 
-  Int_t clusterITS[200];
   Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
-  Float_t dca1[2], cov1[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
 
   Float_t mcpt = infoMC->GetParticle().Pt();
-  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
-  Float_t spt = TMath::Sqrt(mcpt);
+  Float_t mceta = infoMC->GetParticle().Eta();
+  //Float_t spt = TMath::Sqrt(mcpt);
 
   // distance to Prim. vertex 
   const Double_t* dv = infoMC->GetVDist(); 
@@ -173,7 +220,7 @@ void AliComparisonDCA::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   if (infoRC->GetStatus(1)!=3) return;
   if (!infoRC->GetESDtrack()) return;  
   if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
-  if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
+  //if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
 
   // calculate and set prim. vertex
   AliESDVertex vertexMC;
@@ -189,27 +236,56 @@ void AliComparisonDCA::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
       Bool_t bDCAStatus = track->PropagateToDCA(&vertexMC,field,kMaxD,dca,cov);
 
       if(bDCAStatus) {
-        fD0TanSPtTPC->Fill(tantheta,spt,dca[0]);
-        fD1TanSPtTPC->Fill(tantheta,spt,dca[1]);
-         }
-
-         delete track;
+        Double_t vDCAHisto[4]={dca[0],dca[1],mceta,mcpt};
+        fDCAHisto->Fill(vDCAHisto);
+      }
+    delete track;
     }
   }
-  
- infoRC->GetESDtrack()->GetImpactParameters(dca1,cov1);
+}
+
+//_____________________________________________________________________________
+void AliComparisonDCA::ProcessTPCITS(AliMCInfo* const infoMC, AliESDRecInfo * const infoRC)
+{
+  // Fill DCA comparison information
+  Int_t clusterITS[200];
+  Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
+
+  Float_t mcpt = infoMC->GetParticle().Pt();
+  Float_t mceta = infoMC->GetParticle().Eta();
+  //Float_t spt = TMath::Sqrt(mcpt);
+
+  // distance to Prim. vertex 
+  const Double_t* dv = infoMC->GetVDist(); 
+  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
+
+  // Check selection cuts
+  if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; 
+  if (!isPrim) return;
+  if (infoRC->GetStatus(1)!=3) return;
+  if (!infoRC->GetESDtrack()) return;  
+  if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
+  //if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
 
- // ITS + TPC
- if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS()){
-    fD0TanSPtTPCITS->Fill(tantheta,spt,dca1[0]);
-    fD1TanSPtTPCITS->Fill(tantheta,spt,dca1[1]);
+  infoRC->GetESDtrack()->GetImpactParameters(dca,cov);
+
+  // ITS + TPC
+  if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS())
+  {
+    Double_t vDCAHisto[4]={dca[0],dca[1],mceta,mcpt};
+    fDCAHisto->Fill(vDCAHisto);
   }
-    fD0TanSPt->Fill(tantheta,spt,dca1[0]);
-    fD1TanSPt->Fill(tantheta,spt,dca1[1]);
+}
+
+void AliComparisonDCA::ProcessConstrained(AliMCInfo* const infoMC, AliESDRecInfo * const infoRC)
+{
+  // Fill DCA comparison information
+  
+  AliDebug(AliLog::kWarning, "Warning: Not implemented");
 }
 
 //_____________________________________________________________________________
-Long64_t AliComparisonDCA::Merge(TCollection* list) 
+Long64_t AliComparisonDCA::Merge(TCollection* const list) 
 {
   // Merge list of objects (needed by PROOF)
 
@@ -228,14 +304,16 @@ Long64_t AliComparisonDCA::Merge(TCollection* list)
   {
     AliComparisonDCA* entry = dynamic_cast<AliComparisonDCA*>(obj);
     if (entry == 0) continue; 
-    
 
+    fDCAHisto->Add(entry->fDCAHisto);
+    /*
     fD0TanSPtTPCITS->Add(entry->fD0TanSPtTPCITS);
     fD1TanSPtTPCITS->Add(entry->fD1TanSPtTPCITS);
     fD0TanSPt->Add(entry->fD0TanSPt);
     fD1TanSPt->Add(entry->fD1TanSPt);
     fD0TanSPtTPC->Add(entry->fD0TanSPtTPC);
     fD1TanSPtTPC->Add(entry->fD1TanSPtTPC);
+    */
 
     count++;
   }
@@ -244,9 +322,16 @@ return count;
 }
 
 //_____________________________________________________________________________
-void AliComparisonDCA::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
+void AliComparisonDCA::Exec(AliMCInfo* const infoMC, AliESDRecInfo * const infoRC)
+{
   // Process comparison information
-  Process(infoMC,infoRC);
+  if(GetAnalysisMode() == 0) ProcessTPC(infoMC,infoRC);
+  else if(GetAnalysisMode() == 1) ProcessTPCITS(infoMC,infoRC);
+  else if(GetAnalysisMode() == 2) ProcessConstrained(infoMC,infoRC);
+  else {
+    printf("ERROR: AnalysisMode %d \n",fAnalysisMode);
+    return;
+  }
 }
 
 //_____________________________________________________________________________
@@ -258,11 +343,12 @@ void AliComparisonDCA::Analyse()
   //
   
   TH1::AddDirectory(kFALSE);
+  TObjArray *aFolderObj = new TObjArray;
 
+  /*
   TGraph * gr[8]= { 0,0,0,0,0,0,0,0 };
   TGraph2D *gr2[8]= { 0,0,0,0,0,0,0,0};
   AliComparisonDCA * comp=this;
-  TObjArray *aFolderObj = new TObjArray;
 
   // write results in the folder 
   // Canvas to draw analysed histograms
@@ -457,6 +543,7 @@ void AliComparisonDCA::Analyse()
   gr2[7]->GetHistogram()->SetName("DCAZMeanSPTTanTPCITS");
   aFolderObj->Add(gr2[7]->GetHistogram());
 
+  */
   // export objects to analysis folder
   fAnalysisFolder = ExportToFolder(aFolderObj);
 
index db34a0f..24d655b 100644 (file)
@@ -9,45 +9,40 @@
 // Author: J.Otwinowski 04/02/2008 
 //------------------------------------------------------------------------------
 
-class TFile;
 class AliMCInfo;
 class AliESDRecInfo;
 class AliESDEvent; 
-class AliESD;
-class AliESDfriend;
 class AliRecInfoCuts;
 class AliMCInfoCuts;
-class TH1I;
+class AliESDVertex;
 class TH3F;
 class TH3;
-class TProfile;
-class TProfile2D;
 class TString;
-class AliESDVertex;
+class TNamed;
 
-#include "TNamed.h"
+#include "THnSparse.h"
 #include "AliComparisonObject.h"
 
-//class AliComparisonDCA : public TNamed {
 class AliComparisonDCA : public AliComparisonObject {
 public :
   AliComparisonDCA(); 
+  AliComparisonDCA(Char_t* name, Char_t* title, Int_t analysisMode, Bool_t hptGenerator);
   ~AliComparisonDCA();
 
   // Init data members
   virtual void Init();
 
   // Execute analysis
-  virtual void Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  virtual void Exec(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC);
 
   // Merge output objects (needed by PROOF) 
-  virtual Long64_t Merge(TCollection* list);
+  virtual Long64_t Merge(TCollection* const list);
 
   // Analyse output histograms
   virtual void Analyse();
 
   // Get analysis folder
-  virtual TFolder* GetAnalysisFolder() {return fAnalysisFolder;}
+  virtual TFolder* GetAnalysisFolder() const {return fAnalysisFolder;}
 
   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderDCA",TString title = "Analysed DCA histograms");
@@ -56,31 +51,43 @@ public :
   TFolder *ExportToFolder(TObjArray * array=0);
 
   // Process events
-  void  Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  void  ProcessTPC(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC);
+  void  ProcessTPCITS(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC);
+  void  ProcessConstrained(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC); // not implemented
 
   // Selection cuts
-  void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}
-  void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = 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;}
 
   // getters
-  TH3F  *GetD0TanSPtTPCITS() {return fD0TanSPtTPCITS;}
-  TH3F  *GetD1TanSPtTPCITS() {return fD1TanSPtTPCITS;}
-  TH3F  *GetD0TanSPt() {return fD0TanSPt;}
-  TH3F  *GetD1TanSPt() {return fD1TanSPt;}
-  TH3F  *GetD0TanSPtTPC() {return fD0TanSPtTPC;}
-  TH3F  *GetD1TanSPtTPC() {return fD1TanSPtTPC;}
+  /*
+  TH3F  *GetD0TanSPtTPCITS() const {return fD0TanSPtTPCITS;}
+  TH3F  *GetD1TanSPtTPCITS() const {return fD1TanSPtTPCITS;}
+  TH3F  *GetD0TanSPt() const {return fD0TanSPt;}
+  TH3F  *GetD1TanSPt() const {return fD1TanSPt;}
+  TH3F  *GetD0TanSPtTPC() const {return fD0TanSPtTPC;}
+  TH3F  *GetD1TanSPtTPC() const {return fD1TanSPtTPC;}
+  */
+
+  // DCA
+  THnSparse* GetDCAHisto() const {return fDCAHisto;}
 
 private:
-  // DCA resolution
+
+  // DCA histograms
+  THnSparseF *fDCAHisto; //-> dca_r:dca_z:eta:pt 
+  /*
   TH3F  *fD0TanSPtTPCITS; //-> distance to vertex y (TPC+ITS clusters) 
   TH3F  *fD1TanSPtTPCITS; //-> distance to vertex z (TPC+ITS clusters) 
   TH3F  *fD0TanSPt;     //-> distance to vertex y  
   TH3F  *fD1TanSPt;     //-> distance to vertex z 
   TH3F  *fD0TanSPtTPC;  //-> distance to vertex y (only TPC track parameters) 
   TH3F  *fD1TanSPtTPC;  //-> distance to vertex z (only TPC track parameters)
+  */
 
   // Global cuts objects
   AliRecInfoCuts*  fCutsRC; // selection cuts for reconstructed tracks
index 175079f..060e0c2 100644 (file)
 
 */
 
-#include <iostream>
-
-#include "TFile.h"
-#include "TCint.h"
-#include "TH3F.h"
-#include "TH2F.h"
-#include "TF1.h"
-#include "TProfile.h"
-#include "TProfile2D.h"
-#include "TGraph2D.h"
 #include "TCanvas.h"
-#include "TGraph.h"
-//
 #include "AliESDEvent.h"
-#include "AliESD.h"
-#include "AliESDfriend.h"
-#include "AliESDfriendTrack.h"
 #include "AliRecInfoCuts.h" 
 #include "AliMCInfoCuts.h" 
 #include "AliLog.h" 
-//
 #include "AliMathBase.h"
 #include "AliTreeDraw.h"
-//#include "TStatToolkit.h"
 
 #include "AliMCInfo.h" 
 #include "AliESDRecInfo.h" 
@@ -72,38 +55,49 @@ AliComparisonDEdx::AliComparisonDEdx():
   AliComparisonObject("AliComparisonDEdx"),
 
   // dEdx 
-  fTPCSignalNormTan(0), 
-  fTPCSignalNormSPhi(0),
-  fTPCSignalNormTPhi(0), 
-  //
-  fTPCSignalNormTanSPhi(0),
-  fTPCSignalNormTanTPhi(0),
-  fTPCSignalNormTanSPt(0), 
+  fDeDxHisto(0),
   
   // Cuts 
   fCutsRC(0), 
   fCutsMC(0),
-  fMCPtMin(0),
-  fMCAbsTanThetaMax(0),
-  fMCPdgCode(0),
 
   // histogram folder 
   fAnalysisFolder(0)
 {
+  // default constructor       
+}
+
+//_____________________________________________________________________________
+AliComparisonDEdx::AliComparisonDEdx(Char_t* name="AliComparisonDEdx", Char_t* title="AliComparisonDEdx",Int_t analysisMode=0, Bool_t hptGenerator=kFALSE):
+  AliComparisonObject(name,title),
+
+  // dEdx 
+  fDeDxHisto(0),
+  
+  // Cuts 
+  fCutsRC(0), 
+  fCutsMC(0),
+
+  // histogram folder 
+  fAnalysisFolder(0)
+{
+  // named constructor
+
+  SetAnalysisMode(analysisMode);
+  SetHptGenerator(hptGenerator);
   Init();
 }
 
+
 //_____________________________________________________________________________
-AliComparisonDEdx::~AliComparisonDEdx(){
-   
-  if(fTPCSignalNormTan)  delete fTPCSignalNormTan; fTPCSignalNormTan=0; 
-  if(fTPCSignalNormSPhi) delete fTPCSignalNormSPhi; fTPCSignalNormSPhi=0;
-  if(fTPCSignalNormTPhi) delete fTPCSignalNormTPhi; fTPCSignalNormTPhi=0;
-  //
-  if(fTPCSignalNormTanSPhi) delete fTPCSignalNormTanSPhi; fTPCSignalNormTanSPhi=0;
-  if(fTPCSignalNormTanTPhi) delete fTPCSignalNormTanTPhi; fTPCSignalNormTanTPhi=0;
-  if(fTPCSignalNormTanSPt)  delete fTPCSignalNormTanSPt; fTPCSignalNormTanSPt=0;
+AliComparisonDEdx::~AliComparisonDEdx()
+{
+  // destructor
+  if(fDeDxHisto)  delete fDeDxHisto; fDeDxHisto=0; 
 
+  if(fCutsRC) delete fCutsRC; fCutsRC=0;
+  if(fCutsMC) delete fCutsMC; fCutsMC=0;
+  
   if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
 }
 
@@ -113,92 +107,99 @@ void AliComparisonDEdx::Init()
   // Init histograms
   
   // TPC dEdx
-  fTPCSignalNormTan = new TH2F("CdEdxTan","CdEdxTan",50, -2,2,  40,30,70); 
-  fTPCSignalNormTan->SetXTitle("tan(#theta)");
-  fTPCSignalNormTan->SetYTitle("rec. dE/dx / calc. dE/dx");
-
-  fTPCSignalNormSPhi   = new TH2F("CdEdxSPhi","CdEdxSPhi",10,0.0,1,40,30,70);
-  fTPCSignalNormSPhi->SetXTitle("sin(#phi)");
-  fTPCSignalNormSPhi->SetYTitle("rec. dE/dx / calc. dE/dx");
-
-  fTPCSignalNormTPhi   = new TH2F("CdEdxTPhi","CdEdxTPhi",10,0.0,2,40,30,70); 
-  fTPCSignalNormTPhi->SetXTitle("tan(#phi)");
-  fTPCSignalNormTPhi->SetYTitle("rec. dE/dx / calc. dE/dx");
-
-  fTPCSignalNormTanSPhi= new TH3F("CdEdxTanSPhi","CdEdxTanSPhi",20, -2,2, 10,0.0 ,1,  40,30,70);
-  fTPCSignalNormTanSPhi->SetXTitle("tan(#theta)");
-  fTPCSignalNormTanSPhi->SetYTitle("sin(#phi)");
-  fTPCSignalNormTanSPhi->SetZTitle("rec. dE/dx / calc. dE/dx");
-
-  fTPCSignalNormTanTPhi= new TH3F("CdEdxTanTPhi","CdEdxTanTPhi",20, -2,2, 10,0.0 ,1,  40,30,70);
-  fTPCSignalNormTanTPhi->SetXTitle("tan(#theta)");
-  fTPCSignalNormTanTPhi->SetYTitle("tan(#phi)");
-  fTPCSignalNormTanTPhi->SetZTitle("rec. dE/dx / calc. dE/dx");
-
-  fTPCSignalNormTanSPt= new TH3F("CdEdxTanSPt","CdEdxTanSPt",20, -2,2, 10,0.3 ,3, 40,30,70); 
-  fTPCSignalNormTanSPt->SetXTitle("tan(#theta)");
-  fTPCSignalNormTanSPt->SetYTitle("#sqrt{p_{t}}");
-  fTPCSignalNormTanSPt->SetZTitle("rec. dE/dx / calc. dE/dx");
-
-  // Init cuts
-  if(!fCutsMC) 
-    AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
-  if(!fCutsRC) 
-    AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
-
-    // init folder
-    fAnalysisFolder = CreateFolder("folderDEdx","Analysis de/dx Folder");
+  Int_t nPBins = 31;
+    Double_t binsP[32] = {0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,2.25,2.5,2.75,3.,3.5,4.,5.,6.,8.,10.};
+    Double_t pMin = 0., pMax = 10.;
+
+    if(IsHptGenerator() == kTRUE) {
+      nPBins = 100;
+      pMin = 0.; pMax = 100.;
+    }
+
+   //signal:alpha:y:z:snp:tgl:ncls:pid:p
+   Int_t binsQA[9]    = {600,50, 50,  50, 50, 50, 80, 5, nPBins};
+   Double_t xminQA[9] = {0,  -4,-20,-250, -1, -2, 0, 0., pMin};
+   Double_t xmaxQA[9] = {300, 4, 20, 250,  1,  2, 160, 5., pMax};
+
+   fDeDxHisto = new THnSparseF("fDeDxHisto","signal:alpha:y:z:snp:tgl:ncls:pid:momentum",9,binsQA,xminQA,xmaxQA);
+   if(!IsHptGenerator()) fDeDxHisto->SetBinEdges(8,binsP);
+
+   fDeDxHisto->GetAxis(0)->SetTitle("signal");
+   fDeDxHisto->GetAxis(1)->SetTitle("alpha (rad)");
+   fDeDxHisto->GetAxis(2)->SetTitle("y (cm)");
+   fDeDxHisto->GetAxis(3)->SetTitle("z (cm)");
+   fDeDxHisto->GetAxis(4)->SetTitle("snp");
+   fDeDxHisto->GetAxis(5)->SetTitle("tgl");
+   fDeDxHisto->GetAxis(6)->SetTitle("ncls");
+   fDeDxHisto->GetAxis(6)->SetTitle("pid");
+   fDeDxHisto->GetAxis(7)->SetTitle("p (GeV/c)");
+   fDeDxHisto->Sumw2();
+
+   // Init cuts
+   if(!fCutsMC) 
+     AliDebug(AliLog::kError, "ERROR: Cannot find AliMCInfoCuts object");
+   if(!fCutsRC) 
+     AliDebug(AliLog::kError, "ERROR: Cannot find AliRecInfoCuts object");
+
+   // init folder
+   fAnalysisFolder = CreateFolder("folderDEdx","Analysis de/dx Folder");
 }
 
 //_____________________________________________________________________________
-void AliComparisonDEdx::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
-
+void AliComparisonDEdx::ProcessTPC(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC)
+{
   // Fill dE/dx  comparison information
   
-  Float_t mcpt = infoMC->GetParticle().Pt();
-  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
-  Float_t mprim = infoMC->GetPrim();
-
-  // distance to Prim. vertex 
-  const Double_t* dv = infoMC->GetVDist(); 
-
-  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
-  
   // Check selection cuts 
   if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; 
-  if (!isPrim) return;
-  if (infoRC->GetStatus(1)!=3) return;
+  Double_t pid = -1;
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetEM() ) pid = 0;
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetMuM() ) pid = 1;
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetPiP() ) pid = 2;
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetKP() ) pid = 3;
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetProt() ) pid = 4;
+
   if (!infoRC->GetESDtrack()) return;  
   if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
-  if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
-  //if (mprim>1.4) return;
-  //if (mprim<0.5) return;
-  if (mprim > fCutsMC->GetMaxTPCSignal()) return;
-  if (mprim < fCutsMC->GetMinTPCSignal()) return;
-  if (infoRC->GetESDtrack()->GetTPCsignalN()<fCutsRC->GetMinTPCsignalN()) return;
-  //
-  Float_t ratio = infoRC->GetESDtrack()->GetTPCsignal()/infoMC->GetPrim();
-  Float_t sphi =  infoRC->GetESDtrack()->GetInnerParam()->GetSnp();
-  Float_t tphi =  sphi/TMath::Sqrt((1.-sphi)*(1.+sphi));
-
-  if (TMath::Abs(infoMC->GetParticle().GetPdgCode()) != GetMCPdgCode()) return;
-  //if (mcpt>0.5) {
-  if (mcpt > GetMCPtMin()) {
-    fTPCSignalNormTan->Fill(tantheta,ratio);    // only subset
-  }
 
-  //if (TMath::Abs(tantheta)<0.5){
-  if (TMath::Abs(tantheta) < GetMCAbsTanThetaMax()){
-    fTPCSignalNormSPhi->Fill(sphi,ratio);       // only subset
-    fTPCSignalNormTPhi->Fill(tphi,ratio);       // only subset
-  }
-  fTPCSignalNormTanSPhi->Fill(tantheta,sphi,ratio);    
-  fTPCSignalNormTanTPhi->Fill(tantheta,tphi,ratio);    
-  fTPCSignalNormTanSPt->Fill(tantheta,TMath::Sqrt(mcpt),ratio);
+  Float_t dedx = infoRC->GetESDtrack()->GetTPCsignal();
+  Int_t ncls = infoRC->GetESDtrack()->GetTPCNcls();
+
+  const AliExternalTrackParam *innerParam =  0;
+  if ((innerParam = infoRC->GetESDtrack()->GetInnerParam()) == 0) return;
+
+  Double_t pt = innerParam->Pt();
+  Double_t lam = TMath::ATan2(innerParam->Pz(),innerParam->Pt());
+  Double_t p = pt/TMath::Cos(lam);
+  Double_t alpha = innerParam->GetAlpha();
+  Double_t y = innerParam->GetY();
+  Double_t z = innerParam->GetZ();
+  Double_t snp = innerParam->GetSnp();
+  Double_t tgl = innerParam->GetTgl();
+
+  Double_t vDeDxHisto[9] = {dedx,alpha,y,z,snp,tgl,ncls,pid,p};
+  fDeDxHisto->Fill(vDeDxHisto); 
+}
+
+//_____________________________________________________________________________
+void AliComparisonDEdx::ProcessTPCITS(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC)
+{
+  // Fill dE/dx  comparison information
+  
+   AliDebug(AliLog::kWarning, "Warning: Not implemented");
 }
 
 //_____________________________________________________________________________
-Long64_t AliComparisonDEdx::Merge(TCollection* list) 
+void AliComparisonDEdx::ProcessConstrained(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC)
+{
+  // Fill dE/dx  comparison information
+  
+   AliDebug(AliLog::kWarning, "Warning: Not implemented");
+}
+
+//_____________________________________________________________________________
+Long64_t AliComparisonDEdx::Merge(TCollection* const list) 
 {
   // Merge list of objects (needed by PROOF)
 
@@ -218,14 +219,7 @@ Long64_t AliComparisonDEdx::Merge(TCollection* list)
     AliComparisonDEdx* entry = dynamic_cast<AliComparisonDEdx*>(obj);
     if (entry == 0) continue;
 
-    fTPCSignalNormTan->Add(entry->fTPCSignalNormTan);
-    fTPCSignalNormSPhi->Add(entry->fTPCSignalNormSPhi);
-    fTPCSignalNormTPhi->Add(entry->fTPCSignalNormTPhi);
-    //
-    fTPCSignalNormTanSPhi->Add(entry->fTPCSignalNormTanSPhi);
-    fTPCSignalNormTanTPhi->Add(entry->fTPCSignalNormTanTPhi);
-    fTPCSignalNormTanSPt->Add(entry->fTPCSignalNormTanSPt);
-
+    fDeDxHisto->Add(entry->fDeDxHisto);
     count++;
   }
 
@@ -233,10 +227,17 @@ return count;
 }
 
 //_____________________________________________________________________________
-void AliComparisonDEdx::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
+void AliComparisonDEdx::Exec(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC)
 {
   // Process comparison information
-  Process(infoMC,infoRC);
+
+  if(GetAnalysisMode() == 0) ProcessTPC(infoMC,infoRC);
+  else if(GetAnalysisMode() == 1) ProcessTPCITS(infoMC,infoRC);
+  else if(GetAnalysisMode() == 2) ProcessConstrained(infoMC,infoRC);
+  else {
+    printf("ERROR: AnalysisMode %d \n",fAnalysisMode);
+    return;
+  }
 }
 
 //_____________________________________________________________________________
@@ -257,12 +258,10 @@ void AliComparisonDEdx::Analyse()
   // Analyze comparison information and store output histograms
   // in the folder "folderDEdx"
   //
-
   TH1::AddDirectory(kFALSE);
-  
-  AliComparisonDEdx * comp=this;
   TObjArray *aFolderObj = new TObjArray;
 
+  /*
   TH1F *hiss=0;
   TGraph2D * gr=0;
 
@@ -305,6 +304,7 @@ void AliComparisonDEdx::Analyse()
 
   gr->GetHistogram()->SetName("TPCdEdxMeanTanPt_2");
   aFolderObj->Add(gr->GetHistogram());
+  */
 
   // export objects to analysis folder
   fAnalysisFolder = ExportToFolder(aFolderObj);
index 1b40d8b..0185141 100644 (file)
@@ -8,46 +8,38 @@
 // Author: J.Otwinowski 04/02/2008 
 //------------------------------------------------------------------------------
 
-class TFile;
 class AliMCInfo;
 class AliESDRecInfo;
 class AliESDEvent; 
-class AliESD;
-class AliESDfriend;
 class AliRecInfoCuts;
 class AliMCInfoCuts;
-class TH1I;
-class TH3F;
-class TH3;
-class TProfile;
-class TProfile2D;
-class TGraph2D;
-class TGraph; 
 class TString;
+class TNamed;
+class TCanvas;
 
-#include "TNamed.h"
+#include "THnSparse.h"
 #include "AliComparisonObject.h"
 
-//class AliComparisonDEdx : public TNamed {
 class AliComparisonDEdx : public AliComparisonObject {
 public :
   AliComparisonDEdx(); 
+  AliComparisonDEdx(Char_t* name, Char_t* title, Int_t analysisMode, Bool_t hptGenerator);
   ~AliComparisonDEdx();
 
   // Init data members
   virtual void Init();
 
   // Execute analysis
-  virtual void Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  virtual void Exec(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC);
 
   // Merge output objects (needed by PROOF) 
-  virtual Long64_t Merge(TCollection* list);
+  virtual Long64_t Merge(TCollection* const list);
 
   // Analyse output histograms
   virtual void Analyse();
 
   // Get analysis folder
-  virtual TFolder* GetAnalysisFolder() {return fAnalysisFolder;}
+  virtual TFolder* GetAnalysisFolder() const {return fAnalysisFolder;}
 
   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderDEdx",TString title = "Analysed DEdx histograms");
@@ -56,54 +48,33 @@ public :
   TFolder *ExportToFolder(TObjArray * array=0);
 
   // Process events
-  void      Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  void  ProcessTPC(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC);
+  void  ProcessTPCITS(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC); // not implemented
+  void  ProcessConstrained(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC); // not implemented
 
   // Selection cuts
-  void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}
-  void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0)   {fCutsMC = cuts;} 
-
-  void SetMCPtMin(const Float_t cuts=0) {fMCPtMin = cuts;} 
-  void SetMCAbsTanThetaMax(const Float_t cuts=1e99) {fMCAbsTanThetaMax = cuts;} 
-  void SetMCPdgCode(const Int_t cuts=0) {fMCPdgCode = 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;}     
-  Float_t GetMCPtMin() const {return fMCPtMin;}
-  Float_t GetMCAbsTanThetaMax() const {return fMCAbsTanThetaMax;}
-  Int_t GetMCPdgCode() const {return fMCPdgCode;} 
 
   static TH1F*     MakeResol(TH2F * his, Int_t integ, Bool_t type); 
 
   //
   // TPC dE/dx 
-  TH2F* GetTPCSignalNormTan() {return fTPCSignalNormTan;}
-  TH2F* GetTPCSignalNormSPhi() {return fTPCSignalNormSPhi;}
-  TH2F* GetTPCSignalNormTPhi() {return fTPCSignalNormTPhi;}
   //
-  TH3F* GetTPCSignalNormTanSPhi() {return fTPCSignalNormTanSPhi;}
-  TH3F* GetTPCSignalNormTanTPhi() {return fTPCSignalNormTanTPhi;}
-  TH3F* GetTPCSignalNormTanSPt() {return fTPCSignalNormTanSPt;}
-  
+  THnSparse* GetDeDxHisto() const {return fDeDxHisto;}
 
 private:
 
   // TPC dE/dx 
-  TH2F* fTPCSignalNormTan;    //-> TPC signal normalized to the calculated MC signal 
-  TH2F* fTPCSignalNormSPhi;   //-> TPC signal normalized to the calculated MC signal
-  TH2F* fTPCSignalNormTPhi;   //-> TPC signal normalized to the calculated MC signal
-  //
-  TH3F* fTPCSignalNormTanSPhi;   //-> TPC signal normalized to the calculated MC signal
-  TH3F* fTPCSignalNormTanTPhi;   //-> TPC signal normalized to the calculated MC signal
-  TH3F* fTPCSignalNormTanSPt;    //-> TPC signal normalized to the calculated MC signal
+  THnSparseF *fDeDxHisto; //-> signal:alpha:y:z:snp:tgl:ncls:pid:p
   
   // Selection cuts
   AliRecInfoCuts*  fCutsRC; // selection cuts for reconstructed tracks
   AliMCInfoCuts*   fCutsMC; // selection cuts for MC tracks
 
-  Float_t fMCPtMin;               // min. MC pt cut
-  Float_t fMCAbsTanThetaMax;      // max. MC abs[tan(theta)] cut
-  Int_t fMCPdgCode;               // selected particle with Pdg code
-
   // analysis folder 
   TFolder *fAnalysisFolder; // folder for analysed histograms
 
index e769ed6..7e5db4a 100644 (file)
 \r
 */\r
 \r
-\r
-#include <iostream>\r
-\r
-#include "TFile.h"\r
-#include "TCint.h"\r
-#include "TH3F.h"\r
-#include "TH2F.h"\r
-#include "TF1.h"\r
-#include "TProfile.h"\r
-#include "TProfile2D.h"\r
-#include "TGraph2D.h"\r
-#include "TCanvas.h"\r
-#include "TGraph.h"\r
 // \r
-#include "AliESDEvent.h"  \r
-#include "AliESD.h"\r
-#include "AliESDfriend.h"\r
-#include "AliESDfriendTrack.h"\r
+#include "AliESDtrack.h"\r
 #include "AliRecInfoCuts.h" \r
 #include "AliMCInfoCuts.h" \r
 #include "AliLog.h" \r
-//\r
-#include "AliMathBase.h"\r
-#include "AliTreeDraw.h" \r
-#include "AliMagF.h" \r
 #include "AliESDVertex.h" \r
 #include "AliExternalTrackParam.h" \r
 #include "AliTracker.h" \r
-\r
 #include "AliMCInfo.h" \r
 #include "AliESDRecInfo.h" \r
 #include "AliComparisonEff.h" \r
 \r
 using namespace std;\r
 \r
-\r
 ClassImp(AliComparisonEff)\r
 \r
 //_____________________________________________________________________________\r
@@ -77,276 +55,84 @@ AliComparisonEff::AliComparisonEff():
 \r
   // histograms\r
  \r
-  fMCPt(0),\r
-  fMCRecPt(0),\r
-  fMCRecPrimPt(0),\r
-  fMCRecSecPt(0),\r
-\r
-  fEffTPCPt(0),\r
-  fEffTPCPtMC(0),\r
-  fEffTPCPtF(0),\r
-  //\r
-  fEffTPCPt_P(0),\r
-  fEffTPCPtMC_P(0),\r
-  fEffTPCPtF_P(0),\r
-  //\r
-  fEffTPCPt_Pi(0),\r
-  fEffTPCPtMC_Pi(0),\r
-  fEffTPCPtF_Pi(0),\r
-  //\r
-  fEffTPCPt_K(0),\r
-  fEffTPCPtMC_K(0),\r
-  fEffTPCPtF_K(0),\r
\r
-  fEffTPCTan(0),\r
-  fEffTPCTanMC(0),\r
-  fEffTPCTanF(0),\r
-  //\r
-  fEffTPCPtTan(0),\r
-  fEffTPCPtTanMC(0),\r
-  fEffTPCPtTanF(0),\r
-  // TPC+ITS\r
-  fEffTPCITSPt(0),\r
-  fEffTPCITSTan(0),\r
+  fEffHisto(0),\r
 \r
   // Cuts \r
   fCutsRC(0), \r
   fCutsMC(0),\r
 \r
-  fVertex(0),\r
-\r
   // histogram folder \r
   fAnalysisFolder(0)\r
 {\r
-  // init vertex\r
-  fVertex = new AliESDVertex();\r
-  fVertex->SetXv(0.0); fVertex->SetYv(0.0); fVertex->SetZv(0.0); \r
+  // default consttructor      \r
+}\r
 \r
-  for(Int_t i=0; i<4; ++i)\r
-  {\r
-    fTPCPtDCASigmaIdeal[i]=0;\r
-    fTPCPtDCASigmaFull[i]=0;\r
-    fTPCPtDCASigmaDay0[i]=0;\r
+//_____________________________________________________________________________\r
+AliComparisonEff::AliComparisonEff(Char_t* name="AliComparisonEff",Char_t*title="AliComparisonEff",Int_t analysisMode=0, Bool_t hptGenerator=kFALSE):\r
+  AliComparisonObject(name,title),\r
 \r
-    fTPCPtDCAXY[i]=0;\r
-    fTPCPtDCAZ[i]=0;\r
+  // histograms\r
+  fEffHisto(0),\r
 \r
-       fTPCPtDCASigmaIdealPid[i]=0;\r
-       fTPCPtDCASigmaFullPid[i]=0;\r
-       fTPCPtDCASigmaDay0Pid[i]=0;\r
+  // Cuts \r
+  fCutsRC(0), \r
+  fCutsMC(0),\r
 \r
-       fTPCPtDCAXYPid[i]=0;   \r
-       fTPCPtDCAZPid[i]=0; \r
-  }\r
+  // histogram folder \r
+  fAnalysisFolder(0)\r
+{\r
+  // named constructor\r
+  //\r
+  SetAnalysisMode(analysisMode);\r
+  SetHptGenerator(hptGenerator);\r
 \r
   Init();\r
 }\r
 \r
-//_____________________________________________________________________________\r
-AliComparisonEff::~AliComparisonEff(){\r
-\r
-  // \r
-  if(fMCPt)  delete  fMCPt; fMCPt=0;\r
-  if(fMCRecPt)  delete  fMCRecPt; fMCRecPt=0;\r
-  if(fMCRecPrimPt)  delete  fMCRecPrimPt; fMCRecPrimPt=0;\r
-  if(fMCRecSecPt)  delete  fMCRecSecPt; fMCRecSecPt=0;\r
-\r
-  // \r
-  if(fEffTPCPt)   delete  fEffTPCPt;   fEffTPCPt=0;\r
-  if(fEffTPCPtMC) delete  fEffTPCPtMC; fEffTPCPtMC=0;\r
-  if(fEffTPCPtF)  delete  fEffTPCPtF;  fEffTPCPtF=0;\r
-\r
-  // \r
-  if(fEffTPCPt_P)   delete  fEffTPCPt_P;   fEffTPCPt_P=0;\r
-  if(fEffTPCPtMC_P) delete  fEffTPCPtMC_P; fEffTPCPtMC_P=0;\r
-  if(fEffTPCPtF_P)  delete  fEffTPCPtF_P;  fEffTPCPtF_P=0;\r
-\r
-  // \r
-  if(fEffTPCPt_Pi)   delete  fEffTPCPt_Pi;   fEffTPCPt_Pi=0;\r
-  if(fEffTPCPtMC_Pi) delete  fEffTPCPtMC_Pi; fEffTPCPtMC_Pi=0;\r
-  if(fEffTPCPtF_Pi)  delete  fEffTPCPtF_Pi;  fEffTPCPtF_Pi=0;\r
-\r
-  // \r
-  if(fEffTPCPt_K)   delete  fEffTPCPt_K;   fEffTPCPt_K=0;\r
-  if(fEffTPCPtMC_K) delete  fEffTPCPtMC_K; fEffTPCPtMC_K=0;\r
-  if(fEffTPCPtF_K)  delete  fEffTPCPtF_K;  fEffTPCPtF_K=0;\r
-\r
-  // \r
-  if(fEffTPCTan)   delete  fEffTPCTan;   fEffTPCTan=0;\r
-  if(fEffTPCTanMC) delete  fEffTPCTanMC; fEffTPCTanMC=0;\r
-  if(fEffTPCTanF)  delete  fEffTPCTanF;  fEffTPCTanF=0;\r
-\r
-  //\r
-  if(fEffTPCPtTan)   delete  fEffTPCPtTan;   fEffTPCPtTan=0;\r
-  if(fEffTPCPtTanMC) delete  fEffTPCPtTanMC; fEffTPCPtTanMC=0;\r
-  if(fEffTPCPtTanF)  delete  fEffTPCPtTanF;  fEffTPCPtTanF=0;\r
-\r
-  if(fEffTPCITSPt)   delete  fEffTPCITSPt;   fEffTPCITSPt=0;\r
-  if(fEffTPCITSTan)   delete  fEffTPCITSTan;   fEffTPCITSTan=0;\r
-\r
-  for(Int_t i=0; i<4; ++i)\r
-  {\r
-    if(fTPCPtDCASigmaIdeal[i]) delete  fTPCPtDCASigmaIdeal[i];  fTPCPtDCASigmaIdeal[i]=0;\r
-    if(fTPCPtDCASigmaFull[i]) delete  fTPCPtDCASigmaFull[i];  fTPCPtDCASigmaFull[i]=0;\r
-    if(fTPCPtDCASigmaDay0[i]) delete  fTPCPtDCASigmaDay0[i];  fTPCPtDCASigmaDay0[i]=0;\r
 \r
-    if(fTPCPtDCAXY[i]) delete  fTPCPtDCAXY[i];  fTPCPtDCAXY[i]=0;\r
-    if(fTPCPtDCAZ[i]) delete  fTPCPtDCAZ[i];  fTPCPtDCAZ[i]=0;\r
+//_____________________________________________________________________________\r
+AliComparisonEff::~AliComparisonEff()\r
+{\r
+// destructor\r
 \r
-       if(fTPCPtDCASigmaIdealPid[i]) delete  fTPCPtDCASigmaIdealPid[i];  fTPCPtDCASigmaIdealPid[i]=0;\r
-       if(fTPCPtDCASigmaFullPid[i]) delete  fTPCPtDCASigmaFullPid[i];  fTPCPtDCASigmaFullPid[i]=0;\r
-       if(fTPCPtDCASigmaDay0Pid[i]) delete  fTPCPtDCASigmaDay0Pid[i];  fTPCPtDCASigmaDay0Pid[i]=0;\r
+  if(fEffHisto)  delete  fEffHisto; fEffHisto=0;\r
 \r
-       if(fTPCPtDCAXYPid[i]) delete  fTPCPtDCAXYPid[i]; fTPCPtDCAXYPid[i]=0;\r
-       if(fTPCPtDCAZPid[i]) delete   fTPCPtDCAZPid[i];  fTPCPtDCAZPid[i]=0;\r
-  }\r
+  if(fCutsRC) delete fCutsRC; fCutsRC=0;\r
+  if(fCutsMC) delete fCutsMC; fCutsMC=0;\r
 \r
   if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;\r
 }\r
 \r
 //_____________________________________________________________________________\r
-void AliComparisonEff::Init(){\r
-\r
+void AliComparisonEff::Init()\r
+{\r
   // Init histograms\r
   //\r
-  fMCPt = new TH1F("fMCPt","fMCPt",50,0.1,3);           \r
-  fMCPt->SetXTitle("p_{t}");\r
-  fMCPt->SetYTitle("yield");\r
-\r
-  fMCRecPt = new TH1F("fMCRecPt","fMCRecPt",50,0.1,3);           \r
-  fMCRecPt->SetXTitle("p_{t}");\r
-  fMCRecPt->SetYTitle("yield");\r
-\r
-  fMCRecPrimPt = new TH1F("fMCRecPrimPt","fMCRecPrimPt",50,0.1,3);           \r
-  fMCRecPrimPt->SetXTitle("p_{t}");\r
-  fMCRecPrimPt->SetYTitle("yield");\r
-\r
-  fMCRecSecPt = new TH1F("fMCRecSecPt","fMCRecSecPt",50,0.1,3);           \r
-  fMCRecSecPt->SetXTitle("p_{t}");\r
-  fMCRecSecPt->SetYTitle("yield");\r
-\r
-  // Efficiency as function of pt\r
-  fEffTPCPt = new TProfile("Eff_pt","Eff_Pt",50,0.1,3);           \r
-  fEffTPCPt->SetXTitle("p_{t}");\r
-  fEffTPCPt->SetYTitle("TPC Efficiency");\r
-\r
-// Efficiency as function of pt (TPC+ITS)\r
-  fEffTPCITSPt = new TProfile("Eff_pt_TPCITS","Eff_Pt_TPCITS",50,0.1,3);           \r
-  fEffTPCITSPt->SetXTitle("p_{t}");\r
-  fEffTPCITSPt->SetYTitle("TPCITS Efficiency");\r
-\r
-\r
-  fEffTPCPtMC = new TProfile("MC_Eff_pt","MC_Eff_Pt",50,0.1,3);   \r
-  fEffTPCPtMC->SetXTitle("p_{t}");\r
-  fEffTPCPtMC->SetYTitle("MC TPC Efficiency");\r
-\r
-  fEffTPCPtF = new TProfile("F_Eff_pt","F_Eff_Pt",50,0.1,3);     \r
-  fEffTPCPtF->SetXTitle("p_{t}");\r
-  fEffTPCPtF->SetYTitle("TPC Findable Efficiency");\r
-\r
-  // Efficiency as function of pt protons\r
-  fEffTPCPt_P = new TProfile("Eff_pt_P","Eff_Pt_P",50,0.1,3);           \r
-  fEffTPCPt_P->SetXTitle("p_{t}");\r
-  fEffTPCPt_P->SetYTitle("TPC Efficiency");\r
-\r
-  fEffTPCPtMC_P = new TProfile("MC_Eff_pt_P","MC_Eff_Pt_P",50,0.1,3);   \r
-  fEffTPCPtMC_P->SetXTitle("p_{t}");\r
-  fEffTPCPtMC_P->SetYTitle("MC TPC Efficiency");\r
-\r
-  fEffTPCPtF_P = new TProfile("F_Eff_pt_P","F_Eff_Pt_P",50,0.1,3);     \r
-  fEffTPCPtF_P->SetXTitle("p_{t}");\r
-  fEffTPCPtF_P->SetYTitle("TPC Findable Efficiency");\r
-\r
-  // Efficiency as function of pt pions\r
-  fEffTPCPt_Pi = new TProfile("Eff_pt_Pi","Eff_Pit_Pi",50,0.1,3);           \r
-  fEffTPCPt_Pi->SetXTitle("p_{t}");\r
-  fEffTPCPt_Pi->SetYTitle("TPC Efficiency");\r
-\r
-  fEffTPCPtMC_Pi = new TProfile("MC_Eff_pt_Pi","MC_Eff_Pit_Pi",50,0.1,3);   \r
-  fEffTPCPtMC_Pi->SetXTitle("p_{t}");\r
-  fEffTPCPtMC_Pi->SetYTitle("MC TPC Efficiency");\r
-\r
-  fEffTPCPtF_Pi = new TProfile("F_Eff_pt_Pi","F_Eff_Pit_Pi",50,0.1,3);     \r
-  fEffTPCPtF_Pi->SetXTitle("p_{t}");\r
-  fEffTPCPtF_Pi->SetYTitle("TPC Findable Efficiency");\r
-\r
-  // Efficiency as function of pt kaons\r
-  fEffTPCPt_K = new TProfile("Eff_pt_K","Eff_Kt_K",50,0.1,3);           \r
-  fEffTPCPt_K->SetXTitle("p_{t}");\r
-  fEffTPCPt_K->SetYTitle("TPC Efficiency");\r
-\r
-  fEffTPCPtMC_K = new TProfile("MC_Eff_pt_K","MC_Eff_Kt_K",50,0.1,3);   \r
-  fEffTPCPtMC_K->SetXTitle("p_{t}");\r
-  fEffTPCPtMC_K->SetYTitle("MC TPC Efficiency");\r
-\r
-  fEffTPCPtF_K = new TProfile("F_Eff_pt_K","F_Eff_Kt_K",50,0.1,3);     \r
-  fEffTPCPtF_K->SetXTitle("p_{t}");\r
-  fEffTPCPtF_K->SetYTitle("TPC Findable Efficiency");\r
-\r
-  // Efficiency as function of tan(theta) \r
-  fEffTPCTan = new TProfile("Eff_tan","Eff_tan",50,-2.5,2.5);         \r
-  fEffTPCTan->SetXTitle("tan(#theta)");\r
-  fEffTPCTan->SetYTitle("TPC Efficiency");\r
-\r
-// Efficiency as function of tan(theta) (TPC+ITS)\r
-  fEffTPCITSTan = new TProfile("Eff_tan_TPCITS","Eff_tan_TPCITS",50,-2.5,2.5);         \r
-  fEffTPCITSTan->SetXTitle("tan(#theta)");\r
-  fEffTPCITSTan->SetYTitle("TPCITS Efficiency");\r
-\r
-\r
-  fEffTPCTanMC = new TProfile("MC_Eff_tan","MC_Eff_tan",50,-2.5,2.5); \r
-  fEffTPCTanMC->SetXTitle("tan(#theta)");\r
-  fEffTPCTanMC->SetYTitle("MC TPC Efficiency");\r
-\r
-  fEffTPCTanF = new TProfile("F_Eff_tan","F_Eff_tan",50,-2.5,2.5);   \r
-  fEffTPCPtF->SetXTitle("tan(#theta)");\r
-  fEffTPCPtF->SetYTitle("TPC Findable Efficiency");\r
-\r
-  // Efficiency as function of pt and tan(theta) \r
-  fEffTPCPtTan = new TProfile2D("Eff_pt_tan","Eff_Pt_tan",10,0.1,3,20,-2.,2.);\r
-  fEffTPCPtTan->SetXTitle("tan(#theta)");\r
-  fEffTPCPtTan->SetYTitle("p_{t}");\r
-\r
-  fEffTPCPtTanMC = new TProfile2D("MC_Eff_pt_tan_MC","MC Eff Pt",10,0.1,3,20,-2.,2.);\r
-  fEffTPCPtTanMC->SetXTitle("tan(#theta)");\r
-  fEffTPCPtTanMC->SetYTitle("p_{t}");\r
-\r
-  fEffTPCPtTanF = new TProfile2D("MC_Eff_pt_tan_F","MC Eff Pt",10,0.1,3,20,-2.,2.);\r
-  fEffTPCPtTanF->SetXTitle("tan(#theta)");\r
-  fEffTPCPtTanF->SetYTitle("p_{t}");\r
-\r
-  char name[256];\r
-  for(Int_t i=0; i<4; ++i)\r
-  {\r
-    sprintf(name, "fTPCPtDCASigmaIdeal_%d",i);\r
-    fTPCPtDCASigmaIdeal[i] = new TH2F(name,name,50,0.1,3,100,0,100);\r
-\r
-    sprintf(name, "fTPCPtDCASigmaFull_%d",i);\r
-    fTPCPtDCASigmaFull[i] = new TH2F(name,name,50,0.1,3,100,0,100);\r
+  Int_t nPtBins = 31;\r
+  Double_t binsPt[32] = {0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,2.25,2.5,2.75,3.,3.5,4.,5.,6.,8.,10.};\r
+  Double_t ptMin = 0., ptMax = 10.;\r
 \r
-    sprintf(name, "fTPCPtDCASigmaDay0_%d",i);\r
-    fTPCPtDCASigmaDay0[i] = new TH2F(name,name,50,0.1,3,100,0,100);\r
-\r
-    sprintf(name, "fTPCPtDCAXY_%d",i);\r
-    fTPCPtDCAXY[i]= new TH2F(name,name,50,0.1,3,100,0,100);\r
-    sprintf(name, "fTPCPtDCAZ_%d",i);\r
-    fTPCPtDCAZ[i]= new TH2F(name,name,50,0.1,3,100,0,100);\r
-\r
-    sprintf(name, "fTPCPtDCASigmaIdealPid_%d",i);\r
-       fTPCPtDCASigmaIdealPid[i] = new TH3F(name,name,50,0.1,3,100,0,100,5,0,5);\r
-\r
-    sprintf(name, "fTPCPtDCASigmaFullPid_%d",i);\r
-       fTPCPtDCASigmaFullPid[i]= new TH3F(name,name,50,0.1,3,100,0,100,5,0,5);\r
+  if(IsHptGenerator() == kTRUE) {\r
+    nPtBins = 100;\r
+    ptMin = 0.; ptMax = 100.;\r
+  }\r
 \r
-    sprintf(name, "fTPCPtDCASigmaDay0Pid_%d",i);\r
-       fTPCPtDCASigmaDay0Pid[i]= new TH3F(name,name,50,0.1,3,100,0,100,5,0,5);\r
+  //mceta:mcphi:mcpt:pid:isPrim:recStatus:findable\r
+  Int_t binsEffHisto[7]={30,144,nPtBins,5,2,2,2};\r
+  Double_t minEffHisto[7]={-1.5,0.,ptMin,0.,0.,0.,0.};\r
+  Double_t maxEffHisto[7]={ 1.5,2.*TMath::Pi(), ptMax,5.,2.,2.,2.};\r
 \r
-    sprintf(name, "fTPCPtDCAXYPid_%d",i);\r
-       fTPCPtDCAXYPid[i]= new TH3F(name,name,50,0.1,3,100,0,100,5,0,5);\r
+  fEffHisto = new THnSparseF("fEffHisto","mceta:mcphi:mcpt:pid:isPrim:recStatus:findable",7,binsEffHisto,minEffHisto,maxEffHisto);\r
+  if(!IsHptGenerator()) fEffHisto->SetBinEdges(2,binsPt);\r
 \r
-    sprintf(name, "fTPCPtDCAZPid_%d",i);\r
-       fTPCPtDCAZPid[i]= new TH3F(name,name,50,0.1,3,100,0,100,5,0,5);\r
-  }\r
+  fEffHisto->GetAxis(0)->SetTitle("eta");\r
+  fEffHisto->GetAxis(1)->SetTitle("phi (rad)");\r
+  fEffHisto->GetAxis(2)->SetTitle("pt (GeV/c)");\r
+  fEffHisto->GetAxis(3)->SetTitle("pid");\r
+  fEffHisto->GetAxis(4)->SetTitle("isPrim");\r
+  fEffHisto->GetAxis(5)->SetTitle("recStatus");\r
+  fEffHisto->GetAxis(6)->SetTitle("findable");\r
+  fEffHisto->Sumw2();\r
 \r
   // init cuts\r
   if(!fCutsMC) \r
@@ -359,42 +145,34 @@ void AliComparisonEff::Init(){
 }\r
 \r
 //_____________________________________________________________________________\r
-void AliComparisonEff::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)\r
+void AliComparisonEff::ProcessTPC(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC)\r
 {\r
   // Fill efficiency comparison information\r
-  \r
+\r
   AliExternalTrackParam *track = 0;\r
   Double_t field      = AliTracker::GetBz(); // nominal Bz field [kG]\r
   Double_t kMaxD      = 123456.0; // max distance\r
-  Int_t clusterITS[200];\r
-\r
-  // systematics\r
-  const Double_t kSigma2Full_xy  = 0.25; // ExB full systematics  [cm]\r
-  const Double_t kSigma2Full_z  =  5.0;  // drift velocity (goofie) [cm] \r
-\r
-  const Double_t kSigma2Day0_xy  = 0.02; //  ExB  [cm]\r
-  const Double_t kSigma2Day0_z  =  0.1;  //  drift velocity (goofie) [cm]  \r
-\r
-  //  \r
-  Double_t  DCASigmaIdeal=0;\r
-  Double_t  DCASigmaFull=0;\r
-  Double_t  DCASigmaDay0=0;\r
-\r
   Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z\r
+  AliESDVertex vertexMC;  // MC primary vertex\r
 \r
   // distance to Prim. vertex \r
   const Double_t* dv = infoMC->GetVDist(); \r
 \r
   Float_t mcpt = infoMC->GetParticle().Pt();\r
-  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);\r
+  Float_t mceta = infoMC->GetParticle().Eta();\r
+  Float_t mcphi = infoMC->GetParticle().Phi();\r
+  if(mcphi<0) mcphi += 2.*TMath::Pi();\r
+\r
   Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();\r
+  Bool_t findable = (infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits());\r
+  Bool_t recStatus = kFALSE;\r
  \r
   // calculate and set prim. vertex\r
-  fVertex->SetXv( infoMC->GetParticle().Vx() - dv[0] );\r
-  fVertex->SetYv( infoMC->GetParticle().Vy() - dv[1] );\r
-  fVertex->SetZv( infoMC->GetParticle().Vz() - dv[2] );\r
+  vertexMC.SetXv( infoMC->GetParticle().Vx() - dv[0] );\r
+  vertexMC.SetYv( infoMC->GetParticle().Vy() - dv[1] );\r
+  vertexMC.SetZv( infoMC->GetParticle().Vz() - dv[2] );\r
   \r
-  // Check selection cuts\r
+  // Only 5 charged particle species (e,mu,pi,K,p)\r
   if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; \r
 \r
   // transform Pdg to Pid\r
@@ -407,217 +185,152 @@ void AliComparisonEff::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetKP() ) pid = 3; \r
   if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetProt() ) pid = 4; \r
 \r
-  //cout << "dv[0] " << dv[0] << " dv[1] " << dv[1]  <<  " dv[2] " << dv[2] << endl; \r
-  //cout << "v[0] " << fVertex->GetXv()  << " v[1] " << fVertex->GetYv()  <<  " v[2] " << fVertex->GetZv()<< endl; \r
-  if (TMath::Abs(tantheta)<fCutsRC->GetMaxAbsTanTheta())\r
+  if (infoRC->GetESDtrack() && infoRC->GetESDtrack()->GetTPCInnerParam()) \r
   {\r
-    if (infoRC->GetESDtrack() && infoRC->GetESDtrack()->GetTPCInnerParam()) \r
+    if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0)\r
     {\r
-      if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )\r
-      {\r
-        Bool_t bDCAStatus = track->PropagateToDCA(fVertex,field,kMaxD,dca,cov);\r
-               if(bDCAStatus) {\r
-               //\r
-               cov[2] = track->GetCovariance()[2];\r
-\r
-           // Eff = infoRC->GetStatus(1)==3 && isPrim / isPrim;\r
-        // Pt vs ( dca[0]^2/cov[0]^2 + dca[1]^2/cov[2]^2 ) \r
-        // Pt vs ( dca[0]^2/(cov[0]^2 + kSigma2Full_xy)  + dca[1]^2/( cov[2]^2 + kSigma2Full_z ) \r
-        // Pt vs ( dca[0]^2/(cov[0]^2 + kSigma2_xy)  + dca[1]^2/( cov[2]^2 + kSigma2_z ) \r
-\r
-         if(cov[0]>0.0 && cov[2]>0.0)\r
-                {\r
-                        DCASigmaIdeal = TMath::Power(dca[0],2)/cov[0] \r
-                                                                         + TMath::Power(dca[1],2)/cov[2]; \r
-\r
-                        DCASigmaFull = TMath::Power(dca[0],2)/(cov[0]+kSigma2Full_xy) \r
-                                                                        + TMath::Power(dca[1],2)/(cov[2]+kSigma2Full_z); \r
-\r
-                        DCASigmaDay0 = TMath::Power(dca[0],2)/(cov[0]+kSigma2Day0_xy) \r
-                                                                        + TMath::Power(dca[1],2)/(cov[2]+kSigma2Day0_z); \r
-\r
-              //cout << "dca[0] " << dca[0]  << " dca[1] " << dca[1]  << endl; \r
-              //cout << "cov[0] " << cov[0]  << " cov[2] " << cov[2]  << endl; \r
-              //cout << "DCASigmaIdeal " << DCASigmaIdeal  << " DCASigmaFull " << DCASigmaFull  << " DCASigmaDay0 "  <<DCASigmaDay0 <<  endl; \r
-            //cout << " -------------------------------------------------------- "<<  endl; \r
-                }\r
-\r
-         // MC pt\r
-         fMCPt->Fill(mcpt); \r
-         if(infoRC->GetStatus(1)==3) fMCRecPt->Fill(mcpt); \r
-         if(infoRC->GetStatus(1)==3 && isPrim) fMCRecPrimPt->Fill(mcpt); \r
-         if(infoRC->GetStatus(1)==3 && !isPrim) fMCRecSecPt->Fill(mcpt); \r
-\r
-         if(isPrim)\r
-                {\r
-           fTPCPtDCASigmaIdeal[0]->Fill(mcpt,DCASigmaIdeal);\r
-           fTPCPtDCASigmaFull[0]->Fill(mcpt,DCASigmaFull);\r
-           fTPCPtDCASigmaDay0[0]->Fill(mcpt,DCASigmaDay0);\r
-\r
-           fTPCPtDCAXY[0]->Fill(mcpt,dca[0]);\r
-           fTPCPtDCAZ[0]->Fill(mcpt,dca[1]);\r
-\r
-           fTPCPtDCASigmaIdealPid[0]->Fill(mcpt,DCASigmaIdeal,pid);\r
-           fTPCPtDCASigmaFullPid[0]->Fill(mcpt,DCASigmaFull,pid);\r
-           fTPCPtDCASigmaDay0Pid[0]->Fill(mcpt,DCASigmaDay0,pid);\r
-\r
-           fTPCPtDCAXYPid[0]->Fill(mcpt,dca[0],pid);\r
-           fTPCPtDCAZPid[0]->Fill(mcpt,dca[1],pid);\r
-                          \r
-                  if(infoRC->GetStatus(1)==3)\r
-                  {\r
-             fTPCPtDCASigmaIdeal[1]->Fill(mcpt,DCASigmaIdeal);\r
-             fTPCPtDCASigmaFull[1]->Fill(mcpt,DCASigmaFull);\r
-             fTPCPtDCASigmaDay0[1]->Fill(mcpt,DCASigmaDay0);\r
-\r
-             fTPCPtDCAXY[1]->Fill(mcpt,dca[0]);\r
-             fTPCPtDCAZ[1]->Fill(mcpt,dca[1]);\r
-\r
-             fTPCPtDCASigmaIdealPid[1]->Fill(mcpt,DCASigmaIdeal,pid);\r
-             fTPCPtDCASigmaFullPid[1]->Fill(mcpt,DCASigmaFull,pid);\r
-             fTPCPtDCASigmaDay0Pid[1]->Fill(mcpt,DCASigmaDay0,pid);\r
-\r
-             fTPCPtDCAXYPid[1]->Fill(mcpt,dca[0],pid);\r
-             fTPCPtDCAZPid[1]->Fill(mcpt,dca[1],pid);\r
-           }\r
-                }\r
-\r
-        // Cont = infoRC->GetStatus(1)==3 && !isPrim / infoRC->GetStatus(1)==3   \r
-        // Pt vs ( dz[0]^2/cov[0]^2 + dz[1]^2/cov[2]^2 ) \r
-        // Pt vs ( dz[0]^2/(cov[0]^2 + kSigma2Full_xy)  + dz[1]^2/( cov[2]^2 + kSigma2Full_z ) \r
-        // Pt vs ( dz[0]^2/(cov[0]^2 + kSigma2_xy)  + dz[1]^2/( cov[2]^2 + kSigma2_z ) \r
-\r
-                if(infoRC->GetStatus(1)==3) \r
-                {\r
-                  fTPCPtDCASigmaIdeal[2]->Fill(mcpt,DCASigmaIdeal);\r
-           fTPCPtDCASigmaFull[2]->Fill(mcpt,DCASigmaFull);\r
-           fTPCPtDCASigmaDay0[2]->Fill(mcpt,DCASigmaDay0);\r
-\r
-           fTPCPtDCAXY[2]->Fill(mcpt,dca[0]);\r
-           fTPCPtDCAZ[2]->Fill(mcpt,dca[1]);\r
-\r
-           fTPCPtDCASigmaIdealPid[2]->Fill(mcpt,DCASigmaIdeal,pid);\r
-           fTPCPtDCASigmaFullPid[2]->Fill(mcpt,DCASigmaFull,pid);\r
-           fTPCPtDCASigmaDay0Pid[2]->Fill(mcpt,DCASigmaDay0,pid);\r
-\r
-           fTPCPtDCAXYPid[2]->Fill(mcpt,dca[0],pid);\r
-           fTPCPtDCAZPid[2]->Fill(mcpt,dca[1],pid);\r
+      Bool_t bDCAStatus = track->PropagateToDCA(&vertexMC,field,kMaxD,dca,cov);\r
+      if(bDCAStatus) {\r
+        if(TMath::Abs(dca[0])<fCutsRC->GetMaxDCAToVertexXY() && TMath::Abs(dca[1])<fCutsRC->GetMaxDCAToVertexZ())\r
+        {\r
+          recStatus = kTRUE;\r
+        }\r
+      }\r
+    delete track;\r
+    }\r
+  }\r
+\r
+  // Fill histograms\r
+  Double_t vEffHisto[7] = { mceta, mcphi, mcpt, pid, isPrim, recStatus, findable }; \r
+  fEffHisto->Fill(vEffHisto);\r
+}\r
+\r
+//_____________________________________________________________________________\r
+void AliComparisonEff::ProcessTPCITS(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC)\r
+{\r
+  // Fill efficiency comparison information\r
\r
+  Int_t clusterITS[200];\r
+  Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z\r
+\r
+  Float_t mcpt = infoMC->GetParticle().Pt();\r
+  Float_t mceta = infoMC->GetParticle().Eta();\r
+  Float_t mcphi = infoMC->GetParticle().Phi();\r
+  if(mcphi<0) mcphi += 2.*TMath::Pi();\r
+\r
+  // distance to Prim. vertex \r
+  const Double_t* dv = infoMC->GetVDist(); \r
+\r
+  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();\r
+  Bool_t findable = (infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits());\r
+  Bool_t recStatus =kFALSE;\r
  \r
-                  if(isPrim==0)\r
-                  {\r
-             fTPCPtDCASigmaIdeal[3]->Fill(mcpt,DCASigmaIdeal);\r
-             fTPCPtDCASigmaFull[3]->Fill(mcpt,DCASigmaFull);\r
-             fTPCPtDCASigmaDay0[3]->Fill(mcpt,DCASigmaDay0);\r
-\r
-             fTPCPtDCAXY[3]->Fill(mcpt,dca[0]);\r
-             fTPCPtDCAZ[3]->Fill(mcpt,dca[1]);\r
-\r
-             fTPCPtDCASigmaIdealPid[3]->Fill(mcpt,DCASigmaIdeal,pid);\r
-             fTPCPtDCASigmaFullPid[3]->Fill(mcpt,DCASigmaFull,pid);\r
-             fTPCPtDCASigmaDay0Pid[3]->Fill(mcpt,DCASigmaDay0,pid);\r
-\r
-             fTPCPtDCAXYPid[3]->Fill(mcpt,dca[0],pid);\r
-             fTPCPtDCAZPid[3]->Fill(mcpt,dca[1],pid);\r
-           }\r
-            }\r
-          delete track;\r
-       }\r
-       }\r
-     } \r
-        else \r
-        {\r
-       if(isPrim)\r
-          {\r
-            fTPCPtDCASigmaIdeal[0]->Fill(mcpt,0.0);\r
-         fTPCPtDCASigmaFull[0]->Fill(mcpt,0.0);\r
-         fTPCPtDCASigmaDay0[0]->Fill(mcpt,0.0);\r
-\r
-         fTPCPtDCAXY[0]->Fill(mcpt,0.0);\r
-         fTPCPtDCAZ[0]->Fill(mcpt,0.0);\r
-\r
-         fTPCPtDCASigmaIdealPid[0]->Fill(mcpt,0.0,pid);\r
-         fTPCPtDCASigmaFullPid[0]->Fill(mcpt,0.0,pid);\r
-         fTPCPtDCASigmaDay0Pid[0]->Fill(mcpt,0.0,pid);\r
-\r
-         fTPCPtDCAXYPid[0]->Fill(mcpt,0.0,pid);\r
-         fTPCPtDCAZPid[0]->Fill(mcpt,0.0,pid);\r
-          }\r
-     }\r
+  // Only 5 charged particle species (e,mu,pi,K,p)\r
+  if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; \r
+\r
+  // transform Pdg to Pid\r
+  // Pdg convension is different for hadrons and leptons \r
+  // (e.g. K+/K- = 321/-321; e+/e- = -11/11 ) \r
+  Double_t pid = -1;\r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetEM() ) pid = 0; \r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetMuM() ) pid = 1; \r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetPiP() ) pid = 2; \r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetKP() ) pid = 3; \r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetProt() ) pid = 4; \r
+\r
+  if(!infoRC->GetESDtrack()) return;\r
+  if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS())\r
+  {\r
+    infoRC->GetESDtrack()->GetImpactParameters(dca,cov);\r
+    if(TMath::Abs(dca[0]) < fCutsRC->GetMaxDCAToVertexXY() && TMath::Abs(dca[1]) < fCutsRC->GetMaxDCAToVertexZ()) \r
+    {\r
+       recStatus =(infoRC->GetStatus(1)==3);\r
+    } \r
   }\r
 \r
-  // only primary particles\r
-  if (!isPrim) return;\r
+  // fill histograms\r
+  Double_t vEffHisto[7] = { mceta, mcphi, mcpt, pid, isPrim, recStatus, findable }; \r
+  fEffHisto->Fill(vEffHisto);\r
+}\r
 \r
-  // pt\r
-  if (TMath::Abs(tantheta)<fCutsRC->GetMaxAbsTanTheta()){\r
+//_____________________________________________________________________________\r
+void AliComparisonEff::ProcessConstrained(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC)\r
+{\r
+  // Fill efficiency comparison information\r
+  AliExternalTrackParam *track = 0;\r
+  Double_t field      = AliTracker::GetBz(); // nominal Bz field [kG]\r
+  Double_t kMaxD      = 123456.0; // max distance\r
+  Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z\r
+  AliESDVertex vertexMC;  // MC primary vertex\r
 \r
-    fEffTPCPt->Fill(mcpt, infoRC->GetStatus(1)==3);\r
-    fEffTPCPtMC->Fill(mcpt, infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits());\r
-    if (infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits()){\r
-      fEffTPCPtF->Fill(mcpt, infoRC->GetStatus(1)==3);\r
-    }\r
+  // distance to Prim. vertex \r
+  const Double_t* dv = infoMC->GetVDist(); \r
+\r
+  Float_t mcpt = infoMC->GetParticle().Pt();\r
+  Float_t mceta = infoMC->GetParticle().Eta();\r
+  Float_t mcphi = infoMC->GetParticle().Phi();\r
+  if(mcphi<0) mcphi += 2.*TMath::Pi();\r
+\r
+  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();\r
+  Bool_t findable = (infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits());\r
+  Bool_t recStatus = kFALSE;\r
\r
+  // calculate and set prim. vertex\r
+  vertexMC.SetXv( infoMC->GetParticle().Vx() - dv[0] );\r
+  vertexMC.SetYv( infoMC->GetParticle().Vy() - dv[1] );\r
+  vertexMC.SetZv( infoMC->GetParticle().Vz() - dv[2] );\r
   \r
-    fEffTPCITSPt->Fill(mcpt, infoRC->GetStatus(1)==3 && (infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS()));\r
-\r
-    // protons\r
-    if(TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetProt()) { \r
-          fEffTPCPt_P->Fill(mcpt, infoRC->GetStatus(1)==3);\r
-       fEffTPCPtMC_P->Fill(mcpt, infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits());\r
-\r
-       if(infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits()) {\r
-         fEffTPCPtF_P->Fill(mcpt, infoRC->GetStatus(1)==3);\r
-       }\r
-       }\r
-\r
-    // pions\r
-    if(TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetPiP()) {\r
-         fEffTPCPt_Pi->Fill(mcpt, infoRC->GetStatus(1)==3);\r
-      fEffTPCPtMC_Pi->Fill(mcpt, infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits());\r
-\r
-       if(infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits()) {\r
-         fEffTPCPtF_Pi->Fill(mcpt, infoRC->GetStatus(1)==3);\r
-       }\r
-       }\r
-\r
-       // kaons\r
-    if(TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetKP()) {\r
-         fEffTPCPt_K->Fill(mcpt, infoRC->GetStatus(1)==3);\r
-      fEffTPCPtMC_K->Fill(mcpt, infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits());\r
-\r
-       if(infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits()) {\r
-         fEffTPCPtF_K->Fill(mcpt, infoRC->GetStatus(1)==3);\r
-       }\r
-    }\r
-  }\r
+  // Only 5 charged particle species (e,mu,pi,K,p)\r
+  if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; \r
 \r
-  // theta\r
-  if (TMath::Abs(mcpt)>fCutsRC->GetPtMin()){\r
-    fEffTPCTan->Fill(tantheta, infoRC->GetStatus(1)==3);\r
-    fEffTPCTanMC->Fill(tantheta, infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits());\r
-    if (infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits()){\r
-      fEffTPCTanF->Fill(tantheta, infoRC->GetStatus(1)==3);\r
-    }\r
+  // transform Pdg to Pid\r
+  // Pdg convension is different for hadrons and leptons \r
+  // (e.g. K+/K- = 321/-321; e+/e- = -11/11 ) \r
+  Double_t pid = -1;\r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetEM() ) pid = 0; \r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetMuM() ) pid = 1; \r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetPiP() ) pid = 2; \r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetKP() ) pid = 3; \r
+  if( TMath::Abs(infoMC->GetParticle().GetPdgCode())==fCutsMC->GetProt() ) pid = 4; \r
 \r
-    fEffTPCITSTan->Fill(tantheta, infoRC->GetStatus(1)==3 && (infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS()));\r
-  }\r
+  // constrained parameters resolution\r
+  if (!infoRC->GetESDtrack()) return;\r
+  const AliExternalTrackParam * cparam = infoRC->GetESDtrack()->GetConstrainedParam();\r
+  if(!cparam) return;\r
 \r
-  // pt-theta\r
-  fEffTPCPtTan->Fill(mcpt,tantheta,infoRC->GetStatus(1)==3);\r
-  fEffTPCPtTanMC->Fill(mcpt,tantheta,infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits()); \r
-  if (infoMC->GetRowsWithDigits()>fCutsMC->GetMinRowsWithDigits()){\r
-    fEffTPCPtTanF->Fill(mcpt,tantheta,infoRC->GetStatus(1)==3); \r
+  if ((track = new AliExternalTrackParam(*cparam)) != 0)\r
+  {\r
+    Bool_t bDCAStatus = track->PropagateToDCA(&vertexMC,field,kMaxD,dca,cov);\r
+    if(bDCAStatus) {\r
+      if(TMath::Abs(dca[0])<fCutsRC->GetMaxDCAToVertexXY() && TMath::Abs(dca[1])<fCutsRC->GetMaxDCAToVertexZ())\r
+      {\r
+        recStatus =  (infoRC->GetStatus(1)!=3);\r
+      }\r
+    }\r
+  delete track;\r
   }\r
+\r
+  // Fill histograms\r
+  Double_t vEffHisto[7] = { mceta, mcphi, mcpt, pid, isPrim, recStatus, findable }; \r
+  fEffHisto->Fill(vEffHisto);\r
 }\r
 \r
 //_____________________________________________________________________________\r
-void AliComparisonEff::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC)\r
+void AliComparisonEff::Exec(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC)\r
 {\r
   // Process comparison information\r
-  Process(infoMC,infoRC);\r
+\r
+  if(GetAnalysisMode() == 0) ProcessTPC(infoMC,infoRC);\r
+  else if(GetAnalysisMode() == 1) ProcessTPCITS(infoMC,infoRC);\r
+  else if(GetAnalysisMode() == 2) ProcessConstrained(infoMC,infoRC);\r
+  else {\r
+    printf("ERROR: AnalysisMode %d \n",fAnalysisMode);\r
+    return;\r
+  }\r
 }\r
 \r
 //_____________________________________________________________________________\r
-Long64_t AliComparisonEff::Merge(TCollection* list) \r
+Long64_t AliComparisonEff::Merge(TCollection* const list) \r
 {\r
   // Merge list of objects (needed by PROOF)\r
 \r
@@ -638,55 +351,7 @@ Long64_t AliComparisonEff::Merge(TCollection* list)
     AliComparisonEff* entry = dynamic_cast<AliComparisonEff*>(obj);\r
     if (entry == 0) continue; \r
   \r
-    fMCPt->Add(entry->fMCPt);\r
-    fMCRecPt->Add(entry->fMCRecPt);\r
-    fMCRecPrimPt->Add(entry->fMCRecPrimPt);\r
-    fMCRecSecPt->Add(entry->fMCRecSecPt);\r
-\r
-    fEffTPCPt->Add(entry->fEffTPCPt);\r
-       fEffTPCPtMC->Add(entry->fEffTPCPtMC);\r
-       fEffTPCPtF->Add(entry->fEffTPCPtF);\r
-\r
-    fEffTPCPt_P->Add(entry->fEffTPCPt_P);\r
-       fEffTPCPtMC_P->Add(entry->fEffTPCPtMC_P);\r
-       fEffTPCPtF_P->Add(entry->fEffTPCPtF_P);\r
-\r
-    fEffTPCPt_Pi->Add(entry->fEffTPCPt_Pi);\r
-       fEffTPCPtMC_Pi->Add(entry->fEffTPCPtMC_Pi);\r
-       fEffTPCPtF_Pi->Add(entry->fEffTPCPtF_Pi);\r
-\r
-    fEffTPCPt_K->Add(entry->fEffTPCPt_K);\r
-       fEffTPCPtMC_K->Add(entry->fEffTPCPtMC_K);\r
-       fEffTPCPtF_K->Add(entry->fEffTPCPtF_K);\r
-\r
-       fEffTPCTan->Add(entry->fEffTPCTan);\r
-       fEffTPCTanMC->Add(entry->fEffTPCTanMC);\r
-       fEffTPCTanF->Add(entry->fEffTPCTanF);\r
-         \r
-       fEffTPCPtTan->Add(entry->fEffTPCPtTan);\r
-       fEffTPCPtTanMC->Add(entry->fEffTPCPtTanMC);\r
-       fEffTPCPtTanF->Add(entry->fEffTPCPtTanF);\r
-    \r
-    fEffTPCITSPt->Add(entry->fEffTPCITSPt);\r
-    fEffTPCITSTan->Add(entry->fEffTPCITSTan);\r
-\r
-    for(Int_t i=0; i<4; ++i)\r
-    {\r
-      fTPCPtDCASigmaIdeal[i]->Add(entry->fTPCPtDCASigmaIdeal[i]);\r
-      fTPCPtDCASigmaFull[i]->Add(entry->fTPCPtDCASigmaFull[i]);\r
-      fTPCPtDCASigmaDay0[i]->Add(entry->fTPCPtDCASigmaDay0[i]);\r
-\r
-      fTPCPtDCAXY[i]->Add(entry->fTPCPtDCAXY[i]);\r
-      fTPCPtDCAZ[i]->Add(entry->fTPCPtDCAXY[i]);\r
-\r
-      fTPCPtDCASigmaIdealPid[i]->Add(entry->fTPCPtDCASigmaIdealPid[i]);\r
-      fTPCPtDCASigmaFullPid[i]->Add(entry->fTPCPtDCASigmaFullPid[i]);\r
-      fTPCPtDCASigmaDay0Pid[i]->Add(entry->fTPCPtDCASigmaDay0Pid[i]);\r
-\r
-      fTPCPtDCAXYPid[i]->Add(entry->fTPCPtDCAXYPid[i]);\r
-      fTPCPtDCAZPid[i]->Add(entry->fTPCPtDCAXYPid[i]);\r
-    }\r
-\r
+     fEffHisto->Add(entry->fEffHisto);\r
   count++;\r
   }\r
 \r
@@ -699,219 +364,141 @@ void AliComparisonEff::Analyse()
   // Analyse comparison information and store output histograms\r
   // in the folder "folderEff" \r
   //\r
-  \r
   TH1::AddDirectory(kFALSE);\r
-\r
-  AliComparisonEff * comp=this;\r
   TObjArray *aFolderObj = new TObjArray;\r
 \r
-  // calculate efficiency and contamination (4 sigma) \r
-  TH1 *h_sigmaidealpid[20];\r
-  TH1 *h_sigmafullpid[20];\r
-  TH1 *h_sigmaday0pid[20];\r
+  // efficiency vs pt\r
+  fEffHisto->GetAxis(0)->SetRangeUser(-0.9,0.9); // eta range\r
+  fEffHisto->GetAxis(4)->SetRangeUser(1.,1.);    // primary tracks\r
 \r
-  TH1 *h_sigmaidealpidtot[4];\r
-  TH1 *h_sigmafullpidtot[4];\r
-  TH1 *h_sigmaday0pidtot[4];\r
+  // rec efficiency vs pt\r
+  TH1D *ptAll = fEffHisto->Projection(2);\r
 \r
-  char name[256];\r
-  char name1[256];\r
-  Int_t idx;\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.);  // reconstructed \r
+  TH1D *ptRec = fEffHisto->Projection(2);\r
+  ptRec->Divide(ptAll);\r
+  ptRec->SetName("ptRecEff");\r
 \r
-  for(Int_t i=0; i<4; ++i)\r
-  {\r
-     //total\r
-     comp->fTPCPtDCASigmaIdealPid[i]->GetYaxis()->SetRange(1,4);\r
-     sprintf(name,"h_sigmaidealpidtot_%d",i);\r
-     h_sigmaidealpidtot[i] = comp->fTPCPtDCASigmaIdealPid[i]->Project3D();\r
-     h_sigmaidealpidtot[i]->SetName(name);\r
-\r
-     comp->fTPCPtDCASigmaFullPid[i]->GetYaxis()->SetRange(1,4);\r
-     sprintf(name,"h_sigmafullpidtot_%d",i);\r
-     h_sigmafullpidtot[i] = comp->fTPCPtDCASigmaFullPid[i]->Project3D();\r
-     h_sigmafullpidtot[i]->SetName(name);\r
-\r
-     comp->fTPCPtDCASigmaDay0Pid[i]->GetYaxis()->SetRange(1,4);\r
-     sprintf(name,"h_sigmaday0pidtot_%d",i);\r
-     h_sigmaday0pidtot[i] = comp->fTPCPtDCASigmaDay0Pid[i]->Project3D();\r
-     h_sigmaday0pidtot[i]->SetName(name);\r
-\r
-     // pid wise\r
-     for(Int_t j=0; j<5; ++j)\r
-        {\r
-       idx = i*5 + j;\r
-\r
-       comp->fTPCPtDCASigmaIdealPid[i]->GetYaxis()->SetRange(1,4);\r
-       comp->fTPCPtDCASigmaIdealPid[i]->GetZaxis()->SetRange(j+1,j+1);\r
-\r
-       sprintf(name,"h_sigmaidealpid_%d",idx);\r
-       h_sigmaidealpid[idx] = comp->fTPCPtDCASigmaIdealPid[i]->Project3D();\r
-       h_sigmaidealpid[idx]->SetName(name);\r
-          \r
-\r
-       comp->fTPCPtDCASigmaFullPid[i]->GetYaxis()->SetRange(1,4);\r
-       comp->fTPCPtDCASigmaFullPid[i]->GetZaxis()->SetRange(j+1,j+1);\r
-\r
-       sprintf(name,"h_sigmafullpid_%d",idx);\r
-       h_sigmafullpid[idx] = comp->fTPCPtDCASigmaFullPid[i]->Project3D();\r
-       h_sigmafullpid[idx]->SetName(name);\r
-       \r
-       comp->fTPCPtDCASigmaDay0Pid[i]->GetYaxis()->SetRange(1,4);\r
-       comp->fTPCPtDCASigmaDay0Pid[i]->GetZaxis()->SetRange(j+1,j+1);\r
-\r
-       sprintf(name,"h_sigmaday0pid_%d",idx);\r
-       h_sigmaday0pid[idx] = comp->fTPCPtDCASigmaDay0Pid[i]->Project3D();\r
-       h_sigmaday0pid[idx]->SetName(name);\r
-       } \r
-  }\r
+  aFolderObj->Add(ptRec);\r
 \r
-  // calculate efficiency and contamination (all pids)\r
-  h_sigmaidealpidtot[0]->Sumw2();\r
-  h_sigmaidealpidtot[1]->Divide(h_sigmaidealpidtot[0]);\r
-  h_sigmaidealpidtot[2]->Sumw2();\r
-  h_sigmaidealpidtot[3]->Divide(h_sigmaidealpidtot[2]);\r
 \r
-  h_sigmafullpidtot[0]->Sumw2();\r
-  h_sigmafullpidtot[1]->Divide(h_sigmafullpidtot[0]);\r
-  h_sigmafullpidtot[2]->Sumw2();\r
-  h_sigmafullpidtot[3]->Divide(h_sigmafullpidtot[2]);\r
+  // rec efficiency vs pid vs pt\r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.); \r
+  fEffHisto->GetAxis(3)->SetRangeUser(2.,2.); // pions\r
+  TH1D *ptAllPi = fEffHisto->Projection(2);\r
 \r
-  h_sigmaday0pidtot[0]->Sumw2();\r
-  h_sigmaday0pidtot[1]->Divide(h_sigmaday0pidtot[0]);\r
-  h_sigmaday0pidtot[2]->Sumw2();\r
-  h_sigmaday0pidtot[3]->Divide(h_sigmaday0pidtot[2]);\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.); // reconstructed\r
+  TH1D *ptRecPi = fEffHisto->Projection(2);\r
+  ptRecPi->Divide(ptAllPi);\r
+  ptRecPi->SetName("ptRecEffPi");\r
 \r
-  // calculate efficiency pid wise\r
-  for(Int_t jdx = 0; jdx<5; jdx++)\r
-  {\r
-    h_sigmaidealpid[jdx]->Sumw2();\r
-    h_sigmaidealpid[jdx+5]->Divide(h_sigmaidealpid[jdx]);\r
+  aFolderObj->Add(ptRecPi);\r
 \r
-    h_sigmafullpid[jdx]->Sumw2();\r
-    h_sigmafullpid[jdx+5]->Divide(h_sigmafullpid[jdx]);\r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.); \r
+  fEffHisto->GetAxis(3)->SetRangeUser(3.,3.); // kaons\r
+  TH1D *ptAllK = fEffHisto->Projection(2);\r
 \r
-    h_sigmaday0pid[jdx]->Sumw2();\r
-    h_sigmaday0pid[jdx+5]->Divide(h_sigmaday0pid[jdx]);\r
-  }\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.); // reconstructed\r
+  TH1D *ptRecK = fEffHisto->Projection(2);\r
+  ptRecK->Divide(ptAllK);\r
+  ptRecK->SetName("ptRecEffK");\r
 \r
-  // calculate cont. pid wise\r
-  for(Int_t jdx = 0; jdx<5; jdx++)\r
-  {\r
-    h_sigmaidealpid[jdx+15]->Divide(h_sigmaidealpidtot[2]);\r
-    h_sigmafullpid[jdx+15]->Divide(h_sigmafullpidtot[2]);\r
-    h_sigmaday0pid[jdx+15]->Divide(h_sigmaday0pidtot[2]);\r
-  }\r
+  aFolderObj->Add(ptRecK);\r
+\r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.); \r
+  fEffHisto->GetAxis(3)->SetRangeUser(4.,4.); // protons\r
+  TH1D *ptAllP = fEffHisto->Projection(2);\r
+\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.); // reconstructed\r
+  TH1D *ptRecP = fEffHisto->Projection(2);\r
+  ptRecP->Divide(ptAllP);\r
+  ptRecP->SetName("ptRecEffP");\r
 \r
-  TCanvas * c = new TCanvas("Efficiency","Track efficiency");\r
-  c->cd();\r
-  c->Divide(1,2);\r
+  aFolderObj->Add(ptRecP);\r
+  \r
+  // findable efficiency \r
+  fEffHisto->GetAxis(3)->SetRangeUser(0.,4.); \r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.); \r
+  fEffHisto->GetAxis(6)->SetRangeUser(1.,1.); // findable\r
+  TH1D *ptAllF = fEffHisto->Projection(2);\r
+\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.);\r
+  fEffHisto->GetAxis(6)->SetRangeUser(1.,1.);\r
+  TH1D *ptRecF = fEffHisto->Projection(2); // rec findable\r
+  ptRecF->Divide(ptAllF);\r
+  ptRecF->SetName("ptRecFindableEff");\r
+\r
+  aFolderObj->Add(ptRecF);\r
 \r
   //\r
-  c->cd(1);\r
-  comp->fEffTPCTanF->SetXTitle("Tan(#theta)");\r
-  comp->fEffTPCTanF->SetYTitle("eff_{findable}");\r
-  comp->fEffTPCTanF->SetName("EffTanFindable");\r
-  comp->fEffTPCTanF->Draw();\r
+  // efficiency vs eta\r
   //\r
-  c->cd(2);\r
-  comp->fEffTPCTan->SetXTitle("Tan(#theta)");\r
-  comp->fEffTPCTan->SetYTitle("eff_{all}");\r
-  comp->fEffTPCTan->SetName("EffTanAll");\r
-  comp->fEffTPCTan->Draw();\r
-\r
-  aFolderObj->Add(comp->fEffTPCTanF);\r
-  aFolderObj->Add(comp->fEffTPCTan);\r
-\r
-  h_sigmaidealpidtot[1]->SetXTitle("p_{t}");\r
-  h_sigmaidealpidtot[1]->SetYTitle("efficiency");\r
-  h_sigmaidealpidtot[1]->SetTitle("Eff_SigmaIdeal");\r
-  h_sigmaidealpidtot[1]->SetName("Eff_SigmaIdeal");\r
-\r
-  h_sigmaidealpidtot[3]->SetXTitle("p_{t}");\r
-  h_sigmaidealpidtot[3]->SetYTitle("contamination");\r
-  h_sigmaidealpidtot[3]->SetTitle("Cont_SigmaIdeal");\r
-  h_sigmaidealpidtot[3]->SetName("Cont_SigmaIdeal");\r
-\r
-  aFolderObj->Add(h_sigmaidealpidtot[1]);\r
-  aFolderObj->Add(h_sigmaidealpidtot[3]);\r
-\r
-  h_sigmafullpidtot[1]->SetXTitle("p_{t}");\r
-  h_sigmafullpidtot[1]->SetYTitle("efficiency");\r
-  h_sigmafullpidtot[1]->SetTitle("Eff_SigmaFull");\r
-  h_sigmafullpidtot[1]->SetName("Eff_SigmaFull");\r
-\r
-  h_sigmafullpidtot[3]->SetXTitle("p_{t}");\r
-  h_sigmafullpidtot[3]->SetYTitle("contamination");\r
-  h_sigmafullpidtot[3]->SetTitle("Cont_SigmaFull");\r
-  h_sigmafullpidtot[3]->SetName("Cont_SigmaFull");\r
-\r
-  aFolderObj->Add(h_sigmafullpidtot[1]);\r
-  aFolderObj->Add(h_sigmafullpidtot[3]);\r
-\r
-  h_sigmaday0pidtot[1]->SetXTitle("p_{t}");\r
-  h_sigmaday0pidtot[1]->SetYTitle("efficiency");\r
-  h_sigmaday0pidtot[1]->SetTitle("Eff_SigmaDay0");\r
-  h_sigmaday0pidtot[1]->SetName("Eff_SigmaDay0");\r
-\r
-  h_sigmaday0pidtot[3]->SetXTitle("p_{t}");\r
-  h_sigmaday0pidtot[3]->SetYTitle("contamination");\r
-  h_sigmaday0pidtot[3]->SetTitle("Cont_SigmaDay0");\r
-  h_sigmaday0pidtot[3]->SetName("Cont_SigmaDay0");\r
-\r
-  aFolderObj->Add(h_sigmaday0pidtot[1]);\r
-  aFolderObj->Add(h_sigmaday0pidtot[3]);\r
-\r
-  for(Int_t jdx = 0; jdx<5; jdx++)\r
-  {\r
-    sprintf(name,"Eff_SigmaIdeal_%d",jdx);\r
-    sprintf(name1,"Cont_SigmaIdeal_%d",jdx);\r
 \r
+  fEffHisto->GetAxis(0)->SetRangeUser(-1.5,1.5); // eta range\r
+  fEffHisto->GetAxis(2)->SetRangeUser(0.2,10.); // pt range\r
+  fEffHisto->GetAxis(4)->SetRangeUser(1.,1.);   // primary tracks\r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.);   // all\r
+  fEffHisto->GetAxis(6)->SetRangeUser(0.,1.);   // all\r
 \r
-    h_sigmaidealpid[jdx+5]->SetXTitle("p_{t}");\r
-    h_sigmaidealpid[jdx+5]->SetYTitle("efficiency");\r
-    h_sigmaidealpid[jdx+5]->SetTitle(name);\r
-    h_sigmaidealpid[jdx+5]->SetName(name);\r
+  // rec efficiency vs eta\r
+  TH1D *etaAll = fEffHisto->Projection(0);\r
 \r
-    h_sigmaidealpid[jdx+15]->SetXTitle("p_{t}");\r
-    h_sigmaidealpid[jdx+15]->SetYTitle("contamination");\r
-    h_sigmaidealpid[jdx+15]->SetTitle(name1);\r
-    h_sigmaidealpid[jdx+15]->SetName(name1);\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.);  // reconstructed \r
+  TH1D *etaRec = fEffHisto->Projection(0);\r
+  etaRec->Divide(etaAll);\r
+  etaRec->SetName("etaRecEff");\r
 \r
-       aFolderObj->Add(h_sigmaidealpid[jdx+5]);\r
-       aFolderObj->Add(h_sigmaidealpid[jdx+15]);\r
+  aFolderObj->Add(etaRec);\r
 \r
-    sprintf(name,"Eff_SigmaFull_%d",jdx);\r
-    sprintf(name1,"Cont_SigmaFull_%d",jdx);\r
+  // rec efficiency vs pid vs eta\r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.); \r
+  fEffHisto->GetAxis(3)->SetRangeUser(2.,2.); // pions\r
+  TH1D *etaAllPi = fEffHisto->Projection(0);\r
 \r
-    h_sigmafullpid[jdx+5]->SetXTitle("p_{t}");\r
-    h_sigmafullpid[jdx+5]->SetYTitle("efficiency");\r
-    h_sigmafullpid[jdx+5]->SetTitle(name);\r
-    h_sigmafullpid[jdx+5]->SetName(name);\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.); // reconstructed\r
+  TH1D *etaRecPi = fEffHisto->Projection(0);\r
+  etaRecPi->Divide(etaAllPi);\r
+  etaRecPi->SetName("etaRecEffPi");\r
 \r
-    h_sigmafullpid[jdx+15]->SetXTitle("p_{t}");\r
-    h_sigmafullpid[jdx+15]->SetYTitle("contamination");\r
-    h_sigmafullpid[jdx+15]->SetTitle(name1);\r
-    h_sigmafullpid[jdx+15]->SetName(name1);\r
+  aFolderObj->Add(etaRecPi);\r
 \r
-       aFolderObj->Add(h_sigmafullpid[jdx+5]);\r
-       aFolderObj->Add(h_sigmafullpid[jdx+15]);\r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.); \r
+  fEffHisto->GetAxis(3)->SetRangeUser(3.,3.); // kaons\r
+  TH1D *etaAllK = fEffHisto->Projection(0);\r
 \r
-    sprintf(name,"Eff_SigmaDay0_%d",jdx);\r
-    sprintf(name1,"Cont_SigmaDay0_%d",jdx);\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.); // reconstructed\r
+  TH1D *etaRecK = fEffHisto->Projection(0);\r
+  etaRecK->Divide(etaAllK);\r
+  etaRecK->SetName("etaRecEffK");\r
 \r
-    h_sigmaday0pid[jdx+5]->SetXTitle("p_{t}");\r
-    h_sigmaday0pid[jdx+5]->SetYTitle("efficiency");\r
-    h_sigmaday0pid[jdx+5]->SetTitle(name);\r
-    h_sigmaday0pid[jdx+5]->SetName(name);\r
+  aFolderObj->Add(etaRecK);\r
 \r
-    h_sigmaday0pid[jdx+15]->SetXTitle("p_{t}");\r
-    h_sigmaday0pid[jdx+15]->SetYTitle("contamination");\r
-    h_sigmaday0pid[jdx+15]->SetTitle(name1);\r
-    h_sigmaday0pid[jdx+15]->SetName(name1);\r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.); \r
+  fEffHisto->GetAxis(3)->SetRangeUser(4.,4.); // protons\r
+  TH1D *etaAllP = fEffHisto->Projection(0);\r
 \r
-       aFolderObj->Add(h_sigmaday0pid[jdx+5]);\r
-       aFolderObj->Add(h_sigmaday0pid[jdx+15]);\r
-  }\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.); // reconstructed\r
+  TH1D *etaRecP = fEffHisto->Projection(0);\r
+  etaRecP->Divide(etaAllP);\r
+  etaRecP->SetName("etaRecEffP");\r
+\r
+  aFolderObj->Add(etaRecP);\r
+  \r
+  //\r
+  // findable efficiency \r
+  //\r
+  fEffHisto->GetAxis(3)->SetRangeUser(0.,4.); \r
+  fEffHisto->GetAxis(5)->SetRangeUser(0.,1.); \r
+  fEffHisto->GetAxis(6)->SetRangeUser(1.,1.); // findable\r
+  TH1D *etaAllF = fEffHisto->Projection(0);\r
+\r
+  fEffHisto->GetAxis(5)->SetRangeUser(1.,1.);\r
+  fEffHisto->GetAxis(6)->SetRangeUser(1.,1.);\r
+  TH1D *etaRecF = fEffHisto->Projection(0);   // rec findable\r
+  etaRecF->Divide(etaAllF);\r
+  etaRecF->SetName("etaRecFindableEff");\r
+\r
+  aFolderObj->Add(etaRecF);\r
 \r
   // export objects to analysis folder\r
   fAnalysisFolder = ExportToFolder(aFolderObj);\r
index a0244a3..c56f461 100644 (file)
@@ -13,174 +13,66 @@ class AliMCInfo;
 class AliESDRecInfo;
 class AliESDEvent; 
 class AliESD;
-class AliESDfriend;
 class AliRecInfoCuts;
 class AliMCInfoCuts;
-class TH1I;
-class TH3F;
-class TH3;
-class TProfile;
-class TProfile2D;
-class TGraph2D;
-class TGraph; 
-class TGeoManager; 
 class TString;
-class TStatToolkit; 
-class AliMagF;
 class AliESDVertex;
+class TNamed;
 
-#include "TNamed.h"
+#include "THnSparse.h"
 #include "AliComparisonObject.h"
 
 class AliComparisonEff : public AliComparisonObject {
 public :
   AliComparisonEff(); 
+  AliComparisonEff(Char_t* name, Char_t* title, Int_t analysisMode, Bool_t hptGenerator);
   ~AliComparisonEff();
 
   // Init data members
   virtual void Init();
 
   // Execute analysis 
-  virtual void Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  virtual void Exec(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC);
 
   // Merge output objects (needed by PROOF) 
-  virtual Long64_t Merge(TCollection* list);
+  virtual Long64_t Merge(TCollection* const list);
 
   // Analyse output histograms 
   virtual void Analyse();
 
   // Get analysis folder
-  virtual TFolder* GetAnalysisFolder() {return fAnalysisFolder;}
+  virtual TFolder* GetAnalysisFolder() const {return fAnalysisFolder;}
 
   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderEff",TString title = "Analysed Efficiency histograms");
 
   // Export objects to folder
-  TFolder *ExportToFolder(TObjArray * array=0);
+  TFolder *ExportToFolder(TObjArray *array=0);
 
   // Process events
-  void Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  void ProcessTPC(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC);
+  void ProcessTPCITS(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC);
+  void ProcessConstrained(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC);
 
   // Selection cuts
-  void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}
-  void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = cuts;} 
+  void SetAliRecInfoCuts(AliRecInfoCuts* const cuts=0) {fCutsRC = cuts;}
+  void SetAliMCInfoCuts(AliMCInfoCuts* const cuts=0) {fCutsMC = cuts;} 
   
   // Getters
   AliRecInfoCuts*  GetAliRecInfoCuts() const {return fCutsRC;} 
   AliMCInfoCuts*   GetAliMCInfoCuts()  const {return fCutsMC;}
 
-  TH1F *GetMCPt() {return fMCPt;}
-  TH1F *GetMCRecPt() {return fMCRecPt;}
-  TH1F *GetMCRecPrimPt() {return fMCRecPrimPt;}
-  TH1F *GetMCRecSecPt() {return fMCRecSecPt;}
-  
-  TProfile* GetEffTPCPt() {return fEffTPCPt;}
-  TProfile* GetEffTPCITSPt() {return fEffTPCITSPt;}
-  TProfile* GetEffTPCPtMC() {return fEffTPCPtMC;}
-  TProfile* GetEffTPCPtF() {return fEffTPCPtF;}
-
-  TProfile* GetEffTPCPt_P() {return fEffTPCPt_P;}
-  TProfile* GetEffTPCPtMC_P() {return fEffTPCPtMC_P;}
-  TProfile* GetEffTPCPtF_P() {return fEffTPCPtF_P;}
-
-  TProfile* GetEffTPCPt_Pi() {return fEffTPCPt_Pi;}
-  TProfile* GetEffTPCPtMC_Pi() {return fEffTPCPtMC_Pi;}
-  TProfile* GetEffTPCPtF_Pi() {return fEffTPCPtF_Pi;}
-
-  TProfile* GetEffTPCPt_K() {return fEffTPCPt_K;}
-  TProfile* GetEffTPCPtMC_K() {return fEffTPCPtMC_K;}
-  TProfile* GetEffTPCPtF_K() {return fEffTPCPtF_K;}
-
-  //
-  TProfile* GetEffTPCTan() {return fEffTPCTan;}
-  TProfile* GetEffTPCITSTan() {return fEffTPCITSTan;}
-  TProfile* GetEffTPCTanMC() {return fEffTPCTanMC;}
-  TProfile* GetEffTPCTanF() {return fEffTPCTanF;}
-  //
-  TProfile2D* GetEffTPCPtTan() {return fEffTPCPtTan;}
-  TProfile2D* GetEffTPCPtTanMC() {return fEffTPCPtTanMC;}
-  TProfile2D* GetEffTPCPtTanF() {return fEffTPCPtTanF;}
-  
-  // idx - 0 (isPrim), idx - 1 (isPrim && infoRC->GetStatus(1)==3)
-  // idx - 2 (infoRC->GetStatus(1)==3),  idx - 3 (infoRC->GetStatus(1)==3 && !isPrim )
-  //
-  TH2F* GetTPCPtDCASigmaIdeal(Int_t i) {if(i<4) return fTPCPtDCASigmaIdeal[i]; else return 0;}
-  TH2F* GetTPCPtDCASigmaFull(Int_t i) {if(i<4) return fTPCPtDCASigmaFull[i] ; else return 0;}
-  TH2F* GetTPCPtDCASigmaDay0(Int_t i) {if(i<4) return fTPCPtDCASigmaFull[i] ; else  return 0;}
-
-  TH2F* GetTPCPtDCAXY(Int_t i) {if(i<4) return fTPCPtDCAXY[i] ; else return 0;}
-  TH2F* GetTPCPtDCAZ(Int_t i) {if(i<4) return fTPCPtDCAZ[i] ; else return 0;}
-
-  // Pid = 0 - electrons,  1 - muons, 2 - kaons, 3 - pions, 4 - protons   
-  //
-  TH3F* GetTPCPtDCASigmaIdealPid(Int_t i) {if(i<4) return fTPCPtDCASigmaIdealPid[i]; else return 0;}
-  TH3F* GetTPCPtDCASigmaFullPid(Int_t i) {if(i<4) return fTPCPtDCASigmaFullPid[i]; else return 0;}
-  TH3F* GetTPCPtDCASigmaDay0Pid(Int_t i) {if(i<4) return fTPCPtDCASigmaDay0Pid[i]; else return 0;}
-  TH3F* GetTPCPtDCAXYPid(Int_t i) {if(i<4) return fTPCPtDCAXYPid[i]; else return 0;}
-  TH3F* GetTPCPtDCAZPid(Int_t i) {if(i<4) return fTPCPtDCAZPid[i]; else return 0;}
+  THnSparseF* GetEffHisto() const {return fEffHisto;}
 
 private:
 
   // Control histograms
-  TH1F *fMCPt;
-  TH1F *fMCRecPt;
-  TH1F *fMCRecPrimPt;
-  TH1F *fMCRecSecPt;
-  
-  TProfile* fEffTPCPt;      //->TPC efficiency as function of Pt (tan+-1)
-  TProfile* fEffTPCPtMC;    //->MC -TPC efficiency as function of Pt (tan+-1)
-  TProfile* fEffTPCPtF;     //->efficiency for findable tracks
-
-  TProfile* fEffTPCPt_P;    //->TPC efficiency as function of Pt (tan+-1) - Protons
-  TProfile* fEffTPCPtMC_P;  //->MC -TPC efficiency as function of Pt (tan+-1) - Protons
-  TProfile* fEffTPCPtF_P;   //->efficiency for findable tracks - Protons
-
-  TProfile* fEffTPCPt_Pi;   //->TPC efficiency as function of Pt (tan+-1) - Pions
-  TProfile* fEffTPCPtMC_Pi; //->MC -TPC efficiency as function of Pt (tan+-1) - Pions
-  TProfile* fEffTPCPtF_Pi;  //->efficiency for findable tracks - Pions
-
-  TProfile* fEffTPCPt_K;    //->TPC efficiency as function of Pt (tan+-1) - Kaons
-  TProfile* fEffTPCPtMC_K;  //->MC -TPC efficiency as function of Pt (tan+-1) - Kaons
-  TProfile* fEffTPCPtF_K;   //->efficiency for findable tracks - Kaons
-
-  //
-  TProfile* fEffTPCTan;     //->TPC efficiency as function of Tan (pt>0.15
-  TProfile* fEffTPCTanMC;   //->MC -TPC efficiency as function of Tan (pt>0.15)
-  TProfile* fEffTPCTanF;    //->efficiency for findable tracks Tan (pt>0.15)
-  //
-  TProfile2D* fEffTPCPtTan;    //->TPC efficiency as function of Pt and tan
-  TProfile2D* fEffTPCPtTanMC;  //->MC -TPC efficiency as function of Pt and tan
-  TProfile2D* fEffTPCPtTanF;   //->TPC efficiency as function of Pt and tan
-
-  // idx - 0 (isPrim), idx - 1 (isPrim && infoRC->GetStatus(1)==3)
-  // idx - 2 (infoRC->GetStatus(1)==3),  idx - 3 (infoRC->GetStatus(1)==3 && !isPrim )
-  //
-  
-  TH2F* fTPCPtDCASigmaIdeal[4]; //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1)
-  TH2F* fTPCPtDCASigmaFull[4];  //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1, full systematics)
-  TH2F* fTPCPtDCASigmaDay0[4];  //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1, goofie systematics)
-
-  TH2F* fTPCPtDCAXY[4];     //->TPC efficiency as Pt vs DCA_XY (tan+-1)
-  TH2F* fTPCPtDCAZ[4];      //->TPC efficiency as Pt vs DCA_Z (tan+-1)
-
-  // Pid = 0 - electrons,  1 - muons, 2 - kaons, 3 - pions, 4 - protons   
-  TH3F* fTPCPtDCASigmaIdealPid[4]; //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1)
-  TH3F* fTPCPtDCASigmaFullPid[4];  //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1, full systematics)
-  TH3F* fTPCPtDCASigmaDay0Pid[4];  //->TPC efficiency vs Pt vs DCA/Sigma (tan+-1, goofie systematics)
-  TH3F* fTPCPtDCAXYPid[4];     //->TPC efficiency vs Pt vs DCA_XY (tan+-1)
-  TH3F* fTPCPtDCAZPid[4];      //->TPC efficiency vs Pt vs DCA_Z (tan+-1)
-
-  // TPC +ITS
-  TProfile* fEffTPCITSPt;      //->TPCITS efficiency as function of Pt (tan+-1)
-  TProfile* fEffTPCITSTan;      //->TPCITS efficiency as function of Tan (pt>0.15)
+  THnSparseF *fEffHisto; //-> mceta:mcphi:mcpt:pid:isPrim:recStatus:findable
 
   // Global cuts objects
   AliRecInfoCuts* fCutsRC;     // selection cuts for reconstructed tracks
   AliMCInfoCuts*  fCutsMC;     // selection cuts for MC tracks
 
-  // Magnet (needed for DCA calculations) 
-  AliESDVertex* fVertex;  //! 
-  
   // analysis folder 
   TFolder *fAnalysisFolder; // folder for analysed histograms
 
index 40b9ea0..eafe75e 100644 (file)
@@ -32,13 +32,19 @@ ClassImp(AliComparisonObject)
 
 //_____________________________________________________________________________
 AliComparisonObject::AliComparisonObject():
-  TNamed("AliComparisonObject","AliComparisonObject") {
+  TNamed("AliComparisonObject","AliComparisonObject"),
+  fAnalysisMode(-1),
+  fHptGenerator(kFALSE)
+{
   // constructor
 }
 
 //_____________________________________________________________________________
-AliComparisonObject::AliComparisonObject(const char* name):
-  TNamed(name,name) {
+AliComparisonObject::AliComparisonObject(const char* name, const char* title):
+  TNamed(name,title),
+  fAnalysisMode(-1),
+  fHptGenerator(kFALSE)
+{
   // constructor
 }
 
index 040c7a9..e2038fa 100644 (file)
@@ -17,7 +17,7 @@ class AliESDRecInfo;
 class AliComparisonObject : public TNamed {\r
 public :\r
   AliComparisonObject(); \r
-  AliComparisonObject(const char* name="AliComparisonObject"); \r
+  AliComparisonObject(const char* name="AliComparisonObject", const char* title="AliComparisonObject"); \r
   virtual ~AliComparisonObject();\r
 \r
   // Init data members\r
@@ -26,16 +26,32 @@ public :
 \r
   // Execute analysis\r
   // call in the event loop \r
-  virtual void Exec(AliMCInfo* infoMC=0, AliESDRecInfo *infoRC=0) = 0;\r
+  virtual void Exec(AliMCInfo* const infoMC=0, AliESDRecInfo* const infoRC=0) = 0;\r
 \r
   // Merge output objects (needed by PROOF) \r
-  virtual Long64_t Merge(TCollection* list=0) = 0;\r
+  virtual Long64_t Merge(TCollection* const list=0) = 0;\r
 \r
   // Analyse output histograms\r
   virtual void Analyse() = 0;\r
 \r
   // Get output folder for analysed histograms\r
-  virtual TFolder* GetAnalysisFolder() = 0;\r
+  virtual TFolder* GetAnalysisFolder() const = 0;\r
+\r
+  // set and get analysisMode\r
+  void SetAnalysisMode(Int_t analysisMode=0) {fAnalysisMode = analysisMode;} \r
+  Int_t GetAnalysisMode() {return fAnalysisMode;}\r
+\r
+  // set and get hpt generator \r
+  void SetHptGenerator(Bool_t hptGenerator=kFALSE) {fHptGenerator = hptGenerator;}\r
+  Bool_t IsHptGenerator() {return fHptGenerator;}\r
+\r
+protected: \r
+\r
+ // analysis mode\r
+ Int_t fAnalysisMode;  // 0-TPC, 1-TPCITS, 2-Constrained\r
+\r
+ // hpt generator\r
+ Bool_t fHptGenerator; // hpt event generator\r
 \r
   ClassDef(AliComparisonObject,1);\r
 };\r
index ff9f2f1..538515f 100644 (file)
 
 */
 
-#include <iostream>
-
-#include "TFile.h"
-#include "TCint.h"
-#include "TH3F.h"
-#include "TH2F.h"
-#include "TF1.h"
-#include "TProfile.h"
-#include "TProfile2D.h"
-#include "TGraph2D.h"
 #include "TCanvas.h"
-#include "TGraph.h"
-
-#include "AliESDEvent.h"   
-#include "AliESD.h"
-#include "AliESDfriend.h"
-#include "AliESDfriendTrack.h"
+#include "AliESDtrack.h"
 #include "AliESDVertex.h"
 #include "AliRecInfoCuts.h" 
 #include "AliMCInfoCuts.h" 
 #include "AliLog.h" 
 #include "AliTracker.h" 
-
-#include "AliMathBase.h"
 #include "AliTreeDraw.h" 
-
 #include "AliMCInfo.h" 
 #include "AliESDRecInfo.h" 
+
 #include "AliComparisonRes.h" 
 
 using namespace std;
@@ -71,69 +54,25 @@ ClassImp(AliComparisonRes)
 //_____________________________________________________________________________
 AliComparisonRes::AliComparisonRes():
   AliComparisonObject("AliComparisonRes"),
+  fResolHisto(0),
+  fPullHisto(0),
 
-  // Vertices
-  fMCVertex(0),  //-> MC primary vertex
-  fRecVertex(0), //-> Reconstructed primary vertex
-
-  // global observables
-  fPhiTanPtTPC(0),
-  fPhiTanPtTPCITS(0),
-
-  // Resolution 
-
-  // TPC only
-  fPtResolTPC(0),
-  fPtPullTPC(0),
-  fPhiResolTanTPC(0),
-  fTanResolTanTPC(0),
-  fPhiPullTanTPC(0),
-  fTanPullTanTPC(0),
-
-  // TPC+ITS
-  fPtResolTPCITS(0),
-  fPtPullTPCITS(0),
-  fPhiResolTanTPCITS(0),
-  fTanResolTanTPCITS(0),
-  fPhiPullTanTPCITS(0),
-  fTanPullTanTPCITS(0),
-
-  //
-  // Resolution constrained param
-  //
-  fCPhiResolTan(0),  // angular resolution -  constrained
-  fCTanResolTan(0),  // angular resolution -  constrained
-  fCPtResolTan(0),   // pt resolution      -  constrained
-  fCPhiPullTan(0),   // angular resolution -  constrained
-  fCTanPullTan(0),   // angular resolution -  constrained
-  fCPtPullTan(0),    // pt resolution      -  constrained
+  // Cuts 
+  fCutsRC(0),  
+  fCutsMC(0),  
 
-  //
-  // Parametrisation histograms
-  //
+  // histogram folder 
+  fAnalysisFolder(0)
+{
+  //Init();
+}
 
-  f1Pt2ResolS1PtTPC(0),
-  f1Pt2ResolS1PtTPCITS(0),
-  fYResolS1PtTPC(0),
-  fYResolS1PtTPCITS(0),
-  fZResolS1PtTPC(0),
-  fZResolS1PtTPCITS(0),
-  fPhiResolS1PtTPC(0),
-  fPhiResolS1PtTPCITS(0),
-  fThetaResolS1PtTPC(0),
-  fThetaResolS1PtTPCITS(0),
-
-  // constrained
-  fC1Pt2ResolS1PtTPC(0),
-  fC1Pt2ResolS1PtTPCITS(0),
-  fCYResolS1PtTPC(0),
-  fCYResolS1PtTPCITS(0),
-  fCZResolS1PtTPC(0),
-  fCZResolS1PtTPCITS(0),
-  fCPhiResolS1PtTPC(0),
-  fCPhiResolS1PtTPCITS(0),
-  fCThetaResolS1PtTPC(0),
-  fCThetaResolS1PtTPCITS(0),
+//_____________________________________________________________________________
+AliComparisonRes::AliComparisonRes(Char_t* name="AliComparisonRes", Char_t* title="AliComparisonRes",Int_t analysisMode=0,Bool_t hptGenerator=kFALSE):
+//AliComparisonRes::AliComparisonRes(Char_t* name, Char_t* title,Int_t analysisMode,Bool_t hptGenerator):
+  AliComparisonObject(name,title),
+  fResolHisto(0),
+  fPullHisto(0),
 
   // Cuts 
   fCutsRC(0),  
@@ -142,68 +81,24 @@ AliComparisonRes::AliComparisonRes():
   // histogram folder 
   fAnalysisFolder(0)
 {
+  // named constructor 
+  // 
+  SetAnalysisMode(analysisMode);
+  SetHptGenerator(hptGenerator);
+
   Init();
 }
 
 //_____________________________________________________________________________
-AliComparisonRes::~AliComparisonRes(){
-  
-  // Vertices
-  if(fMCVertex) delete fMCVertex; fMCVertex=0;     
-  if(fRecVertex) delete fRecVertex; fRecVertex=0;     
+AliComparisonRes::~AliComparisonRes()
+{
+  // destructor
+   
+  if(fResolHisto) delete fResolHisto; fResolHisto=0;     
+  if(fPullHisto)  delete fPullHisto;  fPullHisto=0;     
 
-  // Global observables
-  //
-  if(fPhiTanPtTPC) delete fPhiTanPtTPC; fPhiTanPtTPC=0;     
-  if(fPhiTanPtTPCITS) delete fPhiTanPtTPCITS; fPhiTanPtTPCITS=0;     
-
-  // Resolution histograms
-  if(fPtResolTPC) delete fPtResolTPC; fPtResolTPC=0;     
-  if(fPtPullTPC) delete fPtPullTPC; fPtPullTPC=0;     
-  if(fPhiResolTanTPC) delete fPhiResolTanTPC; fPhiResolTanTPC=0;     
-  if(fTanResolTanTPC) delete fTanResolTanTPC; fTanResolTanTPC=0;     
-  if(fPhiPullTanTPC) delete fPhiPullTanTPC; fPhiPullTanTPC=0;     
-  if(fTanPullTanTPC) delete fTanPullTanTPC; fTanPullTanTPC=0;     
-
-  if(fPtResolTPCITS) delete fPtResolTPCITS; fPtResolTPCITS=0;     
-  if(fPtPullTPCITS) delete fPtPullTPCITS; fPtPullTPCITS=0;     
-  if(fPhiResolTanTPCITS) delete fPhiResolTanTPCITS; fPhiResolTanTPCITS=0;     
-  if(fTanResolTanTPCITS) delete fTanResolTanTPCITS; fTanResolTanTPCITS=0;     
-  if(fPhiPullTanTPCITS) delete fPhiPullTanTPCITS; fPhiPullTanTPCITS=0;     
-  if(fTanPullTanTPCITS) delete fTanPullTanTPCITS; fTanPullTanTPCITS=0;     
-  
-  // Resolution histograms (constrained param)
-  if(fCPhiResolTan) delete fCPhiResolTan; fCPhiResolTan=0;
-  if(fCTanResolTan) delete fCTanResolTan; fCTanResolTan=0;
-  if(fCPtResolTan)  delete fCPtResolTan;  fCPtResolTan=0; 
-  if(fCPhiPullTan)  delete fCPhiPullTan;  fCPhiPullTan=0;
-  if(fCTanPullTan)  delete fCTanPullTan;  fCTanPullTan=0;
-  if(fCPtPullTan)   delete fCPtPullTan;   fCPtPullTan=0;
-
-  // Parametrisation histograms
-  // 
-  if(f1Pt2ResolS1PtTPC) delete f1Pt2ResolS1PtTPC; f1Pt2ResolS1PtTPC=0;
-  if(f1Pt2ResolS1PtTPCITS) delete f1Pt2ResolS1PtTPCITS; f1Pt2ResolS1PtTPCITS=0;
-  if(fYResolS1PtTPC) delete fYResolS1PtTPC; fYResolS1PtTPC=0;
-  if(fYResolS1PtTPCITS) delete fYResolS1PtTPCITS; fYResolS1PtTPCITS=0;
-  if(fZResolS1PtTPC) delete fZResolS1PtTPC; fZResolS1PtTPC=0;
-  if(fZResolS1PtTPCITS) delete fZResolS1PtTPCITS; fZResolS1PtTPCITS=0;
-  if(fPhiResolS1PtTPC) delete fPhiResolS1PtTPC; fPhiResolS1PtTPC=0;
-  if(fPhiResolS1PtTPCITS) delete fPhiResolS1PtTPCITS; fPhiResolS1PtTPCITS=0;
-  if(fThetaResolS1PtTPC) delete fThetaResolS1PtTPC; fThetaResolS1PtTPC=0;
-  if(fThetaResolS1PtTPCITS) delete fThetaResolS1PtTPCITS; fThetaResolS1PtTPCITS=0;
-
-  // constrained
-  if(fC1Pt2ResolS1PtTPC) delete fC1Pt2ResolS1PtTPC; fC1Pt2ResolS1PtTPC=0;
-  if(fC1Pt2ResolS1PtTPCITS) delete fC1Pt2ResolS1PtTPCITS; fC1Pt2ResolS1PtTPCITS=0;
-  if(fCYResolS1PtTPC) delete fCYResolS1PtTPC; fCYResolS1PtTPC=0;
-  if(fCYResolS1PtTPCITS) delete fCYResolS1PtTPCITS; fCYResolS1PtTPCITS=0;
-  if(fCZResolS1PtTPC) delete fCZResolS1PtTPC; fCZResolS1PtTPC=0;
-  if(fCZResolS1PtTPCITS) delete fCZResolS1PtTPCITS; fCZResolS1PtTPCITS=0;
-  if(fCPhiResolS1PtTPC) delete fCPhiResolS1PtTPC; fCPhiResolS1PtTPC=0;
-  if(fCPhiResolS1PtTPCITS) delete fCPhiResolS1PtTPCITS; fCPhiResolS1PtTPCITS=0;
-  if(fCThetaResolS1PtTPC) delete fCThetaResolS1PtTPC; fCThetaResolS1PtTPC=0;
-  if(fCThetaResolS1PtTPCITS) delete fCThetaResolS1PtTPCITS; fCThetaResolS1PtTPCITS=0;
+  if(fCutsRC) delete fCutsRC; fCutsRC=0;
+  if(fCutsMC) delete fCutsMC; fCutsMC=0;
 
   if(fAnalysisFolder) delete fAnalysisFolder; fAnalysisFolder=0;
 }
@@ -211,186 +106,61 @@ AliComparisonRes::~AliComparisonRes(){
 //_____________________________________________________________________________
 void AliComparisonRes::Init(){
 
-  // Control histograms
-  fMCVertex = new TH3F("MCVertex","MC vertex Xv:Yv:Zv",100,-0.05,0.05,100,-0.05,0.05,100,-10,10);
-  fMCVertex->SetXTitle("Xv [cm]");
-  fMCVertex->SetYTitle("Yv [cm]");
-  fMCVertex->SetZTitle("Zv [cm]");
-
-  fRecVertex = new TH3F("RecVertex","Rec prim. vertex Xv:Yv:Zv",100,-0.01,0.01,100,-0.01,0.01,100,-0.5,0.5);
-  fRecVertex->SetXTitle("Xv [cm]");
-  fRecVertex->SetYTitle("Yv [cm]");
-  fRecVertex->SetZTitle("Zv [cm]");
-
   //
-  fPhiTanPtTPC = new TH3F("PhiTanPtTPC","phi vs tan#theta vs pt - TPC only",200,-3.5,3.5,50,-2,2,100,0.1,3.0);
-  fPhiTanPtTPC->SetXTitle("#phi [rad]");
-  fPhiTanPtTPC->SetYTitle("tan#theta");
-  fPhiTanPtTPC->SetZTitle("p_{t} [GeV]");
-
-  fPhiTanPtTPCITS = new TH3F("PhiTanPtTPCITS","phi vs tan#theta vs pt - TPC+ITS",200,-3.5,3.5,50,-2,2,100,0.1,3.0);
-  fPhiTanPtTPCITS->SetXTitle("#phi [rad]");
-  fPhiTanPtTPCITS->SetYTitle("tan#theta");
-  fPhiTanPtTPCITS->SetZTitle("p_{t} [GeV]");
-
+  // histogram bining
   //
-  fPtResolTPC = new TH2F("PtResolTPC","pt resol",10, 0.1,3,200,-0.2,0.2);
-  fPtResolTPC->SetXTitle("p_{t} [GeV]");
-  fPtResolTPC->SetYTitle("#Deltap_{t}/p_{t}");
-
-  fPtPullTPC = new TH2F("fPtPullTPC","pt pull",10, 0.1,3,200,-6,6);
-  fPtPullTPC->SetXTitle("p_{t} [GeV]");
-  fPtPullTPC->SetYTitle("#Deltap_{t}/#Sigma");
-
-  fPhiResolTanTPC = new TH2F("PhiResolTanTPC","PhiResolTanTPC",50, -2,2,200,-0.025,0.025);   
-  fPhiResolTanTPC->SetXTitle("tan(#theta)");
-  fPhiResolTanTPC->SetYTitle("#Delta#phi [rad]");
-
-  fTanResolTanTPC = new TH2F("TanResolTanTPC","TanResolTanTPC",50, -2,2,200,-0.025,0.025);
-  fTanResolTanTPC->SetXTitle("tan(#theta)");
-  fTanResolTanTPC->SetYTitle("#Delta#theta [rad]");
-
-  fPhiPullTanTPC = new TH2F("PhiPullTanTPC","PhiPullTanTPC",50, -2,2,200,-5,5);   
-  fPhiPullTanTPC->SetXTitle("Tan(#theta)");
-  fPhiPullTanTPC->SetYTitle("#Delta#phi/#Sigma");
-
-  fTanPullTanTPC = new TH2F("TanPullTanTPC","TanPullTanTPC",50, -2,2,200,-5,5);
-  fTanPullTanTPC->SetXTitle("Tan(#theta)");
-  fTanPullTanTPC->SetYTitle("#Delta#theta/#Sigma");
-
-  fPtResolTPCITS = new TH2F("PtResolTPCITS","pt resol",10, 0.1,3,200,-0.2,0.2);
-  fPtResolTPCITS->SetXTitle("p_{t} [GeV]");
-  fPtResolTPCITS->SetYTitle("#Deltap_{t}/p_{t}");
-
-  fPtPullTPCITS = new TH2F("fPtPullTPCITS","pt pull",10, 0.1,3,200,-6,6);
-  fPtPullTPCITS->SetXTitle("p_{t} [GeV]");
-  fPtPullTPCITS->SetYTitle("#Deltap_{t}/#Sigma");
-
-  fPhiResolTanTPCITS = new TH2F("PhiResolTanTPCITS","PhiResolTanTPCITS",50, -2,2,200,-0.025,0.025);   
-  fPhiResolTanTPCITS->SetXTitle("tan(#theta)");
-  fPhiResolTanTPCITS->SetYTitle("#Delta#phi [rad]");
-
-  fTanResolTanTPCITS = new TH2F("TanResolTanTPCITS","TanResolTanTPCITS",50, -2,2,200,-0.025,0.025);
-  fTanResolTanTPCITS->SetXTitle("tan(#theta)");
-  fTanResolTanTPCITS->SetYTitle("#Delta#theta [rad]");
-
-  fPhiPullTanTPCITS = new TH2F("PhiPullTanTPCITS","PhiPullTanTPCITS",50, -2,2,200,-5,5);   
-  fPhiPullTanTPCITS->SetXTitle("Tan(#theta)");
-  fPhiPullTanTPCITS->SetYTitle("#Delta#phi/#Sigma");
-
-  fTanPullTanTPCITS = new TH2F("TanPullTanTPCITS","TanPullTanTPCITS",50, -2,2,200,-5,5);
-  fTanPullTanTPCITS->SetXTitle("Tan(#theta)");
-  fTanPullTanTPCITS->SetYTitle("#Delta#theta/#Sigma");
-
-  // Resolution constrained param
-  fCPhiResolTan = new TH2F("CPhiResolTan","CPhiResolTan",50, -2,2,200,-0.025,0.025);   
-  fCPhiResolTan->SetXTitle("tan(#theta)");
-  fCPhiResolTan->SetYTitle("#Delta#phi [rad]");
-
-  fCTanResolTan = new TH2F("CTanResolTan","CTanResolTan",50, -2,2,200,-0.025,0.025);
-  fCTanResolTan->SetXTitle("tan(#theta)");
-  fCTanResolTan->SetYTitle("#Delta#theta [rad]");
-
-  fCPtResolTan=new TH2F("CPtResol","CPtResol",50, -2,2,200,-0.2,0.2);    
-  fCPtResolTan->SetXTitle("Tan(#theta)");
-  fCPtResolTan->SetYTitle("#Deltap_{t}/p_{t}");
-
-  fCPhiPullTan = new TH2F("CPhiPullTan","CPhiPullTan",50, -2,2,200,-5,5);   
-  fCPhiPullTan->SetXTitle("Tan(#theta)");
-  fCPhiPullTan->SetYTitle("#Delta#phi/#Sigma");
-
-  fCTanPullTan = new TH2F("CTanPullTan","CTanPullTan",50, -2,2,200,-5,5);
-  fCTanPullTan->SetXTitle("Tan(#theta)");
-  fCTanPullTan->SetYTitle("#Delta#theta/#Sigma");
-
-  fCPtPullTan=new TH2F("CPtPull","CPtPull",50, -2,2,200,-5,5);    
-  fCPtPullTan->SetXTitle("Tan(#theta)");
-  fCPtPullTan->SetYTitle("(1/mcp_{t}-1/p_{t})/#Sigma");
-  
-  //
-  // Parametrisation histograms
-  // 
-
-  f1Pt2ResolS1PtTPC = new TH2F("f1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);  
-  f1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  f1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
-
-  f1Pt2ResolS1PtTPCITS = new TH2F("f1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs sqrt(1/pt))",100,0,3,200,-0.010,0.010);  
-  f1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  f1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
-
-  fYResolS1PtTPC = new TH2F("fYResolS1PtTPC","fYResolS1PtTPC",100, 0,3,200,-1.0,1.0);   
-  fYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fYResolS1PtTPC->SetYTitle("#DeltaY");
-
-  fYResolS1PtTPCITS = new TH2F("fYResolS1PtTPCITS","fYResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);   
-  fYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fYResolS1PtTPCITS->SetYTitle("#DeltaY");
-
-  fZResolS1PtTPC = new TH2F("fZResolS1PtTPC","fZResolS1PtTPC",100, 0,3,200,-1.0,1.0);   
-  fZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fZResolS1PtTPC->SetYTitle("#DeltaZ");
-
-  fZResolS1PtTPCITS = new TH2F("fZResolS1PtTPCITS","fZResolS1PtTPCITS",100, 0,3,200,-0.05,0.05);   
-  fZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fZResolS1PtTPCITS->SetYTitle("#DeltaZ");
-
-  fPhiResolS1PtTPC = new TH2F("fPhiResolS1PtTPC","fPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);   
-  fPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fPhiResolS1PtTPC->SetYTitle("#Delta#phi");
-
-  fPhiResolS1PtTPCITS = new TH2F("fPhiResolS1PtTPCITS","fPhiResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);   
-  fPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
-
-  fThetaResolS1PtTPC = new TH2F("fThetaResolS1PtTPC","fThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);   
-  fThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fThetaResolS1PtTPC->SetYTitle("#Delta#theta");
-
-  fThetaResolS1PtTPCITS = new TH2F("fThetaResolS1PtTPCITS","fThetaResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);   
-  fThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
-  
-  // constrained
-  fC1Pt2ResolS1PtTPC = new TH2F("fC1Pt2ResolS1PtTPC","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);  
-  fC1Pt2ResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fC1Pt2ResolS1PtTPC->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
-
-  fC1Pt2ResolS1PtTPCITS = new TH2F("fC1Pt2ResolS1PtTPCITS","(1/mcpt-1/pt)/(1+1/mcpt)^2 vs 1/pt)",100,0,3,200,-0.010,0.010);  
-  fC1Pt2ResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fC1Pt2ResolS1PtTPCITS->SetYTitle("(1/mcp_{t}-1/p_{t})/(1+1/mcp_{t})^2)");
-
-  fCYResolS1PtTPC = new TH2F("fCYResolS1PtTPC","fCYResolS1PtTPC",100, 0,3,200,-1.0,1.0);   
-  fCYResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fCYResolS1PtTPC->SetYTitle("#DeltaY");
-
-  fCYResolS1PtTPCITS = new TH2F("fCYResolS1PtTPCITS","fCYResolS1PtTPCITS",100, 0,3,200,-0.01,0.01);   
-  fCYResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fCYResolS1PtTPCITS->SetYTitle("#DeltaY");
-
-  fCZResolS1PtTPC = new TH2F("fCZResolS1PtTPC","fCZResolS1PtTPC",100, 0,3,200,-1.0,1.0);   
-  fCZResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fCZResolS1PtTPC->SetYTitle("#DeltaZ");
 
-  fCZResolS1PtTPCITS = new TH2F("fCZResolS1PtTPCITS","fCZResolS1PtTPCITS",100, 0,3,200,-0.025,0.025);   
-  fCZResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fCZResolS1PtTPCITS->SetYTitle("#DeltaZ");
+  // set pt bins
+   Int_t nPtBins = 31;
+   Double_t binsPt[32] = {0.,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.7,0.8,0.9,1.0,1.2,1.4,1.6,1.8,2.0,2.25,2.5,2.75,3.,3.5,4.,5.,6.,8.,10.};
+  Double_t ptMin = 0., ptMax = 10.; 
 
-  fCPhiResolS1PtTPC = new TH2F("fCPhiResolS1PtTPC","fCPhiResolS1PtTPC",100, 0,3,200,-0.025,0.025);   
-  fCPhiResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fCPhiResolS1PtTPC->SetYTitle("#Delta#phi");
 
-  fCPhiResolS1PtTPCITS = new TH2F("fCPhiResolS1PtTPCITS","fCPhiResolS1PtTPCITS",100, 0,3,200,-0.003,0.003);   
-  fCPhiResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fCPhiResolS1PtTPCITS->SetYTitle("#Delta#phi");
-
-  fCThetaResolS1PtTPC = new TH2F("fCThetaResolS1PtTPC","fCThetaResolS1PtTPC",100, 0,3,200,-0.025,0.025);   
-  fCThetaResolS1PtTPC->SetXTitle("#sqrt{1/mcp_{t}}");
-  fCThetaResolS1PtTPC->SetYTitle("#Delta#theta");
+  if(IsHptGenerator() == kTRUE) {
+    nPtBins = 100;
+    ptMin = 0.; ptMax = 100.; 
+  }
 
-  fCThetaResolS1PtTPCITS = new TH2F("fCThetaResolS1PtTPCITS","fCThetaResolS1PtTPCITS",100, 0,3,200,-0.005,0.005);   
-  fCThetaResolS1PtTPCITS->SetXTitle("#sqrt{1/mcp_{t}}");
-  fCThetaResolS1PtTPCITS->SetYTitle("#Delta#theta");
+  // res_y:res_z:res_phi,res_lambda:res_1pt:y:z:eta:phi:pt
+  Int_t binsResolHisto[10]={100,100,100,100,100,50,100,30,144,nPtBins};
+  Double_t minResolHisto[10]={-1.,-1.,-0.03,-0.03,-0.2,-0.03,-20.,-1.5,0.,ptMin};
+  Double_t maxResolHisto[10]={ 1., 1., 0.03, 0.03, 0.2, 0.03, 20., 1.5,2.*TMath::Pi(), ptMax};
+
+
+  fResolHisto = new THnSparseF("fResolHisto","res_y:res_z:res_phi:res_lambda:res_1pt:y:z:eta:phi:pt",10,binsResolHisto,minResolHisto,maxResolHisto);
+  if(!IsHptGenerator()) fResolHisto->SetBinEdges(9,binsPt);
+
+  fResolHisto->GetAxis(0)->SetTitle("res_y (cm)");
+  fResolHisto->GetAxis(1)->SetTitle("res_z (cm)");
+  fResolHisto->GetAxis(2)->SetTitle("res_phi (rad)");
+  fResolHisto->GetAxis(3)->SetTitle("res_lambda (rad)");
+  fResolHisto->GetAxis(4)->SetTitle("res_1pt (GeV/c)^{-1}");
+  fResolHisto->GetAxis(5)->SetTitle("y (cm)");
+  fResolHisto->GetAxis(6)->SetTitle("z (cm)");
+  fResolHisto->GetAxis(7)->SetTitle("eta");
+  fResolHisto->GetAxis(8)->SetTitle("phi (rad)");
+  fResolHisto->GetAxis(9)->SetTitle("pt (GeV/c)");
+  fResolHisto->Sumw2();
+
+  //pull_y:pull_z:pull_lambda:pull_phi:pull_1pt:y:z:eta:phi:pt
+  Int_t binsPullHisto[10]={100,100,100,100,100,50,100,30,144,nPtBins};
+  Double_t minPullHisto[10]={-5.,-5.,-5.,-5.,-5.,-0.03, -20.,-1.5, 0., ptMin};
+  Double_t maxPullHisto[10]={ 5., 5., 5., 5., 5., 0.03, 20., 1.5, 2.*TMath::Pi(),ptMax};
+
+  fPullHisto = new THnSparseF("fPullHisto","pull_y:pull_z:pull_phi:pull_lambda:pull_1pt:y:z:eta:phi:pt",10,binsPullHisto,minPullHisto,maxPullHisto);
+  if(!IsHptGenerator()) fPullHisto->SetBinEdges(9,binsPt);
+  
+  fPullHisto->GetAxis(0)->SetTitle("res_y (cm)");
+  fPullHisto->GetAxis(1)->SetTitle("res_z (cm)");
+  fPullHisto->GetAxis(2)->SetTitle("res_phi (rad)");
+  fPullHisto->GetAxis(3)->SetTitle("res_lambda (rad)");
+  fPullHisto->GetAxis(4)->SetTitle("res_1pt (GeV/c)^{-1}");
+  fPullHisto->GetAxis(5)->SetTitle("y (rad)");
+  fPullHisto->GetAxis(6)->SetTitle("z (rad)");
+  fPullHisto->GetAxis(7)->SetTitle("eta");
+  fPullHisto->GetAxis(8)->SetTitle("phi (rad)");
+  fPullHisto->GetAxis(9)->SetTitle("pt (GeV/c)");
+  fPullHisto->Sumw2();
 
   // Init cuts 
   if(!fCutsMC) 
@@ -403,7 +173,7 @@ void AliComparisonRes::Init(){
 }
 
 //_____________________________________________________________________________
-void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
+void AliComparisonRes::ProcessTPC(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC)
 {
   // Fill resolution comparison information 
   AliExternalTrackParam *track = 0;
@@ -411,25 +181,25 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   Double_t kMaxD      = 123456.0; // max distance
   AliESDVertex vertexMC;  // MC primary vertex
 
-  Int_t clusterITS[200];
   Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
 
-  Float_t deltaPt, pullPt, deltaPhi,pullPhi, deltaTan, pullTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt; 
-  Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, pullPhiTPC, deltaTanTPC, pullTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC; 
+  Float_t delta1PtTPC, deltaYTPC, deltaZTPC, deltaPhiTPC, deltaLambdaTPC; 
+  Float_t pull1PtTPC, pullYTPC, pullZTPC, pullPhiTPC, pullLambdaTPC; 
+  //Float_t delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC; 
 
+  Float_t mceta =  infoMC->GetParticle().Eta();
+  Float_t mcphi =  infoMC->GetParticle().Phi();
+  if(mcphi<0) mcphi += 2.*TMath::Pi();
   Float_t mcpt = infoMC->GetParticle().Pt();
-  Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
-  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
-  Float_t eta =  infoMC->GetParticle().Eta();
 
   // distance to Prim. vertex 
   const Double_t* dv = infoMC->GetVDist(); 
   Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
 
-  // Check selection cuts
+  // Only 5 charged particle species (e,mu,pi,K,p)
   if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; 
   if (!isPrim) return;
-  if (infoRC->GetStatus(1)!=3) return; // TPC refit
+  //if (infoRC->GetStatus(1)!=3) return; // TPC refit
   if (!infoRC->GetESDtrack()) return;  
   if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
 
@@ -438,30 +208,6 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
   vertexMC.SetYv( infoMC->GetParticle().Vy() - dv[1] );
   vertexMC.SetZv( infoMC->GetParticle().Vz() - dv[2] );
 
-  // Fill MC vertex histo
-  fMCVertex->Fill(vertexMC.GetXv(),vertexMC.GetYv(),vertexMC.GetZv());
-
-   
-  // Fill Rec vertex histo
-  //fRecVertex->Fill(infoRC->GetESDvertex()->GetXv(),infoRC->GetESDvertex()->GetYv(),infoRC->GetESDvertex()->GetZv());
-  //printf("Rec vertex xv %f, yv %f, zv %f \n",infoRC->GetESDvertex()->GetXv(),infoRC->GetESDvertex()->GetYv(),infoRC->GetESDvertex()->GetZv());
-
-  deltaPt= (mcpt-infoRC->GetESDtrack()->Pt())/mcpt;  
-  pullPt= (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Sqrt(infoRC->GetESDtrack()->GetSigma1Pt2());  
-  deltaPhi = TMath::ATan2(infoRC->GetESDtrack()->Py(),infoRC->GetESDtrack()->Px())-
-                     TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
-  pullPhi = deltaPhi/TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaSnp2()); 
-
-  deltaTan = TMath::ATan2(infoRC->GetESDtrack()->Pz(),infoRC->GetESDtrack()->Pt())-
-                     TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
-  pullTan = deltaTan/TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaTgl2());
-
-  delta1Pt2 = (1/mcpt-infoRC->GetESDtrack()->OneOverPt())/TMath::Power(1+1/mcpt,2);       
-  deltaY1Pt = (infoMC->GetParticle().Vy()-infoRC->GetESDtrack()->GetY()) / (0.2+1/mcpt);
-  deltaZ1Pt = (infoMC->GetParticle().Vz()-infoRC->GetESDtrack()->GetZ()) / (0.2+1/mcpt);
-  deltaPhi1Pt = deltaPhi   / (0.1+1/mcpt);
-  deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
-
   // calculate track parameters at vertex
   const AliExternalTrackParam *innerTPC =  0;
   if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
@@ -472,70 +218,114 @@ void AliComparisonRes::Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
 
       // Fill parametrisation histograms (only TPC track)
       if(bDCAStatus) 
-         {
-                 
-                       deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;  
-                       pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());  
-                       deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
-                                                               TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
-                        pullPhiTPC = deltaPhiTPC/TMath::Sqrt(innerTPC->GetSigmaSnp2()); 
-
-                       deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
-                                                               TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
-                        pullTanTPC = deltaTanTPC/TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaTgl2());
-
-                       delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);       
-                       deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
-                       deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
-                       deltaPhi1PtTPC = deltaPhiTPC   / (0.1+1/mcpt);
-                       deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
-
-               fPhiTanPtTPC->Fill(TMath::ATan2(innerTPC->Py(),innerTPC->Px()), 
-                                          TMath::ATan2(innerTPC->Pz(),innerTPC->Pt()),
-                                                          innerTPC->Pt()); 
-
-                       f1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
-                       fYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
-                       fZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
-                       fPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
-                       fThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
-
-               fPtResolTPC->Fill(mcpt,deltaPtTPC);
-                   fPtPullTPC->Fill(mcpt,pullPtTPC);
-                   fPhiResolTanTPC->Fill(tantheta,deltaPhiTPC);
-                   fPhiPullTanTPC->Fill(tantheta,pullPhiTPC);
-                   fTanResolTanTPC->Fill(tantheta,deltaTanTPC);
-                   fTanPullTanTPC->Fill(tantheta,pullTanTPC);
+      {
+          // select primaries
+          if(TMath::Abs(dca[0])<fCutsRC->GetMaxDCAToVertexXY() && TMath::Abs(dca[1])<fCutsRC->GetMaxDCAToVertexZ()) 
+         { 
+
+            deltaYTPC= track->GetY()-infoMC->GetParticle().Vy();
+            deltaZTPC = track->GetZ()-infoMC->GetParticle().Vz();
+            deltaLambdaTPC = TMath::ATan2(track->Pz(),track->Pt())-TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
+            deltaPhiTPC = TMath::ATan2(track->Py(),track->Px())-TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
+           delta1PtTPC = (track->OneOverPt()-1./mcpt)*mcpt;
+
+            pullYTPC= (track->GetY()-infoMC->GetParticle().Vy()) / TMath::Sqrt(track->GetSigmaY2());
+            pullZTPC = (track->GetZ()-infoMC->GetParticle().Vz()) / TMath::Sqrt(track->GetSigmaZ2());
+            pullLambdaTPC = deltaLambdaTPC / TMath::Sqrt(track->GetSigmaTgl2());
+            pullPhiTPC = deltaPhiTPC / TMath::Sqrt(track->GetSigmaSnp2()); 
+           pull1PtTPC = (track->OneOverPt()-1./mcpt) / TMath::Sqrt(track->GetSigma1Pt2());
+
+            Double_t vResolHisto[10] = {deltaYTPC,deltaZTPC,deltaPhiTPC,deltaLambdaTPC,delta1PtTPC,infoMC->GetParticle().Vy(),infoMC->GetParticle().Vz(),mceta,mcphi,mcpt};
+           fResolHisto->Fill(vResolHisto);
+
+            Double_t vPullHisto[10] = {pullYTPC,pullZTPC,pullPhiTPC,pullLambdaTPC,pull1PtTPC,infoMC->GetParticle().Vy(),infoMC->GetParticle().Vz(),mceta,mcphi,mcpt};
+           fPullHisto->Fill(vPullHisto);
          }
-         delete track;
+
+          /*
+            delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);       
+            deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
+            deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
+            deltaPhi1PtTPC = deltaPhiTPC   / (0.1+1/mcpt);
+            deltaTheta1PtTPC = deltaLambdaTPC / (0.1+1/mcpt);
+
+           fPhiEtaPtTPC->Fill(TMath::ATan2(innerTPC->Py(),innerTPC->Px()), innerTPC->Eta(), innerTPC->Pt()); 
+
+            f1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
+            fYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
+            fZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
+            fPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
+            fThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
+
+            fPtResolPtTPC->Fill(mcpt,deltaPtTPC);
+            fPtPullPtTPC->Fill(mcpt,pullPtTPC);
+            fPhiResolEtaTPC->Fill(eta,deltaPhiTPC);
+            fPhiPullEtaTPC->Fill(eta,pullPhiTPC);
+            fLambdaResolEtaTPC->Fill(eta,deltaLambdaTPC);
+            fLambdaPullEtaTPC->Fill(eta,pullLambdaTPC);
+          */
+       }
+    delete track;
     }
   }
+}
 
-  // TPC and ITS clusters in the system
-  if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS()) 
-  {
-         fPhiTanPtTPCITS->Fill(TMath::ATan2(infoRC->GetESDtrack()->Py(),infoRC->GetESDtrack()->Px()), 
-                               TMath::ATan2(infoRC->GetESDtrack()->Pz(),infoRC->GetESDtrack()->Pt()), 
-                               infoRC->GetESDtrack()->Pt()); 
-
-      f1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
-      fYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
-      fZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
-      fPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
-      fThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
-
-         fPtResolTPCITS->Fill(mcpt,deltaPt);
-         fPtPullTPCITS->Fill(mcpt,pullPt);
-
-         fPhiResolTanTPCITS->Fill(tantheta,deltaPhi);
-         fPhiPullTanTPCITS->Fill(tantheta,pullPhi);
-         fTanResolTanTPCITS->Fill(tantheta,deltaTan);
-         fTanPullTanTPCITS->Fill(tantheta,pullTan);
+//_____________________________________________________________________________
+void AliComparisonRes::ProcessTPCITS(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC)
+{
+  Int_t clusterITS[200];
+  Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
+
+  Float_t delta1PtTPC, deltaYTPC, deltaZTPC, deltaPhiTPC, deltaLambdaTPC; 
+  Float_t pull1PtTPC, pullYTPC, pullZTPC, pullPhiTPC, pullLambdaTPC; 
+
+  Float_t mceta =  infoMC->GetParticle().Eta();
+  Float_t mcphi =  infoMC->GetParticle().Phi();
+  if(mcphi<0) mcphi += 2.*TMath::Pi();
+  Float_t mcpt = infoMC->GetParticle().Pt();
+
+  // distance to Prim. vertex 
+  const Double_t* dv = infoMC->GetVDist(); 
+  Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
+
+  // Only 5 charged particle species (e,mu,pi,K,p)
+  if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; 
+  if (!isPrim) return;
+  if (infoRC->GetStatus(1)!=3) return; // TPC refit
+  if (!infoRC->GetESDtrack()) return;  
+  if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
+
+  infoRC->GetESDtrack()->GetImpactParameters(dca,cov);
+
+  // select primaries
+  if(TMath::Abs(dca[0])<fCutsRC->GetMaxDCAToVertexXY() && TMath::Abs(dca[1])<fCutsRC->GetMaxDCAToVertexZ()) 
+  { 
+    deltaYTPC= infoRC->GetESDtrack()->GetY()-infoMC->GetParticle().Vy();
+    deltaZTPC = infoRC->GetESDtrack()->GetZ()-infoMC->GetParticle().Vz();
+    deltaLambdaTPC = TMath::ATan2(infoRC->GetESDtrack()->Pz(),infoRC->GetESDtrack()->Pt())-TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
+    deltaPhiTPC = TMath::ATan2(infoRC->GetESDtrack()->Py(),infoRC->GetESDtrack()->Px())-TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
+    delta1PtTPC = (infoRC->GetESDtrack()->OneOverPt()-1./mcpt)*mcpt;
+
+    pullYTPC= (infoRC->GetESDtrack()->GetY()-infoMC->GetParticle().Vy()) / TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaY2());
+    pullZTPC = (infoRC->GetESDtrack()->GetZ()-infoMC->GetParticle().Vz()) / TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaZ2());
+    pullLambdaTPC = deltaLambdaTPC / TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaTgl2());
+    pullPhiTPC = deltaPhiTPC / TMath::Sqrt(infoRC->GetESDtrack()->GetSigmaSnp2()); 
+    pull1PtTPC = (infoRC->GetESDtrack()->OneOverPt()-1./mcpt) / TMath::Sqrt(infoRC->GetESDtrack()->GetSigma1Pt2());
+
+    Double_t vResolHisto[10] = {deltaYTPC,deltaZTPC,deltaPhiTPC,deltaLambdaTPC,delta1PtTPC,infoMC->GetParticle().Vy(),infoMC->GetParticle().Vz(),mceta,mcphi,mcpt};
+    Double_t vPullHisto[10] = {pullYTPC,pullZTPC,pullPhiTPC,pullLambdaTPC,pull1PtTPC,infoMC->GetParticle().Vy(),infoMC->GetParticle().Vz(),mceta,mcphi,mcpt};
+
+    // TPC and ITS clusters in the system
+    if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS()) 
+    {
+      fResolHisto->Fill(vResolHisto);
+      fPullHisto->Fill(vPullHisto);
+    }
   }
 }
 
 //_____________________________________________________________________________
-void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *infoRC)
+void AliComparisonRes::ProcessConstrained(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC)
 {
   // Fill resolution comparison information (constarained parameters) 
   //
@@ -544,112 +334,76 @@ void AliComparisonRes::ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *info
   Double_t kMaxD      = 123456.0; // max distance
   AliESDVertex vertexMC;  // MC primary vertex
 
-  Int_t clusterITS[200];
   Double_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z
-  Float_t deltaPt, pullPt, deltaPhi, pullPhi, deltaTan, pullTan, delta1Pt2, deltaY1Pt, deltaZ1Pt, deltaPhi1Pt, deltaTheta1Pt; 
-  Float_t deltaPtTPC, pullPtTPC, deltaPhiTPC, deltaTanTPC, delta1Pt2TPC, deltaY1PtTPC, deltaZ1PtTPC, deltaPhi1PtTPC, deltaTheta1PtTPC; 
 
+  Float_t delta1PtTPC, deltaYTPC, deltaZTPC, deltaPhiTPC, deltaLambdaTPC; 
+  Float_t pull1PtTPC, pullYTPC, pullZTPC, pullPhiTPC, pullLambdaTPC; 
+
+  Float_t mceta =  infoMC->GetParticle().Eta();
+  Float_t mcphi =  infoMC->GetParticle().Phi();
+  if(mcphi<0) mcphi += 2.*TMath::Pi();
   Float_t mcpt = infoMC->GetParticle().Pt();
-  Float_t s1mcpt = TMath::Sqrt(1./infoMC->GetParticle().Pt());
-  Float_t tantheta = TMath::Tan(infoMC->GetParticle().Theta()-TMath::Pi()*0.5);
 
   // distance to Prim. vertex 
   const Double_t* dv = infoMC->GetVDist(); 
   Bool_t isPrim = TMath::Sqrt(dv[0]*dv[0] + dv[1]*dv[1])<fCutsMC->GetMaxR() && TMath::Abs(dv[2])<fCutsMC->GetMaxVz();
-  
+
+  // calculate and set prim. vertex
+  vertexMC.SetXv( infoMC->GetParticle().Vx() - dv[0] );
+  vertexMC.SetYv( infoMC->GetParticle().Vy() - dv[1] );
+  vertexMC.SetZv( infoMC->GetParticle().Vz() - dv[2] );
+
   // Check selection cuts
   if (fCutsMC->IsPdgParticle(TMath::Abs(infoMC->GetParticle().GetPdgCode())) == kFALSE) return; 
   if (!isPrim) return;
-  if (infoRC->GetStatus(1)!=3) return;
+  if (infoRC->GetStatus(1)!=3) return; // TPC refit
   if (!infoRC->GetESDtrack()) return;  
   if (infoRC->GetESDtrack()->GetTPCNcls()<fCutsRC->GetMinNClustersTPC()) return;
-  if (!infoRC->GetESDtrack()->GetConstrainedParam()) return;
-
-// calculate and set prim. vertex
-  vertexMC.SetXv( infoMC->GetParticle().Vx() - dv[0] );
-  vertexMC.SetYv( infoMC->GetParticle().Vy() - dv[1] );
-  vertexMC.SetZv( infoMC->GetParticle().Vz() - dv[2] );
 
   // constrained parameters resolution
   const AliExternalTrackParam * cparam = infoRC->GetESDtrack()->GetConstrainedParam();
-  deltaPt= (mcpt-cparam->Pt())/mcpt;  
-  pullPt= (1/mcpt-cparam->OneOverPt())/TMath::Sqrt(cparam->GetSigma1Pt2());          
-  deltaPhi = TMath::ATan2(cparam->Py(),cparam->Px())-
-                     TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
-  pullPhi = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2()); 
-  deltaTan = TMath::ATan2(cparam->Pz(),cparam->Pt())-TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
-  pullTan = deltaPhi/TMath::Sqrt(cparam->GetSigmaSnp2()); 
+  if(!cparam) return;
 
-
-  delta1Pt2 = (1/mcpt-cparam->OneOverPt())/TMath::Power(1+1/mcpt,2);       
-
-  deltaY1Pt = (infoMC->GetParticle().Vy()-cparam->GetY()) / (0.2+1/mcpt);
-  deltaZ1Pt = (infoMC->GetParticle().Vz()-cparam->GetZ()) / (0.2+1/mcpt);
-  deltaPhi1Pt = deltaPhi   / (0.1+1/mcpt);
-  deltaTheta1Pt = deltaTan / (0.1+1/mcpt);
-
-  // calculate track parameters at vertex
-  const AliExternalTrackParam *innerTPC =  0;
-  if ((innerTPC = infoRC->GetESDtrack()->GetTPCInnerParam()) != 0)
+  if ((track = new AliExternalTrackParam(*cparam)) != 0)
   {
-    if ((track = new AliExternalTrackParam(*infoRC->GetESDtrack()->GetTPCInnerParam())) != 0 )
-    {
-      Bool_t bDCAStatus = track->PropagateToDCA(&vertexMC,field,kMaxD,dca,cov);
-
-      // Fill parametrisation histograms (only TPC track)
-      if(bDCAStatus) 
-         {
-                 deltaPtTPC= (mcpt-innerTPC->Pt())/mcpt;  
-                 pullPtTPC= (1/mcpt-innerTPC->OneOverPt())/TMath::Sqrt(innerTPC->GetSigma1Pt2());  
-                 deltaPhiTPC = TMath::ATan2(innerTPC->Py(),innerTPC->Px())-
-                                                               TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
-
-                 deltaTanTPC = TMath::ATan2(innerTPC->Pz(),innerTPC->Pt())-
-                                                               TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
-
-                 delta1Pt2TPC = (1/mcpt-innerTPC->OneOverPt())/TMath::Power(1+1/mcpt,2);       
-                 deltaY1PtTPC= (infoMC->GetParticle().Vy()-innerTPC->GetY()) / (0.2+1/mcpt);
-                 deltaZ1PtTPC = (infoMC->GetParticle().Vz()-innerTPC->GetZ()) / (0.2+1/mcpt);
-                 deltaPhi1PtTPC = deltaPhiTPC   / (0.1+1/mcpt);
-                 deltaTheta1PtTPC = deltaTanTPC / (0.1+1/mcpt);
-
-          fC1Pt2ResolS1PtTPC->Fill(s1mcpt,delta1Pt2TPC);
-          fCYResolS1PtTPC->Fill(s1mcpt,deltaY1PtTPC);
-          fCZResolS1PtTPC->Fill(s1mcpt,deltaZ1PtTPC);
-          fCPhiResolS1PtTPC->Fill(s1mcpt,deltaPhi1PtTPC);
-          fCThetaResolS1PtTPC->Fill(s1mcpt,deltaTheta1PtTPC);
-         }
-         delete track;
+    Bool_t bDCAStatus = track->PropagateToDCA(&vertexMC,field,kMaxD,dca,cov);
+    if(bDCAStatus) {
+      if(TMath::Abs(dca[0])<fCutsRC->GetMaxDCAToVertexXY() && TMath::Abs(dca[1])<fCutsRC->GetMaxDCAToVertexZ())
+      {
+        deltaYTPC= track->GetY()-infoMC->GetParticle().Vy();
+        deltaZTPC = track->GetZ()-infoMC->GetParticle().Vz();
+        deltaLambdaTPC = TMath::ATan2(track->Pz(),track->Pt())-TMath::ATan2(infoMC->GetParticle().Pz(),infoMC->GetParticle().Pt());
+        deltaPhiTPC = TMath::ATan2(track->Py(),track->Px())-TMath::ATan2(infoMC->GetParticle().Py(),infoMC->GetParticle().Px());
+        delta1PtTPC = (track->OneOverPt()-1./mcpt)*mcpt;
+
+        pullYTPC= (track->GetY()-infoMC->GetParticle().Vy()) / TMath::Sqrt(track->GetSigmaY2());
+        pullZTPC = (track->GetZ()-infoMC->GetParticle().Vz()) / TMath::Sqrt(track->GetSigmaZ2());
+        pullLambdaTPC = deltaLambdaTPC / TMath::Sqrt(track->GetSigmaTgl2());
+        pullPhiTPC = deltaPhiTPC / TMath::Sqrt(track->GetSigmaSnp2()); 
+        pull1PtTPC = (track->OneOverPt()-1./mcpt) / TMath::Sqrt(track->GetSigma1Pt2());
+
+        Double_t vResolHisto[10] = {deltaYTPC,deltaZTPC,deltaPhiTPC,deltaLambdaTPC,delta1PtTPC,infoMC->GetParticle().Vy(),infoMC->GetParticle().Vz(),mceta,mcphi,mcpt};
+        fResolHisto->Fill(vResolHisto);
+
+        Double_t vPullHisto[10] = {pullYTPC,pullZTPC,pullPhiTPC,pullLambdaTPC,pull1PtTPC,infoMC->GetParticle().Vy(),infoMC->GetParticle().Vz(),mceta,mcphi,mcpt};
+        fPullHisto->Fill(vPullHisto);
+      }
     }
-  }
-
- // TPC and ITS in the system
-  if(infoRC->GetESDtrack()->GetITSclusters(clusterITS)>fCutsRC->GetMinNClustersITS()) 
-  {
-      fC1Pt2ResolS1PtTPCITS->Fill(s1mcpt,delta1Pt2);
-      fCYResolS1PtTPCITS->Fill(s1mcpt,deltaY1Pt);
-      fCZResolS1PtTPCITS->Fill(s1mcpt,deltaZ1Pt);
-      fCPhiResolS1PtTPCITS->Fill(s1mcpt,deltaPhi1Pt);
-      fCThetaResolS1PtTPCITS->Fill(s1mcpt,deltaTheta1Pt);
-
-         // Fill histograms
-         fCPtResolTan->Fill(tantheta,deltaPt);
-         fCPtPullTan->Fill(tantheta,pullPt);
-         fCPhiResolTan->Fill(tantheta,deltaPhi);
-         fCPhiPullTan->Fill(tantheta,pullPhi);
-         fCTanResolTan->Fill(tantheta,deltaTan);
-         fCTanPullTan->Fill(tantheta,pullTan);
+  delete track;
   }
 }
  
 //_____________________________________________________________________________
-void AliComparisonRes::Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC){
+void AliComparisonRes::Exec(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC){
   
   // Process comparison information 
-  Process(infoMC,infoRC);
-  ProcessConstrained(infoMC,infoRC);
+  if(GetAnalysisMode() == 0) ProcessTPC(infoMC,infoRC);
+  else if(GetAnalysisMode() == 1) ProcessTPCITS(infoMC,infoRC);
+  else if(GetAnalysisMode() == 2) ProcessConstrained(infoMC,infoRC);
+  else {
+    printf("ERROR: AnalysisMode %d \n",fAnalysisMode);
+    return;
+  }
 }
 
 //_____________________________________________________________________________
@@ -669,320 +423,67 @@ void AliComparisonRes::Analyse(){
   // Analyse comparison information and store output histograms
   // in the folder "folderRes"
   //
   TH1::AddDirectory(kFALSE);
-
-  AliComparisonRes * comp=this;
-  TH1F *hiss=0;
+  TH1F *h=0;
+  TH2F *h2D=0;
   TObjArray *aFolderObj = new TObjArray;
 
   // write results in the folder 
-
   TCanvas * c = new TCanvas("Phi resol Tan","Phi resol Tan");
   c->cd();
-  //
-  hiss = comp->MakeResol(comp->fPtResolTPC,1,0);
-  hiss->SetXTitle("p_{t} (GeV)");
-  hiss->SetYTitle("#sigmap_{t}/p_{t}");
-  hiss->Draw(); 
-  hiss->SetName("PtResolPtTPC");
-  
-  aFolderObj->Add(hiss);
 
-  //
-  hiss = comp->MakeResol(comp->fPtResolTPC,1,1);
-  hiss->SetXTitle("p_{t} (GeV)");
-  hiss->SetYTitle("mean #Deltap_{t}/p_{t}");
-  hiss->Draw(); 
-  hiss->SetName("PtMeanPtTPC");
-  
-  aFolderObj->Add(hiss);
+  char name[256];
+  char res_title[256] = {"res_y:res_z:res_lambda:res_phi:res_1pt:y:z:eta:phi:pt"} ;
+  char pull_title[256] = {"pull_y:pull_z:pull_lambda:pull_phi:pull_1pt:y:z:eta:phi:pt"};
 
-  //
-  hiss = comp->MakeResol(comp->fPhiResolTanTPC,1,0);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("#sigma#phi (rad)");
-  hiss->Draw();
-  hiss->SetName("PhiResolTanTPC");
-
-  aFolderObj->Add(hiss);
-
-  //
-  hiss = comp->MakeResol(comp->fPhiResolTanTPC,1,1);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("mean #Delta#phi (rad)");
-  hiss->Draw();
-  hiss->SetName("PhiMeanTanTPC");
-  
-
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fTanResolTanTPC,1,0);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("#sigma#theta (rad)");
-  hiss->Draw();
-  hiss->SetName("ThetaResolTanTPC");
-  
-  aFolderObj->Add(hiss);
-
-  //
-  hiss = comp->MakeResol(comp->fTanResolTanTPC,1,1);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("mean #Delta#theta (rad)");
-  hiss->Draw();
-  hiss->SetName("ThetaMeanTanTPC");
-  
-  aFolderObj->Add(hiss);
-
-  //
-  //
-  hiss = comp->MakeResol(comp->fPtResolTPCITS,1,0);
-  hiss->SetXTitle("p_{t}");
-  hiss->SetYTitle("#sigmap_{t}/p_{t}");
-  hiss->Draw(); 
-  hiss->SetName("PtResolPtTPCITS");
-  
-  aFolderObj->Add(hiss);
-
-  //
-  hiss = comp->MakeResol(comp->fPtResolTPCITS,1,1);
-  hiss->SetXTitle("p_{t}");
-  hiss->SetYTitle("mean #Deltap_{t}/p_{t}");
-  hiss->Draw(); 
-  hiss->SetName("PtMeanPtTPCITS");
-  
-  aFolderObj->Add(hiss);
-
-  //
-  hiss = comp->MakeResol(comp->fPhiResolTanTPCITS,1,0);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("#sigma#phi (rad)");
-  hiss->Draw();
-  hiss->SetName("PhiResolTanTPCITS");
-  
-  aFolderObj->Add(hiss);
-
-  //
-  hiss = comp->MakeResol(comp->fPhiResolTanTPCITS,1,1);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("mean #Delta#phi (rad)");
-  hiss->Draw();
-  hiss->SetName("PhiMeanTanTPCITS");
-  
-  aFolderObj->Add(hiss);
-
-  //
-  hiss = comp->MakeResol(comp->fTanResolTanTPCITS,1,0);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("#sigma#theta (rad)");
-  hiss->Draw();
-  hiss->SetName("ThetaResolTanTPCITS");
-  
-  aFolderObj->Add(hiss);
-
-  //
-  hiss = comp->MakeResol(comp->fTanResolTanTPCITS,1,1);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("mean #Delta#theta (rad)");
-  hiss->Draw();
-  hiss->SetName("ThetaMeanTanTPCITS");
-  
-  aFolderObj->Add(hiss);
-
-  //
-  //
-  hiss = comp->MakeResol(comp->fCPtResolTan,1,0);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("#sigmap_{t}/p_{t}");
-  hiss->Draw(); 
-  hiss->SetName("CptResolTan");
-  
-  aFolderObj->Add(hiss);
-
-  hiss = comp->MakeResol(comp->fCPhiResolTan,1,0);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("#sigma#phi (rad)");
-  hiss->Draw();
-  hiss->SetName("CPhiResolTan");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fCTanResolTan,1,0);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("#sigma#theta (rad)");
-  hiss->Draw();
-  hiss->SetName("CThetaResolTan");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fCPtPullTan,1,0);
-  hiss->SetXTitle("Tan(#theta)");
-  hiss->SetYTitle("1/mcp_{t}-1/p_{t}/#Sigma(1/p_{t})");
-  hiss->Draw();
-  hiss->SetName("CptPullTan");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
-  hiss->Draw();
-  hiss->SetName("C1Pt2ResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+  for(Int_t i=0; i<5; i++) 
+  {
+    for(Int_t j=5; j<10; j++) 
+    {
+      if(j==7) fResolHisto->GetAxis(9)->SetRangeUser(0.2,10.); // pt threshold
+      if(j==9) fResolHisto->GetAxis(7)->SetRangeUser(-0.9,0.9); // eta window
 
-  hiss = comp->MakeResol(comp->fC1Pt2ResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
-  hiss->Draw();
-  hiss->SetName("C1Pt2ResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fCYResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("CYResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      h2D = (TH2F*)fResolHisto->Projection(i,j);
+      h = AliComparisonRes::MakeResol(h2D,1,0);
+      sprintf(name,"h_res_%d_vs_%d",i,j);
+      h->SetName(name);
+      h->SetTitle(res_title);
 
-  hiss = comp->MakeResol(comp->fCYResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("CYResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fCZResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("CZResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      aFolderObj->Add(h);
 
-  hiss = comp->MakeResol(comp->fCZResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("CZResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fCPhiResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("CPhiResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      h = AliComparisonRes::MakeResol(h2D,1,1);
+      sprintf(name,"h_mean_res_%d_vs_%d",i,j);
+      h->SetName(name);
+      h->SetTitle(res_title);
 
-  hiss = comp->MakeResol(comp->fCPhiResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("CPhiResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fCThetaResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("CThetaResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      aFolderObj->Add(h);
 
-  hiss = comp->MakeResol(comp->fCThetaResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("CThetaResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
+      if(j==7) fResolHisto->GetAxis(9)->SetRangeUser(0.0,10.);
+      if(j==9) fResolHisto->GetAxis(7)->SetRangeUser(-1.5,1.5);
 
-  //
-  hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
-  hiss->Draw();
-  hiss->SetName("OnePt2ResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      //
+      if(j==7) fPullHisto->GetAxis(9)->SetRangeUser(0.2,10.);
+      if(j==9) fPullHisto->GetAxis(7)->SetRangeUser(-0.9,0.9);
 
-  hiss = comp->MakeResol(comp->f1Pt2ResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("1/mcp_{t}-1/p_{t}/(1+1/p_{t})^2");
-  hiss->Draw();
-  hiss->SetName("OnePt2ResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fYResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("YResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      h2D = (TH2F*)fPullHisto->Projection(i,j);
+      h = AliComparisonRes::MakeResol(h2D,1,0);
+      sprintf(name,"h_pull_%d_vs_%d",i,j);
+      h->SetName(name);
+      h->SetTitle(pull_title);
 
-  hiss = comp->MakeResol(comp->fYResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mcy-y)/(0.2+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("YResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fZResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("ZResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      aFolderObj->Add(h);
 
-  hiss = comp->MakeResol(comp->fZResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mcz-z)/(0.2+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("ZResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fPhiResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("PhiResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      h = AliComparisonRes::MakeResol(h2D,1,1);
+      sprintf(name,"h_mean_pull_%d_vs_%d",i,j);
+      h->SetName(name);
+      h->SetTitle(pull_title);
 
-  hiss = comp->MakeResol(comp->fPhiResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mc#phi-#phi)/(0.1+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("PhiResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
-  //
-  hiss = comp->MakeResol(comp->fThetaResolS1PtTPC,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("ThetaResolS1PtTPC");
-  
-  aFolderObj->Add(hiss);
+      aFolderObj->Add(h);
 
-  hiss = comp->MakeResol(comp->fThetaResolS1PtTPCITS,1,0);
-  hiss->SetXTitle("#sqrt(1/mcp_{t})");
-  hiss->SetYTitle("(mc#theta-#theta)/(0.1+1/mcp_{t})");
-  hiss->Draw();
-  hiss->SetName("ThetaResolS1PtTPCITS");
-  
-  aFolderObj->Add(hiss);
+      if(j==7) fPullHisto->GetAxis(9)->SetRangeUser(0.0,10.);
+      if(j==9) fPullHisto->GetAxis(7)->SetRangeUser(-1.5,1.5);
+    }
+  }
 
   // export objects to analysis folder
   fAnalysisFolder = ExportToFolder(aFolderObj);
@@ -1027,7 +528,7 @@ return newFolder;
 }
 
 //_____________________________________________________________________________
-Long64_t AliComparisonRes::Merge(TCollection* list) 
+Long64_t AliComparisonRes::Merge(TCollection* const list) 
 {
   // Merge list of objects (needed by PROOF)
 
@@ -1046,60 +547,9 @@ Long64_t AliComparisonRes::Merge(TCollection* list)
   {
   AliComparisonRes* entry = dynamic_cast<AliComparisonRes*>(obj);
   if (entry == 0) continue; 
-  
-  fMCVertex->Add(entry->fMCVertex);
-  fRecVertex->Add(entry->fRecVertex);
-
-  fPhiTanPtTPC->Add(entry->fPhiTanPtTPC);
-  fPhiTanPtTPCITS->Add(entry->fPhiTanPtTPCITS);
-
-  fPtResolTPC->Add(entry->fPtResolTPC);
-  fPtPullTPC->Add(entry->fPtPullTPC);
-  fPhiResolTanTPC->Add(entry->fPhiResolTanTPC);
-  fTanResolTanTPC->Add(entry->fTanResolTanTPC);
-  fPhiPullTanTPC->Add(entry->fPhiPullTanTPC);
-  fTanPullTanTPC->Add(entry->fTanPullTanTPC);
-
-  fPtResolTPCITS->Add(entry->fPtResolTPCITS);
-  fPtPullTPCITS->Add(entry->fPtPullTPCITS);
-  fPhiResolTanTPCITS->Add(entry->fPhiResolTanTPCITS);
-  fTanResolTanTPCITS->Add(entry->fTanResolTanTPCITS);
-  fPhiPullTanTPCITS->Add(entry->fPhiPullTanTPCITS);
-  fTanPullTanTPCITS->Add(entry->fTanPullTanTPCITS);
-
-  // Histograms for 1/pt parameterisation
-  f1Pt2ResolS1PtTPC->Add(entry->f1Pt2ResolS1PtTPC);
-  fYResolS1PtTPC->Add(entry->fYResolS1PtTPC);
-  fZResolS1PtTPC->Add(entry->fZResolS1PtTPC);
-  fPhiResolS1PtTPC->Add(entry->fPhiResolS1PtTPC);
-  fThetaResolS1PtTPC->Add(entry->fThetaResolS1PtTPC);
-
-  f1Pt2ResolS1PtTPCITS->Add(entry->f1Pt2ResolS1PtTPCITS);
-  fYResolS1PtTPCITS->Add(entry->fYResolS1PtTPCITS);
-  fZResolS1PtTPCITS->Add(entry->fZResolS1PtTPCITS);
-  fPhiResolS1PtTPCITS->Add(entry->fPhiResolS1PtTPCITS);
-  fThetaResolS1PtTPCITS->Add(entry->fThetaResolS1PtTPCITS);
-
-  // Resolution histograms (constrained param)
-  fCPhiResolTan->Add(entry->fCPhiResolTan);
-  fCTanResolTan->Add(entry->fCTanResolTan);
-  fCPtResolTan->Add(entry->fCPtResolTan);
-  fCPhiPullTan->Add(entry->fCPhiPullTan);
-  fCTanPullTan->Add(entry->fCTanPullTan);
-  fCPtPullTan->Add(entry->fCPtPullTan);
-
-  //  Histograms for 1/pt parameterisation (constrained)
-  fC1Pt2ResolS1PtTPC->Add(entry->fC1Pt2ResolS1PtTPC);
-  fCYResolS1PtTPC->Add(entry->fCYResolS1PtTPC);
-  fCZResolS1PtTPC->Add(entry->fCZResolS1PtTPC);
-  fCPhiResolS1PtTPC->Add(entry->fCPhiResolS1PtTPC);
-  fCThetaResolS1PtTPC->Add(entry->fCThetaResolS1PtTPC);
-
-  fC1Pt2ResolS1PtTPCITS->Add(entry->fC1Pt2ResolS1PtTPCITS);
-  fCYResolS1PtTPCITS->Add(entry->fCYResolS1PtTPCITS);
-  fCZResolS1PtTPCITS->Add(entry->fCZResolS1PtTPCITS);
-  fCPhiResolS1PtTPCITS->Add(entry->fCPhiResolS1PtTPCITS);
-  fCThetaResolS1PtTPCITS->Add(entry->fCThetaResolS1PtTPCITS);
+
+  fResolHisto->Add(entry->fResolHisto);
+  fPullHisto->Add(entry->fPullHisto);
 
   count++;
   }
index 64f2f8f..e4e4c08 100644 (file)
@@ -8,48 +8,45 @@
 // Author: J.Otwinowski 04/02/2008 
 //------------------------------------------------------------------------------
 
-class TFile;
+class AliESDVertex;
+class AliESDtrack;
 class AliMCInfo;
 class AliESDRecInfo;
 class AliESDEvent; 
-class AliESD;
-class AliESDfriend;
 class AliMCInfoCuts;
 class AliRecInfoCuts;
-class TH1I;
-class TH3F;
-class TH3;
-class TProfile;
-class TProfile2D;
 class TString;
-class AliESDVertex;
+class TNamed;
+class TCanvas;
 
-#include "TNamed.h"
+#include "THnSparse.h"
 #include "AliComparisonObject.h"
 
 class AliComparisonRes : public AliComparisonObject {
 public :
   AliComparisonRes(); 
+  AliComparisonRes(Char_t* name, Char_t* title, Int_t analysisMode, Bool_t hptGenerator);
   virtual ~AliComparisonRes();
 
   // Init data members
-  virtual void     Init();
+  virtual void  Init();
 
   // Execute analysis
-  virtual void      Exec(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  virtual void  Exec(AliMCInfo* const infoMC, AliESDRecInfo *const infoRC);
 
   // Merge output objects (needed by PROOF) 
-  virtual Long64_t Merge(TCollection* list);
+  virtual Long64_t Merge(TCollection* const list);
 
   // Analyse output histograms
   virtual void Analyse();
 
   // Get analysis folder
-  virtual TFolder* GetAnalysisFolder() {return fAnalysisFolder;}
+  virtual TFolder* GetAnalysisFolder() const {return fAnalysisFolder;}
 
   // Process events
-  void      ProcessConstrained(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
-  void      Process(AliMCInfo* infoMC, AliESDRecInfo *infoRC);
+  void ProcessConstrained(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC);
+  void ProcessTPC(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC);
+  void ProcessTPCITS(AliMCInfo* const infoMC, AliESDRecInfo* const infoRC);
 
   // Create folder for analysed histograms
   TFolder *CreateFolder(TString folder = "folderRes",TString title = "Analysed Resolution histograms");
@@ -58,135 +55,30 @@ public :
   TFolder *ExportToFolder(TObjArray * array=0);
 
   // Selection cuts
-  void SetAliRecInfoCuts(AliRecInfoCuts* cuts=0) {fCutsRC = cuts;}   
-  void SetAliMCInfoCuts(AliMCInfoCuts* cuts=0) {fCutsMC = 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;}  
 
-  static TH1F*       MakeResol(TH2F * his, Int_t integ, Bool_t type); 
+  static TH1F*     MakeResol(TH2F * his, Int_t integ, Bool_t type); 
 
   // getters
-  TH3F *GetMCVertex()  { return fMCVertex; }
-  TH3F *GetRecVertex() { return fRecVertex; } 
-
-  TH3F *GetPhiTanPtTPC() { return fPhiTanPtTPC; } 
-  TH3F *GetPhiTanPtTPCITS() { return fPhiTanPtTPCITS; } 
-
-  TH2F *GetPtResolTPC()     { return fPtResolTPC; } 
-  TH2F *GetPtPullTPC()      { return fPtPullTPC; } 
-  TH2F *GetPhiResolTanTPC() { return fPhiResolTanTPC; } 
-  TH2F *GetTanResolTanTPC() { return fTanResolTanTPC; } 
-  TH2F *GetPhiPullTanTPC()  { return fPhiPullTanTPC; } 
-  TH2F *GetTanPullTanTPC()  { return fTanPullTanTPC; } 
-
-  TH2F *GetPtResolTPCITS()     { return fPtResolTPCITS; } 
-  TH2F *GetPtPullTPCITS()      { return fPtPullTPCITS; } 
-  TH2F *GetPhiResolTanTPCITS() { return fPhiResolTanTPCITS; } 
-  TH2F *GetTanResolTanTPCITS() { return fTanResolTanTPCITS; } 
-  TH2F *GetPhiPullTanTPCITS()  { return fPhiPullTanTPCITS; } 
-  TH2F *GetTanPullTanTPCITS()  { return fTanPullTanTPCITS; } 
-
   //
-  // Resolution constrained param
-  //
-  TH2F *GetCPhiResolTan() { return fCPhiResolTan; } 
-  TH2F *GetCTanResolTan() { return fCTanResolTan; } 
-  TH2F *GetCPtResolTan()  { return fCPtResolTan; } 
-  TH2F *GetCPhiPullTan()  { return fCPhiPullTan; } 
-  TH2F *GetCTanPullTan()  { return fCTanPullTan; } 
-  TH2F *GetCPtPullTan()   { return fCPtPullTan; } 
-
-  //
-  // Histograms for track resolution parameterisation
-  //
-  TH2F *Get1Pt2ResolS1PtTPC()    { return f1Pt2ResolS1PtTPC; } 
-  TH2F *Get1Pt2ResolS1PtTPCITS() { return f1Pt2ResolS1PtTPCITS; } 
-  TH2F *GetYResolS1PtTPC()       { return fYResolS1PtTPC; } 
-  TH2F *GetYResolS1PtTPCITS()    { return fYResolS1PtTPCITS; } 
-  TH2F *GetZResolS1PtTPC()       { return fZResolS1PtTPC; } 
-  TH2F *GetZResolS1PtTPCITS()    { return fZResolS1PtTPCITS; } 
-  TH2F *GetPhiResolS1PtTPC()     { return fPhiResolS1PtTPC; } 
-  TH2F *GetPhiResolS1PtTPCITS()  { return fPhiResolS1PtTPCITS; } 
-  TH2F *GetThetaResolS1PtTPC()   { return fThetaResolS1PtTPC; } 
-  TH2F *GetThetaResolS1PtTPCITS(){ return fThetaResolS1PtTPCITS; } 
-
-  // constrained
-  //
-  TH2F *GetC1Pt2ResolS1PtTPC()    { return fC1Pt2ResolS1PtTPC; } 
-  TH2F *GetC1Pt2ResolS1PtTPCITS() { return fC1Pt2ResolS1PtTPCITS; } 
-  TH2F *GetCYResolS1PtTPC()       { return fCYResolS1PtTPC; } 
-  TH2F *GetCYResolS1PtTPCITS()    { return fCYResolS1PtTPCITS; } 
-  TH2F *GetCZResolS1PtTPC()       { return fCZResolS1PtTPC; } 
-  TH2F *GetCZResolS1PtTPCITS()    { return fCZResolS1PtTPCITS; } 
-  TH2F *GetCPhiResolS1PtTPC()     { return fCPhiResolS1PtTPC; } 
-  TH2F *GetCPhiResolS1PtTPCITS()  { return fCPhiResolS1PtTPCITS; } 
-  TH2F *GetCThetaResolS1PtTPC()   { return fCThetaResolS1PtTPC; } 
-  TH2F *GetCThetaResolS1PtTPCITS(){ return fCThetaResolS1PtTPCITS; } 
+  THnSparse *GetResolHisto() const  { return fResolHisto; }
+  THnSparse *GetPullHisto()  const  { return fPullHisto; }
 
 private:
   //
   // Control histograms
+  // 5 track parameters (details in STEER/AliExternalTrackParam.h)
   //
 
-  TH3F *fMCVertex;  //-> MC primary vertex 
-  TH3F *fRecVertex; //-> Reconstructed primary vertex
-
-  TH3F *fPhiTanPtTPC; //-> phi vs tantheta vs pt
-  TH3F *fPhiTanPtTPCITS; //-> phi vs tantheta vs pt
-
-  // TPC only
-  TH2F *fPtResolTPC;        //-> pt resolution
-  TH2F *fPtPullTPC;         //-> pt pull
-  TH2F *fPhiResolTanTPC;       //-> angular resolution 
-  TH2F *fTanResolTanTPC;       //-> angular resolution
-  TH2F *fPhiPullTanTPC;        //-> angular resolution
-  TH2F *fTanPullTanTPC;        //-> angular resolution
-
-  // TPC+ITS
-  TH2F *fPtResolTPCITS;        //-> pt resolution
-  TH2F *fPtPullTPCITS;         //-> pt pull
-  TH2F *fPhiResolTanTPCITS;       //-> angular resolution 
-  TH2F *fTanResolTanTPCITS;       //-> angular resolution
-  TH2F *fPhiPullTanTPCITS;        //-> angular resolution
-  TH2F *fTanPullTanTPCITS;        //-> angular resolution
-
-  //
-  // Resolution constrained param
-  //
-  TH2F   *fCPhiResolTan;   //-> angular resolution -  constrained
-  TH2F   *fCTanResolTan;   //-> angular resolution -  constrained
-  TH2F   *fCPtResolTan;    //-> pt resolution      -  constrained
-  TH2F   *fCPhiPullTan;    //-> angular resolution -  constrained
-  TH2F   *fCTanPullTan;    //-> angular resolution -  constrained
-  TH2F   *fCPtPullTan;     //-> pt resolution      -  constrained
-
-  //
-  // Histograms for track resolution parameterisation
-  //
+  // resolution histogram
+  THnSparseF *fResolHisto; //-> res_y:res_z:res_phi:res_lambda:res_1pt:y:z:eta:phi:pt
 
-  TH2F* f1Pt2ResolS1PtTPC;      //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs sqrt(1/pt) (TPC)
-  TH2F* f1Pt2ResolS1PtTPCITS;   //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs sqrt(1/pt) (TPC+ITS)
-  TH2F* fYResolS1PtTPC;         //-> (mcy-y)/(0.2+1/pt) vs sqrt(1/pt) (TPC) 
-  TH2F* fYResolS1PtTPCITS;      //-> (mcy-y)/(0.2+1/pt) vs sqrt(1/pt) (TPC + ITS) 
-  TH2F* fZResolS1PtTPC;         //-> (mcz-z)/(0.2+1/pt) vs sqrt(1/pt) (TPC)
-  TH2F* fZResolS1PtTPCITS;      //-> (mcz-z)/(0.2+1/pt) vs sqrt(1/pt) (TPC+ITS)
-  TH2F* fPhiResolS1PtTPC;       //-> (mcphi-phi)/(0.1+1/pt) vs sqrt(1/pt) (TPC)
-  TH2F* fPhiResolS1PtTPCITS;    //-> (mcphi-phi)/(0.1+1/pt) vs sqrt(1/pt) (TPC+ITS)
-  TH2F* fThetaResolS1PtTPC;     //-> (mctheta-theta)/(0.1+1/pt) vs sqrt(1/pt) (TPC)
-  TH2F* fThetaResolS1PtTPCITS;  //-> (mctheta-theta)/(0.1+1/pt) vs sqrt(1/pt) (TPC+ITS)
-  
-  // constrained
-  TH2F* fC1Pt2ResolS1PtTPC;      //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs sqrt(1/pt) (TPC)
-  TH2F* fC1Pt2ResolS1PtTPCITS;   //-> (1/mcpt-1/pt)/(1+1/pt)^2 vs sqrt(1/pt) (TPC+ITS)
-  TH2F* fCYResolS1PtTPC;         //-> (mcy-y)/(0.2+1/pt) vs sqrt(1/pt) (TPC) 
-  TH2F* fCYResolS1PtTPCITS;      //-> (mcy-y)/(0.2+1/pt) vs sqrt(1/pt) (TPC + ITS) 
-  TH2F* fCZResolS1PtTPC;         //-> (mcz-z)/(0.2+1/pt) vs sqrt(1/pt) (TPC)
-  TH2F* fCZResolS1PtTPCITS;      //-> (mcz-z)/(0.2+1/pt) vs sqrt(1/pt) (TPC+ITS)
-  TH2F* fCPhiResolS1PtTPC;       //-> (mcphi-phi)/(0.1+1/pt) vs sqrt(1/pt) (TPC)
-  TH2F* fCPhiResolS1PtTPCITS;    //-> (mcphi-phi)/(0.1+1/pt) vs sqrt(1/pt) (TPC+ITS)
-  TH2F* fCThetaResolS1PtTPC;     //-> (mctheta-theta)/(0.1+1/pt) vs sqrt(1/pt) (TPC)
-  TH2F* fCThetaResolS1PtTPCITS;  //-> (mctheta-theta)/(0.1+1/pt) vs sqrt(1/pt) (TPC+ITS)
+  // pull histogram
+  THnSparseF *fPullHisto;  //-> pull_y:pull_z:pull_phi:pull_lambda:pull_1pt:y:z:eta:phi:pt
 
   // Global cuts objects
   AliRecInfoCuts*  fCutsRC;      // selection cuts for reconstructed tracks
index 548d6ba..ba3429f 100644 (file)
@@ -3,6 +3,15 @@ void RunAliComparisonTask(TChain  *chain = 0, Bool_t aProof = kTRUE, Bool_t aDeb
   //
   // Set mag field map (needed to propagate track to the DCA)
   //
+  //Int_t magField = 2;  // 0 - 0.2 T, 1 = 0.4 T, 2  - 0.5 T
+  //magFMap = new AliMagFMaps("Maps","Maps", 2, 1., 10., magField);
+  //AliTracker::SetFieldMap(magFMap,kFALSE);
+
+  //AliMagWrapCheb* field = 0x0;
+  //field = new AliMagWrapCheb("Maps","Maps", 2, 1., 10., AliMagWrapCheb::k5kG,kTRUE,"$(ALICE_ROOT)/data/maps/mfchebKGI_sym.root");
+  //Bool_t uniform=kFALSE;
+  //AliTracker::SetFieldMap(field,uniform);  // tracking with the real map
+
   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 2, 1., 1., 10., AliMagF::k5kG));
 
   //
@@ -12,9 +21,12 @@ void RunAliComparisonTask(TChain  *chain = 0, Bool_t aProof = kTRUE, Bool_t aDeb
   // Create ESD track reconstruction cuts
   AliRecInfoCuts *pRecInfoCuts = new AliRecInfoCuts(); 
   if(pRecInfoCuts) {
-    pRecInfoCuts->SetPtRange(0.15,200.0);
-    pRecInfoCuts->SetMaxAbsTanTheta(1.0);
-    pRecInfoCuts->SetMinNClustersTPC(10);
+    pRecInfoCuts->SetPtRange(0.20,200.0);
+    //pRecInfoCuts->SetEtaRange(-0.9,0.9);
+    pRecInfoCuts->SetMaxDCAToVertexXY(3.0);
+    pRecInfoCuts->SetMaxDCAToVertexZ(3.0);
+    pRecInfoCuts->SetMinNClustersTPC(50);
+    pRecInfoCuts->SetMinNClustersITS(2);
     pRecInfoCuts->SetMinTPCsignalN(50);
 
        pRecInfoCuts->SetHistogramsOn(kFALSE); 
@@ -26,8 +38,8 @@ void RunAliComparisonTask(TChain  *chain = 0, Bool_t aProof = kTRUE, Bool_t aDeb
   AliMCInfoCuts  *pMCInfoCuts = new AliMCInfoCuts();
   if(pMCInfoCuts) {
     pMCInfoCuts->SetMinRowsWithDigits(50);
-    pMCInfoCuts->SetMaxR(0.001);  
-    pMCInfoCuts->SetMaxVz(0.001); 
+    pMCInfoCuts->SetMaxR(0.025); // from diamond xy size (pp@10TeV) 
+    pMCInfoCuts->SetMaxVz(10.);  // from diamond z size  (pp@10TeV)
     pMCInfoCuts->SetRangeTPCSignal(0.5,1.4); 
   } else {
     AliDebug(AliLog::kError, "ERROR: Cannot AliMCInfoCuts object");
@@ -36,41 +48,76 @@ void RunAliComparisonTask(TChain  *chain = 0, Bool_t aProof = kTRUE, Bool_t aDeb
   //
   // Create comparison objects and set cuts 
   //
+  const Int_t kTPC = 0;
+  const Int_t kTPCITS = 1;
+  const Int_t kConstrained = 2;
 
   // Resolution
-  AliComparisonRes *pCompRes = new AliComparisonRes(); 
-  if(!pCompRes) {
-    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes object");
+  AliComparisonRes *pCompRes0 = new AliComparisonRes("AliComparisonResTPC","AliComparisonResTPC",kTPC,kFALSE); 
+  if(!pCompRes0) {
+    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes0 object");
+  }
+  pCompRes0->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompRes0->SetAliMCInfoCuts(pMCInfoCuts);
+
+  AliComparisonRes *pCompRes1 = new AliComparisonRes("AliComparisonResTPCITS","AliComparisonResTPCITS",kTPCITS,kFALSE); 
+  if(!pCompRes1) {
+    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes1 object");
   }
-  pCompRes->SetAliRecInfoCuts(pRecInfoCuts);
-  pCompRes->SetAliMCInfoCuts(pMCInfoCuts);
+  pCompRes1->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompRes1->SetAliMCInfoCuts(pMCInfoCuts);
+
+  AliComparisonRes *pCompRes2 = new AliComparisonRes("AliComparisonResConstrained","AliComparisonResConstrained",kConstrained,kFALSE); 
+  if(!pCompRes2) {
+    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonRes2 object");
+  }
+  pCompRes2->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompRes2->SetAliMCInfoCuts(pMCInfoCuts);
 
   // Efficiency
-  AliComparisonEff *pCompEff =  new AliComparisonEff();
-  if(!pCompEff) {
+  AliComparisonEff *pCompEff0 =  new AliComparisonEff("AliComparisonEffTPC","AliComparisonEffTPC",kTPC,kFALSE);
+  if(!pCompEff0) {
+    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonEff object");
+  }
+  pCompEff0->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompEff0->SetAliMCInfoCuts(pMCInfoCuts);
+
+  AliComparisonEff *pCompEff1 =  new AliComparisonEff("AliComparisonEffTPCITS","AliComparisonEffTPCITS",kTPCITS,kFALSE);
+  if(!pCompEff1) {
     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonEff object");
   }
-  pCompEff->SetAliRecInfoCuts(pRecInfoCuts);
-  pCompEff->SetAliMCInfoCuts(pMCInfoCuts);
+  pCompEff1->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompEff1->SetAliMCInfoCuts(pMCInfoCuts);
+
+  AliComparisonEff *pCompEff2 =  new AliComparisonEff("AliComparisonEffConstrained","AliComparisonEffConstrained",kConstrained,kFALSE);
+  if(!pCompEff2) {
+    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonEff object");
+  }
+  pCompEff2->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompEff2->SetAliMCInfoCuts(pMCInfoCuts);
 
   // dE/dx
-  AliComparisonDEdx *pCompDEdx = new AliComparisonDEdx();
-  if(!pCompDEdx) {
+  AliComparisonDEdx *pCompDEdx0 = new AliComparisonDEdx("AliComparisonDEdxTPC","AliComparisonDEdxTPC",kTPC,kFALSE);
+  if(!pCompDEdx0) {
     AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDEdx object");
   }
-  pCompDEdx->SetAliRecInfoCuts(pRecInfoCuts);
-  pCompDEdx->SetAliMCInfoCuts(pMCInfoCuts);
-  pCompDEdx->SetMCPtMin(0.5);
-  pCompDEdx->SetMCAbsTanThetaMax(0.5);
-  pCompDEdx->SetMCPdgCode(pMCInfoCuts->GetPiP()); // only pi+ particles
+  pCompDEdx0->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompDEdx0->SetAliMCInfoCuts(pMCInfoCuts);
 
   // DCA
-  AliComparisonDCA *pCompDCA = new AliComparisonDCA();
-  if(!pCompDCA) {
-    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDCA object");
+  AliComparisonDCA *pCompDCA0 = new AliComparisonDCA("AliComparisonDCATPC","AliComparisonDCATPC",kTPC,kFALSE);
+  if(!pCompDCA0) {
+    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDCATPC object");
+  }
+  pCompDCA0->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompDCA0->SetAliMCInfoCuts(pMCInfoCuts);
+
+  AliComparisonDCA *pCompDCA1 = new AliComparisonDCA("AliComparisonDCATPCITS","AliComparisonDCAITS",kTPCITS,kFALSE);
+  if(!pCompDCA1) {
+    AliDebug(AliLog::kError, "ERROR: Cannot create AliComparisonDCAITS");
   }
-  pCompDCA->SetAliRecInfoCuts(pRecInfoCuts);
-  pCompDCA->SetAliMCInfoCuts(pMCInfoCuts);
+  pCompDCA1->SetAliRecInfoCuts(pRecInfoCuts);
+  pCompDCA1->SetAliMCInfoCuts(pMCInfoCuts);
 
   // Create the analysis manager
   mgr = new AliAnalysisManager("testAnalysis");
@@ -78,10 +125,15 @@ void RunAliComparisonTask(TChain  *chain = 0, Bool_t aProof = kTRUE, Bool_t aDeb
   // Create, add task
   task = new AliComparisonTask;
 
-  task->AddComparisonObject( pCompRes );
-  task->AddComparisonObject( pCompEff );
-  task->AddComparisonObject( pCompDEdx );
-  task->AddComparisonObject( pCompDCA );
+  task->AddComparisonObject( pCompRes0 );
+  task->AddComparisonObject( pCompRes1 );
+  task->AddComparisonObject( pCompRes2 );
+  task->AddComparisonObject( pCompEff0 );
+  task->AddComparisonObject( pCompEff1 );
+  task->AddComparisonObject( pCompEff2 );
+  task->AddComparisonObject( pCompDEdx0 );
+  task->AddComparisonObject( pCompDCA0 );
+  task->AddComparisonObject( pCompDCA1 );
   
   mgr->AddTask(task);
 
index 9557d00..62d873e 100644 (file)
@@ -33,9 +33,6 @@ RunAliComparisonTask(chain, kFALSE);
 
 2. Example (run on Proof/GSI):
 
-// -- Load libXrdClient.so e.g.
-gSystem->Load("/usr/local/grid/XRootd/GSI/lib64/libXrdClient.so");
-
 // -- Connect to Proof as USER_NAME
 TProof::Open("USER_NAME@gsiaf.gsi.de");
 
@@ -64,7 +61,7 @@ RunAliComparisonTask(chain, kTRUE);
 
 //-----------------------------------------------------------------------------
 
-void RunGSI(Bool_t aProof=kTRUE) {
+void RunGSI(Bool_t aProof=kFALSE) {
 
   // -- RUN  LOCALLY
   if(aProof == kFALSE) 
@@ -76,7 +73,7 @@ void RunGSI(Bool_t aProof=kTRUE) {
     AliXRDPROOFtoolkit tool;
     
     // -- Make chain
-    TChain * chain = tool.MakeChain("cmpESDTracks.txt","ESDcmpTracks","",1000,0);
+    TChain * chain = tool.MakeChain("cmpESDTracks_post_v4-16-Rev-05.txt","ESDcmpTracks","",10,0);
     
     // -- Run AliComparisonTask task
     gROOT->LoadMacro("RunAliComparisonTask.C");
@@ -89,9 +86,6 @@ void RunGSI(Bool_t aProof=kTRUE) {
   //-- RUN ON PROOF
   else 
   {
-    // -- Load libXrdClient.so e.g.
-    gSystem->Load("/usr/local/grid/XRootd/GSI/lib64/libXrdClient.so");
-     
     // -- Connect to Proof as USER_NAME
     TProof::Open("jacek@gsiaf.gsi.de");