Adding analysis task
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Nov 2012 19:58:13 +0000 (19:58 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Nov 2012 19:58:13 +0000 (19:58 +0000)
PWGLF/CMakelibPWGLFforward2.pkg
PWGLF/FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.cxx [new file with mode: 0644]
PWGLF/FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.h [new file with mode: 0644]
PWGLF/FORWARD/macros/AddTaskZDCTreePbPb.C [new file with mode: 0644]
PWGLF/PWGLFforward2LinkDef.h

index a68ce6b..4b104bc 100644 (file)
@@ -76,6 +76,7 @@ set ( SRCS
   FORWARD/analysis2/AliPoissonCalculator.cxx
   FORWARD/analysis2/AliSPDMCTrackDensity.cxx
   FORWARD/GEO/AliAnalysisTaskZDCPbPb.cxx
+  FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.cxx
   FORWARD/analysis2/AliForwardMultiplicityDistribution.cxx
   FORWARD/analysis2/AliForwardCreateResponseMatrices.cxx
 )
@@ -96,7 +97,8 @@ set ( EXPORT FORWARD/analysis2/AliAODForwardMult.h
              FORWARD/analysis2/AliForwardUtil.h  
             FORWARD/analysis2/AliFMDEventInspector.h
             FORWARD/analysis2/AliFMDMCEventInspector.h
-            FORWARD/GEO/AliAnalysisTaskZDCPbPb.h)
+            FORWARD/GEO/AliAnalysisTaskZDCPbPb.h
+            FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.h)
 
 set ( DHDR  PWGLFforward2LinkDef.h)
 
diff --git a/PWGLF/FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.cxx b/PWGLF/FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.cxx
new file mode 100644 (file)
index 0000000..b985b41
--- /dev/null
@@ -0,0 +1,441 @@
+/**************************************************************************
+ * Copyright(c) 1998-2008, 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.                  *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////
+//                                                        //
+//     Class to analyze ZDC data                          //
+//                                                        //
+/////////////////////////////////////////////////////////////
+
+#include <TTree.h>
+//#include <TList.h>
+#include <TFile.h>
+#include <TString.h>
+#include <TCanvas.h>
+
+#include "AliAnalysisManager.h"
+#include "AliInputEventHandler.h"
+#include "AliVEvent.h"
+#include "AliESD.h"
+#include "AliESDEvent.h"
+#include "AliESDHeader.h"
+#include "AliESDInputHandler.h"
+#include "AliESDZDC.h"
+#include "AliMultiplicity.h"
+#include "AliAODHandler.h"
+#include "AliAODEvent.h"
+#include "AliAODHeader.h"
+#include "AliAODVertex.h"
+#include "AliAODVZERO.h"
+#include "AliAODZDC.h"
+#include "AliAODMCHeader.h"
+#include "AliMCEventHandler.h"
+#include "AliMCEvent.h"
+#include "AliHeader.h"
+#include "AliAODMCParticle.h"
+#include "AliAnalysisTaskSE.h"
+#include "AliGenEventHeader.h"
+#include "AliGenHijingEventHeader.h"
+#include "AliPhysicsSelectionTask.h"
+#include "AliPhysicsSelection.h"
+#include "AliTriggerAnalysis.h"
+#include "AliCentrality.h"
+#include "AliAnalysisTaskZDCTreeMaker.h"
+
+ClassImp(AliAnalysisTaskZDCTreeMaker)
+
+
+//________________________________________________________________________
+AliAnalysisTaskZDCTreeMaker::AliAnalysisTaskZDCTreeMaker():
+  AliAnalysisTaskSE(),
+    fDebug(0),
+    fAnalysisInput("ESD"),
+    fIsMCInput(kFALSE),
+    fUseSpecialOutput(kFALSE),
+    fOutput(0x0),
+    fCentralityTree(0x0),
+    fIsEventSelected(kFALSE),
+    fxVertex(0),        
+    fyVertex(0),        
+    fzVertex(0),        
+    fVertexer3d(kFALSE),
+    fNTracklets(0),
+    fIsV0ATriggered(0),
+    fIsV0CTriggered(0),
+    fMultV0A(0),        
+    fMultV0C(0), 
+    fESDFlag(0),        
+    fZNCEnergy(0), 
+    fZPCEnergy(0),  
+    fZNAEnergy(0),  
+    fZPAEnergy(0),
+    fZEM1Energy(0), 
+    fZEM2Energy(0),
+//    fTDCZEM1(0),
+//    fTDCZEM2(0),
+    fCentralityV0M(0),
+    fCentralityV0A(0),
+    fCentralityV0C(0),
+    fCentralityCL1(0)
+{   
+   // Default constructor
+
+  fNClusters[0]=fNClusters[1]=0;
+  for(Int_t itow=0; itow<5; itow++){
+     fZNCtower[itow]=0.;  
+     fZPCtower[itow]=0.;  
+     fZNAtower[itow]=0.;  
+     fZPAtower[itow]=0.;  
+     fZNCtowerLG[itow]=0.;
+     fZPCtowerLG[itow]=0.;
+     fZNAtowerLG[itow]=0.;
+     fZPAtowerLG[itow]=0.;
+
+  }
+  for(Int_t ihit=0; ihit<4; ihit++) {
+     fTDCZNC[ihit] = 9999.;
+     fTDCZPC[ihit] = 9999.;
+     fTDCZNA[ihit] = 9999.;
+     fTDCZPA[ihit] = 9999;
+  }
+  
+  /*for(Int_t itdc=0; itdc<32; itdc++){
+    for(Int_t ihit=0; ihit<4; ihit++) fTDCvalues[itdc][ihit]=9999;
+//    for(Int_t ihit=0; ihit<4; ihit++) fTDCcorr[itdc][ihit]=-9999.;
+  }*/
+}   
+
+//________________________________________________________________________
+AliAnalysisTaskZDCTreeMaker::AliAnalysisTaskZDCTreeMaker(const char *name):
+  AliAnalysisTaskSE(name),
+    fDebug(0),
+    fAnalysisInput("ESD"),
+    fIsMCInput(kFALSE),
+    fUseSpecialOutput(kFALSE),
+    fOutput(0x0),
+    fCentralityTree(0x0),
+    fIsEventSelected(kFALSE),
+    fxVertex(0),       
+    fyVertex(0),       
+    fzVertex(0),       
+    fVertexer3d(kFALSE), 
+    fNTracklets(0),
+    fIsV0ATriggered(0),
+    fIsV0CTriggered(0),
+    fMultV0A(0),        
+    fMultV0C(0), 
+    fESDFlag(0),        
+    fZNCEnergy(0), 
+    fZPCEnergy(0),  
+    fZNAEnergy(0),  
+    fZPAEnergy(0),
+    fZEM1Energy(0), 
+    fZEM2Energy(0),
+//    fTDCZEM1(0),
+//    fTDCZEM2(0),
+    fCentralityV0M(0),
+    fCentralityV0A(0),
+    fCentralityV0C(0),
+    fCentralityCL1(0)
+{
+  // Default constructor
+  fNClusters[0]=fNClusters[1]=0;
+  for(Int_t itow=0; itow<5; itow++){
+     fZNCtower[itow]=0.;  
+     fZPCtower[itow]=0.;  
+     fZNAtower[itow]=0.;  
+     fZPAtower[itow]=0.;  
+     fZNCtowerLG[itow]=0.;
+     fZPCtowerLG[itow]=0.;
+     fZNAtowerLG[itow]=0.;
+     fZPAtowerLG[itow]=0.;
+
+  }
+  for(Int_t ihit=0; ihit<4; ihit++) {
+     fTDCZNC[ihit] = 9999.;
+     fTDCZPC[ihit] = 9999.;
+     fTDCZNA[ihit] = 9999.;
+     fTDCZPA[ihit] = 9999;
+  }
+  
+  /*for(Int_t itdc=0; itdc<32; itdc++){
+    for(Int_t ihit=0; ihit<4; ihit++) fTDCvalues[itdc][ihit]=9999;
+//    for(Int_t ihit=0; ihit<4; ihit++) fTDCcorr[itdc][ihit]=-9999.;
+  }*/
+  
+  // Output slot #1 writes into a TList container
+  DefineOutput(1, TList::Class()); 
+  //DefineOutput(1, TTree::Class()); 
+  
+}
+//________________________________________________________________________
+AliAnalysisTaskZDCTreeMaker::~AliAnalysisTaskZDCTreeMaker()
+{
+  // Destructor
+  if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
+    delete fOutput; fOutput=0;
+  } 
+  /*if(fCentralityTree && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()){
+    delete fCentralityTree; fCentralityTree=0;
+  } 
+  */ 
+}  
+
+//________________________________________________________________________
+void AliAnalysisTaskZDCTreeMaker::UserCreateOutputObjects()
+{
+  // Create the output containers
+  if(fDebug>1) printf("AliAnalysisTaskZDCTreeMaker::UserCreateOutputObjects() \n");
+
+  if (fUseSpecialOutput) OpenFile(1);
+
+  // Several histograms are more conveniently managed in a TList
+  fOutput = new TList;
+  fOutput->SetOwner();
+  //fOutput->SetName("output");
+
+    fCentralityTree = new TTree("fCentralityTree", "Centrality vs. multiplicity tree");
+    //
+//    fCentralityTree->Branch("trigClass",&fTrigClass,"trigClass/C");
+    fCentralityTree->Branch("eventSelected",&fIsEventSelected,"eventSelected/O");
+    fCentralityTree->Branch("xVertex", &fxVertex,"xVertex/D");
+    fCentralityTree->Branch("yVertex", &fyVertex,"yVertex/D");
+    fCentralityTree->Branch("zVertex", &fzVertex,"zVertex/D");
+    fCentralityTree->Branch("vertexer3d", &fVertexer3d,"vertexer3d/O");
+    fCentralityTree->Branch("nTracklets", &fNTracklets,"nTracklets/I");
+    fCentralityTree->Branch("nClusters", fNClusters,"nClusters[2]/I");
+
+    fCentralityTree->Branch("isV0ATriggered", &fIsV0ATriggered,"isV0ATriggered/I");
+    fCentralityTree->Branch("isV0CTriggered", &fIsV0CTriggered,"isV0CTriggered/I");
+    fCentralityTree->Branch("multV0A", &fMultV0A,"multV0A/F");
+    fCentralityTree->Branch("multV0C", &fMultV0C,"multV0C/F");
+    
+    fCentralityTree->Branch("esdFlag", &fESDFlag,"esdFlag/i");
+    fCentralityTree->Branch("zncEnergy",  &fZNCEnergy,  "zncEnergy/F");
+    fCentralityTree->Branch("zpcEnergy",  &fZPCEnergy,  "zpcEnergy/F");
+    fCentralityTree->Branch("znaEnergy",  &fZNAEnergy,  "znaEnergy/F");
+    fCentralityTree->Branch("zpaEnergy",  &fZPAEnergy,  "zpaEnergy/F");
+    fCentralityTree->Branch("zem1Energy", &fZEM1Energy, "zem1Energy/F");
+    fCentralityTree->Branch("zem2Energy", &fZEM2Energy, "zem2Energy/F");
+
+    fCentralityTree->Branch("znctower", fZNCtower, "znctower[5]/F");
+    fCentralityTree->Branch("zpctower", fZPCtower, "zpctower[5]/F");
+    fCentralityTree->Branch("znatower", fZNAtower, "znatower[5]/F");
+    fCentralityTree->Branch("zpatower", fZPAtower, "zpatower[5]/F");
+    fCentralityTree->Branch("znctowerLG", fZNCtowerLG, "znctowerLG[5]/F");
+    fCentralityTree->Branch("zpctowerLG", fZPCtowerLG, "zpctowerLG[5]/F");
+    fCentralityTree->Branch("znatowerLG", fZNAtowerLG, "znatowerLG[5]/F");
+    fCentralityTree->Branch("zpatowerLG", fZPAtowerLG, "zpatowerLG[5]/F");
+
+//    fCentralityTree->Branch("tdc", fTDCvalues, "tdc[32][4]/I");
+//    fCentralityTree->Branch("tdcCorr", fTDCcorr, "tdcCorr[32][4]/F");
+    fCentralityTree->Branch("tdcZNC", fTDCZNC, "tdcZNC[4]/I");
+    fCentralityTree->Branch("tdcZPC", fTDCZPC, "tdcZPC[4]/I");
+    fCentralityTree->Branch("tdcZNA", fTDCZNA, "tdcZNA[4]/I");
+    fCentralityTree->Branch("tdcZPA", fTDCZPA, "tdcZPA[4]/I");
+    
+    fCentralityTree->Branch("centrV0mult", &fCentralityV0M, "centrV0mult/F");
+    fCentralityTree->Branch("centrV0Amult", &fCentralityV0A, "centrV0Amult/F");
+    fCentralityTree->Branch("centrV0Cmult", &fCentralityV0C, "centrV0Cmult/F");
+    fCentralityTree->Branch("centrSPDclu1", &fCentralityCL1, "centrSPDclu1/F");
+  
+    fOutput->Add(fCentralityTree);      
+    PostData(1, fOutput);
+  
+  //PostData(1, fCentralityTree);
+}
+
+//________________________________________________________________________
+void AliAnalysisTaskZDCTreeMaker::UserExec(Option_t */*option*/)
+{
+  // Execute analysis for current event:
+  if(fDebug>1) printf(" **** AliAnalysisTaskZDCTreeMaker::UserExec() \n");
+  
+  if (!InputEvent()) {
+    Printf("ERROR: InputEvent not available");
+    return;
+  }
+
+  if(fAnalysisInput.CompareTo("ESD")==0){
+      
+      //printf(" \t ***Analizing ESD ev. %d\n",fNev);
+      
+      AliESDEvent* esd = dynamic_cast<AliESDEvent*> (InputEvent());
+      if(!esd) return;
+      
+      // Select PHYSICS events (type=7, for data)
+      if(!fIsMCInput && esd->GetEventType()!=7) return; 
+      
+      // ***** Trigger selection
+      //TString triggerClass = esd->GetFiredTriggerClasses();
+      //sprintf(fTrigClass,"%s",triggerClass.Data());
+      
+      // Taking only C1ZED triggers
+      //if(triggerClass.Contains("C1ZED")==0) return;
+      
+      // use response of AliPhysicsSelection
+      fIsEventSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kAnyINT);       
+
+      AliCentrality *centrality = esd->GetCentrality();
+      fCentralityV0M = centrality->GetCentralityPercentile("V0M");
+      fCentralityV0A = centrality->GetCentralityPercentile("V0A");
+      fCentralityV0C = centrality->GetCentralityPercentile("V0C");
+      fCentralityCL1 = centrality->GetCentralityPercentile("CL1");
+      //fCentralityZDC = centrality->GetCentralityPercentile("ZEMvsZDC");
+                
+      const AliESDVertex *vertex = esd->GetPrimaryVertexSPD();
+      fxVertex = vertex->GetX();
+      fyVertex = vertex->GetY();
+      fzVertex = vertex->GetZ();
+      if(vertex->IsFromVertexer3D()) fVertexer3d = kTRUE;
+      else fVertexer3d = kFALSE;
+      
+      const AliMultiplicity *mult = esd->GetMultiplicity();
+      fNTracklets = mult->GetNumberOfTracklets();
+      
+      for(Int_t ilay=0; ilay<2; ilay++){
+        fNClusters[ilay] = mult->GetNumberOfITSClusters(ilay);
+      }
+          
+      AliESDVZERO *vzeroAOD = esd->GetVZEROData();
+      fMultV0A = vzeroAOD->GetMTotV0A();
+      fMultV0C = vzeroAOD->GetMTotV0C();
+      //
+      fIsV0ATriggered = vzeroAOD->GetV0ADecision();
+      fIsV0CTriggered = vzeroAOD->GetV0CDecision();
+        
+      AliESDZDC *esdZDC = esd->GetESDZDC();
+      
+      fESDFlag =  esdZDC->GetESDQuality();   
+      
+      fZNCEnergy = (Float_t) (esdZDC->GetZDCN1Energy());
+      fZPCEnergy = (Float_t) (esdZDC->GetZDCP1Energy());
+      fZNAEnergy = (Float_t) (esdZDC->GetZDCN2Energy());
+      fZPAEnergy = (Float_t) (esdZDC->GetZDCP2Energy());
+      fZEM1Energy = (Float_t) (esdZDC->GetZDCEMEnergy(0));
+      fZEM2Energy = (Float_t) (esdZDC->GetZDCEMEnergy(1));
+       
+      const Double_t * towZNC = esdZDC->GetZN1TowerEnergy();
+      const Double_t * towZPC = esdZDC->GetZP1TowerEnergy();
+      const Double_t * towZNA = esdZDC->GetZN2TowerEnergy();
+      const Double_t * towZPA = esdZDC->GetZP2TowerEnergy();
+      //
+      const Double_t * towZNCLG = esdZDC->GetZN1TowerEnergyLR();
+      const Double_t * towZPCLG = esdZDC->GetZP1TowerEnergyLR();
+      const Double_t * towZNALG = esdZDC->GetZN2TowerEnergyLR();
+      const Double_t * towZPALG = esdZDC->GetZP2TowerEnergyLR();
+      //
+      for(Int_t it=0; it<5; it++){
+         fZNCtower[it] = (Float_t) (towZNC[it]);
+         fZPCtower[it] = (Float_t) (towZPC[it]);
+         fZNAtower[it] = (Float_t) (towZNA[it]); 
+         fZPAtower[it] = (Float_t) (towZPA[it]);  
+         fZNCtowerLG[it] = (Float_t) (towZNCLG[it]);
+         fZPCtowerLG[it] = (Float_t) (towZPCLG[it]);
+         fZNAtowerLG[it] = (Float_t) (towZNALG[it]); 
+         fZPAtowerLG[it] = (Float_t) (towZPALG[it]);  
+      }
+      
+      for(int itdc=0; itdc<4; itdc++){
+         fTDCZNC[itdc] = esdZDC->GetZDCTDCData(10, itdc);
+        fTDCZPC[itdc] = esdZDC->GetZDCTDCData(11, itdc);
+        fTDCZNA[itdc] = esdZDC->GetZDCTDCData(12, itdc);
+        fTDCZPA[itdc] = esdZDC->GetZDCTDCData(13, itdc);
+      }
+
+      /*for(Int_t itdc=0; itdc<32; itdc++){
+        for(Int_t i=0; i<4; i++){
+          fTDCvalues[itdc][i] = esdZDC->GetZDCTDCData(itdc, i);
+        }
+      }*/      
+  }   
+  else if(fAnalysisInput.CompareTo("AOD")==0){
+
+      printf("\n \t *** Running analysis on AODs\n\n");
+      
+      AliAODEvent *aod =  dynamic_cast<AliAODEvent*> (InputEvent());
+      if(!aod) return;
+      
+      // Select PHYSICS events (type=7, for data)
+      if(!fIsMCInput && aod->GetEventType()!=7) return; 
+      
+      // use response of AliPhysicsSelection
+      fIsEventSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCINT5);       
+      
+      AliCentrality *centrality = aod->GetCentrality();
+      fCentralityV0M = centrality->GetCentralityPercentile("V0M");
+      fCentralityV0A = centrality->GetCentralityPercentile("V0A");
+      fCentralityV0C = centrality->GetCentralityPercentile("V0C");
+      fCentralityCL1 = centrality->GetCentralityPercentile("CL1");
+      //fCentralityZDC = centrality->GetCentralityPercentile("ZEMvsZDC");
+     
+      // ***** Trigger selection
+      //TString triggerClass = aod->GetFiredTriggerClasses();
+      //sprintf(fTrigClass,"%s",triggerClass.Data());
+      
+      const AliAODVertex *vertex = aod->GetPrimaryVertexSPD();
+      fxVertex = vertex->GetX();
+      fyVertex = vertex->GetY();
+      fzVertex = vertex->GetZ();
+
+      AliAODTracklets *trackl = aod->GetTracklets();
+      fNTracklets = trackl->GetNumberOfTracklets();
+          
+      AliAODVZERO *vzeroAOD = aod->GetVZEROData();
+      fMultV0A = vzeroAOD->GetMTotV0A();
+      fMultV0C = vzeroAOD->GetMTotV0C();
+        
+      AliAODZDC *aodZDC = aod->GetZDCData();
+            
+      fZNCEnergy = (Float_t) (aodZDC->GetZNCEnergy());
+      fZPCEnergy = (Float_t) (aodZDC->GetZPCEnergy());
+      fZNAEnergy = (Float_t) (aodZDC->GetZNAEnergy());
+      fZPAEnergy = (Float_t) (aodZDC->GetZPAEnergy());
+      fZEM1Energy = (Float_t) (aodZDC->GetZEM1Energy());
+      fZEM2Energy = (Float_t) (aodZDC->GetZEM2Energy());
+      
+      const Double_t * towZNC = aodZDC->GetZNCTowerEnergy();
+      const Double_t * towZPC = aodZDC->GetZPCTowerEnergy();
+      const Double_t * towZNA = aodZDC->GetZNATowerEnergy();
+      const Double_t * towZPA = aodZDC->GetZPATowerEnergy();
+      //
+      for(Int_t it=0; it<5; it++){
+         fZNCtower[it] = (Float_t) (towZNC[it]);
+         fZPCtower[it] = (Float_t) (towZPC[it]);
+         fZNAtower[it] = (Float_t) (towZNA[it]); 
+         fZPAtower[it] = (Float_t) (towZPA[it]);  
+      }
+
+  }
+  
+  fCentralityTree->Fill();
+  PostData(1, fOutput);
+  
+  //PostData(1, fCentralityTree);
+   
+}
+
+
+
+//________________________________________________________________________
+void AliAnalysisTaskZDCTreeMaker::Terminate(Option_t */*option*/)
+{
+  // Terminate analysis
+  //
+  printf(" **** AliAnalysisTaskZDCTreeMaker::Terminate() \n");
+}
diff --git a/PWGLF/FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.h b/PWGLF/FORWARD/GEO/AliAnalysisTaskZDCTreeMaker.h
new file mode 100644 (file)
index 0000000..c391bfa
--- /dev/null
@@ -0,0 +1,106 @@
+#ifndef ALIANALYSISTASKZDCTREEMAKER_H
+#define ALIANALYSISTASKZDCTREEMAKER_H
+
+/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+//*****************************************************
+//   Class AliAnalysisTaskZDCTreeMaker
+//   author: Chiara Oppedisano
+//*****************************************************
+
+#include "AliAnalysisTaskSE.h"
+
+class TROOT;
+class TSystem;
+class TList;
+class TFile;
+class TTree;
+
+class AliAnalysisTaskZDCTreeMaker : public AliAnalysisTaskSE {
+
+ public:
+
+  AliAnalysisTaskZDCTreeMaker();
+  AliAnalysisTaskZDCTreeMaker(const char *name);
+  virtual ~AliAnalysisTaskZDCTreeMaker();
+
+  // Implementation of interface methods
+  virtual void UserCreateOutputObjects();
+  virtual void UserExec(Option_t *option);
+  virtual void Terminate(Option_t *);
+
+  virtual void  SetDebugLevel(Int_t level) {fDebug = level;}
+  void SetInput(const char* input) {fAnalysisInput = input;}
+  void SetMCInput() {fIsMCInput = kTRUE;}
+   void SetUseSpecialOutput(Bool_t v=kTRUE) {fUseSpecialOutput = v;}
+
+ private:
+
+  Int_t    fDebug;             //  Debug flag
+  TString  fAnalysisInput;     // "ESD", "AOD"
+  Bool_t   fIsMCInput;          // true when input is MC
+  Bool_t   fUseSpecialOutput;   // do we use special output instead of merging?
+  //
+  TList   *fOutput;            //! list send on output slot 0
+  //
+  TTree   *fCentralityTree;     //! output tree
+  //
+  //char     fTrigClass[100];  //  fired trigger classes
+  //
+  Bool_t   fIsEventSelected;    //  is physics selection on
+  //
+  Double_t fxVertex;           //  X vertex from ITS
+  Double_t fyVertex;           //  Y vertex from ITS
+  Double_t fzVertex;           //  Z vertex from ITS
+  Bool_t   fVertexer3d;                //  Is vertex from 3d vertexer?
+  //
+  Int_t    fNTracklets;                //  no. tracklets
+  Int_t    fNClusters[2];      //  no. clusters on SPD layers
+  //
+  Int_t    fIsV0ATriggered;    //  VOA decision
+  Int_t    fIsV0CTriggered;    //  V0C decision
+  Float_t  fMultV0A;           //  mult. V0A
+  Float_t  fMultV0C;           //  mult. V0C
+  //
+  UInt_t   fESDFlag;           //  ZDC ESD flags
+  Float_t  fZNCEnergy;         //  ZNC Energy
+  Float_t  fZPCEnergy;         //  ZPC Energy
+  Float_t  fZNAEnergy;         //  ZNA Energy
+  Float_t  fZPAEnergy;         //  ZPA Energy
+  Float_t  fZEM1Energy;                //  ZEM1 Energy
+  Float_t  fZEM2Energy;                //  ZEM2 Energy
+  
+  Float_t  fZNCtower[5];       //  ZNC 5 tower signals
+  Float_t  fZPCtower[5];       //  ZPC 5 tower signals
+  Float_t  fZNAtower[5];       //  ZNA 5 tower signals
+  Float_t  fZPAtower[5];       //  ZPA 5 tower signals
+  Float_t  fZNCtowerLG[5];     //  ZNC 5 tower signals
+  Float_t  fZPCtowerLG[5];     //  ZPC 5 tower signals
+  Float_t  fZNAtowerLG[5];     //  ZNA 5 tower signals
+  Float_t  fZPAtowerLG[5];     //  ZPA 5 tower signals
+  //
+//  Int_t    fTDCvalues[32][4];   // TDC raw values !ONLY FOR ESDs ANALYSIS!
+//  Float_t  fTDCcorr[32][4];     // TDC corrected values  !ONLY FOR ESDs ANALYSIS!
+  //
+  Int_t    fTDCZNC[4];      // TDC raw values !ONLY FOR ESDs ANALYSIS!
+  Int_t    fTDCZPC[4];      // TDC raw values !ONLY FOR ESDs ANALYSIS!
+  Int_t    fTDCZNA[4];      // TDC raw values !ONLY FOR ESDs ANALYSIS!
+  Int_t    fTDCZPA[4];      // TDC raw values !ONLY FOR ESDs ANALYSIS!
+//  Int_t    fTDCZEM1;      // TDC raw values !ONLY FOR ESDs ANALYSIS!
+//  Int_t    fTDCZEM2;      // TDC raw values !ONLY FOR ESDs ANALYSIS!
+  
+  Float_t fCentralityV0M;        // Centrality from V0A+V0C
+  Float_t fCentralityV0A;        // Centrality from V0A
+  Float_t fCentralityV0C;        // Centrality from V0C
+  Float_t fCentralityCL1;        // Centrality from Clusters in layer 1
+  //
+  AliAnalysisTaskZDCTreeMaker& operator= (const AliAnalysisTaskZDCTreeMaker& ana);
+  AliAnalysisTaskZDCTreeMaker(const AliAnalysisTaskZDCTreeMaker& c);
+  //
+  ClassDef(AliAnalysisTaskZDCTreeMaker,1); 
+
+};
+
+#endif
+
diff --git a/PWGLF/FORWARD/macros/AddTaskZDCTreePbPb.C b/PWGLF/FORWARD/macros/AddTaskZDCTreePbPb.C
new file mode 100644 (file)
index 0000000..4072354
--- /dev/null
@@ -0,0 +1,62 @@
+AliAnalysisTaskSE* AddTaskZDCPbPb(Bool_t  applyPS = kTRUE,
+                                 Float_t centrlowlim = 0.,
+                                  Float_t centruplim = 100.,
+                                  TString centrest = "V0M",
+                                 TString outfname = "ZDCPbPb",
+                                 Bool_t  isMC = kFALSE)
+{
+  
+  // Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if(!mgr){
+    ::Error("AddTaskZDCPbPb", "No analysis manager to connect to.");
+    return NULL;
+  }  
+
+  AliVEventHandler *inputHandler = mgr->GetInputEventHandler();
+  
+  // Check the analysis type using the event handlers connected to the analysis manager.
+  //==============================================================================
+  if(!inputHandler){
+    ::Error("AddTaskZDCPbPb", "This task requires an input event handler");
+    return NULL;
+  }
+  TString inputDataType = inputHandler->GetDataType(); // can be "ESD" or "AOD"
+  
+   // Configure analysis
+   //===========================================================================
+   AliAnalysisTaskZDCTreeMaker* task = new AliAnalysisTaskZDCTreeMaker("taskZDCPbPb");
+
+   if(inputDataType.CompareTo("ESD")==0){
+      task->SetInput(1);
+      //printf("  AliAnalysisTaskZDCTreeMaker initialized for ESD analysis\n");
+      //
+      // apply physics selection
+      if(applyPS) task->SelectCollisionCandidates();
+   }
+   else if(inputDataType.CompareTo("AOD")==0){
+      task->SetInput(2);
+      //printf("  AliAnalysisTaskZDCTreeMaker initialized for AOD analysis\n");
+   }
+   task->SetCentralityRange(centrlowlim, centruplim);
+   task->SetCentralityEstimator(centrest);
+   
+   if(isMC==kTRUE) task->SetMCInput();
+
+   mgr->AddTask(task);
+
+   TString outputFileName = AliAnalysisManager::GetCommonFileName();
+   
+   AliAnalysisDataContainer *coutput  = mgr->CreateContainer(outfname.Data(), 
+                                       TList::Class(),
+                                       AliAnalysisManager::kOutputContainer,   
+                                       Form("%s:ZDCHistos", mgr->GetCommonFileName()));
+
+   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (task, 1, coutput);
+
+   return task;   
+}
+
+
index 6315841..7446b8e 100644 (file)
@@ -30,6 +30,7 @@
 #pragma link C++ nestedclasses;
 
 #pragma link C++ class AliAnalysisTaskZDCPbPb+;
+#pragma link C++ class AliAnalysisTaskZDCTreeMaker+;
 
 #pragma link C++ class AliAODCentralMult+;
 #pragma link C++ class AliAODForwardEP+;