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 23 of file RPCReadOutMapping.h.

Member Typedef Documentation

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

Definition at line 69 of file RPCReadOutMapping.h.

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

first member is DetUnit ID, second strip in DetUnit frame

Definition at line 27 of file RPCReadOutMapping.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file RPCReadOutMapping.cc.

19  : theVersion(version) { }
const std::string & version() const
version as string
std::string theVersion
virtual RPCReadOutMapping::~RPCReadOutMapping ( )
inlinevirtual

Definition at line 30 of file RPCReadOutMapping.h.

References add(), dcc(), ecaldqm::dccId(), dccList(), and dccNumberRange().

30 {}

Member Function Documentation

void RPCReadOutMapping::add ( const DccSpec dcc)

attach FED to map

Definition at line 28 of file RPCReadOutMapping.cc.

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

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

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

FED identified by ID.

Definition at line 21 of file RPCReadOutMapping.cc.

References theFeds.

Referenced by add(), location(), and ~RPCReadOutMapping().

22 {
23  IMAP im = theFeds.find(dccId);
24  const DccSpec & ddc = (*im).second;
25  return (im != theFeds.end()) ? &ddc : nullptr;
26 }
std::map< int, DccSpec > theFeds
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
unsigned dccId(DetId const &)
std::vector< const DccSpec * > RPCReadOutMapping::dccList ( ) const

all FEDs in map

Definition at line 34 of file RPCReadOutMapping.cc.

References mps_fire::result, and theFeds.

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

35 {
36  std::vector<const DccSpec*> result;
37  result.reserve(theFeds.size());
38  for (IMAP im = theFeds.begin(); im != theFeds.end(); im++) {
39  result.push_back( &(im->second) );
40  }
41  return result;
42 }
std::map< int, DccSpec > theFeds
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
std::pair< int, int > RPCReadOutMapping::dccNumberRange ( ) const

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

Definition at line 44 of file RPCReadOutMapping.cc.

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

Referenced by popcon::RPCEMapSourceHandler::Compare2EMaps(), and ~RPCReadOutMapping().

45 {
46 
47  if (theFeds.empty()) return std::make_pair(0,-1);
48  else {
49  IMAP first = theFeds.begin();
50  IMAP last = theFeds.end(); last--;
51  return std::make_pair(first->first, last->first);
52  }
53 }
std::map< int, DccSpec > theFeds
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
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 132 of file RPCReadOutMapping.cc.

References ChamberStripSpec::chamberStripNumber, LinkBoardSpec::feb(), LinkBoardPackedStrip::febInLB(), LogDebug, LinkBoardSpec::print(), FebConnectorSpec::rawId(), digitizers_cfi::strip, FebConnectorSpec::strip(), and LinkBoardPackedStrip::stripPinInFeb().

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

134 {
135  uint32_t detUnit = 0;
136  int stripInDU = 0;
137  int febInLB = lbstrip.febInLB();
138  int stripPinInFeb = lbstrip.stripPinInFeb();
139 
140  const FebConnectorSpec * feb = location.feb(febInLB);
141  if (feb) {
142  detUnit = feb->rawId();
143  const ChamberStripSpec strip = feb->strip(stripPinInFeb);
144  if (strip.chamberStripNumber > -1) {
145  stripInDU = strip.chamberStripNumber;
146  } else {
147  // LogWarning("detUnitFrame")<<"problem with stip for febInLB: "<<febInLB
148  // <<" strip pin: "<< stripPinInFeb
149  // <<" strip pin: "<< stripPinInFeb;
150  LogDebug("")<<"problem with stip for febInLB: "<<febInLB
151  <<" strip pin: "<< stripPinInFeb
152  <<" strip pin: "<< stripPinInFeb
153  <<" for linkBoard: "<<location.print(3);
154  }
155  } else {
156  // LogWarning("detUnitFrame")<<"problem with detUnit for febInLB: ";
157  LogDebug("") <<"problem with detUnit for febInLB: " <<febInLB
158  <<" for linkBoard: "<<location.print(1);
159  }
160  return std::make_pair(detUnit,stripInDU);
161 }
#define LogDebug(id)
const uint32_t & rawId() const
DetUnit to which data belongs.
std::string print(int depth=0) const
debud printout
const ChamberStripSpec strip(int pinNumber) const
strip info for input pin
const FebConnectorSpec * feb(int febInputNum) const
get Feb by its connection number to this board
std::vector< const LinkBoardSpec * > RPCReadOutMapping::getLBforChamber ( const std::string &  name) const

Definition at line 205 of file RPCReadOutMapping.cc.

References FebConnectorSpec::chamber(), ChamberLocationSpec::chamberLocationName(), LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, LinkBoardSpec::feb(), gen::k, LinkBoardElectronicIndex::lbNumInLink, location(), AlCaHLTBitMon_QueryRunRegistry::string, and LinkBoardElectronicIndex::tbLinkInputNum.

Referenced by version().

205  {
206 
207 
208  std::vector<const LinkBoardSpec*> vLBforChamber;
209 
210  LinkBoardElectronicIndex linkboard;
211  linkboard.dccId = 790;
212  linkboard.dccInputChannelNum = 1;
213  linkboard.tbLinkInputNum = 1;
214  linkboard.lbNumInLink = 0;
215  const LinkBoardSpec *location = this->location(linkboard);
216 
217  for(int k=0;k<18;k++){
218  linkboard.dccInputChannelNum = 1;
219  linkboard.tbLinkInputNum = k;
220  for(int j=0;j<3;j++){
221  linkboard.lbNumInLink = j;
222  int febInputNum=1;
223  location = this->location(linkboard);
224  if (location) {
225  //location->print();
226  for(int j=0;j<6;j++){
227  const FebConnectorSpec * feb = location->feb(febInputNum+j);
228  if(feb){
229  //feb->print();
230  std::string chName = feb->chamber().chamberLocationName();
231  if(chName==name){
232  vLBforChamber.push_back(location);
233  //feb->chamber().print();
234  break;
235  }
236  }
237  }
238  }
239  }
240  }
241  return vLBforChamber;
242 }
const ChamberLocationSpec & chamber() const
const FebConnectorSpec * feb(int febInputNum) const
get Feb by its connection number to this board
std::string chamberLocationName() const
virtual const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const
conversion between electronic and detector indexing
int k[5][pyjets_maxn]
std::pair< LinkBoardElectronicIndex, int > RPCReadOutMapping::getRAWSpecForCMSChamberSrip ( uint32_t  detId,
int  strip,
int  dccInputChannel 
) const

Definition at line 169 of file RPCReadOutMapping.cc.

References ChamberStripSpec::cmsStripNumber, gather_cfg::cout, LinkBoardElectronicIndex::dccId, LinkBoardElectronicIndex::dccInputChannelNum, LinkBoardSpec::feb(), mps_fire::i, gen::k, checklumidiff::l, LinkBoardElectronicIndex::lbNumInLink, location(), FebConnectorSpec::rawId(), FebConnectorSpec::strip(), and LinkBoardElectronicIndex::tbLinkInputNum.

Referenced by version().

169  {
170 
171  LinkBoardElectronicIndex linkboard;
172  linkboard.dccId = 790;
173  linkboard.dccInputChannelNum = dccInputChannel;
174 
175  for(int k=0;k<18;k++){
176  linkboard.tbLinkInputNum = k;
177  for(int j=0;j<3;j++){
178  linkboard.lbNumInLink = j;
179  const LinkBoardSpec *location = this->location(linkboard);
180  if (location) {
181  for(int i=1;i<7;i++){
182  const FebConnectorSpec * feb = location->feb(i);
183  if(feb && feb->rawId()==detId){
184  for(int l=1;l<17;l++){
185  int pin = l;
186  const ChamberStripSpec aStrip = feb->strip(pin);
187  if(aStrip.cmsStripNumber==strip){
188  int bitInLink = (i-1)*16+l-1;
189  std::pair<LinkBoardElectronicIndex, int> stripInfo(linkboard,bitInLink);
190  return stripInfo;
191  }
192  }
193  }
194  }
195  }
196  }
197  }
198  RPCDetId aDet(detId);
199  std::cout<<"Strip: "<<strip<<" not found for detector: "<<aDet<<std::endl;
200  std::pair<LinkBoardElectronicIndex, int> dummyStripInfo(linkboard,-99);
201  return dummyStripInfo;
202 }
const uint32_t & rawId() const
DetUnit to which data belongs.
const ChamberStripSpec strip(int pinNumber) const
strip info for input pin
const FebConnectorSpec * feb(int febInputNum) const
get Feb by its connection number to this board
virtual const LinkBoardSpec * location(const LinkBoardElectronicIndex &ele) const
conversion between electronic and detector indexing
int k[5][pyjets_maxn]
const LinkBoardSpec * RPCReadOutMapping::location ( const LinkBoardElectronicIndex ele) const
virtual

conversion between electronic and detector indexing

Reimplemented in RPCReadOutMappingWithFastSearch.

Definition at line 114 of file RPCReadOutMapping.cc.

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

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

115 {
116  //FIXME after debugging change to dcc(ele.dccId)->triggerBoard(ele.dccInputChannelNum)->...
117  const DccSpec *dcc = RPCReadOutMapping::dcc(ele.dccId);
118  if (dcc) {
119  const TriggerBoardSpec *tb = dcc->triggerBoard(ele.dccInputChannelNum);
120  if (tb) {
121  const LinkConnSpec *lc = tb->linkConn( ele.tbLinkInputNum);
122  if (lc) {
123  const LinkBoardSpec *lb = lc->linkBoard(ele.lbNumInLink);
124  return lb;
125  }
126  }
127  }
128  return nullptr;
129 }
const LinkBoardSpec * linkBoard(int linkBoardNumInLink) const
LB served by this link, identified by its position in link.
Definition: LinkConnSpec.cc:21
const TriggerBoardSpec * triggerBoard(int channelNumber) const
TB attached to channel.
Definition: DccSpec.cc:21
const LinkConnSpec * linkConn(int tbInputNumber) const
link attached to this TB with given input number
const DccSpec * dcc(int dccId) const
FED identified by ID.
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 57 of file RPCReadOutMapping.cc.

References 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(), and version().

58 {
59  std::vector< std::pair< LinkBoardElectronicIndex, LinkBoardPackedStrip> > result;
60  LinkBoardElectronicIndex eleIndex = { 0,0,0,0 };
61 
62  const uint32_t & rawDetId = stripInDetUnit.first;
63  const int & stripInDU = stripInDetUnit.second;
64 
65  for (IMAP im=theFeds.begin(); im != theFeds.end(); im++) {
66  const DccSpec & dccSpec = (*im).second;
67  const std::vector<TriggerBoardSpec> & triggerBoards = dccSpec.triggerBoards();
68  for ( std::vector<TriggerBoardSpec>::const_iterator
69  it = triggerBoards.begin(); it != triggerBoards.end(); it++) {
70  const TriggerBoardSpec & triggerBoard = (*it);
71  typedef std::vector<const LinkConnSpec* > LINKS;
72  LINKS linkConns = triggerBoard.enabledLinkConns();
73  for ( LINKS::const_iterator ic = linkConns.begin(); ic != linkConns.end(); ic++) {
74 
75  const LinkConnSpec & link = **ic;
76  const std::vector<LinkBoardSpec> & boards = link.linkBoards();
77  for ( std::vector<LinkBoardSpec>::const_iterator
78  ib = boards.begin(); ib != boards.end(); ib++) {
79 
80  const LinkBoardSpec & board = (*ib);
81 
82  eleIndex.dccId = dccSpec.id();
83  eleIndex.dccInputChannelNum = triggerBoard.dccInputChannelNum();
84  eleIndex.tbLinkInputNum = link.triggerBoardInputNumber();
85  eleIndex.lbNumInLink = board.linkBoardNumInLink();
86 
87  const std::vector<FebConnectorSpec> & febs = board.febs();
88  int febCheck = 0;
89  for ( std::vector<FebConnectorSpec>::const_iterator
90  ifc = febs.begin(); ifc != febs.end(); ifc++) {
91  const FebConnectorSpec & febConnector = (*ifc);
92  febCheck++;
93  if (febConnector.rawId() != rawDetId) continue;
94  int febInLB = febConnector.linkBoardInputNum();
95  /* if (febInLB != febCheck) {
96  edm::LogError("rawDataFrame") << " problem with febInLB: " <<febInLB<<" "<<febCheck;
97  } */
98  for (int istrip=0; istrip<febConnector.nstrips(); istrip++) {
99  int stripPinInFeb = febConnector.cablePinNum(istrip);
100  if (febConnector.chamberStripNum(istrip) == stripInDU) {
101  result.push_back(
102  std::make_pair( eleIndex, LinkBoardPackedStrip( febInLB, stripPinInFeb) ) );
103  }
104  }
105  }
106  }
107  }
108  }
109  }
110  return result;
111 }
const std::vector< TriggerBoardSpec > & triggerBoards() const
Definition: DccSpec.h:27
const int cablePinNum(int istrip) const
const uint32_t & rawId() const
DetUnit to which data belongs.
int id() const
id of FED
Definition: DccSpec.h:23
std::vector< const LinkConnSpec * > enabledLinkConns() const
not masked links belonging to this TB
int triggerBoardInputNumber() const
this link input number in TriggerBoard
Definition: LinkConnSpec.h:21
const int nstrips() const
const int chamberStripNum(int istrip) const
std::map< int, DccSpec > theFeds
int linkBoardInputNum() const
this FEB channel in LinkBoard
std::unordered_map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
const std::vector< FebConnectorSpec > & febs() const
Definition: LinkBoardSpec.h:36
int dccInputChannelNum() const
input channel number to DCC
int linkBoardNumInLink() const
this LB number in link
Definition: LinkBoardSpec.h:26
const std::vector< LinkBoardSpec > & linkBoards() const
Definition: LinkConnSpec.h:26
ib
Definition: cuy.py:662
template<class Archive >
void RPCReadOutMapping::serialize ( Archive &  ar,
const unsigned int  version 
)
private
const std::string& RPCReadOutMapping::version ( ) const
inline

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 74 of file RPCReadOutMapping.h.

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

Definition at line 74 of file RPCReadOutMapping.h.

Member Data Documentation

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

Definition at line 70 of file RPCReadOutMapping.h.

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

std::string RPCReadOutMapping::theVersion
private

Definition at line 71 of file RPCReadOutMapping.h.

Referenced by version().