]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDInputHandler.cxx
Runing the online reconstruction in the Amore framework (Cvetan)
[u/mrichter/AliRoot.git] / STEER / AliESDInputHandler.cxx
index f5d9641871f081f30d02c16e06cc4d0ebcdffa4b..d2ab9338d029a98147b563c9dbd71b1575fbf985 100644 (file)
@@ -47,6 +47,9 @@ AliESDInputHandler::AliESDInputHandler() :
   fEvent(0x0),
   fAnalysisType(0),
   fNEvents(0),
+  fHLTEvent(0x0),
+  fHLTTree(0x0),
+  fUseHLT(kFALSE),
   fUseTags(kFALSE),
   fChainT(0),
   fTreeT(0),
@@ -65,7 +68,7 @@ AliESDInputHandler::~AliESDInputHandler()
 //______________________________________________________________________________
 AliESDInputHandler::AliESDInputHandler(const char* name, const char* title):
     AliInputEventHandler(name, title), fEvent(0x0), fAnalysisType(0),
-     fNEvents(0), fUseTags(kFALSE), fChainT(0), fTreeT(0), fRunTag(0)
+     fNEvents(0),  fHLTEvent(0x0), fHLTTree(0x0), fUseHLT(kFALSE), fUseTags(kFALSE), fChainT(0), fTreeT(0), fRunTag(0)
 {
     // Constructor
 }
@@ -77,22 +80,21 @@ Bool_t AliESDInputHandler::Init(TTree* tree,  Option_t* opt)
     fTree         = tree;
     
     if (!fTree) return kFALSE;
+    fTree->GetEntry(0);
+    
     // Get pointer to ESD event
     SwitchOffBranches();
     SwitchOnBranches();
     
-    if (fEvent) {
-      delete fEvent;
-      fEvent = 0;
-    }
-    fEvent = new AliESDEvent();
-
+    if (!fEvent) fEvent = new AliESDEvent();
     fEvent->ReadFromTree(fTree);
     fNEvents = fTree->GetEntries();
+
+
     return kTRUE;
 }
 
-Bool_t AliESDInputHandler::BeginEvent(Long64_t /*entry*/)
+Bool_t AliESDInputHandler::BeginEvent(Long64_t entry)
 {
     // Copy from old to new format if necessary
   AliESD* old = ((AliESDEvent*) fEvent)->GetAliESDOld();
@@ -100,6 +102,11 @@ Bool_t AliESDInputHandler::BeginEvent(Long64_t /*entry*/)
        ((AliESDEvent*)fEvent)->CopyFromOldESD();
        old->Reset();
   }
+
+  if (fHLTTree) {
+      fHLTTree->GetEntry(entry);
+  }
+  
   return kTRUE;
 }
 
@@ -115,6 +122,19 @@ Bool_t AliESDInputHandler::Notify(const char* path)
     // Notify a directory change
     AliInfo(Form("Directory change %s \n", path));
     //
+    if (fUseHLT) {
+       // Get HLTesdTree from current file
+       TTree* cTree = fTree;
+       if (fTree->GetTree()) cTree = fTree->GetTree();
+       TFile* cFile = cTree->GetCurrentFile();
+       cFile->GetObject("HLTesdTree", fHLTTree);
+       
+       if (fHLTTree) {
+         if (!fHLTEvent) fHLTEvent = new AliESDEvent();
+         fHLTEvent->ReadFromTree(fHLTTree);
+       }
+    }
+
     if (!fUseTags) return (kTRUE);
     
     Bool_t zip = kFALSE;
@@ -148,7 +168,7 @@ Bool_t AliESDInputHandler::Notify(const char* path)
     }
     
     printf("AliESDInputHandler::Notify() Path: %s\n", pathName.Data());
-    
+
     if (fRunTag) {
        fRunTag->Clear();
     } else {
@@ -156,7 +176,7 @@ Bool_t AliESDInputHandler::Notify(const char* path)
     }
     
     delete fTreeT; fTreeT = 0;
-
+    
     if (fChainT) {
        delete fChainT;
        fChainT = 0;