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