Task updated to estimate efficiency/contamination and to use the new CAF
authorgvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Jun 2010 08:28:29 +0000 (08:28 +0000)
committergvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Jun 2010 08:28:29 +0000 (08:28 +0000)
HMPID/AliHMPIDAnalysisTask.C
HMPID/AliHMPIDAnalysisTask.cxx
HMPID/AliHMPIDAnalysisTask.h

index 20777fd..b200608 100644 (file)
@@ -1,28 +1,28 @@
 void AliHMPIDAnalysisTask()
 {
-  
-  
+
   //
   // Macro to run the AliHMPIDAnalysisTask
+  // To use: copy this macro to your work directory, modify the global
+  // part to match your needs, then run root.
+  // root[0] .x AliHMPIDAnalysisTask.C
   //
+
   //______ Input settings
-  Int_t nEvents = 10000000;           //on Proof
+  Int_t nEvents = 650000;           //on Proof
   Int_t nOffset = 0;               //on Proof
   Int_t nFile2Xml = 10;         //on Grid - how many ESD files to chain in xml
-  TString xmlName="run104157.xml";//new.xml";       //name of the xml collection created
-  // char *indataset = "/home/lmolnar/CERN/alice/Dec01_rv5-25-04_gcc/test/cosmic/100923/09000100923018.10";
-//   char *indataset = "/COMMON/COMMON/LHC09a4_run8101X";
-  // char *indataset = "/PWG4/kleinb/LHC09a3_90023_checked";///HMPID/lmolnar/run100923";///PWG4/kleinb/LHC09a3_90023_checked";
-   char *indataset = "/home/lmolnar/CERN/alice/Dec01_rv5-25-04_gcc/test/cosmic/100923/09000100923018.10/AliESDs.root";
- // char *indataset = "/media/data/Data/09000100923018.10/AliESDs.root";
- // char *indataset = "/media/data/Data/alice/sim/LHC09a1/70213/001/AliESDs.root";
-  
+  TString xmlName="HmpidCheckRun122080_test.xml";//new.xml";       //name of the xml collection created
+  Char_t *indataset = "/alice/sim/LHC10b4_114932";
+//   char *indataset = "$HOME/HMPID/data/AliESDs.root";
+
   //______ Select Local, Proof or Intercative Grid Analysis (but just only one :-))
   Bool_t bLOCAL        = kFALSE;
-  Bool_t bPROOF        = kFALSE;
-  Bool_t bGRIDINT      = kTRUE;
+  Bool_t bPROOF        = kTRUE;
+  Bool_t bGRIDINT      = kFALSE;
 
-  AliLog::SetGlobalDebugLevel(2);
+//  AliLog::SetGlobalDebugLevel(2);
+//  AliLog::SetGlobalLogLevel(0);
 
 
   //______ Init data set chain
@@ -30,126 +30,124 @@ void AliHMPIDAnalysisTask()
   TChain *chain = new TChain("esdTree");
 
   //______ Define settings for PROOF
-  const char* proofNode = "lmolnar@alicecaf";
+  const char* proofNode = "alice-caf";
   gEnv->SetValue("XSec.GSI.DelegProxy","2");
+  gSystem->SetIncludePath("-I. -I$HOME/HMPID -I$ALICE_ROOT/include -I$ROOTSYS/include");
   gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
+  gSystem->Load("libTree.so");
+  gSystem->Load("libGeom.so");
+  gSystem->Load("libVMC.so");
+  gSystem->Load("libPhysics.so");
   gSystem->Load("libSTEERBase");
   gSystem->Load("libESD");
   gSystem->Load("libAOD");
   gSystem->Load("libANALYSIS");
-  gSystem->Load("libANALYSISalice");  
+  gSystem->Load("libANALYSISalice");
+
  //______ Create analysis manager
    AliAnalysisManager *mgr  = new AliAnalysisManager("HMPID Analysis Train", "HMPID Analysis Train");
+   mgr->SetDebugLevel(0);
+
    //______ Create input handler, default ESD
    AliESDInputHandler *esdHandler = new AliESDInputHandler();
    mgr->SetInputEventHandler(esdHandler);
-   mgr->SetDebugLevel(0);
-   AliLog::SetGlobalLogLevel(0);
+
+   //______ Create MC input handler
+   AliMCEventHandler* mcHandler = new AliMCEventHandler();
+   mgr->SetMCtruthEventHandler(mcHandler);
+
    //______ Create default input container
    AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
    AliAnalysisDataContainer *hmpoutput= mgr->CreateContainer("hmpoutput", TList::Class(),AliAnalysisManager::kOutputContainer,"HmpidOutput.root");
-  
-   if(bLOCAL) 
+
+   if(bLOCAL)
   {
-   
+
    Printf("========> Running LOCAL HMPID Analysis <=========");
    gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
    gSystem->Load("libSTEERBase");
    gSystem->Load("libESD");
    gSystem->Load("libAOD");
    gSystem->Load("libANALYSIS");
-   gSystem->Load("libANALYSISalice");  
+   gSystem->Load("libANALYSISalice");
    //chain = CreateESDChain(dataset.Data());//,1,0,kFALSE,kFALSE,0);
-    chain->Add(indataset);  
-   gSystem->SetIncludePath("-I. -I$HOME/HMPID -I$ALICE_ROOT/include -I$ROOTSYS/include");
-   gROOT->LoadMacro(Form("%s/HMPID/AliHMPIDAnalysisTask.cxx++g",gSystem->Getenv("ALICE_ROOT")));//"AliHMPIDAnalysisTask.cxx++");
+   chain->Add(indataset);
+   gROOT->LoadMacro("AliHMPIDAnalysisTask.cxx++g");//"AliHMPIDAnalysisTask.cxx++");
    AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
-   mgr->AddTask(hmpTask);  
+   mgr->AddTask(hmpTask);
   }
-  else if(bPROOF) 
+  else if(bPROOF)
   {
     Printf("========> Running PROOF HMPID Analysis <=========");
-    TProof::Open(proofNode);  
-    /*
-    gProof->UploadPackage("STEERBase.par");
-    gProof->EnablePackage("STEERBase");           
-    gProof->UploadPackage("ESD.par");     
-    gProof->EnablePackage("ESD");      
-    gProof->UploadPackage("ANALYSIS.par"); 
-    gProof->EnablePackage("ANALYSIS");    
-    gProof->UploadPackage("ANALYSISalice.par");
-    gProof->EnablePackage("ANALYSISalice");
-    */
-    gProof->UploadPackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-17-Release/AF-v4-17");
-    gProof->EnablePackage("/afs/cern.ch/alice/caf/sw/ALICE/PARs/v4-17-Release/AF-v4-17");   
+    TProof::Open(proofNode);
+//    gProof->SetParallel(2);
+    gProof->EnablePackage("VO_ALICE@AliRoot::v4-19-14-AN");   
     gProof->Load(Form("%s/HMPID/AliHMPIDAnalysisTask.cxx++g",gSystem->Getenv("ALICE_ROOT")));
+//    gProof->Load("AliHMPIDAnalysisTask.cxx++g");//"AliHMPIDAnalysisTask.cxx++");
     AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
-    mgr->AddTask(hmpTask);    
+    mgr->AddTask(hmpTask);
   }
-  else if(bGRIDINT) 
+  else if(bGRIDINT)
   {
     Printf("========> Running INTERCATIVE GRID HMPID Analysis <=========");
     gSystem->Load("libSTEERBase");
     gSystem->Load("libESD");
     gSystem->Load("libANALYSIS");
-    gSystem->Load("libANALYSISalice");  
-    //______ Add HMPID task 
+    gSystem->Load("libANALYSISalice");
+    //______ Add HMPID task
     gSystem->SetIncludePath("-I. -I$HOME/HMPID -I$ALICE_ROOT/include -I$ROOTSYS/include");
     gROOT->LoadMacro("$ALICE_ROOT/HMPID/AliHMPIDAnalysisTask.cxx++");
-  
-       
+
+
     TGrid::Connect("alien://");
-    chain = CreateChainFromCollection(xmlName.Data(),"esdTree",nFile2Xml); 
+    chain = CreateChainFromCollection(xmlName.Data(),"esdTree",nFile2Xml);
     //gROOT->LoadMacro(Form("%s/HMPID/AliHMPIDAnalysisTask.cxx++g",gSystem->Getenv("ALICE_ROOT")));//"AliHMPIDAnalysisTask.cxx++");
     //gROOT->LoadMacro("$ALICE_ROOT/HMPID/AliHMPIDAnalysisTask.cxx++");
     AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
-    mgr->AddTask(hmpTask);  
+    mgr->AddTask(hmpTask);
      
   }
-  
-   
-  if(bLOCAL) 
-  {
-   //______ Add HMPID task 
-   gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
-   gSystem->Load("libSTEERBase");
-   gSystem->Load("libESD");
-   gSystem->Load("libAOD");
-   gSystem->Load("libANALYSIS");
-   gSystem->Load("libANALYSISalice");  
-   
 
+
+  if(bLOCAL)
+  {
+    //______ Add HMPID task
+    gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
+    gSystem->Load("libSTEERBase");
+    gSystem->Load("libESD");
+    gSystem->Load("libAOD");
+    gSystem->Load("libANALYSIS");
+    gSystem->Load("libANALYSISalice");
   }
   if ( bPROOF ) 
   {
     
-  } 
-  
-   mgr->ConnectInput(hmpTask,0,cinput);
-   mgr->ConnectOutput(hmpTask,0,hmpoutput);
-   
-      
-    if (mgr->InitAnalysis()) {
-       mgr->PrintStatus();
-       if(bLOCAL || bGRIDINT) mgr->StartAnalysis("local",chain);
-       else if(bPROOF) mgr->StartAnalysis("proof",dataset.Data(), nEvents,nOffset);
-     }
-     
+  }
+
+  mgr->ConnectInput(hmpTask,0,cinput);
+  mgr->ConnectOutput(hmpTask,0,hmpoutput);
+
+
+  if (mgr->InitAnalysis()) {
+    mgr->PrintStatus();
+    if(bLOCAL || bGRIDINT) mgr->StartAnalysis("local",chain);
+    else if(bPROOF) mgr->StartAnalysis("proof",dataset.Data(), nEvents,nOffset);
+  }
 }   
+
 //__________________________________________________________________________________
 TChain *CreateChainFromCollection(const char* xmlfile, const char *treeName="esdTree",Int_t nFiles = 0)
 {
-// Create a chain from an alien collection.                                                                          
+// Create a chain from an alien collection.
    TAlienCollection * myCollection  = TAlienCollection::Open(xmlfile);
 
    if (!myCollection) {
-      ::Error("CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ;
+      ::Error("CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile);
      return NULL ;
    }
 
   TChain* chain = new TChain(treeName);
-  myCollection->Reset() ;
+  myCollection->Reset();
   Int_t iCount = 0;
   while ( myCollection->Next() ){
     if(nFiles!=0)iCount++;
@@ -159,26 +157,27 @@ TChain *CreateChainFromCollection(const char* xmlfile, const char *treeName="esd
   }
   chain->ls();
   return chain;
-}    
-//__________________________________________________________________________________  
+}
+
+//__________________________________________________________________________________
 void SetupPar(char* pararchivename)
 {
-  //Load par files, create analysis libraries                                                         
-  //For testing, if par file already decompressed and modified                                        
-  //classes then do not decompress.                                                                   
+  //Load par files, create analysis libraries
+  //For testing, if par file already decompressed and modified
+  //classes then do not decompress.
+
+  TString cdir(Form("%s", gSystem->WorkingDirectory() ));
+  TString parpar(Form("%s.par", pararchivename));
 
-  TString cdir(Form("%s", gSystem->WorkingDirectory() )) ;
-  TString parpar(Form("%s.par", pararchivename)) ;
-  
   if (!gSystem->AccessPathName(pararchivename) ) {
-    TString processline = Form(".! tar xvzf %s",parpar.Data()) ;
+    TString processline = Form(".! tar xvzf %s",parpar.Data());
     gROOT->ProcessLine(processline.Data());
   }
 
   TString ocwd = gSystem->WorkingDirectory();
   gSystem->ChangeDirectory(pararchivename);
 
-  // check for BUILD.sh and execute                                                                   
+  // check for BUILD.sh and execute
   if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
     printf("*******************************\n");
     printf("*** Building PAR archive    ***\n");
@@ -190,7 +189,7 @@ void SetupPar(char* pararchivename)
       return -1;
     }
   }
-  // check for SETUP.C and execute                                                                    
+  // check for SETUP.C and execute
   if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
     printf("*******************************\n");
     printf("*** Setup PAR archive       ***\n");
@@ -201,5 +200,4 @@ void SetupPar(char* pararchivename)
 
   gSystem->ChangeDirectory(ocwd.Data());
   printf("Current dir: %s\n", ocwd.Data());
-}
-  
+}
\ No newline at end of file
index 3f521dc..674663d 100644 (file)
  **************************************************************************/
 
 //==============================================================================
-// AliHMPIDAnalysysTask - Class representing a basic analysis tool of HMPID data at  
+// AliHMPIDAnalysysTask - Class representing a basic analysis tool of HMPID data at
 // level of ESD.
-// A set of histograms is created. 
+// A set of histograms is created.
 //==============================================================================
-// 
+//
 // By means of AliHMPIDAnalysisTask.C macro it is possible to use this class
-// to perform the analysis on local data, on data on alien using local machine 
-// and on CAF. 
+// to perform the analysis on local data, on data on alien using local machine
+// and on CAF.
 
 #ifndef AliHMPIDAnalysisTASK_CXX
 #define AliHMPIDAnalysisTASK_CXX
 
-#include <TH2.h>
-#include <AliLog.h>
+
+#include "TH1.h"
+#include "TH2.h"
+#include "TFile.h"
+#include "TCanvas.h"
+#include "TGraphErrors.h"
 #include "AliAnalysisManager.h"
 #include "AliESDInputHandler.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
 #include "AliESDtrack.h"
+#include "AliPID.h"
+#include "AliLog.h"
 #include "AliHMPIDAnalysisTask.h"
 
 ClassImp(AliHMPIDAnalysisTask)
@@ -43,45 +51,83 @@ AliHMPIDAnalysisTask::AliHMPIDAnalysisTask() :
   fTrigger(0),
   fHmpPesdPhmp(0x0),fHmpCkovPesd(0x0),fHmpCkovPhmp(0x0),
   fHmpMipTrkDist(0x0),fHmpMipTrkDistX(0x0),fHmpMipTrkDistY(0x0),fHmpMipCharge3cm(0x0),fHmpMipCharge1cm(0x0),fHmpNumPhots(0x0),
-  fHmpTrkFlags(0x0)
+  fHmpTrkFlags(0x0),
+  fN1(6),
+  fN2(8),
+  fPionEff(0x0),
+  fKaonEff(0x0),
+  fProtEff(0x0),
+  fPionTot(0x0),
+  fKaonTot(0x0),
+  fProtTot(0x0),
+  fPionNot(0x0),
+  fKaonNot(0x0),
+  fProtNot(0x0),
+  fPionCon(0x0),
+  fKaonCon(0x0),
+  fProtCon(0x0),
+  fThetavsPiFromK(0x0),
+  fThetapivsPesd(0x0),
+  fThetaKvsPesd(0x0),
+  fThetaPvsPesd(0x0)
 {
   //
   //Default ctor
   //
-  
 }
+
 //___________________________________________________________________________
 AliHMPIDAnalysisTask::AliHMPIDAnalysisTask(const Char_t* name) :
   AliAnalysisTaskSE(name),
-  fESD(0),fHmpHistList(0x0), fNevts(0),
+  fESD(0), fHmpHistList(0x0), fNevts(0),
   fTrigNevts(0),
   fTrigger(0),
-  fHmpPesdPhmp(0x0),fHmpCkovPesd(0x0),fHmpCkovPhmp(0x0),
-  fHmpMipTrkDist(0x0),fHmpMipTrkDistX(0x0),fHmpMipTrkDistY(0x0),fHmpMipCharge3cm(0x0),fHmpMipCharge1cm(0x0),fHmpNumPhots(0x0),
-  fHmpTrkFlags(0x0)
+  fHmpPesdPhmp(0x0), fHmpCkovPesd(0x0), fHmpCkovPhmp(0x0),
+  fHmpMipTrkDist(0x0), fHmpMipTrkDistX(0x0), fHmpMipTrkDistY(0x0),
+  fHmpMipCharge3cm(0x0), fHmpMipCharge1cm(0x0),
+  fHmpNumPhots(0x0), fHmpTrkFlags(0x0),
+  fN1(6),
+  fN2(8),
+  fPionEff(0x0),
+  fKaonEff(0x0),
+  fProtEff(0x0),
+  fPionTot(0x0),
+  fKaonTot(0x0),
+  fProtTot(0x0),
+  fPionNot(0x0),
+  fKaonNot(0x0),
+  fProtNot(0x0),
+  fPionCon(0x0),
+  fKaonCon(0x0),
+  fProtCon(0x0),
+  fThetavsPiFromK(0x0),
+  fThetapivsPesd(0x0),
+  fThetaKvsPesd(0x0),
+  fThetaPvsPesd(0x0)
 {
   //
   // Constructor. Initialization of Inputs and Outputs
   //
-  
+
   DefineOutput(0,TList::Class());
- }
+}
+
 //___________________________________________________________________________
-AliHMPIDAnalysisTask& AliHMPIDAnalysisTask::operator=(const AliHMPIDAnalysisTask& c) 
+AliHMPIDAnalysisTask& AliHMPIDAnalysisTask::operator=(const AliHMPIDAnalysisTask& c)
 {
   //
   // Assignment operator
   //
   if (this!=&c) {
-    AliAnalysisTaskSE::operator=(c) ;
-    fESD             = c.fESD ;
-    fHmpHistList     = c.fHmpHistList ;
+    AliAnalysisTaskSE::operator=(c);
+    fESD             = c.fESD;
+    fHmpHistList     = c.fHmpHistList;
     fNevts           = c.fNevts;
     fTrigNevts       = c.fTrigNevts;
     fTrigger         = c.fTrigger;
-    fHmpPesdPhmp     = c.fHmpPesdPhmp ;
-    fHmpCkovPesd     = c.fHmpCkovPesd ;
-    fHmpCkovPhmp     = c.fHmpCkovPhmp ;
+    fHmpPesdPhmp     = c.fHmpPesdPhmp;
+    fHmpCkovPesd     = c.fHmpCkovPesd;
+    fHmpCkovPhmp     = c.fHmpCkovPhmp;
     fHmpMipTrkDist   = c.fHmpMipTrkDist;
     fHmpMipTrkDistX  = c.fHmpMipTrkDistX;
     fHmpMipTrkDistY  = c.fHmpMipTrkDistY;
@@ -89,10 +135,27 @@ AliHMPIDAnalysisTask& AliHMPIDAnalysisTask::operator=(const AliHMPIDAnalysisTask
     fHmpMipCharge1cm = c.fHmpMipCharge1cm;
     fHmpNumPhots     = c.fHmpNumPhots;
     fHmpTrkFlags     = c.fHmpTrkFlags;
-    
+    fN1              = c.fN1;
+    fN2              = c.fN2;
+    fPionEff         = c.fPionEff;
+    fKaonEff         = c.fKaonEff;
+    fProtEff         = c.fProtEff;
+    fPionTot         = c.fPionTot;
+    fKaonTot         = c.fKaonTot;
+    fProtTot         = c.fProtTot;
+    fPionNot         = c.fPionNot;
+    fKaonNot         = c.fKaonNot;
+    fProtNot         = c.fProtNot;
+    fPionCon         = c.fPionCon;
+    fKaonCon         = c.fKaonCon;
+    fProtCon         = c.fProtCon;
+    fThetavsPiFromK  = c.fThetavsPiFromK;
+    fThetapivsPesd   = c.fThetapivsPesd;
+    fThetaKvsPesd    = c.fThetaKvsPesd;
+    fThetaPvsPesd    = c.fThetaPvsPesd;
   }
   return *this;
-}   
+}
 
 //___________________________________________________________________________
 AliHMPIDAnalysisTask::AliHMPIDAnalysisTask(const AliHMPIDAnalysisTask& c) :
@@ -101,9 +164,27 @@ AliHMPIDAnalysisTask::AliHMPIDAnalysisTask(const AliHMPIDAnalysisTask& c) :
   fTrigNevts(c.fTrigNevts),
   fTrigger(c.fTrigger),
   fHmpPesdPhmp(c.fHmpPesdPhmp),fHmpCkovPesd(c.fHmpCkovPesd),fHmpCkovPhmp(c.fHmpCkovPhmp),
-  fHmpMipTrkDist(c.fHmpMipTrkDist),fHmpMipTrkDistX(c.fHmpMipTrkDistX),fHmpMipTrkDistY(c.fHmpMipTrkDistY),fHmpMipCharge3cm(c.fHmpMipCharge3cm),
-  fHmpMipCharge1cm(c.fHmpMipCharge1cm),fHmpNumPhots(c.fHmpNumPhots),
-  fHmpTrkFlags(c.fHmpTrkFlags)    
+  fHmpMipTrkDist(c.fHmpMipTrkDist),fHmpMipTrkDistX(c.fHmpMipTrkDistX),fHmpMipTrkDistY(c.fHmpMipTrkDistY),
+  fHmpMipCharge3cm(c.fHmpMipCharge3cm), fHmpMipCharge1cm(c.fHmpMipCharge1cm),
+  fHmpNumPhots(c.fHmpNumPhots), fHmpTrkFlags(c.fHmpTrkFlags),
+  fN1(c.fN1),
+  fN2(c.fN2),
+  fPionEff(c.fPionEff),
+  fKaonEff(c.fKaonEff),
+  fProtEff(c.fProtEff),
+  fPionTot(c.fPionTot),
+  fKaonTot(c.fKaonTot),
+  fProtTot(c.fProtTot),
+  fPionNot(c.fPionNot),
+  fKaonNot(c.fKaonNot),
+  fProtNot(c.fProtNot),
+  fPionCon(c.fPionCon),
+  fKaonCon(c.fKaonCon),
+  fProtCon(c.fProtCon),
+  fThetavsPiFromK(c.fThetavsPiFromK),
+  fThetapivsPesd(c.fThetapivsPesd),
+  fThetaKvsPesd(c.fThetaKvsPesd),
+  fThetaPvsPesd(c.fThetaPvsPesd)
 {
   //
   // Copy Constructor
@@ -115,81 +196,162 @@ AliHMPIDAnalysisTask::~AliHMPIDAnalysisTask() {
   //
   //destructor
   //
-  Info("~AliHMPIDAnalysisask","Calling Destructor");
+  Info("~AliHMPIDAnalysisTask","Calling Destructor");
   if (fHmpHistList) {fHmpHistList->Clear(); delete fHmpHistList;}
 }
+
 //___________________________________________________________________________
-void AliHMPIDAnalysisTask::ConnectInputData(Option_t *) 
+void AliHMPIDAnalysisTask::ConnectInputData(Option_t *)
 {
   // Connect ESD here
-  
+
   AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
   if (!esdH) {
-      AliDebug(2,Form("ERROR: Could not get ESDInputHandler")); 
+      AliDebug(2,Form("ERROR: Could not get ESDInputHandler"));
     } else
       fESD = esdH->GetEvent();
- }
+
+  // Connect MC
+
+  AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
+  if (!mcH) {
+      AliDebug(2,Form("ERROR: Could not get MCEventHandler"));
+    } else
+      fMC = mcH->MCEvent();
+}
+
 //_________________________________________________
 void AliHMPIDAnalysisTask::Exec(Option_t *)
 {
+  AliStack* pStack = fMC->Stack();
+  Int_t label;
+  Double_t priors[5]={1.,1.,1.,1.,1.}; //{0.01,0.01,0.83,0.10,0.5};
+  Double_t probs[5];
+  AliPID *pPid = new AliPID();
+  pPid->SetPriors(priors);
+  Double_t n = 1.293;
+  Double_t dGeVMass[] = {0.000511,0.105658,0.13957018,0.493677,0.938272};
+
+  AliESDtrack *track=0;
+  TParticle *pPart=0;
   //
   // Main loop function, executed on Event basis
   //
   for (Int_t iTrack = 0; iTrack<fESD->GetNumberOfTracks(); iTrack++) {
 
-    AliESDtrack* track = fESD->GetTrack(iTrack);
+    track = fESD->GetTrack(iTrack);
     if(!track) continue;
+    Double_t dPtr = track->P();
     Double_t rin[3], rout[3];
     track->GetInnerXYZ(rin);
     track->GetOuterXYZ(rout);
-        /*
-     ((TH2F *)fHmpHistList->At(22))->Fill(rin[0],rin[1]);
-     ((TH2F *)fHmpHistList->At(23))->Fill(rout[0],rout[1]);
-*/
-     Double_t ktol = 0.001;
-    
-     if(Equal(track->GetHMPIDsignal(),-20.,ktol))      fHmpTrkFlags->Fill(0);
-     else if(Equal(track->GetHMPIDsignal(),-9.,ktol))  fHmpTrkFlags->Fill(1);
-     else if(Equal(track->GetHMPIDsignal(),-5.,ktol))   fHmpTrkFlags->Fill(2);
-     else if(Equal(track->GetHMPIDsignal(),-11.,ktol))  fHmpTrkFlags->Fill(3);
-     else if(Equal(track->GetHMPIDsignal(),-22.,ktol)) fHmpTrkFlags->Fill(4);
-     else fHmpTrkFlags->Fill(4);     
-     
-       
+    Double_t ktol = 0.001;
+
+    if(Equal(track->GetHMPIDsignal(),-20.,ktol))      fHmpTrkFlags->Fill(0);
+    else if(Equal(track->GetHMPIDsignal(),-9.,ktol))  fHmpTrkFlags->Fill(1);
+    else if(Equal(track->GetHMPIDsignal(),-5.,ktol))   fHmpTrkFlags->Fill(2);
+    else if(Equal(track->GetHMPIDsignal(),-11.,ktol))  fHmpTrkFlags->Fill(3);
+    else if(Equal(track->GetHMPIDsignal(),-22.,ktol)) fHmpTrkFlags->Fill(4);
+    else fHmpTrkFlags->Fill(4);
+
     if(Equal(track->GetHMPIDsignal(),-20.,ktol)) continue;
     if(track->GetHMPIDcluIdx() < 0) continue;
-   
-    //Int_t ch = track->GetHMPIDcluIdx()/1000000; 
-    Float_t x, y; Int_t q, nph; 
+
+    //Int_t ch = track->GetHMPIDcluIdx()/1000000;
+    Int_t q, nph;
+    Float_t x, y;
     Float_t xpc, ypc, th, ph;
-    
     track->GetHMPIDmip(x,y,q,nph);
     track->GetHMPIDtrk(xpc,ypc,th,ph);
-     
+
     if(Equal(x,0.,ktol) && Equal(y,0.,ktol) && Equal(xpc,0.,ktol) && Equal(ypc,0.,ktol)) continue;
-    //Printf("%s  %s Good track is found",(char*)__FILE__,__LINE__);
-     
+
     Double_t dist = TMath::Sqrt( (xpc-x)*(xpc-x) + (ypc - y)*(ypc - y));
     fHmpMipTrkDist->Fill(dist);
-    fHmpMipTrkDistX->Fill(xpc-x);
+    fHmpMipTrkDistX->Fill(xpc - x);
     fHmpMipTrkDistY->Fill(ypc - y);
-    if(dist<=3.0) fHmpMipCharge3cm->Fill(q);
-    
+    Double_t pHmp[3] = {0}, pHmp3 = 0;
+    if (track->GetOuterHmpPxPyPz(pHmp)) pHmp3 = TMath::Sqrt(pHmp[0]*pHmp[0]+pHmp[1]*pHmp[1]+pHmp[2]*pHmp[2]);
+    if (dist <= 3.0) fHmpMipCharge3cm->Fill(q);
+
+    Float_t thetaTheorPion = 999., thetaTheorKaon = 999., thetaTheorProt = 999.,
+            thetaHmpTheorPion = 999., thetaHmpTheorKaon = 999., thetaHmpTheorProt = 999.;
+    if(dPtr != 0){
+      thetaTheorPion = TMath::ACos(TMath::Sqrt(dPtr*dPtr + dGeVMass[2]*dGeVMass[2])/(n*dPtr));
+      thetaTheorKaon = TMath::ACos(TMath::Sqrt(dPtr*dPtr + dGeVMass[3]*dGeVMass[3])/(n*dPtr));
+      thetaTheorProt = TMath::ACos(TMath::Sqrt(dPtr*dPtr + dGeVMass[4]*dGeVMass[4])/(n*dPtr));
+    }
+    if(pHmp3 != 0){
+      thetaHmpTheorPion = TMath::ACos(TMath::Sqrt(pHmp3*pHmp3 + dGeVMass[2]*dGeVMass[2])/(n*pHmp3));
+      thetaHmpTheorKaon = TMath::ACos(TMath::Sqrt(pHmp3*pHmp3 + dGeVMass[3]*dGeVMass[3])/(n*pHmp3));
+      thetaHmpTheorProt = TMath::ACos(TMath::Sqrt(pHmp3*pHmp3 + dGeVMass[4]*dGeVMass[4])/(n*pHmp3));
+    }
+
+    track->GetHMPIDpid(probs);
+    pPid->SetProbabilities(probs);
+    if ((label = track->GetLabel()) < 0) continue;
+    pPart = pStack->Particle(label);
+
+
     if(track->GetHMPIDsignal() > 0 )
     {
-      Printf("EvtNumInFile: %d HMPID ThetaC: %lf x: %lf xpc: %lf y: %lf ypx: %lf Q: %d nPh: %d IncTheta; %lf IncPhi: %lf",fESD->GetEventNumberInFile(),track->GetHMPIDsignal(),x,xpc,y,ypc,q,nph,th,ph);
-      Double_t pHmp[3] = {0},pmod = 0;if(track->GetOuterHmpPxPyPz(pHmp))  pmod = TMath::Sqrt(pHmp[0]*pHmp[0]+pHmp[1]*pHmp[1]+pHmp[2]*pHmp[2]); 
-      fHmpPesdPhmp->Fill(track->P(),pmod);  
-      if(dist<=1.0)  fHmpMipCharge1cm->Fill(q);
+      fHmpPesdPhmp->Fill(track->P(),pHmp3);
+      if (dist<=1.0) fHmpMipCharge1cm->Fill(q);
       fHmpNumPhots->Fill(nph);
       fHmpCkovPesd->Fill(track->P(),track->GetHMPIDsignal());
-      fHmpCkovPhmp->Fill(pmod,track->GetHMPIDsignal());
+      fHmpCkovPhmp->Fill(pHmp3,track->GetHMPIDsignal());
+
+      if (!pStack->IsPhysicalPrimary(label)) continue;
+      Int_t pdgCode = TMath::Abs(pPart->GetPdgCode());
+      if (pdgCode==211){
+        fThetapivsPesd->Fill(track->P(),track->GetHMPIDsignal());
+        Int_t mot=pPart->GetFirstMother();
+        if (mot > -1){
+          TParticle *pMot=pStack->Particle(mot);
+          TString str=pMot->GetName();
+          if (str.Contains("K")) fThetavsPiFromK->Fill(pHmp3,track->GetHMPIDsignal());
+        }
+      }
+      if (pdgCode==321) fThetaKvsPesd->Fill(track->P(),track->GetHMPIDsignal());
+      if (pdgCode==2212) fThetaPvsPesd->Fill(track->P(),track->GetHMPIDsignal());
+
+      if (track->Pt()<1. || track->Pt()>5.) continue;
+      Int_t ptBin=(Int_t) (2*(track->Pt()-1));
+      if (pdgCode!=2212) fProtCon->Fill(ptBin);
+      if (pdgCode==2212){
+        fProtTot->Fill(ptBin);
+        fProtEff->Fill(ptBin,pPid->GetProbability(AliPID::kProton));
+        fPionNot->Fill(ptBin,pPid->GetProbability(AliPID::kPion));
+        fKaonNot->Fill(ptBin,pPid->GetProbability(AliPID::kKaon));
+      }
+      if (pdgCode!=211) fPionCon->Fill(ptBin);
+      if (pdgCode!=321) fKaonCon->Fill(ptBin);
+      if (pdgCode==211){
+        if (ptBin < 6){
+          Float_t weight=pPid->GetProbability(AliPID::kElectron)+
+                         pPid->GetProbability(AliPID::kMuon)+
+                         pPid->GetProbability(AliPID::kPion);
+          fPionTot->Fill(ptBin);
+          fPionEff->Fill(ptBin,weight);
+          fKaonNot->Fill(ptBin,pPid->GetProbability(AliPID::kKaon));
+        }
+        fProtNot->Fill(ptBin,pPid->GetProbability(AliPID::kProton));
+      }
+      if (pdgCode==321){
+        if (ptBin < 6){
+          fKaonTot->Fill(ptBin);
+          fKaonEff->Fill(ptBin,pPid->GetProbability(AliPID::kKaon));
+          fPionNot->Fill(ptBin,(pPid->GetProbability(AliPID::kPion)));
+        }
+        fProtNot->Fill(ptBin,(pPid->GetProbability(AliPID::kProton)));
+      }
     }//there is signal
-    
-    }//track loop
-  
+  }//track loop
+
+  delete pPid;
+
   /* PostData(0) is taken care of by AliAnalysisTaskSE */
-  PostData(0,fHmpHistList) ;
+  PostData(0,fHmpHistList);
 }
 
 //___________________________________________________________________________
@@ -200,6 +362,107 @@ void AliHMPIDAnalysisTask::Terminate(Option_t*)
   // the results graphically or save the results to file.
 
   Info("Terminate","");
+  fHmpHistList = dynamic_cast<TList*> (GetOutputData(0));
+
+  fPionEff = dynamic_cast<TH1F*> (fHmpHistList->FindObject("PionEff"));
+  fPionTot = dynamic_cast<TH1I*> (fHmpHistList->FindObject("PionTot"));
+  fPionNot = dynamic_cast<TH1F*> (fHmpHistList->FindObject("PionNot"));
+  fPionCon = dynamic_cast<TH1I*> (fHmpHistList->FindObject("PionCon"));
+  fKaonEff = dynamic_cast<TH1F*> (fHmpHistList->FindObject("KaonEff"));
+  fKaonTot = dynamic_cast<TH1I*> (fHmpHistList->FindObject("KaonTot"));
+  fKaonNot = dynamic_cast<TH1F*> (fHmpHistList->FindObject("KaonNot"));
+  fKaonCon = dynamic_cast<TH1I*> (fHmpHistList->FindObject("KaonCon"));
+  fProtEff = dynamic_cast<TH1F*> (fHmpHistList->FindObject("ProtEff"));
+  fProtTot = dynamic_cast<TH1I*> (fHmpHistList->FindObject("ProtTot"));
+  fProtNot = dynamic_cast<TH1F*> (fHmpHistList->FindObject("ProtNot"));
+  fProtCon = dynamic_cast<TH1I*> (fHmpHistList->FindObject("ProtCon"));
+
+  Float_t *pionEff=fPionEff->GetArray();
+  Int_t   *pionTot=fPionTot->GetArray();
+  Float_t *pionNot=fPionNot->GetArray();
+  Int_t   *pionCon=fPionCon->GetArray();
+  Float_t *kaonEff=fKaonEff->GetArray();
+  Int_t   *kaonTot=fKaonTot->GetArray();
+  Float_t *kaonNot=fKaonNot->GetArray();
+  Int_t   *kaonCon=fKaonCon->GetArray();
+  Float_t *protEff=fProtEff->GetArray();
+  Int_t   *protTot=fProtTot->GetArray();
+  Float_t *protNot=fProtNot->GetArray();
+  Int_t   *protCon=fProtCon->GetArray();
+
+  TGraphErrors *effPi = new TGraphErrors(fN1);
+  TGraphErrors *effKa = new TGraphErrors(fN1);
+  TGraphErrors *effPr = new TGraphErrors(fN2);
+  TGraphErrors *conPi = new TGraphErrors(fN1);
+  TGraphErrors *conKa = new TGraphErrors(fN1);
+  TGraphErrors *conPr = new TGraphErrors(fN2);
+
+  Float_t pt[8]={1.25,1.75,2.25,2.75,3.25,3.75,4.25,4.75};
+  Float_t eff=0, effErr=0, con=0, conErr=0;
+  for (Int_t i=0; i< fN2; i++){
+    eff = protEff[i+1]/TMath::Max(protTot[i+1],1);
+    effErr = TMath::Sqrt(eff*(1.-eff)/TMath::Max(protTot[i+1],1));
+    con = protNot[i+1]/TMath::Max(protCon[i+1],1);
+    conErr = TMath::Sqrt(con*(1.-con)/protCon[i+1]);
+    effPr->SetPoint(i,pt[i],eff);
+    effPr->SetPointError(i,0,effErr);
+    conPr->SetPoint(i,pt[i],con);
+    conPr->SetPointError(i,0,conErr);
+
+    if (i>=fN1) continue;
+    eff = pionEff[i+1]/pionTot[i+1];
+    effErr = TMath::Sqrt(eff*(1.-eff)/pionTot[i+1]);
+    con=pionNot[i+1]/pionCon[i+1];
+    conErr = TMath::Sqrt(con*(1.-con)/pionCon[i+1]);
+    effPi->SetPoint(i,pt[i],(Float_t)pionEff[i+1]/(Float_t)pionTot[i+1]);
+    effPi->SetPointError(i,0,effErr);
+    conPi->SetPoint(i,pt[i],(Float_t)pionNot[i+1]/(Float_t)pionCon[i+1]);
+    conPi->SetPointError(i,0,conErr);
+
+    eff = kaonEff[i+1]/TMath::Max(kaonTot[i+1],1);
+    effErr = TMath::Sqrt(eff*(1.-eff)/kaonTot[i+1]);
+    con = kaonNot[i+1]/TMath::Max(kaonCon[i+1],1);
+    conErr = TMath::Sqrt(con*(1.-con)/kaonCon[i+1]);
+    effKa->SetPoint(i,pt[i],(Float_t)kaonEff[i+1]/TMath::Max(kaonTot[i+1],1));
+    effKa->SetPointError(i,0,effErr);
+    conKa->SetPoint(i,pt[i],(Float_t)kaonNot[i+1]/TMath::Max(kaonCon[i+1],1));
+    conKa->SetPointError(i,0,conErr);
+  }
+
+  TCanvas *pCan=new TCanvas("Hmp","Efficiency and contamination",500,900);
+  pCan->Divide(1,3);
+
+  pCan->cd(1);
+  effPi->SetTitle("Pions");
+  effPi->GetXaxis()->SetTitle("p_{T} (GeV/c)");
+  effPi->GetYaxis()->SetRangeUser(0.,1.);
+  effPi->SetMarkerStyle(20);
+  effPi->Draw("ALP");
+  conPi->SetMarkerStyle(21);
+  conPi->Draw("sameLP");
+
+  pCan->cd(2);
+  effKa->SetTitle("Kaons");
+  effKa->GetXaxis()->SetTitle("p_{T} (GeV/c)");
+  effKa->GetYaxis()->SetRangeUser(0.,1.);
+  effKa->SetMarkerStyle(20);
+  effKa->Draw("ALP");
+  conKa->SetMarkerStyle(21);
+  conKa->Draw("sameLP");
+
+  pCan->cd(3);
+  effPr->SetTitle("Protons");
+  effPr->GetXaxis()->SetTitle("p_{T} (GeV/c)");
+  effPr->GetYaxis()->SetRangeUser(0.,1.);
+  effPr->SetMarkerStyle(20);
+  effPr->Draw("ALP");
+  conPr->SetMarkerStyle(21);
+  conPr->Draw("sameLP");
+
+  TFile *outFile = new TFile("HmpidGraphs.root","recreate");
+  pCan->Write();
+  outFile->Close();
+
   AliAnalysisTaskSE::Terminate();
 
 }
@@ -214,83 +477,74 @@ void AliHMPIDAnalysisTask::CreateOutputObjects() {
   //slot #1
    OpenFile(0);
    fHmpHistList = new TList();
+
    fHmpPesdPhmp = new TH2F("fHmpPesdPhmp","HMPID: ESD p - running p;HMP p (GeV/c);ESD p (Gev/c)",100,0,10,100,0,10);
    fHmpHistList->Add(fHmpPesdPhmp);
-   
+
    fHmpCkovPesd = new TH2F("fHmpCkovPesd","HMPID: ThetaCherenkov vs P;p_esd (GeV/c);#Theta_C;Entries",100,0,10,110,0,1.1);
    fHmpHistList->Add(fHmpCkovPesd);
-   
+
    fHmpCkovPhmp = new TH2F("fHmpCkovPhmp","HMPID: ThetaCherenkov vs P;p_hmp (GeV/c);#Theta_C;Entries",100,0,10,110,0,1.1);
-   fHmpHistList->Add(fHmpCkovPhmp);  
-   
+   fHmpHistList->Add(fHmpCkovPhmp);
+
    fHmpMipTrkDist = new TH1F("fHmpMipTrkDist","HMPID MIP-Track distance;distance (cm);Entries",800,-20,20);
    fHmpHistList->Add(fHmpMipTrkDist);
+
    fHmpMipTrkDistX = new TH1F("fHmpMipTrkDistX","HMPID MIP-Track distance in local X;distance (cm);Entries",800,-20,20);
    fHmpHistList->Add(fHmpMipTrkDistX);
+
    fHmpMipTrkDistY = new TH1F("fHmpMipTrkDistY","HMPID MIP-Track distance in local Y;distance (cm);Entries",800,-20,20);
    fHmpHistList->Add(fHmpMipTrkDistY);
-   
+
    fHmpMipCharge3cm = new TH1F("fHmpMipCharge3cm","HMPID MIP Charge;MIP Charge (ADC);Entries",5001,-0.5,5000.5);
    fHmpHistList->Add(fHmpMipCharge3cm);
-   
+
    fHmpMipCharge1cm = new TH1F("fHmpMipCharge1cm","HMPID MIP Charge;MIP Charge (ADC);Entries",5001,-0.5,5000.5);
    fHmpHistList->Add(fHmpMipCharge1cm);
-   
+
    fHmpNumPhots = new TH1F("fHmpNumPhots","HMPID Number of photon clusters on ring;#photon clus.;Entries",51,-0.5,50.5);
    fHmpHistList->Add(fHmpNumPhots);
-   
+
    fHmpTrkFlags = new TH1F("fHmpTrkFlags","HMPID track flags",6,0,6);
    TString summary[6] =  {"NotPerformed","MipDistCut", "MipQdcCut", "NoPhotAccept", "kNoRad", "other"};
    for(Int_t ibin = 0; ibin < 6; ibin++) fHmpTrkFlags->GetXaxis()->SetBinLabel(ibin+1,Form("%i  %s",ibin+1,summary[ibin].Data()));
    fHmpHistList->Add(fHmpTrkFlags);
-   /*
-   //0
-   TH1F *trkH = new TH1F("trkH","signal flags in HMPID",6,0,6);
-   TString summary[6] =  {"NotPerformed","MipDistCut", "MipQdcCut", "NoPhotAccept", "kNoRad", "other"};
-   for(Int_t ibin = 0; ibin < 6; ibin++) trkH->GetXaxis()->SetBinLabel(ibin+1,Form("%i  %s",ibin+1,summary[ibin].Data()));
-   fHmpHistList->Add(trkH);
-
-  
-   TH2F *mod[7], *dq[7];
-   TH1F *q[7];
-
-   //1-7
-   for(Int_t i=0; i< 7 ; i++) {// to preserve the histo sorting
-   mod[i] = new TH2F(Form("mod%i",i),Form("MIP position in chamber %i",i),180,0,180,180,0,180);
-   mod[i]->SetMarkerStyle(8);
-   mod[i]->SetMarkerColor(2);
-   fHmpHistList->Add(mod[i]);
-   }
-   //8-14
-   for(Int_t i=0; i< 7 ; i++) {//to reserve the histo sorting
-   q[i] = new TH1F(Form("q%i",i),Form("MIP charge distribution in chamber %i",i),5000,0,5000);
-   q[i]->SetMarkerColor(2);
-   fHmpHistList->Add(q[i]);
-   }
-   //15-21
-   for(Int_t i=0; i< 7 ; i++) {//to reserve the histo sorting
-   dq[i] = new TH2F(Form("dq%i",i),Form("#Delta(mip-track) vs Q_{mip} in chamber %i",i),1000,0,100,5000,0,5000),
-   dq[i]->SetMarkerStyle(6);
-   fHmpHistList->Add(dq[i]);
-   }
-   //22
-   TH2F *inner = new TH2F("inner","inner track XY",800,-400,400,800,-400,400);
-   inner->SetMarkerStyle(6);
-   inner->SetXTitle("X cm");
-   inner->SetYTitle("Y cm");
-   fHmpHistList->Add(inner); 
-   //23
-   TH2F *outer = new TH2F("outer","outer track XY",800,-400,400,800,-400,400);
-   outer->SetMarkerStyle(6);
-   outer->SetXTitle("X cm");
-   outer->SetYTitle("Y cm");
-   fHmpHistList->Add(outer);
-*/
+
+   fPionEff = new TH1F("PionEff","Identified pions",fN1,0,fN1);
+   fKaonEff = new TH1F("KaonEff","Identified kaons",fN1,0,fN1);
+   fProtEff = new TH1F("ProtEff","Identified protons",fN2,0,fN2);
+   fPionTot = new TH1I("PionTot","Total MC pions",fN1,0,fN1);
+   fKaonTot = new TH1I("KaonTot","Total MC kaons",fN1,0,fN1);
+   fProtTot = new TH1I("ProtTot","Total MC protons",fN2,0,fN2);
+   fPionNot = new TH1F("PionNot","Misidentified pions",fN1,0,fN1);
+   fKaonNot = new TH1F("KaonNot","Misidentified kaons",fN1,0,fN1);
+   fProtNot = new TH1F("ProtNot","Misidentified protons",fN2,0,fN2);
+   fPionCon = new TH1I("PionCon","Total not MC pions",fN1,0,fN1);
+   fKaonCon = new TH1I("KaonCon","Total not MC kaons",fN1,0,fN1);
+   fProtCon = new TH1I("ProtCon","Total not MC protons",fN2,0,fN2);
+
+   fHmpHistList->Add(fPionEff); fHmpHistList->Add(fKaonEff); fHmpHistList->Add(fProtEff);
+   fHmpHistList->Add(fPionTot); fHmpHistList->Add(fKaonTot); fHmpHistList->Add(fProtTot);
+   fHmpHistList->Add(fPionNot); fHmpHistList->Add(fKaonNot); fHmpHistList->Add(fProtNot);
+   fHmpHistList->Add(fPionCon); fHmpHistList->Add(fKaonCon); fHmpHistList->Add(fProtCon);
+
+   fThetavsPiFromK= new TH2F("ThetavsPiFromK","Theta vs p of pions from K;p_esd (GeV/c);#Theta_C",100,0,10,110,0,1.1);
+   fHmpHistList->Add(fThetavsPiFromK);
+
+   fThetapivsPesd = new TH2F("ThetapivsPesd","Theta of pions vs p of esd;p_esd (GeV/c);#Theta_C",100,0,10,110,0,1.1);
+   fHmpHistList->Add(fThetapivsPesd);
+
+   fThetaKvsPesd  = new TH2F("ThetaKvsPesd","Theta of kaons vs p of esd;p_esd (GeV/c);#Theta_C",100,0,10,110,0,1.1);
+   fHmpHistList->Add(fThetaKvsPesd);
+
+   fThetaPvsPesd  = new TH2F("ThetaPvsPesd","Theta of protons vs p of esd;p_esd (GeV/c);#Theta_C",100,0,10,110,0,1.1);
+   fHmpHistList->Add(fThetaPvsPesd);
+
 }
 //____________________________________________________________________________________________________________________________________
 Bool_t AliHMPIDAnalysisTask::Equal(Double_t x, Double_t y, Double_t tolerance)
 {
- return abs(x - y) <= tolerance ;  
-}  
+ return abs(x - y) <= tolerance ;
+}
    
 #endif
index 6714ee9..0f0b4fb 100644 (file)
 #define ALIHMPIDANALYSISTASK_H
 
 #include "AliAnalysisTaskSE.h"
+#include "AliStack.h"
 
 class TH1;
-class TH2;
-class TParticle ;
-class AliStack ;
+class TParticle;
+class TFile;
 class AliESDtrack;
 class AliESDEvent;
 
@@ -46,6 +46,7 @@ class AliHMPIDAnalysisTask : public AliAnalysisTaskSE {
   virtual void   CreateOutputObjects();
   virtual void   Exec(Option_t *option);
   virtual void   Terminate(Option_t *);
+
           Bool_t Equal(Double_t x, Double_t y, Double_t tolerance);
   
  protected:
@@ -53,23 +54,47 @@ class AliHMPIDAnalysisTask : public AliAnalysisTaskSE {
  private:     
  
   void   SetTrigger(Int_t trigger) {fTrigger = trigger;}
-  AliESDEvent   *fESD;             //! ESD object
-  TList         *fHmpHistList ;    // list of histograms 
+  AliESDEvent *fESD;               //! ESD object
+  AliMCEvent  *fMC;                //! MC event
+
+  TList         *fHmpHistList ;    // list of histograms
   Int_t          fNevts       ;    //event numbering
   Int_t          fTrigNevts   ;    //event numbering with the requested trigger
   Int_t          fTrigger     ;    //requested trigger
+
   TH2F          *fHmpPesdPhmp;     // HMP momentum vs ESD momentum
   TH2F          *fHmpCkovPesd;     // Ckov angle vs ESD momentum
   TH2F          *fHmpCkovPhmp;     // Ckov angle vs HMP momenutm
+
   TH1F          *fHmpMipTrkDist;   // Track-Mip distance distribution
   TH1F          *fHmpMipTrkDistX;  // Xtrk - Xmip
   TH1F          *fHmpMipTrkDistY;  // Ytrk - Ymip
-  TH1F          *fHmpMipCharge3cm; // Mip charge with 3 cm distance cut 
+  TH1F          *fHmpMipCharge3cm; // Mip charge with 3 cm distance cut
   TH1F          *fHmpMipCharge1cm; // Mip charge with 1 cm distance cut
   TH1F          *fHmpNumPhots;     // Number of reconstructed photo-electrons
   TH1F          *fHmpTrkFlags;     // track flags
-  
-  ClassDef(AliHMPIDAnalysisTask,2);
+
+  Int_t          fN1;              // number of points for pi and K
+  Int_t          fN2;              // number of point for p
+  TH1F          *fPionEff;         // identified pions
+  TH1F          *fKaonEff;         // identified kaons
+  TH1F          *fProtEff;         // identified protons
+  TH1I          *fPionTot;         // total pions
+  TH1I          *fKaonTot;         // total kaons
+  TH1I          *fProtTot;         // total protons
+  TH1F          *fPionNot;         // non-pion tracks
+  TH1F          *fKaonNot;         // non-kaon tracks
+  TH1F          *fProtNot;         // non-proton tracks
+  TH1I          *fPionCon;         // tracks identified as pions
+  TH1I          *fKaonCon;         // tracks identified as kaons
+  TH1I          *fProtCon;         // tracks identified as protons
+  TH2F          *fThetavsPiFromK;  // theta chkov of pis from Ks
+  TH2F          *fThetapivsPesd;   // theta chkov of pions vs Pesd
+  TH2F          *fThetaKvsPesd;    // theta chkov of kaons vs Pesd
+  TH2F          *fThetaPvsPesd;    // theta chkov of protons vs Pesd
+
+
+  ClassDef(AliHMPIDAnalysisTask,3);
 };
 
-#endif
+#endif
\ No newline at end of file