ATLAS Offline Software
HIJetMaxOverMeanTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
5 
6 #include "HIJetMaxOverMeanTool.h"
7 
8 HIJetMaxOverMeanTool::HIJetMaxOverMeanTool(const std::string& t) : asg::AsgTool(t)
9 {
10  declareInterface<IJetDecorator>(this);
11 }
12 
13 
15 {
16  if( m_jetContainerName.empty() ){
17  ATH_MSG_ERROR("HIJetMaxOverMeanTool needs to have its input jet container name configured!");
18  return StatusCode::FAILURE;
19  }
20  //Preped Jet Container Name
23 
24  ATH_CHECK( m_jetMaxConstituentETKey.initialize() );
25  ATH_CHECK( m_jetMaxOverMeanKey.initialize() );
26 
27  return StatusCode::SUCCESS;
28 
29 }
30 
32  {
33  //Decorator handlers
36  for(const xAOD::Jet* jet : jets)
37  {
38  float max=-999;
39  float sum=0;
40  float count=0;
41  const xAOD::JetConstituentVector constituents = jet->getConstituents();
42  for (const auto *constituent : constituents)
43  {
44  float et=constituent->e()/std::cosh(constituent->eta());
45  if(et > max) max=et;
46  sum+=et;
47  count++;
48  }
49  if(count==0.) sum=0;
50  else sum/=count;
51  float D=0;
52  if(sum!=0.) D=max/sum;
53 
54  // set the attributes
55  jetMaxConstituentETDecorHandle(*jet) = max;
56  jetMaxOverMeanDecorHandle(*jet) = D;
57 
58  }
59  return StatusCode::SUCCESS;
60 }
et
Extra patterns decribing particle interation process.
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
HIJetMaxOverMeanTool::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jets) const override
Decorate a jet collection without otherwise modifying it.
Definition: HIJetMaxOverMeanTool.cxx:31
asg
Definition: DataHandleTestTool.h:28
HIJetMaxOverMeanTool::HIJetMaxOverMeanTool
HIJetMaxOverMeanTool(const std::string &t)
Definition: HIJetMaxOverMeanTool.cxx:8
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
HIJetMaxOverMeanTool.h
HIJetMaxOverMeanTool::m_jetMaxConstituentETKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetMaxConstituentETKey
Definition: HIJetMaxOverMeanTool.h:45
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
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
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
HIJetMaxOverMeanTool::m_jetMaxOverMeanKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jetMaxOverMeanKey
Definition: HIJetMaxOverMeanTool.h:46
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
xAOD::JetConstituentVector
A vector of jet constituents at the scale used during jet finding.
Definition: JetConstituentVector.h:117
HIJetMaxOverMeanTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: HIJetMaxOverMeanTool.cxx:14
HIJetMaxOverMeanTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: HIJetMaxOverMeanTool.h:48