CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCPacManager.h
Go to the documentation of this file.
1 #ifndef L1Trigger_RPCPacManager_h
2 #define L1Trigger_RPCPacManager_h
3 
18 //------------------------------------------------------------------------------
19 #include <string>
20 #include <vector>
23 
25 
26 #include <xercesc/util/PlatformUtils.hpp>
27 #include <cstdlib>
28 #ifndef _STAND_ALONE
30 #endif // _STAND_ALONE
31 
33 // TODO: should be moved to L1RPConfig
36  _12_PACS_PER_TOWER = 12, //the same m_PAC in the same segment in every sector,
39 };
40 
41 
42 template<class TPacType> class RPCPacManager {
43 public:
45  for (unsigned int m_tower = 0; m_tower < m_PacTab.size(); m_tower++)
46  for (unsigned int logSector = 0; logSector < m_PacTab[m_tower].size(); logSector++) {
47  for (unsigned int logSegment = 0; logSegment < m_PacTab[m_tower][logSector].size(); logSegment++) {
48  TPacType* pac = m_PacTab[m_tower][logSector][logSegment];
49  delete pac;
50  }
51  }
52  }
53 
59  void init(std::string patFilesDirectory, L1RpcPACsCntEnum _PACsCnt) {
60  m_PACsCnt = _PACsCnt;
62  m_SectorsCnt = 1;
63  m_SegmentCnt = 1;
64  }
65  else if(m_PACsCnt == _12_PACS_PER_TOWER) {
66  m_SectorsCnt = 1;
67  m_SegmentCnt = 12;
68  }
69  else if(m_PACsCnt == _144_PACS_PER_TOWER) {
70  m_SectorsCnt = 12;
71  m_SegmentCnt = 12;
72  }
73  else if(m_PACsCnt == TB_TESTS) {
74  m_SectorsCnt = 1;
75  m_SegmentCnt = 4;
76  }
77 
78  for (int m_tower = 0; m_tower < RPCConst::m_TOWER_COUNT; m_tower++) {
79  m_PacTab.push_back(std::vector<std::vector<TPacType*> >());
80  for (int logSector = 0; logSector < m_SectorsCnt; logSector++) {
81  m_PacTab[m_tower].push_back(std::vector<TPacType*>());
82  for (int logSegment = 0; logSegment < m_SegmentCnt; logSegment++) {
83  TPacType* pac = new TPacType(patFilesDirectory, m_tower, logSector, logSegment);
84  m_PacTab[m_tower][logSector].push_back(pac);
85  }
86  }
87  }
88  xercesc::XMLPlatformUtils::Terminate();
89  };
90 
91 
92  void init(const L1RPCConfig *rpcconf) {
93 
94  switch (rpcconf->getPPT()){
95  case 1:
97  break;
98  case 12:
100  break;
101  case 144:
103  break;
104 
105  }
106 
108  m_SectorsCnt = 1;
109  m_SegmentCnt = 1;
110  }
111  else if(m_PACsCnt == _12_PACS_PER_TOWER) {
112  m_SectorsCnt = 1;
113  m_SegmentCnt = 12;
114  }
115  else if(m_PACsCnt == _144_PACS_PER_TOWER) {
116  m_SectorsCnt = 12;
117  m_SegmentCnt = 12;
118  }
119  else if(m_PACsCnt == TB_TESTS) {
120  m_SectorsCnt = 1;
121  m_SegmentCnt = 4;
122  }
123 
124  /*
125  std::vector<std::vector<std::vector<RPCPattern::RPCPatVec> > > patvec;
126  std::vector<std::vector<std::vector<RPCPattern::TQualityVec> > > qualvec;
127  for (int tower = 0; tower < RPCConst::m_TOWER_COUNT; ++tower) {
128  patvec.push_back(std::vector< std::vector< RPCPattern::RPCPatVec > >());
129  qualvec.push_back(std::vector< std::vector< RPCPattern::TQualityVec > >());
130  for (int logSector = 0; logSector < m_SectorsCnt; ++logSector) {
131  patvec[tower].push_back(std::vector< RPCPattern::RPCPatVec >());
132  qualvec[tower].push_back(std::vector< RPCPattern::TQualityVec >());
133  for (int logSegment = 0; logSegment < m_SegmentCnt; ++logSegment) {
134  patvec[tower][logSector].push_back(RPCPattern::RPCPatVec());
135  qualvec[tower][logSector].push_back(RPCPattern::TQualityVec());
136  }
137  }
138  }
139 
140  for (unsigned int ipat=0; ipat<rpcconf->m_pats.size(); ipat++)
141  patvec[rpcconf->m_pats[ipat].getTower()][rpcconf->m_pats[ipat].getLogSector()][rpcconf->m_pats[ipat].getLogSegment()].push_back(rpcconf->m_pats[ipat]);
142  for (unsigned int iqual=0; iqual<rpcconf->m_quals.size(); iqual++)
143  qualvec[rpcconf->m_quals[iqual].m_tower][rpcconf->m_quals[iqual].m_logsector][rpcconf->m_quals[iqual].m_logsegment].push_back(rpcconf->m_quals[iqual]);
144  */
145 
146 
147  for (int tower = 0; tower < RPCConst::m_TOWER_COUNT; tower++) {
148  m_PacTab.push_back(std::vector<std::vector<TPacType*> >());
149  for (int logSector = 0; logSector < m_SectorsCnt; logSector++) {
150  m_PacTab[tower].push_back(std::vector<TPacType*>());
151  for (int logSegment = 0; logSegment < m_SegmentCnt; logSegment++) {
152  /*L1RPCConfig* rpcconf1=new L1RPCConfig();
153  rpcconf1->setPPT(rpcconf->getPPT());
154  for (unsigned int ipat=0; ipat<patvec[tower][logSector][logSegment].size(); ipat++)
155  rpcconf1->m_pats.push_back(patvec[tower][logSector][logSegment][ipat]);
156  for (unsigned int iqual=0; iqual<qualvec[tower][logSector][logSegment].size(); iqual++)
157  rpcconf1->m_quals.push_back(qualvec[tower][logSector][logSegment][iqual]);
158  //TPacType* pac = new TPacType(rpcconf1->m_pats,rpcconf1->m_quals);*/
159  TPacType* pac = new TPacType(rpcconf, tower, logSector, logSegment);
160  m_PacTab[tower][logSector].push_back(pac);
161  }
162  }
163  }
164  xercesc::XMLPlatformUtils::Terminate();
165  };
166 
171  //const
172  TPacType* getPac(int m_tower, int logSector, int logSegment) const {
173  if (m_PacTab.size() <= (unsigned int) abs(m_tower))
174  throw RPCException("RPCPacManager::getPac: given towerNum to big");
175  // edm::LogError("RPCTrigger") << "RPCPacManager::getPac: given towerNum to big" << std::endl;
176 
177  //int curLogSector = logSector;
178  //int curlogSegment = logSegment;
179 
181  logSector = 0;
182  logSegment = 0;
183  }
184  else if(m_PACsCnt == _12_PACS_PER_TOWER) {
185  logSector = 0;
186  }
187 
188  //XXXX//m_PacTab[abs(m_tower)][logSector][logSegment]->setCurrentPosition(m_tower, curLogSector, curlogSegment);
189  return m_PacTab[std::abs(m_tower)][logSector][logSegment];
190  };
191 
192  //const
193  TPacType* getPac(const RPCConst::l1RpcConeCrdnts& coneCrdnts) const {
194  return getPac(coneCrdnts.m_Tower, coneCrdnts.m_LogSector, coneCrdnts.m_LogSegment);
195  }
196 
197  private:
198  std::vector<std::vector<std::vector<TPacType*> > > m_PacTab;
199 
201 
203 
204  L1RpcPACsCntEnum m_PACsCnt; //Used configuration version.
205 };
206 
207 #endif
int m_SegmentCnt
Count of used differnt segments.
The coordinates of Logic Cone: m_Tower, m_LogSector, m_LogSegment.
Definition: RPCConst.h:119
int getPPT() const
Definition: L1RPCConfig.h:35
#define abs(x)
Definition: mlp_lapack.h:159
TPacType * getPac(int m_tower, int logSector, int logSegment) const
L1RpcPACsCntEnum m_PACsCnt
TPacType * getPac(const RPCConst::l1RpcConeCrdnts &coneCrdnts) const
static const int m_TOWER_COUNT
Only half of the detector.
Definition: RPCConst.h:43
std::vector< std::vector< std::vector< TPacType * > > > m_PacTab
m_PacTab[m_tower][logSector][m_LogSegment]
int m_SectorsCnt
Count of used differnt sectors.
L1RpcPACsCntEnum
Suported configurations.
Definition: RPCPacManager.h:34
void init(const L1RPCConfig *rpcconf)
Definition: RPCPacManager.h:92
void init(std::string patFilesDirectory, L1RpcPACsCntEnum _PACsCnt)
Definition: RPCPacManager.h:59