]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGJE/EMCALJetTasks/AliEmcalJetFinder.cxx
added single particle tracking efficiency
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / AliEmcalJetFinder.cxx
index eea371de3416df7044b8ef1a771aeb62cb83e744..aa1159f64c3520fc14b146fa95165f59210fd956 100644 (file)
@@ -1,12 +1,11 @@
 // $Id$
 //
 // Standalone jet finder
+//   CINT-compatible wrapper for AliFJWrapper, can be used in macros and from the ROOT command line.
+//   Compiled code can use AliFJWrapper directly
 //
 // Authors: R.Haake
 
-#ifndef ALIEMCALJETFINDER_CXX
-#define ALIEMCALJETFINDER_CXX
-
 #include "AliFJWrapper.h"
 #include "AliEmcalJet.h"
 #include "AliEmcalJetFinder.h"
@@ -16,7 +15,7 @@
 
 //________________________________________________________________________
 AliEmcalJetFinder::AliEmcalJetFinder() :
-  TNamed("EmcalJetFinder","EmcalJetFinder"), fFastjetWrapper(0), fInputVectorIndex(0), fJetCount(0), fJetArray(), fGhostArea(0.005), fRadius(0.4), fJetAlgorithm(0), fTrackMaxEta(0.9), fJetMaxEta(0.5), fJetMinPt(0), fJetMinArea(0)
+  TNamed("EmcalJetFinder","EmcalJetFinder"), fFastjetWrapper(0), fInputVectorIndex(0), fJetCount(0), fJetArray(), fGhostArea(0.005), fRadius(0.4), fJetAlgorithm(0), fRecombScheme(-1), fTrackMaxEta(0.9), fJetMaxEta(0.5), fJetMinPt(0), fJetMinArea(0)
 {
   // Constructor
   fFastjetWrapper = new AliFJWrapper("FJWrapper", "FJWrapper");
@@ -24,7 +23,7 @@ AliEmcalJetFinder::AliEmcalJetFinder() :
 
 //________________________________________________________________________
 AliEmcalJetFinder::AliEmcalJetFinder(const char* name) :
-  TNamed(name, name), fFastjetWrapper(0), fInputVectorIndex(0), fJetCount(0), fJetArray(), fGhostArea(0.005), fRadius(0.4), fJetAlgorithm(0), fTrackMaxEta(0.9), fJetMaxEta(0.5), fJetMinPt(0), fJetMinArea(0)
+  TNamed(name, name), fFastjetWrapper(0), fInputVectorIndex(0), fJetCount(0), fJetArray(), fGhostArea(0.005), fRadius(0.4), fJetAlgorithm(0), fRecombScheme(-1), fTrackMaxEta(0.9), fJetMaxEta(0.5), fJetMinPt(0), fJetMinArea(0)
 {
   // Constructor
   fFastjetWrapper = new AliFJWrapper("FJWrapper", "FJWrapper");
@@ -42,6 +41,10 @@ AliEmcalJetFinder::~AliEmcalJetFinder()
 Bool_t AliEmcalJetFinder::FindJets()
 {
   // Tidy up and check input
+  for (UInt_t i=0; i<fJetArray.size(); i++) {
+    delete fJetArray[i];
+    fJetArray[i] = 0;
+  }
   fJetArray.clear();
   fJetCount = 0;
   if(!fInputVectorIndex)
@@ -58,6 +61,8 @@ Bool_t AliEmcalJetFinder::FindJets()
     fFastjetWrapper->SetAlgorithm(fastjet::antikt_algorithm);  
   if(fJetAlgorithm == 1)
     fFastjetWrapper->SetAlgorithm(fastjet::kt_algorithm);  
+  if(fRecombScheme>=0)
+    fFastjetWrapper->SetRecombScheme(static_cast<fastjet::RecombinationScheme>(fRecombScheme));
 
   fFastjetWrapper->SetMaxRap(fTrackMaxEta);
 
@@ -82,6 +87,7 @@ Bool_t AliEmcalJetFinder::FindJets()
 
     // Set the most important properties of the jet
     Int_t nConstituents(fFastjetWrapper->GetJetConstituents(i).size());
+    jet->SetArea(fFastjetWrapper->GetJetArea(i));
     jet->SetNumberOfTracks(nConstituents);
     jet->SetNumberOfClusters(nConstituents);
     fJetArray[fJetCount] = jet;
@@ -90,6 +96,7 @@ Bool_t AliEmcalJetFinder::FindJets()
 
   fJetArray.resize(fJetCount);
 
+  //fastjets.clear(); // will be done by the destructor at the end of the function
   fFastjetWrapper->Clear();
   fInputVectorIndex = 0;
   return kTRUE;
@@ -102,12 +109,19 @@ void AliEmcalJetFinder::AddInputVector(Double_t px, Double_t py, Double_t pz)
   fInputVectorIndex++;
 }
 
+//________________________________________________________________________
+void AliEmcalJetFinder::AddInputVector(Double_t px, Double_t py, Double_t pz, Double_t E)
+{
+  fFastjetWrapper->AddInputVector(px, py, pz, E, fInputVectorIndex + 100);
+  fInputVectorIndex++;
+}
+
 //________________________________________________________________________
 void AliEmcalJetFinder::FillPtHistogram(TH1* histogram)
 {
   if(!histogram)
     return;
-  for (Int_t i=0; i<fJetArray.size(); i++)
+  for (std::size_t i=0; i<fJetArray.size(); i++)
   {
     histogram->Fill(fJetArray[i]->Pt());
   }
@@ -118,7 +132,7 @@ void AliEmcalJetFinder::FillPhiHistogram(TH1* histogram)
 {
   if(!histogram)
     return;
-  for (Int_t i=0; i<fJetArray.size(); i++)
+  for (std::size_t i=0; i<fJetArray.size(); i++)
   {
     histogram->Fill(fJetArray[i]->Phi());
   }
@@ -129,9 +143,8 @@ void AliEmcalJetFinder::FillEtaHistogram(TH1* histogram)
 {
   if(!histogram)
     return;
-  for (Int_t i=0; i<fJetArray.size(); i++)
+  for (std::size_t i=0; i<fJetArray.size(); i++)
   {
     histogram->Fill(fJetArray[i]->Eta());
   }
 }
-#endif