CMS 3D CMS Logo

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

#include <RPCReadOutMapping.h>

Inheritance diagram for RPCReadOutMapping:
RPCReadOutMappingWithFastSearch

Public Types

typedef std::pair< uint32_t, int > StripInDetUnit
 first member is DetUnit ID, second strip in DetUnit frame More...
 

Public Member Functions

void add (const DccSpec &dcc)
 attach FED to map More...
 
const DccSpecdcc (int dccId) const
 FED identified by ID. More...
 
std::vector< const DccSpec * > dccList () const
 all FEDs in map More...
 
std::pair< int, int > dccNumberRange () const
 Range of FED IDs in map (min and max id) More...
 
virtual StripInDetUnit detUnitFrame (const LinkBoardSpec &location, const LinkBoardPackedStrip &packedStrip) const
 convert strip location as in raw data (LB and LBchannel) to detUnit frame More...
 
std::vector< const LinkBoardSpec * > getLBforChamber (const std::string &name) const
 
std::pair< LinkBoardElectronicIndex, int > getRAWSpecForCMSChamberSrip (uint32_t detId, int strip, int dccInputChannel) const
 
virtual const LinkBoardSpeclocation (const LinkBoardElectronicIndex &ele) const
 conversion between electronic and detector indexing More...
 
std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip > > rawDataFrame (const StripInDetUnit &duFrame) const
 connection "paths" that lead from one digi to one strip More...
 
 RPCReadOutMapping (const std::string &version="")
 
const std::string & version () const
 version as string More...
 
virtual ~RPCReadOutMapping ()
 

Private Types

typedef std::map< int, DccSpec >::const_iterator IMAP
 

Private Member Functions

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

Private Attributes

std::map< int, DccSpectheFeds
 
std::string theVersion
 

Friends

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

Detailed Description

Description: Class to map read-out channels to physical RPC strips

Definition at line 22 of file RPCReadOutMapping.h.

Member Typedef Documentation

◆ IMAP

typedef std::map<int, DccSpec>::const_iterator RPCReadOutMapping::IMAP
private

Definition at line 62 of file RPCReadOutMapping.h.

◆ StripInDetUnit

typedef std::pair<uint32_t, int> RPCReadOutMapping::StripInDetUnit

first member is DetUnit ID, second strip in DetUnit frame

Definition at line 25 of file RPCReadOutMapping.h.

Constructor & Destructor Documentation

◆ RPCReadOutMapping()

RPCReadOutMapping::RPCReadOutMapping ( const std::string &  version = "")

Definition at line 16 of file RPCReadOutMapping.cc.

16 : theVersion(version) {}
const std::string & version() const
version as string
std::string theVersion

◆ ~RPCReadOutMapping()

virtual RPCReadOutMapping::~RPCReadOutMapping ( )
inlinevirtual

Definition at line 28 of file RPCReadOutMapping.h.

28 {}

Member Function Documentation

◆ add()

void RPCReadOutMapping::add ( const DccSpec dcc)

attach FED to map

Definition at line 24 of file RPCReadOutMapping.cc.

References dcc(), DccSpec::id(), and theFeds.

Referenced by RPCEMap::convert(), counter.Counter::register(), SequenceTypes._TaskBase::remove(), and SequenceTypes._TaskBase::replace().

24 { theFeds[dcc.id()] = dcc; }
std::map< int, DccSpec > theFeds
const DccSpec * dcc(int dccId) const
FED identified by ID.
int id() const
id of FED
Definition: DccSpec.h:22

◆ dcc()

const DccSpec * RPCReadOutMapping::dcc ( int  dccId) const

FED identified by ID.

Definition at line 18 of file RPCReadOutMapping.cc.

References ecaldqm::dccId(), and theFeds.

Referenced by add(), and location().

18  {
19  IMAP im = theFeds.find(dccId);
20  const DccSpec &ddc = (*im).second;
21  return (im != theFeds.end()) ? &ddc : nullptr;
22 }
std::map< int, DccSpec > theFeds
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP

◆ dccList()

std::vector< const DccSpec * > RPCReadOutMapping::dccList ( ) const

all FEDs in map

Definition at line 26 of file RPCReadOutMapping.cc.

References mps_fire::result, and theFeds.

Referenced by popcon::RPCEMapSourceHandler::Compare2EMaps(), RPCReadOutMappingWithFastSearch::init(), RPCLinkSynchroStat::init(), and omtf::translateOmtf2Pact().

26  {
27  std::vector<const DccSpec *> result;
28  result.reserve(theFeds.size());
29  for (IMAP im = theFeds.begin(); im != theFeds.end(); im++) {
30  result.push_back(&(im->second));
31  }
32  return result;
33 }
std::map< int, DccSpec > theFeds
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP

◆ dccNumberRange()

std::pair< int, int > RPCReadOutMapping::dccNumberRange ( ) const

Range of FED IDs in map (min and max id)

Definition at line 35 of file RPCReadOutMapping.cc.

References dqmdumpme::first, dqmdumpme::last, and theFeds.

Referenced by popcon::RPCEMapSourceHandler::Compare2EMaps().

35  {
36  if (theFeds.empty())
37  return std::make_pair(0, -1);
38  else {
39  IMAP first = theFeds.begin();
40  IMAP last = theFeds.end();
41  last--;
42  return std::make_pair(first->first, last->first);
43  }
44 }
std::map< int, DccSpec > theFeds
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP

◆ detUnitFrame()

RPCReadOutMapping::StripInDetUnit RPCReadOutMapping::detUnitFrame ( const LinkBoardSpec location,
const LinkBoardPackedStrip packedStrip 
) const
virtual

convert strip location as in raw data (LB and LBchannel) to detUnit frame

Reimplemented in RPCReadOutMappingWithFastSearch.

Definition at line 108 of file RPCReadOutMapping.cc.

References LinkBoardSpec::feb(), LinkBoardPackedStrip::febInLB(), location(), LogDebug, LinkBoardSpec::print(), FebConnectorSpec::rawId(), nano_mu_digi_cff::strip, FebConnectorSpec::strip(), and LinkBoardPackedStrip::stripPinInFeb().

Referenced by RPCReadOutMappingWithFastSearch::detUnitFrame(), and RPCRecordFormatter::recordUnpack().

109  {
110  uint32_t detUnit = 0;
111  int stripInDU = 0;
112  int febInLB = lbstrip.febInLB();
113  int stripPinInFeb = lbstrip.stripPinInFeb();
114 
115  const FebConnectorSpec *feb = location.feb(febInLB);
116  if (feb) {
117  detUnit = feb->rawId();
118  const ChamberStripSpec strip = feb->strip(stripPinInFeb);
119  if (strip.chamberStripNumber > -1) {
120  stripInDU = strip.chamberStripNumber;
121  } else {
122  // LogWarning("detUnitFrame")<<"problem with stip for febInLB: "<<febInLB
123  // <<" strip pin: "<< stripPinInFeb
124  // <<" strip pin: "<< stripPinInFeb;
125  LogDebug("") << "problem with stip for febInLB: " << febInLB << " strip pin: " << stripPinInFeb
126  << " strip pin: " << stripPinInFeb << " for linkBoard: " << location.print(3);
127  }
128  } else {
129  // LogWarning("detUnitFrame")<<"problem with detUnit for febInLB: ";
130  LogDebug("") << "problem with detUnit for febInLB: " << febInLB << " for linkBoard: " << location.print(1);
131  }
132  return std::make_pair(detUnit, stripInDU);
133 }
std::string print(int depth=0) const
debud printout
uint32_t rawId() const
DetUnit to which data belongs.
virtual const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const
conversion between electronic and detector indexing
const FebConnectorSpec * feb(int febInputNum) const
get Feb by its connection number to this board
Definition: LinkBoardSpec.cc:9
const ChamberStripSpec strip(int pinNumber) const
strip info for input pin
#define LogDebug(id)

◆ getLBforChamber()

std::vector< const LinkBoardSpec * > RPCReadOutMapping::getLBforChamber ( const std::string &  name) const

Definition at line 175 of file RPCReadOutMapping.cc.

References FebConnectorSpec::chamber(), ChamberLocationSpec::chamberLocationName(), LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, LinkBoardSpec::feb(), dqmiolumiharvest::j, dqmdumpme::k, LinkBoardElectronicIndex::lbNumInLink, location(), Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and LinkBoardElectronicIndex::tbLinkInputNum.

175  {
176  std::vector<const LinkBoardSpec *> vLBforChamber;
177 
178  LinkBoardElectronicIndex linkboard;
179  linkboard.dccId = 790;
180  linkboard.dccInputChannelNum = 1;
181  linkboard.tbLinkInputNum = 1;
182  linkboard.lbNumInLink = 0;
183  const LinkBoardSpec *location = this->location(linkboard);
184 
185  for (int k = 0; k < 18; k++) {
186  linkboard.dccInputChannelNum = 1;
187  linkboard.tbLinkInputNum = k;
188  for (int j = 0; j < 3; j++) {
189  linkboard.lbNumInLink = j;
190  int febInputNum = 1;
191  location = this->location(linkboard);
192  if (location) {
193  //location->print();
194  for (int j = 0; j < 6; j++) {
195  const FebConnectorSpec *feb = location->feb(febInputNum + j);
196  if (feb) {
197  //feb->print();
198  std::string chName = feb->chamber().chamberLocationName();
199  if (chName == name) {
200  vLBforChamber.push_back(location);
201  //feb->chamber().print();
202  break;
203  }
204  }
205  }
206  }
207  }
208  }
209  return vLBforChamber;
210 }
const ChamberLocationSpec & chamber() const
virtual const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const
conversion between electronic and detector indexing
const FebConnectorSpec * feb(int febInputNum) const
get Feb by its connection number to this board
Definition: LinkBoardSpec.cc:9
std::string chamberLocationName() const

◆ getRAWSpecForCMSChamberSrip()

std::pair< LinkBoardElectronicIndex, int > RPCReadOutMapping::getRAWSpecForCMSChamberSrip ( uint32_t  detId,
int  strip,
int  dccInputChannel 
) const

Definition at line 139 of file RPCReadOutMapping.cc.

References ChamberStripSpec::cmsStripNumber, gather_cfg::cout, LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, hcalRecHitTable_cff::detId, LinkBoardSpec::feb(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, MainPageGenerator::l, LinkBoardElectronicIndex::lbNumInLink, location(), FebConnectorSpec::rawId(), nano_mu_digi_cff::strip, FebConnectorSpec::strip(), and LinkBoardElectronicIndex::tbLinkInputNum.

141  {
142  LinkBoardElectronicIndex linkboard;
143  linkboard.dccId = 790;
144  linkboard.dccInputChannelNum = dccInputChannel;
145 
146  for (int k = 0; k < 18; k++) {
147  linkboard.tbLinkInputNum = k;
148  for (int j = 0; j < 3; j++) {
149  linkboard.lbNumInLink = j;
150  const LinkBoardSpec *location = this->location(linkboard);
151  if (location) {
152  for (int i = 1; i < 7; i++) {
153  const FebConnectorSpec *feb = location->feb(i);
154  if (feb && feb->rawId() == detId) {
155  for (int l = 1; l < 17; l++) {
156  int pin = l;
157  const ChamberStripSpec aStrip = feb->strip(pin);
158  if (aStrip.cmsStripNumber == strip) {
159  int bitInLink = (i - 1) * 16 + l - 1;
160  std::pair<LinkBoardElectronicIndex, int> stripInfo(linkboard, bitInLink);
161  return stripInfo;
162  }
163  }
164  }
165  }
166  }
167  }
168  }
169  RPCDetId aDet(detId);
170  std::cout << "Strip: " << strip << " not found for detector: " << aDet << std::endl;
171  std::pair<LinkBoardElectronicIndex, int> dummyStripInfo(linkboard, -99);
172  return dummyStripInfo;
173 }
uint32_t rawId() const
DetUnit to which data belongs.
virtual const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const
conversion between electronic and detector indexing
const FebConnectorSpec * feb(int febInputNum) const
get Feb by its connection number to this board
Definition: LinkBoardSpec.cc:9
const ChamberStripSpec strip(int pinNumber) const
strip info for input pin

◆ location()

const LinkBoardSpec * RPCReadOutMapping::location ( const LinkBoardElectronicIndex ele) const
virtual

conversion between electronic and detector indexing

Reimplemented in RPCReadOutMappingWithFastSearch.

Definition at line 92 of file RPCReadOutMapping.cc.

References dcc(), LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, LinkBoardElectronicIndex::lbNumInLink, LinkConnSpec::linkBoard(), TriggerBoardSpec::linkConn(), LinkBoardElectronicIndex::tbLinkInputNum, and DccSpec::triggerBoard().

Referenced by detUnitFrame(), getLBforChamber(), getRAWSpecForCMSChamberSrip(), and RPCRecordFormatter::recordUnpack().

92  {
93  //FIXME after debugging change to dcc(ele.dccId)->triggerBoard(ele.dccInputChannelNum)->...
95  if (dcc) {
97  if (tb) {
98  const LinkConnSpec *lc = tb->linkConn(ele.tbLinkInputNum);
99  if (lc) {
100  const LinkBoardSpec *lb = lc->linkBoard(ele.lbNumInLink);
101  return lb;
102  }
103  }
104  }
105  return nullptr;
106 }
const LinkBoardSpec * linkBoard(int linkBoardNumInLink) const
LB served by this link, identified by its position in link.
Definition: LinkConnSpec.cc:18
const LinkConnSpec * linkConn(int tbInputNumber) const
link attached to this TB with given input number
const TriggerBoardSpec * triggerBoard(int channelNumber) const
TB attached to channel.
Definition: DccSpec.cc:19
const DccSpec * dcc(int dccId) const
FED identified by ID.

◆ rawDataFrame()

std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip > > RPCReadOutMapping::rawDataFrame ( const StripInDetUnit duFrame) const

connection "paths" that lead from one digi to one strip

Definition at line 46 of file RPCReadOutMapping.cc.

References l1ctLayer1_cff::boards, FebConnectorSpec::cablePinNum(), FebConnectorSpec::chamberStripNum(), LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, TriggerBoardSpec::dccInputChannelNum(), TriggerBoardSpec::enabledLinkConns(), LinkBoardSpec::febs(), cuy::ib, DccSpec::id(), LinkBoardElectronicIndex::lbNumInLink, FebConnectorSpec::linkBoardInputNum(), LinkBoardSpec::linkBoardNumInLink(), LinkConnSpec::linkBoards(), FebConnectorSpec::nstrips(), FebConnectorSpec::rawId(), mps_fire::result, LinkBoardElectronicIndex::tbLinkInputNum, theFeds, LinkConnSpec::triggerBoardInputNumber(), and DccSpec::triggerBoards().

Referenced by RPCRecordFormatter::recordPack().

47  {
48  std::vector<std::pair<LinkBoardElectronicIndex, LinkBoardPackedStrip> > result;
49  LinkBoardElectronicIndex eleIndex = {0, 0, 0, 0};
50 
51  const uint32_t &rawDetId = stripInDetUnit.first;
52  const int &stripInDU = stripInDetUnit.second;
53 
54  for (IMAP im = theFeds.begin(); im != theFeds.end(); im++) {
55  const DccSpec &dccSpec = (*im).second;
56  const std::vector<TriggerBoardSpec> &triggerBoards = dccSpec.triggerBoards();
57  for (std::vector<TriggerBoardSpec>::const_iterator it = triggerBoards.begin(); it != triggerBoards.end(); it++) {
58  const TriggerBoardSpec &triggerBoard = (*it);
59  typedef std::vector<const LinkConnSpec *> LINKS;
60  LINKS linkConns = triggerBoard.enabledLinkConns();
61  for (LINKS::const_iterator ic = linkConns.begin(); ic != linkConns.end(); ic++) {
62  const LinkConnSpec &link = **ic;
63  const std::vector<LinkBoardSpec> &boards = link.linkBoards();
64  for (std::vector<LinkBoardSpec>::const_iterator ib = boards.begin(); ib != boards.end(); ib++) {
65  const LinkBoardSpec &board = (*ib);
66 
67  eleIndex.dccId = dccSpec.id();
68  eleIndex.dccInputChannelNum = triggerBoard.dccInputChannelNum();
69  eleIndex.tbLinkInputNum = link.triggerBoardInputNumber();
70  eleIndex.lbNumInLink = board.linkBoardNumInLink();
71 
72  const std::vector<FebConnectorSpec> &febs = board.febs();
73  for (std::vector<FebConnectorSpec>::const_iterator ifc = febs.begin(); ifc != febs.end(); ifc++) {
74  const FebConnectorSpec &febConnector = (*ifc);
75  if (febConnector.rawId() != rawDetId)
76  continue;
77  int febInLB = febConnector.linkBoardInputNum();
78  for (int istrip = 0; istrip < febConnector.nstrips(); istrip++) {
79  int stripPinInFeb = febConnector.cablePinNum(istrip);
80  if (febConnector.chamberStripNum(istrip) == stripInDU) {
81  result.push_back(std::make_pair(eleIndex, LinkBoardPackedStrip(febInLB, stripPinInFeb)));
82  }
83  }
84  }
85  }
86  }
87  }
88  }
89  return result;
90 }
const std::vector< LinkBoardSpec > & linkBoards() const
Definition: LinkConnSpec.h:25
int dccInputChannelNum() const
input channel number to DCC
uint32_t rawId() const
DetUnit to which data belongs.
const int nstrips() const
int linkBoardInputNum() const
this FEB channel in LinkBoard
const std::vector< FebConnectorSpec > & febs() const
Definition: LinkBoardSpec.h:36
int triggerBoardInputNumber() const
this link input number in TriggerBoard
Definition: LinkConnSpec.h:20
std::map< int, DccSpec > theFeds
int linkBoardNumInLink() const
this LB number in link
Definition: LinkBoardSpec.h:26
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
const int chamberStripNum(int istrip) const
std::vector< const LinkConnSpec * > enabledLinkConns() const
not masked links belonging to this TB
const int cablePinNum(int istrip) const
const std::vector< TriggerBoardSpec > & triggerBoards() const
Definition: DccSpec.h:26
int id() const
id of FED
Definition: DccSpec.h:22
ib
Definition: cuy.py:661

◆ serialize()

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

◆ version()

const std::string& RPCReadOutMapping::version ( ) const
inline

version as string

Definition at line 43 of file RPCReadOutMapping.h.

References theVersion.

Referenced by RPCUnpackingModule::beginRun(), validation.Sample::datasetpattern(), and validation.Sample::filename().

43 { return theVersion; }
std::string theVersion

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 66 of file RPCReadOutMapping.h.

◆ cond::serialization::access

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

Definition at line 66 of file RPCReadOutMapping.h.

Member Data Documentation

◆ theFeds

std::map<int, DccSpec> RPCReadOutMapping::theFeds
private

Definition at line 63 of file RPCReadOutMapping.h.

Referenced by add(), dcc(), dccList(), dccNumberRange(), and rawDataFrame().

◆ theVersion

std::string RPCReadOutMapping::theVersion
private

Definition at line 64 of file RPCReadOutMapping.h.

Referenced by version().