Rename base classes from PartCorr to CaloTrackCorr, agreed new naming and directory...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 Jan 2012 17:31:41 +0000 (17:31 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 12 Jan 2012 17:31:41 +0000 (17:31 +0000)
Extract from the analysis base class a new class containing the histograms settings AliHistogramRanges
All classes in the Dep directory affected and updated. Example macros updated or newly added with new naming

PWG4/PartCorrBase/AliAnaCaloTrackCorrBaseClass.cxx [new file with mode: 0755]
PWG4/PartCorrBase/AliAnaCaloTrackCorrBaseClass.h [new file with mode: 0755]
PWG4/PartCorrBase/AliAnaCaloTrackCorrMaker.cxx [new file with mode: 0755]
PWG4/PartCorrBase/AliAnaCaloTrackCorrMaker.h [new file with mode: 0755]
PWG4/PartCorrBase/AliAnalysisTaskCaloTrackCorrelation.cxx [moved from PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.cxx with 59% similarity]
PWG4/PartCorrBase/AliAnalysisTaskCaloTrackCorrelation.h [new file with mode: 0755]
PWG4/PartCorrBase/AliAnalysisTaskCaloTrackCorrelationM.cxx [moved from PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx with 59% similarity]
PWG4/PartCorrBase/AliAnalysisTaskCaloTrackCorrelationM.h [new file with mode: 0755]
PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.h [deleted file]
PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h [deleted file]

diff --git a/PWG4/PartCorrBase/AliAnaCaloTrackCorrBaseClass.cxx b/PWG4/PartCorrBase/AliAnaCaloTrackCorrBaseClass.cxx
new file mode 100755 (executable)
index 0000000..15b0977
--- /dev/null
@@ -0,0 +1,435 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//_________________________________________________________________________
+// Base class for CaloTrackCorr analysis algorithms
+//-- Author: Gustavo Conesa (LNF-INFN, LPSC-Grenoble) 
+//
+//
+//_________________________________________________________________________
+
+
+// --- ROOT system ---
+#include <TClonesArray.h>
+//#include <Riostream.h>
+
+//---- AliRoot system ----
+#include "AliAnaCaloTrackCorrBaseClass.h"
+#include "AliCaloTrackReader.h"
+#include "AliCalorimeterUtils.h"
+#include "AliCaloPID.h"
+#include "AliFiducialCut.h"
+#include "AliIsolationCut.h"
+#include "AliMCAnalysisUtils.h"
+#include "AliNeutralMesonSelection.h"
+#include "AliVCaloCells.h" 
+#include "AliAODEvent.h"
+#include "AliAODHandler.h"
+#include "AliAnalysisManager.h"
+#include "AliAODPWG4Particle.h"
+
+ClassImp(AliAnaCaloTrackCorrBaseClass)
+
+
+//__________________________________________________________
+AliAnaCaloTrackCorrBaseClass::AliAnaCaloTrackCorrBaseClass() : 
+TObject(), 
+fDataMC(0),                   fDebug(0),                   fCheckFidCut(0),
+fCheckCaloPID(0),             fRecalculateCaloPID(0), 
+fMinPt(0),                    fMaxPt(0),                   fPairTimeCut(200), 
+fMultiBin(0),                 fNZvertBin(0),
+fNrpBin(0),                   fNCentrBin(0),
+fNmaxMixEv(0),                fMaxMulti(0),                fMinMulti(0),
+fUseSelectEvent(kFALSE),      fMakePlots(kFALSE),
+fInputAODBranch(0x0),         fInputAODName(""),
+fOutputAODBranch(0x0),        fNewAOD(kFALSE),
+fOutputAODName(""),           fOutputAODClassName(""),
+fAODObjArrayName(""),         fAddToHistogramsName(""),
+fCaloPID(0x0),                fCaloUtils(0x0),
+fFidCut(0x0),                 fHisto(0x0),
+fIC(0x0),                     fMCUtils(0x0),                
+fNMS(0x0),                    fReader(0x0)
+{
+  //Default Ctor
+  
+  //Initialize parameters
+  InitParameters();
+}
+
+//___________________________________________________________
+AliAnaCaloTrackCorrBaseClass::~AliAnaCaloTrackCorrBaseClass() 
+{
+  // Remove all pointers except analysis output pointers.
+  
+  //delete fCaloUtils ; //Already deleted in maker
+  //delete fReader ;    //Already deleted in maker
+       
+  delete fCaloPID ; fCaloPID = 0;
+  delete fFidCut ;  fFidCut  = 0;
+  delete fIC ;      fIC      = 0;
+  delete fMCUtils ; fMCUtils = 0;
+  delete fNMS ;     fNMS     = 0;
+  delete fHisto;    fHisto   = 0;
+}
+
+//______________________________________________________________________
+void AliAnaCaloTrackCorrBaseClass::AddAODParticle(AliAODPWG4Particle pc)
+{
+  //Put AOD calo cluster in the AODParticleCorrelation array
+  
+  if(fOutputAODBranch){
+    
+    Int_t i = fOutputAODBranch->GetEntriesFast();
+    //new((*fOutputAODBranch)[i])  AliAODPWG4Particle(pc);
+    if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4Particle")==0)
+      new((*fOutputAODBranch)[i])  AliAODPWG4Particle(pc);
+    else   if(strcmp(fOutputAODBranch->GetClass()->GetName(),"AliAODPWG4ParticleCorrelation")==0)
+      new((*fOutputAODBranch)[i])  AliAODPWG4ParticleCorrelation(pc);
+    else {
+      printf("AliAnaCaloTrackCorrBaseClass::AddAODParticle() - Cannot add an object of type < %s >, to the AOD TClonesArray \n",  
+             fOutputAODBranch->GetClass()->GetName());
+      abort();    
+    }
+  }
+  else {
+    printf(" AliAnaCaloTrackCorrBaseClass::AddAODParticle() - No AOD branch available!!!\n");
+    abort();
+  }
+  
+}      
+
+
+//________________________________________________________________
+void AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() 
+{
+  //Recover ouput and input AOD pointers for each event in the maker
+       
+  //Delta AODs
+  if(fDebug > 3) printf("AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Connect Input with name: <%s>; Connect output with name <%s>\n",fInputAODName.Data(),fOutputAODName.Data());
+  
+  //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
+  AliAODHandler* aodHandler = 0x0;
+  Bool_t outAOD = kFALSE;
+  if((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()) outAOD = kTRUE;
+  if(outAOD) aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); 
+  else              aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
+  
+  if(!GetReader()->WriteDeltaAODToFile())
+  {
+    fOutputAODBranch =  (TClonesArray *) (fReader->GetAODBranchList())->FindObject(fOutputAODName);
+    fInputAODBranch  =  (TClonesArray *) (fReader->GetAODBranchList())->FindObject(fInputAODName);     
+  }
+  else if (aodHandler->GetExtensions()) { 
+    
+    AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName()); 
+    if(ext){
+      AliAODEvent *aodEvent = ext->GetAOD(); 
+      if(fNewAOD)fOutputAODBranch = (TClonesArray*) aodEvent->FindListObject(fOutputAODName);
+      fInputAODBranch = (TClonesArray*) aodEvent->FindListObject(fInputAODName);         
+      if(!fOutputAODBranch && fNewAOD) fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
+      if(!fInputAODBranch)  fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);
+    }
+    else{//If no Delta AODs, kept in standard branch, to revise. 
+      if(fNewAOD && fReader->GetOutputEvent()) {
+        fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
+        fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName); 
+      }
+      else {
+        fInputAODBranch  =  (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);  
+        if(!fInputAODBranch && fReader->GetOutputEvent() ) 
+          fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
+      }
+    }
+  }
+  else{ //If no Delta AODs, kept in standard branch
+    if(fNewAOD && fReader->GetOutputEvent()) {
+      fOutputAODBranch =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fOutputAODName);
+      fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);   
+    }
+    else{ 
+      fInputAODBranch  =  (TClonesArray *) fReader->GetInputEvent()->FindListObject(fInputAODName);
+      if(!fInputAODBranch && fReader->GetOutputEvent())  
+        fInputAODBranch  =  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(fInputAODName);//Try the output event.
+    }
+  }
+  
+  if(GetDebug() > 1){
+    if(fNewAOD && !fOutputAODBranch) 
+      printf(" AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Output Branch <%s>, not found!\n",fOutputAODName.Data());
+    if(!fNewAOD && !fInputAODBranch) 
+      printf(" AliAnaCaloTrackCorrBaseClass::ConnectInputOutputAODBranches() - Input Branch  <%s>, not found!\n",fInputAODName.Data());
+  }
+}
+
+//__________________________________________________________________________________________
+AliVCluster * AliAnaCaloTrackCorrBaseClass::FindCluster(TObjArray* clusters, const Int_t id, 
+                                                        Int_t & iclus, const Int_t first) 
+{
+  // Given the cluster ID stored in AliAODPWG4Particle, get the originator cluster and its index in the array
+  
+  if(!clusters) return 0x0;
+  
+  for(iclus = first; iclus < clusters->GetEntriesFast(); iclus++){
+    AliVCluster *cluster= dynamic_cast<AliVCluster*> (clusters->At(iclus));
+    if(cluster){
+      if     (cluster->GetID()==id) {
+        return cluster;
+      }
+    }      
+  }// calorimeter clusters loop
+  
+  return 0x0;
+  
+}
+
+//______________________________________________________________________________
+TClonesArray * AliAnaCaloTrackCorrBaseClass::GetAODBranch(TString aodName) const 
+{
+       //Recover ouput and input AOD pointers for each event in the maker
+       
+       //Delta AODs
+       if(fDebug > 3) printf("AliAnaCaloTrackCorrBaseClass::GetAODBranch() - Get Input Branch with name: <%s>; \n",aodName.Data());
+       
+  //Get the AOD handler, if output AOD is created use it, if not get the branches from the input which should be deltaAODs
+  AliAODHandler* aodHandler = 0x0;
+  Bool_t outAOD = kFALSE;
+  if((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()) outAOD = kTRUE;
+  if(outAOD) aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler()); 
+  else              aodHandler = (AliAODHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
+  
+  if(!GetReader()->WriteDeltaAODToFile())
+  {
+    return  (TClonesArray *) (fReader->GetAODBranchList())->FindObject(aodName);
+  }
+  else if (aodHandler->GetExtensions())
+  { 
+    AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject(GetReader()->GetDeltaAODFileName()); 
+    if(ext){
+      AliAODEvent *aodEvent = ext->GetAOD(); 
+      TClonesArray * aodbranch =  (TClonesArray*) aodEvent->FindListObject(aodName);
+      if(aodbranch) return aodbranch;
+      else {
+        if(outAOD) return  (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
+        else       return  (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
+      }
+    }
+    else{//If no Delta AODs, kept in standard branch, to revise. 
+      if(outAOD) return (TClonesArray *) fReader->GetOutputEvent()->FindListObject(aodName);
+      else       return (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
+    }
+  }
+  else{ //If no Delta AODs, kept in standard branch, to revise. 
+    if(outAOD) return (TClonesArray *)  fReader->GetOutputEvent()->FindListObject(aodName);
+    else       return  (TClonesArray *) fReader->GetInputEvent() ->FindListObject(aodName);
+  }
+  
+}
+
+//_____________________________________________________________
+TObjArray *  AliAnaCaloTrackCorrBaseClass::GetCTSTracks() const 
+{
+  //Get list of referenced tracks from reader
+  
+  return fReader->GetCTSTracks(); 
+  
+}
+
+//________________________________________________________________
+TObjArray *  AliAnaCaloTrackCorrBaseClass::GetPHOSClusters() const 
+{
+  //Get list of PHOS reference caloclusters from reader
+  
+  return fReader->GetPHOSClusters(); 
+  
+}
+
+//_________________________________________________________________
+TObjArray *  AliAnaCaloTrackCorrBaseClass::GetEMCALClusters() const 
+{
+  //Get list of emcal referenced caloclusters from reader
+  
+  return fReader->GetEMCALClusters(); 
+  
+}
+
+//______________________________________________________________________
+TClonesArray *  AliAnaCaloTrackCorrBaseClass::GetAODCaloClusters() const 
+{
+  //Get list of all caloclusters in AOD output file 
+  
+  return fReader->GetOutputEvent()->GetCaloClusters(); 
+  
+}
+
+//________________________________________________________________
+TClonesArray *  AliAnaCaloTrackCorrBaseClass::GetAODTracks() const 
+{
+  //Get list of all tracks in AOD output file 
+  
+  return fReader->GetOutputEvent()->GetTracks(); 
+  
+}
+
+//____________________________________________________________
+TString  AliAnaCaloTrackCorrBaseClass::GetBaseParametersList()  
+{
+  //Put data member values in string to keep in output container
+  
+  TString parList ; //this will be list of parameters used for this analysis.
+  const Int_t buffersize = 255;
+  char onePar[buffersize] ;
+  snprintf(onePar,buffersize,"--- AliAnaCaloTrackCorrBaseClass ---\n") ;
+  parList+=onePar ;    
+  snprintf(onePar,buffersize,"Minimal P_t: %2.2f ; Max\n", fMinPt) ;
+  parList+=onePar ;
+  snprintf(onePar,buffersize,"Minimal P_t: %2.2f ; Max\n", fMaxPt) ;
+  parList+=onePar ;
+  snprintf(onePar,buffersize,"|t_{1}-t_{2}| < %2.2f ; Max\n", fPairTimeCut) ;
+  parList+=onePar ;
+  snprintf(onePar,buffersize,"fDataMC =%d (Check MC information, on/off) \n",fDataMC) ;
+  parList+=onePar ;
+  snprintf(onePar,buffersize,"fCheckFidCut=%d (Check Fiducial cut selection on/off) \n",fCheckFidCut) ;
+  parList+=onePar ;
+  snprintf(onePar,buffersize,"fCheckCaloPID =%d (Use Bayesian PID in calorimetes, on/off) \n",fCheckCaloPID) ;
+  parList+=onePar ;
+  snprintf(onePar,buffersize,"fRecalculateCaloPID  =%d (Calculate PID from shower/tof/tracking parameters, on/off) \n",fRecalculateCaloPID) ;
+  parList+=onePar ;
+  snprintf(onePar,buffersize,"fInputAODName  =%s Input AOD name \n",fInputAODName.Data()) ;
+  parList+=onePar ;    
+  if(fNewAOD){
+    snprintf(onePar,buffersize,"fOutputAODName  =%s Output AOD name \n",fOutputAODName.Data()) ;
+    parList+=onePar ;  
+    snprintf(onePar,buffersize,"fOutputAODClassName  =%s Output AOD class name \n",fOutputAODClassName.Data()) ;
+    parList+=onePar ;  
+  }
+  snprintf(onePar,buffersize,"fAODObjArrayName  =%s Reference arrays in AOD name \n",fAODObjArrayName.Data()) ;
+  parList+=onePar ;    
+  snprintf(onePar,buffersize,"fAddToHistogramsName  =%s String added to beginning of histograms name \n",fAddToHistogramsName.Data()) ;
+  parList+=onePar ;    
+       
+  return parList; 
+  
+}
+
+//_____________________________________________________________________
+TClonesArray * AliAnaCaloTrackCorrBaseClass::GetCreateOutputAODBranch() 
+{
+  //Create AOD branch filled in the analysis
+  
+  printf("Create AOD branch of %s objects and with name < %s >\n",
+         fOutputAODClassName.Data(),fOutputAODName.Data()) ;
+  
+  TClonesArray * aodBranch = new TClonesArray(fOutputAODClassName, 0);
+  aodBranch->SetName(fOutputAODName);
+  return aodBranch ;
+  
+}
+
+//________________________________________________________
+Int_t AliAnaCaloTrackCorrBaseClass::GetEventNumber() const 
+{
+  //Get current event number
+  
+  return fReader->GetEventNumber() ; 
+  
+}
+
+
+//__________________________________________________________
+AliStack *  AliAnaCaloTrackCorrBaseClass::GetMCStack() const 
+{
+  //Get stack pointer from reader
+  
+  return fReader->GetStack(); 
+  
+}
+//____________________________________________________________
+AliHeader *  AliAnaCaloTrackCorrBaseClass::GetMCHeader() const
+{
+  //Get header pointer from reader
+  
+  return fReader->GetHeader(); 
+  
+}
+
+//____________________________________________________________________________
+AliGenEventHeader *  AliAnaCaloTrackCorrBaseClass::GetMCGenEventHeader() const
+{
+  //Get GenEventHeader pointer from reader
+  
+  return fReader->GetGenEventHeader(); 
+  
+}
+
+//_________________________________________________
+void AliAnaCaloTrackCorrBaseClass::InitParameters()
+{ 
+  //Initialize the parameters of the analysis.
+  fDataMC              = kFALSE;
+  fDebug               = -1;
+  fCheckCaloPID        = kTRUE ;
+  fCheckFidCut         = kFALSE ;
+  fRecalculateCaloPID  = kFALSE ;
+  fMinPt               = 0.1  ; //Min pt in particle analysis
+  fMaxPt               = 300. ; //Max pt in particle analysis
+  fMultiBin            = 1;
+  fNZvertBin           = 1;
+  fNrpBin              = 1;
+  fMaxMulti            = 1000;
+  fMinMulti            = 0;
+  fUseSelectEvent      = kFALSE ;
+  
+  //fReader    = new AliCaloTrackReader(); //Initialized in maker
+  //fCaloUtils = new AliCalorimeterUtils();//Initialized in maker
+  
+  fNewAOD              = kFALSE ;
+  fOutputAODName       = "CaloTrackCorr";
+  fOutputAODClassName  = "AliAODPWG4Particle";
+  fInputAODName        = "CaloTrackCorr";
+  fAddToHistogramsName = "";
+  fAODObjArrayName     = "Ref";
+  
+}
+
+//__________________________________________________________________
+void AliAnaCaloTrackCorrBaseClass::Print(const Option_t * opt) const
+{
+  //Print some relevant parameters set for the analysis
+  
+  if(! opt)
+    return;
+       
+  printf("New AOD:            =     %d\n",fNewAOD);
+  printf("Input AOD name:     =     %s\n",fInputAODName.Data());
+  printf("Output AOD name:    =     %s\n",fOutputAODName.Data());
+  printf("Output AOD Class name: =  %s\n",fOutputAODClassName.Data());
+  printf("Min Photon pT       =     %2.2f\n",  fMinPt) ;
+  printf("Max Photon pT       =     %3.2f\n",  fMaxPt) ;
+  printf("Check PID           =     %d\n",     fCheckCaloPID) ;
+  printf("Recalculate PID     =     %d\n",     fRecalculateCaloPID) ;
+  printf("Check Fiducial cut  =     %d\n",     fCheckFidCut) ;
+  printf("Check MC labels     =     %d\n",     fDataMC);
+  printf("Make plots?         =     %d \n",    fMakePlots);    
+  printf("Debug Level         =     %d\n",     fDebug);
+  
+  printf("Name of reference array      : %s\n", fAODObjArrayName.Data());      
+  printf("String added histograms name : %s\n", fAddToHistogramsName.Data());
+       
+  printf("    \n") ;
+  
+} 
+
+
+
diff --git a/PWG4/PartCorrBase/AliAnaCaloTrackCorrBaseClass.h b/PWG4/PartCorrBase/AliAnaCaloTrackCorrBaseClass.h
new file mode 100755 (executable)
index 0000000..ad7d9e4
--- /dev/null
@@ -0,0 +1,311 @@
+#ifndef ALIANACALOTRACKCORRBASECLASS_H
+#define ALIANACALOTRACKCORRBASECLASS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+
+//_________________________________________________________________________
+// Base class for CaloTrackCorr analysis algorithms
+//-- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
+//-- Add the possibility for event selection analysis based on 
+//   vertex and multiplicity bins (Yaxian Mao, 10/10/2010)
+//
+//_________________________________________________________________________
+
+#include <cstdlib>
+
+//ROOT
+class TClonesArray ;
+class TObjArray ;
+#include <TList.h> 
+#include <TObject.h>
+class TObjString;
+
+//Analysis
+class AliVCaloCells;
+#include "AliCaloTrackReader.h"   
+#include "AliCaloPID.h"
+#include "AliFiducialCut.h"
+#include "AliIsolationCut.h"
+#include "AliMCAnalysisUtils.h"
+#include "AliNeutralMesonSelection.h"
+#include "AliCalorimeterUtils.h" 
+#include "AliHistogramRanges.h"
+class AliStack ; 
+class AliHeader ; 
+class AliGenEventHeader ; 
+#include "AliAODPWG4ParticleCorrelation.h"
+class AliEMCALGeometry;
+class AliPHOSGeoUtils;
+#include "AliMixedEvent.h" 
+#include "AliCentrality.h"
+#include "AliEventplane.h"
+
+class AliAnaCaloTrackCorrBaseClass : public TObject {
+       
+public:   
+  AliAnaCaloTrackCorrBaseClass() ;          // default ctor
+  virtual ~AliAnaCaloTrackCorrBaseClass() ; // virtual dtor
+  
+  //General methods, to be declared in deriving classes if needed
+  
+  virtual TList *        GetCreateOutputObjects()               { return (new TList)          ; }
+  
+  virtual void           Init() {;}
+  virtual void           InitParameters() ;
+   
+  virtual void           MakeAnalysisFillAOD()                  { ; }
+  
+  virtual void           MakeAnalysisFillHistograms()           { ; }  
+    
+  virtual void           Print(const Option_t * ) const ;
+  
+  virtual void           Terminate(TList * /*outputList*/)      { ; }
+
+  //Histograms, cuts 
+       
+  virtual void           AddToHistogramsName(TString add)       { fAddToHistogramsName = add  ; }  
+  virtual TString        GetAddedHistogramsStringToName() const { return fAddToHistogramsName ; }
+  
+  virtual TObjString *   GetAnalysisCuts()                      { return 0x0                  ; }
+  virtual TString             GetBaseParametersList();
+  
+  //Getters, setters
+  virtual Int_t          GetDebug()                       const { return fDebug               ; }
+  virtual void           SetDebug(Int_t d)                      { fDebug = d                  ; }
+  
+  virtual Int_t          GetEventNumber() const ;
+       
+  //Centrality
+  virtual AliCentrality* GetCentrality()                   const { return fReader->GetCentrality()       ; }
+  virtual Int_t          GetEventCentrality()              const { return fReader->GetEventCentrality()  ; }
+       
+  //Event plane
+  virtual AliEventplane* GetEventPlane()                   const { return fReader->GetEventPlane()       ; }           
+  virtual TString        GetEventPlaneMethod()             const { return fReader->GetEventPlaneMethod() ; }
+  
+  //AOD branch
+  virtual void           AddAODParticle(AliAODPWG4Particle part) ;
+  
+  virtual void           ConnectInputOutputAODBranches();
+  
+  virtual TClonesArray * GetCreateOutputAODBranch() ;
+  
+  virtual TString        GetInputAODName()                 const { return fInputAODName  ; }
+  virtual void           SetInputAODName(TString name)           { fInputAODName = name  ; }   
+  
+  virtual TString        GetOutputAODName()                const { return fOutputAODName ; }
+  virtual void           SetOutputAODName(TString name)          { fNewAOD = kTRUE ; fOutputAODName = name; }
+  
+  virtual Bool_t         NewOutputAOD()                    const { return fNewAOD        ; }
+  
+  virtual TString        GetOutputAODClassName()           const { return fOutputAODClassName ; }
+  virtual void           SetOutputAODClassName(TString name)     { fOutputAODClassName = name ; }
+  
+  virtual TString        GetAODObjArrayName()              const { return fAODObjArrayName ; }
+  virtual void           SetAODObjArrayName(TString name)        { fAODObjArrayName = name ; }
+  
+  virtual TClonesArray * GetInputAODBranch()               const { return fInputAODBranch  ; }
+  virtual TClonesArray * GetOutputAODBranch()              const { if(fNewAOD) return fOutputAODBranch; else return fInputAODBranch ; }
+  virtual TClonesArray * GetAODBranch(TString aodBranchName) const ;
+       
+  //Track cluster arrays access methods
+  virtual TClonesArray*  GetAODCaloClusters()              const ; // Output AOD clusters, not used?
+  virtual TClonesArray*  GetAODTracks()                    const ; // Output AOD tracks,   not used?
+  virtual AliVCaloCells* GetPHOSCells()                    const { return fReader->GetPHOSCells()  ; }
+  virtual AliVCaloCells* GetEMCALCells()                   const { return fReader->GetEMCALCells() ; }
+  virtual TObjArray*     GetCTSTracks()                    const ;
+  virtual TObjArray*     GetEMCALClusters()                const ;
+  virtual TObjArray*     GetPHOSClusters()                 const ;
+  
+       
+  // Common analysis switchs 
+  
+  virtual Bool_t         IsDataMC()                        const { return fDataMC                ; }
+  virtual void           SwitchOnDataMC()                        { fDataMC = kTRUE ; if(!fMCUtils)fMCUtils = new AliMCAnalysisUtils();}
+  virtual void           SwitchOffDataMC()                       { fDataMC = kFALSE              ; }
+  
+  virtual Bool_t         IsFiducialCutOn()                 const { return fCheckFidCut           ; }
+  virtual void           SwitchOnFiducialCut()                   { fCheckFidCut = kTRUE;  if(!fFidCut)fFidCut = new AliFiducialCut();}
+  virtual void           SwitchOffFiducialCut()                  { fCheckFidCut = kFALSE         ; }
+  
+  virtual Bool_t         IsCaloPIDOn()                     const { return fCheckCaloPID          ; }
+  virtual void           SwitchOnCaloPID()                       { fCheckCaloPID = kTRUE; if(!fCaloPID)fCaloPID = new AliCaloPID();}
+  virtual void           SwitchOffCaloPID()                      { fCheckCaloPID = kFALSE        ; }
+  
+  virtual Bool_t         MakePlotsOn()                     const { return fMakePlots        ; }
+  virtual void           SwitchOnPlotsMaking()                   { fMakePlots = kTRUE       ; }
+  virtual void           SwitchOffPlotsMaking()                  { fMakePlots = kFALSE      ; }
+  
+  virtual Bool_t         DoEventSelect()                   const { return fUseSelectEvent   ; }   // Do correlation analysis with different event buffers
+
+  virtual void           SwitchOnEventSelection()                { fUseSelectEvent = kTRUE  ; }
+  virtual void           SwitchOffEventSelection()               { fUseSelectEvent = kFALSE ; } 
+  
+  // Cluster energy/momentum cut
+  
+  virtual Float_t        GetMaxPt()                        const { return fMaxPt ; }
+  virtual Float_t        GetMinPt()                        const { return fMinPt ; }
+  virtual void           SetMaxPt(Float_t pt)                    { fMaxPt = pt   ; }
+  virtual void           SetMinPt(Float_t pt)                    { fMinPt = pt   ; }
+  virtual void           SetPtCutRange(Double_t mi, Double_t ma) { fMaxPt = ma;  fMinPt=mi; }
+  
+  virtual Float_t        GetMaxEnergy()                    const { return fMaxPt ; }
+  virtual Float_t        GetMinEnergy()                    const { return fMinPt ; }
+  virtual void           SetMaxEnergy(Float_t e)                 { fMaxPt = e    ; }
+  virtual void           SetMinEnergy(Float_t e)                 { fMinPt = e    ; }
+  virtual void           SetEnergyCutRange(Double_t mi, Double_t ma) { fMaxPt = ma;   fMinPt = mi; }
+  
+  //Cluster Pairs Time cut  
+  virtual void           SetPairTimeCut(Float_t t)               { fPairTimeCut  = t   ; } //ns
+  virtual Float_t        GetPairTimeCut()                  const { return fPairTimeCut ; } //ns
+  
+  //Getters / Setters for parameters of event buffers
+  
+  virtual Int_t          GetMultiBin()                     const { return fMultiBin  ; } //number of bins in Multiplicity 
+  virtual Int_t          GetNZvertBin()                    const { return fNZvertBin ; } //number of bins in vertex   
+  virtual Int_t          GetNRPBin()                       const { return fNrpBin    ; } //number of bins in reaction plain 
+  virtual Int_t          GetNCentrBin()                    const { return fNCentrBin ; } //number of bins in centrality
+  virtual Int_t          GetNMaxEvMix()                    const { return fNmaxMixEv ; } //maximal number of events for mixin
+  virtual Float_t        GetZvertexCut()                   const { return GetReader()->GetZvertexCut();} //cut on vertex position  
+  virtual Int_t          GetMaxMulti()                     const { return fMaxMulti  ; }  
+  virtual Int_t          GetMinMulti()                     const { return fMinMulti  ; }  
+  
+  virtual void           SetMultiBin(Int_t n=1)                  { fMultiBin  = n ;} //number of bins in Multiplicity  
+  virtual void           SetNZvertBin(Int_t n=1)                 { fNZvertBin = n ;} //number of bins for vertex position
+  virtual void           SetNRPBin(Int_t n=1)                    { fNrpBin    = n ;} //number of bins in reaction plain  
+  virtual void           SetNCentrBin(Int_t n=1)                 { fNCentrBin = n ;} //number of bins in centrality 
+  virtual void           SetNMaxEvMix(Int_t n=20)                { fNmaxMixEv = n ;} //maximal number of events for mixing
+  virtual void           SetMultiplicity(Int_t multimin, Int_t multimax) {fMinMulti = multimin ; fMaxMulti = multimax ; }
+  
+  //Mixed event
+  virtual AliMixedEvent * GetMixedEvent()                        { return GetReader()->GetMixedEvent()  ; } 
+  virtual Int_t           GetNMixedEvent()                 const { return GetReader()->GetNMixedEvent() ; } 
+  
+  //Vertex methods
+  virtual void           GetVertex(Double_t vertex[3])     const { GetReader()->GetVertex(vertex)       ; } 
+  virtual Double_t*      GetVertex(const Int_t evtIndex)   const { return GetReader()->GetVertex(evtIndex) ; } 
+  virtual void           GetVertex(Double_t vertex[3], const Int_t evtIndex) const { GetReader()->GetVertex(vertex,evtIndex) ; } 
+
+  
+  //MULTIPLICITY
+  
+  virtual Int_t GetTrackMultiplicity()                     const { return fReader->GetTrackMultiplicity() ; }
+  
+  //VZERO
+  
+  virtual Int_t GetV0Signal(Int_t i )                      const { return fReader->GetV0Signal(i)         ; }
+  
+  virtual Int_t GetV0Multiplicity(Int_t i )                const { return fReader->GetV0Multiplicity(i)   ; }
+  
+  
+  //MC event acces methods
+  virtual AliStack *                 GetMCStack()          const ;
+  
+  virtual AliHeader*                 GetMCHeader()         const ;
+  
+  virtual AliGenEventHeader        * GetMCGenEventHeader() const ;
+  
+  //Analysis helpers classes pointers setters and getters
+  
+  virtual AliCaloPID               * GetCaloPID()                { if(!fCaloPID) fCaloPID = new AliCaloPID();               return  fCaloPID ; }
+  
+  virtual AliCalorimeterUtils      * GetCaloUtils()        const { return fCaloUtils            ; }
+  
+  virtual AliFiducialCut           * GetFiducialCut()            { if(!fFidCut)  fFidCut  = new AliFiducialCut();           return  fFidCut  ; }
+  
+  virtual AliHistogramRanges       * GetHistogramRanges()        { if(!fHisto)   fHisto   = new AliHistogramRanges();       return  fHisto   ; }
+  
+  virtual AliIsolationCut          * GetIsolationCut()           { if(!fIC)      fIC      = new AliIsolationCut();          return  fIC      ; }
+  
+  virtual AliMCAnalysisUtils       * GetMCAnalysisUtils()        { if(!fMCUtils) fMCUtils = new AliMCAnalysisUtils();       return  fMCUtils ; }
+  
+  virtual AliNeutralMesonSelection * GetNeutralMesonSelection()  { if(!fNMS)     fNMS     = new AliNeutralMesonSelection(); return  fNMS     ; }
+  
+  virtual AliCaloTrackReader       * GetReader()           const { return fReader                        ; }
+  
+  virtual AliEMCALGeometry         * GetEMCALGeometry()    const { return fCaloUtils->GetEMCALGeometry() ; }
+  
+  virtual AliPHOSGeoUtils          * GetPHOSGeometry()     const { return fCaloUtils->GetPHOSGeometry()  ; }
+
+  virtual void                       SetCaloPID(AliCaloPID * const pid)                             { delete fCaloPID; fCaloPID = pid     ; }
+  
+  virtual void                       SetCaloUtils(AliCalorimeterUtils * caloutils)                  { fCaloUtils = caloutils              ; }  
+  
+  virtual void                       SetFiducialCut(AliFiducialCut * const fc)                      { delete fFidCut;  fFidCut  = fc      ; }
+  
+  virtual void                       SetHistogramRanges(AliHistogramRanges * const hr)              { delete fHisto;   fHisto   = hr      ; }
+  
+  virtual void                       SetIsolationCut(AliIsolationCut * const ic)                    { delete fIC;      fIC      = ic      ; }
+  
+  virtual void                       SetMCAnalysisUtils(AliMCAnalysisUtils * const mcutils)         { delete fMCUtils; fMCUtils = mcutils ; }  
+  
+  virtual void                       SetNeutralMesonSelection(AliNeutralMesonSelection * const nms) { delete fNMS;     fNMS     = nms     ; }
+  
+  virtual void                       SetReader(AliCaloTrackReader * const reader)                   { fReader = reader                    ; }
+  
+  //Calorimeter specific access methods and calculations
+    
+  virtual Bool_t         IsTrackMatched(AliVCluster * cluster, AliVEvent* event) const {
+   return fCaloPID->IsTrackMatched(cluster, fCaloUtils, event) ; } 
+  
+  virtual Int_t          GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const {
+         return fCaloUtils->GetModuleNumberCellIndexes(absId, calo, icol, irow,iRCU) ; }
+  
+  virtual Int_t          GetModuleNumber(AliAODPWG4Particle * part) const {
+         return fCaloUtils->GetModuleNumber(part, fReader->GetInputEvent()) ; }
+  
+  virtual Int_t          GetModuleNumber(AliVCluster * cluster)     const {
+         return fCaloUtils->GetModuleNumber(cluster) ; }
+  
+  virtual AliVCluster*   FindCluster(TObjArray* clusters, const Int_t id, Int_t & iclus, const Int_t first=0) ;
+
+private:    
+  
+  Bool_t                     fDataMC ;             // Flag to access MC data when using ESD or AOD     
+  Int_t                      fDebug ;              // Debug level
+  Bool_t                     fCheckFidCut ;        // Do analysis for clusters in defined region         
+  Bool_t                     fCheckCaloPID ;       // Do analysis for calorimeters
+  Bool_t                     fRecalculateCaloPID ; // Recalculate PID or use PID weights in calorimeters
+  Float_t                    fMinPt ;              // Maximum pt of (trigger) particles in the analysis
+  Float_t                    fMaxPt ;              // Minimum pt of (trigger) particles in the analysis
+  Float_t                    fPairTimeCut;         // Maximum difference between time of cluster pairs (ns)
+  Int_t                      fMultiBin ;                // Number of bins in event container for multiplicity
+  Int_t                      fNZvertBin ;               // Number of bins in event container for vertex position
+  Int_t                      fNrpBin ;            // Number of bins in event container for reaction plain
+  Int_t                      fNCentrBin ;               // Number of bins in event container for centrality
+  Int_t                      fNmaxMixEv ;               // Maximal number of events stored in buffer for mixing
+  Int_t                      fMaxMulti ;           // Maximum multiplicity of particles in the analysis
+  Int_t                      fMinMulti ;           // Maximum multiplicity of particles in the analysis
+  Bool_t                     fUseSelectEvent ;     // Select events based on multiplicity and vertex cuts
+  Bool_t                     fMakePlots   ;        // Print plots
+    
+  TClonesArray*              fInputAODBranch ;     //! Selected input particles branch
+  TString                    fInputAODName ;       //  Name of input AOD branch;
+  TClonesArray*              fOutputAODBranch ;    //! Selected output particles branch
+  Bool_t                     fNewAOD ;             //  Flag, new aod branch added to the analysis or not.
+  TString                    fOutputAODName ;      //  Name of output AOD branch;
+  TString                    fOutputAODClassName;  //  Type of aod objects to be stored in the TClonesArray (AliAODPWG4Particle, AliAODPWG4ParticleCorrelation ...)    
+  TString                    fAODObjArrayName ;    //  Name of ref array kept in a TList in AliAODParticleCorrelation with clusters or track references.
+  TString                    fAddToHistogramsName; //  Add this string to histograms name
+  
+  //Analysis helper classes access pointers
+  AliCaloPID               * fCaloPID;             // PID calculation
+  AliCalorimeterUtils      * fCaloUtils ;          // Pointer to CalorimeterUtils
+  AliFiducialCut           * fFidCut;              // Acceptance cuts
+  AliHistogramRanges       * fHisto ;              // Histogram ranges container
+  AliIsolationCut          * fIC;                  // Isolation cut 
+  AliMCAnalysisUtils       * fMCUtils;             // MonteCarlo Analysis utils 
+  AliNeutralMesonSelection * fNMS;                 // Neutral Meson Selection
+  AliCaloTrackReader       * fReader;              // Acces to ESD/AOD/MC data
+
+  AliAnaCaloTrackCorrBaseClass(              const AliAnaCaloTrackCorrBaseClass & bc) ; // cpy ctor
+  AliAnaCaloTrackCorrBaseClass & operator = (const AliAnaCaloTrackCorrBaseClass & bc) ; // cpy assignment
+  
+  ClassDef(AliAnaCaloTrackCorrBaseClass,20)
+} ;
+
+
+#endif //ALIANACALOTRACKCORRBASECLASS_H
+
+
+
diff --git a/PWG4/PartCorrBase/AliAnaCaloTrackCorrMaker.cxx b/PWG4/PartCorrBase/AliAnaCaloTrackCorrMaker.cxx
new file mode 100755 (executable)
index 0000000..ff5768b
--- /dev/null
@@ -0,0 +1,355 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//_____________________________________________________________________________
+// Steering class for particle (gamma, hadron) identification and correlation 
+// analysis. It is called by the task class AliAnalysisTaskCaloTrackCorrelation 
+// and it connects the input (ESD/AOD/MonteCarlo) got with AliCaloTrackReader 
+// (produces TClonesArrays of AODs (TParticles in MC case if requested)), with 
+// the analysis classes that derive from AliAnaCaloTrackCorrBaseClass
+//
+// -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
+
+#include <cstdlib>
+
+// --- ROOT system ---
+#include "TClonesArray.h"
+#include "TList.h"
+#include "TH1I.h"
+//#include "Riostream.h"
+//#include <TObjectTable.h>
+
+//---- AliRoot system ---- 
+#include "AliAnalysisManager.h"
+#include "AliVEventHandler.h"
+#include "AliAnaCaloTrackCorrBaseClass.h" 
+#include "AliAnaCaloTrackCorrMaker.h" 
+
+ClassImp(AliAnaCaloTrackCorrMaker)
+
+
+//__________________________________________________
+AliAnaCaloTrackCorrMaker::AliAnaCaloTrackCorrMaker() : 
+TObject(),
+fOutputContainer(new TList ), fAnalysisContainer(new TList ),
+fMakeHisto(kFALSE),           fMakeAOD(kFALSE), 
+fAnaDebug(0),                 fReader(0), 
+fCaloUtils(0),                fCuts(new TList), 
+fhNEvents(0x0),               fhTrackMult(0x0)
+{
+  //Default Ctor
+  if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n");
+  
+  //Initialize parameters, pointers and histograms
+  InitParameters();
+}
+
+//________________________________________________________________________________________
+AliAnaCaloTrackCorrMaker::AliAnaCaloTrackCorrMaker(const AliAnaCaloTrackCorrMaker & maker) :   
+TObject(),
+fOutputContainer(new TList()), fAnalysisContainer(new TList()), 
+fMakeHisto(maker.fMakeHisto),  fMakeAOD(maker.fMakeAOD),
+fAnaDebug(maker.fAnaDebug),    fReader(),//new AliCaloTrackReader(*maker.fReader)), 
+fCaloUtils(),//(new AliCalorimeterUtils(*maker.fCaloUtils)),
+fCuts(new TList()),
+fhNEvents(maker.fhNEvents),    fhTrackMult(maker.fhTrackMult)
+{
+  // cpy ctor
+}
+
+//___________________________________________________
+AliAnaCaloTrackCorrMaker::~AliAnaCaloTrackCorrMaker() 
+{
+  // Remove all owned pointers.
+  
+  //  Do not delete it here, already done somewhere else, need to understand where.    
+  //  if (fOutputContainer) {
+  //    fOutputContainer->Clear();
+  //    delete fOutputContainer ;
+  //  }   
+  
+  if (fAnalysisContainer) {
+    fAnalysisContainer->Delete();
+    delete fAnalysisContainer ;
+  }   
+  
+  if (fReader)    delete fReader ;
+  if (fCaloUtils) delete fCaloUtils ;
+  
+  if(fCuts){
+         fCuts->Delete();
+         delete fCuts;
+  }
+       
+}
+
+//_______________________________________________________
+void    AliAnaCaloTrackCorrMaker::AddAnalysis(TObject* ana, Int_t n) 
+{
+  // Add analysis depending on AliAnaCaloTrackCorrBaseClass to list
+  
+  if ( fAnalysisContainer)
+  { 
+    fAnalysisContainer->AddAt(ana,n); 
+  }
+  else
+  { 
+    printf("AliAnaCaloTrackCorrMaker::AddAnalysis() - AnalysisContainer not initialized\n");
+    abort();
+  }
+}  
+
+//_________________________________________________________
+TList * AliAnaCaloTrackCorrMaker::FillAndGetAODBranchList()
+{ 
+       
+       // Get any new output AOD branches from analysis and put them in a list
+       // The list is filled in the maker, and new branch passed to the analysis frame
+       // AliAnalysisTaskCaloTrackCorrelation
+  
+       TList *aodBranchList = fReader->GetAODBranchList() ;
+  
+       for(Int_t iana = 0; iana <  fAnalysisContainer->GetEntries(); iana++){
+               
+               AliAnaCaloTrackCorrBaseClass * ana =  ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
+               if(ana->NewOutputAOD()) aodBranchList->Add(ana->GetCreateOutputAODBranch());
+    
+       }
+       
+       return aodBranchList ;
+       
+}
+
+//_______________________________________________________
+TList * AliAnaCaloTrackCorrMaker::GetListOfAnalysisCuts()
+{ 
+  
+       // Get the list of the cuts used for the analysis
+       // The list is filled in the maker, called by the task in LocalInit() and posted there
+
+  
+       for(Int_t iana = 0; iana <  fAnalysisContainer->GetEntries(); iana++){
+               AliAnaCaloTrackCorrBaseClass * ana =  ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
+               TObjString * objstring = ana->GetAnalysisCuts();
+
+               if(objstring)fCuts->Add(objstring);
+       }
+
+       return fCuts ;
+  
+}
+
+//___________________________________________________
+TList *AliAnaCaloTrackCorrMaker::GetOutputContainer()
+{
+  // Fill the output list of histograms during the CreateOutputObjects stage.
+  
+  //Initialize calorimeters  geometry pointers
+  GetCaloUtils()->InitPHOSGeometry();
+  GetCaloUtils()->InitEMCALGeometry();
+  
+  if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0){
+    printf("AliAnaCaloTrackCorrMaker::GetOutputContainer() - Analysis job list not initialized!!!\n");
+    //abort();
+  }
+  else{
+    const Int_t buffersize = 255;
+    char newname[255];
+    for(Int_t iana = 0; iana <  fAnalysisContainer->GetEntries(); iana++){
+      AliAnaCaloTrackCorrBaseClass * ana =  ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
+      if(fMakeHisto){// Analysis with histograms as output on
+        //Fill container with appropriate histograms                   
+        TList * templist =  ana ->GetCreateOutputObjects(); 
+        templist->SetOwner(kFALSE); //Owner is fOutputContainer.
+        for(Int_t i = 0; i < templist->GetEntries(); i++){
+          
+          //Add only  to the histogram name the name of the task
+          if(   strcmp((templist->At(i))->ClassName(),"TObjString")   ) {
+            snprintf(newname,buffersize, "%s%s", (ana->GetAddedHistogramsStringToName()).Data(), (templist->At(i))->GetName());  
+            ((TH1*) templist->At(i))->SetName(newname);
+          }
+          //Add histogram to general container
+          fOutputContainer->Add(templist->At(i)) ;
+        }
+        delete templist;
+      }// Analysis with histograms as output on
+    }//Loop on analysis defined
+  }//Analysis list available
+  
+  //General event histograms
+  
+  fhNEvents        = new TH1I("hNEvents",   "Number of analyzed events"     , 1 , 0 , 1  ) ;
+  fOutputContainer->Add(fhNEvents);
+  fhTrackMult      = new TH1I("hTrackMult", "Number of tracks per events"   , 2000 , 0 , 2000  ) ;
+  fOutputContainer->Add(fhTrackMult);
+  
+  return fOutputContainer;
+  
+}
+
+//___________________________________
+void AliAnaCaloTrackCorrMaker::Init()
+{  
+  //Init container histograms and other common variables
+  // Fill the output list of histograms during the CreateOutputObjects stage.
+  
+  //Initialize reader
+  GetReader()->Init();
+  GetReader()->SetCaloUtils(GetCaloUtils()); // pass the calo utils pointer to the reader
+       
+  
+  if(!fAnalysisContainer || fAnalysisContainer->GetEntries()==0){
+    printf("AliAnaCaloTrackCorrMaker::GetOutputInit() - Analysis job list not initialized!!!\n");
+    //abort();
+  }
+       else{
+    
+    for(Int_t iana = 0; iana <  fAnalysisContainer->GetEntries(); iana++){
+      
+      AliAnaCaloTrackCorrBaseClass * ana =  ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
+      ana->SetReader(fReader); //SetReader for each analysis
+      ana->SetCaloUtils(fCaloUtils); //Set CaloUtils for each analysis
+      
+      ana->Init();
+      
+    }//Loop on analysis defined
+  }//Analysis list available
+}
+
+//_____________________________________________
+void AliAnaCaloTrackCorrMaker::InitParameters()
+{      
+  //Init data members
+  
+  fMakeHisto  = kTRUE;
+  fMakeAOD    = kTRUE; 
+  fAnaDebug   = 0; // No debugging info displayed by default
+       
+}
+
+//______________________________________________________________
+void AliAnaCaloTrackCorrMaker::Print(const Option_t * opt) const
+{      
+  //Print some relevant parameters set for the analysis
+       
+  if(! opt)
+    return;
+  
+  printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
+  printf("Debug level                =     %d\n", fAnaDebug) ;
+  printf("Produce Histo              =     %d\n", fMakeHisto) ;
+  printf("Produce AOD                =     %d\n", fMakeAOD) ;
+  printf("Number of analysis tasks   =     %d\n", fAnalysisContainer->GetEntries()) ;
+  
+  if(!strcmp("all",opt)){
+         printf("Print analysis Tasks settings :\n") ;
+         for(Int_t iana = 0; iana<fAnalysisContainer->GetEntries(); iana++){
+                 ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana))->Print("");
+         }
+    
+         printf("Print analysis Reader settings :\n") ;
+         fReader->Print("");
+         printf("Print analysis Calorimeter Utils settings :\n") ;
+         fCaloUtils->Print("");
+  }
+} 
+
+//_______________________________________________________________________
+void AliAnaCaloTrackCorrMaker::ProcessEvent(const Int_t iEntry, 
+                                            const char * currentFileName)
+{
+  //Process analysis for this event
+  
+  if(fMakeHisto && !fOutputContainer){
+    printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - Histograms not initialized\n");
+    abort();
+  }
+       
+  if(fAnaDebug >= 0 ){ 
+               printf("***  AliAnaCaloTrackCorrMaker::ProcessEvent() Event %d   ***  \n",iEntry);
+         if(fAnaDebug > 1 ) {
+                 printf("AliAnaCaloTrackCorrMaker::ProcessEvent() - Current File Name : %s\n", currentFileName);
+                 //printf("fAODBranchList %p, entries %d\n",fAODBranchList,fAODBranchList->GetEntries());
+         }
+  }
+  
+  //Each event needs an empty branch
+  TList * aodList = fReader->GetAODBranchList();
+  Int_t nAODBranches = aodList->GetEntries();
+  for(Int_t iaod = 0; iaod < nAODBranches; iaod++){
+         TClonesArray *tca = dynamic_cast<TClonesArray*> (aodList->At(iaod));
+         if(tca) tca->Clear("C");
+  }
+  
+  //Set geometry matrices before filling arrays, in case recalibration/position calculation etc is needed
+  fCaloUtils->SetGeometryTransformationMatrices(fReader->GetInputEvent());     
+  
+  //Tell the reader to fill the data in the 3 detector lists
+  Bool_t ok = fReader->FillInputEvent(iEntry, currentFileName);
+  if(!ok){
+         if(fAnaDebug >= 1 )printf("*** Skip event *** %d \n",iEntry);
+         return ;
+  }
+       
+  //Magic line to write events to file
+  if(fReader->WriteDeltaAODToFile())AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
+  
+  //printf(">>>>>>>>>> BEFORE >>>>>>>>>>>\n");
+  //gObjectTable->Print();
+  //Loop on analysis algorithms
+  if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n");
+  Int_t nana = fAnalysisContainer->GetEntries() ;
+  for(Int_t iana = 0; iana <  nana; iana++){
+    AliAnaCaloTrackCorrBaseClass * ana =  ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ; 
+    
+    ana->ConnectInputOutputAODBranches(); //Sets branches for each analysis
+    //Make analysis, create aods in aod branch or AODCaloClusters
+    if(fMakeAOD  )  ana->MakeAnalysisFillAOD()  ;
+    //Make further analysis with aod branch and fill histograms
+    if(fMakeHisto)  ana->MakeAnalysisFillHistograms()  ;
+    
+  }
+       
+  fhNEvents->Fill(0); //Event analyzed
+  fhTrackMult->Fill(fReader->GetTrackMultiplicity()); 
+  
+  fReader->ResetLists();
+  
+  //printf(">>>>>>>>>> AFTER >>>>>>>>>>>\n");
+  //gObjectTable->Print();
+       
+  if(fAnaDebug > 0 ) printf("*** End analysis *** \n");
+  
+}
+
+//__________________________________________________________
+void AliAnaCaloTrackCorrMaker::Terminate(TList * outputList)
+{  
+  //Execute Terminate of analysis
+  //Do some final plots.
+  
+  if (!outputList) {
+         Error("Terminate", "No output list");
+         return;
+  }
+       
+  for(Int_t iana = 0; iana <  fAnalysisContainer->GetEntries(); iana++){
+    
+    AliAnaCaloTrackCorrBaseClass * ana =  ((AliAnaCaloTrackCorrBaseClass *) fAnalysisContainer->At(iana)) ;
+    if(ana->MakePlotsOn())ana->Terminate(outputList);
+    
+  }//Loop on analysis defined
+}
+
diff --git a/PWG4/PartCorrBase/AliAnaCaloTrackCorrMaker.h b/PWG4/PartCorrBase/AliAnaCaloTrackCorrMaker.h
new file mode 100755 (executable)
index 0000000..2209c47
--- /dev/null
@@ -0,0 +1,98 @@
+#ifndef ALIANACALOTRACKCORRMAKER_H
+#define ALIANACALOTRACKCORRMAKER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice     */
+
+//_____________________________________________________________________________
+// Steering class for particle (gamma, hadron) identification and correlation 
+// analysis. It is called by the task class AliAnalysisTaskCaloTrackCorrelation 
+// and it connects the input (ESD/AOD/MonteCarlo) got with AliCaloTrackReader 
+// (produces TClonesArrays of AODs (TParticles in MC case if requested)), with 
+// the analysis classes that derive from AliAnaCaloTrackCorrBaseClass
+//
+// -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
+
+// --- ROOT system ---
+class TList; 
+class TClonesArray;
+#include<TObject.h>
+class TH1I;
+
+// --- Analysis system ---
+#include "AliCaloTrackReader.h" 
+#include "AliCalorimeterUtils.h"
+
+class AliAnaCaloTrackCorrMaker : public TObject {
+
+ public: 
+  AliAnaCaloTrackCorrMaker() ;          // default ctor
+  virtual ~AliAnaCaloTrackCorrMaker() ; // virtual dtor
+  AliAnaCaloTrackCorrMaker(const AliAnaCaloTrackCorrMaker & maker) ; // cpy ctor
+
+ public:
+       
+  void    AddAnalysis(TObject* ana, Int_t n) ;
+
+  TList * GetListOfAnalysisCuts();
+  TList * GetOutputContainer() ;
+
+  TList * FillAndGetAODBranchList();
+  
+  Int_t   GetAnaDebug()        const  { return fAnaDebug    ; }
+  void    SetAnaDebug(Int_t d)        { fAnaDebug = d       ; }
+       
+  Bool_t  AreHistogramsMade()   const { return fMakeHisto   ; }
+  void    SwitchOnHistogramsMaker()   { fMakeHisto = kTRUE  ; }
+  void    SwitchOffHistogramsMaker()  { fMakeHisto = kFALSE ; }
+  Bool_t  AreAODsMade()         const { return fMakeAOD     ; }
+  void    SwitchOnAODsMaker()         { fMakeAOD = kTRUE    ; }
+  void    SwitchOffAODsMaker()        { fMakeAOD = kFALSE   ; }
+       
+
+  AliCaloTrackReader  * GetReader()                                   { if(!fReader) fReader = new AliCaloTrackReader ();
+                                                                        return fReader    ; }
+  void                  SetReader(AliCaloTrackReader * reader)        { fReader = reader  ; }
+       
+  AliCalorimeterUtils * GetCaloUtils()                                { if(!fCaloUtils) fCaloUtils = new AliCalorimeterUtils(); 
+                                                                        return fCaloUtils      ; }
+  void                  SetCaloUtils(AliCalorimeterUtils * caloutils) { fCaloUtils = caloutils ; }
+       
+  void    Init();
+  
+  void    InitParameters();
+  
+  void    Print(const Option_t * opt) const;
+  
+  void    ProcessEvent(const Int_t iEntry, const char * currentFileName) ;
+  
+  void    Terminate(TList * outputList);
+
+ private:
+  
+  //General Data members
+  
+  TList * fOutputContainer ;   //! Output histograms container
+  TList * fAnalysisContainer ; // List with analysis pointers
+  Bool_t  fMakeHisto ;         // If true makes final analysis with histograms as output
+  Bool_t  fMakeAOD ;           // If true makes analysis generating AODs
+  Int_t   fAnaDebug;           // Debugging info.
+       
+  AliCaloTrackReader  *  fReader ;     //  Pointer to reader 
+  AliCalorimeterUtils *  fCaloUtils ;  //  Pointer to CalorimeterUtils
+
+  TList * fCuts ;                 //! List with analysis cuts
+
+  TH1I  * fhNEvents;         //! Number of events counter histogram
+  TH1I  * fhTrackMult;       //! Number of tracks per event histogram
+
+  AliAnaCaloTrackCorrMaker & operator = (const AliAnaCaloTrackCorrMaker & ) ; // cpy assignment
+  
+  ClassDef(AliAnaCaloTrackCorrMaker,8)
+} ;
+
+#endif //ALIANACALOTRACKCORRMAKER_H
+
+
+
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/* $Id: $ */
 
 //_________________________________________________________________________
 // Analysis task that executes the analysis classes
-// that depend on the PartCorr frame, frame for Particle identification and correlations.
+// that depend on the CaloTrackCorr frame, frame for Particle identification 
+// with calorimeters and tracks and correlations.
 // Specially designed for calorimeters but also can be used for charged tracks
-// Input of this task is a configuration file that contains all the settings of the analyis
+// Input of this task is a configuration file that contains all the settings 
+// of the analysis
 //
-// -- Author: Gustavo Conesa (INFN-LNF)
+// -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
 
 #include <cstdlib>
 
 //#include <TObjectTable.h>
 
 // --- Analysis ---
-#include "AliAnalysisTaskParticleCorrelation.h"
-#include "AliAnaPartCorrMaker.h"
+#include "AliAnalysisTaskCaloTrackCorrelation.h"
+#include "AliAnaCaloTrackCorrMaker.h"
 #include "AliCaloTrackReader.h"
 #include "AliPDG.h"
 #include "AliAnalysisManager.h"
 #include "AliInputEventHandler.h"
 
-ClassImp(AliAnalysisTaskParticleCorrelation)
+ClassImp(AliAnalysisTaskCaloTrackCorrelation)
 
-////////////////////////////////////////////////////////////////////////
-AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation():
+//________________________________________________________________________
+AliAnalysisTaskCaloTrackCorrelation::AliAnalysisTaskCaloTrackCorrelation() :
   AliAnalysisTaskSE(),
   fAna(0x0),
   fOutputContainer(0x0),
-  fConfigName(""), fCuts(0x0)
+  fConfigName(""), 
+  fCuts(0x0)
 {
   // Default constructor
 }
 
-//_____________________________________________________
-AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const char* name):
+//________________________________________________________________________________________
+AliAnalysisTaskCaloTrackCorrelation::AliAnalysisTaskCaloTrackCorrelation(const char* name) :
   AliAnalysisTaskSE(name),
   fAna(0x0),
   fOutputContainer(0x0),
-  fConfigName(""), fCuts(0x0)
+  fConfigName(""), 
+  fCuts(0x0)
 {
   // Default constructor
   
@@ -64,27 +67,30 @@ AliAnalysisTaskParticleCorrelation::AliAnalysisTaskParticleCorrelation(const cha
   DefineOutput(2, TList::Class());  // will contain cuts or local params
 }
 
-//_____________________________________________________
-AliAnalysisTaskParticleCorrelation::~AliAnalysisTaskParticleCorrelation() 
+//_________________________________________________________________________
+AliAnalysisTaskCaloTrackCorrelation::~AliAnalysisTaskCaloTrackCorrelation() 
 {
   // Remove all pointers
+  
   if (fOutputContainer && ! AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
     fOutputContainer->Clear() ; 
     delete fOutputContainer ;
   }
+  
   if (fAna && ! AliAnalysisManager::GetAnalysisManager()->IsProofMode()) delete fAna;
+  
 }
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects()
+//_________________________________________________________________
+void AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects()
 {
   // Create the output container
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - Begin\n");
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() - Begin\n");
   
   //Get list of aod arrays, add each aod array to analysis frame 
   TClonesArray *array = 0;
   TList * list = fAna->FillAndGetAODBranchList(); //Loop the analysis and create the list of branches
-  if (DebugLevel() >= 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - n AOD branches %d\n",list->GetEntries());
+  if (DebugLevel() >= 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() - n AOD branches %d\n",list->GetEntries());
   
   //Put the delta AODs in output file, std or delta
   if((fAna->GetReader())->WriteDeltaAODToFile()){
@@ -100,17 +106,18 @@ void AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects()
   OpenFile(1);
   fOutputContainer = fAna->GetOutputContainer();
   
-  if (DebugLevel() >= 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - n histograms %d\n",fOutputContainer->GetEntries());
-
+  if (DebugLevel() >= 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() - n histograms %d\n",fOutputContainer->GetEntries());
+  
   fOutputContainer->SetOwner(kTRUE);
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserCreateOutputObjects() - End\n");
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserCreateOutputObjects() - End\n");
+  
   PostData(1,fOutputContainer);
-
+  
 }
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelation::LocalInit()
+
+//___________________________________________________
+void AliAnalysisTaskCaloTrackCorrelation::LocalInit()
 {
        // Local Initialization
        
@@ -125,98 +132,103 @@ void AliAnalysisTaskParticleCorrelation::LocalInit()
        
 }
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelation::Init()
+//______________________________________________
+void AliAnalysisTaskCaloTrackCorrelation::Init()
 {
   // Initialization
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - Begin\n");
+  
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::Init() - Begin\n");
   
   // Call configuration file if specified
   
   if (fConfigName.Length()) {
-    printf("AliAnalysisTaskParticleCorrelation::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data());
-       gROOT->LoadMacro(fConfigName+".C");
-       fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()");
+    printf("AliAnalysisTaskCaloTrackCorrelation::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data());
+    gROOT->LoadMacro(fConfigName+".C");
+    fAna = (AliAnaCaloTrackCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()");
   }
   
   if(!fAna) {
-       printf("AliAnalysisTaskParticleCorrelation::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n");
-       abort();
+    printf("AliAnalysisTaskCaloTrackCorrelation::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n");
+    abort();
   }
   
   // Add different generator particles to PDG Data Base 
   // to avoid problems when reading MC generator particles
   AliPDG::AddParticlesToPdgDataBase();
-
+  
   //Set in the reader the name of the task in case is needed
   (fAna->GetReader())->SetTaskName(GetName());
        
   // Initialise analysis
   fAna->Init();
-
+  
   //Delta AOD
   if((fAna->GetReader())->GetDeltaAODFileName()!="")
          AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile((fAna->GetReader())->GetDeltaAODFileName());
-
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::Init() - End\n");
+  
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::Init() - End\n");
   
 }
 
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelation::UserExec(Option_t */*option*/)
+//______________________________________________________________________
+void AliAnalysisTaskCaloTrackCorrelation::UserExec(Option_t */*option*/)
 {
   // Execute analysis for current event
-  //
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - Begin\n");
-
-   //Get the type of data, check if type is correct
+  
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserExec() - Begin\n");
+  
+  //Get the type of data, check if type is correct
   Int_t  datatype = fAna->GetReader()->GetDataType();
   if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD &&
      datatype != AliCaloTrackReader::kMC){
-    printf("AliAnalysisTaskParticleCorrelation::UserExec() - Wrong type of data\n");
+    printf("AliAnalysisTaskCaloTrackCorrelation::UserExec() - Wrong type of data\n");
     return ;
   }
-
+  
   fAna->GetReader()->SetInputOutputMCEvent(InputEvent(), AODEvent(), MCEvent());
-
+  
   //Process event
   fAna->ProcessEvent((Int_t) Entry(), CurrentFileName());
-  //printf("AliAnalysisTaskParticleCorrelation::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName());
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelation::UserExec() - End\n");
+  
+  //printf("AliAnalysisTaskCaloTrackCorrelation::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName());
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelation::UserExec() - End\n");
        
   PostData(1, fOutputContainer);
        
   //gObjectTable->Print();
-
   
 }
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelation::Terminate(Option_t */*option*/)
+//_______________________________________________________________________
+void AliAnalysisTaskCaloTrackCorrelation::Terminate(Option_t */*option*/)
 {
   // Terminate analysis
   // Do some plots
-
+  
   // Get merged histograms from the output container
   // Propagate histagrams to maker
   fAna->Terminate((TList*)GetOutputData(1));
        
 }
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelation::FinishTaskOutput(){
+//__________________________________________________________
+void AliAnalysisTaskCaloTrackCorrelation::FinishTaskOutput()
+{
   // Put in the output some event summary histograms
   AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
+  
   AliInputEventHandler *inputH = dynamic_cast<AliInputEventHandler*>(am->GetInputEventHandler());
+  
   if (!inputH) return; 
+  
   TH2F *histStat = dynamic_cast<TH2F*>(inputH->GetStatistics()); 
   TH2F *histBin0 = dynamic_cast<TH2F*>(inputH->GetStatistics("BIN0"));
   
   if(histStat)fOutputContainer->Add(histStat); 
   else if(DebugLevel()>0) 
-    printf("AliAnalysisTaskParticleCorrelation::FinishTaskOutput() - Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists \n");
+    printf("AliAnalysisTaskCaloTrackCorrelation::FinishTaskOutput() - Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists \n");
+  
   if(histBin0)fOutputContainer->Add(histBin0); 
   
 }
diff --git a/PWG4/PartCorrBase/AliAnalysisTaskCaloTrackCorrelation.h b/PWG4/PartCorrBase/AliAnalysisTaskCaloTrackCorrelation.h
new file mode 100755 (executable)
index 0000000..28c0821
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef ALIANALYSISTASKCALOTRACKCORRELATION_H
+#define ALIANALYSISTASKCALOTRACKCORRELATION_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+//_________________________________________________________________________
+// Analysis task that executes the analysis classes
+// that depend on the CaloTrackCorr frame, frame for Particle identification 
+// with calorimeters and tracks and correlations.
+// Specially designed for calorimeters but also can be used for charged tracks
+// Input of this task is a configuration file that contains all the settings 
+// of the analysis
+//
+// -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
+
+//--- Root ---
+class TList;
+
+//--- AliRoot ---
+#include "AliAnalysisTaskSE.h"
+class AliAnaCaloTrackCorrMaker;
+class AliESDEvent;
+class AliAODEvent;
+
+class AliAnalysisTaskCaloTrackCorrelation : public AliAnalysisTaskSE
+{
+ public:
+  AliAnalysisTaskCaloTrackCorrelation();
+  AliAnalysisTaskCaloTrackCorrelation(const char* name);
+  virtual ~AliAnalysisTaskCaloTrackCorrelation() ; // virtual dtor
+  
+  // Implementation of interface methods
+  virtual void UserCreateOutputObjects();
+  virtual void Init();
+  virtual void LocalInit() ;
+  virtual void UserExec (Option_t *option);
+  virtual void Terminate(Option_t *option);
+  virtual void FinishTaskOutput();
+  
+  void         SetConfigFileName(TString & name ) { fConfigName = name ; }
+  TString      GetConfigFileName()          const { return fConfigName ; }
+       
+  void         SetAnalysisMaker(AliAnaCaloTrackCorrMaker * const maker) { fAna = maker ; } 
+  
+ private:
+  AliAnalysisTaskCaloTrackCorrelation           (const AliAnalysisTaskCaloTrackCorrelation&); // Not implemented
+  AliAnalysisTaskCaloTrackCorrelation& operator=(const AliAnalysisTaskCaloTrackCorrelation&); // Not implemented
+  
+  AliAnaCaloTrackCorrMaker* fAna;  //  Pointer to the manager class 
+  TList * fOutputContainer ;       //! Histogram container
+  TString fConfigName ;            //  Configuration file name
+  TList * fCuts ;                  //! List with analysis cuts
+       
+  ClassDef(AliAnalysisTaskCaloTrackCorrelation, 3); // Analysis task for standard gamma correlation analysis
+};
+
+#endif //ALIANALYSISTASKCALOTRACKCORRELATION_H
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/* $Id$ */
 
 //_________________________________________________________________________
 // Analysis task that executes the analysis classes
-// that depend on the PartCorr frame, frame for Particle identification and correlations.
+// that depend on the CaloTrackCorr frame, frame for Particle identification 
+// with calorimeters and tracks and correlations.
 // Specially designed for calorimeters but also can be used for charged tracks
-// Input of this task is a configuration file that contains all the settings of the analyis
+// Input of this task is a configuration file that contains all the settings 
+// of the analysis
 //
-// -- Author: Gustavo Conesa (INFN-LNF)
+// -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
 
 #include <cstdlib>
 
@@ -32,8 +33,8 @@
 //#include <TObjectTable.h>
 
 // --- Analysis ---
-#include "AliAnalysisTaskParticleCorrelationM.h"
-#include "AliAnaPartCorrMaker.h"
+#include "AliAnalysisTaskCaloTrackCorrelationM.h"
+#include "AliAnaCaloTrackCorrMaker.h"
 #include "AliCaloTrackReader.h"
 #include "AliPDG.h"
 #include "AliAnalysisManager.h"
 #include "AliESDEvent.h"
 #include "AliAnalysisDataSlot.h"
 
-ClassImp(AliAnalysisTaskParticleCorrelationM)
+ClassImp(AliAnalysisTaskCaloTrackCorrelationM)
 
-////////////////////////////////////////////////////////////////////////
-AliAnalysisTaskParticleCorrelationM::AliAnalysisTaskParticleCorrelationM():
+//__________________________________________________________________________
+AliAnalysisTaskCaloTrackCorrelationM::AliAnalysisTaskCaloTrackCorrelationM() :
   AliAnalysisTaskME(),
   fAna(0x0),
   fOutputContainer(0x0),
-  fConfigName(""), fCuts(0x0), fInputEvent(NULL)
+  fConfigName(""), 
+  fCuts(0x0), 
+  fInputEvent(NULL)
 {
   // Default constructor
 }
 
-//_____________________________________________________
-AliAnalysisTaskParticleCorrelationM::AliAnalysisTaskParticleCorrelationM(const char* name):
+//__________________________________________________________________________________________
+AliAnalysisTaskCaloTrackCorrelationM::AliAnalysisTaskCaloTrackCorrelationM(const char* name) :
   AliAnalysisTaskME(name),
   fAna(0x0),
   fOutputContainer(0x0),
-  fConfigName(""), fCuts(0x0), fInputEvent(NULL)
+  fConfigName(""), 
+  fCuts(0x0), 
+  fInputEvent(NULL)
 {
   // Default constructor
   
@@ -68,35 +73,33 @@ AliAnalysisTaskParticleCorrelationM::AliAnalysisTaskParticleCorrelationM(const c
   DefineOutput(2, TList::Class());  // will contain cuts or local params
 }
 
-//_____________________________________________________
-AliAnalysisTaskParticleCorrelationM::~AliAnalysisTaskParticleCorrelationM() 
+//___________________________________________________________________________
+AliAnalysisTaskCaloTrackCorrelationM::~AliAnalysisTaskCaloTrackCorrelationM() 
 {
   // Remove all pointers
        
-//     printf("********** Delete Task\n");
-//  // Do not delete it here, already done somewhere else, need to understand where.
-//  if(fOutputContainer && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
-//    fOutputContainer->Clear() ; 
-//    delete fOutputContainer ;
-//  }
-
+  //  // Do not delete it here, already done somewhere else, need to understand where.
+  //  if(fOutputContainer && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
+  //    fOutputContainer->Clear() ; 
+  //    delete fOutputContainer ;
+  //  }
+  
   delete fInputEvent ; 
   if(fAna) delete fAna;
-
-//  printf("********** Task deleted \n");
+  
 }
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects()
+//__________________________________________________________________
+void AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects()
 {
   // Create the output container
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() - Begin\n");
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects() - Begin\n");
   
   //Get list of aod arrays, add each aod array to analysis frame 
   TClonesArray *array = 0;
   TList * list = fAna->FillAndGetAODBranchList();
-  if (DebugLevel() >= 1) printf("AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() - n AOD branches %d\n",list->GetEntries());
-
+  if (DebugLevel() >= 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects() - n AOD branches %d\n",list->GetEntries());
+  
   //Put the delta AODs in output file, std or delta
   if((fAna->GetReader())->WriteDeltaAODToFile()){
     TString deltaAODName = (fAna->GetReader())->GetDeltaAODFileName();
@@ -111,17 +114,18 @@ void AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects()
   OpenFile(1);
   fOutputContainer = fAna->GetOutputContainer();
   
-  if (DebugLevel() >= 1) printf("AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() - n histograms %d\n",fOutputContainer->GetEntries());
+  if (DebugLevel() >= 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects() - n histograms %d\n",fOutputContainer->GetEntries());
   
   fOutputContainer->SetOwner(kTRUE);
   
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() - End\n");
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserCreateOutputObjects() - End\n");
+  
   PostData(1,fOutputContainer);
        
 }
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelationM::LocalInit()
+
+//____________________________________________________
+void AliAnalysisTaskCaloTrackCorrelationM::LocalInit()
 {
        // Local Initialization
        
@@ -131,68 +135,68 @@ void AliAnalysisTaskParticleCorrelationM::LocalInit()
        // Create cuts/param objects and publish to slot
        fCuts = fAna->GetListOfAnalysisCuts();
   fCuts ->SetOwner(kTRUE);
-
+  
        // Post Data
        PostData(2, fCuts);
        
 }
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelationM::Init()
+//_______________________________________________
+void AliAnalysisTaskCaloTrackCorrelationM::Init()
 {
   // Initialization
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::Init() - Begin\n");
+  
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::Init() - Begin\n");
   
   fInputEvent = new AliMixedEvent() ; 
   
   // Call configuration file if specified
   
   if (fConfigName.Length()) {
-    printf("AliAnalysisTaskParticleCorrelationM::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data());
-       gROOT->LoadMacro(fConfigName+".C");
-       fAna = (AliAnaPartCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()");
+    printf("AliAnalysisTaskCaloTrackCorrelationM::Init() - ### Configuration file is %s.C ###\n", fConfigName.Data());
+    gROOT->LoadMacro(fConfigName+".C");
+    fAna = (AliAnaCaloTrackCorrMaker*) gInterpreter->ProcessLine("ConfigAnalysis()");
   }
   
   if(!fAna) {
-       printf("AliAnalysisTaskParticleCorrelationM::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n");
-       abort();
+    printf("AliAnalysisTaskCaloTrackCorrelationM::Init() - Analysis maker pointer not initialized, no analysis specified, STOP !\n");
+    abort();
   }
   
   // Add different generator particles to PDG Data Base 
   // to avoid problems when reading MC generator particles
   AliPDG::AddParticlesToPdgDataBase();
-
+  
   //Set in the reader the name of the task in case is needed
   (fAna->GetReader())->SetTaskName(GetName());
        
   // Initialise analysis
   fAna->Init();
-
+  
   //Delta AOD
   if((fAna->GetReader())->GetDeltaAODFileName()!="")
          AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile((fAna->GetReader())->GetDeltaAODFileName());
-
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::Init() - End\n");
+  
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::Init() - End\n");
   
 }
 
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelationM::UserExec(Option_t */*option*/)
+//_______________________________________________________________________
+void AliAnalysisTaskCaloTrackCorrelationM::UserExec(Option_t */*option*/)
 {
   // Execute analysis for current event
-  //
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserExec() - Begin\n");
-
-   //Get the type of data, check if type is correct
+  
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserExec() - Begin\n");
+  
+  //Get the type of data, check if type is correct
   Int_t  datatype = fAna->GetReader()->GetDataType();
   if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD &&
      datatype != AliCaloTrackReader::kMC){
-    printf("AliAnalysisTaskParticleCorrelationM::UserExec() - Wrong type of data\n");
+    printf("AliAnalysisTaskCaloTrackCorrelationM::UserExec() - Wrong type of data\n");
     return ;
   }
-
+  
   Int_t nev = fInputHandler->GetBufferSize();
   fInputEvent->Reset();
   
@@ -206,31 +210,33 @@ void AliAnalysisTaskParticleCorrelationM::UserExec(Option_t */*option*/)
     } else {
       AliFatal("need to implement mixed event for MC") ; 
     }
-   }
+  }
+  
   fInputEvent->Init();
-
+  
   fAna->GetReader()->SetInputOutputMCEvent(fInputEvent, AODEvent(), MCEvent());
-
+  
   //Process event
   fAna->ProcessEvent((Int_t) Entry(), CurrentFileName());
-  //printf("AliAnalysisTaskParticleCorrelationM::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName());
-  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserExec() - End\n");
-    
+  
+  //printf("AliAnalysisTaskCaloTrackCorrelationM::Current Event %d; Current File Name : %s\n",(Int_t) Entry(), CurrentFileName());
+  if (DebugLevel() > 1) printf("AliAnalysisTaskCaloTrackCorrelationM::UserExec() - End\n");
+  
   PostData(1, fOutputContainer);
        
   AliAnalysisDataSlot *out0 = GetOutputSlot(0);
   if (out0 && out0->IsConnected()) PostData(0, fTreeA);  
   
   //gObjectTable->Print();
-
+  
 }
 
-//_____________________________________________________
-void AliAnalysisTaskParticleCorrelationM::Terminate(Option_t */*option*/)
+//________________________________________________________________________
+void AliAnalysisTaskCaloTrackCorrelationM::Terminate(Option_t */*option*/)
 {
   // Terminate analysis
   // Do some plots
-
+  
   // Get merged histograms from the output container
   // Propagate histagrams to maker
   fAna->Terminate((TList*)GetOutputData(1));
diff --git a/PWG4/PartCorrBase/AliAnalysisTaskCaloTrackCorrelationM.h b/PWG4/PartCorrBase/AliAnalysisTaskCaloTrackCorrelationM.h
new file mode 100755 (executable)
index 0000000..f0ea651
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef ALIANALYSISTASKCALOTRACKCORRELATIONM_H
+#define ALIANALYSISTASKCALOTRACKCORRELATIONM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+//_________________________________________________________________________
+// Analysis task that executes the analysis classes
+// that depend on the CaloTrackCorr frame, frame for Particle identification 
+// with calorimeters and tracks and correlations.
+// Specially designed for calorimeters but also can be used for charged tracks
+// Input of this task is a configuration file that contains all the settings 
+// of the analysis
+//
+// -- Author: Gustavo Conesa (INFN-LNF, LPSC-Grenoble)
+
+//--- Root ---
+class TList;
+
+//--- AliRoot ---
+#include "AliAnalysisTaskME.h"
+class AliAnaCaloTrackCorrMaker;
+class AliMixedEvent; 
+class AliMCEvent; 
+
+class AliAnalysisTaskCaloTrackCorrelationM : public AliAnalysisTaskME
+{
+ public:
+  AliAnalysisTaskCaloTrackCorrelationM();
+  AliAnalysisTaskCaloTrackCorrelationM(const char* name);
+  virtual ~AliAnalysisTaskCaloTrackCorrelationM() ; // virtual dtor
+  
+  // Implementation of interface methods
+  virtual void UserCreateOutputObjects();
+  virtual void Init();
+  virtual void LocalInit() ;
+  virtual void UserExec(Option_t *option);
+  virtual void Terminate(Option_t *option);
+  
+  void         SetConfigFileName(TString & name ) { fConfigName = name ; }
+  TString      GetConfigFileName()          const { return fConfigName ; }
+       
+  void         SetAnalysisMaker(AliAnaCaloTrackCorrMaker * const maker) { fAna = maker ; } 
+  AliMixedEvent * InputEvent()                    { return fInputEvent ; }
+  AliMCEvent*  MCEvent()                          { return NULL        ; } // do something about MC event 
+
+ private:
+  AliAnalysisTaskCaloTrackCorrelationM(           const AliAnalysisTaskCaloTrackCorrelationM&); // Not implemented
+  AliAnalysisTaskCaloTrackCorrelationM& operator=(const AliAnalysisTaskCaloTrackCorrelationM&); // Not implemented
+  
+  AliAnaCaloTrackCorrMaker* fAna;  //  Pointer to the manager class 
+  TList * fOutputContainer ;       //! Histogram container
+  TString fConfigName ;            //  Configuration file name
+  TList * fCuts ;                  //! List with analysis cuts
+  
+  AliMixedEvent * fInputEvent;
+       
+  ClassDef(AliAnalysisTaskCaloTrackCorrelationM, 3); // Analysis task for standard gamma correlation analysis
+};
+
+#endif //ALIANALYSISTASKCALOTRACKCORRELATIONM_H
diff --git a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.h b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelation.h
deleted file mode 100755 (executable)
index 1dd7664..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef ALIANALYSISTASKPARTICLECORRELATION_H
-#define ALIANALYSISTASKPARTICLECORRELATION_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-//_________________________________________________________________________
-// Analysis task that executes the analysis classes
-// that depend on the PartCorr frame, frame for Particle identification and correlations.
-// Specially designed for calorimeters but also can be used for charged tracks
-// Input of this task is a configuration file that contains all the settings of the analyis
-//
-// -- Author: Gustavo Conesa (INFN-LNF)
-
-//--- Root ---
-class TList;
-
-//--- AliRoot ---
-#include "AliAnalysisTaskSE.h"
-class AliAnaPartCorrMaker;
-class AliESDEvent;
-class AliAODEvent;
-
-class AliAnalysisTaskParticleCorrelation : public AliAnalysisTaskSE
-{
- public:
-  AliAnalysisTaskParticleCorrelation();
-  AliAnalysisTaskParticleCorrelation(const char* name);
-  virtual ~AliAnalysisTaskParticleCorrelation() ;// virtual dtor
-  
-  // Implementation of interface methods
-  virtual void UserCreateOutputObjects();
-  virtual void Init();
-  virtual void LocalInit() ;
-  virtual void UserExec(Option_t *option);
-  virtual void Terminate(Option_t *option);
-  virtual void FinishTaskOutput();
-  
-  void SetConfigFileName(TString & name ) {fConfigName = name ; }
-  TString GetConfigFileName() const {return fConfigName ; }
-       
-  void SetAnalysisMaker(AliAnaPartCorrMaker * const maker) {fAna = maker;} 
-  
- private:
-  AliAnalysisTaskParticleCorrelation(const AliAnalysisTaskParticleCorrelation&); // Not implemented
-  AliAnalysisTaskParticleCorrelation& operator=(const AliAnalysisTaskParticleCorrelation&); // Not implemented
-  
-  AliAnaPartCorrMaker* fAna;  //  Pointer to the manager class 
-  TList * fOutputContainer ;  //! Histogram container
-  TString fConfigName ;       // Configuration file name
-  TList * fCuts ;             //! List with analysis cuts
-       
-  ClassDef(AliAnalysisTaskParticleCorrelation, 3); // Analysis task for standard gamma correlation analysis
-};
-
-#endif //ALIANALYSISTASKPARTICLECORRELATION_H
diff --git a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h
deleted file mode 100755 (executable)
index c43eaf7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef ALIANALYSISTASKPARTICLECORRELATIONM_H
-#define ALIANALYSISTASKPARTICLECORRELATIONM_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-//_________________________________________________________________________
-// Analysis task that executes the analysis classes
-// that depend on the PartCorr frame, frame for Particle identification and correlations.
-// Specially designed for calorimeters but also can be used for charged tracks
-// Input of this task is a configuration file that contains all the settings of the analyis
-//
-// -- Author: Gustavo Conesa (INFN-LNF)
-
-//--- Root ---
-class TList;
-
-//--- AliRoot ---
-#include "AliAnalysisTaskME.h"
-class AliAnaPartCorrMaker;
-class AliMixedEvent; 
-class AliMCEvent; 
-
-class AliAnalysisTaskParticleCorrelationM : public AliAnalysisTaskME
-{
- public:
-  AliAnalysisTaskParticleCorrelationM();
-  AliAnalysisTaskParticleCorrelationM(const char* name);
-  virtual ~AliAnalysisTaskParticleCorrelationM() ;// virtual dtor
-  
-  // Implementation of interface methods
-  virtual void UserCreateOutputObjects();
-  virtual void Init();
-  virtual void LocalInit() ;
-  virtual void UserExec(Option_t *option);
-  virtual void Terminate(Option_t *option);
-  
-  void SetConfigFileName(TString & name ) {fConfigName = name ; }
-  TString GetConfigFileName() const {return fConfigName ; }
-       
-  void SetAnalysisMaker(AliAnaPartCorrMaker * const maker) {fAna = maker;} 
-  AliMixedEvent * InputEvent(){ return fInputEvent ; }
-  AliMCEvent*   MCEvent()     {return NULL;} // do something about MC event 
-
- private:
-  AliAnalysisTaskParticleCorrelationM(const AliAnalysisTaskParticleCorrelationM&); // Not implemented
-  AliAnalysisTaskParticleCorrelationM& operator=(const AliAnalysisTaskParticleCorrelationM&); // Not implemented
-  
-  AliAnaPartCorrMaker* fAna;  //  Pointer to the manager class 
-  TList * fOutputContainer ;  //! Histogram container
-  TString fConfigName ;       // Configuration file name
-  TList * fCuts ;             //! List with analysis cuts
-  
-  AliMixedEvent * fInputEvent;
-       
-  ClassDef(AliAnalysisTaskParticleCorrelationM, 3); // Analysis task for standard gamma correlation analysis
-};
-
-#endif //ALIANALYSISTASKPARTICLECORRELATIONM_H