7 std::vector<unsigned char> Vo_CHAR;
11 if (p!=
indexes.end() && p->detid==DetId)
15 size_t sd= Vo_CHAR.end() - Vo_CHAR.begin();
17 detregistry.
detid=DetId;
31 if (p==
indexes.end()|| p->detid!=DetId)
42 DetIds_.push_back(
p->detid);
48 vped.push_back((static_cast<uint16_t> (ped) & 0x3FF)) ;
52 if (10*strip>=(range.second-range.first)*8){
54 <<
"[SiStripPedestals::getPed] looking for SiStripPedestals for a strip out of range: strip " <<
strip;
56 return static_cast<float> (
decode(strip,range));
60 static const uint16_t BITS_PER_STRIP = 10;
61 const size_t VoSize = (size_t)((Vi.size() * BITS_PER_STRIP)/8+.999);
63 for(
size_t i = 0;
i<Vo.size(); ++
i)
66 for(
unsigned int stripIndex =0; stripIndex<Vi.size(); ++stripIndex){
67 unsigned char*
data = &Vo[Vo.size()-1];
68 uint32_t lowBit = stripIndex * BITS_PER_STRIP;
69 uint8_t firstByteBit = (lowBit & 0x6);
70 uint8_t firstByteNBits = 8 - firstByteBit;
71 uint8_t firstByteMask = 0xffu << firstByteBit;
72 uint8_t secondByteNbits = (BITS_PER_STRIP - firstByteNBits);
73 uint8_t secondByteMask = ~(0xffu << secondByteNbits);
75 *(data-lowBit/8) = (*(data-lowBit/8) & ~(firstByteMask)) | ((Vi[stripIndex] & 0xffu) <<firstByteBit);
76 *(data-lowBit/8-1) = (*(data-lowBit/8-1) & ~(secondByteMask)) | ((Vi[stripIndex] >> firstByteNBits) & secondByteMask);
101 const char *
data = &*(range.second -1);
102 static const uint16_t BITS_PER_STRIP = 10;
104 uint32_t lowBit = strip * BITS_PER_STRIP;
105 uint8_t firstByteBit = (lowBit & 6);
106 uint8_t firstByteNBits = 8 - firstByteBit;
107 uint8_t firstByteMask = 0xffu << firstByteBit;
108 uint8_t secondByteMask = ~(0xffu << (BITS_PER_STRIP - firstByteNBits));
109 uint16_t
value = ((uint16_t(*(data-lowBit/8 )) & firstByteMask) >> firstByteBit) | ((uint16_t(*(data-lowBit/8-1)) & secondByteMask) << firstByteNBits);
134 uint8_t maskThis = (0xFF <<
skip);
135 uint8_t maskThat = ((4 <<
skip) - 1);
136 uint16_t ret = ( ((*ptr) & maskThis) >> skip );
138 return ret | ( ((*ptr) & maskThat) << (8 - skip) );
143 size_t mysize = ((range.second-range.first) << 3) / 10;
144 size_t size = peds.size();
146 <<
"[SiStripPedestals::allPeds] Requested pedestals for " << peds.size() <<
" strips, I have it only for " << mysize <<
" strips\n";
147 size_t size4 = size & (~0x3), carry = size & 0x3;
148 const uint8_t *ptr =
reinterpret_cast<const uint8_t *
>(&*range.second) - 1;
149 std::vector<int>::iterator
out = peds.begin(), end4 = peds.begin() + size4;
159 for (
size_t rem = 0; rem < carry; ++rem ) {
160 *out =
static_cast<int> (
get10bits(ptr, 2*rem) ); ++
out;
166 std::vector<uint32_t> detid;
169 for(
size_t id = 0;
id < detid.size(); ++
id ) {
171 for(
int it=0; it < (range.second-range.first)*8/10; ++it ){
172 summary.
add( detid[
id],
getPed(it,range) );
175 ss <<
"Summary of pedestals:" << std::endl;
182 std::vector<uint32_t> detid;
185 ss <<
"Number of detids = " << detid.size() << std::endl;
187 for(
size_t id = 0;
id < detid.size(); ++
id ) {
191 ss <<
"detid" << std::setw(15) <<
"strip" << std::setw(10) <<
"pedestal" << std::endl;
194 for(
int it=0; it < (range.second-range.first)*8/10; ++it ){
196 if( detId != oldDetId ) {
201 ss << std::setw(15) << strip++ << std::setw(10) <<
getPed(it,range) << std::endl;
std::pair< ContainerIterator, ContainerIterator > Range
void encode(InputVector &Vi, std::vector< unsigned char > &Vo_CHAR)
void printDebug(std::stringstream &ss) const
Prints all pedestals.
uint16_t decode(const uint16_t &strip, const Range &range) const
static std::string const input
float getPed(const uint16_t &strip, const Range &range) const
std::vector< uint16_t > InputVector
void printSummary(std::stringstream &ss) const
Prints mean pedestal value divided for subdet, layer and mono/stereo.
void print(std::stringstream &ss, const bool mean=true) const
void allPeds(std::vector< int > &pefs, const Range &range) const
void getDetIds(std::vector< uint32_t > &DetIds_) const
bool put(const uint32_t &detID, InputVector &input)
void setData(float ped, InputVector &vped)
char data[epos_bytes_allocation]
uint16_t get10bits(const uint8_t *&ptr, int8_t skip) const
const Range getRange(const uint32_t &detID) const
Registry::const_iterator RegistryIterator
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...