CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCEMap.h
Go to the documentation of this file.
1 #ifndef RPCEMap_H
2 #define RPCEMap_H
3 
5 #include <map>
6 #include <vector>
7 #include <utility>
8 #include <string>
9 #include <iostream>
10 #include <boost/cstdint.hpp>
11 
12 class RPCEMap {
13 public:
14 
15  RPCEMap(const std::string & version = "")
16  : theVersion(version) { }
17 
18  virtual ~RPCEMap(){}
19 
20  std::string theVersion;
21 
22  struct dccItem {
23  int theId;
24  int nTBs;
25  };
26  struct tbItem {
27  int theNum;
28  int nLinks;
29  };
30  struct linkItem {
32  int nLBs;
33  };
34  struct lbItem {
35  bool theMaster;
37  int theCode;
38  int nFebs;
39  };
40  struct febItem {
44  int theAlgo;
45  };
46 
47  std::vector<dccItem> theDccs;
48  std::vector<tbItem> theTBs;
49  std::vector<linkItem> theLinks;
50  std::vector<lbItem> theLBs;
51  std::vector<febItem> theFebs;
52 
55  int lastTB=0;
56  int lastLink=0;
57  int lastLB=0;
58  int lastFeb=0;
59  for (unsigned int idcc=0; idcc<theDccs.size(); idcc++) {
60  DccSpec dcc(theDccs[idcc].theId);
61  for (int itb=lastTB; itb<lastTB+theDccs[idcc].nTBs; itb++) {
62  TriggerBoardSpec tb(theTBs[itb].theNum);
63  for (int ilink=lastLink; ilink<lastLink+theTBs[itb].nLinks; ilink++) {
64  LinkConnSpec lc(theLinks[ilink].theTriggerBoardInputNumber);
65  for (int ilb=lastLB; ilb<lastLB+theLinks[ilink].nLBs; ilb++) {
66  LinkBoardSpec lb(theLBs[ilb].theMaster,theLBs[ilb].theLinkBoardNumInLink,theLBs[ilb].theCode);
67  for (int ifeb=lastFeb; ifeb<lastFeb+theLBs[ilb].nFebs; ifeb++) {
68  int sector=(theFebs[ifeb].theChamber)%100;
69  char subsector=((theFebs[ifeb].theChamber)/100)%10-2;
70  char febZRadOrnt=((theFebs[ifeb].theChamber)/1000)%5;
71  char febZOrnt=((theFebs[ifeb].theChamber)/5000)%2;
72  char diskOrWheel=((theFebs[ifeb].theChamber)/10000)%10-3;
73  char layer=((theFebs[ifeb].theChamber)/100000)%10;
74  char barrelOrEndcap=(theFebs[ifeb].theChamber)/1000000;
75  ChamberLocationSpec chamber={diskOrWheel,layer,sector,subsector,febZOrnt,febZRadOrnt,barrelOrEndcap};
76  char cmsEtaPartition=(theFebs[ifeb].thePartition)/1000;
77  char positionInCmsEtaPartition=((theFebs[ifeb].thePartition)%1000)/100;
78  char localEtaPartition=((theFebs[ifeb].thePartition)%100)/10;
79  char positionInLocalEtaPartition=(theFebs[ifeb].thePartition)%10;
80  FebLocationSpec afeb={cmsEtaPartition,positionInCmsEtaPartition,localEtaPartition,positionInLocalEtaPartition};
81  FebConnectorSpec febConnector(theFebs[ifeb].theLinkBoardInputNum,chamber,afeb);
82  febConnector.addStrips(theFebs[ifeb].theAlgo);
83  lb.add(febConnector);
84 // std::cout<<"End of FEB"<<std::endl;
85  }
86  lc.add(lb);
87  lastFeb+=theLBs[ilb].nFebs;
88  }
89  tb.add(lc);
90  lastLB+=theLinks[ilink].nLBs;
91  }
92  dcc.add(tb);
93  lastLink+=theTBs[itb].nLinks;
94  }
95  cabling->add(dcc);
96  lastTB+=theDccs[idcc].nTBs;
97  }
98  return cabling;
99 };
100 
101 private:
102 
103 };
104 
105 #endif // RPCEMap_H
106 
int theTriggerBoardInputNumber
Definition: RPCEMap.h:31
int theLinkBoardInputNum
Definition: RPCEMap.h:41
void add(const FebConnectorSpec &feb)
attach feb
Definition: LinkBoardSpec.cc:8
RPCReadOutMapping * convert() const
Definition: RPCEMap.h:53
std::vector< tbItem > theTBs
Definition: RPCEMap.h:48
void addStrips(int algo)
add strip info
void add(const LinkBoardSpec &lb)
attach LinkBoard to this link
Definition: LinkConnSpec.cc:16
void add(const LinkConnSpec &lc)
attach connection to TB
int theLinkBoardNumInLink
Definition: RPCEMap.h:36
std::vector< dccItem > theDccs
Definition: RPCEMap.h:47
std::vector< febItem > theFebs
Definition: RPCEMap.h:51
void add(const DccSpec &dcc)
attach FED to map
void add(const TriggerBoardSpec &tb)
attach TB to DCC. The channel is defined by TB
Definition: DccSpec.cc:34
int thePartition
Definition: RPCEMap.h:42
std::vector< linkItem > theLinks
Definition: RPCEMap.h:49
bool theMaster
Definition: RPCEMap.h:35
std::vector< lbItem > theLBs
Definition: RPCEMap.h:50
RPCEMap(const std::string &version="")
Definition: RPCEMap.h:15
std::string theVersion
Definition: RPCEMap.h:20
virtual ~RPCEMap()
Definition: RPCEMap.h:18