ATLAS Offline Software
Loading...
Searching...
No Matches
corr_pileupShift.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
5#include <iostream>
6#include <string>
7#include <utility>
8#include <cmath>
9
11
12
14
15 std::string filename = PathResolverFindCalibFile("egammaLayerRecalibTool/v2/layer_average.root");
16
17 m_file = TFile::Open(filename.c_str());
18 if (not m_file or m_file->IsZombie()) {
19 std::cerr << "FATAL: cannot open " << filename << std::endl;
20 }
21 else {
22 for (int layer=0;layer<4;layer++) {
23 char name[12];
24 snprintf(name,sizeof(name),"average_%d",layer);
25 m_haverage[layer]=(TH1D*) (m_file->Get(name));
26 if (not m_haverage[layer]) {
27 std::cerr << "FATAL: cannot find " << name << std::endl;
28 }
29 }
30 }
31 m_runMin=296939;
32 m_runMax=311563;
33}
34//===============================================================================
39
40//===============================================================================
41float corr_pileupShift::getCorr(int layer, int run, float mu, float eta) const
42{
43
44 if (layer<0 || layer>3) return 0.;
45 if (run<m_runMin || run>m_runMax) return 0.;
46 double aeta=std::fabs(eta);
47 if (aeta> 2.5) return 0.;
48 if (aeta>2.37) aeta=2.37;
49
50 int ibin = std::as_const(*m_haverage[layer]).GetXaxis()->FindFixBin(aeta);
51 float corr = mu * m_haverage[layer]->GetBinContent(ibin);
52
53 return corr;
54
55}
Scalar eta() const
pseudorapidity method
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
float getCorr(int layer, int run, float mu, float eta) const
get shift to subtract to raw layer energy : corrected layer energy = raw energy - shift
corr_pileupShift()
constructor (initialization done there reading a root file for the HV maps per period
Definition run.py:1