ATLAS Offline Software
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ViewCreatorCentredOnJetWithPVConstraintROITool Class Reference

#include <ViewCreatorCentredOnJetWithPVConstraintROITool.h>

Inheritance diagram for ViewCreatorCentredOnJetWithPVConstraintROITool:
Collaboration diagram for ViewCreatorCentredOnJetWithPVConstraintROITool:

Public Member Functions

 ViewCreatorCentredOnJetWithPVConstraintROITool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~ViewCreatorCentredOnJetWithPVConstraintROITool ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode attachROILinks (TrigCompositeUtils::DecisionContainer &decisions, const EventContext &ctx) const override
 Tool interface method. More...
 

Public Attributes

SG::WriteHandleKey< TrigRoiDescriptorCollectionm_roisWriteHandleKey
 
Gaudi::Property< double > m_roiEtaWidth
 
Gaudi::Property< double > m_roiPhiWidth
 
Gaudi::Property< double > m_roiZWidth
 
SG::ReadHandleKey< xAOD::VertexContainerm_vertexReadHandleKey
 
Gaudi::Property< std::string > m_prmVtxLink
 

Protected Member Functions

const xAOD::VertexgetPrimaryVertex (const xAOD::VertexContainer *) const
 

Detailed Description

Creates a new ROI centred on an object deriving from xAOD::Jet adding a PV constraint.

Stores this new ROI in the output container, and links it to the Decision Object

The new EventView spawned by the parent EventViewCreatorAlgorithm of this tool will process in this new ROI.

In the majority of cases, this tool will be used to create the new ROI centred on the "feature" from the previous Step.

Definition at line 26 of file ViewCreatorCentredOnJetWithPVConstraintROITool.h.

Constructor & Destructor Documentation

◆ ViewCreatorCentredOnJetWithPVConstraintROITool()

ViewCreatorCentredOnJetWithPVConstraintROITool::ViewCreatorCentredOnJetWithPVConstraintROITool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 13 of file ViewCreatorCentredOnJetWithPVConstraintROITool.cxx.

16  : base_class(type, name, parent)
17 {}

◆ ~ViewCreatorCentredOnJetWithPVConstraintROITool()

virtual ViewCreatorCentredOnJetWithPVConstraintROITool::~ViewCreatorCentredOnJetWithPVConstraintROITool ( )
virtualdefault

Member Function Documentation

◆ attachROILinks()

StatusCode ViewCreatorCentredOnJetWithPVConstraintROITool::attachROILinks ( TrigCompositeUtils::DecisionContainer decisions,
const EventContext &  ctx 
) const
overridevirtual

Tool interface method.

Definition at line 33 of file ViewCreatorCentredOnJetWithPVConstraintROITool.cxx.

34  {
35 
36  // ===================================================================================== //
37  // Retrieve Primary Vertex... only 1 in the event
39  ATH_CHECK( vertexContainerHandle.isValid() );
40 
41  const xAOD::VertexContainer *vertexContainer = vertexContainerHandle.get();
42  ATH_MSG_DEBUG( "I'm working with " << vertexContainer->size() << " vertices" );
43 
44  const xAOD::Vertex* primaryVertex = getPrimaryVertex( vertexContainer );
45  if ( primaryVertex == nullptr ) {
46  ATH_MSG_ERROR( "No primary vertex has been found for this event!" );
47  return StatusCode::FAILURE;
48  }
49  ATH_MSG_DEBUG( " ** PV = (" << primaryVertex->x() <<
50  "," << primaryVertex->y() <<
51  "," << primaryVertex->z() << ")" );
52 
53  // ===================================================================================== //
54  // ===================================================================================== //
55  // Create output RoI collection
56 
58  // ===================================================================================== //
59 
60  for ( TrigCompositeUtils::Decision* outputDecision : decisions ) {
61  const std::vector< TrigCompositeUtils::LinkInfo< xAOD::JetContainer >> myFeature = TrigCompositeUtils::findLinks< xAOD::JetContainer >(outputDecision, TrigCompositeUtils::featureString(), TrigDefs::lastFeatureOfType);
62 
63  if (myFeature.size() != 1) {
64  ATH_MSG_ERROR("Did not find exactly one most-recent xAOD::Jet '" << TrigCompositeUtils::featureString() << "' for Decision object index " << outputDecision->index()
65  << ", found " << myFeature.size());
66  return StatusCode::FAILURE;
67  }
68  ATH_CHECK(myFeature.at(0).isValid());
69 
70  const xAOD::Jet *myJet = *(myFeature.at(0).link);
71  double jetPt = myJet->p4().Et();
72  double jetEta = myJet->eta();
73  double jetPhi = myJet->phi();
74 
75  ATH_MSG_DEBUG("JET -- pt=" << jetPt <<
76  " eta=" << jetEta <<
77  " phi=" << jetPhi );
78 
79  // create ROIs
80  ATH_MSG_DEBUG("Creating RoI");
81  ATH_MSG_DEBUG( " ** Imposing Z constraint while building RoI" );
82  double etaMinus = jetEta - m_roiEtaWidth;
83  double etaPlus = jetEta + m_roiEtaWidth;
84 
85  double phiMinus = CxxUtils::wrapToPi( jetPhi - m_roiPhiWidth );
86  double phiPlus = CxxUtils::wrapToPi( jetPhi + m_roiPhiWidth );
87 
88  double zMinus = primaryVertex->z() - m_roiZWidth;
89  double zPlus = primaryVertex->z() + m_roiZWidth;
90 
91  TrigRoiDescriptor *newROI = new TrigRoiDescriptor( jetEta,etaMinus, etaPlus,
92  jetPhi, phiMinus, phiPlus,
93  primaryVertex->z(),zMinus,zPlus );
94 
95  roisWriteHandle->push_back( newROI );
96  const ElementLink< TrigRoiDescriptorCollection > roiEL = ElementLink< TrigRoiDescriptorCollection >( *roisWriteHandle, roisWriteHandle->size() - 1, ctx );
97 
98  outputDecision->setObjectLink( TrigCompositeUtils::roiString(), roiEL );
99  outputDecision->setObjectLink( m_prmVtxLink.value(),
101 
102  ATH_MSG_DEBUG("PRINTING DECISION");
103  ATH_MSG_DEBUG( *outputDecision );
104  }
105 
106  return StatusCode::SUCCESS;
107 }

◆ getPrimaryVertex()

const xAOD::Vertex * ViewCreatorCentredOnJetWithPVConstraintROITool::getPrimaryVertex ( const xAOD::VertexContainer vertexContainer) const
protected

Definition at line 109 of file ViewCreatorCentredOnJetWithPVConstraintROITool.cxx.

109  {
110  // In case we need more complex selection
111  if ( vertexContainer->size() == 0 ) {
112  ATH_MSG_WARNING( "Vertex Container has size 0! This can't be right!" );
113  return nullptr;
114  }
115 
116  for ( unsigned int i(0); i<vertexContainer->size(); i++ ) {
117  const xAOD::Vertex *vertex = vertexContainer->at(i);
118  if ( vertex->vertexType() != xAOD::VxType::VertexType::PriVtx ) continue;
119  return vertex;
120  }
121 
122  ATH_MSG_DEBUG( "None of the vertexes in the vertex container is a primary vertex!" );
123  ATH_MSG_DEBUG( "Using dummy vertex!" );
124  return vertexContainer->at(0);
125 }

◆ initialize()

StatusCode ViewCreatorCentredOnJetWithPVConstraintROITool::initialize ( )
overridevirtual

Definition at line 20 of file ViewCreatorCentredOnJetWithPVConstraintROITool.cxx.

20  {
22  ATH_CHECK( m_vertexReadHandleKey.initialize() );
23 
24  // FIXME: We have to renounce to the Vertex RedHandleKey due to problems in the scheduler's sanity checks
25  // 'Strongly connected components found in DF realm' (see ATR-21298)
26  // Short term way of avoiding the issue
27  renounce( m_vertexReadHandleKey );
28 
29  return StatusCode::SUCCESS;
30 }

Member Data Documentation

◆ m_prmVtxLink

Gaudi::Property< std::string > ViewCreatorCentredOnJetWithPVConstraintROITool::m_prmVtxLink
Initial value:
{this,"PrmVtxLink","",
"PrmVtx link to attach to the output decision"}

Definition at line 60 of file ViewCreatorCentredOnJetWithPVConstraintROITool.h.

◆ m_roiEtaWidth

Gaudi::Property< double > ViewCreatorCentredOnJetWithPVConstraintROITool::m_roiEtaWidth
Initial value:
{this,"RoIEtaWidth",0.4,
"Extent of the ROI in eta from its centre"}

Definition at line 48 of file ViewCreatorCentredOnJetWithPVConstraintROITool.h.

◆ m_roiPhiWidth

Gaudi::Property< double > ViewCreatorCentredOnJetWithPVConstraintROITool::m_roiPhiWidth
Initial value:
{this,"RoIPhiWidth",0.4,
"Extent of the ROI in phi from its centre"}

Definition at line 51 of file ViewCreatorCentredOnJetWithPVConstraintROITool.h.

◆ m_roisWriteHandleKey

SG::WriteHandleKey< TrigRoiDescriptorCollection > ViewCreatorCentredOnJetWithPVConstraintROITool::m_roisWriteHandleKey
Initial value:
{this,"RoisWriteHandleKey","",
"Name of the ROI collection produced by this tool."}

Definition at line 45 of file ViewCreatorCentredOnJetWithPVConstraintROITool.h.

◆ m_roiZWidth

Gaudi::Property< double > ViewCreatorCentredOnJetWithPVConstraintROITool::m_roiZWidth
Initial value:
{this,"RoIZWidth",10.0,
"Z Half Width in mm"}

Definition at line 54 of file ViewCreatorCentredOnJetWithPVConstraintROITool.h.

◆ m_vertexReadHandleKey

SG::ReadHandleKey< xAOD::VertexContainer > ViewCreatorCentredOnJetWithPVConstraintROITool::m_vertexReadHandleKey
Initial value:
{this,"VertexReadHandleKey","",
"Name of the Vertex collection required as input for constructing the ROI"}

Definition at line 57 of file ViewCreatorCentredOnJetWithPVConstraintROITool.h.


The documentation for this class was generated from the following files:
xAOD::Vertex_v1::x
float x() const
Returns the x position.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CxxUtils::wrapToPi
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition: phihelper.h:24
ViewCreatorCentredOnJetWithPVConstraintROITool::m_roiPhiWidth
Gaudi::Property< double > m_roiPhiWidth
Definition: ViewCreatorCentredOnJetWithPVConstraintROITool.h:51
xAOD::Jet_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: Jet_v1.cxx:54
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
ViewCreatorCentredOnJetWithPVConstraintROITool::m_prmVtxLink
Gaudi::Property< std::string > m_prmVtxLink
Definition: ViewCreatorCentredOnJetWithPVConstraintROITool.h:60
ViewCreatorCentredOnJetWithPVConstraintROITool::m_roiEtaWidth
Gaudi::Property< double > m_roiEtaWidth
Definition: ViewCreatorCentredOnJetWithPVConstraintROITool.h:48
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
ViewCreatorCentredOnJetWithPVConstraintROITool::m_roisWriteHandleKey
SG::WriteHandleKey< TrigRoiDescriptorCollection > m_roisWriteHandleKey
Definition: ViewCreatorCentredOnJetWithPVConstraintROITool.h:45
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
SG::ReadHandle::get
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::Vertex_v1::z
float z() const
Returns the z position.
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TrigCompositeUtils::createAndStoreNoAux
SG::WriteHandle< CONT > createAndStoreNoAux(const SG::WriteHandleKey< CONT > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Creates and right away records the Container CONT with the key.
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::decisions
decisions
Definition: TrigComposite_v1.cxx:81
xAOD::Jet_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: Jet_v1.cxx:49
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:886
ViewCreatorCentredOnJetWithPVConstraintROITool::m_vertexReadHandleKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexReadHandleKey
Definition: ViewCreatorCentredOnJetWithPVConstraintROITool.h:57
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ViewCreatorCentredOnJetWithPVConstraintROITool::getPrimaryVertex
const xAOD::Vertex * getPrimaryVertex(const xAOD::VertexContainer *) const
Definition: ViewCreatorCentredOnJetWithPVConstraintROITool.cxx:109
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
SG::WriteHandle< TrigRoiDescriptorCollection >
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
xAOD::Jet_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: Jet_v1.cxx:71
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::Vertex_v1::y
float y() const
Returns the y position.
TrigCompositeUtils::roiString
const std::string & roiString()
Definition: TrigCompositeUtilsRoot.cxx:878
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition: TrigSteeringEventTPCnv.cxx:68
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
ViewCreatorCentredOnJetWithPVConstraintROITool::m_roiZWidth
Gaudi::Property< double > m_roiZWidth
Definition: ViewCreatorCentredOnJetWithPVConstraintROITool.h:54
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.