17 std::vector<unsigned char> Vo_CHAR;
21 if (p !=
indexes.end() && p->detid == DetId)
24 size_t sd = Vo_CHAR.end() - Vo_CHAR.begin();
26 detregistry.
detid = DetId;
38 if (p ==
indexes.end() || p->detid != DetId)
41 __builtin_prefetch((&
v_noises.front()) + p->ibegin);
42 __builtin_prefetch((&
v_noises.front()) + p->ibegin + 96);
43 __builtin_prefetch((&
v_noises.front()) + p->iend - 96);
52 __builtin_prefetch((&
v_noises.front()) +
p->ibegin);
53 __builtin_prefetch((&
v_noises.front()) +
p->ibegin + 96);
54 __builtin_prefetch((&
v_noises.front()) +
p->iend - 96);
62 DetIds_.reserve(
indexes.size());
64 DetIds_.push_back(
p->detid);
69 if (9 * strip >= (range.second - range.first) * 8)
71 <<
"[SiStripNoises::getNoise] looking for SiStripNoises for a strip out of range: strip " <<
strip;
75 v.push_back((static_cast<int16_t>(noise_ * 10.0 + 0.5) & 0x01FF));
79 static const uint16_t BITS_PER_STRIP = 9;
80 const size_t VoSize = (size_t)((Vi.size() * BITS_PER_STRIP) / 8 + .999);
82 for (
size_t i = 0;
i < VoSize; ++
i)
85 for (
unsigned int stripIndex = 0; stripIndex < Vi.size(); ++stripIndex) {
86 unsigned char*
data = &Vo[VoSize - 1];
87 uint32_t lowBit = stripIndex * BITS_PER_STRIP;
88 uint8_t firstByteBit = (lowBit & 0x7);
89 uint8_t firstByteNBits = 8 - firstByteBit;
90 uint8_t firstByteMask = 0xffu << firstByteBit;
91 uint8_t secondByteNbits = (BITS_PER_STRIP - firstByteNBits);
92 uint8_t secondByteMask = ~(0xffu << secondByteNbits);
94 *(data - lowBit / 8) = (*(data - lowBit / 8) & ~(firstByteMask)) | ((Vi[stripIndex] & 0xffu) << firstByteBit);
95 *(data - lowBit / 8 - 1) =
96 (*(data - lowBit / 8 - 1) & ~(secondByteMask)) | ((Vi[stripIndex] >> firstByteNBits) & secondByteMask);
123 size_t mysize = ((range.second - range.first) << 3) / 9;
124 size_t size = noises.size();
126 throw cms::Exception(
"CorruptedData") <<
"[SiStripNoises::allNoises] Requested noise for " << noises.size()
127 <<
" strips, I have it only for " << mysize <<
" strips\n";
128 size_t size8 = size & (~0x7), carry = size & 0x7;
129 const uint8_t* ptr = (&*range.second) - 1;
130 std::vector<float>::iterator
out = noises.begin(), end8 = noises.begin() + size8;
134 *out =
static_cast<float>(
get9bits(ptr, 0) / 10.0f);
136 *out =
static_cast<float>(
get9bits(ptr, 1) / 10.0f);
138 *out =
static_cast<float>(
get9bits(ptr, 2) / 10.0f);
140 *out =
static_cast<float>(
get9bits(ptr, 3) / 10.0f);
142 *out =
static_cast<float>(
get9bits(ptr, 4) / 10.0f);
144 *out =
static_cast<float>(
get9bits(ptr, 5) / 10.0f);
146 *out =
static_cast<float>(
get9bits(ptr, 6) / 10.0f);
148 *out =
static_cast<float>(
get9bits(ptr, 7) / 10.0f);
152 for (
size_t rem = 0; rem < carry; ++rem) {
153 *out =
static_cast<float>(
get9bits(ptr, rem) / 10.0f);
199 std::vector<float> vstripnoise;
201 ss <<
"detid" << std::setw(15) <<
"strip" << std::setw(10) <<
"noise" << std::endl;
205 for (; rit != erit; ++rit) {
206 Nstrips = (rit->iend - rit->ibegin) * 8 / 9;
207 vstripnoise.resize(Nstrips);
211 if (detId != oldDetId) {
216 for (
size_t i = 0;
i < Nstrips; ++
i) {
219 ss << std::setw(15) <<
i << std::setw(10) << vstripnoise[
i] << std::endl;
227 std::stringstream tempss;
231 std::vector<float> vstripnoise;
233 for (; rit != erit; ++rit) {
234 Nstrips = (rit->iend - rit->ibegin) * 8 / 9;
235 vstripnoise.resize(Nstrips);
237 tempss <<
"\ndetid: " << rit->detid <<
" \t ";
243 DetId detId(rit->detid);
245 for (
size_t i = 0;
i < Nstrips; ++
i) {
246 mean += vstripnoise[
i];
247 rms += vstripnoise[
i] * vstripnoise[
i];
248 if (vstripnoise[
i] < min)
249 min = vstripnoise[
i];
250 if (vstripnoise[
i] > max)
251 max = vstripnoise[
i];
256 rms =
sqrt(rms / Nstrips - mean * mean);
258 tempss <<
"Nstrips " << Nstrips <<
" \t; mean " << mean <<
" \t; rms " << rms <<
" \t; min " << min <<
" \t; max "
261 ss << std::endl <<
"Summary:" << std::endl;
268 std::vector<ratioData>
result;
275 for (; iter != iterE; ++iter) {
278 aData.
detid = iter->detid;
284 size_t strip = 0, stripE = (range.second - range.first) * 8 / 9;
285 for (; strip < stripE; ++
strip) {
286 if (d_range.first == d_range.second) {
291 aData.
values.push_back(value);
293 result.push_back(aData);
300 for (; iter != iterE; ++iter) {
305 if (range.first == range.second) {
306 aData.
detid = iter->detid;
308 size_t strip = 0, stripE = (d_range.second - d_range.first) * 8 / 9;
309 for (; strip < stripE; ++
strip) {
311 aData.
values.push_back(value);
313 result.push_back(aData);
static uint16_t get9bits(const uint8_t *&ptr, int8_t skip)
std::vector< float > values
std::vector< uint16_t > InputVector
std::vector< ratioData > operator/(const SiStripNoises &d)
static void verify(uint16_t strip, const Range &range)
static void encode(const InputVector &Vi, std::vector< unsigned char > &Vo_CHAR)
static std::string const input
const uint16_t range(const Frame &aFrame)
static float getNoise(uint16_t strip, const Range &range)
Registry::const_iterator RegistryIterator
bool put(const uint32_t &detID, const InputVector &input)
RegistryIterator getRegistryVectorEnd() const
void getDetIds(std::vector< uint32_t > &DetIds_) const
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
RegistryIterator getRegistryVectorBegin() const
char data[epos_bytes_allocation]
Range getRangeByPos(unsigned short pos) const
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
const Range getRange(const uint32_t detID) const
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
std::pair< ContainerIterator, ContainerIterator > Range
void allNoises(std::vector< float > &noises, const Range &range) const
ContainerIterator getDataVectorBegin() const
tuple size
Write out results.
void setData(float noise_, InputVector &vped)