ATLAS Offline Software
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 }
JetVoronoiDiagramHelpers::Diagram::m_x_min
double m_x_min
Definition: JetVoronoiDiagramHelpers.h:140
JetVoronoiDiagramHelpers::PolygonList
std::vector< Polygon > PolygonList
Definition: JetVoronoiDiagramHelpers.h:112
JetVoronoiMomentsTool::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition: JetVoronoiMomentsTool.cxx:42
Trk::TrackState::Segment
@ Segment
Definition: TrackStateDefs.h:37
JetVoronoiMomentsTool::m_y_max
Gaudi::Property< float > m_y_max
Definition: JetVoronoiMomentsTool.h:52
NSWL1::Polygon
boost::geometry::model::polygon< Vertex > Polygon
Definition: GeoUtils.h:18
asg
Definition: DataHandleTestTool.h:28
JetVoronoiMomentsTool.h
JetVoronoiDiagramHelpers.h
JetVoronoiDiagramHelpers::Point
Definition: JetVoronoiDiagramHelpers.h:50
JetVoronoiMomentsTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetVoronoiMomentsTool.h:54
JetVoronoiDiagramHelpers::Diagram::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: JetVoronoiDiagramHelpers.cxx:98
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
JetVoronoiDiagramHelpers::Diagram::m_voro_vtx
Polygon m_voro_vtx
Definition: JetVoronoiDiagramHelpers.h:146
JetVoronoiDiagramHelpers::Diagram
Definition: JetVoronoiDiagramHelpers.h:126
JetVoronoiDiagramHelpers::Diagram::m_y_max
double m_y_max
Definition: JetVoronoiDiagramHelpers.h:143
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
JetVoronoiDiagramHelpers::Diagram::createVoronoiDiagram
StatusCode createVoronoiDiagram()
Definition: JetVoronoiDiagramHelpers.cxx:148
JetVoronoiMomentsTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetVoronoiMomentsTool.cxx:28
JetVoronoiDiagramHelpers::Diagram::m_x_max
double m_x_max
Definition: JetVoronoiDiagramHelpers.h:141
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
JetVoronoiMomentsTool::JetVoronoiMomentsTool
JetVoronoiMomentsTool(const std::string &name)
Definition: JetVoronoiMomentsTool.cxx:22
JetVoronoiDiagramHelpers::SegmentList
Definition: JetVoronoiDiagramHelpers.h:117
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
JetVoronoiDiagramHelpers::Polygon::Add
void Add(coord x, coord y)
Definition: JetVoronoiDiagramHelpers.h:95
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetVoronoiDiagramHelpers::Diagram::m_y_min
double m_y_min
Definition: JetVoronoiDiagramHelpers.h:142
JetVoronoiMomentsTool::m_x_max
Gaudi::Property< float > m_x_max
Definition: JetVoronoiMomentsTool.h:48
JetVoronoiMomentsTool::m_voronoiAreaKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_voronoiAreaKey
Definition: JetVoronoiMomentsTool.h:57
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
JetVoronoiDiagramHelpers::Diagram::getCellArea
float getCellArea(const coord x, const coord y) const
Definition: JetVoronoiDiagramHelpers.cxx:118
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
JetVoronoiMomentsTool::m_y_min
Gaudi::Property< float > m_y_min
Definition: JetVoronoiMomentsTool.h:50
JetVoronoiMomentsTool::m_x_min
Gaudi::Property< float > m_x_min
Definition: JetVoronoiMomentsTool.h:46