]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - JETAN/AliJetFinder.cxx
make scan of dEdx blocks consistent, there is only one block
[u/mrichter/AliRoot.git] / JETAN / AliJetFinder.cxx
index bbdaa671b30cf78d319f4832bf692677058b347e..bdad6045e357270c5dfbf6fe4f551d44a080aeb7 100644 (file)
 #include <TFile.h>
 
 #include "AliJetFinder.h"
-#include "AliJet.h"
 #include "AliAODJet.h"
-#include "AliJetControlPlots.h"
-#include "AliLeading.h"
 #include "AliAODEvent.h"
 #include "AliJetUnitArray.h"
-
-class TProcessID;
-class TClonesArray;
+#include "AliJetReaderHeader.h"
+#include "AliJetHeader.h"
+#include "AliJetReader.h"
+#include "AliAODJetEventBackground.h"
 
 ClassImp(AliJetFinder)
 
 AliJetFinder::AliJetFinder():
-    fTreeJ(0),
-    fPlotMode(kFALSE),
-    fJets(0),
-    fGenJets(0),
-    fLeading(0),
     fReader(0x0),
     fHeader(0x0),
     fAODjets(0x0),
     fNAODjets(0),
-    fPlots(0x0),
-    fOut(0x0)
-    
+    fAODEvBkg(0),
+    fDebug(0)
 {
   //
   // Constructor
   //
-
-  fJets    = new AliJet();
-  fGenJets = new AliJet();
-  fLeading = new AliLeading();
   fAODjets = 0;
 }
 
@@ -69,57 +57,9 @@ AliJetFinder::~AliJetFinder()
   //
   // Destructor
   //
-
-  // Reset and delete jets
-  fJets->ClearJets();
-  delete fJets;
-  fGenJets->ClearJets();
-  delete fGenJets;
-  // close file
-  if (fOut) {
-    fOut->Close();
-    fOut->Delete();
-  }
-  delete fOut;
-  // reset and delete control plots
-  if (fPlots) delete fPlots;
 }
 
-////////////////////////////////////////////////////////////////////////
-void AliJetFinder::SetOutputFile(const char */*name*/)
-{
-  //  opens output file 
-  //  fOut = new TFile(name,"recreate");
-}
 
-////////////////////////////////////////////////////////////////////////
-void AliJetFinder::PrintJets()
-{
-  // Print jet information
-  cout << " Jets found with jet algorithm:" << endl;
-  fJets->PrintJets();
-  cout << " Jets found by pythia:" << endl;
-  fGenJets->PrintJets();
-}
-
-////////////////////////////////////////////////////////////////////////
-void AliJetFinder::SetPlotMode(Bool_t b)
-{
-  // Sets the plotting mode
-  fPlotMode=b;
-  if (b && !fPlots) fPlots = new AliJetControlPlots(); 
-}
-
-////////////////////////////////////////////////////////////////////////
-TTree* AliJetFinder::MakeTreeJ(char* name)
-{
-    // Create the tree for reconstructed jets
-    fTreeJ = new TTree(name, "AliJet");
-    fTreeJ->Branch("FoundJet",   &fJets,   1000);
-    fTreeJ->Branch("GenJet",     &fGenJets,1000);
-    fTreeJ->Branch("LeadingPart",&fLeading,1000);
-    return fTreeJ;
-}
 
 ////////////////////////////////////////////////////////////////////////
 void AliJetFinder::WriteRHeaderToFile()
@@ -129,65 +69,6 @@ void AliJetFinder::WriteRHeaderToFile()
     rh->Write();
 }
 
-////////////////////////////////////////////////////////////////////////
-void AliJetFinder::Run()
-{
-  // Do some initialization
-  Init();
-  // connect files
-  fReader->OpenInputFiles();
-
-  // write headers
-  WriteHeaders();
-  // loop over events
-  Int_t nFirst, nLast, option, debug, arrayInitialised; 
-  nFirst = fReader->GetReaderHeader()->GetFirstEvent();
-  nLast  = fReader->GetReaderHeader()->GetLastEvent();
-
-  option = fReader->GetReaderHeader()->GetDetector();
-  debug  = fReader->GetReaderHeader()->GetDebug();
-  arrayInitialised = fReader->GetArrayInitialised();
-
-  // loop over events
-  for (Int_t i=nFirst;i<nLast;i++) {
-      fReader->FillMomentumArray();
-      fLeading->FindLeading(fReader);
-      fReader->GetGenJets(fGenJets);
-
-      if (option == 0) { // TPC with fMomentumArray
-         if(debug > 1) 
-             printf("In FindJetsC() routine: find jets with fMomentumArray !!!\n");
-         FindJetsC();
-      } else {
-       if(debug > 1) printf("In FindJets() routine: find jets with fUnitArray !!!\n");
-       FindJets();
-      }
-      if (fOut) {
-         fOut->cd();
-      }
-      
-      if (fPlots) fPlots->FillHistos(fJets);
-      fLeading->Reset();
-      fGenJets->ClearJets();
-      Reset();
-  } 
-
-  // write out
-  if (fPlots) {
-      fPlots->Normalize();
-      fPlots->PlotHistos();
-  }
-  if (fOut) {
-      fOut->cd();
-      fPlots->Write();
-      fOut->Close();
-  }
-}
-
-
-//
-// The following methods have been added to allow for event steering from the outside
-//
 
 ////////////////////////////////////////////////////////////////////////
 void AliJetFinder::ConnectTree(TTree* tree, TObject* data)
@@ -216,16 +97,8 @@ Bool_t AliJetFinder::ProcessEvent()
 
   Bool_t ok = fReader->FillMomentumArray();
   if (!ok) return kFALSE;
-  
-  // Leading particles
-  fLeading->FindLeading(fReader);
   // Jets
   FindJets(); // V1
-  //  FindJetsC(); // V2
-  
-  if (fPlots) fPlots->FillHistos(fJets);
-  fLeading->Reset();
-  fGenJets->ClearJets();
   Reset();  
   return kTRUE;
 }
@@ -244,13 +117,10 @@ Bool_t AliJetFinder::ProcessEvent2()
 
   // Delete reference pointer  
   if (!ok) {delete ref; return kFALSE;}
-  
-  // Leading particles
-  fLeading->FindLeading(fReader);
   // Jets
   FindJets();
   
-  Int_t         nEntRef    = ref->GetEntries();
+  Int_t nEntRef = ref->GetEntries();
 
   for(Int_t i=0; i<nEntRef; i++)
     { 
@@ -275,44 +145,23 @@ Bool_t AliJetFinder::ProcessEvent2()
   ref->Delete();
   delete ref;
 
-  if (fPlots) fPlots->FillHistos(fJets);
-  fLeading->Reset();
-  fGenJets->ClearJets();
   Reset();
 
   return kTRUE;
 }
 
-////////////////////////////////////////////////////////////////////////
-void AliJetFinder::FinishRun()
-{
-    // Finish a run
-    if (fPlots) {
-       fPlots->Normalize();
-       fPlots->PlotHistos();
-    }
-    
-    if (fOut) {
-        fOut->cd();
-        if (fPlots) {
-            fPlots->Write();
-        }
-        fOut->Close();
-    }
-}
 
-////////////////////////////////////////////////////////////////////////
 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();
+    fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(AliAODJetEventBackground::StdBranchName()));
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -320,6 +169,7 @@ void AliJetFinder::ConnectAODNonStd(AliAODEvent* aod,const char *bname)
 {
 
   fAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(bname));
-  // how is this is reset? Cleared?
+  fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(Form("%s_%s",AliAODJetEventBackground::StdBranchName(),bname)));
+  // how is this is reset? Cleared? -> by the UserExec!!
 }