ATLAS Offline Software
electronPearShapeAlignmentCorrection.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "TFile.h"
8 
9 namespace {
10 char const * const s_histoName = "sdeta";
11 }
12 
14  const std::string& infile)
15 {
16  const std::string path = "EGammaVariableCorrection/" + infile;
17  std::unique_ptr<TFile> file =
18  std::make_unique<TFile>(PathResolverFindCalibFile(path).c_str());
19  if (!file) {
20  throw std::runtime_error(
21  "cannot find input file for pear shape correction");
22  }
23 
24  m_sdeta = std::unique_ptr<TH2>(dynamic_cast<TH2*>(file->Get(s_histoName)));
25  if (!m_sdeta) {
26  throw std::runtime_error("cannot find histogram for pear shape correction");
27  }
28  m_sdeta->SetDirectory(nullptr);
29 }
30 
31 double
33  const float eta,
34  const float phi) const
35 {
36  const int binEta = m_sdeta->GetXaxis()->FindBin(eta);
37  const int binPhi = m_sdeta->GetYaxis()->FindBin(phi);
38  const double dEtaDistortion = m_sdeta->GetBinContent(binEta, binPhi);
39  return dEtaDistortion;
40 }
41 
42 double
44  const float eta,
45  const float phi) const
46 {
47  return (-1. * getDeltaEtaDistortion(eta, phi));
48 }
49 
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
run.infile
string infile
Definition: run.py:13
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
electronPearShapeAlignmentCorrection.h
electronPearShapeAlignmentCorrection::getDeltaEtaDistortion
double getDeltaEtaDistortion(const float eta, const float phi) const
get the correction to deltaEta
Definition: electronPearShapeAlignmentCorrection.cxx:32
Trk::binEta
@ binEta
Definition: BinningType.h:54
electronPearShapeAlignmentCorrection::electronPearShapeAlignmentCorrection
electronPearShapeAlignmentCorrection(const std::string &infile="rel22_210510/pearshapedistortion.root")
constructor (initialization reading a root file)
Definition: electronPearShapeAlignmentCorrection.cxx:13
file
TFile * file
Definition: tile_monitor.h:29
electronPearShapeAlignmentCorrection::getDeltaEtaCorrection
double getDeltaEtaCorrection(const float eta, const float phi) const
Definition: electronPearShapeAlignmentCorrection.cxx:43
PathResolver.h
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
electronPearShapeAlignmentCorrection::m_sdeta
std::unique_ptr< TH2 > m_sdeta
Definition: electronPearShapeAlignmentCorrection.h:34
Trk::binPhi
@ binPhi
Definition: BinningType.h:51