CMS 3D CMS Logo

PulseArray.cc
Go to the documentation of this file.
2 
4 
5 void PulseArray::initialize(unsigned numberOfChannels) {
6  numberOfChannels_ = numberOfChannels;
7  data_.clear();
9  for (unsigned layer = 0; layer < CSCConstants::NUM_LAYERS; layer++) {
10  data_[layer].resize(numberOfChannels);
11  }
12 }
13 
15  // set all elements in the 2D vector to 0
16  for (auto& p : data_) {
17  for (auto& q : p) {
18  q = 0;
19  }
20  }
21 }
22 
23 unsigned& PulseArray::operator()(const unsigned layer, const unsigned channel) { return data_[layer][channel]; }
24 
25 unsigned PulseArray::bitsInPulse() const { return 8 * sizeof(data_[0][0]); }
26 
27 void PulseArray::extend(const unsigned layer, const unsigned channel, const unsigned bx, const unsigned hit_persist) {
28  for (unsigned int ibx = bx; ibx < bx + hit_persist; ++ibx) {
29  data_[layer][channel] = data_[layer][channel] | (1 << ibx);
30  }
31 }
32 
33 bool PulseArray::oneShotAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const {
34  return (data_[layer][channel] >> bx) & 1;
35 }
36 
37 bool PulseArray::isOneShotHighAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const {
38  return oneShotAtBX(layer, channel, bx) == 1;
39 }
40 
41 unsigned PulseArray::numberOfLayersAtBX(const unsigned bx) const {
42  unsigned layers_hit = 0;
43  for (unsigned layer = 0; layer < CSCConstants::NUM_LAYERS; layer++) {
44  for (unsigned channel = 0; channel < numberOfChannels_; channel++) {
45  if (isOneShotHighAtBX(layer, channel, bx)) {
46  layers_hit++;
47  break;
48  }
49  }
50  }
51  return layers_hit;
52 }
PulseArray::bitsInPulse
unsigned bitsInPulse() const
Definition: PulseArray.cc:25
PulseArray::extend
void extend(const unsigned layer, const unsigned channel, const unsigned bx, const unsigned hit_persist)
Definition: PulseArray.cc:27
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
PulseArray::PulseArray
PulseArray()
Definition: PulseArray.cc:3
PulseArray::numberOfLayersAtBX
unsigned numberOfLayersAtBX(const unsigned bx) const
Definition: PulseArray.cc:41
CSCConstants::NUM_LAYERS
Definition: CSCConstants.h:103
PulseArray.h
PulseArray::numberOfChannels_
unsigned numberOfChannels_
Definition: PulseArray.h:42
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PulseArray::isOneShotHighAtBX
bool isOneShotHighAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:37
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
PulseArray::data_
std::vector< std::vector< unsigned > > data_
Definition: PulseArray.h:41
PulseArray::operator()
unsigned & operator()(const unsigned layer, const unsigned channel)
Definition: PulseArray.cc:23
PulseArray::oneShotAtBX
bool oneShotAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:33
PulseArray::clear
void clear()
Definition: PulseArray.cc:14
PulseArray::initialize
void initialize(unsigned numberOfChannels)
Definition: PulseArray.cc:5