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