CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PulseArray Class Reference

#include <PulseArray.h>

Public Member Functions

unsigned bitsInPulse () const
 
void clear ()
 
void extend (const unsigned layer, const unsigned channel, const unsigned bx, const unsigned hit_persist)
 
void initialize (unsigned numberOfChannels)
 
bool isOneShotHighAtBX (const unsigned layer, const unsigned channel, const unsigned bx) const
 
unsigned numberOfLayersAtBX (const unsigned bx) const
 
bool oneShotAtBX (const unsigned layer, const unsigned channel, const unsigned bx) const
 
unsigned & operator() (const unsigned layer, const unsigned channel)
 
 PulseArray ()
 

Private Attributes

std::vector< std::vector< unsigned > > data_
 
unsigned numberOfChannels_
 

Detailed Description

Definition at line 11 of file PulseArray.h.

Constructor & Destructor Documentation

◆ PulseArray()

PulseArray::PulseArray ( )

Definition at line 3 of file PulseArray.cc.

3 {}

Member Function Documentation

◆ bitsInPulse()

unsigned PulseArray::bitsInPulse ( ) const

Definition at line 25 of file PulseArray.cc.

References data_.

Referenced by CSCCathodeLCTProcessor::pulseExtension(), and CSCAnodeLCTProcessor::pulseExtension().

25 { return 8 * sizeof(data_[0][0]); }
std::vector< std::vector< unsigned > > data_
Definition: PulseArray.h:41

◆ clear()

void PulseArray::clear ( void  )

Definition at line 14 of file PulseArray.cc.

References data_, AlCaHLTBitMon_ParallelJobs::p, and submitPVResolutionJobs::q.

Referenced by CSCCathodeLCTProcessor::pulseExtension(), and CSCAnodeLCTProcessor::pulseExtension().

14  {
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 }
std::vector< std::vector< unsigned > > data_
Definition: PulseArray.h:41

◆ extend()

void PulseArray::extend ( const unsigned  layer,
const unsigned  channel,
const unsigned  bx,
const unsigned  hit_persist 
)

Definition at line 27 of file PulseArray.cc.

References nano_mu_digi_cff::bx, data_, and nano_mu_digi_cff::layer.

Referenced by MatrixUtil.WF::__init__(), CSCCathodeLCTProcessor::pulseExtension(), and CSCAnodeLCTProcessor::pulseExtension().

27  {
28  for (unsigned int ibx = bx; ibx < bx + hit_persist; ++ibx) {
29  data_[layer][channel] = data_[layer][channel] | (1 << ibx);
30  }
31 }
std::vector< std::vector< unsigned > > data_
Definition: PulseArray.h:41

◆ initialize()

void PulseArray::initialize ( unsigned  numberOfChannels)

Definition at line 5 of file PulseArray.cc.

References data_, nano_mu_digi_cff::layer, CSCConstants::NUM_LAYERS, and numberOfChannels_.

Referenced by CSCCathodeLCTProcessor::run(), and CSCAnodeLCTProcessor::run().

5  {
6  numberOfChannels_ = numberOfChannels;
7  data_.clear();
9  for (unsigned layer = 0; layer < CSCConstants::NUM_LAYERS; layer++) {
10  data_[layer].resize(numberOfChannels);
11  }
12 }
std::vector< std::vector< unsigned > > data_
Definition: PulseArray.h:41
unsigned numberOfChannels_
Definition: PulseArray.h:42

◆ isOneShotHighAtBX()

bool PulseArray::isOneShotHighAtBX ( const unsigned  layer,
const unsigned  channel,
const unsigned  bx 
) const

◆ numberOfLayersAtBX()

unsigned PulseArray::numberOfLayersAtBX ( const unsigned  bx) const

Definition at line 41 of file PulseArray.cc.

References nano_mu_digi_cff::bx, isOneShotHighAtBX(), nano_mu_digi_cff::layer, CSCConstants::NUM_LAYERS, and numberOfChannels_.

Referenced by CSCCathodeLCTProcessor::patternFinding().

41  {
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 }
bool isOneShotHighAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:37
unsigned numberOfChannels_
Definition: PulseArray.h:42

◆ oneShotAtBX()

bool PulseArray::oneShotAtBX ( const unsigned  layer,
const unsigned  channel,
const unsigned  bx 
) const

Definition at line 33 of file PulseArray.cc.

References nano_mu_digi_cff::bx, data_, and nano_mu_digi_cff::layer.

Referenced by isOneShotHighAtBX(), CSCAnodeLCTProcessor::pulseExtension(), and CSCAnodeLCTProcessor::showPatterns().

33  {
34  return (data_[layer][channel] >> bx) & 1;
35 }
std::vector< std::vector< unsigned > > data_
Definition: PulseArray.h:41

◆ operator()()

unsigned & PulseArray::operator() ( const unsigned  layer,
const unsigned  channel 
)

Definition at line 23 of file PulseArray.cc.

References data_, and nano_mu_digi_cff::layer.

23 { return data_[layer][channel]; }
std::vector< std::vector< unsigned > > data_
Definition: PulseArray.h:41

Member Data Documentation

◆ data_

std::vector<std::vector<unsigned> > PulseArray::data_
private

Definition at line 41 of file PulseArray.h.

Referenced by bitsInPulse(), clear(), extend(), initialize(), oneShotAtBX(), and operator()().

◆ numberOfChannels_

unsigned PulseArray::numberOfChannels_
private

Definition at line 42 of file PulseArray.h.

Referenced by initialize(), and numberOfLayersAtBX().