2 // $Id: AliHLTJETConeJetCandidate.cxx $
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTJETConeJetCandidate.cxx
20 @author Jochen Thaeder
22 @brief Jet candidate of the cone finder
25 // see header file for class documentation
27 // refer to README to build package
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
35 #include "AliHLTJETConeJetCandidate.h"
36 #include "AliHLTJETConeEtaPhiCell.h"
38 /** ROOT macro for the implementation of ROOT specific class methods */
39 ClassImp(AliHLTJETConeJetCandidate)
42 * ---------------------------------------------------------------------------------
43 * Constructor / Destructor
44 * ---------------------------------------------------------------------------------
47 //##################################################################################
48 AliHLTJETConeJetCandidate::AliHLTJETConeJetCandidate() :
61 // see header file for class documentation
63 // refer to README to build package
65 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
69 //##################################################################################
70 AliHLTJETConeJetCandidate::AliHLTJETConeJetCandidate( const Float_t* aEtaPhi,
71 const Int_t* aGridIdx,
73 Bool_t useWholeCell ) :
74 fSeedCellIdx(aGridIdx[kIdxPrimary]),
75 fSeedEtaIdx(aGridIdx[kIdxEtaPrimary]),
76 fSeedPhiIdx(aGridIdx[kIdxPhiPrimary]),
77 fSeedEta(aEtaPhi[kIdxEta]),
78 fSeedPhi(aEtaPhi[kIdxPhi]),
79 fSeedPt(aEtaPhi[kIdxPt]),
84 fUseWholeCell(useWholeCell),
85 fConeRadius2(coneRadius*coneRadius) {
86 // see header file for class documentation
89 //##################################################################################
90 AliHLTJETConeJetCandidate::~AliHLTJETConeJetCandidate() {
91 // see header file for class documentation
95 * ---------------------------------------------------------------------------------
97 * ---------------------------------------------------------------------------------
100 //##################################################################################
101 Int_t AliHLTJETConeJetCandidate::AddCell( AliHLTJETConeEtaPhiCell* cell ) {
102 // see header file for class documentation
105 // -------------------
106 if ( fUseWholeCell ) {
108 fPt += cell->GetPt();
109 fPhi += cell->GetPhi();
110 fEta += cell->GetEta();
111 fNTracks += cell->GetNTracks();
113 HLTDebug("Cell : eta: %f - phi: %f - pt: %f - nTracks: %d .",
114 cell->GetEta(), cell->GetPhi(), cell->GetPt(), cell->GetNTracks() );
116 } // if ( fUseWholeCell ) {
118 // -- radius compared to every track
119 // -----------------------------------
122 HLTDebug("Check NTracks %d.", cell->GetNTracks());
124 TObjArray* trackList = cell->GetTrackList();
126 // -- Loop over all tracks in cell
127 for ( Int_t iter = 0; iter < cell->GetNTracks(); iter++ ) {
130 if ( cell->GetTrackType() == kTrackMC ) {
132 TParticle* particle = reinterpret_cast<TParticle*> ((*trackList)[iter]);
134 // -- Check if in cone
135 if ( ! InCone( particle->Eta(), particle->Phi() ) )
138 fPt += particle->Pt();
139 fPhi += particle->Phi();
140 fEta += particle->Eta();
143 HLTDebug("Particle : eta: %f - phi: %f - pt: %f .",
144 particle->Eta(), particle->Phi(), particle->Pt() );
147 else if ( cell->GetTrackType() == kTrackESD ) {
149 AliESDtrack* esdTrack = reinterpret_cast<AliESDtrack*> ((*trackList)[iter]);
151 // -- Check if in cone
152 if ( ! InCone( esdTrack->Eta(), esdTrack->Phi() ) )
155 fPt += esdTrack->Pt();
156 fPhi += esdTrack->Phi();
157 fEta += esdTrack->Eta();
160 HLTDebug("ESDTrack : eta: %f - phi: %f - pt: %f .",
161 esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt() );
164 HLTError("Not implemented yet...");
167 } // for ( Int_t iter = 0; iter > cell->GetNTracks(); iter++ ) {
174 * ---------------------------------------------------------------------------------
175 * Sort of JetCandidates
176 * ---------------------------------------------------------------------------------
179 //##################################################################################
180 Int_t AliHLTJETConeJetCandidate::Compare( const TObject* obj) const {
181 // see header file for class documentation
186 if ( fSeedPt < (dynamic_cast<AliHLTJETConeJetCandidate*>
187 ( const_cast<TObject*>(obj)))->GetSeedPt() )
194 * ---------------------------------------------------------------------------------
196 * ---------------------------------------------------------------------------------
199 //##################################################################################
200 Float_t AliHLTJETConeJetCandidate::GetDistance2( const Float_t eta1, const Float_t phi1,
201 const Float_t eta2, const Float_t phi2) {
202 // see header file for class documentation
204 return ( (eta1-eta2)*(eta1-eta2) ) + ( (phi1-phi2)*(phi1-phi2) );
207 //##################################################################################
208 Bool_t AliHLTJETConeJetCandidate::InCone( Float_t eta, Float_t phi ) {
209 // see header file for class documentation
211 if ( GetDistance2(fSeedEta,fSeedPhi,eta,phi) <= fConeRadius2 )