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);
63 DetIds_.reserve(
indexes.size());
65 DetIds_.push_back(
p->detid);
70 if (9*strip>=(range.second-range.first)*8)
72 <<
"[SiStripNoises::getNoise] looking for SiStripNoises for a strip out of range: strip " <<
strip;
76 v.push_back((static_cast<int16_t> (noise_*10.0 + 0.5) & 0x01FF)) ;
81 static const uint16_t BITS_PER_STRIP = 9;
82 const size_t VoSize = (size_t)((Vi.size() * BITS_PER_STRIP)/8+.999);
84 for(
size_t i = 0;
i<VoSize; ++
i)
87 for(
unsigned int stripIndex =0; stripIndex<Vi.size(); ++stripIndex){
88 unsigned char*
data = &Vo[VoSize-1];
89 uint32_t lowBit = stripIndex * BITS_PER_STRIP;
90 uint8_t firstByteBit = (lowBit & 0x7);
91 uint8_t firstByteNBits = 8 - firstByteBit;
92 uint8_t firstByteMask = 0xffu << firstByteBit;
93 uint8_t secondByteNbits = (BITS_PER_STRIP - firstByteNBits);
94 uint8_t secondByteMask = ~(0xffu << secondByteNbits);
96 *(data-lowBit/8) = (*(data-lowBit/8) & ~(firstByteMask)) | ((Vi[stripIndex] & 0xffu) <<firstByteBit);
97 *(data-lowBit/8-1) = (*(data-lowBit/8-1) & ~(secondByteMask)) | ((Vi[stripIndex] >> firstByteNBits) & secondByteMask);
127 size_t mysize = ((range.second-range.first) << 3) / 9;
128 size_t size = noises.size();
130 <<
"[SiStripNoises::allNoises] Requested noise for " << noises.size() <<
" strips, I have it only for " << mysize <<
" strips\n";
131 size_t size8 = size & (~0x7), carry = size & 0x7;
132 const uint8_t *ptr = (&*range.second) - 1;
133 std::vector<float>::iterator
out = noises.begin(), end8 = noises.begin() + size8;
137 *out =
static_cast<float> (
get9bits(ptr, 0) / 10.0f ); ++
out;
138 *out =
static_cast<float> (
get9bits(ptr, 1) / 10.0f ); ++
out;
139 *out =
static_cast<float> (
get9bits(ptr, 2) / 10.0f ); ++
out;
140 *out =
static_cast<float> (
get9bits(ptr, 3) / 10.0f ); ++
out;
141 *out =
static_cast<float> (
get9bits(ptr, 4) / 10.0f ); ++
out;
142 *out =
static_cast<float> (
get9bits(ptr, 5) / 10.0f ); ++
out;
143 *out =
static_cast<float> (
get9bits(ptr, 6) / 10.0f ); ++
out;
144 *out =
static_cast<float> (
get9bits(ptr, 7) / 10.0f ); ++
out;
147 for (
size_t rem = 0; rem < carry; ++rem ) {
148 *out =
static_cast<float> (
get9bits(ptr, rem) / 10.0f ); ++
out;
194 std::vector<float> vstripnoise;
196 ss <<
"detid" << std::setw(15) <<
"strip" << std::setw(10) <<
"noise" << std::endl;
200 for(;rit!=erit;++rit){
201 Nstrips = (rit->iend-rit->ibegin)*8/9;
202 vstripnoise.resize(Nstrips);
206 if( detId != oldDetId ) {
211 for(
size_t i=0;
i<Nstrips;++
i){
212 if(
i != 0 ) ss <<
" ";
213 ss << std::setw(15) <<
i << std::setw(10) << vstripnoise[
i] << std::endl;
222 std::stringstream tempss;
226 std::vector<float> vstripnoise;
228 for(;rit!=erit;++rit){
229 Nstrips = (rit->iend-rit->ibegin)*8/9;
230 vstripnoise.resize(Nstrips);
232 tempss <<
"\ndetid: " << rit->detid <<
" \t ";
233 mean=0; rms=0; min=10000; max=0;
235 DetId detId(rit->detid);
237 for(
size_t i=0;
i<Nstrips;++
i){
238 mean+=vstripnoise[
i];
239 rms+=vstripnoise[
i]*vstripnoise[
i];
240 if(vstripnoise[
i]<min) min=vstripnoise[
i];
241 if(vstripnoise[
i]>max) max=vstripnoise[
i];
243 summary.
add(detId, vstripnoise[
i]);
246 rms=
sqrt(rms/Nstrips-mean*mean);
249 tempss <<
"Nstrips " << Nstrips <<
" \t; mean " << mean <<
" \t; rms " << rms <<
" \t; min " << min <<
" \t; max " << max <<
"\t " ;
251 ss << std::endl <<
"Summary:" << std::endl;
258 std::vector<ratioData>
result;
265 for(;iter!=iterE;++iter){
268 aData.
detid=iter->detid;
274 size_t strip=0, stripE= (range.second-range.first)*8/9;
275 for (;strip<stripE;++
strip){
276 if(d_range.first==d_range.second){
281 aData.
values.push_back(value);
283 result.push_back(aData);
290 for(;iter!=iterE;++iter){
295 if(range.first==range.second){
296 aData.
detid=iter->detid;
298 size_t strip=0, stripE= (d_range.second-d_range.first)*8/9;
299 for (;strip<stripE;++
strip){
301 aData.
values.push_back(value);
303 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
static float getNoise(uint16_t strip, const Range &range)
Registry::const_iterator RegistryIterator
void print(std::stringstream &ss, const bool mean=true) const
bool put(const uint32_t &detID, const InputVector &input)
RegistryIterator getRegistryVectorEnd() const
void getDetIds(std::vector< uint32_t > &DetIds_) const
RegistryIterator getRegistryVectorBegin() const
char data[epos_bytes_allocation]
Range getRangeByPos(unsigned short pos) const
const Range getRange(const uint32_t detID) const
void printDebug(std::stringstream &ss) const
void printSummary(std::stringstream &ss) const
std::pair< ContainerIterator, ContainerIterator > Range
void allNoises(std::vector< float > &noises, const Range &range) const
ContainerIterator getDataVectorBegin() const
void add(const DetId &detid, const float &value)
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo...
void setData(float noise_, InputVector &vped)