32 std::set<unsigned int> used_indices;
33 for(
int ybin=1; ybin<h2->GetNbinsY(); ybin++)
35 auto mItr=
m_edges.emplace_hint(
m_edges.end(),ybin-1,std::vector<range_index_t>());
36 for(
int xbin=1; xbin<h2->GetNbinsX(); xbin++)
38 if(h2->GetBinContent(xbin,ybin) < 0)
continue;
39 unsigned int v=h2->GetBinContent(xbin,ybin);
44 auto sItr=used_indices.find(
v);
45 if(sItr==used_indices.end()) used_indices.insert(
v);
54 mItr->second.push_back(
range_index_t(h2->GetXaxis()->GetBinLowEdge(xbin),h2->GetXaxis()->GetBinUpEdge(xbin),
v));
75 mItr->second[eb].index=
index;
86 unsigned int num_eta_bins=
static_cast<unsigned int>(
std::round(std::abs((emax-emin)/deta)));
88 for(
unsigned int k=0;
k<num_eta_bins;
k++)
94 mItr->second[
k+num_eta_bins].eta_max=
roundToTenth(emin+
k*deta+deta);
97 index+=2*num_eta_bins;
113 const std::vector<range_index_t>&
vec=mItr->second;
114 unsigned int vsize=
vec.size();
118 std::cerr <<
"Layer " <<
layer <<
" has no range in calorimeter" << std::endl;
119 throw std::range_error(
"Bad binning request");
126 float abs_eta=std::abs(
eta);
130 if(abs_eta < rmin) eta_c=rmin+std::copysign(1
e-2,
eta);
131 else if(abs_eta > rmax) eta_c=rmax-std::copysign(1
e-2,
eta);
134 unsigned int pIndex=0;
135 for(; pIndex < vsize-1; pIndex++)
141 return (etaIndex) ? pIndex :
vec.at(pIndex).index;
157 if(shape_container==
nullptr)
166 return shape_container->
at(
bin);
171 if(shape_container==
nullptr)
180 return shape_container->
at(
bin);
190 return shape_container->
at(
bin);
200 std::cerr <<
"Layer " <<
layer <<
" has no binning specification" << std::endl;
201 throw std::range_error(
"Bad binning request");
214 bool isEmpty=(shape_container->
size()==0);
225 for(
auto ri : pp.second)
232 shape_container->operator[](ri.index)=
slice;
234 else slice=shape_container->
at(ri.index);
236 slice->setEtaMin(ri.eta_min);
237 slice->setEtaMax(ri.eta_max);
238 slice->setLayer(pp.first);
239 slice->etCos().assign(num_harmonics,0);
240 slice->etSin().assign(num_harmonics,0);
248 std::stringstream
ss;
252 for(
auto ri : pp.second)
254 ss << std::setw(10) << pp.first
255 << std::setw(10) << ri.eta_min
256 << std::setw(10) << ri.eta_max
257 << std::setw(10) << ri.index