CMS 3D CMS Logo

TriggerMenuParser.cc
Go to the documentation of this file.
1 
21 // this class header
22 #include "TriggerMenuParser.h"
23 
24 // system include files
25 #include <string>
26 #include <vector>
27 
28 #include <iostream>
29 #include <fstream>
30 #include <iomanip>
31 #include <cmath>
32 
34 
37 
38 #include "tmEventSetup/tmEventSetup.hh"
39 #include "tmEventSetup/esTriggerMenu.hh"
40 #include "tmEventSetup/esAlgorithm.hh"
41 #include "tmEventSetup/esCondition.hh"
42 #include "tmEventSetup/esObject.hh"
43 #include "tmEventSetup/esCut.hh"
44 #include "tmEventSetup/esScale.hh"
45 #include "tmGrammar/Algorithm.hh"
46 #include <cstdint>
47 
48 // constructor
50  : m_triggerMenuInterface("NULL"),
51  m_triggerMenuName("NULL"),
52  m_triggerMenuImplementation(0x0),
53  m_scaleDbKey("NULL")
54 
55 {
56  // menu names, scale key initialized to NULL due to ORACLE treatment of strings
57 
58  // empty
59 }
60 
61 // destructor
63 
64 // set the number of condition chips in GTL
65 void l1t::TriggerMenuParser::setGtNumberConditionChips(const unsigned int& numberConditionChipsValue) {
66  m_numberConditionChips = numberConditionChipsValue;
67 }
68 
69 // set the number of pins on the GTL condition chips
70 void l1t::TriggerMenuParser::setGtPinsOnConditionChip(const unsigned int& pinsOnConditionChipValue) {
71  m_pinsOnConditionChip = pinsOnConditionChipValue;
72 }
73 
74 // set the correspondence "condition chip - GTL algorithm word"
75 // in the hardware
76 void l1t::TriggerMenuParser::setGtOrderConditionChip(const std::vector<int>& orderConditionChipValue) {
77  m_orderConditionChip = orderConditionChipValue;
78 }
79 
80 // set the number of physics trigger algorithms
81 void l1t::TriggerMenuParser::setGtNumberPhysTriggers(const unsigned int& numberPhysTriggersValue) {
82  m_numberPhysTriggers = numberPhysTriggersValue;
83 }
84 
85 // set the condition maps
86 void l1t::TriggerMenuParser::setGtConditionMap(const std::vector<ConditionMap>& condMap) { m_conditionMap = condMap; }
87 
88 // set the trigger menu name
90  m_triggerMenuInterface = menuInterface;
91 }
92 
93 // set the trigger menu uuid
94 void l1t::TriggerMenuParser::setGtTriggerMenuUUID(const int uuid) { m_triggerMenuUUID = uuid; }
95 
96 void l1t::TriggerMenuParser::setGtTriggerMenuName(const std::string& menuName) { m_triggerMenuName = menuName; }
97 
98 void l1t::TriggerMenuParser::setGtTriggerMenuImplementation(const unsigned long& menuImplementation) {
99  m_triggerMenuImplementation = menuImplementation;
100 }
101 
102 // set menu associated scale key
103 void l1t::TriggerMenuParser::setGtScaleDbKey(const std::string& scaleKey) { m_scaleDbKey = scaleKey; }
104 
105 // set the vectors containing the conditions
106 void l1t::TriggerMenuParser::setVecMuonTemplate(const std::vector<std::vector<MuonTemplate> >& vecMuonTempl) {
107  m_vecMuonTemplate = vecMuonTempl;
108 }
109 
110 void l1t::TriggerMenuParser::setVecCaloTemplate(const std::vector<std::vector<CaloTemplate> >& vecCaloTempl) {
111  m_vecCaloTemplate = vecCaloTempl;
112 }
113 
115  const std::vector<std::vector<EnergySumTemplate> >& vecEnergySumTempl) {
116  m_vecEnergySumTemplate = vecEnergySumTempl;
117 }
118 
120  const std::vector<std::vector<ExternalTemplate> >& vecExternalTempl) {
121  m_vecExternalTemplate = vecExternalTempl;
122 }
123 
125  const std::vector<std::vector<CorrelationTemplate> >& vecCorrelationTempl) {
126  m_vecCorrelationTemplate = vecCorrelationTempl;
127 }
128 
130  const std::vector<std::vector<CorrelationWithOverlapRemovalTemplate> >& vecCorrelationWithOverlapRemovalTempl) {
131  m_vecCorrelationWithOverlapRemovalTemplate = vecCorrelationWithOverlapRemovalTempl;
132 }
133 
134 // set the vectors containing the conditions for correlation templates
135 //
136 void l1t::TriggerMenuParser::setCorMuonTemplate(const std::vector<std::vector<MuonTemplate> >& corMuonTempl) {
137  m_corMuonTemplate = corMuonTempl;
138 }
139 
140 void l1t::TriggerMenuParser::setCorCaloTemplate(const std::vector<std::vector<CaloTemplate> >& corCaloTempl) {
141  m_corCaloTemplate = corCaloTempl;
142 }
143 
145  const std::vector<std::vector<EnergySumTemplate> >& corEnergySumTempl) {
146  m_corEnergySumTemplate = corEnergySumTempl;
147 }
148 
149 // set the algorithm map (by algorithm names)
150 void l1t::TriggerMenuParser::setGtAlgorithmMap(const AlgorithmMap& algoMap) { m_algorithmMap = algoMap; }
151 
152 // set the algorithm map (by algorithm aliases)
153 void l1t::TriggerMenuParser::setGtAlgorithmAliasMap(const AlgorithmMap& algoMap) { m_algorithmAliasMap = algoMap; }
154 
155 std::map<std::string, unsigned int> l1t::TriggerMenuParser::getExternalSignals(const L1TUtmTriggerMenu* utmMenu) {
156  using namespace tmeventsetup;
157  const esTriggerMenu* menu = reinterpret_cast<const esTriggerMenu*>(utmMenu);
158  const std::map<std::string, esCondition>& condMap = menu->getConditionMap();
159 
160  std::map<std::string, unsigned int> extBitMap;
161 
162  //loop over the algorithms
163  for (std::map<std::string, esCondition>::const_iterator cit = condMap.begin(); cit != condMap.end(); cit++) {
164  const esCondition& condition = cit->second;
165  if (condition.getType() == esConditionType::Externals) {
166  // Get object for External conditions
167  const std::vector<esObject>& objects = condition.getObjects();
168  for (size_t jj = 0; jj < objects.size(); jj++) {
169  const esObject object = objects.at(jj);
170  if (object.getType() == esObjectType::EXT) {
171  unsigned int channelID = object.getExternalChannelId();
172  std::string name = object.getExternalSignalName();
173 
174  if (extBitMap.count(name) == 0)
175  extBitMap.insert(std::map<std::string, unsigned int>::value_type(name, channelID));
176  }
177  }
178  }
179  }
180  /*
181  for (std::map<std::string, unsigned int>::const_iterator cit = extBitMap.begin();
182  cit != extBitMap.end(); cit++) {
183  std::cout << " Ext Map: Name " << cit->first << " Bit " << cit->second << std::endl;
184  }
185 */
186  return extBitMap;
187 }
188 
189 // parse def.xml file
191  // resize the vector of condition maps
192  // the number of condition chips should be correctly set before calling parseXmlFile
193  m_conditionMap.resize(m_numberConditionChips);
194 
195  m_vecMuonTemplate.resize(m_numberConditionChips);
196  m_vecCaloTemplate.resize(m_numberConditionChips);
197  m_vecEnergySumTemplate.resize(m_numberConditionChips);
198  m_vecExternalTemplate.resize(m_numberConditionChips);
199 
200  m_vecCorrelationTemplate.resize(m_numberConditionChips);
201  m_vecCorrelationWithOverlapRemovalTemplate.resize(m_numberConditionChips);
202  m_corMuonTemplate.resize(m_numberConditionChips);
203  m_corCaloTemplate.resize(m_numberConditionChips);
204  m_corEnergySumTemplate.resize(m_numberConditionChips);
205 
206  using namespace tmeventsetup;
207  using namespace Algorithm;
208 
209  const esTriggerMenu* menu = reinterpret_cast<const esTriggerMenu*>(utmMenu);
210 
211  //get the meta data
212  m_triggerMenuDescription = menu->getComment();
213  m_triggerMenuDate = menu->getDatetime();
214  m_triggerMenuImplementation = (getMmHashN(menu->getFirmwareUuid()) & 0xFFFFFFFF); //make sure we only have 32 bits
215  m_triggerMenuName = menu->getName();
216  m_triggerMenuInterface = menu->getVersion(); //BLW: correct descriptor?
217  m_triggerMenuUUID = (getMmHashN(menu->getName()) & 0xFFFFFFFF); //make sure we only have 32 bits
218 
219  const std::map<std::string, esAlgorithm>& algoMap = menu->getAlgorithmMap();
220  const std::map<std::string, esCondition>& condMap = menu->getConditionMap();
221  const std::map<std::string, esScale>& scaleMap = menu->getScaleMap();
222 
223  // parse the scales
224  m_gtScales.setScalesName(menu->getScaleSetName());
225  parseScales(scaleMap);
226 
227  //loop over the algorithms
228  for (std::map<std::string, esAlgorithm>::const_iterator cit = algoMap.begin(); cit != algoMap.end(); cit++) {
229  //condition chip (artifact) TO DO: Update
230  int chipNr = 0;
231 
232  //get algorithm
233  const esAlgorithm& algo = cit->second;
234 
235  //parse the algorithm
236  parseAlgorithm(algo, chipNr); //blw
237 
238  //get conditions for this algorithm
239  const std::vector<std::string>& rpn_vec = algo.getRpnVector();
240  for (size_t ii = 0; ii < rpn_vec.size(); ii++) {
241  const std::string& token = rpn_vec.at(ii);
242  if (isGate(token))
243  continue;
244  // long hash = getHash(token);
245  const esCondition& condition = condMap.find(token)->second;
246 
247  //check to see if this condtion already exists
248  if ((m_conditionMap[chipNr]).count(condition.getName()) == 0) {
249  // parse Calo Conditions (EG, Jets, Taus)
250  if (condition.getType() == esConditionType::SingleEgamma ||
251  condition.getType() == esConditionType::DoubleEgamma ||
252  condition.getType() == esConditionType::TripleEgamma ||
253  condition.getType() == esConditionType::QuadEgamma || condition.getType() == esConditionType::SingleTau ||
254  condition.getType() == esConditionType::DoubleTau || condition.getType() == esConditionType::TripleTau ||
255  condition.getType() == esConditionType::QuadTau || condition.getType() == esConditionType::SingleJet ||
256  condition.getType() == esConditionType::DoubleJet || condition.getType() == esConditionType::TripleJet ||
257  condition.getType() == esConditionType::QuadJet) {
258  parseCalo(condition, chipNr, false);
259 
260  // parse Energy Sums
261  } else if (condition.getType() == esConditionType::TotalEt ||
262  condition.getType() == esConditionType::TotalEtEM ||
263  condition.getType() == esConditionType::TotalHt ||
264  condition.getType() == esConditionType::MissingEt ||
265  condition.getType() == esConditionType::MissingHt ||
266  condition.getType() == esConditionType::MissingEtHF ||
267  condition.getType() == esConditionType::TowerCount ||
268  condition.getType() == esConditionType::MinBiasHFP0 ||
269  condition.getType() == esConditionType::MinBiasHFM0 ||
270  condition.getType() == esConditionType::MinBiasHFP1 ||
271  condition.getType() == esConditionType::MinBiasHFM1 ||
272  condition.getType() == esConditionType::AsymmetryEt ||
273  condition.getType() == esConditionType::AsymmetryHt ||
274  condition.getType() == esConditionType::AsymmetryEtHF ||
275  condition.getType() == esConditionType::AsymmetryHtHF ||
276  condition.getType() == esConditionType::Centrality0 ||
277  condition.getType() == esConditionType::Centrality1 ||
278  condition.getType() == esConditionType::Centrality2 ||
279  condition.getType() == esConditionType::Centrality3 ||
280  condition.getType() == esConditionType::Centrality4 ||
281  condition.getType() == esConditionType::Centrality5 ||
282  condition.getType() == esConditionType::Centrality6 ||
283  condition.getType() == esConditionType::Centrality7) {
284  parseEnergySum(condition, chipNr, false);
285 
286  //parse Muons
287  } else if (condition.getType() == esConditionType::SingleMuon ||
288  condition.getType() == esConditionType::DoubleMuon ||
289  condition.getType() == esConditionType::TripleMuon ||
290  condition.getType() == esConditionType::QuadMuon) {
291  parseMuon(condition, chipNr, false);
292 
293  //parse Correlation Conditions
294  } else if (condition.getType() == esConditionType::MuonMuonCorrelation ||
295  condition.getType() == esConditionType::MuonEsumCorrelation ||
296  condition.getType() == esConditionType::CaloMuonCorrelation ||
297  condition.getType() == esConditionType::CaloCaloCorrelation ||
298  condition.getType() == esConditionType::CaloEsumCorrelation ||
299  condition.getType() == esConditionType::InvariantMass ||
300  condition.getType() == esConditionType::TransverseMass) {
301  parseCorrelation(condition, chipNr);
302 
303  //parse Externals
304  } else if (condition.getType() == esConditionType::Externals) {
305  parseExternal(condition, chipNr);
306 
307  } else if (condition.getType() == esConditionType::SingleEgammaOvRm ||
308  condition.getType() == esConditionType::DoubleEgammaOvRm ||
309  condition.getType() == esConditionType::TripleEgammaOvRm ||
310  condition.getType() == esConditionType::QuadEgammaOvRm ||
311  condition.getType() == esConditionType::SingleTauOvRm ||
312  condition.getType() == esConditionType::DoubleTauOvRm ||
313  condition.getType() == esConditionType::TripleTauOvRm ||
314  condition.getType() == esConditionType::QuadTauOvRm ||
315  condition.getType() == esConditionType::SingleJetOvRm ||
316  condition.getType() == esConditionType::DoubleJetOvRm ||
317  condition.getType() == esConditionType::TripleJetOvRm ||
318  condition.getType() == esConditionType::QuadJetOvRm) {
319  edm::LogError("TriggerMenuParser")
320  << std::endl
321  << "SingleEgammaOvRm" << std::endl
322  << "DoubleEgammaOvRm" << std::endl
323  << "TripleEgammaOvRm" << std::endl
324  << "QuadEgammaOvRm" << std::endl
325  << "SingleTauOvRm" << std::endl
326  << "DoubleTauOvRm" << std::endl
327  << "TripleTauOvRm" << std::endl
328  << "QuadTauOvRm" << std::endl
329  << "SingleJetOvRm" << std::endl
330  << "DoubleJetOvRm" << std::endl
331  << "TripleJetOvRm" << std::endl
332  << "QuadJetOvRm" << std::endl
333  << "The above conditions types OvRm are not implemented yet in the parser. Please remove alogrithms that "
334  "use this type of condtion from L1T Menu!"
335  << std::endl;
336 
337  }
338  //parse CorrelationWithOverlapRemoval
339  else if (condition.getType() == esConditionType::CaloCaloCorrelationOvRm ||
340  condition.getType() == esConditionType::InvariantMassOvRm ||
341  condition.getType() == esConditionType::TransverseMassOvRm) {
342  parseCorrelationWithOverlapRemoval(condition, chipNr);
343  }
344 
345  } //if condition is a new one
346  } //loop over conditions
347  } //loop over algorithms
348 
349  return;
350 }
351 
352 //
353 
354 void l1t::TriggerMenuParser::setGtTriggerMenuInterfaceDate(const std::string& val) { m_triggerMenuInterfaceDate = val; }
355 
357  m_triggerMenuInterfaceAuthor = val;
358 }
359 
361  m_triggerMenuInterfaceDescription = val;
362 }
363 
365 
366 void l1t::TriggerMenuParser::setGtTriggerMenuAuthor(const std::string& val) { m_triggerMenuAuthor = val; }
367 
368 void l1t::TriggerMenuParser::setGtTriggerMenuDescription(const std::string& val) { m_triggerMenuDescription = val; }
369 
370 void l1t::TriggerMenuParser::setGtAlgorithmImplementation(const std::string& val) { m_algorithmImplementation = val; }
371 
372 // methods for conditions and algorithms
373 
374 // clearMaps - delete all conditions and algorithms in
375 // the maps and clear the maps.
377  // loop over condition maps (one map per condition chip)
378  // then loop over conditions in the map
379  for (std::vector<ConditionMap>::iterator itCondOnChip = m_conditionMap.begin(); itCondOnChip != m_conditionMap.end();
380  itCondOnChip++) {
381  // the conditions in the maps are deleted in L1uGtTriggerMenu, not here
382 
383  itCondOnChip->clear();
384  }
385 
386  // the algorithms in the maps are deleted in L1uGtTriggerMenu, not here
387  m_algorithmMap.clear();
388 }
389 
390 // insertConditionIntoMap - safe insert of condition into condition map.
391 // if the condition name already exists, do not insert it and return false
393  std::string cName = cond.condName();
394  LogTrace("TriggerMenuParser") << " Trying to insert condition \"" << cName << "\" in the condition map."
395  << std::endl;
396 
397  // no condition name has to appear twice!
398  if ((m_conditionMap[chipNr]).count(cName) != 0) {
399  LogTrace("TriggerMenuParser") << " Condition " << cName << " already exists - not inserted!" << std::endl;
400  return false;
401  }
402 
403  (m_conditionMap[chipNr])[cName] = &cond;
404  LogTrace("TriggerMenuParser") << " OK - condition inserted!" << std::endl;
405 
406  return true;
407 }
408 
409 // insert an algorithm into algorithm map
411  std::string algName = alg.algoName();
412  const std::string& algAlias = alg.algoAlias();
413  //LogTrace("TriggerMenuParser")
414  //<< " Trying to insert algorithm \"" << algName << "\" in the algorithm map." ;
415 
416  // no algorithm name has to appear twice!
417  if (m_algorithmMap.count(algName) != 0) {
418  LogTrace("TriggerMenuParser") << " Algorithm \"" << algName
419  << "\"already exists in the algorithm map- not inserted!" << std::endl;
420  return false;
421  }
422 
423  if (m_algorithmAliasMap.count(algAlias) != 0) {
424  LogTrace("TriggerMenuParser") << " Algorithm alias \"" << algAlias
425  << "\"already exists in the algorithm alias map- not inserted!" << std::endl;
426  return false;
427  }
428 
429  // bit number less than zero or greater than maximum number of algorithms
430  int bitNumber = alg.algoBitNumber();
431  if ((bitNumber < 0) || (bitNumber >= static_cast<int>(m_numberPhysTriggers))) {
432  LogTrace("TriggerMenuParser") << " Bit number " << bitNumber << " outside allowed range [0, "
433  << m_numberPhysTriggers << ") - algorithm not inserted!" << std::endl;
434  return false;
435  }
436 
437  // maximum number of algorithms
438  if (m_algorithmMap.size() >= m_numberPhysTriggers) {
439  LogTrace("TriggerMenuParser") << " More than maximum allowed " << m_numberPhysTriggers
440  << " algorithms in the algorithm map - not inserted!" << std::endl;
441  return false;
442  }
443 
444  // chip number outside allowed values
445  int chipNr = alg.algoChipNumber(
446  static_cast<int>(m_numberConditionChips), static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
447 
448  if ((chipNr < 0) || (chipNr > static_cast<int>(m_numberConditionChips))) {
449  LogTrace("TriggerMenuParser") << " Chip number " << chipNr << " outside allowed range [0, "
450  << m_numberConditionChips << ") - algorithm not inserted!" << std::endl;
451  return false;
452  }
453 
454  // output pin outside allowed values
455  int outputPin = alg.algoOutputPin(
456  static_cast<int>(m_numberConditionChips), static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
457 
458  if ((outputPin < 0) || (outputPin > static_cast<int>(m_pinsOnConditionChip))) {
459  LogTrace("TriggerMenuParser") << " Output pin " << outputPin << " outside allowed range [0, "
460  << m_pinsOnConditionChip << "] - algorithm not inserted!" << std::endl;
461  return false;
462  }
463 
464  // no two algorithms on the same chip can have the same output pin
465  for (CItAlgo itAlgo = m_algorithmMap.begin(); itAlgo != m_algorithmMap.end(); itAlgo++) {
466  int iPin = (itAlgo->second)
467  .algoOutputPin(static_cast<int>(m_numberConditionChips),
468  static_cast<int>(m_pinsOnConditionChip),
469  m_orderConditionChip);
470  std::string iName = itAlgo->first;
471  int iChip = (itAlgo->second)
472  .algoChipNumber(static_cast<int>(m_numberConditionChips),
473  static_cast<int>(m_pinsOnConditionChip),
474  m_orderConditionChip);
475 
476  if ((outputPin == iPin) && (chipNr == iChip)) {
477  LogTrace("TriggerMenuParser") << " Output pin " << outputPin << " is the same as for algorithm " << iName
478  << "\n from the same chip number " << chipNr << " - algorithm not inserted!"
479  << std::endl;
480  return false;
481  }
482  }
483 
484  // insert algorithm
485  m_algorithmMap[algName] = alg;
486  m_algorithmAliasMap[algAlias] = alg;
487 
488  //LogTrace("TriggerMenuParser")
489  //<< " OK - algorithm inserted!"
490  //<< std::endl;
491 
492  return true;
493 }
494 
495 template <typename T>
497  std::stringstream ss;
498  ss << data;
499  return ss.str();
500 }
502  std::stringstream ss;
503  ss << data;
504  int value;
505  ss >> value;
506  return value;
507 }
508 
516 bool l1t::TriggerMenuParser::parseScales(std::map<std::string, tmeventsetup::esScale> scaleMap) {
517  using namespace tmeventsetup;
518 
519  // Setup ScaleParameter to hold information from parsing
525  GlobalScales::ScaleParameters ettEmScales;
527  GlobalScales::ScaleParameters etmHfScales;
530 
531  // Start by parsing the Scale Map
532  for (std::map<std::string, esScale>::const_iterator cit = scaleMap.begin(); cit != scaleMap.end(); cit++) {
533  const esScale& scale = cit->second;
534 
535  GlobalScales::ScaleParameters* scaleParam;
536  if (scale.getObjectType() == esObjectType::Muon)
537  scaleParam = &muScales;
538  else if (scale.getObjectType() == esObjectType::Egamma)
539  scaleParam = &egScales;
540  else if (scale.getObjectType() == esObjectType::Tau)
541  scaleParam = &tauScales;
542  else if (scale.getObjectType() == esObjectType::Jet)
543  scaleParam = &jetScales;
544  else if (scale.getObjectType() == esObjectType::ETT)
545  scaleParam = &ettScales;
546  else if (scale.getObjectType() == esObjectType::ETTEM)
547  scaleParam = &ettEmScales;
548  else if (scale.getObjectType() == esObjectType::ETM)
549  scaleParam = &etmScales;
550  else if (scale.getObjectType() == esObjectType::ETMHF)
551  scaleParam = &etmHfScales;
552  else if (scale.getObjectType() == esObjectType::HTT)
553  scaleParam = &httScales;
554  else if (scale.getObjectType() == esObjectType::HTM)
555  scaleParam = &htmScales;
556  else
557  scaleParam = nullptr;
558 
559  if (scaleParam != nullptr) {
560  switch (scale.getScaleType()) {
561  case esScaleType::EtScale: {
562  scaleParam->etMin = scale.getMinimum();
563  scaleParam->etMax = scale.getMaximum();
564  scaleParam->etStep = scale.getStep();
565 
566  //Get bin edges
567  const std::vector<esBin>& binsV = scale.getBins();
568  for (unsigned int i = 0; i < binsV.size(); i++) {
569  const esBin& bin = binsV.at(i);
570  std::pair<double, double> binLimits(bin.minimum, bin.maximum);
571  scaleParam->etBins.push_back(binLimits);
572  }
573 
574  // If this is an energy sum fill dummy values for eta and phi
575  // There are no scales for these in the XML so the other case statements will not be seen....do it here.
576  if (scale.getObjectType() == esObjectType::ETT || scale.getObjectType() == esObjectType::HTT ||
577  scale.getObjectType() == esObjectType::ETM || scale.getObjectType() == esObjectType::HTM ||
578  scale.getObjectType() == esObjectType::ETTEM || scale.getObjectType() == esObjectType::ETMHF) {
579  scaleParam->etaMin = -1.;
580  scaleParam->etaMax = -1.;
581  scaleParam->etaStep = -1.;
582  if (scale.getObjectType() == esObjectType::ETT || scale.getObjectType() == esObjectType::HTT ||
583  scale.getObjectType() == esObjectType::ETTEM) {
584  // if(scale.getObjectType() == esObjectType::ETT || scale.getObjectType() == esObjectType::HTT) {
585  scaleParam->phiMin = -1.;
586  scaleParam->phiMax = -1.;
587  scaleParam->phiStep = -1.;
588  }
589  }
590  } break;
591  case esScaleType::EtaScale: {
592  scaleParam->etaMin = scale.getMinimum();
593  scaleParam->etaMax = scale.getMaximum();
594  scaleParam->etaStep = scale.getStep();
595 
596  //Get bin edges
597  const std::vector<esBin>& binsV = scale.getBins();
598  scaleParam->etaBins.resize(pow(2, scale.getNbits()));
599  for (unsigned int i = 0; i < binsV.size(); i++) {
600  const esBin& bin = binsV.at(i);
601  std::pair<double, double> binLimits(bin.minimum, bin.maximum);
602  scaleParam->etaBins.at(bin.hw_index) = binLimits;
603  }
604  } break;
605  case esScaleType::PhiScale: {
606  scaleParam->phiMin = scale.getMinimum();
607  scaleParam->phiMax = scale.getMaximum();
608  scaleParam->phiStep = scale.getStep();
609 
610  //Get bin edges
611  const std::vector<esBin>& binsV = scale.getBins();
612  scaleParam->phiBins.resize(pow(2, scale.getNbits()));
613  for (unsigned int i = 0; i < binsV.size(); i++) {
614  const esBin& bin = binsV.at(i);
615  std::pair<double, double> binLimits(bin.minimum, bin.maximum);
616  scaleParam->phiBins.at(bin.hw_index) = binLimits;
617  }
618  } break;
619  default:
620 
621  break;
622  } //end switch
623  } //end valid scale
624  } //end loop over scaleMap
625 
626  // put the ScaleParameters into the class
627  m_gtScales.setMuonScales(muScales);
628  m_gtScales.setEGScales(egScales);
629  m_gtScales.setTauScales(tauScales);
630  m_gtScales.setJetScales(jetScales);
631  m_gtScales.setETTScales(ettScales);
632  m_gtScales.setETTEmScales(ettEmScales);
633  m_gtScales.setETMScales(etmScales);
634  m_gtScales.setETMHfScales(etmHfScales);
635  m_gtScales.setHTTScales(httScales);
636  m_gtScales.setHTMScales(htmScales);
637 
638  // Setup the LUT for the Scale Conversions
639  bool hasPrecision = false;
640  std::map<std::string, unsigned int> precisions;
641  getPrecisions(precisions, scaleMap);
642  for (std::map<std::string, unsigned int>::const_iterator cit = precisions.begin(); cit != precisions.end(); cit++) {
643  //std::cout << cit->first << " = " << cit->second << "\n";
644  hasPrecision = true;
645  }
646 
647  if (hasPrecision) {
648  //Start with the Cal - Muon Eta LUTS
649  //----------------------------------
650  parseCalMuEta_LUTS(scaleMap, "EG", "MU");
651  parseCalMuEta_LUTS(scaleMap, "JET", "MU");
652  parseCalMuEta_LUTS(scaleMap, "TAU", "MU");
653 
654  //Now the Cal - Muon Phi LUTS
655  //-------------------------------------
656  parseCalMuPhi_LUTS(scaleMap, "EG", "MU");
657  parseCalMuPhi_LUTS(scaleMap, "JET", "MU");
658  parseCalMuPhi_LUTS(scaleMap, "TAU", "MU");
659  parseCalMuPhi_LUTS(scaleMap, "HTM", "MU");
660  parseCalMuPhi_LUTS(scaleMap, "ETM", "MU");
661  parseCalMuPhi_LUTS(scaleMap, "ETMHF", "MU");
662 
663  // Now the Pt LUTs (??? more combinations needed ??)
664  // ---------------
665  parsePt_LUTS(scaleMap, "Mass", "EG", precisions["PRECISION-EG-MU-MassPt"]);
666  parsePt_LUTS(scaleMap, "Mass", "MU", precisions["PRECISION-EG-MU-MassPt"]);
667  parsePt_LUTS(scaleMap, "Mass", "JET", precisions["PRECISION-EG-JET-MassPt"]);
668  parsePt_LUTS(scaleMap, "Mass", "TAU", precisions["PRECISION-EG-TAU-MassPt"]);
669  parsePt_LUTS(scaleMap, "Mass", "ETM", precisions["PRECISION-EG-ETM-MassPt"]);
670  parsePt_LUTS(scaleMap, "Mass", "ETMHF", precisions["PRECISION-EG-ETMHF-MassPt"]);
671  parsePt_LUTS(scaleMap, "Mass", "HTM", precisions["PRECISION-EG-HTM-MassPt"]);
672 
673  // Now the Pt LUTs for TBPT calculation (??? CCLA following what was done for MASS pt LUTs for now ??)
674  // ---------------
675  parsePt_LUTS(scaleMap, "TwoBody", "EG", precisions["PRECISION-EG-MU-TwoBodyPt"]);
676  parsePt_LUTS(scaleMap, "TwoBody", "MU", precisions["PRECISION-EG-MU-TwoBodyPt"]);
677  parsePt_LUTS(scaleMap, "TwoBody", "JET", precisions["PRECISION-EG-JET-TwoBodyPt"]);
678  parsePt_LUTS(scaleMap, "TwoBody", "TAU", precisions["PRECISION-EG-TAU-TwoBodyPt"]);
679  parsePt_LUTS(scaleMap, "TwoBody", "ETM", precisions["PRECISION-EG-ETM-TwoBodyPt"]);
680  parsePt_LUTS(scaleMap, "TwoBody", "ETMHF", precisions["PRECISION-EG-ETMHF-TwoBodyPt"]);
681  parsePt_LUTS(scaleMap, "TwoBody", "HTM", precisions["PRECISION-EG-HTM-TwoBodyPt"]);
682 
683  // Now the Delta Eta/Cosh LUTs (must be done in groups)
684  // ----------------------------------------------------
685  parseDeltaEta_Cosh_LUTS(
686  scaleMap, "EG", "EG", precisions["PRECISION-EG-EG-Delta"], precisions["PRECISION-EG-EG-Math"]);
687  parseDeltaEta_Cosh_LUTS(
688  scaleMap, "EG", "JET", precisions["PRECISION-EG-JET-Delta"], precisions["PRECISION-EG-JET-Math"]);
689  parseDeltaEta_Cosh_LUTS(
690  scaleMap, "EG", "TAU", precisions["PRECISION-EG-TAU-Delta"], precisions["PRECISION-EG-TAU-Math"]);
691  parseDeltaEta_Cosh_LUTS(
692  scaleMap, "EG", "MU", precisions["PRECISION-EG-MU-Delta"], precisions["PRECISION-EG-MU-Math"]);
693 
694  parseDeltaEta_Cosh_LUTS(
695  scaleMap, "JET", "JET", precisions["PRECISION-JET-JET-Delta"], precisions["PRECISION-JET-JET-Math"]);
696  parseDeltaEta_Cosh_LUTS(
697  scaleMap, "JET", "TAU", precisions["PRECISION-JET-TAU-Delta"], precisions["PRECISION-JET-TAU-Math"]);
698  parseDeltaEta_Cosh_LUTS(
699  scaleMap, "JET", "MU", precisions["PRECISION-JET-MU-Delta"], precisions["PRECISION-JET-MU-Math"]);
700 
701  parseDeltaEta_Cosh_LUTS(
702  scaleMap, "TAU", "TAU", precisions["PRECISION-TAU-TAU-Delta"], precisions["PRECISION-TAU-TAU-Math"]);
703  parseDeltaEta_Cosh_LUTS(
704  scaleMap, "TAU", "MU", precisions["PRECISION-TAU-MU-Delta"], precisions["PRECISION-TAU-MU-Math"]);
705 
706  parseDeltaEta_Cosh_LUTS(
707  scaleMap, "MU", "MU", precisions["PRECISION-MU-MU-Delta"], precisions["PRECISION-MU-MU-Math"]);
708 
709  // Now the Delta Phi/Cos LUTs (must be done in groups)
710  // ----------------------------------------------------
711  parseDeltaPhi_Cos_LUTS(
712  scaleMap, "EG", "EG", precisions["PRECISION-EG-EG-Delta"], precisions["PRECISION-EG-EG-Math"]);
713  parseDeltaPhi_Cos_LUTS(
714  scaleMap, "EG", "JET", precisions["PRECISION-EG-JET-Delta"], precisions["PRECISION-EG-JET-Math"]);
715  parseDeltaPhi_Cos_LUTS(
716  scaleMap, "EG", "TAU", precisions["PRECISION-EG-TAU-Delta"], precisions["PRECISION-EG-TAU-Math"]);
717  parseDeltaPhi_Cos_LUTS(
718  scaleMap, "EG", "ETM", precisions["PRECISION-EG-ETM-Delta"], precisions["PRECISION-EG-ETM-Math"]);
719  parseDeltaPhi_Cos_LUTS(
720  scaleMap, "EG", "ETMHF", precisions["PRECISION-EG-ETMHF-Delta"], precisions["PRECISION-EG-ETMHF-Math"]);
721  parseDeltaPhi_Cos_LUTS(
722  scaleMap, "EG", "HTM", precisions["PRECISION-EG-HTM-Delta"], precisions["PRECISION-EG-HTM-Math"]);
723  parseDeltaPhi_Cos_LUTS(
724  scaleMap, "EG", "MU", precisions["PRECISION-EG-MU-Delta"], precisions["PRECISION-EG-MU-Math"]);
725 
726  parseDeltaPhi_Cos_LUTS(
727  scaleMap, "JET", "JET", precisions["PRECISION-JET-JET-Delta"], precisions["PRECISION-JET-JET-Math"]);
728  parseDeltaPhi_Cos_LUTS(
729  scaleMap, "JET", "TAU", precisions["PRECISION-JET-TAU-Delta"], precisions["PRECISION-JET-TAU-Math"]);
730  parseDeltaPhi_Cos_LUTS(
731  scaleMap, "JET", "ETM", precisions["PRECISION-JET-ETM-Delta"], precisions["PRECISION-JET-ETM-Math"]);
732  parseDeltaPhi_Cos_LUTS(
733  scaleMap, "JET", "ETMHF", precisions["PRECISION-JET-ETMHF-Delta"], precisions["PRECISION-JET-ETMHF-Math"]);
734  parseDeltaPhi_Cos_LUTS(
735  scaleMap, "JET", "HTM", precisions["PRECISION-JET-HTM-Delta"], precisions["PRECISION-JET-HTM-Math"]);
736  parseDeltaPhi_Cos_LUTS(
737  scaleMap, "JET", "MU", precisions["PRECISION-JET-MU-Delta"], precisions["PRECISION-JET-MU-Math"]);
738 
739  parseDeltaPhi_Cos_LUTS(
740  scaleMap, "TAU", "TAU", precisions["PRECISION-TAU-TAU-Delta"], precisions["PRECISION-TAU-TAU-Math"]);
741  parseDeltaPhi_Cos_LUTS(
742  scaleMap, "TAU", "ETM", precisions["PRECISION-TAU-ETM-Delta"], precisions["PRECISION-TAU-ETM-Math"]);
743  parseDeltaPhi_Cos_LUTS(
744  scaleMap, "TAU", "ETMHF", precisions["PRECISION-TAU-ETMHF-Delta"], precisions["PRECISION-TAU-ETMHF-Math"]);
745  parseDeltaPhi_Cos_LUTS(
746  scaleMap, "TAU", "HTM", precisions["PRECISION-TAU-HTM-Delta"], precisions["PRECISION-TAU-HTM-Math"]);
747  parseDeltaPhi_Cos_LUTS(
748  scaleMap, "TAU", "MU", precisions["PRECISION-TAU-MU-Delta"], precisions["PRECISION-TAU-MU-Math"]);
749 
750  parseDeltaPhi_Cos_LUTS(
751  scaleMap, "MU", "ETM", precisions["PRECISION-MU-ETM-Delta"], precisions["PRECISION-MU-ETM-Math"]);
752  parseDeltaPhi_Cos_LUTS(
753  scaleMap, "MU", "ETMHF", precisions["PRECISION-MU-ETMHF-Delta"], precisions["PRECISION-MU-ETMHF-Math"]);
754  parseDeltaPhi_Cos_LUTS(
755  scaleMap, "MU", "HTM", precisions["PRECISION-MU-HTM-Delta"], precisions["PRECISION-MU-HTM-Math"]);
756  parseDeltaPhi_Cos_LUTS(
757  scaleMap, "MU", "MU", precisions["PRECISION-MU-MU-Delta"], precisions["PRECISION-MU-MU-Math"]);
758 
759  parsePhi_Trig_LUTS(scaleMap, "EG", l1t::COS, precisions["PRECISION-EG-EG-Math"]);
760  parsePhi_Trig_LUTS(scaleMap, "JET", l1t::COS, precisions["PRECISION-JET-JET-Math"]);
761  parsePhi_Trig_LUTS(scaleMap, "TAU", l1t::COS, precisions["PRECISION-TAU-TAU-Math"]);
762  parsePhi_Trig_LUTS(scaleMap, "MU", l1t::COS, precisions["PRECISION-MU-MU-Math"]);
763 
764  parsePhi_Trig_LUTS(scaleMap, "EG", l1t::SIN, precisions["PRECISION-EG-EG-Math"]);
765  parsePhi_Trig_LUTS(scaleMap, "JET", l1t::SIN, precisions["PRECISION-JET-JET-Math"]);
766  parsePhi_Trig_LUTS(scaleMap, "TAU", l1t::SIN, precisions["PRECISION-TAU-TAU-Math"]);
767  parsePhi_Trig_LUTS(scaleMap, "MU", l1t::SIN, precisions["PRECISION-MU-MU-Math"]);
768 
769  //CCLA
770  //m_gtScales.dumpAllLUTs(std::cout);
771  //m_gtScales.print(std::cout);
772  }
773 
774  return true;
775 }
776 
777 void l1t::TriggerMenuParser::parseCalMuEta_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
778  std::string obj1,
779  std::string obj2) {
780  using namespace tmeventsetup;
781 
782  // First Delta Eta for this set
783  std::string scLabel1 = obj1;
784  scLabel1 += "-ETA";
785  std::string scLabel2 = obj2;
786  scLabel2 += "-ETA";
787 
788  //This LUT does not exist in L1 Menu file, don't fill it
789  if (scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
790  return;
791 
792  const esScale* scale1 = &scaleMap.find(scLabel1)->second;
793  const esScale* scale2 = &scaleMap.find(scLabel2)->second;
794 
795  std::vector<long long> lut_cal_2_mu_eta;
796  getCaloMuonEtaConversionLut(lut_cal_2_mu_eta, scale1, scale2);
797 
798  std::string lutName = obj1;
799  lutName += "-";
800  lutName += obj2;
801  m_gtScales.setLUT_CalMuEta(lutName, lut_cal_2_mu_eta);
802 }
803 
804 void l1t::TriggerMenuParser::parseCalMuPhi_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
805  std::string obj1,
806  std::string obj2) {
807  using namespace tmeventsetup;
808 
809  // First Delta Eta for this set
810  std::string scLabel1 = obj1;
811  scLabel1 += "-PHI";
812  std::string scLabel2 = obj2;
813  scLabel2 += "-PHI";
814 
815  //This LUT does not exist in L1 Menu file, don't fill it
816  if (scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
817  return;
818 
819  const esScale* scale1 = &scaleMap.find(scLabel1)->second;
820  const esScale* scale2 = &scaleMap.find(scLabel2)->second;
821 
822  std::vector<long long> lut_cal_2_mu_phi;
823  getCaloMuonPhiConversionLut(lut_cal_2_mu_phi, scale1, scale2);
824 
825  std::string lutName = obj1;
826  lutName += "-";
827  lutName += obj2;
828  m_gtScales.setLUT_CalMuPhi(lutName, lut_cal_2_mu_phi);
829 }
830 
831 void l1t::TriggerMenuParser::parsePt_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
832  std::string lutpfx,
833  std::string obj1,
834  unsigned int prec) {
835  using namespace tmeventsetup;
836 
837  // First Delta Eta for this set
838  std::string scLabel1 = obj1;
839  scLabel1 += "-ET";
840 
841  //This LUT does not exist in L1 Menu file, don't fill it
842  if (scaleMap.find(scLabel1) == scaleMap.end())
843  return;
844 
845  const esScale* scale1 = &scaleMap.find(scLabel1)->second;
846 
847  std::vector<long long> lut_pt;
848  getLut(lut_pt, scale1, prec);
849 
850  m_gtScales.setLUT_Pt(lutpfx + "_" + scLabel1, lut_pt, prec);
851 }
852 
853 void l1t::TriggerMenuParser::parseDeltaEta_Cosh_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap,
854  std::string obj1,
855  std::string obj2,
856  unsigned int prec1,
857  unsigned int prec2) {
858  using namespace tmeventsetup;
859 
860  // First Delta Eta for this set
861  std::string scLabel1 = obj1;
862  scLabel1 += "-ETA";
863  std::string scLabel2 = obj2;
864  scLabel2 += "-ETA";
865 
866  //This LUT does not exist in L1 Menu file, don't fill it
867  if (scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
868  return;
869 
870  const esScale* scale1 = &scaleMap.find(scLabel1)->second;
871  const esScale* scale2 = &scaleMap.find(scLabel2)->second;
872  std::vector<double> val_delta_eta;
873  std::vector<long long> lut_delta_eta;
874  size_t n = getDeltaVector(val_delta_eta, scale1, scale2);
875  setLut(lut_delta_eta, val_delta_eta, prec1);
876  std::string lutName = obj1;
877  lutName += "-";
878  lutName += obj2;
879  m_gtScales.setLUT_DeltaEta(lutName, lut_delta_eta, prec1);
880 
881  // Second Get the Cosh for this delta Eta Set
882  std::vector<long long> lut_cosh;
883  applyCosh(val_delta_eta, n);
884  setLut(lut_cosh, val_delta_eta, prec2);
885  m_gtScales.setLUT_Cosh(lutName, lut_cosh, prec2);
886 }
887 
888 void l1t::TriggerMenuParser::parseDeltaPhi_Cos_LUTS(const std::map<std::string, tmeventsetup::esScale>& scaleMap,
889  const std::string& obj1,
890  const std::string& obj2,
891  unsigned int prec1,
892  unsigned int prec2) {
893  using namespace tmeventsetup;
894 
895  // First Delta phi for this set
896  std::string scLabel1 = obj1;
897  scLabel1 += "-PHI";
898  std::string scLabel2 = obj2;
899  scLabel2 += "-PHI";
900 
901  //This LUT does not exist in L1 Menu file, don't fill it
902  if (scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
903  return;
904 
905  const esScale* scale1 = &scaleMap.find(scLabel1)->second;
906  const esScale* scale2 = &scaleMap.find(scLabel2)->second;
907  std::vector<double> val_delta_phi;
908  std::vector<long long> lut_delta_phi;
909  size_t n = getDeltaVector(val_delta_phi, scale1, scale2);
910  setLut(lut_delta_phi, val_delta_phi, prec1);
911  std::string lutName = obj1;
912  lutName += "-";
913  lutName += obj2;
914  m_gtScales.setLUT_DeltaPhi(lutName, lut_delta_phi, prec1);
915 
916  // Second Get the Cosh for this delta phi Set
917  std::vector<long long> lut_cos;
918  applyCos(val_delta_phi, n);
919  setLut(lut_cos, val_delta_phi, prec2);
920  m_gtScales.setLUT_Cos(lutName, lut_cos, prec2);
921 }
922 
923 void l1t::TriggerMenuParser::parsePhi_Trig_LUTS(const std::map<std::string, tmeventsetup::esScale>& scaleMap,
924  const std::string& obj,
926  unsigned int prec) {
927  using namespace tmeventsetup;
928 
929  std::string scLabel = obj;
930  scLabel += "-PHI";
931 
932  //This LUT does not exist in L1 Menu file, don't fill it
933  if (scaleMap.find(scLabel) == scaleMap.end())
934  return;
935  if (func != l1t::SIN and func != l1t::COS)
936  return;
937 
938  const esScale* scale = &scaleMap.find(scLabel)->second;
939 
940  const double step = scale->getStep();
941  const double range = scale->getMaximum() - scale->getMinimum();
942  const size_t n = std::ceil(range / step);
943  const size_t bitwidth = std::ceil(std::log10(n) / std::log10(2));
944 
945  std::vector<double> array(std::pow(2, bitwidth), 0);
946 
947  for (size_t ii = 0; ii < n; ii++) {
948  array.at(ii) = step * ii;
949  }
950 
951  const std::string& lutName = obj;
952  std::vector<long long> lut;
953  if (func == l1t::SIN) {
954  applySin(array, n);
955  setLut(lut, array, prec);
956  m_gtScales.setLUT_Sin(lutName, lut, prec);
957  } else if (func == l1t::COS) {
958  applyCos(array, n);
959  setLut(lut, array, prec);
960  m_gtScales.setLUT_Cos(lutName, lut, prec);
961  }
962 }
963 
975 bool l1t::TriggerMenuParser::parseMuon(tmeventsetup::esCondition condMu, unsigned int chipNr, const bool corrFlag) {
976  using namespace tmeventsetup;
977 
978  // get condition, particle name (must be muon) and type name
979  std::string condition = "muon";
980  std::string particle = "muon"; //l1t2string( condMu.objectType() );
981  std::string type = l1t2string(condMu.getType());
982  std::string name = l1t2string(condMu.getName());
983  int nrObj = -1;
984 
986 
987  if (condMu.getType() == esConditionType::SingleMuon) {
988  type = "1_s";
989  cType = l1t::Type1s;
990  nrObj = 1;
991  } else if (condMu.getType() == esConditionType::DoubleMuon) {
992  type = "2_s";
993  cType = l1t::Type2s;
994  nrObj = 2;
995  } else if (condMu.getType() == esConditionType::TripleMuon) {
996  type = "3";
997  cType = l1t::Type3s;
998  nrObj = 3;
999  } else if (condMu.getType() == esConditionType::QuadMuon) {
1000  type = "4";
1001  cType = l1t::Type4s;
1002  nrObj = 4;
1003  } else {
1004  edm::LogError("TriggerMenuParser") << "Wrong type for muon-condition (" << type << ")" << std::endl;
1005  return false;
1006  }
1007 
1008  if (nrObj < 0) {
1009  edm::LogError("TriggerMenuParser") << "Unknown type for muon-condition (" << type << ")"
1010  << "\nCan not determine number of trigger objects. " << std::endl;
1011  return false;
1012  }
1013 
1014  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1015  << "\n parseMuon "
1016  << "\n condition = " << condition << "\n particle = " << particle
1017  << "\n type = " << type << "\n name = " << name << std::endl;
1018 
1019  // // get values
1020 
1021  // temporary storage of the parameters
1022  std::vector<MuonTemplate::ObjectParameter> objParameter(nrObj);
1023 
1024  // Do we need this?
1025  MuonTemplate::CorrelationParameter corrParameter;
1026 
1027  // need at least two values for deltaPhi
1028  std::vector<uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1029  tmpValues.reserve(nrObj);
1030 
1031  if (int(condMu.getObjects().size()) != nrObj) {
1032  edm::LogError("TriggerMenuParser") << " condMu objects: nrObj = " << nrObj
1033  << "condMu.getObjects().size() = " << condMu.getObjects().size() << std::endl;
1034  return false;
1035  }
1036 
1037  // Look for cuts on the objects in the condition
1038  unsigned int chargeCorrelation = 1;
1039  const std::vector<esCut>& cuts = condMu.getCuts();
1040  for (size_t jj = 0; jj < cuts.size(); jj++) {
1041  const esCut cut = cuts.at(jj);
1042  if (cut.getCutType() == esCutType::ChargeCorrelation) {
1043  if (cut.getData() == "ls")
1044  chargeCorrelation = 2;
1045  else if (cut.getData() == "os")
1046  chargeCorrelation = 4;
1047  else
1048  chargeCorrelation = 1; //ignore correlation
1049  }
1050  }
1051 
1052  //set charge correlation parameter
1053  corrParameter.chargeCorrelation = chargeCorrelation; //tmpValues[0];
1054 
1055  int cnt = 0;
1056 
1057  // BLW TO DO: These needs to the added to the object rather than the whole condition.
1058  int relativeBx = 0;
1059  bool gEq = false;
1060 
1061  // Loop over objects and extract the cuts on the objects
1062  const std::vector<esObject>& objects = condMu.getObjects();
1063  for (size_t jj = 0; jj < objects.size(); jj++) {
1064  const esObject object = objects.at(jj);
1065  gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
1066 
1067  // BLW TO DO: This needs to be added to the Object Parameters
1068  relativeBx = object.getBxOffset();
1069 
1070  // Loop over the cuts for this object
1071  int upperThresholdInd = -1;
1072  int lowerThresholdInd = 0;
1073  int upperIndexInd = -1;
1074  int lowerIndexInd = 0;
1075  int cntEta = 0;
1076  unsigned int etaWindow1Lower = -1, etaWindow1Upper = -1, etaWindow2Lower = -1, etaWindow2Upper = -1;
1077  int cntPhi = 0;
1078  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
1079  int isolationLUT = 0xF; //default is to ignore unless specified.
1080  int charge = -1; //default value is to ignore unless specified
1081  int qualityLUT = 0xFFFF; //default is to ignore unless specified.
1082 
1083  const std::vector<esCut>& cuts = object.getCuts();
1084  for (size_t kk = 0; kk < cuts.size(); kk++) {
1085  const esCut cut = cuts.at(kk);
1086 
1087  switch (cut.getCutType()) {
1088  case esCutType::Threshold:
1089  lowerThresholdInd = cut.getMinimum().index;
1090  upperThresholdInd = cut.getMaximum().index;
1091  break;
1092 
1093  case esCutType::Slice:
1094  lowerIndexInd = int(cut.getMinimum().value);
1095  upperIndexInd = int(cut.getMaximum().value);
1096  break;
1097 
1098  case esCutType::Eta: {
1099  if (cntEta == 0) {
1100  etaWindow1Lower = cut.getMinimum().index;
1101  etaWindow1Upper = cut.getMaximum().index;
1102  } else if (cntEta == 1) {
1103  etaWindow2Lower = cut.getMinimum().index;
1104  etaWindow2Upper = cut.getMaximum().index;
1105  } else {
1106  edm::LogError("TriggerMenuParser")
1107  << "Too Many Eta Cuts for muon-condition (" << particle << ")" << std::endl;
1108  return false;
1109  }
1110  cntEta++;
1111 
1112  } break;
1113 
1114  case esCutType::Phi: {
1115  if (cntPhi == 0) {
1116  phiWindow1Lower = cut.getMinimum().index;
1117  phiWindow1Upper = cut.getMaximum().index;
1118  } else if (cntPhi == 1) {
1119  phiWindow2Lower = cut.getMinimum().index;
1120  phiWindow2Upper = cut.getMaximum().index;
1121  } else {
1122  edm::LogError("TriggerMenuParser")
1123  << "Too Many Phi Cuts for muon-condition (" << particle << ")" << std::endl;
1124  return false;
1125  }
1126  cntPhi++;
1127 
1128  } break;
1129 
1130  case esCutType::Charge:
1131  if (cut.getData() == "positive")
1132  charge = 0;
1133  else if (cut.getData() == "negative")
1134  charge = 1;
1135  else
1136  charge = -1;
1137  break;
1138  case esCutType::Quality:
1139 
1140  qualityLUT = l1tstr2int(cut.getData());
1141 
1142  break;
1143  case esCutType::Isolation: {
1144  isolationLUT = l1tstr2int(cut.getData());
1145 
1146  } break;
1147  default:
1148  break;
1149  } //end switch
1150 
1151  } //end loop over cuts
1152 
1153  // Set the parameter cuts
1154  objParameter[cnt].ptHighThreshold = upperThresholdInd;
1155  objParameter[cnt].ptLowThreshold = lowerThresholdInd;
1156 
1157  objParameter[cnt].indexHigh = upperIndexInd;
1158  objParameter[cnt].indexLow = lowerIndexInd;
1159 
1160  objParameter[cnt].etaWindow1Lower = etaWindow1Lower;
1161  objParameter[cnt].etaWindow1Upper = etaWindow1Upper;
1162  objParameter[cnt].etaWindow2Lower = etaWindow2Lower;
1163  objParameter[cnt].etaWindow2Upper = etaWindow2Upper;
1164 
1165  objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
1166  objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
1167  objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
1168  objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
1169 
1170  // BLW TO DO: Do we need these anymore? Drop them?
1171  objParameter[cnt].enableMip = false; //tmpMip[i];
1172  objParameter[cnt].enableIso = false; //tmpEnableIso[i];
1173  objParameter[cnt].requestIso = false; //tmpRequestIso[i];
1174 
1175  objParameter[cnt].charge = charge;
1176  objParameter[cnt].qualityLUT = qualityLUT;
1177  objParameter[cnt].isolationLUT = isolationLUT;
1178 
1179  cnt++;
1180  } //end loop over objects
1181 
1182  // object types - all muons
1183  std::vector<GlobalObject> objType(nrObj, gtMu);
1184 
1185  // now create a new CondMuonition
1186  MuonTemplate muonCond(name);
1187 
1188  muonCond.setCondType(cType);
1189  muonCond.setObjectType(objType);
1190  muonCond.setCondGEq(gEq);
1191  muonCond.setCondChipNr(chipNr);
1192  muonCond.setCondRelativeBx(relativeBx);
1193 
1194  muonCond.setConditionParameter(objParameter, corrParameter);
1195 
1196  if (edm::isDebugEnabled()) {
1197  std::ostringstream myCoutStream;
1198  muonCond.print(myCoutStream);
1199  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
1200  }
1201 
1202  // insert condition into the map and into muon template vector
1203  if (!insertConditionIntoMap(muonCond, chipNr)) {
1204  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
1205  return false;
1206  } else {
1207  LogDebug("TriggerMenuParser") << "Added Condition " << name << " to the ConditionMap" << std::endl;
1208  if (corrFlag) {
1209  (m_corMuonTemplate[chipNr]).push_back(muonCond);
1210  } else {
1211  LogDebug("TriggerMenuParser") << "Added Condition " << name << " to the vecMuonTemplate vector" << std::endl;
1212  (m_vecMuonTemplate[chipNr]).push_back(muonCond);
1213  }
1214  }
1215 
1216  //
1217  return true;
1218 }
1219 
1220 bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, unsigned int chipNr) {
1221  // XERCES_CPP_NAMESPACE_USE
1222  using namespace tmeventsetup;
1223 
1224  // get condition, particle name (must be muon) and type name
1225  std::string condition = "muon";
1226  std::string particle = "muon"; //l1t2string( condMu.objectType() );
1227  std::string type = l1t2string(corrMu->getType());
1228  std::string name = l1t2string(corrMu->getName());
1229  int nrObj = 1;
1230  type = "1_s";
1231  GtConditionType cType = l1t::Type1s;
1232 
1233  if (nrObj < 0) {
1234  edm::LogError("TriggerMenuParser") << "Unknown type for muon-condition (" << type << ")"
1235  << "\nCan not determine number of trigger objects. " << std::endl;
1236  return false;
1237  }
1238 
1239  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1240  << "\n parseMuon "
1241  << "\n condition = " << condition << "\n particle = " << particle
1242  << "\n type = " << type << "\n name = " << name << std::endl;
1243 
1244  // // get values
1245 
1246  // temporary storage of the parameters
1247  std::vector<MuonTemplate::ObjectParameter> objParameter(nrObj);
1248 
1249  // Do we need this?
1250  MuonTemplate::CorrelationParameter corrParameter;
1251 
1252  // need at least two values for deltaPhi
1253  std::vector<uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1254  tmpValues.reserve(nrObj);
1255 
1256  // BLW TO DO: How do we deal with these in the new format
1257  // std::string str_chargeCorrelation = l1t2string( condMu.requestedChargeCorr() );
1258  std::string str_chargeCorrelation = "ig";
1259  unsigned int chargeCorrelation = 0;
1260  if (str_chargeCorrelation == "ig")
1261  chargeCorrelation = 1;
1262  else if (str_chargeCorrelation == "ls")
1263  chargeCorrelation = 2;
1264  else if (str_chargeCorrelation == "os")
1265  chargeCorrelation = 4;
1266 
1267  //getXMLHexTextValue("1", dst);
1268  corrParameter.chargeCorrelation = chargeCorrelation; //tmpValues[0];
1269 
1270  // BLW TO DO: These needs to the added to the object rather than the whole condition.
1271  int relativeBx = 0;
1272  bool gEq = false;
1273 
1274  //const esObject* object = condMu;
1275  gEq = (corrMu->getComparisonOperator() == esComparisonOperator::GE);
1276 
1277  // BLW TO DO: This needs to be added to the Object Parameters
1278  relativeBx = corrMu->getBxOffset();
1279 
1280  // Loop over the cuts for this object
1281  int upperThresholdInd = -1;
1282  int lowerThresholdInd = 0;
1283  int upperIndexInd = -1;
1284  int lowerIndexInd = 0;
1285  int cntEta = 0;
1286  unsigned int etaWindow1Lower = -1, etaWindow1Upper = -1, etaWindow2Lower = -1, etaWindow2Upper = -1;
1287  int cntPhi = 0;
1288  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
1289  int isolationLUT = 0xF; //default is to ignore unless specified.
1290  int charge = -1; //defaut is to ignore unless specified
1291  int qualityLUT = 0xFFFF; //default is to ignore unless specified.
1292 
1293  const std::vector<esCut>& cuts = corrMu->getCuts();
1294  for (size_t kk = 0; kk < cuts.size(); kk++) {
1295  const esCut cut = cuts.at(kk);
1296 
1297  switch (cut.getCutType()) {
1298  case esCutType::Threshold:
1299  lowerThresholdInd = cut.getMinimum().index;
1300  upperThresholdInd = cut.getMaximum().index;
1301  break;
1302 
1303  case esCutType::Slice:
1304  lowerIndexInd = int(cut.getMinimum().value);
1305  upperIndexInd = int(cut.getMaximum().value);
1306  break;
1307 
1308  case esCutType::Eta: {
1309  if (cntEta == 0) {
1310  etaWindow1Lower = cut.getMinimum().index;
1311  etaWindow1Upper = cut.getMaximum().index;
1312  } else if (cntEta == 1) {
1313  etaWindow2Lower = cut.getMinimum().index;
1314  etaWindow2Upper = cut.getMaximum().index;
1315  } else {
1316  edm::LogError("TriggerMenuParser")
1317  << "Too Many Eta Cuts for muon-condition (" << particle << ")" << std::endl;
1318  return false;
1319  }
1320  cntEta++;
1321 
1322  } break;
1323 
1324  case esCutType::Phi: {
1325  if (cntPhi == 0) {
1326  phiWindow1Lower = cut.getMinimum().index;
1327  phiWindow1Upper = cut.getMaximum().index;
1328  } else if (cntPhi == 1) {
1329  phiWindow2Lower = cut.getMinimum().index;
1330  phiWindow2Upper = cut.getMaximum().index;
1331  } else {
1332  edm::LogError("TriggerMenuParser")
1333  << "Too Many Phi Cuts for muon-condition (" << particle << ")" << std::endl;
1334  return false;
1335  }
1336  cntPhi++;
1337 
1338  } break;
1339 
1340  case esCutType::Charge:
1341  if (cut.getData() == "positive")
1342  charge = 0;
1343  else if (cut.getData() == "negative")
1344  charge = 1;
1345  else
1346  charge = -1;
1347  break;
1348  case esCutType::Quality:
1349 
1350  qualityLUT = l1tstr2int(cut.getData());
1351 
1352  break;
1353  case esCutType::Isolation: {
1354  isolationLUT = l1tstr2int(cut.getData());
1355 
1356  } break;
1357  default:
1358  break;
1359  } //end switch
1360 
1361  } //end loop over cuts
1362 
1363  // Set the parameter cuts
1364  objParameter[0].ptHighThreshold = upperThresholdInd;
1365  objParameter[0].ptLowThreshold = lowerThresholdInd;
1366 
1367  objParameter[0].indexHigh = upperIndexInd;
1368  objParameter[0].indexLow = lowerIndexInd;
1369 
1370  objParameter[0].etaWindow1Lower = etaWindow1Lower;
1371  objParameter[0].etaWindow1Upper = etaWindow1Upper;
1372  objParameter[0].etaWindow2Lower = etaWindow2Lower;
1373  objParameter[0].etaWindow2Upper = etaWindow2Upper;
1374 
1375  objParameter[0].phiWindow1Lower = phiWindow1Lower;
1376  objParameter[0].phiWindow1Upper = phiWindow1Upper;
1377  objParameter[0].phiWindow2Lower = phiWindow2Lower;
1378  objParameter[0].phiWindow2Upper = phiWindow2Upper;
1379 
1380  // BLW TO DO: Do we need these anymore? Drop them?
1381  objParameter[0].enableMip = false; //tmpMip[i];
1382  objParameter[0].enableIso = false; //tmpEnableIso[i];
1383  objParameter[0].requestIso = false; //tmpRequestIso[i];
1384 
1385  objParameter[0].charge = charge;
1386  objParameter[0].qualityLUT = qualityLUT;
1387  objParameter[0].isolationLUT = isolationLUT;
1388 
1389  // object types - all muons
1390  std::vector<GlobalObject> objType(nrObj, gtMu);
1391 
1392  // now create a new CondMuonition
1393  MuonTemplate muonCond(name);
1394 
1395  muonCond.setCondType(cType);
1396  muonCond.setObjectType(objType);
1397  muonCond.setCondGEq(gEq);
1398  muonCond.setCondChipNr(chipNr);
1399  muonCond.setCondRelativeBx(relativeBx);
1400  muonCond.setConditionParameter(objParameter, corrParameter);
1401 
1402  if (edm::isDebugEnabled()) {
1403  std::ostringstream myCoutStream;
1404  muonCond.print(myCoutStream);
1405  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
1406  }
1407 
1408  /*
1409  // insert condition into the map and into muon template vector
1410  if ( !insertConditionIntoMap(muonCond, chipNr)) {
1411  edm::LogError("TriggerMenuParser")
1412  << " Error: duplicate condition (" << name << ")"
1413  << std::endl;
1414  return false;
1415  }
1416  else {
1417  LogDebug("TriggerMenuParser") << "Added Condition " << name << " to the ConditionMap" << std::endl;
1418  (m_corMuonTemplate[chipNr]).push_back(muonCond);
1419  }
1420 */
1421  (m_corMuonTemplate[chipNr]).push_back(muonCond);
1422 
1423  //
1424  return true;
1425 }
1426 
1438 bool l1t::TriggerMenuParser::parseCalo(tmeventsetup::esCondition condCalo, unsigned int chipNr, const bool corrFlag) {
1439  // XERCES_CPP_NAMESPACE_USE
1440  using namespace tmeventsetup;
1441 
1442  // get condition, particle name and type name
1443 
1444  std::string condition = "calo";
1445  std::string particle = "test-fix";
1446  std::string type = l1t2string(condCalo.getType());
1447  std::string name = l1t2string(condCalo.getName());
1448 
1449  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1450  << "\n (in parseCalo) "
1451  << "\n condition = " << condition << "\n particle = " << particle
1452  << "\n type = " << type << "\n name = " << name << std::endl;
1453 
1455 
1456  // determine object type type
1457  // BLW TO DO: Can this object type wait and be done later in the parsing. Or done differently completely..
1458  GlobalObject caloObjType;
1459  int nrObj = -1;
1460 
1461  if (condCalo.getType() == esConditionType::SingleEgamma) {
1462  caloObjType = gtEG;
1463  type = "1_s";
1464  cType = l1t::Type1s;
1465  nrObj = 1;
1466  } else if (condCalo.getType() == esConditionType::DoubleEgamma) {
1467  caloObjType = gtEG;
1468  type = "2_s";
1469  cType = l1t::Type2s;
1470  nrObj = 2;
1471  } else if (condCalo.getType() == esConditionType::TripleEgamma) {
1472  caloObjType = gtEG;
1473  cType = l1t::Type3s;
1474  type = "3";
1475  nrObj = 3;
1476  } else if (condCalo.getType() == esConditionType::QuadEgamma) {
1477  caloObjType = gtEG;
1478  cType = l1t::Type4s;
1479  type = "4";
1480  nrObj = 4;
1481  } else if (condCalo.getType() == esConditionType::SingleJet) {
1482  caloObjType = gtJet;
1483  cType = l1t::Type1s;
1484  type = "1_s";
1485  nrObj = 1;
1486  } else if (condCalo.getType() == esConditionType::DoubleJet) {
1487  caloObjType = gtJet;
1488  cType = l1t::Type2s;
1489  type = "2_s";
1490  nrObj = 2;
1491  } else if (condCalo.getType() == esConditionType::TripleJet) {
1492  caloObjType = gtJet;
1493  cType = l1t::Type3s;
1494  type = "3";
1495  nrObj = 3;
1496  } else if (condCalo.getType() == esConditionType::QuadJet) {
1497  caloObjType = gtJet;
1498  cType = l1t::Type4s;
1499  type = "4";
1500  nrObj = 4;
1501  } else if (condCalo.getType() == esConditionType::SingleTau) {
1502  caloObjType = gtTau;
1503  cType = l1t::Type1s;
1504  type = "1_s";
1505  nrObj = 1;
1506  } else if (condCalo.getType() == esConditionType::DoubleTau) {
1507  caloObjType = gtTau;
1508  cType = l1t::Type2s;
1509  type = "2_s";
1510  nrObj = 2;
1511  } else if (condCalo.getType() == esConditionType::TripleTau) {
1512  caloObjType = gtTau;
1513  cType = l1t::Type3s;
1514  type = "3";
1515  nrObj = 3;
1516  } else if (condCalo.getType() == esConditionType::QuadTau) {
1517  caloObjType = gtTau;
1518  cType = l1t::Type4s;
1519  type = "4";
1520  nrObj = 4;
1521  } else {
1522  edm::LogError("TriggerMenuParser") << "Wrong particle for calo-condition (" << particle << ")" << std::endl;
1523  return false;
1524  }
1525 
1526  // std::string str_etComparison = l1t2string( condCalo.comparison_operator() );
1527 
1528  if (nrObj < 0) {
1529  edm::LogError("TriggerMenuParser") << "Unknown type for calo-condition (" << type << ")"
1530  << "\nCan not determine number of trigger objects. " << std::endl;
1531  return false;
1532  }
1533 
1534  // get values
1535 
1536  // temporary storage of the parameters
1537  std::vector<CaloTemplate::ObjectParameter> objParameter(nrObj);
1538 
1539  //BLW TO DO: Can this be dropped?
1540  CaloTemplate::CorrelationParameter corrParameter;
1541 
1542  // need at least one value for deltaPhiRange
1543  std::vector<uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1544  tmpValues.reserve(nrObj);
1545 
1546  if (int(condCalo.getObjects().size()) != nrObj) {
1547  edm::LogError("TriggerMenuParser") << " condCalo objects: nrObj = " << nrObj
1548  << "condCalo.getObjects().size() = " << condCalo.getObjects().size()
1549  << std::endl;
1550  return false;
1551  }
1552 
1553  // std::string str_condCalo = "";
1554  // uint64_t tempUIntH, tempUIntL;
1555  // uint64_t dst;
1556  int cnt = 0;
1557 
1558  // BLW TO DO: These needs to the added to the object rather than the whole condition.
1559  int relativeBx = 0;
1560  bool gEq = false;
1561 
1562  // Loop over objects and extract the cuts on the objects
1563  const std::vector<esObject>& objects = condCalo.getObjects();
1564  for (size_t jj = 0; jj < objects.size(); jj++) {
1565  const esObject object = objects.at(jj);
1566  gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
1567 
1568  // BLW TO DO: This needs to be added to the Object Parameters
1569  relativeBx = object.getBxOffset();
1570 
1571  // Loop over the cuts for this object
1572  int upperThresholdInd = -1;
1573  int lowerThresholdInd = 0;
1574  int upperIndexInd = -1;
1575  int lowerIndexInd = 0;
1576  int cntEta = 0;
1577  unsigned int etaWindow1Lower = -1, etaWindow1Upper = -1, etaWindow2Lower = -1, etaWindow2Upper = -1;
1578  int cntPhi = 0;
1579  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
1580  int isolationLUT = 0xF; //default is to ignore isolation unless specified.
1581  int qualityLUT = 0xF; //default is to ignore quality unless specified.
1582 
1583  const std::vector<esCut>& cuts = object.getCuts();
1584  for (size_t kk = 0; kk < cuts.size(); kk++) {
1585  const esCut cut = cuts.at(kk);
1586 
1587  switch (cut.getCutType()) {
1588  case esCutType::Threshold:
1589  lowerThresholdInd = cut.getMinimum().index;
1590  upperThresholdInd = cut.getMaximum().index;
1591  break;
1592  case esCutType::Slice:
1593  lowerIndexInd = int(cut.getMinimum().value);
1594  upperIndexInd = int(cut.getMaximum().value);
1595  break;
1596  case esCutType::Eta: {
1597  if (cntEta == 0) {
1598  etaWindow1Lower = cut.getMinimum().index;
1599  etaWindow1Upper = cut.getMaximum().index;
1600  } else if (cntEta == 1) {
1601  etaWindow2Lower = cut.getMinimum().index;
1602  etaWindow2Upper = cut.getMaximum().index;
1603  } else {
1604  edm::LogError("TriggerMenuParser")
1605  << "Too Many Eta Cuts for calo-condition (" << particle << ")" << std::endl;
1606  return false;
1607  }
1608  cntEta++;
1609 
1610  } break;
1611 
1612  case esCutType::Phi: {
1613  if (cntPhi == 0) {
1614  phiWindow1Lower = cut.getMinimum().index;
1615  phiWindow1Upper = cut.getMaximum().index;
1616  } else if (cntPhi == 1) {
1617  phiWindow2Lower = cut.getMinimum().index;
1618  phiWindow2Upper = cut.getMaximum().index;
1619  } else {
1620  edm::LogError("TriggerMenuParser")
1621  << "Too Many Phi Cuts for calo-condition (" << particle << ")" << std::endl;
1622  return false;
1623  }
1624  cntPhi++;
1625 
1626  } break;
1627 
1628  case esCutType::Charge: {
1629  edm::LogError("TriggerMenuParser") << "No charge cut for calo-condition (" << particle << ")" << std::endl;
1630  return false;
1631 
1632  } break;
1633  case esCutType::Quality: {
1634  qualityLUT = l1tstr2int(cut.getData());
1635 
1636  } break;
1637  case esCutType::Isolation: {
1638  isolationLUT = l1tstr2int(cut.getData());
1639 
1640  } break;
1641  default:
1642  break;
1643  } //end switch
1644 
1645  } //end loop over cuts
1646 
1647  // Fill the object parameters
1648  objParameter[cnt].etHighThreshold = upperThresholdInd;
1649  objParameter[cnt].etLowThreshold = lowerThresholdInd;
1650  objParameter[cnt].indexHigh = upperIndexInd;
1651  objParameter[cnt].indexLow = lowerIndexInd;
1652  objParameter[cnt].etaWindow1Lower = etaWindow1Lower;
1653  objParameter[cnt].etaWindow1Upper = etaWindow1Upper;
1654  objParameter[cnt].etaWindow2Lower = etaWindow2Lower;
1655  objParameter[cnt].etaWindow2Upper = etaWindow2Upper;
1656  objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
1657  objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
1658  objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
1659  objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
1660  objParameter[cnt].isolationLUT = isolationLUT;
1661  objParameter[cnt].qualityLUT = qualityLUT; //TO DO: Must add
1662 
1663  // Output for debugging
1664  LogDebug("TriggerMenuParser") << "\n Calo ET high thresholds (hex) for calo object " << caloObjType << " "
1665  << cnt << " = " << std::hex << objParameter[cnt].etLowThreshold << " - "
1666  << objParameter[cnt].etHighThreshold
1667  << "\n etaWindow Lower / Upper for calo object " << cnt << " = 0x"
1668  << objParameter[cnt].etaWindow1Lower << " / 0x" << objParameter[cnt].etaWindow1Upper
1669  << "\n etaWindowVeto Lower / Upper for calo object " << cnt << " = 0x"
1670  << objParameter[cnt].etaWindow2Lower << " / 0x" << objParameter[cnt].etaWindow2Upper
1671  << "\n phiWindow Lower / Upper for calo object " << cnt << " = 0x"
1672  << objParameter[cnt].phiWindow1Lower << " / 0x" << objParameter[cnt].phiWindow1Upper
1673  << "\n phiWindowVeto Lower / Upper for calo object " << cnt << " = 0x"
1674  << objParameter[cnt].phiWindow2Lower << " / 0x" << objParameter[cnt].phiWindow2Upper
1675  << "\n Isolation LUT for calo object " << cnt << " = 0x"
1676  << objParameter[cnt].isolationLUT << "\n Quality LUT for calo object " << cnt
1677  << " = 0x" << objParameter[cnt].qualityLUT << std::dec << std::endl;
1678 
1679  cnt++;
1680  } //end loop over objects
1681 
1682  // object types - all same caloObjType
1683  std::vector<GlobalObject> objType(nrObj, caloObjType);
1684 
1685  // now create a new calo condition
1686  CaloTemplate caloCond(name);
1687 
1688  caloCond.setCondType(cType);
1689  caloCond.setObjectType(objType);
1690 
1691  //BLW TO DO: This needs to be added to the object rather than the whole condition
1692  caloCond.setCondGEq(gEq);
1693  caloCond.setCondChipNr(chipNr);
1694 
1695  //BLW TO DO: This needs to be added to the object rather than the whole condition
1696  caloCond.setCondRelativeBx(relativeBx);
1697 
1698  caloCond.setConditionParameter(objParameter, corrParameter);
1699 
1700  if (edm::isDebugEnabled()) {
1701  std::ostringstream myCoutStream;
1702  caloCond.print(myCoutStream);
1703  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
1704  }
1705 
1706  // insert condition into the map
1707  if (!insertConditionIntoMap(caloCond, chipNr)) {
1708  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
1709 
1710  return false;
1711  } else {
1712  if (corrFlag) {
1713  (m_corCaloTemplate[chipNr]).push_back(caloCond);
1714  } else {
1715  (m_vecCaloTemplate[chipNr]).push_back(caloCond);
1716  }
1717  }
1718 
1719  //
1720  return true;
1721 }
1722 
1734 bool l1t::TriggerMenuParser::parseCaloCorr(const tmeventsetup::esObject* corrCalo, unsigned int chipNr) {
1735  // XERCES_CPP_NAMESPACE_USE
1736  using namespace tmeventsetup;
1737 
1738  // get condition, particle name and type name
1739 
1740  std::string condition = "calo";
1741  std::string particle = "test-fix";
1742  std::string type = l1t2string(corrCalo->getType());
1743  std::string name = l1t2string(corrCalo->getName());
1744 
1745  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1746  << "\n (in parseCalo) "
1747  << "\n condition = " << condition << "\n particle = " << particle
1748  << "\n type = " << type << "\n name = " << name << std::endl;
1749 
1750  // determine object type type
1751  // BLW TO DO: Can this object type wait and be done later in the parsing. Or done differently completely..
1752  GlobalObject caloObjType;
1753  int nrObj = 1;
1754  type = "1_s";
1755  GtConditionType cType = l1t::Type1s;
1756 
1757  if (corrCalo->getType() == esObjectType::Egamma) {
1758  caloObjType = gtEG;
1759  } else if (corrCalo->getType() == esObjectType::Jet) {
1760  caloObjType = gtJet;
1761  } else if (corrCalo->getType() == esObjectType::Tau) {
1762  caloObjType = gtTau;
1763  } else {
1764  edm::LogError("TriggerMenuParser") << "Wrong particle for calo-condition (" << particle << ")" << std::endl;
1765  return false;
1766  }
1767 
1768  // std::string str_etComparison = l1t2string( condCalo.comparison_operator() );
1769 
1770  if (nrObj < 0) {
1771  edm::LogError("TriggerMenuParser") << "Unknown type for calo-condition (" << type << ")"
1772  << "\nCan not determine number of trigger objects. " << std::endl;
1773  return false;
1774  }
1775 
1776  // get values
1777 
1778  // temporary storage of the parameters
1779  std::vector<CaloTemplate::ObjectParameter> objParameter(nrObj);
1780 
1781  //BLW TO DO: Can this be dropped?
1782  CaloTemplate::CorrelationParameter corrParameter;
1783 
1784  // need at least one value for deltaPhiRange
1785  std::vector<uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1786  tmpValues.reserve(nrObj);
1787 
1788  // BLW TO DO: These needs to the added to the object rather than the whole condition.
1789  int relativeBx = 0;
1790  bool gEq = false;
1791 
1792  gEq = (corrCalo->getComparisonOperator() == esComparisonOperator::GE);
1793 
1794  // BLW TO DO: This needs to be added to the Object Parameters
1795  relativeBx = corrCalo->getBxOffset();
1796 
1797  // Loop over the cuts for this object
1798  int upperThresholdInd = -1;
1799  int lowerThresholdInd = 0;
1800  int upperIndexInd = -1;
1801  int lowerIndexInd = 0;
1802  int cntEta = 0;
1803  unsigned int etaWindow1Lower = -1, etaWindow1Upper = -1, etaWindow2Lower = -1, etaWindow2Upper = -1;
1804  int cntPhi = 0;
1805  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
1806  int isolationLUT = 0xF; //default is to ignore isolation unless specified.
1807  int qualityLUT = 0xF; //default is to ignore quality unless specified.
1808 
1809  const std::vector<esCut>& cuts = corrCalo->getCuts();
1810  for (size_t kk = 0; kk < cuts.size(); kk++) {
1811  const esCut cut = cuts.at(kk);
1812 
1813  switch (cut.getCutType()) {
1814  case esCutType::Threshold:
1815  lowerThresholdInd = cut.getMinimum().index;
1816  upperThresholdInd = cut.getMaximum().index;
1817  break;
1818  case esCutType::Slice:
1819  lowerIndexInd = int(cut.getMinimum().value);
1820  upperIndexInd = int(cut.getMaximum().value);
1821  break;
1822  case esCutType::Eta: {
1823  if (cntEta == 0) {
1824  etaWindow1Lower = cut.getMinimum().index;
1825  etaWindow1Upper = cut.getMaximum().index;
1826  } else if (cntEta == 1) {
1827  etaWindow2Lower = cut.getMinimum().index;
1828  etaWindow2Upper = cut.getMaximum().index;
1829  } else {
1830  edm::LogError("TriggerMenuParser")
1831  << "Too Many Eta Cuts for calo-condition (" << particle << ")" << std::endl;
1832  return false;
1833  }
1834  cntEta++;
1835 
1836  } break;
1837 
1838  case esCutType::Phi: {
1839  if (cntPhi == 0) {
1840  phiWindow1Lower = cut.getMinimum().index;
1841  phiWindow1Upper = cut.getMaximum().index;
1842  } else if (cntPhi == 1) {
1843  phiWindow2Lower = cut.getMinimum().index;
1844  phiWindow2Upper = cut.getMaximum().index;
1845  } else {
1846  edm::LogError("TriggerMenuParser")
1847  << "Too Many Phi Cuts for calo-condition (" << particle << ")" << std::endl;
1848  return false;
1849  }
1850  cntPhi++;
1851 
1852  } break;
1853 
1854  case esCutType::Charge: {
1855  edm::LogError("TriggerMenuParser") << "No charge cut for calo-condition (" << particle << ")" << std::endl;
1856  return false;
1857 
1858  } break;
1859  case esCutType::Quality: {
1860  qualityLUT = l1tstr2int(cut.getData());
1861 
1862  } break;
1863  case esCutType::Isolation: {
1864  isolationLUT = l1tstr2int(cut.getData());
1865 
1866  } break;
1867  default:
1868  break;
1869  } //end switch
1870 
1871  } //end loop over cuts
1872 
1873  // Fill the object parameters
1874  objParameter[0].etLowThreshold = lowerThresholdInd;
1875  objParameter[0].etHighThreshold = upperThresholdInd;
1876  objParameter[0].indexHigh = upperIndexInd;
1877  objParameter[0].indexLow = lowerIndexInd;
1878  objParameter[0].etaWindow1Lower = etaWindow1Lower;
1879  objParameter[0].etaWindow1Upper = etaWindow1Upper;
1880  objParameter[0].etaWindow2Lower = etaWindow2Lower;
1881  objParameter[0].etaWindow2Upper = etaWindow2Upper;
1882  objParameter[0].phiWindow1Lower = phiWindow1Lower;
1883  objParameter[0].phiWindow1Upper = phiWindow1Upper;
1884  objParameter[0].phiWindow2Lower = phiWindow2Lower;
1885  objParameter[0].phiWindow2Upper = phiWindow2Upper;
1886  objParameter[0].isolationLUT = isolationLUT;
1887  objParameter[0].qualityLUT = qualityLUT; //TO DO: Must add
1888 
1889  // Output for debugging
1890  LogDebug("TriggerMenuParser") << "\n Calo ET high threshold (hex) for calo object " << caloObjType << " "
1891  << " = " << std::hex << objParameter[0].etLowThreshold << " - "
1892  << objParameter[0].etHighThreshold << "\n etaWindow Lower / Upper for calo object "
1893  << " = 0x" << objParameter[0].etaWindow1Lower << " / 0x"
1894  << objParameter[0].etaWindow1Upper
1895  << "\n etaWindowVeto Lower / Upper for calo object "
1896  << " = 0x" << objParameter[0].etaWindow2Lower << " / 0x"
1897  << objParameter[0].etaWindow2Upper << "\n phiWindow Lower / Upper for calo object "
1898  << " = 0x" << objParameter[0].phiWindow1Lower << " / 0x"
1899  << objParameter[0].phiWindow1Upper
1900  << "\n phiWindowVeto Lower / Upper for calo object "
1901  << " = 0x" << objParameter[0].phiWindow2Lower << " / 0x"
1902  << objParameter[0].phiWindow2Upper << "\n Isolation LUT for calo object "
1903  << " = 0x" << objParameter[0].isolationLUT << "\n Quality LUT for calo object "
1904  << " = 0x" << objParameter[0].qualityLUT << std::dec << std::endl;
1905 
1906  // object types - all same caloObjType
1907  std::vector<GlobalObject> objType(nrObj, caloObjType);
1908 
1909  // now create a new calo condition
1910  CaloTemplate caloCond(name);
1911 
1912  caloCond.setCondType(cType);
1913  caloCond.setObjectType(objType);
1914 
1915  //BLW TO DO: This needs to be added to the object rather than the whole condition
1916  caloCond.setCondGEq(gEq);
1917  caloCond.setCondChipNr(chipNr);
1918 
1919  //BLW TO DO: This needs to be added to the object rather than the whole condition
1920  caloCond.setCondRelativeBx(relativeBx);
1921 
1922  caloCond.setConditionParameter(objParameter, corrParameter);
1923 
1924  if (edm::isDebugEnabled()) {
1925  std::ostringstream myCoutStream;
1926  caloCond.print(myCoutStream);
1927  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
1928  }
1929 
1930  /*
1931  // insert condition into the map
1932  if ( !insertConditionIntoMap(caloCond, chipNr)) {
1933 
1934  edm::LogError("TriggerMenuParser")
1935  << " Error: duplicate condition (" << name << ")"
1936  << std::endl;
1937 
1938  return false;
1939  }
1940  else {
1941  (m_corCaloTemplate[chipNr]).push_back(caloCond);
1942  }
1943 */
1944  (m_corCaloTemplate[chipNr]).push_back(caloCond);
1945 
1946  //
1947  return true;
1948 }
1949 
1961 bool l1t::TriggerMenuParser::parseEnergySum(tmeventsetup::esCondition condEnergySum,
1962  unsigned int chipNr,
1963  const bool corrFlag) {
1964  // XERCES_CPP_NAMESPACE_USE
1965  using namespace tmeventsetup;
1966 
1967  // get condition, particle name and type name
1968 
1969  std::string condition = "calo";
1970  std::string type = l1t2string(condEnergySum.getType());
1971  std::string name = l1t2string(condEnergySum.getName());
1972 
1973  LogDebug("TriggerMenuParser") << "\n ****************************************** "
1974  << "\n (in parseEnergySum) "
1975  << "\n condition = " << condition << "\n type = " << type
1976  << "\n name = " << name << std::endl;
1977 
1978  // determine object type type
1979  GlobalObject energySumObjType;
1980  GtConditionType cType;
1981 
1982  if (condEnergySum.getType() == esConditionType::MissingEt) {
1983  energySumObjType = GlobalObject::gtETM;
1984  cType = TypeETM;
1985  } else if (condEnergySum.getType() == esConditionType::TotalEt) {
1986  energySumObjType = GlobalObject::gtETT;
1987  cType = TypeETT;
1988  } else if (condEnergySum.getType() == esConditionType::TotalEtEM) {
1989  energySumObjType = GlobalObject::gtETTem;
1990  cType = TypeETTem;
1991  } else if (condEnergySum.getType() == esConditionType::TotalHt) {
1992  energySumObjType = GlobalObject::gtHTT;
1993  cType = TypeHTT;
1994  } else if (condEnergySum.getType() == esConditionType::MissingHt) {
1995  energySumObjType = GlobalObject::gtHTM;
1996  cType = TypeHTM;
1997  } else if (condEnergySum.getType() == esConditionType::MissingEtHF) {
1998  energySumObjType = GlobalObject::gtETMHF;
1999  cType = TypeETMHF;
2000  } else if (condEnergySum.getType() == esConditionType::TowerCount) {
2001  energySumObjType = GlobalObject::gtTowerCount;
2002  cType = TypeTowerCount;
2003  } else if (condEnergySum.getType() == esConditionType::MinBiasHFP0) {
2004  energySumObjType = GlobalObject::gtMinBiasHFP0;
2005  cType = TypeMinBiasHFP0;
2006  } else if (condEnergySum.getType() == esConditionType::MinBiasHFM0) {
2007  energySumObjType = GlobalObject::gtMinBiasHFM0;
2008  cType = TypeMinBiasHFM0;
2009  } else if (condEnergySum.getType() == esConditionType::MinBiasHFP1) {
2010  energySumObjType = GlobalObject::gtMinBiasHFP1;
2011  cType = TypeMinBiasHFP1;
2012  } else if (condEnergySum.getType() == esConditionType::MinBiasHFM1) {
2013  energySumObjType = GlobalObject::gtMinBiasHFM1;
2014  cType = TypeMinBiasHFM1;
2015  } else if (condEnergySum.getType() == esConditionType::AsymmetryEt) {
2016  energySumObjType = GlobalObject::gtAsymmetryEt;
2017  cType = TypeAsymEt;
2018  } else if (condEnergySum.getType() == esConditionType::AsymmetryHt) {
2019  energySumObjType = GlobalObject::gtAsymmetryHt;
2020  cType = TypeAsymHt;
2021  } else if (condEnergySum.getType() == esConditionType::AsymmetryEtHF) {
2022  energySumObjType = GlobalObject::gtAsymmetryEtHF;
2023  cType = TypeAsymEtHF;
2024  } else if (condEnergySum.getType() == esConditionType::AsymmetryHtHF) {
2025  energySumObjType = GlobalObject::gtAsymmetryHtHF;
2026  cType = TypeAsymHtHF;
2027  } else if (condEnergySum.getType() == esConditionType::Centrality0) {
2028  energySumObjType = GlobalObject::gtCentrality0;
2029  cType = TypeCent0;
2030  } else if (condEnergySum.getType() == esConditionType::Centrality1) {
2031  energySumObjType = GlobalObject::gtCentrality1;
2032  cType = TypeCent1;
2033  } else if (condEnergySum.getType() == esConditionType::Centrality2) {
2034  energySumObjType = GlobalObject::gtCentrality2;
2035  cType = TypeCent2;
2036  } else if (condEnergySum.getType() == esConditionType::Centrality3) {
2037  energySumObjType = GlobalObject::gtCentrality3;
2038  cType = TypeCent3;
2039  } else if (condEnergySum.getType() == esConditionType::Centrality4) {
2040  energySumObjType = GlobalObject::gtCentrality4;
2041  cType = TypeCent4;
2042  } else if (condEnergySum.getType() == esConditionType::Centrality5) {
2043  energySumObjType = GlobalObject::gtCentrality5;
2044  cType = TypeCent5;
2045  } else if (condEnergySum.getType() == esConditionType::Centrality6) {
2046  energySumObjType = GlobalObject::gtCentrality6;
2047  cType = TypeCent6;
2048  } else if (condEnergySum.getType() == esConditionType::Centrality7) {
2049  energySumObjType = GlobalObject::gtCentrality7;
2050  cType = TypeCent7;
2051  } else {
2052  edm::LogError("TriggerMenuParser") << "Wrong type for energy-sum condition (" << type << ")" << std::endl;
2053  return false;
2054  }
2055 
2056  // global object
2057  int nrObj = 1;
2058 
2059  // std::string str_etComparison = l1t2string( condEnergySum.comparison_operator() );
2060 
2061  // get values
2062 
2063  // temporary storage of the parameters
2064  std::vector<EnergySumTemplate::ObjectParameter> objParameter(nrObj);
2065 
2066  int cnt = 0;
2067 
2068  // BLW TO DO: These needs to the added to the object rather than the whole condition.
2069  int relativeBx = 0;
2070  bool gEq = false;
2071 
2072  // l1t::EnergySumsObjectRequirement objPar = condEnergySum.objectRequirement();
2073 
2074  // Loop over objects and extract the cuts on the objects
2075  const std::vector<esObject>& objects = condEnergySum.getObjects();
2076  for (size_t jj = 0; jj < objects.size(); jj++) {
2077  const esObject object = objects.at(jj);
2078  gEq = (object.getComparisonOperator() == esComparisonOperator::GE);
2079 
2080  // BLW TO DO: This needs to be added to the Object Parameters
2081  relativeBx = object.getBxOffset();
2082 
2083  // Loop over the cuts for this object
2084  int lowerThresholdInd = 0;
2085  int upperThresholdInd = -1;
2086  int cntPhi = 0;
2087  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
2088 
2089  const std::vector<esCut>& cuts = object.getCuts();
2090  for (size_t kk = 0; kk < cuts.size(); kk++) {
2091  const esCut cut = cuts.at(kk);
2092 
2093  switch (cut.getCutType()) {
2094  case esCutType::Threshold:
2095  lowerThresholdInd = cut.getMinimum().index;
2096  upperThresholdInd = cut.getMaximum().index;
2097  break;
2098 
2099  case esCutType::Eta:
2100  break;
2101 
2102  case esCutType::Phi: {
2103  if (cntPhi == 0) {
2104  phiWindow1Lower = cut.getMinimum().index;
2105  phiWindow1Upper = cut.getMaximum().index;
2106  } else if (cntPhi == 1) {
2107  phiWindow2Lower = cut.getMinimum().index;
2108  phiWindow2Upper = cut.getMaximum().index;
2109  } else {
2110  edm::LogError("TriggerMenuParser") << "Too Many Phi Cuts for esum-condition (" << type << ")" << std::endl;
2111  return false;
2112  }
2113  cntPhi++;
2114 
2115  } break;
2116 
2117  case esCutType::Count:
2118  lowerThresholdInd = cut.getMinimum().index;
2119  upperThresholdInd = 0xffffff;
2120  break;
2121 
2122  default:
2123  break;
2124  } //end switch
2125 
2126  } //end loop over cuts
2127 
2128  // Fill the object parameters
2129  objParameter[cnt].etLowThreshold = lowerThresholdInd;
2130  objParameter[cnt].etHighThreshold = upperThresholdInd;
2131  objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
2132  objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
2133  objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
2134  objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
2135 
2136  // Output for debugging
2137  LogDebug("TriggerMenuParser") << "\n EnergySum ET high threshold (hex) for energy sum object " << cnt << " = "
2138  << std::hex << objParameter[cnt].etLowThreshold << " - "
2139  << objParameter[cnt].etHighThreshold
2140  << "\n phiWindow Lower / Upper for calo object " << cnt << " = 0x"
2141  << objParameter[cnt].phiWindow1Lower << " / 0x" << objParameter[cnt].phiWindow1Upper
2142  << "\n phiWindowVeto Lower / Upper for calo object " << cnt << " = 0x"
2143  << objParameter[cnt].phiWindow2Lower << " / 0x" << objParameter[cnt].phiWindow2Upper
2144  << std::dec << std::endl;
2145 
2146  cnt++;
2147  } //end loop over objects
2148 
2149  // object types - all same energySumObjType
2150  std::vector<GlobalObject> objType(nrObj, energySumObjType);
2151 
2152  // now create a new energySum condition
2153 
2154  EnergySumTemplate energySumCond(name);
2155 
2156  energySumCond.setCondType(cType);
2157  energySumCond.setObjectType(objType);
2158  energySumCond.setCondGEq(gEq);
2159  energySumCond.setCondChipNr(chipNr);
2160  energySumCond.setCondRelativeBx(relativeBx);
2161 
2162  energySumCond.setConditionParameter(objParameter);
2163 
2164  if (edm::isDebugEnabled()) {
2165  std::ostringstream myCoutStream;
2166  energySumCond.print(myCoutStream);
2167  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2168  }
2169 
2170  // insert condition into the map
2171  if (!insertConditionIntoMap(energySumCond, chipNr)) {
2172  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
2173 
2174  return false;
2175  } else {
2176  if (corrFlag) {
2177  (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2178 
2179  } else {
2180  (m_vecEnergySumTemplate[chipNr]).push_back(energySumCond);
2181  }
2182  }
2183 
2184  //
2185  return true;
2186 }
2187 
2199 bool l1t::TriggerMenuParser::parseEnergySumCorr(const tmeventsetup::esObject* corrESum, unsigned int chipNr) {
2200  // XERCES_CPP_NAMESPACE_USE
2201  using namespace tmeventsetup;
2202 
2203  // get condition, particle name and type name
2204 
2205  std::string condition = "calo";
2206  std::string type = l1t2string(corrESum->getType());
2207  std::string name = l1t2string(corrESum->getName());
2208 
2209  LogDebug("TriggerMenuParser") << "\n ****************************************** "
2210  << "\n (in parseEnergySum) "
2211  << "\n condition = " << condition << "\n type = " << type
2212  << "\n name = " << name << std::endl;
2213 
2214  // determine object type type
2215  GlobalObject energySumObjType;
2216  GtConditionType cType;
2217 
2218  if (corrESum->getType() == esObjectType::ETM) {
2219  energySumObjType = GlobalObject::gtETM;
2220  cType = TypeETM;
2221  } else if (corrESum->getType() == esObjectType::HTM) {
2222  energySumObjType = GlobalObject::gtHTM;
2223  cType = TypeHTM;
2224  } else if (corrESum->getType() == esObjectType::ETMHF) {
2225  energySumObjType = GlobalObject::gtETMHF;
2226  cType = TypeETMHF;
2227  } else if (corrESum->getType() == esObjectType::TOWERCOUNT) {
2228  energySumObjType = GlobalObject::gtTowerCount;
2229  cType = TypeTowerCount;
2230  } else {
2231  edm::LogError("TriggerMenuParser") << "Wrong type for energy-sum correclation condition (" << type << ")"
2232  << std::endl;
2233  return false;
2234  }
2235 
2236  // global object
2237  int nrObj = 1;
2238 
2239  // std::string str_etComparison = l1t2string( condEnergySum.comparison_operator() );
2240 
2241  // get values
2242 
2243  // temporary storage of the parameters
2244  std::vector<EnergySumTemplate::ObjectParameter> objParameter(nrObj);
2245 
2246  int cnt = 0;
2247 
2248  // BLW TO DO: These needs to the added to the object rather than the whole condition.
2249  int relativeBx = 0;
2250  bool gEq = false;
2251 
2252  // l1t::EnergySumsObjectRequirement objPar = condEnergySum.objectRequirement();
2253 
2254  gEq = (corrESum->getComparisonOperator() == esComparisonOperator::GE);
2255 
2256  // BLW TO DO: This needs to be added to the Object Parameters
2257  relativeBx = corrESum->getBxOffset();
2258 
2259  // Loop over the cuts for this object
2260  int lowerThresholdInd = 0;
2261  int upperThresholdInd = -1;
2262  int cntPhi = 0;
2263  unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1;
2264 
2265  const std::vector<esCut>& cuts = corrESum->getCuts();
2266  for (size_t kk = 0; kk < cuts.size(); kk++) {
2267  const esCut cut = cuts.at(kk);
2268 
2269  switch (cut.getCutType()) {
2270  case esCutType::Threshold:
2271  lowerThresholdInd = cut.getMinimum().index;
2272  upperThresholdInd = cut.getMaximum().index;
2273  break;
2274 
2275  case esCutType::Eta:
2276  break;
2277 
2278  case esCutType::Phi: {
2279  if (cntPhi == 0) {
2280  phiWindow1Lower = cut.getMinimum().index;
2281  phiWindow1Upper = cut.getMaximum().index;
2282  } else if (cntPhi == 1) {
2283  phiWindow2Lower = cut.getMinimum().index;
2284  phiWindow2Upper = cut.getMaximum().index;
2285  } else {
2286  edm::LogError("TriggerMenuParser") << "Too Many Phi Cuts for esum-condition (" << type << ")" << std::endl;
2287  return false;
2288  }
2289  cntPhi++;
2290 
2291  } break;
2292 
2293  default:
2294  break;
2295  } //end switch
2296 
2297  } //end loop over cuts
2298 
2299  // Fill the object parameters
2300  objParameter[0].etLowThreshold = lowerThresholdInd;
2301  objParameter[0].etHighThreshold = upperThresholdInd;
2302  objParameter[0].phiWindow1Lower = phiWindow1Lower;
2303  objParameter[0].phiWindow1Upper = phiWindow1Upper;
2304  objParameter[0].phiWindow2Lower = phiWindow2Lower;
2305  objParameter[0].phiWindow2Upper = phiWindow2Upper;
2306 
2307  // Output for debugging
2308  LogDebug("TriggerMenuParser") << "\n EnergySum ET high threshold (hex) for energy sum object " << cnt << " = "
2309  << std::hex << objParameter[0].etLowThreshold << " - " << objParameter[0].etLowThreshold
2310  << "\n phiWindow Lower / Upper for calo object " << cnt << " = 0x"
2311  << objParameter[0].phiWindow1Lower << " / 0x" << objParameter[0].phiWindow1Upper
2312  << "\n phiWindowVeto Lower / Upper for calo object " << cnt << " = 0x"
2313  << objParameter[0].phiWindow2Lower << " / 0x" << objParameter[0].phiWindow2Upper
2314  << std::dec << std::endl;
2315 
2316  // object types - all same energySumObjType
2317  std::vector<GlobalObject> objType(nrObj, energySumObjType);
2318 
2319  // now create a new energySum condition
2320 
2321  EnergySumTemplate energySumCond(name);
2322 
2323  energySumCond.setCondType(cType);
2324  energySumCond.setObjectType(objType);
2325  energySumCond.setCondGEq(gEq);
2326  energySumCond.setCondChipNr(chipNr);
2327  energySumCond.setCondRelativeBx(relativeBx);
2328 
2329  energySumCond.setConditionParameter(objParameter);
2330 
2331  if (edm::isDebugEnabled()) {
2332  std::ostringstream myCoutStream;
2333  energySumCond.print(myCoutStream);
2334  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2335  }
2336  /*
2337  // insert condition into the map
2338  if ( !insertConditionIntoMap(energySumCond, chipNr)) {
2339 
2340  edm::LogError("TriggerMenuParser")
2341  << " Error: duplicate condition (" << name << ")"
2342  << std::endl;
2343 
2344  return false;
2345  }
2346  else {
2347 
2348  (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2349 
2350  }
2351 */
2352  (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2353 
2354  //
2355  return true;
2356 }
2357 
2370 bool l1t::TriggerMenuParser::parseExternal(tmeventsetup::esCondition condExt, unsigned int chipNr) {
2371  using namespace tmeventsetup;
2372 
2373  // get condition, particle name and type name
2374  std::string condition = "ext";
2375  std::string particle = "test-fix";
2376  std::string type = l1t2string(condExt.getType());
2377  std::string name = l1t2string(condExt.getName());
2378 
2379  LogDebug("TriggerMenuParser") << "\n ****************************************** "
2380  << "\n (in parseExternal) "
2381  << "\n condition = " << condition << "\n particle = " << particle
2382  << "\n type = " << type << "\n name = " << name << std::endl;
2383 
2384  // object type and condition type
2385  // object type - irrelevant for External conditions
2386  GtConditionType cType = TypeExternal;
2387  GlobalObject extSignalType = GlobalObject::gtExternal;
2388  int nrObj = 1; //only one object for these conditions
2389 
2390  int relativeBx = 0;
2391  unsigned int channelID = 0;
2392 
2393  // Get object for External conditions
2394  const std::vector<esObject>& objects = condExt.getObjects();
2395  for (size_t jj = 0; jj < objects.size(); jj++) {
2396  const esObject object = objects.at(jj);
2397  if (object.getType() == esObjectType::EXT) {
2398  relativeBx = object.getBxOffset();
2399  channelID = object.getExternalChannelId();
2400  }
2401  }
2402 
2403  // set the boolean value for the ge_eq mode - irrelevant for External conditions
2404  bool gEq = false;
2405 
2406  //object types - all same for external conditions
2407  std::vector<GlobalObject> objType(nrObj, extSignalType);
2408 
2409  // now create a new External condition
2410  ExternalTemplate externalCond(name);
2411 
2412  externalCond.setCondType(cType);
2413  externalCond.setObjectType(objType);
2414  externalCond.setCondGEq(gEq);
2415  externalCond.setCondChipNr(chipNr);
2416  externalCond.setCondRelativeBx(relativeBx);
2417  externalCond.setExternalChannel(channelID);
2418 
2419  LogTrace("TriggerMenuParser") << externalCond << "\n" << std::endl;
2420 
2421  // insert condition into the map
2422  if (!insertConditionIntoMap(externalCond, chipNr)) {
2423  edm::LogError("TriggerMenuParser") << " Error: duplicate condition (" << name << ")" << std::endl;
2424 
2425  return false;
2426  } else {
2427  (m_vecExternalTemplate[chipNr]).push_back(externalCond);
2428  }
2429 
2430  return true;
2431 }
2432 
2445 bool l1t::TriggerMenuParser::parseCorrelation(tmeventsetup::esCondition corrCond, unsigned int chipNr) {
2446  using namespace tmeventsetup;
2447 
2448  std::string condition = "corr";
2449  std::string particle = "test-fix";
2450  std::string type = l1t2string(corrCond.getType());
2451  std::string name = l1t2string(corrCond.getName());
2452 
2453  LogDebug("TriggerMenuParser") << " ****************************************** " << std::endl
2454  << " (in parseCorrelation) " << std::endl
2455  << " condition = " << condition << std::endl
2456  << " particle = " << particle << std::endl
2457  << " type = " << type << std::endl
2458  << " name = " << name << std::endl;
2459 
2460  // create a new correlation condition
2461  CorrelationTemplate correlationCond(name);
2462 
2463  // check that the condition does not exist already in the map
2464  if (!insertConditionIntoMap(correlationCond, chipNr)) {
2465  edm::LogError("TriggerMenuParser") << " Error: duplicate correlation condition (" << name << ")" << std::endl;
2466 
2467  return false;
2468  }
2469 
2470  // Define some of the quantities to store the parased information
2471 
2472  // condition type BLW (Do we change this to the type of correlation condition?)
2474 
2475  // two objects (for sure)
2476  const int nrObj = 2;
2477 
2478  // object types and greater equal flag - filled in the loop
2479  int intGEq[nrObj] = {-1, -1};
2480  std::vector<GlobalObject> objType(nrObj); //BLW do we want to define these as a different type?
2481  std::vector<GtConditionCategory> condCateg(nrObj); //BLW do we want to change these categories
2482 
2483  // correlation flag and index in the cor*vector
2484  const bool corrFlag = true;
2485  int corrIndexVal[nrObj] = {-1, -1};
2486 
2487  // Storage of the correlation selection
2489  corrParameter.chargeCorrelation = 1; //ignore charge correlation
2490 
2491  // Get the correlation Cuts on the legs
2492  int cutType = 0;
2493  const std::vector<esCut>& cuts = corrCond.getCuts();
2494  for (size_t jj = 0; jj < cuts.size(); jj++) {
2495  const esCut cut = cuts.at(jj);
2496 
2497  if (cut.getCutType() == esCutType::ChargeCorrelation) {
2498  if (cut.getData() == "ls")
2499  corrParameter.chargeCorrelation = 2;
2500  else if (cut.getData() == "os")
2501  corrParameter.chargeCorrelation = 4;
2502  else
2503  corrParameter.chargeCorrelation = 1; //ignore charge correlation
2504  } else {
2505  //
2506  // Unitl utm has method to calculate these, do the integer value calculation with precision.
2507  //
2508  double minV = cut.getMinimum().value;
2509  double maxV = cut.getMaximum().value;
2510 
2511  //Scale down very large numbers out of xml
2512  if (maxV > 1.0e8)
2513  maxV = 1.0e8;
2514 
2515  if (cut.getCutType() == esCutType::DeltaEta) {
2516  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tDeltaEta Cut minV = " << minV
2517  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
2518  << " precMax = " << cut.getMaximum().index << std::endl;
2519  corrParameter.minEtaCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2520  corrParameter.maxEtaCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2521  corrParameter.precEtaCut = cut.getMinimum().index;
2522  cutType = cutType | 0x1;
2523  } else if (cut.getCutType() == esCutType::DeltaPhi) {
2524  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tDeltaPhi Cut minV = " << minV
2525  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
2526  << " precMax = " << cut.getMaximum().index << std::endl;
2527  corrParameter.minPhiCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2528  corrParameter.maxPhiCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2529  corrParameter.precPhiCut = cut.getMinimum().index;
2530  cutType = cutType | 0x2;
2531  } else if (cut.getCutType() == esCutType::DeltaR) {
2532  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tDeltaR Cut minV = " << minV
2533  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
2534  << " precMax = " << cut.getMaximum().index << std::endl;
2535  corrParameter.minDRCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2536  corrParameter.maxDRCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2537  corrParameter.precDRCut = cut.getMinimum().index;
2538  cutType = cutType | 0x4;
2539  } else if (cut.getCutType() == esCutType::TwoBodyPt) {
2540  corrParameter.minTBPTCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2541  corrParameter.maxTBPTCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2542  corrParameter.precTBPTCut = cut.getMinimum().index;
2543  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tTPBT Cut minV = " << minV
2544  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
2545  << " precMax = " << cut.getMaximum().index << std::endl;
2546  cutType = cutType | 0x20;
2547  } else if (cut.getCutType() == esCutType::Mass) {
2548  LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tMass Cut minV = " << minV
2549  << " Max = " << maxV << " precMin = " << cut.getMinimum().index
2550  << " precMax = " << cut.getMaximum().index << std::endl;
2551  corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2552  corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2553  corrParameter.precMassCut = cut.getMinimum().index;
2554  // cutType = cutType | 0x8;
2555  if (corrCond.getType() == esConditionType::TransverseMass) {
2556  cutType = cutType | 0x10;
2557  //std::cout << "CCLA running Transverse mass cutType= " << cutType << std::endl;
2558  } else {
2559  cutType = cutType | 0x8;
2560  //std::cout << "CCLA running Invarient mass cutType= " << cutType << std::endl;
2561  }
2562  }
2563  }
2564  }
2565  corrParameter.corrCutType = cutType;
2566 
2567  // Get the two objects that form the legs
2568  const std::vector<esObject>& objects = corrCond.getObjects();
2569  if (objects.size() != 2) {
2570  edm::LogError("TriggerMenuParser") << "incorrect number of objects for the correlation condition " << name
2571  << " corrFlag " << corrFlag << std::endl;
2572  return false;
2573  }
2574 
2575  // loop over legs
2576  for (size_t jj = 0; jj < objects.size(); jj++) {
2577  const esObject object = objects.at(jj);
2578  //std::cout << " obj name = " << object.getName() << "\n";
2579  //std::cout << " obj type = " << object.getType() << "\n";
2580  //std::cout << " obj op = " << object.getComparisonOperator() << "\n";
2581  //std::cout << " obj bx = " << object.getBxOffset() << "\n";
2582 
2583  // check the leg type
2584  if (object.getType() == esObjectType::Muon) {
2585  // we have a muon
2586 
2587  /*
2588  //BLW Hold on to this code we may need to go back to it at some point.
2589  // Now we are putting ALL leg conditions into the vector (so there are duplicates)
2590  // This is potentially a place to slim down the code. Note: We currently evaluate the
2591  // conditions every time, so even if we put the condition in the vector once, we would
2592  // still evaluate it multiple times. This is a place for optimization.
2593  {
2594 
2595  parseMuonCorr(&object,chipNr);
2596  corrIndexVal[jj] = (m_corMuonTemplate[chipNr]).size() - 1;
2597 
2598  } else {
2599  LogDebug("TriggerMenuParser") << "Not Adding Correlation Muon Condition to Map...looking for the condition in Muon Cor Vector" << std::endl;
2600  bool found = false;
2601  int index = 0;
2602  while(!found && index<(int)((m_corMuonTemplate[chipNr]).size()) ) {
2603  if( (m_corMuonTemplate[chipNr]).at(index).condName() == object.getName() ) {
2604  LogDebug("TriggerMenuParser") << "Found condition " << object.getName() << " in vector at index " << index << std::endl;
2605  found = true;
2606  } else {
2607  index++;
2608  }
2609  }
2610  if(found) {
2611  corrIndexVal[jj] = index;
2612  } else {
2613  edm::LogError("TriggerMenuParser") << "FAILURE: Condition " << object.getName() << " is in map but not in cor. vector " << std::endl;
2614  }
2615 
2616  }
2617 */
2618  parseMuonCorr(&object, chipNr);
2619  corrIndexVal[jj] = (m_corMuonTemplate[chipNr]).size() - 1;
2620 
2621  //Now set some flags for this subCondition
2622  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
2623  objType[jj] = gtMu;
2624  condCateg[jj] = CondMuon;
2625 
2626  } else if (object.getType() == esObjectType::Egamma || object.getType() == esObjectType::Jet ||
2627  object.getType() == esObjectType::Tau) {
2628  // we have an Calo object
2629  parseCaloCorr(&object, chipNr);
2630  corrIndexVal[jj] = (m_corCaloTemplate[chipNr]).size() - 1;
2631 
2632  //Now set some flags for this subCondition
2633  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
2634  switch (object.getType()) {
2635  case esObjectType::Egamma: {
2636  objType[jj] = gtEG;
2637  } break;
2638  case esObjectType::Jet: {
2639  objType[jj] = gtJet;
2640  } break;
2641  case esObjectType::Tau: {
2642  objType[jj] = gtTau;
2643  } break;
2644  default: {
2645  } break;
2646  }
2647  condCateg[jj] = CondCalo;
2648 
2649  } else if (object.getType() == esObjectType::ETM || object.getType() == esObjectType::ETMHF ||
2650  object.getType() == esObjectType::TOWERCOUNT || object.getType() == esObjectType::HTM) {
2651  // we have Energy Sum
2652  parseEnergySumCorr(&object, chipNr);
2653  corrIndexVal[jj] = (m_corEnergySumTemplate[chipNr]).size() - 1;
2654 
2655  //Now set some flags for this subCondition
2656  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
2657  switch (object.getType()) {
2658  case esObjectType::ETM: {
2660  } break;
2661  case esObjectType::HTM: {
2663  } break;
2664  case esObjectType::ETMHF: {
2666  } break;
2667  case esObjectType::TOWERCOUNT: {
2669  } break;
2670  default: {
2671  } break;
2672  }
2673  condCateg[jj] = CondEnergySum;
2674 
2675  } else {
2676  edm::LogError("TriggerMenuParser") << "Illegal Object Type " << object.getType()
2677  << " for the correlation condition " << name << std::endl;
2678  return false;
2679 
2680  } //if block on leg types
2681 
2682  } //loop over legs
2683 
2684  // get greater equal flag for the correlation condition
2685  bool gEq = true;
2686  if (intGEq[0] != intGEq[1]) {
2687  edm::LogError("TriggerMenuParser") << "Inconsistent GEq flags for sub-conditions "
2688  << " for the correlation condition " << name << std::endl;
2689  return false;
2690 
2691  } else {
2692  gEq = (intGEq[0] != 0);
2693  }
2694 
2695  // fill the correlation condition
2696  correlationCond.setCondType(cType);
2697  correlationCond.setObjectType(objType);
2698  correlationCond.setCondGEq(gEq);
2699  correlationCond.setCondChipNr(chipNr);
2700 
2701  correlationCond.setCond0Category(condCateg[0]);
2702  correlationCond.setCond1Category(condCateg[1]);
2703 
2704  correlationCond.setCond0Index(corrIndexVal[0]);
2705  correlationCond.setCond1Index(corrIndexVal[1]);
2706 
2707  correlationCond.setCorrelationParameter(corrParameter);
2708 
2709  if (edm::isDebugEnabled()) {
2710  std::ostringstream myCoutStream;
2711  correlationCond.print(myCoutStream);
2712  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
2713  }
2714 
2715  // insert condition into the map
2716  // condition is not duplicate, check was done at the beginning
2717 
2718  (m_vecCorrelationTemplate[chipNr]).push_back(correlationCond);
2719 
2720  //
2721  return true;
2722 }
2723 
2736 bool l1t::TriggerMenuParser::parseCorrelationWithOverlapRemoval(const tmeventsetup::esCondition& corrCond,
2737  unsigned int chipNr) {
2738  using namespace tmeventsetup;
2739 
2740  std::string condition = "corrWithOverlapRemoval";
2741  std::string particle = "test-fix";
2742  std::string type = l1t2string(corrCond.getType());
2743  std::string name = l1t2string(corrCond.getName());
2744 
2745  LogDebug("TriggerMenuParser") << " ****************************************** " << std::endl
2746  << " (in parseCorrelationWithOverlapRemoval) " << std::endl
2747  << " condition = " << condition << std::endl
2748  << " particle = " << particle << std::endl
2749  << " type = " << type << std::endl
2750  << " name = " << name << std::endl;
2751 
2752  // create a new correlation condition
2753  CorrelationWithOverlapRemovalTemplate correlationWORCond(name);
2754 
2755  // check that the condition does not exist already in the map
2756  if (!insertConditionIntoMap(correlationWORCond, chipNr)) {
2757  edm::LogError("TriggerMenuParser") << " Error: duplicate correlation condition (" << name << ")" << std::endl;
2758 
2759  return false;
2760  }
2761 
2762  // Define some of the quantities to store the parased information
2763 
2764  // condition type BLW (Do we change this to the type of correlation condition?)
2766 
2767  // three objects (for sure)
2768  const int nrObj = 3;
2769 
2770  // object types and greater equal flag - filled in the loop
2771  int intGEq[nrObj] = {-1, -1, -1};
2772  std::vector<GlobalObject> objType(nrObj); //BLW do we want to define these as a different type?
2773  std::vector<GtConditionCategory> condCateg(nrObj); //BLW do we want to change these categories
2774 
2775  // correlation flag and index in the cor*vector
2776  const bool corrFlag = true;
2777  int corrIndexVal[nrObj] = {-1, -1, -1};
2778 
2779  // Storage of the correlation selection
2781  corrParameter.chargeCorrelation = 1; //ignore charge correlation for corr-legs
2782 
2783  // Get the correlation Cuts on the legs
2784  int cutType = 0;
2785  const std::vector<esCut>& cuts = corrCond.getCuts();
2786  for (size_t jj = 0; jj < cuts.size(); jj++) {
2787  const esCut cut = cuts.at(jj);
2788 
2789  if (cut.getCutType() == esCutType::ChargeCorrelation) {
2790  if (cut.getData() == "ls")
2791  corrParameter.chargeCorrelation = 2;
2792  else if (cut.getData() == "os")
2793  corrParameter.chargeCorrelation = 4;
2794  else
2795  corrParameter.chargeCorrelation = 1; //ignore charge correlation
2796  } else {
2797  //
2798  // Unitl utm has method to calculate these, do the integer value calculation with precision.
2799  //
2800  double minV = cut.getMinimum().value;
2801  double maxV = cut.getMaximum().value;
2802 
2803  //Scale down very large numbers out of xml
2804  if (maxV > 1.0e8)
2805  maxV = 1.0e8;
2806 
2807  if (cut.getCutType() == esCutType::DeltaEta) {
2808  //std::cout << "DeltaEta Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
2809  corrParameter.minEtaCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2810  corrParameter.maxEtaCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2811  corrParameter.precEtaCut = cut.getMinimum().index;
2812  cutType = cutType | 0x1;
2813  } else if (cut.getCutType() == esCutType::DeltaPhi) {
2814  //std::cout << "DeltaPhi Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
2815  corrParameter.minPhiCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2816  corrParameter.maxPhiCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2817  corrParameter.precPhiCut = cut.getMinimum().index;
2818  cutType = cutType | 0x2;
2819  } else if (cut.getCutType() == esCutType::DeltaR) {
2820  //std::cout << "DeltaR Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
2821  corrParameter.minDRCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2822  corrParameter.maxDRCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2823  corrParameter.precDRCut = cut.getMinimum().index;
2824  cutType = cutType | 0x4;
2825  } else if (cut.getCutType() == esCutType::Mass) {
2826  //std::cout << "Mass Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
2827  corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2828  corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2829  corrParameter.precMassCut = cut.getMinimum().index;
2830  cutType = cutType | 0x8;
2831  }
2832  if (cut.getCutType() == esCutType::OvRmDeltaEta) {
2833  //std::cout << "OverlapRemovalDeltaEta Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
2834  corrParameter.minOverlapRemovalEtaCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2835  corrParameter.maxOverlapRemovalEtaCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2836  corrParameter.precOverlapRemovalEtaCut = cut.getMinimum().index;
2837  cutType = cutType | 0x10;
2838  } else if (cut.getCutType() == esCutType::OvRmDeltaPhi) {
2839  //std::cout << "OverlapRemovalDeltaPhi Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
2840  corrParameter.minOverlapRemovalPhiCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2841  corrParameter.maxOverlapRemovalPhiCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2842  corrParameter.precOverlapRemovalPhiCut = cut.getMinimum().index;
2843  cutType = cutType | 0x20;
2844  } else if (cut.getCutType() == esCutType::OvRmDeltaR) {
2845  //std::cout << "DeltaR Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl;
2846  corrParameter.minOverlapRemovalDRCutValue = (long long)(minV * pow(10., cut.getMinimum().index));
2847  corrParameter.maxOverlapRemovalDRCutValue = (long long)(maxV * pow(10., cut.getMaximum().index));
2848  corrParameter.precOverlapRemovalDRCut = cut.getMinimum().index;
2849  cutType = cutType | 0x40;
2850  }
2851  }
2852  }
2853  corrParameter.corrCutType = cutType;
2854 
2855  // Get the two objects that form the legs
2856  const std::vector<esObject>& objects = corrCond.getObjects();
2857  if (objects.size() != 3) {
2858  edm::LogError("TriggerMenuParser")
2859  << "incorrect number of objects for the correlation condition with overlap removal " << name << " corrFlag "
2860  << corrFlag << std::endl;
2861  return false;
2862  }
2863 
2864  // loop over legs
2865  for (size_t jj = 0; jj < objects.size(); jj++) {
2866  const esObject& object = objects.at(jj);
2867  //std::cout << " obj name = " << object.getName() << "\n";
2868  //std::cout << " obj type = " << object.getType() << "\n";
2869  //std::cout << " obj op = " << object.getComparisonOperator() << "\n";
2870  //std::cout << " obj bx = " << object.getBxOffset() << "\n";
2871  //std::cout << "type = done" << std::endl;
2872 
2873  // check the leg type
2874  if (object.getType() == esObjectType::Muon) {
2875  // we have a muon
2876 
2877  /*
2878  //BLW Hold on to this code we may need to go back to it at some point.
2879  // Now we are putting ALL leg conditions into the vector (so there are duplicates)
2880  // This is potentially a place to slim down the code. Note: We currently evaluate the
2881  // conditions every time, so even if we put the condition in the vector once, we would
2882  // still evaluate it multiple times. This is a place for optimization.
2883  {
2884 
2885  parseMuonCorr(&object,chipNr);
2886  corrIndexVal[jj] = (m_corMuonTemplate[chipNr]).size() - 1;
2887 
2888  } else {
2889  LogDebug("TriggerMenuParser") << "Not Adding Correlation Muon Condition to Map...looking for the condition in Muon Cor Vector" << std::endl;
2890  bool found = false;
2891  int index = 0;
2892  while(!found && index<(int)((m_corMuonTemplate[chipNr]).size()) ) {
2893  if( (m_corMuonTemplate[chipNr]).at(index).condName() == object.getName() ) {
2894  LogDebug("TriggerMenuParser") << "Found condition " << object.getName() << " in vector at index " << index << std::endl;
2895  found = true;
2896  } else {
2897  index++;
2898  }
2899  }
2900  if(found) {
2901  corrIndexVal[jj] = index;
2902  } else {
2903  edm::LogError("TriggerMenuParser") << "FAILURE: Condition " << object.getName() << " is in map but not in cor. vector " << std::endl;
2904  }
2905 
2906  }
2907 */
2908  parseMuonCorr(&object, chipNr);
2909  corrIndexVal[jj] = (m_corMuonTemplate[chipNr]).size() - 1;
2910 
2911  //Now set some flags for this subCondition
2912  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
2913  objType[jj] = gtMu;
2914  condCateg[jj] = CondMuon;
2915 
2916  } else if (object.getType() == esObjectType::Egamma || object.getType() == esObjectType::Jet ||
2917  object.getType() == esObjectType::Tau) {
2918  // we have an Calo object
2919  parseCaloCorr(&object, chipNr);
2920  corrIndexVal[jj] = (m_corCaloTemplate[chipNr]).size() - 1;
2921 
2922  //Now set some flags for this subCondition
2923  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
2924  switch (object.getType()) {
2925  case esObjectType::Egamma: {
2926  objType[jj] = gtEG;
2927  } break;
2928  case esObjectType::Jet: {
2929  objType[jj] = gtJet;
2930  } break;
2931  case esObjectType::Tau: {
2932  objType[jj] = gtTau;
2933  } break;
2934  default: {
2935  } break;
2936  }
2937  condCateg[jj] = CondCalo;
2938 
2939  } else if (object.getType() == esObjectType::ETM || object.getType() == esObjectType::ETMHF ||
2940  object.getType() == esObjectType::TOWERCOUNT || object.getType() == esObjectType::HTM) {
2941  // we have Energy Sum
2942  parseEnergySumCorr(&object, chipNr);
2943  corrIndexVal[jj] = (m_corEnergySumTemplate[chipNr]).size() - 1;
2944 
2945  //Now set some flags for this subCondition
2946  intGEq[jj] = (object.getComparisonOperator() == esComparisonOperator::GE);
2947  switch (object.getType()) {
2948  case esObjectType::ETM: {
2950  } break;
2951  case esObjectType::HTM: {
2953  } break;
2954  case esObjectType::ETMHF: {
2956  } break;
2957  case esObjectType::TOWERCOUNT: {
2959  } break;
2960  default: {
2961  } break;
2962  }
2963  condCateg[jj] = CondEnergySum;
2964 
2965  } else {
2966  edm::LogError("TriggerMenuParser") << "Illegal Object Type " << object.getType()
2967  << " for the correlation condition " << name << std::endl;
2968  return false;
2969 
2970  } //if block on leg types
2971 
2972  } //loop over legs
2973 
2974  // get greater equal flag for the correlation condition
2975  bool gEq = true;
2976  if (intGEq[0] != intGEq[1]) {
2977  edm::LogError("TriggerMenuParser") << "Inconsistent GEq flags for sub-conditions "
2978  << " for the correlation condition " << name << std::endl;
2979  return false;
2980 
2981  } else {
2982  gEq = (intGEq[0] != 0);
2983  }
2984 
2985  // fill the correlation condition
2986  correlationWORCond.setCondType(cType);
2987  correlationWORCond.setObjectType(objType);
2988  correlationWORCond.setCondGEq(gEq);
2989  correlationWORCond.setCondChipNr(chipNr);
2990 
2991  correlationWORCond.setCond0Category(condCateg[0]);
2992  correlationWORCond.setCond1Category(condCateg[1]);
2993  correlationWORCond.setCond2Category(condCateg[2]);
2994 
2995  correlationWORCond.setCond0Index(corrIndexVal[0]);
2996  correlationWORCond.setCond1Index(corrIndexVal[1]);
2997  correlationWORCond.setCond2Index(corrIndexVal[2]);
2998 
2999  correlationWORCond.setCorrelationWithOverlapRemovalParameter(corrParameter);
3000 
3001  if (edm::isDebugEnabled()) {
3002  std::ostringstream myCoutStream;
3003  correlationWORCond.print(myCoutStream);
3004  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
3005  }
3006 
3007  // insert condition into the map
3008  // condition is not duplicate, check was done at the beginning
3009 
3010  (m_vecCorrelationWithOverlapRemovalTemplate[chipNr]).push_back(correlationWORCond);
3011 
3012  //
3013  return true;
3014 }
3015 
3027 bool l1t::TriggerMenuParser::parseAlgorithm(tmeventsetup::esAlgorithm algorithm, unsigned int chipNr) {
3028  using namespace tmeventsetup;
3029  //using namespace Algorithm;
3030 
3031  // get alias
3032  std::string algAlias = algorithm.getName();
3033  const std::string& algName = algorithm.getName();
3034 
3035  if (algAlias.empty()) {
3036  algAlias = algName;
3037  LogDebug("TriggerMenuParser") << "\n No alias defined for algorithm. Alias set to algorithm name."
3038  << "\n Algorithm name: " << algName << "\n Algorithm alias: " << algAlias
3039  << std::endl;
3040  } else {
3041  //LogDebug("TriggerMenuParser")
3042  LogDebug("TriggerMenuParser") << "\n Alias defined for algorithm."
3043  << "\n Algorithm name: " << algName << "\n Algorithm alias: " << algAlias
3044  << std::endl;
3045  }
3046 
3047  // get the logical expression
3048  const std::string& logExpression = algorithm.getExpressionInCondition();
3049 
3050  LogDebug("TriggerMenuParser") << " Logical expression: " << logExpression
3051  << " Chip number: " << chipNr << std::endl;
3052 
3053  // determine output pin
3054  int outputPin = algorithm.getIndex();
3055 
3056  //LogTrace("TriggerMenuParser")
3057  LogDebug("TriggerMenuParser") << " Output pin: " << outputPin << std::endl;
3058 
3059  // compute the bit number from chip number, output pin and order of the chips
3060  // pin numbering start with 1, bit numbers with 0
3061  int bitNumber = outputPin; // + (m_orderConditionChip[chipNr] -1)*m_pinsOnConditionChip -1;
3062 
3063  //LogTrace("TriggerMenuParser")
3064  LogDebug("TriggerMenuParser") << " Bit number: " << bitNumber << std::endl;
3065 
3066  // create a new algorithm and insert it into algorithm map
3067  GlobalAlgorithm alg(algName, logExpression, bitNumber);
3068  alg.setAlgoChipNumber(static_cast<int>(chipNr));
3069  alg.setAlgoAlias(algAlias);
3070 
3071  if (edm::isDebugEnabled()) {
3072  std::ostringstream myCoutStream;
3073  alg.print(myCoutStream);
3074  LogTrace("TriggerMenuParser") << myCoutStream.str() << "\n" << std::endl;
3075  }
3076 
3077  // insert algorithm into the map
3078  if (!insertAlgorithmIntoMap(alg)) {
3079  return false;
3080  }
3081 
3082  return true;
3083 }
3084 
3085 // static class members
l1t::TriggerMenuParser::l1t2string
std::string l1t2string(T)
Definition: TriggerMenuParser.cc:496
l1t::GlobalScales::ScaleParameters::etaStep
double etaStep
Definition: GlobalScales.h:48
CaloTemplate
Definition: CaloTemplate.h:33
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::precMassCut
unsigned int precMassCut
Definition: CorrelationWithOverlapRemovalTemplate.h:82
CorrelationTemplate::setCond1Category
void setCond1Category(const l1t::GtConditionCategory &)
Definition: CorrelationTemplate.cc:115
l1t::gtHTM
Definition: GlobalObject.h:24
CorrelationTemplate::setCond0Index
void setCond0Index(const int &)
Definition: CorrelationTemplate.cc:118
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
l1t::Type2cor
Definition: GlobalDefinitions.h:53
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::minOverlapRemovalEtaCutValue
long long minOverlapRemovalEtaCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:88
l1t::TypeCent5
Definition: GlobalDefinitions.h:74
GlobalCondition::setCondType
void setCondType(const l1t::GtConditionType &cType)
Definition: GlobalCondition.h:62
l1t::gtCentrality0
Definition: GlobalObject.h:36
CorrelationTemplate::CorrelationParameter::maxEtaCutValue
long long maxEtaCutValue
Definition: CorrelationTemplate.h:63
l1t::gtExternal
Definition: GlobalObject.h:44
HTM
Definition: L1GtObject.h:38
mps_fire.i
i
Definition: mps_fire.py:355
l1t::TriggerMenuParser::setGtPinsOnConditionChip
void setGtPinsOnConditionChip(const unsigned int &)
Definition: TriggerMenuParser.cc:70
l1t::TriggerMenuParser::getExternalSignals
std::map< std::string, unsigned int > getExternalSignals(const L1TUtmTriggerMenu *utmMenu)
Definition: TriggerMenuParser.cc:155
l1t::TriggerMenuParser::parseMuon
bool parseMuon(tmeventsetup::esCondition condMu, unsigned int chipNr=0, const bool corrFlag=false)
parse a muon condition
Definition: TriggerMenuParser.cc:975
l1t::TriggerMenuParser::setGtScaleDbKey
void setGtScaleDbKey(const std::string &)
Definition: TriggerMenuParser.cc:103
MessageLogger.h
l1t::TriggerMenuParser::setVecMuonTemplate
void setVecMuonTemplate(const std::vector< std::vector< MuonTemplate > > &)
Definition: TriggerMenuParser.cc:106
GlobalAlgorithm::setAlgoChipNumber
void setAlgoChipNumber(const int algoChipNumberValue)
Definition: GlobalAlgorithm.h:79
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
GlobalAlgorithm::algoName
const std::string algoName() const
get / set algorithm name
Definition: GlobalAlgorithm.h:52
MuonTemplate::setConditionParameter
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
Definition: MuonTemplate.cc:64
GlobalCondition::setCondRelativeBx
void setCondRelativeBx(const int &cRelativeBx)
Definition: GlobalCondition.h:82
CaloTemplate::setConditionParameter
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
Definition: CaloTemplate.cc:63
l1t::GlobalScales::ScaleParameters::etStep
double etStep
Definition: GlobalScales.h:38
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
l1t::TriggerMenuParser::setGtNumberPhysTriggers
void setGtNumberPhysTriggers(const unsigned int &)
Definition: TriggerMenuParser.cc:81
l1t::TriggerMenuParser::setGtTriggerMenuUUID
void setGtTriggerMenuUUID(const int)
Definition: TriggerMenuParser.cc:94
step
step
Definition: StallMonitor.cc:94
CorrelationTemplate::CorrelationParameter::precPhiCut
unsigned int precPhiCut
Definition: CorrelationTemplate.h:68
l1t::TriggerMenuParser::setGtTriggerMenuInterfaceDate
void setGtTriggerMenuInterfaceDate(const std::string &)
Definition: TriggerMenuParser.cc:354
ETM
Definition: L1GtObject.h:35
EnergySumTemplate::setConditionParameter
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
Definition: EnergySumTemplate.cc:66
l1t::TriggerMenuParser::parseCorrelationWithOverlapRemoval
bool parseCorrelationWithOverlapRemoval(const tmeventsetup::esCondition &corrCond, unsigned int chipNr=0)
parse a correlation condition with overlap removal
Definition: TriggerMenuParser.cc:2736
l1t::GlobalScales::ScaleParameters::phiMax
double phiMax
Definition: GlobalScales.h:42
GlobalAlgorithm::algoAlias
std::string const & algoAlias() const
get / set algorithm alias
Definition: GlobalAlgorithm.h:57
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::maxDRCutValue
long long maxDRCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:76
l1t::TriggerMenuParser::setVecEnergySumTemplate
void setVecEnergySumTemplate(const std::vector< std::vector< EnergySumTemplate > > &)
Definition: TriggerMenuParser.cc:114
l1t::TriggerMenuParser::parseDeltaEta_Cosh_LUTS
void parseDeltaEta_Cosh_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string obj1, std::string obj2, unsigned int prec1, unsigned int prec2)
Definition: TriggerMenuParser.cc:853
l1t::TriggerMenuParser::setCorCaloTemplate
void setCorCaloTemplate(const std::vector< std::vector< CaloTemplate > > &)
Definition: TriggerMenuParser.cc:140
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::precEtaCut
unsigned int precEtaCut
Definition: CorrelationWithOverlapRemovalTemplate.h:69
L1TRate_Offline_cfi.Tau
Tau
Definition: L1TRate_Offline_cfi.py:43
l1t::TypeNull
Definition: GlobalDefinitions.h:49
l1t::TrigFunc_t
TrigFunc_t
Definition: TriggerMenuParser.h:54
l1t::GlobalScales::ScaleParameters::etMin
double etMin
Definition: GlobalScales.h:36
CorrelationTemplate::setCond1Index
void setCond1Index(const int &)
Definition: CorrelationTemplate.cc:120
objects
Definition: __init__.py:1
CorrelationTemplate::CorrelationParameter::minMassCutValue
long long minMassCutValue
Definition: CorrelationTemplate.h:74
l1t::GlobalScales::ScaleParameters::etaMin
double etaMin
Definition: GlobalScales.h:46
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::maxMassCutValue
long long maxMassCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:81
l1t::TypeETM
Definition: GlobalDefinitions.h:56
l1t::gtEG
Definition: GlobalObject.h:18
l1t::Type3s
Definition: GlobalDefinitions.h:54
CorrelationTemplate::CorrelationParameter::precDRCut
unsigned int precDRCut
Definition: CorrelationTemplate.h:72
l1t::TriggerMenuParser::setVecCorrelationTemplate
void setVecCorrelationTemplate(const std::vector< std::vector< CorrelationTemplate > > &)
Definition: TriggerMenuParser.cc:124
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::precDRCut
unsigned int precDRCut
Definition: CorrelationWithOverlapRemovalTemplate.h:78
CorrelationTemplate::CorrelationParameter::precMassCut
unsigned int precMassCut
Definition: CorrelationTemplate.h:76
l1t::gtETTem
Definition: GlobalObject.h:31
l1t::TriggerMenuParser::parseDeltaPhi_Cos_LUTS
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: TriggerMenuParser.cc:888
CorrelationWithOverlapRemovalTemplate::print
void print(std::ostream &myCout) const override
print the condition
Definition: CorrelationWithOverlapRemovalTemplate.cc:152
CaloTemplate::print
void print(std::ostream &myCout) const override
print the condition
Definition: CaloTemplate.cc:69
l1t::gtMinBiasHFP1
Definition: GlobalObject.h:29
l1t::gtMinBiasHFM1
Definition: GlobalObject.h:30
CorrelationTemplate::CorrelationParameter::corrCutType
int corrCutType
Definition: CorrelationTemplate.h:85
HLT_2018_cff.DoubleMuon
DoubleMuon
Definition: HLT_2018_cff.py:3720
l1t::GlobalScales::ScaleParameters::phiMin
double phiMin
Definition: GlobalScales.h:41
mps_check.array
array
Definition: mps_check.py:216
l1t::TypeAsymEtHF
Definition: GlobalDefinitions.h:79
l1t::TriggerMenuParser::parseCondFormats
void parseCondFormats(const L1TUtmTriggerMenu *utmMenu)
Definition: TriggerMenuParser.cc:190
MuonTemplate::print
void print(std::ostream &myCout) const override
print the condition
Definition: MuonTemplate.cc:70
l1t::gtAsymmetryEt
Definition: GlobalObject.h:32
GlobalCondition.h
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::minDRCutValue
long long minDRCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:75
l1t::TypeMinBiasHFP0
Definition: GlobalDefinitions.h:62
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::maxEtaCutValue
long long maxEtaCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:68
l1t::TriggerMenuParser::~TriggerMenuParser
virtual ~TriggerMenuParser()
destructor
Definition: TriggerMenuParser.cc:62
l1t::TriggerMenuParser::setGtTriggerMenuInterfaceDescription
void setGtTriggerMenuInterfaceDescription(const std::string &)
Definition: TriggerMenuParser.cc:360
l1t::TypeCent2
Definition: GlobalDefinitions.h:71
l1t::TriggerMenuParser::setGtTriggerMenuInterface
void setGtTriggerMenuInterface(const std::string &)
Definition: TriggerMenuParser.cc:89
l1t::TypeCent3
Definition: GlobalDefinitions.h:72
CorrelationTemplate::print
void print(std::ostream &myCout) const override
print the condition
Definition: CorrelationTemplate.cc:127
l1t::gtCentrality5
Definition: GlobalObject.h:41
l1t::TypeCent7
Definition: GlobalDefinitions.h:76
l1t::TriggerMenuParser::setVecExternalTemplate
void setVecExternalTemplate(const std::vector< std::vector< ExternalTemplate > > &)
Definition: TriggerMenuParser.cc:119
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::corrCutType
int corrCutType
Definition: CorrelationWithOverlapRemovalTemplate.h:103
l1t::TypeMinBiasHFM1
Definition: GlobalDefinitions.h:65
l1t::gtCentrality7
Definition: GlobalObject.h:43
l1t::TriggerMenuParser::setGtTriggerMenuDescription
void setGtTriggerMenuDescription(const std::string &)
Definition: TriggerMenuParser.cc:368
l1t::gtAsymmetryHt
Definition: GlobalObject.h:33
CorrelationWithOverlapRemovalTemplate::setCond2Category
void setCond2Category(const l1t::GtConditionCategory &)
Definition: CorrelationWithOverlapRemovalTemplate.cc:135
l1t::gtCentrality4
Definition: GlobalObject.h:40
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::minPhiCutValue
long long minPhiCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:71
l1t::gtJet
Definition: GlobalObject.h:19
HLT_2018_cff.DeltaEta
DeltaEta
Definition: HLT_2018_cff.py:454
CorrelationTemplate::CorrelationParameter::minTBPTCutValue
long long minTBPTCutValue
Definition: CorrelationTemplate.h:78
l1t::gtTowerCount
Definition: GlobalObject.h:26
CorrelationTemplate::CorrelationParameter::precTBPTCut
unsigned int precTBPTCut
Definition: CorrelationTemplate.h:80
L1TUtmTriggerMenu
Definition: L1TUtmTriggerMenu.h:25
l1t::Type2corWithOverlapRemoval
Definition: GlobalDefinitions.h:68
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
GlobalObject
cmsdt::algo
algo
Definition: constants.h:164
ExternalTemplate
Definition: ExternalTemplate.h:32
CorrelationWithOverlapRemovalTemplate::setCond0Index
void setCond0Index(const int &)
Definition: CorrelationWithOverlapRemovalTemplate.cc:140
l1t::TriggerMenuParser::parseCaloCorr
bool parseCaloCorr(const tmeventsetup::esObject *corrCalo, unsigned int chipNr=0)
Definition: TriggerMenuParser.cc:1734
CorrelationWithOverlapRemovalTemplate::setCorrelationWithOverlapRemovalParameter
void setCorrelationWithOverlapRemovalParameter(const CorrelationWithOverlapRemovalParameter &corrParameter)
Definition: CorrelationWithOverlapRemovalTemplate.cc:147
l1t::TypeCent1
Definition: GlobalDefinitions.h:70
l1t::CondCalo
Definition: GlobalDefinitions.h:95
l1t::SIN
Definition: TriggerMenuParser.h:54
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::minOverlapRemovalDRCutValue
long long minOverlapRemovalDRCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:96
GlobalAlgorithm
Definition: GlobalAlgorithm.h:32
createPayload.uuid
uuid
Definition: createPayload.py:391
reco::ceil
constexpr int32_t ceil(float num)
Definition: constexpr_cmath.h:7
CorrelationWithOverlapRemovalTemplate::setCond2Index
void setCond2Index(const int &)
Definition: CorrelationWithOverlapRemovalTemplate.cc:144
CorrelationTemplate::CorrelationParameter::maxPhiCutValue
long long maxPhiCutValue
Definition: CorrelationTemplate.h:67
l1t::GtConditionType
GtConditionType
Definition: GlobalDefinitions.h:48
GlobalCondition::setCondChipNr
void setCondChipNr(const int &cChipNr)
Definition: GlobalCondition.h:77
l1t::GlobalScales::ScaleParameters::etaMax
double etaMax
Definition: GlobalScales.h:47
GlobalAlgorithm::algoBitNumber
int algoBitNumber() const
get / set algorithm bit number
Definition: GlobalAlgorithm.h:72
HTT
Definition: L1GtObject.h:37
l1t::TypeAsymEt
Definition: GlobalDefinitions.h:77
HLT_2018_cff.Threshold
Threshold
Definition: HLT_2018_cff.py:10302
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::maxOverlapRemovalDRCutValue
long long maxOverlapRemovalDRCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:97
l1t::gtETMHF
Definition: GlobalObject.h:25
l1t::COS
Definition: TriggerMenuParser.h:54
l1t::TypeHTT
Definition: GlobalDefinitions.h:58
l1t::TriggerMenuParser::parseCalMuPhi_LUTS
void parseCalMuPhi_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string obj1, std::string obj2)
Definition: TriggerMenuParser.cc:804
L1TRate_cfi.Jet
Jet
Definition: L1TRate_cfi.py:43
GetRecoTauVFromDQM_MC_cff.kk
kk
Definition: GetRecoTauVFromDQM_MC_cff.py:84
HLTSiStripMonitoring_cff.Mass
Mass
Definition: HLTSiStripMonitoring_cff.py:135
l1t::TriggerMenuParser::setCorMuonTemplate
void setCorMuonTemplate(const std::vector< std::vector< MuonTemplate > > &)
Definition: TriggerMenuParser.cc:136
l1t::TriggerMenuParser::setVecCaloTemplate
void setVecCaloTemplate(const std::vector< std::vector< CaloTemplate > > &)
Definition: TriggerMenuParser.cc:110
l1t::gtHTT
Definition: GlobalObject.h:23
VtxSmearedParameters_cfi.Phi
Phi
Definition: VtxSmearedParameters_cfi.py:112
HLT_2018_cff.Algorithm
Algorithm
Definition: HLT_2018_cff.py:8159
l1t::TriggerMenuParser::parseScales
bool parseScales(std::map< std::string, tmeventsetup::esScale > scaleMap)
parse scales
Definition: TriggerMenuParser.cc:516
MuonTemplate
Definition: MuonTemplate.h:33
l1t::TypeCent4
Definition: GlobalDefinitions.h:73
l1t::TriggerMenuParser::insertConditionIntoMap
bool insertConditionIntoMap(GlobalCondition &cond, const int chipNr)
Definition: TriggerMenuParser.cc:392
GlobalAlgorithm::algoOutputPin
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
Definition: GlobalAlgorithm.cc:95
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::minOverlapRemovalPhiCutValue
long long minOverlapRemovalPhiCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:92
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
l1t::TriggerMenuParser::l1tstr2int
int l1tstr2int(const std::string data)
Definition: TriggerMenuParser.cc:501
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CorrelationTemplate::CorrelationParameter::chargeCorrelation
unsigned int chargeCorrelation
Definition: CorrelationTemplate.h:83
l1t::TriggerMenuParser::setGtAlgorithmAliasMap
void setGtAlgorithmAliasMap(const AlgorithmMap &)
Definition: TriggerMenuParser.cc:153
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
cond
Definition: plugin.cc:23
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::maxOverlapRemovalEtaCutValue
long long maxOverlapRemovalEtaCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:89
l1t::TriggerMenuParser::setVecCorrelationWithOverlapRemovalTemplate
void setVecCorrelationWithOverlapRemovalTemplate(const std::vector< std::vector< CorrelationWithOverlapRemovalTemplate > > &)
Definition: TriggerMenuParser.cc:129
l1t::gtCentrality1
Definition: GlobalObject.h:37
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
CorrelationWithOverlapRemovalTemplate::setCond0Category
void setCond0Category(const l1t::GtConditionCategory &)
Definition: CorrelationWithOverlapRemovalTemplate.cc:127
l1t::gtETM
Definition: GlobalObject.h:21
electrons_cff.objType
objType
Definition: electrons_cff.py:491
optionsL1T.menu
menu
Definition: optionsL1T.py:29
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
MessageDrop.h
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::maxOverlapRemovalPhiCutValue
long long maxOverlapRemovalPhiCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:93
edm::LogError
Definition: MessageLogger.h:183
l1t::TriggerMenuParser::parseEnergySum
bool parseEnergySum(tmeventsetup::esCondition condEnergySums, unsigned int chipNr=0, const bool corrFlag=false)
parse an "energy sum" condition
Definition: TriggerMenuParser.cc:1961
EnergySumTemplate::print
void print(std::ostream &myCout) const override
print the condition
Definition: EnergySumTemplate.cc:70
l1t::TriggerMenuParser::TriggerMenuParser
TriggerMenuParser()
Definition: TriggerMenuParser.cc:49
l1t::TriggerMenuParser::setGtTriggerMenuDate
void setGtTriggerMenuDate(const std::string &)
Definition: TriggerMenuParser.cc:364
l1t::gtMu
Definition: GlobalObject.h:17
l1t::GlobalScales::ScaleParameters::etaBins
std::vector< std::pair< double, double > > etaBins
Definition: GlobalScales.h:49
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::precOverlapRemovalEtaCut
unsigned int precOverlapRemovalEtaCut
Definition: CorrelationWithOverlapRemovalTemplate.h:90
l1t::TriggerMenuParser::setCorEnergySumTemplate
void setCorEnergySumTemplate(const std::vector< std::vector< EnergySumTemplate > > &)
Definition: TriggerMenuParser.cc:144
l1t::Type1s
Definition: GlobalDefinitions.h:50
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
CorrelationTemplate::CorrelationParameter::maxTBPTCutValue
long long maxTBPTCutValue
Definition: CorrelationTemplate.h:79
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter
typedef for correlation parameters
Definition: CorrelationWithOverlapRemovalTemplate.h:65
EnergySumTemplate
Definition: EnergySumTemplate.h:32
l1t::gtAsymmetryEtHF
Definition: GlobalObject.h:34
CorrelationTemplate::CorrelationParameter::minPhiCutValue
long long minPhiCutValue
Definition: CorrelationTemplate.h:66
l1t::gtCentrality6
Definition: GlobalObject.h:42
l1t::TriggerMenuParser::setGtAlgorithmMap
void setGtAlgorithmMap(const AlgorithmMap &)
Definition: TriggerMenuParser.cc:150
CorrelationTemplate::CorrelationParameter::minDRCutValue
long long minDRCutValue
Definition: CorrelationTemplate.h:70
qcdUeDQM_cfi.algorithm
algorithm
Definition: qcdUeDQM_cfi.py:32
l1t::gtMinBiasHFP0
Definition: GlobalObject.h:27
l1t::TypeMinBiasHFP1
Definition: GlobalDefinitions.h:64
createfilelist.int
int
Definition: createfilelist.py:10
dumpRecoGeometry_cfg.Muon
Muon
Definition: dumpRecoGeometry_cfg.py:190
l1t::AlgorithmMap
std::map< std::string, GlobalAlgorithm > AlgorithmMap
map containing the algorithms
Definition: TriggerMenuFwd.h:32
l1t::GlobalScales::ScaleParameters
typedef for a single object template
Definition: GlobalScales.h:35
l1t::TriggerMenuParser::setGtConditionMap
void setGtConditionMap(const std::vector< ConditionMap > &)
Definition: TriggerMenuParser.cc:86
l1t::TypeTowerCount
Definition: GlobalDefinitions.h:61
HLT_2018_cff.SingleMuon
SingleMuon
Definition: HLT_2018_cff.py:4919
l1t::TriggerMenuParser::setGtTriggerMenuAuthor
void setGtTriggerMenuAuthor(const std::string &)
Definition: TriggerMenuParser.cc:366
ETT
Definition: L1GtObject.h:36
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::maxPhiCutValue
long long maxPhiCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:72
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
CorrelationTemplate
Definition: CorrelationTemplate.h:34
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
l1t::CondEnergySum
Definition: GlobalDefinitions.h:96
CorrelationWithOverlapRemovalTemplate::setCond1Category
void setCond1Category(const l1t::GtConditionCategory &)
Definition: CorrelationWithOverlapRemovalTemplate.cc:131
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
l1t::TriggerMenuParser::setGtAlgorithmImplementation
void setGtAlgorithmImplementation(const std::string &)
Definition: TriggerMenuParser.cc:370
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::precPhiCut
unsigned int precPhiCut
Definition: CorrelationWithOverlapRemovalTemplate.h:73
l1t::GlobalScales::ScaleParameters::phiStep
double phiStep
Definition: GlobalScales.h:43
MuonTemplate::CorrelationParameter::chargeCorrelation
unsigned int chargeCorrelation
Definition: MuonTemplate.h:86
CorrelationWithOverlapRemovalTemplate::setCond1Index
void setCond1Index(const int &)
Definition: CorrelationWithOverlapRemovalTemplate.cc:142
l1t::gtETT
Definition: GlobalObject.h:22
goodZToMuMu_cfi.condition
condition
Definition: goodZToMuMu_cfi.py:37
l1t::TypeETMHF
Definition: GlobalDefinitions.h:60
l1t::TypeAsymHt
Definition: GlobalDefinitions.h:78
l1t::TriggerMenuParser::setGtTriggerMenuName
void setGtTriggerMenuName(const std::string &)
Definition: TriggerMenuParser.cc:96
l1t::gtCentrality3
Definition: GlobalObject.h:39
l1t::TriggerMenuParser::setGtTriggerMenuInterfaceAuthor
void setGtTriggerMenuInterfaceAuthor(const std::string &)
Definition: TriggerMenuParser.cc:356
l1t::TypeETTem
Definition: GlobalDefinitions.h:66
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::minMassCutValue
long long minMassCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:80
l1t::CItAlgo
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
Definition: TriggerMenuFwd.h:39
HLT_2018_cff.DeltaPhi
DeltaPhi
Definition: HLT_2018_cff.py:465
l1t::Type2s
Definition: GlobalDefinitions.h:51
type
type
Definition: HCALResponse.h:21
heppy_batch.val
val
Definition: heppy_batch.py:351
l1t::GlobalScales::ScaleParameters::etBins
std::vector< std::pair< double, double > > etBins
Definition: GlobalScales.h:39
l1t::TypeETT
Definition: GlobalDefinitions.h:57
GlobalAlgorithm::setAlgoAlias
void setAlgoAlias(const std::string &algoAliasValue)
Definition: GlobalAlgorithm.h:59
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::minEtaCutValue
long long minEtaCutValue
Definition: CorrelationWithOverlapRemovalTemplate.h:67
TriggerMenuParser.h
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::precOverlapRemovalPhiCut
unsigned int precOverlapRemovalPhiCut
Definition: CorrelationWithOverlapRemovalTemplate.h:94
l1t::TriggerMenuParser::parsePt_LUTS
void parsePt_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string lutpfx, std::string obj1, unsigned int prec)
Definition: TriggerMenuParser.cc:831
l1t::TypeHTM
Definition: GlobalDefinitions.h:59
CorrelationTemplate::CorrelationParameter::maxDRCutValue
long long maxDRCutValue
Definition: CorrelationTemplate.h:71
GlobalAlgorithm::print
virtual void print(std::ostream &myCout) const
print condition
Definition: GlobalAlgorithm.cc:106
l1t::TriggerMenuParser::setGtOrderConditionChip
void setGtOrderConditionChip(const std::vector< int > &)
Definition: TriggerMenuParser.cc:76
T
long double T
Definition: Basic3DVectorLD.h:48
l1t::TriggerMenuParser::insertAlgorithmIntoMap
bool insertAlgorithmIntoMap(const GlobalAlgorithm &alg)
insert an algorithm into algorithm map
Definition: TriggerMenuParser.cc:410
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::precOverlapRemovalDRCut
unsigned int precOverlapRemovalDRCut
Definition: CorrelationWithOverlapRemovalTemplate.h:98
l1t::gtTau
Definition: GlobalObject.h:20
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
l1t::TypeExternal
Definition: GlobalDefinitions.h:67
l1t::TriggerMenuParser::setGtNumberConditionChips
void setGtNumberConditionChips(const unsigned int &)
Definition: TriggerMenuParser.cc:65
CorrelationTemplate::setCond0Category
void setCond0Category(const l1t::GtConditionCategory &)
Definition: CorrelationTemplate.cc:113
GlobalCondition::setObjectType
void setObjectType(const std::vector< l1t::GlobalObject > &objType)
Definition: GlobalCondition.h:67
PixelTestBeamValidation_cfi.Charge
Charge
Definition: PixelTestBeamValidation_cfi.py:78
l1t::TriggerMenuParser::parseCalMuEta_LUTS
void parseCalMuEta_LUTS(std::map< std::string, tmeventsetup::esScale > scaleMap, std::string obj1, std::string obj2)
Definition: TriggerMenuParser.cc:777
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CaloTemplate::CorrelationParameter
typedef for correlation parameters
Definition: CaloTemplate.h:78
l1t::TypeCent6
Definition: GlobalDefinitions.h:75
l1t::CondMuon
Definition: GlobalDefinitions.h:94
CorrelationTemplate::CorrelationParameter::precEtaCut
unsigned int precEtaCut
Definition: CorrelationTemplate.h:64
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
l1t::gtMinBiasHFM0
Definition: GlobalObject.h:28
l1t::TypeAsymHtHF
Definition: GlobalDefinitions.h:80
l1t::TriggerMenuParser::parseCalo
bool parseCalo(tmeventsetup::esCondition condCalo, unsigned int chipNr=0, const bool corrFlag=false)
parse a calorimeter condition
Definition: TriggerMenuParser.cc:1438
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:71
l1t::Type4s
Definition: GlobalDefinitions.h:55
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
MuonTemplate::CorrelationParameter
Definition: MuonTemplate.h:85
l1t::GlobalScales::ScaleParameters::phiBins
std::vector< std::pair< double, double > > phiBins
Definition: GlobalScales.h:44
L1TBPTX_cfi.bitNumber
bitNumber
Definition: L1TBPTX_cfi.py:26
l1t::TypeMinBiasHFM0
Definition: GlobalDefinitions.h:63
CorrelationTemplate::CorrelationParameter::minEtaCutValue
long long minEtaCutValue
Definition: CorrelationTemplate.h:62
ExternalTemplate::setExternalChannel
void setExternalChannel(unsigned int extCh)
set functions
Definition: ExternalTemplate.h:58
l1t::TriggerMenuParser::parseEnergySumCorr
bool parseEnergySumCorr(const tmeventsetup::esObject *corrESum, unsigned int chipNr=0)
Definition: TriggerMenuParser.cc:2199
L1TMuonDQMOffline_cfi.cuts
cuts
Definition: L1TMuonDQMOffline_cfi.py:41
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
GlobalCondition
Definition: GlobalCondition.h:33
GlobalAlgorithm::algoChipNumber
const int algoChipNumber() const
get / set algorithm bit number
Definition: GlobalAlgorithm.h:77
CorrelationWithOverlapRemovalTemplate
Definition: CorrelationWithOverlapRemovalTemplate.h:34
l1t::TypeCent0
Definition: GlobalDefinitions.h:69
l1t::TriggerMenuParser::parseMuonCorr
bool parseMuonCorr(const tmeventsetup::esObject *condMu, unsigned int chipNr=0)
Definition: TriggerMenuParser.cc:1220
CorrelationTemplate::setCorrelationParameter
void setCorrelationParameter(const CorrelationParameter &corrParameter)
Definition: CorrelationTemplate.cc:123
l1t::TriggerMenuParser::setGtTriggerMenuImplementation
void setGtTriggerMenuImplementation(const unsigned long &)
Definition: TriggerMenuParser.cc:98
CorrelationTemplate::CorrelationParameter::maxMassCutValue
long long maxMassCutValue
Definition: CorrelationTemplate.h:75
l1t::gtCentrality2
Definition: GlobalObject.h:38
l1t::TriggerMenuParser::parseExternal
bool parseExternal(tmeventsetup::esCondition condExt, unsigned int chipNr=0)
Definition: TriggerMenuParser.cc:2370
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
l1t::TriggerMenuParser::parsePhi_Trig_LUTS
void parsePhi_Trig_LUTS(const std::map< std::string, tmeventsetup::esScale > &scaleMap, const std::string &obj, TrigFunc_t func, unsigned int prec)
Definition: TriggerMenuParser.cc:923
cuy.ii
ii
Definition: cuy.py:590
l1t::GlobalScales::ScaleParameters::etMax
double etMax
Definition: GlobalScales.h:37
CorrelationWithOverlapRemovalTemplate::CorrelationWithOverlapRemovalParameter::chargeCorrelation
unsigned int chargeCorrelation
Definition: CorrelationWithOverlapRemovalTemplate.h:101
GlobalCondition::setCondGEq
void setCondGEq(const bool &cGEq)
Definition: GlobalCondition.h:72
l1t::gtAsymmetryHtHF
Definition: GlobalObject.h:35
l1t::TriggerMenuParser::parseCorrelation
bool parseCorrelation(tmeventsetup::esCondition corrCond, unsigned int chipNr=0)
parse a correlation condition
Definition: TriggerMenuParser.cc:2445
CorrelationTemplate::CorrelationParameter
typedef for correlation parameters
Definition: CorrelationTemplate.h:60
l1t::TriggerMenuParser::parseAlgorithm
bool parseAlgorithm(tmeventsetup::esAlgorithm algorithm, unsigned int chipNr=0)
parse all algorithms
Definition: TriggerMenuParser.cc:3027
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
ecaldqm::Quality
Quality
Definition: DBWriterWorkers.cc:55
l1t::TriggerMenuParser::clearMaps
void clearMaps()
Definition: TriggerMenuParser.cc:376
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316