ATLAS Offline Software
corr_pileupShift.cxx
Go to the documentation of this file.
2 #include <iostream>
3 #include <string>
4 #include <utility>
5 
7 
8 
10 
11  std::string filename = PathResolverFindCalibFile("egammaLayerRecalibTool/v2/layer_average.root");
12 
13  m_file = TFile::Open(filename.c_str());
14  if (not m_file or m_file->IsZombie()) {
15  std::cerr << "FATAL: cannot open " << filename << std::endl;
16  }
17  else {
18  for (int layer=0;layer<4;layer++) {
19  char name[12];
20  snprintf(name,sizeof(name),"average_%d",layer);
21  m_haverage[layer]=(TH1D*) (m_file->Get(name));
22  if (not m_haverage[layer]) {
23  std::cerr << "FATAL: cannot find " << name << std::endl;
24  }
25  }
26  }
27  m_runMin=296939;
28  m_runMax=311563;
29 }
30 //===============================================================================
32 {
33  m_file->Close();
34 }
35 
36 //===============================================================================
37 float corr_pileupShift::getCorr(int layer, int run, float mu, float eta) const
38 {
39 
40  if (layer<0 || layer>3) return 0.;
41  if (run<m_runMin || run>m_runMax) return 0.;
42  double aeta=std::fabs(eta);
43  if (aeta> 2.5) return 0.;
44  if (aeta>2.37) aeta=2.37;
45 
46  int ibin = std::as_const(*m_haverage[layer]).GetXaxis()->FindFixBin(aeta);
47  float corr = mu * m_haverage[layer]->GetBinContent(ibin);
48 
49  return corr;
50 
51 }
corr_pileupShift::m_runMax
int m_runMax
Definition: corr_pileupShift.h:27
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
corr_pileupShift.h
corr_pileupShift::getCorr
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
Definition: corr_pileupShift.cxx:37
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
run
Definition: run.py:1
PathResolver.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
corr_pileupShift::~corr_pileupShift
~corr_pileupShift()
Definition: corr_pileupShift.cxx:31
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
corr_pileupShift::corr_pileupShift
corr_pileupShift()
constructor (initialization done there reading a root file for the HV maps per period
Definition: corr_pileupShift.cxx:9
corr_pileupShift::m_runMin
int m_runMin
Definition: corr_pileupShift.h:27
corr_pileupShift::m_haverage
TH1D * m_haverage[4]
Definition: corr_pileupShift.h:30
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
corr_pileupShift::m_file
TFile * m_file
Definition: corr_pileupShift.h:31