ATLAS Offline Software
Loading...
Searching...
No Matches
PseudoJetTranslator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5
6
7xAOD::Jet& PseudoJetTranslator::translate(const fastjet::PseudoJet& pj,
8 const PseudoJetContainer& pjCont,
9 xAOD::JetContainer& jetCont, const xAOD::Vertex* originVertex) const {
10
11 // Create a new jet in place at the end of the container
12 jetCont.emplace_back(new xAOD::Jet());
13 xAOD::Jet& jet = *jetCont.back();
14 jet.setJetP4( xAOD::JetFourMom_t( pj.pt(), pj.eta(), pj.phi(), pj.m() ) );
15
16 const static SG::AuxElement::Accessor<const fastjet::PseudoJet*> pjAccessor("PseudoJet");
17 pjAccessor(jet) = &pj;
18
19 // Record the jet-finding momentum, i.e. the one used to find/groom the jet.
20 jet.setJetP4(xAOD::JetConstitScaleMomentum, jet.jetP4());
21
22 // save area if needed ---------
23 if( pj.has_area() ){
24
25 if(m_saveArea) jet.setAttribute(xAOD::JetAttribute::ActiveArea,pj.area());
27 fastjet::PseudoJet pja = pj.area_4vector();
28 xAOD::JetFourMom_t fvarea(pja.pt(), pja.eta(), pja.phi(), pja.m());
29 jet.setAttribute(xAOD::JetAttribute::ActiveArea4vec, fvarea);
30 }
31 }// area -------------
32
33 if (originVertex == nullptr){
34 pjCont.extractConstituents(jet, pj);
35 }
36 else{
37 pjCont.extractByVertexConstituents(jet, pj, originVertex);
38 }
39
40 return jet;
41}
42
43xAOD::Jet& PseudoJetTranslator::translate(const fastjet::PseudoJet& pj,
44 const PseudoJetContainer& pjCont,
45 xAOD::JetContainer& jetCont,
46 const xAOD::Jet &parent, const xAOD::Vertex* originVertex) const {
47 xAOD::Jet& jet = translate(pj, pjCont, jetCont, originVertex);
48
49 const xAOD::JetContainer* parentCont = dynamic_cast<const xAOD::JetContainer*>(parent.container());
50 if ( parentCont == nullptr ) { return jet ;} // can this happen? if so THIS IS an ERROR ! should do something
51
52 ElementLink<xAOD::JetContainer> el(*parentCont, parent.index());
53 static const SG::AuxElement::Accessor<ElementLink<xAOD::JetContainer> > parentELacc("Parent_TEMP");
54 parentELacc(jet) =el;
55
56 jet.setInputType(parent.getInputType());
57 jet.setAlgorithmType(parent.getAlgorithmType());
58 jet.setSizeParameter(parent.getSizeParameter());
59 jet.setConstituentsSignalState(parent.getConstituentsSignalState());
60
61 float area=0;
62 if(parent.getAttribute(xAOD::JetAttribute::JetGhostArea, area)) jet.setAttribute(xAOD::JetAttribute::JetGhostArea, area);
63
64 return jet;
65}
double area(double R)
const T * back() const
Access the last element in the collection as an rvalue.
value_type emplace_back(value_type pElem)
Add an element to the end of the collection.
bool extractByVertexConstituents(xAOD::Jet &jet, const PseudoJet &finalPJ, const xAOD::Vertex *vertex) const
bool extractConstituents(xAOD::Jet &, const std::vector< PseudoJet > &) const
xAOD::Jet & translate(const fastjet::PseudoJet &pj, const PseudoJetContainer &pjCont, xAOD::JetContainer &jetCont, const xAOD::Vertex *originVertex=nullptr) const
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
Jet_v1 Jet
Definition of the current "jet version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
@ JetConstitScaleMomentum
Definition JetTypes.h:29
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition JetTypes.h:17