]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add new classes for the jet cone finder
authorjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 1 Apr 2009 19:33:16 +0000 (19:33 +0000)
committerjthaeder <jthaeder@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 1 Apr 2009 19:33:16 +0000 (19:33 +0000)
* Not yet in compilation
* waiting for an addon in JETAN

18 files changed:
HLT/JET/AliHLTJETBase.cxx [new file with mode: 0644]
HLT/JET/AliHLTJETBase.h [new file with mode: 0644]
HLT/JET/AliHLTJETJetCuts.cxx [new file with mode: 0644]
HLT/JET/AliHLTJETJetCuts.h [new file with mode: 0644]
HLT/JET/AliHLTJETJets.cxx [new file with mode: 0644]
HLT/JET/AliHLTJETJets.h [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeEtaPhiCell.cxx [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeEtaPhiCell.h [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeFinder.cxx [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeFinder.h [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeGrid.cxx [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeGrid.h [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeHeader.cxx [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeHeader.h [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeJetCandidate.cxx [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeJetCandidate.h [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeSeedCuts.cxx [new file with mode: 0644]
HLT/JET/cone/AliHLTJETConeSeedCuts.h [new file with mode: 0644]

diff --git a/HLT/JET/AliHLTJETBase.cxx b/HLT/JET/AliHLTJETBase.cxx
new file mode 100644 (file)
index 0000000..10a8ba8
--- /dev/null
@@ -0,0 +1,211 @@
+//-*- Mode: C++ -*-
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/** @file   AliHLTJETBase.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Base functionality for HLT JET package
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
+   using namespace std;
+#endif
+
+#include "AliHLTJETBase.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETBase)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+  AliHLTJETBase::AliHLTJETBase() {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+
+//##################################################################################
+AliHLTJETBase::~AliHLTJETBase() {
+  // see header file for class documentation
+}
+
+#if 0
+
+
+//##################################################################################
+void AliHLTJETBase::XYZtoRPhiEta( const Double_t *xyz, Double_t *rpe ) {
+  // see header file for class documentation
+
+  // Spherical [r,phi,eta] - rpe
+  // Cartesian [x,y,z] - xyz
+  
+  rpe[0] = TMath::Sqrt( xyz[0]*xyz[0] + xyz[1]*xyz[1] + xyz[2]*xyz[2] );
+  rpe[1] = AliHLTJETBase::GetPhiFromXYZ( xyz );
+  rpe[2] = 0.5 * TMath::Log( (rpe[0]+xyz[2])/(rpe[0]-xyz[2]) );
+}
+
+//##################################################################################
+void AliHLTJETBase::XYZEtoRPhiEtaPt( const Double_t *xyze, Double_t *rpep ) {
+  // see header file for class documentation
+
+  // Spherical [r,phi,eta,pt] - rpep
+  // Cartesian [x,y,z,E] - xyze
+  
+  rpep[0] = TMath::Sqrt( xyze[0]*xyze[0] + xyze[1]*xyze[1] + xyze[2]*xyze[2] );
+  rpep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
+  rpep[2] = 0.5 * TMath::Log( (rpep[0]+xyze[2])/(rpep[0]-xyze[2]) );
+  rpep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
+}
+
+//##################################################################################
+void AliHLTJETBase::XYZEtoRPhiEtaPt( const Float_t *xyze, Double_t *rpep ) {
+  // see header file for class documentation
+
+  // Spherical [r,phi,eta,pt] - rpep
+  // Cartesian [x,y,z,E] - xyze
+  Double_t x = (Double_t) xyze[0];
+  Double_t y = (Double_t) xyze[1];
+  Double_t z = (Double_t) xyze[2];
+  
+  rpep[0] = TMath::Sqrt( x*x + y*y + z*z );
+  rpep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
+  rpep[2] = 0.5 * TMath::Log( (rpep[0]+z)/(rpep[0]-z) );
+  rpep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
+}
+
+//##################################################################################
+void AliHLTJETBase::XYZEtoEPhiEtaPt( const Double_t *xyze, Double_t *epep ) {
+  // see header file for class documentation
+
+  // Spherical [r,phi,eta,pt] - rpep
+  // Cartesian [x,y,z,E] - xyze
+
+  Double_t r = TMath::Sqrt( xyze[0]*xyze[0] + xyze[1]*xyze[1] + xyze[2]*xyze[2] );
+  
+  epep[0] = xyze[3];
+  epep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
+  epep[2] = 0.5 * TMath::Log( (r+xyze[2])/(r-xyze[2]) );
+  epep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
+}
+
+//##################################################################################
+void AliHLTJETBase::XYZEtoEPhiEtaPt( const Float_t *xyze, Double_t *epep ) {
+  // see header file for class documentation
+
+  // Spherical [r,phi,eta,pt] - rpep
+  // Cartesian [x,y,z,E] - xyze
+  Double_t x = (Double_t) xyze[0];
+  Double_t y = (Double_t) xyze[1];
+  Double_t z = (Double_t) xyze[2];
+  Double_t e = (Double_t) xyze[3];
+  Double_t r = TMath::Sqrt( x*x + y*y + z*z );
+  
+  epep[0] = e;
+  epep[1] = AliHLTJETBase::GetPhiFromXYZ( xyze );
+  epep[2] = 0.5 * TMath::Log( (r+z)/(r-z) );
+  epep[3] = AliHLTJETBase::GetPtFromXYZ( xyze );
+}
+
+//##################################################################################
+Double_t AliHLTJETBase::GetPtFromXYZ( const Double_t *pxpypz ) {
+  // see header file for class documentation
+  // Cartesian [px,py,pz] 
+  
+  return TMath::Sqrt( pxpypz[0]*pxpypz[0] + pxpypz[1]*pxpypz[1] );
+}
+
+//##################################################################################
+Double_t AliHLTJETBase::GetPtFromXYZ( const Float_t *pxpypz ) {
+  // see header file for class documentation
+  // Cartesian [px,py,pz] 
+  
+  Double_t px = (Double_t) pxpypz[0];
+  Double_t py = (Double_t) pxpypz[1];
+
+  return TMath::Sqrt( px*px + py*py );
+}
+
+//##################################################################################
+Double_t AliHLTJETBase::GetPhiFromXYZ( const Double_t *xyz ) {
+  // see header file for class documentation
+  // Cartesian [x,y,z,E] - xyz
+  Double_t phi = TMath::ATan2( xyz[1], xyz[0] );  
+  if ( phi < 0.0 ) phi += TMath::TwoPi();
+
+  return phi;
+}
+
+//##################################################################################
+Double_t AliHLTJETBase::GetPhiFromXYZ( const Float_t *xyz ) {
+  // see header file for class documentation
+  // Cartesian [x,y,z,E] - xyz
+  Double_t x = (Double_t) xyz[0];
+  Double_t y = (Double_t) xyz[1];
+
+  Double_t phi = TMath::ATan2( y, x );  
+  if ( phi < 0.0 ) phi += TMath::TwoPi();
+
+  return phi;
+}
+
+//##################################################################################
+Double_t AliHLTJETBase::GetEtaFromXYZ( const Double_t *xyz ) {
+  // see header file for class documentation
+  // Cartesian [x,y,z,E] - xyz
+  
+  Double_t r = TMath::Sqrt( xyz[0]*xyz[0] + xyz[1]*xyz[1] + xyz[2]*xyz[2] );
+  return 0.5 * TMath::Log( (r+xyz[2])/(r-xyz[2]) );
+}
+//##################################################################################
+Double_t AliHLTJETBase::GetEtaFromXYZ( const Float_t *xyz ) {
+  // see header file for class documentation
+  // Cartesian [x,y,z,E] - xyz
+  
+  Double_t x = (Double_t) xyz[0];
+  Double_t y = (Double_t) xyz[1];
+  Double_t z = (Double_t) xyz[2];
+  
+  Double_t r = TMath::Sqrt( x*x + y*y + z*z );
+  return 0.5 * TMath::Log( (r+z)/(r-z) );
+}
+
+//################################################################################## 
+Double_t AliHLTJETBase::GetDistance2( const Double_t eta1, const Double_t phi1, 
+                                            const Double_t eta2, const Double_t phi2) {
+  // see header file for class documentation
+  
+  return ( (eta1-eta2)*(eta1-eta2) ) + ( (phi1-phi2)*(phi1-phi2) );
+}
+
+
+#endif
diff --git a/HLT/JET/AliHLTJETBase.h b/HLT/JET/AliHLTJETBase.h
new file mode 100644 (file)
index 0000000..0e8d34b
--- /dev/null
@@ -0,0 +1,103 @@
+//-*- Mode: C++ -*-
+#ifndef ALIHLTJETBASE_H
+#define ALIHLTJETBASE_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETBase.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Base functionality for HLT JET package
+
+*/
+
+#include "AliHLTLogging.h"
+#include "TObject.h"
+
+enum GridIndex_t   { kIdxPrimary, kIdxOutter, kIdxEtaPrimary, kIdxPhiPrimary, kIdxPhiOutter };
+enum EtaPhiIndex_t { kIdxEta, kIdxPhi, kIdxPt };
+enum TrackType_t   { kTrackMC, kTrackESD, kTrackAOD };
+
+/**
+XXXX STILL TRUE???
+ Different type of how to add tracks to a jet
+    0 : check for radius compared to every track 
+    in selected cell -- default
+    1 : check for radius compared to center 
+    of selected cell
+    2 : take whole cell
+*/
+enum FinderType_t { kSquareCellRegion, kRadiusCellRegion, kRadius, kSquareArea };
+
+/**
+ * @class AliHLTJETBase
+ * This class contains a Seed for the JetFinder
+ * 
+ */
+
+class AliHLTJETBase : public TObject, public AliHLTLogging {
+
+ public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+  /** Standard constructor */
+  AliHLTJETBase();
+
+  /** Destructor */
+  ~AliHLTJETBase();  
+
+  ///////////////////////////////////////////////////////////////////////////////////
+  
+ private:
+
+  /** copy constructor prohibited */
+  AliHLTJETBase(const AliHLTJETBase&);
+
+  /** assignment operator prohibited */
+  AliHLTJETBase& operator=(const AliHLTJETBase&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+    
+  ClassDef(AliHLTJETBase, 0)
+};
+#endif
+
+
+#if 0
+   */
+
+  static Int_t GetCellIndex( const Double_t* aEtaPhi, Int_t* aGridIndex );
+
+  static void XYZtoRPhiEta( const Double_t *xyz, Double_t *rpe );
+
+  static void XYZEtoRPhiEtaPt( const Double_t *xyze, Double_t *rpep );
+  static void XYZEtoRPhiEtaPt( const Float_t *xyze, Double_t *rpep );
+
+  static void XYZEtoEPhiEtaPt( const Double_t *xyze, Double_t *epep );
+  static void XYZEtoEPhiEtaPt( const Float_t *xyze, Double_t *epep );
+
+  static Double_t GetPtFromXYZ( const Double_t *pxpypz );
+  static Double_t GetPtFromXYZ( const Float_t *pxpypz );
+
+  static Double_t GetPhiFromXYZ( const Double_t *xyz );
+  static Double_t GetPhiFromXYZ( const Float_t *xyz );
+
+  static Double_t GetEtaFromXYZ( const Double_t *xyz );
+  static Double_t GetEtaFromXYZ( const Float_t *xyz );
+
+  static Double_t GetDistance2( const Double_t eta1, const Double_t phi1, 
+                               const Double_t eta2, const Double_t phi2);
+
+
+#endif
diff --git a/HLT/JET/AliHLTJETJetCuts.cxx b/HLT/JET/AliHLTJETJetCuts.cxx
new file mode 100644 (file)
index 0000000..b76ea38
--- /dev/null
@@ -0,0 +1,174 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETJetCuts.cxx  $
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLTJETJetCuts.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Cuts for jet input tracks
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "AliHLTJETJetCuts.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETJetCuts)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+  
+// #################################################################################
+AliHLTJETJetCuts::AliHLTJETJetCuts(const Char_t* name, const Char_t* title )
+  : 
+  AliAnalysisCuts(name, title),
+  fEtMin(0.) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+// #################################################################################
+AliHLTJETJetCuts::~AliHLTJETJetCuts() {
+  // see header file for class documentation
+
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                   Selection
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Bool_t AliHLTJETJetCuts::IsSelected( TObject *obj ) {
+  // see header file for class documentation
+
+  Bool_t bResult = kTRUE;
+
+  if ( ! strcmp(obj->ClassName(),"AliHLTJETConeJetCandidate") )
+    bResult = IsSelected( dynamic_cast<AliHLTJETConeJetCandidate*> (obj));
+  else if ( ! strcmp(obj->ClassName(),"AliAODJet") )
+    bResult = IsSelected( dynamic_cast<AliAODJet*> (obj));
+  else {
+    HLTError("Unknown object type %s", obj->ClassName() );
+    bResult = kFALSE;
+  }
+  
+   HLTError("Unknown object dd type %s", obj->ClassName() );
+
+  return bResult;
+}
+
+// #################################################################################
+Bool_t AliHLTJETJetCuts::IsSelected( AliHLTJETConeJetCandidate* jet ) {
+  // see header file for class documentation
+
+  Bool_t bResult = kTRUE;
+
+  // -- cut on min Pt
+  if ( jet->GetEt() < fEtMin )
+    bResult = kFALSE;
+
+  return bResult;
+}
+
+// #################################################################################
+Bool_t AliHLTJETJetCuts::IsSelected( AliAODJet* jet ) {
+  // see header file for class documentation
+
+  Bool_t bResult = kTRUE;
+
+  // -- cut on min Pt
+  if ( jet->Pt() < fEtMin )
+    bResult = kFALSE;
+
+  return bResult;
+}
+
+
+#if 0
+/*
+Int_t AliHLTJetFinder::CleanJetCandidates(){
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+  
+  fJets->SortJets();
+  
+  Int_t nIntitalJetCandidates = fJets->GetNJets();
+
+  for ( Int_t iter = 0; iter < nIntitalJetCandidates; iter++ ) {
+
+    if ( ! fJets->IsJet( iter ) )
+       continue;
+
+    AliHLTJetFinderJetCandidate* jet = fJets->GetJet( iter );
+
+    for ( Int_t compareIter = 0; compareIter < iter ; compareIter++ ) {
+
+      if ( ! fJets->IsJet( compareIter ) )
+       continue;
+
+      if ( ! fJets->IsJet( iter ) )
+       break;
+
+      
+      AliHLTJetFinderJetCandidate* compareJet = fJets->GetJet( compareIter );
+
+      Double_t distance2 = AliHLTJetDefinitions::GetDistance2( jet->GetEta(), jet->GetPhi(), 
+                                                              compareJet->GetEta(), compareJet->GetPhi() );
+
+      // -- check if Jet is close to another one
+      if ( distance2 > ( fDistanceCutJet*fDistanceCutJet) ) 
+       continue;
+
+      // -- one has to go
+      if ( jet->GetPt() >= compareJet->GetPt() )
+       fJets->RemoveJet( compareIter );
+      
+      else {
+       fJets->RemoveJet( iter );
+       break;
+      }
+
+    } // for ( Int_t compareIter = 0; compareIter < iter ; compareIter++ ) {
+    
+  } // for ( Int_t iter = 0; iter < fNJetCandidates; iter++ ) {
+  
+  fJets->CompressJets();
+
+  return iResult;
+}
+
+*/
+#endif
+
diff --git a/HLT/JET/AliHLTJETJetCuts.h b/HLT/JET/AliHLTJETJetCuts.h
new file mode 100644 (file)
index 0000000..73df9a0
--- /dev/null
@@ -0,0 +1,116 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETJetCuts.h $
+
+#ifndef ALIHLTJETJETCUTS_H
+#define ALIHLTJETJETCUTS_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETJetCuts.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Cuts for jet input tracks
+*/
+
+#include "AliAODJet.h"
+
+#include "AliAnalysisCuts.h"
+#include "AliHLTLogging.h"
+#include "AliHLTJETBase.h"
+
+#include "AliHLTJETConeJetCandidate.h"
+
+/**
+ * @class  AliHLTJETJetCuts
+ * Cuts for jets
+ *
+ * @ingroup alihlt_jet
+ */
+
+class AliHLTJETJetCuts : public AliAnalysisCuts, public AliHLTLogging {
+  
+public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** standard constructor */
+  AliHLTJETJetCuts(const Char_t* name = "AliHLTJETJetCuts", const Char_t* title = "");
+
+  /** destructor */
+  virtual ~AliHLTJETJetCuts();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                   Selection
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Select jet
+      @param obj AliHLTJETConeJetCandidate or AliAODJet
+      @return kTRUE if selected, kFALSE otherwise
+  */
+  Bool_t IsSelected( TObject* obj );
+
+  /** Select jet
+      @param jet AliHLTJETConeJetCandidate jet
+      @return kTRUE if selected, kFALSE otherwise
+  */
+  Bool_t IsSelected( AliHLTJETConeJetCandidate* jet );
+
+  /** Select jet
+      @param jet AliAODJet jet
+      @return kTRUE if selected, kFALSE otherwise
+  */
+  Bool_t IsSelected( AliAODJet* jet );
+  
+  /** Select jet
+      Not implemented
+      @return kTRUE 
+  */
+  Bool_t IsSelected( TList* /*list*/ ) { return kTRUE; }
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Setter
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Set cut on min pt */
+  void SetMinEt( Float_t f ) { fEtMin = f; }
+
+  ///////////////////////////////////////////////////////////////////////////////////
+
+private:
+
+  /** copy constructor prohibited */
+  AliHLTJETJetCuts (const AliHLTJETJetCuts&);
+
+  /** assignment operator prohibited */
+  AliHLTJETJetCuts& operator= (const AliHLTJETJetCuts&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Minimum Et */
+  Float_t            fEtMin;                    // see above
+
+#if 0
+  /** Distance between to jets */
+  Float_t            fDistanceCut;
+#endif
+
+  ClassDef(AliHLTJETJetCuts, 1)
+
+};
+#endif
+
diff --git a/HLT/JET/AliHLTJETJets.cxx b/HLT/JET/AliHLTJETJets.cxx
new file mode 100644 (file)
index 0000000..9c4e542
--- /dev/null
@@ -0,0 +1,122 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETJets.cxx  $
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/** @file   AliHLTJETJets.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Container holding produced Jets
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
+   using namespace std;
+#endif
+
+#include "AliHLTJETJets.h"
+#include "TLorentzVector.h"
+
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETJets)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+AliHLTJETJets::AliHLTJETJets() :
+  fNAODJets(0),
+  fAODJets(new TClonesArray( "AliAODJet", 20 ) ) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+  
+}
+
+//##################################################################################
+AliHLTJETJets::~AliHLTJETJets() {
+  // see header file for class documentation
+
+  if ( fAODJets ){
+    fAODJets->Clear();
+    delete fAODJets;
+  }
+  fAODJets = NULL;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                   Initialize / Reset
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETJets::Reset() {
+  // see header file for class documentation  
+
+  fAODJets->Clear();
+  fNAODJets = 0;
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                     Getter
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+AliAODJet* AliHLTJETJets::GetJet( Int_t iter )  { 
+  // see header file for class documentation
+  
+  if ( iter > fNAODJets )
+    return NULL;
+  else
+    return reinterpret_cast<AliAODJet*>((*fAODJets)[iter]); 
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                     Setter
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETJets::AddJet( AliHLTJETConeJetCandidate* jet ) {
+  // see header file for class documentation
+  
+  // -- create TLorentzVector
+  TLorentzVector v;
+  v.SetPtEtaPhiE( jet->GetPt(),jet->GetEta(),jet->GetPhi(), jet->GetEt() );
+
+  // -- add AliAODJet
+  new ((*fAODJets)[fNAODJets]) AliAODJet(v);
+  fNAODJets++;
+
+  return;
+}
diff --git a/HLT/JET/AliHLTJETJets.h b/HLT/JET/AliHLTJETJets.h
new file mode 100644 (file)
index 0000000..992f66b
--- /dev/null
@@ -0,0 +1,115 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETJets.h  $
+
+#ifndef ALIHLTJETJETS_H
+#define ALIHLTJETJETS_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETJets.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Container holding produced Jets
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "TClonesArray.h"
+
+#include "AliAODJet.h"
+
+#include "AliHLTLogging.h"
+#include "AliHLTJETBase.h"
+
+#include "AliHLTJETConeJetCandidate.h"
+
+/**
+ * @class AliHLTJETJets
+ * This class contains AliAODJets and comments
+ *
+ * @ingroup alihlt_jet
+ */
+
+class AliHLTJETJets : public TObject, public AliHLTLogging {
+public:
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Constructor */
+  AliHLTJETJets();
+  
+  /** Destructor */
+  ~AliHLTJETJets();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                   Initialize / Reset
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Reset output array */
+  void Reset();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Getter
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /* Get number of AODJets */
+  Int_t         GetNAODJets() { return fNAODJets; }
+
+  /** Get ptr to AODJets */
+  TClonesArray* GetAODJets()  { return fAODJets; }
+
+  /** Get AODHet with idx iter */
+  AliAODJet*    GetJet( Int_t iter );
+
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Setter
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Add Jet to Container 
+   * @param  jetCandidate  ptr to AliHLTJetFinderJetSeed
+   */
+  void AddJet( AliHLTJETConeJetCandidate* jet );
+
+  ///////////////////////////////////////////////////////////////////////////////////
+  
+ private:
+  /** copy constructor prohibited */
+  AliHLTJETJets(const AliHLTJETJets&);
+  
+  /** assignment operator prohibited */
+  AliHLTJETJets& operator=(const AliHLTJETJets&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Number of AOD jets */
+  Int_t                   fNAODJets;          // see above
+
+  /** Array of AOD jets */
+  TClonesArray*           fAODJets;        // see above
+
+  ClassDef(AliHLTJETJets, 1)
+};
+#endif
diff --git a/HLT/JET/cone/AliHLTJETConeEtaPhiCell.cxx b/HLT/JET/cone/AliHLTJETConeEtaPhiCell.cxx
new file mode 100644 (file)
index 0000000..60c1c0b
--- /dev/null
@@ -0,0 +1,156 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETConeEtaPhiCell.cxx  $
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/** @file   AliHLTJETConeEtaPhiCell.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Cell in eta-phi space of the cone finder
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
+   using namespace std;
+#endif
+
+#include "AliHLTJETConeEtaPhiCell.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETConeEtaPhiCell)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+  AliHLTJETConeEtaPhiCell::AliHLTJETConeEtaPhiCell() :
+    fEtaIdx(0),
+    fPhiIdx(0),
+    fPt(0.),
+    fEta(0.),
+    fPhi(0.),
+    fNTracks(0),
+    fTrackList(NULL),
+    fTrackType(0) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+//##################################################################################
+AliHLTJETConeEtaPhiCell::AliHLTJETConeEtaPhiCell( Int_t etaIdx, Int_t phiIdx, 
+                                                 AliESDtrack* track ) :
+    fEtaIdx(etaIdx),
+    fPhiIdx(phiIdx),
+    fPt(0.),
+    fEta(0.),
+    fPhi(0.),
+    fNTracks(0), 
+    fTrackList( new TObjArray(20)), // XXXXXX 20
+    fTrackType( kTrackESD ) {  
+  // see header file for class documentation
+
+  HLTDebug("New cell for ESD etaIdx %d - phiIdx %d", etaIdx, phiIdx );
+
+  AddTrack( track );
+}
+
+//##################################################################################
+AliHLTJETConeEtaPhiCell::AliHLTJETConeEtaPhiCell( Int_t etaIdx, Int_t phiIdx, 
+                                                 TParticle* particle ) :
+    fEtaIdx(etaIdx),
+    fPhiIdx(phiIdx),
+    fPt(0.),
+    fEta(0.),
+    fPhi(0.),
+    fNTracks(0), 
+    fTrackList( new TObjArray(20)), // XXXXXX 20
+    fTrackType( kTrackMC ) {  
+  // see header file for class documentation
+  
+  HLTDebug("New cell for MC etaIdx %d - phiIdx %d", etaIdx, phiIdx );
+  
+  AddTrack( particle );
+}
+
+
+//##################################################################################
+AliHLTJETConeEtaPhiCell::~AliHLTJETConeEtaPhiCell() {
+  // see header file for class documentation
+
+  if ( fTrackList )
+    delete fTrackList;
+  fTrackList = NULL;
+}
+
+//##################################################################################
+void AliHLTJETConeEtaPhiCell::Clear( Option_t* /*option*/ ) {
+  // see header file for class documentation
+
+  if ( fTrackList )
+    delete fTrackList;
+  fTrackList = NULL;
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                     Process 
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+void AliHLTJETConeEtaPhiCell::AddTrack( AliESDtrack* track  ){
+  // see header file for class documentation
+
+  Float_t weight = 1.0; // **  XXXX
+  
+  fEta   += (weight * track->Eta());
+  fPhi   += (weight * track->Phi());
+  fPt    += (weight * TMath::Abs(track->Pt()));
+
+  fTrackList->Add( (TObject*) track );
+  ++fNTracks;
+
+  return;
+}
+
+//##################################################################################
+void AliHLTJETConeEtaPhiCell::AddTrack( TParticle* particle ){
+  // see header file for class documentation
+
+  Float_t weight = 1.0; // **  XXXX
+
+  fEta   += (weight * particle->Eta());
+  fPhi   += (weight * particle->Phi());
+  fPt    += (weight * TMath::Abs( particle->Pt()));
+  
+  fTrackList->Add( (TObject*) particle );
+  ++fNTracks;
+
+  return;
+}
diff --git a/HLT/JET/cone/AliHLTJETConeEtaPhiCell.h b/HLT/JET/cone/AliHLTJETConeEtaPhiCell.h
new file mode 100644 (file)
index 0000000..09b655d
--- /dev/null
@@ -0,0 +1,156 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETConeEtaPhiCell.h  $
+
+#ifndef ALIHLTJETCONEETAPHICELL_H
+#define ALIHLTJETCONEETAPHICELL_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETConeEtaPhiCell.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Cell in eta-phi space of the cone finder
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "TObjArray.h"
+#include "TParticle.h"
+
+#include "AliESDtrack.h"
+
+#include "AliHLTLogging.h"
+#include "AliHLTJETBase.h"
+
+/**
+ * @class AliHLTJETConeEtaPhiCell
+ * This class contains one cell in the eta-phi space for the cone finder
+ * 
+ * @ingroup alihlt_jet_cone
+ */
+
+class AliHLTJETConeEtaPhiCell : public TObject, public AliHLTLogging  {
+
+public:
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Constructor for ESD tracks */
+  AliHLTJETConeEtaPhiCell( Int_t etaIdx, Int_t phiIdx, AliESDtrack* track );
+
+  /** Constructor for MC particles */
+  AliHLTJETConeEtaPhiCell( Int_t etaIdx, Int_t phiIdx, TParticle* particle );
+
+  /** Destructor */
+  ~AliHLTJETConeEtaPhiCell();
+
+  /** A destructor like class, called by TClonesArray->Clear("C") */
+  void Clear(Option_t* option = "");
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Getter
+   * ---------------------------------------------------------------------------------
+   */
+  /** Get cell eta index */
+  Int_t         GetEtaIdx()        { return fEtaIdx; }
+
+  /** Get cell phi index */
+  Int_t         GetPhiIdx()        { return fPhiIdx; }
+
+  /** Get summed pt of cell */
+  Float_t       GetPt()            { return fPt; }  
+
+  /** Get summed eta of cell */
+  Float_t       GetEta()           { return fEta; }
+
+  /** Get summed phi of cell */
+  Float_t       GetPhi()           { return fPhi; }  
+
+  /** Get N of tracks in cell */
+  Int_t         GetNTracks()       { return fNTracks; }
+
+  /**  Get List of tracks in cell */
+  TObjArray*    GetTrackList()     { return fTrackList; }
+
+  /** Get type of tracks (TrackType_t) */
+  Int_t         GetTrackType()     { return fTrackType; }
+
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Process 
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Add Track to cell, using ESD track */
+  void AddTrack( AliESDtrack* track );
+
+  /** Add Track to cell, using MC particle */
+  void AddTrack( TParticle* particle );
+  
+  ///////////////////////////////////////////////////////////////////////////////////
+
+ private:
+
+  /** Standard constructor prohibited */
+  AliHLTJETConeEtaPhiCell();
+
+  /** copy constructor prohibited */
+  AliHLTJETConeEtaPhiCell(const AliHLTJETConeEtaPhiCell&);
+
+  /** assignment operator prohibited */
+  AliHLTJETConeEtaPhiCell& operator=(const AliHLTJETConeEtaPhiCell&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  // -- cell index parameters --
+
+  /** cell eta index */
+  Int_t      fEtaIdx;                        // see above
+
+  /** cell phi index */
+  Int_t      fPhiIdx;                        // see above
+
+  // -- summed parameters --
+
+  /** Summed pt of cell */
+  Float_t    fPt;                            // see above
+
+  /** Summed eta of cell */
+  Float_t    fEta;                           // see above
+
+  /** Summed phi of cell */
+  Float_t    fPhi;                           // see above
+
+  /** N of tracks in cell */
+  UInt_t     fNTracks;                       // see above
+
+  // -- Lists --
+
+  /** TObjArray of tracks in the cell */
+  TObjArray* fTrackList;                     //! transient
+  
+  /** Type of tracks (TrackType_t) */
+  Int_t      fTrackType;                     // see above
+
+  ClassDef(AliHLTJETConeEtaPhiCell, 1)
+};
+#endif
+
diff --git a/HLT/JET/cone/AliHLTJETConeFinder.cxx b/HLT/JET/cone/AliHLTJETConeFinder.cxx
new file mode 100644 (file)
index 0000000..6bf9be4
--- /dev/null
@@ -0,0 +1,316 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETConeFinder.cxx  $
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLTJETConeFinder.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Jet cone finder
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "AliHLTJETReader.h"
+
+#include "AliHLTJETConeGrid.h"
+#include "AliHLTJETConeFinder.h"
+#include "AliHLTJETConeHeader.h"
+#include "AliHLTJETConeJetCandidate.h"
+#include "AliHLTJETConeEtaPhiCell.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETConeFinder)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+  
+// #################################################################################
+AliHLTJETConeFinder::AliHLTJETConeFinder()
+  : 
+  AliJetFinder(),
+  fGrid(NULL),
+  fJets(NULL) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+// #################################################################################
+AliHLTJETConeFinder::~AliHLTJETConeFinder() {
+  // see header file for class documentation
+
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                    Initialize
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Int_t AliHLTJETConeFinder::Initialize() {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+  
+  if ( !fHeader || !fReader ) {
+    HLTError("No header or reader set!");
+    return -EINPROGRESS;
+  }
+
+  // -- Initialize Reader
+  AliHLTJETReader *reader = dynamic_cast<AliHLTJETReader*> (fReader);
+  
+  iResult = reader->Initialize();
+  if ( iResult ) {
+    HLTError( "Initializing Reader failed!");
+    return iResult;
+  }
+  // -- Initialize Header
+  AliHLTJETConeHeader *header = dynamic_cast<AliHLTJETConeHeader*> (fHeader);
+
+  iResult = header->Initialize();
+  if ( iResult ) {
+    HLTError( "Initializing Header failed!");
+    return iResult;
+  }
+
+  // -- Set ptr to grid
+  fGrid = reader->GetGrid();
+  if ( ! fGrid ) {
+    HLTError( "Getting ptr to grid failed!");
+    return -EINPROGRESS;
+  }
+
+  // -- Check ptr to output container
+  if ( !fJets ) {
+    HLTError( "Ptr to output container not set!");
+    return -EINPROGRESS;
+  }
+
+  return iResult;
+}
+
+// #################################################################################
+void AliHLTJETConeFinder::Reset() {
+  // see header file for class documentation
+
+  // -- Reset reader
+  (dynamic_cast<AliHLTJETReader*> (fReader))->ResetEvent();
+
+  // -- Reset output container
+  if (fJets)
+    fJets->Reset();
+  
+  return;
+}
+
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                      Process
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Bool_t AliHLTJETConeFinder::ProcessEvent() {
+  // see header file for class documentation
+
+  // -- Pick up jet reader
+  AliHLTJETReader *reader = dynamic_cast<AliHLTJETReader*> (fReader);
+
+  // -- Reset
+  Reset();
+
+  // -- Fill Grid
+  if ( !reader->FillGrid() ){
+    HLTError("Error filling grid.");
+    return kFALSE;  
+  }
+
+  // -- Find Leading
+  if ( FindConeLeading()  ) {
+    HLTError("Error finding leading.");
+    return kFALSE;
+  }
+
+  // -- Find Jets 
+  if ( FindConeJets()  ) {
+    HLTError("Error finding jets.");
+    return kFALSE;
+  }
+
+  // -- Fill Jets and apply jet cuts
+  if ( FillConeJets()  ) {
+    HLTError("Error filling jets.");
+    return kFALSE;
+  }
+
+  return kTRUE;
+}
+
+// #################################################################################
+Bool_t AliHLTJETConeFinder::ProcessConeEvent() {
+  // see header file for class documentation
+
+  // -- Find Leading
+  if ( FindConeLeading()  ) {
+    HLTError("Error finding leading.");
+    return kFALSE;
+  }
+
+  // -- Find Jets 
+  if ( FindConeJets()  ) {
+    HLTError("Error finding jets.");
+    return kFALSE;
+  }
+
+  // -- Fill Jets and apply jet cuts
+  if ( FillConeJets()  ) {
+    HLTError("Error filling jets.");
+    return kFALSE;
+  }
+
+  return kTRUE;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                             Process - private
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Int_t AliHLTJETConeFinder::FindConeLeading() {
+  // see header file for class documentation
+
+  // -- Pick up jet reader
+  AliHLTJETReader *reader = dynamic_cast<AliHLTJETReader*> (fReader);
+  
+  // -- Pick up jet canidates
+  TClonesArray* jetCandidates = reader->GetJetCandidates();
+  
+  // -- Sort jet candidates with seed pt 
+  jetCandidates->Sort();
+  // -- Use leading seed only
+  //    Keep index 0, remove the others
+  if ( (dynamic_cast<AliHLTJETConeHeader*> (fHeader))->GetUseLeading() ) {
+    
+    for ( Int_t iter = 1; iter < reader->GetNJetCandidates(); iter++ )
+      jetCandidates->RemoveAt(iter);
+    
+    reader->SetNJetCandidates(1);
+  }
+  
+  // -- Resize the seed TClonesArray
+  jetCandidates->Compress();
+
+  return 0;
+}
+
+// #################################################################################
+Int_t AliHLTJETConeFinder::FindConeJets() {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+
+  // -- Pick up jet reader
+  AliHLTJETReader *reader = dynamic_cast<AliHLTJETReader*> (fReader);
+   
+  // -- Pick up jet canidates
+  TClonesArray* jetCandidates = reader->GetJetCandidates();
+
+  // -- Loop over jet candidates
+  for ( Int_t iter = 0; iter < reader->GetNJetCandidates(); iter++ ) {
+    
+    AliHLTJETConeJetCandidate* jet = reinterpret_cast<AliHLTJETConeJetCandidate*> ((*jetCandidates)[iter]);
+    
+    // -- Set iterator for cells around seed
+    fGrid->SetCellIter( jet->GetSeedEtaIdx(), jet->GetSeedPhiIdx() ); 
+
+    Int_t cellIdx = 0;
+    
+    // -- Loop over cells around ssed
+    while ( (cellIdx = fGrid->NextCell() ) != -1 && !iResult) {
+
+      AliHLTJETConeEtaPhiCell* cell = NULL;
+      if ( ! (cell = reinterpret_cast<AliHLTJETConeEtaPhiCell*>(fGrid->UncheckedAt(cellIdx))) )
+       continue;
+      
+      if ( ( iResult = jet->AddCell(cell) ) ) {
+       HLTError( "Error adding cell %d to jet candiate %d", cellIdx, iter);
+       continue;
+      }
+    } // while ( (cellIdx = fGrid->NextCell() ) != -1 && !iResult) {
+    
+  } // for ( Int_t iter = 0; iter < reader->GetNJetCandidates(); iter++ ) {
+  
+  return iResult;
+}
+
+// #################################################################################
+Int_t AliHLTJETConeFinder::FillConeJets() {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+
+  // -- Pick up jet reader
+  AliHLTJETReader *reader = dynamic_cast<AliHLTJETReader*> (fReader);
+
+  // -- Pick up jet header
+  AliHLTJETConeHeader *header = dynamic_cast<AliHLTJETConeHeader*> (fHeader);
+  
+  // -- Get jet canidates
+  TClonesArray* jetCandidates = reader->GetJetCandidates();
+  
+  // -- Get jet cuts
+  AliHLTJETJetCuts* jetCuts = header->GetJetCuts();
+
+  // -- Loop over jet candidates
+  for ( Int_t iter = 0; iter < reader->GetNJetCandidates(); iter++ ) {
+    
+    AliHLTJETConeJetCandidate* jet = reinterpret_cast<AliHLTJETConeJetCandidate*> ((*jetCandidates)[iter]);
+  
+    // -- Apply jet cuts 
+    if ( ! jetCuts->IsSelected(jet) )
+      continue;
+
+    // -- Add jet as AliAODJet
+    fJets->AddJet(jet);
+
+  } // for ( Int_t iter = 0; iter < reader->GetNJetCandidates(); iter++ ) {
+  
+  HLTDebug( "Added %d jets", fJets->GetNAODJets());
+
+  return iResult;
+}
diff --git a/HLT/JET/cone/AliHLTJETConeFinder.h b/HLT/JET/cone/AliHLTJETConeFinder.h
new file mode 100644 (file)
index 0000000..c46f66d
--- /dev/null
@@ -0,0 +1,173 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETConeFinder.h  $
+
+#ifndef ALIHLTJETCONEFINDER_H
+#define ALIHLTJETCONEFINDER_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETConeFinder.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Jet cone finder
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliJetFinder.h"
+
+#include "AliHLTLogging.h"
+#include "AliHLTJETBase.h"
+
+#include "AliHLTJETJets.h"
+#include "AliHLTJETConeGrid.h"
+
+/**
+ * @class  AliHLTJETConeFinder
+ * ConeFinder for jet finder
+ *
+ * <b>Usage in off-line</b><br>
+ *  * Initialization phase :
+ *      <pre>jetFinder->Init();</pre> 
+ *  * Set the input event via the reader
+ *      <pre>jetReader->SetInputEvent( ... )</pre>
+ *  * Process one event
+ *      <pre>jetFinder->ProcessEvent();</pre>
+ *
+ * <b>Usage in on-line</b><br>
+ *  * Initialization phase :
+ *      <pre>jetFinder->Initialize();</pre> 
+ *  * Reset
+        <pre>jetFinder->Reset();</pre>
+ *  * Set the input event via the reader
+ *      <pre>jetReader->SetInputEvent( ... )</pre>
+ *  * Process one event
+ *      <pre>jetReader->FillGridXXX();</pre> 
+ *       Where XXX is has to be replaced by MC, ESD or AOD, depending
+ *       on the input object
+ *      <pre>jetFinder->ProcessConeEvent();</pre>
+ *   
+ * @ingroup alihlt_jet_cone
+ */
+
+class AliHLTJETConeFinder : public AliJetFinder, public AliHLTLogging {
+  
+public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** standard constructor */
+  AliHLTJETConeFinder();
+
+  /** destructor */
+  virtual ~AliHLTJETConeFinder();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                    Initialize
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Initialize the jet finder and the search grid
+   *  ONLY for use in off-line ... it inherits from a virtual void ?!?!
+   */
+  void Init() { Initialize(); }
+
+  /** Initialize the jet finder and the search grid
+   *  @return 0 on success, < 0 on failure
+   */
+  Int_t Initialize();
+
+  /** Reset for next event */
+  void Reset();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Setter
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Set ptr to output container */
+  void SetOutputJets( AliHLTJETJets* jets ) { fJets = jets; }
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                      Process
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Process one event
+   *  ONLY for use in off-line ... it inherits from a virtual Bool_t
+   *  @return kTRUE on success, kFALSE on failure
+   */
+  Bool_t ProcessEvent();
+  
+  /** Process one event
+   *  @return kTRUE on success, kFALSE on failure
+   */
+  Bool_t ProcessConeEvent();
+
+  /** Find jets in one event
+   *  ONLY for use in off-line ... it inherits from a virtual void ?!?!
+   */
+  void FindJets() { FindConeJets(); }
+
+  ///////////////////////////////////////////////////////////////////////////////////
+
+private:
+
+  /** copy constructor prohibited */
+  AliHLTJETConeFinder (const AliHLTJETConeFinder&);
+
+  /** assignment operator prohibited */
+  AliHLTJETConeFinder& operator= (const AliHLTJETConeFinder&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Process - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Sort seed descending in pt
+   *  if header::fUseLeading only is set, keep only seed with highest pt
+   *  @return 0 on success, < 0 on failure
+   */ 
+  Int_t FindConeLeading();
+
+  /** Find jets in one event
+   *  @return 0 on success, < 0 on failure
+   */
+  Int_t FindConeJets();
+
+  /** Fill jets in output container and apply cuts
+   *  @return 0 on success, < 0 on failure
+   */
+  Int_t FillConeJets();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Grid for cone finder */
+  AliHLTJETConeGrid           *fGrid;           //! transient
+
+  AliHLTJETJets               *fJets;           //! transient
+
+  ClassDef(AliHLTJETConeFinder, 1)
+
+};
+#endif
+
diff --git a/HLT/JET/cone/AliHLTJETConeGrid.cxx b/HLT/JET/cone/AliHLTJETConeGrid.cxx
new file mode 100644 (file)
index 0000000..82405dc
--- /dev/null
@@ -0,0 +1,402 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETConeGrid.cxx  $
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLTJETConeGrid.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Eta-Phi grid of the cone finder
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "AliHLTJETConeGrid.h"
+#include "AliHLTJETConeEtaPhiCell.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETConeGrid)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+  
+// #################################################################################
+AliHLTJETConeGrid::AliHLTJETConeGrid()
+  : 
+  fGrid(NULL),
+  fEtaMin(-0.9),
+  fEtaMax(0.9),
+  fPhiMin(0.0),
+  fPhiMax(6.3),
+  fEtaRange(1.8),
+  fPhiRange(6.3),
+  fEtaBinning(0.05),
+  fPhiBinning(0.05),
+  fEtaNGridBins(-1),
+  fPhiNGridBins(-1),
+  fNBins(-1),
+  fEtaNRBins(-1),
+  fPhiNRBins(-1),
+  fEtaIdxCurrent(0),
+  fEtaIdxMin(0),
+  fEtaIdxMax(0),
+  fPhiIdxCurrent(0),
+  fPhiIdxMin(0),
+  fPhiIdxMax(0),
+  fConeRadius(0.0) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+// #################################################################################
+AliHLTJETConeGrid::~AliHLTJETConeGrid() {
+  // see header file for class documentation
+  if ( fGrid ) {
+    fGrid->Clear("C");
+    delete fGrid;
+  }
+  fGrid = NULL;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                   Setup / Reset
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Int_t AliHLTJETConeGrid::Initialize() {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+
+  // -- Set total N bins in eta and phi
+  fEtaNGridBins = TMath::CeilNint( fEtaRange / fEtaBinning );
+  fPhiNGridBins = TMath::CeilNint( fPhiRange / fPhiBinning );
+
+  // -- Set total number of bins
+  fNBins = fEtaNGridBins * fPhiNGridBins;
+
+  // -- Set cells around R in eta and phi
+  fEtaNRBins = TMath::CeilNint( fConeRadius / fEtaBinning );
+  fPhiNRBins = TMath::CeilNint( fConeRadius / fPhiBinning );
+
+  HLTInfo(" -= Grid =- ");
+  HLTInfo(" NGridBins (%d,%d)", fEtaNGridBins, fPhiNGridBins);
+  HLTInfo(" NRBins    (%d,%d)", fEtaNRBins   , fPhiNRBins);
+  HLTInfo(" NBins      %d", fNBins );
+
+  fGrid = new TClonesArray("AliHLTJETConeEtaPhiCell", fNBins );
+  
+  if ( ! fGrid ) {
+    HLTError( "Error: Setup search grid with size %d .", fNBins );
+    iResult = 1;
+  }
+
+  return iResult;
+}
+
+// #################################################################################
+void AliHLTJETConeGrid::Reset() { 
+  // see header file for class documentation
+
+  if ( fGrid )
+    fGrid->Clear("C");
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                    Process
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Int_t AliHLTJETConeGrid::FillTrack( TParticle* particle, const Float_t* aEtaPhi, Int_t* aGridIdx ) {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+
+  // ---------------------------
+  // -- Get Cell Indices
+  // ---------------------------
+  iResult = GetCellIndex( aEtaPhi, aGridIdx );
+  if ( iResult < 0 ) {
+    HLTError("Error getting cell index");
+    return iResult;
+  }
+
+  // ---------------------------
+  // -- Fill track in primary region
+  // ---------------------------
+  
+  // -- Create new cell and add track to cell
+  if (! fGrid->UncheckedAt( aGridIdx[kIdxPrimary] ) ) {
+    new( (*fGrid ) [aGridIdx[kIdxPrimary]] ) AliHLTJETConeEtaPhiCell( aGridIdx[kIdxEtaPrimary], 
+                                                                     aGridIdx[kIdxPhiPrimary], 
+                                                                     particle );
+  }
+  // -- Add track to existing cell
+  else {
+    (reinterpret_cast<AliHLTJETConeEtaPhiCell*> ((*fGrid)[aGridIdx[kIdxPrimary]]))->AddTrack(particle);
+  }
+
+  // ---------------------------
+  // -- Fill track in outter region
+  // ---------------------------
+  
+  // -- if it has to be filled
+  if ( iResult == 1 ) {
+
+    // -- Create new cell and add track to cell
+    if (! fGrid->UncheckedAt( aGridIdx[kIdxOutter] ) ) {
+      new( (*fGrid) [aGridIdx[kIdxOutter]] ) AliHLTJETConeEtaPhiCell( aGridIdx[kIdxEtaPrimary], 
+                                                                     aGridIdx[kIdxPhiOutter], 
+                                                                     particle );
+    }
+    // -- Add track to existing cell
+    else {
+      (reinterpret_cast<AliHLTJETConeEtaPhiCell*> ((*fGrid)[aGridIdx[kIdxOutter]]))->AddTrack(particle);
+    }
+  }
+
+  return 0;
+}
+
+//##################################################################################
+Int_t AliHLTJETConeGrid::FillTrack( AliESDtrack *esdTrack, const Float_t* aEtaPhi, Int_t* aGridIdx ) {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+  // ---------------------------
+  // -- Get Cell Indices
+  // ---------------------------
+
+  iResult = GetCellIndex( aEtaPhi, aGridIdx );
+  if ( iResult < 0 ) {
+    return iResult;
+  }
+    
+  // ---------------------------
+  // -- Fill track in primary region
+  // ---------------------------
+  
+  // -- Create new cell and add track to cell
+  if (! fGrid->UncheckedAt( aGridIdx[kIdxPrimary] ) ) {
+    new( (*fGrid ) [aGridIdx[kIdxPrimary]] ) AliHLTJETConeEtaPhiCell( aGridIdx[kIdxEtaPrimary], 
+                                                                     aGridIdx[kIdxPhiPrimary], 
+                                                                     esdTrack );
+  }
+  // -- Add track to existing cell
+  else {
+    (reinterpret_cast<AliHLTJETConeEtaPhiCell*> ((*fGrid)[aGridIdx[kIdxPrimary]]))->AddTrack(esdTrack);
+  }
+   
+  // ---------------------------
+  // -- Fill track in outter region
+  // ---------------------------
+  
+  // -- if it has to be filled
+  if ( iResult == 1 ) {
+    
+    // -- Create new cell and add track to cell
+    if (! fGrid->UncheckedAt( aGridIdx[kIdxOutter] ) ) {
+      new( (*fGrid) [aGridIdx[kIdxOutter]] ) AliHLTJETConeEtaPhiCell( aGridIdx[kIdxEtaPrimary], 
+                                                                     aGridIdx[kIdxPhiOutter], 
+                                                                     esdTrack );
+    }
+    // -- Add track to existing cell
+    else {
+      (reinterpret_cast<AliHLTJETConeEtaPhiCell*> ((*fGrid)[aGridIdx[kIdxOutter]]))->AddTrack(esdTrack);
+    }
+  }
+  
+  return 0;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                             Helper - public
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Int_t AliHLTJETConeGrid::NextCell() {
+  // see header file for class documentation
+
+  Int_t cellIdx = 0;
+
+  ++fPhiIdxCurrent;
+  
+  if ( fPhiIdxCurrent > fPhiIdxMax ) {
+    fPhiIdxCurrent = fPhiIdxMin;
+
+    ++fEtaIdxCurrent;
+    
+    if ( fEtaIdxCurrent > fEtaIdxMax )
+      cellIdx = -1;
+  }
+
+  if ( cellIdx != -1 ) 
+    cellIdx = fEtaIdxCurrent + ( fPhiIdxCurrent * fEtaNGridBins );
+
+  if ( cellIdx > fNBins ) {
+    HLTError("Idx out of bound (%d,%d) -> %d", fEtaIdxCurrent, fPhiIdxCurrent, cellIdx );
+    HLTError("MAX %d,%d - %d", fEtaNGridBins, fPhiNGridBins, fNBins );
+
+    cellIdx = -1;
+  }
+
+  return cellIdx;
+}
+
+// #################################################################################
+void AliHLTJETConeGrid::SetCellIter( const Int_t etaIdx, const Int_t phiIdx ) {
+  // see header file for class documentation
+
+  fEtaIdxMax = etaIdx + fEtaNRBins;
+  fEtaIdxMin = etaIdx - fEtaNRBins;
+  fEtaIdxCurrent = fEtaIdxMin;
+
+  fPhiIdxMax = phiIdx + fPhiNRBins;
+  fPhiIdxMin = phiIdx - fPhiNRBins;
+  fPhiIdxCurrent = fPhiIdxMin - 1;
+
+  return;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                             Helper - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Int_t AliHLTJETConeGrid::GetCellIndex( const Float_t* aEtaPhi, Int_t* aGridIdx ) {
+  // see header file for class documentation
+
+  Int_t iResult = 0;
+
+  // -- Prime is relative to (0,0) in grid which is (-fEtaMax,-fConeRadius)
+  Float_t etaPrime = fEtaMax + aEtaPhi[kIdxEta];
+  Float_t phiPrime = aEtaPhi[kIdxPhi] + fConeRadius;
+
+  HLTDebug("eta    : %f - phi :%f", aEtaPhi[kIdxEta], aEtaPhi[kIdxPhi] );
+  HLTDebug("eta\'   : %f - phi\':%f", etaPrime, phiPrime );
+
+  // -- Index in 2D (idxEta,idxPhi) 
+  aGridIdx[kIdxEtaPrimary] = TMath::FloorNint( etaPrime / fEtaBinning );
+  aGridIdx[kIdxPhiPrimary] = TMath::FloorNint( phiPrime / fPhiBinning );
+  // -- Index in 1D 
+  aGridIdx[kIdxPrimary] = aGridIdx[kIdxEtaPrimary] + ( aGridIdx[kIdxPhiPrimary] * fEtaNGridBins );
+  
+  // -- Boundery Check 2D
+  if ( (aGridIdx[kIdxEtaPrimary] < 0) || 
+       (aGridIdx[kIdxPhiPrimary] < 0) || 
+       (aGridIdx[kIdxEtaPrimary] >= fEtaNGridBins) || 
+       (aGridIdx[kIdxPhiPrimary] >= fPhiNGridBins) ) {
+    HLTError ( "Index out of range: idxEta %d - max %d, idxPhi %d - max %d", 
+              aGridIdx[kIdxEtaPrimary], fEtaNGridBins, 
+              aGridIdx[kIdxPhiPrimary], fPhiNGridBins);
+    iResult = -1;
+  }
+
+  // -- Boundery Check 1D
+  if ( (aGridIdx[kIdxPrimary] < 0) ||
+       (aGridIdx[kIdxPrimary] >= fNBins) ) {
+    HLTError( "Index out of range: 1D idx %d - max %d", 
+             aGridIdx[kIdxPrimary], fNBins );
+    iResult = -2;
+  }
+  
+  HLTDebug( "idxEta %d - max %d, idxPhi %d - max %d", 
+           aGridIdx[kIdxEtaPrimary], fEtaNGridBins, 
+           aGridIdx[kIdxPhiPrimary], fPhiNGridBins);
+  HLTDebug( "1D idx %d - max %d", aGridIdx[kIdxPrimary], fNBins );
+  
+  if ( iResult ) 
+    return iResult;
+
+  // -- check if to map from border region to outter region
+  Float_t phiOutterPrime = 0.0;
+  
+  // -- upper border
+  if ( aEtaPhi[kIdxPhi] > ( fPhiMax - fConeRadius ) ) {
+    phiOutterPrime = phiPrime - fPhiMax;
+    iResult = 1;  
+
+    HLTDebug("eta    : %f - phiOutter :%f .", aEtaPhi[kIdxEta], aEtaPhi[kIdxPhi] - fPhiMax );
+    HLTDebug("eta\'   : %f - phiOutter\':%f .", etaPrime, phiOutterPrime );
+  }
+  // -- lower border
+  else if ( aEtaPhi[kIdxPhi] < fConeRadius ) {
+    phiOutterPrime = phiPrime + fPhiMax;
+    iResult = 1;
+
+    HLTDebug("eta    : %f - phiOutter :%f .", aEtaPhi[kIdxEta], aEtaPhi[kIdxPhi] + fPhiMax );
+    HLTDebug("eta\'   : %f - phiOutter\':%f .", etaPrime, phiOutterPrime );
+  }
+  
+  // -- if outter phi present
+  if ( iResult == 1 ) {
+
+    // -- Index in 2D (idxEta,idxPhiOutter) 
+    aGridIdx[kIdxPhiOutter] = TMath::FloorNint( phiOutterPrime / fPhiBinning );
+
+    // -- Index in 1D
+    aGridIdx[kIdxOutter] = aGridIdx[kIdxEtaPrimary] + ( aGridIdx[kIdxPhiOutter] * fEtaNGridBins );
+  
+    // -- Boundery Check 2D
+    if ( aGridIdx[kIdxPhiOutter] < 0 || aGridIdx[kIdxPhiOutter] >= fPhiNGridBins ) {
+      HLTError( "Index out of range ( Outter Phi ): idxPhiOutter %d - max %d", 
+               aGridIdx[kIdxPhiOutter], fPhiNGridBins);
+      iResult = -3;
+    }
+    
+    // -- Boundery Check 1D
+    if ( aGridIdx[kIdxOutter] >= fNBins ) {
+      HLTError( "Index out of range ( Outter Phi ): 1D idx %d - max %d", 
+               aGridIdx[kIdxOutter], fNBins );
+      iResult = -4;
+    }
+
+    HLTDebug( "idxEta %d - max %d, idxPhiOutter %d - max %d", 
+             aGridIdx[kIdxEtaPrimary], fEtaNGridBins, aGridIdx[kIdxPhiOutter], fPhiNGridBins);
+    HLTDebug( "1D idx %d - max %d", aGridIdx[kIdxOutter], fNBins );
+  }
+
+  return iResult;
+}
diff --git a/HLT/JET/cone/AliHLTJETConeGrid.h b/HLT/JET/cone/AliHLTJETConeGrid.h
new file mode 100644 (file)
index 0000000..06fff7f
--- /dev/null
@@ -0,0 +1,267 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETConeGrid.h  $
+
+#ifndef ALIHLTJETCONEGRID_H
+#define ALIHLTJETCONEGRID_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETConeGrid.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Eta-Phi grid of the cone finder
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+
+#include "TClonesArray.h"
+#include "TParticle.h"
+
+#include "AliESDtrack.h"
+
+#include "AliHLTLogging.h"
+#include "AliHLTJETBase.h"
+
+/**
+ * @class  AliHLTJETConeGrid
+ * Eta-Phi grid of the cone finder
+ *
+ * @ingroup alihlt_jet_cone
+ */
+
+class AliHLTJETConeGrid : public AliHLTLogging, public TObject  {
+  
+public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** standard constructor */
+  AliHLTJETConeGrid();
+
+  /** destructor */
+  virtual ~AliHLTJETConeGrid();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                    Process
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Fill particle into grid -> into cell
+   *  retrieve the grid indeces and get (eta,phi,pt) of the particle
+   *  @param esdTrack ptr to track
+   *  @param aEtaPhi  array to be filled with (eta,phi,pt) of the particle
+   *  @param aGridIdx array to be filled with grid indeces
+   *  @return 0 on sucess, < 0 for error
+   */
+  Int_t FillTrack( TParticle* particle, const Float_t* aEtaPhi, Int_t* aGridIdx );
+
+  /** Fill track into grid -> into cell
+   *  retrieve the grid indeces and get (eta,phi,pt) of the track
+   *  @param esdTrack ptr to track
+   *  @param aEtaPhi  array to be filled with (eta,phi,pt) of the track
+   *  @param aGridIdx array to be filled with grid indeces
+   *  @return 0 on sucess, < 0 for error
+   */
+  Int_t FillTrack( AliESDtrack* esdTrack, const Float_t* aEtaPhi, Int_t* aGridIdx );
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                   Initialize / Reset
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Initialize grid 
+   *  @return 0 on sucess, < 0 for error
+   */
+  Int_t Initialize();
+
+  /** Reset grid */
+  void Reset();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Setter
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Set eta range parameters */
+  void SetEtaRange( Float_t etaMin, Float_t etaMax, Float_t etaRange ) 
+  { fEtaMin = etaMin; fEtaMax = etaMax; fEtaRange = etaRange; }
+
+  /** Set eta range parameters */
+  void SetPhiRange( Float_t phiMin, Float_t phiMax, Float_t phiRange ) 
+  { fPhiMin = phiMin; fPhiMax = phiMax; fPhiRange = phiRange; }
+
+  /** Set binning */
+  void SetBinning( Float_t etaBinning, Float_t phiBinning ) 
+  { fEtaBinning = etaBinning; fPhiBinning = phiBinning; }
+  
+  /** Set cone radius */
+  void SetConeRadius( Float_t coneRadius) { fConeRadius = coneRadius; }
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Helper - public
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Next cell
+   *  Returns idx for the next cell in around seed
+   *  @return idx, -1 if false
+   */
+  Int_t NextCell();
+  
+  /** Seed cell iterator
+   *  Sets cell iterator for the NextCell method for
+   *  a given seed
+   *  @param etaIdx Eta index of seed
+   *  @param phiIdx Phi index of seed
+   */
+  void SetCellIter( const Int_t etaIdx, const Int_t phiIdx );
+
+
+  /** Check if there is an object at cellIdx in fGrid
+   *  @param   cellIdx    CellIdx where there coulf be an object
+   *  @return             ptr to cell, NULL if empty
+   */
+  TObject* UncheckedAt( Int_t cellIdx ) { return fGrid->UncheckedAt(cellIdx); }
+  
+
+  //  reinterpret_cast<AliHLTJETConeEtaPhiCell*>((*fGrid)[cellIdx])
+  //if ( ( iResult = jet->AddCell(fGrid->GetCell(cellIdx)) ) ) {
+
+
+
+  ///////////////////////////////////////////////////////////////////////////////////
+
+private:
+
+  /** copy constructor prohibited */
+  AliHLTJETConeGrid (const AliHLTJETConeGrid&);
+
+  /** assignment operator prohibited */
+  AliHLTJETConeGrid& operator= (const AliHLTJETConeGrid&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Helper - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Get Cell index out of eta and phi
+   *  @param aEtaPhi  input structure containing eta,phi
+   *                  [0] = eta,    
+   *                  [1] = phi
+   *  @param aGridIdx output structure containing grid index
+   *                  [0] = 1D  index in primary region
+   *                  [1] = 1D  index in outter region
+   *                  [2] = eta index in primary region
+   *                  [3] = phi index in primary region
+   *                  [4] = phi index in outter region
+   *  @return  0 on sucess, 1 for outter phi present, <0 for error
+   */
+  Int_t GetCellIndex( const Float_t* aEtaPhi, Int_t* aGridIdx );
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  // -- Cells
+
+  /** Search Grid */
+  TClonesArray*  fGrid;                    //! transient
+
+  // -- Grid boundaries in eta and phi - set via setter
+
+  /** Minimum eta */
+  Float_t        fEtaMin;                  // see above
+
+  /** Maximum eta */
+  Float_t        fEtaMax;                  // see above
+
+  /** Minimum phi */
+  Float_t        fPhiMin;                  // see above
+
+  /** Maximum phi */
+  Float_t        fPhiMax;                  // see above
+
+  /** Total eta range */
+  Float_t        fEtaRange;                // see above
+
+  /** Total phi range 
+   *  abs(phimin)+phiMax + 2*coneRadius;
+   */
+  Float_t        fPhiRange;                // see above
+
+  // -- Grid parameter - set via setter
+  
+  /** Binning in eta */
+  Float_t        fEtaBinning;              // see above
+
+  /** Binning in phi */
+  Float_t        fPhiBinning;              // see above
+
+  // -- Number of bins in eta and phi - set via Initialize()
+
+  /** Number of grid bins in eta */
+  Int_t          fEtaNGridBins;            // see above
+
+  /** Number of grid bins in phi */
+  Int_t          fPhiNGridBins;            // see above
+
+  /** Total number of bins */
+  Int_t          fNBins;                   // see above
+
+  // -- Bins around R - set via Initialize()
+
+  /** Number of grid bins in eta in R */
+  Int_t          fEtaNRBins;               // see above
+
+  /** Number of grid bins in phi in R */
+  Int_t          fPhiNRBins;               // see above
+
+  // -- Cell iterator - set in SetCellIter()
+
+  /** Eta Idx - current */
+  Int_t          fEtaIdxCurrent;           // see above
+
+  /** Eta Idx - min */
+  Int_t          fEtaIdxMin;               // see above
+
+  /** Eta Idx - max */
+  Int_t          fEtaIdxMax;               // see above
+
+  /** Phi Idx - current */
+  Int_t          fPhiIdxCurrent;           // see above
+
+  /** Phi Idx - min */
+  Int_t          fPhiIdxMin;               // see above
+
+  /** Phi Idx - max */
+  Int_t          fPhiIdxMax;               // see above
+
+  // -- Cone radius - set via setter
+
+  /** Cone radius */
+  Float_t        fConeRadius;              // see above
+
+  ClassDef(AliHLTJETConeGrid, 1)
+
+};
+#endif
+
diff --git a/HLT/JET/cone/AliHLTJETConeHeader.cxx b/HLT/JET/cone/AliHLTJETConeHeader.cxx
new file mode 100644 (file)
index 0000000..4890d45
--- /dev/null
@@ -0,0 +1,79 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETConeHeader.cxx  $
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLTJETConeHeader.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Header of the cone finder
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "AliHLTJETConeHeader.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETConeHeader)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+  
+// #################################################################################
+AliHLTJETConeHeader::AliHLTJETConeHeader()
+  : 
+  AliJetHeader("AliHLTJETConeHeader"),
+  fJetCuts(NULL),
+  fUseLeading(kFALSE) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+// #################################################################################
+AliHLTJETConeHeader::~AliHLTJETConeHeader() {
+  // see header file for class documentation
+
+}
+/*
+ * ---------------------------------------------------------------------------------
+ *                                    Initialize
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Int_t AliHLTJETConeHeader::Initialize() {
+  // see header file for class documentation
+
+  HLTInfo(" -= AliHLTJETHeader =- " );
+
+  return 0;
+}
diff --git a/HLT/JET/cone/AliHLTJETConeHeader.h b/HLT/JET/cone/AliHLTJETConeHeader.h
new file mode 100644 (file)
index 0000000..25a3388
--- /dev/null
@@ -0,0 +1,125 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETConeHeader.h $
+
+#ifndef ALIHLTJETCONEHEADER_H
+#define ALIHLTJETCONEHEADER_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETConeHeader.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Header of the cone finder
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliJetHeader.h"
+
+#include "AliHLTLogging.h"
+#include "AliHLTJETBase.h"
+
+#include "AliHLTJETJetCuts.h"
+
+/**
+ * @class  AliHLTJETConeHeader
+ * Header of the cone finder
+ *
+ * @ingroup alihlt_jet_cone
+ */
+
+class AliHLTJETConeHeader : public AliJetHeader, public AliHLTLogging {
+  
+public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** standard constructor */
+  AliHLTJETConeHeader();
+
+  /** destructor */
+  virtual ~AliHLTJETConeHeader();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                    Initialize
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Initialize the jet header
+   *  @return 0 on success, < 0 on failure
+   */
+  Int_t Initialize();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Setter
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Set Analysis Cuts
+   *  @param cuts ptr to AliHLTJETJetCuts 
+   */
+  void SetJetCuts( AliHLTJETJetCuts* cuts )  { fJetCuts = cuts; }
+  /** Set flag to use only leading seed */
+  void SetUseLeading( Bool_t b ) { fUseLeading = b; }
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Getter
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Get Analysis Cuts
+   *  @return ptr to AliHLTJETJetCuts 
+   */
+  AliHLTJETJetCuts* GetJetCuts()     { return fJetCuts; }
+
+  /** Get flag to use only leading seed 
+   *  @return   if kTRUE, only leading seed is used
+   */
+  Bool_t GetUseLeading() { return fUseLeading; }
+
+  ///////////////////////////////////////////////////////////////////////////////////
+
+private:
+
+  /** copy constructor prohibited */
+  AliHLTJETConeHeader (const AliHLTJETConeHeader&);
+
+  /** assignment operator prohibited */
+  AliHLTJETConeHeader& operator= (const AliHLTJETConeHeader&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Cuts on jet selection */
+  AliHLTJETJetCuts          *fJetCuts;              //! transient
+  
+  /** if kTRUE, only leading seed is used */
+  Bool_t                     fUseLeading;           // see above
+
+  /*
+    Int_t                      fgFinderType;
+  */
+
+  ClassDef(AliHLTJETConeHeader, 1)
+
+};
+#endif
+
diff --git a/HLT/JET/cone/AliHLTJETConeJetCandidate.cxx b/HLT/JET/cone/AliHLTJETConeJetCandidate.cxx
new file mode 100644 (file)
index 0000000..a722aba
--- /dev/null
@@ -0,0 +1,215 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETConeJetCandidate.cxx  $
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
+
+/** @file   AliHLTJETConeJetCandidate.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Jet candidate of the cone finder
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
+   using namespace std;
+#endif
+
+#include "AliHLTJETConeJetCandidate.h"
+#include "AliHLTJETConeEtaPhiCell.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETConeJetCandidate)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+  AliHLTJETConeJetCandidate::AliHLTJETConeJetCandidate() :
+    fSeedCellIdx(0.),
+    fSeedEtaIdx(0.),
+    fSeedPhiIdx(0.),
+    fSeedEta(0.),
+    fSeedPhi(0.),
+    fSeedPt(0.),
+    fEta(0.),
+    fPhi(0.),
+    fPt(0.),
+    fNTracks(0),
+    fUseWholeCell(kTRUE),
+    fConeRadius2(0.) {
+    // see header file for class documentation
+    // or
+    // refer to README to build package
+    // or
+    // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+
+//##################################################################################
+AliHLTJETConeJetCandidate::AliHLTJETConeJetCandidate( const Float_t* aEtaPhi, 
+                                                     const Int_t* aGridIdx, 
+                                                     Float_t coneRadius,
+                                                     Bool_t useWholeCell ) :
+  fSeedCellIdx(aGridIdx[kIdxPrimary]),
+  fSeedEtaIdx(aGridIdx[kIdxEtaPrimary]),
+  fSeedPhiIdx(aGridIdx[kIdxPhiPrimary]),
+  fSeedEta(aEtaPhi[kIdxEta]),
+  fSeedPhi(aEtaPhi[kIdxPhi]),
+  fSeedPt(aEtaPhi[kIdxPt]),
+  fEta(0.0),
+  fPhi(0.0),
+  fPt(0.0),
+  fNTracks(0),
+  fUseWholeCell(useWholeCell),
+  fConeRadius2(coneRadius*coneRadius) {
+  // see header file for class documentation
+}
+
+//##################################################################################
+AliHLTJETConeJetCandidate::~AliHLTJETConeJetCandidate() {
+  // see header file for class documentation
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                     Process 
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Int_t AliHLTJETConeJetCandidate::AddCell( AliHLTJETConeEtaPhiCell* cell ) {
+  // see header file for class documentation
+  
+  // -- use whole cell
+  // -------------------
+  if ( fUseWholeCell ) {
+    
+    fPt  += cell->GetPt();
+    fPhi += cell->GetPhi();
+    fEta += cell->GetEta();
+    fNTracks += cell->GetNTracks();
+    
+    HLTDebug("Cell : eta: %f - phi: %f - pt: %f - nTracks: %d .", 
+            cell->GetEta(), cell->GetPhi(), cell->GetPt(), cell->GetNTracks() );
+
+  } // if ( fUseWholeCell ) {
+
+  // -- radius compared to every track
+  // -----------------------------------
+  else {
+    
+    HLTDebug("Check NTracks %d.", cell->GetNTracks());
+
+    TObjArray* trackList = cell->GetTrackList();
+
+    // -- Loop over all tracks in cell
+    for ( Int_t iter = 0; iter < cell->GetNTracks(); iter++ ) {
+
+      // -- MC particles
+      if ( cell->GetTrackType() == kTrackMC ) {
+
+       TParticle* particle = reinterpret_cast<TParticle*> ((*trackList)[iter]);
+       
+       // -- Check if in cone
+       if ( ! InCone( particle->Eta(), particle->Phi() ) )
+         continue;
+       
+       fPt  += particle->Pt();
+       fPhi += particle->Phi();
+       fEta += particle->Eta();
+       ++fNTracks;
+      
+       HLTDebug("Particle : eta: %f - phi: %f - pt: %f .", 
+                particle->Eta(), particle->Phi(), particle->Pt() );
+      
+      }
+      else if ( cell->GetTrackType() == kTrackESD ) {
+
+       AliESDtrack* esdTrack = reinterpret_cast<AliESDtrack*> ((*trackList)[iter]);
+       
+       // -- Check if in cone
+       if ( ! InCone( esdTrack->Eta(), esdTrack->Phi() ) )
+         continue;
+       
+       fPt  += esdTrack->Pt();
+       fPhi += esdTrack->Phi();
+       fEta += esdTrack->Eta();
+       ++fNTracks;
+      
+       HLTDebug("ESDTrack : eta: %f - phi: %f - pt: %f .", 
+                esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt() );
+      }
+      else {
+       HLTError("Not implemented yet...");
+      }
+
+    } // for ( Int_t iter = 0; iter > cell->GetNTracks(); iter++ ) {
+  }
+  
+  return 0;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                Sort of JetCandidates 
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Int_t AliHLTJETConeJetCandidate::Compare( const TObject* obj) const {
+  // see header file for class documentation
+  
+  if (this == obj) 
+    return 0;
+    
+  if ( fSeedPt < (dynamic_cast<AliHLTJETConeJetCandidate*>
+                 ( const_cast<TObject*>(obj)))->GetSeedPt() ) 
+    return 1;
+  else 
+    return -1;
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                             Helper - private
+ * ---------------------------------------------------------------------------------
+ */
+
+//##################################################################################
+Float_t AliHLTJETConeJetCandidate::GetDistance2( const Float_t eta1, const Float_t phi1, 
+                                                const Float_t eta2, const Float_t phi2) {
+  // see header file for class documentation
+
+  return ( (eta1-eta2)*(eta1-eta2) ) + ( (phi1-phi2)*(phi1-phi2) );
+}
+
+//##################################################################################
+Bool_t AliHLTJETConeJetCandidate::InCone( Float_t eta, Float_t phi ) {
+  // see header file for class documentation
+
+  if ( GetDistance2(fSeedEta,fSeedPhi,eta,phi) <= fConeRadius2 )
+    return kTRUE;
+  else
+    return kFALSE;
+}
diff --git a/HLT/JET/cone/AliHLTJETConeJetCandidate.h b/HLT/JET/cone/AliHLTJETConeJetCandidate.h
new file mode 100644 (file)
index 0000000..02949f0
--- /dev/null
@@ -0,0 +1,225 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETConeJetCandidate.h $
+
+#ifndef ALIHLTJETCONEJETCANDIDATE_H
+#define ALIHLTJETCONEJETCANDIDATE_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETConeJetCandidate.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Jet candidate of the cone finder
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "TClonesArray.h"
+
+#include "AliHLTLogging.h"
+#include "AliHLTJETBase.h"
+
+class AliHLTJETConeEtaPhiCell;
+
+/**
+ * @class AliHLTJETConeJetCandidate
+ * This class is contstructed with a seed and contains a found jet 
+ * from the jet cone finder
+ * Two options exist: 
+ * <ul>
+ *    <li>Add up the whole cell to the jet candidate<li>
+ *    <li>Add up only patricles inside the coneradius to the jet candidate<li>
+ * </ul>
+ *
+ * @ingroup alihlt_jet_cone
+ */
+
+class AliHLTJETConeJetCandidate : public TObject, public AliHLTLogging {
+public:
+  
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Constructor 
+   *  @param aEtaPhi   eta and phi of the seed
+   *  @param aGridIdx  indeces in the grid
+   *  @param useWholeCell  XXXXX
+  */
+  AliHLTJETConeJetCandidate( const Float_t* aEtaPhi, const Int_t* aGridIdx, 
+                            Float_t coneRadius, Bool_t useWholeCell = kTRUE);
+
+  /** Destructor */
+  ~AliHLTJETConeJetCandidate();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Getter
+   * ---------------------------------------------------------------------------------
+   */
+
+  // -- Sees properties
+  
+  /** Get cell eta index of seed*/
+  Int_t         GetSeedEtaIdx()    { return fSeedEtaIdx; }
+
+  /** Get cell phi index of seed*/
+  Int_t         GetSeedPhiIdx()    { return fSeedPhiIdx; }
+
+  /** Get pt of seed */
+  Float_t       GetSeedPt()        { return fSeedPt; }  
+  
+  // -- Jet properties
+
+  /** Get eta of jet */
+  Float_t       GetEta()           { return ( (!fNTracks) ? 0. : fEta / fNTracks); } 
+
+  /** Get phi of jet  */
+  Float_t       GetPhi()           { return ( (!fNTracks) ? 0. : fPhi / fNTracks); } 
+
+  /** Get pt of jet */
+  Float_t       GetPt()            { return fPt; }  
+
+  /** Get Et of jet */
+  Float_t       GetEt()            { return fPt; }  
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Process 
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Add cell to JetCandidate 
+   *  @param cell ptr to cell
+   *  @return 0 on success, <0 on failure
+   */
+  Int_t AddCell( AliHLTJETConeEtaPhiCell* cell );
+
+
+
+  /* XXXXXXXXXX
+  void SetAll( Float_t pt, Float_t eta, Float_t phi, Int_t nTracks, Bool_t useWholeCell) {
+    fPt = pt; 
+    fEta = eta*nTracks; 
+    fPhi = phi*nTracks; 
+    fNTracks = nTracks; 
+    fUseWholeCell = useWholeCell; 
+  }
+  */
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                Sort of JetCandidates 
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Compare this class with an other instance of this class
+   *  used in a TClonesArray::Sort() 
+   *  @param   obj  ptr to other instance  
+   *  @return  Returns 0 when equal, 1 when this is smaller 
+   *  and -1 when bigger -- sorts descending
+   */
+  Int_t Compare( const TObject* obj) const;
+
+
+  /** Defines this class as being sortable in a TClonesArray
+   *  @return     always kTRUE;
+   */
+  Bool_t IsSortable() const  { return kTRUE; }
+
+  ///////////////////////////////////////////////////////////////////////////////////
+  
+ private:
+  /** standard constructor prohibited */
+  AliHLTJETConeJetCandidate();
+
+  /** copy constructor prohibited */
+  AliHLTJETConeJetCandidate(const AliHLTJETConeJetCandidate&);
+
+  /** assignment operator prohibited */
+  AliHLTJETConeJetCandidate& operator=(const AliHLTJETConeJetCandidate&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Helper - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Get distance squared between two points in eta-phi
+   *  @param eta1    eta coordinate of first point
+   *  @param phi1    phi coordinate of first point
+   *  @param eta2    eta coordinate of second point
+   *  @param phi2    phi coordinate of second point
+   *  @return        Distance squared
+   */
+  Float_t GetDistance2( const Float_t eta1, const Float_t phi1, 
+                       const Float_t eta2, const Float_t phi2);
+  
+  /** Check if particle is in side the cne
+   *  @param eta    eta coordinate 
+   *  @param phi    phi coordinate 
+   *  @return       kTRUE if it is, otherwise kFALSE
+   */
+  Bool_t InCone( Float_t eta, Float_t phi );
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  //  -- Seed cell index parameters
+
+  /** Seed cell index */
+  Int_t                  fSeedCellIdx;      // see above
+
+  /** Seed cell eta index */ 
+  Int_t                  fSeedEtaIdx;       // see above
+
+  /** Seeed cell phi index */  
+  Int_t                  fSeedPhiIdx;       // see above
+
+  // -- Seed parameters
+
+  /** seed eta */
+  Float_t                fSeedEta;          // see above
+
+  /** seed phi */
+  Float_t                fSeedPhi;          // see above
+
+  /** seed pt */
+  Float_t                fSeedPt;           // see above
+
+  // -- Summed variables
+
+  /** Summed eta */
+  Float_t                fEta;              // see above
+
+  /** Summed phi */
+  Float_t                fPhi;              // see above
+
+  /** Summed pt */
+  Float_t                fPt;               // see above
+
+  /** Number of tracks in JetCandidate */
+  UInt_t                 fNTracks;          // see above
+
+  /** Flag if whole cell should be added, or every track */
+  Bool_t                 fUseWholeCell;     // see above
+
+  /** Cone radius squared */
+  Float_t                fConeRadius2;      // see above
+
+  ClassDef(AliHLTJETConeJetCandidate, 1)
+};
+#endif
diff --git a/HLT/JET/cone/AliHLTJETConeSeedCuts.cxx b/HLT/JET/cone/AliHLTJETConeSeedCuts.cxx
new file mode 100644 (file)
index 0000000..10a6d9b
--- /dev/null
@@ -0,0 +1,137 @@
+//-*- Mode: C++ -*-
+// $Id: AliHLTJETConeSeedCuts.cxx  $
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLTJETConeSeedCuts.cxx
+    @author Jochen Thaeder
+    @date   
+    @brief  Cuts for jet input tracks
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#if __GNUC__ >= 3
+using namespace std;
+#endif
+
+#include "AliHLTJETConeSeedCuts.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTJETConeSeedCuts)
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                            Constructor / Destructor
+ * ---------------------------------------------------------------------------------
+ */
+  
+// #################################################################################
+AliHLTJETConeSeedCuts::AliHLTJETConeSeedCuts(const Char_t* name, const Char_t* title )
+  : 
+  AliAnalysisCuts(name, title),
+  fPtMin(0.0),
+  fEtaMin(-0.9),
+  fEtaMax(0.9),
+  fPhiMin(0.0),
+  fPhiMax(6.3) {
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+}
+
+// #################################################################################
+AliHLTJETConeSeedCuts::~AliHLTJETConeSeedCuts() {
+  // see header file for class documentation
+
+}
+
+/*
+ * ---------------------------------------------------------------------------------
+ *                                   Selection
+ * ---------------------------------------------------------------------------------
+ */
+
+// #################################################################################
+Bool_t AliHLTJETConeSeedCuts::IsSelected( TObject *obj ) {
+  // see header file for class documentation
+
+  Bool_t bResult = kTRUE;
+
+  if ( ! strcmp(obj->ClassName(),"TParticle") )
+    bResult = IsSelected( dynamic_cast<TParticle*> (obj));
+  else if ( ! strcmp(obj->ClassName(),"AliESDtrack") )
+    bResult = IsSelected( dynamic_cast<AliESDtrack*> (obj));
+  else {
+    HLTError("Unknown object type %s", obj->ClassName() );
+    bResult = kFALSE;
+  }
+  
+   HLTError("Unknown object dd type %s", obj->ClassName() );
+
+  return bResult;
+}
+
+// #################################################################################
+Bool_t AliHLTJETConeSeedCuts::IsSelected( TParticle *particle ) {
+  // see header file for class documentation
+
+  Bool_t bResult = kTRUE;
+
+  // -- cut on min Pt
+  if ( particle->Pt() < fPtMin )
+    bResult = kFALSE;
+
+  // -- cut on eta acceptance
+  if ( ( particle->Eta() < fEtaMin ) || ( particle->Eta() > fEtaMax ) )
+    bResult = kFALSE;
+
+  // -- cut on phi acceptance
+  if ( ( particle->Phi() < fPhiMin ) || ( particle->Phi() > fPhiMax ) )
+    bResult = kFALSE;
+
+  return bResult;
+}
+
+// #################################################################################
+Bool_t AliHLTJETConeSeedCuts::IsSelected( AliESDtrack *esdTrack ) {
+  // see header file for class documentation
+
+  Bool_t bResult = kTRUE;
+
+  // -- cut on min Pt
+  if ( esdTrack->Pt() < fPtMin )
+    bResult = kFALSE;
+
+  // -- cut on eta acceptance
+  if ( ( esdTrack->Eta() < fEtaMin ) || ( esdTrack->Eta() > fEtaMax ) )
+    bResult = kFALSE;
+
+  cout << esdTrack->Phi() << endl;
+
+  // -- cut on phi acceptance
+  if ( ( esdTrack->Phi() < fPhiMin ) || ( esdTrack->Phi() > fPhiMax ) )
+    bResult = kFALSE;
+
+  return bResult;
+}
diff --git a/HLT/JET/cone/AliHLTJETConeSeedCuts.h b/HLT/JET/cone/AliHLTJETConeSeedCuts.h
new file mode 100644 (file)
index 0000000..1c17810
--- /dev/null
@@ -0,0 +1,136 @@
+//-*- Mode: C++ -*-
+
+// $Id: AliHLTJETConeSeedCuts.h $
+
+#ifndef ALIHLTJETCONESEEDCUTS_H
+#define ALIHLTJETCONESEEDCUTS_H
+
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTJETConeSeedCuts.h
+    @author Jochen Thaeder
+    @date   
+    @brief  Cuts for jet input tracks
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "TParticle.h"
+
+#include "AliAnalysisCuts.h"
+#include "AliESDtrack.h"
+
+#include "AliHLTLogging.h"
+#include "AliHLTJETBase.h"
+
+/**
+ * @class  AliHLTJETConeSeedCuts
+ * Cuts for seed MC tracks and ESD tracks 
+ *
+ * @ingroup alihlt_jet_cone
+ */
+
+class AliHLTJETConeSeedCuts : public AliAnalysisCuts, public AliHLTLogging {
+  
+public:
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                            Constructor / Destructor
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** constructor */
+  AliHLTJETConeSeedCuts(const Char_t* name = "AliHLTJETConeSeedCuts", 
+                       const Char_t* title = "");
+
+  /** destructor */
+  virtual ~AliHLTJETConeSeedCuts();
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                   Selection
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Select track
+      @param obj esd track or particle
+      @return kTRUE if selected, kFALSE otherwise
+  */
+  Bool_t IsSelected( TObject* obj );
+
+  /** Select track
+      @param particle particle
+      @return kTRUE if selected, kFALSE otherwise
+  */
+  Bool_t IsSelected( TParticle* particle );
+
+  /** Select track
+      @param esdTrack esd track 
+      @return kTRUE if selected, kFALSE otherwise
+  */
+  Bool_t IsSelected( AliESDtrack* esdTrack );
+  
+  /** Select track
+      Not implemented
+      @return kTRUE 
+  */
+  Bool_t IsSelected( TList* /*list*/ ) { return kTRUE; }
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                                     Setter
+   * ---------------------------------------------------------------------------------
+   */
+  
+  /** Set cut on min pt */
+  void SetMinPt( Float_t f ) { fPtMin = f; }
+
+  /** Set cut on eta acceptance */
+  void SetEtaRange( Float_t etaMin, Float_t etaMax ) { fEtaMin = etaMin; fEtaMax = etaMax; }
+
+  /** Set cut on phi acceptance */
+  void SetPhiRange( Float_t phiMin, Float_t phiMax ) { fPhiMin = phiMin; fPhiMax = phiMax; }
+
+  ///////////////////////////////////////////////////////////////////////////////////
+
+private:
+
+  /** copy constructor prohibited */
+  AliHLTJETConeSeedCuts (const AliHLTJETConeSeedCuts&);
+
+  /** assignment operator prohibited */
+  AliHLTJETConeSeedCuts& operator= (const AliHLTJETConeSeedCuts&);
+
+  /*
+   * ---------------------------------------------------------------------------------
+   *                             Members - private
+   * ---------------------------------------------------------------------------------
+   */
+
+  /** Minimum pt */
+  Float_t            fPtMin;                    // see above
+
+  /** Minimum eta */
+  Float_t            fEtaMin;                   // see above
+
+  /** Maximum eta */
+  Float_t            fEtaMax;                   // see above
+
+  /** Minimum phi */
+  Float_t            fPhiMin;                   // see above
+
+  /** Maximum phi */
+  Float_t            fPhiMax;                   // see above
+
+  ClassDef(AliHLTJETConeSeedCuts, 1)
+
+};
+#endif
+