15 |
|
} |
16 |
|
|
17 |
|
//-------------------------------------------------------------------------------------------------- |
18 |
< |
Float_t CEffUser2D::getEff(const Double_t x, const Double_t y) |
18 |
> |
Float_t CEffUser2D::getEff(const Double_t x, const Double_t y, const bool keepInBounds) |
19 |
|
{ |
20 |
|
if(!hEff) { |
21 |
|
cout << "Efficiency table not loaded! Aborting..." << endl; |
22 |
|
assert(0); |
23 |
|
} |
24 |
< |
return getValue(hEff,x,y); |
24 |
> |
return getValue(hEff,x,y,keepInBounds); |
25 |
|
} |
26 |
|
|
27 |
|
//-------------------------------------------------------------------------------------------------- |
28 |
< |
Float_t CEffUser2D::getErrLow(const Double_t x, const Double_t y) |
28 |
> |
Float_t CEffUser2D::getErrLow(const Double_t x, const Double_t y, const bool keepInBounds) |
29 |
|
{ |
30 |
|
if(!hErrl) { |
31 |
|
cout << "Low errors table not loaded! Aborting..." << endl; |
32 |
|
assert(0); |
33 |
|
} |
34 |
< |
return getValue(hErrl,x,y); |
34 |
> |
return getValue(hErrl,x,y,keepInBounds); |
35 |
|
} |
36 |
|
|
37 |
|
//-------------------------------------------------------------------------------------------------- |
38 |
< |
Float_t CEffUser2D::getErrHigh(const Double_t x, const Double_t y) |
38 |
> |
Float_t CEffUser2D::getErrHigh(const Double_t x, const Double_t y, const bool keepInBounds) |
39 |
|
{ |
40 |
|
if(!hErrh) { |
41 |
|
cout << "High errors table not loaded! Aborting..." << endl; |
42 |
|
assert(0); |
43 |
|
} |
44 |
< |
return getValue(hErrh,x,y); |
44 |
> |
return getValue(hErrh,x,y,keepInBounds); |
45 |
|
} |
46 |
|
|
47 |
|
//-------------------------------------------------------------------------------------------------- |
105 |
|
} |
106 |
|
|
107 |
|
//-------------------------------------------------------------------------------------------------- |
108 |
< |
Float_t CEffUser2D::getValue(const TH2D* h, const Double_t x, const Double_t y) |
108 |
> |
Float_t CEffUser2D::getValue(const TH2D* h, const Double_t x, const Double_t y, const bool keepInBounds) |
109 |
|
{ |
110 |
|
Int_t ix=0; |
111 |
|
Int_t iy=0; |
112 |
|
const Int_t nx = h->GetNbinsX(); |
113 |
|
const Int_t ny = h->GetNbinsY(); |
114 |
+ |
Double_t xval=x,yval=y; |
115 |
+ |
|
116 |
+ |
if(keepInBounds) { |
117 |
+ |
if(x < h->GetXaxis()->GetBinLowEdge(1)) xval = h->GetXaxis()->GetBinCenter(1); |
118 |
+ |
if(x > h->GetXaxis()->GetBinUpEdge(nx)) xval = h->GetXaxis()->GetBinCenter(nx); |
119 |
+ |
if(y < h->GetYaxis()->GetBinLowEdge(1)) yval = h->GetYaxis()->GetBinCenter(1); |
120 |
+ |
if(y > h->GetYaxis()->GetBinUpEdge(ny)) yval = h->GetYaxis()->GetBinCenter(ny); |
121 |
+ |
} |
122 |
|
|
123 |
|
for(Int_t i=1; i<=nx; i++) { |
124 |
< |
if((x >= h->GetXaxis()->GetBinLowEdge(i)) && (x < h->GetXaxis()->GetBinLowEdge(i+1))) { |
124 |
> |
if((xval >= h->GetXaxis()->GetBinLowEdge(i)) && (xval < h->GetXaxis()->GetBinLowEdge(i+1))) { |
125 |
|
ix=i; |
126 |
|
break; |
127 |
|
} |
128 |
|
} |
129 |
|
|
130 |
|
for(Int_t i=1; i<=ny; i++) { |
131 |
< |
if((y >= h->GetYaxis()->GetBinLowEdge(i)) && (y < h->GetYaxis()->GetBinLowEdge(i+1))) { |
131 |
> |
if((yval >= h->GetYaxis()->GetBinLowEdge(i)) && (yval < h->GetYaxis()->GetBinLowEdge(i+1))) { |
132 |
|
iy=i; |
133 |
|
break; |
134 |
|
} |