23 : TH2D(
name,
name, nbinseta, mineta, maxeta, nbinse, mine, maxe) {
24 GetXaxis()->SetTitle(
"#eta");
25 GetYaxis()->SetTitle(
"E");
28 for (
int ie = 1; ie <= GetNbinsY(); ie++) {
40 GetXaxis()->SetTitle(
"#eta");
41 GetYaxis()->SetTitle(
"E");
43 string err =
"PFResolutionMap::PFResolutionMap : cannot read file ";
45 throw invalid_argument(
err);
54 std::ofstream outf(mapfile);
56 edm::LogWarning(
"PFResolutionMap::Write") <<
" : cannot open file " << mapfile;
60 outf << (*this) << endl;
62 edm::LogError(
"PFResolutionMap::Write") <<
" : corrupted file " << mapfile;
73 std::ifstream
inf(mapfile);
97 SetBins(nbinseta, mineta, maxeta, nbinse, mine, maxe);
114 istringstream lin(
s);
120 SetBinContent(
j,
i, dataw);
122 }
while (lin.good());
124 }
while (
inf.good());
139 constexpr
double fMinEta = -2.95;
140 constexpr
double fMaxEta = 2.95;
141 constexpr
double fMinE = 0;
142 constexpr
double fMaxE = 100;
145 eta = fMinEta + 0.001;
147 eta = fMaxEta - 0.001;
156 double res = GetBinContent(
bin);
169 if (
e >= GetYaxis()->GetXmax())
170 e = GetYaxis()->GetXmax() - 0.001;
172 return TH2D::FindBin(
eta,
e);
180 outf <<
rm.GetNbinsX() << endl;
181 outf <<
rm.GetXaxis()->GetXmin() << endl;
182 outf <<
rm.GetXaxis()->GetXmax() << endl;
184 outf <<
rm.GetNbinsY() << endl;
185 outf <<
rm.GetYaxis()->GetXmin() << endl;
186 outf <<
rm.GetYaxis()->GetXmax() << endl;
188 for (
int ie = 1; ie <=
rm.GetNbinsY(); ie++) {
190 outf <<
rm.GetBinContent(
ieta, ie) <<
"\t";
200 bool Is = (TMath::Abs(dminPhi) < 0.005);
206 if (TMath::Abs(
b) < TMath::Abs(
a))
212 #define M_PI 3.14159265358979323846 217 constexpr
double pi =
M_PI;
218 constexpr
double twopi = 2. *
pi;
219 constexpr
double twopiO18 =
pi / 9;
222 constexpr
double c0 = 2.97025;
223 constexpr std::array<double, 18> cPhi{{
c0,
240 c0 - 17 * twopiO18}};
243 constexpr
double delta_cPhi = 0.00638;
255 if (
phi < cPhi[17] ||
phi >= cPhi[0]) {
double minimum(double a, double b)
bool ReadMapFile(const char *mapfile)
read text file
double dCrackPhi(double phi, double eta)
static const unsigned lineSize_
bool WriteMapFile(const char *mapfile)
Log< level::Error, false > LogError
ostream & operator<<(ostream &outf, const PFResolutionMap &rm)
double getRes(double eta, double phi, double e, int MapEta=-1)
std::pair< int, edm::FunctionWithDict > OK
bool IsInAPhiCrack(double phi, double eta)
PFResolutionMap()
default constructor
int FindBin(double eta, double e, double z=0) override
extrapolation requires overloading of this function
Log< level::Warning, false > LogWarning
Resolution Map (resolution as a function of eta and E)