HMPID Analysis task improved
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Dec 2009 15:23:42 +0000 (15:23 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Dec 2009 15:23:42 +0000 (15:23 +0000)
HMPID/AliHMPIDAnalysisTask.C
HMPID/AliHMPIDAnalysisTask.cxx
HMPID/AliHMPIDAnalysisTask.h

index f6bbc47..20777fd 100644 (file)
-Bool_t AliHMPIDAnalysisTask()
+void AliHMPIDAnalysisTask()
 {
   
-  TBenchmark benchmark;
-  benchmark.Start("AliHMPIDAnalysisTask");
-
-  AliLog::SetGlobalDebugLevel(0);
-
-  Load() ; //load the required libraries
-
-  TChain * analysisChain ;
-   analysisChain = new TChain("esdTree");
-    //here put your input data path 
-   analysisChain->Add("AliESDs.root");
-
-
-  Info("AliHMPIDAnalysisTask",Form("N events %d",(Int_t)analysisChain->GetEntries()));
-
-  // create the task
-  AliHMPIDAnalysisTask *task = new AliHMPIDAnalysisTask("CosmicAnalysisTask");
-  task->SetTrigger(2);
-
-  // Make the analysis manager
-  AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
-
-  AliESDInputHandler* esdHandler = new AliESDInputHandler();
-  mgr->SetInputEventHandler(esdHandler);
-
-  // Create and connect containers for input/output
-
-  //------ input data ------
-  AliAnalysisDataContainer *cinput0  = mgr->GetCommonInputContainer();
-
-  // ----- output data -----
   
-  //slot 0 : default output tree (by default handled by AliAnalysisTaskSE)
-//  AliAnalysisDataContainer *coutput0 = mgr->CreateContainer("ctree0", TTree::Class(),AliAnalysisManager::kOutputContainer,"Houtput.root");
-
-  //now comes user's output objects :
+  //
+  // Macro to run the AliHMPIDAnalysisTask
+  //
+  //______ Input settings
+  Int_t nEvents = 10000000;           //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";
   
-  // output TH1I for event counting
-  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("chist0", TH1I::Class(),AliAnalysisManager::kOutputContainer,"Houtput.root");
-  // output list of histos
-  AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("clist0", TList::Class(),AliAnalysisManager::kOutputContainer,"Houtput.root");
-  cinput0->SetData(analysisChain);
+  //______ Select Local, Proof or Intercative Grid Analysis (but just only one :-))
+  Bool_t bLOCAL        = kFALSE;
+  Bool_t bPROOF        = kFALSE;
+  Bool_t bGRIDINT      = kTRUE;
+
+  AliLog::SetGlobalDebugLevel(2);
+
+
+  //______ Init data set chain
+  TString dataset(indataset);
+  TChain *chain = new TChain("esdTree");
+
+  //______ Define settings for PROOF
+  const char* proofNode = "lmolnar@alicecaf";
+  gEnv->SetValue("XSec.GSI.DelegProxy","2");
+  gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
+  gSystem->Load("libSTEERBase");
+  gSystem->Load("libESD");
+  gSystem->Load("libAOD");
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libANALYSISalice");  
+ //______ Create analysis manager
+   AliAnalysisManager *mgr  = new AliAnalysisManager("HMPID Analysis Train", "HMPID Analysis Train");
+   //______ Create input handler, default ESD
+   AliESDInputHandler *esdHandler = new AliESDInputHandler();
+   mgr->SetInputEventHandler(esdHandler);
+   mgr->SetDebugLevel(0);
+   AliLog::SetGlobalLogLevel(0);
+   //______ Create default input container
+   AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
+   AliAnalysisDataContainer *hmpoutput= mgr->CreateContainer("hmpoutput", TList::Class(),AliAnalysisManager::kOutputContainer,"HmpidOutput.root");
+  
+   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");  
+   //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++");
+   AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
+   mgr->AddTask(hmpTask);  
+  }
+  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");   
+    gProof->Load(Form("%s/HMPID/AliHMPIDAnalysisTask.cxx++g",gSystem->Getenv("ALICE_ROOT")));
+    AliHMPIDAnalysisTask *hmpTask = new AliHMPIDAnalysisTask("HMPIDAnalysisTask");
+    mgr->AddTask(hmpTask);    
+  }
+  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->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); 
+    //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);  
+     
+  }
+  
+   
+  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");  
+   
 
-  mgr->AddTask(task);
-  mgr->ConnectInput(task,0,cinput0);
-//  mgr->ConnectOutput(task,0,coutput0);
-  mgr->ConnectOutput(task,1,coutput1);
-  mgr->ConnectOutput(task,2,coutput2);
+  }
+  if ( bPROOF ) 
+  {
+    
+  } 
+  
+   mgr->ConnectInput(hmpTask,0,cinput);
+   mgr->ConnectOutput(hmpTask,0,hmpoutput);
  
-
-  //RUN !!!
-  if (mgr->InitAnalysis()) {
-    mgr->PrintStatus();
-    mgr->StartAnalysis("local",analysisChain);
+   
+      
+    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.                                                                          
+   TAlienCollection * myCollection  = TAlienCollection::Open(xmlfile);
+
+   if (!myCollection) {
+      ::Error("CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ;
+     return NULL ;
+   }
+
+  TChain* chain = new TChain(treeName);
+  myCollection->Reset() ;
+  Int_t iCount = 0;
+  while ( myCollection->Next() ){
+    if(nFiles!=0)iCount++;
+    if(iCount > nFiles)break;
+    chain->Add(myCollection->GetTURL("")) ;
+    Printf("Adding %s",myCollection->GetTURL(""));
   }
+  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.                                                                   
 
-  benchmark.Stop("AliHMPIDAnalysisTask");
-  benchmark.Show("AliHMPIDAnalysisTask");
-
-  return kTRUE ;
-
+  TString cdir(Form("%s", gSystem->WorkingDirectory() )) ;
+  TString parpar(Form("%s.par", pararchivename)) ;
+  
+  if (!gSystem->AccessPathName(pararchivename) ) {
+    TString processline = Form(".! tar xvzf %s",parpar.Data()) ;
+    gROOT->ProcessLine(processline.Data());
+  }
 
-}
+  TString ocwd = gSystem->WorkingDirectory();
+  gSystem->ChangeDirectory(pararchivename);
 
-void Load() {
+  // check for BUILD.sh and execute                                                                   
+  if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
+    printf("*******************************\n");
+    printf("*** Building PAR archive    ***\n");
+    cout<<pararchivename<<endl;
+    printf("*******************************\n");
 
-  //load the required aliroot libraries
-  gSystem->Load("libANALYSIS") ;
-  gSystem->Load("libANALYSISalice") ;
+    if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
+      Error("runProcess","Cannot Build the PAR Archive! - Abort!");
+      return -1;
+    }
+  }
+  // check for SETUP.C and execute                                                                    
+  if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
+    printf("*******************************\n");
+    printf("*** Setup PAR archive       ***\n");
+    cout<<pararchivename<<endl;
+    printf("*******************************\n");
+    gROOT->Macro("PROOF-INF/SETUP.C");
+  }
 
-  //compile online the task class
-  gSystem->SetIncludePath("-I. -I$HOME/HMPID -I$ALICE_ROOT/include -I$ROOTSYS/include");
-  gROOT->LoadMacro("./AliHMPIDAnalysisTask.cxx+");
+  gSystem->ChangeDirectory(ocwd.Data());
+  printf("Current dir: %s\n", ocwd.Data());
 }
+  
index 8f1d768..888f4b3 100644 (file)
 #ifndef AliHMPIDAnalysisTASK_CXX
 #define AliHMPIDAnalysisTASK_CXX
 
-#include "AliHMPIDAnalysisTask.h"
-#include "TCanvas.h"
-#include "AliStack.h"
-#include "TParticle.h"
-#include "Riostream.h"
-#include "TH1I.h"
-#include "TH2F.h"
-#include "TH1F.h"
-#include "AliMCEvent.h"
+
+#include "TH1.h"
+#include "TH2.h"
 #include "AliAnalysisManager.h"
-#include "AliESDEvent.h"
-#include "TChain.h"
+#include "AliESDInputHandler.h"
 #include "AliESDtrack.h"
 #include "AliLog.h"
+#include "AliHMPIDAnalysisTask.h"
 
 ClassImp(AliHMPIDAnalysisTask)
 
 //__________________________________________________________________________
 AliHMPIDAnalysisTask::AliHMPIDAnalysisTask() :
-  fHistList(0x0),
-  fHistEventsProcessed(0x0),
+  fESD(0x0),fHmpHistList(0x0),
   fNevts(0),
   fTrigNevts(0),
-  fTrigger(0)
+  fTrigger(0),
+  fHmpInner(0x0),fHmpPesdPhmp(0x0),fHmpCkovPesd(0x0),fHmpCkovPhmp(0x0),
+  fHmpMipTrkDist(0x0),fHmpMipTrkDistX(0x0),fHmpMipTrkDistY(0x0),fHmpMipCharge3cm(0x0),fHmpMipCharge1cm(0x0),fHmpNumPhots(0x0),
+  fHmpTrkFlags(0x0)
 {
   //
   //Default ctor
   //
+  
 }
 //___________________________________________________________________________
 AliHMPIDAnalysisTask::AliHMPIDAnalysisTask(const Char_t* name) :
   AliAnalysisTaskSE(name),
-  fHistList(0x0),
-  fHistEventsProcessed(0x0),
-  fNevts(0),
+  fESD(0),fHmpHistList(0x0), fNevts(0),
   fTrigNevts(0),
-  fTrigger(0)
+  fTrigger(0),
+  fHmpInner(0x0),fHmpPesdPhmp(0x0),fHmpCkovPesd(0x0),fHmpCkovPhmp(0x0),
+  fHmpMipTrkDist(0x0),fHmpMipTrkDistX(0x0),fHmpMipTrkDistY(0x0),fHmpMipCharge3cm(0x0),fHmpMipCharge1cm(0x0),fHmpNumPhots(0x0),
+  fHmpTrkFlags(0x0)
 {
   //
   // Constructor. Initialization of Inputs and Outputs
   //
-  Info("AliHMPIDAnalysisTask","Calling Constructor");
-
-  /*
-    DefineInput(0) and DefineOutput(0)
-    are taken care of by AliAnalysisTaskSE constructor
-  */
-  DefineOutput(1,TH1I::Class());
-  DefineOutput(2,TList::Class());
-}
-
-//___________________________________________________________________________
-AliHMPIDAnalysisTask& AliHMPIDAnalysisTask::operator=(const AliHMPIDAnalysisTask& c) 
-{
-  //
-  // Assignment operator
-  //
-  if (this!=&c) {
-    AliAnalysisTaskSE::operator=(c) ;
-    fHistList = c.fHistList ;
-    fHistEventsProcessed = c.fHistEventsProcessed;
-    fNevts = c.fNevts;
-    fTrigNevts = c.fTrigNevts;
-    fTrigger = c.fTrigger;
-  }
-  return *this;
-}
-
-//___________________________________________________________________________
-AliHMPIDAnalysisTask::AliHMPIDAnalysisTask(const AliHMPIDAnalysisTask& c) :
-  AliAnalysisTaskSE(c),
-  fHistList(c.fHistList),
-  fHistEventsProcessed(c.fHistEventsProcessed),
-  fNevts(c.fNevts),
-  fTrigNevts(c.fTrigNevts),
-  fTrigger(c.fTrigger)
-{
-  //
-  // Copy Constructor
-  //
-}
-
+  
+  DefineOutput(0,TList::Class());
+ }
 //___________________________________________________________________________
 AliHMPIDAnalysisTask::~AliHMPIDAnalysisTask() {
   //
   //destructor
   //
   Info("~AliHMPIDAnalysisask","Calling Destructor");
-  if (fHistEventsProcessed) delete fHistEventsProcessed ;
-  if (fHistList) {fHistList->Clear(); delete fHistList;}
+  if (fHmpHistList) {fHmpHistList->Clear(); delete fHmpHistList;}
 }
-
+//___________________________________________________________________________
+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")); 
+    } else
+      fESD = esdH->GetEvent();
+ }
 //_________________________________________________
-void AliHMPIDAnalysisTask::UserExec(Option_t *)
+void AliHMPIDAnalysisTask::Exec(Option_t *)
 {
   //
   // Main loop function, executed on Event basis
   //
-  Info("UserExec","") ;
-
-  AliESDEvent* fESD = dynamic_cast<AliESDEvent*>(fInputEvent);
-  if (!fESD) {
-    Error("UserExec","NO ESD FOUND!");
-    return;
-  }
-  fNevts++;
-  if(fESD->GetTriggerMask()&fTrigger == fTrigger) fTrigNevts++;
-
-
   for (Int_t iTrack = 0; iTrack<fESD->GetNumberOfTracks(); iTrack++) {
 
     AliESDtrack* track = fESD->GetTrack(iTrack);
@@ -133,47 +90,52 @@ void AliHMPIDAnalysisTask::UserExec(Option_t *)
     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]);
+*/
+
+     if(track->GetHMPIDsignal() == -20) fHmpTrkFlags->Fill(0);
+     else if(track->GetHMPIDsignal() == -9) fHmpTrkFlags->Fill(1);
+     else if(track->GetHMPIDsignal() == -5) fHmpTrkFlags->Fill(2);
+     else if(track->GetHMPIDsignal() == -11) fHmpTrkFlags->Fill(3);
+     else if(track->GetHMPIDsignal() == -22) fHmpTrkFlags->Fill(4);
+     else fHmpTrkFlags->Fill(4);
   
-     ((TH2F *)fHistList->At(22))->Fill(rin[0],rin[1]);
-     ((TH2F *)fHistList->At(23))->Fill(rout[0],rout[1]);
-
-
-     TH1F *h = ((TH1F*)(fHistList->At(0)));
-     if(track->GetHMPIDsignal() == -20) h->Fill(0);
-     else if(track->GetHMPIDsignal() == -9) h->Fill(1);
-     else if(track->GetHMPIDsignal() == -5) h->Fill(2);
-     else if(track->GetHMPIDsignal() == -11) h->Fill(3);
-     else if(track->GetHMPIDsignal() == -22) h->Fill(4);
-     else h->Fill(4);
-    
-     if(track->GetHMPIDcluIdx() == 99099999) continue;
-     if(track->GetHMPIDcluIdx() < 0) continue;
-
+    if(track->GetHMPIDsignal()== -20) continue;
+    if(track->GetHMPIDcluIdx() < 0) continue;
+   
     Int_t ch = track->GetHMPIDcluIdx()/1000000; 
-
     Float_t x, y; Int_t q, nph; 
-    track->GetHMPIDmip(x,y,q,nph);
-
-    if(x==0 && y==0) continue;
     Float_t xpc, ypc, th, ph;
-    track->GetHMPIDtrk(xpc,ypc,th,ph); //special setting in local cosmic rec!!!
-                                       //do not use with standard rec
-
+    
+    track->GetHMPIDmip(x,y,q,nph);
+    track->GetHMPIDtrk(xpc,ypc,th,ph);
+     
+    if(x==0 && y==0 && xpc == 0 && ypc == 0) continue;
+    //Printf("%s  %s Good track is found",(char*)__FILE__,__LINE__);
+     
     Double_t dist = TMath::Sqrt( (xpc-x)*(xpc-x) + (ypc - y)*(ypc - y));
-
-     if(ch >=0 && ch < 7) {
-     if(dist < 3) ((TH2F *)fHistList->At(ch+1))->Fill(x,y);
-     ((TH1F *)fHistList->At(ch+7+1))->Fill(q);
-     ((TH2F *)fHistList->At(ch+14+1))->Fill(dist,q);
-     }
-  
+    fHmpMipTrkDist->Fill(dist);
+    fHmpMipTrkDistX->Fill(xpc-x);
+    fHmpMipTrkDistY->Fill(ypc - y);
+    if(dist<=3.0) fHmpMipCharge3cm->Fill(q);
+    
+    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);
+      fHmpNumPhots->Fill(nph);
+      fHmpCkovPesd->Fill(track->P(),track->GetHMPIDsignal());
+      fHmpCkovPesd->Fill(pmod,track->GetHMPIDsignal());
+    }//there is signal
+    
     }//track loop
-
-  fHistEventsProcessed->Fill(0);
   
   /* PostData(0) is taken care of by AliAnalysisTaskSE */
-  PostData(1,fHistEventsProcessed) ;
-  PostData(2,fHistList) ;
+  PostData(0,fHmpHistList) ;
 }
 
 
@@ -191,25 +153,53 @@ void AliHMPIDAnalysisTask::Terminate(Option_t*)
 
 
 //___________________________________________________________________________
-void AliHMPIDAnalysisTask::UserCreateOutputObjects() {
+void AliHMPIDAnalysisTask::CreateOutputObjects() {
   //
   //HERE ONE CAN CREATE OUTPUT OBJECTS
   //TO BE SET BEFORE THE EXECUTION OF THE TASK
   //
-  Info("CreateOutputObjects","CreateOutputObjects of task %s", GetName());
 
   //slot #1
-  OpenFile(1);
-  fHistEventsProcessed = new TH1I("fHistEventsProcessed","",1,0,1) ;
-
-   OpenFile(2);
-   fHistList = new TList();
+   OpenFile(0);
+   fHmpHistList = new TList();
+   fHmpInner =new TH2F("fHmpInner","HMPID: Inner track XY;X (cm);Y(cm)",800,-400,400,800,-400,400);
+   fHmpHistList->Add(fHmpInner);
+   
+   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);  
    
+   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()));
-   fHistList->Add(trkH);
+   fHmpHistList->Add(trkH);
 
   
    TH2F *mod[7], *dq[7];
@@ -220,33 +210,33 @@ void AliHMPIDAnalysisTask::UserCreateOutputObjects() {
    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);
-   fHistList->Add(mod[i]);
+   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);
-   fHistList->Add(q[i]);
+   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);
-   fHistList->Add(dq[i]);
+   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");
-   fHistList->Add(inner); 
+   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");
-   fHistList->Add(outer);
-
+   fHmpHistList->Add(outer);
+*/
 }
 
 #endif
index 563af55..82819fb 100644 (file)
@@ -24,6 +24,7 @@ class TParticle ;
 class TFile ;
 class AliStack ;
 class AliESDtrack;
+class AliESDEvent;
 
 class AliHMPIDAnalysisTask : public AliAnalysisTaskSE {
   public:
@@ -32,28 +33,39 @@ class AliHMPIDAnalysisTask : public AliAnalysisTaskSE {
 
   AliHMPIDAnalysisTask();
   AliHMPIDAnalysisTask(const Char_t* name);
-  AliHMPIDAnalysisTask& operator= (const AliHMPIDAnalysisTask& c);
-  AliHMPIDAnalysisTask(const AliHMPIDAnalysisTask& c);
   virtual ~AliHMPIDAnalysisTask();
+  
+  virtual void   ConnectInputData(Option_t *);
+  virtual void   CreateOutputObjects();
+  virtual void   Exec(Option_t *option);
+  virtual void   Terminate(Option_t *);
 
-  // ANALYSIS FRAMEWORK STUFF
-  void     UserCreateOutputObjects();
-  void     UserExec(Option_t *option);
-  void     Terminate(Option_t *);
-
-  // setter
-  void   SetTrigger(Int_t trigger) {fTrigger = trigger;}
-
- protected:
-  TList          *fHistList ;  // list of histograms
   
-  //Number of events
-  TH1I  *fHistEventsProcessed ;  // simple histo for monitoring number of processed events
+ protected:
+     
+ private:     
+  void   SetTrigger(Int_t trigger) {fTrigger = trigger;}
+  AliESDEvent *fESD;              //! ESD object
+  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          *fHmpInner;
+  TH2F          *fHmpPesdPhmp;
+  TH2F          *fHmpCkovPesd;
+  TH2F          *fHmpCkovPhmp;
+  
+  TH1F          *fHmpMipTrkDist;
+  TH1F          *fHmpMipTrkDistX;
+  TH1F          *fHmpMipTrkDistY;
+  TH1F          *fHmpMipCharge3cm;
+  TH1F          *fHmpMipCharge1cm;
+  TH1F          *fHmpNumPhots;
+  
+  TH1F          *fHmpTrkFlags;
   
-  ClassDef(AliHMPIDAnalysisTask,1);
+  ClassDef(AliHMPIDAnalysisTask,2);
 };
 
 #endif