ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
DerivationFramework::METTriggerAugmentationTool Class Reference

#include <METTriggerAugmentationTool.h>

Inheritance diagram for DerivationFramework::METTriggerAugmentationTool:
Collaboration diagram for DerivationFramework::METTriggerAugmentationTool:

Public Member Functions

 METTriggerAugmentationTool (const std::string &t, const std::string &n, const IInterface *p)
 
virtual StatusCode initialize () override final
 
virtual StatusCode addBranches (const EventContext &ctx) const override final
 

Private Attributes

SG::ReadHandleKey< xAOD::EnergySumRoIm_L1METName {this, "L1METName", "LVL1EnergySumRoI"}
 
SG::ReadHandleKey< xAOD::JetRoIContainerm_L1JetName {this, "L1JetName", "LVL1JetRoIs"}
 
SG::WriteHandleKey< xAOD::EnergySumRoIm_outputName {this, "OutputName", "LVL1EnergySumRoI_KF"}
 
Gaudi::Property< std::string > m_LUTFileName {this, "LUTFile", "LUT_data15.root"}
 
std::unique_ptr< TH2 > m_LUT {}
 

Detailed Description

Definition at line 19 of file METTriggerAugmentationTool.h.

Constructor & Destructor Documentation

◆ METTriggerAugmentationTool()

DerivationFramework::METTriggerAugmentationTool::METTriggerAugmentationTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 16 of file METTriggerAugmentationTool.cxx.

18  :
19  base_class(t,n,p)
20  {
21  }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::METTriggerAugmentationTool::addBranches ( const EventContext &  ctx) const
finaloverridevirtual

Definition at line 51 of file METTriggerAugmentationTool.cxx.

52  {
53  ATH_MSG_DEBUG(" In L1KF_METMaker::makeKFMET()" );
54  // if the output has already been written we don't need to do anything
55  if (evtStore()->contains<xAOD::EnergySumRoI>(m_outputName.key()) ) return StatusCode::SUCCESS; // FIXME tool should not have been configured in this case
56 
58  if (!originalL1.isValid()){
59  ATH_MSG_ERROR("Unable to retrieve EnergySumRoI: " << m_L1METName << "!");
60  return StatusCode::FAILURE;
61  }
62 
64  if (!originalL1.isValid()){
65  ATH_MSG_ERROR("Unable to retrieve JetRoIContainer: " << m_L1JetName << "!");
66  return StatusCode::FAILURE;
67  }
68 
70  if (!originalL1.isValid()){
71  ATH_MSG_ERROR("Invalid WriteHandle for EnergySumRoI: " << m_outputName << "!");
72  return StatusCode::FAILURE;
73  }
74  ATH_CHECK(l1_kf.record(std::make_unique<xAOD::EnergySumRoI>(), std::make_unique<xAOD::EnergySumRoIAuxInfo>()));
75 
76  ATH_MSG_DEBUG( "Making deep copy" );
77  // copy across the info
78  *l1_kf = *originalL1;
79 
80  ATH_MSG_DEBUG( "Building KF MET" );
81  float KFMETx = l1_kf->exMiss();
82  float KFMETy = l1_kf->eyMiss();
83  float KFSumEt = l1_kf->energyT();
84 
85  for (const auto jet : *l1Jets) {
86  int etaBin = m_LUT->GetXaxis()->FindBin( fabs( jet->eta() ) );
87  int ptBin = m_LUT->GetYaxis()->FindBin( log2( jet->et8x8() / 1000.) );
88  if (ptBin==0) ptBin=1;
89  float KFweight = m_LUT->GetBinContent(etaBin, ptBin);
90  float jetContribution = jet->et8x8() * KFweight;
91 
92  KFMETx -= jetContribution * cos( jet->phi() );
93  KFMETy -= jetContribution * sin( jet->phi() );
94  KFSumEt += jetContribution;
95  }
96  l1_kf->setEnergyX(-KFMETx);
97  l1_kf->setEnergyY(-KFMETy);
98  l1_kf->setEnergyT(KFSumEt);
99 
100  ATH_MSG_DEBUG( "Built KF MET" );
101  return StatusCode::SUCCESS;
102  }

◆ initialize()

StatusCode DerivationFramework::METTriggerAugmentationTool::initialize ( )
finaloverridevirtual

Definition at line 23 of file METTriggerAugmentationTool.cxx.

24  {
25  ATH_CHECK(m_L1METName.initialize());
26  ATH_CHECK(m_L1JetName.initialize());
27  ATH_CHECK(m_outputName.initialize());
28  std::string fullLUTFileName = PathResolver::find_file(m_LUTFileName, "DATAPATH");
29 
30  if (fullLUTFileName.empty() ) {
31  ATH_MSG_ERROR( "File " << m_LUTFileName << " not found!" );
32  return StatusCode::FAILURE;
33  }
34 
35  TFile* lutFile = TFile::Open(fullLUTFileName.c_str() );
36  if (lutFile->IsZombie() ) return StatusCode::FAILURE;
37 
38  TH2* lutFromFile{};
39  lutFile->GetObject("LUT", lutFromFile);
40  if (!lutFromFile) {
41  ATH_MSG_ERROR( "LUT file doesn't contain a 'LUT' object!" );
42  return StatusCode::FAILURE;
43  }
44 
45  m_LUT.reset(dynamic_cast<TH2*>(lutFromFile->Clone() ) );
46  m_LUT->SetDirectory(0);
47  lutFile->Close();
48  return StatusCode::SUCCESS;
49  }

Member Data Documentation

◆ m_L1JetName

SG::ReadHandleKey<xAOD::JetRoIContainer> DerivationFramework::METTriggerAugmentationTool::m_L1JetName {this, "L1JetName", "LVL1JetRoIs"}
private

Definition at line 26 of file METTriggerAugmentationTool.h.

◆ m_L1METName

SG::ReadHandleKey<xAOD::EnergySumRoI> DerivationFramework::METTriggerAugmentationTool::m_L1METName {this, "L1METName", "LVL1EnergySumRoI"}
private

Definition at line 25 of file METTriggerAugmentationTool.h.

◆ m_LUT

std::unique_ptr<TH2> DerivationFramework::METTriggerAugmentationTool::m_LUT {}
private

Definition at line 29 of file METTriggerAugmentationTool.h.

◆ m_LUTFileName

Gaudi::Property<std::string> DerivationFramework::METTriggerAugmentationTool::m_LUTFileName {this, "LUTFile", "LUT_data15.root"}
private

Definition at line 28 of file METTriggerAugmentationTool.h.

◆ m_outputName

SG::WriteHandleKey<xAOD::EnergySumRoI> DerivationFramework::METTriggerAugmentationTool::m_outputName {this, "OutputName", "LVL1EnergySumRoI_KF"}
private

Definition at line 27 of file METTriggerAugmentationTool.h.


The documentation for this class was generated from the following files:
DerivationFramework::METTriggerAugmentationTool::m_LUT
std::unique_ptr< TH2 > m_LUT
Definition: METTriggerAugmentationTool.h:29
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
DerivationFramework::METTriggerAugmentationTool::m_L1METName
SG::ReadHandleKey< xAOD::EnergySumRoI > m_L1METName
Definition: METTriggerAugmentationTool.h:25
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:149
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:727
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition: PathResolver.cxx:221
DerivationFramework::METTriggerAugmentationTool::m_outputName
SG::WriteHandleKey< xAOD::EnergySumRoI > m_outputName
Definition: METTriggerAugmentationTool.h:27
DerivationFramework::METTriggerAugmentationTool::m_LUTFileName
Gaudi::Property< std::string > m_LUTFileName
Definition: METTriggerAugmentationTool.h:28
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
DerivationFramework::METTriggerAugmentationTool::m_L1JetName
SG::ReadHandleKey< xAOD::JetRoIContainer > m_L1JetName
Definition: METTriggerAugmentationTool.h:26