|
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include "fastjet/PseudoJet.hh"
9 #include "fastjet/ClusterSequence.hh"
10 #include "fastjet/ClusterSequenceArea.hh"
11 #include "fastjet/config.h"
12 #include "fastjet/contrib/VariableRPlugin.hh"
33 return StatusCode::SUCCESS;
39 auto nullreturn = std::make_pair(std::unique_ptr<xAOD::JetContainer>(
nullptr), std::unique_ptr<SG::IAuxStore>(
nullptr));
53 unsigned numVertices = vertices->
size();
54 ATH_MSG_DEBUG(
"Retrieved vertex container for by-vertex clustering");
58 auto jets = std::make_unique<xAOD::JetContainer>();
59 auto auxCont = std::make_unique<xAOD::JetAuxContainer>();
60 jets->setStore(auxCont.get());
72 ATH_MSG_DEBUG(
"Pseudojet input container has size " << inputPseudoJetVector->size());
74 std::unique_ptr<fastjet::ClusterSequence> clSequence = std::make_unique<fastjet::ClusterSequence>();
76 std::unique_ptr<PseudoJetVector> outputPseudoJetVector = std::make_unique<PseudoJetVector>();
78 for (
unsigned int iVertex{0}; iVertex < numVertices; iVertex++)
82 for (
unsigned int iJet{0}; iJet < inputPseudoJetVector->size(); iJet++)
84 fastjet::PseudoJet &pseudoJet = inputPseudoJetVector->at(iJet);
91 pseudoJet = cachedPseudoJetVector.at(iJet);
92 if (originVertex !=
vertex)
101 ATH_MSG_VERBOSE(
"Constituent found with pT = " << pseudoJet.pt() <<
" belonging to vertex index: " << userInfo.
vertex()->
index());
106 std::unique_ptr<fastjet::ClusterSequence> clSequenceByVertex =
buildClusterSequence(inputPseudoJetVector);
107 if (!clSequenceByVertex)
115 auto outputPseudoJetVectorByVertex = std::make_unique<PseudoJetVector>(fastjet::sorted_by_pt(clSequenceByVertex->inclusive_jets(
m_ptmin)));
118 for (
const auto &pj : *outputPseudoJetVectorByVertex)
120 msg() <<
" Pseudojet with pt " << std::setprecision(4) << pj.Et() * 1
e-3 <<
" has " << pj.constituents().size() <<
" constituents" <<
endmsg;
126 if (!outputPseudoJetVectorByVertex->empty())
128 for (
const fastjet::PseudoJet &pj : *outputPseudoJetVectorByVertex)
133 ATH_MSG_DEBUG(
"For vertex index " << iVertex <<
", total reconstructed jet count so far: " <<
jets->size() <<
" clusterseq=" << clSequenceByVertex.get());
136 for (
const fastjet::PseudoJet &pj : *outputPseudoJetVectorByVertex)
138 outputPseudoJetVector->emplace_back(pj);
147 if (!outputPseudoJetVector->empty())
152 if (!pjVectorHandle.
record(std::move(outputPseudoJetVector)))
160 if (!clusterSeqHandle.
record(std::move(clSequence)))
169 return std::make_pair(std::move(
jets), std::move(auxCont));
const xAOD::Vertex * vertex() const
Returns the associated vertex if this constit is a track. Else returns null. */.
const_pointer_type cptr()
Dereference the pointer.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
bool msgLvl(const MSG::Level lvl) const
SG::WriteHandleKey< jet::ClusterSequence > m_clusterSequence
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
StatusCode initialize() override
Dummy implementation of the initialisation function.
SG::ReadHandleKey< PseudoJetContainer > m_inputPseudoJets
Handle Input PseudoJetContainer.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::unique_ptr< fastjet::ClusterSequence > buildClusterSequence(const PseudoJetVector *pseudoJetvector) const
Used to create the cluster sequence.
size_t index() const
Return the index of this element within its container.
void append(const PseudoJetContainer *)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::pair< std::unique_ptr< xAOD::JetContainer >, std::unique_ptr< SG::IAuxStore > > getJets() const override
Return the final jets with their aux store.
StatusCode initialize() override
Dummy implementation of the initialisation function.
std::vector< fastjet::PseudoJet > PseudoJetVector
Class describing a Vertex.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandleKey< PseudoJetVector > m_finalPseudoJets
used to build the key under which the final PJ will be stored in evtStore()
JetClustererByVertex(const std::string &name)
Gaudi::Property< float > m_ptmin
const std::vector< PseudoJet > * casVectorPseudoJet() const
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
void processPseudoJet(const fastjet::PseudoJet &pj, const PseudoJetContainer &pjCont, xAOD::JetContainer *jets, const xAOD::Vertex *vertex) const
translate to xAOD::Jet