12 #include "boost/lexical_cast.hpp"
19 <<
" Constructing object...";
35 <<
" Destructing object...";
104 <<
" " <<
nstrips_ <<
" digis expected, but got " <<
nbins <<
". Skipping.";
109 static int32_t firstev =
summary.event();
113 if (static_cast<int32_t>(
summary.event()) - firstev <
nskip_) {
119 <<
" Done skipping events. Now starting pedestals.";
127 for (uint16_t istrip = 0; istrip <
nstrips_; ++istrip) {
136 for (uint16_t iapv = 0; iapv < 2; ++iapv) {
137 for (uint16_t ibin = 0; ibin < 128; ++ibin) {
138 uint16_t istrip = (iapv * 128) + ibin;
148 <<
" Rough pedestals done. Now starting noise measurements.";
155 std::vector<int32_t> cm;
157 std::vector<uint16_t>
adc;
158 for (uint16_t iapv = 0; iapv < 2; iapv++) {
161 for (uint16_t ibin = 0; ibin < 128; ibin++) {
162 if ((iapv * 128) + ibin <
nbins) {
163 adc.push_back(digis.
data.at((iapv * 128) + ibin).adc());
166 sort(
adc.begin(),
adc.end());
168 uint16_t
index =
adc.size() % 2 ?
adc.size() / 2 :
adc.size() / 2 - 1;
169 cm[iapv] = static_cast<int16_t>(
adc[
index]);
172 for (uint16_t istrip = 0; istrip <
nstrips_; ++istrip) {
174 int16_t noiseval = static_cast<int16_t>(digis.
data.at(istrip).adc()) - cm[istrip / 128];
180 std::vector<int16_t> noisevals, noisevalssorted;
181 std::vector<float> noisevalsfl, noisevalssortedfl;
182 for (uint16_t iapv = 0; iapv < 2; ++iapv) {
186 noisevalssorted.clear();
187 noisevalssortedfl.clear();
188 for (uint16_t ibin = 0; ibin < 128; ++ibin) {
189 uint16_t istrip = (iapv * 128) + ibin;
192 noisevalsfl.push_back(static_cast<float>(digis.
data.at(istrip).adc()) -
pedsfl_.at(istrip));
195 totadc += noisevalsfl[ibin];
197 noisevalssortedfl.push_back(noisevalsfl[ibin]);
200 noisevals.push_back(static_cast<int16_t>(digis.
data.at(istrip).adc()) -
peds_.at(istrip));
203 totadc += noisevals[ibin];
205 noisevalssorted.push_back(noisevals[ibin]);
213 cmshift = totadc / 128;
215 cmshift = static_cast<int16_t>(totadc / 128);
220 sort(noisevalssortedfl.begin(), noisevalssortedfl.end());
221 uint16_t
index = noisevalssortedfl.size() % 2 ? noisevalssortedfl.size() / 2 : noisevalssortedfl.size() / 2 - 1;
222 cmshift = noisevalssortedfl[
index];
225 sort(noisevalssorted.begin(), noisevalssorted.end());
226 uint16_t
index = noisevalssorted.size() % 2 ? noisevalssorted.size() / 2 : noisevalssorted.size() / 2 - 1;
227 cmshift = noisevalssorted[
index];
231 for (uint16_t ibin = 0; ibin < 128; ++ibin) {
232 uint16_t istrip = (iapv * 128) + ibin;
234 float noiseval = (
usefloatpeds_ ? noisevalsfl[ibin] : noisevals[ibin]) - cmshift;
236 uint32_t binnr =
hist2d_->GetBin(static_cast<int>(noiseval +
nadcnoise_), istrip + 1);