22 if (badChannels.size() < linearCutoff) {
23 return (
std::find(badChannels.begin(), badChannels.end(), channel) != badChannels.end());
25 return std::binary_search(badChannels.begin(), badChannels.end(), channel);
48 std::vector<HDigiFP420> cluster_digis;
50 cluster_digis.reserve(15);
52 std::vector<ClusterFP420> rhits;
53 rhits.reserve((
end -
begin) / 3 + 1);
55 AboveSeed predicate(seedThresholdInNoiseSigma(), vnoise);
58 int vnoisesize = vnoise.size();
60 if (vnoisesize <= itest->channel()) {
61 std::cout <<
"WARNING for detid " << detid <<
" there will be a request for noise for channel seed"
62 << itest->channel() <<
" but this detid has vnoise.size= " << vnoise.size() <<
"\nskip" << std::endl;
68 while (ibeg !=
end && (ihigh = find_if(ibeg,
end, predicate)) !=
end) {
76 while (itest !=
end && (itest->channel() - iend->channel() <= max_voids_ + 1)) {
77 float channelNoise = vnoise[itest->channel()].getNoise();
78 bool IsBadChannel = vnoise[itest->channel()].getDisable();
79 if (!IsBadChannel && itest->adc() >= static_cast<int>(channelThresholdInNoiseSigma() * channelNoise)) {
86 if (itest !=
end && (itest->channel() - iend->channel() == 1) && vnoise[itest->channel()].getDisable()) {
87 std::cout <<
"Inserted bad electrode at the end edge iend->channel()= " << iend->channel()
88 <<
" itest->channel() = " << itest->channel() << std::endl;
94 while (itest >=
begin && (ibeg->channel() - itest->channel() <= max_voids_ + 1)) {
95 float channelNoise = vnoise[itest->channel()].getNoise();
96 bool IsBadChannel = vnoise[itest->channel()].getDisable();
97 if (!IsBadChannel && itest->adc() >= static_cast<int>(channelThresholdInNoiseSigma() * channelNoise)) {
104 if (itest >=
begin && (ibeg->channel() - itest->channel() == 1) && vnoise[itest->channel()].getDisable()) {
105 std::cout <<
"Inserted bad electrode at the begin edge ibeg->channel()= " << ibeg->channel()
106 <<
" itest->channel() = " << itest->channel() << std::endl;
111 float sigmaNoise2 = 0;
112 cluster_digis.clear();
113 for (
i = ibeg;
i <= iend; ++
i) {
114 float channelNoise = vnoise[
i->channel()].getNoise();
115 bool IsBadChannel = vnoise[
i->channel()].getDisable();
117 if (
i != ibeg &&
i->channel() - (
i - 1)->channel() != 1) {
119 for (
int j = (
i - 1)->channel() + 1;
j <
i->channel(); ++
j) {
127 if (!IsBadChannel &&
i->adc() >= static_cast<int>(channelThresholdInNoiseSigma() * channelNoise)) {
129 sigmaNoise2 += channelNoise * channelNoise;
130 cluster_digis.push_back(*
i);
132 cluster_digis.push_back(
137 float sigmaNoise =
sqrt(sigmaNoise2);
141 unsigned int xytype = 2;
142 if (
charge >= static_cast<int>(clusterThresholdInNoiseSigma() * sigmaNoise)) {
155 d = ichannel->stripV() - jchannel->stripV();
157 }
else if (xytype == 1) {
158 d = ichannel->stripH() - jchannel->stripH();
161 std::cout <<
"difNarr: wrong xytype = " << xytype << std::endl;
168 d = ichannel->stripVW() - jchannel->stripVW();
170 }
else if (xytype == 1) {
171 d = ichannel->stripHW() - jchannel->stripHW();
174 std::cout <<
"difWide: wrong xytype = " << xytype << std::endl;
193 std::vector<HDigiFP420> cluster_digis;
196 cluster_digis.reserve(25);
199 std::vector<ClusterFP420> rhits;
200 rhits.reserve((
end -
begin) / 3 + 1);
203 AboveSeed predicate(seedThresholdInNoiseSigma(), vnoise);
217 int vnoisesize = vnoise.size();
218 if (vnoisesize <= itest->channel()) {
228 while (ibeg !=
end && (ihigh = find_if(ibeg,
end, predicate)) !=
end) {
237 while (itest !=
end && (difNarr(xytype, itest, iend) <= max_voids_ + 1) && (difWide(xytype, itest, iend) <= 1)) {
238 float channelNoise = vnoise[itest->channel()].getNoise();
239 bool IsBadChannel = vnoise[itest->channel()].getDisable();
240 if (!IsBadChannel && itest->adc() >= static_cast<int>(channelThresholdInNoiseSigma() * channelNoise)) {
243 std::cout <<
"=========================================================================== " << std::endl;
244 std::cout <<
"Right side: itest->adc()= " << itest->adc()
245 <<
" channel_noise = " << static_cast<int>(channelThresholdInNoiseSigma() * channelNoise)
253 if (itest !=
end && (difNarr(xytype, itest, iend) == 1) && (difWide(xytype, itest, iend) < 1) &&
254 vnoise[itest->channel()].getDisable()) {
256 std::cout <<
"Inserted bad electrode at the end edge iend->channel()= " << iend->channel()
257 <<
" itest->channel() = " << itest->channel() << std::endl;
262 std::cout <<
"Result of going to right side iend->channel()= " << iend->channel()
263 <<
" itest->channel() = " << itest->channel() << std::endl;
270 while (itest >=
begin && (difNarr(xytype, ibeg, itest) <= max_voids_ + 1) && (difWide(xytype, ibeg, itest) <= 1)) {
271 float channelNoise = vnoise[itest->channel()].getNoise();
272 bool IsBadChannel = vnoise[itest->channel()].getDisable();
273 if (!IsBadChannel && itest->adc() >= static_cast<int>(channelThresholdInNoiseSigma() * channelNoise)) {
276 std::cout <<
"Left side: itest->adc()= " << itest->adc()
277 <<
" channel_noise = " << static_cast<int>(channelThresholdInNoiseSigma() * channelNoise)
285 if (itest >=
begin && (difNarr(xytype, ibeg, itest) == 1) && (difWide(xytype, ibeg, itest) < 1) &&
286 vnoise[itest->channel()].getDisable()) {
288 std::cout <<
"Inserted bad electrode at the begin edge ibeg->channel()= " << ibeg->channel()
289 <<
" itest->channel() = " << itest->channel() << std::endl;
294 std::cout <<
"Result of going to left side ibeg->channel()= " << ibeg->channel()
295 <<
" itest->channel() = " << itest->channel() << std::endl;
301 float sigmaNoise2 = 0;
302 cluster_digis.clear();
305 std::cout <<
"check for consecutive digis ibeg->channel()= " << ibeg->channel()
306 <<
" iend->channel() = " << iend->channel() << std::endl;
308 for (
i = ibeg;
i <= iend; ++
i) {
309 float channelNoise = vnoise[
i->channel()].getNoise();
310 bool IsBadChannel = vnoise[
i->channel()].getDisable();
312 std::cout <<
"Looking at cluster digis: detid " << detid <<
" digis " <<
i->channel() <<
" adc " <<
i->adc()
313 <<
" channelNoise " << channelNoise <<
" IsBadChannel " << IsBadChannel << std::endl;
320 std::cout <<
"difNarr(xytype,i,i-1) = " << difNarr(xytype,
i,
i - 1) << std::endl;
321 std::cout <<
"difWide(xytype,i,i-1) = " << difWide(xytype,
i,
i - 1) << std::endl;
325 if (
i != ibeg && (difNarr(xytype,
i,
i - 1) > 1 && difWide(xytype,
i,
i - 1) > 1)) {
327 for (
int j = (
i - 1)->channel() + 1;
j <
i->channel(); ++
j) {
329 std::cout <<
"not consecutive digis: set HDigiFP420.adc_=0 : j = " <<
j << std::endl;
335 if (!IsBadChannel &&
i->adc() >= static_cast<int>(channelThresholdInNoiseSigma() * channelNoise)) {
337 sigmaNoise2 += channelNoise * channelNoise;
338 cluster_digis.push_back(*
i);
340 std::cout <<
"put into cluster_digis good i info: i->channel() = " <<
i->channel() << std::endl;
343 cluster_digis.push_back(
346 std::cout <<
"else if electrode bad or under threshold set HDigiFP420.adc_=0: i->channel() = " <<
i->channel()
353 float sigmaNoise =
sqrt(sigmaNoise2);
356 if (
charge >= static_cast<int>(clusterThresholdInNoiseSigma() * sigmaNoise)) {
360 std::cout <<
"Looking at cog and err : cog " << cog <<
" err " <<
err << std::endl;
361 std::cout <<
"=========================================================================== " << std::endl;