ATLAS Offline Software
JetLArHVTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
10 
11 JetLArHVTool::JetLArHVTool(const std::string& name)
12  : asg::AsgTool(name)
13 {
14 }
15 
16 
18 {
19  if(m_fracKey.key().at(0) == '.' || m_nCellKey.key().at(0) == '.'){
20  ATH_MSG_ERROR("JetLArHVTool needs to have its input jet container name configured!");
21  return StatusCode::FAILURE;
22  }
23 
24  // Prepend jet container name
25  m_fracKey = m_jetContainerName + "." + m_fracKey.key();
27 
28  ATH_CHECK(m_fracKey.initialize());
29  ATH_CHECK(m_nCellKey.initialize());
30  return StatusCode::SUCCESS;
31 }
32 
33 
35 {
36 
39 
40  for(const xAOD::Jet* jet : jets){
41 
42  double energyHVaff=0;
43  int numCellsHVaff=0;
44 
45  // loop over raw constituents. Look for clusters
46  size_t num = jet->numConstituents();
47  for(size_t i=0;i<num;i++) {
48  const xAOD::CaloCluster * cl = dynamic_cast<const xAOD::CaloCluster *>(jet->rawConstituent(i));
49  if( !cl) continue;
50 
51  double m;
52  if(cl->retrieveMoment(xAOD::CaloCluster::ENG_BAD_HV_CELLS,m) ) energyHVaff += m;
53  if(cl->retrieveMoment(xAOD::CaloCluster::N_BAD_HV_CELLS, m) ) numCellsHVaff += m;
54  }
55 
56  double emE = jet->jetP4(xAOD::JetEMScaleMomentum).E();
57  // set the attributes
58  fracHandle(*jet) = energyHVaff / emE;
59  nCellHandle(*jet) = numCellsHVaff;
60  }
61  return StatusCode::SUCCESS;
62 }
63 
64 
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
xAOD::CaloCluster_v1::ENG_BAD_HV_CELLS
@ ENG_BAD_HV_CELLS
Total em-scale energy of cells with bad HV in this cluster.
Definition: CaloCluster_v1.h:167
JetLArHVTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetLArHVTool.h:40
asg
Definition: DataHandleTestTool.h:28
JetLArHVTool::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition: JetLArHVTool.cxx:34
JetLArHVTool::m_nCellKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_nCellKey
Definition: JetLArHVTool.h:45
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
JetLArHVTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: JetLArHVTool.cxx:17
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloCluster.h
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:99
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
WriteDecorHandle.h
Handle class for adding a decoration to an object.
xAOD::JetEMScaleMomentum
@ JetEMScaleMomentum
Definition: JetTypes.h:28
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
JetLArHVTool::m_fracKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_fracKey
Definition: JetLArHVTool.h:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
xAOD::CaloCluster_v1::N_BAD_HV_CELLS
@ N_BAD_HV_CELLS
number of cells with bad HV
Definition: CaloCluster_v1.h:168
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
JetLArHVTool.h
JetLArHVTool::JetLArHVTool
JetLArHVTool(const std::string &name)
Definition: JetLArHVTool.cxx:11
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
JetDistances.h