]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - JETAN/AliJetFinder.cxx
hlt build system fixed after commit 25261: ifdef in pkg definitions; added explicit...
[u/mrichter/AliRoot.git] / JETAN / AliJetFinder.cxx
index 8c623b84638a643e1dc94ef57d1eb3eaf6fb8b5f..0e2f500367bafa35b49c0a205c8465a67713dc9e 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;
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -73,10 +80,10 @@ AliJetFinder::~AliJetFinder()
 
 ////////////////////////////////////////////////////////////////////////
 
-void AliJetFinder::SetOutputFile(const char* name)
+void AliJetFinder::SetOutputFile(const char */*name*/)
 {
   //  opens output file 
-    fOut = new TFile(name,"recreate");
+  //  fOut = new TFile(name,"recreate");
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -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);
 
@@ -151,12 +158,11 @@ void AliJetFinder::Run()
              printf("In FindJetsTPC() routine: find jets with fMomentumArray !!!\n");
          FindJetsTPC();
       } else {
-         if(debug > 1) printf("In FindJets() routine: find jets with fUnitArray !!!\n");
-         FindJets();
+          if(debug > 1) printf("In FindJets() routine: find jets with fUnitArray !!!\n");
+          FindJets();
       }
       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,14 @@ 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();
+}