CMS 3D CMS Logo

RPCEMap.h
Go to the documentation of this file.
1 #ifndef RPCEMap_H
2 #define RPCEMap_H
3 
5 
7 #include <map>
8 #include <vector>
9 #include <utility>
10 #include <string>
11 #include <iostream>
12 
13 class RPCEMap {
14 public:
16 
17  virtual ~RPCEMap() {}
18 
20 
21  struct dccItem {
22  int theId;
23  int nTBs;
24 
26  };
27  struct tbItem {
28  int theNum;
29  int nLinks;
30 
32  };
33  struct linkItem {
35  int nLBs;
36 
38  };
39  struct lbItem {
40  bool theMaster;
42  int theCode;
43  int nFebs;
44 
46 
48  };
49  struct febItem {
53  int theAlgo;
54 
56  };
57 
58  std::vector<dccItem> theDccs;
59  std::vector<tbItem> theTBs;
60  std::vector<linkItem> theLinks;
61  std::vector<lbItem> theLBs;
62  std::vector<febItem> theFebs;
63 
64  RPCReadOutMapping const* convert() const {
66  int diskOffset = 4;
67  int year = atoi(theVersion.substr(6, 4).c_str());
68  int month = atoi(theVersion.substr(3, 2).c_str());
69  if (year < 2012 || (year == 2012 && month < 11))
70  diskOffset = 3;
71  int lastTB = 0;
72  int lastLink = 0;
73  int lastLB = 0;
74  int lastFeb = 0;
75  for (unsigned int idcc = 0; idcc < theDccs.size(); idcc++) {
76  DccSpec dcc(theDccs[idcc].theId);
77  for (int itb = lastTB; itb < lastTB + theDccs[idcc].nTBs; itb++) {
78  TriggerBoardSpec tb(theTBs[itb].theNum);
79  for (int ilink = lastLink; ilink < lastLink + theTBs[itb].nLinks; ilink++) {
80  LinkConnSpec lc(theLinks[ilink].theTriggerBoardInputNumber);
81  for (int ilb = lastLB; ilb < lastLB + theLinks[ilink].nLBs; ilb++) {
82  LinkBoardSpec lb(theLBs[ilb].theMaster, theLBs[ilb].theLinkBoardNumInLink, theLBs[ilb].theCode);
83  for (int ifeb = lastFeb; ifeb < lastFeb + theLBs[ilb].nFebs; ifeb++) {
84  int sector = (theFebs[ifeb].theChamber) % 100;
85  char subsector = ((theFebs[ifeb].theChamber) / 100) % 10 - 2;
86  char febZRadOrnt = ((theFebs[ifeb].theChamber) / 1000) % 5;
87  char febZOrnt = ((theFebs[ifeb].theChamber) / 5000) % 2;
88  char diskOrWheel = ((theFebs[ifeb].theChamber) / 10000) % 10 - diskOffset;
89  char layer = ((theFebs[ifeb].theChamber) / 100000) % 10;
90  char barrelOrEndcap = (theFebs[ifeb].theChamber) / 1000000;
92  diskOrWheel, layer, sector, subsector, febZOrnt, febZRadOrnt, barrelOrEndcap};
93  char cmsEtaPartition = (theFebs[ifeb].thePartition) / 1000;
94  char positionInCmsEtaPartition = ((theFebs[ifeb].thePartition) % 1000) / 100;
95  char localEtaPartition = ((theFebs[ifeb].thePartition) % 100) / 10;
96  char positionInLocalEtaPartition = (theFebs[ifeb].thePartition) % 10;
97  FebLocationSpec afeb = {
98  cmsEtaPartition, positionInCmsEtaPartition, localEtaPartition, positionInLocalEtaPartition};
99  FebConnectorSpec febConnector(theFebs[ifeb].theLinkBoardInputNum, chamber, afeb);
100  febConnector.addStrips(theFebs[ifeb].theAlgo);
101  lb.add(febConnector);
102  // std::cout<<"End of FEB"<<std::endl;
103  }
104  lc.add(lb);
105  lastFeb += theLBs[ilb].nFebs;
106  }
107  tb.add(lc);
108  lastLB += theLinks[ilink].nLBs;
109  }
110  dcc.add(tb);
111  lastLink += theTBs[itb].nLinks;
112  }
113  cabling->add(dcc);
114  lastTB += theDccs[idcc].nTBs;
115  }
116  return cabling;
117  };
118 
119 private:
121 };
122 
123 #endif // RPCEMap_H
RPCEMap::dccItem::theId
int theId
Definition: RPCEMap.h:22
ChamberLocationSpec
Definition: ChamberLocationSpec.h:11
RPCEMap::~RPCEMap
virtual ~RPCEMap()
Definition: RPCEMap.h:17
funct::false
false
Definition: Factorize.h:29
RPCReadOutMapping.h
RPCEMap::convert
RPCReadOutMapping const * convert() const
Definition: RPCEMap.h:64
LinkConnSpec
Definition: LinkConnSpec.h:14
RPCEMap::lbItem::theCode
int theCode
Definition: RPCEMap.h:42
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
RPCEMap::theFebs
std::vector< febItem > theFebs
Definition: RPCEMap.h:62
RPCEMap::theTBs
std::vector< tbItem > theTBs
Definition: RPCEMap.h:59
RPCEMap::febItem::theAlgo
int theAlgo
Definition: RPCEMap.h:53
RPCEMap::lbItem::lbItem
lbItem()
Definition: RPCEMap.h:45
RPCEMap::dccItem
Definition: RPCEMap.h:21
RPCEMap::lbItem::theMaster
bool theMaster
Definition: RPCEMap.h:40
RPCReadOutMapping::add
void add(const DccSpec &dcc)
attach FED to map
Definition: RPCReadOutMapping.cc:24
RPCEMap::tbItem::theNum
int theNum
Definition: RPCEMap.h:28
RPCEMap
Definition: RPCEMap.h:13
RPCEMap::linkItem
Definition: RPCEMap.h:33
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCEMap::dccItem::nTBs
int nTBs
Definition: RPCEMap.h:23
RPCEMap::febItem::theChamber
int theChamber
Definition: RPCEMap.h:52
LinkBoardSpec
Definition: LinkBoardSpec.h:13
RPCEMap::RPCEMap
RPCEMap(const std::string &version="")
Definition: RPCEMap.h:15
Serializable.h
RPCEMap::tbItem
Definition: RPCEMap.h:27
RPCReadOutMapping
Definition: RPCReadOutMapping.h:22
RPCEMap::febItem
Definition: RPCEMap.h:49
FebConnectorSpec::addStrips
void addStrips(int algo)
add strip info
Definition: FebConnectorSpec.h:32
RPCEMap::theLinks
std::vector< linkItem > theLinks
Definition: RPCEMap.h:60
RPCEMap::theDccs
std::vector< dccItem > theDccs
Definition: RPCEMap.h:58
RPCEMap::febItem::thePartition
int thePartition
Definition: RPCEMap.h:51
RPCEMap::lbItem
Definition: RPCEMap.h:39
FebLocationSpec
Definition: FebLocationSpec.h:12
RPCEMap::linkItem::nLBs
int nLBs
Definition: RPCEMap.h:35
RPCEMap::theVersion
std::string theVersion
Definition: RPCEMap.h:19
DccSpec
Definition: DccSpec.h:16
TriggerBoardSpec
Definition: TriggerBoardSpec.h:14
LinkConnSpec::add
void add(const LinkBoardSpec &lb)
attach LinkBoard to this link
Definition: LinkConnSpec.cc:16
TriggerBoardSpec::add
void add(const LinkConnSpec &lc)
attach connection to TB
Definition: TriggerBoardSpec.cc:41
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
DccSpec::add
void add(const TriggerBoardSpec &tb)
attach TB to DCC. The channel is defined by TB
Definition: DccSpec.cc:31
RPCEMap::linkItem::theTriggerBoardInputNumber
int theTriggerBoardInputNumber
Definition: RPCEMap.h:34
RPCEMap::tbItem::nLinks
int nLinks
Definition: RPCEMap.h:29
RPCEMap::theLBs
std::vector< lbItem > theLBs
Definition: RPCEMap.h:61
FebConnectorSpec
Definition: FebConnectorSpec.h:23
RPCEMap::lbItem::theLinkBoardNumInLink
int theLinkBoardNumInLink
Definition: RPCEMap.h:41
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
RPCEMap::febItem::theLinkBoardInputNum
int theLinkBoardInputNum
Definition: RPCEMap.h:50
LinkBoardSpec::add
void add(const FebConnectorSpec &feb)
attach feb
Definition: LinkBoardSpec.cc:7
RPCEMap::lbItem::nFebs
int nFebs
Definition: RPCEMap.h:43