16 m_rangemin(rangemin), m_rangemax(rangemax), m_region(region), m_nbins(
nbins), m_histo{
new unsigned int[
m_nbins]} {
18 m_binsize = (m_rangemax - m_rangemin) / m_nbins;
19 m_invbinsize = 1. / m_binsize,
30 if (
hits.empty())
return;
32 std::vector<int> layerCounts(
m_nbins, 0);
33 int sign = subtract ? -1000 : 1000;
37 int prevlayer =
hits.front()->layer;
40 PhiHitVec::const_iterator
it =
hits.begin();
41 PhiHitVec::const_iterator it_end =
hits.end();
42 for (;
it != it_end; ++
it) {
44 if (prevlayer != (*it)->layer) {
46 if (subtract && -layerCounts[
i] >=
static_cast<int>(
m_histo[
i]))
53 prevlayer = (*it)->layer;
57 std::pair<int, int> minMax =
range((*it)->r, (*it)->phimin, (*it)->phimax);
58 int binmin = minMax.first;
59 int binmax = minMax.second;
62 if (binmin >=
m_nbins)
continue;
63 if (binmax < 0)
continue;
66 if (binmin < 0) binmin = 0;
71 std::cout <<
" filling hit " << (*it)->layer <<
" phimin " << (*it)->phimin <<
" phimax " << (*it)->phimax <<
" weight "
72 << (*it)->w <<
" binmin " << binmin <<
" max " << binmax;
73 if ((*it)->debugInfo()) {
78 std::cout << std::endl;
82 for (; binmin <= binmax; ++binmin) layerCounts[binmin] =
weight;
86 if (subtract && -layerCounts[
i] >=
static_cast<int>(
m_histo[
i]))
95 if (
hits.empty())
return;
96 if (
m_debug) std::cout <<
" filling layers, hits " <<
hits.size() <<
" subtract " << subtract << std::endl;
98 int prevbinmin = 10000;
101 PhiHitVec::const_iterator
it =
hits.begin();
102 PhiHitVec::const_iterator it_end =
hits.end();
103 for (;
it != it_end; ++
it) {
104 std::pair<int, int> minMax =
range((*it)->r, (*it)->phimin, (*it)->phimax);
106 int binmin = minMax.first;
107 int binmax = minMax.second;
109 if (binmin >=
m_nbins)
continue;
110 if (binmax < 0)
continue;
112 if (binmin < 0) binmin = 0;
115 std::cout <<
" layer " << (*it)->layer <<
" r " << (*it)->r <<
" phimin " << (*it)->phimin <<
" phimax " << (*it)->phimax
116 <<
" new min " << binmin <<
" " << binmax << std::endl;
119 if (prevbinmax == -1) {
121 std::cout <<
" first range " << (*it)->layer <<
" r " << (*it)->r <<
" range " << binmin <<
" " << binmax <<
" new min "
122 << binmin <<
" " << binmax << std::endl;
125 prevlayer = (*it)->layer;
129 if (binmin < prevbinmin && prevlayer == (*it)->layer)
130 std::cout <<
"Error hits are out of order: min " << binmin <<
" max " << binmax << std::endl;
134 if (prevbinmax < binmin || prevlayer != (*it)->layer) {
136 std::cout <<
" filling " << (*it)->layer <<
" r " << (*it)->r <<
" phimin " << (*it)->phimin <<
" phimax "
137 << (*it)->phimax <<
" range " << prevbinmin <<
" " << prevbinmax <<
" new min " << binmin <<
" " << binmax
139 for (
int n = prevbinmin;
n <= prevbinmax; ++
n) {
141 int w = 1000 * (*it)->w;
142 if (subtract)
w *= -1;
143 if (
w < 0 && (
int)
val < -
w)
150 prevlayer = (*it)->layer;
155 std::cout <<
" updating range " << (*it)->layer <<
" r " << (*it)->r <<
" phimin " << (*it)->phimin <<
" phimax "
156 << (*it)->phimax <<
" range " << prevbinmin <<
" " << prevbinmax <<
" new min " << binmin <<
" " << binmax
161 if (prevbinmax != -1) {
163 std::cout <<
" filling " <<
hits.back()->layer <<
" r " <<
hits.back()->r <<
" phimin " <<
hits.back()->phimin <<
" phimax "
164 <<
hits.back()->phimax <<
" range " << prevbinmin <<
" " << prevbinmax << std::endl;
165 for (
int n = prevbinmin;
n <= prevbinmax; ++
n) {
167 int w = 1000 *
hits.back()->w;
168 if (subtract)
w *= -1;
169 if (
w < 0 && (
int)
val < -
w)
178 std::vector<TH1*>
hists;
201 if (maxval < 0)
return false;
203 unsigned int tmax = 0;
205 unsigned int imaxval = maxval * 1000;
212 if (posb == -1)
return false;
213 if (tmax < imaxval)
return false;
221 std::cout <<
" too large maximum: " <<
maximum.max <<
" tmax " << tmax << std::endl;
227 unsigned int sidemax = 0.7 *
imax;
229 for (
int n = posb != 0 ? posb - 1 : posb;
n >= 0; --
n) {
249 PhiHitVec::const_iterator
it =
hits.begin();
250 PhiHitVec::const_iterator it_end =
hits.end();
251 for (;
it != it_end; ++
it) {
253 std::pair<int, int> minMax =
range((*it)->r, (*it)->phimin, (*it)->phimax);
255 std::cout <<
" hit: r " << (*it)->r <<
" phimin " << (*it)->phimin <<
" phimax " << (*it)->phimax <<
" range "
256 << minMax.first <<
" " << minMax.second <<
" maximum range " <<
maximum.binposmin <<
" " <<
maximum.binposmax
258 if (minMax.first >
maximum.binposmax)
continue;
259 if (minMax.second <
maximum.binposmin)
continue;