CMS 3D CMS Logo

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