Changes for report #69974: Virtual class for calorimeter analysis objects
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Aug 2010 06:24:20 +0000 (06:24 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Aug 2010 06:24:20 +0000 (06:24 +0000)
86 files changed:
ANALYSIS/AliAnalysisTaskESDfilter.cxx
ANALYSIS/AliAnalysisTaskME.cxx
ANALYSIS/AliAnalysisTaskME.h
ANALYSIS/AliMultiEventInputHandler.h
EMCAL/AliEMCALAodCluster.cxx
EMCAL/AliEMCALClusterizerNxN.cxx
EMCAL/AliEMCALClusterizerv1.cxx
EMCAL/AliEMCALPID.cxx
EMCAL/AliEMCALReconstructor.cxx
EMCAL/AliEMCALTracker.cxx
EMCAL/macros/TestESD.C
ESDCheck/AliEMCALQATask.cxx
ESDCheck/AliPHOSQATask.cxx
EVE/EveDet/AliEveEMCALData.cxx
HLT/BASE/util/AliHLTESDCaloClusterMaker.cxx
HLT/CALO/AliHLTCaloClusterAnalyser.cxx
JETAN/AliJetESDFillUnitArrayEMCalDigits.cxx
PHOS/AliPHOSAodCluster.cxx
PHOS/AliPHOSQADataMakerRec.cxx
PHOS/AliPHOSReconstructor.cxx
PWG4/CaloCalib/AliAnalysisTaskCaloFilter.cxx
PWG4/CaloCalib/AliAnalysisTaskEMCALPi0CalibSelection.cxx
PWG4/CaloCalib/AliAnalysisTaskPHOSPi0CalibSelection.cxx
PWG4/JCORRAN/AliJCORRANTask.cxx
PWG4/PWG4PartCorrBaseLinkDef.h
PWG4/PartCorrBase/AliAnaPartCorrBaseClass.cxx
PWG4/PartCorrBase/AliAnaPartCorrBaseClass.h
PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx [new file with mode: 0755]
PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h [new file with mode: 0755]
PWG4/PartCorrBase/AliCaloPID.cxx
PWG4/PartCorrBase/AliCaloTrackAODReader.cxx
PWG4/PartCorrBase/AliCaloTrackAODReader.h
PWG4/PartCorrBase/AliCaloTrackESDReader.cxx
PWG4/PartCorrBase/AliCaloTrackESDReader.h
PWG4/PartCorrBase/AliCaloTrackReader.cxx
PWG4/PartCorrBase/AliCaloTrackReader.h
PWG4/PartCorrBase/AliCalorimeterUtils.cxx
PWG4/PartCorrBase/AliCalorimeterUtils.h
PWG4/PartCorrDep/AliAnaBtag.cxx
PWG4/PartCorrDep/AliAnaCaloTrigger.cxx
PWG4/PartCorrDep/AliAnaCalorimeterQA.cxx
PWG4/PartCorrDep/AliAnaCalorimeterQA.h
PWG4/PartCorrDep/AliAnaElectron.cxx
PWG4/PartCorrDep/AliAnaExample.cxx
PWG4/PartCorrDep/AliAnaParticleHadronCorrelation.cxx
PWG4/PartCorrDep/AliAnaParticleJetLeadingConeCorrelation.cxx
PWG4/PartCorrDep/AliAnaPhoton.cxx
PWG4/PartCorrDep/AliAnaPi0.cxx
PWG4/PartCorrDep/AliAnaPi0.h
PWG4/PartCorrDep/AliAnaPi0EbE.cxx
PWG4/PartCorrDep/AliAnalysisTaskPHOSExample.cxx
PWG4/libPWG4PartCorrBase.pkg
PWG4/macros/ana.C
PWG4/macros/anaM.C [new file with mode: 0644]
STEER/AODLinkDef.h
STEER/AliAODCaloCells.cxx
STEER/AliAODCaloCells.h
STEER/AliAODCaloCluster.cxx
STEER/AliAODCaloCluster.h
STEER/AliAODCluster.cxx
STEER/AliAODCluster.h
STEER/AliAODEvent.cxx
STEER/AliAODEvent.h
STEER/AliAODHandler.cxx
STEER/AliAODRecoDecay.h
STEER/AliAODTrack.cxx
STEER/AliAODTrack.h
STEER/AliAODv0.h
STEER/AliESDCaloCells.cxx
STEER/AliESDCaloCells.h
STEER/AliESDCaloCluster.cxx
STEER/AliESDCaloCluster.h
STEER/AliESDEvent.h
STEER/AliESDtrack.h
STEER/AliESDv0.h
STEER/AliMCEvent.h
STEER/AliMixedEvent.cxx
STEER/AliMixedEvent.h
STEER/AliVCaloCells.cxx [new file with mode: 0644]
STEER/AliVCaloCells.h [new file with mode: 0644]
STEER/AliVCluster.cxx [new file with mode: 0644]
STEER/AliVCluster.h [new file with mode: 0644]
STEER/AliVEvent.h
STEER/AliVTrack.h
STEER/STEERBaseLinkDef.h
STEER/libSTEERBase.pkg

index 290eace..ba72ab0 100644 (file)
@@ -1145,50 +1145,39 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
 \r
       AliESDCaloCluster * cluster = esd->GetCaloCluster(iClust);\r
 \r
-      Int_t id        = cluster->GetID();\r
-      Int_t nLabel    = cluster->GetNLabels();\r
-      TArrayI* labels = cluster->GetLabels();\r
-      Int_t *label = 0;\r
-      if (labels){\r
-       label = (cluster->GetLabels())->GetArray();\r
-       for(int i = 0;i < labels->GetSize();++i){\r
-         if(mcH)mcH->SelectParticle(label[i]);\r
-       }\r
-      }     \r
+      Int_t  id        = cluster->GetID();\r
+      Int_t  nLabel    = cluster->GetNLabels();\r
+      Int_t *labels    = cluster->GetLabels();\r
+      if(labels){ \r
+                 for(int i = 0;i < nLabel;++i){\r
+                         if(mcH)mcH->SelectParticle(labels[i]);\r
+                 }\r
+         }             \r
 \r
       Float_t energy = cluster->E();\r
       cluster->GetPosition(posF);\r
-      Char_t ttype = AliAODCluster::kUndef; \r
 \r
-      if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster) {\r
-       ttype=AliAODCluster::kPHOSNeutral;\r
-      } \r
-      else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) {\r
-       ttype = AliAODCluster::kEMCALClusterv1;\r
-      }\r
-\r
-      \r
       AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) AliAODCaloCluster(id,\r
                                                                                        nLabel,\r
-                                                                                       label,\r
+                                                                                       labels,\r
                                                                                        energy,\r
                                                                                        posF,\r
                                                                                        NULL,\r
-                                                                                       ttype);\r
+                                                                                       cluster->GetType(),0);\r
       \r
       caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),\r
-                                 cluster->GetClusterDisp(),\r
+                                 cluster->GetDispersion(),\r
                                  cluster->GetM20(), cluster->GetM02(),\r
                                  cluster->GetEmcCpvDistance(),  \r
                                  cluster->GetNExMax(),cluster->GetTOF()) ;\r
 \r
-      caloCluster->SetPIDFromESD(cluster->GetPid());\r
+      caloCluster->SetPIDFromESD(cluster->GetPID());\r
       caloCluster->SetNCells(cluster->GetNCells());\r
       caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());\r
       caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());\r
 \r
       TArrayI* matchedT =      cluster->GetTracksMatched();\r
-      if (nTracks>0 && matchedT && cluster->GetTrackMatched() >= 0) {  \r
+      if (nTracks>0 && matchedT && cluster->GetTrackMatchedIndex() >= 0) {     \r
        for (Int_t im = 0; im < matchedT->GetSize(); im++) {\r
            Int_t iESDtrack = matchedT->At(im);;\r
            if (aodTrackRefs->At(iESDtrack) != 0) {\r
@@ -1208,7 +1197,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
       \r
       AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());\r
       aodEMcells.CreateContainer(nEMcell);\r
-      aodEMcells.SetType(AliAODCaloCells::kEMCAL);\r
+      aodEMcells.SetType(AliAODCaloCells::kEMCALCell);\r
       for (Int_t iCell = 0; iCell < nEMcell; iCell++) {      \r
        aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell));\r
       }\r
@@ -1222,7 +1211,7 @@ void AliAnalysisTaskESDfilter::ConvertESDtoAOD() {
       \r
       AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells());\r
       aodPHcells.CreateContainer(nPHcell);\r
-      aodPHcells.SetType(AliAODCaloCells::kPHOS);\r
+      aodPHcells.SetType(AliAODCaloCells::kPHOSCell);\r
       for (Int_t iCell = 0; iCell < nPHcell; iCell++) {      \r
        aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell));\r
       }\r
index c922604..0273803 100644 (file)
@@ -169,13 +169,13 @@ const char* AliAnalysisTaskME::CurrentFileName()
     else return "";
 }
 
-void AliAnalysisTaskME::AddAODBranch(const char* cname, void* addobj)
+void AliAnalysisTaskME::AddAODBranch(const char* cname, void* addobj, const char *fname)
 {
     // Add a new branch to the aod tree
     AliAODHandler* handler = (AliAODHandler*) 
        ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
     if (handler) {
-       handler->AddBranch(cname, addobj);
+       handler->AddBranch(cname, addobj, fname);
     }
 }
 
index 9f5015d..0928f1b 100644 (file)
@@ -34,14 +34,15 @@ class AliAnalysisTaskME : public AliAnalysisTask
     virtual void UserCreateOutputObjects()  {;}
     virtual void UserExec(Option_t* /*option*/) {;}
     // Helpers for adding branches to the AOD
-   virtual void AddAODBranch(const char* cname, void* addobj);
-// Getters
+    virtual void   AddAODBranch(const char* cname, void* addobj, const char *fname="");
+    // Getters
     virtual Int_t          DebugLevel()              {return fDebug;     }
     virtual AliVEvent*     GetEvent(Int_t iev);
     virtual AliAODEvent*   AODEvent()                {return fOutputAOD; }
     virtual TTree*         OutputTree()              {return fTreeA;     }
     virtual Long64_t       Entry()                   {return fEntry;     }
     virtual const char*    CurrentFileName();
+    
   protected:
     Int_t                      fDebug;           //  Debug flag
     Int_t                      fEntry;           //  Current entry in the chain
index 0b492a5..bea1092 100644 (file)
@@ -32,6 +32,7 @@ class AliMultiEventInputHandler : public AliInputEventHandler {
     virtual AliVEvent       *GetEvent()          const {return GetLatestEvent();}
     virtual AliVEvent       *GetEvent(Int_t iev) const;
     AliVEvent               *GetLatestEvent()    const {return fEventBuffer[fIndex];}
+    Int_t                    GetFormat() { return fFormat ;} 
     // From the interface
     virtual Bool_t Init(Option_t* /*opt*/)    {return kTRUE;}
     virtual Bool_t Init(TTree* tree, Option_t* /*opt*/);
index 0de255f..fe01738 100644 (file)
@@ -224,9 +224,9 @@ void AliEMCALAodCluster::EvalPositionAndShowerShape(Float_t logWeight, TString e
   TVector3 gpos ;
   emcalgeo->GetGlobal(clXYZ, gpos, iSupMod);
 
-  SetPosition(0,gpos[0]) ;
-  SetPosition(1,gpos[1]) ;  
-  SetPosition(2,gpos[2]) ;
+  SetPositionAt(gpos[0],0) ;
+  SetPositionAt(gpos[1],1) ;  
+  SetPositionAt(gpos[2],2) ;
 
   //Calculate dispersion       
   for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
index 98eebec..6e9b441 100644 (file)
@@ -319,7 +319,7 @@ void AliEMCALClusterizerNxN::MakeClusters()
          fRecPoints->AddAt(recPoint, fNumberOfECAClusters) ;
          recPoint = dynamic_cast<AliEMCALRecPoint *>(fRecPoints->At(fNumberOfECAClusters)) ; 
          fNumberOfECAClusters++ ;       
-         recPoint->SetClusterType(AliESDCaloCluster::kEMCALClusterv1);
+         recPoint->SetClusterType(AliVCluster::kEMCALClusterv1);
 
          AliDebug(9, Form("Number of cells per cluster (max is 9!): %d", clusterDigitList.GetEntries()));
          for (Int_t idig = 0; idig < clusterDigitList.GetEntries(); idig++)
index c834a99..a333cae 100644 (file)
@@ -338,7 +338,7 @@ void AliEMCALClusterizerv1::MakeClusters()
       recPoint = dynamic_cast<AliEMCALRecPoint *>(fRecPoints->At(fNumberOfECAClusters)) ; 
       fNumberOfECAClusters++ ; 
 
-      recPoint->SetClusterType(AliESDCaloCluster::kEMCALClusterv1);
+      recPoint->SetClusterType(AliVCluster::kEMCALClusterv1);
 
       recPoint->AddDigit(*digit, Calibrate(digit->GetAmplitude(), digit->GetTime(),digit->GetId()),kFALSE) ; //Time or TimeR?
       TObjArray clusterDigits;
index ebcc8a5..71cd663 100644 (file)
 //
 //     kElectron :  fPIDFinal[0]
 //     kMuon     :  fPIDFinal[1]
-//     kPion     :  fPIDFinal[2]
-//     kKaon     :  fPIDFinal[3]
+//     kPion       :  fPIDFinal[2]
+//     kKaon       :  fPIDFinal[3]
 //     kProton   :  fPIDFinal[4]
 //     kPhoton   :  fPIDFinal[5]
-//     kPi0      :  fPIDFinal[6]
+//     kPi0        :  fPIDFinal[6]
 //     kNeutron  :  fPIDFinal[7]
 //     kKaon0    :  fPIDFinal[8]
 //     kEleCon   :  fPIDFinal[9]
@@ -116,7 +116,7 @@ void AliEMCALPID::RunPID(AliESDEvent *esd)
   
   Int_t nClusters = esd->GetNumberOfCaloClusters();
   Int_t firstCluster = 0;
-  Double_t energy, lambda0;
+  Double_t energy=0., lambda0=0.;
   for (Int_t iCluster = firstCluster; iCluster < (nClusters + firstCluster); iCluster++) {
     
     AliESDCaloCluster *clust = esd->GetCaloCluster(iCluster);
@@ -124,9 +124,8 @@ void AliEMCALPID::RunPID(AliESDEvent *esd)
     
     energy = clust->E();
     lambda0 = clust->GetM02();
-    // verify cluster type
-    Int_t clusterType= clust->GetClusterType();
-    if (clusterType == AliESDCaloCluster::kEMCALClusterv1 && lambda0 != 0  && energy < 1000) {
+   
+    if (lambda0 != 0  && energy < 1000) {
       
       // reject clusters with lambda0 = 0
       
@@ -159,8 +158,8 @@ void AliEMCALPID::RunPID(AliESDEvent *esd)
       
       if(fReconstructor){ // In case it is called during reconstruction.
        //      cout << "############# Fill ESDs with PIDWeight ##########" << endl;
-       clust->SetPid(fPIDFinal);}
-    } // end if (clusterType...)
+       clust->SetPID(fPIDFinal);}
+    } // end if (lambda0 != 0  && energy < 1000)
   } // end for (iCluster...)
 }
 
index 048721c..10cc902 100644 (file)
@@ -308,7 +308,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
 
   AliESDCaloCells &emcCells = *(esd->GetEMCALCells());
   emcCells.CreateContainer(nDigits);
-  emcCells.SetType(AliESDCaloCells::kEMCALCell);
+  emcCells.SetType(AliVCaloCells::kEMCALCell);
   Float_t energy = 0;
   for (Int_t idig = 0 ; idig < nDigits ; idig++) {
     const AliEMCALDigit * dig = (const AliEMCALDigit*)digits->At(idig);
@@ -362,7 +362,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
   //########################################
   for (Int_t iClust = 0 ; iClust < nClusters ; iClust++) {
     const AliEMCALRecPoint * clust = (const AliEMCALRecPoint*)clusters->At(iClust);
-    //if(clust->GetClusterType()== AliESDCaloCluster::kEMCALClusterv1) nRP++; else nPC++;
+    //if(clust->GetClusterType()== AliVCluster::kEMCALClusterv1) nRP++; else nPC++;
     if (Debug()) clust->Print();
     // Get information from EMCAL reconstruction points
     Float_t xyz[3];
@@ -403,7 +403,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
       Int_t *parentList =  clust->GetParents(parentMult);
       // fills the ESDCaloCluster
       AliESDCaloCluster * ec = new AliESDCaloCluster() ;
-      ec->SetClusterType(AliESDCaloCluster::kEMCALClusterv1);
+      ec->SetType(AliVCluster::kEMCALClusterv1);
       ec->SetPosition(xyz);
       ec->SetE(clust->GetEnergy());
                
@@ -420,8 +420,8 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
       }
       ec->SetCellsAbsId(newAbsIdList);
       ec->SetCellsAmplitudeFraction(newFracList);
-      ec->SetClusterDisp(clust->GetDispersion());
-      ec->SetClusterChi2(-1); //not yet implemented
+      ec->SetDispersion(clust->GetDispersion());
+      ec->SetChi2(-1); //not yet implemented
       ec->SetM02(elipAxis[0]*elipAxis[0]) ;
       ec->SetM20(elipAxis[1]*elipAxis[1]) ;
       ec->SetTOF(clust->GetTime()) ; //time-of-fligh
index 80e5cf3..98c999c 100644 (file)
@@ -284,7 +284,7 @@ Int_t AliEMCALTracker::LoadClusters(TTree *cTree)
        for (Int_t i = 0; i < nClusters; i++) {
                AliEMCALRecPoint *cluster = (AliEMCALRecPoint*)clusters->At(i);
                if (!cluster) continue;
-               if (cluster->GetClusterType() != AliESDCaloCluster::kEMCALClusterv1) continue;
+               if (cluster->GetClusterType() != AliVCluster::kEMCALClusterv1) continue;
                AliEMCALMatchCluster *matchCluster = new AliEMCALMatchCluster(i, cluster);
                fClusters->AddLast(matchCluster);
        }
index 0593138..c82a18e 100644 (file)
@@ -1,20 +1,13 @@
+
 #if !defined(__CINT__) || defined(__MAKECINT__)
 
 //Root include files 
-#include <Riostream.h>
+//#include <Riostream.h>
 #include <TFile.h>
-#include <TChain.h>
-#include <TParticle.h>
-#include <TNtuple.h>
-#include <TCanvas.h>
-#include <TObjArray.h>
-#include <TSystem.h>
-#include <TString.h>
+//#include <TSystem.h>
 #include <TH1F.h>
-#include <TVector.h>
 #include <TParticle.h>
 #include <TRefArray.h>
-#include <TArrayS.h>
 
 //AliRoot include files 
 #include "AliRunLoader.h"
 #include "AliESDCaloCluster.h"
 #include "AliESDCaloCells.h"
 #include "AliPID.h"
-#include "AliLog.h"
+#include "AliEMCALGeometry.h"
 
 #endif
 
 //Change the bool depending on what information you want to print
 // when all FALSE, prints minimum cluster information.
-Bool_t kPrintKine = kTRUE; //Do not use for raw data.
-Bool_t kPrintCaloCells = kFALSE;
+Bool_t kPrintKine         = kFALSE; //Do not use for raw data.
+Bool_t kPrintCaloCells    = kFALSE;
 Bool_t kPrintTrackMatches = kFALSE;
 Bool_t kPrintClusterCells = kFALSE;
+Bool_t kPrintClusterPID   = kFALSE;
 
 void TestESD() {
-
-  TGeoManager::Import("geometry.root");
-  AliEMCALGeometry *geom =  AliEMCALGeometry::GetInstance("EMCAL_COMPLETE") ;  
-
+  // Main method to read information stored in AliESDCaloClusters and AliESDCaloCells
+       
+  // Init some example histograms
+  // ESD
+  TH1F * hEta  = (TH1F*) new TH1F("hEta","reco eta",1000, -0.71,0.71); 
+  TH1F * hPhi  = (TH1F*) new TH1F("hPhi","reco phi",130, 70,200); 
+  TH1F * hE    = (TH1F*) new TH1F("hE"  ,"reco e",300, 0,30); 
+  TH1F * hTime = (TH1F*) new TH1F("hTime"  ,"reco time",1000, 0,1000); 
+  hEta ->SetXTitle("#eta");
+  hPhi ->SetXTitle("#phi (deg)");
+  hE   ->SetXTitle("E (GeV)");
+  hTime->SetXTitle("time (ns)");
+  
+  // Monte Carlo
+  TH1F * hMCEta = (TH1F*) new TH1F("hMCEta","MC eta",1000, -0.71,0.71); 
+  TH1F * hMCPhi = (TH1F*) new TH1F("hMCPhi","MC phi",130, 70,200); 
+  TH1F * hMCE   = (TH1F*) new TH1F("hMCE"  ,"MC e",300, 0,30); 
+  hMCEta->SetXTitle("#eta");
+  hMCPhi->SetXTitle("#phi (deg)");
+  hMCE  ->SetXTitle("E (GeV)");
+  
+  //ESD - MonteCarlo
+  TH1F * hDEta = (TH1F*) new TH1F("hDEta"," eta cluster - eta MC",500, -0.05,0.05); 
+  TH1F * hDPhi = (TH1F*) new TH1F("hDPhi","phi cluster - phi MC",200, -20,20); 
+  TH1F * hDE   = (TH1F*) new TH1F("hDE"  ,"e cluster - e MC",200, -10,10); 
+  hDEta->SetXTitle("#eta_{reco}-#eta_{MC}");
+  hDPhi->SetXTitle("#phi_{reco}-#phi_{MC} (deg)");
+  hDE  ->SetXTitle("E_{reco}-E_{MC} (GeV)");
+  
+  //Open the ESD file, get the tree with events
   TFile* f = new TFile("AliESDs.root");
   TTree* esdTree = (TTree*)f->Get("esdTree");
-  
   AliESDEvent* esd = new AliESDEvent();
   esd->ReadFromTree(esdTree);
 
+  //Init geometry and array that will contain the clusters
+  TRefArray* caloClusters = new TRefArray();
+  AliEMCALGeometry *geom =  AliEMCALGeometry::GetInstance("EMCAL_FIRSTYEAR") ;         
+  Float_t pos[3];
+  
+  //Loop of events
   Int_t nEvt = esdTree->GetEntries();
-  Float_t pos[3] = {0.,0.,0.};
-
   for(Int_t iev = 0; iev < nEvt; iev++) {
     cout << "<<<< Event: " << iev+1 << "/" << nEvt << " >>>>"<<endl;
     esdTree->GetEvent(iev);
-         
-       //In case you want to play with MC data
-       AliStack *stack = 0;
-       if(kPrintKine){  
-               AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),  "read");
-               rl->LoadKinematics();  
-               rl->GetEvent(iev);
-               stack = rl->Stack();
-       }  
-         
-       //get reconstructed vertex position
-       Double_t vertex_position[3];
-       esd->GetVertex()->GetXYZ(vertex_position);
-         
-       //GetCellsClusters Array  
-    AliESDCaloCells &cells= *(esd->GetEMCALCells());
-         // Uncomment to see the full list of digit amplitudes and times.
-       if(kPrintCaloCells){  
-               Int_t nTotalCells = cells.GetNumberOfCells() ;  
-               Int_t type        = cells.GetType();
-               for (Int_t icell=  0; icell <  nTotalCells; icell++) {
-                       cout<<"Cell   : "<<icell<<"/"<<nTotalCells<<" ID: "<<cells.GetCellNumber(icell)<<" Amplitude: "<<cells.GetAmplitude(icell)<<" Time: "<<cells.GetTime(icell)<<endl;        
-               }// cell loop
-       }
-         
-       //GetCaloClusters Array
-    TRefArray* caloClusters = new TRefArray();
-    esd->GetEMCALClusters(caloClusters);
+    
+    //Pass the geometry transformation matrix from ESDs to geometry
+    for(Int_t mod=0; mod < (geom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
+      //printf("matrix %d\n",mod);
+      if(esd->GetEMCALMatrix(mod)) {
+        //printf("EMCAL: mod %d, matrix %p\n",mod, esd->GetEMCALMatrix(mod));
+        //(esd->GetEMCALMatrix(mod))->Print("");
+        geom->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ;
+      }//matrix
+    }//module
+    
+    //In case you want to play with MC data, get stack
+    AliStack *stack = 0;
+    if(kPrintKine){  
+      AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),  "read");
+      rl->LoadKinematics();  
+      rl->GetEvent(iev);
+      stack = rl->Stack();
+    }  
+    
+    //get reconstructed vertex position
+    Double_t vertex_position[3];
+    esd->GetVertex()->GetXYZ(vertex_position);
+    
+    //------------------------------------------------------
+    //Get Cells Array, all cells in event, print cells info 
+    //------------------------------------------------------ 
+    AliVCaloCells &cells= *(esd->GetEMCALCells());
+    //AliESDCaloCells &cells= *(esd->GetEMCALCells());
 
+    if(kPrintCaloCells){  
+      Int_t nTotalCells = cells.GetNumberOfCells() ;  
+      //Int_t type        = cells.GetType();
+      for (Int_t icell=  0; icell <  nTotalCells; icell++) {
+       cout<<"Cell   : "<<icell<<"/"<<nTotalCells<<" ID: "<<cells.GetCellNumber(icell)<<" Amplitude: "<<cells.GetAmplitude(icell)<<" Time: "<<cells.GetTime(icell)*1e9<<endl;    
+      }// cell loop
+    }
+    
+    //------------------------------------------------------
+    // Calo Clusters 
+    //------------------------------------------------------
+    
+    //Get CaloClusters Array
+    caloClusters->Clear();
+    esd->GetEMCALClusters(caloClusters);
+    
     //loop over clusters
     Int_t nclus = caloClusters->GetEntries();
     for (Int_t icl = 0; icl < nclus; icl++) {
-
-      AliESDCaloCluster* clus = (AliESDCaloCluster*)caloClusters->At(icl);
+      
+      AliVCluster* clus = (AliVCluster*)caloClusters->At(icl);
+      //AliESDCluster* clus = (AliESDCluster*)caloClusters->At(icl);
       Float_t energy = clus->E();
       clus->GetPosition(pos);
       TVector3 vpos(pos[0],pos[1],pos[2]);
-      TLorentzVector p;
-      clus->GetMomentum(p,vertex_position);
+      
+      //We can get a momentum TLorentzVector per cluster, corrected by the vertex position 
+      //TLorentzVector p;
+      //clus->GetMomentum(p,vertex_position);
+      
       Double_t cphi = vpos.Phi();
       Double_t ceta = vpos.Eta();
-
-      Int_t nMatched = clus->GetNTracksMatched();
-      Int_t trackIndex = clus->GetTrackMatched();
-      Int_t nLabels = clus->GetNLabels();
+      
+      Int_t nMatched   = clus->GetNTracksMatched();
+      Int_t trackIndex = clus->GetTrackMatchedIndex();
+      Int_t nLabels    = clus->GetNLabels();
       Int_t labelIndex = clus->GetLabel();
-
-      Int_t nCells = clus->GetNCells();
-
-      //For later: ADD CHECK THAT CLUSTER IS WITHIN SM FIDUCIAL VOLUME
-
-      cout << "Cluster: " << icl+1 << "/" << nclus << " Energy: " << energy << " Phi: " 
-          << cphi*TMath::RadToDeg() << " Eta: " << ceta << " NCells: " << nCells << " #Matches: " << nMatched 
-          << " Index: " << trackIndex << " #Labels: " << nLabels << " Index: " 
-          << labelIndex << endl;
-
-       if(kPrintTrackMatches && trackIndex >= 0) {
-               AliESDtrack* track = esd->GetTrack(trackIndex);
-               Double_t tphi = track->GetOuterParam()->Phi();
-               Double_t teta = track->GetOuterParam()->Eta();
-               Double_t tmom = track->GetOuterParam()->P();
-               cout << "\t Track Momentum: " << tmom << " phi: " << tphi << " eta: " << teta << endl;
-
-               Double_t deta = teta - ceta;
-               Double_t dphi = tphi - cphi;
-               if(dphi > TMath::Pi()) dphi -= 2*TMath::Pi();
-               if(dphi < -TMath::Pi()) dphi += 2*TMath::Pi();
-               Double_t dR = sqrt(dphi*dphi + deta*deta);
-
-               Double_t pOverE = tmom/energy;
-
-               if(dR < 0.02 && pOverE < 1.8 && nCells > 1) {
-                       cout << "\n\t Excellent MATCH! dR = " << dR << " p/E = " << pOverE << " nCells = " << nCells << endl;
-               }
-
-       }
-               
-       //Get CaloCells of cluster and print
-       if(kPrintClusterCells){ 
-               UShort_t * index = clus->GetCellsAbsId() ;
-               Double_t * fraction = clus->GetCellsAmplitudeFraction() ;
-               for(Int_t i = 0; i < nCells ; i++){
-                       Int_t absId =   index[i]; // or clus->GetCellNumber(i) ;
-                       Double_t ampFract =  fraction[i];
-                       Float_t amp       = cells.GetCellAmplitude(absId) ;
-                       Float_t time      = cells.GetCellTime(absId);
-                       cout<<"         Cluster Cell: AbsID : "<< absId << "; Amplitude "<< amp << "; Fraction "<<ampFract<<"; Time " <<time<<endl;
-                       //Geometry methods  
-                       Int_t iSupMod =  0 ;
-                       Int_t iTower  =  0 ;
-                       Int_t iIphi   =  0 ;
-                       Int_t iIeta   =  0 ;
-                       Int_t iphi    =  0 ;
-                       Int_t ieta    =  0 ;
-                       if(geom){
-                         geom->GetCellIndex(absId,iSupMod,iTower,iIphi,iIeta); 
-                         //Gives SuperModule and Tower numbers
-                         geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
-                                                           iIphi, iIeta,iphi,ieta);
-                         //Gives label of cell in eta-phi position per each supermodule
-                         cout<< "SModule "<<iSupMod<<"; Tower "<<iTower <<"; Eta "<<iIeta
-                             <<"; Phi "<<iIphi<<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<endl;
-                       }
-               }
-       }
+      Int_t nCells     = clus->GetNCells();
                
-       //Print primary info
-       if(!stack || !kPrintKine) continue;
+      //Fill some histograms
+      hEta->Fill(ceta);
+      hPhi->Fill(cphi*TMath::RadToDeg());
+      hE  ->Fill(energy);
+      hTime->Fill(clus->GetTOF()*1e9);
+      
+      //Print basic cluster information
+      cout << "Cluster: " << icl+1 << "/" << nclus << " Energy: " << energy << "; Phi: " 
+          << cphi*TMath::RadToDeg() << "; Eta: " << ceta << "; NCells: " << nCells << " ;#Matches: " << nMatched 
+          << "; Index: " << trackIndex << "; #Labels: " << nLabels << " Index: " 
+          << labelIndex << "; Time "<<clus->GetTOF()*1e9<<" ns "<<endl;
+      
+      //Print primary info
+      if(stack && kPrintKine) {
        if(labelIndex >= 0 && labelIndex < stack->GetNtrack()){
-               TParticle * particle = stack->Particle(labelIndex);
-               //Print primary values
-               cout<<"         More  contributing primary: "<<particle->GetName()<< "; Energy "<<particle->Energy()<<"; Eta "<<particle->Eta()<<"; Phi "<<particle->Phi()*TMath::RadToDeg()<<endl;   
-               for(Int_t i = 1; i < nLabels; i++){
-                       particle = stack->Particle((clus->GetLabels())->At(i));
-                       cout<<"         Other contributing primary: "<<particle->GetName()<< "; Energy "<<particle->Energy()<<endl;
-               }
+         TParticle * particle = stack->Particle(labelIndex);
+         //Fill histograms with primary info
+         hMCEta->Fill(particle->Eta());
+         hMCPhi->Fill(particle->Phi()*TMath::RadToDeg());
+         hMCE  ->Fill(particle->Energy());
+         hDEta ->Fill(ceta-particle->Eta());
+         hDPhi ->Fill(cphi*TMath::RadToDeg()-particle->Phi()*TMath::RadToDeg());
+         hDE   ->Fill(energy-particle->Energy());
+         //Print primary values
+         cout<<"         More  contributing primary: "<<particle->GetName()<<"; with kinematics: "<<endl;
+         cout<<" \t     Energy: "<<particle->Energy()<<"; Phi: "<<particle->Phi()*TMath::RadToDeg()<<"; Eta: "<<particle->Eta()<<endl;   
+         for(Int_t i = 1; i < nLabels; i++){
+           //particle = stack->Particle((((AliESDCaloCluster*)clus)->GetLabelsArray())->At(i));
+           particle = stack->Particle((clus->GetLabels())[i]);
+           //or Int_t *labels = clus->GetLabels();
+           //particle = stack->Particle(labels[i]);
+           cout<<"         Other contributing primary: "<<particle->GetName()<< "; Energy "<<particle->Energy()<<endl;
+         }
        }
        else if( labelIndex >= stack->GetNtrack()) cout <<"PROBLEM, label is too large : "<<labelIndex<<" >= particles in stack "<< stack->GetNtrack() <<endl;
-       else cout<<"Negative label!!!  : "<<labelIndex<<endl;
-               
+                 else cout<<"Negative label!!!  : "<<labelIndex<<endl;
+      } // play with stack
+      
+      // Matching results
+      if(kPrintTrackMatches && trackIndex >= 0) {
+       AliESDtrack* track = esd->GetTrack(trackIndex);
+       Double_t tphi = track->GetOuterParam()->Phi();
+       Double_t teta = track->GetOuterParam()->Eta();
+       Double_t tmom = track->GetOuterParam()->P();
+       cout << "\t Track Momentum: " << tmom << " phi: " << tphi << " eta: " << teta << endl;
+       
+       Double_t deta = teta - ceta;
+       Double_t dphi = tphi - cphi;
+       if(dphi > TMath::Pi()) dphi -= 2*TMath::Pi();
+       if(dphi < -TMath::Pi()) dphi += 2*TMath::Pi();
+       Double_t dR = sqrt(dphi*dphi + deta*deta);
+       
+       Double_t pOverE = tmom/energy;
+       
+       if(dR < 0.02 && pOverE < 1.8 && nCells > 1) {
+         cout << "\n\t Excellent MATCH! dR = " << dR << " p/E = " << pOverE << " nCells = " << nCells << endl;
        }
-
-
+      }// matching
+      
+      //Get PID weights and print them
+      if(kPrintClusterPID){
+       const Double_t *pid = clus->GetPID();
+       printf("PID weights: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n",
+              pid[AliVCluster::kPhoton],   pid[AliVCluster::kPi0],
+              pid[AliVCluster::kElectron], pid[AliVCluster::kEleCon],
+              pid[AliVCluster::kPion],     pid[AliVCluster::kKaon],   pid[AliVCluster::kProton],
+              pid[AliVCluster::kNeutron],  pid[AliVCluster::kKaon0]);
+      }//PID
+      
+      //Get CaloCells of cluster and print their info, position.
+      if(kPrintClusterCells){  
+       UShort_t * index    = clus->GetCellsAbsId() ;
+       Double_t * fraction = clus->GetCellsAmplitudeFraction() ;
+       Int_t sm = -1;
+       for(Int_t i = 0; i < nCells ; i++){
+         Int_t absId       =   index[i]; // or clus->GetCellNumber(i) ;
+         Double_t ampFract =  fraction[i];
+         Float_t amp       = cells.GetCellAmplitude(absId) ;
+         Double_t time     = cells.GetCellTime(absId);
+         cout<<"\t Cluster Cell: AbsID : "<< absId << " == "<<clus->GetCellAbsId(i) <<"; Amplitude "<< amp << "; Fraction "<<ampFract<<"; Time " <<time*1e9<<endl;
+         //Geometry methods  
+         Int_t iSupMod =  0 ;
+         Int_t iTower  =  0 ;
+         Int_t iIphi   =  0 ;
+         Int_t iIeta   =  0 ;
+         Int_t iphi    =  0 ;
+         Int_t ieta    =  0 ;
+         if(geom){
+           geom->GetCellIndex(absId,iSupMod,iTower,iIphi,iIeta); 
+           //Gives SuperModule and Tower numbers
+           geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
+                                             iIphi, iIeta,iphi,ieta);
+           //Gives label of cell in eta-phi position per each supermodule
+           Float_t cellPhi = 0;
+           Float_t cellEta = 0;
+           geom->EtaPhiFromIndex(absId,cellEta,cellPhi);
+           cout<< "                SModule "<<iSupMod<<"; Tower "<<iTower <<"; Eta "<<iIeta
+               <<"; Phi "<<iIphi<<"; Index: Cell Eta "<<ieta<<"; Cell Phi "<<iphi
+               <<"; Global: Cell Eta "<<cellEta<<"; Cell Phi "<<cellPhi*TMath::RadToDeg()<<endl;
+           if(i==0) sm = iSupMod;
+           else{
+             if(sm!=iSupMod) printf("******CLUSTER SHARED BY 2 SuperModules!!!!\n");
+           }   
+         }// geometry on
+       }// cluster cell loop
+      }// print cell clusters
+    } //cluster loop
+  } // event loop
+  
+  
+  //Write histograms in a file
+  TFile * fhisto = (TFile*) new TFile("histos.root","recreate");
+  hEta->Write();
+  hPhi->Write();
+  hE  ->Write();
+  hTime->Write();
+  if(kPrintKine){
+    hMCEta->Write();
+    hMCPhi->Write();
+    hMCE  ->Write();
+    hDEta->Write();
+    hDPhi->Write();
+    hDE  ->Write();
   }
-
-
-
+  fhisto->Close();
 }
index 475a11b..c3fbf95 100644 (file)
@@ -192,14 +192,14 @@ void AliEMCALQATask::Exec(Option_t *)
     AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(emcalCluster) ;
     if (caloCluster) {
       Float_t pos[3] ;
-      if(caloCluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) {  
+      if(caloCluster->IsEMCAL()) {  
        caloCluster->GetPosition(pos) ;
        fhEMCALPos->Fill(pos[0],pos[1],pos[2]) ;
        fhEMCALEnergy->Fill(caloCluster->E()) ;
        fhEMCALDigits->Fill(entry, caloCluster->GetNCells()) ;
        numberOfEmcalClustersv1++ ;
        numberOfDigitsInEmcal += caloCluster->GetNCells() ;    
-       // Float_t * pid = clus->GetPid() ;
+       // const Double_t * pid = clus->GetPID() ;
        // if(pid[AliPID::kPhoton]>0.9){
        emcalVector[numberOfPhotonsInEmcal] = new TVector3(pos[0],pos[1],pos[2]) ;
        emcalPhotonsEnergy[numberOfPhotonsInEmcal] = caloCluster->E() ;
index 591769f..4fbc929 100644 (file)
@@ -198,7 +198,7 @@ void AliPHOSQATask::Exec(Option_t *)
       fhPHOSPos->Fill( pos[0], pos[1], pos[2] ) ;
       fhPHOSDigits->Fill(entry, caloCluster->GetNCells() ) ;
       numberOfDigitsInPhos += caloCluster->GetNCells() ;
-      Double_t * pid = caloCluster->GetPid() ;
+      const Double_t * pid = caloCluster->GetPID() ;
       if(pid[AliPID::kPhoton] > 0.9) {
        phosVector[numberOfPhotonsInPhos] = new TVector3(pos[0],pos[1],pos[2]) ;
        phosPhotonsEnergy[numberOfPhotonsInPhos]=caloCluster->E() ;
index fe9151c..580deb0 100644 (file)
@@ -652,7 +652,7 @@ void AliEveEMCALData::LoadRecPointsFromESD()
       // adc
       //      Int_t   eneInt = (Int_t)energy*500+0.5;
       Double_t eneInt = energy/0.0153; // To be modified with correct OCDB conversion
-      Double_t disp   = clus->GetClusterDisp() ;
+      Double_t disp   = clus->GetDispersion() ;
       
       clus->GetPosition(pos) ; // Global position
       TVector3 vpos(pos[0],pos[1],pos[2]) ;
index 31af8b6..8cfdfcf 100644 (file)
@@ -69,14 +69,14 @@ AliHLTESDCaloClusterMaker::FillESD(AliESDEvent *esdPtr, const AliHLTCaloClusterH
       AliESDCaloCluster esdCluster;
 
       esdCluster.SetID(caloClusterStructPtr->fID);
-      esdCluster.SetClusterType(caloClusterStructPtr->fClusterType);
+      esdCluster.SetType(caloClusterStructPtr->fClusterType);
       esdCluster.SetPosition((Float_t*)(caloClusterStructPtr->fGlobalPos));
       esdCluster.SetE(caloClusterStructPtr->fEnergy);
       esdCluster.SetTOF(caloClusterStructPtr->fTOF);
-      esdCluster.SetClusterDisp(caloClusterStructPtr->fDispersion);
-      esdCluster.SetClusterChi2(caloClusterStructPtr->fFitQuality);
+      esdCluster.SetDispersion(caloClusterStructPtr->fDispersion);
+      esdCluster.SetChi2(caloClusterStructPtr->fFitQuality);
       const Float_t *pid = caloClusterStructPtr->fPID;
-      esdCluster.SetPid(pid);
+      esdCluster.SetPID(pid);
       esdCluster.SetM20(caloClusterStructPtr->fM20);
       esdCluster.SetM02(caloClusterStructPtr->fM02);
       esdCluster.SetNExMax(caloClusterStructPtr->fNExMax);
index 3fbe574..5370b66 100644 (file)
@@ -57,7 +57,7 @@ AliHLTCaloClusterAnalyser::AliHLTCaloClusterAnalyser() :
   fDoPID(false),
   fHaveDistanceToBadChannel(false),
   fGeometry(0),
-  fClusterType(AliESDCaloCluster::kPHOSCluster),
+  fClusterType(AliVCluster::kPHOSNeutral),
   fRecoParamsPtr(0),
   fCutOnSingleCellClusters(false),
   fSingleCellEnergyCut(0.5)
index d8581d2..7747140 100755 (executable)
@@ -266,7 +266,7 @@ void AliJetESDFillUnitArrayEMCalDigits::Exec(Option_t* const /*option*/)
       Int_t     digMult = fClus->GetNCells() ;
       UShort_t *digID   = fClus->GetCellsAbsId() ;
 //(not used ?)      Double_t *digAmpFrac = fClus->GetCellsAmplitudeFraction() ;
-      Int_t     trackIndex = fClus->GetTrackMatched();
+      Int_t     trackIndex = fClus->GetTrackMatchedIndex();
 
       // Do double-counted electron correction 
       if (fApplyElectronCorrection != 0 && trackIndex !=-1 )
index 9bd0fc5..1625b7b 100755 (executable)
@@ -230,7 +230,7 @@ void AliPHOSAodCluster::EvalCoord(Float_t logWeight, TVector3 &vtx)
   //Go to the global system
   TVector3 gps ;
   phosgeom->Local2Global(phosMod, xMean, zMean, gps) ;
-  SetPosition(0, gps[0]) ;
-  SetPosition(1, gps[1]) ;  
-  SetPosition(2, gps[2]) ;
+  SetPositionAt(gps[0],0) ;
+  SetPositionAt(gps[1],1) ;  
+  SetPositionAt(gps[2],2) ;
 }
index a2dd251..3d60a4b 100644 (file)
@@ -344,7 +344,7 @@ void AliPHOSQADataMakerRec::MakeESDs(AliESDEvent * esd)
     AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
     if( clu->IsPHOS() ) {
       GetESDsData(kESDSpec)->Fill(clu->E()) ;
-      Double_t *pid=clu->GetPid() ;
+      const Double_t * pid = clu->GetPID() ;
       GetESDsData(kESDpid)->Fill(pid[AliPID::kPhoton]) ;
       eTot+=clu->E() ;
       nTot++ ;
index 32120ef..9afd29b 100644 (file)
@@ -293,17 +293,17 @@ void AliPHOSReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
       energy = rp->Energy();
 
     // fills the ESDCaloCluster
-    ec->SetClusterType(AliESDCaloCluster::kPHOSCluster);
+    ec->SetType(AliVCluster::kPHOSNeutral);
     ec->SetPosition(xyz);                       //rec.point position in MARS
     ec->SetE(energy);                           //total or core particle energy
-    ec->SetClusterDisp(emcRP->GetDispersion()); //cluster dispersion
-    ec->SetPid(rp->GetPID()) ;                  //array of particle identification
+    ec->SetDispersion(emcRP->GetDispersion());  //cluster dispersion
+    ec->SetPID(rp->GetPID()) ;            //array of particle identification
     ec->SetM02(emcRP->GetM2x()) ;               //second moment M2x
     ec->SetM20(emcRP->GetM2z()) ;               //second moment M2z
     ec->SetNExMax(emcRP->GetNExMax());          //number of local maxima
     ec->SetEmcCpvDistance(ts->GetCpvDistance("r")); //Only radius, what about separate x,z????
     ec->SetTrackDistance(ts->GetCpvDistance("x"),ts->GetCpvDistance("z")); 
-    ec->SetClusterChi2(-1);                     //not yet implemented
+    ec->SetChi2(-1);                     //not yet implemented
     ec->SetTOF(emcRP->GetTime());               //Time of flight - already calibrated in EMCRecPoint
 
     //Cells contributing to clusters
index a746272..c518303 100644 (file)
@@ -68,7 +68,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD()
   for (Int_t i = 0; i < 6; i++)  covVtx[i] = 0.;
   
   // Update the header
-   AliAODHeader* headerin = aod->GetHeader();
+  AliAODHeader* headerin = aod->GetHeader();
   AliAODHeader* header = AODEvent()->GetHeader();
   header->SetRunNumber(headerin->GetRunNumber());
   header->SetBunchCrossNumber(headerin->GetBunchCrossNumber());
@@ -93,7 +93,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD()
   //
   //
   Int_t nVertices = 1 ;/* = prim. vtx*/;
-  Int_t nCaloClus = aod->GetNCaloClusters();
+  Int_t nCaloClus = aod->GetNumberOfCaloClusters();
   
   AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0);
   
@@ -122,8 +122,8 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD()
     AliAODCaloCluster * cluster = aod->GetCaloCluster(iClust);
     
     //Check which calorimeter information we want to keep.
-    if     (fCalorimeter.Contains("PHOS")  && !fCalorimeter.Contains("EMCAL") && cluster->IsEMCALCluster()) continue ;
-    else if(fCalorimeter.Contains("EMCAL") && !fCalorimeter.Contains("PHOS")  && cluster->IsPHOSCluster())  continue ;
+    if     (fCalorimeter.Contains("PHOS")  && !fCalorimeter.Contains("EMCAL") && cluster->IsEMCAL()) continue ;
+    else if(fCalorimeter.Contains("EMCAL") && !fCalorimeter.Contains("PHOS")  && cluster->IsPHOS())  continue ;
     
     Int_t id       = cluster->GetID();
     Float_t energy = cluster->E();
@@ -140,13 +140,13 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD()
                        NULL,
                        ttype);
     
-    caloCluster->SetCaloCluster(cluster->GetDistToBadChannel(),
+    caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),
                                cluster->GetDispersion(),
                                cluster->GetM20(), cluster->GetM02(),
                                cluster->GetEmcCpvDistance(),  
                                cluster->GetNExMax(),cluster->GetTOF()) ;
     
-    caloCluster->SetPIDFromESD(cluster->PID());
+    caloCluster->SetPIDFromESD(cluster->GetPID());
     caloCluster->SetNCells(cluster->GetNCells());
     caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());
     caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());
@@ -162,7 +162,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD()
     
     AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());
     aodEMcells.CreateContainer(nEMcell);
-    aodEMcells.SetType(AliAODCaloCells::kEMCAL);
+    aodEMcells.SetType(AliVCaloCells::kEMCALCell);
     for (Int_t iCell = 0; iCell < nEMcell; iCell++) {      
       aodEMcells.SetCell(iCell,aodinEMcells.GetCellNumber(iCell),aodinEMcells.GetAmplitude(iCell));
     }
@@ -176,7 +176,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromAOD()
     
     AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells());
     aodPHcells.CreateContainer(nPHcell);
-    aodPHcells.SetType(AliAODCaloCells::kPHOS);
+    aodPHcells.SetType(AliVCaloCells::kPHOSCell);
     for (Int_t iCell = 0; iCell < nPHcell; iCell++) {      
       aodPHcells.SetCell(iCell,aodinPHcells.GetCellNumber(iCell),aodinPHcells.GetAmplitude(iCell));
     }
@@ -264,15 +264,6 @@ void AliAnalysisTaskCaloFilter::CreateAODFromESD()
     Int_t id       = cluster->GetID();
     Float_t energy = cluster->E();
     cluster->GetPosition(posF);
-    Char_t ttype   = AliAODCluster::kUndef; 
-    
-    if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster) {
-      ttype=AliAODCluster::kPHOSNeutral;
-    } 
-    else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1) {
-      ttype = AliAODCluster::kEMCALClusterv1;
-    }
-    
     
     AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) 
       AliAODCaloCluster(id,
@@ -281,15 +272,15 @@ void AliAnalysisTaskCaloFilter::CreateAODFromESD()
                        energy,
                        posF,
                        NULL,
-                       ttype);
+                       cluster->GetType());
     
     caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),
-                               cluster->GetClusterDisp(),
+                               cluster->GetDispersion(),
                                cluster->GetM20(), cluster->GetM02(),
                                cluster->GetEmcCpvDistance(),  
                                cluster->GetNExMax(),cluster->GetTOF()) ;
     
-    caloCluster->SetPIDFromESD(cluster->GetPid());
+    caloCluster->SetPIDFromESD(cluster->GetPID());
     caloCluster->SetNCells(cluster->GetNCells());
     caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());
     caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());
@@ -305,7 +296,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromESD()
     
     AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());
     aodEMcells.CreateContainer(nEMcell);
-    aodEMcells.SetType(AliAODCaloCells::kEMCAL);
+    aodEMcells.SetType(AliVCaloCells::kEMCALCell);
     for (Int_t iCell = 0; iCell < nEMcell; iCell++) {      
       aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell));
     }
@@ -319,7 +310,7 @@ void AliAnalysisTaskCaloFilter::CreateAODFromESD()
     
     AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells());
     aodPHcells.CreateContainer(nPHcell);
-    aodPHcells.SetType(AliAODCaloCells::kPHOS);
+    aodPHcells.SetType(AliVCaloCells::kPHOSCell);
     for (Int_t iCell = 0; iCell < nPHcell; iCell++) {      
       aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell));
     }
index 291b056..43ef96a 100644 (file)
 #include "AliAnalysisTaskEMCALPi0CalibSelection.h"
 #include "AliAODEvent.h"
 #include "AliESDEvent.h"
-#include "AliESDCaloCluster.h"
-#include "AliESDCaloCells.h"
 #include "AliEMCALGeometry.h"
-#include "AliAODCaloCluster.h"
-#include "AliAODCaloCells.h"
+#include "AliVCluster.h"
+#include "AliVCaloCells.h"
 //#include "AliEMCALAodCluster.h"
 //#include "AliEMCALCalibData.h"
 
@@ -126,7 +124,6 @@ void AliAnalysisTaskEMCALPi0CalibSelection::LocalInit()
 void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromAOD()
 {
   // Copy AOD header, vertex, CaloClusters and CaloCells to output AOD
-  
   AliAODEvent* aod = dynamic_cast<AliAODEvent*>(InputEvent());
   
   // set arrays and pointers
@@ -162,7 +159,7 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromAOD()
   //
   //
   Int_t nVertices = 1 ;/* = prim. vtx*/;
-  Int_t nCaloClus = aod->GetNCaloClusters();
+  Int_t nCaloClus = aod->GetNumberOfCaloClusters();
   
   AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0);
   
@@ -178,64 +175,64 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromAOD()
   vtx->GetCovMatrix(covVtx); //covariance matrix
   
   AliAODVertex * primary = new(vertices[jVertices++])
-    AliAODVertex(pos, covVtx, vtx->GetChi2perNDF(), NULL, -1, AliAODVertex::kPrimary);
+  AliAODVertex(pos, covVtx, vtx->GetChi2perNDF(), NULL, -1, AliAODVertex::kPrimary);
   primary->SetName(vtx->GetName());
   primary->SetTitle(vtx->GetTitle());
   
   // Access to the AOD container of clusters
   TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters());
   Int_t jClusters=0;
+  printf("nCaloClus %d\n",nCaloClus);
   
   for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
     
     AliAODCaloCluster * cluster = aod->GetCaloCluster(iClust);
     
     //Check if it is a EMCAL cluster
-    if(!cluster->IsEMCALCluster())  continue ;
-    
-       if(ClusterContainsBadChannel(cluster->GetCellsAbsId(), cluster->GetNCells())) continue; 
-
-         
+    if(!cluster->IsEMCAL())  continue ;
+    printf("EMCAL cluster %d, ncells %d\n",iClust, cluster->GetNCells());
+    if(ClusterContainsBadChannel(cluster->GetCellsAbsId(), cluster->GetNCells())) continue;    
+    printf("copy\n");
     Int_t id       = cluster->GetID();
     Float_t energy = cluster->E();
     cluster->GetPosition(posF);
     Char_t ttype   = cluster->GetType(); 
     AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) 
-      AliAODCaloCluster(id,
-                       0,
-                       0x0,
-                       energy,
-                       posF,
-                       NULL,
-                       ttype);
-
-    caloCluster->SetCaloCluster(cluster->GetDistToBadChannel(),
-                               cluster->GetDispersion(),
-                               cluster->GetM20(), cluster->GetM02(),
-                               cluster->GetEmcCpvDistance(),  
-                               cluster->GetNExMax(),cluster->GetTOF()) ;
+    AliAODCaloCluster(id,
+                      0,
+                      0x0,
+                      energy,
+                      posF,
+                      NULL,
+                      ttype);
     
-    caloCluster->SetPIDFromESD(cluster->PID());
+    caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),
+                                cluster->GetDispersion(),
+                                cluster->GetM20(), cluster->GetM02(),
+                                cluster->GetEmcCpvDistance(),  
+                                cluster->GetNExMax(),cluster->GetTOF()) ;
+    
+    caloCluster->SetPIDFromESD(cluster->GetPID());
     caloCluster->SetNCells(cluster->GetNCells());
     caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());
-       
+    
     caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());
     
   } 
-
+  
   caloClusters.Expand(jClusters); // resize TObjArray   
   // end of loop on calo clusters
   
   // fill EMCAL cell info
   if (aod->GetEMCALCells()) { // protection against missing AOD information
-           AliAODCaloCells &aodinEMcells = *(aod->GetEMCALCells());
+    AliAODCaloCells &aodinEMcells = *(aod->GetEMCALCells());
     Int_t nEMcell = aodinEMcells.GetNumberOfCells() ;
     
     AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());
     aodEMcells.CreateContainer(nEMcell);
-    aodEMcells.SetType(AliAODCaloCells::kEMCAL);
-       
-       Double_t calibFactor = 1;
+    aodEMcells.SetType(AliAODCaloCells::kEMCALCell);
+    
+    Double_t calibFactor = 1;
     for (Int_t iCell = 0; iCell < nEMcell; iCell++) {      
       aodEMcells.SetCell(iCell,aodinEMcells.GetCellNumber(iCell),aodinEMcells.GetAmplitude(iCell)*calibFactor);
     }
@@ -250,7 +247,6 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromESD()
 {
   
   // Copy Header, Vertex, CaloClusters and CaloCells from ESDs to AODs
-  
   AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
   
   // set arrays and pointers
@@ -303,13 +299,14 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromESD()
   vtx->GetCovMatrix(covVtx); //covariance matrix
   
   AliAODVertex * primary = new(vertices[jVertices++])
-    AliAODVertex(pos, covVtx, vtx->GetChi2toNDF(), NULL, -1, AliAODVertex::kPrimary);
+  AliAODVertex(pos, covVtx, vtx->GetChi2toNDF(), NULL, -1, AliAODVertex::kPrimary);
   primary->SetName(vtx->GetName());
   primary->SetTitle(vtx->GetTitle());
   
   // Access to the AOD container of clusters
   TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters());
   Int_t jClusters=0;
+  printf("nCaloClus %d\n",nCaloClus);
   
   for (Int_t iClust=0; iClust<nCaloClus; ++iClust) {
     
@@ -317,49 +314,52 @@ void AliAnalysisTaskEMCALPi0CalibSelection::CreateAODFromESD()
     
     //Check which calorimeter information we want to keep.
     if(!cluster->IsEMCAL())  continue ;
-       if(ClusterContainsBadChannel(cluster->GetCellsAbsId(), cluster->GetNCells())) continue; 
-         
+    printf("EMCAL cluster %d, ncells %d\n",iClust, cluster->GetNCells());
+    
+    if(ClusterContainsBadChannel(cluster->GetCellsAbsId(), cluster->GetNCells())) continue;    
+    printf("copy\n");
+    
     Int_t id       = cluster->GetID();
     Float_t energy = cluster->E();
     cluster->GetPosition(posF);
     
     AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) 
-      AliAODCaloCluster(id,
-                       0,
-                       0x0,
-                       energy,
-                       posF,
-                       NULL,
-                       AliAODCluster::kEMCALClusterv1);
+    AliAODCaloCluster(id,
+                      0,
+                      0x0,
+                      energy,
+                      posF,
+                      NULL,
+                      AliVCluster::kEMCALClusterv1);
     
     caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),
-                               cluster->GetClusterDisp(),
-                               cluster->GetM20(), cluster->GetM02(),
-                               cluster->GetEmcCpvDistance(),  
-                               cluster->GetNExMax(),cluster->GetTOF()) ;
+                                cluster->GetDispersion(),
+                                cluster->GetM20(), cluster->GetM02(),
+                                cluster->GetEmcCpvDistance(),  
+                                cluster->GetNExMax(),cluster->GetTOF()) ;
     
-    caloCluster->SetPIDFromESD(cluster->GetPid());
+    caloCluster->SetPIDFromESD(cluster->GetPID());
     caloCluster->SetNCells(cluster->GetNCells());
     caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());
     caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());
-
+    
   } 
-
+  
   caloClusters.Expand(jClusters); // resize TObjArray
   // end of loop on calo clusters
   
   // fill EMCAL cell info
-
+  
   if( esd->GetEMCALCells()) { // protection against missing ESD information
     AliESDCaloCells &esdEMcells = *(esd->GetEMCALCells());
-       Int_t nEMcell = esdEMcells.GetNumberOfCells() ;
+    Int_t nEMcell = esdEMcells.GetNumberOfCells() ;
     
     AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells());
     aodEMcells.CreateContainer(nEMcell);
-    aodEMcells.SetType(AliAODCaloCells::kEMCAL);  
+    aodEMcells.SetType(AliAODCaloCells::kEMCALCell);  
          
-       Double_t calibFactor = 1;   
-       for (Int_t iCell = 0; iCell < nEMcell; iCell++) {      
+    Double_t calibFactor = 1;   
+    for (Int_t iCell = 0; iCell < nEMcell; iCell++) {      
       aodEMcells.SetCell(iCell,esdEMcells.GetCellNumber(iCell),esdEMcells.GetAmplitude(iCell)*calibFactor);
     }
     aodEMcells.Sort();
@@ -485,7 +485,7 @@ void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */)
   for(Int_t iClu=0; iClu<kNumberOfEMCALClusters; iClu++) {
     
     AliAODCaloCluster *c1 = (AliAODCaloCluster *) caloClustersArr->At(iClu);
-    if(!fCopyAOD && kESD && ClusterContainsBadChannel(c1->GetCellsAbsId(), c1->GetNCells())) continue; 
+    if(!fCopyAOD && ClusterContainsBadChannel(c1->GetCellsAbsId(), c1->GetNCells())) continue; 
     
     Float_t e1i = c1->E();   // cluster energy before correction   
     if(e1i < fEmin) continue;
@@ -533,7 +533,7 @@ void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */)
     for (Int_t jClu=iClu; jClu<kNumberOfEMCALClusters; jClu++) {
       AliAODCaloCluster *c2 = (AliAODCaloCluster *) caloClustersArr->At(jClu);
       if(c2->IsEqual(c1)) continue;
-      if(!fCopyAOD && kESD && ClusterContainsBadChannel(c2->GetCellsAbsId(), c2->GetNCells())) continue;       
+      if(!fCopyAOD && ClusterContainsBadChannel(c2->GetCellsAbsId(), c2->GetNCells())) continue;       
       
       Float_t e2i = c2->E();
       if(e2i < fEmin) continue;
index 2578d36..563440c 100644 (file)
@@ -132,7 +132,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD()
   //
   //
   Int_t nVertices = 1 ;/* = prim. vtx*/;
-  Int_t nCaloClus = aod->GetNCaloClusters();
+  Int_t nCaloClus = aod->GetNumberOfCaloClusters();
   
   AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0);
   
@@ -161,7 +161,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD()
     AliAODCaloCluster * cluster = aod->GetCaloCluster(iClust);
     
     //Check if it is a PHOS cluster
-    if(!cluster->IsPHOSCluster())  continue ;
+    if(!cluster->IsPHOS())  continue ;
     
     Int_t id       = cluster->GetID();
     Float_t energy = cluster->E();
@@ -177,13 +177,13 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD()
                        NULL,
                        ttype);
     
-    caloCluster->SetCaloCluster(cluster->GetDistToBadChannel(),
+    caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),
                                cluster->GetDispersion(),
                                cluster->GetM20(), cluster->GetM02(),
                                cluster->GetEmcCpvDistance(),  
                                cluster->GetNExMax(),cluster->GetTOF()) ;
     
-    caloCluster->SetPIDFromESD(cluster->PID());
+    caloCluster->SetPIDFromESD(cluster->GetPID());
     caloCluster->SetNCells(cluster->GetNCells());
     caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());
     caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());
@@ -200,7 +200,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD()
     
     AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells());
     aodPHcells.CreateContainer(nPHcell);
-    aodPHcells.SetType(AliAODCaloCells::kPHOS);
+    aodPHcells.SetType(AliVCaloCells::kPHOSCell);
     for (Int_t iCell = 0; iCell < nPHcell; iCell++) {      
       aodPHcells.SetCell(iCell,aodinPHcells.GetCellNumber(iCell),aodinPHcells.GetAmplitude(iCell));
     }
@@ -297,12 +297,12 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromESD()
                        AliAODCluster::kPHOSNeutral);
     
     caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(),
-                               cluster->GetClusterDisp(),
+                               cluster->GetDispersion(),
                                cluster->GetM20(), cluster->GetM02(),
                                cluster->GetEmcCpvDistance(),  
                                cluster->GetNExMax(),cluster->GetTOF()) ;
     
-    caloCluster->SetPIDFromESD(cluster->GetPid());
+    caloCluster->SetPIDFromESD(cluster->GetPID());
     caloCluster->SetNCells(cluster->GetNCells());
     caloCluster->SetCellsAbsId(cluster->GetCellsAbsId());
     caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction());
@@ -318,7 +318,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromESD()
     
     AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells());
     aodPHcells.CreateContainer(nPHcell);
-    aodPHcells.SetType(AliAODCaloCells::kPHOS);
+    aodPHcells.SetType(AliVCaloCells::kPHOSCell);
     for (Int_t iCell = 0; iCell < nPHcell; iCell++) {      
       aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell));
     }
@@ -427,7 +427,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::UserExec(Option_t* /* option */)
   for(Int_t iClu=0; iClu<kNumberOfPhosClusters; iClu++) {
     
     AliAODCaloCluster *c1 = (AliAODCaloCluster *) caloClustersArr->At(iClu);
-    if(!c1->IsPHOSCluster()) continue; // EMCAL cluster!
+    if(!c1->IsPHOS()) continue; // EMCAL cluster!
 
     Float_t e1i = c1->E();   // cluster energy before correction
     if(e1i<fEmin) continue;
@@ -449,7 +449,7 @@ void AliAnalysisTaskPHOSPi0CalibSelection::UserExec(Option_t* /* option */)
     
     for (Int_t jClu=iClu; jClu<kNumberOfPhosClusters; jClu++) {
       AliAODCaloCluster *c2 = (AliAODCaloCluster *) caloClustersArr->At(jClu);
-      if(!c2->IsPHOSCluster())   continue; // EMCAL cluster!
+      if(!c2->IsPHOS())   continue; // EMCAL cluster!
       if(c2->IsEqual(c1)) continue;
 
       Float_t e2i = c2->E();
index 12e5c82..5bc958a 100755 (executable)
@@ -401,7 +401,7 @@ void AliJCORRANTask::ReadESDTracks(const AliESDEvent * esd)
         ctrack->SetPhi(p3.Phi());
         ctrack->SetPID(pid);
         ctrack->SetFlavor(kNone);//kHadron);
-       ctrack->SetCharge(track->Charge());
+        ctrack->SetCharge(track->Charge());
         ctrack->ConvertAliPID();
         ctrack->SetEta(eta);
 
@@ -478,15 +478,15 @@ void AliJCORRANTask::ReadESDCaloClusters(const AliESDEvent* esd)
   for(Int_t icluster = 0 ; icluster < numberOfCaloClusters ; icluster++) {
     AliESDCaloCluster *caloCluster = esd->GetCaloCluster(icluster) ;
     if(!caloCluster) continue;
-    if(caloCluster->GetTrackMatched()==-1){
+    if(caloCluster->GetTrackMatchedIndex()==-1){
       if(caloCluster->E()<fLowerCutOnCaloClusterE) continue;                  //FK//
       // we will not implement any PID cut here      
       fPhotonList->AddAliJPhoton(nPhotons);
       AliJPhoton *pht = fPhotonList->GetAliJPhoton(nPhotons);
       pht->SetFlavor(kPhoton);
       pht->SetE(caloCluster->E());
-      pht->SetChi2(caloCluster->GetClusterChi2());
-      pht->SetPID(caloCluster->GetPid());
+      pht->SetChi2(caloCluster->Chi2());
+      pht->SetPID(caloCluster->GetPID());
       Float_t pos[3]; caloCluster->GetPosition(pos) ;
       pht->SetX(pos[0]);
       pht->SetY(pos[1]);
@@ -498,7 +498,7 @@ void AliJCORRANTask::ReadESDCaloClusters(const AliESDEvent* esd)
       if(caloCluster->IsEMCAL()) pht->SetCaloType(AliJPhoton::kEMCALCalo);
       if(caloCluster->IsPHOS())  pht->SetCaloType(AliJPhoton::kPHOSCalo);
       pht->SetDistToBadChannel(caloCluster->GetDistanceToBadChannel());
-      pht->SetDispersion(caloCluster->GetClusterDisp());
+      pht->SetDispersion(caloCluster->GetDispersion());
       pht->SetM20(caloCluster->GetM20());
       pht->SetM02(caloCluster->GetM02());
       pht->SetEmcCpvDist(caloCluster->GetEmcCpvDistance());
@@ -517,7 +517,7 @@ void AliJCORRANTask::ReadESDCaloClusters(const AliESDEvent* esd)
 void AliJCORRANTask::ReadAODCaloClusters(const AliAODEvent* aod)
 {
   // Read the AliAODCaloClusters and fill the list of AliJPhoton containers
-  Int_t numberOfCaloClusters = aod->GetNCaloClusters() ;
+  Int_t numberOfCaloClusters = aod->GetNumberOfCaloClusters() ;
   if(fDebug < 5) cout << "AOD::number of ESD caloclusters " << numberOfCaloClusters << endl;
   Short_t nPhotons = 0;
   for(Int_t icluster = 0 ; icluster < numberOfCaloClusters ; icluster++) {
@@ -531,7 +531,7 @@ void AliJCORRANTask::ReadAODCaloClusters(const AliAODEvent* aod)
       pht->SetE(caloCluster->E());
       pht->SetFlavor(kPhoton);
       pht->SetChi2(caloCluster->Chi2());
-      pht->SetPID((Double_t*)caloCluster->PID());
+      pht->SetPID((Double_t*)caloCluster->GetPID());
       Float_t pos[3]; caloCluster->GetPosition(pos) ;
       pht->SetX(pos[0]);
       pht->SetY(pos[1]);
@@ -540,16 +540,16 @@ void AliJCORRANTask::ReadAODCaloClusters(const AliAODEvent* aod)
       pht->SetTheta(atan2(sqrt(pos[0]*pos[1]+pos[1]*pos[1]),pos[2]));
       pht->SetPt(caloCluster->E()*sin(atan2(sqrt(pos[0]*pos[0]+pos[1]*pos[1]),pos[2])));
       pht->SetCharge(0);
-      if(caloCluster->IsEMCALCluster()) pht->SetCaloType(AliJPhoton::kEMCALCalo);
-      if(caloCluster->IsPHOSCluster())  pht->SetCaloType(AliJPhoton::kPHOSCalo);
-      pht->SetDistToBadChannel(caloCluster->GetDistToBadChannel());
+      if(caloCluster->IsEMCAL()) pht->SetCaloType(AliJPhoton::kEMCALCalo);
+      if(caloCluster->IsPHOS())  pht->SetCaloType(AliJPhoton::kPHOSCalo);
+      pht->SetDistToBadChannel(caloCluster->GetDistanceToBadChannel());
       pht->SetDispersion(caloCluster->GetDispersion());
       pht->SetM20(caloCluster->GetM20());
       pht->SetM02(caloCluster->GetM02());
       pht->SetEmcCpvDist(caloCluster->GetEmcCpvDistance());
       pht->SetNCells(int(caloCluster->GetNCells()));
       pht->SetCellsAbsId(caloCluster->GetCellsAbsId());
-      Int_t imoduleID = GetSuperModuleNumber(caloCluster->IsEMCALCluster(), caloCluster->GetCellAbsId(0));
+      Int_t imoduleID = GetSuperModuleNumber(caloCluster->IsEMCAL(), caloCluster->GetCellAbsId(0));
       pht->SetSuperModuleID(imoduleID);
       
       fPhotonList->SetNPhotons(++nPhotons);
@@ -709,7 +709,7 @@ bool AliJCORRANTask::ContainsESDHighECaloClusters(){
     for(Int_t icluster = 0 ; icluster < numberOfCaloClusters ; icluster++) {
       AliESDCaloCluster *caloCluster = esd->GetCaloCluster(icluster) ;
       if(!caloCluster) continue;
-      if(caloCluster->GetTrackMatched()==-1){
+      if(caloCluster->GetTrackMatchedIndex()==-1){
         //sotre calo clusters above 1 GeV
         if( caloCluster->E() > fLowerCutOnLeadingCaloClusterE){
           isThisEventToBeStored = kTRUE;
@@ -726,7 +726,7 @@ bool AliJCORRANTask::ContainsESDHighECaloClusters(){
       aod = (AliAODEvent*)InputEvent();
     }
 
-    Int_t numberOfCaloClusters = aod->GetNCaloClusters() ;
+    Int_t numberOfCaloClusters = aod->GetNumberOfCaloClusters() ;
     // loop over all the Calo Clusters
     for(Int_t icluster = 0 ; icluster < numberOfCaloClusters ; icluster++) {
       AliAODCaloCluster *caloCluster = aod->GetCaloCluster(icluster) ;
index fc0ee62..08577dc 100755 (executable)
@@ -13,6 +13,7 @@
 #pragma link C++ class AliAnaPartCorrMaker+;
 #pragma link C++ class AliAnaPartCorrBaseClass+;
 #pragma link C++ class AliAnalysisTaskParticleCorrelation+;
+#pragma link C++ class AliAnalysisTaskParticleCorrelationM+;
 #pragma link C++ class AliCaloTrackReader+;
 #pragma link C++ class AliCaloTrackESDReader+;
 #pragma link C++ class AliCaloTrackAODReader+;
index b7907d4..030b581 100755 (executable)
@@ -37,6 +37,8 @@
 #include "AliAODEvent.h"
 #include "AliAODHandler.h"
 #include "AliAnalysisManager.h"
+#include "AliMixedEvent.h"
+#include "AliAODPWG4Particle.h"
 
 ClassImp(AliAnaPartCorrBaseClass)
   
@@ -57,7 +59,7 @@ ClassImp(AliAnaPartCorrBaseClass)
     fHistoPhiBins(0),  fHistoPhiMax(0.),  fHistoPhiMin(0.),
     fHistoEtaBins(0),  fHistoEtaMax(0.),  fHistoEtaMin(0.),
     fHistoMassBins(0), fHistoMassMax(0.), fHistoMassMin(0.),
-    fHistoAsymBins(0), fHistoAsymMax(0.), fHistoAsymMin(0.)
+    fHistoAsymBins(0), fHistoAsymMax(0.), fHistoAsymMin(0.), fMixedEvent(NULL), fNMixedEvent(1), fVertex(NULL)
 {
   //Default Ctor
     
@@ -180,6 +182,14 @@ AliAnaPartCorrBaseClass::~AliAnaPartCorrBaseClass()
   if(fIC)        delete fIC ;
   if(fMCUtils)   delete fMCUtils ;
   if(fNMS)       delete fNMS ;
+  
+  if (fMixedEvent) {
+    for (Int_t i = 0; i < fNMixedEvent; i++) {
+      delete [] fVertex[i] ; 
+    }
+  }
+  delete [] fVertex ;  
+  
 //   printf("--- analysis deleted \n");
 }
 
@@ -517,7 +527,7 @@ void AliAnaPartCorrBaseClass::InitParameters()
   fHistoAsymBins  = 10 ;
   fHistoAsymMax   = 1. ;
   fHistoAsymMin   = 0. ;
-       
+       
 }
 
 //__________________________________________________________________
@@ -550,3 +560,26 @@ void AliAnaPartCorrBaseClass::Print(const Option_t * opt) const
   printf("    \n") ;
   
 } 
+
+//__________________________________________________________________
+AliMixedEvent * AliAnaPartCorrBaseClass::GetMixedEvent() 
+{ 
+    //gets the mixed event objects and does some setting
+  if (!fMixedEvent) {
+    fMixedEvent = dynamic_cast<AliMixedEvent*>(GetReader()->GetInputEvent()) ; 
+    if (fMixedEvent) {
+      fNMixedEvent = fMixedEvent->GetNumberOfEvents() ; 
+    }
+    fVertex = new Double_t*[fNMixedEvent] ; 
+    for (Int_t i = 0; i < fNMixedEvent; i++) {
+      fVertex[i] = new Double_t[3] ; 
+      fVertex[i][0] = 0.0 ; 
+      fVertex[i][1] = 0.0 ; 
+      fVertex[i][2] = 0.0 ; 
+    }          
+  }  
+  return fMixedEvent ; 
+}
+
+
+
index 42fe305..61d3d58 100755 (executable)
@@ -4,20 +4,20 @@
  * See cxx source for full Copyright notice     */
 /* $Id: $ */
 
-//_________________________________________________________________________
-// Base class for analysis algorithms
-//-- Author: Gustavo Conesa (INFN-LNF)
+  //_________________________________________________________________________
+  // Base class for analysis algorithms
+  //-- Author: Gustavo Conesa (INFN-LNF)
 
 #include <cstdlib>
 
-//ROOT
+  //ROOT
 class TClonesArray ;
 class TObjArray ;
 #include <TList.h> 
 #include <TObject.h>
 class TObjString;
 
-//Analysis
+  //Analysis
 class AliESDCaloCluster;
 class AliAODCaloCluster;
 class AliAODCaloCells;
@@ -34,28 +34,29 @@ class AliGenEventHeader ;
 #include "AliAODPWG4ParticleCorrelation.h"
 class AliEMCALGeoUtils;
 class AliPHOSGeoUtils;
+#include "AliMixedEvent.h" 
 
 class AliAnaPartCorrBaseClass : public TObject {
        
- public:   
+public:   
   AliAnaPartCorrBaseClass() ; // default ctor
   virtual ~AliAnaPartCorrBaseClass() ; //virtual dtor
   
- private:
+private:
   AliAnaPartCorrBaseClass(const AliAnaPartCorrBaseClass & g) ; // cpy ctor
   AliAnaPartCorrBaseClass & operator = (const AliAnaPartCorrBaseClass & g) ;//cpy assignment
   
- public:
-  //   virtual void AddAODCaloCluster(AliAODCaloCluster calo) ;
+public:
+    // virtual void AddAODCaloCluster(AliAODCaloCluster calo) ;
   virtual void AddAODParticle(AliAODPWG4Particle part) ;
   
-//     virtual void ConnectAODCaloClusters();
+    // virtual void ConnectAODCaloClusters();
   virtual void ConnectAODPHOSCells();
   virtual void ConnectAODEMCALCells();
   virtual void ConnectInputOutputAODBranches();
   
   virtual TList * GetCreateOutputObjects()      { return (new TList) ;}
-  //virtual TList * GetAnalysisOutputContainer()  { return fAnaOutContainer ;} 
+    //virtual TList * GetAnalysisOutputContainer()  { return fAnaOutContainer ;} 
        
   virtual void AddToHistogramsName(TString add) { fAddToHistogramsName = add; }  
   virtual TString GetAddedHistogramsStringToName() {return fAddToHistogramsName ;}
@@ -77,26 +78,26 @@ class AliAnaPartCorrBaseClass : public TObject {
   virtual void SetDebug(Int_t d)   { fDebug = d ; }
   
   virtual Int_t GetEventNumber() const ;
-               
+  
   virtual AliCaloTrackReader * GetReader() const {return fReader ; }
   virtual void SetReader(AliCaloTrackReader * const reader) { fReader = reader ; }
   
-  //Calorimeter helper class access methods
+    //Calorimeter helper class access methods
   AliEMCALGeoUtils *  GetEMCALGeometry() const { return fCaloUtils->GetEMCALGeometry(); }
   AliPHOSGeoUtils  *  GetPHOSGeometry()  const { return fCaloUtils->GetPHOSGeometry() ; }
-
+  
   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);}
   Int_t GetModuleNumber(AliAODPWG4Particle * part) const {
          return fCaloUtils->GetModuleNumber(part, fReader->GetInputEvent());}
-  Int_t GetModuleNumber(AliESDCaloCluster * cluster) const {
-         return fCaloUtils->GetModuleNumber(cluster);}
-  Int_t GetModuleNumber(AliAODCaloCluster * cluster) const {
+  Int_t GetModuleNumber(AliVCluster * cluster) const {
          return fCaloUtils->GetModuleNumber(cluster);}
+    //  Int_t GetModuleNumber(AliAODCaloCluster * cluster) const {
+    //   return fCaloUtils->GetModuleNumber(cluster);}
        
   virtual void Terminate(TList * /*outputList*/) {;}
        
-  //analysis AOD branch
+    //analysis AOD branch
   virtual TClonesArray * GetCreateOutputAODBranch() ;
   virtual TString GetInputAODName() const {return fInputAODName ; }
   virtual void SetInputAODName(TString name)   { fInputAODName = name; }       
@@ -110,12 +111,12 @@ class AliAnaPartCorrBaseClass : public TObject {
        
   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 ;
        
-//     virtual TClonesArray* GetAODCaloClusters() const {return fAODCaloClusters ;}
+    // virtual TClonesArray* GetAODCaloClusters() const {return fAODCaloClusters ;}
   virtual TClonesArray* GetAODCaloClusters() const ;
   virtual TClonesArray* GetAODTracks() const ; 
   virtual AliAODCaloCells* GetAODCaloCells() const {return fAODCaloCells ;}
@@ -133,7 +134,7 @@ class AliAnaPartCorrBaseClass : public TObject {
   virtual AliHeader* GetMCHeader() const ;
   virtual AliGenEventHeader* GetMCGenEventHeader() const ;
   
-  //Analysis helpers classes pointers setters and getters
+    //Analysis helpers classes pointers setters and getters
   virtual AliCaloPID * GetCaloPID() {if(!fCaloPID) fCaloPID = new AliCaloPID(); return  fCaloPID ;}
   virtual void SetCaloPID(AliCaloPID * const pid) { fCaloPID = pid ;}
   
@@ -152,7 +153,7 @@ class AliAnaPartCorrBaseClass : public TObject {
   virtual Bool_t     IsDataMC()       {return fDataMC ; }
   virtual void SwitchOnDataMC()       {fDataMC = kTRUE ; if(!fMCUtils)fMCUtils = new AliMCAnalysisUtils();}
   virtual void SwitchOffDataMC()      {fDataMC = kFALSE ; }
-
+  
   virtual Bool_t IsFiducialCutOn()       { return fCheckFidCut ; }
   virtual void SwitchOnFiducialCut()     { fCheckFidCut = kTRUE;  if(!fFidCut)fFidCut = new AliFiducialCut();}
   virtual void SwitchOffFiducialCut()    { fCheckFidCut = kFALSE;}
@@ -172,8 +173,8 @@ class AliAnaPartCorrBaseClass : public TObject {
   virtual void SetPtCutRange(Double_t ptmin, Double_t ptmax)
   {  fMaxPt=ptmax;   fMinPt=ptmin;}
   
-  //Histogrammes setters and getters
-  //Pt, Energy 
+    //Histogrammes setters and getters
+    //Pt, Energy 
   virtual void SetHistoPtRangeAndNBins(Float_t min, Float_t max, Int_t n) {
     fHistoPtBins = n ;
     fHistoPtMax = max ;
@@ -184,7 +185,7 @@ class AliAnaPartCorrBaseClass : public TObject {
   virtual Float_t GetHistoPtMin()   const { return fHistoPtMin ; }
   virtual Float_t GetHistoPtMax()   const { return fHistoPtMax ; }
   
-  //Azimuthal angle
+    //Azimuthal angle
   virtual void SetHistoPhiRangeAndNBins(Float_t min, Float_t max, Int_t n) {
     fHistoPhiBins  = n ;
     fHistoPhiMax   = max ;
@@ -195,7 +196,7 @@ class AliAnaPartCorrBaseClass : public TObject {
   virtual Float_t GetHistoPhiMin()   const { return fHistoPhiMin ; }
   virtual Float_t GetHistoPhiMax()   const { return fHistoPhiMax ; }
   
-  //Pseudorapidity-rapidity
+    //Pseudorapidity-rapidity
   virtual void SetHistoEtaRangeAndNBins(Float_t min, Float_t max, Int_t n) {
     fHistoEtaBins = n ;
     fHistoEtaMax  = max ;
@@ -206,29 +207,34 @@ class AliAnaPartCorrBaseClass : public TObject {
   virtual Float_t GetHistoEtaMin()   const { return fHistoEtaMin ; }
   virtual Float_t GetHistoEtaMax()   const { return fHistoEtaMax ; }
   
-  //Mass
+    //Mass
   virtual void SetHistoMassRangeAndNBins(Float_t min, Float_t max, Int_t n) {
-       fHistoMassBins = n ;
-       fHistoMassMax  = max ;
-       fHistoMassMin  = min ;
+    fHistoMassBins = n ;
+    fHistoMassMax  = max ;
+    fHistoMassMin  = min ;
   }
        
   virtual Int_t   GetHistoMassBins()  const { return fHistoMassBins ; }
   virtual Float_t GetHistoMassMin()   const { return fHistoMassMin ; }
   virtual Float_t GetHistoMassMax()   const { return fHistoMassMax ; }
        
-  //Asymetry
+    //Asymetry
   virtual void SetHistoAsymmetryRangeAndNBins(Float_t min, Float_t max, Int_t n) {
-       fHistoAsymBins = n ;
-       fHistoAsymMax  = max ;
-       fHistoAsymMin  = min ;
+    fHistoAsymBins = n ;
+    fHistoAsymMax  = max ;
+    fHistoAsymMin  = min ;
   }
        
   virtual Int_t   GetHistoAsymmetryBins()  const { return fHistoAsymBins ; }
   virtual Float_t GetHistoAsymmetryMin()   const { return fHistoAsymMin ; }
   virtual Float_t GetHistoAsymmetryMax()   const { return fHistoAsymMax ; }    
+  
+  virtual AliMixedEvent * GetMixedEvent() ; 
+  Int_t GetNMixedEvent() const { return fNMixedEvent ; } 
+  Double_t *  GetVertex(Int_t i) const { return fVertex[i] ; } 
+
        
- private:    
+private:    
   
   Bool_t  fDataMC ;             // Flag to access MC data when using ESD or AOD     
   Int_t   fDebug ;              // Debug level
@@ -249,20 +255,20 @@ class AliAnaPartCorrBaseClass : public TObject {
   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
   
-  //TClonesArray* fAODCaloClusters ;  //! selected PHOS/EMCAL CaloClusters
+    //TClonesArray* fAODCaloClusters ;  //! selected PHOS/EMCAL CaloClusters
   AliAODCaloCells * fAODCaloCells ; //! selected PHOS/EMCAL CaloCells
   
-  //Analysis helper classes access pointers
+    //Analysis helper classes access pointers
   AliCaloPID               * fCaloPID; //! PID calculation
   AliFiducialCut           * fFidCut;  //! Acceptance cuts
   AliIsolationCut          * fIC;      //! Isolation cut 
   AliMCAnalysisUtils       * fMCUtils; //! MonteCarlo Analysis utils 
   AliNeutralMesonSelection * fNMS;     //! Neutral Meson Selection
   AliCalorimeterUtils      * fCaloUtils ; //  Pointer to CalorimeterUtils
-
-  //TList * fAnaOutContainer;  // Temporal histogram output container, contents to be added to the main container passed to the main analysis frame
-
-  //Histograms binning and range    
+  
+    //TList * fAnaOutContainer;        // Temporal histogram output container, contents to be added to the main container passed to the main analysis frame
+  
+    //Histograms binning and range    
   Int_t   fHistoPtBins   ;  // Number of bins in pt axis
   Float_t fHistoPtMax    ;  // Maximum value of pt histogram range
   Float_t fHistoPtMin    ;  // Minimum value of pt histogram range
@@ -278,9 +284,15 @@ class AliAnaPartCorrBaseClass : public TObject {
   Int_t   fHistoAsymBins ;  // Number of bins in asymmetry axis
   Float_t fHistoAsymMax  ;  // Maximum value of asymmetry histogram range
   Float_t fHistoAsymMin  ;  // Minimum value of asymmetry histogram range
+  
+  AliMixedEvent * fMixedEvent ;  //! mixed event object
+  Int_t           fNMixedEvent ; //! number of events in mixed event buffer
+  Double_t **     fVertex ;      //! vertex array 3 dim for each mixed event buffer
+
+  
        
   ClassDef(AliAnaPartCorrBaseClass,7)
-    } ;
+} ;
 
 
 #endif //ALIANAPARTCORRBASECLASS_H
diff --git a/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.cxx
new file mode 100755 (executable)
index 0000000..a7a81b1
--- /dev/null
@@ -0,0 +1,226 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+/* $Id$ */
+
+//_________________________________________________________________________
+// 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)
+
+#include <cstdlib>
+
+// --- Root ---
+#include <TROOT.h>
+#include <TInterpreter.h>
+#include <TClonesArray.h>
+//#include <Riostream.h>
+//#include <TObjectTable.h>
+
+// --- Analysis ---
+#include "AliAnalysisTaskParticleCorrelationM.h"
+#include "AliAnaPartCorrMaker.h"
+#include "AliCaloTrackReader.h"
+#include "AliPDG.h"
+#include "AliAnalysisManager.h"
+#include "AliMultiEventInputHandler.h"
+#include "AliMixedEvent.h"
+#include "AliAODEvent.h"
+#include "AliESDEvent.h"
+
+ClassImp(AliAnalysisTaskParticleCorrelationM)
+
+////////////////////////////////////////////////////////////////////////
+AliAnalysisTaskParticleCorrelationM::AliAnalysisTaskParticleCorrelationM():
+  AliAnalysisTaskME(),
+  fAna(0x0),
+  fOutputContainer(0x0),
+  fConfigName(""), fCuts(0x0), fInputEvent(NULL)
+{
+  // Default constructor
+}
+
+//_____________________________________________________
+AliAnalysisTaskParticleCorrelationM::AliAnalysisTaskParticleCorrelationM(const char* name):
+  AliAnalysisTaskME(name),
+  fAna(0x0),
+  fOutputContainer(0x0),
+  fConfigName(""), fCuts(0x0), fInputEvent(NULL)
+{
+  // Default constructor
+  
+  DefineOutput(1, TList::Class());
+  DefineOutput(2, TList::Class());  // will contain cuts or local params
+}
+
+//_____________________________________________________
+AliAnalysisTaskParticleCorrelationM::~AliAnalysisTaskParticleCorrelationM() 
+{
+  // Remove all pointers
+       
+//     printf("********** Delete Task\n");
+//  // Do not delete it here, already done somewhere else, need to understand where.
+//  if(fOutputContainer){
+//    fOutputContainer->Clear() ; 
+//    delete fOutputContainer ;
+//  }
+
+  delete fInputEvent ; 
+  if(fAna) delete fAna;
+
+//  printf("********** Task deleted \n");
+}
+
+//_____________________________________________________
+void AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects()
+{
+  // Create the output container
+  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() - Begin\n");
+  
+  //Get list of aod arrays, add each aod array to analysis frame 
+  TClonesArray *array = 0;
+  TList * list = fAna->GetAODBranchList();
+  TString deltaAODName = (fAna->GetReader())->GetDeltaAODFileName();
+  for(Int_t iaod = 0; iaod < list->GetEntries(); iaod++){
+    array = (TClonesArray*) list->At(iaod);
+       if(deltaAODName!="") AddAODBranch("TClonesArray", &array, deltaAODName);//Put it in DeltaAOD file
+       else AddAODBranch("TClonesArray", &array);//Put it in standard AOD file
+  } 
+       
+  //Histograms container
+  OpenFile(1);
+  fOutputContainer = fAna->GetOutputContainer();
+  fOutputContainer->SetOwner(kTRUE);
+  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::UserCreateOutputObjects() - End\n");
+  PostData(1,fOutputContainer);
+       
+}
+//_____________________________________________________
+void AliAnalysisTaskParticleCorrelationM::LocalInit()
+{
+       // Local Initialization
+       
+       //Call the Init to initialize the configuration of the analysis
+       Init();
+       
+       // Create cuts/param objects and publish to slot
+       fCuts = fAna->GetListOfAnalysisCuts();
+       
+       // Post Data
+       PostData(2, fCuts);
+       
+}
+
+//_____________________________________________________
+void AliAnalysisTaskParticleCorrelationM::Init()
+{
+  // Initialization
+  if (DebugLevel() > 1) printf("AliAnalysisTaskParticleCorrelationM::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()");
+  }
+  
+  if(!fAna) {
+       printf("AliAnalysisTaskParticleCorrelationM::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");
+  
+}
+
+
+//_____________________________________________________
+void AliAnalysisTaskParticleCorrelationM::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
+  Int_t  datatype = fAna->GetReader()->GetDataType();
+  if(datatype != AliCaloTrackReader::kESD && datatype != AliCaloTrackReader::kAOD &&
+     datatype != AliCaloTrackReader::kMC){
+    printf("AliAnalysisTaskParticleCorrelationM::UserExec() - Wrong type of data\n");
+    return ;
+  }
+
+  Int_t nev = fInputHandler->GetBufferSize();
+  fInputEvent->Reset();
+  
+  for (Int_t iev = 0; iev < nev; iev++) {
+    if (datatype == AliCaloTrackReader::kESD) {
+      AliESDEvent* esd = dynamic_cast<AliESDEvent*>(GetEvent(iev));
+      fInputEvent->AddEvent(esd);
+    } else if (datatype == AliCaloTrackReader::kAOD) {
+      AliAODEvent* aod = dynamic_cast<AliAODEvent*>(GetEvent(iev));
+      fInputEvent->AddEvent(aod);
+    } 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");
+       
+  PostData(1, fOutputContainer);
+       
+  //gObjectTable->Print();
+
+  
+}
+
+//_____________________________________________________
+void AliAnalysisTaskParticleCorrelationM::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/AliAnalysisTaskParticleCorrelationM.h b/PWG4/PartCorrBase/AliAnalysisTaskParticleCorrelationM.h
new file mode 100755 (executable)
index 0000000..1cedd5a
--- /dev/null
@@ -0,0 +1,59 @@
+#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
index 5bc5eb6..b80f755 100755 (executable)
@@ -250,24 +250,24 @@ Int_t AliCaloPID::GetPdg(const TString calo, const Double_t * pid, const Float_t
   }
   
   if(fDebug > 0)  printf("AliCaloPID::GetPdg: calo %s, ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n",
-                        calo.Data(),pid[AliAODCluster::kPhoton], pid[AliAODCluster::kPi0],
-                        pid[AliAODCluster::kElectron], pid[AliAODCluster::kEleCon],
-                        pid[AliAODCluster::kPion], pid[AliAODCluster::kKaon], pid[AliAODCluster::kProton],
-                        pid[AliAODCluster::kNeutron], pid[AliAODCluster::kKaon0]);
+                        calo.Data(),pid[AliVCluster::kPhoton], pid[AliVCluster::kPi0],
+                        pid[AliVCluster::kElectron], pid[AliVCluster::kEleCon],
+                        pid[AliVCluster::kPion], pid[AliVCluster::kKaon], pid[AliVCluster::kProton],
+                        pid[AliVCluster::kNeutron], pid[AliVCluster::kKaon0]);
   
   Int_t pdg = kNeutralUnknown ;
-  Float_t chargedHadronWeight = pid[AliAODCluster::kProton]+pid[AliAODCluster::kKaon]+
-    pid[AliAODCluster::kPion]+pid[AliAODCluster::kMuon];
-  Float_t neutralHadronWeight = pid[AliAODCluster::kNeutron]+pid[AliAODCluster::kKaon0];
-  Float_t allChargedWeight    = pid[AliAODCluster::kElectron]+pid[AliAODCluster::kEleCon]+ chargedHadronWeight;
-  Float_t allNeutralWeight    = pid[AliAODCluster::kPhoton]+pid[AliAODCluster::kPi0]+ neutralHadronWeight;
+  Float_t chargedHadronWeight = pid[AliVCluster::kProton]+pid[AliVCluster::kKaon]+
+    pid[AliVCluster::kPion]+pid[AliVCluster::kMuon];
+  Float_t neutralHadronWeight = pid[AliVCluster::kNeutron]+pid[AliVCluster::kKaon0];
+  Float_t allChargedWeight    = pid[AliVCluster::kElectron]+pid[AliVCluster::kEleCon]+ chargedHadronWeight;
+  Float_t allNeutralWeight    = pid[AliVCluster::kPhoton]+pid[AliVCluster::kPi0]+ neutralHadronWeight;
   
   //Select most probable ID
   if(calo=="PHOS"){
-    if(pid[AliAODCluster::kPhoton] > wPh) pdg = kPhoton ;
-    else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ; 
-    else if(pid[AliAODCluster::kElectron] > wE)  pdg = kElectron ;
-    else if(pid[AliAODCluster::kEleCon] >  wE) pdg = kEleCon ;
+    if(pid[AliVCluster::kPhoton] > wPh) pdg = kPhoton ;
+    else if(pid[AliVCluster::kPi0] > wPi0) pdg = kPi0 ; 
+    else if(pid[AliVCluster::kElectron] > wE)  pdg = kElectron ;
+    else if(pid[AliVCluster::kEleCon] >  wE) pdg = kEleCon ;
     else if(chargedHadronWeight > wCh) pdg = kChargedHadron ;  
     else if(neutralHadronWeight > wNe) pdg = kNeutralHadron ; 
     else if(allChargedWeight >  allNeutralWeight)
@@ -277,10 +277,10 @@ Int_t AliCaloPID::GetPdg(const TString calo, const Double_t * pid, const Float_t
   }
   else{//EMCAL
 
-    if(pid[AliAODCluster::kPhoton]+pid[AliAODCluster::kElectron]  > wPh) pdg = kPhoton ; //temporal sollution until track matching for electrons is considered
-    //if(pid[AliAODCluster::kPhoton]  > wPh) pdg = kPhoton ;
-    else if(pid[AliAODCluster::kPi0] > wPi0) pdg = kPi0 ; 
-    //else if(pid[AliAODCluster::kElectron]  > wE) pdg = kElectron ;
+    if(pid[AliVCluster::kPhoton]+pid[AliVCluster::kElectron]  > wPh) pdg = kPhoton ; //temporal sollution until track matching for electrons is considered
+    //if(pid[AliVCluster::kPhoton]  > wPh) pdg = kPhoton ;
+    else if(pid[AliVCluster::kPi0] > wPi0) pdg = kPi0 ; 
+    //else if(pid[AliVCluster::kElectron]  > wE) pdg = kElectron ;
     else if(chargedHadronWeight + neutralHadronWeight > wCh) pdg = kChargedHadron ;  
     else if(neutralHadronWeight + chargedHadronWeight > wNe) pdg = kNeutralHadron ; 
     else pdg =  kNeutralUnknown ;
@@ -301,18 +301,18 @@ Int_t AliCaloPID::GetPdg(const TString calo,const TLorentzVector mom, const AliA
 
   if(fDebug > 0) printf("AliCaloPID::GetPdg: Calorimeter %s, E %3.2f, l0 %3.2f, l1 %3.2f, disp %3.2f, tof %1.11f, distCPV %3.2f, distToBC %1.1f, NMax %d\n",
                                                calo.Data(),energy,lambda0,cluster->GetM20(),cluster->GetDispersion(),cluster->GetTOF(), 
-                                               cluster->GetEmcCpvDistance(), cluster->GetDistToBadChannel(),cluster->GetNExMax());
+                                               cluster->GetEmcCpvDistance(), cluster->GetDistanceToBadChannel(),cluster->GetNExMax());
 
   if(calo == "EMCAL") {
          //Recalculate Bayesian
          if(fRecalculateBayesian){       
                  if(fDebug > 0)  {
-                         const Double_t  *pid0 = cluster->PID();
+                         const Double_t  *pid0 = cluster->GetPID();
                          printf("AliCaloPID::GetPdg: BEFORE calo %s, ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n",
-                                                                calo.Data(),pid0[AliAODCluster::kPhoton], pid0[AliAODCluster::kPi0],
-                                                                pid0[AliAODCluster::kElectron], pid0[AliAODCluster::kEleCon],
-                                                                pid0[AliAODCluster::kPion], pid0[AliAODCluster::kKaon], pid0[AliAODCluster::kProton],
-                                                                pid0[AliAODCluster::kNeutron], pid0[AliAODCluster::kKaon0]);
+                                                                calo.Data(),pid0[AliVCluster::kPhoton], pid0[AliVCluster::kPi0],
+                                                                pid0[AliVCluster::kElectron], pid0[AliVCluster::kEleCon],
+                                                                pid0[AliVCluster::kPion], pid0[AliVCluster::kKaon], pid0[AliVCluster::kProton],
+                                                                pid0[AliVCluster::kNeutron], pid0[AliVCluster::kKaon0]);
                  }
                  
                 fEMCALPIDUtils->ComputePID(energy, lambda0);
@@ -323,10 +323,10 @@ Int_t AliCaloPID::GetPdg(const TString calo,const TLorentzVector mom, const AliA
          
        }
          
-       // If no use of bayesian, simple PID  
-    if(lambda0 < 0.25) return kPhoton ;
-    //else return  kNeutralHadron ; 
-       else return  kPi0 ;
+         // If no use of bayesian, simple PID  
+         if(lambda0 < 0.25) return kPhoton ;
+         //else return  kNeutralHadron ; 
+         else return  kPi0 ;
   }
   
   //   if(calo == "PHOS") {
@@ -434,7 +434,7 @@ void AliCaloPID::SetPIDBits(const TString calo, const AliAODCaloCluster * cluste
   ph->SetChargedBit(ntr>0) ;  //Temporary cut, should we evaluate distance?
   
   //Set PID pdg
-  ph->SetPdg(GetPdg(calo,cluster->PID(),ph->E()));
+  ph->SetPdg(GetPdg(calo,cluster->GetPID(),ph->E()));
   
   if(fDebug > 0){ 
     printf("AliCaloPID::SetPIDBits: TOF %e, Dispersion %2.2f, NTracks %d\n",tof , disp, ntr);  
index a3d0be0..0840e79 100755 (executable)
 #include "AliESDtrack.h"
 #include "AliFiducialCut.h"
 #include "AliAODInputHandler.h"
+#include "AliMultiEventInputHandler.h"
 #include "AliAnalysisManager.h"
+#include "AliMixedEvent.h"
 
 ClassImp(AliCaloTrackAODReader)
 
 //____________________________________________________________________________
 AliCaloTrackAODReader::AliCaloTrackAODReader() : 
-  AliCaloTrackReader(), fWriteOutputStdAOD(kFALSE)
+  AliCaloTrackReader()
 {
   //Default Ctor
   
@@ -74,267 +76,6 @@ AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & aodr)
 //
 //}
 
-//____________________________________________________________________________
-void AliCaloTrackAODReader::FillInputCTS() {
-  //Return array with Central Tracking System (CTS) tracks
-  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputCTS()\n");
-  Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
-  Int_t naod = 0;
-  Double_t p[3];
-  for (Int_t itrack =  0; itrack <  nTracks; itrack++) {////////////// track loop
-    AliAODTrack * track = ((AliAODEvent*)fInputEvent)->GetTrack(itrack) ; // retrieve track from esd
-         
-    //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
-       if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ;
-    
-    track->GetPxPyPz(p) ;
-    TLorentzVector momentum(p[0],p[1],p[2],0);
-    
-    if(fCTSPtMin < momentum.Pt()){
-
-         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
-
-      if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-         
-         if(fWriteOutputStdAOD){
-                  AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*track);
-                  fAODCTS->Add(newtrack); //Use AOD stored in output for references.
-         }
-         else fAODCTS->Add(track);
-    }//Pt and Fiducial cut passed. 
-  }// track loop
-       
-  fAODCTSNormalInputEntries = fAODCTS->GetEntriesFast();
-  if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS()   - aod entries %d\n", fAODCTSNormalInputEntries);
-
-  //If second input event available, add the clusters.
-  if(fSecondInputAODTree && fSecondInputAODEvent){
-         nTracks   = fSecondInputAODEvent->GetNumberOfTracks() ;
-         if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS()   - Add second input tracks, entries %d\n", nTracks) ;
-         for (Int_t itrack =  0; itrack <  nTracks; itrack++) {////////////// track loop
-                 AliAODTrack * track = ((AliAODEvent*)fSecondInputAODEvent)->GetTrack(itrack) ; // retrieve track from esd
-                 
-                 //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
-                 if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ;
-                 
-                 track->GetPxPyPz(p) ;
-                 TLorentzVector momentum(p[0],p[1],p[2],0);
-                 
-                 if(fCTSPtMin < momentum.Pt()){
-
-                         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
-
-                         if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                                                                                  momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-                         
-                         if(fWriteOutputStdAOD){
-                                 AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*track);
-                                 fAODCTS->Add(newtrack); //Use AOD stored in output for references.
-                         }
-                         else fAODCTS->Add(track);
-                         
-                 }//Pt and Fiducial cut passed. 
-         }// track loop
-         
-         if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS()   - aod normal entries %d, after second input %d\n", fAODCTSNormalInputEntries, fAODCTS->GetEntriesFast());
-  }    //second input loop
-       
-}
-
-//____________________________________________________________________________
-void AliCaloTrackAODReader::FillInputEMCAL() {
-  //Return array with EMCAL clusters in aod format
-  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputEMCAL()\n");
-       
-  //Get vertex for momentum calculation  
-  Double_t v[3] ; //vertex ;
-  GetVertex(v);
-
-  Int_t naod =  (fOutputEvent->GetCaloClusters())->GetEntriesFast();
-  //Loop to select clusters in fiducial cut and fill container with aodClusters
-  Int_t nclusters = ((AliAODEvent*)fInputEvent)->GetNCaloClusters();
-  for (Int_t iclus =  0; iclus <  nclusters; iclus++) {
-    AliAODCaloCluster * clus = 0;
-    if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
-      if (clus->IsEMCALCluster()){
-                 
-       //Check if the cluster contains any bad channel and if close to calorimeter borders
-       if(GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) continue;
-       if(!GetCaloUtils()->CheckCellFiducialRegion(clus,((AliAODEvent*)fInputEvent)->GetEMCALCells())) continue;
-
-       TLorentzVector momentum ;
-       clus->GetMomentum(momentum, v);      
-       
-       if(fEMCALPtMin < momentum.Pt()){
-    
-         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) continue;
-               
-         if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                    momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-         
-         //Recalibrate the cluster energy 
-         if(GetCaloUtils()->IsRecalibrationOn()) {
-                 Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetEMCALCells());
-                 clus->SetE(energy);
-         }
-               
-         if(fWriteOutputStdAOD){
-               AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus);
-               fAODEMCAL->Add(newclus);        
-         }
-         else fAODEMCAL->Add(clus);    
-       }//Pt and Fiducial cut passed.
-      }//EMCAL cluster
-    }// cluster exists
-  }// cluster loop
-       
-  fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast();
-  if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod entries %d\n", fAODEMCALNormalInputEntries);
-
-  //If second input event available, add the clusters.
-  if(fSecondInputAODTree && fSecondInputAODEvent){
-         GetSecondInputAODVertex(v);
-         nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNCaloClusters();
-         if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Add second input clusters, entries %d\n", nclusters) ;
-               for (Int_t iclus =  0; iclus < nclusters; iclus++) {
-                       AliAODCaloCluster * clus = 0;
-                       if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) {
-                               if (clus->IsEMCALCluster()){
-                                       TLorentzVector momentum ;
-                                       clus->GetMomentum(momentum, v);      
-                                       
-                                       if(fEMCALPtMin < momentum.Pt()){
-
-                                               if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) continue;
-
-                                               if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                                                                                                       momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-                                               if(fWriteOutputStdAOD){
-                                                       AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus);
-                                                   fAODEMCAL->Add(newclus);    
-                                               }
-                                               else fAODEMCAL->Add(clus);      
-                                       }//Pt and Fiducial cut passed.
-                               }//EMCAL cluster
-                       }// cluster exists
-               }// cluster loop
-               
-         if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod normal entries %d, after second input %d\n", fAODEMCALNormalInputEntries, fAODEMCAL->GetEntriesFast());
-
-       } //second input loop
-}
-
-//____________________________________________________________________________
-void AliCaloTrackAODReader::FillInputPHOS() {
-  //Return array with PHOS clusters in aod format
-  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputPHOS()\n");
-       
-  //Get vertex for momentum calculation  
-  Double_t v[3] ; //vertex ;
-  GetVertex(v);
-       
-  Int_t naod =  (fOutputEvent->GetCaloClusters())->GetEntriesFast();
-  //Loop to select clusters in fiducial cut and fill container with aodClusters
-  Int_t nclusters = ((AliAODEvent*)fInputEvent)->GetNCaloClusters();
-  for (Int_t iclus =  0; iclus < nclusters; iclus++) {
-    AliAODCaloCluster * clus = 0;
-    if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
-      if (clus->IsPHOSCluster()){
-                 
-       //Check if the cluster contains any bad channel and if close to calorimeter borders
-       if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) continue;
-       if(!GetCaloUtils()->CheckCellFiducialRegion(clus, ((AliAODEvent*)fInputEvent)->GetPHOSCells())) continue;
-
-       TLorentzVector momentum ;
-       clus->GetMomentum(momentum, v);      
-       
-       if(fPHOSPtMin < momentum.Pt()){
-
-         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
-
-         if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                    momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-               
-               //Recalibrate the cluster energy 
-               if(GetCaloUtils()->IsRecalibrationOn()) {
-                       Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
-                       clus->SetE(energy);
-               }
-               
-               if(fWriteOutputStdAOD){
-                       AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus);
-                       fAODPHOS->Add(newclus); 
-               }
-               else fAODPHOS->Add(clus);       
-       }//Pt and Fiducial cut passed.
-      }//PHOS cluster
-    }//cluster exists
-  }//esd cluster loop
-       
-  fAODPHOSNormalInputEntries = fAODPHOS->GetEntriesFast() ;
-  if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS()  - aod entries %d\n", fAODPHOSNormalInputEntries);
-
-  //If second input event available, add the clusters.
-  if(fSecondInputAODTree && fSecondInputAODEvent){  
-         GetSecondInputAODVertex(v);
-         nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNCaloClusters();
-         if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS()  - Add second input clusters, entries %d\n", nclusters);
-               for (Int_t iclus =  0; iclus < nclusters; iclus++) {
-                       AliAODCaloCluster * clus = 0;
-                       if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) {
-                               if (clus->IsPHOSCluster()){
-                                       TLorentzVector momentum ;
-                                       clus->GetMomentum(momentum, v);      
-                                       
-                                       if(fPHOSPtMin < momentum.Pt()){
-
-                                               if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
-
-                                               if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                                                                                                       momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-                                               if(fWriteOutputStdAOD){
-                                                       AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus);
-                                                   fAODPHOS->Add(newclus);     
-                                               }
-                                               else fAODPHOS->Add(clus);       
-                                       }//Pt and Fiducial cut passed.
-                               }//PHOS cluster
-                       }// cluster exists
-               }// cluster loop
-               if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS()  - aod normal entries %d, after second input %d\n", fAODPHOSNormalInputEntries, fAODPHOS->GetEntriesFast());
-  }    //second input loop
-
-}
-
-//____________________________________________________________________________
-void AliCaloTrackAODReader::FillInputEMCALCells() {
-  //Return array with EMCAL cells in aod format
-
-  fEMCALCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetEMCALCells(); 
-
-}
-
-//____________________________________________________________________________
-void AliCaloTrackAODReader::FillInputPHOSCells() {
-  //Return array with PHOS cells in aod format
-
-  fPHOSCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetPHOSCells(); 
-
-}
-
-//____________________________________________________________________________
-void AliCaloTrackAODReader::GetVertex(Double_t  v[3]) const {
-  //Return vertex position
- if(((AliAODEvent*)fInputEvent)->GetPrimaryVertex())
-        ((AliAODEvent*)fInputEvent)->GetPrimaryVertex()->GetXYZ(v); 
- else {
-        printf("AliCaloTrackAODReader::GetVertex() - No vertex available, InputEvent()->GetPrimaryVertex() = 0, return (0,0,0)\n");
-        v[0]=0; v[1]=0; v[2]=0;
- }
-
-       
-}
 
 //____________________________________________________________________________
 void AliCaloTrackAODReader::GetSecondInputAODVertex(Double_t  v[3]) const {
@@ -348,7 +89,7 @@ void AliCaloTrackAODReader::GetSecondInputAODVertex(Double_t  v[3]) const {
 Double_t AliCaloTrackAODReader::GetBField() const {
   //Return magnetic field
 
-  Double_t bfield =  ((AliAODEvent*)fInputEvent)->GetMagneticField();
+  Double_t bfield = fInputEvent->GetMagneticField();
 
   return bfield;
 
@@ -359,14 +100,31 @@ void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent*
   // Connect the data pointers
   // If input is AOD, do analysis with input, if not, do analysis with the output aod.
 
-  if(!strcmp(input->GetName(),"AliESDEvent"))   {
+         //printf("AODInputHandler %p, MergeEvents %d \n",aodIH, aodIH->GetMergeEvents());
+
+  Bool_t tesd = kFALSE ; 
+  Bool_t taod = kTRUE ; 
+  if ( strcmp(input->GetName(), "AliMixedEvent") == 0 ) {
+    AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
+    if (multiEH->GetFormat() == 0 ) {
+      tesd = kTRUE ; 
+    } else if (multiEH->GetFormat() == 1) {
+      taod = kTRUE ; 
+    }
+  }
+  if (strcmp(input->GetName(),"AliESDEvent") == 0) {
+    tesd = kTRUE ; 
+  } else if (strcmp(input->GetName(),"AliAODEvent") == 0) {
+    taod = kTRUE ; 
+  }
+  
+
+  if(tesd)   {
     SetInputEvent(aod);
     SetOutputEvent(aod);
   }
-  else if(!strcmp(input->GetName(),"AliAODEvent")){
-         
-         AliAODInputHandler* aodIH = static_cast<AliAODInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
-         //printf("AODInputHandler %p, MergeEvents %d \n",aodIH, aodIH->GetMergeEvents());
+  else if(taod){
+    AliAODInputHandler* aodIH = dynamic_cast<AliAODInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
          if (aodIH && aodIH->GetMergeEvents()) {
                  //Merged events, use output AOD.
                  SetInputEvent(aod);
@@ -378,8 +136,7 @@ void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent*
          }
   }
   else{ 
-    printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName());
-    abort();
+    AliFatal(Form("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName()));
   }
   
   SetMC(mc);
index 0fc8a0c..2564091 100755 (executable)
@@ -28,16 +28,10 @@ public:
   //AliCaloTrackAODReader & operator = (const AliCaloTrackAODReader & g) ;//cpy assignment
   virtual ~AliCaloTrackAODReader() {;} //virtual dtor
   
-  void FillInputCTS()   ;
-  void FillInputEMCAL() ;
-  void FillInputPHOS()  ;
-  void FillInputEMCALCells() ;
-  void FillInputPHOSCells()  ;
-       
+       
   Double_t GetBField() const;
 
   void GetSecondInputAODVertex(Double_t v[3]) const ;
-  void GetVertex(Double_t v[3]) const ;
   
   void SetInputOutputMCEvent(AliVEvent* esd, AliAODEvent* aod, AliMCEvent* mc) ; 
   void SwitchOnWriteStdAOD()  {fWriteOutputStdAOD = kTRUE;}
@@ -47,10 +41,8 @@ public:
 
   void Print(const Option_t * opt) const;
        
-private:
-  Bool_t            fWriteOutputStdAOD;   // Write selected standard tracks and caloclusters in output AOD
 
-  ClassDef(AliCaloTrackAODReader,4)
+  ClassDef(AliCaloTrackAODReader,5)
 } ;
 
 #endif //ALICALOTRACKAODREADER_H
index 8286c0d..63a1f6a 100755 (executable)
 #include "AliAODTrack.h"
 #include "AliAODPid.h"
 #include "AliAODEvent.h"
+#include "AliMultiEventInputHandler.h"
+#include "AliAnalysisManager.h"
 #include "AliFiducialCut.h"
+#include "AliMixedEvent.h"
+
 
 ClassImp(AliCaloTrackESDReader)
 
@@ -82,338 +86,353 @@ AliCaloTrackESDReader::AliCaloTrackESDReader(const AliCaloTrackESDReader & g) :
 //}
 
 //____________________________________________________________________________
-void AliCaloTrackESDReader::FillInputCTS() {
-  //Return array with CTS tracks
-  if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputCTS()\n");
-
-  //TObjArray * fAODCTS = new TObjArray();
-  Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
-  Int_t naod = 0;
-  Double_t pos[3];
-  Double_t p[3];
-  Double_t covTr[21];
-  Double_t pid[10];
-  Double_t bfield = ((AliESDEvent*)fInputEvent)->GetMagneticField();
-
-  Double_t      timezero        = 0;   //TO BE FIXED
-  //List of output tracks 
-  TClonesArray &tracks = *(fOutputEvent->GetTracks());
-
-  //To be replaced by call to AliEMCALGeoUtils when the class becomes available
-  Double_t radius = 441.0; //[cm] EMCAL radius +13cm
-
-  if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputCTS() - org entries %d\n", nTracks);
-  for (Int_t itrack =  0; itrack <  nTracks; itrack++) {////////////// track loop
-    AliESDtrack * track = (AliESDtrack*) ((AliESDEvent*)fInputEvent)->GetTrack(itrack) ; // retrieve track from esd
-    
-    //We want tracks fitted in the detectors: TPCrefit, ITSrefit ... check the set bits.
-       if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ;
-      
-       track->GetPxPyPz(p) ;
-       TLorentzVector momentum(p[0],p[1],p[2],0);
-      
-       if(fCTSPtMin < momentum.Pt()){
-               
-               if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
-               
-               if(fDebug > 3 && momentum.Pt() > 0.2) printf("AliCaloTrackESDReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                   momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-       
-               track->GetXYZ(pos);
-               track->GetCovarianceXYZPxPyPz(covTr);
-               track->GetESDpid(pid);
-       
-               Float_t impactXY, impactZ;
-       
-               track->GetImpactParameters(impactXY,impactZ);
-       
-               if (impactXY<3) {
-                 // track inside the beam pipe
-                 //Put new aod object in file in AOD tracks array
-                 AliAODTrack *aodTrack = new(tracks[naod++]) 
-                   //AliAODTrack *aodTrack = new((*(fOutputEvent->GetTracks()))[naod++]) 
-                   AliAODTrack(track->GetID(), track->GetLabel(), p, kTRUE, pos, kFALSE,covTr, (Short_t)track->GetSign(), track->GetITSClusterMap(), 
-                               pid,
-                               0x0,//primary,
-                               kTRUE, // check if this is right
-                               kTRUE, // check if this is right
-                               AliAODTrack::kPrimary, 
-                               0);
-                 
-                 aodTrack->SetFlags(track->GetStatus());
-                 aodTrack->ConvertAliPIDtoAODPID();
-
-                 //fill needed AliAODPid information, including
-                 //Extrapolate track to EMCAL surface for AOD-level track-cluster matching
-                 AliAODPid *aodpid = new AliAODPid;
-                 aodpid->SetITSsignal(track->GetITSsignal());
-                 aodpid->SetTPCsignal(track->GetTPCsignal());
-                 //n TRD planes = 6
-                 Int_t nslices = track->GetNumberOfTRDslices()*6;
-                 Double_t *trdslices = new Double_t[nslices];
-                 for(Int_t iSl =0; iSl < track->GetNumberOfTRDslices(); iSl++) {
-                   for(Int_t iPl =0; iPl<6; iPl++) trdslices[iPl*track->GetNumberOfTRDslices()+iSl] = track->GetTRDslice(iPl,iSl);
-                 }
-                 aodpid->SetTRDsignal(track->GetNumberOfTRDslices()*6,trdslices);
-                 Double_t times[AliAODPid::kSPECIES]; track->GetIntegratedTimes(times);
-                 aodpid->SetIntegratedTimes(times);
-
-                 aodpid->SetTOFsignal(track->GetTOFsignal()-timezero); // to be fixed 
-                 aodpid->SetHMPIDsignal(track->GetHMPIDsignal());
-
-                 Double_t emcpos[3] = {0.,0.,0.};
-                 Double_t emcmom[3] = {0.,0.,0.};
-                 aodpid->SetEMCALPosition(emcpos);
-                 aodpid->SetEMCALMomentum(emcmom);
-                 
-                 AliExternalTrackParam *outerparam = (AliExternalTrackParam*)track->GetOuterParam();
-                 if(!outerparam) continue;
-                 
-                 Bool_t okpos = outerparam->GetXYZAt(radius,bfield,emcpos);
-                 Bool_t okmom = outerparam->GetPxPyPzAt(radius,bfield,emcmom);
-                 if(!(okpos && okmom)) continue;
-                 
-                 aodpid->SetEMCALPosition(emcpos);
-                 aodpid->SetEMCALMomentum(emcmom);
-                 
-                 aodTrack->SetDetPID(aodpid);
-               }
-               else continue;   // outside the beam pipe: orphan track 
-       }//Pt and Fiducial cut passed. 
-  }// track loop
-
-  //Put references to selected tracks in array
-  for(Int_t itrack = 0; itrack < (fOutputEvent->GetTracks())->GetEntriesFast(); itrack++){
-    AliAODTrack * track =  (AliAODTrack*) (fOutputEvent->GetTracks())->At(itrack);     
-    fAODCTS->Add(track);                               
-  }    
-  
-  if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputCTS() - aod entries %d\n", fAODCTS->GetEntriesFast());
-}
-
-//____________________________________________________________________________
-void AliCaloTrackESDReader::FillInputEMCAL() {
-  //Return array with EMCAL clusters in aod format
-  if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputEMCAL()\n");
-       
-  //Get vertex for momentum calculation  
-  Double_t v[3] ; //vertex ;
-  GetVertex(v);
-  
-  Float_t pos[3] ;
-  Int_t naod      = (fOutputEvent->GetCaloClusters())->GetEntriesFast();
-  Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
-  
-  //Loop to select clusters in fiducial cut and fill container with aodClusters
-  for (Int_t iclus = 0; iclus < ((AliESDEvent*)fInputEvent)->GetNumberOfCaloClusters(); iclus++) {
-    AliESDCaloCluster * clus = 0;
-    if ( (clus = ((AliESDEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
-      if (clus->IsEMCAL()){
-                 
-       //Check if the cluster contains any bad channel and if close to calorimeter borders
-       if( GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) continue;
-       if(!GetCaloUtils()->CheckCellFiducialRegion(clus, ((AliESDEvent*)fInputEvent)->GetEMCALCells())) continue;
-
-       TLorentzVector momentum ;
-       clus->GetMomentum(momentum, v);      
-       if(fDebug > 3 && momentum.E() > 0.1) printf("AliCaloTrackESDReader::FillInputEMCAL() - all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                  momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); 
-       if(fEMCALPtMin < momentum.Pt()){
-         
-         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) continue;
-               
-         if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackESDReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                    momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-         
-         clus->GetPosition(pos) ;
-         Int_t id = clus->GetID();
-         Int_t nLabel = clus->GetNLabels();
-         Int_t *labels=0x0;
-         if(clus->GetLabels()) labels =  (clus->GetLabels())->GetArray();
-         
-         Float_t energy = clus->E();
-         Char_t ttype= AliAODCluster::kEMCALClusterv1;
-
-         //Recalibrate the cluster energy 
-               if(GetCaloUtils()->IsRecalibrationOn()) energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliESDCaloCells*)GetEMCALCells());
-               
-               
-         //Put new aod object in file in AOD calo clusters array
-         AliAODCaloCluster *caloCluster = new((*(fOutputEvent->GetCaloClusters()))[naod++]) 
-           AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL,ttype,0);
-         
-         //       printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n",
-         //         pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion],
-         //         pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]);
-         caloCluster->SetPIDFromESD(clus->GetPid());
-         caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetClusterDisp(), 
-                                     clus->GetM20(), clus->GetM02(),   
-                                     clus->GetEmcCpvDistance(),  clus->GetNExMax(), clus->GetTOF()) ;
-         
-         
-         if(fDebug > 3 && momentum.E() > 0.1)
-           printf("AliCaloTrackESDReader::FillInputEMCAL() - Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, NexMax %d, TOF %e\n",
-                  clus->GetDistanceToBadChannel(), clus->GetClusterDisp(),clus->GetM20(), clus->GetM02(),
-                  clus->GetNExMax(), clus->GetTOF());
-         
-         caloCluster->SetNCells(clus->GetNCells());
-         caloCluster->SetCellsAbsId(clus->GetCellsAbsId());
-         caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction());
-         
-         TArrayI* matchedT =   clus->GetTracksMatched();
-         if (nTracks > 0 && matchedT && clus->GetTrackMatched() >= 0) {        
-           for (Int_t im = 0; im < matchedT->GetSize(); im++) {
-             Int_t iESDtrack = matchedT->At(im);
-             if(iESDtrack < nTracks && iESDtrack > -1)
-               caloCluster->AddTrackMatched((fInputEvent->GetTrack(iESDtrack)));
-           }
-         }
-         //Fill reference array
-       }//Pt and Fiducial cut passed.
-      }//EMCAL cluster
-    }//cluster exists
-  }//esd cluster loop
-  
-  //Put references to selected clusters in array
-  for(Int_t iclus = 0; iclus < (fOutputEvent->GetCaloClusters())->GetEntriesFast(); iclus++){
-    AliAODCaloCluster * clus =  (AliAODCaloCluster*) (fOutputEvent->GetCaloClusters())->At(iclus);     
-    fAODEMCAL->Add(clus);                              
-  }
-  if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputEMCAL() - aod entries %d\n", fAODEMCAL->GetEntriesFast());
-  
-}
-
-//____________________________________________________________________________
-void AliCaloTrackESDReader::FillInputPHOS() {
-  //Return array with PHOS clusters in aod format
-  if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputPHOS()\n");
-
-  Int_t nEMCAL = (fOutputEvent->GetCaloClusters())->GetEntriesFast();
-  //Get vertex for momentum calculation  
-  Double_t v[3] ; //vertex ;
-  GetVertex(v);
-  
-  Float_t pos[3] ;
-  Double_t * pid = new Double_t[AliPID::kSPECIESN];
-  Int_t naod      = (fOutputEvent->GetCaloClusters())->GetEntriesFast();
-  Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
-
-  //Loop to select clusters in fiducial cut and fill container with aodClusters
-  for (Int_t iclus = 0; iclus < ((AliESDEvent*)fInputEvent)->GetNumberOfCaloClusters(); iclus++) {
-    AliESDCaloCluster * clus = 0;
-    if ( (clus = ((AliESDEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
-      if (clus->IsPHOS()){
-                 
-       //Check if the cluster contains any bad channel and if close to calorimeter borders
-       if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) continue;
-       if(!GetCaloUtils()->CheckCellFiducialRegion(clus, ((AliESDEvent*)fInputEvent)->GetPHOSCells())) continue;
-
-       TLorentzVector momentum ;
-       clus->GetMomentum(momentum, v);      
-       if(fDebug > 3 && momentum.E() > 0.1)printf("AliCaloTrackESDReader::FillInputPHOS() - all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                  momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-       if(fPHOSPtMin < momentum.Pt()){
-
-         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
-
-         if(fDebug > 2 && momentum.E() > 0.1)printf("AliCaloTrackESDReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
-                                                    momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
-         
-         clus->GetPosition(pos) ;
-         Int_t id = clus->GetID();
-         Int_t nLabel = clus->GetNLabels();
-         Int_t *labels=0x0;
-         if(clus->GetLabels()) labels =  (clus->GetLabels())->GetArray();
-         Float_t energy = clus->E();
-         
-         //Phos cluster type
-         pid = clus->GetPid();
-         // printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n",
-         //     pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion],
-         //     pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]);
-         Char_t ttype= AliAODCluster::kPHOSNeutral;
-         Float_t wNeutral = pid[AliPID::kNeutron]+ pid[AliPID::kKaon0]+pid[AliPID::kPhoton]+pid[AliPID::kPi0];
-         Float_t wCharged = pid[AliPID::kMuon] + pid[AliPID::kElectron] + pid[AliPID::kEleCon]+ 
-           pid[AliPID::kProton]+pid[AliPID::kKaon]+pid[AliPID::kPion];
-         if( wCharged > wNeutral)  ttype= AliAODCluster::kPHOSCharged;
-         
-         //Recalibrate the cluster energy 
-         if(GetCaloUtils()->IsRecalibrationOn()) energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliESDCaloCells*)GetPHOSCells());
-               
-         //Put new aod object in file in AOD calo clusters array
-         AliAODCaloCluster *caloCluster = new((*(fOutputEvent->GetCaloClusters()))[naod++]) 
-           AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL, ttype, 0);
-
-
-         caloCluster->SetPIDFromESD(pid);   
-         caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetClusterDisp(), 
-                                     clus->GetM20(), clus->GetM02(),  
-                                     clus->GetEmcCpvDistance(),  clus->GetNExMax()) ;
-         
-         if(fDebug > 3 && momentum.E() > 0.2)
-           printf("AliCaloTrackESDReader::FillInputPHOS() - Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, EmcCpvDist %3.3f, NexMax %d, TOF %e\n",
-                  clus->GetDistanceToBadChannel(), clus->GetClusterDisp(),clus->GetM20(), clus->GetM02(),
-                  clus->GetEmcCpvDistance(),  clus->GetNExMax(), clus->GetTOF());
-         
-         caloCluster->SetNCells(clus->GetNCells());
-         caloCluster->SetCellsAbsId(clus->GetCellsAbsId());
-         caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction());
-
-         TArrayI* matchedT =   clus->GetTracksMatched();
-         if (nTracks > 0 && matchedT && clus->GetTrackMatched() >= 0) {        
-           for (Int_t im = 0; im < matchedT->GetSize(); im++) {
-             Int_t iESDtrack = matchedT->At(im);
-             if(iESDtrack < nTracks && iESDtrack > -1)
-               caloCluster->AddTrackMatched((fInputEvent->GetTrack(iESDtrack)));
-           }
-         }
-       }//Pt and Fiducial cut passed.
-      }//PHOS cluster
-    }//cluster exists
-  }//esd cluster loop
-  
-  //Put references to selected clusters in array
-  for(Int_t iclus = nEMCAL; iclus < (fOutputEvent->GetCaloClusters())->GetEntriesFast(); iclus++){
-    AliAODCaloCluster * clus =  (AliAODCaloCluster*) (fOutputEvent->GetCaloClusters())->At(iclus);     
-    fAODPHOS->Add(clus);                               
-  }    
-  if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputPHOS() - aod entries %d\n", fAODPHOS->GetEntriesFast());
-  
-}
-
-//____________________________________________________________________________
-void AliCaloTrackESDReader::FillInputEMCALCells() {
-  //Return array with EMCAL cells in esd format
-  
-  fEMCALCells = (TNamed*) ((AliESDEvent*)fInputEvent)->GetEMCALCells(); 
-  
-}
-
-//____________________________________________________________________________
-void AliCaloTrackESDReader::FillInputPHOSCells() {
-  //Return array with PHOS cells in esd format
-  
-  fPHOSCells = (TNamed*) ((AliESDEvent*)fInputEvent)->GetPHOSCells(); 
-  
-}
-
+//void AliCaloTrackESDReader::FillInputCTS() {
+//  //Return array with CTS tracks
+//  if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputCTS()\n");
+//
+//  //TObjArray * fAODCTS = new TObjArray();
+//  Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
+//  Int_t naod = 0;
+//  Double_t pos[3];
+//  Double_t p[3];
+//  Double_t covTr[21];
+//  Double_t pid[10];
+//  Double_t bfield = fInputEvent->GetMagneticField();
+//
+//  Double_t      timezero        = 0;   //TO BE FIXED
+// 
+//  //List of output tracks 
+//  TClonesArray &tracks = *(fOutputEvent->GetTracks());
+//
+//  //To be replaced by call to AliEMCALGeoUtils when the class becomes available
+//  Double_t radius = 441.0; //[cm] EMCAL radius +13cm
+//
+//  if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputCTS() - org entries %d\n", nTracks);
+//  for (Int_t itrack =  0; itrack <  nTracks; itrack++) {////////////// track loop
+//    AliESDtrack * track = (AliESDtrack*) fInputEvent->GetTrack(itrack) ; // retrieve track from esd
+//    
+//    //We want tracks fitted in the detectors: TPCrefit, ITSrefit ... check the set bits.
+//     if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ;
+//      
+//     track->GetPxPyPz(p) ;
+//     TLorentzVector momentum(p[0],p[1],p[2],0);
+//      
+//     if(fCTSPtMin < momentum.Pt()){
+//             
+//             if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
+//             
+//             if(fDebug > 3 && momentum.Pt() > 0.2) printf("AliCaloTrackESDReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+//                                                 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+//     
+//             track->GetXYZ(pos);
+//             track->GetCovarianceXYZPxPyPz(covTr);
+//             track->GetESDpid(pid);
+//     
+//             Float_t impactXY, impactZ;
+//     
+//             track->GetImpactParameters(impactXY,impactZ);
+//     
+//             if (impactXY<3) {
+//               // track inside the beam pipe
+//               //Put new aod object in file in AOD tracks array
+//               AliAODTrack *aodTrack = new(tracks[naod++]) 
+//                 //AliAODTrack *aodTrack = new((*(fOutputEvent->GetTracks()))[naod++]) 
+//                 AliAODTrack(track->GetID(), track->GetLabel(), p, kTRUE, pos, kFALSE,covTr, (Short_t)track->GetSign(), track->GetITSClusterMap(), 
+//                             pid,
+//                             0x0,//primary,
+//                             kTRUE, // check if this is right
+//                             kTRUE, // check if this is right
+//                             AliAODTrack::kPrimary, 
+//                             0);
+//               
+//               aodTrack->SetFlags(track->GetStatus());
+//               aodTrack->ConvertAliPIDtoAODPID();
+//
+//               //fill needed AliAODPid information, including
+//               //Extrapolate track to EMCAL surface for AOD-level track-cluster matching
+//               AliAODPid *aodpid = new AliAODPid;
+//               aodpid->SetITSsignal(track->GetITSsignal());
+//               aodpid->SetTPCsignal(track->GetTPCsignal());
+//               //n TRD planes = 6
+//               Int_t nslices = track->GetNumberOfTRDslices()*6;
+//               Double_t *trdslices = new Double_t[nslices];
+//               for(Int_t iSl =0; iSl < track->GetNumberOfTRDslices(); iSl++) {
+//                 for(Int_t iPl =0; iPl<6; iPl++) trdslices[iPl*track->GetNumberOfTRDslices()+iSl] = track->GetTRDslice(iPl,iSl);
+//               }
+//               aodpid->SetTRDsignal(track->GetNumberOfTRDslices()*6,trdslices);
+//               Double_t times[AliAODPid::kSPECIES]; track->GetIntegratedTimes(times);
+//               aodpid->SetIntegratedTimes(times);
+//
+//               aodpid->SetTOFsignal(track->GetTOFsignal()-timezero); // to be fixed 
+//               aodpid->SetHMPIDsignal(track->GetHMPIDsignal());
+//
+//               Double_t emcpos[3] = {0.,0.,0.};
+//               Double_t emcmom[3] = {0.,0.,0.};
+//               aodpid->SetEMCALPosition(emcpos);
+//               aodpid->SetEMCALMomentum(emcmom);
+//               
+//               AliExternalTrackParam *outerparam = (AliExternalTrackParam*)track->GetOuterParam();
+//               if(!outerparam) continue;
+//               
+//               Bool_t okpos = outerparam->GetXYZAt(radius,bfield,emcpos);
+//               Bool_t okmom = outerparam->GetPxPyPzAt(radius,bfield,emcmom);
+//               if(!(okpos && okmom)) continue;
+//               
+//               aodpid->SetEMCALPosition(emcpos);
+//               aodpid->SetEMCALMomentum(emcmom);
+//               
+//               aodTrack->SetDetPID(aodpid);
+//             }
+//             else continue;   // outside the beam pipe: orphan track 
+//     }//Pt and Fiducial cut passed. 
+//  }// track loop
+//
+//  //Put references to selected tracks in array
+//  for(Int_t itrack = 0; itrack < (fOutputEvent->GetTracks())->GetEntriesFast(); itrack++){
+//    AliAODTrack * track =  (AliAODTrack*) (fOutputEvent->GetTracks())->At(itrack);   
+//    fAODCTS->Add(track);                             
+//  }  
+//  
+//  if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputCTS() - aod entries %d\n", fAODCTS->GetEntriesFast());
+//}
+//
+////____________________________________________________________________________
+//void AliCaloTrackESDReader::FillInputEMCAL() {
+//    //Return array with EMCAL clusters in aod format
+//  if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputEMCAL()\n");
+//  
+//  Float_t pos[3] ;
+//  Int_t naod      = (fOutputEvent->GetCaloClusters())->GetEntriesFast();
+//  Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
+//  
+//    //Loop to select clusters in fiducial cut and fill container with aodClusters
+//  for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++) {
+//    AliESDCaloCluster * clus = 0;
+//    if ( (clus = (AliESDCaloCluster *)fInputEvent->GetCaloCluster(iclus)) ) {
+//      if (clus->IsEMCAL()){
+//        
+//          //Check if the cluster contains any bad channel and if close to calorimeter borders
+//        Int_t vindex = 0 ;  
+//        if (fMixedEvent) 
+//          vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
+//
+//        if( GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) 
+//          continue;
+//        if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetEMCALCells(), fInputEvent, vindex)) 
+//          continue;
+//        
+//        TLorentzVector momentum ;
+//        clus->GetMomentum(momentum, fVertex[vindex]);      
+//        if(fDebug > 3 && momentum.E() > 0.1) 
+//          printf("AliCaloTrackESDReader::FillInputEMCAL() - all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+//                                                    momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); 
+//        if(fEMCALPtMin < momentum.Pt()){
+//          
+//          if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) 
+//            continue;
+//          
+//          if(fDebug > 2 && momentum.E() > 0.1) 
+//            printf("AliCaloTrackESDReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+//                                                      momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+//          
+//          clus->GetPosition(pos) ;
+//          Int_t id = clus->GetID();
+//
+//          Int_t nLabel  = clus->GetNLabels();
+//          Int_t *labels = clus->GetLabels();
+//          
+//          Float_t energy = clus->E();
+//          Char_t ttype= AliAODCluster::kEMCALClusterv1;
+//          
+//            //Recalibrate the cluster energy 
+//          if(GetCaloUtils()->IsRecalibrationOn())    
+//            energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells());
+//          
+//          
+//            //Put new aod object in file in AOD calo clusters array
+//          AliAODCaloCluster *caloCluster = new((*(fOutputEvent->GetCaloClusters()))[naod++]) 
+//          AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL,ttype,0);
+//          
+//            //       printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n",
+//            //            pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion],
+//            //            pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]);
+//          caloCluster->SetPIDFromESD(clus->GetPID());
+//          caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetDispersion(), 
+//                                      clus->GetM20(), clus->GetM02(),   
+//                                      clus->GetEmcCpvDistance(),  clus->GetNExMax(), clus->GetTOF()) ;
+//          
+//          
+//          if(fDebug > 3 && momentum.E() > 0.1)
+//            printf("AliCaloTrackESDReader::FillInputEMCAL() - Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, NexMax %d, TOF %e\n",
+//                   clus->GetDistanceToBadChannel(), clus->GetDispersion(),clus->GetM20(), clus->GetM02(),
+//                   clus->GetNExMax(), clus->GetTOF());
+//          
+//          caloCluster->SetNCells(clus->GetNCells());
+//          caloCluster->SetCellsAbsId(clus->GetCellsAbsId());
+//          caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction());
+//          
+//          TArrayI* matchedT =        clus->GetTracksMatched();
+//          if (nTracks > 0 && matchedT && clus->GetTrackMatchedIndex() >= 0) {        
+//            for (Int_t im = 0; im < matchedT->GetSize(); im++) {
+//              Int_t iESDtrack = matchedT->At(im);
+//              if(iESDtrack < nTracks && iESDtrack > -1)
+//                caloCluster->AddTrackMatched((fInputEvent->GetTrack(iESDtrack)));
+//            }
+//          }
+//            //Fill reference array
+//        }//Pt and Fiducial cut passed.
+//      }//EMCAL cluster
+//    }//cluster exists
+//  }//esd cluster loop
+//  
+//    //Put references to selected clusters in array
+//  for(Int_t iclus = 0; iclus < (fOutputEvent->GetCaloClusters())->GetEntriesFast(); iclus++){
+//    AliAODCaloCluster * clus =  (AliAODCaloCluster*) (fOutputEvent->GetCaloClusters())->At(iclus);   
+//    if (fMixedEvent) {
+//      clus->SetID(iclus) ;   
+//    }      
+//    fAODEMCAL->Add(clus);                            
+//  }
+//  if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputEMCAL() - aod entries %d\n", fAODEMCAL->GetEntriesFast());
+//  
+//}
+//
+//  //____________________________________________________________________________
+//void AliCaloTrackESDReader::FillInputPHOS() {
+//  //Return array with PHOS clusters in aod format
+//  if(fDebug > 2 ) printf("AliCaloTrackESDReader::FillInputPHOS()\n");
+//
+//  Int_t nPHOS = (fOutputEvent->GetCaloClusters())->GetEntriesFast();  
+//  Float_t pos[3] ;
+//  Int_t naod      = (fOutputEvent->GetCaloClusters())->GetEntriesFast();
+//  Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
+//
+//    //Loop to select clusters in fiducial cut and fill container with aodClusters
+//  for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++) {
+//    AliESDCaloCluster * clus = 0;
+//    if ( (clus = (AliESDCaloCluster *)fInputEvent->GetCaloCluster(iclus)) ) {
+//      if (clus->IsPHOS()){        
+//          //Check if the cluster contains any bad channel and if close to calorimeter borders
+//        Int_t vindex = 0 ;  
+//        if (fMixedEvent) 
+//          vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
+//        if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) 
+//          continue;
+//        if(!GetCaloUtils()->CheckCellFiducialRegion(clus, (AliESDCaloCells*)fInputEvent->GetPHOSCells(), fInputEvent, vindex)) 
+//          continue;
+//        
+//        TLorentzVector momentum ;
+//        clus->GetMomentum(momentum, fVertex[vindex]);      
+//        if(fDebug > 3 && momentum.E() > 0.1)
+//          printf("AliCaloTrackESDReader::FillInputPHOS() - all clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+//                                                   momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+//        if(fPHOSPtMin < momentum.Pt()){
+//          
+//          if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) 
+//            continue;
+//          
+//          if(fDebug > 2 && momentum.E() > 0.1)
+//            printf("AliCaloTrackESDReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+//                                                     momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+//          
+//          clus->GetPosition(pos) ;
+//          Int_t id = clus->GetID();
+//          Int_t nLabel  = clus->GetNLabels();
+//          Int_t *labels = clus->GetLabels();
+//          Float_t energy = clus->E();
+//          
+//            //Phos cluster type
+//          const Double_t * pid = clus->GetPID();
+//            // printf("Reader PID ESD: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f \n",
+//            //        pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion],
+//            //        pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]);
+//          Char_t ttype= AliAODCluster::kPHOSNeutral;
+//          Float_t wNeutral = pid[AliPID::kNeutron]+ pid[AliPID::kKaon0]+pid[AliPID::kPhoton]+pid[AliPID::kPi0];
+//          Float_t wCharged = pid[AliPID::kMuon] + pid[AliPID::kElectron] + pid[AliPID::kEleCon]+ 
+//          pid[AliPID::kProton]+pid[AliPID::kKaon]+pid[AliPID::kPion];
+//          if( wCharged > wNeutral)  ttype= AliAODCluster::kPHOSCharged;
+//          
+//            //Recalibrate the cluster energy 
+//          if(GetCaloUtils()->IsRecalibrationOn()) 
+//            energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetPHOSCells());
+//          
+//            //Put new aod object in file in AOD calo clusters array
+//          AliAODCaloCluster *caloCluster = new((*(fOutputEvent->GetCaloClusters()))[naod++]) 
+//          AliAODCaloCluster(id,nLabel,labels,energy, pos, NULL, ttype, 0);
+//          
+//          
+//          caloCluster->SetPIDFromESD(pid);   
+//          caloCluster->SetCaloCluster(clus->GetDistanceToBadChannel(), clus->GetDispersion(), 
+//                                      clus->GetM20(), clus->GetM02(),  
+//                                      clus->GetEmcCpvDistance(),  clus->GetNExMax()) ;
+//          
+//          if(fDebug > 3 && momentum.E() > 0.2)
+//            printf("AliCaloTrackESDReader::FillInputPHOS() - Selected clusters Distance BC %2.2f, dispersion %2.2f, M20 %f, M02 %3.2f, EmcCpvDist %3.3f,  NexMax %d, TOF %e\n",
+//                   clus->GetDistanceToBadChannel(), clus->GetDispersion(),clus->GetM20(), clus->GetM02(),
+//                   clus->GetEmcCpvDistance(),  clus->GetNExMax(), clus->GetTOF());
+//          
+//          caloCluster->SetNCells(clus->GetNCells());
+//          caloCluster->SetCellsAbsId(clus->GetCellsAbsId());
+//          caloCluster->SetCellsAmplitudeFraction(clus->GetCellsAmplitudeFraction());
+//          
+//          TArrayI* matchedT =        clus->GetTracksMatched();
+//          if (nTracks > 0 && matchedT && clus->GetTrackMatchedIndex() >= 0) {        
+//            for (Int_t im = 0; im < matchedT->GetSize(); im++) {
+//              Int_t iESDtrack = matchedT->At(im);
+//              if(iESDtrack < nTracks && iESDtrack > -1)
+//                caloCluster->AddTrackMatched((fInputEvent->GetTrack(iESDtrack)));
+//            }
+//          }
+//        }//Pt and Fiducial cut passed.
+//      }//PHOS cluster
+//    }//cluster exists
+//  }//esd cluster loop
+//  
+//    //Put references to selected clusters in array
+//  
+//  for(Int_t iclus = nPHOS; iclus < (fOutputEvent->GetCaloClusters())->GetEntriesFast(); iclus++){
+//    AliAODCaloCluster * clus =  (AliAODCaloCluster*) (fOutputEvent->GetCaloClusters())->At(iclus);   
+//    if (fMixedEvent) {
+//      clus->SetID(iclus) ; 
+//    }                    
+//    fAODPHOS->Add(clus);                             
+//  }
+//  if(fDebug > 1) printf("AliCaloTrackESDReader::FillInputPHOS() - aod entries %d\n", fAODPHOS->GetEntriesFast());
+//  
+//}
+//
+//  //____________________________________________________________________________
+//void AliCaloTrackESDReader::FillInputEMCALCells() {
+//  //Return array with EMCAL cells in esd format
+//  
+//  fEMCALCells = fInputEvent->GetEMCALCells(); 
+//  
+//}
+//
+////____________________________________________________________________________
+//void AliCaloTrackESDReader::FillInputPHOSCells() {
+//  //Return array with PHOS cells in esd format
+//  
+//  fPHOSCells = fInputEvent->GetPHOSCells(); 
+//  
+//}
+//
 
 //____________________________________________________________________________
-void AliCaloTrackESDReader::GetVertex(Double_t  v[3]) const {
-  //Return vertex position
-  
-  //((AliESDEvent*)fInputEvent)->GetVertex()->GetXYZ(v) ;//SPD
-  ((AliESDEvent*)fInputEvent)->GetPrimaryVertex()->GetXYZ(v);
-       
-}
+//void AliCaloTrackESDReader::GetVertex(Double_t  v[3]) const {
+//  //Return vertex position
+//  
+//  //((AliESDEvent*)fInputEvent)->GetVertex()->GetXYZ(v) ;//SPD
+//  fInputEvent->GetPrimaryVertex()->GetXYZ(v);
+//     
+//}
 
 
 //____________________________________________________________________________
 Double_t AliCaloTrackESDReader::GetBField() const {
   //Return magnetic field
 
-  Double_t bfield = ((AliESDEvent*)fInputEvent)->GetMagneticField();
+  Double_t bfield = fInputEvent->GetMagneticField();
 
   return bfield;
 }
@@ -423,9 +442,20 @@ Double_t AliCaloTrackESDReader::GetBField() const {
 void AliCaloTrackESDReader::SetInputOutputMCEvent(AliVEvent* esd, AliAODEvent* aod, AliMCEvent* mc) {
   // Connect the data pointers
   
-  if(strcmp(esd->GetName(),"AliESDEvent")){
-    printf("AliCaloTrackESDReader::SetInputOutputMCEvent() - STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent \n",esd->GetName());
-    abort();
+  Bool_t tesd = kFALSE ; 
+
+  if ( strcmp(esd->GetName(), "AliMixedEvent") == 0 ) {
+    AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
+    if (multiEH->GetFormat() == 0 ) {
+      tesd = kTRUE ; 
+    }
+  }
+  if (strcmp(esd->GetName(),"AliESDEvent") == 0) {
+    tesd = kTRUE ; 
+  }
+  
+  if(!tesd){
+    AliFatal(Form("AliCaloTrackESDReader::SetInputOutputMCEvent() - STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent \n",esd->GetName()));
   }
   
   SetInputEvent(esd);
index 6bd2935..c903e63 100755 (executable)
@@ -31,13 +31,13 @@ class AliCaloTrackESDReader : public AliCaloTrackReader {
   //AliCaloTrackESDReader & operator = (const AliCaloTrackESDReader & g) ;//cpy assignment
   virtual ~AliCaloTrackESDReader() {;} //virtual dtor
   
-  void FillInputCTS  () ;
-  void FillInputEMCAL() ;
-  void FillInputPHOS () ;  
-  void FillInputEMCALCells() ;
-  void FillInputPHOSCells() ;
+//  void FillInputCTS  () ;
+//  void FillInputEMCAL() ;
+//  void FillInputPHOS () ;  
+//  void FillInputEMCALCells() ;
+//  void FillInputPHOSCells() ;
   
-  void GetVertex(Double_t v[3]) const ;
+//  void GetVertex(Double_t v[3]) const ;
   Double_t GetBField() const;
   void SetInputOutputMCEvent(AliVEvent* esd, AliAODEvent* aod, AliMCEvent* mc) ; 
        
index 0d1caae..470a39a 100755 (executable)
 #include "AliMCEvent.h"
 #include "AliAODMCHeader.h"
 #include "AliGenPythiaEventHeader.h"
+#include "AliVEvent.h"
 #include "AliAODEvent.h"
+#include "AliVTrack.h"
+#include "AliVParticle.h"
+#include "AliMixedEvent.h"
 
 ClassImp(AliCaloTrackReader)
   
@@ -55,7 +59,8 @@ ClassImp(AliCaloTrackReader)
     fAODPHOSNormalInputEntries(0), fTrackStatus(0), 
     fReadStack(kFALSE), fReadAODMCParticles(kFALSE), 
     fCleanOutputStdAOD(kFALSE), fDeltaAODFileName("deltaAODPartCorr.root"),fFiredTriggerClassName(""),
-    fAnaLED(kFALSE),fTaskName(""),fCaloUtils(0x0)
+    fAnaLED(kFALSE),fTaskName(""),fCaloUtils(0x0), 
+    fMixedEvent(NULL), fNMixedEvent(1), fVertex(NULL), fWriteOutputStdAOD(kFALSE)
 {
   //Ctor
   
@@ -185,6 +190,12 @@ AliCaloTrackReader::~AliCaloTrackReader() {
     fPHOSCells->Clear() ; 
     delete fPHOSCells ;
   }
+  if (fMixedEvent) {
+    for (Int_t i = 0; i < fNMixedEvent; i++) {
+      delete [] fVertex[i] ; 
+    }
+  }
+  delete [] fVertex ;
        
 //  Pointers not owned, done by the analysis frame
 //  if(fInputEvent)  delete fInputEvent ;
@@ -268,21 +279,24 @@ AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const {
 
 //____________________________________________________________________________
 TClonesArray* AliCaloTrackReader::GetAODMCParticles(Int_t input) const {
-       //Return list of particles in AOD. Do it for the corresponding input event.
-       if(fDataType == kAOD){
-        //Normal input AOD
-        if(input == 0) return (TClonesArray*)((AliAODEvent*)fInputEvent)->FindListObject("mcparticles");
-         //Second input AOD
-        else if(input == 1 && fSecondInputAODEvent) return (TClonesArray*) fSecondInputAODEvent->FindListObject("mcparticles");        
-        else {
-            printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input); 
-                return 0x0;
-        }
-       }
-       else {
-               printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); 
-               return 0x0;
-       }
+    //Return list of particles in AOD. Do it for the corresponding input event.
+  TClonesArray * rv = NULL ; 
+    // if(fDataType == kAOD){
+    //Normal input AOD
+  AliAODEvent * evt = NULL ; 
+  if (evt) {
+    if(input == 0){
+      evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
+      rv = (TClonesArray*)evt->FindListObject("mcparticles");
+    } else if(input == 1 && fSecondInputAODEvent){ //Second input AOD   
+      rv = (TClonesArray*) fSecondInputAODEvent->FindListObject("mcparticles");        
+    } else {
+    printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input); 
+    }
+  } else {
+    printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); 
+  }
+  return rv ; 
 }
 
 //____________________________________________________________________________
@@ -417,7 +431,8 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * curre
   if(fInputEvent->GetHeader())
          eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
   if( fFiredTriggerClassName  !="" && !fAnaLED){
-       if(eventType!=7)return kFALSE; //Only physics event, do not use for simulated events!!!
+    if(eventType!=7)
+      return kFALSE; //Only physics event, do not use for simulated events!!!
     if(fDebug > 0) 
       printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n",
             GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName));
@@ -474,12 +489,26 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * curre
     
   }
        
-  if(fFillEMCALCells) FillInputEMCALCells();
-  if(fFillPHOSCells)  FillInputPHOSCells();
+
+  for (Int_t iev = 0; iev < fNMixedEvent; iev++) {
+    if (!fMixedEvent) {
+      GetVertex() ;
+    }      
+    else 
+      fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);     
+  }
+  
+  if(fFillEMCALCells) 
+    FillInputEMCALCells();
+  if(fFillPHOSCells)  
+    FillInputPHOSCells();
        
-  if(fFillCTS)   FillInputCTS();
-  if(fFillEMCAL) FillInputEMCAL();
-  if(fFillPHOS)  FillInputPHOS();
+  if(fFillCTS)   
+    FillInputCTS();
+  if(fFillEMCAL) 
+    FillInputEMCAL();
+  if(fFillPHOS)  
+    FillInputPHOS();
 
        
   return kTRUE ;
@@ -501,3 +530,325 @@ void AliCaloTrackReader::ResetLists() {
   }
 
 }
+
+//____________________________________________________________________________
+void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)  
+{
+  fInputEvent  = input;
+  fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ; 
+  if (fMixedEvent) {
+    fNMixedEvent = fMixedEvent->GetNumberOfEvents() ; 
+  }
+  fVertex = new Double_t*[fNMixedEvent] ; 
+  for (Int_t i = 0; i < fNMixedEvent; i++) {
+    fVertex[i] = new Double_t[3] ; 
+    fVertex[i][0] = 0.0 ; 
+    fVertex[i][1] = 0.0 ; 
+    fVertex[i][2] = 0.0 ; 
+  }
+}
+
+//____________________________________________________________________________
+Double_t * AliCaloTrackReader::GetVertex() {
+    //Return vertex position
+  if (fMixedEvent)
+    return NULL ; 
+  if(fInputEvent->GetPrimaryVertex())
+    fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]); 
+  else {
+    printf("AliCaloTrackReader::GetVertex() - No vertex available, InputEvent()->GetPrimaryVertex() = 0, return (0,0,0)\n");
+    fVertex[0][0]=0.0; fVertex[0][1]=0.0; fVertex[0][2]=0.0;
+  }
+  return fVertex[0] ; 
+}
+
+  //____________________________________________________________________________
+void AliCaloTrackReader::FillInputCTS() {
+    //Return array with Central Tracking System (CTS) tracks
+  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputCTS()\n");
+  Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
+  Int_t naod = 0;
+  Double_t p[3];
+  for (Int_t itrack =  0; itrack <  nTracks; itrack++) {////////////// track loop
+    AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
+    
+      //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
+    if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) 
+      continue ;
+    
+    track->GetPxPyPz(p) ;
+    TLorentzVector momentum(p[0],p[1],p[2],0);
+    
+    if(fCTSPtMin < momentum.Pt()){
+      
+      if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) 
+        continue;
+      
+      if(fDebug > 2 && momentum.Pt() > 0.1) 
+        printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+               momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+      
+      if (fMixedEvent) {
+        track->SetID(itrack);
+      }
+      if(fWriteOutputStdAOD){
+        AliAODTrack * aodTrack = dynamic_cast<AliAODTrack*> (track) ;
+        if (aodTrack) {
+          AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*aodTrack);
+          fAODCTS->Add(newtrack); //Use AOD stored in output for references.
+        } else {
+          AliError("Can only write AOD tracks to output AOD !") ;
+        }
+      }
+      else {
+        fAODCTS->Add(track);        
+      } 
+    }//Pt and Fiducial cut passed. 
+  }// track loop
+       
+  fAODCTSNormalInputEntries = fAODCTS->GetEntriesFast();
+  if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS()   - aod entries %d\n", fAODCTSNormalInputEntries);
+  
+    //  //If second input event available, add the clusters.
+    //  if(fSecondInputAODTree && fSecondInputAODEvent){
+    //   nTracks   = fSecondInputAODEvent->GetNumberOfTracks() ;
+    //   if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS()   - Add second input tracks, entries %d\n", nTracks) ;
+    //   for (Int_t itrack =  0; itrack <  nTracks; itrack++) {////////////// track loop
+    //           AliAODTrack * track = ((AliAODEvent*)fSecondInputAODEvent)->GetTrack(itrack) ; // retrieve track from esd
+    //           
+    //           //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
+    //           if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ;
+    //           
+    //           track->GetPxPyPz(p) ;
+    //           TLorentzVector momentum(p[0],p[1],p[2],0);
+    //           
+    //           if(fCTSPtMin < momentum.Pt()){
+    //
+    //                   if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
+    //
+    //                   if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+    //                                                                momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+    //                   
+    //                   if(fWriteOutputStdAOD){
+    //                           AliAODTrack* newtrack = new((*(fOutputEvent->GetTracks()))[naod++]) AliAODTrack(*track);
+    //                           fAODCTS->Add(newtrack); //Use AOD stored in output for references.
+    //                   }
+    //                   else fAODCTS->Add(track);
+    //                   
+    //           }//Pt and Fiducial cut passed. 
+    //   }// track loop
+    //   
+    //   if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS()   - aod normal entries %d, after second input %d\n", fAODCTSNormalInputEntries, fAODCTS->GetEntriesFast());
+    //  }      //second input loop
+    // 
+}
+
+  //____________________________________________________________________________
+void AliCaloTrackReader::FillInputEMCAL() {
+    //Return array with EMCAL clusters in aod format
+  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputEMCAL()\n");
+  
+  Int_t naod =  (fOutputEvent->GetCaloClusters())->GetEntriesFast();
+    //Loop to select clusters in fiducial cut and fill container with aodClusters
+  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
+  for (Int_t iclus =  0; iclus <  nclusters; iclus++) {
+    AliVCluster * clus = 0;
+    if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) {
+      if (clus->IsEMCAL()){
+        
+          //Check if the cluster contains any bad channel and if close to calorimeter borders
+        Int_t vindex = 0 ;  
+        if (fMixedEvent) 
+          vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
+        
+        if(GetCaloUtils()->ClusterContainsBadChannel("EMCAL",clus->GetCellsAbsId(), clus->GetNCells())) 
+          continue;
+        if(!GetCaloUtils()->CheckCellFiducialRegion(clus, (AliVCaloCells*)fInputEvent->GetEMCALCells(), fInputEvent, vindex)) 
+          continue;
+        
+        TLorentzVector momentum ;
+        
+        clus->GetMomentum(momentum, fVertex[vindex]);      
+        
+        if(fEMCALPtMin < momentum.Pt()){
+          
+          if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) 
+            continue;
+          
+          if(fDebug > 2 && momentum.E() > 0.1) 
+            printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+                   momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+          
+            //Recalibrate the cluster energy 
+          if(GetCaloUtils()->IsRecalibrationOn()) {
+            Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetEMCALCells());
+            clus->SetE(energy);
+          }
+          
+          if (fMixedEvent) {
+            clus->SetID(iclus) ; 
+          }
+          if(fWriteOutputStdAOD){
+            AliAODCaloCluster * aodClus = dynamic_cast<AliAODCaloCluster*> (clus) ;
+            if (aodClus) {
+              AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*aodClus);
+              fAODEMCAL->Add(newclus); 
+            } else {
+              AliError("Can only write AOD clusters to output AOD !") ;
+            }
+          } else {
+            fAODEMCAL->Add(clus);      
+          }
+        }//Pt and Fiducial cut passed.
+      }//EMCAL cluster
+    }// cluster exists
+  }// cluster loop
+  fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast();
+  if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod entries %d\n", fAODEMCALNormalInputEntries);
+  
+    //If second input event available, add the clusters.
+    //  if(fSecondInputAODTree && fSecondInputAODEvent){
+    //   GetSecondInputAODVertex(v);
+    //   nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNumberOfCaloClusters();
+    //   if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Add second input clusters, entries %d\n", nclusters) ;
+    //         for (Int_t iclus =  0; iclus < nclusters; iclus++) {
+    //                 AliAODCaloCluster * clus = 0;
+    //                 if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) {
+    //                         if (clus->IsEMCAL()){
+    //                                 TLorentzVector momentum ;
+    //                                 clus->GetMomentum(momentum, v);      
+    //                                 
+    //                                 if(fEMCALPtMin < momentum.Pt()){
+    //
+    //                                         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) continue;
+    //
+    //                                         if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+    //                                                                                                                                 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+    //                                         if(fWriteOutputStdAOD){
+    //                                                 AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus);
+    //                                             fAODEMCAL->Add(newclus);    
+    //                                         }
+    //                                         else fAODEMCAL->Add(clus);      
+    //                                 }//Pt and Fiducial cut passed.
+    //                         }//EMCAL cluster
+    //                 }// cluster exists
+    //         }// cluster loop
+    //         
+    //   if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod normal entries %d, after second input %d\n", fAODEMCALNormalInputEntries, fAODEMCAL->GetEntriesFast());
+    //
+    // } //second input loop
+}
+
+  //____________________________________________________________________________
+void AliCaloTrackReader::FillInputPHOS() {
+    //Return array with PHOS clusters in aod format
+  if(fDebug > 2 ) printf("AliCaloTrackAODReader::FillInputPHOS()\n");
+       
+    //Get vertex for momentum calculation  
+  
+  Int_t naod =  (fOutputEvent->GetCaloClusters())->GetEntriesFast();
+    //Loop to select clusters in fiducial cut and fill container with aodClusters
+  Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
+  for (Int_t iclus = 0; iclus < nclusters; iclus++) {
+    AliVCluster * clus = 0;
+    if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) {
+      if (clus->IsPHOS()){
+          //Check if the cluster contains any bad channel and if close to calorimeter borders
+        Int_t vindex = 0 ;  
+        if (fMixedEvent) 
+          vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
+        if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) 
+          continue;
+        if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex)) 
+          continue;
+        
+        TLorentzVector momentum ;
+        
+        clus->GetMomentum(momentum, fVertex[vindex]);      
+        
+        if(fPHOSPtMin < momentum.Pt()){
+          
+          if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) 
+            continue;
+          
+          if(fDebug > 2 && momentum.E() > 0.1) 
+            printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+                   momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+          
+            //Recalibrate the cluster energy 
+          if(GetCaloUtils()->IsRecalibrationOn()) {
+            Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
+            clus->SetE(energy);
+          }
+          
+          if (fMixedEvent) {
+            clus->SetID(iclus) ; 
+          }              
+          
+          if(fWriteOutputStdAOD){
+            AliAODCaloCluster * aodClus = dynamic_cast<AliAODCaloCluster*> (clus) ;
+            if (aodClus) {
+              AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*aodClus);
+              fAODPHOS->Add(newclus);  
+            } else {
+              AliError("Can only write AOD clusters to output AOD !") ;
+            }
+          } else {
+            fAODPHOS->Add(clus);       
+          }
+        }//Pt and Fiducial cut passed.
+      }//PHOS cluster
+    }//cluster exists
+  }//esd cluster loop
+  
+  fAODPHOSNormalInputEntries = fAODPHOS->GetEntriesFast() ;
+  if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS()  - aod entries %d\n", fAODPHOSNormalInputEntries);
+  
+    //If second input event available, add the clusters.
+    //  if(fSecondInputAODTree && fSecondInputAODEvent){  
+    //   GetSecondInputAODVertex(v);
+    //   nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNumberOfCaloClusters();
+    //   if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS()  - Add second input clusters, entries %d\n", nclusters);
+    //         for (Int_t iclus =  0; iclus < nclusters; iclus++) {
+    //                 AliAODCaloCluster * clus = 0;
+    //                 if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) {
+    //                         if (clus->IsPHOS()){
+    //                                 TLorentzVector momentum ;
+    //                                 clus->GetMomentum(momentum, v);      
+    //                                 
+    //                                 if(fPHOSPtMin < momentum.Pt()){
+    //
+    //                                         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
+    //
+    //                                         if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
+    //                                                                                                                                 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+    //                                         if(fWriteOutputStdAOD){
+    //                                                 AliAODCaloCluster * newclus = new((*(fOutputEvent->GetCaloClusters()))[naod++])AliAODCaloCluster(*clus);
+    //                                             fAODPHOS->Add(newclus);     
+    //                                         }
+    //                                         else fAODPHOS->Add(clus);       
+    //                                 }//Pt and Fiducial cut passed.
+    //                         }//PHOS cluster
+    //                 }// cluster exists
+    //         }// cluster loop
+    //         if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS()  - aod normal entries %d, after second input %d\n", fAODPHOSNormalInputEntries, fAODPHOS->GetEntriesFast());
+    //  }      //second input loop
+  
+}
+
+  //____________________________________________________________________________
+void AliCaloTrackReader::FillInputEMCALCells() {
+    //Return array with EMCAL cells in aod format
+  
+  fEMCALCells = fInputEvent->GetEMCALCells(); 
+  
+}
+
+  //____________________________________________________________________________
+void AliCaloTrackReader::FillInputPHOSCells() {
+    //Return array with PHOS cells in aod format
+  
+  fPHOSCells = fInputEvent->GetPHOSCells(); 
+  
+}
+
index b9bda81..fc85a07 100755 (executable)
@@ -27,6 +27,8 @@ class AliGenEventHeader ;
 class AliVEvent;
 class AliAODEvent;
 class AliMCEvent;
+class AliMixedEvent;
+#include "AliVCaloCells.h"
 #include "AliFiducialCut.h"
 class AliAODMCHeader;
 #include "AliCalorimeterUtils.h"
@@ -93,17 +95,17 @@ public:
   void SwitchOffPHOSCells()  {fFillPHOSCells = kFALSE ; }
 
   virtual Bool_t FillInputEvent(const Int_t iEntry, const char *currentFileName)  ;
-  virtual void FillInputCTS()   {;}
-  virtual void FillInputEMCAL() {;}
-  virtual void FillInputPHOS()  {;}
-  virtual void FillInputEMCALCells() {;}
-  virtual void FillInputPHOSCells()  {;}
+  virtual void FillInputCTS() ;
+  virtual void FillInputEMCAL() ;
+  virtual void FillInputPHOS() ;
+  virtual void FillInputEMCALCells() ;
+  virtual void FillInputPHOSCells() ;
 
   virtual TObjArray* GetAODCTS()   const {return fAODCTS ;}
   virtual TObjArray* GetAODEMCAL() const {return fAODEMCAL ;}
   virtual TObjArray* GetAODPHOS()  const {return fAODPHOS ;}
-  virtual TNamed* GetEMCALCells()  const {return fEMCALCells ;}
-  virtual TNamed* GetPHOSCells()   const {return fPHOSCells ;}
+  virtual AliVCaloCells* GetEMCALCells()  const { return fEMCALCells ;}
+  virtual AliVCaloCells* GetPHOSCells()   const { return fPHOSCells ;}
 
   //Get MC  informatio
   //Kinematics and galice.root available 
@@ -123,7 +125,8 @@ public:
        
   virtual void Init();
        
-  virtual void SetInputEvent(AliVEvent* const input)  {fInputEvent  = input;}
+//  virtual void SetInputEvent(AliVEvent* const input)  {fInputEvent  = input;}
+  virtual void SetInputEvent(AliVEvent* const input) ;
   virtual void SetOutputEvent(AliAODEvent* const aod) {fOutputEvent = aod;}
   virtual void SetMC(AliMCEvent* const mc)            {fMC  = mc;}
 
@@ -186,6 +189,9 @@ public:
 
   AliCalorimeterUtils * GetCaloUtils() const {return fCaloUtils ; }
   void SetCaloUtils(AliCalorimeterUtils * caloutils) { fCaloUtils = caloutils ; }
+  
+  Double_t * GetVertex() ;  
+
 
  protected:
   Int_t                   fEventNumber; // Event number
@@ -205,8 +211,8 @@ public:
   TObjArray *    fAODCTS ;        //! temporal referenced array with tracks
   TObjArray *    fAODEMCAL ;      //! temporal referenced array with EMCAL CaloClusters
   TObjArray *    fAODPHOS ;       //! temporal referenced array with PHOS CaloClusters
-  TNamed *       fEMCALCells ;    //! temporal array with EMCAL CaloCells, ESD or AOD
-  TNamed *       fPHOSCells ;     //! temporal array with PHOS CaloCells, ESD or AOD
+  AliVCaloCells *fEMCALCells ;    //! temporal array with EMCAL CaloCells, ESD or AOD
+  AliVCaloCells *fPHOSCells ;     //! temporal array with PHOS CaloCells, ESD or AOD
 
   AliVEvent   *  fInputEvent;     //! pointer to esd or aod input
   AliAODEvent *  fOutputEvent;    //! pointer to aod output
@@ -229,9 +235,9 @@ public:
        
   ULong_t        fTrackStatus        ; // Track selection bit, select tracks refitted in TPC, ITS ...
   Bool_t         fReadStack          ; // Access kine information from stack
-  Bool_t            fReadAODMCParticles ; // Access kine information from filtered AOD MC particles
+  Bool_t              fReadAODMCParticles ; // Access kine information from filtered AOD MC particles
        
-  Bool_t            fCleanOutputStdAOD;   // clean the written standard tracks and caloclusters in output AOD
+  Bool_t              fCleanOutputStdAOD;   // clean the written standard tracks and caloclusters in output AOD
   TString        fDeltaAODFileName ;   // Delta AOD file name
   TString        fFiredTriggerClassName  ;  // Name of trigger event type used to do the analysis
 
@@ -240,8 +246,15 @@ public:
   TString fTaskName;           // Name of task that executes the analysis
        
   AliCalorimeterUtils *  fCaloUtils ;  //  Pointer to CalorimeterUtils
+
+  AliMixedEvent* fMixedEvent ;         //! mixed event object. This class is not the owner
+  Int_t          fNMixedEvent ;        //! number of events in mixed event buffer
+  Double_t **    fVertex ;             //! vertex array 3 dim for each mixed event buffer
+  
+  Bool_t              fWriteOutputStdAOD;   // Write selected standard tracks and caloclusters in output AOD
+
        
-  ClassDef(AliCaloTrackReader,15)
+  ClassDef(AliCaloTrackReader,16)
 } ;
 
 
index 0a13661..511874f 100755 (executable)
 
 //---- ANALYSIS system ----
 #include "AliCalorimeterUtils.h"
-#include "AliAODEvent.h"
-#include "AliESDEvent.h"
+#include "AliVEvent.h"
 #include "AliAODPWG4Particle.h"
-#include "AliAODCaloCluster.h"
-#include "AliESDCaloCluster.h"
-#include "AliAODCaloCells.h"
-#include "AliESDCaloCells.h"
+#include "AliVCluster.h"
+#include "AliVCaloCells.h"
+#include "AliMixedEvent.h"
 
 
 ClassImp(AliCalorimeterUtils)
@@ -43,7 +41,7 @@ ClassImp(AliCalorimeterUtils)
 //____________________________________________________________________________
   AliCalorimeterUtils::AliCalorimeterUtils() : 
     TObject(), fDebug(0), 
-    fEMCALGeoName("EMCAL_COMPLETE"),fPHOSGeoName("PHOSgeo"), 
+    fEMCALGeoName("EMCAL_FIRSTYEAR"),fPHOSGeoName("PHOSgeo"), 
     fEMCALGeo(0x0), fPHOSGeo(0x0), 
     fEMCALGeoMatrixSet(kFALSE), fPHOSGeoMatrixSet(kFALSE), 
     fRemoveBadChannels(kFALSE),
@@ -108,25 +106,61 @@ AliCalorimeterUtils::~AliCalorimeterUtils() {
 }
 
 //_______________________________________________________________
-Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliAODCaloCluster* cluster, AliAODCaloCells* cells) const {
+Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev) const {
+
        // Given the list of AbsId of the cluster, get the maximum cell and 
        // check if there are fNCellsFromBorder from the calorimeter border
        
-       //If the distance to the border is 0 or negative just exit accept all clusters
-       if(cells->GetType()==AliAODCaloCells::kEMCAL && fNCellsFromEMCALBorder <= 0 ) return kTRUE;
-       if(cells->GetType()==AliAODCaloCells::kPHOS  && fNCellsFromPHOSBorder  <= 0 ) return kTRUE;
+    //If the distance to the border is 0 or negative just exit accept all clusters
+       if(cells->GetType()==AliVCaloCells::kEMCALCell && fNCellsFromEMCALBorder <= 0 ) return kTRUE;
+       if(cells->GetType()==AliVCaloCells::kPHOSCell  && fNCellsFromPHOSBorder  <= 0 ) return kTRUE;
 
-       //Find cells with maximum amplitude
-       Int_t absIdMax  = -1;
+  Int_t absIdMax       = -1;
        Float_t ampMax  = -1;
-       for(Int_t i = 0; i < cluster->GetNCells() ; i++){
-               Int_t absId = cluster->GetCellAbsId(i) ;
-               Float_t amp     = cells->GetCellAmplitude(absId);
-               if(amp > ampMax){
-                       ampMax   = amp;
-                       absIdMax = absId;
-               }
-       }
+       
+  AliMixedEvent * mixEvent = dynamic_cast<AliMixedEvent*> (event);
+  Int_t nMixedEvents = 0 ; 
+  Int_t * cellsCumul = NULL ;
+  Int_t numberOfCells = 0 ;  
+  if (mixEvent){
+    nMixedEvents = mixEvent->GetNumberOfEvents() ; 
+    if (cells->GetType()==AliVCaloCells::kEMCALCell) {
+      cellsCumul =  mixEvent->GetEMCALCellsCumul() ; 
+      numberOfCells = mixEvent->GetNumberOfEMCALCells() ;
+    } 
+      
+    else if (cells->GetType()==AliVCaloCells::kPHOSCell) {
+      cellsCumul =  mixEvent->GetPHOSCellsCumul() ; 
+      numberOfCells = mixEvent->GetNumberOfPHOSCells() ;
+    } 
+    Int_t startCell = cellsCumul[iev] ; 
+    Int_t endCell   = (iev+1 < nMixedEvents)?cellsCumul[iev+1]:numberOfCells;
+      //Find cells with maximum amplitude
+    for(Int_t i = 0; i < cluster->GetNCells() ; i++){
+      Int_t absId = cluster->GetCellAbsId(i) ;
+      for (Int_t j = startCell; j < endCell ;  j++) {
+        Short_t cellNumber; 
+        Double_t amp ; 
+        Double_t time; 
+        cells->GetCell(j, cellNumber, amp, time) ; 
+        if (absId == cellNumber) {
+          if(amp > ampMax){
+            ampMax   = amp;
+            absIdMax = absId;
+          }        
+        }
+      }
+    }
+  } else {
+    for(Int_t i = 0; i < cluster->GetNCells() ; i++){
+      Int_t absId = cluster->GetCellAbsId(i) ;
+      Float_t amp      = cells->GetCellAmplitude(absId);
+      if(amp > ampMax){
+        ampMax   = amp;
+        absIdMax = absId;
+      }
+    }
+  }
        
        if(fDebug > 1)
                printf("AliCalorimeterUtils::CheckCellFiducialRegion(AOD) - Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f\n", 
@@ -138,7 +172,7 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliAODCaloCluster* cluster,
        Bool_t okrow = kFALSE;
        Bool_t okcol = kFALSE;
 
-       if(cells->GetType()==AliAODCaloCells::kEMCAL){
+       if(cells->GetType()==AliVCaloCells::kEMCALCell){
        
                Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1; 
                fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta); 
@@ -172,7 +206,7 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliAODCaloCluster* cluster,
                        else  printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
                }
        }//EMCAL
-       else if(cells->GetType()==AliAODCaloCells::kPHOS){
+       else if(cells->GetType()==AliVCaloCells::kPHOSCell){
                Int_t relId[4];
                Int_t irow = -1, icol = -1;
                fPHOSGeo->AbsToRelNumbering(absIdMax,relId);
@@ -196,92 +230,92 @@ Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliAODCaloCluster* cluster,
 }      
 
 //_______________________________________________________________
-Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const {
-       // Given the list of AbsId of the cluster, get the maximum cell and 
-       // check if there are fNCellsFromBorder from the calorimeter border
-       
-       //If the distance to the border is 0 or negative just exit accept all clusters
-       if(cells->GetType()==AliESDCaloCells::kEMCALCell && fNCellsFromEMCALBorder <= 0 ) return kTRUE;
-       if(cells->GetType()==AliESDCaloCells::kPHOSCell  && fNCellsFromPHOSBorder  <= 0 ) return kTRUE;
-       
-       //Find cell with maximum amplitude
-       Int_t absIdMax  = -1;
-       Float_t ampMax  = -1;
-       for(Int_t i = 0; i < cluster->GetNCells() ; i++){
-               Int_t absId = cluster->GetCellAbsId(i) ;
-               Float_t amp     = cells->GetCellAmplitude(absId);
-               if(amp > ampMax){
-                       ampMax   = amp;
-                       absIdMax = absId;
-               }
-       }
-       
-       if(fDebug > 1)
-               printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f\n", 
-                                                absIdMax, ampMax, cluster->E());
-       if(absIdMax==-1) return kFALSE;
-       
-       //Check if the cell is close to the borders:
-       Bool_t okrow = kFALSE;
-       Bool_t okcol = kFALSE;
-       
-       if(cells->GetType()==AliESDCaloCells::kEMCALCell){
-               
-               Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1; 
-               fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta); 
-               fEMCALGeo->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta);
-               
-               //Check rows/phi
-               if(iSM < 10){
-                       if(iphi >= fNCellsFromEMCALBorder && iphi < 24-fNCellsFromEMCALBorder) okrow =kTRUE; 
-           }
-               else{
-                       if(iphi >= fNCellsFromEMCALBorder && iphi < 12-fNCellsFromEMCALBorder) okrow =kTRUE; 
-               }
-               
-               //Check collumns/eta
-               if(!fNoEMCALBorderAtEta0){
-                       if(ieta  > fNCellsFromEMCALBorder && ieta < 48-fNCellsFromEMCALBorder) okcol =kTRUE; 
-               }
-               else{
-                       if(iSM%2==0){
-                               if(ieta >= fNCellsFromEMCALBorder)     okcol = kTRUE;   
-                       }
-                       else {
-                               if(ieta <  48-fNCellsFromEMCALBorder)  okcol = kTRUE;   
-                       }
-               }//eta 0 not checked
-               if(fDebug > 1)
-               {
-                       printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ?",
-                                  fNCellsFromEMCALBorder, ieta, iphi, iSM);
-                       if (okcol && okrow ) printf(" YES \n");
-                       else  printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
-               }
-       }//EMCAL
-       else if(cells->GetType()==AliESDCaloCells::kPHOSCell){
-               Int_t relId[4];
-               Int_t irow = -1, icol = -1;
-               fPHOSGeo->AbsToRelNumbering(absIdMax,relId);
-               irow = relId[2];
-               icol = relId[3];
-               //imod = relId[0]-1;
-               if(irow >= fNCellsFromPHOSBorder && irow < 64-fNCellsFromPHOSBorder) okrow =kTRUE; 
-               if(icol >= fNCellsFromPHOSBorder && icol < 56-fNCellsFromPHOSBorder) okcol =kTRUE; 
-               if(fDebug > 1)
-               {
-                       printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - PHOS Cluster in %d cells fiducial volume: icol %d, irow %d, Module %d ?",
-                                  fNCellsFromPHOSBorder, icol, irow,relId[0]-1);
-                       if (okcol && okrow ) printf(" YES \n");
-                       else  printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
-               }
-       }//PHOS
-       
-       if (okcol && okrow) return kTRUE; 
-       else                return kFALSE;
-       
-}      
-
+//Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const {
+//     // Given the list of AbsId of the cluster, get the maximum cell and 
+//     // check if there are fNCellsFromBorder from the calorimeter border
+//     
+//     //If the distance to the border is 0 or negative just exit accept all clusters
+//     if(cells->GetType()==AliVCaloCells::kEMCALCell && fNCellsFromEMCALBorder <= 0 ) return kTRUE;
+//     if(cells->GetType()==AliVCaloCells::kPHOSCell  && fNCellsFromPHOSBorder  <= 0 ) return kTRUE;
+//     
+//     //Find cell with maximum amplitude
+//     Int_t absIdMax  = -1;
+//     Float_t ampMax  = -1;
+//     for(Int_t i = 0; i < cluster->GetNCells() ; i++){
+//             Int_t absId = cluster->GetCellAbsId(i) ;
+//             Float_t amp     = cells->GetCellAmplitude(absId);
+//             if(amp > ampMax){
+//                     ampMax   = amp;
+//                     absIdMax = absId;
+//             }
+//     }
+//     
+//     if(fDebug > 1)
+//             printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - Cluster Max AbsId %d, Cell Energy %2.2f, Cluster Energy %2.2f\n", 
+//                                              absIdMax, ampMax, cluster->E());
+//     if(absIdMax==-1) return kFALSE;
+//     
+//     //Check if the cell is close to the borders:
+//     Bool_t okrow = kFALSE;
+//     Bool_t okcol = kFALSE;
+//     
+//     if(cells->GetType()==AliESDCaloCells::kEMCALCell){
+//             
+//             Int_t iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1, iSM = -1; 
+//             fEMCALGeo->GetCellIndex(absIdMax,iSM,iTower,iIphi,iIeta); 
+//             fEMCALGeo->GetCellPhiEtaIndexInSModule(iSM,iTower,iIphi, iIeta,iphi,ieta);
+//             
+//             //Check rows/phi
+//             if(iSM < 10){
+//                     if(iphi >= fNCellsFromEMCALBorder && iphi < 24-fNCellsFromEMCALBorder) okrow =kTRUE; 
+//         }
+//             else{
+//                     if(iphi >= fNCellsFromEMCALBorder && iphi < 12-fNCellsFromEMCALBorder) okrow =kTRUE; 
+//             }
+//             
+//             //Check collumns/eta
+//             if(!fNoEMCALBorderAtEta0){
+//                     if(ieta  > fNCellsFromEMCALBorder && ieta < 48-fNCellsFromEMCALBorder) okcol =kTRUE; 
+//             }
+//             else{
+//                     if(iSM%2==0){
+//                             if(ieta >= fNCellsFromEMCALBorder)     okcol = kTRUE;   
+//                     }
+//                     else {
+//                             if(ieta <  48-fNCellsFromEMCALBorder)  okcol = kTRUE;   
+//                     }
+//             }//eta 0 not checked
+//             if(fDebug > 1)
+//             {
+//                     printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - EMCAL Cluster in %d cells fiducial volume: ieta %d, iphi %d, SM %d ?",
+//                                fNCellsFromEMCALBorder, ieta, iphi, iSM);
+//                     if (okcol && okrow ) printf(" YES \n");
+//                     else  printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
+//             }
+//     }//EMCAL
+//     else if(cells->GetType()==AliVCaloCells::kPHOSCell){
+//             Int_t relId[4];
+//             Int_t irow = -1, icol = -1;
+//             fPHOSGeo->AbsToRelNumbering(absIdMax,relId);
+//             irow = relId[2];
+//             icol = relId[3];
+//             //imod = relId[0]-1;
+//             if(irow >= fNCellsFromPHOSBorder && irow < 64-fNCellsFromPHOSBorder) okrow =kTRUE; 
+//             if(icol >= fNCellsFromPHOSBorder && icol < 56-fNCellsFromPHOSBorder) okcol =kTRUE; 
+//             if(fDebug > 1)
+//             {
+//                     printf("AliCalorimeterUtils::CheckCellFiducialRegion(ESD) - PHOS Cluster in %d cells fiducial volume: icol %d, irow %d, Module %d ?",
+//                                fNCellsFromPHOSBorder, icol, irow,relId[0]-1);
+//                     if (okcol && okrow ) printf(" YES \n");
+//                     else  printf(" NO: column ok? %d, row ok? %d \n",okcol,okrow);
+//             }
+//     }//PHOS
+//     
+//     if (okcol && okrow) return kTRUE; 
+//     else                return kFALSE;
+//     
+//}    
+//
 
 //_________________________________________________________________________________________________________
 Bool_t AliCalorimeterUtils::ClusterContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells){
@@ -337,21 +371,15 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODPWG4Particle * particle, AliVEv
                return fEMCALGeo->GetSuperModuleNumber(absId) ;
        }//EMCAL
        else if(particle->GetDetector()=="PHOS"){
-               if(!strcmp(inputEvent->GetName(),"AliESDEvent"))   {
-                       AliESDCaloCluster *cluster = ((AliESDEvent*)inputEvent)->GetCaloCluster(particle->GetCaloLabel(0));
-                       return GetModuleNumber(cluster);
-               }//ESDs
-               else{
-                       AliAODCaloCluster *cluster = ((AliAODEvent*)inputEvent)->GetCaloCluster(particle->GetCaloLabel(0));
-                       return GetModuleNumber(cluster);
-               }//AODs
+    AliVCluster *cluster = inputEvent->GetCaloCluster(particle->GetCaloLabel(0));
+    return GetModuleNumber(cluster);
        }//PHOS
        
        return -1;
 }
 
 //____________________________________________________________________________________________________________________________________________________
-Int_t AliCalorimeterUtils::GetModuleNumber(AliAODCaloCluster * cluster) const
+Int_t AliCalorimeterUtils::GetModuleNumber(AliVCluster * cluster) const
 {
        //Get the EMCAL/PHOS module number that corresponds to this cluster, input are AODs
        TLorentzVector lv;
@@ -360,14 +388,14 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODCaloCluster * cluster) const
        Float_t phi = lv.Phi();
        if(phi < 0) phi+=TMath::TwoPi();        
        Int_t absId = -1;
-       if(cluster->IsEMCALCluster()){
+       if(cluster->IsEMCAL()){
                fEMCALGeo->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId);
                if(fDebug > 2) 
                  printf("AliCalorimeterUtils::GetModuleNumber(ESD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
                         lv.Eta(), phi*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId));
                return fEMCALGeo->GetSuperModuleNumber(absId) ;
        }//EMCAL
-       else if(cluster->IsPHOSCluster()) {
+       else if(cluster->IsPHOS()) {
                Int_t    relId[4];
                if ( cluster->GetNCells() > 0) {
                        absId = cluster->GetCellAbsId(0);
@@ -389,46 +417,6 @@ Int_t AliCalorimeterUtils::GetModuleNumber(AliAODCaloCluster * cluster) const
        return -1;
 }
 
-//____________________________________________________________________________________________________________________________________________________
-Int_t AliCalorimeterUtils::GetModuleNumber(AliESDCaloCluster * cluster) const
-{
-       //Get the EMCAL/PHOS module number that corresponds to this cluster, input are ESDs
-       TLorentzVector lv;
-       Double_t v[]={0.,0.,0.}; //not necessary to pass the real vertex.
-       cluster->GetMomentum(lv,v);
-       Float_t phi = lv.Phi();
-       if(phi < 0) phi+=TMath::TwoPi();        
-       Int_t absId = -1;
-       if(cluster->IsEMCAL()){
-               fEMCALGeo->GetAbsCellIdFromEtaPhi(lv.Eta(),phi, absId);
-               if(fDebug > 2) 
-                 printf("AliCalorimeterUtils::GetModuleNumber(ESD) - EMCAL: cluster eta %f, phi %f, absid %d, SuperModule %d\n",
-                        lv.Eta(), phi*TMath::RadToDeg(),absId, fEMCALGeo->GetSuperModuleNumber(absId));
-               return fEMCALGeo->GetSuperModuleNumber(absId) ;
-       }//EMCAL
-       else if(cluster->IsPHOS()){
-               Int_t    relId[4];
-               if ( cluster->GetNCells() > 0) {
-                       absId = cluster->GetCellAbsId(0);
-                       if(fDebug > 2) 
-                         printf("AliCalorimeterUtils::GetModuleNumber(ESD) - PHOS: cluster eta %f, phi %f, e %f, absId %d\n",
-                                lv.Eta(), phi*TMath::RadToDeg(), lv.E(), absId);
-               }
-               else return -1;
-               
-               if ( absId >= 0) {
-                       fPHOSGeo->AbsToRelNumbering(absId,relId);
-                       if(fDebug > 2) 
-                         printf("AliCalorimeterUtils::GetModuleNumber(ESD) - PHOS: Module %d\n",relId[0]-1);
-                       return relId[0]-1;
-               }
-               else return -1;
-       }//PHOS
-       
-       return -1;
-}
-
-
 //_____________________________________________________________________________________________________________
 Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t & iRCU) const
 {
@@ -489,7 +477,7 @@ Int_t AliCalorimeterUtils::GetModuleNumberCellIndexes(const Int_t absId, const T
 void AliCalorimeterUtils::InitParameters()
 {
   //Initialize the parameters of the analysis.
-  fEMCALGeoName = "EMCAL_COMPLETE";
+  fEMCALGeoName = "EMCAL_FIRSTYEAR";
   fPHOSGeoName  = "PHOSgeo";
        
   if(gGeoManager) {// geoManager was set
@@ -649,7 +637,7 @@ void AliCalorimeterUtils::Print(const Option_t * opt) const
 } 
 
 //________________________________________________________________
-Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliESDCaloCluster * cluster, AliESDCaloCells * cells){
+Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliVCluster * cluster, AliVCaloCells * cells){
        // Recalibrate the cluster energy, considering the recalibration map and the energy of the cells that compose the cluster.
        // ESD case
 
@@ -688,56 +676,9 @@ Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliESDCaloCluster * cluste
                printf("AliCalorimeterUtils::RecalibrateClusterEnergy(ESD) - Energy before %f, after %f\n",cluster->E(),energy);
        
        return energy;
-
 }
 
 //________________________________________________________________
-Float_t AliCalorimeterUtils::RecalibrateClusterEnergy(AliAODCaloCluster * cluster, AliAODCaloCells * cells){
-       // Recalibrate the cluster energy, considering the recalibration map and the energy of the cells that compose the cluster.
-       // AOD case
-       
-       if(!cells) {
-               printf("AliCalorimeterUtils::RecalibrateClusterEnergy(AOD) - Cells pointer does not exist, stop!");
-               abort();
-       }
-       
-       //Get the cluster number of cells and list of absId, check what kind of cluster do we have.
-       UShort_t * index    = cluster->GetCellsAbsId() ;
-       Double_t * fraction = cluster->GetCellsAmplitudeFraction() ;
-       Int_t ncells = cluster->GetNCells();
-       TString calo = "EMCAL";
-       if(cluster->IsPHOSCluster()) calo = "PHOS";
-       
-       //Initialize some used variables
-       Float_t energy = 0;
-       Int_t absId    = -1;
-    Int_t icol = -1, irow = -1, iRCU = -1, module=1;
-       Float_t factor = 1, frac = 0;
-       
-       //Loop on the cells, get the cell amplitude and recalibration factor, multiply and and to the new energy
-       for(Int_t icell = 0; icell < ncells; icell++){
-               absId = index[icell];
-               frac =  fraction[icell];
-               if(frac < 1e-3) frac = 1; //in case of EMCAL, this is set as 0, not used.
-        module = GetModuleNumberCellIndexes(absId,calo,icol,irow,iRCU);
-               if(cluster->IsPHOSCluster()) factor = GetPHOSChannelRecalibrationFactor (module,icol,irow);
-               else                         factor = GetEMCALChannelRecalibrationFactor(module,icol,irow);
-               if(fDebug>2)
-                       printf("AliCalorimeterUtils::RecalibrateClusterEnergy(ESD) - recalibrate cell: %s, module %d, col %d, row %d, cell fraction %f,recalibration factor %f, cell energy %f\n", 
-                          calo.Data(),module,icol,irow,frac,factor,cells->GetCellAmplitude(absId));
-               
-               energy += cells->GetCellAmplitude(absId)*factor*frac;
-       }
-       
-       if(fDebug>1)
-               printf("AliCalorimeterUtils::RecalibrateClusterEnergy(ESD) - Energy before %f, after %f\n",cluster->E(),energy);
-       
-       return energy;
-       
-}
-
-
-//________________________________________________________________
 void AliCalorimeterUtils::SetGeometryTransformationMatrices(AliVEvent* inputEvent) 
 {
   //Set the calorimeters transformation matrices
@@ -748,9 +689,9 @@ void AliCalorimeterUtils::SetGeometryTransformationMatrices(AliVEvent* inputEven
                  printf(" AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load EMCAL misalignment matrices. \n");
          if(!strcmp(inputEvent->GetName(),"AliESDEvent"))  {
                        for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ 
-                               if(((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod)) {
+                               if(inputEvent->GetEMCALMatrix(mod)) {
                                        //printf("EMCAL: mod %d, matrix %p\n",mod, ((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod));
-                                       fEMCALGeo->SetMisalMatrix(((AliESDEvent*)inputEvent)->GetEMCALMatrix(mod),mod) ;
+                                       fEMCALGeo->SetMisalMatrix(inputEvent->GetEMCALMatrix(mod),mod) ;
                                        fEMCALGeoMatrixSet = kTRUE;//At least one, so good
                                }
                        }// loop over super modules     
@@ -767,9 +708,9 @@ void AliCalorimeterUtils::SetGeometryTransformationMatrices(AliVEvent* inputEven
                        printf(" AliCalorimeterUtils::SetGeometryTransformationMatrices() - Load PHOS misalignment matrices. \n");
                        if(!strcmp(inputEvent->GetName(),"AliESDEvent"))  {
                                for(Int_t mod=0; mod < 5; mod++){ 
-                                       if(((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod)) {
+                                       if(inputEvent->GetPHOSMatrix(mod)) {
                                                //printf("PHOS: mod %d, matrix %p\n",mod, ((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod));
-                                               fPHOSGeo->SetMisalMatrix(((AliESDEvent*)inputEvent)->GetPHOSMatrix(mod),mod) ;
+                                               fPHOSGeo->SetMisalMatrix(inputEvent->GetPHOSMatrix(mod),mod) ;
                                                fPHOSGeoMatrixSet  = kTRUE; //At least one so good
                                        }
                                }// loop over modules   
index 8bef611..afb3aaa 100755 (executable)
@@ -22,10 +22,8 @@ class TArrayF;
 //--- ANALYSIS system ---
 class AliVEvent;
 class AliAODPWG4Particle;
-class AliAODCaloCluster;
-class AliAODCaloCells;
-class AliESDCaloCluster;
-class AliESDCaloCells;
+class AliVCluster;
+class AliVCaloCells;
 #include "AliPHOSGeoUtils.h"
 #include "AliEMCALGeoUtils.h"
 
@@ -97,14 +95,14 @@ class AliCalorimeterUtils : public TObject {
        
   //Calorimeter indexes information
   Int_t GetModuleNumber(AliAODPWG4Particle * particle, AliVEvent* inputEvent) const;
-  Int_t GetModuleNumber(AliAODCaloCluster * cluster) const;
-  Int_t GetModuleNumber(AliESDCaloCluster * cluster) const;
+  Int_t GetModuleNumber(AliVCluster * cluster) const;
+    //  Int_t GetModuleNumber(AliESDCaloCluster * cluster) const;
 
   Int_t GetModuleNumberCellIndexes(const Int_t absId, const TString calo, Int_t & icol, Int_t & irow, Int_t &iRCU) const ;
        
   //Modules fiducial region
-  Bool_t CheckCellFiducialRegion(AliAODCaloCluster* cluster, AliAODCaloCells* cells) const ;
-  Bool_t CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const ;
+  Bool_t CheckCellFiducialRegion(AliVCluster* cluster, AliVCaloCells* cells, AliVEvent * event, Int_t iev=0) const ;
+    //  Bool_t CheckCellFiducialRegion(AliESDCaloCluster* cluster, AliESDCaloCells* cells) const ;
        
   void   SetNumberOfCellsFromEMCALBorder(Int_t n) {fNCellsFromEMCALBorder = n; }
   Int_t  GetNumberOfCellsFromEMCALBorder() const  {return fNCellsFromEMCALBorder; }
@@ -147,8 +145,8 @@ class AliCalorimeterUtils : public TObject {
   void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecalibrationFactors = map;}
   void SetPHOSChannelRecalibrationFactors (TObjArray *map) {fPHOSRecalibrationFactors  = map;}
 
-  Float_t RecalibrateClusterEnergy(AliESDCaloCluster* cluster, AliESDCaloCells * cells);
-  Float_t RecalibrateClusterEnergy(AliAODCaloCluster* cluster, AliAODCaloCells * cells);
+  Float_t RecalibrateClusterEnergy(AliVCluster* cluster, AliVCaloCells * cells);
+    //Float_t RecalibrateClusterEnergy(AliAODCaloCluster* cluster, AliAODCaloCells * cells);
 
  private:
 
index acb04da..98515a1 100644 (file)
@@ -305,7 +305,7 @@ void  AliAnaBtag::MakeAnalysisFillAOD()
           if (clus->GetM02()          < 0.06 ) continue;\r
          \r
          \r
-         Double_t x[3];\r
+         Float_t x[3];\r
          clus->GetPosition(x);\r
          TVector3 cluspos(x[0],x[1],x[2]);\r
          Double_t deta = teta - cluspos.Eta();\r
index 3ed46c5..407ec8f 100755 (executable)
@@ -205,7 +205,7 @@ void AliAnaCaloTrigger::UserExec(Option_t *)
          labelmax = cluster->GetLabel();
        }
        
-       Double_t * pid = cluster->GetPid() ;
+       const Double_t * pid = cluster->GetPID() ;
        
        if(pid[AliPID::kPhoton] > 0.9) {
          if ( cluEnergy > phEnMax) { 
index 8df3cf5..c3f7311 100755 (executable)
  **************************************************************************/
 /* $Id: $ */
 
-//_________________________________________________________________________
-// Class to check results from simulations or reconstructed real data. 
-// Fill few histograms and do some checking plots
-//
-//-- Author: Gustavo Conesa (INFN-LNF)
-//_________________________________________________________________________
+  //_________________________________________________________________________
+  // Class to check results from simulations or reconstructed real data. 
+  // Fill few histograms and do some checking plots
+  //
+  //-- Author: Gustavo Conesa (INFN-LNF)
+  //_________________________________________________________________________
 
 
-// --- ROOT system ---
-//#include "Riostream.h"
+  // --- ROOT system ---
+  //#include "Riostream.h"
 #include "TObjArray.h"
 #include "TParticle.h"
 #include "TDatabasePDG.h"
 #include "TStyle.h"
 #include <TObjString.h>
 
-//---- AliRoot system ----
+  //---- AliRoot system ----
 #include "AliAnaCalorimeterQA.h"
 #include "AliCaloTrackReader.h"
 #include "AliStack.h"
-#include "AliAODCaloCells.h"
-#include "AliESDCaloCells.h"
-#include "AliAODCaloCluster.h"
+#include "AliVCaloCells.h"
 #include "AliFiducialCut.h"
-#include "AliESDtrack.h"
-#include "AliAODTrack.h"
-#include "AliESDCaloCluster.h"
-#include "AliESDEvent.h"
-#include "AliAODEvent.h"
+#include "AliVTrack.h"
+#include "AliVCluster.h"
+#include "AliVEvent.h"
 #include "AliVEventHandler.h"
 #include "AliAnalysisManager.h"
 #include "AliAODMCParticle.h"
 #include "AliMCAnalysisUtils.h"
 #include "AliAODPid.h"
+#include "AliExternalTrackParam.h"
 
 ClassImp(AliAnaCalorimeterQA)
-  
-//____________________________________________________________________________
-  AliAnaCalorimeterQA::AliAnaCalorimeterQA() : 
-    AliAnaPartCorrBaseClass(), fCalorimeter(""), fStyleMacro(""), 
-    fMakePlots(kFALSE), fCorrelateCalos(kFALSE), fNModules(12), fNRCU(2),
-    fTimeCutMin(-1), fTimeCutMax(9999999),
-    fHistoPOverEBins(100),     fHistoPOverEMax(100.),     fHistoPOverEMin(0.),
-    fHistodEdxBins(100),       fHistodEdxMax(100.),       fHistodEdxMin(0.),
-    fHistodRBins(100),         fHistodRMax(100.),         fHistodRMin(0.),
-    fHistoTimeBins(100),       fHistoTimeMax(100.),       fHistoTimeMin(0.),
-    fHistoNBins(100),          fHistoNMax(100),           fHistoNMin(0),
-    fHistoRatioBins(100),      fHistoRatioMax(100.),      fHistoRatioMin(0.),
-    fHistoVertexDistBins(100), fHistoVertexDistMax(100.), fHistoVertexDistMin(0.),
-    fHistoRBins(100),          fHistoRMax(1000),           fHistoRMin(-1000),
-    fHistoXBins(100),          fHistoXMax(1000),           fHistoXMin(-1000),
-    fHistoYBins(100),          fHistoYMax(1000),           fHistoYMin(-1000),
-    fHistoZBins(100),          fHistoZMax(1000),           fHistoZMin(-1000),
-    fHistoSSBins(40),          fHistoSSMax(10),            fHistoSSMin(0),
-    fhE(0),fhPt(0),fhPhi(0),fhEta(0),   fhEtaPhiE(0),
-    fhECharged(0),fhPtCharged(0),fhPhiCharged(0),fhEtaCharged(0), fhEtaPhiECharged(0), 
-    //fhEChargedNoOut(0),fhPtChargedNoOut(0),fhPhiChargedNoOut(0),fhEtaChargedNoOut(0), fhEtaPhiChargedNoOut(0), 
-    fhDeltaE(0), fhDeltaPt(0),fhDeltaPhi(0),fhDeltaEta(0), fhRatioE(0), fhRatioPt(0),fhRatioPhi(0),fhRatioEta(0),
-    fh2E(0),fh2Pt(0),fh2Phi(0),fh2Eta(0),
-    fhLambda(0), fhDispersion(0), 
-    fhIM(0), fhIMCellCut(0),fhAsym(0), 
-    fhNCellsPerCluster(0),fhNCellsPerClusterMIP(0), fhNCellsPerClusterMIPCharged(0), fhNClusters(0), 
-    fhClusterTimeEnergy(0),fhCellTimeSpreadRespectToCellMax(0),fhCellIdCellLargeTimeSpread(0),
-    fhRNCells(0),fhXNCells(0),fhYNCells(0),fhZNCells(0),
-    fhRE(0),     fhXE(0),     fhYE(0),     fhZE(0),    fhXYZ(0),
-    fhRCellE(0), fhXCellE(0), fhYCellE(0), fhZCellE(0),fhXYZCell(0),
-    fhDeltaCellClusterRNCells(0),fhDeltaCellClusterXNCells(0),fhDeltaCellClusterYNCells(0),fhDeltaCellClusterZNCells(0),
-    fhDeltaCellClusterRE(0),     fhDeltaCellClusterXE(0),     fhDeltaCellClusterYE(0),     fhDeltaCellClusterZE(0),
-    fhNCells(0), fhAmplitude(0), fhAmpId(0), fhEtaPhiAmp(0), 
-    fhTime(0), fhTimeId(0), fhTimeAmp(0), //fhT0Time(0), fhT0TimeId(0), fhT0TimeAmp(0), 
-    fhCaloCorrNClusters(0), fhCaloCorrEClusters(0), fhCaloCorrNCells(0), fhCaloCorrECells(0),
-    fhEMod(0), fhNClustersMod(0), fhNCellsPerClusterMod(0), fhNCellsMod(0),  
-    fhGridCellsMod(0), fhGridCellsEMod(0), fhGridCellsTimeMod(0), 
-    fhAmplitudeMod(0), fhAmplitudeModFraction(0),fhTimeAmpPerRCU(0), //fhT0TimeAmpPerRCU(0), 
-    //fhTimeCorrRCU(0),
-    fhIMMod(0),  fhIMCellCutMod(0),
-    fhGenGamPt(0),fhGenGamEta(0),fhGenGamPhi(0),fhGenPi0Pt(0),fhGenPi0Eta(0),fhGenPi0Phi(0),
-    fhGenEtaPt(0),fhGenEtaEta(0),fhGenEtaPhi(0),fhGenOmegaPt(0),fhGenOmegaEta(0),fhGenOmegaPhi(0),
-    fhGenElePt(0),fhGenEleEta(0),fhGenElePhi(0), fhEMVxyz(0),  fhEMR(0), fhHaVxyz(0),  fhHaR(0),
-    fhGamE(0),fhGamPt(0),fhGamPhi(0),fhGamEta(0), 
-    fhGamDeltaE(0), fhGamDeltaPt(0),fhGamDeltaPhi(0),fhGamDeltaEta(0), 
-    fhGamRatioE(0), fhGamRatioPt(0),fhGamRatioPhi(0),fhGamRatioEta(0),
-    fhEleE(0),fhElePt(0),fhElePhi(0),fhEleEta(0),
-    fhPi0E(0),fhPi0Pt(0),fhPi0Phi(0),fhPi0Eta(0), 
-    fhNeHadE(0),fhNeHadPt(0),fhNeHadPhi(0),fhNeHadEta(0), 
-    fhChHadE(0),fhChHadPt(0),fhChHadPhi(0),fhChHadEta(0),
-    fhGamECharged(0),fhGamPtCharged(0),fhGamPhiCharged(0),fhGamEtaCharged(0), 
-    fhEleECharged(0),fhElePtCharged(0),fhElePhiCharged(0),fhEleEtaCharged(0),
-    fhPi0ECharged(0),fhPi0PtCharged(0),fhPi0PhiCharged(0),fhPi0EtaCharged(0), 
-    fhNeHadECharged(0),fhNeHadPtCharged(0),fhNeHadPhiCharged(0),fhNeHadEtaCharged(0), 
-    fhChHadECharged(0),fhChHadPtCharged(0),fhChHadPhiCharged(0),fhChHadEtaCharged(0),
-    fhGenGamAccE(0),fhGenGamAccPt(0),fhGenGamAccEta(0),fhGenGamAccPhi(0),
-    fhGenPi0AccE(0),fhGenPi0AccPt(0),fhGenPi0AccEta(0),fhGenPi0AccPhi(0),
-    fh1pOverE(0),fh1dR(0),fh2EledEdx(0), fh2MatchdEdx(0),fhMCEle1pOverE(0),fhMCEle1dR(0),fhMCEle2MatchdEdx(0),
-    fhMCChHad1pOverE(0),  fhMCChHad1dR(0),  fhMCChHad2MatchdEdx(0),
-    fhMCNeutral1pOverE(0),fhMCNeutral1dR(0),fhMCNeutral2MatchdEdx(0),
-    fh1pOverER02(0), fhMCEle1pOverER02(0), fhMCChHad1pOverER02(0), fhMCNeutral1pOverER02(0)
+
+  //____________________________________________________________________________
+AliAnaCalorimeterQA::AliAnaCalorimeterQA() : 
+AliAnaPartCorrBaseClass(), fCalorimeter(""), fStyleMacro(""), 
+fMakePlots(kFALSE), fCorrelateCalos(kFALSE), fNModules(12), fNRCU(2),
+fTimeCutMin(-1), fTimeCutMax(9999999),
+fHistoPOverEBins(100),     fHistoPOverEMax(100.),     fHistoPOverEMin(0.),
+fHistodEdxBins(100),       fHistodEdxMax(100.),       fHistodEdxMin(0.),
+fHistodRBins(100),         fHistodRMax(100.),         fHistodRMin(0.),
+fHistoTimeBins(100),       fHistoTimeMax(100.),       fHistoTimeMin(0.),
+fHistoNBins(100),          fHistoNMax(100),           fHistoNMin(0),
+fHistoRatioBins(100),      fHistoRatioMax(100.),      fHistoRatioMin(0.),
+fHistoVertexDistBins(100), fHistoVertexDistMax(100.), fHistoVertexDistMin(0.),
+fHistoRBins(100),          fHistoRMax(1000),           fHistoRMin(-1000),
+fHistoXBins(100),          fHistoXMax(1000),           fHistoXMin(-1000),
+fHistoYBins(100),          fHistoYMax(1000),           fHistoYMin(-1000),
+fHistoZBins(100),          fHistoZMax(1000),           fHistoZMin(-1000),
+fHistoSSBins(40),          fHistoSSMax(10),            fHistoSSMin(0),
+fhE(0),fhPt(0),fhPhi(0),fhEta(0),   fhEtaPhiE(0),
+fhECharged(0),fhPtCharged(0),fhPhiCharged(0),fhEtaCharged(0), fhEtaPhiECharged(0), 
+  //fhEChargedNoOut(0),fhPtChargedNoOut(0),fhPhiChargedNoOut(0),fhEtaChargedNoOut(0), fhEtaPhiChargedNoOut(0), 
+fhDeltaE(0), fhDeltaPt(0),fhDeltaPhi(0),fhDeltaEta(0), fhRatioE(0), fhRatioPt(0),fhRatioPhi(0),fhRatioEta(0),
+fh2E(0),fh2Pt(0),fh2Phi(0),fh2Eta(0),
+fhLambda(0), fhDispersion(0), 
+fhIM(0), fhIMCellCut(0),fhAsym(0), 
+fhNCellsPerCluster(0),fhNCellsPerClusterMIP(0), fhNCellsPerClusterMIPCharged(0), fhNClusters(0), 
+fhClusterTimeEnergy(0),fhCellTimeSpreadRespectToCellMax(0),fhCellIdCellLargeTimeSpread(0),
+fhRNCells(0),fhXNCells(0),fhYNCells(0),fhZNCells(0),
+fhRE(0),     fhXE(0),     fhYE(0),     fhZE(0),    fhXYZ(0),
+fhRCellE(0), fhXCellE(0), fhYCellE(0), fhZCellE(0),fhXYZCell(0),
+fhDeltaCellClusterRNCells(0),fhDeltaCellClusterXNCells(0),fhDeltaCellClusterYNCells(0),fhDeltaCellClusterZNCells(0),
+fhDeltaCellClusterRE(0),     fhDeltaCellClusterXE(0),     fhDeltaCellClusterYE(0),     fhDeltaCellClusterZE(0),
+fhNCells(0), fhAmplitude(0), fhAmpId(0), fhEtaPhiAmp(0), 
+fhTime(0), fhTimeId(0), fhTimeAmp(0), //fhT0Time(0), fhT0TimeId(0), fhT0TimeAmp(0), 
+fhCaloCorrNClusters(0), fhCaloCorrEClusters(0), fhCaloCorrNCells(0), fhCaloCorrECells(0),
+fhEMod(0), fhNClustersMod(0), fhNCellsPerClusterMod(0), fhNCellsMod(0),  
+fhGridCellsMod(0), fhGridCellsEMod(0), fhGridCellsTimeMod(0), 
+fhAmplitudeMod(0), fhAmplitudeModFraction(0),fhTimeAmpPerRCU(0), //fhT0TimeAmpPerRCU(0), 
+                                                                 //fhTimeCorrRCU(0),
+fhIMMod(0),  fhIMCellCutMod(0),
+fhGenGamPt(0),fhGenGamEta(0),fhGenGamPhi(0),fhGenPi0Pt(0),fhGenPi0Eta(0),fhGenPi0Phi(0),
+fhGenEtaPt(0),fhGenEtaEta(0),fhGenEtaPhi(0),fhGenOmegaPt(0),fhGenOmegaEta(0),fhGenOmegaPhi(0),
+fhGenElePt(0),fhGenEleEta(0),fhGenElePhi(0), fhEMVxyz(0),  fhEMR(0), fhHaVxyz(0),  fhHaR(0),
+fhGamE(0),fhGamPt(0),fhGamPhi(0),fhGamEta(0), 
+fhGamDeltaE(0), fhGamDeltaPt(0),fhGamDeltaPhi(0),fhGamDeltaEta(0), 
+fhGamRatioE(0), fhGamRatioPt(0),fhGamRatioPhi(0),fhGamRatioEta(0),
+fhEleE(0),fhElePt(0),fhElePhi(0),fhEleEta(0),
+fhPi0E(0),fhPi0Pt(0),fhPi0Phi(0),fhPi0Eta(0), 
+fhNeHadE(0),fhNeHadPt(0),fhNeHadPhi(0),fhNeHadEta(0), 
+fhChHadE(0),fhChHadPt(0),fhChHadPhi(0),fhChHadEta(0),
+fhGamECharged(0),fhGamPtCharged(0),fhGamPhiCharged(0),fhGamEtaCharged(0), 
+fhEleECharged(0),fhElePtCharged(0),fhElePhiCharged(0),fhEleEtaCharged(0),
+fhPi0ECharged(0),fhPi0PtCharged(0),fhPi0PhiCharged(0),fhPi0EtaCharged(0), 
+fhNeHadECharged(0),fhNeHadPtCharged(0),fhNeHadPhiCharged(0),fhNeHadEtaCharged(0), 
+fhChHadECharged(0),fhChHadPtCharged(0),fhChHadPhiCharged(0),fhChHadEtaCharged(0),
+fhGenGamAccE(0),fhGenGamAccPt(0),fhGenGamAccEta(0),fhGenGamAccPhi(0),
+fhGenPi0AccE(0),fhGenPi0AccPt(0),fhGenPi0AccEta(0),fhGenPi0AccPhi(0),
+fh1pOverE(0),fh1dR(0),fh2EledEdx(0), fh2MatchdEdx(0),fhMCEle1pOverE(0),fhMCEle1dR(0),fhMCEle2MatchdEdx(0),
+fhMCChHad1pOverE(0),  fhMCChHad1dR(0),  fhMCChHad2MatchdEdx(0),
+fhMCNeutral1pOverE(0),fhMCNeutral1dR(0),fhMCNeutral2MatchdEdx(0),
+fh1pOverER02(0), fhMCEle1pOverER02(0), fhMCChHad1pOverER02(0), fhMCNeutral1pOverER02(0)
 {
-  //Default Ctor
+    //Default Ctor
   
-  //Initialize parameters
+    //Initialize parameters
   InitParameters();
 }
 /*
-//____________________________________________________________________________
-AliAnaCalorimeterQA::AliAnaCalorimeterQA(const AliAnaCalorimeterQA & qa) :   
-  AliAnaPartCorrBaseClass(qa), fCalorimeter(qa.fCalorimeter), fStyleMacro(qa.fStyleMacro), 
-  fMakePlots(qa.fMakePlots), fCorrelateCalos(qa.fCorrelateCalos), fNModules(qa.fNModules), fNRCU(qa.fNRCU),
-  fTimeCutMin(qa.fTimeCutMin), fTimeCutMax(qa.fTimeCutMax),    
-  fHistoPOverEBins(qa.fHistoPOverEBins), fHistoPOverEMax(qa.fHistoPOverEMax), fHistoPOverEMin(qa.fHistoPOverEMin),
-  fHistodEdxBins(qa.fHistodEdxBins), fHistodEdxMax(qa.fHistodEdxMax), fHistodEdxMin(qa.fHistodEdxMin), 
-  fHistodRBins(qa.fHistodRBins), fHistodRMax(qa.fHistodRMax), fHistodRMin(qa.fHistodRMin),
-  fHistoTimeBins(qa.fHistoTimeBins), fHistoTimeMax(qa.fHistoTimeMax), fHistoTimeMin(qa.fHistoTimeMin),
-  fHistoNBins(qa.fHistoNBins), fHistoNMax(qa.fHistoNMax), fHistoNMin(qa.fHistoNMin),
-  fHistoRatioBins(qa.fHistoRatioBins), fHistoRatioMax(qa.fHistoRatioMax), fHistoRatioMin(qa.fHistoRatioMin),
-  fHistoVertexDistBins(qa.fHistoVertexDistBins), fHistoVertexDistMax(qa.fHistoVertexDistMax), fHistoVertexDistMin(qa.fHistoVertexDistMin),
-  fHistoRBins(qa.fHistoRBins), fHistoRMax(qa.fHistoRMax),  fHistoRMin(qa.fHistoRMin),
-  fHistoXBins(qa.fHistoXBins), fHistoXMax(qa.fHistoXMax),  fHistoXMin(qa.fHistoXMin),
-  fHistoYBins(qa.fHistoYBins), fHistoYMax(qa.fHistoYMax),  fHistoYMin(qa.fHistoYMin),
-  fHistoZBins(qa.fHistoZBins), fHistoZMax(qa.fHistoZMax),  fHistoZMin(qa.fHistoZMin),
-  fHistoSSBins(qa.fHistoSSBins),fHistoSSMax(qa.fHistoSSMax), fHistoSSMin(qa.fHistoSSMin),
-  fhE(qa.fhE),fhPt(qa.fhPt), fhPhi(qa.fhPhi), fhEta(qa.fhEta), fhEtaPhiE(qa.fhEtaPhiE), 
-  fhECharged(qa.fhECharged),fhPtCharged(qa.fhPtCharged),fhPhiCharged(qa.fhPhiCharged),
-  fhEtaCharged(qa.fhEtaCharged), fhEtaPhiECharged(qa.fhEtaPhiECharged), 
-  //fhEChargedNoOut(qa.fhEChargedNoOut),fhPtChargedNoOut(qa.fhPtChargedNoOut),fhPhiChargedNoOut(qa.fhPhiChargedNoOut),
-  //fhEtaChargedNoOut(qa.fhEtaChargedNoOut), fhEtaPhiChargedNoOut(qa.fhEtaPhiChargedNoOut), 
-  fhDeltaE(qa.fhDeltaE), fhDeltaPt(qa.fhDeltaPt), fhDeltaPhi(qa.fhDeltaPhi), fhDeltaEta(qa.fhDeltaEta),
-  fhRatioE(qa.fhRatioE), fhRatioPt(qa.fhRatioPt), fhRatioPhi(qa.fhRatioPhi), fhRatioEta(qa.fhRatioEta),
-  fh2E(qa.fh2E), fh2Pt(qa.fh2Pt), fh2Phi(qa.fh2Phi),fh2Eta(qa.fh2Eta), 
-  fhLambda(qa.fhLambda), fhDispersion(qa.fhDispersion), 
-  fhIM(qa.fhIM), fhIMCellCut(qa.fhIMCellCut), fhAsym(qa.fhAsym), 
-  fhNCellsPerCluster(qa.fhNCellsPerCluster), fhNCellsPerClusterMIP(qa.fhNCellsPerClusterMIP),
-  fhNCellsPerClusterMIPCharged(qa.fhNCellsPerClusterMIPCharged),fhNClusters(qa.fhNClusters),
-  fhClusterTimeEnergy(qa.fhClusterTimeEnergy), 
-  fhCellTimeSpreadRespectToCellMax(qa.fhCellTimeSpreadRespectToCellMax),
-  fhCellIdCellLargeTimeSpread(qa.fhCellIdCellLargeTimeSpread),
-  fhRNCells(qa.fhRNCells),fhXNCells(qa.fhXNCells),fhYNCells(qa.fhYNCells),fhZNCells(qa.fhZNCells),
-  fhRE(qa.fhRE),          fhXE(qa.fhXE),          fhYE(qa.fhYE),          fhZE(qa.fhZE),        fhXYZ(qa.fhXYZ),
-  fhRCellE(qa.fhXCellE),  fhXCellE(qa.fhXCellE),  fhYCellE(qa.fhYCellE),  fhZCellE(qa.fhZCellE),fhXYZCell(qa.fhXYZCell),
-  fhDeltaCellClusterRNCells(qa.fhDeltaCellClusterRNCells),fhDeltaCellClusterXNCells(qa.fhDeltaCellClusterXNCells),
-  fhDeltaCellClusterYNCells(qa.fhDeltaCellClusterYNCells),fhDeltaCellClusterZNCells(qa.fhDeltaCellClusterZNCells),
-  fhDeltaCellClusterRE(qa.fhDeltaCellClusterRE),          fhDeltaCellClusterXE(qa.fhDeltaCellClusterXE),
-  fhDeltaCellClusterYE(qa.fhDeltaCellClusterYE),          fhDeltaCellClusterZE(qa.fhDeltaCellClusterZE),
-  fhNCells(qa.fhNCells), fhAmplitude(qa.fhAmplitude), fhAmpId(fhAmpId), fhEtaPhiAmp(qa.fhEtaPhiAmp),
-  fhTime(qa.fhTime), fhTimeId(qa.fhTimeId),fhTimeAmp(qa.fhTimeAmp),
-  //fhT0Time(qa.fhT0Time),fhT0TimeId(qa.fhT0TimeId), fhT0TimeAmp(qa.fhT0TimeAmp), 
-  fhCaloCorrNClusters(qa.fhCaloCorrNClusters), fhCaloCorrEClusters(qa.fhCaloCorrEClusters),
-  fhCaloCorrNCells(qa.fhCaloCorrNCells), fhCaloCorrECells(qa.fhCaloCorrECells),
-  fhEMod(qa.fhEMod), fhNClustersMod(qa.fhNClustersMod), 
-  fhNCellsPerClusterMod(qa.fhNCellsPerClusterMod), fhNCellsMod(qa.fhNCellsMod),  
-  fhGridCellsMod(qa.fhGridCellsMod),  fhGridCellsEMod(qa.fhGridCellsEMod), fhGridCellsTimeMod(qa.fhGridCellsTimeMod), 
-  fhAmplitudeMod(qa.fhAmplitudeMod), fhAmplitudeModFraction(qa.fhAmplitudeModFraction),
-  fhTimeAmpPerRCU(qa.fhTimeAmpPerRCU), //fhT0TimeAmpPerRCU(qa.fhT0TimeAmpPerRCU), fhTimeCorrRCU(qa.fhTimeCorrRCU),
-  fhIMMod(qa.fhIMMod),fhIMCellCutMod(qa.fhIMCellCutMod),
-  fhGenGamPt(qa.fhGenGamPt), fhGenGamEta(qa.fhGenGamEta), fhGenGamPhi(qa.fhGenGamPhi),
-  fhGenPi0Pt(qa.fhGenPi0Pt), fhGenPi0Eta(qa.fhGenPi0Eta), fhGenPi0Phi(qa.fhGenPi0Phi),
-  fhGenEtaPt(qa.fhGenEtaPt), fhGenEtaEta(qa.fhGenEtaEta), fhGenEtaPhi(qa.fhGenEtaPhi),
-  fhGenOmegaPt(qa.fhGenOmegaPt), fhGenOmegaEta(qa.fhGenOmegaEta), fhGenOmegaPhi(qa.fhGenOmegaPhi),
-  fhGenElePt(qa.fhGenElePt), fhGenEleEta(qa.fhGenEleEta), fhGenElePhi(qa.fhGenElePhi), 
-  fhEMVxyz(qa.fhEMVxyz),  fhEMR(qa.fhEMR), fhHaVxyz(qa.fhHaVxyz),  fhHaR(qa.fhHaR),
-  fhGamE(qa.fhGamE),fhGamPt(qa.fhGamPt),fhGamPhi(qa.fhGamPhi),fhGamEta(qa.fhGamEta), 
-  fhGamDeltaE(qa.fhGamDeltaE), fhGamDeltaPt(qa.fhGamDeltaPt), fhGamDeltaPhi(qa.fhGamDeltaPhi), fhGamDeltaEta(qa.fhGamDeltaEta),
-  fhGamRatioE(qa.fhGamRatioE), fhGamRatioPt(qa.fhGamRatioPt), fhGamRatioPhi(qa.fhGamRatioPhi), fhGamRatioEta(qa.fhGamRatioEta),
-  fhEleE(qa.fhEleE),fhElePt(qa.fhElePt),fhElePhi(qa.fhElePhi),fhEleEta(qa.fhEleEta),
-  fhPi0E(qa.fhPi0E),fhPi0Pt(qa.fhPi0Pt),fhPi0Phi(qa.fhPi0Phi),fhPi0Eta(qa.fhPi0Eta), 
-  fhNeHadE(qa.fhNeHadE),fhNeHadPt(qa.fhNeHadPt),fhNeHadPhi(qa.fhNeHadPhi),fhNeHadEta(qa.fhNeHadEta), 
-  fhChHadE(qa.fhChHadE),fhChHadPt(qa.fhChHadPt),fhChHadPhi(qa.fhChHadPhi),fhChHadEta(qa.fhChHadEta),
-  fhGamECharged(qa.fhGamECharged),fhGamPtCharged(qa.fhGamPtCharged),fhGamPhiCharged(qa.fhGamPhiCharged),fhGamEtaCharged(qa.fhGamEtaCharged), 
-  fhEleECharged(qa.fhEleECharged),fhElePtCharged(qa.fhElePtCharged),fhElePhiCharged(qa.fhElePhiCharged),fhEleEtaCharged(qa.fhEleEtaCharged),
-  fhPi0ECharged(qa.fhPi0ECharged),fhPi0PtCharged(qa.fhPi0PtCharged),fhPi0PhiCharged(qa.fhPi0PhiCharged),fhPi0EtaCharged(qa.fhPi0EtaCharged), 
-  fhNeHadECharged(qa.fhNeHadECharged),fhNeHadPtCharged(qa.fhNeHadPtCharged),fhNeHadPhiCharged(qa.fhNeHadPhiCharged),fhNeHadEtaCharged(qa.fhNeHadEtaCharged), 
-  fhChHadECharged(qa.fhChHadECharged),fhChHadPtCharged(qa.fhChHadPtCharged),fhChHadPhiCharged(qa.fhChHadPhiCharged),fhChHadEtaCharged(qa.fhChHadEtaCharged),
-  fhGenGamAccE(qa.fhGenGamAccE),fhGenGamAccPt(qa.fhGenGamAccPt),fhGenGamAccEta(qa.fhGenGamAccEta),fhGenGamAccPhi(qa.fhGenGamAccPhi),
-  fhGenPi0AccE(qa.fhGenPi0AccE),fhGenPi0AccPt(qa.fhGenPi0AccPt),fhGenPi0AccEta(qa.fhGenPi0AccEta),fhGenPi0AccPhi(qa.fhGenPi0AccPhi),
-  fh1pOverE(qa.fh1pOverE),fh1dR(qa.fh1dR),fh2EledEdx(qa.fh2EledEdx), fh2MatchdEdx(qa.fh2MatchdEdx),
-  fhMCEle1pOverE(qa.fhMCEle1pOverE),fhMCEle1dR(qa.fhMCEle1dR), fhMCEle2MatchdEdx(qa.fhMCEle2MatchdEdx),
-  fhMCChHad1pOverE(qa.fhMCChHad1pOverE),fhMCChHad1dR(qa.fhMCChHad1dR), fhMCChHad2MatchdEdx(qa.fhMCChHad2MatchdEdx),
-  fhMCNeutral1pOverE(qa.fhMCNeutral1pOverE),fhMCNeutral1dR(qa.fhMCNeutral1dR), fhMCNeutral2MatchdEdx(qa.fhMCNeutral2MatchdEdx),
-  fh1pOverER02(qa.fh1pOverER02), fhMCEle1pOverER02(qa.fhMCEle1pOverER02),fhMCChHad1pOverER02(qa.fhMCChHad1pOverER02), fhMCNeutral1pOverER02(qa.fhMCNeutral1pOverER02)
-{
-  // cpy ctor
-  
-}
-*/
-//________________________________________________________________________________________________________________________________________________
-//AliAnaCalorimeterQA::~AliAnaCalorimeterQA() {
+ //____________________________________________________________________________
+ AliAnaCalorimeterQA::AliAnaCalorimeterQA(const AliAnaCalorimeterQA & qa) :   
+ AliAnaPartCorrBaseClass(qa), fCalorimeter(qa.fCalorimeter), fStyleMacro(qa.fStyleMacro), 
+ fMakePlots(qa.fMakePlots), fCorrelateCalos(qa.fCorrelateCalos), fNModules(qa.fNModules), fNRCU(qa.fNRCU),
+ fTimeCutMin(qa.fTimeCutMin), fTimeCutMax(qa.fTimeCutMax),     
+ fHistoPOverEBins(qa.fHistoPOverEBins), fHistoPOverEMax(qa.fHistoPOverEMax), fHistoPOverEMin(qa.fHistoPOverEMin),
+ fHistodEdxBins(qa.fHistodEdxBins), fHistodEdxMax(qa.fHistodEdxMax), fHistodEdxMin(qa.fHistodEdxMin), 
+ fHistodRBins(qa.fHistodRBins), fHistodRMax(qa.fHistodRMax), fHistodRMin(qa.fHistodRMin),
+ fHistoTimeBins(qa.fHistoTimeBins), fHistoTimeMax(qa.fHistoTimeMax), fHistoTimeMin(qa.fHistoTimeMin),
+ fHistoNBins(qa.fHistoNBins), fHistoNMax(qa.fHistoNMax), fHistoNMin(qa.fHistoNMin),
+ fHistoRatioBins(qa.fHistoRatioBins), fHistoRatioMax(qa.fHistoRatioMax), fHistoRatioMin(qa.fHistoRatioMin),
+ fHistoVertexDistBins(qa.fHistoVertexDistBins), fHistoVertexDistMax(qa.fHistoVertexDistMax), fHistoVertexDistMin(qa.fHistoVertexDistMin),
+ fHistoRBins(qa.fHistoRBins), fHistoRMax(qa.fHistoRMax),  fHistoRMin(qa.fHistoRMin),
+ fHistoXBins(qa.fHistoXBins), fHistoXMax(qa.fHistoXMax),  fHistoXMin(qa.fHistoXMin),
+ fHistoYBins(qa.fHistoYBins), fHistoYMax(qa.fHistoYMax),  fHistoYMin(qa.fHistoYMin),
+ fHistoZBins(qa.fHistoZBins), fHistoZMax(qa.fHistoZMax),  fHistoZMin(qa.fHistoZMin),
+ fHistoSSBins(qa.fHistoSSBins),fHistoSSMax(qa.fHistoSSMax), fHistoSSMin(qa.fHistoSSMin),
+ fhE(qa.fhE),fhPt(qa.fhPt), fhPhi(qa.fhPhi), fhEta(qa.fhEta), fhEtaPhiE(qa.fhEtaPhiE), 
+ fhECharged(qa.fhECharged),fhPtCharged(qa.fhPtCharged),fhPhiCharged(qa.fhPhiCharged),
+ fhEtaCharged(qa.fhEtaCharged), fhEtaPhiECharged(qa.fhEtaPhiECharged), 
+ //fhEChargedNoOut(qa.fhEChargedNoOut),fhPtChargedNoOut(qa.fhPtChargedNoOut),fhPhiChargedNoOut(qa.fhPhiChargedNoOut),
+ //fhEtaChargedNoOut(qa.fhEtaChargedNoOut), fhEtaPhiChargedNoOut(qa.fhEtaPhiChargedNoOut), 
+ fhDeltaE(qa.fhDeltaE), fhDeltaPt(qa.fhDeltaPt), fhDeltaPhi(qa.fhDeltaPhi), fhDeltaEta(qa.fhDeltaEta),
+ fhRatioE(qa.fhRatioE), fhRatioPt(qa.fhRatioPt), fhRatioPhi(qa.fhRatioPhi), fhRatioEta(qa.fhRatioEta),
+ fh2E(qa.fh2E), fh2Pt(qa.fh2Pt), fh2Phi(qa.fh2Phi),fh2Eta(qa.fh2Eta), 
+ fhLambda(qa.fhLambda), fhDispersion(qa.fhDispersion), 
+ fhIM(qa.fhIM), fhIMCellCut(qa.fhIMCellCut), fhAsym(qa.fhAsym), 
+ fhNCellsPerCluster(qa.fhNCellsPerCluster), fhNCellsPerClusterMIP(qa.fhNCellsPerClusterMIP),
+ fhNCellsPerClusterMIPCharged(qa.fhNCellsPerClusterMIPCharged),fhNClusters(qa.fhNClusters),
+ fhClusterTimeEnergy(qa.fhClusterTimeEnergy),  
+ fhCellTimeSpreadRespectToCellMax(qa.fhCellTimeSpreadRespectToCellMax),
+ fhCellIdCellLargeTimeSpread(qa.fhCellIdCellLargeTimeSpread),
+ fhRNCells(qa.fhRNCells),fhXNCells(qa.fhXNCells),fhYNCells(qa.fhYNCells),fhZNCells(qa.fhZNCells),
+ fhRE(qa.fhRE),          fhXE(qa.fhXE),          fhYE(qa.fhYE),          fhZE(qa.fhZE),        fhXYZ(qa.fhXYZ),
+ fhRCellE(qa.fhXCellE),  fhXCellE(qa.fhXCellE),  fhYCellE(qa.fhYCellE),  fhZCellE(qa.fhZCellE),fhXYZCell(qa.fhXYZCell),
+ fhDeltaCellClusterRNCells(qa.fhDeltaCellClusterRNCells),fhDeltaCellClusterXNCells(qa.fhDeltaCellClusterXNCells),
+ fhDeltaCellClusterYNCells(qa.fhDeltaCellClusterYNCells),fhDeltaCellClusterZNCells(qa.fhDeltaCellClusterZNCells),
+ fhDeltaCellClusterRE(qa.fhDeltaCellClusterRE),          fhDeltaCellClusterXE(qa.fhDeltaCellClusterXE),
+ fhDeltaCellClusterYE(qa.fhDeltaCellClusterYE),          fhDeltaCellClusterZE(qa.fhDeltaCellClusterZE),
+ fhNCells(qa.fhNCells), fhAmplitude(qa.fhAmplitude), fhAmpId(fhAmpId), fhEtaPhiAmp(qa.fhEtaPhiAmp),
+ fhTime(qa.fhTime), fhTimeId(qa.fhTimeId),fhTimeAmp(qa.fhTimeAmp),
+ //fhT0Time(qa.fhT0Time),fhT0TimeId(qa.fhT0TimeId), fhT0TimeAmp(qa.fhT0TimeAmp), 
+ fhCaloCorrNClusters(qa.fhCaloCorrNClusters), fhCaloCorrEClusters(qa.fhCaloCorrEClusters),
+ fhCaloCorrNCells(qa.fhCaloCorrNCells), fhCaloCorrECells(qa.fhCaloCorrECells),
+ fhEMod(qa.fhEMod), fhNClustersMod(qa.fhNClustersMod), 
+ fhNCellsPerClusterMod(qa.fhNCellsPerClusterMod), fhNCellsMod(qa.fhNCellsMod),  
+ fhGridCellsMod(qa.fhGridCellsMod),  fhGridCellsEMod(qa.fhGridCellsEMod), fhGridCellsTimeMod(qa.fhGridCellsTimeMod), 
+ fhAmplitudeMod(qa.fhAmplitudeMod), fhAmplitudeModFraction(qa.fhAmplitudeModFraction),
+ fhTimeAmpPerRCU(qa.fhTimeAmpPerRCU), //fhT0TimeAmpPerRCU(qa.fhT0TimeAmpPerRCU), fhTimeCorrRCU(qa.fhTimeCorrRCU),
+ fhIMMod(qa.fhIMMod),fhIMCellCutMod(qa.fhIMCellCutMod),
+ fhGenGamPt(qa.fhGenGamPt), fhGenGamEta(qa.fhGenGamEta), fhGenGamPhi(qa.fhGenGamPhi),
+ fhGenPi0Pt(qa.fhGenPi0Pt), fhGenPi0Eta(qa.fhGenPi0Eta), fhGenPi0Phi(qa.fhGenPi0Phi),
+ fhGenEtaPt(qa.fhGenEtaPt), fhGenEtaEta(qa.fhGenEtaEta), fhGenEtaPhi(qa.fhGenEtaPhi),
+ fhGenOmegaPt(qa.fhGenOmegaPt), fhGenOmegaEta(qa.fhGenOmegaEta), fhGenOmegaPhi(qa.fhGenOmegaPhi),
+ fhGenElePt(qa.fhGenElePt), fhGenEleEta(qa.fhGenEleEta), fhGenElePhi(qa.fhGenElePhi), 
+ fhEMVxyz(qa.fhEMVxyz),  fhEMR(qa.fhEMR), fhHaVxyz(qa.fhHaVxyz),  fhHaR(qa.fhHaR),
+ fhGamE(qa.fhGamE),fhGamPt(qa.fhGamPt),fhGamPhi(qa.fhGamPhi),fhGamEta(qa.fhGamEta), 
+ fhGamDeltaE(qa.fhGamDeltaE), fhGamDeltaPt(qa.fhGamDeltaPt), fhGamDeltaPhi(qa.fhGamDeltaPhi), fhGamDeltaEta(qa.fhGamDeltaEta),
+ fhGamRatioE(qa.fhGamRatioE), fhGamRatioPt(qa.fhGamRatioPt), fhGamRatioPhi(qa.fhGamRatioPhi), fhGamRatioEta(qa.fhGamRatioEta),
+ fhEleE(qa.fhEleE),fhElePt(qa.fhElePt),fhElePhi(qa.fhElePhi),fhEleEta(qa.fhEleEta),
+ fhPi0E(qa.fhPi0E),fhPi0Pt(qa.fhPi0Pt),fhPi0Phi(qa.fhPi0Phi),fhPi0Eta(qa.fhPi0Eta), 
+ fhNeHadE(qa.fhNeHadE),fhNeHadPt(qa.fhNeHadPt),fhNeHadPhi(qa.fhNeHadPhi),fhNeHadEta(qa.fhNeHadEta), 
+ fhChHadE(qa.fhChHadE),fhChHadPt(qa.fhChHadPt),fhChHadPhi(qa.fhChHadPhi),fhChHadEta(qa.fhChHadEta),
+ fhGamECharged(qa.fhGamECharged),fhGamPtCharged(qa.fhGamPtCharged),fhGamPhiCharged(qa.fhGamPhiCharged),fhGamEtaCharged(qa.fhGamEtaCharged), 
+ fhEleECharged(qa.fhEleECharged),fhElePtCharged(qa.fhElePtCharged),fhElePhiCharged(qa.fhElePhiCharged),fhEleEtaCharged(qa.fhEleEtaCharged),
+ fhPi0ECharged(qa.fhPi0ECharged),fhPi0PtCharged(qa.fhPi0PtCharged),fhPi0PhiCharged(qa.fhPi0PhiCharged),fhPi0EtaCharged(qa.fhPi0EtaCharged), 
+ fhNeHadECharged(qa.fhNeHadECharged),fhNeHadPtCharged(qa.fhNeHadPtCharged),fhNeHadPhiCharged(qa.fhNeHadPhiCharged),fhNeHadEtaCharged(qa.fhNeHadEtaCharged), 
+ fhChHadECharged(qa.fhChHadECharged),fhChHadPtCharged(qa.fhChHadPtCharged),fhChHadPhiCharged(qa.fhChHadPhiCharged),fhChHadEtaCharged(qa.fhChHadEtaCharged),
+ fhGenGamAccE(qa.fhGenGamAccE),fhGenGamAccPt(qa.fhGenGamAccPt),fhGenGamAccEta(qa.fhGenGamAccEta),fhGenGamAccPhi(qa.fhGenGamAccPhi),
+ fhGenPi0AccE(qa.fhGenPi0AccE),fhGenPi0AccPt(qa.fhGenPi0AccPt),fhGenPi0AccEta(qa.fhGenPi0AccEta),fhGenPi0AccPhi(qa.fhGenPi0AccPhi),
+ fh1pOverE(qa.fh1pOverE),fh1dR(qa.fh1dR),fh2EledEdx(qa.fh2EledEdx), fh2MatchdEdx(qa.fh2MatchdEdx),
+ fhMCEle1pOverE(qa.fhMCEle1pOverE),fhMCEle1dR(qa.fhMCEle1dR), fhMCEle2MatchdEdx(qa.fhMCEle2MatchdEdx),
+ fhMCChHad1pOverE(qa.fhMCChHad1pOverE),fhMCChHad1dR(qa.fhMCChHad1dR), fhMCChHad2MatchdEdx(qa.fhMCChHad2MatchdEdx),
+ fhMCNeutral1pOverE(qa.fhMCNeutral1pOverE),fhMCNeutral1dR(qa.fhMCNeutral1dR), fhMCNeutral2MatchdEdx(qa.fhMCNeutral2MatchdEdx),
+ fh1pOverER02(qa.fh1pOverER02), fhMCEle1pOverER02(qa.fhMCEle1pOverER02),fhMCChHad1pOverER02(qa.fhMCChHad1pOverER02), fhMCNeutral1pOverER02(qa.fhMCNeutral1pOverER02)
+ {
+ // cpy ctor
+ }
+ */
+  //________________________________________________________________________________________________________________________________________________
+  //AliAnaCalorimeterQA::~AliAnaCalorimeterQA() {
        // dtor
-       
-//}
 
-//________________________________________________________________________
+  //}
+
+  //________________________________________________________________________
 TObjString *  AliAnaCalorimeterQA::GetAnalysisCuts()
 {      
-       //Save parameters used for analysis
+    //Save parameters used for analysis
        TString parList ; //this will be list of parameters used for this analysis.
        char onePar[255] ;
        
@@ -223,27 +220,27 @@ TObjString *  AliAnaCalorimeterQA::GetAnalysisCuts()
        parList+=onePar ;
        sprintf(onePar,"Time Cut : %2.2f < T < %2.2f ns  \n",fTimeCutMin, fTimeCutMax) ;
        parList+=onePar ;
-               
-       //Get parameters set in base class.
-       //parList += GetBaseParametersList() ;
+  
+    //Get parameters set in base class.
+    //parList += GetBaseParametersList() ;
        
-       //Get parameters set in FiducialCut class (not available yet)
-       //parlist += GetFidCut()->GetFidCutParametersList() 
+    //Get parameters set in FiducialCut class (not available yet)
+    //parlist += GetFidCut()->GetFidCutParametersList() 
        
        return new TObjString(parList) ;
 }
 
 
-//________________________________________________________________________
+  //________________________________________________________________________
 TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
 {  
-       // Create histograms to be saved in output file and 
-       // store them in outputContainer
-       
+    // Create histograms to be saved in output file and 
+    // store them in outputContainer
+  
        TList * outputContainer = new TList() ; 
        outputContainer->SetName("QAHistos") ; 
        
-       //Histograms
+    //Histograms
        Int_t nptbins     = GetHistoPtBins();           Float_t ptmax     = GetHistoPtMax();           Float_t ptmin     = GetHistoPtMin();
        Int_t nphibins    = GetHistoPhiBins();              Float_t phimax    = GetHistoPhiMax();          Float_t phimin    = GetHistoPhiMin();
        Int_t netabins    = GetHistoEtaBins();          Float_t etamax    = GetHistoEtaMax();          Float_t etamin    = GetHistoEtaMin();    
@@ -262,11 +259,11 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        Int_t zbins       = GetHistoZBins();            Float_t zmax      = GetHistoZMax();            Float_t zmin      = GetHistoZMin(); 
        Int_t ssbins      = GetHistoShowerShapeBins();  Float_t ssmax     = GetHistoShowerShapeMax();  Float_t ssmin     = GetHistoShowerShapeMin();
        
-       //EMCAL
+    //EMCAL
        Int_t colmax = 48;
        Int_t rowmax = 24;
        fNRCU   = 2 ;
-       //PHOS
+    //PHOS
        if(fCalorimeter=="PHOS"){
                colmax = 56;
                rowmax = 64;
@@ -291,35 +288,35 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        outputContainer->Add(fhEta);
        
        fhEtaPhiE  = new TH3F ("hEtaPhiE","#eta vs #phi vs energy, reconstructed clusters",
-                                                  netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax); 
+                         netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax); 
        fhEtaPhiE->SetXTitle("#eta ");
        fhEtaPhiE->SetYTitle("#phi (rad)");
        fhEtaPhiE->SetZTitle("E (GeV) ");
        outputContainer->Add(fhEtaPhiE);
        
        fhClusterTimeEnergy  = new TH2F ("hClusterTimeEnergy","energy vs TOF, reconstructed clusters",
-                                                  nptbins,ptmin,ptmax, ntimebins,timemin,timemax); 
+                                   nptbins,ptmin,ptmax, ntimebins,timemin,timemax); 
        fhClusterTimeEnergy->SetXTitle("E (GeV) ");
        fhClusterTimeEnergy->SetYTitle("TOF (ns)");
        outputContainer->Add(fhClusterTimeEnergy);
        
        
-       //Shower shape
+    //Shower shape
        fhLambda  = new TH3F ("hLambda","#lambda_{0}^{2} vs #lambda_{1}^{2} vs energy, reconstructed clusters",
-                                                  ssbins,ssmin,ssmax,ssbins,ssmin,ssmax,nptbins,ptmin,ptmax); 
+                        ssbins,ssmin,ssmax,ssbins,ssmin,ssmax,nptbins,ptmin,ptmax); 
        fhLambda->SetXTitle("#lambda_{0}^{2}  ");
        fhLambda->SetYTitle("#lambda_{1}^{2}  ");
        fhLambda->SetZTitle("E (GeV) ");
        outputContainer->Add(fhLambda);
        
        fhDispersion  = new TH2F ("hDispersion"," dispersion vs energy, reconstructed clusters",
-                                                 ssbins,ssmin,ssmax,nptbins,ptmin,ptmax); 
+                            ssbins,ssmin,ssmax,nptbins,ptmin,ptmax); 
        fhDispersion->SetXTitle("Dispersion  ");
        fhDispersion->SetYTitle("E (GeV) ");
        outputContainer->Add(fhDispersion);
        
-       //Track Matching
-
+    //Track Matching
+  
        fhECharged  = new TH1F ("hECharged","E reconstructed clusters, matched with track", nptbins,ptmin,ptmax); 
        fhECharged->SetXTitle("E (GeV)");
        outputContainer->Add(fhECharged);
@@ -337,34 +334,34 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        outputContainer->Add(fhEtaCharged);
        
        fhEtaPhiECharged  = new TH3F ("hEtaPhiECharged","#eta vs #phi, reconstructed clusters, matched with track",
-                                                                 netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax); 
+                                netabins,etamin,etamax,nphibins,phimin,phimax,nptbins,ptmin,ptmax); 
        fhEtaPhiECharged->SetXTitle("#eta ");
        fhEtaPhiECharged->SetYTitle("#phi ");
        fhEtaPhiECharged->SetZTitle("E (GeV) ");
        outputContainer->Add(fhEtaPhiECharged); 
-
-
-//     fhEChargedNoOut  = new TH1F ("hEChargedNoOut","E reconstructed clusters, matched with track, no output track params", nptbins,ptmin,ptmax);                                     
-//     fhEChargedNoOut->SetXTitle("E (GeV)");                                                                                                                                          
-//     outputContainer->Add(fhEChargedNoOut);                                                                                                                                         
-//                                                                                                                                                                     
-//     fhPtChargedNoOut  = new TH1F ("hPtChargedNoOut","p_{T} reconstructed clusters, matched with track, no output track params", nptbins,ptmin,ptmax);                               
-//     fhPtChargedNoOut->SetXTitle("p_{T} (GeV/c)");                                                                                                                               
-//     outputContainer->Add(fhPtChargedNoOut);                                                                                                                                       
-//                                                                                                                                                                             
-//     fhPhiChargedNoOut  = new TH1F ("hPhiChargedNoOut","#phi reconstructed clusters, matched with track, no output track params",nphibins,phimin,phimax);                    
-//     fhPhiChargedNoOut->SetXTitle("#phi (rad)");                                                                                                                               
-//     outputContainer->Add(fhPhiChargedNoOut);                                                                                                                        
-//                                                                                                                                                                       
-//     fhEtaChargedNoOut  = new TH1F ("hEtaChargedNoOut","#eta reconstructed clusters, matched with track, no output track params",netabins,etamin,etamax);               
-//     fhEtaChargedNoOut->SetXTitle("#eta ");                                                                                                                           
-//     outputContainer->Add(fhEtaChargedNoOut);                                                                                                                             
-//                                                                                                                                                                           
-//     fhEtaPhiChargedNoOut  = new TH2F ("hEtaPhiChargedNoOut","#eta vs #phi, reconstructed clusters, matched with track, no output track params",netabins,etamin,etamax,nphibins,phimin,phimax); 
-//     fhEtaPhiChargedNoOut->SetXTitle("#eta ");                                                                                                    
-//     fhEtaPhiChargedNoOut->SetYTitle("#phi ");                                                                                                                       
-//     outputContainer->Add(fhEtaPhiChargedNoOut);     
-
+  
+  
+    // fhEChargedNoOut  = new TH1F ("hEChargedNoOut","E reconstructed clusters, matched with track, no output track params", nptbins,ptmin,ptmax);                                     
+    // fhEChargedNoOut->SetXTitle("E (GeV)");                                                                                                                                          
+    // outputContainer->Add(fhEChargedNoOut);                                                                                                                                         
+    //                                                                                                                                                                 
+    // fhPtChargedNoOut  = new TH1F ("hPtChargedNoOut","p_{T} reconstructed clusters, matched with track, no output track params", nptbins,ptmin,ptmax);                               
+    // fhPtChargedNoOut->SetXTitle("p_{T} (GeV/c)");                                                                                                                               
+    // outputContainer->Add(fhPtChargedNoOut);                                                                                                                                       
+    //                                                                                                                                                                         
+    // fhPhiChargedNoOut  = new TH1F ("hPhiChargedNoOut","#phi reconstructed clusters, matched with track, no output track params",nphibins,phimin,phimax);                    
+    // fhPhiChargedNoOut->SetXTitle("#phi (rad)");                                                                                                                               
+    // outputContainer->Add(fhPhiChargedNoOut);                                                                                                                        
+    //                                                                                                                                                                   
+    // fhEtaChargedNoOut  = new TH1F ("hEtaChargedNoOut","#eta reconstructed clusters, matched with track, no output track params",netabins,etamin,etamax);               
+    // fhEtaChargedNoOut->SetXTitle("#eta ");                                                                                                                           
+    // outputContainer->Add(fhEtaChargedNoOut);                                                                                                                             
+    //                                                                                                                                                                       
+    // fhEtaPhiChargedNoOut  = new TH2F ("hEtaPhiChargedNoOut","#eta vs #phi, reconstructed clusters, matched with track, no output track params",netabins,etamin,etamax,nphibins,phimin,phimax); 
+    // fhEtaPhiChargedNoOut->SetXTitle("#eta ");                                                                                                    
+    // fhEtaPhiChargedNoOut->SetYTitle("#phi ");                                                                                                                       
+    // outputContainer->Add(fhEtaPhiChargedNoOut);     
+  
        fh1pOverE = new TH2F("h1pOverE","TRACK matches p/E",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
        fh1pOverE->SetYTitle("p/E");
        fh1pOverE->SetXTitle("p_{T} (GeV/c)");
@@ -412,7 +409,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        
        
        fhNCellsPerClusterMIP  = new TH3F ("hNCellsPerClusterMIP","# cells per cluster vs energy vs #eta, smaller bin for MIP search", 
-                                                                               100,0.,1., 6,0,5,netabins,etamin,etamax); 
+                                     100,0.,1., 6,0,5,netabins,etamin,etamax); 
        fhNCellsPerClusterMIP->SetXTitle("E (GeV)");
        fhNCellsPerClusterMIP->SetYTitle("n cells");
        fhNCellsPerClusterMIP->SetZTitle("#eta");
@@ -420,7 +417,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        
        
        fhNCellsPerClusterMIPCharged  = new TH3F ("hNCellsPerClusterMIPCharged","# cells per track-matched cluster vs energy vs #eta, smaller bin for MIP search", 
-                                                                                               100,0.,1., 6,0,5,netabins,etamin,etamax); 
+                                            100,0.,1., 6,0,5,netabins,etamin,etamax); 
        fhNCellsPerClusterMIPCharged->SetXTitle("E (GeV)");
        fhNCellsPerClusterMIPCharged->SetYTitle("n cells");
        fhNCellsPerClusterMIPCharged->SetZTitle("#eta");
@@ -460,7 +457,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        fhXE->SetXTitle("x (cm)");
        fhXE->SetYTitle("E (GeV)");
        outputContainer->Add(fhXE);
-
+  
        fhYE  = new TH2F ("hYE","Cluster Y position vs cluster energy",ybins,ymin,ymax,nptbins,ptmin,ptmax); 
        fhYE->SetXTitle("y (cm)");
        fhYE->SetYTitle("E (GeV)");
@@ -476,7 +473,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        fhXYZ->SetYTitle("y (cm)");
        fhXYZ->SetZTitle("z (cm) ");
        outputContainer->Add(fhXYZ);
-               
+  
        fhRCellE  = new TH2F ("hRCellE","Cell R position vs cell energy",rbins,rmin,rmax,nptbins,ptmin,ptmax); 
        fhRCellE->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
        fhRCellE->SetYTitle("E (GeV)");
@@ -486,7 +483,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        fhXCellE->SetXTitle("x (cm)");
        fhXCellE->SetYTitle("E (GeV)");
        outputContainer->Add(fhXCellE);
-
+  
        fhYCellE  = new TH2F ("hYCellE","Cell Y position vs cell energy",ybins,ymin,ymax,nptbins,ptmin,ptmax); 
        fhYCellE->SetXTitle("y (cm)");
        fhYCellE->SetYTitle("E (GeV)");
@@ -502,13 +499,13 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        fhXYZCell->SetYTitle("y (cm)");
        fhXYZCell->SetZTitle("z (cm)");
        outputContainer->Add(fhXYZCell);
-
-
+  
+  
        Float_t dx = TMath::Abs(xmin)+TMath::Abs(xmax);
        Float_t dy = TMath::Abs(ymin)+TMath::Abs(ymax);
        Float_t dz = TMath::Abs(zmin)+TMath::Abs(zmax);
        Float_t dr = TMath::Abs(rmin)+TMath::Abs(rmax);
-
+  
        fhDeltaCellClusterRNCells  = new TH2F ("hDeltaCellClusterRNCells","Cluster-Cell R position vs N Clusters per Cell",rbins*2,-dr,dr,nbins,nmin,nmax); 
        fhDeltaCellClusterRNCells->SetXTitle("r = #sqrt{x^{2}+y^{2}} (cm)");
        fhDeltaCellClusterRNCells->SetYTitle("N cells per cluster");
@@ -554,13 +551,13 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        fhEtaPhiAmp->SetYTitle("#phi (rad)");
        fhEtaPhiAmp->SetZTitle("E (GeV) ");
        outputContainer->Add(fhEtaPhiAmp);              
-
-
-       //Calo cells
+  
+  
+    //Calo cells
        fhNCells  = new TH1F ("hNCells","# cells", colmax*rowmax*fNModules,0,colmax*rowmax*fNModules); 
        fhNCells->SetXTitle("n cells");
        outputContainer->Add(fhNCells);
-    
+  
        fhAmplitude  = new TH1F ("hAmplitude","Cell Energy", nptbins*2,ptmin,ptmax); 
        fhAmplitude->SetXTitle("Cell Energy (GeV)");
        outputContainer->Add(fhAmplitude);
@@ -572,7 +569,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        outputContainer->Add(fhAmpId);
        
        
-       //Cell Time histograms, time only available in ESDs
+    //Cell Time histograms, time only available in ESDs
        if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) {
                
                fhCellTimeSpreadRespectToCellMax = new TH1F ("hCellTimeSpreadRespectToCellMax","t_{cell max}-t_{cell i} per cluster", 100,-200,200); 
@@ -586,30 +583,30 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                fhTime  = new TH1F ("hTime","Cell Time",ntimebins,timemin,timemax); 
                fhTime->SetXTitle("Cell Time (ns)");
                outputContainer->Add(fhTime);
-
+    
                fhTimeId  = new TH2F ("hTimeId","Cell Time vs Absolute Id",ntimebins,timemin,timemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules); 
                fhTimeId->SetXTitle("Cell Time (ns)");
                fhTimeId->SetYTitle("Cell Absolute Id");
                outputContainer->Add(fhTimeId);
-       
+    
                fhTimeAmp  = new TH2F ("hTimeAmp","Cell Time vs Cell Energy",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax); 
                fhTimeAmp->SetYTitle("Cell Time (ns)");
                fhTimeAmp->SetXTitle("Cell Energy (GeV)");
                outputContainer->Add(fhTimeAmp);
                
-//             fhT0Time  = new TH1F ("hT0Time","Cell Time",ntimebins,timemin,timemax); 
-//             fhT0Time->SetXTitle("T_{0} - T_{EMCal} (ns)");
-//             outputContainer->Add(fhT0Time);
-//             
-//             fhT0TimeId  = new TH2F ("hT0TimeId","Cell Time vs Absolute Id",ntimebins,timemin,timemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules); 
-//             fhT0TimeId->SetXTitle("T_{0} - T_{EMCal} (ns)");
-//             fhT0TimeId->SetYTitle("Cell Absolute Id");
-//             outputContainer->Add(fhT0TimeId);
-//             
-//             fhT0TimeAmp  = new TH2F ("hT0TimeAmp","Cell Time vs Cell Energy",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax); 
-//             fhT0TimeAmp->SetYTitle("T_{0} - T_{EMCal} (ns)");
-//             fhT0TimeAmp->SetXTitle("Cell Energy (GeV)");
-//             outputContainer->Add(fhT0TimeAmp);
+      //               fhT0Time  = new TH1F ("hT0Time","Cell Time",ntimebins,timemin,timemax); 
+      //               fhT0Time->SetXTitle("T_{0} - T_{EMCal} (ns)");
+      //               outputContainer->Add(fhT0Time);
+      //               
+      //               fhT0TimeId  = new TH2F ("hT0TimeId","Cell Time vs Absolute Id",ntimebins,timemin,timemax,rowmax*colmax*fNModules,0,rowmax*colmax*fNModules); 
+      //               fhT0TimeId->SetXTitle("T_{0} - T_{EMCal} (ns)");
+      //               fhT0TimeId->SetYTitle("Cell Absolute Id");
+      //               outputContainer->Add(fhT0TimeId);
+      //               
+      //               fhT0TimeAmp  = new TH2F ("hT0TimeAmp","Cell Time vs Cell Energy",nptbins*2,ptmin,ptmax,ntimebins,timemin,timemax); 
+      //               fhT0TimeAmp->SetYTitle("T_{0} - T_{EMCal} (ns)");
+      //               fhT0TimeAmp->SetXTitle("Cell Energy (GeV)");
+      //               outputContainer->Add(fhT0TimeAmp);
        }
        
        
@@ -619,24 +616,24 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                fhCaloCorrNClusters->SetXTitle("number of clusters in EMCAL");
                fhCaloCorrNClusters->SetYTitle("number of clusters in PHOS");
                outputContainer->Add(fhCaloCorrNClusters);
-       
+    
                fhCaloCorrEClusters  = new TH2F ("hCaloCorrEClusters","summed energy of clusters in EMCAL vs PHOS", nptbins*2,ptmin,ptmax*2,nptbins,ptmin,ptmax*2); 
                fhCaloCorrEClusters->SetXTitle("#Sigma E of clusters in EMCAL (GeV)");
                fhCaloCorrEClusters->SetYTitle("#Sigma E of clusters in PHOS (GeV)");
                outputContainer->Add(fhCaloCorrEClusters);
-       
+    
                fhCaloCorrNCells  = new TH2F ("hCaloCorrNCells","# Cells in EMCAL vs PHOS", nbins,nmin,nmax, nbins,nmin,nmax); 
                fhCaloCorrNCells->SetXTitle("number of Cells in EMCAL");
                fhCaloCorrNCells->SetYTitle("number of Cells in PHOS");
                outputContainer->Add(fhCaloCorrNCells);
-       
+    
                fhCaloCorrECells  = new TH2F ("hCaloCorrECells","summed energy of Cells in EMCAL vs PHOS", nptbins*2,ptmin,ptmax*2,nptbins,ptmin,ptmax*2); 
                fhCaloCorrECells->SetXTitle("#Sigma E of Cells in EMCAL (GeV)");
                fhCaloCorrECells->SetYTitle("#Sigma E of Cells in PHOS (GeV)");
                outputContainer->Add(fhCaloCorrECells);
        }//correlate calorimeters
        
-       //Module histograms
+    //Module histograms
        fhEMod                 = new TH1F*[fNModules];
        fhNClustersMod         = new TH1F*[fNModules];
        fhNCellsPerClusterMod  = new TH2F*[fNModules];
@@ -647,14 +644,14 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        fhAmplitudeMod         = new TH1F*[fNModules];
        if(fCalorimeter=="EMCAL")
                fhAmplitudeModFraction = new TH1F*[fNModules*3];
-
+  
        fhTimeAmpPerRCU        = new TH2F*[fNModules*fNRCU];
-       //fhT0TimeAmpPerRCU      = new TH2F*[fNModules*fNRCU];
-       //fhTimeCorrRCU          = new TH2F*[fNModules*fNRCU*fNModules*fNRCU];
+    //fhT0TimeAmpPerRCU      = new TH2F*[fNModules*fNRCU];
+    //fhTimeCorrRCU          = new TH2F*[fNModules*fNRCU*fNModules*fNRCU];
        
        fhIMMod                = new TH2F*[fNModules];
        fhIMCellCutMod         = new TH2F*[fNModules];
-
+  
        for(Int_t imod = 0; imod < fNModules; imod++){
                
                fhEMod[imod]  = new TH1F (Form("hE_Mod%d",imod),Form("Cluster reconstructed Energy in Module %d ",imod), nptbins,ptmin,ptmax); 
@@ -666,8 +663,8 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                outputContainer->Add(fhNClustersMod[imod]);
                
                fhNCellsPerClusterMod[imod]  = new TH2F (Form("hNCellsPerCluster_Mod%d",imod),
-                                                                                                Form("# cells per cluster vs cluster energy in Module %d",imod), 
-                                                                                                nptbins,ptmin,ptmax, nbins,nmin,nmax); 
+                                             Form("# cells per cluster vs cluster energy in Module %d",imod), 
+                                             nptbins,ptmin,ptmax, nbins,nmin,nmax); 
                fhNCellsPerClusterMod[imod]->SetXTitle("E (GeV)");
                fhNCellsPerClusterMod[imod]->SetYTitle("n cells");
                outputContainer->Add(fhNCellsPerClusterMod[imod]);
@@ -676,19 +673,19 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                fhNCellsMod[imod]->SetXTitle("n cells");
                outputContainer->Add(fhNCellsMod[imod]);
                fhGridCellsMod[imod]  = new TH2F (Form("hGridCells_Mod%d",imod),Form("Entries in grid of cells in Module %d",imod), 
-                                                                                 colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); 
+                                      colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); 
                fhGridCellsMod[imod]->SetYTitle("row (phi direction)");
                fhGridCellsMod[imod]->SetXTitle("column (eta direction)");
                outputContainer->Add(fhGridCellsMod[imod]);
-
+    
                fhGridCellsEMod[imod]  = new TH2F (Form("hGridCellsE_Mod%d",imod),Form("Accumulated energy in grid of cells in Module %d",imod), 
-                                                                                  colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); 
+                                       colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); 
                fhGridCellsEMod[imod]->SetYTitle("row (phi direction)");
                fhGridCellsEMod[imod]->SetXTitle("column (eta direction)");
                outputContainer->Add(fhGridCellsEMod[imod]);
                
                fhGridCellsTimeMod[imod]  = new TH2F (Form("hGridCellsTime_Mod%d",imod),Form("Accumulated time in grid of cells in Module %d, with E > 0.5 GeV",imod), 
-                                                                                  colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); 
+                                          colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); 
                fhGridCellsTimeMod[imod]->SetYTitle("row (phi direction)");
                fhGridCellsTimeMod[imod]->SetXTitle("column (eta direction)");
                outputContainer->Add(fhGridCellsTimeMod[imod]);
@@ -707,45 +704,45 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                }
                
                for(Int_t ircu = 0; ircu < fNRCU; ircu++){
-                               fhTimeAmpPerRCU[imod*fNRCU+ircu]  = new TH2F (Form("hTimeAmp_Mod%d_RCU%d",imod,ircu),
-                                                                                                                  Form("Cell Energy vs Cell Time in Module %d, RCU %d ",imod,ircu), 
-                                                                                                                  nptbins,ptmin,ptmax,ntimebins,timemin,timemax); 
-                               fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)");
-                               fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("time (ns)");
-                               outputContainer->Add(fhTimeAmpPerRCU[imod*fNRCU+ircu]);
+      fhTimeAmpPerRCU[imod*fNRCU+ircu]  = new TH2F (Form("hTimeAmp_Mod%d_RCU%d",imod,ircu),
+                                                    Form("Cell Energy vs Cell Time in Module %d, RCU %d ",imod,ircu), 
+                                                    nptbins,ptmin,ptmax,ntimebins,timemin,timemax); 
+      fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)");
+      fhTimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("time (ns)");
+      outputContainer->Add(fhTimeAmpPerRCU[imod*fNRCU+ircu]);
                        
-//                             fhT0TimeAmpPerRCU[imod*fNRCU+ircu]  = new TH2F (Form("hT0TimeAmp_Mod%d_RCU%d",imod,ircu),
-//                                                                                                                       Form("Cell Energy vs T0-Cell Time in Module %d, RCU %d ",imod,ircu), 
-//                                                                                                                       nptbins,ptmin,ptmax,ntimebins,timemin,timemax); 
-//                             fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)");
-//                             fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("T_{0} - T_{EMCal} (ns)");
-//                             outputContainer->Add(fhT0TimeAmpPerRCU[imod*fNRCU+ircu]);
-//                     
+        //                             fhT0TimeAmpPerRCU[imod*fNRCU+ircu]  = new TH2F (Form("hT0TimeAmp_Mod%d_RCU%d",imod,ircu),
+        //                                                                                                                       Form("Cell Energy vs T0-Cell Time in Module %d, RCU %d ",imod,ircu), 
+        //                                                                                                                       nptbins,ptmin,ptmax,ntimebins,timemin,timemax); 
+        //                             fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetXTitle("E (GeV)");
+        //                             fhT0TimeAmpPerRCU[imod*fNRCU+ircu]->SetYTitle("T_{0} - T_{EMCal} (ns)");
+        //                             outputContainer->Add(fhT0TimeAmpPerRCU[imod*fNRCU+ircu]);
+        //                     
                        
-//                             for(Int_t imod2 = 0; imod2 < fNModules; imod2++){
-//                                             for(Int_t ircu2 = 0; ircu2 < fNModules; ircu2++){
-//                                                     Int_t index =  (imod2*fNRCU+ircu2)+(fNModules*fNRCU)*(ircu+imod)+fNRCU*fNModules*imod; 
-//                                                     fhTimeCorrRCU[index]  = new TH2F (Form("hTimeCorrRCU_Mod%d_RCU%d_CompareTo_Mod%d_RCU%d",imod, ircu,imod2, ircu2),
-//                                                                                                                                                     Form("Cell Energy > 0.3, Correlate cell Time in Module %d, RCU %d to Module %d, RCU %d",imod,ircu,imod2, ircu2),
-//                                                                                                                                                     ntimebins,timemin,timemax,ntimebins,timemin,timemax); 
-//                                                     fhTimeCorrRCU[index]->SetXTitle("Trigger Cell Time (ns)");
-//                                                     fhTimeCorrRCU[index]->SetYTitle("Cell Time (ns)");
-//                                                     outputContainer->Add(fhTimeCorrRCU[index]);
-//                                             }
-//                             }
+        //                             for(Int_t imod2 = 0; imod2 < fNModules; imod2++){
+        //                                             for(Int_t ircu2 = 0; ircu2 < fNModules; ircu2++){
+        //                                                     Int_t index =  (imod2*fNRCU+ircu2)+(fNModules*fNRCU)*(ircu+imod)+fNRCU*fNModules*imod; 
+        //                                                     fhTimeCorrRCU[index]  = new TH2F (Form("hTimeCorrRCU_Mod%d_RCU%d_CompareTo_Mod%d_RCU%d",imod, ircu,imod2, ircu2),
+        //                                                                                                                                                     Form("Cell Energy > 0.3, Correlate cell Time in Module %d, RCU %d to Module %d, RCU %d",imod,ircu,imod2, ircu2),
+        //                                                                                                                                                     ntimebins,timemin,timemax,ntimebins,timemin,timemax); 
+        //                                                     fhTimeCorrRCU[index]->SetXTitle("Trigger Cell Time (ns)");
+        //                                                     fhTimeCorrRCU[index]->SetYTitle("Cell Time (ns)");
+        //                                                     outputContainer->Add(fhTimeCorrRCU[index]);
+        //                                             }
+        //                             }
                }
                
                
                fhIMMod[imod]  = new TH2F (Form("hIM_Mod%d",imod),
-                                                                  Form("Cluster pairs Invariant mass vs reconstructed pair energy in Module %d",imod),
-                                                                  nptbins,ptmin,ptmax,nmassbins,massmin,massmax); 
+                               Form("Cluster pairs Invariant mass vs reconstructed pair energy in Module %d",imod),
+                               nptbins,ptmin,ptmax,nmassbins,massmin,massmax); 
                fhIMMod[imod]->SetXTitle("p_{T, cluster pairs} (GeV) ");
                fhIMMod[imod]->SetYTitle("M_{cluster pairs} (GeV/c^{2})");
                outputContainer->Add(fhIMMod[imod]);
-                               
+    
                fhIMCellCutMod[imod]  = new TH2F (Form("hIMCellCut_Mod%d",imod),
-                                                                  Form("Cluster (n cells > 1) pairs Invariant mass vs reconstructed pair energy in Module %d",imod),
-                                                                  nptbins,ptmin,ptmax,nmassbins,massmin,massmax); 
+                                      Form("Cluster (n cells > 1) pairs Invariant mass vs reconstructed pair energy in Module %d",imod),
+                                      nptbins,ptmin,ptmax,nmassbins,massmin,massmax); 
                fhIMCellCutMod[imod]->SetXTitle("p_{T, cluster pairs} (GeV) ");
                fhIMCellCutMod[imod]->SetYTitle("M_{cluster pairs} (GeV/c^{2})");
                outputContainer->Add(fhIMCellCutMod[imod]);
@@ -753,7 +750,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
        }
        
        
-       //Monte Carlo Histograms
+    //Monte Carlo Histograms
        if(IsDataMC()){
                
                fhDeltaE  = new TH1F ("hDeltaE","MC - Reco E ", nptbins*2,-ptmax,ptmax); 
@@ -808,7 +805,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                fh2Eta->SetYTitle("#eta_{gen} ");
                outputContainer->Add(fh2Eta);
                
-               //Fill histos depending on origin of cluster
+      //Fill histos depending on origin of cluster
                fhGamE  = new TH2F ("hGamE","E reconstructed vs E generated from #gamma", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax); 
                fhGamE->SetXTitle("E_{rec} (GeV)");
                fhGamE->SetXTitle("E_{gen} (GeV)");
@@ -860,7 +857,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                fhGamRatioEta  = new TH1F ("hGamRatioEta","#gamma Reco/MC #eta",nratiobins,ratiomin,ratiomax); 
                fhGamRatioEta->SetXTitle("#eta_{reco}/#eta_{gen} ");
                outputContainer->Add(fhGamRatioEta);
-
+    
                fhPi0E  = new TH2F ("hPi0E","E reconstructed vs E generated from #pi^{0}", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax); 
                fhPi0E->SetXTitle("E_{rec} (GeV)");
                fhPi0E->SetYTitle("E_{gen} (GeV)");
@@ -941,7 +938,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                fhChHadEta->SetYTitle("#eta_{gen} ");
                outputContainer->Add(fhChHadEta);
                
-               //Charged clusters
+      //Charged clusters
                
                fhGamECharged  = new TH2F ("hGamECharged","E reconstructed vs E generated from #gamma, track matched cluster", nptbins,ptmin,ptmax, nptbins,ptmin,ptmax); 
                fhGamECharged->SetXTitle("E_{rec} (GeV)");
@@ -1044,18 +1041,18 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                fhChHadEtaCharged->SetYTitle("#eta_{gen} ");
                outputContainer->Add(fhChHadEtaCharged);
                
-               //Vertex of generated particles 
+      //Vertex of generated particles 
                
                fhEMVxyz  = new TH2F ("hEMVxyz","Production vertex of reconstructed ElectroMagnetic particles",nvdistbins,vdistmin,vdistmax,nvdistbins,vdistmin,vdistmax);//,100,0,500); 
                fhEMVxyz->SetXTitle("v_{x}");
                fhEMVxyz->SetYTitle("v_{y}");
-               //fhEMVxyz->SetZTitle("v_{z}");
+      //fhEMVxyz->SetZTitle("v_{z}");
                outputContainer->Add(fhEMVxyz);
                
                fhHaVxyz  = new TH2F ("hHaVxyz","Production vertex of reconstructed hadrons",nvdistbins,vdistmin,vdistmax,nvdistbins,vdistmin,vdistmax);//,100,0,500); 
                fhHaVxyz->SetXTitle("v_{x}");
                fhHaVxyz->SetYTitle("v_{y}");
-               //fhHaVxyz->SetZTitle("v_{z}");
+      //fhHaVxyz->SetZTitle("v_{z}");
                outputContainer->Add(fhHaVxyz);
                
                fhEMR  = new TH2F ("hEMR","Distance to production vertex of reconstructed ElectroMagnetic particles vs E rec",nptbins,ptmin,ptmax,nvdistbins,vdistmin,vdistmax); 
@@ -1068,9 +1065,9 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                fhHaR->SetYTitle("TMath::Sqrt(v_{x}^{2}+v_{y}^{2})");
                outputContainer->Add(fhHaR);
                
-
+    
                
-               //Pure MC
+      //Pure MC
                fhGenGamPt  = new TH1F("hGenGamPt" ,"p_{T} of generated #gamma",nptbins,ptmin,ptmax);
                fhGenGamEta = new TH1F("hGenGamEta","Y of generated #gamma",netabins,etamin,etamax);
                fhGenGamPhi = new TH1F("hGenGamPhi","#phi of generated #gamma",nphibins,phimin,phimax);
@@ -1097,7 +1094,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                outputContainer->Add(fhGenGamPt);
                outputContainer->Add(fhGenGamEta);
                outputContainer->Add(fhGenGamPhi);
-
+    
                fhGenPi0Pt->SetXTitle("p_{T} (GeV/c)");
                fhGenPi0Eta->SetXTitle("#eta");
                fhGenPi0Phi->SetXTitle("#phi (rad)");
@@ -1111,7 +1108,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                outputContainer->Add(fhGenEtaPt);
                outputContainer->Add(fhGenEtaEta);
                outputContainer->Add(fhGenEtaPhi);
-                               
+    
                fhGenOmegaPt->SetXTitle("p_{T} (GeV/c)");
                fhGenOmegaEta->SetXTitle("#eta");
                fhGenOmegaPhi->SetXTitle("#phi (rad)");
@@ -1154,7 +1151,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
                outputContainer->Add(fhGenPi0AccEta);
                outputContainer->Add(fhGenPi0AccPhi);
                
-               //Track Matching 
+      //Track Matching 
                
          fhMCEle1pOverE = new TH2F("hMCEle1pOverE","TRACK matches p/E, MC electrons",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
          fhMCEle1pOverE->SetYTitle("p/E");
@@ -1197,7 +1194,7 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
          fhMCNeutral2MatchdEdx->SetXTitle("p (GeV/c)");
          fhMCNeutral2MatchdEdx->SetYTitle("<dE/dx>");
          outputContainer->Add(fhMCNeutral2MatchdEdx);
-                 
+    
          fhMCEle1pOverER02 = new TH2F("hMCEle1pOverER02","TRACK matches p/E, MC electrons",nptbins,ptmin,ptmax, nPoverEbins,pOverEmin,pOverEmax);
          fhMCEle1pOverER02->SetYTitle("p/E");
          fhMCEle1pOverER02->SetXTitle("p_{T} (GeV/c)");
@@ -1213,25 +1210,25 @@ TList *  AliAnaCalorimeterQA::GetCreateOutputObjects()
          fhMCNeutral1pOverER02->SetXTitle("p_{T} (GeV/c)");
          outputContainer->Add(fhMCNeutral1pOverER02);
        }
-
+  
        return outputContainer;
 }
 
-//_______________________________________________________________________________________________________________________________________
+  //_______________________________________________________________________________________________________________________________________
 Int_t AliAnaCalorimeterQA::GetNewRebinForRePlotting(TH1D* histo, const Float_t newXmin, const Float_t newXmax,const Int_t newXnbins) const
 {
-  //Calculate the rebinning for the new requested bin size, only used when replotting executing the Terminte
+    //Calculate the rebinning for the new requested bin size, only used when replotting executing the Terminte
   Float_t oldbinsize =  histo->GetBinWidth(0);
   Float_t newbinsize = TMath::Abs(newXmax-newXmin) / newXnbins;
-  //printf("bin size, old %f, new %f\n",oldbinsize,newbinsize);
+    //printf("bin size, old %f, new %f\n",oldbinsize,newbinsize);
   if(newbinsize > oldbinsize) return (Int_t) (newbinsize/oldbinsize);
   else  return 1;
 }
 
-//__________________________________________________
+  //__________________________________________________
 void AliAnaCalorimeterQA::Init()
 { 
-       //Check if the data or settings are ok
+    //Check if the data or settings are ok
        if(fCalorimeter != "PHOS" && fCalorimeter !="EMCAL"){
                printf("AliAnaCalorimeterQA::Init() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data());
                abort();
@@ -1245,12 +1242,12 @@ void AliAnaCalorimeterQA::Init()
 }
 
 
-//__________________________________________________
+  //__________________________________________________
 void AliAnaCalorimeterQA::InitParameters()
 { 
-  //Initialize the parameters of the analysis.
+    //Initialize the parameters of the analysis.
   AddToHistogramsName("AnaCaloQA_");
-
+  
   fCalorimeter = "EMCAL"; //or PHOS
   fStyleMacro  = "" ;
   fNModules    = 12; // set maximum to maximum number of EMCAL modules
@@ -1273,16 +1270,16 @@ void AliAnaCalorimeterQA::InitParameters()
        
 }
 
-//__________________________________________________________________
+  //__________________________________________________________________
 void AliAnaCalorimeterQA::Print(const Option_t * opt) const
 {
-  //Print some relevant parameters set for the analysis
+    //Print some relevant parameters set for the analysis
   if(! opt)
     return;
   
   printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
   AliAnaPartCorrBaseClass::Print(" ");
-
+  
   printf("Select Calorimeter %s \n",fCalorimeter.Data());
   printf("Make plots?        %d \n",fMakePlots);       
   printf("Plots style macro  %s \n",fStyleMacro.Data()); 
@@ -1298,13 +1295,13 @@ void AliAnaCalorimeterQA::Print(const Option_t * opt) const
   printf("Histograms: %d < N    < %d, Nbin = %d\n"      , fHistoNMin,      fHistoNMax,      fHistoNBins);
   printf("Histograms: %3.1f < Ratio< %3.1f, Nbin = %d\n", fHistoRatioMin,  fHistoRatioMax,  fHistoRatioBins);
   printf("Histograms: %3.1f < Vertex Distance < %3.1f, Nbin = %d\n", fHistoVertexDistMin, fHistoVertexDistMax, fHistoVertexDistBins);
-
+  
 } 
 
-//__________________________________________________________________
+  //__________________________________________________________________
 void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms() 
 {
-       //Fill Calorimeter QA histograms
+    //Fill Calorimeter QA histograms
        TLorentzVector mom ;
        TLorentzVector mom2 ;
        TRefArray * caloClusters = new TRefArray();
@@ -1315,39 +1312,39 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
        Int_t nTracksMatched = 0;
        Int_t trackIndex = 0;
        Int_t nModule = -1;
-
-       //Play with the MC stack if available   
-       //Get the MC arrays and do some checks
+  
+    //Play with the MC stack if available      
+    //Get the MC arrays and do some checks
        if(IsDataMC()){
                if(GetReader()->ReadStack()){
-
+      
                        if(!GetMCStack()) {
                                printf("AliAnaPhoton::MakeAnalysisFillHistograms() - Stack not available, is the MC handler called? STOP\n");
                                abort();
                        }
-                       //Fill some pure MC histograms, only primaries.
+        //Fill some pure MC histograms, only primaries.
                        for(Int_t i=0 ; i<GetMCStack()->GetNprimary(); i++){//Only primary particles, for all MC transport put GetNtrack()
                                TParticle *primary = GetMCStack()->Particle(i) ;
-                               //printf("i %d, %s: status = %d, primary? %d\n",i, primary->GetName(), primary->GetStatusCode(), primary->IsPrimary());
+          //printf("i %d, %s: status = %d, primary? %d\n",i, primary->GetName(), primary->GetStatusCode(), primary->IsPrimary());
                                if (primary->GetStatusCode() > 11) continue; //Working for PYTHIA and simple generators, check for HERWIG 
                                primary->Momentum(mom);
                                MCHistograms(mom,TMath::Abs(primary->GetPdgCode()));
                        } //primary loop
                }
                else if(GetReader()->ReadAODMCParticles()){
-
+      
                        if(!GetReader()->GetAODMCParticles(0))  {
                                printf("AliAnaPhoton::MakeAnalysisFillHistograms() -  AODMCParticles not available!\n");
                                abort();
                        }
-                       //Fill some pure MC histograms, only primaries.
+        //Fill some pure MC histograms, only primaries.
                        for(Int_t i=0 ; i < (GetReader()->GetAODMCParticles(0))->GetEntriesFast(); i++){
                                AliAODMCParticle *aodprimary = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(0))->At(i) ;
-                               //printf("i %d, %s: primary? %d physical primary? %d, flag %d\n",
-                               //         i,(TDatabasePDG::Instance()->GetParticle(aodprimary->GetPdgCode()))->GetName(), 
-                               //         aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), aodprimary->GetFlag());
+          //printf("i %d, %s: primary? %d physical primary? %d, flag %d\n",
+          //      i,(TDatabasePDG::Instance()->GetParticle(aodprimary->GetPdgCode()))->GetName(), 
+          //      aodprimary->IsPrimary(), aodprimary->IsPhysicalPrimary(), aodprimary->GetFlag());
                                if (!aodprimary->IsPrimary()) continue; //accept all which is not MC transport generated. Don't know how to avoid partons
-                               //aodprimary->Momentum(mom);
+                                                //aodprimary->Momentum(mom);
                                mom.SetPxPyPzE(aodprimary->Px(),aodprimary->Py(),aodprimary->Pz(),aodprimary->E());
                                MCHistograms(mom,TMath::Abs(aodprimary->GetPdgCode()));
                        } //primary loop
@@ -1356,39 +1353,25 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
        }// is data and MC      
        
        
-       //Get List with CaloClusters  
+    //Get List with CaloClusters  
        
-       if(GetReader()->GetDataType()==AliCaloTrackReader::kESD) {
-               if     (fCalorimeter == "EMCAL") ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALClusters(caloClusters);//GetAODEMCAL();
-               else if(fCalorimeter == "PHOS")  ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSClusters (caloClusters);//GetAODPHOS();
-               else {
-                       printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data());
-                       abort();
-               }
-       }
-       else if(GetReader()->GetDataType()==AliCaloTrackReader::kAOD) {
-               if     (fCalorimeter == "EMCAL") ((AliAODEvent*)GetReader()->GetInputEvent())->GetEMCALClusters(caloClusters);//GetAODEMCAL();
-               else if(fCalorimeter == "PHOS")  ((AliAODEvent*)GetReader()->GetInputEvent())->GetPHOSClusters (caloClusters);//GetAODPHOS();
-               else {
-                       printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data());
-                       abort();
-               }
-       }
+  if     (fCalorimeter == "EMCAL") GetReader()->GetInputEvent()->GetEMCALClusters(caloClusters);//GetAODEMCAL();
+  else if(fCalorimeter == "PHOS") GetReader()->GetInputEvent()->GetPHOSClusters (caloClusters);//GetAODPHOS();
+  else 
+    AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - Wrong calorimeter name <%s>, END\n", fCalorimeter.Data()));
        
-       if(!caloClusters) {
-               printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - No CaloClusters available\n");
-               abort();
-       }
+       if(!caloClusters) 
+               AliFatal(Form("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - No CaloClusters available\n"));
        
-       //----------------------------------------------------------
-       //Correlate Calorimeters
-       //----------------------------------------------------------
+    //----------------------------------------------------------
+    //Correlate Calorimeters
+    //----------------------------------------------------------
        if(fCorrelateCalos)     CorrelateCalorimeters(caloClusters);
-               
+  
        
-       //----------------------------------------------------------
-       // CALOCLUSTERS
-       //----------------------------------------------------------
+    //----------------------------------------------------------
+    // CALOCLUSTERS
+    //----------------------------------------------------------
        
        nCaloClusters = caloClusters->GetEntriesFast() ; 
        fhNClusters->Fill(nCaloClusters);
@@ -1398,92 +1381,90 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
        if(GetDebug() > 0)
                printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - In %s there are %d clusters \n", fCalorimeter.Data(), nCaloClusters);
        
-       //Get vertex for photon momentum calculation
+    //Get vertex for photon momentum calculation
        Double_t v[3] = {0,0,0}; //vertex ;
        GetReader()->GetVertex(v);
-       TObject * track = 0x0;
+       AliVTrack * track = 0x0;
        
        Float_t pos[3] ;
        Float_t showerShape[3] ;
        Double_t tof = 0;
-       //Loop over CaloClusters
-       //if(nCaloClusters > 0)printf("QA  : Vertex Cut passed %f, cut %f, entries %d, %s\n",v[2], 40., nCaloClusters, fCalorimeter.Data());
+    //Loop over CaloClusters
+    //if(nCaloClusters > 0)printf("QA  : Vertex Cut passed %f, cut %f, entries %d, %s\n",v[2], 40., nCaloClusters, fCalorimeter.Data());
        for(Int_t iclus = 0; iclus < nCaloClusters; iclus++){
                
                if(GetDebug() > 0) printf("AliAnaCalorimeterQA::MakeAnalysisFillHistograms() - cluster: %d/%d, data %d \n",
-                                                                       iclus+1,nCaloClusters,GetReader()->GetDataType());
+                               iclus+1,nCaloClusters,GetReader()->GetDataType());
                
                if(GetReader()->GetDataType()==AliCaloTrackReader::kESD){
-                       AliESDCaloCluster* clus =  (AliESDCaloCluster*) (caloClusters->At(iclus));
-                       AliESDCaloCells * cell = 0x0; 
-                       if(fCalorimeter == "PHOS") cell =  ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSCells();
-                       else                               cell =  ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALCells();
+                       AliVCluster* clus =  (AliVCluster*)caloClusters->At(iclus);
+                       AliVCaloCells * cell = 0x0; 
+                       if(fCalorimeter == "PHOS") cell =  GetReader()->GetInputEvent()->GetPHOSCells();
+                       else                               cell =  GetReader()->GetInputEvent()->GetEMCALCells();
                        
-                       //Check if the cluster contains any bad channel or it is close to the calorimeter borders
+        //Check if the cluster contains any bad channel or it is close to the calorimeter borders
                        if( GetCaloUtils()->ClusterContainsBadChannel(fCalorimeter,clus->GetCellsAbsId(), clus->GetNCells())) continue; 
-                       if(!GetCaloUtils()->CheckCellFiducialRegion(clus, cell)) continue;
-                       //Recalibrate the cluster energy 
+                       if(!GetCaloUtils()->CheckCellFiducialRegion(clus, cell, GetReader()->GetInputEvent(), 0)) continue;
+        //Recalibrate the cluster energy 
                        if( GetCaloUtils()->IsRecalibrationOn())        {
                                Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, cell);
                                clus->SetE(energy);
                        }
                        
-                       //Get cluster kinematics
+        //Get cluster kinematics
                        clus->GetPosition(pos);
                        clus->GetMomentum(mom,v);
                        tof = clus->GetTOF()*1e9;
                        if(tof < fTimeCutMin || tof > fTimeCutMax) continue;
                        
-                       //Check only certain regions
+        //Check only certain regions
                        Bool_t in = kTRUE;
                        if(IsFiducialCutOn()) in =  GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
                        if(!in) continue;
-                       //Get module of cluster
+        //Get module of cluster
                        nModule = GetModuleNumber(clus);
                        if(nModule < fNModules) nClustersInModule[nModule]++;
-                       //MC labels
+        //MC labels
                        nLabel = clus->GetNLabels();
-                       //labels = clus->GetLabels();
-                       if(clus->GetLabels()) labels =  (clus->GetLabels())->GetArray();
-                       //Cells per cluster
+                       labels = clus->GetLabels();
+        //Cells per cluster
                        nCaloCellsPerCluster =  clus->GetNCells();
-                       //if(mom.E() > 10 && nCaloCellsPerCluster == 1 ) printf("%s:************** E = %f ********** ncells = %d\n",fCalorimeter.Data(), mom.E(),nCaloCellsPerCluster);
-                       //matched cluster with tracks
+        //if(mom.E() > 10 && nCaloCellsPerCluster == 1 ) printf("%s:************** E = %f ********** ncells = %d\n",fCalorimeter.Data(), mom.E(),nCaloCellsPerCluster);
+        //matched cluster with tracks
                        nTracksMatched = clus->GetNTracksMatched();
-                       trackIndex     = clus->GetTrackMatched();
+                       trackIndex     = clus->GetTrackMatchedIndex();
                        if(trackIndex >= 0){
-                               track = (AliESDtrack*) ((AliESDEvent*)GetReader()->GetInputEvent())->GetTrack(trackIndex);
+                               track = (AliVTrack*)GetReader()->GetInputEvent()->GetTrack(trackIndex);
                        }
                        else{
                                if(nTracksMatched == 1) nTracksMatched = 0;
                                track = 0;
                        }
                        
-                       //Shower shape parameters
+        //Shower shape parameters
                        showerShape[0] = clus->GetM20();
                        showerShape[1] = clus->GetM02();
-                       //showerShape[2] = clus->GetDispersion();
-                       showerShape[2] = clus->GetClusterDisp();
-
-                       //======================
-                       //Cells in cluster
-                       //======================
-
-                       //Get list of contributors
+                       showerShape[2] = clus->GetDispersion();
+      
+        //======================
+        //Cells in cluster
+        //======================
+      
+        //Get list of contributors
                        UShort_t * indexList = clus->GetCellsAbsId() ;
-                       // check time of cells respect to max energy cell
-                       //Get maximum energy cell
+        // check time of cells respect to max energy cell
+        //Get maximum energy cell
                        Float_t emax  = -1;
                        Double_t tmax = -1;
                        Int_t imax    = -1;
                        Int_t absId   = -1 ;
-                       //printf("nCaloCellsPerCluster %d\n",nCaloCellsPerCluster);
-                       //Loop on cluster cells
+        //printf("nCaloCellsPerCluster %d\n",nCaloCellsPerCluster);
+        //Loop on cluster cells
                        for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++) {
-                         //    printf("Index %d\n",ipos);
+          //   printf("Index %d\n",ipos);
                          absId  = indexList[ipos]; 
                          
-                         //Get position of cell compare to cluster
+          //Get position of cell compare to cluster
                          if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){
                            
                            Double_t cellpos[] = {0, 0, 0};
@@ -1501,21 +1482,21 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
                            Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]);
                            fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ; 
                            fhDeltaCellClusterRE     ->Fill(r-rcell, mom.E())  ; 
-                       
-//                                     Float_t celleta = 0, cellphi = 0;
-//                                     GetEMCALGeometry()->EtaPhiFromIndex(absId, celleta, cellphi); 
-//                                     Int_t imod = -1, iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1;
-//                                     GetEMCALGeometry()->GetCellIndex(absId,imod,iTower,iIphi,iIeta); 
-//                                     GetEMCALGeometry()->GetCellPhiEtaIndexInSModule(imod,iTower,
-//                                                                                                                                                              iIphi, iIeta,iphi,ieta);
-//                                     printf("AbsId %d, SM %d, Index eta %d, phi %d\n", absId, imod, ieta, iphi);
-//                                     printf("Cluster E %f, eta %f, phi %f; Cell: Amp %f, eta %f, phi%f\n", mom.E(),mom.Eta(), mom.Phi()*TMath::RadToDeg(), cell->GetCellAmplitude(absId),celleta, cellphi*TMath::RadToDeg());
-//                                     printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]);
-//                                     printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]);
-//                                     printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]);
-//                                     printf("r cluster %f, r cell %f, cluster-cell %f\n",r,      rcell,     r-rcell);
-//                                     
-
+          
+            //                                 Float_t celleta = 0, cellphi = 0;
+            //                                 GetEMCALGeometry()->EtaPhiFromIndex(absId, celleta, cellphi); 
+            //                                 Int_t imod = -1, iTower = -1, iIphi = -1, iIeta = -1, iphi = -1, ieta = -1;
+            //                                 GetEMCALGeometry()->GetCellIndex(absId,imod,iTower,iIphi,iIeta); 
+            //                                 GetEMCALGeometry()->GetCellPhiEtaIndexInSModule(imod,iTower,
+            //                                                                                                                                                          iIphi, iIeta,iphi,ieta);
+            //                                 printf("AbsId %d, SM %d, Index eta %d, phi %d\n", absId, imod, ieta, iphi);
+            //                                 printf("Cluster E %f, eta %f, phi %f; Cell: Amp %f, eta %f, phi%f\n", mom.E(),mom.Eta(), mom.Phi()*TMath::RadToDeg(), cell->GetCellAmplitude(absId),celleta, cellphi*TMath::RadToDeg());
+            //                                 printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]);
+            //                                 printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]);
+            //                                 printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]);
+            //                                 printf("r cluster %f, r cell %f, cluster-cell %f\n",r,      rcell,     r-rcell);
+            //                                 
+          
                          }//EMCAL and its matrices are available
                          else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){
                            TVector3 xyz;
@@ -1540,22 +1521,22 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
                            fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ; 
                            fhDeltaCellClusterRE     ->Fill(r-rcell, mom.E())  ; 
                            
-//                             printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]);
-//                             printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]);
-//                             printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]);
-//                                     printf("r cluster %f, r cell %f, cluster-cell %f\n",r,      rcell,     r-rcell);
+            //                         printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]);
+            //                         printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]);
+            //                         printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]);
+            //                                 printf("r cluster %f, r cell %f, cluster-cell %f\n",r,      rcell,     r-rcell);
                          }//PHOS and its matrices are available
-
-                         //Find maximum energy cluster
+        
+          //Find maximum energy cluster
                          if(cell->GetCellAmplitude(absId) > emax) {
                            imax = ipos;
                            emax = cell->GetCellAmplitude(absId);
                            tmax = cell->GetCellTime(absId);
                          } 
-
+        
                        }// cluster cell loop
                        
-                       // check time of cells respect to max energy cell
+        // check time of cells respect to max energy cell
                        if(nCaloCellsPerCluster > 1){
                          for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++) {
                            if(imax == ipos) continue;
@@ -1566,212 +1547,72 @@ void  AliAnaCalorimeterQA::MakeAnalysisFillHistograms()
                          }// fill cell-cluster histogram loop
                          
                        }//check time of cells respect to max energy cell
-                       
-                       
-               }//ESDs
-               else{
-                       AliAODCaloCluster* clus =  (AliAODCaloCluster*) (caloClusters->At(iclus));
-                       AliAODCaloCells * cell = 0x0; 
-                       if(fCalorimeter == "PHOS") cell =  ((AliAODEvent*)GetReader()->GetInputEvent())->GetPHOSCells();
-                       else                                       cell =  ((AliAODEvent*)GetReader()->GetInputEvent())->GetEMCALCells();
-                       
-                       //Check if the cluster contains any bad channel or it is close to calorimeter borders
-                       if( GetCaloUtils()->ClusterContainsBadChannel(fCalorimeter,clus->GetCellsAbsId(), clus->GetNCells())) continue;
-                       if(!GetCaloUtils()->CheckCellFiducialRegion(clus, cell)) continue;
-                       //Recalibrate the cluster energy 
-                       if( GetCaloUtils()->IsRecalibrationOn())        {
-                               Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, cell);
-                               clus->SetE(energy);
-                       }
-                       
-                       //Get cluster kinematics
-                       clus->GetPosition(pos);
-                       clus->GetMomentum(mom,v);
-                       tof = clus->GetTOF()*1e9;
-                       if(tof < fTimeCutMin || tof > fTimeCutMax) continue;
-
-                       //Check only certain regions
-                       Bool_t in = kTRUE;
-                       if(IsFiducialCutOn()) in =  GetFiducialCut()->IsInFiducialCut(mom,fCalorimeter) ;
-                       if(!in) continue;                       
-                       //Get module of cluster
-                       nModule = GetModuleNumber(clus);
-                       if(nModule < fNModules)  nClustersInModule[nModule]++;
-                       //MC labels
-                       nLabel = clus->GetNLabel();
-                       //labels = clus->GetLabels();
-                       if(clus->GetLabels()) labels =  clus->GetLabels();
-                       //Cells per cluster
-                       nCaloCellsPerCluster = clus->GetNCells();
-                       //matched cluster with tracks
-                       nTracksMatched = clus->GetNTracksMatched();
-                       if(nTracksMatched > 0)
-                               track  = (AliAODTrack*)clus->GetTrackMatched(0);
-                       
-                   //Shower shape parameters
-                       showerShape[0] = clus->GetM20();
-                       showerShape[1] = clus->GetM02();
-                       showerShape[2] = clus->GetDispersion();
-                       
-                       //======================
-                       //Cells in cluster
-                       //======================
-                                               
-                       //Get list of contributors
-                       UShort_t * indexList = clus->GetCellsAbsId() ;
-                       Int_t absId   = -1 ;
-                       //printf("nCaloCellsPerCluster %d\n",nCaloCellsPerCluster);
-                       //Loop on cluster cells
-                       for (Int_t ipos = 0; ipos < nCaloCellsPerCluster; ipos++) {
-                               //      printf("Index %d\n",ipos);
-                               absId  = indexList[ipos]; 
-                               
-                               //Get position of cell compare to cluster
-                               if(fCalorimeter=="EMCAL" && GetCaloUtils()->IsEMCALGeoMatrixSet()){
-                                       
-                                       Double_t cellpos[] = {0, 0, 0};
-                                       GetEMCALGeometry()->GetGlobal(absId, cellpos);
-                                       
-                                       fhDeltaCellClusterXNCells->Fill(pos[0]-cellpos[0],nCaloCellsPerCluster) ; 
-                                       fhDeltaCellClusterYNCells->Fill(pos[1]-cellpos[1],nCaloCellsPerCluster) ; 
-                                       fhDeltaCellClusterZNCells->Fill(pos[2]-cellpos[2],nCaloCellsPerCluster) ;
-                                       
-                                       fhDeltaCellClusterXE->Fill(pos[0]-cellpos[0],mom.E())  ; 
-                                       fhDeltaCellClusterYE->Fill(pos[1]-cellpos[1],mom.E())  ; 
-                                       fhDeltaCellClusterZE->Fill(pos[2]-cellpos[2],mom.E())  ; 
-                                       
-                                       Float_t r     = TMath::Sqrt(pos[0]*pos[0]        +pos[1]*pos[1]);//        +pos[2]*pos[2]);
-                                       Float_t rcell = TMath::Sqrt(cellpos[0]*cellpos[0]+cellpos[1]*cellpos[1]);//+cellpos[2]*cellpos[2]);
-                                       fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ; 
-                                       fhDeltaCellClusterRE     ->Fill(r-rcell, mom.E())  ; 
-                                       
-//                                             printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]);
-//                                             printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]);
-//                                             printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]);
-//                                             printf("r cluster %f, r cell %f, cluster-cell %f\n",r,      rcell,     r-rcell);                                        
-                                       
-                               }// EMCAL and its matrices are available
-                               else if(fCalorimeter=="PHOS" && GetCaloUtils()->IsPHOSGeoMatrixSet()){
-                                 TVector3 xyz;
-                                 Int_t relId[4], module;
-                                 Float_t xCell, zCell;
-                                 
-                                 GetPHOSGeometry()->AbsToRelNumbering(absId,relId);
-                                 module = relId[0];
-                                 GetPHOSGeometry()->RelPosInModule(relId,xCell,zCell);
-                                 GetPHOSGeometry()->Local2Global(module,xCell,zCell,xyz);
-                                 
-                                 fhDeltaCellClusterXNCells->Fill(pos[0]-xyz.X(),nCaloCellsPerCluster) ; 
-                                 fhDeltaCellClusterYNCells->Fill(pos[1]-xyz.Y(),nCaloCellsPerCluster) ; 
-                                 fhDeltaCellClusterZNCells->Fill(pos[2]-xyz.Z(),nCaloCellsPerCluster) ;
-                                 
-                                 fhDeltaCellClusterXE->Fill(pos[0]-xyz.X(),mom.E())  ; 
-                                 fhDeltaCellClusterYE->Fill(pos[1]-xyz.Y(),mom.E())  ; 
-                                 fhDeltaCellClusterZE->Fill(pos[2]-xyz.Z(),mom.E())  ; 
-                                 
-                                 Float_t r     = TMath::Sqrt(pos[0]*pos[0]  +pos[1]*pos[1]);//     +pos[2]*pos[2]);
-                                 Float_t rcell = TMath::Sqrt(xyz.X()*xyz.X()+xyz.Y()*xyz.Y());//+xyz.Z()*xyz.Z());
-                                 fhDeltaCellClusterRNCells->Fill(r-rcell, nCaloCellsPerCluster) ; 
-                                 fhDeltaCellClusterRE     ->Fill(r-rcell, mom.E())  ; 
-                                 
-//                             printf("x cluster %f, x cell %f, cluster-cell %f\n",pos[0], cellpos[0],pos[0]-cellpos[0]);
-//                             printf("y cluster %f, y cell %f, cluster-cell %f\n",pos[1], cellpos[1],pos[1]-cellpos[1]);
-//                             printf("z cluster %f, z cell %f, cluster-cell %f\n",pos[2], cellpos[2],pos[2]-cellpos[2]);
-//                                     printf("r cluster %f, r cell %f, cluster-cell %f\n",r,      rcell,     r-rcell);
-
-                               }   //PHOS and its matrices are available
-                       }// cluster cell loop
-                       
-               }//AODs
-               
-               //-----------------------------------------------------------
-               //Fill histograms related to single cluster or track matching
-               //-----------------------------------------------------------
-
-               ClusterHistograms(mom, tof, pos, showerShape, nCaloCellsPerCluster, nModule, nTracksMatched, track, labels, nLabel);    
-               
-                        
-               //-----------------------------------------------------------
-               //Invariant mass
-               //-----------------------------------------------------------
-               if(GetDebug()>1) printf("Invariant mass \n");
-
-               //do not do for bad vertex
-               Float_t fZvtxCut = 40. ;        
-               if(v[2]<-fZvtxCut || v[2]> fZvtxCut) continue ; //Event can not be used (vertex, centrality,... cuts not fulfilled)
-               
-               Int_t nModule2 = -1;
-               Int_t nCaloCellsPerCluster2=0;
-               if (nCaloClusters > 1 ) {
-                       for(Int_t jclus = iclus + 1 ; jclus < nCaloClusters ; jclus++) {
-                               if(GetReader()->GetDataType()==AliCaloTrackReader::kESD){
-                                       AliESDCaloCluster* clus2 =  (AliESDCaloCluster*) (caloClusters->At(jclus));
-                                       AliESDCaloCells  * cell2 = 0x0; 
-                                       if(fCalorimeter == "PHOS") cell2 =  ((AliESDEvent*)GetReader()->GetInputEvent())->GetPHOSCells();
-                                       else                               cell2 =  ((AliESDEvent*)GetReader()->GetInputEvent())->GetEMCALCells();
-                                       //Check if the cluster contains any bad channel or it is close to calorimeter borders
+      
+        //-----------------------------------------------------------
+        //Fill histograms related to single cluster or track matching
+        //-----------------------------------------------------------
+      
+      ClusterHistograms(mom, tof, pos, showerShape, nCaloCellsPerCluster, nModule, nTracksMatched, track, labels, nLabel);     
+      
+      
+        //-----------------------------------------------------------
+        //Invariant mass
+        //-----------------------------------------------------------
+      if(GetDebug()>1) print