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 ()
 
virtual StatusCode finalize ()
 
virtual StatusCode addBranches () const
 

Private Attributes

std::string m_outputName
 
std::string m_LUTFileName
 
std::string m_L1METName
 
std::string m_L1JetName
 
std::unique_ptr< TH2 > m_LUT
 

Detailed Description

Definition at line 18 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 18 of file METTriggerAugmentationTool.cxx.

20  :
21  base_class(t,n,p)
22  {
23  declareProperty("OutputName", m_outputName = "LVL1EnergySumRoI_KF");
24  declareProperty("LUTFile", m_LUTFileName = "LUT_data15.root");
25  declareProperty("L1METName", m_L1METName = "LVL1EnergySumRoI");
26  declareProperty("L1JetName", m_L1JetName = "LVL1JetRoIs");
27  }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::METTriggerAugmentationTool::addBranches ( ) const
virtual

Definition at line 61 of file METTriggerAugmentationTool.cxx.

62  {
63  ATH_MSG_DEBUG(" In L1KF_METMaker::makeKFMET()" );
64 
65  // if the output has already been written we don't need to do anything
66  if (evtStore()->contains<xAOD::EnergySumRoI>(m_outputName) ) return StatusCode::SUCCESS;
67 
68  const xAOD::EnergySumRoI* originalL1(0);
69  ATH_CHECK( evtStore()->retrieve(originalL1, m_L1METName) );
70 
71  const xAOD::JetRoIContainer* l1Jets(0);
72  ATH_CHECK( evtStore()->retrieve(l1Jets, m_L1JetName) );
73 
76 
77  ATH_MSG_DEBUG( "Setting the store" );
78  // set the store
79  l1_kf->setStore(l1_kfAux);
80 
81  ATH_MSG_DEBUG( "Making deep copy" );
82  // copy across the info
83  *l1_kf = *originalL1;
84 
85  ATH_MSG_DEBUG( "Building KF MET" );
86  float KFMETx = l1_kf->exMiss();
87  float KFMETy = l1_kf->eyMiss();
88  float KFSumEt = l1_kf->energyT();
89 
90  for (const auto jet : *l1Jets) {
91  int etaBin = m_LUT->GetXaxis()->FindBin( fabs( jet->eta() ) );
92  int ptBin = m_LUT->GetYaxis()->FindBin( log2( jet->et8x8() / 1000.) );
93  if (ptBin==0) ptBin=1;
94  float KFweight = m_LUT->GetBinContent(etaBin, ptBin);
95  float jetContribution = jet->et8x8() * KFweight;
96 
97  KFMETx -= jetContribution * cos( jet->phi() );
98  KFMETy -= jetContribution * sin( jet->phi() );
99  KFSumEt += jetContribution;
100  }
101  l1_kf->setEnergyX(-KFMETx);
102  l1_kf->setEnergyY(-KFMETy);
103  l1_kf->setEnergyT(KFSumEt);
104 
105  ATH_MSG_DEBUG( "Built KF MET" );
106  ATH_CHECK( evtStore()->record(l1_kf, m_outputName) );
107  ATH_CHECK( evtStore()->record(l1_kfAux, m_outputName+"Aux.") );
108  return StatusCode::SUCCESS;
109  }

◆ finalize()

StatusCode DerivationFramework::METTriggerAugmentationTool::finalize ( )
virtual

Definition at line 54 of file METTriggerAugmentationTool.cxx.

55  {
56  return StatusCode::SUCCESS;
57  }

◆ initialize()

StatusCode DerivationFramework::METTriggerAugmentationTool::initialize ( )
virtual

Definition at line 29 of file METTriggerAugmentationTool.cxx.

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

Member Data Documentation

◆ m_L1JetName

std::string DerivationFramework::METTriggerAugmentationTool::m_L1JetName
private

Definition at line 28 of file METTriggerAugmentationTool.h.

◆ m_L1METName

std::string DerivationFramework::METTriggerAugmentationTool::m_L1METName
private

Definition at line 27 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

std::string DerivationFramework::METTriggerAugmentationTool::m_LUTFileName
private

Definition at line 26 of file METTriggerAugmentationTool.h.

◆ m_outputName

std::string DerivationFramework::METTriggerAugmentationTool::m_outputName
private

Definition at line 25 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
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DerivationFramework::METTriggerAugmentationTool::m_outputName
std::string m_outputName
Definition: METTriggerAugmentationTool.h:25
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
xAOD::EnergySumRoI_v2::setEnergyX
void setEnergyX(float value)
Set the total energy deposited in the X direction.
xAOD::EnergySumRoI_v2::energyT
float energyT() const
The deposited total transverse energy.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
DerivationFramework::METTriggerAugmentationTool::m_L1METName
std::string m_L1METName
Definition: METTriggerAugmentationTool.h:27
xAOD::EnergySumRoIAuxInfo
EnergySumRoIAuxInfo_v2 EnergySumRoIAuxInfo
Declare the most recent version of the energy-sum auxiliary info.
Definition: EnergySumRoIAuxInfo.h:17
xAOD::EnergySumRoIAuxInfo_v2
Auxiliary store for an EnergySum RoI object.
Definition: EnergySumRoIAuxInfo_v2.h:34
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::AuxElement::setStore
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
Definition: AuxElement.cxx:241
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
xAOD::EnergySumRoI_v2::setEnergyY
void setEnergyY(float value)
Set the total energy deposited in the Y direction.
xAOD::EnergySumRoI_v2::setEnergyT
void setEnergyT(float value)
Set the deposited total transverse energy.
xAOD::EnergySumRoI_v2::exMiss
float exMiss() const
The missing energy in the X direction.
Definition: EnergySumRoI_v2.h:131
DerivationFramework::METTriggerAugmentationTool::m_LUTFileName
std::string m_LUTFileName
Definition: METTriggerAugmentationTool.h:26
xAOD::EnergySumRoI
EnergySumRoI_v2 EnergySumRoI
Definition: EnergySumRoI.h:16
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
xAOD::EnergySumRoI_v2::eyMiss
float eyMiss() const
The missing energy in the Y direction.
Definition: EnergySumRoI_v2.h:141
xAOD::EnergySumRoI_v2
Class describing a LVL1 energy-sum "RoI".
Definition: EnergySumRoI_v2.h:35
DerivationFramework::METTriggerAugmentationTool::m_L1JetName
std::string m_L1JetName
Definition: METTriggerAugmentationTool.h:28