ATLAS Offline Software
Loading...
Searching...
No Matches
JetVoronoiMomentsTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5
8
9// helpers
11
12
20
21
23 : asg::AsgTool(name)
24{
25 declareInterface<IJetDecorator>(this);
26}
27
29
30 if(m_jetContainerName.empty()){
31 ATH_MSG_ERROR("JetVoronoiMomentsTool needs to have its input jet container name configured!");
32 return StatusCode::FAILURE;
33 }
34
35 // Prepend jet collection name
37
38 ATH_CHECK(m_voronoiAreaKey.initialize());
39 return StatusCode::SUCCESS;
40}
41
43
45
46 // setup diagram class
47 Diagram voro ("VoronoiDiagram");
48 voro.m_x_min = m_x_min;
49 voro.m_x_max = m_x_max;
50 voro.m_y_min = m_y_min;
51 voro.m_y_max = m_y_max;
52 if (voro.initialize().isFailure()) ATH_MSG_WARNING( "Initialization of diagram failed. This should never happen.");
53 // add jets / set number of points
54 for ( const xAOD::Jet * jet : jets ) {
55 voro.m_voro_vtx.Add(jet->eta(), jet->phi());
56 }
57 // create diagram and calculate area per cell
58 if ( voro.createVoronoiDiagram().isFailure() ) {
59 ATH_MSG_WARNING("Could not calculate Voronoi diagram");
60 }
61 // decorate the jets
62 for (const xAOD::Jet *jet : jets ){
63 outputHandle(*jet) = voro.getCellArea(jet->eta(), jet->phi());
64 }
65 return StatusCode::SUCCESS;
66}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
Handle class for adding a decoration to an object.
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
JetVoronoiMomentsTool(const std::string &name)
Gaudi::Property< float > m_x_min
Gaudi::Property< std::string > m_jetContainerName
Gaudi::Property< float > m_y_min
Gaudi::Property< float > m_y_max
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_voronoiAreaKey
Gaudi::Property< float > m_x_max
Handle class for adding a decoration to an object.
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
std::vector< Polygon > PolygonList
List of polygons.
double coord
Type of coordination system.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Tool for calculating and storing diagram.
float getCellArea(const coord x, const coord y) const
StatusCode initialize()
Dummy implementation of the initialisation function.