ATLAS Offline Software
PseudoJetTranslator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 
7 xAOD::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());
26  if(m_saveArea4Vec){
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 
43 xAOD::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");
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;
63 
64  return jet;
65 }
DataVector::emplace_back
value_type emplace_back(value_type pElem)
Add an element to the end of the collection.
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
xAOD::JetAttribute::JetGhostArea
@ JetGhostArea
Definition: JetAttributes.h:41
PseudoJetContainer
Definition: PseudoJetContainer.h:48
xAOD::JetConstitScaleMomentum
@ JetConstitScaleMomentum
Definition: JetTypes.h:29
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
PseudoJetTranslator.h
PseudoJetTranslator::m_saveArea
bool m_saveArea
Definition: PseudoJetTranslator.h:28
xAOD::JetAttribute::ActiveArea4vec
@ ActiveArea4vec
Definition: JetAttributes.h:43
test_pyathena.parent
parent
Definition: test_pyathena.py:15
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
PseudoJetTranslator::translate
xAOD::Jet & translate(const fastjet::PseudoJet &pj, const PseudoJetContainer &pjCont, xAOD::JetContainer &jetCont, const xAOD::Vertex *originVertex=nullptr) const
Definition: PseudoJetTranslator.cxx:7
PseudoJetContainer::extractConstituents
bool extractConstituents(xAOD::Jet &, const std::vector< PseudoJet > &) const
Definition: PseudoJetContainer.cxx:48
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
PseudoJetTranslator::m_saveArea4Vec
bool m_saveArea4Vec
Definition: PseudoJetTranslator.h:29
xAOD::JetAttribute::ActiveArea
@ ActiveArea
Definition: JetAttributes.h:42
area
double area(double R)
Definition: ConvertStaveServices.cxx:42
PseudoJetContainer::extractByVertexConstituents
bool extractByVertexConstituents(xAOD::Jet &jet, const PseudoJet &finalPJ, const xAOD::Vertex *vertex) const
Definition: PseudoJetContainer.cxx:114