18 double mineta,
double maxeta,
20 double mine,
double maxe,
double value)
21 : TH2D(name, name, nbinseta, mineta, maxeta, nbinse, mine, maxe) {
23 GetXaxis()->SetTitle(
"#eta");
24 GetYaxis()->SetTitle(
"E");
27 for(
int ie=1; ie<=GetNbinsY(); ie++) {
28 for(
int ieta=1; ieta<=GetNbinsX(); ieta++) {
29 SetBinContent(ieta,ie, value);
41 GetXaxis()->SetTitle(
"#eta");
42 GetYaxis()->SetTitle(
"E");
44 string err =
"PFResolutionMap::PFResolutionMap : cannot read file ";
46 throw invalid_argument(err);
58 std::ofstream outf(mapfile);
60 edm::LogWarning(
"PFResolutionMap::Write")<<
" : cannot open file "<<mapfile;
66 edm::LogError(
"PFResolutionMap::Write")<<
" : corrupted file "<<mapfile;
81 std::ifstream
inf(mapfile);
105 SetBins(nbinseta, mineta, maxeta, nbinse, mine, maxe);
118 if(
string(s).
empty()) {
122 istringstream lin(s);
128 SetBinContent(j, i, dataw);
130 }
while (lin.good() );
156 if( eta<fMinEta ) eta = fMinEta+0.001;
157 if( eta>fMaxEta ) eta = fMaxEta-0.001;
159 if( e<fMinE ) e = fMinE+0.001;
160 if( e>fMaxE ) e = fMaxE-0.001;
164 double res= GetBinContent(bin);
167 if(MapEta==1) res *= 1.88;
177 if(e >= GetYaxis()->GetXmax() )
178 e = GetYaxis()->GetXmax() - 0.001;
180 return TH2D::FindBin(eta,e);
187 if(!outf.good() )
return outf;
190 outf<<rm.GetNbinsX()<<endl;
191 outf<<rm.GetXaxis()->GetXmin()<<endl;
192 outf<<rm.GetXaxis()->GetXmax()<<endl;
194 outf<<rm.GetNbinsY()<<endl;
195 outf<<rm.GetYaxis()->GetXmin()<<endl;
196 outf<<rm.GetYaxis()->GetXmax()<<endl;
198 for(
int ie=1; ie<=rm.GetNbinsY(); ie++) {
199 for(
int ieta=1; ieta<=rm.GetNbinsX(); ieta++) {
200 outf<<rm.GetBinContent(ieta,ie)<<
"\t";
222 #define M_PI 3.14159265358979323846 235 c0-twopiO18, c0-2*twopiO18, c0-3*twopiO18, c0-4*twopiO18,
236 c0-5*twopiO18, c0-6*twopiO18, c0-7*twopiO18, c0-8*twopiO18,
237 c0-9*twopiO18, c0-10*twopiO18, c0-11*twopiO18, c0-12*twopiO18,
238 c0-13*twopiO18, c0-14*twopiO18, c0-15*twopiO18, c0-16*twopiO18,
249 if(phi>pi) phi-=twopi;
251 if (phi>=-pi && phi<=pi){
254 if (phi<cPhi[17] || phi>=cPhi[0]){
255 if (phi<0) phi+= twopi;
256 m =
minimum(phi -cPhi[0],phi-cPhi[17]-twopi);
265 m=
minimum(phi-cPhi[i+1],phi-cPhi[i]);
friend std::ostream & operator<<(std::ostream &out, const PFResolutionMap &rm)
print this map
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)
bin
set the eta bin as selection string.
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
Resolution Map (resolution as a function of eta and E)