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)
49 DetIds_.push_back(
p->detid);
54 if (9*strip>=(range.second-range.first)*8){
56 <<
"[SiStripNoises::getNoise] looking for SiStripNoises for a strip out of range: strip " <<
strip;
62 v.push_back((static_cast<int16_t> (noise_*10.0 + 0.5) & 0x01FF)) ;
66 static const uint16_t BITS_PER_STRIP = 9;
67 const size_t VoSize = (size_t)((Vi.size() * BITS_PER_STRIP)/8+.999);
69 for(
size_t i = 0;
i<VoSize; ++
i)
72 for(
unsigned int stripIndex =0; stripIndex<Vi.size(); ++stripIndex){
73 unsigned char*
data = &Vo[VoSize-1];
74 uint32_t lowBit = stripIndex * BITS_PER_STRIP;
75 uint8_t firstByteBit = (lowBit & 0x7);
76 uint8_t firstByteNBits = 8 - firstByteBit;
77 uint8_t firstByteMask = 0xffu << firstByteBit;
78 uint8_t secondByteNbits = (BITS_PER_STRIP - firstByteNBits);
79 uint8_t secondByteMask = ~(0xffu << secondByteNbits);
81 *(data-lowBit/8) = (*(data-lowBit/8) & ~(firstByteMask)) | ((Vi[stripIndex] & 0xffu) <<firstByteBit);
82 *(data-lowBit/8-1) = (*(data-lowBit/8-1) & ~(secondByteMask)) | ((Vi[stripIndex] >> firstByteNBits) & secondByteMask);
112 size_t mysize = ((range.second-range.first) << 3) / 9;
113 size_t size = noises.size();
115 <<
"[SiStripNoises::allNoises] Requested noise for " << noises.size() <<
" strips, I have it only for " << mysize <<
" strips\n";
116 size_t size8 = size & (~0x7), carry = size & 0x7;
117 const uint8_t *ptr = (&*range.second) - 1;
118 std::vector<float>::iterator
out = noises.begin(), end8 = noises.begin() + size8;
122 *out =
static_cast<float> (
get9bits(ptr, 0) / 10.0f ); ++
out;
123 *out =
static_cast<float> (
get9bits(ptr, 1) / 10.0f ); ++
out;
124 *out =
static_cast<float> (
get9bits(ptr, 2) / 10.0f ); ++
out;
125 *out =
static_cast<float> (
get9bits(ptr, 3) / 10.0f ); ++
out;
126 *out =
static_cast<float> (
get9bits(ptr, 4) / 10.0f ); ++
out;
127 *out =
static_cast<float> (
get9bits(ptr, 5) / 10.0f ); ++
out;
128 *out =
static_cast<float> (
get9bits(ptr, 6) / 10.0f ); ++
out;
129 *out =
static_cast<float> (
get9bits(ptr, 7) / 10.0f ); ++
out;
132 for (
size_t rem = 0; rem < carry; ++rem ) {
133 *out =
static_cast<float> (
get9bits(ptr, rem) / 10.0f ); ++
out;
179 std::vector<float> vstripnoise;
181 ss <<
"detid" << std::setw(15) <<
"strip" << std::setw(10) <<
"noise" << std::endl;
185 for(;rit!=erit;++rit){
186 Nstrips = (rit->iend-rit->ibegin)*8/9;
187 vstripnoise.resize(Nstrips);
191 if( detId != oldDetId ) {
196 for(
size_t i=0;
i<Nstrips;++
i){
197 if(
i != 0 ) ss <<
" ";
198 ss << std::setw(15) <<
i << std::setw(10) << vstripnoise[
i] << std::endl;
207 std::stringstream tempss;
211 std::vector<float> vstripnoise;
213 for(;rit!=erit;++rit){
214 Nstrips = (rit->iend-rit->ibegin)*8/9;
215 vstripnoise.resize(Nstrips);
217 tempss <<
"\ndetid: " << rit->detid <<
" \t ";
218 mean=0; rms=0; min=10000; max=0;
220 DetId detId(rit->detid);
222 for(
size_t i=0;
i<Nstrips;++
i){
223 mean+=vstripnoise[
i];
224 rms+=vstripnoise[
i]*vstripnoise[
i];
225 if(vstripnoise[
i]<min) min=vstripnoise[
i];
226 if(vstripnoise[
i]>max) max=vstripnoise[
i];
228 summary.
add(detId, vstripnoise[
i]);
231 rms=
sqrt(rms/Nstrips-mean*mean);
234 tempss <<
"Nstrips " << Nstrips <<
" \t; mean " << mean <<
" \t; rms " << rms <<
" \t; min " << min <<
" \t; max " << max <<
"\t " ;
236 ss << std::endl <<
"Summary:" << std::endl;
243 std::vector<ratioData>
result;
250 for(;iter!=iterE;++iter){
253 aData.
detid=iter->detid;
259 size_t strip=0, stripE= (range.second-range.first)*8/9;
260 for (;strip<stripE;++
strip){
261 if(d_range.first==d_range.second){
266 aData.
values.push_back(value);
268 result.push_back(aData);
275 for(;iter!=iterE;++iter){
280 if(range.first==range.second){
281 aData.
detid=iter->detid;
283 size_t strip=0, stripE= (d_range.second-d_range.first)*8/9;
284 for (;strip<stripE;++
strip){
286 aData.
values.push_back(value);
288 result.push_back(aData);
std::vector< ratioData > operator/(SiStripNoises d)
static uint16_t get9bits(const uint8_t *&ptr, int8_t skip)
std::vector< float > values
std::vector< uint16_t > InputVector
static void encode(const InputVector &Vi, std::vector< unsigned char > &Vo_CHAR)
static float getNoiseFast(const uint16_t &strip, const Range &range)
const T & max(const T &a, const T &b)
Registry::const_iterator RegistryIterator
void print(std::stringstream &ss, const bool mean=true) const
bool put(const uint32_t &detID, const InputVector &input)
static float getNoise(uint16_t strip, const Range &range)
RegistryIterator getRegistryVectorEnd() const
void getDetIds(std::vector< uint32_t > &DetIds_) const
RegistryIterator getRegistryVectorBegin() const
char data[epos_bytes_allocation]
void printDebug(std::stringstream &ss) const
void printSummary(std::stringstream &ss) const
std::pair< ContainerIterator, ContainerIterator > Range
const Range getRange(const uint32_t &detID) const
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...
tuple size
Write out results.
void setData(float noise_, InputVector &vped)