CMS 3D CMS Logo

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

Class to store hardware like structured TTStub Collection used by Track Trigger emulators. More...

#include <TTDTC.h>

Public Types

typedef std::bitset< TTBV::SBV
 
typedef std::pair< TTStubRef, BVFrame
 
typedef std::vector< FrameStream
 
typedef std::vector< StreamStreams
 

Public Member Functions

int nGaps () const
 
int nStubs () const
 
void setStream (int dtcRegion, int dtcBoard, int dtcChannel, const Stream &stream)
 
int size () const
 
const Streamstream (int tfpRegion, int tfpChannel) const
 
const std::vector< int > & tfpChannels () const
 
const std::vector< int > & tfpRegions () const
 
 TTDTC ()
 
 TTDTC (int numRegions, int numOverlappingRegions, int numDTCsPerRegion)
 
 ~TTDTC ()
 

Private Member Functions

int index (int dtcRegion, int dtcBoard, int dtcChannel) const
 
int index (int tfpRegion, int tfpChannel) const
 

Private Attributes

std::vector< int > channels_
 
int numDTCsPerRegion_
 
int numDTCsPerTFP_
 
int numOverlappingRegions_
 
int numRegions_
 
std::vector< int > regions_
 
Streams streams_
 

Detailed Description

Class to store hardware like structured TTStub Collection used by Track Trigger emulators.

Author
Thomas Schuh
Date
2020, Jan

Definition at line 17 of file TTDTC.h.

Member Typedef Documentation

◆ BV

typedef std::bitset<TTBV::S> TTDTC::BV

Definition at line 20 of file TTDTC.h.

◆ Frame

typedef std::pair<TTStubRef, BV> TTDTC::Frame

Definition at line 22 of file TTDTC.h.

◆ Stream

typedef std::vector<Frame> TTDTC::Stream

Definition at line 24 of file TTDTC.h.

◆ Streams

typedef std::vector<Stream> TTDTC::Streams

Definition at line 26 of file TTDTC.h.

Constructor & Destructor Documentation

◆ TTDTC() [1/2]

TTDTC::TTDTC ( )
inline

Definition at line 28 of file TTDTC.h.

28 {}

◆ TTDTC() [2/2]

TTDTC::TTDTC ( int  numRegions,
int  numOverlappingRegions,
int  numDTCsPerRegion 
)

Definition at line 9 of file TTDTC.cc.

10  : numRegions_(numRegions),
11  numOverlappingRegions_(numOverlappingRegions),
12  numDTCsPerRegion_(numDTCsPerRegion),
13  numDTCsPerTFP_(numOverlappingRegions * numDTCsPerRegion),
17  iota(regions_.begin(), regions_.end(), 0);
18  iota(channels_.begin(), channels_.end(), 0);
19 }

References channels_, and regions_.

◆ ~TTDTC()

TTDTC::~TTDTC ( )
inline

Definition at line 30 of file TTDTC.h.

30 {}

Member Function Documentation

◆ index() [1/2]

int TTDTC::index ( int  dtcRegion,
int  dtcBoard,
int  dtcChannel 
) const
private

Definition at line 90 of file TTDTC.cc.

90  {
91  return (dtcRegion * numDTCsPerRegion_ + dtcBoard) * numOverlappingRegions_ + dtcChannel;
92 }

References numDTCsPerRegion_, and numOverlappingRegions_.

Referenced by index(), BeautifulSoup.PageElement::insert(), setStream(), and stream().

◆ index() [2/2]

int TTDTC::index ( int  tfpRegion,
int  tfpChannel 
) const
private

Definition at line 95 of file TTDTC.cc.

95  {
96  const int dtcChannel = numOverlappingRegions_ - (tfpChannel / numDTCsPerRegion_) - 1;
97  const int dtcBoard = tfpChannel % numDTCsPerRegion_;
98  const int dtcRegion = tfpRegion - dtcChannel >= 0 ? tfpRegion - dtcChannel : tfpRegion - dtcChannel + numRegions_;
99  return index(dtcRegion, dtcBoard, dtcChannel);
100 }

References index(), numDTCsPerRegion_, numOverlappingRegions_, and numRegions_.

Referenced by BeautifulSoup.PageElement::insert().

◆ nGaps()

int TTDTC::nGaps ( ) const

Definition at line 81 of file TTDTC.cc.

81  {
82  auto gaps = [](int& sum, const Frame& frame) { return sum += frame.first.isNull(); };
83  int n(0);
84  for (const Stream& stream : streams_)
85  n += accumulate(stream.begin(), stream.end(), 0, gaps);
86  return n;
87 }

References amptDefault_cfi::frame, dqmiodumpmetadata::n, stream(), and streams_.

◆ nStubs()

int TTDTC::nStubs ( ) const

Definition at line 72 of file TTDTC.cc.

72  {
73  auto stubs = [](int& sum, const Frame& frame) { return sum += frame.first.isNonnull(); };
74  int n(0);
75  for (const Stream& stream : streams_)
76  n += accumulate(stream.begin(), stream.end(), 0, stubs);
77  return n;
78 }

References amptDefault_cfi::frame, dqmiodumpmetadata::n, stream(), and streams_.

◆ setStream()

void TTDTC::setStream ( int  dtcRegion,
int  dtcBoard,
int  dtcChannel,
const Stream stream 
)

Definition at line 23 of file TTDTC.cc.

23  {
24  // check arguments
25  const bool oorRegion = dtcRegion >= numRegions_ || dtcRegion < 0;
26  const bool oorBoard = dtcBoard >= numDTCsPerRegion_ || dtcBoard < 0;
27  const bool oorChannel = dtcChannel >= numOverlappingRegions_ || dtcChannel < 0;
28  if (oorRegion || oorBoard || oorChannel) {
29  cms::Exception exception("out_of_range");
30  exception.addContext("TTDTC::setStream");
31  if (oorRegion)
32  exception << "Requested Detector Region "
33  << "(" << dtcRegion << ") is out of range 0 to " << numRegions_ - 1 << ".";
34  if (oorBoard)
35  exception << "Requested DTC Board "
36  << "(" << dtcBoard << ") is out of range 0 to " << numDTCsPerRegion_ - 1 << ".";
37  if (oorChannel)
38  exception << "Requested DTC Channel "
39  << "(" << dtcChannel << ") is out of range 0 to " << numOverlappingRegions_ - 1 << ".";
40  throw exception;
41  }
42  streams_[index(dtcRegion, dtcBoard, dtcChannel)] = move(stream);
43 }

References cppFunctionSkipper::exception, index(), eostools::move(), numDTCsPerRegion_, numOverlappingRegions_, numRegions_, stream(), and streams_.

Referenced by trackerDTC::DTC::produce().

◆ size()

int TTDTC::size ( void  ) const

Definition at line 66 of file TTDTC.cc.

66  {
67  auto all = [](int& sum, const Stream& stream) { return sum += stream.size(); };
68  return accumulate(streams_.begin(), streams_.end(), 0, all);
69 }

References python.cmstools::all(), stream(), and streams_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

◆ stream()

const TTDTC::Stream & TTDTC::stream ( int  tfpRegion,
int  tfpChannel 
) const

Definition at line 47 of file TTDTC.cc.

47  {
48  // check arguments
49  const bool oorRegion = tfpRegion >= numRegions_ || tfpRegion < 0;
50  const bool oorChannel = tfpChannel >= numDTCsPerTFP_ || tfpChannel < 0;
51  if (oorRegion || oorChannel) {
52  cms::Exception exception("out_of_range");
53  exception.addContext("TTDTC::stream");
54  if (oorRegion)
55  exception << "Requested Processing Region "
56  << "(" << tfpRegion << ") is out of range 0 to " << numRegions_ - 1 << ".";
57  if (oorChannel)
58  exception << "Requested TFP Channel "
59  << "(" << tfpChannel << ") is out of range 0 to " << numDTCsPerTFP_ - 1 << ".";
60  throw exception;
61  }
62  return streams_.at(index(tfpRegion, tfpChannel));
63 }

References cppFunctionSkipper::exception, index(), numDTCsPerTFP_, numRegions_, and streams_.

Referenced by nGaps(), nStubs(), setStream(), and size().

◆ tfpChannels()

const std::vector<int>& TTDTC::tfpChannels ( ) const
inline

Definition at line 35 of file TTDTC.h.

35 { return channels_; }

References channels_.

◆ tfpRegions()

const std::vector<int>& TTDTC::tfpRegions ( ) const
inline

Definition at line 33 of file TTDTC.h.

33 { return regions_; }

References regions_.

Member Data Documentation

◆ channels_

std::vector<int> TTDTC::channels_
private

Definition at line 65 of file TTDTC.h.

Referenced by tfpChannels(), and TTDTC().

◆ numDTCsPerRegion_

int TTDTC::numDTCsPerRegion_
private

Definition at line 59 of file TTDTC.h.

Referenced by index(), and setStream().

◆ numDTCsPerTFP_

int TTDTC::numDTCsPerTFP_
private

Definition at line 61 of file TTDTC.h.

Referenced by stream().

◆ numOverlappingRegions_

int TTDTC::numOverlappingRegions_
private

Definition at line 57 of file TTDTC.h.

Referenced by index(), and setStream().

◆ numRegions_

int TTDTC::numRegions_
private

Definition at line 55 of file TTDTC.h.

Referenced by index(), setStream(), and stream().

◆ regions_

std::vector<int> TTDTC::regions_
private

Definition at line 63 of file TTDTC.h.

Referenced by tfpRegions(), and TTDTC().

◆ streams_

Streams TTDTC::streams_
private

Definition at line 67 of file TTDTC.h.

Referenced by nGaps(), nStubs(), setStream(), size(), and stream().

dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TTDTC::numOverlappingRegions_
int numOverlappingRegions_
Definition: TTDTC.h:57
TTDTC::streams_
Streams streams_
Definition: TTDTC.h:67
TTDTC::regions_
std::vector< int > regions_
Definition: TTDTC.h:63
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:26
TTDTC::numDTCsPerRegion_
int numDTCsPerRegion_
Definition: TTDTC.h:59
TTDTC::numRegions_
int numRegions_
Definition: TTDTC.h:55
TTDTC::channels_
std::vector< int > channels_
Definition: TTDTC.h:65
TTDTC::Stream
std::vector< Frame > Stream
Definition: TTDTC.h:24
TTDTC::stream
const Stream & stream(int tfpRegion, int tfpChannel) const
Definition: TTDTC.cc:47
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
eostools.move
def move(src, dest)
Definition: eostools.py:511
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
TTDTC::Frame
std::pair< TTStubRef, BV > Frame
Definition: TTDTC.h:22
cms::Exception
Definition: Exception.h:70
TTDTC::index
int index(int dtcRegion, int dtcBoard, int dtcChannel) const
Definition: TTDTC.cc:90
TTDTC::numDTCsPerTFP_
int numDTCsPerTFP_
Definition: TTDTC.h:61