CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Types | Private Attributes
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 Attributes

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

Detailed Description

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

Definition at line 21 of file RPCReadOutMapping.h.

Member Typedef Documentation

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

Definition at line 67 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 25 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 28 of file RPCReadOutMapping.h.

28 {}

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().

29 {
30  theFeds[dcc.id()] = dcc;
31 }
int id() const
id of FED
Definition: DccSpec.h:21
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(), and location().

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

all FEDs in map

Definition at line 34 of file RPCReadOutMapping.cc.

References query::result, and theFeds.

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

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
tuple result
Definition: query.py:137
std::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 first, prof2calltree::last, and theFeds.

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

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
bool first
Definition: L1TdeRCT.cc:94
std::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, debug, edm::MessageDrop::debugEnabled, LinkBoardSpec::feb(), LinkBoardPackedStrip::febInLB(), edm::MessageDrop::instance(), LogDebug, LinkBoardSpec::print(), FebConnectorSpec::rawId(), strip(), FebConnectorSpec::strip(), and LinkBoardPackedStrip::stripPinInFeb().

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

134 {
136  uint32_t detUnit = 0;
137  int stripInDU = 0;
138  int febInLB = lbstrip.febInLB();
139  int stripPinInFeb = lbstrip.stripPinInFeb();
140 
141  const FebConnectorSpec * feb = location.feb(febInLB);
142  if (feb) {
143  detUnit = feb->rawId();
144  const ChamberStripSpec strip = feb->strip(stripPinInFeb);
145  if (strip.chamberStripNumber > -1) {
146  stripInDU = strip.chamberStripNumber;
147  } else {
148  // LogWarning("detUnitFrame")<<"problem with stip for febInLB: "<<febInLB
149  // <<" strip pin: "<< stripPinInFeb
150  // <<" strip pin: "<< stripPinInFeb;
151  if (debug) {
152  LogDebug("")<<"problem with stip for febInLB: "<<febInLB
153  <<" strip pin: "<< stripPinInFeb
154  <<" strip pin: "<< stripPinInFeb
155  <<" for linkBoard: "<<location.print(3);
156  }
157  }
158  } else {
159  // LogWarning("detUnitFrame")<<"problem with detUnit for febInLB: ";
160  if (debug) {
161  LogDebug("") <<"problem with detUnit for febInLB: " <<febInLB
162  <<" for linkBoard: "<<location.print(1);
163  }
164  }
165  return std::make_pair(detUnit,stripInDU);
166 }
#define LogDebug(id)
const uint32_t & rawId() const
DetUnit to which data belongs.
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
std::string print(int depth=0) const
debud printout
static MessageDrop * instance()
Definition: MessageDrop.cc:65
static bool debugEnabled
Definition: MessageDrop.h:105
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
#define debug
Definition: MEtoEDMFormat.h:34
std::vector< const LinkBoardSpec * > RPCReadOutMapping::getLBforChamber ( const std::string &  name) const

Definition at line 210 of file RPCReadOutMapping.cc.

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

210  {
211 
212 
213  std::vector<const LinkBoardSpec*> vLBforChamber;
214 
215  LinkBoardElectronicIndex linkboard;
216  linkboard.dccId = 790;
217  linkboard.dccInputChannelNum = 1;
218  linkboard.tbLinkInputNum = 1;
219  linkboard.lbNumInLink = 0;
220  const LinkBoardSpec *location = this->location(linkboard);
221 
222  for(int k=0;k<18;k++){
223  linkboard.dccInputChannelNum = 1;
224  linkboard.tbLinkInputNum = k;
225  for(int j=0;j<3;j++){
226  linkboard.lbNumInLink = j;
227  int febInputNum=1;
228  location = this->location(linkboard);
229  if (location) {
230  //location->print();
231  for(int j=0;j<6;j++){
232  const FebConnectorSpec * feb = location->feb(febInputNum+j);
233  if(feb){
234  //feb->print();
235  std::string chName = feb->chamber().chamberLocationName();
236  if(chName==name){
237  vLBforChamber.push_back(location);
238  //feb->chamber().print();
239  break;
240  }
241  }
242  }
243  }
244  }
245  }
246  return vLBforChamber;
247 }
const ChamberLocationSpec & chamber() const
int j
Definition: DBlmapReader.cc:9
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 174 of file RPCReadOutMapping.cc.

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

174  {
175 
176  LinkBoardElectronicIndex linkboard;
177  linkboard.dccId = 790;
178  linkboard.dccInputChannelNum = dccInputChannel;
179 
180  for(int k=0;k<18;k++){
181  linkboard.tbLinkInputNum = k;
182  for(int j=0;j<3;j++){
183  linkboard.lbNumInLink = j;
184  const LinkBoardSpec *location = this->location(linkboard);
185  if (location) {
186  for(int i=1;i<7;i++){
187  const FebConnectorSpec * feb = location->feb(i);
188  if(feb && feb->rawId()==detId){
189  for(int l=1;l<17;l++){
190  int pin = l;
191  const ChamberStripSpec aStrip = feb->strip(pin);
192  if(aStrip.cmsStripNumber==strip){
193  int bitInLink = (i-1)*16+l-1;
194  std::pair<LinkBoardElectronicIndex, int> stripInfo(linkboard,bitInLink);
195  return stripInfo;
196  }
197  }
198  }
199  }
200  }
201  }
202  }
203  RPCDetId aDet(detId);
204  std::cout<<"Strip: "<<strip<<" not found for detector: "<<aDet<<std::endl;
205  std::pair<LinkBoardElectronicIndex, int> dummyStripInfo(linkboard,-99);
206  return dummyStripInfo;
207 }
int i
Definition: DBlmapReader.cc:9
const uint32_t & rawId() const
DetUnit to which data belongs.
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
const ChamberStripSpec strip(int pinNumber) const
strip info for input pin
int j
Definition: DBlmapReader.cc:9
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]
tuple cout
Definition: gather_cfg.py:121
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(), and RPCRecordFormatter::recordUnpack().

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 0;
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(), DccSpec::id(), LinkBoardElectronicIndex::lbNumInLink, link(), FebConnectorSpec::linkBoardInputNum(), LinkBoardSpec::linkBoardNumInLink(), LinkConnSpec::linkBoards(), splitter::LINKS, FebConnectorSpec::nstrips(), FebConnectorSpec::rawId(), query::result, LinkBoardElectronicIndex::tbLinkInputNum, theFeds, LinkConnSpec::triggerBoardInputNumber(), and DccSpec::triggerBoards().

Referenced by RPCRecordFormatter::recordPack().

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:25
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:21
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:19
const int nstrips() const
const int chamberStripNum(int istrip) const
std::string link(std::string &nm, std::string &ns)
Definition: hierarchy.cc:47
list LINKS
Definition: splitter.py:14
std::map< int, DccSpec > theFeds
tuple result
Definition: query.py:137
int linkBoardInputNum() const
this FEB channel in LinkBoard
std::map< int, SiPixelFedCablingTree::PixelFEDCabling >::const_iterator IMAP
const std::vector< FebConnectorSpec > & febs() const
Definition: LinkBoardSpec.h:34
int dccInputChannelNum() const
input channel number to DCC
int linkBoardNumInLink() const
this LB number in link
Definition: LinkBoardSpec.h:24
const std::vector< LinkBoardSpec > & linkBoards() const
Definition: LinkConnSpec.h:24
const std::string& RPCReadOutMapping::version ( ) const
inline

Member Data Documentation

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

Definition at line 68 of file RPCReadOutMapping.h.

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

std::string RPCReadOutMapping::theVersion
private

Definition at line 69 of file RPCReadOutMapping.h.

Referenced by version().