]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - JETAN/AliJetFinder.cxx
Protection added.
[u/mrichter/AliRoot.git] / JETAN / AliJetFinder.cxx
index 67d76bec640512ea3ef851d1e3baae34c6c08a19..5dcd87f9d5bd232011a3981cf06b5b7c4c4c0e46 100644 (file)
 
 #include <Riostream.h>
 #include <TFile.h>
+#include <TClonesArray.h>
+
 #include "AliJetFinder.h"
 #include "AliJet.h"
+#include "AliAODJet.h"
 #include "AliJetReader.h"
 #include "AliJetReaderHeader.h"
 #include "AliJetControlPlots.h"
 #include "AliLeading.h"
+#include "AliAODEvent.h"
 
 ClassImp(AliJetFinder)
 
@@ -41,6 +45,8 @@ AliJetFinder::AliJetFinder():
     fLeading(0),
     fReader(0x0),
     fHeader(0x0),
+    fAODjets(0x0),
+    fNAODjets(0),
     fPlots(0x0),
     fOut(0x0)
     
@@ -49,6 +55,7 @@ AliJetFinder::AliJetFinder():
   fJets    = new AliJet();
   fGenJets = new AliJet();
   fLeading = new AliLeading();
+  fAODjets = 0;
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -142,7 +149,7 @@ void AliJetFinder::Run()
 
   // loop over events
   for (Int_t i=nFirst;i<nLast;i++) {
-      fReader->FillMomentumArray(i);
+      fReader->FillMomentumArray();
       fLeading->FindLeading(fReader);
       fReader->GetGenJets(fGenJets);
 
@@ -156,7 +163,6 @@ void AliJetFinder::Run()
       }
       if (fOut) {
          fOut->cd();
-         fTreeJ->Fill();
       }
       
       if (fPlots) fPlots->FillHistos(fJets);
@@ -198,23 +204,18 @@ void AliJetFinder::WriteHeaders()
 }
 
 
-Bool_t AliJetFinder::ProcessEvent(Long64_t entry)
+Bool_t AliJetFinder::ProcessEvent()
 {
 //
 // Process one event
 //
-    Int_t debug  = fReader->GetReaderHeader()->GetDebug();
-    if (debug > 0) printf("<<<<< Processing Event %5d >>>>> \n", (Int_t) entry);
-    
-    Bool_t ok = fReader->FillMomentumArray(entry);
+    Bool_t ok = fReader->FillMomentumArray();
     if (!ok) return kFALSE;
 
     // Leading particles
     fLeading->FindLeading(fReader);
     // Jets
     FindJets();
-    // Fill the tree
-    fTreeJ->Fill();
 
     if (fPlots) fPlots->FillHistos(fJets);
     fLeading->Reset();
@@ -233,7 +234,6 @@ void AliJetFinder::FinishRun()
     
     if (fOut) {
         fOut->cd();
-        fTreeJ->Write();
         if (fPlots) {
             fPlots->Write();
         }
@@ -241,3 +241,21 @@ void AliJetFinder::FinishRun()
     }
 }
 
+void AliJetFinder::AddJet(AliAODJet p)
+{
+  // Add new jet to the list
+  new ((*fAODjets)[fNAODjets++]) AliAODJet(p);
+}
+
+void AliJetFinder::ConnectAOD(AliAODEvent* aod)
+{
+// Connect to the AOD
+    fAODjets = aod->GetJets();
+}
+
+void AliJetFinder::ConnectAODNonStd(AliAODEvent* aod,const char *bname)
+{
+
+  fAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(bname));
+  // how is this is reset? Cleared?
+}