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 
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 diskOffset=4;
56  int year=atoi(theVersion.substr(6,4).c_str());
57  int month=atoi(theVersion.substr(3,2).c_str());
58  if (year < 2012 || (year==2012 && month<11)) diskOffset=3;
59  int lastTB=0;
60  int lastLink=0;
61  int lastLB=0;
62  int lastFeb=0;
63  for (unsigned int idcc=0; idcc<theDccs.size(); idcc++) {
64  DccSpec dcc(theDccs[idcc].theId);
65  for (int itb=lastTB; itb<lastTB+theDccs[idcc].nTBs; itb++) {
66  TriggerBoardSpec tb(theTBs[itb].theNum);
67  for (int ilink=lastLink; ilink<lastLink+theTBs[itb].nLinks; ilink++) {
68  LinkConnSpec lc(theLinks[ilink].theTriggerBoardInputNumber);
69  for (int ilb=lastLB; ilb<lastLB+theLinks[ilink].nLBs; ilb++) {
70  LinkBoardSpec lb(theLBs[ilb].theMaster,theLBs[ilb].theLinkBoardNumInLink,theLBs[ilb].theCode);
71  for (int ifeb=lastFeb; ifeb<lastFeb+theLBs[ilb].nFebs; ifeb++) {
72  int sector=(theFebs[ifeb].theChamber)%100;
73  char subsector=((theFebs[ifeb].theChamber)/100)%10-2;
74  char febZRadOrnt=((theFebs[ifeb].theChamber)/1000)%5;
75  char febZOrnt=((theFebs[ifeb].theChamber)/5000)%2;
76  char diskOrWheel=((theFebs[ifeb].theChamber)/10000)%10-diskOffset;
77  char layer=((theFebs[ifeb].theChamber)/100000)%10;
78  char barrelOrEndcap=(theFebs[ifeb].theChamber)/1000000;
79  ChamberLocationSpec chamber={diskOrWheel,layer,sector,subsector,febZOrnt,febZRadOrnt,barrelOrEndcap};
80  char cmsEtaPartition=(theFebs[ifeb].thePartition)/1000;
81  char positionInCmsEtaPartition=((theFebs[ifeb].thePartition)%1000)/100;
82  char localEtaPartition=((theFebs[ifeb].thePartition)%100)/10;
83  char positionInLocalEtaPartition=(theFebs[ifeb].thePartition)%10;
84  FebLocationSpec afeb={cmsEtaPartition,positionInCmsEtaPartition,localEtaPartition,positionInLocalEtaPartition};
85  FebConnectorSpec febConnector(theFebs[ifeb].theLinkBoardInputNum,chamber,afeb);
86  febConnector.addStrips(theFebs[ifeb].theAlgo);
87  lb.add(febConnector);
88 // std::cout<<"End of FEB"<<std::endl;
89  }
90  lc.add(lb);
91  lastFeb+=theLBs[ilb].nFebs;
92  }
93  tb.add(lc);
94  lastLB+=theLinks[ilink].nLBs;
95  }
96  dcc.add(tb);
97  lastLink+=theTBs[itb].nLinks;
98  }
99  cabling->add(dcc);
100  lastTB+=theDccs[idcc].nTBs;
101  }
102  return cabling;
103 };
104 
105 private:
106 
107 };
108 
109 #endif // RPCEMap_H
110 
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