Standard connection to ESD in chain.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 May 2007 10:53:03 +0000 (10:53 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 May 2007 10:53:03 +0000 (10:53 +0000)
JETAN/AliAnalysisTaskJets.cxx
JETAN/AliJetESDReader.cxx
JETAN/AliJetESDReader.h
JETAN/AliJetFinder.cxx
JETAN/AliJetFinder.h
JETAN/AliJetReader.h

index 5ec6b6a..9abfd88 100644 (file)
@@ -73,9 +73,17 @@ void AliAnalysisTaskJets::ConnectInputData(Option_t */*option*/)
 // Connect the input data
 //
     if (fDebug > 1) printf("AnalysisTaskJets::ConnectInputData() \n");
-    
+    char ** address = (char **)GetBranchAddress(0, "ESD");
+
+    if (address)     {
+       fESD = (AliESD*)(*address);
+    }
+    else     {
+       fESD = new AliESD();
+       SetBranchAddress(0, "ESD", &fESD); // first task taking the branch enables it
+    }
     fChain = (TChain*)GetInputData(0);
-    fJetFinder->ConnectTree(fChain);
+    fJetFinder->ConnectTree(fChain, fESD);
     fJetFinder->WriteHeaders();
 }
 
index 5e8e817..5ccba90 100755 (executable)
@@ -117,11 +117,11 @@ void AliJetESDReader::OpenInputFiles()
   }
 }
 
-void AliJetESDReader::ConnectTree(TTree* tree) {
+void AliJetESDReader::ConnectTree(TTree* tree, TObject* data) {
     // Connect the tree
      fChain = (TChain*) tree;
+     fESD   = (AliESD*) data;
      
-     fChain->SetBranchAddress("ESD",    &fESD);
      Int_t nMax = fChain->GetEntries(); 
      printf("\n AliJetESDReader: Total number of events in chain= %5d \n", nMax);
      // set number of events in header
index 015f34c..4cdfd2f 100755 (executable)
@@ -34,7 +34,7 @@ class AliJetESDReader : public AliJetReader
   Bool_t FillMomentumArray(Int_t event); 
   void   OpenInputFiles();
   void   InitUnitArray();
-  void   ConnectTree(TTree* tree);
+  void   ConnectTree(TTree* tree, TObject* data);
   virtual void SetTPCGrid(AliJetGrid *grid)   {fTpcGrid = grid;}
   virtual void SetEMCalGrid(AliJetGrid *grid) {fEmcalGrid = grid;}
   // Correction of hadronic energy
index 21d09e4..97855f1 100644 (file)
@@ -73,7 +73,7 @@ AliJetFinder::~AliJetFinder()
 
 ////////////////////////////////////////////////////////////////////////
 
-void AliJetFinder::SetOutputFile(const char *name)
+void AliJetFinder::SetOutputFile(const char */*name*/)
 {
   //  opens output file 
   //  fOut = new TFile(name,"recreate");
@@ -185,10 +185,10 @@ void AliJetFinder::Run()
 // The following methods have been added to allow for event steering from the outside
 //
 
-void AliJetFinder::ConnectTree(TTree* tree)
+void AliJetFinder::ConnectTree(TTree* tree, TObject* data)
 {
     // Connect the input file
-    fReader->ConnectTree(tree);
+    fReader->ConnectTree(tree, data);
 }
 
 void AliJetFinder::WriteHeaders()
index a1822c8..1e303dd 100755 (executable)
@@ -49,7 +49,7 @@ class AliJetFinder : public TObject
   // some methods to allow steering from the outside
   virtual Bool_t ProcessEvent(Long64_t entry);
   virtual void   FinishRun();
-  virtual void   ConnectTree(TTree* tree);
+  virtual void   ConnectTree(TTree* tree, TObject* data);
   virtual TTree* MakeTreeJ(char* name);
   virtual void   WriteHeaders();
   virtual void   WriteJetsToFile() {;}
index 0c08ee9..2a7cbdb 100755 (executable)
@@ -53,7 +53,7 @@ class AliJetReader : public TObject
          
   // Others
   virtual void   OpenInputFiles() {}
-  virtual void   ConnectTree(TTree* /*tree*/) {}
+  virtual void   ConnectTree(TTree* /*tree*/, TObject* /*data*/) {}
   virtual Bool_t GetGenJets(AliJet* /*genJets*/) {return kFALSE;}
   
   void ClearArray();