CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Friends
mySiStripNoises Class Reference

#include <mySiStripNoises.h>

Classes

struct  DetRegistry
 
class  StrictWeakOrdering
 

Public Types

typedef SiStripNoiseVector::const_iterator ContainerIterator
 
typedef std::pair< ContainerIterator, ContainerIteratorRange
 
typedef std::vector< DetRegistryRegistry
 
typedef Registry::const_iterator RegistryIterator
 
typedef std::vector< unsigned char > SiStripNoiseVector
 

Public Member Functions

uint16_t decode (const uint16_t &strip, const Range &range) const
 
void encode (InputVector &Vi, std::vector< unsigned char > &Vo_CHAR)
 
void getDetIds (std::vector< uint32_t > &DetIds) const
 
float getNoise (const uint16_t &strip, const Range &range) const
 
const Range getRange (const uint32_t &detID) const
 
 mySiStripNoises ()
 
bool put (const uint32_t detID, InputVector &input)
 
void setData (float noise_, std::vector< short > &vped)
 
 ~mySiStripNoises ()
 

Public Attributes

std::vector< DetRegistryindexes
 
const typedef std::vector< short > InputVector
 
std::vector< unsigned char > v_noises
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 14 of file mySiStripNoises.h.

Member Typedef Documentation

◆ ContainerIterator

typedef SiStripNoiseVector::const_iterator mySiStripNoises::ContainerIterator

Definition at line 31 of file mySiStripNoises.h.

◆ Range

Definition at line 32 of file mySiStripNoises.h.

◆ Registry

typedef std::vector<DetRegistry> mySiStripNoises::Registry

Definition at line 33 of file mySiStripNoises.h.

◆ RegistryIterator

typedef Registry::const_iterator mySiStripNoises::RegistryIterator

Definition at line 34 of file mySiStripNoises.h.

◆ SiStripNoiseVector

typedef std::vector<unsigned char> mySiStripNoises::SiStripNoiseVector

Definition at line 30 of file mySiStripNoises.h.

Constructor & Destructor Documentation

◆ mySiStripNoises()

mySiStripNoises::mySiStripNoises ( )
inline

Definition at line 16 of file mySiStripNoises.h.

16 {}

◆ ~mySiStripNoises()

mySiStripNoises::~mySiStripNoises ( )
inline

Definition at line 17 of file mySiStripNoises.h.

17 {}

Member Function Documentation

◆ decode()

uint16_t mySiStripNoises::decode ( const uint16_t &  strip,
const Range range 
) const

Definition at line 68 of file mySiStripNoises.cc.

68  {
69  const unsigned char* data = &*(range.second - 1); // pointer to the last byte of data
70  static const uint16_t BITS_PER_STRIP = 9;
71 
72  uint32_t lowBit = strip * BITS_PER_STRIP;
73  uint8_t firstByteBit = (lowBit & 7); //module 8
74  uint8_t firstByteNBits = 8 - firstByteBit;
75  uint8_t firstByteMask = 0xffu << firstByteBit;
76  uint8_t secondByteMask = ~(0xffu << (BITS_PER_STRIP - firstByteNBits));
77  uint16_t value = ((uint16_t(*(data - lowBit / 8)) & firstByteMask) >> firstByteBit) |
78  ((uint16_t(*(data - lowBit / 8 - 1)) & secondByteMask) << firstByteNBits);
79  return value;
80 }

References data, FastTimerService_cff::range, digitizers_cfi::strip, and relativeConstraints::value.

Referenced by ztail.Decoder::follow(), getNoise(), and ztail.Decoder::initial_synchronize().

◆ encode()

void mySiStripNoises::encode ( InputVector Vi,
std::vector< unsigned char > &  Vo_CHAR 
)

Definition at line 46 of file mySiStripNoises.cc.

46  {
47  static const uint16_t BITS_PER_STRIP = 9;
48  const size_t VoSize = (size_t)((Vi.size() * BITS_PER_STRIP) / 8 + .999);
49  Vo.resize(VoSize);
50  for (size_t i = 0; i < Vo.size(); ++i)
51  Vo[i] &= 0x00u;
52 
53  for (unsigned int stripIndex = 0; stripIndex < Vi.size(); ++stripIndex) {
54  unsigned char* data = &Vo[Vo.size() - 1];
55  uint32_t lowBit = stripIndex * BITS_PER_STRIP;
56  uint8_t firstByteBit = (lowBit & 0x7);
57  uint8_t firstByteNBits = 8 - firstByteBit;
58  uint8_t firstByteMask = 0xffu << firstByteBit;
59  uint8_t secondByteNbits = (BITS_PER_STRIP - firstByteNBits);
60  uint8_t secondByteMask = ~(0xffu << secondByteNbits);
61 
62  *(data - lowBit / 8) = (*(data - lowBit / 8) & ~(firstByteMask)) | ((Vi[stripIndex] & 0xffu) << firstByteBit);
63  *(data - lowBit / 8 - 1) =
64  (*(data - lowBit / 8 - 1) & ~(secondByteMask)) | ((Vi[stripIndex] >> firstByteNBits) & secondByteMask);
65  }
66 }

References data, and mps_fire::i.

Referenced by put().

◆ getDetIds()

void mySiStripNoises::getDetIds ( std::vector< uint32_t > &  DetIds) const

Definition at line 29 of file mySiStripNoises.cc.

29  {
30  // returns vector of DetIds in map
34  DetIds.push_back(p->detid);
35  }
36 }

References begin, end, indexes, and AlCaHLTBitMon_ParallelJobs::p.

◆ getNoise()

float mySiStripNoises::getNoise ( const uint16_t &  strip,
const Range range 
) const

Definition at line 38 of file mySiStripNoises.cc.

38  {
39  return static_cast<float>(decode(strip, range) / 10.0);
40 }

References decode(), FastTimerService_cff::range, and digitizers_cfi::strip.

◆ getRange()

const mySiStripNoises::Range mySiStripNoises::getRange ( const uint32_t &  detID) const

Definition at line 20 of file mySiStripNoises.cc.

20  {
21  // get SiStripNoises Range of DetId
22  RegistryIterator p = std::lower_bound(indexes.begin(), indexes.end(), DetId, StrictWeakOrdering());
23  if (p == indexes.end() || p->detid != DetId)
24  return mySiStripNoises::Range(v_noises.end(), v_noises.end());
25  else
26  return mySiStripNoises::Range(v_noises.begin() + p->ibegin, v_noises.begin() + p->iend);
27 }

References indexes, cuda_std::lower_bound(), AlCaHLTBitMon_ParallelJobs::p, and v_noises.

◆ put()

bool mySiStripNoises::put ( const uint32_t  detID,
InputVector input 
)

Definition at line 3 of file mySiStripNoises.cc.

3  {
4  // put in SiStripNoises of DetId
5  std::vector<unsigned char> Vo_CHAR;
6  encode(input, Vo_CHAR);
7  Registry::iterator p = std::lower_bound(indexes.begin(), indexes.end(), DetId, mySiStripNoises::StrictWeakOrdering());
8  if (p != indexes.end() && p->detid == DetId)
9  return false;
10  size_t sd = Vo_CHAR.end() - Vo_CHAR.begin();
11  DetRegistry detregistry;
12  detregistry.detid = DetId;
13  detregistry.ibegin = v_noises.size();
14  detregistry.iend = v_noises.size() + sd;
15  indexes.insert(p, detregistry);
16  v_noises.insert(v_noises.end(), Vo_CHAR.begin(), Vo_CHAR.end());
17  return true;
18 }

References mySiStripNoises::DetRegistry::detid, encode(), mySiStripNoises::DetRegistry::ibegin, mySiStripNoises::DetRegistry::iend, indexes, input, cuda_std::lower_bound(), AlCaHLTBitMon_ParallelJobs::p, sd, and v_noises.

◆ serialize()

template<class Archive >
void mySiStripNoises::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setData()

void mySiStripNoises::setData ( float  noise_,
std::vector< short > &  vped 
)

Definition at line 42 of file mySiStripNoises.cc.

42  {
43  v.push_back((static_cast<int16_t>(noise_ * 10.0 + 0.5) & 0x01FF));
44 }

References sistrip::extrainfo::noise_, and findQualityFiles::v.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 50 of file mySiStripNoises.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 50 of file mySiStripNoises.h.

Member Data Documentation

◆ indexes

std::vector<DetRegistry> mySiStripNoises::indexes

Definition at line 48 of file mySiStripNoises.h.

Referenced by getDetIds(), getRange(), and put().

◆ InputVector

const typedef std::vector<short> mySiStripNoises::InputVector

Definition at line 35 of file mySiStripNoises.h.

◆ v_noises

std::vector<unsigned char> mySiStripNoises::v_noises

Definition at line 47 of file mySiStripNoises.h.

Referenced by getRange(), and put().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
sistrip::extrainfo::noise_
static const char noise_[]
Definition: ConstantsForDqm.h:47
mps_fire.i
i
Definition: mps_fire.py:355
mySiStripNoises::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: mySiStripNoises.h:32
input
static const std::string input
Definition: EdmProvDump.cc:48
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
mySiStripNoises::encode
void encode(InputVector &Vi, std::vector< unsigned char > &Vo_CHAR)
Definition: mySiStripNoises.cc:46
findQualityFiles.v
v
Definition: findQualityFiles.py:179
end
#define end
Definition: vmac.h:39
mySiStripNoises::StrictWeakOrdering
Definition: mySiStripNoises.h:26
DetId
Definition: DetId.h:17
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
mySiStripNoises::indexes
std::vector< DetRegistry > indexes
Definition: mySiStripNoises.h:48
value
Definition: value.py:1
relativeConstraints.value
value
Definition: relativeConstraints.py:53
mySiStripNoises::RegistryIterator
Registry::const_iterator RegistryIterator
Definition: mySiStripNoises.h:34
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
sd
double sd
Definition: CascadeWrapper.h:113
mySiStripNoises::v_noises
std::vector< unsigned char > v_noises
Definition: mySiStripNoises.h:47
begin
#define begin
Definition: vmac.h:32
mySiStripNoises::decode
uint16_t decode(const uint16_t &strip, const Range &range) const
Definition: mySiStripNoises.cc:68