]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Update classes for the new analysis framwork
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Sep 2007 11:07:19 +0000 (11:07 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Sep 2007 11:07:19 +0000 (11:07 +0000)
PWG4/AliAnaCaloTrigger.cxx
PWG4/AliAnaCaloTrigger.h
PWG4/AliAnaGammaPhos.cxx
PWG4/AliAnaGammaPhos.h

index 89cfe826f53b5b9f95cadb96ad752ba828ee3a1e..e230d5f85be6b935bdda34bd2197053339d3f42e 100644 (file)
 #include <TVector3.h> 
 
 #include "AliAnaCaloTrigger.h" 
-#include "AliESD.h" 
+#include "AliAnalysisManager.h"
+#include "AliESDEvent.h" 
 #include "AliLog.h"
+#include "AliESDCaloCluster.h"
+
+//______________________________________________________________________________
+AliAnaCaloTrigger::AliAnaCaloTrigger() :  
+  fChain(0),
+  fESD(0), 
+  fOutputContainer(0),
+  fCalorimeter("PHOS"),
+  fNtTrigger22(0), 
+  fNtTriggerNN(0)
+
+{
+  // Default Constructor.
+
+}
 
 //______________________________________________________________________________
 AliAnaCaloTrigger::AliAnaCaloTrigger(const char *name) : 
-  AliAnalysisTask(name,""),  
+  AliAnalysisTask(name,"AnaCaloTrigger"),  
   fChain(0),
   fESD(0), 
   fOutputContainer(0),
@@ -101,14 +117,9 @@ void AliAnaCaloTrigger::ConnectInputData(const Option_t*)
     return ;
   }
   
-  // One should first check if the branch address was taken by some other task
-  char ** address = (char **)GetBranchAddress(0, "ESD");
-  if (address) {
-    fESD = (AliESD*)(*address);
-  } else {
-    fESD = new AliESD();
-    SetBranchAddress(0, "ESD", &fESD);
-  }
+  fESD = new AliESDEvent();
+  fESD->ReadFromTree(fChain);
+
 }
 
 //________________________________________________________________________
@@ -116,15 +127,18 @@ void AliAnaCaloTrigger::ConnectInputData(const Option_t*)
 void AliAnaCaloTrigger::CreateOutputObjects()
 {  
 
+  // Create the outputs containers
+  OpenFile(0) ;
+
   // create histograms 
   fNtTrigger22 = new TNtuple(fCalorimeter+"trigger22", "Trigger data 2x2 patch", "a22:a220:enMax:phEnMax:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax");
   fNtTriggerNN = new TNtuple(fCalorimeter+"triggerNN", "Trigger data NxN patch", "aNN:aNN0:enMax:phEnMax:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax");
-
+  
   // create output container
   
   fOutputContainer = new TObjArray(2) ; 
   fOutputContainer->SetName(GetName()) ; 
-
+  
   fOutputContainer->AddAt(fNtTrigger22,             0) ; 
   fOutputContainer->AddAt(fNtTriggerNN,             1) ; 
 
@@ -148,20 +162,15 @@ void AliAnaCaloTrigger::Exec(Option_t *)
   // Get trigger information of fCalorimeter 
   TArrayF * triggerAmplitudes = 0x0 ;
   TArrayF * triggerPosition   = 0x0 ;
-  Int_t firstCaloCluster      = 0 ;
-  Int_t numberOfCaloClusters  = 0 ;
+  Int_t numberOfCaloClusters  =  fESD->GetNumberOfCaloClusters() ;
 
   if(fCalorimeter == "PHOS"){
     triggerAmplitudes      = fESD->GetPHOSTriggerAmplitudes();
     triggerPosition        = fESD->GetPHOSTriggerPosition();
-    firstCaloCluster       = fESD->GetFirstPHOSCluster() ;
-    numberOfCaloClusters   = fESD->GetNumberOfPHOSClusters() ;
   }
   else if(fCalorimeter == "EMCAL"){
     triggerAmplitudes    = fESD->GetEMCALTriggerAmplitudes();
     triggerPosition      = fESD->GetEMCALTriggerPosition();
-    firstCaloCluster     = fESD->GetFirstEMCALCluster() ;
-    numberOfCaloClusters = fESD->GetNumberOfEMCALClusters() ;
   }
 
   if( triggerAmplitudes && triggerPosition ){
@@ -197,10 +206,13 @@ void AliAnaCaloTrigger::Exec(Option_t *)
   
   // loop over the Calorimeters Clusters
   
-  for(icaloCluster = firstCaloCluster ; icaloCluster < firstCaloCluster + numberOfCaloClusters ; icaloCluster++) {
+  for(icaloCluster = 0 ; icaloCluster < numberOfCaloClusters ; icaloCluster++) {
+    
     AliESDCaloCluster * cluster = fESD->GetCaloCluster(icaloCluster) ;
-    if (cluster) {
-      
+    
+    if (cluster && ( (fCalorimeter == "PHOS" && cluster->IsPHOS())  ||  
+                    (fCalorimeter == "EMCAL" && cluster->IsEMCAL()))) {
+         
       Float_t cluEnergy = cluster->E() ; 
       Float_t pos[3] ;
       TVector3 vpos ;
index 8437edb52dd7dfb910fc4cda683dd658688e09c1..fb6b11284868ab5a40eab75b51a4ec3929679807 100644 (file)
@@ -8,17 +8,19 @@
 //*-- Yves Schutz 
 //////////////////////////////////////////////////////////////////////////////
 
-#include <TTree.h> 
+
 #include "AliAnalysisTask.h"  
 
-class AliESD ; 
+class AliESDEvent ; 
 class TNtuple ;
 class TH1D ; 
 class TH1I ; 
+class TChain;
 
 class AliAnaCaloTrigger : public AliAnalysisTask {
 
 public:
+  AliAnaCaloTrigger() ;
   AliAnaCaloTrigger(const char *name) ;
   AliAnaCaloTrigger(const AliAnaCaloTrigger & trig) ;
   AliAnaCaloTrigger & operator=(const AliAnaCaloTrigger& source);
@@ -33,8 +35,8 @@ public:
   void    SetCalorimeter(TString calo) {fCalorimeter = calo ; }
 
 private:
-  TTree   * fChain ;            //!pointer to the analyzed TTree or TChain
-  AliESD  * fESD ;              //! Declaration of leave types
+  TChain   * fChain ;            //!pointer to the analyzed TTree or TChain
+  AliESDEvent  * fESD ;              //! Declaration of leave types
 
   TObjArray * fOutputContainer ; //! output data container
 
index 057cbdc55c085fd5b4534ec552abf20a06b5f9a1..72db8ee433c62702f85d2ad6e589003337bc5f8a 100644 (file)
@@ -34,7 +34,8 @@
 
 #include "AliAnaGammaPhos.h" 
 #include "AliAnalysisManager.h"
-#include "AliESD.h" 
+#include "AliESDEvent.h" 
+#include "AliESDCaloCluster.h" 
 #include "AliAODEvent.h"
 #include "AliAODHandler.h"
 #include "AliAODPhoton.h"
@@ -112,14 +113,9 @@ void AliAnaGammaPhos::ConnectInputData(const Option_t*)
     return ;
   }
   
-  // One should first check if the branch address was taken by some other task
-  char ** address = (char **)GetBranchAddress(0, "ESD");
-  if (address) {
-    fESD = (AliESD*)(*address);
-  } else {
-    fESD = new AliESD();
-    SetBranchAddress(0, "ESD", &fESD);
-  }
+  fESD = new AliESDEvent();
+  fESD->ReadFromTree(fChain);
+
 }
 
 //________________________________________________________________________
index cff478be826b310590a082877194e01d63fa9190..8942716c824d45f974da58fc497eec1a01bb7734 100644 (file)
@@ -11,7 +11,7 @@
 #include <TTree.h> 
 #include "AliAnalysisTask.h"  
 
-class AliESD ; 
+class AliESDEvent ; 
 class AliAOD ; 
 class AliAODEvent ; 
 class TNtuple ;
@@ -40,7 +40,7 @@ private:
   // input and output
   TTree        * fChain ;         //!pointer to the analyzed TTree or TChain
   Int_t          fDebug ;         // Debug flag
-  AliESD       * fESD ;           //! ESD
+  AliESDEvent       * fESD ;           //! ESD
   AliAODEvent  * fAOD ;           //! AOD
   TClonesArray * fAODPhotons ;    //! reconstructed photons
   Int_t          fPhotonsInPhos ; //! number of photons found