From: jthaeder Date: Thu, 5 Nov 2009 09:06:21 +0000 (+0000) Subject: * Added fast interface to fastjet X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=1f9fec4a4221a81786f9e8f48a86d132f1375cfc;p=u%2Fmrichter%2FAliRoot.git * Added fast interface to fastjet * Added more flexibility in the cone finder * cleaned up code * Added AnalysisTasks and test macros --- diff --git a/HLT/JET/AliHLTJETBase.cxx b/HLT/JET/AliHLTJETBase.cxx index cc4cff9c979..1c02a284209 100644 --- a/HLT/JET/AliHLTJETBase.cxx +++ b/HLT/JET/AliHLTJETBase.cxx @@ -56,7 +56,23 @@ ClassImp(AliHLTJETBase) AliHLTJETBase::~AliHLTJETBase() { // see header file for class documentation } + /* + * --------------------------------------------------------------------------------- + * Initialize static const + * --------------------------------------------------------------------------------- + */ + +//################################################################################## +const Char_t *AliHLTJETBase::fgkJetAlgorithmType[] = { + "Anti Kt", + "Kt", + "FFSC SquareCell", + "FFSC RadiusCell" +}; + +#if 0 + //################################################################################## Float_t AliHLTJETBase::GetDistance2( const Float_t eta1, const Float_t phi1, const Float_t eta2, const Float_t phi2) { @@ -64,12 +80,6 @@ Float_t AliHLTJETBase::GetDistance2( const Float_t eta1, const Float_t phi1, return ( (eta1-eta2)*(eta1-eta2) ) + ( (phi1-phi2)*(phi1-phi2) ); } -*/ - - - -#if 0 - //################################################################################## void AliHLTJETBase::XYZtoRPhiEta( const Double_t *xyz, Double_t *rpe ) { diff --git a/HLT/JET/AliHLTJETBase.h b/HLT/JET/AliHLTJETBase.h index 6d5034e9c72..8f97ce62dc7 100644 --- a/HLT/JET/AliHLTJETBase.h +++ b/HLT/JET/AliHLTJETBase.h @@ -16,20 +16,28 @@ #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 }; +/** Indices in grid position array */ +enum GridIndex_t { + kIdxPrimary, /**< 1D index for the main search area */ + kIdxOutter, /**< 1D index for the outter search area */ + kIdxEtaPrimary, /**< 2D eta index for the main search area */ + kIdxPhiPrimary, /**< 2D phi index for the main search area */ + kIdxPhiOutter /**< 2D phi index for the outter search area */ +}; -/** -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 }; +/** Indices in array */ +enum EtaPhiIndex_t { + kIdxEta, /**< Eta */ + kIdxPhi, /**< Phi */ + kIdxPt /**< Pt */ +}; + +/** Used track types */ +enum TrackType_t { + kTrackMC, /**< TParticle */ + kTrackESD, /**< AliESDtrack */ + kTrackAOD /**< AliAODtrack */ +}; /** * @class AliHLTJETBase @@ -53,8 +61,18 @@ class AliHLTJETBase : public TObject, public AliHLTLogging { /** Destructor */ ~AliHLTJETBase(); - // static Float_t GetDistance2( const Float_t eta1, const Float_t phi1, - // const Float_t eta2, const Float_t phi2); + /** Types of jet algorithms */ + enum JetAlgorithmType_t { + kAntiKt, /**< FastJet implementation of the Anti kt */ + kKt, /**< FastJet implementation of the kt */ + kFFSCSquareCell, /**< Fast Fixed Seeded Cone, using a square cell */ + kFFSCRadiusCell, /**< Fast Fixed Seeded Cone, using a radius cell */ + kJetAlgorithmMax /**< Number of enum entries */ + }; + + /** Array of types of the Jet Algorithms */ + static const Char_t *fgkJetAlgorithmType[]; //! transient + /////////////////////////////////////////////////////////////////////////////////// @@ -78,27 +96,28 @@ class AliHLTJETBase : public TObject, public AliHLTLogging { #if 0 - */ - static Int_t GetCellIndex( const Double_t* aEtaPhi, Int_t* aGridIndex ); - static void XYZtoRPhiEta( const Double_t *xyz, Double_t *rpe ); +static Float_t GetDistance2( const Float_t eta1, const Float_t phi1, + const Float_t eta2, const Float_t phi2); - static void XYZEtoRPhiEtaPt( const Double_t *xyze, Double_t *rpep ); - static void XYZEtoRPhiEtaPt( const Float_t *xyze, Double_t *rpep ); +static Int_t GetCellIndex( const Double_t* aEtaPhi, Int_t* aGridIndex ); - static void XYZEtoEPhiEtaPt( const Double_t *xyze, Double_t *epep ); - static void XYZEtoEPhiEtaPt( const Float_t *xyze, Double_t *epep ); +static void XYZtoRPhiEta( const Double_t *xyz, Double_t *rpe ); - static Double_t GetPtFromXYZ( const Double_t *pxpypz ); - static Double_t GetPtFromXYZ( const Float_t *pxpypz ); +static void XYZEtoRPhiEtaPt( const Double_t *xyze, Double_t *rpep ); +static void XYZEtoRPhiEtaPt( const Float_t *xyze, Double_t *rpep ); - static Double_t GetPhiFromXYZ( const Double_t *xyz ); - static Double_t GetPhiFromXYZ( const Float_t *xyz ); +static void XYZEtoEPhiEtaPt( const Double_t *xyze, Double_t *epep ); +static void XYZEtoEPhiEtaPt( const Float_t *xyze, Double_t *epep ); - static Double_t GetEtaFromXYZ( const Double_t *xyz ); - static Double_t GetEtaFromXYZ( const Float_t *xyz ); +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 ); #endif diff --git a/HLT/JET/AliHLTJETFastJetComponent.cxx b/HLT/JET/AliHLTJETFastJetComponent.cxx deleted file mode 100644 index 45ee2a06075..00000000000 --- a/HLT/JET/AliHLTJETFastJetComponent.cxx +++ /dev/null @@ -1,269 +0,0 @@ -//-*- Mode: C++ -*- -// $Id: $ - -//************************************************************************** -//* This file is property of and copyright by the ALICE HLT Project * -//* ALICE Experiment at CERN, All rights reserved. * -//* * -//* Primary Authors: Jochen Thaeder * -//* 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 AliHLTJETFastJetComponent.cxx - @author Jochen Thaeder - @date - @brief Component to run the FastJet jetfinder -*/ - -#if __GNUC__>= 3 -using namespace std; -#endif - -#include -#include -#include - -#include "AliHLTJETFastJetComponent.h" - -#include "TString.h" -#include "TObjString.h" - -/** ROOT macro for the implementation of ROOT specific class methods */ -ClassImp(AliHLTJETFastJetComponent) - -/* - * --------------------------------------------------------------------------------- - * Constructor / Destructor - * --------------------------------------------------------------------------------- - */ - -// ################################################################################# -AliHLTJETFastJetComponent::AliHLTJETFastJetComponent() - : - fJetFinder(NULL), - fJetHeader(NULL), - fJetReader(NULL), - fJetReaderHeader(NULL), - fJetTrackCuts(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 -} - -// ################################################################################# -AliHLTJETFastJetComponent::~AliHLTJETFastJetComponent() { - // see header file for class documentation -} - -/* - * --------------------------------------------------------------------------------- - * Public functions to implement AliHLTComponent's interface. - * These functions are required for the registration process - * --------------------------------------------------------------------------------- - */ - -// ################################################################################# -const Char_t* AliHLTJETFastJetComponent::GetComponentID() { - // see header file for class documentation - return "JETFastJetFinder"; -} - -// ################################################################################# -void AliHLTJETFastJetComponent::GetInputDataTypes( vector& list) { - // see header file for class documentation - list.clear(); - list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline ); - list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT ); - list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline ); - list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT ); -} - -// ################################################################################# -AliHLTComponentDataType AliHLTJETFastJetComponent::GetOutputDataType() { - // see header file for class documentation - return (kAliHLTDataTypeESDObject| kAliHLTDataOriginHLT); -} - -// ################################################################################# -void AliHLTJETFastJetComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) { - // see header file for class documentation - - constBase = 0; - inputMultiplier = 0.3; -} - -// ################################################################################# -AliHLTComponent* AliHLTJETFastJetComponent::Spawn() { - // see header file for class documentation - return new AliHLTJETFastJetComponent(); -} - -/* - * --------------------------------------------------------------------------------- - * Protected functions to implement AliHLTComponent's interface. - * These functions provide initialization as well as the actual processing - * capabilities of the component. - * --------------------------------------------------------------------------------- - */ - -// ################################################################################# -Int_t AliHLTJETFastJetComponent::DoInit( Int_t /*argc*/, const Char_t** /*argv*/ ) { - // see header file for class documentation - -#if 0 - - if ( fJetFinder || fJetHeader || fJetReader || fJetReader || fJetTrackCuts) - return -EINPROGRESS; - - // -- Jet Track Cuts - // ------------------------------------------- - if ( ! (fJetTrackCuts = new AliHLTJETTrackCuts()) ) { - HLTError("Error initializing Track Cuts"); - return -EINPROGRESS; - } - - // fJetTrackCuts->Set ... - - // -- Jet Reader Header - // ------------------------------------------- - if ( ! (fJetReaderHeader = new AliHLTJETReaderHeader()) ) { - HLTError("Error initializing Jet Reader Header"); - return -EINPROGRESS; - } - - fJetReaderHeader->SetAnalysisCuts( dynamic_cast(fJetTrackCuts) ); - - // -- Jet Reader - // ------------------------------------------- - if ( ! (fJetReader = new AliHLTJETReader()) ) { - HLTError("Error initializing Jet Reader"); - return -EINPROGRESS; - } - - fJetReader->SetReaderHeader(fJetReaderHeader); - - // -- Jet Header - // ------------------------------------------- - if ( ! (fJetHeader = new AliFastJetHeader()) ) { - HLTError("Error initializing Jet Header"); - return -EINPROGRESS; - } - - fJetHeader->SetRparam(0.7); - - // -- Jet Finder - // ------------------------------------------- - if ( ! (fJetFinder = new AliFastJetFinder()) ) { - HLTError("Error initializing Jet Finder"); - return -EINPROGRESS; - } - - fJetFinder->SetJetHeader(fJetHeader); - fJetFinder->SetJetReader(fJetReader); - fJetFinder->SetOutputFile("jets.root"); - - // -- Initialize Jet Finder - // ------------------------------------------- - fJetFinder->Init(); -#endif - return 0; -} - -// ################################################################################# -Int_t AliHLTJETFastJetComponent::DoDeinit() { - // see header file for class documentation - /* - if ( fJetFinder ) - delete fJetFinder; - fJetFinder = NULL; - - if ( fJetHeader ) - delete fJetHeader; - fJetHeader = NULL; - - if ( fJetReader ) - delete fJetReader; - fJetReader = NULL; - - if ( fJetReaderHeader ) - delete fJetReaderHeader; - fJetReaderHeader = NULL; - - if ( fJetTrackCuts ) - delete fJetTrackCuts; - fJetTrackCuts = NULL; - - - */ - return 0; -} - -// ################################################################################# -Int_t AliHLTJETFastJetComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, - AliHLTComponentTriggerData& /*trigData*/ ) { - // see header file for class documentation - - Int_t iResult = 0; -#if 0 - const TObject* iter = NULL; - - // -- Start-Of-Run - // ----------------- - if ( GetFirstInputObject(kAliHLTDataTypeSOR) && !iResult ) { - HLTInfo("On-line SOR Event"); - } - - // -- ADD MC Object -- Off-line - // ------------------------------ - for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginOffline); iter != NULL && !iResult; iter=GetNextInputObject() ) { - HLTInfo("Off-line MC Event"); - } - // -- ADD MC Object -- On-line - // ------------------------------ - for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT); iter != NULL && !iResult; iter=GetNextInputObject() ) { - HLTInfo("On-line MC Event"); - - // -- Set input event - fJetReader->SetInputEvent( NULL, NULL, const_cast(iter) ); - - // -- Process one event - if ( ! (fJetFinder->ProcessEvent()) ) - iResult = -1; - } - - // -- ADD ESD Object -- Off-line - // ------------------------------- - for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline); iter != NULL && !iResult; iter=GetNextInputObject() ) { - HLTInfo("Off-line ESD Event"); - } - - // -- ADD ESD Object -- On-line - // ------------------------------ - for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); iter != NULL && !iResult; iter=GetNextInputObject() ) { - HLTInfo("On-line ESD Event"); - } - - // -- End-Of-Run - // --------------- - if ( GetFirstInputObject(kAliHLTDataTypeEOR) && !iResult ) { - HLTInfo("On-line EOR Event"); - - // -- Finish Event ? - // fJetFinder->FinishRun(); - } - - // -- PushBack - // ------------- -#endif - return iResult; -} diff --git a/HLT/JET/AliHLTJETJetCuts.cxx b/HLT/JET/AliHLTJETJetCuts.cxx index b76ea38db30..76d637f6203 100644 --- a/HLT/JET/AliHLTJETJetCuts.cxx +++ b/HLT/JET/AliHLTJETJetCuts.cxx @@ -113,62 +113,3 @@ Bool_t AliHLTJETJetCuts::IsSelected( AliAODJet* jet ) { 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 index 73df9a0d62c..34497d17220 100644 --- a/HLT/JET/AliHLTJETJetCuts.h +++ b/HLT/JET/AliHLTJETJetCuts.h @@ -85,6 +85,15 @@ public: /** Set cut on min pt */ void SetMinEt( Float_t f ) { fEtMin = f; } + /* + * --------------------------------------------------------------------------------- + * Getter + * --------------------------------------------------------------------------------- + */ + + /** Get cut on min pt */ + Float_t GetMinEt() { return fEtMin; } + /////////////////////////////////////////////////////////////////////////////////// private: @@ -104,11 +113,6 @@ private: /** Minimum Et */ Float_t fEtMin; // see above -#if 0 - /** Distance between to jets */ - Float_t fDistanceCut; -#endif - ClassDef(AliHLTJETJetCuts, 1) }; diff --git a/HLT/JET/AliHLTJETReader.cxx b/HLT/JET/AliHLTJETReader.cxx index bfe738bf6e9..26d2bcbcb4e 100644 --- a/HLT/JET/AliHLTJETReader.cxx +++ b/HLT/JET/AliHLTJETReader.cxx @@ -35,6 +35,7 @@ using namespace std; #include "TLorentzVector.h" #include "TParticle.h" #include "TParticlePDG.h" +#include "TDatabasePDG.h" #include "AliHLTJETReader.h" @@ -55,9 +56,10 @@ AliHLTJETReader::AliHLTJETReader() AliJetReader(), fESD(NULL), fMC(NULL), + fHLTMC(NULL), fAOD(NULL), #ifdef HAVE_FASTJET - fMomentumVector( new vector ), + fMomentumVector(NULL), #endif fGrid(NULL), fNJetCandidates(0), @@ -117,48 +119,21 @@ Int_t AliHLTJETReader::Initialize() { iResult = -EINPROGRESS; } - // -- Initialize grid - // -------------------- - if ( ! iResult ) { - - if ( fGrid ) - delete fGrid; - - if ( ! (fGrid = new AliHLTJETConeGrid()) ) { - HLTError("Error instanciating grid."); - iResult = -EINPROGRESS; - } - } - - if ( ! iResult ) { - fGrid->SetEtaRange( readerHeader->GetFiducialEtaMin(), - readerHeader->GetFiducialEtaMax(), - readerHeader->GetGridEtaRange() ); - - fGrid->SetPhiRange( readerHeader->GetFiducialPhiMin(), - readerHeader->GetFiducialPhiMax(), - readerHeader->GetGridPhiRange() ); - - fGrid->SetBinning( readerHeader->GetGridEtaBinning(), - readerHeader->GetGridEtaBinning() ); - - fGrid->SetConeRadius( readerHeader->GetConeRadius() ); - - iResult = fGrid->Initialize(); - } - - // -- Initialize jet candidates - // ------------------------------ - if ( ! iResult ) { - fJetCandidates = new TClonesArray("AliHLTJETConeJetCandidate", 30); - if ( ! fJetCandidates) { - HLTError("Error instanciating jet candidates."); - iResult = -EINPROGRESS; - } + // -- Initialize Algorithms + // -------------------------- + if ( readerHeader->GetJetAlgorithm() >= AliHLTJETBase::kFFSCSquareCell ) + iResult = InitializeFFSC(); + else { +#ifdef HAVE_FASTJET + iResult = InitializeFastjet(); +#else + HLTError("Error FastJet not present."); + iResult = -EINPROGRESS; +#endif } - // -- Initialize cuts - // -------------------- + // -- Get ptr to cuts from reader + // -------------------------------- // -- Seed cuts if ( ! iResult ) { @@ -167,9 +142,6 @@ Int_t AliHLTJETReader::Initialize() { HLTError("Error getting ptr to seed cuts."); iResult = -EINPROGRESS; } - else { - HLTInfo(" -= SeedCuts =- " ); - } } // -- Track cuts @@ -193,17 +165,65 @@ Int_t AliHLTJETReader::Initialize() { void AliHLTJETReader::ResetEvent() { // see header file for class documentation - // -- clear grid - fGrid->Reset(); - - // -- clear jet candidates - fJetCandidates->Clear(); + // -- Reset FFSC algorithms + // -------------------------- + if ( GetReaderHeader()->GetJetAlgorithm() >= AliHLTJETBase::kFFSCSquareCell ) { + // -- clear grid + fGrid->Reset(); + + // -- clear jet candidates + fJetCandidates->Clear(); + + fNJetCandidates = 0; + } - fNJetCandidates = 0; + // -- Reset for FastJet algorithms + // --------------------------------- + else { + // -- Clear input vector + if ( fMomentumVector ) + fMomentumVector->clear(); + } return; } +/* + * --------------------------------------------------------------------------------- + * Setter + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +void AliHLTJETReader::SetInputEvent(const TObject* esd, const TObject* aod, const TObject* mc) { + // see header file for class documentation + + // Needs "useMC" flag for running in analysis task only + + AliHLTJETReaderHeader* readerHeader = GetReaderHeader(); + + // -- Fill ESD + if ( esd && !readerHeader->GetUseMC() ) + fESD = dynamic_cast (const_cast(esd)); + + // -- Fill AOD + else if ( aod && !readerHeader->GetUseMC() ) + fAOD = dynamic_cast (const_cast(aod)); + + // -- Fill MC + else if ( mc && readerHeader->GetUseMC() ) { + + // -- if off-line MC event, + if ( !strcmp (mc->ClassName(),"AliMCEvent") ) + fMC = dynamic_cast (const_cast(mc)); + // -- if on-line MC event + else + fHLTMC = dynamic_cast (const_cast(mc)); + } + + return; +} + /* * --------------------------------------------------------------------------------- * Fastjet Reader functionality @@ -211,43 +231,121 @@ void AliHLTJETReader::ResetEvent() { */ #ifdef HAVE_FASTJET // ################################################################################# -Bool_t AliHLTJETReader::FillMomentumArrayFast() { +Bool_t AliHLTJETReader::FillVector() { // see header file for class documentation Bool_t bResult = kFALSE; if ( fESD ) - bResult = FillMomentumArrayFastESD(); + bResult = FillVectorESD(); else if ( fMC ) - bResult = FillMomentumArrayFastMC(); + bResult = FillVectorMC(); + else if ( fHLTMC ) + bResult = FillVectorHLTMC(); else if ( fAOD ) - bResult = FillMomentumArrayFastAOD(); + bResult = FillVectorAOD(); return bResult; } // ################################################################################# -Bool_t AliHLTJETReader::FillMomentumArrayFastMC() { +Bool_t AliHLTJETReader::FillVectorMC() { // see header file for class documentation + Bool_t bResult = kTRUE; + if ( ! fMC ) { HLTError( "No MC Event present!" ); return kFALSE; } + + // -- Reset Event + ResetEvent(); + + Int_t nTracks = 0; + + AliStack* stack = fMC->Stack(); + + for (Int_t iterStack = 0; iterStack < stack->GetNtrack() && bResult; iterStack++) { + + TParticle *particle = stack->Particle(iterStack); + if ( !particle) { + HLTError( "Error reading particle %i out of %i", iterStack, stack->GetNtrack() ); + bResult = kFALSE; + continue; + } + + // ------------------------------ + // -- Basic cuts on MC particle --> To be done better XXX + // ------------------------------ + + // -- primary + if ( !(stack->IsPhysicalPrimary(iterStack)) ) + continue; + + // -- final state + if ( particle->GetNDaughters() != 0 ) + continue; + + // -- particle in DB + TParticlePDG * particlePDG = particle->GetPDG(); + if ( ! particlePDG ) { + particlePDG = TDatabasePDG::Instance()->GetParticle( particle->GetPdgCode() ); + + if ( ! particlePDG ) { + HLTError("Particle %i not in PDG database", particle->GetPdgCode() ); + bResult = kFALSE; + continue; + } + } + + // ------------------------ + // -- Standard track cuts + // ------------------------ + + // -- Apply track cuts + if ( ! fTrackCuts->IsSelected(particle) ) + continue; + + // -- Create PseudoJet object + fastjet::PseudoJet part( particle->Px(), particle->Py(), + particle->Pz(), particle->Energy() ); + + // -- label the particle into Fastjet algortihm + part.set_user_index( iterStack ); + + // -- Add to input_particles vector + fMomentumVector->push_back(part); + + nTracks++; + } // for (Int_t iterStack = 0; iterStack < stack->GetNtrack() && !bResult; iterStack++) { + + HLTDebug(" Number of selected tracks %d", nTracks); + + return kTRUE; +} + +// ################################################################################# +Bool_t AliHLTJETReader::FillVectorHLTMC() { + // see header file for class documentation + + if ( ! fHLTMC ) { + HLTError( "No HLT MC Event present!" ); + return kFALSE; + } + + // -- Reset Event + ResetEvent(); - // -- Clear input vector - if ( fMomentumVector ) - fMomentumVector->clear(); - Int_t nTracks = 0; TParticle* particle = NULL; // -- Loop over particles // ------------------------ - while ( (particle = fMC->NextParticle() ) ) { + while ( (particle = fHLTMC->NextParticle() ) ) { - // -- Apply cuts + // -- Apply track cuts if ( ! fTrackCuts->IsSelected(particle) ) continue; @@ -256,29 +354,73 @@ Bool_t AliHLTJETReader::FillMomentumArrayFastMC() { particle->Pz(), particle->Energy() ); // -- label the particle into Fastjet algortihm - part.set_user_index( fMC->GetIndex() ); + part.set_user_index( fHLTMC->GetIndex() ); // -- Add to input_particles vector fMomentumVector->push_back(part); nTracks++; - } // while ( (particle = fMC->NextParticle() ) ) { + } // while ( (particle = fHLTMC->NextParticle() ) ) { - HLTInfo(" Number of selected tracks %d \n", nTracks); + HLTInfo(" Number of selected tracks %d", nTracks); return kTRUE; } // ################################################################################# -Bool_t AliHLTJETReader::FillMomentumArrayFastESD() { +Bool_t AliHLTJETReader::FillVectorESD() { // see header file for class documentation - return kTRUE; + Bool_t bResult = kTRUE; + + if ( ! fESD ) { + HLTError( "No ESD Event present!" ); + return kFALSE; + } + + // -- Reset Event + ResetEvent(); + + Int_t nTracks = 0; + + // -- Loop over particles + // ------------------------ + for ( Int_t iter = 0; iter < fESD->GetNumberOfTracks() && bResult; iter++ ) { + + AliESDtrack* esdTrack = fESD->GetTrack(iter); + if ( ! esdTrack ) { + HLTError("Could not read ESD track %d from %d", iter, fESD->GetNumberOfTracks() ); + bResult = kFALSE; + continue; + } + + // -- Apply track cuts + if ( ! fTrackCuts->IsSelected(esdTrack) ) + continue; + + // -- Create PseudoJet object + fastjet::PseudoJet part( esdTrack->Px(), esdTrack->Py(), + esdTrack->Pz(), esdTrack->E() ); + + // -- label the particle into Fastjet algortihm + part.set_user_index( iter ); + + // -- Add to input_particles vector + fMomentumVector->push_back(part); + + nTracks++; + + } // for ( Int_t iter = 0; iter < fESD->GetNumberOfTracks() && !iResult; iter++ ) { + + HLTInfo(" Number of selected tracks %d", nTracks); + + + return bResult; } // ################################################################################# -Bool_t AliHLTJETReader::FillMomentumArrayFastAOD() { +Bool_t AliHLTJETReader::FillVectorAOD() { // see header file for class documentation return kFALSE; @@ -301,9 +443,11 @@ Bool_t AliHLTJETReader::FillGrid() { bResult = FillGridESD(); else if ( fMC ) bResult = FillGridMC(); + else if ( fHLTMC ) + bResult = FillGridHLTMC(); else if ( fAOD ) bResult = FillGridAOD(); - + return bResult; } @@ -311,11 +455,97 @@ Bool_t AliHLTJETReader::FillGrid() { Bool_t AliHLTJETReader::FillGridMC() { // see header file for class documentation + Bool_t bResult = kTRUE; + if ( ! fMC ) { HLTError( "No MC Event present!" ); return kFALSE; } + // -- Reset Event + ResetEvent(); + + AliHLTJETReaderHeader* readerHeader = GetReaderHeader(); + + Int_t nTracks = 0; + + AliStack* stack = fMC->Stack(); + + for (Int_t iterStack = 0; iterStack < stack->GetNtrack() && bResult; iterStack++) { + + TParticle *particle = stack->Particle(iterStack); + if ( !particle) { + HLTError( "Error reading particle %i out of %i", iterStack, stack->GetNtrack() ); + bResult = kFALSE; + continue; + } + + // ------------------------------ + // -- Basic cuts on MC particle --> To be done better XXX + // ------------------------------ + + // -- primary + if ( !(stack->IsPhysicalPrimary(iterStack)) ) + continue; + + // -- final state + if ( particle->GetNDaughters() != 0 ) + continue; + + // -- particle in DB + TParticlePDG * particlePDG = particle->GetPDG(); + if ( ! particlePDG ) { + particlePDG = TDatabasePDG::Instance()->GetParticle( particle->GetPdgCode() ); + + if ( ! particlePDG ) { + HLTError("Particle %i not in PDG database", particle->GetPdgCode() ); + bResult = kFALSE; + continue; + } + } + + // ------------------------ + // -- Standard track cuts + // ------------------------ + + // -- Apply track cuts + if ( ! fTrackCuts->IsSelected(particle) ) + continue; + + const Float_t aEtaPhi[] = { particle->Eta(), particle->Phi(), particle->Pt() }; + Int_t aGridIdx[] = { -1, -1, -1, -1, -1 }; + + fGrid->FillTrack(particle, aEtaPhi, aGridIdx); + + nTracks++; + + // -- Apply seed cuts + if ( ! fSeedCuts->IsSelected(particle) ) + continue; + + // -- Add Seed + AddSeed(aEtaPhi, const_cast (aGridIdx), readerHeader->GetConeRadius()); + + } // for (Int_t iterStack = 0; iterStack < stack->GetNtrack() && !bResult; iterStack++) { + + HLTInfo(" Number of selected tracks %d", nTracks); + HLTInfo(" Number of seeds %d", fNJetCandidates); + + return kTRUE; +} + +// ################################################################################# +Bool_t AliHLTJETReader::FillGridHLTMC() { + // see header file for class documentation + + if ( ! fHLTMC ) { + HLTError( "No HLT MC Event present!" ); + return kFALSE; + } + + // -- Reset Event + ResetEvent(); + AliHLTJETReaderHeader* readerHeader = GetReaderHeader(); Int_t nTracks = 0; @@ -323,8 +553,10 @@ Bool_t AliHLTJETReader::FillGridMC() { // -- Loop over particles // ------------------------ - while ( ( particle = fMC->NextParticle() ) ) { + while ( ( particle = fHLTMC->NextParticle() ) ) { + // HLTError("=== nTracks %d ===",nTracks); + // -- Apply track cuts if ( ! fTrackCuts->IsSelected(particle) ) continue; @@ -332,6 +564,7 @@ Bool_t AliHLTJETReader::FillGridMC() { const Float_t aEtaPhi[] = { particle->Eta(), particle->Phi(), particle->Pt() }; Int_t aGridIdx[] = { -1, -1, -1, -1, -1 }; + // -- Fill grid fGrid->FillTrack(particle, aEtaPhi, aGridIdx); nTracks++; @@ -344,10 +577,10 @@ Bool_t AliHLTJETReader::FillGridMC() { AddSeed(aEtaPhi, const_cast (aGridIdx), readerHeader->GetConeRadius()); - } // while ( (particle = fMC->NextParticle() ) ) { + } // while ( (particle = fHLTMC->NextParticle() ) ) { - HLTDebug(" Number of selected tracks %d", nTracks); - HLTDebug(" Number of seeds %d", fNJetCandidates); + HLTInfo(" Number of selected tracks %d", nTracks); + HLTInfo(" Number of seeds %d", fNJetCandidates); return kTRUE; } @@ -363,6 +596,9 @@ Bool_t AliHLTJETReader::FillGridESD() { return kFALSE; } + // -- Reset Event + ResetEvent(); + AliHLTJETReaderHeader* readerHeader = GetReaderHeader(); Int_t nTracks = 0; @@ -373,7 +609,7 @@ Bool_t AliHLTJETReader::FillGridESD() { AliESDtrack* esdTrack = fESD->GetTrack(iter); if ( ! esdTrack ) { - HLTError("Could not read ESD track %d from %d\n", iter, fESD->GetNumberOfTracks() ); + HLTError("Could not read ESD track %d from %d", iter, fESD->GetNumberOfTracks() ); bResult = kFALSE; continue; } @@ -386,7 +622,7 @@ Bool_t AliHLTJETReader::FillGridESD() { Int_t aGridIdx[] = { -1, -1, -1, -1, -1 }; // -- Fill grid - fGrid->FillTrack(esdTrack, aEtaPhi, aGridIdx); + fGrid->FillTrack(esdTrack, aEtaPhi, aGridIdx); nTracks++; @@ -400,8 +636,8 @@ Bool_t AliHLTJETReader::FillGridESD() { } // for ( Int_t iter = 0; iter < fESD->GetNumberOfTracks() && !iResult; iter++ ) { - HLTDebug(" Number of selected tracks %d", nTracks); - HLTDebug(" Number of seeds %d", fNJetCandidates); + HLTInfo(" Number of selected tracks %d", nTracks); + HLTInfo(" Number of seeds %d", fNJetCandidates); return bResult; } @@ -413,26 +649,6 @@ Bool_t AliHLTJETReader::FillGridAOD() { return kFALSE; } -/* - * --------------------------------------------------------------------------------- - * Setter - * --------------------------------------------------------------------------------- - */ - -// ################################################################################# -void AliHLTJETReader::SetInputEvent(TObject* esd, TObject* aod, TObject* mc) { - // see header file for class documentation - - if ( esd ) - fESD = dynamic_cast (esd); - else if ( aod ) - fAOD = dynamic_cast (aod); - else if ( mc ) - fMC = dynamic_cast (mc); - - return; -} - /* * --------------------------------------------------------------------------------- * Seeds @@ -444,10 +660,12 @@ void AliHLTJETReader::AddSeed( const Float_t* aEtaPhi, const Int_t* aGridIdx, const Float_t coneRadius ) { // see header file for class documentation - Bool_t useWholeCell = kTRUE ; // XXXXXXXXXXXXXXXXx get reader header finder type balhh - useWholeCell = kFALSE ; - // -- Add track / particle + Bool_t useWholeCell = kTRUE; + if ( GetReaderHeader()->GetJetAlgorithm() == AliHLTJETBase::kFFSCRadiusCell ) + useWholeCell = kFALSE ; + + // -- Add track / particle new( (*fJetCandidates) [fNJetCandidates] ) AliHLTJETConeJetCandidate( aEtaPhi, aGridIdx, coneRadius, @@ -455,7 +673,81 @@ void AliHLTJETReader::AddSeed( const Float_t* aEtaPhi, const Int_t* aGridIdx, fNJetCandidates++; HLTDebug("Added Seed Pt=%f, Eta=%f, Phi=%f", aEtaPhi[kIdxPt], - aEtaPhi[kIdxEta], aEtaPhi[kIdxPhi] ); + aEtaPhi[kIdxEta], aEtaPhi[kIdxPhi] ); return; } + +/* + * --------------------------------------------------------------------------------- + * Initialize - private + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETReader::InitializeFFSC() { + // see header file for class documentation + + Int_t iResult = 0; + AliHLTJETReaderHeader* readerHeader = GetReaderHeader(); + + // -- Initialize grid + // -------------------- + if ( fGrid ) + delete fGrid; + + if ( ! (fGrid = new AliHLTJETConeGrid()) ) { + HLTError("Error instanciating grid."); + iResult = -EINPROGRESS; + } + + if ( ! iResult ) { + fGrid->SetEtaRange( readerHeader->GetFiducialEtaMin(), + readerHeader->GetFiducialEtaMax(), + readerHeader->GetGridEtaRange() ); + + fGrid->SetPhiRange( readerHeader->GetFiducialPhiMin(), + readerHeader->GetFiducialPhiMax(), + readerHeader->GetGridPhiRange() ); + + fGrid->SetBinning( readerHeader->GetGridEtaBinning(), + readerHeader->GetGridEtaBinning() ); + + fGrid->SetConeRadius( readerHeader->GetConeRadius() ); + + iResult = fGrid->Initialize(); + } + + // -- Initialize jet candidates + // ------------------------------ + if ( ! iResult ) { + fJetCandidates = new TClonesArray("AliHLTJETConeJetCandidate", 30); + if ( ! fJetCandidates) { + HLTError("Error instanciating jet candidates."); + iResult = -EINPROGRESS; + } + } + + return iResult; +} + +#ifdef HAVE_FASTJET +// ################################################################################# +Int_t AliHLTJETReader::InitializeFastjet() { + // see header file for class documentation + + Int_t iResult = 0; + + // -- Initialize Vector + // ---------------------- + if ( fMomentumVector ) + delete fMomentumVector; + + if ( ! (fMomentumVector = new vector) ) { + HLTError("Error instanciating momentum vector."); + iResult = -EINPROGRESS; + } + + return iResult; +} +#endif diff --git a/HLT/JET/AliHLTJETReader.h b/HLT/JET/AliHLTJETReader.h index 690de20fea6..8cc745c0864 100644 --- a/HLT/JET/AliHLTJETReader.h +++ b/HLT/JET/AliHLTJETReader.h @@ -25,7 +25,6 @@ #include "AliESDEvent.h" #include "AliAODEvent.h" - #include "AliHLTLogging.h" #include "AliHLTMCEvent.h" @@ -38,7 +37,12 @@ /** * @class AliHLTJETReader - * Reader for jet finder + * This class is the reader class for the JetFinder in the HLT + * It implements the reading of ESDs and MCs. AOD reading is + * not yet implemented + *
+ * Usage :
+ * - Initilize() // Initializes the reader dependent of the algorithm * * @ingroup alihlt_jet */ @@ -65,11 +69,9 @@ public: * --------------------------------------------------------------------------------- */ - - void SetTrackCuts( AliHLTJETTrackCuts * cuts) {fTrackCuts = cuts; } - - /** Initialize reader for cone jet finder + /** Initialize reader * Calls AliHLTJETReaderHeader::Initialize + * and the private Initialize methods * @return 0 on success, otherwise <0 */ Int_t Initialize(); @@ -77,6 +79,23 @@ public: /** Reset the event */ void ResetEvent(); + /* + * --------------------------------------------------------------------------------- + * Setter + * --------------------------------------------------------------------------------- + */ + + /** Set pointer to input event + * Needs "useMC" flag for running in analysis task only + * @param esd an AliESDEvent + * @param aod an AliAODEvent + * @param mc an AliHLTMCEvent + */ + void SetInputEvent(const TObject* esd, const TObject* aod, const TObject* mc); + + /** Set number of jet candates = seeds */ + void SetNJetCandidates( Int_t i ) { fNJetCandidates = i; } + /* * --------------------------------------------------------------------------------- * Fastjet Reader functionality @@ -87,22 +106,27 @@ public: /** Fill tracks in fastjet momemtum vector * @return kTRUE on success, otherwise kFALSE */ - Bool_t FillMomentumArrayFast(); + Bool_t FillVector(); /** Fill MC tracks in fastjet momemtum vector * @return kTRUE on success, otherwise kFALSE */ - Bool_t FillMomentumArrayFastMC(); + Bool_t FillVectorMC(); + + /** Fill HLT MC tracks in fastjet momemtum vector + * @return kTRUE on success, otherwise kFALSE + */ + Bool_t FillVectorHLTMC(); /** Fill ESD tracks in fastjet momemtum vector * @return kTRUE on success, otherwise kFALSE */ - Bool_t FillMomentumArrayFastESD(); + Bool_t FillVectorESD(); /** Fill AOD tracks in fastjet momemtum vector * @return kTRUE on success, otherwise kFALSE */ - Bool_t FillMomentumArrayFastAOD(); + Bool_t FillVectorAOD(); #endif /* @@ -121,6 +145,11 @@ public: */ Bool_t FillGridMC(); + /** Fill HLT MC tracks in momentum array + * @return kTRUE on success, otherwise kFALSE + */ + Bool_t FillGridHLTMC(); + /** Fill ESD tracks in momentum array * @return kTRUE on success, otherwise kFALSE */ @@ -131,22 +160,6 @@ public: */ Bool_t FillGridAOD(); - /* - * --------------------------------------------------------------------------------- - * Setter - * --------------------------------------------------------------------------------- - */ - - /** Set pointer to input event - * @param esd an AliESDEvent - * @param aod an AliAODEvent - * @param mc an AliHLTMCEvent - */ - void SetInputEvent(TObject* esd, TObject* aod, TObject* mc); - - /** Set number of jet candates = seeds */ - void SetNJetCandidates( Int_t i ) { fNJetCandidates = i; } - /* * --------------------------------------------------------------------------------- * Getter @@ -156,25 +169,25 @@ public: /** Get Ptr to AliHLTJETReaderHeader * @return ptr to AliHLTJETReaderHeader */ - AliHLTJETReaderHeader* GetReaderHeader() { return dynamic_cast(fReaderHeader);} + AliHLTJETReaderHeader* GetReaderHeader() { return dynamic_cast(fReaderHeader);} #ifdef HAVE_FASTJET /** Get Ptr to input vector of Fastjet * @return ptr to input vector of Fastjet */ - vector* GetMomentumVectorFast() { return fMomentumVector; } + vector* GetVector() { return fMomentumVector; } #endif /** Get Ptr to grid of cone finder * @return ptr to grid of cone finder */ - AliHLTJETConeGrid* GetGrid() { return fGrid; } - + AliHLTJETConeGrid* GetGrid() { return fGrid; } + /** Get number of jet candates = seeds */ - Int_t GetNJetCandidates() { return fNJetCandidates; } + Int_t GetNJetCandidates() { return fNJetCandidates; } /** Get ptr to jet candiates = seeds for cone finder */ - TClonesArray* GetJetCandidates() { return fJetCandidates; } + TClonesArray* GetJetCandidates() { return fJetCandidates; } /* * --------------------------------------------------------------------------------- @@ -200,21 +213,48 @@ private: /** assignment operator prohibited */ AliHLTJETReader& operator= (const AliHLTJETReader&); + /* + * --------------------------------------------------------------------------------- + * Initialize - private + * --------------------------------------------------------------------------------- + */ + + /** Initialize reader for the FFSC cone jet finder + * @return 0 on success, otherwise <0 + */ + Int_t InitializeFFSC(); + +#ifdef HAVE_FASTJET + /** Initialize reader for the fastjet jet finders + * @return 0 on success, otherwise <0 + */ + Int_t InitializeFastjet(); +#endif + /* * --------------------------------------------------------------------------------- * Members - private * --------------------------------------------------------------------------------- */ + // -- Input + // ---------- + /** ESD event */ AliESDEvent *fESD; //! transient - /** MC event */ - AliHLTMCEvent *fMC; //! transient + /** off-line MC event */ + AliMCEvent *fMC; //! transient + + /** on-line MC event */ + AliHLTMCEvent *fHLTMC; //! transient /** AOD event */ AliAODEvent *fAOD; //! transient + // -- Particle structures + // ------------------------ + #ifdef HAVE_FASTJET /** Vector of fastjet momemtum entries */ vector *fMomentumVector; //! transient @@ -223,12 +263,18 @@ private: /** Grid for cone finder */ AliHLTJETConeGrid *fGrid; //! transient + // -- Output + // ----------- + /** Number of jet candates = seeds */ Int_t fNJetCandidates; // see above /** Jet candiates = seeds for cone finder */ TClonesArray *fJetCandidates; //! transient + // -- Cuts + // --------- + /** Ptr to seed cuts */ AliHLTJETConeSeedCuts *fSeedCuts; //! transient diff --git a/HLT/JET/AliHLTJETReaderHeader.cxx b/HLT/JET/AliHLTJETReaderHeader.cxx index b3089db4353..8184e3e64d9 100644 --- a/HLT/JET/AliHLTJETReaderHeader.cxx +++ b/HLT/JET/AliHLTJETReaderHeader.cxx @@ -54,7 +54,9 @@ AliHLTJETReaderHeader::AliHLTJETReaderHeader() fGridPhiBinning(0.0), fGridEtaRange(0.0), fGridPhiRange(0.0), - fConeRadius(0.0) { + fAlgorithm(AliHLTJETBase::kFFSCSquareCell), + fConeRadius(0.0), + fUseMC(kFALSE) { // see header file for class documentation // or // refer to README to build package @@ -93,6 +95,10 @@ Int_t AliHLTJETReaderHeader::Initialize() { HLTInfo(" Grid phi binning %f", fGridPhiBinning ); HLTInfo(" Grid eta range %f", fGridEtaRange ); HLTInfo(" Grid phi range %f", fGridPhiRange ); + HLTInfo(" Algorithm %s", AliHLTJETBase::fgkJetAlgorithmType[fAlgorithm] ); + + if (fUseMC) { HLTInfo(" Use Kinematics TRUE"); } + else { HLTInfo( " Use Kinematics FALSE"); } if ( ! fTrackCuts ) { HLTError("No track cuts set in reader header"); @@ -104,6 +110,17 @@ Int_t AliHLTJETReaderHeader::Initialize() { HLTInfo(" -= TrackCuts =- " ); } + if ( ! fSeedCuts ) { + HLTError("No seed cuts set in reader header"); + iResult = -EINPROGRESS; + } + else { + fSeedCuts->SetEtaRange( fFiducialEtaMin+fConeRadius, + fFiducialEtaMax-fConeRadius ); + fSeedCuts->SetPhiRange( fFiducialPhiMin, fFiducialPhiMax ); + HLTInfo(" -= SeedCuts =- " ); + } + return iResult; } diff --git a/HLT/JET/AliHLTJETReaderHeader.h b/HLT/JET/AliHLTJETReaderHeader.h index 4a8c5350492..6b349945065 100644 --- a/HLT/JET/AliHLTJETReaderHeader.h +++ b/HLT/JET/AliHLTJETReaderHeader.h @@ -50,7 +50,7 @@ public: * --------------------------------------------------------------------------------- */ - /** Initialize reader haeder for cone jet finder + /** Initialize reader header for cone jet finder * @return 0 on success, otherwise <0 */ Int_t Initialize(); @@ -80,6 +80,12 @@ public: /** Set grid binning in phi */ void SetGridPhiBinning( Float_t f ) { fGridPhiBinning = f; } + /** Set algorithm type */ + void SetJetAlgorithm( AliHLTJETBase::JetAlgorithmType_t a ) { fAlgorithm = a; } + + /** Set Usage of Kinematics */ + void SetUseMC( Bool_t b ) { fUseMC = b; } + /* * --------------------------------------------------------------------------------- * Getter @@ -111,6 +117,12 @@ public: /** Get cone radius */ Float_t GetConeRadius() { return fConeRadius; } + /** Get algorithm type */ + AliHLTJETBase::JetAlgorithmType_t GetJetAlgorithm() { return fAlgorithm; } + + /** Get Usage of Kinematics */ + Bool_t GetUseMC() { return fUseMC; } + /////////////////////////////////////////////////////////////////////////////////// private: @@ -151,10 +163,16 @@ private: */ Float_t fGridPhiRange; // see above - // -- cone members + // -- Algorithm members + + /** Algorithm */ + AliHLTJETBase::JetAlgorithmType_t fAlgorithm; // see above /** Cone radius */ Float_t fConeRadius; // see above + + /** Use MC Data -- only neede for off-line*/ + Bool_t fUseMC; // see above ClassDef(AliHLTJETReaderHeader, 1) diff --git a/HLT/JET/AliHLTJETTrackCuts.cxx b/HLT/JET/AliHLTJETTrackCuts.cxx index 4069c1380ab..c5d4e72eedd 100644 --- a/HLT/JET/AliHLTJETTrackCuts.cxx +++ b/HLT/JET/AliHLTJETTrackCuts.cxx @@ -79,7 +79,7 @@ Bool_t AliHLTJETTrackCuts::IsSelected( TObject *obj ) { // see header file for class documentation Bool_t bResult = kTRUE; - + if ( ! strcmp(obj->ClassName(),"TParticle") ) bResult = IsSelected( dynamic_cast (obj)); else if ( ! strcmp(obj->ClassName(),"AliESDtrack") ) @@ -148,8 +148,6 @@ Bool_t AliHLTJETTrackCuts::IsSelected( AliESDtrack *esdTrack ) { 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; diff --git a/HLT/JET/cone/AliHLTJETConeFinder.cxx b/HLT/JET/cone/AliHLTJETConeFinder.cxx index 4a134dea806..0e0deb7ae1a 100644 --- a/HLT/JET/cone/AliHLTJETConeFinder.cxx +++ b/HLT/JET/cone/AliHLTJETConeFinder.cxx @@ -124,9 +124,6 @@ Int_t AliHLTJETConeFinder::Initialize() { void AliHLTJETConeFinder::Reset() { // see header file for class documentation - // -- Reset reader - (dynamic_cast (fReader))->ResetEvent(); - // -- Reset output container if (fJets) fJets->Reset(); @@ -134,7 +131,6 @@ void AliHLTJETConeFinder::Reset() { return; } - /* * --------------------------------------------------------------------------------- * Process @@ -179,9 +175,12 @@ Bool_t AliHLTJETConeFinder::ProcessEvent() { } // ################################################################################# -Bool_t AliHLTJETConeFinder::ProcessConeEvent() { +Bool_t AliHLTJETConeFinder::ProcessHLTEvent() { // see header file for class documentation + // -- Reset + Reset(); + // -- Find Leading if ( FindConeLeading() ) { HLTError("Error finding leading."); @@ -218,7 +217,7 @@ Int_t AliHLTJETConeFinder::FindConeLeading() { // -- Pick up jet canidates TClonesArray* jetCandidates = reader->GetJetCandidates(); - + // -- Check for more than 1 jet candidate if ( reader->GetNJetCandidates() > 1 ) { @@ -239,7 +238,7 @@ Int_t AliHLTJETConeFinder::FindConeLeading() { // -- Resize the seed TClonesArray jetCandidates->Compress(); - + return 0; } @@ -315,7 +314,8 @@ Int_t AliHLTJETConeFinder::FillConeJets() { } // for ( Int_t iter = 0; iter < reader->GetNJetCandidates(); iter++ ) { - HLTDebug( "Added %d jets", fJets->GetNAODJets()); + // xxx HLTDebug( "Added %d jets", fJets->GetNAODJets()); + HLTInfo( "Added %d jets", fJets->GetNAODJets()); return iResult; } diff --git a/HLT/JET/cone/AliHLTJETConeFinder.h b/HLT/JET/cone/AliHLTJETConeFinder.h index 41ff9d311ed..77e6a3f54a2 100644 --- a/HLT/JET/cone/AliHLTJETConeFinder.h +++ b/HLT/JET/cone/AliHLTJETConeFinder.h @@ -38,21 +38,21 @@ *
jetFinder->Init();
* * Set the input event via the reader *
jetReader->SetInputEvent( ... )
- * * Process one event + * * Process one event (contains reset per event) *
jetFinder->ProcessEvent();
- * + * * Usage in on-line
* * Initialization phase : *
jetFinder->Initialize();
- * * Reset -
jetFinder->Reset();
* * Set the input event via the reader *
jetReader->SetInputEvent( ... )
- * * Process one event - *
jetReader->FillGridXXX();
- * Where XXX is has to be replaced by MC, ESD or AOD, depending - * on the input object - *
jetFinder->ProcessConeEvent();
+ * * Process one event + * * Fill grid (contains reset per event) + *
jetReader->FillGridXXX();
+ * Where XXX is has to be replaced by MC, ESD or AOD, + * depending, on the input object + * * Process one event (contains reset per event) + *
jetFinder->ProcessConeEvent();
* * @ingroup alihlt_jet_cone */ @@ -116,12 +116,7 @@ public: /** 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(); } + Bool_t ProcessHLTEvent(); /////////////////////////////////////////////////////////////////////////////////// @@ -164,6 +159,7 @@ private: /** Grid for cone finder */ AliHLTJETConeGrid *fGrid; //! transient + /** Container of AliAODJets */ AliHLTJets *fJets; //! transient ClassDef(AliHLTJETConeFinder, 1) diff --git a/HLT/JET/cone/AliHLTJETConeHeader.h b/HLT/JET/cone/AliHLTJETConeHeader.h index 25a3388afa5..892599affba 100644 --- a/HLT/JET/cone/AliHLTJETConeHeader.h +++ b/HLT/JET/cone/AliHLTJETConeHeader.h @@ -74,7 +74,7 @@ public: void SetJetCuts( AliHLTJETJetCuts* cuts ) { fJetCuts = cuts; } /** Set flag to use only leading seed */ - void SetUseLeading( Bool_t b ) { fUseLeading = b; } + void SetUseLeading( Bool_t b ) { fUseLeading = b; } /* * --------------------------------------------------------------------------------- @@ -90,7 +90,7 @@ public: /** Get flag to use only leading seed * @return if kTRUE, only leading seed is used */ - Bool_t GetUseLeading() { return fUseLeading; } + Bool_t GetUseLeading() { return fUseLeading; } /////////////////////////////////////////////////////////////////////////////////// @@ -114,10 +114,6 @@ private: /** if kTRUE, only leading seed is used */ Bool_t fUseLeading; // see above - /* - Int_t fgFinderType; - */ - ClassDef(AliHLTJETConeHeader, 1) }; diff --git a/HLT/JET/cone/AliHLTJETConeJetComponent.cxx b/HLT/JET/cone/AliHLTJETConeJetComponent.cxx index dc03b17019c..a5e197869ca 100644 --- a/HLT/JET/cone/AliHLTJETConeJetComponent.cxx +++ b/HLT/JET/cone/AliHLTJETConeJetComponent.cxx @@ -36,8 +36,6 @@ using namespace std; #include "TString.h" #include "TObjString.h" -#include "AliAODJet.h" - /** ROOT macro for the implementation of ROOT specific class methods */ ClassImp(AliHLTJETConeJetComponent) @@ -132,6 +130,10 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { // -- Defaults // --------------------------------------------------------------------- + TString comment = "HLT Fast Fixed Seeded Cone finder "; + + AliHLTJETBase::JetAlgorithmType_t algorithm = AliHLTJETBase::kFFSCSquareCell; + Bool_t leading = kFALSE; Float_t coneRadius = 0.4; Float_t trackCutMinPt = 1.0; Float_t seedCutMinPt = 5.0; @@ -141,8 +143,6 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { // -- Get Arguments // --------------------------------------------------------------------- - TString comment; - Int_t iResult = 0; Int_t bMissingParam=0; @@ -155,8 +155,62 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { if (argument.IsNull()) continue; + // -- algorithm + if ( !argument.CompareTo("-algorithm") ) { + if ((bMissingParam=(++iter>=argc))) break; + + TString parameter(argv[iter]); + parameter.Remove(TString::kLeading, ' '); + + if ( !parameter.CompareTo("FSCSquareCell") ) { + algorithm = AliHLTJETBase::kFFSCSquareCell; + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else if ( !parameter.CompareTo("FSCRadiusCell") ) { + algorithm = AliHLTJETBase::kFFSCRadiusCell; + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else { + HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data()); + iResult=-EINVAL; + } + } + + // -- leading + else if ( !argument.CompareTo("-leading") ) { + if ((bMissingParam=(++iter>=argc))) break; + + TString parameter(argv[iter]); + parameter.Remove(TString::kLeading, ' '); + + if ( !parameter.CompareTo("0") ) { + leading = kFALSE; + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else if ( !parameter.CompareTo("1") ) { + leading = kTRUE; + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else { + HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data()); + iResult=-EINVAL; + } + } + // -- coneRadius - if ( !argument.CompareTo("-coneRadius") ) { + else if ( !argument.CompareTo("-coneRadius") ) { if ((bMissingParam=(++iter>=argc))) break; TString parameter(argv[iter]); @@ -251,7 +305,6 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { if (iResult) return iResult; - // --------------------------------------------------------------------- // -- Jet Track Cuts // --------------------------------------------------------------------- @@ -271,13 +324,8 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { return -EINPROGRESS; } - // Set pt cut fSeedCuts->SetMinPt( seedCutMinPt ); - // Set Eta min/max and Phi min/max - fSeedCuts->SetEtaRange( (-0.9+coneRadius), (0.9-coneRadius) ); - fSeedCuts->SetPhiRange( 0.0, TMath::TwoPi() ); - // --------------------------------------------------------------------- // -- Jet Jet Cuts // --------------------------------------------------------------------- @@ -286,7 +334,6 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { return -EINPROGRESS; } - // Set pt cut fJetCuts->SetMinEt( jetCutMinEt ); // --------------------------------------------------------------------- @@ -296,6 +343,9 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { HLTError("Error instantiating jet reader header"); return -EINPROGRESS; } + + // Set Algorithm + fJetReaderHeader->SetJetAlgorithm( algorithm ); // Set prt to track cuts fJetReaderHeader->SetTrackCuts( fTrackCuts ); @@ -320,7 +370,6 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { return -EINPROGRESS; } - // Set reader header fJetReader->SetReaderHeader(fJetReaderHeader); // --------------------------------------------------------------------- @@ -340,8 +389,9 @@ Int_t AliHLTJETConeJetComponent::DoInit( Int_t argc, const Char_t** argv ) { HLTError("Error instantiating cone jet header"); return -EINPROGRESS; } + fJetHeader->SetJetCuts(fJetCuts); - fJetHeader->SetUseLeading(kTRUE); + fJetHeader->SetUseLeading(leading); // --------------------------------------------------------------------- // -- Jet Finder @@ -425,21 +475,21 @@ Int_t AliHLTJETConeJetComponent::DoEvent( const AliHLTComponentEventData& /*evtD for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT); iter != NULL && !iResult; iter=GetNextInputObject() ) { - // -- Reset - fJetFinder->Reset(); - + // -- Set automatic MC usage, --> needed in off-line + fJetReaderHeader->SetUseMC(kTRUE); + // -- Set input event fJetReader->SetInputEvent( NULL, NULL, const_cast(iter) ); // -- Fill grid with MC - if ( ! fJetReader->FillGridMC() ) { + if ( ! fJetReader->FillGridHLTMC() ) { HLTError("Error filling grid."); iResult = -EINPROGRESS; } // -- Find jets if ( !iResult) { - if ( ! fJetFinder->ProcessConeEvent() ) { + if ( ! fJetFinder->ProcessHLTEvent() ) { HLTError("Error processing cone event."); iResult = -EINPROGRESS; } @@ -456,8 +506,8 @@ Int_t AliHLTJETConeJetComponent::DoEvent( const AliHLTComponentEventData& /*evtD for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline); iter != NULL && !iResult; iter=GetNextInputObject() ) { - // -- Reset - fJetFinder->Reset(); + // -- Set automatic MC usage, --> needed in off-line + fJetReaderHeader->SetUseMC(kFALSE); // -- Set input event fJetReader->SetInputEvent( const_cast(iter), NULL, NULL ); @@ -470,7 +520,7 @@ Int_t AliHLTJETConeJetComponent::DoEvent( const AliHLTComponentEventData& /*evtD // -- Find jets if ( !iResult) { - if ( ! fJetFinder->ProcessConeEvent() ) { + if ( ! fJetFinder->ProcessHLTEvent() ) { HLTError("Error processing cone event."); iResult = -EINPROGRESS; } @@ -487,12 +537,12 @@ Int_t AliHLTJETConeJetComponent::DoEvent( const AliHLTComponentEventData& /*evtD for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); iter != NULL && !iResult; iter=GetNextInputObject() ) { + // -- Set automatic MC usage, --> needed in off-line + fJetReaderHeader->SetUseMC(kFALSE); + // -- Set input event fJetReader->SetInputEvent( const_cast(iter), NULL, NULL ); - // -- Reset - fJetFinder->Reset(); - // -- Fill grid with ESD if ( ! fJetReader->FillGridESD() ) { HLTError("Error filling grid."); @@ -501,7 +551,7 @@ Int_t AliHLTJETConeJetComponent::DoEvent( const AliHLTComponentEventData& /*evtD // -- Find jets if ( !iResult) { - if ( ! fJetFinder->ProcessConeEvent() ) { + if ( ! fJetFinder->ProcessHLTEvent() ) { HLTError("Error processing cone event."); iResult = -EINPROGRESS; } diff --git a/HLT/JET/cone/AliHLTJETConeJetComponent.h b/HLT/JET/cone/AliHLTJETConeJetComponent.h index e8e33cc8d54..f51f74e508f 100644 --- a/HLT/JET/cone/AliHLTJETConeJetComponent.h +++ b/HLT/JET/cone/AliHLTJETConeJetComponent.h @@ -47,6 +47,14 @@ * *

Optional arguments:

* + * \li -algorithm JetAlgorithm to be run
+ * - Possible values : FSCSquareCell, FFSCRadiusCell
+ * - Default : FSCSquareCell
+ * + * \li -leading use leading seed only
+ * - Possible values : 0, 1
+ * - Default : 0
+ * * \li -coneRadius Cone radius for cone finder
* - Default : 0.4
* @@ -184,7 +192,7 @@ private: /** Ptr to jet container holding AliAODJets */ AliHLTJets *fJets; //!transient - ClassDef(AliHLTJETConeJetComponent, 0) + ClassDef(AliHLTJETConeJetComponent, 1) }; #endif diff --git a/HLT/JET/cone/AliHLTJETConeSeedCuts.cxx b/HLT/JET/cone/AliHLTJETConeSeedCuts.cxx index 10a6d9beec1..76f371e725a 100644 --- a/HLT/JET/cone/AliHLTJETConeSeedCuts.cxx +++ b/HLT/JET/cone/AliHLTJETConeSeedCuts.cxx @@ -127,8 +127,6 @@ Bool_t AliHLTJETConeSeedCuts::IsSelected( AliESDtrack *esdTrack ) { 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; diff --git a/HLT/JET/fastjet/AliHLTJETFastJetComponent.cxx b/HLT/JET/fastjet/AliHLTJETFastJetComponent.cxx new file mode 100644 index 00000000000..ab17345deb1 --- /dev/null +++ b/HLT/JET/fastjet/AliHLTJETFastJetComponent.cxx @@ -0,0 +1,495 @@ +//-*- Mode: C++ -*- +// $Id: $ + +//************************************************************************** +//* This file is property of and copyright by the ALICE HLT Project * +//* ALICE Experiment at CERN, All rights reserved. * +//* * +//* Primary Authors: Jochen Thaeder * +//* 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 AliHLTJETFastJetComponent.cxx + @author Jochen Thaeder + @date + @brief Component to run the FastJet jetfinder +*/ + +#if __GNUC__>= 3 +using namespace std; +#endif + +#include +#include +#include + +#include "AliHLTJETFastJetComponent.h" + +#include "TString.h" +#include "TObjString.h" + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTJETFastJetComponent) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +AliHLTJETFastJetComponent::AliHLTJETFastJetComponent() + : + fJetFinder(NULL), + fJetHeader(NULL), + fJetReader(NULL), + fJetReaderHeader(NULL), + fTrackCuts(NULL), + fJetCuts(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 +} + +// ################################################################################# +AliHLTJETFastJetComponent::~AliHLTJETFastJetComponent() { + // see header file for class documentation + +} + +/* + * --------------------------------------------------------------------------------- + * Public functions to implement AliHLTComponent's interface. + * These functions are required for the registration process + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +const Char_t* AliHLTJETFastJetComponent::GetComponentID() { + // see header file for class documentation + return "JETFastJetFinder"; +} + +// ################################################################################# +void AliHLTJETFastJetComponent::GetInputDataTypes( vector& list) { + // see header file for class documentation + list.clear(); + list.push_back( kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT ); + list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline ); + list.push_back( kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT ); +} + +// ################################################################################# +AliHLTComponentDataType AliHLTJETFastJetComponent::GetOutputDataType() { + // see header file for class documentation + return (kAliHLTDataTypeJet|kAliHLTDataOriginHLT); +} + +// ################################################################################# +void AliHLTJETFastJetComponent::GetOutputDataSize( ULong_t& constBase, Double_t& inputMultiplier ) { + // see header file for class documentation + + constBase = 1000; + inputMultiplier = 0.3; +} + +// ################################################################################# +AliHLTComponent* AliHLTJETFastJetComponent::Spawn() { + // see header file for class documentation + return new AliHLTJETFastJetComponent(); +} + +/* + * --------------------------------------------------------------------------------- + * Protected functions to implement AliHLTComponent's interface. + * These functions provide initialization as well as the actual processing + * capabilities of the component. + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETFastJetComponent::DoInit( Int_t argc, const Char_t** argv ) { + // see header file for class documentation + + if ( fJetFinder || fJetHeader || fJetReader || fJetReaderHeader || + fTrackCuts || fJetCuts || fJets ) + return -EINPROGRESS; + + // --------------------------------------------------------------------- + // -- Defaults + // --------------------------------------------------------------------- + + TString comment = "HLT FastJet interface"; + + AliHLTJETBase::JetAlgorithmType_t algorithm = AliHLTJETBase::kKt; + Float_t coneRadius = 0.4; + Float_t trackCutMinPt = 1.0; + Float_t jetCutMinEt = 15.0; + + // --------------------------------------------------------------------- + // -- Get Arguments + // --------------------------------------------------------------------- + + Int_t iResult = 0; + Int_t bMissingParam=0; + + TString argument=""; + + // -- Loop over all arguments + for ( Int_t iter = 0; iter=0; iter++) { + argument=argv[iter]; + + if (argument.IsNull()) + continue; + + // -- algorithm + if ( !argument.CompareTo("-algorithm") ) { + if ((bMissingParam=(++iter>=argc))) break; + + TString parameter(argv[iter]); + parameter.Remove(TString::kLeading, ' '); + + if ( !parameter.CompareTo("Kt") ) { + algorithm = AliHLTJETBase::kKt; + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else if ( !parameter.CompareTo("AntiKt") ) { + algorithm = AliHLTJETBase::kAntiKt; + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else { + HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data()); + iResult=-EINVAL; + } + } + + // -- coneRadius + else if ( !argument.CompareTo("-coneRadius") ) { + if ((bMissingParam=(++iter>=argc))) break; + + TString parameter(argv[iter]); + parameter.Remove(TString::kLeading, ' '); + + if ( parameter.IsFloat() ) { + coneRadius = parameter.Atof(); + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else { + HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data()); + iResult=-EINVAL; + } + } + + // -- trackCutMinPt + else if ( !argument.CompareTo("-trackCutMinPt") ) { + if ((bMissingParam=(++iter>=argc))) break; + + TString parameter(argv[iter]); + parameter.Remove(TString::kLeading, ' '); + + if ( parameter.IsFloat() ) { + trackCutMinPt = parameter.Atof(); + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else { + HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data()); + iResult=-EINVAL; + } + } + + // -- jetCutMinEt + else if ( !argument.CompareTo("-jetCutMinEt") ) { + if ((bMissingParam=(++iter>=argc))) break; + + TString parameter(argv[iter]); + parameter.Remove(TString::kLeading, ' '); + + if ( parameter.IsFloat() ) { + jetCutMinEt = parameter.Atof(); + comment += argument; + comment += " "; + comment += parameter; + comment += ' '; + } + else { + HLTError("Wrong parameter %s for argument %s.", parameter.Data(), argument.Data()); + iResult=-EINVAL; + } + } + + // -- Argument not known + else { + HLTError("Unknown argument %s.", argument.Data()); + iResult = -EINVAL; + } + } // for ( Int iter = 0; iter=0; iter++) { + + // -- Check if parameter is missing + if ( bMissingParam ) { + HLTError("Missing parameter for argument %s.", argument.Data()); + iResult=-EINVAL; + } + + if (iResult) + return iResult; + + // --------------------------------------------------------------------- + // -- Jet Track Cuts + // --------------------------------------------------------------------- + if ( ! (fTrackCuts = new AliHLTJETTrackCuts()) ) { + HLTError("Error instantiating track cuts"); + return -EINPROGRESS; + } + + fTrackCuts->SetChargedOnly( kTRUE ); + fTrackCuts->SetMinPt( trackCutMinPt ); + + // --------------------------------------------------------------------- + // -- Jet Jet Cuts + // --------------------------------------------------------------------- + if ( ! (fJetCuts = new AliHLTJETJetCuts()) ) { + HLTError("Error instantiating jet cuts"); + return -EINPROGRESS; + } + + fJetCuts->SetMinEt( jetCutMinEt ); + + // --------------------------------------------------------------------- + // -- Jet Reader Header + // --------------------------------------------------------------------- + if ( ! (fJetReaderHeader = new AliHLTJETReaderHeader()) ) { + HLTError("Error instantiating jet reader header"); + return -EINPROGRESS; + } + + // Set Algorithm + fJetReaderHeader->SetJetAlgorithm( algorithm ); + + // Set prt to track cuts + fJetReaderHeader->SetTrackCuts( fTrackCuts ); + + // Set Eta min/max and Phi min/max + fJetReaderHeader->SetFiducialEta( -0.9, 0.9) ; + fJetReaderHeader->SetFiducialPhi( 0.0, TMath::TwoPi() ) ; + + // Set cone radius + fJetReaderHeader->SetConeRadius(coneRadius); + + // --------------------------------------------------------------------- + // -- Jet Reader + // --------------------------------------------------------------------- + if ( ! (fJetReader = new AliHLTJETReader()) ) { + HLTError("Error instantiating jet reader"); + return -EINPROGRESS; + } + + fJetReader->SetReaderHeader(fJetReaderHeader); + + // --------------------------------------------------------------------- + // -- Jet Container + // --------------------------------------------------------------------- + if ( ! (fJets = new AliHLTJets()) ) { + HLTError("Error instantiating jet container"); + return -EINPROGRESS; + } + + fJets->SetComment(comment); + + // --------------------------------------------------------------------- + // -- Jet Header + // --------------------------------------------------------------------- + if ( ! (fJetHeader = new AliHLTJETFastJetHeader()) ) { + HLTError("Error instantiating fastjet header"); + return -EINPROGRESS; + } + + fJetHeader->SetReaderHeader(fJetReaderHeader); + fJetHeader->SetJetCuts(fJetCuts); + + // --------------------------------------------------------------------- + // -- Jet Finder + // --------------------------------------------------------------------- + if ( ! (fJetFinder = new AliHLTJETFastJetFinder()) ) { + HLTError("Error instantiating fastjet finder"); + return -EINPROGRESS; + } + + fJetFinder->SetJetHeader(fJetHeader); + fJetFinder->SetJetReader(fJetReader); + fJetFinder->SetOutputJets(fJets); + + // --------------------------------------------------------------------- + // -- Initialize Jet Finder + // --------------------------------------------------------------------- + if ( (fJetFinder->Initialize()) ) { + HLTError("Error initializing fastjet finder"); + return -EINPROGRESS; + } + + return 0; +} + +// ################################################################################# +Int_t AliHLTJETFastJetComponent::DoDeinit() { + // see header file for class documentation + + if ( fJetFinder ) + delete fJetFinder; + fJetFinder = NULL; + + if ( fJetHeader ) + delete fJetHeader; + fJetHeader = NULL; + + if ( fJetReader ) + delete fJetReader; + fJetReader = NULL; + + if ( fJetReaderHeader ) + delete fJetReaderHeader; + fJetReaderHeader = NULL; + + if ( fJetCuts ) + delete fJetCuts; + fJetCuts = NULL; + + if ( fJets ) + delete fJets; + fJets = NULL; + + return 0; +} + +// ################################################################################# +Int_t AliHLTJETFastJetComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, + AliHLTComponentTriggerData& /*trigData*/ ) { + // see header file for class documentation + + Int_t iResult = 0; + + const TObject* iter = NULL; + + // -- Start-Of-Run + // ----------------- + if ( GetFirstInputObject(kAliHLTDataTypeSOR) && !iResult ) { + HLTInfo("On-line SOR Event"); + } + + // -- ADD MC Object -- On-line + // ------------------------------ + for ( iter=GetFirstInputObject(kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT); + iter != NULL && !iResult; iter=GetNextInputObject() ) { + + // -- Set automatic MC usage, --> needed in off-line + fJetReaderHeader->SetUseMC(kTRUE); + + // -- Set input event + fJetReader->SetInputEvent( NULL, NULL, const_cast(iter) ); + + // -- Fill vector with MC + if ( ! fJetReader->FillVectorHLTMC() ) { + HLTError("Error filling vector."); + iResult = -EINPROGRESS; + } + + // -- Find jets + if ( !iResult) { + if ( ! fJetFinder->ProcessHLTEvent() ) { + HLTError("Error processing fastjet event."); + iResult = -EINPROGRESS; + } + } + + // -- PushBack + if ( !iResult) { + PushBack(fJets, kAliHLTDataTypeJet|kAliHLTDataOriginHLT, GetSpecification()); + } + } + + // -- ADD ESD Object -- Off-line + // ------------------------------- + for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline); + iter != NULL && !iResult; iter=GetNextInputObject() ) { + + // -- Set automatic MC usage, --> needed in off-line + fJetReaderHeader->SetUseMC(kFALSE); + + // -- Set input event + fJetReader->SetInputEvent( const_cast(iter), NULL, NULL ); + + // -- Fill vector with ESD + if ( ! fJetReader->FillVectorESD() ) { + HLTError("Error filling vector."); + iResult = -1; + } + + // -- Find jets + if ( !iResult) { + if ( ! fJetFinder->ProcessHLTEvent() ) { + HLTError("Error processing fastjet event."); + iResult = -EINPROGRESS; + } + } + + // -- PushBack + if ( !iResult) { + PushBack(fJets, kAliHLTDataTypeJet|kAliHLTDataOriginHLT, GetSpecification()); + } + } + + // -- ADD ESD Object -- On-line + // ------------------------------ + for ( iter=GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT); + iter != NULL && !iResult; iter=GetNextInputObject() ) { + + // -- Set automatic MC usage, --> needed in off-line + fJetReaderHeader->SetUseMC(kFALSE); + + // -- Set input event + fJetReader->SetInputEvent( const_cast(iter), NULL, NULL ); + + // -- Fill vector with ESD + if ( ! fJetReader->FillVectorESD() ) { + HLTError("Error filling vector."); + iResult = -1; + } + + // -- Find jets + if ( !iResult) { + if ( ! fJetFinder->ProcessHLTEvent() ) { + HLTError("Error processing fastjet event."); + iResult = -EINPROGRESS; + } + } + + // -- PushBack + if ( !iResult) { + PushBack(fJets, kAliHLTDataTypeJet|kAliHLTDataOriginHLT, GetSpecification()); + } + } + + return iResult; +} diff --git a/HLT/JET/AliHLTJETFastJetComponent.h b/HLT/JET/fastjet/AliHLTJETFastJetComponent.h similarity index 72% rename from HLT/JET/AliHLTJETFastJetComponent.h rename to HLT/JET/fastjet/AliHLTJETFastJetComponent.h index 9a66a1e4967..a5514518e21 100644 --- a/HLT/JET/AliHLTJETFastJetComponent.h +++ b/HLT/JET/fastjet/AliHLTJETFastJetComponent.h @@ -17,19 +17,50 @@ #include "AliHLTProcessor.h" -#include "AliFastJetFinder.h" -#include "AliFastJetHeader.h" - #include "AliHLTJETReader.h" #include "AliHLTJETReaderHeader.h" #include "AliHLTJETTrackCuts.h" +#include "AliHLTJETJetCuts.h" + +#include "AliHLTJETFastJetFinder.h" +#include "AliHLTJETFastJetHeader.h" /** * @class AliHLTJETFastJetComponent * Component to run the FastJet jetfinder * + *

General properties:

+ * + * Component ID: \b JETFaseJetFinder
+ * Library: \b libAliHLTJET.so
+ * Input Data Types:
+ * - kAliHLTDataTypeMCObject|kAliHLTDataOriginHLT --> class AliHLTMCEvent
+ * - kAliHLTDataTypeESDObject|kAliHLTDataOriginOffline --> class AliHLTESDEvent
+ * - kAliHLTDataTypeESDObject|kAliHLTDataOriginHLT --> class AliHLTESDEvent
+ * Output Data Types:
+ * - kAliHLTDataTypeJet|kAliHLTDataOriginHLT --> class AliHLTJets
+ * + *

Mandatory arguments:

+ * There are no mandatrory arguments
+ * + *

Optional arguments:

+ * + * \li -algorithm JetAlgorithm to be run
+ * - Possible values : Kt, AntiKt
+ * - Default : Kt
+ * + * \li -coneRadius Cone radius for cone finder
+ * - Default : 0.4
+ * + * \li -trackCutMinPt min pt for cut on tracks, in GeV/c
+ * - Default : 1.0
+ * + * \li -jetCutMinPt min Et for cut on found jets, in GeV/c
+ * - Default : 15.0
+ * * @ingroup alihlt_jet + * @ingroup alihlt_jet_fastjet */ class AliHLTJETFastJetComponent : public AliHLTProcessor { @@ -129,22 +160,28 @@ private: * --------------------------------------------------------------------------------- */ - /** pointer to the jet finder object */ - AliFastJetFinder *fJetFinder; //!transient - - /** Ptr to the jet finder header */ - AliFastJetHeader *fJetHeader; //!transient - + /** Ptr to the jet finder */ + AliHLTJETFastJetFinder *fJetFinder; //!transient + + /** Ptr to the jet finder header */ + AliHLTJETFastJetHeader *fJetHeader; //!transient + /** Ptr to jet reader */ AliHLTJETReader *fJetReader; //!transient - + /** Ptr to jet reader header */ AliHLTJETReaderHeader *fJetReaderHeader; //!transient /** Ptr to track cuts */ - AliHLTJETTrackCuts *fJetTrackCuts; //!transient - - ClassDef(AliHLTJETFastJetComponent, 0) + AliHLTJETTrackCuts *fTrackCuts; //!transient + + /** Ptr to jet cuts */ + AliHLTJETJetCuts *fJetCuts; //!transient + + /** Ptr to jet container holding AliAODJets */ + AliHLTJets *fJets; + + ClassDef(AliHLTJETFastJetComponent, 1) }; #endif diff --git a/HLT/JET/fastjet/AliHLTJETFastJetFinder.cxx b/HLT/JET/fastjet/AliHLTJETFastJetFinder.cxx new file mode 100644 index 00000000000..883c3949690 --- /dev/null +++ b/HLT/JET/fastjet/AliHLTJETFastJetFinder.cxx @@ -0,0 +1,294 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTJETFastJetFinder.cxx $ +/************************************************************************** + * This file is property of and copyright by the ALICE HLT Project * + * ALICE Experiment at CERN, All rights reserved. * + * * + * Primary Authors: Jochen Thaeder * + * 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 AliHLTJETFastJetFinder.cxx + @author Jochen Thaeder + @date + @brief FastJet finder interface +*/ + +// 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 "fastjet/AreaDefinition.hh" +//#include "fastjet/JetDefinition.hh" +// get info on how fastjet was configured +//#include "fastjet/config.h" + +//#include +//#include +//#include + +//#include "AliAODJet.h" + +#include "AliHLTJETReader.h" +#include "AliHLTJETJetCuts.h" + +#include "AliHLTJETFastJetFinder.h" +#include "AliHLTJETFastJetHeader.h" + +//#include // needed for internal io +//#include +//#include + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTJETFastJetFinder) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +AliHLTJETFastJetFinder::AliHLTJETFastJetFinder() + : + AliJetFinder(), + fInputVector(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 + +} + +// ################################################################################# +AliHLTJETFastJetFinder::~AliHLTJETFastJetFinder() { + // see header file for class documentation + +} + +/* + * --------------------------------------------------------------------------------- + * Initialize + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETFastJetFinder::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 (fReader); + + iResult = reader->Initialize(); + if ( iResult ) { + HLTError( "Initializing Reader failed!"); + return iResult; + } + + // -- Initialize Header + AliHLTJETFastJetHeader *header = dynamic_cast (fHeader); + + iResult = header->Initialize(); + if ( iResult ) { + HLTError( "Initializing Header failed!"); + return iResult; + } + + // -- Set ptr to vector + fInputVector = reader->GetVector(); + if ( ! fInputVector ) { + HLTError( "Getting ptr to vector failed!"); + return -EINPROGRESS; + } + + // -- Check ptr to output container + if ( !fJets ) { + HLTError( "Ptr to output container not set!"); + return -EINPROGRESS; + } + + return iResult; +} + +// ################################################################################# +void AliHLTJETFastJetFinder::Reset() { + // see header file for class documentation + + // -- Reset output container + if (fJets) + fJets->Reset(); + + return; +} + +/* + * --------------------------------------------------------------------------------- + * Process + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Bool_t AliHLTJETFastJetFinder::ProcessEvent() { + // see header file for class documentation + + // -- Pick up jet reader + AliHLTJETReader *reader = dynamic_cast (fReader); + + // -- Reset + Reset(); + + // -- Fill Vector + if ( !reader->FillVector() ){ + HLTError("Error filling vector."); + return kFALSE; + } + + // -- Find Jets, fill jets and apply jet cuts + if ( FindFastJets() ) { + HLTError("Error finding jets."); + return kFALSE; + } + + return kTRUE; +} + +// ################################################################################# +Bool_t AliHLTJETFastJetFinder::ProcessHLTEvent() { + // see header file for class documentation + + // -- Reset + Reset(); + + // -- Find Jets, fill jets and apply jet cuts + if ( FindFastJets() ) { + HLTError("Error finding jets."); + return kFALSE; + } + + return kTRUE; +} + +/* + * --------------------------------------------------------------------------------- + * Helper + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +void AliHLTJETFastJetFinder::PrintJets( vector &jets, + fastjet::ClusterSequenceArea &clust_seq ) { + // see header file for class documentation + + // -- pick up fastjet header + AliHLTJETFastJetHeader *header = dynamic_cast (fHeader); + + // -- print header info + TString comment = header->GetComment(); + comment += TString(clust_seq.strategy_string()); + + HLTInfo( "--------------------------------------------------------" ); + HLTInfo( "%s", comment.Data() ); + HLTInfo( "--------------------------------------------------------" ); + + header->PrintParameters(); + + // -- print found jets + HLTInfo( "Number of unclustered particles: %i", clust_seq.unclustered_particles().size() ); + + HLTInfo( "Printing inclusive sub jets with pt > %f GeV", header->GetPtMin() ); + HLTInfo( "-------------------------------------------------------" ); + HLTInfo( " ijet rap phi Pt area +- err" ); + + for ( UInt_t jetIter = 0; jetIter < jets.size(); jetIter++ ) { + + Double_t area = clust_seq.area(jets[jetIter]); + Double_t area_error = clust_seq.area_error(jets[jetIter]); + + HLTInfo( "%5u %9.5f %8.5f %10.3f %8.3f +- %6.3f", + jetIter,jets[jetIter].rap(),jets[jetIter].phi(),jets[jetIter].perp(), area, area_error ); + + } // for ( Int_t jetIter = 0; jetIter < jets.size(); jetIter++ ) { + + return; +} + +/* + * --------------------------------------------------------------------------------- + * Process - private + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETFastJetFinder::FindFastJets() { + // see header file for class documentation + + // -- pick up fastjet header + AliHLTJETFastJetHeader *header = dynamic_cast (fHeader); + + // -- Run the jet clustering with the jet definition from the header + fastjet::ClusterSequenceArea clust_seq( (*fInputVector), + (*header->GetJetDefinition()), + (*header->GetAreaDefinition()) ); + + // -- Extract the inclusive jets with pt > ptmin, sorted by pt + vector inclusive_jets = clust_seq.inclusive_jets(header->GetPtMin()); + + // -- Subtract background + vector sub_jets = clust_seq.subtracted_jets((*header->GetRangeDefinition()), + header->GetPtMin()); + + // -- Sort jets into increasing pt + vector jets = sorted_by_pt(sub_jets); + + // -- Fill jets in output container + // ----------------------------------- + + // -- Get jet cuts + AliHLTJETJetCuts* jetCuts = header->GetJetCuts(); + + // -- Loop over jet candidates + for ( UInt_t jetIter = 0; jetIter < jets.size(); jetIter++ ) { + + // -- Fill AOD jets + AliAODJet aodjet (jets[jetIter].px(), jets[jetIter].py(), + jets[jetIter].pz(), jets[jetIter].E()); + + // -- Apply jet cuts + if ( ! jetCuts->IsSelected(&aodjet) ) + continue; + + fJets->AddJet(&aodjet); + + } // for ( Int_t jetIter = 0; jetIter < jets.size(); jetIter++ ) { + +#if 0 + // -- Print found jets + PrintJets( jets, clust_seq ); +#endif + + return 0; +} + diff --git a/HLT/JET/fastjet/AliHLTJETFastJetFinder.h b/HLT/JET/fastjet/AliHLTJETFastJetFinder.h new file mode 100644 index 00000000000..d36ac3714a0 --- /dev/null +++ b/HLT/JET/fastjet/AliHLTJETFastJetFinder.h @@ -0,0 +1,168 @@ +//-*- Mode: C++ -*- + +// $Id: AliHLTJETFastJetFinder.h $ + +#ifndef ALIHLTJETFASTJETFINDER_H +#define ALIHLTJETFASTJETFINDER_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 AliHLTJETFastJetFinder.h + @author Jochen Thaeder + @date + @brief FastJet finder interface +*/ + +// see below for class documentation +// or +// refer to README to build package +// or +// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + +#include "fastjet/PseudoJet.hh" +#include "fastjet/ClusterSequenceArea.hh" + +#include "AliJetFinder.h" + +#include "AliHLTJets.h" +#include "AliHLTLogging.h" + +#include "AliHLTJETBase.h" + +/** + * @class AliHLTJETFastJetFinder + * FastJet Interface for the fasjet package ( v.2.4.1 ) + * + * Usage in off-line
+ * * Initialization phase : + *
jetFinder->Init();
+ * * Set the input event via the reader + *
jetReader->SetInputEvent( ... )
+ * * Process one event (contains reset per event) + *
jetFinder->ProcessEvent();
+ * + * Usage in on-line
+ * * Initialization phase : + *
jetFinder->Initialize();
+ * * Set the input event via the reader + *
jetReader->SetInputEvent( ... )
+ * * Process one event + * * Fill input vector (contains reset per event) + *
jetReader->FillVectorXXX();
+ * Where XXX is has to be replaced by MC, ESD or AOD, + * depending, on the input object + * * Process one event (contains reset per event) + *
jetFinder->ProcessHLTEvent();
+ * + * @ingroup alihlt_jet_fastjet + */ + +class AliHLTJETFastJetFinder : public AliJetFinder, public AliHLTLogging { + + public: + + /* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + + /** standard constructor */ + AliHLTJETFastJetFinder(); + + /** destructor */ + virtual ~AliHLTJETFastJetFinder(); + + /* + * --------------------------------------------------------------------------------- + * 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( AliHLTJets* 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 ProcessHLTEvent(); + + /* + * --------------------------------------------------------------------------------- + * Helper + * --------------------------------------------------------------------------------- + */ + + /** Print found jets */ + void PrintJets(vector &jets, fastjet::ClusterSequenceArea &clust_seq); + + /////////////////////////////////////////////////////////////////////////////////// + +private: + + /** copy constructor prohibited */ + AliHLTJETFastJetFinder (const AliHLTJETFastJetFinder&); + + /** assignment operator prohibited */ + AliHLTJETFastJetFinder& operator= (const AliHLTJETFastJetFinder&); + + /* + * --------------------------------------------------------------------------------- + * Process - private + * --------------------------------------------------------------------------------- + */ + + /** Find jets, fill jets and apply jet cuts in one event + * @return 0 on success, < 0 on failure + */ + Int_t FindFastJets(); + + /* + * --------------------------------------------------------------------------------- + * Members - private + * --------------------------------------------------------------------------------- + */ + + /** Input vector for fastJet */ + vector *fInputVector; //! transient + + /** Container of AliAODJets */ + AliHLTJets *fJets; //! transient + + ClassDef(AliHLTJETFastJetFinder,1) +}; + +#endif diff --git a/HLT/JET/fastjet/AliHLTJETFastJetHeader.cxx b/HLT/JET/fastjet/AliHLTJETFastJetHeader.cxx new file mode 100644 index 00000000000..79dfc5764d9 --- /dev/null +++ b/HLT/JET/fastjet/AliHLTJETFastJetHeader.cxx @@ -0,0 +1,212 @@ +//-*- Mode: C++ -*- +// $Id: AliHLTJETFastJetHeader.cxx $ +/************************************************************************** + * This file is property of and copyright by the ALICE HLT Project * + * ALICE Experiment at CERN, All rights reserved. * + * * + * Primary Authors: Jochen Thaeder * + * 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 AliHLTJETFastJetHeader.cxx + @author Jochen Thaeder + @date + @brief Header of the FastJet finder interface +*/ + +// 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" + +#include "AliHLTJETReaderHeader.h" +#include "AliHLTJETFastJetHeader.h" + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTJETFastJetHeader) + +/* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +AliHLTJETFastJetHeader::AliHLTJETFastJetHeader() + : + AliJetHeader("AliHLTJETFastJetHeader"), + fAlgorithm(fastjet::kt_algorithm), + fStrategy(fastjet::Best), + fRecombScheme(fastjet::BIpt_scheme), + fGhostArea(0.05), + fActiveAreaRepeats(1), + fAreaType(fastjet::active_area), + fPtMin(5.), + fJetDefinition(NULL), + fGhostedAreaSpec(NULL), + fAreaDefinition(NULL), + fRangeDefinition(NULL), + fReaderHeader(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 + + // SetRapRange(rapmin, rapmax); +} + +// ################################################################################# +AliHLTJETFastJetHeader::~AliHLTJETFastJetHeader() { + // see header file for class documentation + + if ( fJetDefinition ) + delete fJetDefinition; + fJetDefinition = NULL; + + if ( fGhostedAreaSpec) + delete fGhostedAreaSpec; + fGhostedAreaSpec = NULL; + + if ( fAreaDefinition ) + delete fAreaDefinition; + fAreaDefinition = NULL; + + if ( fRangeDefinition ) + delete fRangeDefinition; + fRangeDefinition = NULL; +} + +/* + * --------------------------------------------------------------------------------- + * Initialize + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +Int_t AliHLTJETFastJetHeader::Initialize() { + // see header file for class documentation + + HLTInfo(" -= AliHLTJETFastJetHeader =- " ); + + Int_t iResult = 0; + + AliHLTJETReaderHeader* readerHeader = dynamic_cast(fReaderHeader); + + if ( !fJetCuts ) { + HLTError("No HLT jet cuts set!"); + return -1; + } + + // -- Set min pt + fPtMin = fJetCuts->GetMinEt(); + + // -- Set Algorithm + AliHLTJETBase::JetAlgorithmType_t GetJetAlgorithm(); + + if ( readerHeader->GetJetAlgorithm() == AliHLTJETBase::kKt ) + fAlgorithm = fastjet::kt_algorithm; + else if ( readerHeader->GetJetAlgorithm() == AliHLTJETBase::kAntiKt ) + fAlgorithm = fastjet::antikt_algorithm; + else { + HLTError("No algorithm found!"); + return -1; + } + + // -- Create an object that represents your choice of jet algorithm, + // and the associated parameters + if ( fJetDefinition ) + delete fJetDefinition; + fJetDefinition = new fastjet::JetDefinition(fAlgorithm, readerHeader->GetConeRadius(), + fRecombScheme, fStrategy); + + // -- Create the object that holds info about ghosts + if ( fGhostedAreaSpec ) + delete fGhostedAreaSpec; + fGhostedAreaSpec = new fastjet::GhostedAreaSpec(readerHeader->GetFiducialEtaMax(), + fActiveAreaRepeats, fGhostArea); + + // -- Create area definition + if ( fAreaDefinition ) + delete fAreaDefinition; + // xxx fAreaDefinition = new fastjet::AreaDefinition(fAreaType, fGhostedAreaSpec); + fAreaDefinition = new fastjet::AreaDefinition(fAreaType, (*fGhostedAreaSpec) ); + + // -- Set the rapididty, phi range within which to study the background + if ( fRangeDefinition ) + delete fRangeDefinition; + fRangeDefinition = new fastjet::RangeDefinition( readerHeader->GetFiducialEtaMin()+readerHeader->GetConeRadius(), + readerHeader->GetFiducialEtaMax()-readerHeader->GetConeRadius(), + readerHeader->GetFiducialPhiMin(), + readerHeader->GetFiducialPhiMax() ); + + // -- Check initialization + if ( !fJetDefinition || !fGhostedAreaSpec || + !fAreaDefinition || !fRangeDefinition ) { + HLTError("Initializing FastJet failed!"); + iResult = kFALSE; + } + + // -- Create comment + if ( !iResult ) { + fComment = "Running FastJet algorithm with the following setup."; + fComment+= "\n-Jet definition:\n "; + fComment+= TString(fJetDefinition->description()); + fComment+= ". \n-Area definition:\n "; + fComment+= TString(fAreaDefinition->description()); + fComment+= ". \n-Strategy adopted by FastJet:\n "; + } + + return iResult; +} + +/* + * --------------------------------------------------------------------------------- + * Helper + * --------------------------------------------------------------------------------- + */ + +// ################################################################################# +void AliHLTJETFastJetHeader::PrintParameters() const { + // see header file for class documentation + + HLTInfo( "FastJet algorithm parameters:" ); + + HLTInfo( "-- Jet Definition --- " ); +#if 0 + HLTInfo( "R %f ",fRparam ); + HLTInfo( "Jet Algorithm %s", fAlgorithm ); + HLTInfo( "Strategy " << fStrategy ); + HLTInfo( "Recombination Scheme " << fRecombScheme ); + + HLTInfo( "-- Ghosted Area Spec parameters --- " ); + HLTInfo( "Ghost Eta Max " << fGhostEtaMax ); + HLTInfo( "Ghost Area " << fGhostArea ); + HLTInfo( "Active Area Repeats " << fActiveAreaRepeats ); + + HLTInfo( "-- Area Definition parameters --- " ); + HLTInfo( "Area Type " << fAreaType ); + + HLTInfo( "-- Cluster Sequence Area parameters --- " ); + HLTInfo( "pt min " << fPtMin ); + + HLTInfo( "-- Range Definition parameters --- " ); + HLTInfo( " bkg rapidity range from " << fRapMin << " to " << fRapMax ); + HLTInfo( " bkg phi range from " << fPhiMin << " to " << fPhiMax ); +#endif +} diff --git a/HLT/JET/fastjet/AliHLTJETFastJetHeader.h b/HLT/JET/fastjet/AliHLTJETFastJetHeader.h new file mode 100644 index 00000000000..aca9e929378 --- /dev/null +++ b/HLT/JET/fastjet/AliHLTJETFastJetHeader.h @@ -0,0 +1,205 @@ +//-*- Mode: C++ -*- + +// $Id: AliHLTJETFastJetHeader.h $ + +#ifndef ALIHLTJETFASTJETHEADER_H +#define ALIHLTJETFASTJETHEADER_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 AliHLTJETFastJetHeader.h + @author Jochen Thaeder + @date + @brief Header of the FastJet finder interface +*/ + +// see below for class documentation +// or +// refer to README to build package +// or +// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + +//#include "fastjet/PseudoJet.hh" + +#include "fastjet/ClusterSequenceArea.hh" +#include "fastjet/AreaDefinition.hh" +#include "fastjet/JetDefinition.hh" + +#include "AliJetHeader.h" +#include "AliJetReaderHeader.h" +#include "AliHLTLogging.h" + +#include "AliHLTJETBase.h" + +/** + * @class AliHLTJETFastJetHeader + * FastJet Interface for the fasjet package ( v.2.4.1 ) + * + * + * @ingroup alihlt_jet_fastjet + */ + +class AliHLTJETFastJetHeader : public AliJetHeader, public AliHLTLogging { + + public: + + /* + * --------------------------------------------------------------------------------- + * Constructor / Destructor + * --------------------------------------------------------------------------------- + */ + + /** standard constructor */ + AliHLTJETFastJetHeader(); + + /** destructor */ + virtual ~AliHLTJETFastJetHeader(); + + /* + * --------------------------------------------------------------------------------- + * Initialize + * --------------------------------------------------------------------------------- + */ + + /** Initialize the jet header + * @return 0 on success, < 0 on failure + */ + Int_t Initialize(); + + /* + * --------------------------------------------------------------------------------- + * Setter + * --------------------------------------------------------------------------------- + */ + + /** Set Reader Header + * @param rh ptr to Analysis Cuts + */ + void SetReaderHeader(AliJetReaderHeader* rh ) { fReaderHeader = rh; } + + /** Set Analysis Cuts + * @param cuts ptr to AliHLTJETJetCuts + */ + void SetJetCuts( AliHLTJETJetCuts* cuts ) { fJetCuts = cuts; } + + /* + * --------------------------------------------------------------------------------- + * Getter + * --------------------------------------------------------------------------------- + */ + + /** Get Min Pt for jets */ + Double_t GetPtMin() const {return fPtMin;} + + /** Get Analysis Cuts + * @return ptr to AliHLTJETJetCuts + */ + AliHLTJETJetCuts* GetJetCuts() { return fJetCuts; } + + // -- FastJet Getters + // -------------------- + + /** Get jet definition */ + fastjet::JetDefinition* GetJetDefinition() {return fJetDefinition;} + + /** Get area definition */ + fastjet::AreaDefinition* GetAreaDefinition() {return fAreaDefinition;} + + /** Get range definition */ + fastjet::RangeDefinition* GetRangeDefinition() {return fRangeDefinition;} + + /* + * --------------------------------------------------------------------------------- + * Getter + * --------------------------------------------------------------------------------- + */ + + /** Print fastjet parameters */ + void PrintParameters() const; + + /////////////////////////////////////////////////////////////////////////////////// + +private: + + /** copy constructor prohibited */ + AliHLTJETFastJetHeader (const AliHLTJETFastJetHeader&); + + /** assignment operator prohibited */ + AliHLTJETFastJetHeader& operator= (const AliHLTJETFastJetHeader&); + + /* + * --------------------------------------------------------------------------------- + * Members - private + * --------------------------------------------------------------------------------- + */ + + // -- fastjet::JetDefinition parameters + // -------------------------------------- + + /** Jet Algorithm + * Default : fastjet::kt_algorithm + */ + fastjet::JetAlgorithm fAlgorithm; // see above + + /** Finding strategy + * Default : fastjet::Best + */ + fastjet::Strategy fStrategy; // see above + + /** Recombination scheme + * Default : fastjet::BIpt_scheme; + */ + fastjet::RecombinationScheme fRecombScheme; // see above + + // -- fastjet::GhostedAreaSpec parameters + // ---------------------------------------- + + /** Ghost area */ + Double_t fGhostArea; // see above + + /** Ghost area - active repeats */ + Int_t fActiveAreaRepeats; // see above + + // -- fastjet::AreaDefinition parameters + // --------------------------------------- + + /** Area Definition */ + fastjet::AreaType fAreaType; // see above + + // -- fastjet::ClusterSequenceArea options parameters + // ---------------------------------------------------- + + /** Jet pt > ptmin */ + Double_t fPtMin; // see above + + // -- fastjet classes + // -------------------- + + /** Jet definition */ + fastjet::JetDefinition *fJetDefinition; //! transient + + /** Ghost definition */ + fastjet::GhostedAreaSpec *fGhostedAreaSpec; //! transient + + /** Area definition */ + fastjet::AreaDefinition *fAreaDefinition; //! transient + + /** Range definition */ + fastjet::RangeDefinition *fRangeDefinition; //! transient + + // -- Ptr to classes + // ------------------- + + /** Ptr to jet reader header */ + AliJetReaderHeader *fReaderHeader; //! transient + + /** Cuts on jet selection */ + AliHLTJETJetCuts *fJetCuts; //! transient + + + ClassDef(AliHLTJETFastJetHeader,1) +}; + +#endif diff --git a/HLT/JET/macros/HLTJetReconstruction.C b/HLT/JET/macros/HLTJetReconstruction.C index b1229ed2b06..4d6cc106950 100644 --- a/HLT/JET/macros/HLTJetReconstruction.C +++ b/HLT/JET/macros/HLTJetReconstruction.C @@ -30,13 +30,21 @@ const Char_t* pprRunName[] = { "kPyJetJet", "kPyGammaJetPHOS" }; +// ---------------------------------------------------------------------------- +// -- Jet Parameter +// ---------------------------------------------------------------------------- + +Float_t aConeRadius[] = { 0.4, 0.7 }; +Float_t aCutPtSeed[] = { 4.0, 7.0, 10.0 }; +Float_t aCutEtJet[] = { 4.0, 7.0, 10.0, 15.0 }; + // ---------------------------------------------------------------------------- /** HLTJetReconstruction test macro * @param nEvents Number of events which should be processed */ -void HLTJetReconstruction(Int_t nEvents=1, Int_t idx=0, Bool_t generate=kFALSE, PprRun_t runType = kPythia6Jets104_125 ) { +void HLTJetReconstruction(Int_t nEvents=1, Bool_t generate=kFALSE, PprRun_t runType = kPythia6Jets104_125 ) { TString writerInput; TString analysisInput; @@ -81,13 +89,9 @@ void HLTJetReconstruction(Int_t nEvents=1, Int_t idx=0, Bool_t generate=kFALSE, // - - // // ----------------------------// - Float_t aConeRadius[] = { 0.4, 0.7 }; - Float_t aCutPtSeed[] = { 4.0, 7.0, 10.0 }; - Float_t aCutEtJet[] = { 4.0, 7.0, 10.0, 15.0 }; - - Float_t coneRadius = 0.7; - Float_t cutPtSeed = 4.0; - Float_t cutEtJet = 7.0; + Float_t coneRadius = aConeRadius[0]; + Float_t cutPtSeed = aCutPtSeed[0]; + Float_t cutEtJet = aCutEtJet[1]; Int_t seed = 12345; @@ -97,15 +101,14 @@ void HLTJetReconstruction(Int_t nEvents=1, Int_t idx=0, Bool_t generate=kFALSE, // - - // // ----------------------------// - // ------------------------------------------ - // -- The ESDMCEventPublisher - // ------------------------------------------ if ( ! generate ) { - + // ------------------------------------------ + // -- The ESDMCEventPublisher + // ------------------------------------------ TString publisherId("ESDMCEventPublisher"); + // ------------------------------------------ - TString publisherArg( Form("-entrytype MCFAST -dataspec 0x0000001F -datapath /home/jthaeder/jet/data/HEAD_2009-03-17/FastGen/kPythia6Jets104_125_14TeV/JET-ETA=-0.2,0.2_JET-ET=50,1000_R=0.4_10ev") ); - + TString publisherArg( Form("-entrytype MCFAST -dataspec 0x0000001F -datapath /home/jthaeder/jet/data/HEAD_2009-10-26/FastGen/kPythia6Jets125_150_14TeV/JET-ETA=-0.2,0.2_JET-ET=50,1000_R=0.4_200ev") ); AliHLTConfiguration ESDMCEventPublisher(publisherId.Data(), "ESDMCEventPublisher", NULL, publisherArg.Data() ); if (!analysisInput.IsNull()) analysisInput+=" "; @@ -115,12 +118,12 @@ void HLTJetReconstruction(Int_t nEvents=1, Int_t idx=0, Bool_t generate=kFALSE, jetInput += publisherId; } - // ------------------------------------------ - // -- The MCGenerator - // ------------------------------------------ else { - + // ------------------------------------------ + // -- The MCGenerator + // ------------------------------------------ TString generatorId( Form("MCGenerator_%s", pprRunName[runType]) ); + // ------------------------------------------ TString generatorArg( Form("-seed %d -nevents %d -runtype %d -coneRadius %.1f -jetCutMinEt %.1f", seed, nEvents, runType, coneRadius, cutEtJet)); @@ -143,10 +146,10 @@ void HLTJetReconstruction(Int_t nEvents=1, Int_t idx=0, Bool_t generate=kFALSE, // ------------------------------------------ // -- ConeJetFinder // ------------------------------------------ - TString jetId("JETConeJet"); + // ------------------------------------------ - TString jetArg( Form("-coneRadius %.1f -trackCutMinPt 0.0 -seedCutMinPt %.1f -jetCutMinEt %.1f", + TString jetArg( Form("-algorithm FSCSquareCell -leading 1 -coneRadius %.1f -trackCutMinPt 0.0 -seedCutMinPt %.1f -jetCutMinEt %.1f", coneRadius, cutPtSeed, cutEtJet) ); AliHLTConfiguration jetCone(jetId.Data(), "JETConeJetFinder", jetInput.Data(), jetArg.Data()); @@ -176,8 +179,9 @@ void HLTJetReconstruction(Int_t nEvents=1, Int_t idx=0, Bool_t generate=kFALSE, // ------------------------------------------ // -- Jet Analysis // ------------------------------------------ - TString analysisId("JETAnalysis"); + // ------------------------------------------ + TString analysisArg(""); AliHLTConfiguration jetAnalysis(analysisId.Data(), "JETAnalysis", analysisInput.Data(), analysisArg.Data() ); diff --git a/HLT/JET/macros/run.sh b/HLT/JET/macros/runChain.sh similarity index 72% rename from HLT/JET/macros/run.sh rename to HLT/JET/macros/runChain.sh index 85cfa656d7d..3f8dc04c850 100755 --- a/HLT/JET/macros/run.sh +++ b/HLT/JET/macros/runChain.sh @@ -1,8 +1,5 @@ #/bin/bash - -N_EVENTS=100 - if [ ! -d ./analysis ] ; then mkdir analysis fi @@ -13,8 +10,7 @@ if [ -n "${ROOTFILES}" ] ; then rm ${ROOTFILES} fi - -aliroot -b -l -q 'HLTJetReconstruction.C(10,0,kTRUE)' 2>&1 | tee log.log +aliroot -b -l -q 'HLTJetReconstruction.C(20,kTRUE)' 2>&1 | tee ChainLog.log ROOTFILES=`find . -maxdepth 1 -name "*.root" ` @@ -22,7 +18,6 @@ if [ -n "${ROOTFILES}" ] ; then rm ${ROOTFILES} fi -aliroot -l 'readJets.C("./analysis/EOR_analyze_10_kPythia6Jets104_125.root")' - +aliroot -l 'readJets.C("./analysis/EOR_analyze_20_kPythia6Jets104_125.root")' #valgrind --error-limit=no --leak-check=full --show-reachable=yes aliroot -b -l -q 'HLTJetReconstruction.C(10)' diff --git a/HLT/JET/macros/runTask.sh b/HLT/JET/macros/runTask.sh new file mode 100755 index 00000000000..525dbd12885 --- /dev/null +++ b/HLT/JET/macros/runTask.sh @@ -0,0 +1,24 @@ +#/bin/bash + +if [ ! -d ./analysis ] ; then + mkdir analysis +fi + +ROOTFILES=`find . -maxdepth 1 -name "*.root" ` + +if [ -n "${ROOTFILES}" ] ; then + rm ${ROOTFILES} +fi + +aliroot -b -l -q './tasks/JetAnalysisManagerHLT.C' 2>&1 | tee TaskLog.log + +ROOTFILES=`find . -maxdepth 1 -name "*.root" ` + +#if [ -n "${ROOTFILES}" ] ; then +# rm ${ROOTFILES} +#fi + +#aliroot -l 'readJets.C("./analysis/EOR_analyze_100_kPythia6Jets104_125.root")' + + +#valgrind --error-limit=no --leak-check=full --show-reachable=yes aliroot -b -l -q 'HLTJetReconstruction.C(10)' diff --git a/HLT/JET/macros/tasks/ConfigJetAnalysisHLT.C b/HLT/JET/macros/tasks/ConfigJetAnalysisHLT.C new file mode 100644 index 00000000000..9964b905b87 --- /dev/null +++ b/HLT/JET/macros/tasks/ConfigJetAnalysisHLT.C @@ -0,0 +1,95 @@ +/** --------------------------------------------------------------------- + * @file ConfigJetAnalysisHLT.C + * @author Jochen Thaeder + * @brief Run HLT cone finder in analysis framework, on ESDs + * + * --------------------------------------------------------------------- + */ + +AliJetFinder* ConfigJetAnalysis() { + + printf("ConfigJetAnalysis() -- HLT \n"); + + // --------------------------------------------------------------------- + // -- Defaults + // --------------------------------------------------------------------- + + TString comment = "HLT Fast Fixed Seeded Cone finder on ESD"; + AliHLTJETBase::JetAlgorithmType_t algorithm = AliHLTJETBase::kFFSCSquareCell; + + Bool_t leading = kFALSE; + Float_t coneRadius = 0.4; + Float_t trackCutMinPt = 1.0; + Float_t seedCutMinPt = 5.0; + Float_t jetCutMinEt = 15.0; + Bool_t useMC = kFALSE; + + // -- Jet Track Cuts + // --------------------------------------------------------------------- + AliHLTJETTrackCuts *trackCuts = new AliHLTJETTrackCuts(); + trackCuts->SetChargedOnly( kTRUE ); + trackCuts->SetMinPt( trackCutMinPt ); + + // -- Jet Seed Cuts + // --------------------------------------------------------------------- + AliHLTJETConeSeedCuts *seedCuts = new AliHLTJETConeSeedCuts(); + seedCuts->SetMinPt( seedCutMinPt ); + + // -- Jet Jet Cuts + // --------------------------------------------------------------------- + AliHLTJETJetCuts *jetCuts = new AliHLTJETJetCuts(); + jetCuts->SetMinEt( jetCutMinEt ); + + // -- Jet Reader Header + // --------------------------------------------------------------------- + AliHLTJETReaderHeader *jetReaderHeader = new AliHLTJETReaderHeader(); + + // Set Algorithm + jetReaderHeader->SetJetAlgorithm(algorithm); + + // Set prt to track cuts + jetReaderHeader->SetTrackCuts( trackCuts ); + jetReaderHeader->SetSeedCuts( seedCuts ); + + // Set Eta min/max and Phi min/max + jetReaderHeader->SetFiducialEta( -0.9, 0.9) ; + jetReaderHeader->SetFiducialPhi( 0.0, TMath::TwoPi() ) ; + + // Set grid binning + jetReaderHeader->SetGridEtaBinning( 0.05 ); + jetReaderHeader->SetGridPhiBinning( 0.05 ); + + // Set cone radius + jetReaderHeader->SetConeRadius(coneRadius); + + // Use Kinematics + jetReaderHeader->SetUseMC(useMC); + + // -- Jet Reader + // --------------------------------------------------------------------- + AliHLTJETReader *jetReader = new AliHLTJETReader(); + jetReader->SetReaderHeader(jetReaderHeader); + + // --------------------------------------------------------------------- + // -- Jet Container + // --------------------------------------------------------------------- + AliHLTJets *jets = new AliHLTJets(); + jets->SetComment(comment); + + // --------------------------------------------------------------------- + // -- Jet Header + // --------------------------------------------------------------------- + AliHLTJETConeHeader *jetHeader = new AliHLTJETConeHeader(); + jetHeader->SetJetCuts(jetCuts); + jetHeader->SetUseLeading(leading); + + // --------------------------------------------------------------------- + // -- Jet Finder + // --------------------------------------------------------------------- + AliHLTJETConeFinder *jetFinder = new AliHLTJETConeFinder(); + jetFinder->SetJetHeader(jetHeader); + jetFinder->SetJetReader(jetReader); + jetFinder->SetOutputJets(jets); + + return jetFinder; +} diff --git a/HLT/JET/macros/tasks/ConfigJetAnalysisHLTMC.C b/HLT/JET/macros/tasks/ConfigJetAnalysisHLTMC.C new file mode 100644 index 00000000000..38a7fe9dd50 --- /dev/null +++ b/HLT/JET/macros/tasks/ConfigJetAnalysisHLTMC.C @@ -0,0 +1,95 @@ +/** --------------------------------------------------------------------- + * @file ConfigJetAnalysisHLTMC.C + * @author Jochen Thaeder + * @brief Run HLT cone finder in analysis framework, on Kinematics + * + * --------------------------------------------------------------------- + */ + +AliJetFinder* ConfigJetAnalysis() { + + printf("ConfigJetAnalysis() -- HLT \n"); + + // --------------------------------------------------------------------- + // -- Defaults + // --------------------------------------------------------------------- + + TString comment = "HLT Fast Fixed Seeded Cone finder on MC"; + AliHLTJETBase::JetAlgorithmType_t algorithm = AliHLTJETBase::kFFSCSquareCell; + + Bool_t leading = kFALSE; + Float_t coneRadius = 0.4; + Float_t trackCutMinPt = 1.0; + Float_t seedCutMinPt = 5.0; + Float_t jetCutMinEt = 15.0; + Bool_t useMC = kTRUE; + + // -- Jet Track Cuts + // --------------------------------------------------------------------- + AliHLTJETTrackCuts *trackCuts = new AliHLTJETTrackCuts(); + trackCuts->SetChargedOnly( kTRUE ); + trackCuts->SetMinPt( trackCutMinPt ); + + // -- Jet Seed Cuts + // --------------------------------------------------------------------- + AliHLTJETConeSeedCuts *seedCuts = new AliHLTJETConeSeedCuts(); + seedCuts->SetMinPt( seedCutMinPt ); + + // -- Jet Jet Cuts + // --------------------------------------------------------------------- + AliHLTJETJetCuts *jetCuts = new AliHLTJETJetCuts(); + jetCuts->SetMinEt( jetCutMinEt ); + + // -- Jet Reader Header + // --------------------------------------------------------------------- + AliHLTJETReaderHeader *jetReaderHeader = new AliHLTJETReaderHeader(); + + // Set Algorithm + jetReaderHeader->SetJetAlgorithm(algorithm); + + // Set prt to track cuts + jetReaderHeader->SetTrackCuts( trackCuts ); + jetReaderHeader->SetSeedCuts( seedCuts ); + + // Set Eta min/max and Phi min/max + jetReaderHeader->SetFiducialEta( -0.9, 0.9) ; + jetReaderHeader->SetFiducialPhi( 0.0, TMath::TwoPi() ) ; + + // Set grid binning + jetReaderHeader->SetGridEtaBinning( 0.05 ); + jetReaderHeader->SetGridPhiBinning( 0.05 ); + + // Set cone radius + jetReaderHeader->SetConeRadius(coneRadius); + + // Use Kinematics + jetReaderHeader->SetUseMC(useMC); + + // -- Jet Reader + // --------------------------------------------------------------------- + AliHLTJETReader *jetReader = new AliHLTJETReader(); + jetReader->SetReaderHeader(jetReaderHeader); + + // --------------------------------------------------------------------- + // -- Jet Container + // --------------------------------------------------------------------- + AliHLTJets *jets = new AliHLTJets(); + jets->SetComment(comment); + + // --------------------------------------------------------------------- + // -- Jet Header + // --------------------------------------------------------------------- + AliHLTJETConeHeader *jetHeader = new AliHLTJETConeHeader(); + jetHeader->SetJetCuts(jetCuts); + jetHeader->SetUseLeading(leading); + + // --------------------------------------------------------------------- + // -- Jet Finder + // --------------------------------------------------------------------- + AliHLTJETConeFinder *jetFinder = new AliHLTJETConeFinder(); + jetFinder->SetJetHeader(jetHeader); + jetFinder->SetJetReader(jetReader); + jetFinder->SetOutputJets(jets); + + return jetFinder; +} diff --git a/HLT/JET/macros/tasks/JetAnalysisManagerHLT.C b/HLT/JET/macros/tasks/JetAnalysisManagerHLT.C new file mode 100644 index 00000000000..9f7d4058f45 --- /dev/null +++ b/HLT/JET/macros/tasks/JetAnalysisManagerHLT.C @@ -0,0 +1,110 @@ +void JetAnalysisManagerHLT() { + + if ( getenv("FASTJET") ) { + gSystem->Load("libCGAL.so"); + gSystem->Load("libfastjet.so"); + gSystem->Load("libSISConePlugin.so"); + } + + gSystem->Load("libTree.so"); + gSystem->Load("libPhysics.so"); + gSystem->Load("libGeom.so"); + gSystem->Load("libVMC.so"); + gSystem->Load("libANALYSIS.so"); + gSystem->Load("libSTEERBase.so"); + gSystem->Load("libAOD.so"); + gSystem->Load("libESD.so"); + gSystem->Load("libANALYSISalice.so"); + gSystem->Load("libJETAN.so"); + + gSystem->Load("libHLTbase.so"); + gSystem->Load("libAliHLTUtil.so"); + gSystem->Load("libAliHLTJET.so"); + + // -------------------------------------------------------------------------------- + + if (gApplication) gApplication->InitializeGraphics(); + + // -------------------------------------------------------------------------------- + // + // Create the chain + // + // -------------------------------------------------------------------------------- + + gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); + TChain* chain = new TChain("esdTree"); + + chain->Add("~/jet/data/HEAD_2009-06-04/kPythia6Jets104_125_14TeV/JET-ETA=-0.2,0.2_JET-ET=10,1000_R=0.7_100ev/AliESDs.root"); + //chain->Add("~/jet/data/HEAD_2009-06-04/kPythia6Jets104_125_14TeV/JET-ETA=-0.2,0.2_JET-ET=10,1000_R=0.7_1ev/AliESDs.root"); + + // -------------------------------------------------------------------------------- + // + // Create the analysis manager + // + // -------------------------------------------------------------------------------- + + // Input + AliESDInputHandler* inpHandler = new AliESDInputHandler(); + + // Output + AliAODHandler* aodHandler = new AliAODHandler(); + aodHandler->SetOutputFileName("aod.root"); + + // MC Truth + AliMCEventHandler* mcHandler = new AliMCEventHandler(); + + AliAnalysisManager *mgr = new AliAnalysisManager("Jet Manager", "Jet Manager"); + mgr->SetInputEventHandler (inpHandler); + mgr->SetOutputEventHandler (aodHandler); + mgr->SetMCtruthEventHandler(mcHandler); + mgr->SetDebugLevel(0); + + // -------------------------------------------------------------------------------- + // + // Set Configfiles + // + // -------------------------------------------------------------------------------- + + // -- HLT FFSC + AliAnalysisTaskJets *jetana = new AliAnalysisTaskJets("JetAnalysisHLT"); + jetana->SetConfigFile("./tasks/ConfigJetAnalysisHLT.C"); + jetana->SetNonStdBranch("jetsHLT"); + jetana->SetDebugLevel(10); + mgr->AddTask(jetana); + + // -- HLT FFSC - MC + AliAnalysisTaskJets *jetanaMC = new AliAnalysisTaskJets("JetAnalysisHLTMC"); + jetanaMC->SetConfigFile("./tasks/ConfigJetAnalysisHLTMC.C"); + jetanaMC->SetNonStdBranch("jetsHLTMC"); + jetanaMC->SetDebugLevel(0); + mgr->AddTask(jetanaMC); + + // -------------------------------------------------------------------------------- + // + // Create containers for input/output + // + // -------------------------------------------------------------------------------- + + AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); + AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer(); + AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histos", TList::Class(), AliAnalysisManager::kOutputContainer, "histos.root"); + AliAnalysisDataContainer *coutputMC2 = mgr->CreateContainer("histosMC", TList::Class(), AliAnalysisManager::kOutputContainer, "histosMC.root"); + + mgr->ConnectInput (jetana, 0, cinput1 ); + mgr->ConnectOutput (jetana, 0, coutput1 ); + mgr->ConnectOutput (jetana, 1, coutput2 ); + + mgr->ConnectInput (jetanaMC, 0, cinput1 ); + mgr->ConnectOutput (jetanaMC, 0, coutput1 ); + mgr->ConnectOutput (jetanaMC, 1, coutputMC2 ); + + // -------------------------------------------------------------------------------- + // + // Run the analysis + // + // -------------------------------------------------------------------------------- + + mgr->InitAnalysis(); + mgr->PrintStatus(); + mgr->StartAnalysis("local",chain); +} diff --git a/HLT/JET/macros/tasks/JetAnalysisManagerHLTKine.C b/HLT/JET/macros/tasks/JetAnalysisManagerHLTKine.C new file mode 100644 index 00000000000..9f4a76c9037 --- /dev/null +++ b/HLT/JET/macros/tasks/JetAnalysisManagerHLTKine.C @@ -0,0 +1,76 @@ +void JetAnalysisManagerHLTKine() +{ + gSystem->Load("libCGAL.so"); + gSystem->Load("${FASTJET}/lib/libfastjet.so"); + + gSystem->Load("libTree.so"); + gSystem->Load("libPhysics.so"); + gSystem->Load("libGeom.so"); + gSystem->Load("libVMC.so"); + gSystem->Load("libANALYSIS.so"); + gSystem->Load("libSTEERBase.so"); + gSystem->Load("libAOD.so"); + gSystem->Load("libESD.so"); + gSystem->Load("libANALYSISalice.so"); + gSystem->Load("libJETAN.so"); + + // + if (gApplication) gApplication->InitializeGraphics(); + // Create the chain + // + + gROOT->LoadMacro("${ALICE_ROOT}/PWG0/CreateESDChain.C"); + TChain* chain = new TChain("TE"); + chain->Add("/home/jthaeder/jet/data/HEAD_2009-03-17/FastGen/kPythia6Jets104_125_14TeV/JET-ETA=-0.2,0.2_JET-ET=50,1000_R=0.4_10ev/galice.root"); + + /////////////////////////////////////////////////////////////////////////////////// + // Create the analysis manager + // + // Output + AliAODHandler* aodHandler = new AliAODHandler(); + aodHandler->SetOutputFileName("aod.root"); + // MC Truth + AliMCEventHandler* mcHandler = new AliMCEventHandler(); + mcHandler->SetReadTR(kFALSE); + + AliAnalysisManager *mgr = new AliAnalysisManager("Jet Manager", "Jet Manager"); + mgr->SetOutputEventHandler (aodHandler); + mgr->SetMCtruthEventHandler(mcHandler); + mgr->SetDebugLevel(10); + + AliAnalysisTaskKineFilter *kinefilter = new AliAnalysisTaskKineFilter("Kine Filter"); + mgr->AddTask(kinefilter); + + + AliAnalysisTaskJets *jetana = new AliAnalysisTaskJets("JetAnalysis"); + //jetana->SetConfigFile("ConfigJetAnalysisFastjetMC.C"); + jetana->SetConfigFile("${ALICE_ROOT}/HLT/JET/macros/tasks/ConfigJetAnalysisHLTMC.C"); + jetana->SetDebugLevel(10); + mgr->AddTask(jetana); + + // + // Create containers for input/output + AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), + AliAnalysisManager::kInputContainer); + + AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(), + AliAnalysisManager::kOutputContainer, "default"); + + AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histos", TList::Class(), + AliAnalysisManager::kOutputContainer, "histos.root"); + + mgr->ConnectInput (kinefilter, 0, cinput1 ); + mgr->ConnectOutput (kinefilter, 0, coutput1 ); + + mgr->ConnectInput (jetana, 0, cinput1 ); + mgr->ConnectOutput (jetana, 0, coutput1 ); + mgr->ConnectOutput (jetana, 1, coutput2 ); + + // + // Run the analysis + // + + mgr->InitAnalysis(); + mgr->PrintStatus(); + mgr->StartAnalysis("local",chain); +} diff --git a/HLT/libAliHLTJET.pkg b/HLT/libAliHLTJET.pkg index bdaa9b11467..5c74adf6f3f 100644 --- a/HLT/libAliHLTJET.pkg +++ b/HLT/libAliHLTJET.pkg @@ -19,7 +19,9 @@ CLASS_HDRS := AliHLTJETAgent.h \ analysis/AliHLTJETAnalysisMerge.h \ analysis/AliHLTJETAnalysisComponent.h -CLASS_HDRS_FJ := AliHLTJETFastJetComponent.h +CLASS_HDRS_FJ := fastjet/AliHLTJETFastJetHeader.h \ + fastjet/AliHLTJETFastJetFinder.h \ + fastjet/AliHLTJETFastJetComponent.h ############################################################################### @@ -37,6 +39,7 @@ EINCLUDE := HLT/BASE \ HLT/BASE/util \ HLT/JET \ HLT/JET/cone \ + HLT/JET/fastjet \ HLT/JET/analysis \ ANALYSIS \ JETAN \