CMS 3D CMS Logo

TriggerMenuParser.cc
Go to the documentation of this file.
1 
35 // this class header
36 #include "TriggerMenuParser.h"
37 
38 // system include files
39 #include <string>
40 #include <vector>
41 
42 #include <iostream>
43 #include <fstream>
44 #include <iomanip>
45 #include <cmath>
46 
48 
51 
52 #include "tmEventSetup/tmEventSetup.hh"
53 #include "tmEventSetup/esTypes.hh"
54 
61 #include "tmGrammar/Algorithm.hh"
62 
63 #include <cstdint>
64 
65 // constructor
67  : m_triggerMenuInterface("NULL"),
68  m_triggerMenuName("NULL"),
69  m_triggerMenuImplementation(0x0),
70  m_scaleDbKey("NULL")
71 
72 {
73  // menu names, scale key initialized to NULL due to ORACLE treatment of strings
74 
75  // empty
76 }
77 
78 // destructor
80 
81 // set the number of condition chips in GTL
82 void l1t::TriggerMenuParser::setGtNumberConditionChips(const unsigned int& numberConditionChipsValue) {
83  m_numberConditionChips = numberConditionChipsValue;
84 }
85 
86 // set the number of pins on the GTL condition chips
87 void l1t::TriggerMenuParser::setGtPinsOnConditionChip(const unsigned int& pinsOnConditionChipValue) {
88  m_pinsOnConditionChip = pinsOnConditionChipValue;
89 }
90 
91 // set the correspondence "condition chip - GTL algorithm word"
92 // in the hardware
93 void l1t::TriggerMenuParser::setGtOrderConditionChip(const std::vector<int>& orderConditionChipValue) {
94  m_orderConditionChip = orderConditionChipValue;
95 }
96 
97 // set the number of physics trigger algorithms
98 void l1t::TriggerMenuParser::setGtNumberPhysTriggers(const unsigned int& numberPhysTriggersValue) {
99  m_numberPhysTriggers = numberPhysTriggersValue;
100 }
101 
102 // set the condition maps
103 void l1t::TriggerMenuParser::setGtConditionMap(const std::vector<ConditionMap>& condMap) { m_conditionMap = condMap; }
104 
105 // set the trigger menu name
107  m_triggerMenuInterface = menuInterface;
108 }
109 
110 // set the trigger menu uuid
111 void l1t::TriggerMenuParser::setGtTriggerMenuUUID(const int uuid) { m_triggerMenuUUID = uuid; }
112 
113 void l1t::TriggerMenuParser::setGtTriggerMenuName(const std::string& menuName) { m_triggerMenuName = menuName; }
114 
115 void l1t::TriggerMenuParser::setGtTriggerMenuImplementation(const unsigned long& menuImplementation) {
116  m_triggerMenuImplementation = menuImplementation;
117 }
118 
119 // set menu associated scale key
120 void l1t::TriggerMenuParser::setGtScaleDbKey(const std::string& scaleKey) { m_scaleDbKey = scaleKey; }
121 
122 // set the vectors containing the conditions
123 void l1t::TriggerMenuParser::setVecMuonTemplate(const std::vector<std::vector<MuonTemplate> >& vecMuonTempl) {
124  m_vecMuonTemplate = vecMuonTempl;
125 }
126 
128  const std::vector<std::vector<MuonShowerTemplate> >& vecMuonShowerTempl) {
129  m_vecMuonShowerTemplate = vecMuonShowerTempl;
130 }
131 
132 void l1t::TriggerMenuParser::setVecCaloTemplate(const std::vector<std::vector<CaloTemplate> >& vecCaloTempl) {
133  m_vecCaloTemplate = vecCaloTempl;
134 }
135 
137  const std::vector<std::vector<EnergySumTemplate> >& vecEnergySumTempl) {
138  m_vecEnergySumTemplate = vecEnergySumTempl;
139 }
140 
142  const std::vector<std::vector<EnergySumZdcTemplate> >& vecEnergySumZdcTempl) {
143  m_vecEnergySumZdcTemplate = vecEnergySumZdcTempl;
144 }
145 
146 void l1t::TriggerMenuParser::setVecAXOL1TLTemplate(const std::vector<std::vector<AXOL1TLTemplate> >& vecAXOL1TLTempl) {
147  m_vecAXOL1TLTemplate = vecAXOL1TLTempl;
148 }
149 
150 void l1t::TriggerMenuParser::setVecCICADATemplate(const std::vector<std::vector<CICADATemplate> >& vecCICADATempl) {
151  m_vecCICADATemplate = vecCICADATempl;
152 }
153 
155  const std::vector<std::vector<ExternalTemplate> >& vecExternalTempl) {
156  m_vecExternalTemplate = vecExternalTempl;
157 }
158 
160  const std::vector<std::vector<CorrelationTemplate> >& vecCorrelationTempl) {
161  m_vecCorrelationTemplate = vecCorrelationTempl;
162 }
163 
165  const std::vector<std::vector<CorrelationThreeBodyTemplate> >& vecCorrelationThreeBodyTempl) {
166  m_vecCorrelationThreeBodyTemplate = vecCorrelationThreeBodyTempl;
167 }
168 
170  const std::vector<std::vector<CorrelationWithOverlapRemovalTemplate> >& vecCorrelationWithOverlapRemovalTempl) {
171  m_vecCorrelationWithOverlapRemovalTemplate = vecCorrelationWithOverlapRemovalTempl;
172 }
173 
174 // set the vectors containing the conditions for correlation templates
175 //
176 void l1t::TriggerMenuParser::setCorMuonTemplate(const std::vector<std::vector<MuonTemplate> >& corMuonTempl) {
177  m_corMuonTemplate = corMuonTempl;
178 }
179 
180 void l1t::TriggerMenuParser::setCorCaloTemplate(const std::vector<std::vector<CaloTemplate> >& corCaloTempl) {
181  m_corCaloTemplate = corCaloTempl;
182 }
183 
185  const std::vector<std::vector<EnergySumTemplate> >& corEnergySumTempl) {
186  m_corEnergySumTemplate = corEnergySumTempl;
187 }
188 
189 // set the algorithm map (by algorithm names)
190 void l1t::TriggerMenuParser::setGtAlgorithmMap(const AlgorithmMap& algoMap) { m_algorithmMap = algoMap; }
191 
192 // set the algorithm map (by algorithm aliases)
193 void l1t::TriggerMenuParser::setGtAlgorithmAliasMap(const AlgorithmMap& algoMap) { m_algorithmAliasMap = algoMap; }
194 
195 std::map<std::string, unsigned int> l1t::TriggerMenuParser::getExternalSignals(const L1TUtmTriggerMenu* utmMenu) {
196  using namespace tmeventsetup;
197  const std::map<std::string, L1TUtmCondition>& condMap = utmMenu->getConditionMap();
198 
199  std::map<std::string, unsigned int> extBitMap;
200 
201  //loop over the algorithms
202  for (const auto& cit : condMap) {
203  const L1TUtmCondition& condition = cit.second;
204  if (condition.getType() == esConditionType::Externals) {
205  // Get object for External conditions
206  const std::vector<L1TUtmObject>& objects = condition.getObjects();
207  for (const auto& object : objects) {
208  if (object.getType() == esObjectType::EXT) {
209  unsigned int channelID = object.getExternalChannelId();
210  std::string name = object.getExternalSignalName();
211 
212  if (extBitMap.count(name) == 0)
213  extBitMap.insert(std::map<std::string, unsigned int>::value_type(name, channelID));
214  }
215  }
216  }
217  }
218 
219  return extBitMap;
220 }
221 
222 // parse def.xml file
224  // resize the vector of condition maps
225  // the number of condition chips should be correctly set before calling parseXmlFile
226  m_conditionMap.resize(m_numberConditionChips);
227 
228  m_vecMuonTemplate.resize(m_numberConditionChips);
229  m_vecMuonShowerTemplate.resize(m_numberConditionChips);
230  m_vecCaloTemplate.resize(m_numberConditionChips);
231  m_vecEnergySumTemplate.resize(m_numberConditionChips);
232  m_vecEnergySumZdcTemplate.resize(m_numberConditionChips);
233  m_vecAXOL1TLTemplate.resize(m_numberConditionChips);
234  m_vecCICADATemplate.resize(m_numberConditionChips);
235  m_vecExternalTemplate.resize(m_numberConditionChips);
236 
237  m_vecCorrelationTemplate.resize(m_numberConditionChips);
238  m_vecCorrelationThreeBodyTemplate.resize(m_numberConditionChips);
239  m_vecCorrelationWithOverlapRemovalTemplate.resize(m_numberConditionChips);
240  m_corMuonTemplate.resize(m_numberConditionChips);
241  m_corCaloTemplate.resize(m_numberConditionChips);
242  m_corEnergySumTemplate.resize(m_numberConditionChips);
243 
244  using namespace tmeventsetup;
245  using namespace Algorithm;
246 
247  //get the meta data
248  m_triggerMenuDescription = utmMenu->getComment();
249  m_triggerMenuDate = utmMenu->getDatetime();
250  m_triggerMenuImplementation = (getMmHashN(utmMenu->getFirmwareUuid()) & 0xFFFFFFFF); //make sure we only have 32 bits
251  m_triggerMenuName = utmMenu->getName();
252  m_triggerMenuInterface = utmMenu->getVersion(); //BLW: correct descriptor?
253  m_triggerMenuUUID = (getMmHashN(utmMenu->getName()) & 0xFFFFFFFF); //make sure we only have 32 bits
254 
255  const std::map<std::string, L1TUtmAlgorithm>& algoMap = utmMenu->getAlgorithmMap();
256  const std::map<std::string, L1TUtmCondition>& condMap = utmMenu->getConditionMap();
257  //We use es types for scale map to use auxiliary functions without having to duplicate code
258  const std::map<std::string, tmeventsetup::esScale> scaleMap(std::begin(utmMenu->getScaleMap()),
259  std::end(utmMenu->getScaleMap()));
260 
261  // parse the scales
262  m_gtScales.setScalesName(utmMenu->getScaleSetName());
263  parseScales(scaleMap);
264 
265  //loop over the algorithms
266  for (const auto& cit : algoMap) {
267  //condition chip (artifact) TO DO: Update
268  int chipNr = 0;
269 
270  //get algorithm
271  const L1TUtmAlgorithm& algo = cit.second;
272 
273  //parse the algorithm
274  parseAlgorithm(algo, chipNr); //blw
275 
276  //get conditions for this algorithm
277  const std::vector<std::string>& rpn_vec = algo.getRpnVector();
278  for (size_t ii = 0; ii < rpn_vec.size(); ii++) {
279  const std::string& token = rpn_vec.at(ii);
280  if (isGate(token))
281  continue;
282  // long hash = getHash(token);
283  const L1TUtmCondition& condition = condMap.find(token)->second;
284 
285  //check to see if this condtion already exists
286  if ((m_conditionMap[chipNr]).count(condition.getName()) == 0) {
287  // parse Calo Conditions (EG, Jets, Taus)
288  if (condition.getType() == esConditionType::SingleEgamma ||
289  condition.getType() == esConditionType::DoubleEgamma ||
290  condition.getType() == esConditionType::TripleEgamma ||
291  condition.getType() == esConditionType::QuadEgamma || condition.getType() == esConditionType::SingleTau ||
292  condition.getType() == esConditionType::DoubleTau || condition.getType() == esConditionType::TripleTau ||
293  condition.getType() == esConditionType::QuadTau || condition.getType() == esConditionType::SingleJet ||
294  condition.getType() == esConditionType::DoubleJet || condition.getType() == esConditionType::TripleJet ||
295  condition.getType() == esConditionType::QuadJet) {
296  parseCalo(condition, chipNr, false);
297 
298  // parse Energy Sums (and HI trigger objects, treated as energy sums or counters)
299  } else if (condition.getType() == esConditionType::TotalEt ||
300  condition.getType() == esConditionType::TotalEtEM ||
301  condition.getType() == esConditionType::TotalHt ||
302  condition.getType() == esConditionType::MissingEt ||
303  condition.getType() == esConditionType::MissingHt ||
304  condition.getType() == esConditionType::MissingEtHF ||
305  condition.getType() == esConditionType::TowerCount ||
306  condition.getType() == esConditionType::MinBiasHFP0 ||
307  condition.getType() == esConditionType::MinBiasHFM0 ||
308  condition.getType() == esConditionType::MinBiasHFP1 ||
309  condition.getType() == esConditionType::MinBiasHFM1 ||
310  condition.getType() == esConditionType::AsymmetryEt ||
311  condition.getType() == esConditionType::AsymmetryHt ||
312  condition.getType() == esConditionType::AsymmetryEtHF ||
313  condition.getType() == esConditionType::AsymmetryHtHF ||
314  condition.getType() == esConditionType::Centrality0 ||
315  condition.getType() == esConditionType::Centrality1 ||
316  condition.getType() == esConditionType::Centrality2 ||
317  condition.getType() == esConditionType::Centrality3 ||
318  condition.getType() == esConditionType::Centrality4 ||
319  condition.getType() == esConditionType::Centrality5 ||
320  condition.getType() == esConditionType::Centrality6 ||
321  condition.getType() == esConditionType::Centrality7) {
322  parseEnergySum(condition, chipNr, false);
323 
324  // parse ZDC Energy Sums (NOTE: HI trigger objects are treated as energy sums or counters)
325  } else if (condition.getType() == esConditionType::ZDCPlus ||
326  condition.getType() == esConditionType::ZDCMinus) {
327  parseEnergySumZdc(condition, chipNr, false);
328 
329  //parse AXOL1TL
330  } else if (condition.getType() == esConditionType::Axol1tlTrigger ||
331  condition.getType() == esConditionType::AnomalyDetectionTrigger) {
332  parseAXOL1TL(condition, chipNr);
333 
334  //parse CICADA
335  } else if (condition.getType() == esConditionType::CicadaTrigger) {
336  parseCICADA(condition, chipNr);
337  //parse Muons
338  } else if (condition.getType() == esConditionType::SingleMuon ||
339  condition.getType() == esConditionType::DoubleMuon ||
340  condition.getType() == esConditionType::TripleMuon ||
341  condition.getType() == esConditionType::QuadMuon) {
342  parseMuon(condition, chipNr, false);
343 
344  } else if (condition.getType() == esConditionType::MuonShower0 ||
345  condition.getType() == esConditionType::MuonShower1 ||
346  condition.getType() == esConditionType::MuonShower2 ||
347  condition.getType() == esConditionType::MuonShowerOutOfTime0 ||
348  condition.getType() == esConditionType::MuonShowerOutOfTime1) {
349  parseMuonShower(condition, chipNr, false);
350 
351  //parse Correlation Conditions
352  } else if (condition.getType() == esConditionType::MuonMuonCorrelation ||
353  condition.getType() == esConditionType::MuonEsumCorrelation ||
354  condition.getType() == esConditionType::CaloMuonCorrelation ||
355  condition.getType() == esConditionType::CaloCaloCorrelation ||
356  condition.getType() == esConditionType::CaloEsumCorrelation ||
357  condition.getType() == esConditionType::InvariantMass ||
358  condition.getType() == esConditionType::InvariantMassDeltaR ||
359  condition.getType() == esConditionType::TransverseMass ||
360  condition.getType() == esConditionType::InvariantMassUpt) { // Added for displaced muons
361  parseCorrelation(condition, chipNr);
362 
363  //parse three-body Correlation Conditions
364  } else if (condition.getType() == esConditionType::InvariantMass3) {
365  parseCorrelationThreeBody(condition, chipNr);
366 
367  //parse Externals
368  } else if (condition.getType() == esConditionType::Externals) {
369  parseExternal(condition, chipNr);
370 
371  //parse CorrelationWithOverlapRemoval
372  } else if (condition.getType() == esConditionType::CaloCaloCorrelationOvRm ||
373  condition.getType() == esConditionType::InvariantMassOvRm ||
374  condition.getType() == esConditionType::TransverseMassOvRm ||
375  condition.getType() == esConditionType::DoubleJetOvRm ||
376  condition.getType() == esConditionType::DoubleTauOvRm) {
377  parseCorrelationWithOverlapRemoval(condition, chipNr);
378 
379  } else if (condition.getType() == esConditionType::SingleEgammaOvRm ||
380  condition.getType() == esConditionType::DoubleEgammaOvRm ||
381  condition.getType() == esConditionType::TripleEgammaOvRm ||
382  condition.getType() == esConditionType::QuadEgammaOvRm ||
383  condition.getType() == esConditionType::SingleTauOvRm ||
384  condition.getType() == esConditionType::TripleTauOvRm ||
385  condition.getType() == esConditionType::QuadTauOvRm ||
386  condition.getType() == esConditionType::SingleJetOvRm ||
387  condition.getType() == esConditionType::TripleJetOvRm ||
388  condition.getType() == esConditionType::QuadJetOvRm) {
389  edm::LogError("TriggerMenuParser") << std::endl
390  << "\n SingleEgammaOvRm"
391  << "\n DoubleEgammaOvRm"
392  << "\n TripleEgammaOvRm"
393  << "\n QuadEgammaOvRm"
394  << "\n SingleTauOvRm"
395  << "\n TripleTauOvRm"
396  << "\n QuadTauOvRm"
397  << "\n SingleJetOvRm"
398  << "\n TripleJetOvRm"
399  << "\n QuadJetOvRm"
400  << "\n The above conditions types OvRm are not implemented yet in the "
401  "parser. Please remove alogrithms that "
402  "use this type of condtion from L1T Menu!"
403  << std::endl;
404  }
405 
406  } //if condition is a new one
407  } //loop over conditions
408  } //loop over algorithms
409 
410  return;
411 }
412 
413 //
414 
415 void l1t::TriggerMenuParser::setGtTriggerMenuInterfaceDate(const std::string& val) { m_triggerMenuInterfaceDate = val; }
416 
418  m_triggerMenuInterfaceAuthor = val;
419 }
420 
422  m_triggerMenuInterfaceDescription = val;
423 }
424 
426 
427 void l1t::TriggerMenuParser::setGtTriggerMenuAuthor(const std::string& val) { m_triggerMenuAuthor = val; }
428 
429 void l1t::TriggerMenuParser::setGtTriggerMenuDescription(const std::string& val) { m_triggerMenuDescription = val; }
430 
431 void l1t::TriggerMenuParser::setGtAlgorithmImplementation(const std::string& val) { m_algorithmImplementation = val; }
432 
433 // methods for conditions and algorithms
434 
435 // clearMaps - delete all conditions and algorithms in
436 // the maps and clear the maps.
438  // loop over condition maps (one map per condition chip)
439  // then loop over conditions in the map
440  for (std::vector<ConditionMap>::iterator itCondOnChip = m_conditionMap.begin(); itCondOnChip != m_conditionMap.end();
441  itCondOnChip++) {
442  // the conditions in the maps are deleted in L1uGtTriggerMenu, not here
443 
444  itCondOnChip->clear();
445  }
446 
447  // the algorithms in the maps are deleted in L1uGtTriggerMenu, not here
448  m_algorithmMap.clear();
449 }
450 
451 // insertConditionIntoMap - safe insert of condition into condition map.
452 // if the condition name already exists, do not insert it and return false
454  std::string cName = cond.condName();
455  LogTrace("TriggerMenuParser") << " Trying to insert condition \"" << cName << "\" in the condition map."
456  << std::endl;
457 
458  // no condition name has to appear twice!
459  if ((m_conditionMap[chipNr]).count(cName) != 0) {
460  LogTrace("TriggerMenuParser") << " Condition " << cName << " already exists - not inserted!" << std::endl;
461  return false;
462  }
463 
464  (m_conditionMap[chipNr])[cName] = &cond;
465  LogTrace("TriggerMenuParser") << " OK - condition inserted!" << std::endl;
466 
467  return true;
468 }
469 
470 // insert an algorithm into algorithm map
472  std::string algName = alg.algoName();
473  const std::string& algAlias = alg.algoAlias();
474  //LogTrace("TriggerMenuParser")
475  //<< " Trying to insert algorithm \"" << algName << "\" in the algorithm map." ;
476 
477  // no algorithm name has to appear twice!
478  if (m_algorithmMap.count(algName) != 0) {
479  LogTrace("TriggerMenuParser") << " Algorithm \"" << algName
480  << "\"already exists in the algorithm map- not inserted!" << std::endl;
481  return false;
482  }
483 
484  if (m_algorithmAliasMap.count(algAlias) != 0) {
485  LogTrace("TriggerMenuParser") << " Algorithm alias \"" << algAlias
486  << "\"already exists in the algorithm alias map- not inserted!" << std::endl;
487  return false;
488  }
489 
490  // bit number less than zero or greater than maximum number of algorithms
491  int bitNumber = alg.algoBitNumber();
492  if ((bitNumber < 0) || (bitNumber >= static_cast<int>(m_numberPhysTriggers))) {
493  LogTrace("TriggerMenuParser") << " Bit number " << bitNumber << " outside allowed range [0, "
494  << m_numberPhysTriggers << ") - algorithm not inserted!" << std::endl;
495  return false;
496  }
497 
498  // maximum number of algorithms
499  if (m_algorithmMap.size() >= m_numberPhysTriggers) {
500  LogTrace("TriggerMenuParser") << " More than maximum allowed " << m_numberPhysTriggers
501  << " algorithms in the algorithm map - not inserted!" << std::endl;
502  return false;
503  }
504 
505  // chip number outside allowed values
506  int chipNr = alg.algoChipNumber(
507  static_cast<int>(m_numberConditionChips), static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
508 
509  if ((chipNr < 0) || (chipNr > static_cast<int>(m_numberConditionChips))) {
510  LogTrace("TriggerMenuParser") << " Chip number " << chipNr << " outside allowed range [0, "
511  << m_numberConditionChips << ") - algorithm not inserted!" << std::endl;
512  return false;
513  }
514 
515  // output pin outside allowed values
516  int outputPin = alg.algoOutputPin(
517  static_cast<int>(m_numberConditionChips), static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
518 
519  if ((outputPin < 0) || (outputPin > static_cast<int>(m_pinsOnConditionChip))) {
520  LogTrace("TriggerMenuParser") << " Output pin " << outputPin << " outside allowed range [0, "
521  << m_pinsOnConditionChip << "] - algorithm not inserted!" << std::endl;
522  return false;
523  }
524 
525  // no two algorithms on the same chip can have the same output pin
526  for (CItAlgo itAlgo = m_algorithmMap.begin(); itAlgo != m_algorithmMap.end(); itAlgo++) {
527  int iPin = (itAlgo->second)
528  .algoOutputPin(static_cast<int>(m_numberConditionChips),
529  static_cast<int>(m_pinsOnConditionChip),
530  m_orderConditionChip);
531  std::string iName = itAlgo->first;
532  int iChip = (itAlgo->second)
533  .algoChipNumber(static_cast<int>(m_numberConditionChips),
534  static_cast<int>(m_pinsOnConditionChip),
535  m_orderConditionChip);
536 
537  if ((outputPin == iPin) && (chipNr == iChip)) {
538  LogTrace("TriggerMenuParser") << " Output pin " << outputPin << " is the same as for algorithm " << iName
539  << "\n from the same chip number " << chipNr << " - algorithm not inserted!"
540  << std::endl;
541  return false;
542  }
543  }
544 
545  // insert algorithm
546  m_algorithmMap[algName] = alg;
547  m_algorithmAliasMap[algAlias] = alg;
548 
549  //LogTrace("TriggerMenuParser")
550  //<< " OK - algorithm inserted!"
551  //<< std::endl;
552 
553  return true;
554 }
555 
556 template <typename T>
558  std::stringstream ss;
559  ss << data;
560  return ss.str();
561 }
563  std::stringstream ss;
564  ss << data;
565  int value;
566  ss >> value;
567  return value;
568 }
569 
577 bool l1t::TriggerMenuParser::parseScales(std::map<std::string, tmeventsetup::esScale> scaleMap) {
578  using namespace tmeventsetup;
579 
580  // Setup ScaleParameter to hold information from parsing
586  GlobalScales::ScaleParameters ettEmScales;
588  GlobalScales::ScaleParameters etmHfScales;
592 
593  // Start by parsing the Scale Map
594  for (std::map<std::string, tmeventsetup::esScale>::const_iterator cit = scaleMap.begin(); cit != scaleMap.end();
595  cit++) {
596  const tmeventsetup::esScale& scale = cit->second;
597 
598  GlobalScales::ScaleParameters* scaleParam;
599  if (scale.getObjectType() == esObjectType::Muon)
600  scaleParam = &muScales;
601  else if (scale.getObjectType() == esObjectType::Egamma)
602  scaleParam = &egScales;
603  else if (scale.getObjectType() == esObjectType::Tau)
604  scaleParam = &tauScales;
605  else if (scale.getObjectType() == esObjectType::Jet)
606  scaleParam = &jetScales;
607  else if (scale.getObjectType() == esObjectType::ETT)
608  scaleParam = &ettScales;
609  else if (scale.getObjectType() == esObjectType::ETTEM)
610  scaleParam = &ettEmScales;
611  else if (scale.getObjectType() == esObjectType::ETM)
612  scaleParam = &etmScales;
613  else if (scale.getObjectType() == esObjectType::ETMHF)
614  scaleParam = &etmHfScales;
615  else if (scale.getObjectType() == esObjectType::HTT)
616  scaleParam = &httScales;
617  else if (scale.getObjectType() == esObjectType::HTM)
618  scaleParam = &htmScales;
619  else if (scale.getObjectType() == esObjectType::ZDCP || scale.getObjectType() == esObjectType::ZDCM)
620  scaleParam = &zdcScales;
621  else
622  scaleParam = nullptr;
623 
624  if (scaleParam != nullptr) {
625  switch (scale.getScaleType()) {
626  case esScaleType::EtScale: {
627  scaleParam->etMin = scale.getMinimum();
628  scaleParam->etMax = scale.getMaximum();
629  scaleParam->etStep = scale.getStep();
630 
631  //Get bin edges
632  const std::vector<tmeventsetup::esBin>& binsV = scale.getBins();
633  for (unsigned int i = 0; i < binsV.size(); i++) {
634  const tmeventsetup::esBin& bin = binsV.at(i);
635  std::pair<double, double> binLimits(bin.minimum, bin.maximum);
636  scaleParam->etBins.push_back(binLimits);
637  }
638 
639  // If this is an energy sum fill dummy values for eta and phi
640  // There are no scales for these in the XML so the other case statements will not be seen....do it here.
641  if (scale.getObjectType() == esObjectType::ETT || scale.getObjectType() == esObjectType::HTT ||
642  scale.getObjectType() == esObjectType::ETM || scale.getObjectType() == esObjectType::HTM ||
643  scale.getObjectType() == esObjectType::ETTEM || scale.getObjectType() == esObjectType::ETMHF) {
644  scaleParam->etaMin = -1.;
645  scaleParam->etaMax = -1.;
646  scaleParam->etaStep = -1.;
647  if (scale.getObjectType() == esObjectType::ETT || scale.getObjectType() == esObjectType::HTT ||
648  scale.getObjectType() == esObjectType::ETTEM) {
649  // if(scale.getObjectType() == esObjectType::ETT || scale.getObjectType() == esObjectType::HTT) {
650  scaleParam->phiMin = -1.;
651  scaleParam->phiMax = -1.;
652  scaleParam->phiStep = -1.;
653  }
654  }
655  } break;
656  case esScaleType::UnconstrainedPtScale: { // Added for displaced muons
657  scaleParam->uptMin = scale.getMinimum();
658  scaleParam->uptMax = scale.getMaximum();
659  scaleParam->uptStep = scale.getStep();
660 
661  //Get bin edges
662  const std::vector<tmeventsetup::esBin>& binsV = scale.getBins();
663  for (unsigned int i = 0; i < binsV.size(); i++) {
664  const tmeventsetup::esBin& bin = binsV.at(i);
665  std::pair<double, double> binLimits(bin.minimum, bin.maximum);
666  scaleParam->uptBins.push_back(binLimits);
667  }
668  } break;
669  case esScaleType::EtaScale: {
670  scaleParam->etaMin = scale.getMinimum();
671  scaleParam->etaMax = scale.getMaximum();
672  scaleParam->etaStep = scale.getStep();
673 
674  //Get bin edges
675  const std::vector<tmeventsetup::esBin>& binsV = scale.getBins();
676  scaleParam->etaBins.resize(pow(2, scale.getNbits()));
677  for (unsigned int i = 0; i < binsV.size(); i++) {
678  const tmeventsetup::esBin& bin = binsV.at(i);
679  std::pair<double, double> binLimits(bin.minimum, bin.maximum);
680  scaleParam->etaBins.at(bin.hw_index) = binLimits;
681  }
682  } break;
683  case esScaleType::PhiScale: {
684  scaleParam->phiMin = scale.getMinimum();
685  scaleParam->phiMax = scale.getMaximum();
686  scaleParam->phiStep = scale.getStep();
687 
688  //Get bin edges
689  const std::vector<tmeventsetup::esBin>& binsV = scale.getBins();
690  scaleParam->phiBins.resize(pow(2, scale.getNbits()));
691  for (unsigned int i = 0; i < binsV.size(); i++) {
692  const tmeventsetup::esBin& bin = binsV.at(i);
693  std::pair<double, double> binLimits(bin.minimum, bin.maximum);
694  scaleParam->phiBins.at(bin.hw_index) = binLimits;
695  }
696  } break;
697  default:
698 
699  break;
700  } //end switch
701  } //end valid scale
702  } //end loop over scaleMap
703 
704  // put the ScaleParameters into the class
705  m_gtScales.setMuonScales(muScales);
706  m_gtScales.setEGScales(egScales);
707  m_gtScales.setTauScales(tauScales);
708  m_gtScales.setJetScales(jetScales);
709  m_gtScales.setETTScales(ettScales);
710  m_gtScales.setETTEmScales(ettEmScales);
711  m_gtScales.setETMScales(etmScales);
712  m_gtScales.setETMHfScales(etmHfScales);
713  m_gtScales.setHTTScales(httScales);
714  m_gtScales.setHTMScales(htmScales);
715  m_gtScales.setHTMScales(zdcScales);
716 
717  // Setup the LUT for the Scale Conversions
718  bool hasPrecision = false;
719  std::map<std::string, unsigned int> precisions;
720  getPrecisions(precisions, scaleMap);
721  for (std::map<std::string, unsigned int>::const_iterator cit = precisions.begin(); cit != precisions.end(); cit++) {
722  hasPrecision = true;
723  }
724 
725  if (hasPrecision) {
726  //Start with the Cal - Muon Eta LUTS
727  //----------------------------------
728  parseCalMuEta_LUTS(scaleMap, "EG", "MU");
729  parseCalMuEta_LUTS(scaleMap, "JET", "MU");
730  parseCalMuEta_LUTS(scaleMap, "TAU", "MU");
731 
732  //Now the Cal - Muon Phi LUTS
733  //-------------------------------------
734  parseCalMuPhi_LUTS(scaleMap, "EG", "MU");
735  parseCalMuPhi_LUTS(scaleMap, "JET", "MU");
736  parseCalMuPhi_LUTS(scaleMap, "TAU", "MU");
737  parseCalMuPhi_LUTS(scaleMap, "HTM", "MU");
738  parseCalMuPhi_LUTS(scaleMap, "ETM", "MU");
739  parseCalMuPhi_LUTS(scaleMap, "ETMHF", "MU");
740 
741  // Now the Pt LUTs (??? more combinations needed ??)
742  // ---------------
743  parsePt_LUTS(scaleMap, "Mass", "EG", precisions["PRECISION-EG-MU-MassPt"]);
744  parsePt_LUTS(scaleMap, "Mass", "MU", precisions["PRECISION-EG-MU-MassPt"]);
745  parseUpt_LUTS(scaleMap, "Mass", "MU", precisions["PRECISION-EG-MU-MassPt"]); // Added for displaced muons
746  parsePt_LUTS(scaleMap, "Mass", "JET", precisions["PRECISION-EG-JET-MassPt"]);
747  parsePt_LUTS(scaleMap, "Mass", "TAU", precisions["PRECISION-EG-TAU-MassPt"]);
748  parsePt_LUTS(scaleMap, "Mass", "ETM", precisions["PRECISION-EG-ETM-MassPt"]);
749  parsePt_LUTS(scaleMap, "Mass", "ETMHF", precisions["PRECISION-EG-ETMHF-MassPt"]);
750  parsePt_LUTS(scaleMap, "Mass", "HTM", precisions["PRECISION-EG-HTM-MassPt"]);
751 
752  // Now the Pt LUTs for TBPT calculation (??? CCLA following what was done for MASS pt LUTs for now ??)
753  // ---------------
754  parsePt_LUTS(scaleMap, "TwoBody", "EG", precisions["PRECISION-EG-MU-TwoBodyPt"]);
755  parsePt_LUTS(scaleMap, "TwoBody", "MU", precisions["PRECISION-EG-MU-TwoBodyPt"]);
756  parsePt_LUTS(scaleMap, "TwoBody", "JET", precisions["PRECISION-EG-JET-TwoBodyPt"]);
757  parsePt_LUTS(scaleMap, "TwoBody", "TAU", precisions["PRECISION-EG-TAU-TwoBodyPt"]);
758  parsePt_LUTS(scaleMap, "TwoBody", "ETM", precisions["PRECISION-EG-ETM-TwoBodyPt"]);
759  parsePt_LUTS(scaleMap, "TwoBody", "ETMHF", precisions["PRECISION-EG-ETMHF-TwoBodyPt"]);
760  parsePt_LUTS(scaleMap, "TwoBody", "HTM", precisions["PRECISION-EG-HTM-TwoBodyPt"]);
761 
762  // Now the Delta Eta/Cosh LUTs (must be done in groups)
763  // ----------------------------------------------------
764  parseDeltaEta_Cosh_LUTS(
765  scaleMap, "EG", "EG", precisions["PRECISION-EG-EG-Delta"], precisions["PRECISION-EG-EG-Math"]);
766  parseDeltaEta_Cosh_LUTS(
767  scaleMap, "EG", "JET", precisions["PRECISION-EG-JET-Delta"], precisions["PRECISION-EG-JET-Math"]);
768  parseDeltaEta_Cosh_LUTS(
769  scaleMap, "EG", "TAU", precisions["PRECISION-EG-TAU-Delta"], precisions["PRECISION-EG-TAU-Math"]);
770  parseDeltaEta_Cosh_LUTS(
771  scaleMap, "EG", "MU", precisions["PRECISION-EG-MU-Delta"], precisions["PRECISION-EG-MU-Math"]);
772 
773  parseDeltaEta_Cosh_LUTS(
774  scaleMap, "JET", "JET", precisions["PRECISION-JET-JET-Delta"], precisions["PRECISION-JET-JET-Math"]);
775  parseDeltaEta_Cosh_LUTS(
776  scaleMap, "JET", "TAU", precisions["PRECISION-JET-TAU-Delta"], precisions["PRECISION-JET-TAU-Math"]);
777  parseDeltaEta_Cosh_LUTS(
778  scaleMap, "JET", "MU", precisions["PRECISION-JET-MU-Delta"], precisions["PRECISION-JET-MU-Math"]);
779 
780  parseDeltaEta_Cosh_LUTS(
781  scaleMap, "TAU", "TAU", precisions["PRECISION-TAU-TAU-Delta"], precisions["PRECISION-TAU-TAU-Math"]);
782  parseDeltaEta_Cosh_LUTS(
783  scaleMap, "TAU", "MU", precisions["PRECISION-TAU-MU-Delta"], precisions["PRECISION-TAU-MU-Math"]);
784 
785  parseDeltaEta_Cosh_LUTS(
786  scaleMap, "MU", "MU", precisions["PRECISION-MU-MU-Delta"], precisions["PRECISION-MU-MU-Math"]);
787 
788  // Now the Delta Phi/Cos LUTs (must be done in groups)
789  // ----------------------------------------------------
790  parseDeltaPhi_Cos_LUTS(
791  scaleMap, "EG", "EG", precisions["PRECISION-EG-EG-Delta"], precisions["PRECISION-EG-EG-Math"]);
792  parseDeltaPhi_Cos_LUTS(
793  scaleMap, "EG", "JET", precisions["PRECISION-EG-JET-Delta"], precisions["PRECISION-EG-JET-Math"]);
794  parseDeltaPhi_Cos_LUTS(
795  scaleMap, "EG", "TAU", precisions["PRECISION-EG-TAU-Delta"], precisions["PRECISION-EG-TAU-Math"]);
796  parseDeltaPhi_Cos_LUTS(
797  scaleMap, "EG", "ETM", precisions["PRECISION-EG-ETM-Delta"], precisions["PRECISION-EG-ETM-Math"]);
798  parseDeltaPhi_Cos_LUTS(
799  scaleMap, "EG", "ETMHF", precisions["PRECISION-EG-ETMHF-Delta"], precisions["PRECISION-EG-ETMHF-Math"]);
800  parseDeltaPhi_Cos_LUTS(
801  scaleMap, "EG", "HTM", precisions["PRECISION-EG-HTM-Delta"], precisions["PRECISION-EG-HTM-Math"]);
802  parseDeltaPhi_Cos_LUTS(
803  scaleMap, "EG", "MU", precisions["PRECISION-EG-MU-Delta"], precisions["PRECISION-EG-MU-Math"]);
804 
805  parseDeltaPhi_Cos_LUTS(
806  scaleMap, "JET", "JET", precisions["PRECISION-JET-JET-Delta"], precisions["PRECISION-JET-JET-Math"]);
807  parseDeltaPhi_Cos_LUTS(
808  scaleMap, "JET", "TAU", precisions["PRECISION-JET-TAU-Delta"], precisions["PRECISION-JET-TAU-Math"]);
809  parseDeltaPhi_Cos_LUTS(
810  scaleMap, "JET", "ETM", precisions["PRECISION-JET-ETM-Delta"], precisions["PRECISION-JET-ETM-Math"]);
811  parseDeltaPhi_Cos_LUTS(
812  scaleMap, "JET", "ETMHF", precisions["PRECISION-JET-ETMHF-Delta"], precisions["PRECISION-JET-ETMHF-Math"]);
813  parseDeltaPhi_Cos_LUTS(
814  scaleMap, "JET", "HTM", precisions["PRECISION-JET-HTM-Delta"], precisions["PRECISION-JET-HTM-Math"]);
815  parseDeltaPhi_Cos_LUTS(
816  scaleMap, "JET", "MU", precisions["PRECISION-JET-MU-Delta"], precisions["PRECISION-JET-MU-Math"]);
817 
818  parseDeltaPhi_Cos_LUTS(
819  scaleMap, "TAU", "TAU", precisions["PRECISION-TAU-TAU-Delta"], precisions["PRECISION-TAU-TAU-Math"]);
820  parseDeltaPhi_Cos_LUTS(
821  scaleMap, "TAU", "ETM", precisions["PRECISION-TAU-ETM-Delta"], precisions["PRECISION-TAU-ETM-Math"]);
822  parseDeltaPhi_Cos_LUTS(
823  scaleMap, "TAU", "ETMHF", precisions["PRECISION-TAU-ETMHF-Delta"], precisions["PRECISION-TAU-ETMHF-Math"]);
824  parseDeltaPhi_Cos_LUTS(
825  scaleMap, "TAU", "HTM", precisions["PRECISION-TAU-HTM-Delta"], precisions["PRECISION-TAU-HTM-Math"]);
826  parseDeltaPhi_Cos_LUTS(
827  scaleMap, "TAU", "MU", precisions["PRECISION-TAU-MU-Delta"], precisions["PRECISION-TAU-MU-Math"]);
828 
829  parseDeltaPhi_Cos_LUTS(
830  scaleMap, "MU", "ETM", precisions["PRECISION-MU-ETM-Delta"], precisions["PRECISION-MU-ETM-Math"]);
831  parseDeltaPhi_Cos_LUTS(
832  scaleMap, "MU", "ETMHF", precisions["PRECISION-MU-ETMHF-Delta"], precisions["PRECISION-MU-ETMHF-Math"]);
833  parseDeltaPhi_Cos_LUTS(
834  scaleMap, "MU", "HTM", precisions["PRECISION-MU-HTM-Delta"], precisions["PRECISION-MU-HTM-Math"]);
835  parseDeltaPhi_Cos_LUTS(
836  scaleMap, "MU", "MU", precisions["PRECISION-MU-MU-Delta"], precisions["PRECISION-MU-MU-Math"]);
837 
838  parsePhi_Trig_LUTS(scaleMap, "EG", l1t::COS, precisions["PRECISION-EG-EG-Math"]);
839  parsePhi_Trig_LUTS(scaleMap, "JET", l1t::COS, precisions["PRECISION-JET-JET-Math"]);
840  parsePhi_Trig_LUTS(scaleMap, "TAU", l1t::COS, precisions["PRECISION-TAU-TAU-Math"]);
841  parsePhi_Trig_LUTS(scaleMap, "MU", l1t::COS, precisions["PRECISION-MU-MU-Math"]);
842 
843  parsePhi_Trig_LUTS(scaleMap, "EG", l1t::SIN, precisions["PRECISION-EG-EG-Math"]);
844  parsePhi_Trig_LUTS(scaleMap, "JET", l1t::SIN, precisions["PRECISION-JET-JET-Math"]);
845  parsePhi_Trig_LUTS(scaleMap, "TAU", l1t::SIN, precisions["PRECISION-TAU-TAU-Math"]);
846  parsePhi_Trig_LUTS(scaleMap, "MU", l1t::SIN, precisions["PRECISION-MU-MU-Math"]);
847 
848  //CCLA
849  //m_gtScales.dumpAllLUTs(std::cout);
850  //m_gtScales.print(std::cout);
851  }
852 
853  return true;
854 }
855 
856 void l1t::TriggerMenuParser::parseCalMuEta_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
857  std::string obj1,
858  std::string obj2) {
859  using namespace tmeventsetup;
860 
861  // First Delta Eta for this set
862  std::string scLabel1 = obj1;
863  scLabel1 += "-ETA";
864  std::string scLabel2 = obj2;
865  scLabel2 += "-ETA";
866 
867  //This LUT does not exist in L1 Menu file, don't fill it
868  if (scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
869  return;
870 
871  const tmeventsetup::esScale* scale1 = &scaleMap.find(scLabel1)->second;
872  const tmeventsetup::esScale* scale2 = &scaleMap.find(scLabel2)->second;
873 
874  std::vector<long long> lut_cal_2_mu_eta;
875  getCaloMuonEtaConversionLut(lut_cal_2_mu_eta, scale1, scale2);
876 
877  std::string lutName = obj1;
878  lutName += "-";
879  lutName += obj2;
880  m_gtScales.setLUT_CalMuEta(lutName, lut_cal_2_mu_eta);
881 }
882 
883 void l1t::TriggerMenuParser::parseCalMuPhi_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
884  std::string obj1,
885  std::string obj2) {
886  using namespace tmeventsetup;
887 
888  // First Delta Eta for this set
889  std::string scLabel1 = obj1;
890  scLabel1 += "-PHI";
891  std::string scLabel2 = obj2;
892  scLabel2 += "-PHI";
893 
894  //This LUT does not exist in L1 Menu file, don't fill it
895  if (scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
896  return;
897 
898  const tmeventsetup::esScale* scale1 = &scaleMap.find(scLabel1)->second;
899  const tmeventsetup::esScale* scale2 = &scaleMap.find(scLabel2)->second;
900 
901  std::vector<long long> lut_cal_2_mu_phi;
902  getCaloMuonPhiConversionLut(lut_cal_2_mu_phi, scale1, scale2);
903 
904  std::string lutName = obj1;
905  lutName += "-";
906  lutName += obj2;
907  m_gtScales.setLUT_CalMuPhi(lutName, lut_cal_2_mu_phi);
908 }
909 
910 void l1t::TriggerMenuParser::parsePt_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
911  std::string lutpfx,
912  std::string obj1,
913  unsigned int prec) {
914  using namespace tmeventsetup;
915 
916  // First Delta Eta for this set
917  std::string scLabel1 = obj1;
918  scLabel1 += "-ET";
919 
920  //This LUT does not exist in L1 Menu file, don't fill it
921  if (scaleMap.find(scLabel1) == scaleMap.end())
922  return;
923 
924  const tmeventsetup::esScale* scale1 = &scaleMap.find(scLabel1)->second;
925 
926  std::vector<long long> lut_pt;
927  getLut(lut_pt, scale1, prec);
928 
929  m_gtScales.setLUT_Pt(lutpfx + "_" + scLabel1, lut_pt, prec);
930 }
931 
932 // Added for displaced muons
933 void l1t::TriggerMenuParser::parseUpt_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
934  std::string lutpfx,
935  std::string obj1,
936  unsigned int prec) {
937  using namespace tmeventsetup;
938 
939  // First Delta Eta for this set
940  std::string scLabel1 = obj1;
941  scLabel1 += "-UPT";
942 
943  //This LUT does not exist in L1 Menu file, don't fill it
944  if (scaleMap.find(scLabel1) == scaleMap.end())
945  return;
946 
947  const tmeventsetup::esScale* scale1 = &scaleMap.find(scLabel1)->second;
948 
949  std::vector<long long> lut_pt;
950  getLut(lut_pt, scale1, prec);
951 
952  m_gtScales.setLUT_Upt(lutpfx + "_" + scLabel1, lut_pt, prec);
953 }
954 
955 void l1t::TriggerMenuParser::parseDeltaEta_Cosh_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
956  std::string obj1,
957  std::string obj2,
958  unsigned int prec1,
959  unsigned int prec2) {
960  using namespace tmeventsetup;
961 
962  // First Delta Eta for this set
963  std::string scLabel1 = obj1;
964  scLabel1 += "-ETA";
965  std::string scLabel2 = obj2;
966  scLabel2 += "-ETA";
967 
968  //This LUT does not exist in L1 Menu file, don't fill it
969  if (scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
970  return;
971 
972  const tmeventsetup::esScale* scale1 = &scaleMap.find(scLabel1)->second;
973  const tmeventsetup::esScale* scale2 = &scaleMap.find(scLabel2)->second;
974  std::vector<double> val_delta_eta;
975  std::vector<long long> lut_delta_eta;
976  size_t n = getDeltaVector(val_delta_eta, scale1, scale2);
977  setLut(lut_delta_eta, val_delta_eta, prec1);
978  std::string lutName = obj1;
979  lutName += "-";
980  lutName += obj2;
981  m_gtScales.setLUT_DeltaEta(lutName, lut_delta_eta, prec1);
982 
983  // Second Get the Cosh for this delta Eta Set
984  std::vector<long long> lut_cosh;
985  applyCosh(val_delta_eta, n);
986  setLut(lut_cosh, val_delta_eta, prec2);
987  m_gtScales.setLUT_Cosh(lutName, lut_cosh, prec2);
988 }
989 
990 void l1t::TriggerMenuParser::parseDeltaPhi_Cos_LUTS(const std::map<std::string, tmeventsetup::esScale>& scaleMap,
991  const std::string& obj1,
992  const std::string& obj2,
993  unsigned int prec1,
994  unsigned int prec2) {
995  using namespace tmeventsetup;
996 
997  // First Delta phi for this set
998  std::string scLabel1 = obj1;
999  scLabel1 += "-PHI";
1000  std::string scLabel2 = obj2;
1001  scLabel2 += "-PHI";
1002 
1003  //This LUT does not exist in L1 Menu file, don't fill it
1004  if (scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
1005  return;
1006 
1007  const tmeventsetup::esScale* scale1 = &scaleMap.find(scLabel1)->second;
1008  const tmeventsetup::esScale* scale2 = &scaleMap.find(scLabel2)->second;
1009  std::vector<double> val_delta_phi;
1010  std::vector<long long> lut_delta_phi;
1011  size_t n = getDeltaVector(val_delta_phi, scale1, scale2);
1012  setLut(lut_delta_phi, val_delta_phi, prec1);
1013  std::string lutName = obj1;
1014  lutName += "-";
1015  lutName += obj2;
1016  m_gtScales.setLUT_DeltaPhi(lutName, lut_delta_phi, prec1);
1017 
1018  // Second Get the Cosh for this delta phi Set
1019  std::vector<long long> lut_cos;
1020  applyCos(val_delta_phi, n);
1021  setLut(lut_cos, val_delta_phi, prec2);
1022  m_gtScales.setLUT_Cos(lutName, lut_cos, prec2);
1023 }
1024 
1025 void l1t::TriggerMenuParser::parsePhi_Trig_LUTS(const std::map<std::string, tmeventsetup::esScale>& scaleMap,
1026  const std::string& obj,
1028  unsigned int prec) {
1029  using namespace tmeventsetup;
1030 
1031  std::string scLabel = obj;
1032  scLabel += "-PHI";
1033 
1034  //This LUT does not exist in L1 Menu file, don't fill it
1035  if (scaleMap.find(scLabel) == scaleMap.end())
1036  return;
1037  if (func != l1t::SIN and func != l1t::COS)
1038  return;
1039 
1040  const tmeventsetup::esScale* scale = &scaleMap.find(scLabel)->second;
1041 
1042  const double step = scale->getStep();
1043  const double range = scale->getMaximum() - scale->getMinimum();
1044  const size_t n = std::ceil(range / step);
1045  const size_t bitwidth = std::ceil(std::log10(n) / std::log10(2));
1046 
1047  std::vector<double> array(std::pow(2, bitwidth), 0);
1048 
1049  for (size_t ii = 0; ii < n; ii++) {
1050  array.at(ii) = step * ii;
1051  }
1052 
1053  const std::string& lutName = obj;
1054  std::vector<long long> lut;
1055  if (func == l1t::SIN) {
1056  applySin(array, n);
1057  setLut(lut, array, prec);
1058  m_gtScales.setLUT_Sin(lutName, lut, prec);
1059  } else if (func == l1t::COS) {
1060  applyCos(array, n);
1061  setLut(lut, array, prec);
1062  m_gtScales.setLUT_Cos(lutName, lut, prec);
1063  }
1064 }
1065 
1077 bool l1t::TriggerMenuParser::parseMuon(L1TUtmCondition condMu, unsigned int chipNr, const bool corrFlag) {
1078  using namespace tmeventsetup;
1079  // get condition, particle name (must be muon) and type name
1080  std::string condition = "muon";
1081  std::string particle = "muon"; //l1t2string( condMu.objectType() );
1082  std::string type = l1t2string(condMu.getType());
1083  std::string name = l1t2string(condMu.getName());
1084  int nrObj = -1;
1085 
1087 
1088  if (condMu.getType() == esConditionType::SingleMuon) {
1089  type = "1_s";
1090  cType = l1t::Type1s;
1091  nrObj = 1;
1092  } else if (condMu.getType() == esConditionType::DoubleMuon) {
1093  type = "2_s";
1094  cType = l1t::Type2s;
1095  nrObj = 2;
1096  } else if (condMu.getType() == esConditionType::TripleMuon) {
1097  type = "3";
1098  cType = l1t::Type3s;
1099  nrObj = 3;
1100  } else if (condMu.getType() == esConditionType::QuadMuon) {
1101  type = "4";
1102  cType = l1t::Type4s;
1103  nrObj = 4;
1104  } else {
1105  edm::LogError("TriggerMenuParser") << "Wrong type for muon-condition (" << type << ")" << std::endl;
1106  return false;
1107  }
1108 
1109  if (nrObj < 0) {
1110  edm::LogError("TriggerMenuParser") << "Unknown type for muon-condition (" << type << ")"
1111  << "\nCan not determine number of trigger objects. " << std::endl;
1112  return false;
1113  }
1114 
1115  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1116  << "\n parseMuon "
1117  << "\n condition = " << condition << "\n particle = " << particle
1118  << "\n type = " << type << "\n name = " << name << std::endl;
1119 
1120  // // get values
1121 
1122  // temporary storage of the parameters
1123  std::vector<MuonTemplate::ObjectParameter> objParameter(nrObj);
1124 
1125  // Do we need this?
1126  MuonTemplate::CorrelationParameter corrParameter;
1127 
1128  // need at least two values for deltaPhi
1129  std::vector<uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1130  tmpValues.reserve(nrObj);
1131 
1132  if (int(condMu.getObjects().size()) != nrObj) {
1133  edm::LogError("TriggerMenuParser") << " condMu objects: nrObj = " << nrObj
1134  << "condMu.getObjects().size() = " << condMu.getObjects().size() << std::endl;
1135  return false;
1136  }
1137 
1138  // Look for cuts on the objects in the condition
1139  unsigned int chargeCorrelation = 1;
1140  const std::vector<L1TUtmCut>& cuts = condMu.getCuts();
1141  for (size_t jj = 0; jj < cuts.size(); jj++) {
1142  const L1TUtmCut& cut = cuts.at(jj);
1143  if (cut.getCutType() == esCutType::ChargeCorrelation) {
1144  if (cut.getData() == "ls")
1145  chargeCorrelation = 2;
1146  else if (cut.getData() == "os")
1147  chargeCorrelation = 4;
1148  else
1149  chargeCorrelation = 1; //ignore correlation
1150  }
1151  }
1152 
1153  //set charge correlation parameter
1154  corrParameter.chargeCorrelation = chargeCorrelation; //tmpValues[0];
1155 
1156  int cnt = 0;
1157 
1158  // BLW TO DO: These needs to the added to the object rather than the whole condition.
1159  int relativeBx = 0;
1160  bool gEq = false;
1161 
1162  // Loop over objects and extract the cuts on the objects
1163  const std::vector<L1TUtmObject>& objects = condMu.getObjects();
1164  for (size_t jj = 0; jj < objects.size(); jj++) {
1165  const L1TUtmObject& object = objects.at(jj);
1166  gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
1167 
1168  // BLW TO DO: This needs to be added to the Object Parameters
1169  relativeBx = object.getBxOffset();
1170 
1171  // Loop over the cuts for this object
1172  int upperUnconstrainedPtInd = -1;
1173  int lowerUnconstrainedPtInd = 0;
1174  int upperImpactParameterInd = -1;
1175  int lowerImpactParameterInd = 0;
1176  int upperThresholdInd = -1;
1177  int lowerThresholdInd = 0;
1178  int upperIndexInd = -1;
1179  int lowerIndexInd = 0;
1180  int cntPhi = 0;
1181  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
1182  int isolationLUT = 0xF; //default is to ignore unless specified.
1183  int impactParameterLUT = 0xF; //default is to ignore unless specified
1184  int charge = -1; //default value is to ignore unless specified
1185  int qualityLUT = 0xFFFF; //default is to ignore unless specified.
1186 
1187  std::vector<MuonTemplate::Window> etaWindows;
1188  std::vector<MuonTemplate::Window> tfMuonIndexWindows;
1189 
1190  const std::vector<L1TUtmCut>& cuts = object.getCuts();
1191  for (size_t kk = 0; kk < cuts.size(); kk++) {
1192  const L1TUtmCut& cut = cuts.at(kk);
1193 
1194  switch (cut.getCutType()) {
1195  case esCutType::UnconstrainedPt:
1196  lowerUnconstrainedPtInd = cut.getMinimum().index;
1197  upperUnconstrainedPtInd = cut.getMaximum().index;
1198  break;
1199 
1200  case esCutType::ImpactParameter:
1201  lowerImpactParameterInd = cut.getMinimum().index;
1202  upperImpactParameterInd = cut.getMaximum().index;
1203  impactParameterLUT = l1tstr2int(cut.getData());
1204  break;
1205 
1206  case esCutType::Threshold:
1207  lowerThresholdInd = cut.getMinimum().index;
1208  upperThresholdInd = cut.getMaximum().index;
1209  break;
1210 
1211  case esCutType::Slice:
1212  lowerIndexInd = int(cut.getMinimum().value);
1213  upperIndexInd = int(cut.getMaximum().value);
1214  break;
1215 
1216  case esCutType::Eta: {
1217  if (etaWindows.size() < 5) {
1218  etaWindows.push_back({cut.getMinimum().index, cut.getMaximum().index});
1219  } else {
1220  edm::LogError("TriggerMenuParser")
1221  << "Too Many Eta Cuts for muon-condition (" << particle << ")" << std::endl;
1222  return false;
1223  }
1224  } break;
1225 
1226  case esCutType::Phi: {
1227  if (cntPhi == 0) {
1228  phiWindow1Lower = cut.getMinimum().index;
1229  phiWindow1Upper = cut.getMaximum().index;
1230  } else if (cntPhi == 1) {
1231  phiWindow2Lower = cut.getMinimum().index;
1232  phiWindow2Upper = cut.getMaximum().index;
1233  } else {
1234  edm::LogError("TriggerMenuParser")
1235  << "Too Many Phi Cuts for muon-condition (" << particle << ")" << std::endl;
1236  return false;
1237  }
1238  cntPhi++;
1239 
1240  } break;
1241 
1242  case esCutType::Charge:
1243  if (cut.getData() == "positive")
1244  charge = 0;
1245  else if (cut.getData() == "negative")
1246  charge = 1;
1247  else
1248  charge = -1;
1249  break;
1250  case esCutType::Quality:
1251 
1252  qualityLUT = l1tstr2int(cut.getData());
1253 
1254  break;
1255  case esCutType::Isolation: {
1256  isolationLUT = l1tstr2int(cut.getData());
1257 
1258  } break;
1259 
1260  case esCutType::Index: {
1261  tfMuonIndexWindows.push_back({cut.getMinimum().index, cut.getMaximum().index});
1262  } break;
1263 
1264  default:
1265  break;
1266  } //end switch
1267 
1268  } //end loop over cuts
1269 
1270  // Set the parameter cuts
1271  objParameter[cnt].unconstrainedPtHigh = upperUnconstrainedPtInd;
1272  objParameter[cnt].unconstrainedPtLow = lowerUnconstrainedPtInd;
1273  objParameter[cnt].impactParameterHigh = upperImpactParameterInd;
1274  objParameter[cnt].impactParameterLow = lowerImpactParameterInd;
1275  objParameter[cnt].impactParameterLUT = impactParameterLUT;
1276 
1277  objParameter[cnt].ptHighThreshold = upperThresholdInd;
1278  objParameter[cnt].ptLowThreshold = lowerThresholdInd;
1279 
1280  objParameter[cnt].indexHigh = upperIndexInd;
1281  objParameter[cnt].indexLow = lowerIndexInd;
1282 
1283  objParameter[cnt].etaWindows = etaWindows;
1284 
1285  objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
1286  objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
1287  objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
1288  objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
1289 
1290  // BLW TO DO: Do we need these anymore? Drop them?
1291  objParameter[cnt].enableMip = false; //tmpMip[i];
1292  objParameter[cnt].enableIso = false; //tmpEnableIso[i];
1293  objParameter[cnt].requestIso = false; //tmpRequestIso[i];
1294 
1295  objParameter[cnt].charge = charge;
1296  objParameter[cnt].qualityLUT = qualityLUT;
1297  objParameter[cnt].isolationLUT = isolationLUT;
1298 
1299  objParameter[cnt].tfMuonIndexWindows = tfMuonIndexWindows;
1300 
1301  cnt++;
1302  } //end loop over objects
1303 
1304  // object types - all muons
1305  std::vector<GlobalObject> objType(nrObj, gtMu);
1306 
1307  // now create a new CondMuonition
1308  MuonTemplate muonCond(name);
1309 
1310  muonCond.setCondType(cType);
1311  muonCond.setObjectType(objType);
1312  muonCond.setCondGEq(gEq);
1313  muonCond.setCondChipNr(chipNr);
1314  muonCond.setCondRelativeBx(relativeBx);
1315 
1316  muonCond.setConditionParameter(objParameter, corrParameter);
1317 
1318  if (edm::isDebugEnabled()) {
1319  std::ostringstream myCoutStream;
1320  muonCond.print(myCoutStream);
1321  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
1322  }
1323 
1324  // insert condition into the map and into muon template vector
1325  if (!insertConditionIntoMap(muonCond, chipNr)) {
1326  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
1327  return false;
1328  } else {
1329  LogDebug("TriggerMenuParser") << "Added Condition " << name << " to the ConditionMap" << std::endl;
1330  if (corrFlag) {
1331  (m_corMuonTemplate[chipNr]).push_back(muonCond);
1332  } else {
1333  LogDebug("TriggerMenuParser") << "Added Condition " << name << " to the vecMuonTemplate vector" << std::endl;
1334  (m_vecMuonTemplate[chipNr]).push_back(muonCond);
1335  }
1336  }
1337 
1338  //
1339  return true;
1340 }
1341 
1342 bool l1t::TriggerMenuParser::parseMuonCorr(const L1TUtmObject* corrMu, unsigned int chipNr) {
1343  // XERCES_CPP_NAMESPACE_USE
1344  using namespace tmeventsetup;
1345 
1346  // get condition, particle name (must be muon) and type name
1347  std::string condition = "muon";
1348  std::string particle = "muon"; //l1t2string( condMu.objectType() );
1349  std::string type = l1t2string(corrMu->getType());
1350  std::string name = l1t2string(corrMu->getName());
1351  int nrObj = 1;
1352  type = "1_s";
1353  GtConditionType cType = l1t::Type1s;
1354 
1355  if (nrObj < 0) {
1356  edm::LogError("TriggerMenuParser") << "Unknown type for muon-condition (" << type << ")"
1357  << "\nCan not determine number of trigger objects. " << std::endl;
1358  return false;
1359  }
1360 
1361  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1362  << "\n parseMuon "
1363  << "\n condition = " << condition << "\n particle = " << particle
1364  << "\n type = " << type << "\n name = " << name << std::endl;
1365 
1366  // // get values
1367 
1368  // temporary storage of the parameters
1369  std::vector<MuonTemplate::ObjectParameter> objParameter(nrObj);
1370 
1371  // Do we need this?
1372  MuonTemplate::CorrelationParameter corrParameter;
1373 
1374  // need at least two values for deltaPhi
1375  std::vector<uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1376  tmpValues.reserve(nrObj);
1377 
1378  // BLW TO DO: How do we deal with these in the new format
1379  // std::string str_chargeCorrelation = l1t2string( condMu.requestedChargeCorr() );
1380  std::string str_chargeCorrelation = "ig";
1381  unsigned int chargeCorrelation = 0;
1382  if (str_chargeCorrelation == "ig")
1383  chargeCorrelation = 1;
1384  else if (str_chargeCorrelation == "ls")
1385  chargeCorrelation = 2;
1386  else if (str_chargeCorrelation == "os")
1387  chargeCorrelation = 4;
1388 
1389  //getXMLHexTextValue("1", dst);
1390  corrParameter.chargeCorrelation = chargeCorrelation; //tmpValues[0];
1391 
1392  // BLW TO DO: These needs to the added to the object rather than the whole condition.
1393  int relativeBx = 0;
1394  bool gEq = false;
1395 
1396  //const esObject* object = condMu;
1397  gEq = (corrMu->getComparisonOperator() == esComparisonOperator::GE);
1398 
1399  // BLW TO DO: This needs to be added to the Object Parameters
1400  relativeBx = corrMu->getBxOffset();
1401 
1402  // Loop over the cuts for this object
1403  int upperUnconstrainedPtInd = -1; // Added for displaced muons
1404  int lowerUnconstrainedPtInd = 0; // Added for displaced muons
1405  int upperImpactParameterInd = -1; // Added for displaced muons
1406  int lowerImpactParameterInd = 0; // Added for displaced muons
1407  int impactParameterLUT = 0xF; // Added for displaced muons, default is to ignore unless specified
1408  int upperThresholdInd = -1;
1409  int lowerThresholdInd = 0;
1410  int upperIndexInd = -1;
1411  int lowerIndexInd = 0;
1412  int cntPhi = 0;
1413  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
1414  int isolationLUT = 0xF; //default is to ignore unless specified.
1415  int charge = -1; //defaut is to ignore unless specified
1416  int qualityLUT = 0xFFFF; //default is to ignore unless specified.
1417 
1418  std::vector<MuonTemplate::Window> etaWindows;
1419  std::vector<MuonTemplate::Window> tfMuonIndexWindows;
1420 
1421  const std::vector<L1TUtmCut>& cuts = corrMu->getCuts();
1422  for (size_t kk = 0; kk < cuts.size(); kk++) {
1423  const L1TUtmCut& cut = cuts.at(kk);
1424 
1425  switch (cut.getCutType()) {
1426  case esCutType::UnconstrainedPt: // Added for displaced muons
1427  lowerUnconstrainedPtInd = cut.getMinimum().index;
1428  upperUnconstrainedPtInd = cut.getMaximum().index;
1429  break;
1430 
1431  case esCutType::ImpactParameter: // Added for displaced muons
1432  lowerImpactParameterInd = cut.getMinimum().index;
1433  upperImpactParameterInd = cut.getMaximum().index;
1434  impactParameterLUT = l1tstr2int(cut.getData());
1435  break;
1436 
1437  case esCutType::Threshold:
1438  lowerThresholdInd = cut.getMinimum().index;
1439  upperThresholdInd = cut.getMaximum().index;
1440  break;
1441 
1442  case esCutType::Slice:
1443  lowerIndexInd = int(cut.getMinimum().value);
1444  upperIndexInd = int(cut.getMaximum().value);
1445  break;
1446 
1447  case esCutType::Eta: {
1448  if (etaWindows.size() < 5) {
1449  etaWindows.push_back({cut.getMinimum().index, cut.getMaximum().index});
1450  } else {
1451  edm::LogError("TriggerMenuParser")
1452  << "Too Many Eta Cuts for muon-condition (" << particle << ")" << std::endl;
1453  return false;
1454  }
1455  } break;
1456 
1457  case esCutType::Phi: {
1458  if (cntPhi == 0) {
1459  phiWindow1Lower = cut.getMinimum().index;
1460  phiWindow1Upper = cut.getMaximum().index;
1461  } else if (cntPhi == 1) {
1462  phiWindow2Lower = cut.getMinimum().index;
1463  phiWindow2Upper = cut.getMaximum().index;
1464  } else {
1465  edm::LogError("TriggerMenuParser")
1466  << "Too Many Phi Cuts for muon-condition (" << particle << ")" << std::endl;
1467  return false;
1468  }
1469  cntPhi++;
1470 
1471  } break;
1472 
1473  case esCutType::Charge:
1474  if (cut.getData() == "positive")
1475  charge = 0;
1476  else if (cut.getData() == "negative")
1477  charge = 1;
1478  else
1479  charge = -1;
1480  break;
1481  case esCutType::Quality:
1482 
1483  qualityLUT = l1tstr2int(cut.getData());
1484 
1485  break;
1486  case esCutType::Isolation: {
1487  isolationLUT = l1tstr2int(cut.getData());
1488 
1489  } break;
1490 
1491  case esCutType::Index: {
1492  tfMuonIndexWindows.push_back({cut.getMinimum().index, cut.getMaximum().index});
1493  } break;
1494 
1495  default:
1496  break;
1497  } //end switch
1498 
1499  } //end loop over cuts
1500 
1501  // Set the parameter cuts
1502  objParameter[0].unconstrainedPtHigh = upperUnconstrainedPtInd; // Added for displacd muons
1503  objParameter[0].unconstrainedPtLow = lowerUnconstrainedPtInd; // Added for displacd muons
1504  objParameter[0].impactParameterHigh = upperImpactParameterInd; // Added for displacd muons
1505  objParameter[0].impactParameterLow = lowerImpactParameterInd; // Added for displacd muons
1506  objParameter[0].impactParameterLUT = impactParameterLUT; // Added for displacd muons
1507 
1508  objParameter[0].ptHighThreshold = upperThresholdInd;
1509  objParameter[0].ptLowThreshold = lowerThresholdInd;
1510 
1511  objParameter[0].indexHigh = upperIndexInd;
1512  objParameter[0].indexLow = lowerIndexInd;
1513 
1514  objParameter[0].etaWindows = etaWindows;
1515 
1516  objParameter[0].phiWindow1Lower = phiWindow1Lower;
1517  objParameter[0].phiWindow1Upper = phiWindow1Upper;
1518  objParameter[0].phiWindow2Lower = phiWindow2Lower;
1519  objParameter[0].phiWindow2Upper = phiWindow2Upper;
1520 
1521  // BLW TO DO: Do we need these anymore? Drop them?
1522  objParameter[0].enableMip = false; //tmpMip[i];
1523  objParameter[0].enableIso = false; //tmpEnableIso[i];
1524  objParameter[0].requestIso = false; //tmpRequestIso[i];
1525 
1526  objParameter[0].charge = charge;
1527  objParameter[0].qualityLUT = qualityLUT;
1528  objParameter[0].isolationLUT = isolationLUT;
1529 
1530  objParameter[0].tfMuonIndexWindows = tfMuonIndexWindows;
1531 
1532  // object types - all muons
1533  std::vector<GlobalObject> objType(nrObj, gtMu);
1534 
1535  // now create a new CondMuonition
1536  MuonTemplate muonCond(name);
1537 
1538  muonCond.setCondType(cType);
1539  muonCond.setObjectType(objType);
1540  muonCond.setCondGEq(gEq);
1541  muonCond.setCondChipNr(chipNr);
1542  muonCond.setCondRelativeBx(relativeBx);
1543  muonCond.setConditionParameter(objParameter, corrParameter);
1544 
1545  if (edm::isDebugEnabled()) {
1546  std::ostringstream myCoutStream;
1547  muonCond.print(myCoutStream);
1548  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
1549  }
1550 
1551  /*
1552  // insert condition into the map and into muon template vector
1553  if ( !insertConditionIntoMap(muonCond, chipNr)) {
1554  edm::LogError("TriggerMenuParser")
1555  << " Error: duplicate condition (" << name << ")"
1556  << std::endl;
1557  return false;
1558  }
1559  else {
1560  LogDebug("TriggerMenuParser") << "Added Condition " << name << " to the ConditionMap" << std::endl;
1561  (m_corMuonTemplate[chipNr]).push_back(muonCond);
1562  }
1563 */
1564  (m_corMuonTemplate[chipNr]).push_back(muonCond);
1565 
1566  //
1567  return true;
1568 }
1569 
1581 bool l1t::TriggerMenuParser::parseMuonShower(L1TUtmCondition condMu, unsigned int chipNr, const bool corrFlag) {
1582  using namespace tmeventsetup;
1583 
1584  // get condition, particle name (must be muon) and type name
1585  std::string condition = "muonShower";
1586  std::string particle = "muonShower"; //l1t2string( condMu.objectType() );
1587  std::string type = l1t2string(condMu.getType());
1588  std::string name = l1t2string(condMu.getName());
1589  // the number of muon shower objects is always 1
1590  int nrObj = 1;
1591 
1592  // condition type is always 1 particle, thus Type1s
1593  GtConditionType cType = l1t::Type1s;
1594 
1595  // temporary storage of the parameters
1596  std::vector<MuonShowerTemplate::ObjectParameter> objParameter(nrObj);
1597 
1598  if (int(condMu.getObjects().size()) != nrObj) {
1599  edm::LogError("TriggerMenuParser") << " condMu objects: nrObj = " << nrObj
1600  << "condMu.getObjects().size() = " << condMu.getObjects().size() << std::endl;
1601  return false;
1602  }
1603 
1604  // Get the muon shower object
1605  L1TUtmObject object = condMu.getObjects().at(0);
1606  int relativeBx = object.getBxOffset();
1607 
1608  if (condMu.getType() == esConditionType::MuonShower0) {
1609  objParameter[0].MuonShower0 = true;
1610  } else if (condMu.getType() == esConditionType::MuonShower1) {
1611  objParameter[0].MuonShower1 = true;
1612  } else if (condMu.getType() == esConditionType::MuonShower2) {
1613  objParameter[0].MuonShower2 = true;
1614  } else if (condMu.getType() == esConditionType::MuonShowerOutOfTime0) {
1615  objParameter[0].MuonShowerOutOfTime0 = true;
1616  } else if (condMu.getType() == esConditionType::MuonShowerOutOfTime1) {
1617  objParameter[0].MuonShowerOutOfTime1 = true;
1618  }
1619 
1620  // object types - all muons
1621  std::vector<GlobalObject> objType(nrObj, gtMuShower);
1622 
1623  // now create a new CondMuonition
1624  MuonShowerTemplate muonShowerCond(name);
1625  muonShowerCond.setCondType(cType);
1626  muonShowerCond.setObjectType(objType);
1627  muonShowerCond.setCondChipNr(chipNr);
1628  muonShowerCond.setCondRelativeBx(relativeBx);
1629 
1630  muonShowerCond.setConditionParameter(objParameter);
1631 
1632  if (edm::isDebugEnabled()) {
1633  std::ostringstream myCoutStream;
1634  muonShowerCond.print(myCoutStream);
1635  }
1636 
1637  // insert condition into the map and into muon template vector
1638  if (!insertConditionIntoMap(muonShowerCond, chipNr)) {
1639  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
1640  return false;
1641  } else {
1642  (m_vecMuonShowerTemplate[chipNr]).push_back(muonShowerCond);
1643  }
1644 
1645  return true;
1646 }
1647 
1659 bool l1t::TriggerMenuParser::parseCalo(L1TUtmCondition condCalo, unsigned int chipNr, const bool corrFlag) {
1660  // XERCES_CPP_NAMESPACE_USE
1661  using namespace tmeventsetup;
1662 
1663  // get condition, particle name and type name
1664 
1665  std::string condition = "calo";
1666  std::string particle = "test-fix";
1667  std::string type = l1t2string(condCalo.getType());
1668  std::string name = l1t2string(condCalo.getName());
1669 
1670  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1671  << "\n (in parseCalo) "
1672  << "\n condition = " << condition << "\n particle = " << particle
1673  << "\n type = " << type << "\n name = " << name << std::endl;
1674 
1676 
1677  // determine object type type
1678  // BLW TO DO: Can this object type wait and be done later in the parsing. Or done differently completely..
1679  GlobalObject caloObjType;
1680  int nrObj = -1;
1681 
1682  if (condCalo.getType() == esConditionType::SingleEgamma) {
1683  caloObjType = gtEG;
1684  type = "1_s";
1685  cType = l1t::Type1s;
1686  nrObj = 1;
1687  } else if (condCalo.getType() == esConditionType::DoubleEgamma) {
1688  caloObjType = gtEG;
1689  type = "2_s";
1690  cType = l1t::Type2s;
1691  nrObj = 2;
1692  } else if (condCalo.getType() == esConditionType::TripleEgamma) {
1693  caloObjType = gtEG;
1694  cType = l1t::Type3s;
1695  type = "3";
1696  nrObj = 3;
1697  } else if (condCalo.getType() == esConditionType::QuadEgamma) {
1698  caloObjType = gtEG;
1699  cType = l1t::Type4s;
1700  type = "4";
1701  nrObj = 4;
1702  } else if (condCalo.getType() == esConditionType::SingleJet) {
1703  caloObjType = gtJet;
1704  cType = l1t::Type1s;
1705  type = "1_s";
1706  nrObj = 1;
1707  } else if (condCalo.getType() == esConditionType::DoubleJet) {
1708  caloObjType = gtJet;
1709  cType = l1t::Type2s;
1710  type = "2_s";
1711  nrObj = 2;
1712  } else if (condCalo.getType() == esConditionType::TripleJet) {
1713  caloObjType = gtJet;
1714  cType = l1t::Type3s;
1715  type = "3";
1716  nrObj = 3;
1717  } else if (condCalo.getType() == esConditionType::QuadJet) {
1718  caloObjType = gtJet;
1719  cType = l1t::Type4s;
1720  type = "4";
1721  nrObj = 4;
1722  } else if (condCalo.getType() == esConditionType::SingleTau) {
1723  caloObjType = gtTau;
1724  cType = l1t::Type1s;
1725  type = "1_s";
1726  nrObj = 1;
1727  } else if (condCalo.getType() == esConditionType::DoubleTau) {
1728  caloObjType = gtTau;
1729  cType = l1t::Type2s;
1730  type = "2_s";
1731  nrObj = 2;
1732  } else if (condCalo.getType() == esConditionType::TripleTau) {
1733  caloObjType = gtTau;
1734  cType = l1t::Type3s;
1735  type = "3";
1736  nrObj = 3;
1737  } else if (condCalo.getType() == esConditionType::QuadTau) {
1738  caloObjType = gtTau;
1739  cType = l1t::Type4s;
1740  type = "4";
1741  nrObj = 4;
1742  } else {
1743  edm::LogError("TriggerMenuParser") << "Wrong particle for calo-condition (" << particle << ")" << std::endl;
1744  return false;
1745  }
1746 
1747  // std::string str_etComparison = l1t2string( condCalo.comparison_operator() );
1748 
1749  if (nrObj < 0) {
1750  edm::LogError("TriggerMenuParser") << "Unknown type for calo-condition (" << type << ")"
1751  << "\nCan not determine number of trigger objects. " << std::endl;
1752  return false;
1753  }
1754 
1755  // get values
1756 
1757  // temporary storage of the parameters
1758  std::vector<CaloTemplate::ObjectParameter> objParameter(nrObj);
1759 
1760  //BLW TO DO: Can this be dropped?
1761  CaloTemplate::CorrelationParameter corrParameter;
1762 
1763  // need at least one value for deltaPhiRange
1764  std::vector<uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1765  tmpValues.reserve(nrObj);
1766 
1767  if (int(condCalo.getObjects().size()) != nrObj) {
1768  edm::LogError("TriggerMenuParser") << " condCalo objects: nrObj = " << nrObj
1769  << "condCalo.getObjects().size() = " << condCalo.getObjects().size()
1770  << std::endl;
1771  return false;
1772  }
1773 
1774  // std::string str_condCalo = "";
1775  // uint64_t tempUIntH, tempUIntL;
1776  // uint64_t dst;
1777  int cnt = 0;
1778 
1779  // BLW TO DO: These needs to the added to the object rather than the whole condition.
1780  int relativeBx = 0;
1781  bool gEq = false;
1782 
1783  // Loop over objects and extract the cuts on the objects
1784  const std::vector<L1TUtmObject>& objects = condCalo.getObjects();
1785  for (size_t jj = 0; jj < objects.size(); jj++) {
1786  const L1TUtmObject& object = objects.at(jj);
1787  gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
1788 
1789  // BLW TO DO: This needs to be added to the Object Parameters
1790  relativeBx = object.getBxOffset();
1791 
1792  // Loop over the cuts for this object
1793  int upperThresholdInd = -1;
1794  int lowerThresholdInd = 0;
1795  int upperIndexInd = -1;
1796  int lowerIndexInd = 0;
1797  int cntPhi = 0;
1798  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
1799  int isolationLUT = 0xF; //default is to ignore isolation unless specified.
1800  int qualityLUT = 0xF; //default is to ignore quality unless specified.
1801  int displacedLUT = 0x0; // Added for LLP Jets: single bit LUT: { 0 = noLLP default, 1 = LLP }
1802  // Note: Currently assumes that the LSB from hwQual() getter in L1Candidate provides the
1803  // (single bit) information for the displacedLUT
1804 
1805  std::vector<CaloTemplate::Window> etaWindows;
1806 
1807  const std::vector<L1TUtmCut>& cuts = object.getCuts();
1808  for (size_t kk = 0; kk < cuts.size(); kk++) {
1809  const L1TUtmCut& cut = cuts.at(kk);
1810 
1811  switch (cut.getCutType()) {
1812  case esCutType::Threshold:
1813  lowerThresholdInd = cut.getMinimum().index;
1814  upperThresholdInd = cut.getMaximum().index;
1815  break;
1816  case esCutType::Slice:
1817  lowerIndexInd = int(cut.getMinimum().value);
1818  upperIndexInd = int(cut.getMaximum().value);
1819  break;
1820  case esCutType::Eta: {
1821  if (etaWindows.size() < 5) {
1822  etaWindows.push_back({cut.getMinimum().index, cut.getMaximum().index});
1823  } else {
1824  edm::LogError("TriggerMenuParser")
1825  << "Too Many Eta Cuts for calo-condition (" << particle << ")" << std::endl;
1826  return false;
1827  }
1828  } break;
1829 
1830  case esCutType::Phi: {
1831  if (cntPhi == 0) {
1832  phiWindow1Lower = cut.getMinimum().index;
1833  phiWindow1Upper = cut.getMaximum().index;
1834  } else if (cntPhi == 1) {
1835  phiWindow2Lower = cut.getMinimum().index;
1836  phiWindow2Upper = cut.getMaximum().index;
1837  } else {
1838  edm::LogError("TriggerMenuParser")
1839  << "Too Many Phi Cuts for calo-condition (" << particle << ")" << std::endl;
1840  return false;
1841  }
1842  cntPhi++;
1843 
1844  } break;
1845 
1846  case esCutType::Charge: {
1847  edm::LogError("TriggerMenuParser") << "No charge cut for calo-condition (" << particle << ")" << std::endl;
1848  return false;
1849 
1850  } break;
1851  case esCutType::Quality: {
1852  qualityLUT = l1tstr2int(cut.getData());
1853 
1854  } break;
1855  case esCutType::Displaced: { // Added for LLP Jets
1856  displacedLUT = l1tstr2int(cut.getData());
1857 
1858  } break;
1859  case esCutType::Isolation: {
1860  isolationLUT = l1tstr2int(cut.getData());
1861 
1862  } break;
1863  default:
1864  break;
1865  } //end switch
1866 
1867  } //end loop over cuts
1868 
1869  // Fill the object parameters
1870  objParameter[cnt].etHighThreshold = upperThresholdInd;
1871  objParameter[cnt].etLowThreshold = lowerThresholdInd;
1872  objParameter[cnt].indexHigh = upperIndexInd;
1873  objParameter[cnt].indexLow = lowerIndexInd;
1874  objParameter[cnt].etaWindows = etaWindows;
1875  objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
1876  objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
1877  objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
1878  objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
1879  objParameter[cnt].isolationLUT = isolationLUT;
1880  objParameter[cnt].qualityLUT = qualityLUT; //TO DO: Must add
1881  objParameter[cnt].displacedLUT = displacedLUT; // Added for LLP Jets
1882 
1883  // Output for debugging
1884  {
1885  std::ostringstream oss;
1886  oss << "\n Calo ET high thresholds (hex) for calo object " << caloObjType << " " << cnt << " = " << std::hex
1887  << objParameter[cnt].etLowThreshold << " - " << objParameter[cnt].etHighThreshold;
1888  for (const auto& window : objParameter[cnt].etaWindows) {
1889  oss << "\n etaWindow Lower / Upper for calo object " << cnt << " = 0x" << window.lower << " / 0x"
1890  << window.upper;
1891  }
1892  oss << "\n phiWindow Lower / Upper for calo object " << cnt << " = 0x" << objParameter[cnt].phiWindow1Lower
1893  << " / 0x" << objParameter[cnt].phiWindow1Upper << "\n phiWindowVeto Lower / Upper for calo object "
1894  << cnt << " = 0x" << objParameter[cnt].phiWindow2Lower << " / 0x" << objParameter[cnt].phiWindow2Upper
1895  << "\n Isolation LUT for calo object " << cnt << " = 0x" << objParameter[cnt].isolationLUT
1896  << "\n Quality LUT for calo object " << cnt << " = 0x" << objParameter[cnt].qualityLUT
1897  << "\n LLP DISP LUT for calo object " << cnt << " = 0x" << objParameter[cnt].displacedLUT;
1898  LogDebug("TriggerMenuParser") << oss.str() << std::endl;
1899  }
1900 
1901  cnt++;
1902  } //end loop over objects
1903 
1904  // object types - all same caloObjType
1905  std::vector<GlobalObject> objType(nrObj, caloObjType);
1906 
1907  // now create a new calo condition
1908  CaloTemplate caloCond(name);
1909 
1910  caloCond.setCondType(cType);
1911  caloCond.setObjectType(objType);
1912 
1913  //BLW TO DO: This needs to be added to the object rather than the whole condition
1914  caloCond.setCondGEq(gEq);
1915  caloCond.setCondChipNr(chipNr);
1916 
1917  //BLW TO DO: This needs to be added to the object rather than the whole condition
1918  caloCond.setCondRelativeBx(relativeBx);
1919 
1920  caloCond.setConditionParameter(objParameter, corrParameter);
1921 
1922  if (edm::isDebugEnabled()) {
1923  std::ostringstream myCoutStream;
1924  caloCond.print(myCoutStream);
1925  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
1926  }
1927 
1928  // insert condition into the map
1929  if (!insertConditionIntoMap(caloCond, chipNr)) {
1930  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
1931 
1932  return false;
1933  } else {
1934  if (corrFlag) {
1935  (m_corCaloTemplate[chipNr]).push_back(caloCond);
1936  } else {
1937  (m_vecCaloTemplate[chipNr]).push_back(caloCond);
1938  }
1939  }
1940 
1941  //
1942  return true;
1943 }
1944 
1956 bool l1t::TriggerMenuParser::parseCaloCorr(const L1TUtmObject* corrCalo, unsigned int chipNr) {
1957  // XERCES_CPP_NAMESPACE_USE
1958  using namespace tmeventsetup;
1959 
1960  // get condition, particle name and type name
1961 
1962  std::string condition = "calo";
1963  std::string particle = "test-fix";
1964  std::string type = l1t2string(corrCalo->getType());
1965  std::string name = l1t2string(corrCalo->getName());
1966 
1967  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1968  << "\n (in parseCalo) "
1969  << "\n condition = " << condition << "\n particle = " << particle
1970  << "\n type = " << type << "\n name = " << name << std::endl;
1971 
1972  // determine object type type
1973  // BLW TO DO: Can this object type wait and be done later in the parsing. Or done differently completely..
1974  GlobalObject caloObjType;
1975  int nrObj = 1;
1976  type = "1_s";
1977  GtConditionType cType = l1t::Type1s;
1978 
1979  if (corrCalo->getType() == esObjectType::Egamma) {
1980  caloObjType = gtEG;
1981  } else if (corrCalo->getType() == esObjectType::Jet) {
1982  caloObjType = gtJet;
1983  } else if (corrCalo->getType() == esObjectType::Tau) {
1984  caloObjType = gtTau;
1985  } else {
1986  edm::LogError("TriggerMenuParser") << "Wrong particle for calo-condition (" << particle << ")" << std::endl;
1987  return false;
1988  }
1989 
1990  // std::string str_etComparison = l1t2string( condCalo.comparison_operator() );
1991 
1992  if (nrObj < 0) {
1993  edm::LogError("TriggerMenuParser") << "Unknown type for calo-condition (" << type << ")"
1994  << "\nCan not determine number of trigger objects. " << std::endl;
1995  return false;
1996  }
1997 
1998  // get values
1999 
2000  // temporary storage of the parameters
2001  std::vector<CaloTemplate::ObjectParameter> objParameter(nrObj);
2002 
2003  //BLW TO DO: Can this be dropped?
2004  CaloTemplate::CorrelationParameter corrParameter;
2005 
2006  // need at least one value for deltaPhiRange
2007  std::vector<uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
2008  tmpValues.reserve(nrObj);
2009 
2010  // BLW TO DO: These needs to the added to the object rather than the whole condition.
2011  int relativeBx = 0;
2012  bool gEq = false;
2013 
2014  gEq = (corrCalo->getComparisonOperator() == esComparisonOperator::GE);
2015 
2016  // BLW TO DO: This needs to be added to the Object Parameters
2017  relativeBx = corrCalo->getBxOffset();
2018 
2019  // Loop over the cuts for this object
2020  int upperThresholdInd = -1;
2021  int lowerThresholdInd = 0;
2022  int upperIndexInd = -1;
2023  int lowerIndexInd = 0;
2024  int cntPhi = 0;
2025  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
2026  int isolationLUT = 0xF; //default is to ignore isolation unless specified.
2027  int qualityLUT = 0xF; //default is to ignore quality unless specified.
2028  int displacedLUT = 0x0; // Added for LLP Jets: single bit LUT: { 0 = noLLP default, 1 = LLP }
2029  // Note: Currently assume that the hwQual() getter in L1Candidate provides the
2030  // (single bit) information for the displacedLUT
2031 
2032  std::vector<CaloTemplate::Window> etaWindows;
2033 
2034  const std::vector<L1TUtmCut>& cuts = corrCalo->getCuts();
2035  for (size_t kk = 0; kk < cuts.size(); kk++) {
2036  const L1TUtmCut& cut = cuts.at(kk);
2037 
2038  switch (cut.getCutType()) {
2039  case esCutType::Threshold:
2040  lowerThresholdInd = cut.getMinimum().index;
2041  upperThresholdInd = cut.getMaximum().index;
2042  break;
2043  case esCutType::Slice:
2044  lowerIndexInd = int(cut.getMinimum().value);
2045  upperIndexInd = int(cut.getMaximum().value);
2046  break;
2047  case esCutType::Eta: {
2048  if (etaWindows.size() < 5) {
2049  etaWindows.push_back({cut.getMinimum().index, cut.getMaximum().index});
2050  } else {
2051  edm::LogError("TriggerMenuParser")
2052  << "Too Many Eta Cuts for calo-condition (" << particle << ")" << std::endl;
2053  return false;
2054  }
2055  } break;
2056 
2057  case esCutType::Phi: {
2058  if (cntPhi == 0) {
2059  phiWindow1Lower = cut.getMinimum().index;
2060  phiWindow1Upper = cut.getMaximum().index;
2061  } else if (cntPhi == 1) {
2062  phiWindow2Lower = cut.getMinimum().index;
2063  phiWindow2Upper = cut.getMaximum().index;
2064  } else {
2065  edm::LogError("TriggerMenuParser")
2066  << "Too Many Phi Cuts for calo-condition (" << particle << ")" << std::endl;
2067  return false;
2068  }
2069  cntPhi++;
2070 
2071  } break;
2072 
2073  case esCutType::Charge: {
2074  edm::LogError("TriggerMenuParser") << "No charge cut for calo-condition (" << particle << ")" << std::endl;
2075  return false;
2076 
2077  } break;
2078  case esCutType::Quality: {
2079  qualityLUT = l1tstr2int(cut.getData());
2080 
2081  } break;
2082  case esCutType::Displaced: { // Added for LLP Jets
2083  displacedLUT = l1tstr2int(cut.getData());
2084 
2085  } break;
2086  case esCutType::Isolation: {
2087  isolationLUT = l1tstr2int(cut.getData());
2088 
2089  } break;
2090  default:
2091  break;
2092  } //end switch
2093 
2094  } //end loop over cuts
2095 
2096  // Fill the object parameters
2097  objParameter[0].etLowThreshold = lowerThresholdInd;
2098  objParameter[0].etHighThreshold = upperThresholdInd;
2099  objParameter[0].indexHigh = upperIndexInd;
2100  objParameter[0].indexLow = lowerIndexInd;
2101  objParameter[0].etaWindows = etaWindows;
2102  objParameter[0].phiWindow1Lower = phiWindow1Lower;
2103  objParameter[0].phiWindow1Upper = phiWindow1Upper;
2104  objParameter[0].phiWindow2Lower = phiWindow2Lower;
2105  objParameter[0].phiWindow2Upper = phiWindow2Upper;
2106  objParameter[0].isolationLUT = isolationLUT;
2107  objParameter[0].qualityLUT = qualityLUT; //TO DO: Must add
2108  objParameter[0].displacedLUT = displacedLUT; // Added for LLP Jets
2109 
2110  // Output for debugging
2111  {
2112  std::ostringstream oss;
2113  oss << "\n Calo ET high threshold (hex) for calo object " << caloObjType << " "
2114  << " = " << std::hex << objParameter[0].etLowThreshold << " - " << objParameter[0].etHighThreshold;
2115  for (const auto& window : objParameter[0].etaWindows) {
2116  oss << "\n etaWindow Lower / Upper for calo object "
2117  << " = 0x" << window.lower << " / 0x" << window.upper;
2118  }
2119  oss << "\n phiWindow Lower / Upper for calo object "
2120  << " = 0x" << objParameter[0].phiWindow1Lower << " / 0x" << objParameter[0].phiWindow1Upper
2121  << "\n phiWindowVeto Lower / Upper for calo object "
2122  << " = 0x" << objParameter[0].phiWindow2Lower << " / 0x" << objParameter[0].phiWindow2Upper
2123  << "\n Isolation LUT for calo object "
2124  << " = 0x" << objParameter[0].isolationLUT << "\n Quality LUT for calo object "
2125  << " = 0x" << objParameter[0].qualityLUT << "\n LLP DISP LUT for calo object "
2126  << " = 0x" << objParameter[0].displacedLUT;
2127  LogDebug("TriggerMenuParser") << oss.str() << std::endl;
2128  }
2129 
2130  // object types - all same caloObjType
2131  std::vector<GlobalObject> objType(nrObj, caloObjType);
2132 
2133  // now create a new calo condition
2134  CaloTemplate caloCond(name);
2135 
2136  caloCond.setCondType(cType);
2137  caloCond.setObjectType(objType);
2138 
2139  //BLW TO DO: This needs to be added to the object rather than the whole condition
2140  caloCond.setCondGEq(gEq);
2141  caloCond.setCondChipNr(chipNr);
2142 
2143  //BLW TO DO: This needs to be added to the object rather than the whole condition
2144  caloCond.setCondRelativeBx(relativeBx);
2145 
2146  caloCond.setConditionParameter(objParameter, corrParameter);
2147 
2148  if (edm::isDebugEnabled()) {
2149  std::ostringstream myCoutStream;
2150  caloCond.print(myCoutStream);
2151  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2152  }
2153 
2154  /*
2155  // insert condition into the map
2156  if ( !insertConditionIntoMap(caloCond, chipNr)) {
2157 
2158  edm::LogError("TriggerMenuParser")
2159  << " Error: duplicate condition (" << name << ")"
2160  << std::endl;
2161 
2162  return false;
2163  }
2164  else {
2165  (m_corCaloTemplate[chipNr]).push_back(caloCond);
2166  }
2167 */
2168  (m_corCaloTemplate[chipNr]).push_back(caloCond);
2169 
2170  //
2171  return true;
2172 }
2173 
2185 bool l1t::TriggerMenuParser::parseEnergySum(L1TUtmCondition condEnergySum, unsigned int chipNr, const bool corrFlag) {
2186  // XERCES_CPP_NAMESPACE_USE
2187  using namespace tmeventsetup;
2188 
2189  // get condition, particle name and type name
2190 
2191  std::string condition = "calo";
2192  std::string type = l1t2string(condEnergySum.getType());
2193  std::string name = l1t2string(condEnergySum.getName());
2194 
2195  LogDebug("TriggerMenuParser") << "\n ****************************************** "
2196  << "\n (in parseEnergySum) "
2197  << "\n condition = " << condition << "\n type = " << type
2198  << "\n name = " << name << std::endl;
2199 
2200  // determine object type type
2201  GlobalObject energySumObjType;
2202  GtConditionType cType;
2203 
2204  if (condEnergySum.getType() == esConditionType::MissingEt) {
2205  energySumObjType = GlobalObject::gtETM;
2206  cType = TypeETM;
2207  } else if (condEnergySum.getType() == esConditionType::TotalEt) {
2208  energySumObjType = GlobalObject::gtETT;
2209  cType = TypeETT;
2210  } else if (condEnergySum.getType() == esConditionType::TotalEtEM) {
2211  energySumObjType = GlobalObject::gtETTem;
2212  cType = TypeETTem;
2213  } else if (condEnergySum.getType() == esConditionType::TotalHt) {
2214  energySumObjType = GlobalObject::gtHTT;
2215  cType = TypeHTT;
2216  } else if (condEnergySum.getType() == esConditionType::MissingHt) {
2217  energySumObjType = GlobalObject::gtHTM;
2218  cType = TypeHTM;
2219  } else if (condEnergySum.getType() == esConditionType::MissingEtHF) {
2220  energySumObjType = GlobalObject::gtETMHF;
2221  cType = TypeETMHF;
2222  } else if (condEnergySum.getType() == esConditionType::TowerCount) {
2223  energySumObjType = GlobalObject::gtTowerCount;
2224  cType = TypeTowerCount;
2225  } else if (condEnergySum.getType() == esConditionType::MinBiasHFP0) {
2226  energySumObjType = GlobalObject::gtMinBiasHFP0;
2227  cType = TypeMinBiasHFP0;
2228  } else if (condEnergySum.getType() == esConditionType::MinBiasHFM0) {
2229  energySumObjType = GlobalObject::gtMinBiasHFM0;
2230  cType = TypeMinBiasHFM0;
2231  } else if (condEnergySum.getType() == esConditionType::MinBiasHFP1) {
2232  energySumObjType = GlobalObject::gtMinBiasHFP1;
2233  cType = TypeMinBiasHFP1;
2234  } else if (condEnergySum.getType() == esConditionType::MinBiasHFM1) {
2235  energySumObjType = GlobalObject::gtMinBiasHFM1;
2236  cType = TypeMinBiasHFM1;
2237  } else if (condEnergySum.getType() == esConditionType::AsymmetryEt) {
2238  energySumObjType = GlobalObject::gtAsymmetryEt;
2239  cType = TypeAsymEt;
2240  } else if (condEnergySum.getType() == esConditionType::AsymmetryHt) {
2241  energySumObjType = GlobalObject::gtAsymmetryHt;
2242  cType = TypeAsymHt;
2243  } else if (condEnergySum.getType() == esConditionType::AsymmetryEtHF) {
2244  energySumObjType = GlobalObject::gtAsymmetryEtHF;
2245  cType = TypeAsymEtHF;
2246  } else if (condEnergySum.getType() == esConditionType::AsymmetryHtHF) {
2247  energySumObjType = GlobalObject::gtAsymmetryHtHF;
2248  cType = TypeAsymHtHF;
2249  } else if (condEnergySum.getType() == esConditionType::Centrality0) {
2250  energySumObjType = GlobalObject::gtCentrality0;
2251  cType = TypeCent0;
2252  } else if (condEnergySum.getType() == esConditionType::Centrality1) {
2253  energySumObjType = GlobalObject::gtCentrality1;
2254  cType = TypeCent1;
2255  } else if (condEnergySum.getType() == esConditionType::Centrality2) {
2256  energySumObjType = GlobalObject::gtCentrality2;
2257  cType = TypeCent2;
2258  } else if (condEnergySum.getType() == esConditionType::Centrality3) {
2259  energySumObjType = GlobalObject::gtCentrality3;
2260  cType = TypeCent3;
2261  } else if (condEnergySum.getType() == esConditionType::Centrality4) {
2262  energySumObjType = GlobalObject::gtCentrality4;
2263  cType = TypeCent4;
2264  } else if (condEnergySum.getType() == esConditionType::Centrality5) {
2265  energySumObjType = GlobalObject::gtCentrality5;
2266  cType = TypeCent5;
2267  } else if (condEnergySum.getType() == esConditionType::Centrality6) {
2268  energySumObjType = GlobalObject::gtCentrality6;
2269  cType = TypeCent6;
2270  } else if (condEnergySum.getType() == esConditionType::Centrality7) {
2271  energySumObjType = GlobalObject::gtCentrality7;
2272  cType = TypeCent7;
2273  } else {
2274  edm::LogError("TriggerMenuParser") << "Wrong type for energy-sum condition (" << type << ")" << std::endl;
2275  return false;
2276  }
2277 
2278  // global object
2279  int nrObj = 1;
2280 
2281  // std::string str_etComparison = l1t2string( condEnergySum.comparison_operator() );
2282 
2283  // get values
2284 
2285  // temporary storage of the parameters
2286  std::vector<EnergySumTemplate::ObjectParameter> objParameter(nrObj);
2287 
2288  int cnt = 0;
2289 
2290  // BLW TO DO: These needs to the added to the object rather than the whole condition.
2291  int relativeBx = 0;
2292  bool gEq = false;
2293 
2294  // l1t::EnergySumsObjectRequirement objPar = condEnergySum.objectRequirement();
2295 
2296  // Loop over objects and extract the cuts on the objects
2297  const std::vector<L1TUtmObject>& objects = condEnergySum.getObjects();
2298  for (size_t jj = 0; jj < objects.size(); jj++) {
2299  const L1TUtmObject& object = objects.at(jj);
2300  gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
2301 
2302  // BLW TO DO: This needs to be added to the Object Parameters
2303  relativeBx = object.getBxOffset();
2304 
2305  // Loop over the cuts for this object
2306  int lowerThresholdInd = 0;
2307  int upperThresholdInd = -1;
2308  int cntPhi = 0;
2309  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
2310 
2311  const std::vector<L1TUtmCut>& cuts = object.getCuts();
2312  for (size_t kk = 0; kk < cuts.size(); kk++) {
2313  const L1TUtmCut& cut = cuts.at(kk);
2314 
2315  switch (cut.getCutType()) {
2316  case esCutType::Threshold:
2317  lowerThresholdInd = cut.getMinimum().index;
2318  upperThresholdInd = cut.getMaximum().index;
2319  break;
2320 
2321  case esCutType::Eta:
2322  break;
2323 
2324  case esCutType::Phi: {
2325  if (cntPhi == 0) {
2326  phiWindow1Lower = cut.getMinimum().index;
2327  phiWindow1Upper = cut.getMaximum().index;
2328  } else if (cntPhi == 1) {
2329  phiWindow2Lower = cut.getMinimum().index;
2330  phiWindow2Upper = cut.getMaximum().index;
2331  } else {
2332  edm::LogError("TriggerMenuParser") << "Too Many Phi Cuts for esum-condition (" << type << ")" << std::endl;
2333  return false;
2334  }
2335  cntPhi++;
2336 
2337  } break;
2338 
2339  case esCutType::Count:
2340  lowerThresholdInd = cut.getMinimum().index;
2341  upperThresholdInd = 0xffffff;
2342  break;
2343 
2344  default:
2345  break;
2346  } //end switch
2347 
2348  } //end loop over cuts
2349 
2350  // Fill the object parameters
2351  objParameter[cnt].etLowThreshold = lowerThresholdInd;
2352  objParameter[cnt].etHighThreshold = upperThresholdInd;
2353  objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
2354  objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
2355  objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
2356  objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
2357 
2358  // Output for debugging
2359  LogDebug("TriggerMenuParser") << "\n EnergySum ET high threshold (hex) for energy sum object " << cnt << " = "
2360  << std::hex << objParameter[cnt].etLowThreshold << " - "
2361  << objParameter[cnt].etHighThreshold
2362  << "\n phiWindow Lower / Upper for calo object " << cnt << " = 0x"
2363  << objParameter[cnt].phiWindow1Lower << " / 0x" << objParameter[cnt].phiWindow1Upper
2364  << "\n phiWindowVeto Lower / Upper for calo object " << cnt << " = 0x"
2365  << objParameter[cnt].phiWindow2Lower << " / 0x" << objParameter[cnt].phiWindow2Upper
2366  << std::dec << std::endl;
2367 
2368  cnt++;
2369  } //end loop over objects
2370 
2371  // object types - all same energySumObjType
2372  std::vector<GlobalObject> objType(nrObj, energySumObjType);
2373 
2374  // now create a new energySum condition
2375 
2376  EnergySumTemplate energySumCond(name);
2377 
2378  energySumCond.setCondType(cType);
2379  energySumCond.setObjectType(objType);
2380  energySumCond.setCondGEq(gEq);
2381  energySumCond.setCondChipNr(chipNr);
2382  energySumCond.setCondRelativeBx(relativeBx);
2383 
2384  energySumCond.setConditionParameter(objParameter);
2385 
2386  if (edm::isDebugEnabled()) {
2387  std::ostringstream myCoutStream;
2388  energySumCond.print(myCoutStream);
2389  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2390  }
2391 
2392  // insert condition into the map
2393  if (!insertConditionIntoMap(energySumCond, chipNr)) {
2394  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
2395 
2396  return false;
2397  } else {
2398  if (corrFlag) {
2399  (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2400 
2401  } else {
2402  (m_vecEnergySumTemplate[chipNr]).push_back(energySumCond);
2403  }
2404  }
2405 
2406  //
2407  return true;
2408 }
2409 
2422  unsigned int chipNr,
2423  const bool corrFlag) {
2424  // XERCES_CPP_NAMESPACE_USE
2425  using namespace tmeventsetup;
2426 
2427  // get condition, particle name and type name
2428 
2429  std::string condition = "calo";
2430  std::string type = l1t2string(condEnergySumZdc.getType());
2431  std::string name = l1t2string(condEnergySumZdc.getName());
2432 
2433  LogDebug("TriggerMenuParser")
2434  << "\n ******************************************\n (in parseEnergySumZdc)\n condition = " << condition
2435  << "\n type = " << type << "\n name = " << name;
2436 
2437  // determine object type
2438  GlobalObject energySumObjType;
2439  GtConditionType cType;
2440 
2441  if (condEnergySumZdc.getType() == esConditionType::ZDCPlus) {
2442  LogDebug("TriggerMenuParser") << "ZDC signals: esConditionType::ZDCPlus " << std::endl;
2443  energySumObjType = GlobalObject::gtZDCP;
2444  cType = TypeZDCP;
2445  } else if (condEnergySumZdc.getType() == esConditionType::ZDCMinus) {
2446  LogDebug("TriggerMenuParser") << "ZDC signals: esConditionType::ZDCMinus " << std::endl;
2447  energySumObjType = GlobalObject::gtZDCM;
2448  cType = TypeZDCM;
2449  } else {
2450  edm::LogError("TriggerMenuParser") << "Wrong type for ZDC energy-sum condition (" << type << ")" << std::endl;
2451  return false;
2452  }
2453 
2454  // global object
2455  int nrObj = 1;
2456 
2457  // temporary storage of the parameters
2458  std::vector<EnergySumZdcTemplate::ObjectParameter> objParameter(nrObj);
2459 
2460  // Loop over the cuts for this object
2461  int lowerThresholdInd = 0;
2462  int upperThresholdInd = -1;
2463 
2464  int cnt = 0;
2465 
2466  // BLW TO DO: These needs to the added to the object rather than the whole condition.
2467  int relativeBx = 0;
2468  bool gEq = false;
2469 
2470  // l1t::EnergySumsObjectRequirement objPar = condEnergySumZdc.objectRequirement();
2471 
2472  // Loop over objects and extract the cuts on the objects
2473  const std::vector<L1TUtmObject>& objects = condEnergySumZdc.getObjects();
2474  for (size_t jj = 0; jj < objects.size(); jj++) {
2475  const L1TUtmObject& object = objects.at(jj);
2476  gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
2477 
2478  // BLW TO DO: This needs to be added to the Object Parameters
2479  relativeBx = object.getBxOffset();
2480 
2481  // Loop over the cuts for this object
2482  const std::vector<L1TUtmCut>& cuts = object.getCuts();
2483  for (size_t kk = 0; kk < cuts.size(); kk++) {
2484  const L1TUtmCut& cut = cuts.at(kk);
2485 
2486  switch (cut.getCutType()) {
2487  case esCutType::Threshold:
2488  lowerThresholdInd = cut.getMinimum().index;
2489  upperThresholdInd = cut.getMaximum().index;
2490  break;
2491 
2492  case esCutType::Count:
2493  lowerThresholdInd = cut.getMinimum().index;
2494  upperThresholdInd = 0xffffff;
2495  break;
2496 
2497  default:
2498  break;
2499  } //end switch
2500 
2501  } //end loop over cuts
2502 
2503  // Fill the object parameters
2504  objParameter[cnt].etLowThreshold = lowerThresholdInd;
2505  objParameter[cnt].etHighThreshold = upperThresholdInd;
2506 
2507  // Output for debugging
2508  LogDebug("TriggerMenuParser") << "\n EnergySumZdc ET high threshold (hex) for energy sum object " << cnt
2509  << " = " << std::hex << objParameter[cnt].etLowThreshold << " - "
2510  << objParameter[cnt].etHighThreshold << std::dec;
2511 
2512  cnt++;
2513  } //end loop over objects
2514 
2515  // object types - all same energySumObjType
2516  std::vector<GlobalObject> objType(nrObj, energySumObjType);
2517 
2518  // now create a new energySum condition
2519 
2520  EnergySumZdcTemplate energySumCond(name);
2521 
2522  energySumCond.setCondType(cType);
2523  energySumCond.setObjectType(objType);
2524  energySumCond.setCondGEq(gEq);
2525  energySumCond.setCondChipNr(chipNr);
2526  energySumCond.setCondRelativeBx(relativeBx);
2527 
2528  energySumCond.setConditionParameter(objParameter);
2529 
2530  if (edm::isDebugEnabled()) {
2531  std::ostringstream myCoutStream;
2532  energySumCond.print(myCoutStream);
2533  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2534  }
2535 
2536  // insert condition into the map
2537  if (!insertConditionIntoMap(energySumCond, chipNr)) {
2538  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
2539 
2540  return false;
2541  } else {
2542  (m_vecEnergySumZdcTemplate[chipNr]).push_back(energySumCond);
2543  }
2544  //
2545  return true;
2546 }
2547 
2559 bool l1t::TriggerMenuParser::parseEnergySumCorr(const L1TUtmObject* corrESum, unsigned int chipNr) {
2560  // XERCES_CPP_NAMESPACE_USE
2561  using namespace tmeventsetup;
2562 
2563  // get condition, particle name and type name
2564 
2565  std::string condition = "calo";
2566  std::string type = l1t2string(corrESum->getType());
2567  std::string name = l1t2string(corrESum->getName());
2568 
2569  LogDebug("TriggerMenuParser") << "\n ****************************************** "
2570  << "\n (in parseEnergySum) "
2571  << "\n condition = " << condition << "\n type = " << type
2572  << "\n name = " << name << std::endl;
2573 
2574  // determine object type type
2575  GlobalObject energySumObjType;
2576  GtConditionType cType;
2577 
2578  if (corrESum->getType() == esObjectType::ETM) {
2579  energySumObjType = GlobalObject::gtETM;
2580  cType = TypeETM;
2581  } else if (corrESum->getType() == esObjectType::HTM) {
2582  energySumObjType = GlobalObject::gtHTM;
2583  cType = TypeHTM;
2584  } else if (corrESum->getType() == esObjectType::ETMHF) {
2585  energySumObjType = GlobalObject::gtETMHF;
2586  cType = TypeETMHF;
2587  } else if (corrESum->getType() == esObjectType::TOWERCOUNT) {
2588  energySumObjType = GlobalObject::gtTowerCount;
2589  cType = TypeTowerCount;
2590  } else {
2591  edm::LogError("TriggerMenuParser") << "Wrong type for energy-sum correclation condition (" << type << ")"
2592  << std::endl;
2593  return false;
2594  }
2595 
2596  // global object
2597  int nrObj = 1;
2598 
2599  // std::string str_etComparison = l1t2string( condEnergySum.comparison_operator() );
2600 
2601  // get values
2602 
2603  // temporary storage of the parameters
2604  std::vector<EnergySumTemplate::ObjectParameter> objParameter(nrObj);
2605 
2606  int cnt = 0;
2607 
2608  // BLW TO DO: These needs to the added to the object rather than the whole condition.
2609  int relativeBx = 0;
2610  bool gEq = false;
2611 
2612  // l1t::EnergySumsObjectRequirement objPar = condEnergySum.objectRequirement();
2613 
2614  gEq = (corrESum->getComparisonOperator() == esComparisonOperator::GE);
2615 
2616  // BLW TO DO: This needs to be added to the Object Parameters
2617  relativeBx = corrESum->getBxOffset();
2618 
2619  // Loop over the cuts for this object
2620  int lowerThresholdInd = 0;
2621  int upperThresholdInd = -1;
2622  int cntPhi = 0;
2623  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
2624 
2625  const std::vector<L1TUtmCut>& cuts = corrESum->getCuts();
2626  for (size_t kk = 0; kk < cuts.size(); kk++) {
2627  const L1TUtmCut& cut = cuts.at(kk);
2628 
2629  switch (cut.getCutType()) {
2630  case esCutType::Threshold:
2631  lowerThresholdInd = cut.getMinimum().index;
2632  upperThresholdInd = cut.getMaximum().index;
2633  break;
2634 
2635  case esCutType::Eta:
2636  break;
2637 
2638  case esCutType::Phi: {
2639  if (cntPhi == 0) {
2640  phiWindow1Lower = cut.getMinimum().index;
2641  phiWindow1Upper = cut.getMaximum().index;
2642  } else if (cntPhi == 1) {
2643  phiWindow2Lower = cut.getMinimum().index;
2644  phiWindow2Upper = cut.getMaximum().index;
2645  } else {
2646  edm::LogError("TriggerMenuParser") << "Too Many Phi Cuts for esum-condition (" << type << ")" << std::endl;
2647  return false;
2648  }
2649  cntPhi++;
2650 
2651  } break;
2652 
2653  default:
2654  break;
2655  } //end switch
2656 
2657  } //end loop over cuts
2658 
2659  // Fill the object parameters
2660  objParameter[0].etLowThreshold = lowerThresholdInd;
2661  objParameter[0].etHighThreshold = upperThresholdInd;
2662  objParameter[0].phiWindow1Lower = phiWindow1Lower;
2663  objParameter[0].phiWindow1Upper = phiWindow1Upper;
2664  objParameter[0].phiWindow2Lower = phiWindow2Lower;
2665  objParameter[0].phiWindow2Upper = phiWindow2Upper;
2666 
2667  // Output for debugging
2668  LogDebug("TriggerMenuParser") << "\n EnergySum ET high threshold (hex) for energy sum object " << cnt << " = "
2669  << std::hex << objParameter[0].etLowThreshold << " - " << objParameter[0].etLowThreshold
2670  << "\n phiWindow Lower / Upper for calo object " << cnt << " = 0x"
2671  << objParameter[0].phiWindow1Lower << " / 0x" << objParameter[0].phiWindow1Upper
2672  << "\n phiWindowVeto Lower / Upper for calo object " << cnt << " = 0x"
2673  << objParameter[0].phiWindow2Lower << " / 0x" << objParameter[0].phiWindow2Upper
2674  << std::dec << std::endl;
2675 
2676  // object types - all same energySumObjType
2677  std::vector<GlobalObject> objType(nrObj, energySumObjType);
2678 
2679  // now create a new energySum condition
2680 
2681  EnergySumTemplate energySumCond(name);
2682 
2683  energySumCond.setCondType(cType);
2684  energySumCond.setObjectType(objType);
2685  energySumCond.setCondGEq(gEq);
2686  energySumCond.setCondChipNr(chipNr);
2687  energySumCond.setCondRelativeBx(relativeBx);
2688 
2689  energySumCond.setConditionParameter(objParameter);
2690 
2691  if (edm::isDebugEnabled()) {
2692  std::ostringstream myCoutStream;
2693  energySumCond.print(myCoutStream);
2694  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2695  }
2696  /*
2697  // insert condition into the map
2698  if ( !insertConditionIntoMap(energySumCond, chipNr)) {
2699 
2700  edm::LogError("TriggerMenuParser")
2701  << " Error: duplicate condition (" << name << ")"
2702  << std::endl;
2703 
2704  return false;
2705  }
2706  else {
2707 
2708  (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2709 
2710  }
2711 */
2712  (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2713 
2714  //
2715  return true;
2716 }
2717 
2729 bool l1t::TriggerMenuParser::parseAXOL1TL(L1TUtmCondition condAXOL1TL, unsigned int chipNr) {
2730  using namespace tmeventsetup;
2731 
2732  // get condition, particle name and particle type
2733  std::string condition = "axol1tl";
2734  std::string type = l1t2string(condAXOL1TL.getType());
2735  std::string name = l1t2string(condAXOL1TL.getName());
2736 
2737  LogDebug("TriggerMenuParser") << " ****************************************** " << std::endl
2738  << " (in parseAXOL1TL) " << std::endl
2739  << " condition = " << condition << std::endl
2740  << " type = " << type << std::endl
2741  << " name = " << name << std::endl;
2742 
2743  const int nrObj = 1;
2744  GtConditionType cType = TypeAXOL1TL;
2745 
2746  std::vector<AXOL1TLTemplate::ObjectParameter> objParameter(nrObj);
2747 
2748  if (int(condAXOL1TL.getObjects().size()) != nrObj) {
2749  edm::LogError("TriggerMenuParser") << " condAXOL1TL objects: nrObj = " << nrObj
2750  << "condAXOL1TL.getObjects().size() = " << condAXOL1TL.getObjects().size()
2751  << std::endl;
2752  return false;
2753  }
2754 
2755  // Get the axol1tl object
2756  L1TUtmObject object = condAXOL1TL.getObjects().at(0);
2757  int relativeBx = object.getBxOffset();
2758  bool gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
2759 
2760  //Loop over cuts for this object
2761  int lowerThresholdInd = 0;
2762  int upperThresholdInd = -1;
2763 
2764  //save model and threshold
2765  std::string model = "";
2766 
2767  // for UTM v12+
2768  if (object.getType() == tmeventsetup::Axol1tl) {
2769  const std::vector<L1TUtmCut>& cuts = object.getCuts();
2770  for (size_t kk = 0; kk < cuts.size(); kk++) {
2771  const L1TUtmCut& cut = cuts.at(kk);
2772 
2773  //save model
2774  if (cut.getCutType() == tmeventsetup::Model) {
2775  model = cut.getData();
2776  }
2777  //save score
2778  else if (cut.getCutType() == esCutType::Score) {
2779  lowerThresholdInd = cut.getMinimum().value;
2780  upperThresholdInd = cut.getMaximum().value;
2781  } //end else if
2782  } //end cut loop
2783  } //end if getType
2784  // LEGACY
2785  // for UTM pre v12
2786  else if (condAXOL1TL.getType() == esConditionType::AnomalyDetectionTrigger) {
2787  // hard-code model version for legacy Menu
2788  model = "v3";
2789 
2790  const std::vector<L1TUtmCut>& cuts = object.getCuts();
2791  for (size_t kk = 0; kk < cuts.size(); kk++) {
2792  const L1TUtmCut& cut = cuts.at(kk);
2793  if (cut.getCutType() == esCutType::AnomalyScore) {
2794  lowerThresholdInd = cut.getMinimum().value;
2795  upperThresholdInd = cut.getMaximum().value;
2796  break;
2797  }
2798  } //end cut loop
2799  } else {
2800  edm::LogError("TriggerMenuParser") << " Error: not a proper AXOL1TL condition" << std::endl;
2801  return false;
2802  }
2803 
2804  // check model version is not empty
2805  if (model == "") {
2806  edm::LogError("TriggerMenuParser") << " Error: AXOL1TL movel version is empty" << std::endl;
2807  return false;
2808  }
2809 
2810  //fill object params
2811  objParameter[0].minAXOL1TLThreshold = lowerThresholdInd;
2812  objParameter[0].maxAXOL1TLThreshold = upperThresholdInd;
2813 
2814  // create a new AXOL1TL condition
2815  AXOL1TLTemplate axol1tlCond(name);
2816  axol1tlCond.setCondType(cType);
2817  axol1tlCond.setCondGEq(gEq);
2818  axol1tlCond.setCondChipNr(chipNr);
2819  axol1tlCond.setCondRelativeBx(relativeBx);
2820  axol1tlCond.setConditionParameter(objParameter);
2821  axol1tlCond.setModelVersion(model);
2822 
2823  if (edm::isDebugEnabled()) {
2824  std::ostringstream myCoutStream;
2825  axol1tlCond.print(myCoutStream);
2826  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2827  }
2828 
2829  // check that the condition does not exist already in the map
2830  if (!insertConditionIntoMap(axol1tlCond, chipNr)) {
2831  edm::LogError("TriggerMenuParser") << " Error: duplicate AXOL1TL condition (" << name << ")" << std::endl;
2832  return false;
2833  }
2834 
2835  (m_vecAXOL1TLTemplate[chipNr]).push_back(axol1tlCond);
2836 
2837  return true;
2838 }
2839 
2852 bool l1t::TriggerMenuParser::parseExternal(L1TUtmCondition condExt, unsigned int chipNr) {
2853  using namespace tmeventsetup;
2854  // get condition, particle name and type name
2855  std::string condition = "ext";
2856  std::string particle = "test-fix";
2857  std::string type = l1t2string(condExt.getType());
2858  std::string name = l1t2string(condExt.getName());
2859 
2860  LogDebug("TriggerMenuParser") << "\n ****************************************** "
2861  << "\n (in parseExternal) "
2862  << "\n condition = " << condition << "\n particle = " << particle
2863  << "\n type = " << type << "\n name = " << name << std::endl;
2864 
2865  // object type and condition type
2866  // object type - irrelevant for External conditions
2867  GtConditionType cType = TypeExternal;
2868  GlobalObject extSignalType = GlobalObject::gtExternal;
2869  int nrObj = 1; //only one object for these conditions
2870 
2871  int relativeBx = 0;
2872  unsigned int channelID = 0;
2873 
2874  // Get object for External conditions
2875  const std::vector<L1TUtmObject>& objects = condExt.getObjects();
2876  for (size_t jj = 0; jj < objects.size(); jj++) {
2877  const L1TUtmObject& object = objects.at(jj);
2878  if (object.getType() == esObjectType::EXT) {
2879  relativeBx = object.getBxOffset();
2880  channelID = object.getExternalChannelId();
2881  }
2882  }
2883 
2884  // set the boolean value for the ge_eq mode - irrelevant for External conditions
2885  bool gEq = false;
2886 
2887  //object types - all same for external conditions
2888  std::vector<GlobalObject> objType(nrObj, extSignalType);
2889 
2890  // now create a new External condition
2891  ExternalTemplate externalCond(name);
2892 
2893  externalCond.setCondType(cType);
2894  externalCond.setObjectType(objType);
2895  externalCond.setCondGEq(gEq);
2896  externalCond.setCondChipNr(chipNr);
2897  externalCond.setCondRelativeBx(relativeBx);
2898  externalCond.setExternalChannel(channelID);
2899 
2900  LogTrace("TriggerMenuParser") << externalCond << "\n" << std::endl;
2901 
2902  // insert condition into the map
2903  if (!insertConditionIntoMap(externalCond, chipNr)) {
2904  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
2905 
2906  return false;
2907  } else {
2908  (m_vecExternalTemplate[chipNr]).push_back(externalCond);
2909  }
2910 
2911  return true;
2912 }
2913 
2914 // Parse the CICADA condition and insert the entry into the conditions mapping
2915 bool l1t::TriggerMenuParser::parseCICADA(L1TUtmCondition condCICADA, unsigned int chipNr) {
2916  using namespace tmeventsetup;
2917 
2918  std::string condition = "cicada";
2919  std::string type = l1t2string(condCICADA.getType());
2920  std::string name = l1t2string(condCICADA.getName());
2921 
2922  LogDebug("TriggerMenuParser") << " ****************************************** " << std::endl
2923  << " (in parseCICADA) " << std::endl
2924  << " condition = " << condition << std::endl
2925  << " type = " << type << std::endl
2926  << " name = " << name << std::endl;
2927  const int nrObj = 1;
2928  GtConditionType cType = TypeCICADA;
2929 
2930  std::vector<CICADATemplate::ObjectParameter> objParameter(nrObj);
2931 
2932  if (int(condCICADA.getObjects().size()) != nrObj) {
2933  edm::LogError("TriggerMenuParser") << " condCICADA objects: nrObj = " << nrObj
2934  << "condCICADA.getObjects().size() = " << condCICADA.getObjects().size()
2935  << std::endl;
2936  return false;
2937  }
2938 
2939  L1TUtmObject object = condCICADA.getObjects().at(0);
2940  int relativeBx = object.getBxOffset();
2941  bool gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
2942 
2943  float lowerThresholdInd = 0; //May need to be float to match CICADA?
2944  float upperThresholdInd = -1;
2945 
2946  const std::vector<L1TUtmCut>& cuts = object.getCuts();
2947  for (size_t kk = 0; kk < cuts.size(); kk++) {
2948  const L1TUtmCut& cut = cuts.at(kk);
2949 
2950  switch (cut.getCutType()) {
2951  case esCutType::CicadaScore:
2952  lowerThresholdInd = cut.getMinimum().value;
2953  upperThresholdInd = cut.getMaximum().value;
2954  }
2955  }
2956 
2957  objParameter[0].minCICADAThreshold = lowerThresholdInd;
2958  objParameter[0].maxCICADAThreshold = upperThresholdInd;
2959 
2960  CICADATemplate cicadaCond(name);
2961  cicadaCond.setCondType(cType);
2962  cicadaCond.setCondGEq(gEq);
2963  cicadaCond.setCondChipNr(chipNr);
2964  cicadaCond.setCondRelativeBx(relativeBx);
2965  cicadaCond.setConditionParameter(objParameter);
2966 
2967  if (edm::isDebugEnabled()) {
2968  std::ostringstream myCoutStream;
2969  cicadaCond.print(myCoutStream);
2970  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2971  }
2972 
2973  if (!insertConditionIntoMap(cicadaCond, chipNr)) {
2974  edm::LogError("TriggerMenuParser") << " Error: duplicate CICADA condition (" << name << ")" << std::endl;
2975  return false;
2976  }
2977 
2978  (m_vecCICADATemplate[chipNr]).push_back(cicadaCond);
2979 
2980  return true;
2981 }
2982 
2995 bool l1t::TriggerMenuParser::parseCorrelation(L1TUtmCondition corrCond, unsigned int chipNr) {
2996  using namespace tmeventsetup;
2997  std::string condition = "corr";
2998  std::string particle = "test-fix";
2999  std::string type = l1t2string(corrCond.getType());
3000  std::string name = l1t2string(corrCond.getName());
3001 
3002  LogDebug("TriggerMenuParser") << " ****************************************** " << std::endl
3003  << " (in parseCorrelation) " << std::endl
3004  << " condition = " << condition << std::endl
3005  << " particle = " << particle << std::endl
3006  << " type = " << type << std::endl
3007  << " name = " << name << std::endl;
3008 
3009  // create a new correlation condition
3010  CorrelationTemplate correlationCond(name);
3011 
3012  // check that the condition does not exist already in the map
3013  if (!insertConditionIntoMap(correlationCond, chipNr)) {
3014  edm::LogError("TriggerMenuParser") << " Error: duplicate correlation condition (" << name << ")" << std::endl;
3015 
3016  return false;
3017  }
3018 
3019  // Define some of the quantities to store the parased information
3020 
3021  // condition type BLW (Do we change this to the type of correlation condition?)
3023 
3024  // two objects (for sure)
3025  const int nrObj = 2;
3026 
3027  // object types and greater equal flag - filled in the loop
3028  int intGEq[nrObj] = {-1, -1};
3029  std::vector<GlobalObject> objType(nrObj); //BLW do we want to define these as a different type?
3030  std::vector<GtConditionCategory> condCateg(nrObj); //BLW do we want to change these categories
3031 
3032  // correlation flag and index in the cor*vector
3033  const bool corrFlag = true;
3034  int corrIndexVal[nrObj] = {-1, -1};
3035 
3036  // Storage of the correlation selection
3038  corrParameter.chargeCorrelation = 1; //ignore charge correlation
3039 
3040  // Get the correlation Cuts on the legs
3041  int cutType = 0;
3042  const std::vector<L1TUtmCut>& cuts = corrCond.getCuts();
3043  for (size_t jj = 0; jj < cuts.size(); jj++) {
3044  const L1TUtmCut& cut = cuts.at(jj);
3045 
3046  if (cut.getCutType() == esCutType::ChargeCorrelation) {
3047  if (cut.getData() == "ls")
3048  corrParameter.chargeCorrelation = 2;
3049  else if (cut.getData() == "os")
3050  corrParameter.chargeCorrelation = 4;
3051  else
3052  corrParameter.chargeCorrelation = 1; //ignore charge correlation
3053  } else {
3054  //
3055  // Until utm has method to calculate these, do the integer value calculation with precision.
3056  //
3057  double minV = cut.getMinimum().value;
3058  double maxV = cut.getMaximum().value;
3059 
3060  //Scale down very large numbers out of xml
3061  if (maxV > 1.0e8)
3062  maxV = 1.0e8;
3063 
3064  if (cut.getCutType() == esCutType::DeltaEta) {
3065  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tDeltaEta Cut minV = " << minV
3066  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
3067  << " precMax = " << cut.getMaximum().index << std::endl;
3068  corrParameter.minEtaCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3069  corrParameter.maxEtaCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3070  corrParameter.precEtaCut = cut.getMinimum().index;
3071  cutType = cutType | 0x1;
3072  } else if (cut.getCutType() == esCutType::DeltaPhi) {
3073  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tDeltaPhi Cut minV = " << minV
3074  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
3075  << " precMax = " << cut.getMaximum().index << std::endl;
3076  corrParameter.minPhiCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3077  corrParameter.maxPhiCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3078  corrParameter.precPhiCut = cut.getMinimum().index;
3079  cutType = cutType | 0x2;
3080  } else if (cut.getCutType() == esCutType::DeltaR) {
3081  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tDeltaR Cut minV = " << minV
3082  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
3083  << " precMax = " << cut.getMaximum().index << std::endl;
3084  corrParameter.minDRCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3085  corrParameter.maxDRCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3086  corrParameter.precDRCut = cut.getMinimum().index;
3087  cutType = cutType | 0x4;
3088  } else if (cut.getCutType() == esCutType::TwoBodyPt) {
3089  corrParameter.minTBPTCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3090  corrParameter.maxTBPTCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3091  corrParameter.precTBPTCut = cut.getMinimum().index;
3092  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tTPBT Cut minV = " << minV
3093  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
3094  << " precMax = " << cut.getMaximum().index << std::endl;
3095  cutType = cutType | 0x20;
3096  } else if ((cut.getCutType() == esCutType::Mass) ||
3097  (cut.getCutType() == esCutType::MassDeltaR)) { //Invariant Mass, MassOverDeltaR
3098  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tMass Cut minV = " << minV
3099  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
3100  << " precMax = " << cut.getMaximum().index << std::endl;
3101  corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3102  corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3103  corrParameter.precMassCut = cut.getMinimum().index;
3104  // cutType = cutType | 0x8;
3105  if (corrCond.getType() == esConditionType::TransverseMass) {
3106  cutType = cutType | 0x10;
3107  } else if (corrCond.getType() == esConditionType::InvariantMassDeltaR) {
3108  cutType = cutType | 0x80;
3109  } else {
3110  cutType = cutType | 0x8;
3111  }
3112  } else if (cut.getCutType() == esCutType::MassUpt) { // Added for displaced muons
3113  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tMass Cut minV = " << minV
3114  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
3115  << " precMax = " << cut.getMaximum().index << std::endl;
3116  corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3117  corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3118  corrParameter.precMassCut = cut.getMinimum().index;
3119  cutType = cutType | 0x40; // Note: 0x40 (MassUpt) is next available bit after 0x20 (TwoBodyPt)
3120  } // Careful: cutType carries same info as esCutType, but is hard coded!!
3121  } // This seems like a historical hack, which may be error prone.
3122  } // cutType is defined here, for use later in CorrCondition.cc
3123  corrParameter.corrCutType = cutType;
3124 
3125  // Get the two objects that form the legs
3126  const std::vector<L1TUtmObject>& objects = corrCond.getObjects();
3127  if (objects.size() != 2) {
3128  edm::LogError("TriggerMenuParser") << "incorrect number of objects for the correlation condition " << name
3129  << " corrFlag " << corrFlag << std::endl;
3130  return false;
3131  }
3132 
3133  // loop over legs
3134  for (size_t jj = 0; jj < objects.size(); jj++) {
3135  const L1TUtmObject& object = objects.at(jj);
3136  LogDebug("TriggerMenuParser") << " obj name = " << object.getName() << "\n";
3137  LogDebug("TriggerMenuParser") << " obj type = " << object.getType() << "\n";
3138  LogDebug("TriggerMenuParser") << " obj op = " << object.getComparisonOperator() << "\n";
3139  LogDebug("TriggerMenuParser") << " obj bx = " << object.getBxOffset() << "\n";
3140 
3141  // check the leg type
3142  if (object.getType() == esObjectType::Muon) {
3143  // we have a muon
3144 
3145  /*
3146  //BLW Hold on to this code we may need to go back to it at some point.
3147  // Now we are putting ALL leg conditions into the vector (so there are duplicates)
3148  // This is potentially a place to slim down the code. Note: We currently evaluate the
3149  // conditions every time, so even if we put the condition in the vector once, we would
3150  // still evaluate it multiple times. This is a place for optimization.
3151  {
3152 
3153  parseMuonCorr(&object,chipNr);
3154  corrIndexVal[jj] = (m_corMuonTemplate[chipNr]).size() - 1;
3155 
3156  } else {
3157  LogDebug("TriggerMenuParser") << "Not Adding Correlation Muon Condition to Map...looking for the condition in Muon Cor Vector" << std::endl;
3158  bool found = false;
3159  int index = 0;
3160  while(!found && index<(int)((m_corMuonTemplate[chipNr]).size()) ) {
3161  if( (m_corMuonTemplate[chipNr]).at(index).condName() == object.getName() ) {
3162  LogDebug("TriggerMenuParser") << "Found condition " << object.getName() << " in vector at index " << index << std::endl;
3163  found = true;
3164  } else {
3165  index++;
3166  }
3167  }
3168  if(found) {
3169  corrIndexVal[jj] = index;
3170  } else {
3171  edm::LogError("TriggerMenuParser") << "FAILURE: Condition " << object.getName() << " is in map but not in cor. vector " << std::endl;
3172  }
3173 
3174  }
3175 */
3176  parseMuonCorr(&object, chipNr);
3177  corrIndexVal[jj] = (m_corMuonTemplate[chipNr]).size() - 1;
3178 
3179  //Now set some flags for this subCondition
3180  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
3181  objType[jj] = gtMu;
3182  condCateg[jj] = CondMuon;
3183 
3184  } else if (object.getType() == esObjectType::Egamma || object.getType() == esObjectType::Jet ||
3185  object.getType() == esObjectType::Tau) {
3186  // we have an Calo object
3187  parseCaloCorr(&object, chipNr);
3188  corrIndexVal[jj] = (m_corCaloTemplate[chipNr]).size() - 1;
3189 
3190  //Now set some flags for this subCondition
3191  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
3192  switch (object.getType()) {
3193  case esObjectType::Egamma: {
3194  objType[jj] = gtEG;
3195  } break;
3196  case esObjectType::Jet: {
3197  objType[jj] = gtJet;
3198  } break;
3199  case esObjectType::Tau: {
3200  objType[jj] = gtTau;
3201  } break;
3202  default: {
3203  } break;
3204  }
3205  condCateg[jj] = CondCalo;
3206 
3207  } else if (object.getType() == esObjectType::ETM || object.getType() == esObjectType::ETMHF ||
3208  object.getType() == esObjectType::TOWERCOUNT || object.getType() == esObjectType::HTM) {
3209  // we have Energy Sum
3210  parseEnergySumCorr(&object, chipNr);
3211  corrIndexVal[jj] = (m_corEnergySumTemplate[chipNr]).size() - 1;
3212 
3213  //Now set some flags for this subCondition
3214  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
3215  switch (object.getType()) {
3216  case esObjectType::ETM: {
3218  } break;
3219  case esObjectType::HTM: {
3221  } break;
3222  case esObjectType::ETMHF: {
3224  } break;
3225  case esObjectType::TOWERCOUNT: {
3227  } break;
3228  default: {
3229  } break;
3230  }
3231  condCateg[jj] = CondEnergySum;
3232 
3233  } else {
3234  edm::LogError("TriggerMenuParser") << "Illegal Object Type " << object.getType()
3235  << " for the correlation condition " << name << std::endl;
3236  return false;
3237 
3238  } //if block on leg types
3239 
3240  } //loop over legs
3241 
3242  // get greater equal flag for the correlation condition
3243  bool gEq = true;
3244  if (intGEq[0] != intGEq[1]) {
3245  edm::LogError("TriggerMenuParser") << "Inconsistent GEq flags for sub-conditions "
3246  << " for the correlation condition " << name << std::endl;
3247  return false;
3248 
3249  } else {
3250  gEq = (intGEq[0] != 0);
3251  }
3252 
3253  // fill the correlation condition
3254  correlationCond.setCondType(cType);
3255  correlationCond.setObjectType(objType);
3256  correlationCond.setCondGEq(gEq);
3257  correlationCond.setCondChipNr(chipNr);
3258 
3259  correlationCond.setCond0Category(condCateg[0]);
3260  correlationCond.setCond1Category(condCateg[1]);
3261 
3262  correlationCond.setCond0Index(corrIndexVal[0]);
3263  correlationCond.setCond1Index(corrIndexVal[1]);
3264 
3265  correlationCond.setCorrelationParameter(corrParameter);
3266 
3267  if (edm::isDebugEnabled()) {
3268  std::ostringstream myCoutStream;
3269  correlationCond.print(myCoutStream);
3270  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
3271  }
3272 
3273  // insert condition into the map
3274  // condition is not duplicate, check was done at the beginning
3275 
3276  (m_vecCorrelationTemplate[chipNr]).push_back(correlationCond);
3277 
3278  //
3279  return true;
3280 }
3281 
3283 
3296  using namespace tmeventsetup;
3297  std::string condition = "corrThreeBody";
3298  std::string particle = "muon";
3299  std::string type = l1t2string(corrCond.getType());
3300  std::string name = l1t2string(corrCond.getName());
3301 
3302  LogDebug("TriggerMenuParser") << " ****************************************** " << std::endl
3303  << " (in parseCorrelationThreeBody) " << std::endl
3304  << " condition = " << condition << std::endl
3305  << " particle = " << particle << std::endl
3306  << " type = " << type << std::endl
3307  << " name = " << name << std::endl;
3308 
3309  // create a new correlation condition
3310  CorrelationThreeBodyTemplate correlationThreeBodyCond(name);
3311 
3312  // check that the condition does not exist already in the map
3313  if (!insertConditionIntoMap(correlationThreeBodyCond, chipNr)) {
3314  edm::LogError("TriggerMenuParser") << " Error: duplicate correlation condition (" << name << ")" << std::endl;
3315  return false;
3316  }
3317 
3318  // Define some of the quantities to store the parsed information
3319  GtConditionType cType = l1t::Type3s;
3320 
3321  // three objects (for sure)
3322  const int nrObj = 3;
3323 
3324  // object types and greater equal flag - filled in the loop
3325  std::vector<GlobalObject> objType(nrObj);
3326  std::vector<GtConditionCategory> condCateg(nrObj);
3327 
3328  // correlation flag and index in the cor*vector
3329  const bool corrFlag = true;
3330  int corrIndexVal[nrObj] = {-1, -1, -1};
3331 
3332  // Storage of the correlation selection
3334  // Set charge correlation parameter
3335  //corrThreeBodyParameter.chargeCorrelation = chargeCorrelation; //tmpValues[0];
3336  //corrThreeBodyParameter.chargeCorrelation = 1; //ignore charge correlation for corr-legs
3337 
3338  // Get the correlation cuts on the legs
3339  int cutType = 0;
3340  const std::vector<L1TUtmCut>& cuts = corrCond.getCuts();
3341  for (size_t lll = 0; lll < cuts.size(); lll++) { // START esCut lll
3342  const L1TUtmCut& cut = cuts.at(lll);
3343 
3344  if (cut.getCutType() == esCutType::ChargeCorrelation) {
3345  if (cut.getData() == "ls")
3346  corrThreeBodyParameter.chargeCorrelation = 2;
3347  else if (cut.getData() == "os")
3348  corrThreeBodyParameter.chargeCorrelation = 4;
3349  else
3350  corrThreeBodyParameter.chargeCorrelation = 1; //ignore charge correlation
3351  }
3352 
3353  //
3354  // Until utm has method to calculate these, do the integer value calculation with precision.
3355  //
3356  double minV = cut.getMinimum().value;
3357  double maxV = cut.getMaximum().value;
3358  //Scale down very large numbers out of xml
3359  if (maxV > 1.0e8)
3360  maxV = 1.0e8;
3361 
3362  if (cut.getCutType() == esCutType::Mass) {
3363  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tMass Cut minV = " << minV
3364  << "\tMass Cut maxV = " << maxV << " precMin = " << cut.getMinimum().index
3365  << " precMax = " << cut.getMaximum().index << std::endl;
3366  corrThreeBodyParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3367  corrThreeBodyParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3368  corrThreeBodyParameter.precMassCut = cut.getMinimum().index;
3369  cutType = cutType | 0x8;
3370  } else if (cut.getCutType() == esCutType::MassDeltaR) {
3371  corrThreeBodyParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3372  corrThreeBodyParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3373  corrThreeBodyParameter.precMassCut = cut.getMinimum().index;
3374  cutType = cutType | 0x80;
3375  }
3376  } // END esCut lll
3377  corrThreeBodyParameter.corrCutType = cutType;
3378 
3379  // Get the three objects that form the legs
3380  const std::vector<L1TUtmObject>& objects = corrCond.getObjects();
3381  if (objects.size() != 3) {
3382  edm::LogError("TriggerMenuParser") << "incorrect number of objects for the correlation condition " << name
3383  << " corrFlag " << corrFlag << std::endl;
3384  return false;
3385  }
3386 
3387  // Loop over legs
3388  for (size_t lll = 0; lll < objects.size(); lll++) {
3389  const L1TUtmObject& object = objects.at(lll);
3390  LogDebug("TriggerMenuParser") << " obj name = " << object.getName() << "\n";
3391  LogDebug("TriggerMenuParser") << " obj type = " << object.getType() << "\n";
3392  LogDebug("TriggerMenuParser") << " obj bx = " << object.getBxOffset() << "\n";
3393 
3394  // check the leg type
3395  if (object.getType() == esObjectType::Muon) {
3396  // we have a muon
3397  parseMuonCorr(&object, chipNr);
3398  corrIndexVal[lll] = (m_corMuonTemplate[chipNr]).size() - 1;
3399 
3400  //Now set some flags for this subCondition
3401  objType[lll] = gtMu;
3402  condCateg[lll] = CondMuon;
3403 
3404  } else {
3405  edm::LogError("TriggerMenuParser") << "Checked the object Type " << object.getType()
3406  << " for the correlation condition " << name
3407  << ": no three muons in the event!" << std::endl;
3408  }
3409  } // End loop over legs
3410 
3411  // fill the three-body correlation condition
3412  correlationThreeBodyCond.setCondType(cType);
3413  correlationThreeBodyCond.setObjectType(objType);
3414  correlationThreeBodyCond.setCondChipNr(chipNr);
3415 
3416  correlationThreeBodyCond.setCond0Category(condCateg[0]);
3417  correlationThreeBodyCond.setCond1Category(condCateg[1]);
3418  correlationThreeBodyCond.setCond2Category(condCateg[2]);
3419 
3420  correlationThreeBodyCond.setCond0Index(corrIndexVal[0]);
3421  correlationThreeBodyCond.setCond1Index(corrIndexVal[1]);
3422  correlationThreeBodyCond.setCond2Index(corrIndexVal[2]);
3423 
3424  correlationThreeBodyCond.setCorrelationThreeBodyParameter(corrThreeBodyParameter);
3425 
3426  if (edm::isDebugEnabled()) {
3427  std::ostringstream myCoutStream;
3428  correlationThreeBodyCond.print(myCoutStream);
3429  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
3430  }
3431 
3432  // insert condition into the map
3433  // condition is not duplicate, check was done at the beginning
3434 
3435  (m_vecCorrelationThreeBodyTemplate[chipNr]).push_back(correlationThreeBodyCond);
3436 
3437  //
3438  return true;
3439 }
3440 
3442 
3455  using namespace tmeventsetup;
3456  std::string condition = "corrWithOverlapRemoval";
3457  std::string particle = "test-fix";
3458  std::string type = l1t2string(corrCond.getType());
3459  std::string name = l1t2string(corrCond.getName());
3460 
3461  LogDebug("TriggerMenuParser") << " ****************************************** " << std::endl
3462  << " (in parseCorrelationWithOverlapRemoval) " << std::endl
3463  << " condition = " << condition << std::endl
3464  << " particle = " << particle << std::endl
3465  << " type = " << type << std::endl
3466  << " name = " << name << std::endl;
3467 
3468  // create a new correlation condition
3469  CorrelationWithOverlapRemovalTemplate correlationWORCond(name);
3470 
3471  // check that the condition does not exist already in the map
3472  if (!insertConditionIntoMap(correlationWORCond, chipNr)) {
3473  edm::LogError("TriggerMenuParser") << " Error: duplicate correlation condition (" << name << ")" << std::endl;
3474 
3475  return false;
3476  }
3477 
3478  // Define some of the quantities to store the parased information
3479 
3480  // condition type BLW (Do we change this to the type of correlation condition?)
3482 
3483  // three objects (for sure)
3484  const int nrObj = 3;
3485 
3486  // object types and greater equal flag - filled in the loop
3487  int intGEq[nrObj] = {-1, -1, -1};
3488  std::vector<GlobalObject> objType(nrObj); //BLW do we want to define these as a different type?
3489  std::vector<GtConditionCategory> condCateg(nrObj); //BLW do we want to change these categories
3490 
3491  // correlation flag and index in the cor*vector
3492  const bool corrFlag = true;
3493  int corrIndexVal[nrObj] = {-1, -1, -1};
3494 
3495  // Storage of the correlation selection
3497  corrParameter.chargeCorrelation = 1; //ignore charge correlation for corr-legs
3498 
3499  // Get the correlation Cuts on the legs
3500  int cutType = 0;
3501  const std::vector<L1TUtmCut>& cuts = corrCond.getCuts();
3502  for (size_t jj = 0; jj < cuts.size(); jj++) {
3503  const L1TUtmCut& cut = cuts.at(jj);
3504 
3505  if (cut.getCutType() == esCutType::ChargeCorrelation) {
3506  if (cut.getData() == "ls")
3507  corrParameter.chargeCorrelation = 2;
3508  else if (cut.getData() == "os")
3509  corrParameter.chargeCorrelation = 4;
3510  else
3511  corrParameter.chargeCorrelation = 1; //ignore charge correlation
3512  } else {
3513  //
3514  // Unitl utm has method to calculate these, do the integer value calculation with precision.
3515  //
3516  double minV = cut.getMinimum().value;
3517  double maxV = cut.getMaximum().value;
3518 
3519  //Scale down very large numbers out of xml
3520  if (maxV > 1.0e8)
3521  maxV = 1.0e8;
3522 
3523  if (cut.getCutType() == esCutType::DeltaEta) {
3524  //std::cout << "DeltaEta Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
3525  corrParameter.minEtaCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3526  corrParameter.maxEtaCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3527  corrParameter.precEtaCut = cut.getMinimum().index;
3528  cutType = cutType | 0x1;
3529  } else if (cut.getCutType() == esCutType::DeltaPhi) {
3530  //std::cout << "DeltaPhi Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
3531  corrParameter.minPhiCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3532  corrParameter.maxPhiCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3533  corrParameter.precPhiCut = cut.getMinimum().index;
3534  cutType = cutType | 0x2;
3535  } else if (cut.getCutType() == esCutType::DeltaR) {
3536  //std::cout << "DeltaR Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
3537  corrParameter.minDRCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3538  corrParameter.maxDRCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3539  corrParameter.precDRCut = cut.getMinimum().index;
3540  cutType = cutType | 0x4;
3541  } else if (cut.getCutType() == esCutType::Mass) {
3542  //std::cout << "Mass Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
3543  corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3544  corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3545  corrParameter.precMassCut = cut.getMinimum().index;
3546  cutType = cutType | 0x8;
3547  } else if (cut.getCutType() == esCutType::MassDeltaR) {
3548  corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3549  corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3550  corrParameter.precMassCut = cut.getMinimum().index;
3551  cutType = cutType | 0x80;
3552  }
3553  if (cut.getCutType() == esCutType::OvRmDeltaEta) {
3554  //std::cout << "OverlapRemovalDeltaEta Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
3555  corrParameter.minOverlapRemovalEtaCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3556  corrParameter.maxOverlapRemovalEtaCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3557  corrParameter.precOverlapRemovalEtaCut = cut.getMinimum().index;
3558  cutType = cutType | 0x10;
3559  } else if (cut.getCutType() == esCutType::OvRmDeltaPhi) {
3560  //std::cout << "OverlapRemovalDeltaPhi Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
3561  corrParameter.minOverlapRemovalPhiCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3562  corrParameter.maxOverlapRemovalPhiCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3563  corrParameter.precOverlapRemovalPhiCut = cut.getMinimum().index;
3564  cutType = cutType | 0x20;
3565  } else if (cut.getCutType() == esCutType::OvRmDeltaR) {
3566  //std::cout << "DeltaR Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
3567  corrParameter.minOverlapRemovalDRCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
3568  corrParameter.maxOverlapRemovalDRCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
3569  corrParameter.precOverlapRemovalDRCut = cut.getMinimum().index;
3570  cutType = cutType | 0x40;
3571  }
3572  }
3573  }
3574  corrParameter.corrCutType = cutType;
3575 
3576  // Get the two objects that form the legs
3577  const std::vector<L1TUtmObject>& objects = corrCond.getObjects();
3578  if (objects.size() != 3) {
3579  edm::LogError("TriggerMenuParser")
3580  << "incorrect number of objects for the correlation condition with overlap removal " << name << " corrFlag "
3581  << corrFlag << std::endl;
3582  return false;
3583  }
3584 
3585  // Loop over legs
3586  for (size_t jj = 0; jj < objects.size(); jj++) {
3587  const L1TUtmObject& object = objects.at(jj);
3588  LogDebug("TriggerMenuParser") << " obj name = " << object.getName() << "\n";
3589  LogDebug("TriggerMenuParser") << " obj type = " << object.getType() << "\n";
3590  LogDebug("TriggerMenuParser") << " obj op = " << object.getComparisonOperator() << "\n";
3591  LogDebug("TriggerMenuParser") << " obj bx = " << object.getBxOffset() << "\n";
3592  LogDebug("TriggerMenuParser") << "type = done" << std::endl;
3593 
3594  // check the leg type
3595  if (object.getType() == esObjectType::Muon) {
3596  // we have a muon
3597 
3598  /*
3599  //BLW Hold on to this code we may need to go back to it at some point.
3600  // Now we are putting ALL leg conditions into the vector (so there are duplicates)
3601  // This is potentially a place to slim down the code. Note: We currently evaluate the
3602  // conditions every time, so even if we put the condition in the vector once, we would
3603  // still evaluate it multiple times. This is a place for optimization.
3604  {
3605 
3606  parseMuonCorr(&object,chipNr);
3607  corrIndexVal[jj] = (m_corMuonTemplate[chipNr]).size() - 1;
3608 
3609  } else {
3610  LogDebug("TriggerMenuParser") << "Not Adding Correlation Muon Condition to Map...looking for the condition in Muon Cor Vector" << std::endl;
3611  bool found = false;
3612  int index = 0;
3613  while(!found && index<(int)((m_corMuonTemplate[chipNr]).size()) ) {
3614  if( (m_corMuonTemplate[chipNr]).at(index).condName() == object.getName() ) {
3615  LogDebug("TriggerMenuParser") << "Found condition " << object.getName() << " in vector at index " << index << std::endl;
3616  found = true;
3617  } else {
3618  index++;
3619  }
3620  }
3621  if(found) {
3622  corrIndexVal[jj] = index;
3623  } else {
3624  edm::LogError("TriggerMenuParser") << "FAILURE: Condition " << object.getName() << " is in map but not in cor. vector " << std::endl;
3625  }
3626 
3627  }
3628 */
3629  parseMuonCorr(&object, chipNr);
3630  corrIndexVal[jj] = (m_corMuonTemplate[chipNr]).size() - 1;
3631 
3632  //Now set some flags for this subCondition
3633  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
3634  objType[jj] = gtMu;
3635  condCateg[jj] = CondMuon;
3636 
3637  } else if (object.getType() == esObjectType::Egamma || object.getType() == esObjectType::Jet ||
3638  object.getType() == esObjectType::Tau) {
3639  // we have an Calo object
3640  parseCaloCorr(&object, chipNr);
3641  corrIndexVal[jj] = (m_corCaloTemplate[chipNr]).size() - 1;
3642 
3643  //Now set some flags for this subCondition
3644  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
3645  switch (object.getType()) {
3646  case esObjectType::Egamma: {
3647  objType[jj] = gtEG;
3648  } break;
3649  case esObjectType::Jet: {
3650  objType[jj] = gtJet;
3651  } break;
3652  case esObjectType::Tau: {
3653  objType[jj] = gtTau;
3654  } break;
3655  default: {
3656  } break;
3657  }
3658  condCateg[jj] = CondCalo;
3659 
3660  } else if (object.getType() == esObjectType::ETM || object.getType() == esObjectType::ETMHF ||
3661  object.getType() == esObjectType::TOWERCOUNT || object.getType() == esObjectType::HTM) {
3662  // we have Energy Sum
3663  parseEnergySumCorr(&object, chipNr);
3664  corrIndexVal[jj] = (m_corEnergySumTemplate[chipNr]).size() - 1;
3665 
3666  //Now set some flags for this subCondition
3667  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
3668  switch (object.getType()) {
3669  case esObjectType::ETM: {
3671  } break;
3672  case esObjectType::HTM: {
3674  } break;
3675  case esObjectType::ETMHF: {
3677  } break;
3678  case esObjectType::TOWERCOUNT: {
3680  } break;
3681  default: {
3682  } break;
3683  }
3684  condCateg[jj] = CondEnergySum;
3685 
3686  } else {
3687  edm::LogError("TriggerMenuParser") << "Illegal Object Type " << object.getType()
3688  << " for the correlation condition " << name << std::endl;
3689  return false;
3690 
3691  } //if block on leg types
3692 
3693  } //loop over legs
3694 
3695  // get greater equal flag for the correlation condition
3696  bool gEq = true;
3697  if (intGEq[0] != intGEq[1]) {
3698  edm::LogError("TriggerMenuParser") << "Inconsistent GEq flags for sub-conditions "
3699  << " for the correlation condition " << name << std::endl;
3700  return false;
3701 
3702  } else {
3703  gEq = (intGEq[0] != 0);
3704  }
3705 
3706  // fill the correlation condition
3707  correlationWORCond.setCondType(cType);
3708  correlationWORCond.setObjectType(objType);
3709  correlationWORCond.setCondGEq(gEq);
3710  correlationWORCond.setCondChipNr(chipNr);
3711 
3712  correlationWORCond.setCond0Category(condCateg[0]);
3713  correlationWORCond.setCond1Category(condCateg[1]);
3714  correlationWORCond.setCond2Category(condCateg[2]);
3715 
3716  correlationWORCond.setCond0Index(corrIndexVal[0]);
3717  correlationWORCond.setCond1Index(corrIndexVal[1]);
3718  correlationWORCond.setCond2Index(corrIndexVal[2]);
3719 
3720  correlationWORCond.setCorrelationWithOverlapRemovalParameter(corrParameter);
3721 
3722  if (edm::isDebugEnabled()) {
3723  std::ostringstream myCoutStream;
3724  correlationWORCond.print(myCoutStream);
3725  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
3726  }
3727 
3728  // insert condition into the map
3729  // condition is not duplicate, check was done at the beginning
3730 
3731  (m_vecCorrelationWithOverlapRemovalTemplate[chipNr]).push_back(correlationWORCond);
3732 
3733  //
3734  return true;
3735 }
3736 
3749  // get alias
3750  std::string algAlias = algorithm.getName();
3751  const std::string& algName = algorithm.getName();
3752 
3753  if (algAlias.empty()) {
3754  algAlias = algName;
3755  LogDebug("TriggerMenuParser") << "\n No alias defined for algorithm. Alias set to algorithm name."
3756  << "\n Algorithm name: " << algName << "\n Algorithm alias: " << algAlias
3757  << std::endl;
3758  } else {
3759  //LogDebug("TriggerMenuParser")
3760  LogDebug("TriggerMenuParser") << "\n Alias defined for algorithm."
3761  << "\n Algorithm name: " << algName << "\n Algorithm alias: " << algAlias
3762  << std::endl;
3763  }
3764 
3765  // get the logical expression
3766  const std::string& logExpression = algorithm.getExpressionInCondition();
3767 
3768  LogDebug("TriggerMenuParser") << " Logical expression: " << logExpression
3769  << " Chip number: " << chipNr << std::endl;
3770 
3771  // determine output pin
3772  int outputPin = algorithm.getIndex();
3773 
3774  //LogTrace("TriggerMenuParser")
3775  LogDebug("TriggerMenuParser") << " Output pin: " << outputPin << std::endl;
3776 
3777  // compute the bit number from chip number, output pin and order of the chips
3778  // pin numbering start with 1, bit numbers with 0
3779  int bitNumber = outputPin; // + (m_orderConditionChip[chipNr] -1)*m_pinsOnConditionChip -1;
3780 
3781  //LogTrace("TriggerMenuParser")
3782  LogDebug("TriggerMenuParser") << " Bit number: " << bitNumber << std::endl;
3783 
3784  // create a new algorithm and insert it into algorithm map
3785  GlobalAlgorithm alg(algName, logExpression, bitNumber);
3786  alg.setAlgoChipNumber(static_cast<int>(chipNr));
3787  alg.setAlgoAlias(algAlias);
3788 
3789  if (edm::isDebugEnabled()) {
3790  std::ostringstream myCoutStream;
3791  alg.print(myCoutStream);
3792  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
3793  }
3794 
3795  // insert algorithm into the map
3796  if (!insertAlgorithmIntoMap(alg)) {
3797  return false;
3798  }
3799 
3800  return true;
3801 }
3802 // static class members
void setGtTriggerMenuName(const std::string &)
Definition: L1GtObject.h:38
constexpr int32_t ceil(float num)
bool isDebugEnabled()
void setCondGEq(const bool &cGEq)
const std::string & getName() const
void setModelVersion(const std::string &modelversion)
bool parseAlgorithm(L1TUtmAlgorithm algorithm, unsigned int chipNr=0)
parse all algorithms
const std::string & getComment() const
void setAlgoAlias(const std::string &algoAliasValue)
void setGtScaleDbKey(const std::string &)
const int getType() const
const std::vector< L1TUtmCut > & getCuts() const
Definition: L1TUtmObject.h:118
void setConditionParameter(const std::vector< ObjectParameter > &objParameter)
set functions
void parseCalMuEta_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string obj1, std::string obj2)
void parseCalMuPhi_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string obj1, std::string obj2)
void setGtOrderConditionChip(const std::vector< int > &)
int algoBitNumber() const
get / set algorithm bit number
void parseUpt_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string lutpfx, std::string obj1, unsigned int prec)
void setCorrelationThreeBodyParameter(const CorrelationThreeBodyParameter &corrThreeBodyParameter)
bool parseEnergySumCorr(const L1TUtmObject *corrESum, unsigned int chipNr=0)
void setCond0Index(const int &)
void print(std::ostream &myCout) const override
print the condition
void parseDeltaPhi_Cos_LUTS(const std::map< std::string, tmeventsetup::esScale > &scaleMap, const std::string &obj1, const std::string &obj2, unsigned int prec1, unsigned int prec2)
Definition: L1GtObject.h:36
bool parseExternal(L1TUtmCondition condExt, unsigned int chipNr=0)
const int algoOutputPin(const int numberConditionChips, const int pinsOnConditionChip, const std::vector< int > &orderConditionChip) const
get the output pin on the condition chip for the algorithm
void setCondType(const l1t::GtConditionType &cType)
void print(std::ostream &myCout) const override
print the condition
void setConditionParameter(const std::vector< ObjectParameter > &objParameter)
set functions
bool parseEnergySumZdc(L1TUtmCondition condEnergySumZdcs, unsigned int chipNr=0, const bool corrFlag=false)
void setCorrelationParameter(const CorrelationParameter &corrParameter)
void setGtAlgorithmMap(const AlgorithmMap &)
const std::vector< L1TUtmObject > & getObjects() const
void print(std::ostream &myCout) const override
print the condition
void print(std::ostream &myCout) const override
print condition
void setVecCaloTemplate(const std::vector< std::vector< CaloTemplate > > &)
virtual ~TriggerMenuParser()
destructor
std::map< std::string, unsigned int > getExternalSignals(const L1TUtmTriggerMenu *utmMenu)
const std::string & getScaleSetName() const
struct ZDCP ZDCP
Log< level::Error, false > LogError
const int getComparisonOperator() const
Definition: L1TUtmObject.h:103
const std::string & getName() const
Definition: L1TUtmObject.h:97
void setCondRelativeBx(const int &cRelativeBx)
const std::map< std::string, L1TUtmScale > & getScaleMap() const
std::vector< std::pair< double, double > > phiBins
Definition: GlobalScales.h:50
void setCond0Category(const l1t::GtConditionCategory &)
void print(std::ostream &myCout) const override
print the condition
void setCondChipNr(const int &cChipNr)
#define LogTrace(id)
void setVecEnergySumTemplate(const std::vector< std::vector< EnergySumTemplate > > &)
void setVecCorrelationTemplate(const std::vector< std::vector< CorrelationTemplate > > &)
const int algoChipNumber() const
get / set algorithm bit number
void print(std::ostream &myCout) const override
print the condition
Definition: MuonTemplate.cc:71
void setCorrelationWithOverlapRemovalParameter(const CorrelationWithOverlapRemovalParameter &corrParameter)
void setVecMuonTemplate(const std::vector< std::vector< MuonTemplate > > &)
bool parseMuonShower(L1TUtmCondition condMu, unsigned int chipNr=0, const bool corrFlag=false)
parse a muon shower condition
const int getBxOffset() const
Definition: L1TUtmObject.h:106
void setCond0Category(const l1t::GtConditionCategory &)
void setGtAlgorithmAliasMap(const AlgorithmMap &)
void setGtPinsOnConditionChip(const unsigned int &)
void setGtAlgorithmImplementation(const std::string &)
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
void setExternalChannel(unsigned int extCh)
set functions
bool parseCorrelationWithOverlapRemoval(const L1TUtmCondition &corrCond, unsigned int chipNr=0)
parse a correlation condition with overlap removal
void parseCondFormats(const L1TUtmTriggerMenu *utmMenu)
void parseDeltaEta_Cosh_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string obj1, std::string obj2, unsigned int prec1, unsigned int prec2)
Definition: L1GtObject.h:35
virtual void print(std::ostream &myCout) const
print condition
const int getType() const
Definition: L1TUtmObject.h:100
void print(std::ostream &myCout) const override
print the condition
void setGtTriggerMenuInterface(const std::string &)
bool parseAXOL1TL(L1TUtmCondition condAXOL1TL, unsigned int chipNr=0)
void setCond1Category(const l1t::GtConditionCategory &)
void setGtTriggerMenuAuthor(const std::string &)
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
Definition: CaloTemplate.cc:63
const std::map< std::string, L1TUtmCondition > & getConditionMap() const
void setGtTriggerMenuInterfaceDescription(const std::string &)
const std::string & getName() const
void setVecCorrelationThreeBodyTemplate(const std::vector< std::vector< CorrelationThreeBodyTemplate > > &)
void setVecAXOL1TLTemplate(const std::vector< std::vector< AXOL1TLTemplate > > &)
bool insertConditionIntoMap(GlobalCondition &cond, const int chipNr)
void setObjectType(const std::vector< l1t::GlobalObject > &objType)
void setCond1Category(const l1t::GtConditionCategory &)
ii
Definition: cuy.py:589
void setGtTriggerMenuDate(const std::string &)
bool parseMuonCorr(const L1TUtmObject *condMu, unsigned int chipNr=0)
void setCond2Category(const l1t::GtConditionCategory &)
bool parseMuon(L1TUtmCondition condMu, unsigned int chipNr=0, const bool corrFlag=false)
parse a muon condition
bool parseScales(std::map< std::string, tmeventsetup::esScale > scaleMap)
parse scales
const std::string & getFirmwareUuid() const
void setVecExternalTemplate(const std::vector< std::vector< ExternalTemplate > > &)
bool parseCaloCorr(const L1TUtmObject *corrCalo, unsigned int chipNr=0)
void setGtTriggerMenuDescription(const std::string &)
void setCorMuonTemplate(const std::vector< std::vector< MuonTemplate > > &)
void setCorEnergySumTemplate(const std::vector< std::vector< EnergySumTemplate > > &)
void setCond0Category(const l1t::GtConditionCategory &)
void setGtNumberConditionChips(const unsigned int &)
void print(std::ostream &myCout) const override
print the condition
void print(std::ostream &myCout) const override
print the condition
Definition: CaloTemplate.cc:69
const std::vector< L1TUtmCut > & getCuts() const
int l1tstr2int(const std::string data)
std::vector< std::pair< double, double > > etBins
Definition: GlobalScales.h:39
bool parseCalo(L1TUtmCondition condCalo, unsigned int chipNr=0, const bool corrFlag=false)
parse a calorimeter condition
void setAlgoChipNumber(const int algoChipNumberValue)
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
bool parseCorrelation(L1TUtmCondition corrCond, unsigned int chipNr=0)
parse a correlation condition
void setConditionParameter(const std::vector< ObjectParameter > &objParameter)
typedef for a single object template
Definition: GlobalScales.h:35
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
Definition: MuonTemplate.cc:65
void setGtTriggerMenuUUID(const int)
typedef for correlation parameters
Definition: CaloTemplate.h:88
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
void setVecMuonShowerTemplate(const std::vector< std::vector< MuonShowerTemplate > > &)
std::string const & algoAlias() const
get / set algorithm alias
std::vector< std::pair< double, double > > uptBins
Definition: GlobalScales.h:45
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
void setCorCaloTemplate(const std::vector< std::vector< CaloTemplate > > &)
void setVecCorrelationWithOverlapRemovalTemplate(const std::vector< std::vector< CorrelationWithOverlapRemovalTemplate > > &)
void setGtTriggerMenuInterfaceDate(const std::string &)
void setGtTriggerMenuImplementation(const unsigned long &)
step
Definition: StallMonitor.cc:83
void print(std::ostream &myCout) const override
print the condition
Definition: L1GtObject.h:37
const std::map< std::string, L1TUtmAlgorithm > & getAlgorithmMap() const
void setCond1Category(const l1t::GtConditionCategory &)
const std::string & getVersion() const
bool insertAlgorithmIntoMap(const GlobalAlgorithm &alg)
insert an algorithm into algorithm map
typedef for correlation parameters
void setVecEnergySumZdcTemplate(const std::vector< std::vector< EnergySumZdcTemplate > > &)
long double T
void setCond2Category(const l1t::GtConditionCategory &)
bool parseEnergySum(L1TUtmCondition condEnergySums, unsigned int chipNr=0, const bool corrFlag=false)
parse an "energy sum" condition
void setGtConditionMap(const std::vector< ConditionMap > &)
std::map< std::string, GlobalAlgorithm > AlgorithmMap
map containing the algorithms
bool parseCICADA(L1TUtmCondition condCICADA, unsigned int chipNr=0)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
bool parseCorrelationThreeBody(L1TUtmCondition corrCond, unsigned int chipNr=0)
parse a three-body correlation condition
void parsePhi_Trig_LUTS(const std::map< std::string, tmeventsetup::esScale > &scaleMap, const std::string &obj, TrigFunc_t func, unsigned int prec)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
const std::string algoName() const
get / set algorithm name
void setGtTriggerMenuInterfaceAuthor(const std::string &)
std::vector< std::pair< double, double > > etaBins
Definition: GlobalScales.h:55
void parsePt_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string lutpfx, std::string obj1, unsigned int prec)
const std::string & getDatetime() const
void setCond1Index(const int &)
void setGtNumberPhysTriggers(const unsigned int &)
#define LogDebug(id)
void setVecCICADATemplate(const std::vector< std::vector< CICADATemplate > > &)