CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtBoardMapsTrivialProducer.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <memory>
20 #include "boost/shared_ptr.hpp"
21 
22 #include <string>
23 
24 // user include files
25 // base class
27 
30 
32 
33 // forward declarations
34 
35 //
36 
37 std::vector<L1GtObject> chInputObjects(
38  const std::vector<std::string>& chInputStrings)
39 {
40  std::vector<L1GtObject> chInputObjectsV;
41  chInputObjectsV.reserve(chInputStrings.size());
42 
44 
45  for (std::vector<std::string>::const_iterator itObj =
46  chInputStrings.begin(); itObj != chInputStrings.end(); ++itObj) {
47 
48  if ((*itObj) == "Mu") {
49  obj = Mu;
50  }
51  else if ((*itObj) == "NoIsoEG") {
52  obj = NoIsoEG;
53  }
54  else if ((*itObj) == "IsoEG") {
55  obj = IsoEG;
56  }
57  else if ((*itObj) == "CenJet") {
58  obj = CenJet;
59  }
60  else if ((*itObj) == "ForJet") {
61  obj = ForJet;
62  }
63  else if ((*itObj) == "TauJet") {
64  obj = TauJet;
65  }
66  else if ((*itObj) == "ETM") {
67  obj = ETM;
68  }
69  else if ((*itObj) == "ETT") {
70  obj = ETT;
71  }
72  else if ((*itObj) == "HTT") {
73  obj = HTT;
74  }
75  else if ((*itObj) == "HTM") {
76  obj = HTM;
77  }
78  else if ((*itObj) == "JetCounts") {
79  obj = JetCounts;
80  }
81  else if ((*itObj) == "HfBitCounts") {
82  obj = HfBitCounts;
83  }
84  else if ((*itObj) == "HfRingEtSums") {
85  obj = HfRingEtSums;
86  }
87  else if ((*itObj) == "TechTrig") {
88  obj = TechTrig;
89  }
90  else if ((*itObj) == "BPTX") {
91  obj = BPTX;
92  }
93  else if ((*itObj) == "GtExternal") {
94  obj = GtExternal;
95  }
96  else {
97  throw cms::Exception("Configuration")
98  << "\nError: no such L1 GT object: " << (*itObj) << "\n"
99  << "\n Can not define the mapping of the L1 GT boards. \n"
100  << std::endl;
101 
102  }
103 
104  chInputObjectsV.push_back(obj);
105  }
106 
107  return chInputObjectsV;
108 }
109 
110 // constructor(s)
112 {
113  // tell the framework what data is being produced
115 
116  // now do what ever other initialization is needed
117 
118  // get the list of the board names and indices
119  std::vector<std::string> boardList =
120  parSet.getParameter<std::vector<std::string> >("BoardList");
121 
122  std::vector<int> boardIndexVec =
123  parSet.getParameter<std::vector<int> >("BoardIndex");
124 
125  // check if the board list and the board indices are consistent
126  // i.e. have the same number of entries
127 
128  if (boardList.size() != boardIndexVec.size()) {
129  throw cms::Exception("Configuration")
130  << "\nError: inconsistent length of board list and board indices.\n"
131  << "\n Can not define the mapping of the L1 GT boards. \n"
132  << std::endl;
133  }
134 
135  // L1 GT DAQ record map
136  std::vector<int> boardPositionDaqRecord =
137  parSet.getParameter<std::vector<int> >("BoardPositionDaqRecord");
138 
139  if (boardList.size() != boardPositionDaqRecord.size()) {
140  throw cms::Exception("Configuration")
141  << "\nError: inconsistent length of board list and board indices in GT DAQ record.\n"
142  << "\n Can not define the mapping of the L1 GT boards. \n"
143  << std::endl;
144  }
145 
146  // L1 GT EVM record map
147  std::vector<int> boardPositionEvmRecord =
148  parSet.getParameter<std::vector<int> >("BoardPositionEvmRecord");
149 
150  if (boardList.size() != boardPositionEvmRecord.size()) {
151  throw cms::Exception("Configuration")
152  << "\nError: inconsistent length of board list and board indices in GT EVM record.\n"
153  << "\n Can not define the mapping of the L1 GT boards. \n"
154  << std::endl;
155  }
156 
157  // L1 GT "active boards" map for DAQ record
158  std::vector<int> activeBoardsDaqRecord =
159  parSet.getParameter<std::vector<int> >("ActiveBoardsDaqRecord");
160 
161  if (boardList.size() != activeBoardsDaqRecord.size()) {
162  throw cms::Exception("Configuration")
163  << "\nError: inconsistent length of board list and active boards in GT DAQ record.\n"
164  << "\n Can not define the mapping of the L1 GT boards. \n"
165  << std::endl;
166  }
167 
168  // L1 GT "active boards" map for EVM record
169  std::vector<int> activeBoardsEvmRecord =
170  parSet.getParameter<std::vector<int> >("ActiveBoardsEvmRecord");
171 
172  if (boardList.size() != activeBoardsEvmRecord.size()) {
173  throw cms::Exception("Configuration")
174  << "\nError: inconsistent length of board list and active boards in GT EVM record.\n"
175  << "\n Can not define the mapping of the L1 GT boards. \n"
176  << std::endl;
177  }
178 
179  // L1 GT board - slot map
180  std::vector<int> boardSlotMap =
181  parSet.getParameter<std::vector<int> >("BoardSlotMap");
182 
183  if (boardList.size() != boardSlotMap.size()) {
184  throw cms::Exception("Configuration")
185  << "\nError: inconsistent length of board list and board - slot map.\n"
186  << "\n Can not define the mapping of the L1 GT boards. \n"
187  << std::endl;
188  }
189 
190  // L1 GT board name in hw record map
191  std::vector<int> boardHexNameMap =
192  parSet.getParameter<std::vector<int> >("BoardHexNameMap");
193 
194  if (boardList.size() != boardHexNameMap.size()) {
195  throw cms::Exception("Configuration")
196  << "\nError: inconsistent length of board list and board name in hw record map.\n"
197  << "\n Can not define the mapping of the L1 GT boards. \n"
198  << std::endl;
199  }
200 
201 
202 
203  // GCT PSB to GT - map cables to input quadruplets and PSB indices
204 
205 
206  // L1 GT cable list (GCT input to PSB)
207  std::vector<std::string> cableList =
208  parSet.getParameter<std::vector<std::string> >("CableList");
209 
210  // L1 GT calo input to PSB map
211  // gives the mapping of GT calorimeter input to GT PSBs via PSB index
212  // 4 infinicables per PSB (last PSB can use only 2!)
213  std::vector<int> cableToPsbMap =
214  parSet.getParameter<std::vector<int> >("CableToPsbMap");
215 
216 
217  if (cableList.size() != cableToPsbMap.size()) {
218  throw cms::Exception("Configuration")
219  << "\nError: inconsistent length of cable list and input to PSB list.\n"
220  << "\n Can not define the mapping of GCT quadruplets to GT PSBs.\n"
221  << std::endl;
222  }
223 
224 
225  // detailed input configuration for PSB
226  std::vector<edm::ParameterSet> psbInput = parSet.getParameter<std::vector<
227  edm::ParameterSet> > ("PsbInput");
228 
229  // reserve space for L1 GT boards
230  m_gtBoardMaps.reserve(boardList.size());
231 
232 
233  // fill the maps
234  int posVec = 0;
235 
236  for (std::vector<std::string>::const_iterator
237  it = boardList.begin(); it != boardList.end(); ++it) {
238 
239  L1GtBoardType boardType;
240 
241  if ( (*it) == "GTFE" ) {
242  boardType = GTFE;
243  } else if ( (*it) == "FDL" ) {
244  boardType = FDL;
245  } else if ( (*it) == "PSB" ) {
246  boardType = PSB;
247  } else if ( (*it) == "GMT" ) {
248  boardType = GMT;
249  } else if ( (*it) == "TCS" ) {
250  boardType = TCS;
251  } else if ( (*it) == "TIM" ) {
252  boardType = TIM;
253  } else {
254  throw cms::Exception("Configuration")
255  << "\nError: no such board: " << (*it).c_str() << "\n"
256  << "\n Can not define the mapping of the L1 GT boards. \n"
257  << std::endl;
258  }
259 
260  // construct from board type and board index
261 
262  int iBoard = boardIndexVec.at(posVec);
263  L1GtBoard gtBoard = L1GtBoard(boardType, iBoard);
264 
265  // set the position of board data block
266  // in the GT DAQ readout record
267  gtBoard.setGtPositionDaqRecord(boardPositionDaqRecord.at(posVec));
268 
269  // set the position of board data block
270  // in the GT EVM readout record
271  gtBoard.setGtPositionEvmRecord(boardPositionEvmRecord.at(posVec));
272 
273  // set the bit of board in the GTFE ACTIVE_BOARDS
274  // for the GT DAQ readout record
275  gtBoard.setGtBitDaqActiveBoards(activeBoardsDaqRecord.at(posVec));
276 
277  // set the bit of board in the GTFE ACTIVE_BOARDS
278  // for the GT EVM readout record
279  gtBoard.setGtBitEvmActiveBoards(activeBoardsEvmRecord.at(posVec));
280 
281  // set board slot
282  int boardSlot = boardSlotMap.at(posVec);
283  gtBoard.setGtBoardSlot(boardSlot);
284 
285  // set board hex fragment name in hw record
286  gtBoard.setGtBoardHexName(boardHexNameMap.at(posVec));
287 
288  // set L1 quadruplet (4x16 bits)(cable) in the PSB input
289  // valid for PSB only
290 
291  if (boardType == PSB) {
292 
293  L1GtPsbQuad psbQuad = Free;
294  int posCable = 0;
295  int iPsb = 0;
296  std::vector<L1GtPsbQuad> quadVec(L1GtBoard::NumberCablesBoard);
297 
298  for (std::vector<std::string>::const_iterator
299  cIt = cableList.begin(); cIt != cableList.end(); ++cIt) {
300 
301 
302  if ( *cIt == "TechTr" ) {
303  psbQuad = TechTr;
304  } else if ( *cIt == "IsoEGQ" ) {
305  psbQuad = IsoEGQ;
306  } else if ( *cIt == "NoIsoEGQ" ) {
307  psbQuad = NoIsoEGQ;
308  } else if ( *cIt == "CenJetQ" ) {
309  psbQuad = CenJetQ;
310  } else if ( *cIt == "ForJetQ" ) {
311  psbQuad = ForJetQ;
312  } else if ( *cIt == "TauJetQ" ) {
313  psbQuad = TauJetQ;
314  } else if ( *cIt == "ESumsQ" ) {
315  psbQuad = ESumsQ;
316  } else if ( *cIt == "JetCountsQ" ) {
317  psbQuad = JetCountsQ;
318  } else if ( *cIt == "MQB1" ) {
319  psbQuad = MQB1;
320  } else if ( *cIt == "MQB2" ) {
321  psbQuad = MQB2;
322  } else if ( *cIt == "MQF3" ) {
323  psbQuad = MQF3;
324  } else if ( *cIt == "MQF4" ) {
325  psbQuad = MQF4;
326  } else if ( *cIt == "MQB5" ) {
327  psbQuad = MQB5;
328  } else if ( *cIt == "MQB6" ) {
329  psbQuad = MQB6;
330  } else if ( *cIt == "MQF7" ) {
331  psbQuad = MQF7;
332  } else if ( *cIt == "MQF8" ) {
333  psbQuad = MQF8;
334  } else if ( *cIt == "MQB9" ) {
335  psbQuad = MQB9;
336  } else if ( *cIt == "MQB10" ) {
337  psbQuad = MQB10;
338  } else if ( *cIt == "MQF11" ) {
339  psbQuad = MQF11;
340  } else if ( *cIt == "MQF12" ) {
341  psbQuad = MQF12;
342  } else if ( *cIt == "Free" ) {
343  psbQuad = Free;
344  } else if ( *cIt == "HfQ" ) {
345  psbQuad = HfQ;
346  } else {
347  // should not arrive here
348  throw cms::Exception("Configuration")
349  << "\nError: no such quadruplet: " << (*cIt).c_str() << "\n"
350  << "\n Can not define the mapping of quadruplets to the L1 PSB boards.\n"
351  << std::endl;
352  }
353 
354  int psbIndex = cableToPsbMap.at(posCable);
355 
356  if (psbIndex == gtBoard.gtBoardIndex()) {
357 
358  if (iPsb > L1GtBoard::NumberCablesBoard) {
359  throw cms::Exception("Configuration")
360  << "\nError: too many cables for PSB_" << gtBoard.gtBoardIndex()
361  << "\n\n "
362  << "Can not define the mapping of cables to L1 PSB boards. \n"
363  << std::endl;
364 
365  }
366  quadVec[iPsb] = psbQuad;
367  iPsb++;
368  }
369  posCable++;
370 
371  }
372 
373  gtBoard.setGtQuadInPsb(quadVec);
374 
375  }
376 
377  if (boardType == PSB) {
378 
379  std::map<int, std::vector<L1GtObject> > inputPsbChannels;
380 
381  std::vector<std::string> chStrings;
382  chStrings.reserve(2); // most channels have 2 objects
383 
384  std::vector<L1GtObject> chObjects;
385 
386  for (std::vector<edm::ParameterSet>::const_iterator itPSet =
387  psbInput.begin(); itPSet != psbInput.end(); ++itPSet) {
388 
389  //
390  int slot = itPSet->getParameter<int> ("Slot");
391 
392  if (slot == boardSlot) {
393  chStrings = itPSet->getParameter<std::vector<std::string> > (
394  "Ch0");
395  chObjects = chInputObjects(chStrings);
396  inputPsbChannels[0] = chObjects;
397  chStrings.clear();
398  chObjects.clear();
399 
400  chStrings = itPSet->getParameter<std::vector<std::string> > (
401  "Ch1");
402  chObjects = chInputObjects(chStrings);
403  inputPsbChannels[1] = chObjects;
404  chStrings.clear();
405  chObjects.clear();
406 
407  chStrings = itPSet->getParameter<std::vector<std::string> > (
408  "Ch2");
409  chObjects = chInputObjects(chStrings);
410  inputPsbChannels[2] = chObjects;
411  chStrings.clear();
412  chObjects.clear();
413 
414  chStrings = itPSet->getParameter<std::vector<std::string> > (
415  "Ch3");
416  chObjects = chInputObjects(chStrings);
417  inputPsbChannels[3] = chObjects;
418  chStrings.clear();
419  chObjects.clear();
420 
421  chStrings = itPSet->getParameter<std::vector<std::string> > (
422  "Ch4");
423  chObjects = chInputObjects(chStrings);
424  inputPsbChannels[4] = chObjects;
425  chStrings.clear();
426  chObjects.clear();
427 
428  chStrings = itPSet->getParameter<std::vector<std::string> > (
429  "Ch5");
430  chObjects = chInputObjects(chStrings);
431  inputPsbChannels[5] = chObjects;
432  chStrings.clear();
433  chObjects.clear();
434 
435  chStrings = itPSet->getParameter<std::vector<std::string> > (
436  "Ch6");
437  chObjects = chInputObjects(chStrings);
438  inputPsbChannels[6] = chObjects;
439  chStrings.clear();
440  chObjects.clear();
441 
442  chStrings = itPSet->getParameter<std::vector<std::string> > (
443  "Ch7");
444  chObjects = chInputObjects(chStrings);
445  inputPsbChannels[7] = chObjects;
446  chStrings.clear();
447  chObjects.clear();
448  }
449  }
450 
451  gtBoard.setGtInputPsbChannels(inputPsbChannels);
452  }
453 
454  // push the board in the vector
455  m_gtBoardMaps.push_back(gtBoard);
456 
457  // increase the counter
458  posVec++;
459 
460  }
461 
462 }
463 
464 // destructor
466 {
467 
468  // empty
469 
470 }
471 
472 
473 // member functions
474 
475 // method called to produce the data
476 boost::shared_ptr<L1GtBoardMaps> L1GtBoardMapsTrivialProducer::produceBoardMaps(
477  const L1GtBoardMapsRcd& iRecord)
478 {
479 
480  using namespace edm::es;
481 
482  boost::shared_ptr<L1GtBoardMaps> pL1GtBoardMaps =
483  boost::shared_ptr<L1GtBoardMaps>( new L1GtBoardMaps() );
484 
485  pL1GtBoardMaps->setGtBoardMaps(m_gtBoardMaps);
486 
487  return pL1GtBoardMaps ;
488 }
489 
T getParameter(std::string const &) const
Definition: L1GtObject.h:39
void setGtBoardSlot(const int &)
Definition: L1GtBoard.cc:249
void setGtBoardHexName(const int &)
Definition: L1GtBoard.cc:255
Definition: L1GtObject.h:36
void setGtBitEvmActiveBoards(const int &)
Definition: L1GtBoard.cc:243
std::vector< L1GtObject > chInputObjects(const std::vector< std::string > &chInputStrings)
void setGtPositionEvmRecord(const int &)
Definition: L1GtBoard.cc:228
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
Definition: L1GtObject.h:38
L1GtPsbQuad
quadruples sent to GT via PSB
std::vector< L1GtBoard > m_gtBoardMaps
L1 GT boards and their mapping.
L1GtBoardType
board types in GT
void setGtInputPsbChannels(const std::map< int, std::vector< L1GtObject > > &)
Definition: L1GtBoard.cc:270
const int gtBoardIndex() const
get / set board index
Definition: L1GtBoard.h:82
void setGtBitDaqActiveBoards(const int &)
Definition: L1GtBoard.cc:235
void setGtPositionDaqRecord(const int &)
Definition: L1GtBoard.cc:221
L1GtBoardMapsTrivialProducer(const edm::ParameterSet &)
constructor
Definition: L1GtObject.h:30
Definition: L1GtObject.h:37
boost::shared_ptr< L1GtBoardMaps > produceBoardMaps(const L1GtBoardMapsRcd &)
public methods
static const int NumberCablesBoard
number of InfiniCables per board
Definition: L1GtBoard.h:69
void setGtQuadInPsb(const std::vector< L1GtPsbQuad > &)
Definition: L1GtBoard.cc:263