28 #include <boost/cstdint.hpp>
35 #include "tmEventSetup/tmEventSetup.hh"
36 #include "tmEventSetup/esTriggerMenu.hh"
37 #include "tmEventSetup/esAlgorithm.hh"
38 #include "tmEventSetup/esCondition.hh"
39 #include "tmEventSetup/esObject.hh"
40 #include "tmEventSetup/esCut.hh"
41 #include "tmEventSetup/esScale.hh"
42 #include "tmGrammar/Algorithm.hh"
48 m_triggerMenuInterface(
"NULL"),
49 m_triggerMenuName(
"NULL"), m_triggerMenuImplementation(0x0), m_scaleDbKey(
"NULL")
68 const unsigned int& numberConditionChipsValue) {
70 m_numberConditionChips = numberConditionChipsValue;
77 m_pinsOnConditionChip = pinsOnConditionChipValue;
84 const std::vector<int>& orderConditionChipValue) {
86 m_orderConditionChip = orderConditionChipValue;
92 const unsigned int& numberPhysTriggersValue) {
94 m_numberPhysTriggers = numberPhysTriggersValue;
101 m_conditionMap = condMap;
106 m_triggerMenuInterface = menuInterface;
111 m_triggerMenuUUID =
uuid;
115 m_triggerMenuName = menuName;
119 m_triggerMenuImplementation = menuImplementation;
124 m_scaleDbKey = scaleKey;
129 const std::vector<std::vector<MuonTemplate> >& vecMuonTempl) {
131 m_vecMuonTemplate = vecMuonTempl;
135 const std::vector<std::vector<CaloTemplate> >& vecCaloTempl) {
137 m_vecCaloTemplate = vecCaloTempl;
141 const std::vector<std::vector<EnergySumTemplate> >& vecEnergySumTempl) {
143 m_vecEnergySumTemplate = vecEnergySumTempl;
149 const std::vector<std::vector<ExternalTemplate> >& vecExternalTempl) {
151 m_vecExternalTemplate = vecExternalTempl;
156 const std::vector<std::vector<CorrelationTemplate> >& vecCorrelationTempl) {
158 m_vecCorrelationTemplate = vecCorrelationTempl;
164 const std::vector<std::vector<MuonTemplate> >& corMuonTempl) {
166 m_corMuonTemplate = corMuonTempl;
170 const std::vector<std::vector<CaloTemplate> >& corCaloTempl) {
172 m_corCaloTemplate = corCaloTempl;
176 const std::vector<std::vector<EnergySumTemplate> >& corEnergySumTempl) {
178 m_corEnergySumTemplate = corEnergySumTempl;
186 m_algorithmMap = algoMap;
191 m_algorithmAliasMap = algoMap;
198 using namespace tmeventsetup;
199 const esTriggerMenu*
menu =
reinterpret_cast<const esTriggerMenu*
> (utmMenu);
200 const std::map<std::string, esCondition>& condMap =
menu->getConditionMap();
202 std::map<std::string, unsigned int> extBitMap;
205 for (std::map<std::string, esCondition>::const_iterator cit = condMap.begin();
206 cit != condMap.end(); cit++)
208 const esCondition& condition = cit->second;
209 if(condition.getType() == esConditionType::Externals ) {
212 const std::vector<esObject>& objects = condition.getObjects();
213 for (
size_t jj = 0;
jj < objects.size();
jj++) {
215 const esObject
object = objects.at(
jj);
216 if(
object.getType() == esObjectType::EXT) {
218 unsigned int channelID =
object.getExternalChannelId();
244 m_conditionMap.resize(m_numberConditionChips);
246 m_vecMuonTemplate.resize(m_numberConditionChips);
247 m_vecCaloTemplate.resize(m_numberConditionChips);
248 m_vecEnergySumTemplate.resize(m_numberConditionChips);
249 m_vecExternalTemplate.resize(m_numberConditionChips);
251 m_vecCorrelationTemplate.resize(m_numberConditionChips);
252 m_corMuonTemplate.resize(m_numberConditionChips);
253 m_corCaloTemplate.resize(m_numberConditionChips);
254 m_corEnergySumTemplate.resize(m_numberConditionChips);
256 using namespace tmeventsetup;
257 using namespace Algorithm;
259 const esTriggerMenu*
menu =
reinterpret_cast<const esTriggerMenu*
> (utmMenu);
262 m_triggerMenuDescription =
menu->getComment();
263 m_triggerMenuDate =
menu->getDatetime();
264 m_triggerMenuImplementation = ( getMmHashN(
menu->getFirmwareUuid()) & 0xFFFFFFFF);
265 m_triggerMenuName =
menu->getName();
266 m_triggerMenuInterface =
menu->getVersion();
267 m_triggerMenuUUID = ( getMmHashN(
menu->getName()) & 0xFFFFFFFF);
269 const std::map<std::string, esAlgorithm>& algoMap =
menu->getAlgorithmMap();
270 const std::map<std::string, esCondition>& condMap =
menu->getConditionMap();
271 const std::map<std::string, esScale>& scaleMap =
menu->getScaleMap();
274 m_gtScales.setScalesName(
menu->getScaleSetName() );
275 parseScales(scaleMap);
279 for (std::map<std::string, esAlgorithm>::const_iterator cit = algoMap.begin();
280 cit != algoMap.end(); cit++)
286 const esAlgorithm&
algo = cit->second;
289 parseAlgorithm(algo,chipNr);
292 const std::vector<std::string>& rpn_vec = algo.getRpnVector();
293 for (
size_t ii = 0;
ii < rpn_vec.size();
ii++)
296 if (isGate(token))
continue;
298 const esCondition& condition = condMap.find(token)->second;
302 if ((m_conditionMap[chipNr]).
count(condition.getName()) == 0) {
305 if(condition.getType() == esConditionType::SingleEgamma ||
306 condition.getType() == esConditionType::DoubleEgamma ||
307 condition.getType() == esConditionType::TripleEgamma ||
308 condition.getType() == esConditionType::QuadEgamma ||
309 condition.getType() == esConditionType::SingleTau ||
310 condition.getType() == esConditionType::DoubleTau ||
311 condition.getType() == esConditionType::TripleTau ||
312 condition.getType() == esConditionType::QuadTau ||
313 condition.getType() == esConditionType::SingleJet ||
314 condition.getType() == esConditionType::DoubleJet ||
315 condition.getType() == esConditionType::TripleJet ||
316 condition.getType() == esConditionType::QuadJet )
318 parseCalo(condition,chipNr,
false);
321 }
else if(condition.getType() == esConditionType::TotalEt ||
322 condition.getType() == esConditionType::TotalEtEM ||
323 condition.getType() == esConditionType::TotalHt ||
324 condition.getType() == esConditionType::MissingEt ||
325 condition.getType() == esConditionType::MissingHt ||
326 condition.getType() == esConditionType::MissingEtHF ||
327 condition.getType() == esConditionType::TowerCount ||
328 condition.getType() == esConditionType::MinBiasHFP0 ||
329 condition.getType() == esConditionType::MinBiasHFM0 ||
330 condition.getType() == esConditionType::MinBiasHFP1 ||
331 condition.getType() == esConditionType::MinBiasHFM1 )
333 parseEnergySum(condition,chipNr,
false);
338 condition.getType() == esConditionType::TripleMuon ||
339 condition.getType() == esConditionType::QuadMuon )
341 parseMuon(condition,chipNr,
false);
345 }
else if(condition.getType() == esConditionType::MuonMuonCorrelation ||
346 condition.getType() == esConditionType::MuonEsumCorrelation ||
347 condition.getType() == esConditionType::CaloMuonCorrelation ||
348 condition.getType() == esConditionType::CaloCaloCorrelation ||
349 condition.getType() == esConditionType::CaloEsumCorrelation ||
352 parseCorrelation(condition,chipNr);
355 }
else if(condition.getType() == esConditionType::Externals )
357 parseExternal(condition,chipNr);
376 m_triggerMenuInterfaceDate = val;
382 m_triggerMenuInterfaceAuthor = val;
388 m_triggerMenuInterfaceDescription = val;
395 m_triggerMenuDate = val;
401 m_triggerMenuAuthor = val;
407 m_triggerMenuDescription = val;
413 m_algorithmImplementation = val;
427 for (std::vector<ConditionMap>::iterator itCondOnChip = m_conditionMap.begin(); itCondOnChip
428 != m_conditionMap.end(); itCondOnChip++) {
432 itCondOnChip->clear();
437 m_algorithmMap.clear();
447 <<
" Trying to insert condition \"" << cName <<
"\" in the condition map." ;
450 if ((m_conditionMap[chipNr]).
count(cName) != 0) {
451 LogTrace(
"TriggerMenuParser") <<
" Condition " << cName
452 <<
" already exists - not inserted!" << std::endl;
456 (m_conditionMap[chipNr])[cName] = &cond;
458 <<
" OK - condition inserted!"
475 if (m_algorithmMap.count(algName) != 0) {
476 LogTrace(
"TriggerMenuParser") <<
" Algorithm \"" << algName
477 <<
"\"already exists in the algorithm map- not inserted!" << std::endl;
481 if (m_algorithmAliasMap.count(algAlias) != 0) {
482 LogTrace(
"TriggerMenuParser") <<
" Algorithm alias \"" << algAlias
483 <<
"\"already exists in the algorithm alias map- not inserted!" << std::endl;
489 if ((bitNumber < 0) || (bitNumber >= static_cast<int>(m_numberPhysTriggers))) {
490 LogTrace(
"TriggerMenuParser") <<
" Bit number " << bitNumber
491 <<
" outside allowed range [0, " << m_numberPhysTriggers
492 <<
") - algorithm not inserted!" << std::endl;
497 if (m_algorithmMap.size() >= m_numberPhysTriggers) {
498 LogTrace(
"TriggerMenuParser") <<
" More than maximum allowed "
499 << m_numberPhysTriggers <<
" algorithms in the algorithm map - not inserted!"
506 int chipNr = alg.
algoChipNumber(static_cast<int>(m_numberConditionChips),
507 static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
509 if ((chipNr < 0) || (chipNr > static_cast<int>(m_numberConditionChips))) {
510 LogTrace(
"TriggerMenuParser") <<
" Chip number " << chipNr
511 <<
" outside allowed range [0, " << m_numberConditionChips
512 <<
") - algorithm not inserted!" << std::endl;
517 int outputPin = alg.
algoOutputPin(static_cast<int>(m_numberConditionChips),
518 static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
520 if ((outputPin < 0) || (outputPin > static_cast<int>(m_pinsOnConditionChip))) {
521 LogTrace(
"TriggerMenuParser") <<
" Output pin " << outputPin
522 <<
" outside allowed range [0, " << m_pinsOnConditionChip
523 <<
"] - algorithm not inserted!" << std::endl;
528 for (
CItAlgo itAlgo = m_algorithmMap.begin(); itAlgo != m_algorithmMap.end(); itAlgo++) {
530 int iPin = (itAlgo->second).algoOutputPin( static_cast<int>(m_numberConditionChips),
531 static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
533 int iChip = (itAlgo->second).algoChipNumber(static_cast<int>(m_numberConditionChips),
534 static_cast<int>(m_pinsOnConditionChip), m_orderConditionChip);
536 if ( (outputPin == iPin) && (chipNr == iChip)) {
537 LogTrace(
"TriggerMenuParser") <<
" Output pin " << outputPin
538 <<
" is the same as for algorithm " << iName
539 <<
"\n from the same chip number " << chipNr <<
" - algorithm not inserted!"
547 m_algorithmMap[algName] = alg;
548 m_algorithmAliasMap[algAlias] = alg;
560 std::stringstream
ss;
565 std::stringstream
ss;
582 using namespace tmeventsetup;
598 for (std::map<std::string, esScale>::const_iterator cit = scaleMap.begin();
599 cit != scaleMap.end(); cit++)
601 const esScale&
scale = cit->second;
605 else if (scale.getObjectType() == esObjectType::Egamma) scaleParam = &egScales;
609 else if (scale.getObjectType() == esObjectType::ETTEM) scaleParam = &ettEmScales;
611 else if (scale.getObjectType() == esObjectType::ETMHF) scaleParam = &etmHfScales;
616 if(scaleParam != 0) {
617 switch(scale.getScaleType()) {
618 case esScaleType::EtScale: {
619 scaleParam->
etMin = scale.getMinimum();
620 scaleParam->
etMax = scale.getMaximum();
621 scaleParam->
etStep = scale.getStep();
624 const std::vector<esBin> binsV = scale.getBins();
625 for(
unsigned int i=0;
i<binsV.size();
i++) {
626 const esBin&
bin = binsV.at(
i);
627 std::pair<double, double> binLimits(bin.minimum, bin.maximum);
628 scaleParam->
etBins.push_back(binLimits);
635 scale.getObjectType() == esObjectType::ETTEM || scale.getObjectType() == esObjectType::ETMHF) {
649 case esScaleType::EtaScale: {
650 scaleParam->
etaMin = scale.getMinimum();
651 scaleParam->
etaMax = scale.getMaximum();
652 scaleParam->
etaStep = scale.getStep();
655 const std::vector<esBin> binsV = scale.getBins();
656 scaleParam->
etaBins.resize(
pow(2,scale.getNbits()));
657 for(
unsigned int i=0;
i<binsV.size();
i++) {
658 const esBin&
bin = binsV.at(
i);
659 std::pair<double, double> binLimits(bin.minimum, bin.maximum);
660 scaleParam->
etaBins.at(bin.hw_index) = binLimits;
664 case esScaleType::PhiScale: {
665 scaleParam->
phiMin = scale.getMinimum();
666 scaleParam->
phiMax = scale.getMaximum();
667 scaleParam->
phiStep = scale.getStep();
670 const std::vector<esBin> binsV = scale.getBins();
671 scaleParam->
phiBins.resize(
pow(2,scale.getNbits()));
672 for(
unsigned int i=0;
i<binsV.size();
i++) {
673 const esBin&
bin = binsV.at(
i);
674 std::pair<double, double> binLimits(bin.minimum, bin.maximum);
675 scaleParam->
phiBins.at(bin.hw_index) = binLimits;
687 m_gtScales.setMuonScales(muScales);
688 m_gtScales.setEGScales(egScales);
689 m_gtScales.setTauScales(tauScales);
690 m_gtScales.setJetScales(jetScales);
691 m_gtScales.setETTScales(ettScales);
692 m_gtScales.setETTEmScales(ettEmScales);
693 m_gtScales.setETMScales(etmScales);
694 m_gtScales.setETMHfScales(etmHfScales);
695 m_gtScales.setHTTScales(httScales);
696 m_gtScales.setHTMScales(htmScales);
701 bool hasPrecision =
false;
702 std::map<std::string, unsigned int> precisions;
703 getPrecisions(precisions, scaleMap);
704 for (std::map<std::string, unsigned int>::const_iterator cit = precisions.begin(); cit != precisions.end(); cit++)
716 parseCalMuEta_LUTS(scaleMap,
"EG",
"MU");
717 parseCalMuEta_LUTS(scaleMap,
"JET",
"MU");
718 parseCalMuEta_LUTS(scaleMap,
"TAU",
"MU");
722 parseCalMuPhi_LUTS(scaleMap,
"EG",
"MU");
723 parseCalMuPhi_LUTS(scaleMap,
"JET",
"MU");
724 parseCalMuPhi_LUTS(scaleMap,
"TAU",
"MU");
725 parseCalMuPhi_LUTS(scaleMap,
"HTM",
"MU");
726 parseCalMuPhi_LUTS(scaleMap,
"ETM",
"MU");
727 parseCalMuPhi_LUTS(scaleMap,
"ETMHF",
"MU");
731 parsePt_LUTS(scaleMap,
"EG", precisions[
"PRECISION-EG-MU-MassPt"] );
732 parsePt_LUTS(scaleMap,
"MU", precisions[
"PRECISION-EG-MU-MassPt"] );
733 parsePt_LUTS(scaleMap,
"JET", precisions[
"PRECISION-EG-JET-MassPt"] );
734 parsePt_LUTS(scaleMap,
"TAU", precisions[
"PRECISION-EG-TAU-MassPt"] );
738 parseDeltaEta_Cosh_LUTS(scaleMap,
"EG",
"EG", precisions[
"PRECISION-EG-EG-Delta"], precisions[
"PRECISION-EG-EG-Math"]);
739 parseDeltaEta_Cosh_LUTS(scaleMap,
"EG",
"JET",precisions[
"PRECISION-EG-JET-Delta"],precisions[
"PRECISION-EG-JET-Math"]);
740 parseDeltaEta_Cosh_LUTS(scaleMap,
"EG",
"TAU",precisions[
"PRECISION-EG-TAU-Delta"],precisions[
"PRECISION-EG-TAU-Math"]);
741 parseDeltaEta_Cosh_LUTS(scaleMap,
"EG",
"MU", precisions[
"PRECISION-EG-MU-Delta"], precisions[
"PRECISION-EG-MU-Math"]);
743 parseDeltaEta_Cosh_LUTS(scaleMap,
"JET",
"JET",precisions[
"PRECISION-JET-JET-Delta"],precisions[
"PRECISION-JET-JET-Math"]);
744 parseDeltaEta_Cosh_LUTS(scaleMap,
"JET",
"TAU",precisions[
"PRECISION-JET-TAU-Delta"],precisions[
"PRECISION-JET-TAU-Math"]);
745 parseDeltaEta_Cosh_LUTS(scaleMap,
"JET",
"MU", precisions[
"PRECISION-JET-MU-Delta"], precisions[
"PRECISION-JET-MU-Math"]);
747 parseDeltaEta_Cosh_LUTS(scaleMap,
"TAU",
"TAU",precisions[
"PRECISION-TAU-TAU-Delta"],precisions[
"PRECISION-TAU-TAU-Math"]);
748 parseDeltaEta_Cosh_LUTS(scaleMap,
"TAU",
"MU", precisions[
"PRECISION-TAU-MU-Delta"], precisions[
"PRECISION-TAU-MU-Math"]);
750 parseDeltaEta_Cosh_LUTS(scaleMap,
"MU",
"MU", precisions[
"PRECISION-MU-MU-Delta"], precisions[
"PRECISION-MU-MU-Math"]);
755 parseDeltaPhi_Cos_LUTS(scaleMap,
"EG",
"EG", precisions[
"PRECISION-EG-EG-Delta"], precisions[
"PRECISION-EG-EG-Math"]);
756 parseDeltaPhi_Cos_LUTS(scaleMap,
"EG",
"JET",precisions[
"PRECISION-EG-JET-Delta"],precisions[
"PRECISION-EG-JET-Math"]);
757 parseDeltaPhi_Cos_LUTS(scaleMap,
"EG",
"TAU",precisions[
"PRECISION-EG-TAU-Delta"],precisions[
"PRECISION-EG-TAU-Math"]);
758 parseDeltaPhi_Cos_LUTS(scaleMap,
"EG",
"ETM",precisions[
"PRECISION-EG-ETM-Delta"],precisions[
"PRECISION-EG-ETM-Math"]);
759 parseDeltaPhi_Cos_LUTS(scaleMap,
"EG",
"ETMHF",precisions[
"PRECISION-EG-ETMHF-Delta"],precisions[
"PRECISION-EG-ETMHF-Math"]);
760 parseDeltaPhi_Cos_LUTS(scaleMap,
"EG",
"HTM",precisions[
"PRECISION-EG-HTM-Delta"],precisions[
"PRECISION-EG-HTM-Math"]);
761 parseDeltaPhi_Cos_LUTS(scaleMap,
"EG",
"MU", precisions[
"PRECISION-EG-MU-Delta"], precisions[
"PRECISION-EG-MU-Math"]);
763 parseDeltaPhi_Cos_LUTS(scaleMap,
"JET",
"JET",precisions[
"PRECISION-JET-JET-Delta"],precisions[
"PRECISION-JET-JET-Math"]);
764 parseDeltaPhi_Cos_LUTS(scaleMap,
"JET",
"TAU",precisions[
"PRECISION-JET-TAU-Delta"],precisions[
"PRECISION-JET-TAU-Math"]);
765 parseDeltaPhi_Cos_LUTS(scaleMap,
"JET",
"ETM",precisions[
"PRECISION-JET-ETM-Delta"],precisions[
"PRECISION-JET-ETM-Math"]);
766 parseDeltaPhi_Cos_LUTS(scaleMap,
"JET",
"ETMHF",precisions[
"PRECISION-JET-ETMHF-Delta"],precisions[
"PRECISION-JET-ETMHF-Math"]);
767 parseDeltaPhi_Cos_LUTS(scaleMap,
"JET",
"HTM",precisions[
"PRECISION-JET-HTM-Delta"],precisions[
"PRECISION-JET-HTM-Math"]);
768 parseDeltaPhi_Cos_LUTS(scaleMap,
"JET",
"MU", precisions[
"PRECISION-JET-MU-Delta"], precisions[
"PRECISION-JET-MU-Math"]);
770 parseDeltaPhi_Cos_LUTS(scaleMap,
"TAU",
"TAU",precisions[
"PRECISION-TAU-TAU-Delta"],precisions[
"PRECISION-TAU-TAU-Math"]);
771 parseDeltaPhi_Cos_LUTS(scaleMap,
"TAU",
"ETM",precisions[
"PRECISION-TAU-ETM-Delta"],precisions[
"PRECISION-TAU-ETM-Math"]);
772 parseDeltaPhi_Cos_LUTS(scaleMap,
"TAU",
"ETMHF",precisions[
"PRECISION-TAU-ETMHF-Delta"],precisions[
"PRECISION-TAU-ETMHF-Math"]);
773 parseDeltaPhi_Cos_LUTS(scaleMap,
"TAU",
"HTM",precisions[
"PRECISION-TAU-HTM-Delta"],precisions[
"PRECISION-TAU-HTM-Math"]);
774 parseDeltaPhi_Cos_LUTS(scaleMap,
"TAU",
"MU", precisions[
"PRECISION-TAU-MU-Delta"], precisions[
"PRECISION-TAU-MU-Math"]);
776 parseDeltaPhi_Cos_LUTS(scaleMap,
"MU",
"ETM",precisions[
"PRECISION-MU-ETM-Delta"],precisions[
"PRECISION-MU-ETM-Math"]);
777 parseDeltaPhi_Cos_LUTS(scaleMap,
"MU",
"ETMHF",precisions[
"PRECISION-MU-ETMHF-Delta"],precisions[
"PRECISION-MU-ETMHF-Math"]);
778 parseDeltaPhi_Cos_LUTS(scaleMap,
"MU",
"HTM",precisions[
"PRECISION-MU-HTM-Delta"],precisions[
"PRECISION-MU-HTM-Math"]);
779 parseDeltaPhi_Cos_LUTS(scaleMap,
"MU",
"MU", precisions[
"PRECISION-MU-MU-Delta"], precisions[
"PRECISION-MU-MU-Math"]);
796 using namespace tmeventsetup;
805 if( scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
return;
807 const esScale* scale1 = &scaleMap.find(scLabel1)->second;
808 const esScale* scale2 = &scaleMap.find(scLabel2)->second;
810 std::vector<long long> lut_cal_2_mu_eta;
811 getCaloMuonEtaConversionLut(lut_cal_2_mu_eta, scale1, scale2);
816 m_gtScales.setLUT_CalMuEta(lutName,lut_cal_2_mu_eta);
824 using namespace tmeventsetup;
833 if( scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
return;
835 const esScale* scale1 = &scaleMap.find(scLabel1)->second;
836 const esScale* scale2 = &scaleMap.find(scLabel2)->second;
839 std::vector<long long> lut_cal_2_mu_phi;
840 getCaloMuonPhiConversionLut(lut_cal_2_mu_phi, scale1, scale2);
845 m_gtScales.setLUT_CalMuPhi(lutName,lut_cal_2_mu_phi);
853 using namespace tmeventsetup;
860 if( scaleMap.find(scLabel1) == scaleMap.end())
return;
862 const esScale* scale1 = &scaleMap.find(scLabel1)->second;
864 std::vector<long long> lut_pt;
865 getLut(lut_pt, scale1, prec);
866 m_gtScales.setLUT_Pt(scLabel1,lut_pt,prec);
874 using namespace tmeventsetup;
883 if( scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
return;
885 const esScale* scale1 = &scaleMap.find(scLabel1)->second;
886 const esScale* scale2 = &scaleMap.find(scLabel2)->second;
887 std::vector<double> val_delta_eta;
888 std::vector<long long> lut_delta_eta;
889 size_t n = getDeltaVector(val_delta_eta, scale1, scale2);
890 setLut(lut_delta_eta, val_delta_eta, prec1);
894 m_gtScales.setLUT_DeltaEta(lutName,lut_delta_eta,prec1);
897 std::vector<long long> lut_cosh;
898 applyCosh(val_delta_eta,
n);
899 setLut(lut_cosh, val_delta_eta, prec2);
900 m_gtScales.setLUT_Cosh(lutName,lut_cosh,prec2);
907 using namespace tmeventsetup;
916 if( scaleMap.find(scLabel1) == scaleMap.end() || scaleMap.find(scLabel2) == scaleMap.end())
return;
918 const esScale* scale1 = &scaleMap.find(scLabel1)->second;
919 const esScale* scale2 = &scaleMap.find(scLabel2)->second;
920 std::vector<double> val_delta_phi;
921 std::vector<long long> lut_delta_phi;
922 size_t n = getDeltaVector(val_delta_phi, scale1, scale2);
923 setLut(lut_delta_phi, val_delta_phi, prec1);
927 m_gtScales.setLUT_DeltaPhi(lutName,lut_delta_phi,prec1);
930 std::vector<long long> lut_cos;
931 applyCos(val_delta_phi,
n);
932 setLut(lut_cos, val_delta_phi, prec2);
933 m_gtScales.setLUT_Cos(lutName,lut_cos,prec2);
949 unsigned int chipNr,
const bool corrFlag) {
951 using namespace tmeventsetup;
972 }
else if (condMu.getType() == esConditionType::TripleMuon) {
976 }
else if (condMu.getType() == esConditionType::QuadMuon) {
981 edm::LogError(
"TriggerMenuParser") <<
"Wrong type for muon-condition ("
982 <<
type <<
")" << std::endl;
987 edm::LogError(
"TriggerMenuParser") <<
"Unknown type for muon-condition (" <<
type
988 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
993 <<
"\n ****************************************** "
995 <<
"\n condition = " << condition
996 <<
"\n particle = " << particle
997 <<
"\n type = " <<
type
998 <<
"\n name = " <<
name
1006 std::vector<MuonTemplate::ObjectParameter> objParameter(nrObj);
1012 std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1013 tmpValues.reserve( nrObj );
1015 if(
int(condMu.getObjects().size())!=nrObj ){
1016 edm::LogError(
"TriggerMenuParser") <<
" condMu objects: nrObj = " << nrObj
1017 <<
"condMu.getObjects().size() = "
1018 << condMu.getObjects().size()
1025 unsigned int chargeCorrelation = 1;
1026 const std::vector<esCut>&
cuts = condMu.getCuts();
1030 if(cut.getCutType() == esCutType::ChargeCorrelation) {
1031 if( cut.getData()==
"ls" ) chargeCorrelation = 2;
1032 else if( cut.getData()==
"os" ) chargeCorrelation = 4;
1033 else chargeCorrelation = 1;
1038 corrParameter.chargeCorrelation = chargeCorrelation;
1049 const std::vector<esObject>& objects = condMu.getObjects();
1050 for (
size_t jj = 0;
jj < objects.size();
jj++) {
1052 const esObject
object = objects.at(
jj);
1056 relativeBx =
object.getBxOffset();
1059 int upperThresholdInd = -1;
1060 int lowerThresholdInd = 0;
1062 unsigned int etaWindow1Lower=-1, etaWindow1Upper=-1, etaWindow2Lower=-1, etaWindow2Upper=-1;
1064 unsigned int phiWindow1Lower=-1, phiWindow1Upper=-1, phiWindow2Lower=-1, phiWindow2Upper=-1;
1065 int isolationLUT = 0xF;
1067 int qualityLUT = 0xFFFF;
1069 const std::vector<esCut>&
cuts =
object.getCuts();
1070 for (
size_t kk = 0;
kk < cuts.size();
kk++)
1072 const esCut
cut = cuts.at(
kk);
1074 switch(cut.getCutType()){
1075 case esCutType::Threshold:
1076 lowerThresholdInd = cut.getMinimum().index;
1077 upperThresholdInd = cut.getMaximum().index;
1083 etaWindow1Lower = cut.getMinimum().index;
1084 etaWindow1Upper = cut.getMaximum().index;
1085 }
else if(cntEta == 1) {
1086 etaWindow2Lower = cut.getMinimum().index;
1087 etaWindow2Upper = cut.getMaximum().index;
1089 edm::LogError(
"TriggerMenuParser") <<
"Too Many Eta Cuts for muon-condition ("
1090 << particle <<
")" << std::endl;
1100 phiWindow1Lower = cut.getMinimum().index;
1101 phiWindow1Upper = cut.getMaximum().index;
1102 }
else if(cntPhi == 1) {
1103 phiWindow2Lower = cut.getMinimum().index;
1104 phiWindow2Upper = cut.getMaximum().index;
1106 edm::LogError(
"TriggerMenuParser") <<
"Too Many Phi Cuts for muon-condition ("
1107 << particle <<
")" << std::endl;
1114 case esCutType::Charge:
1115 if( cut.getData()==
"positive" ) charge = 0;
1116 else if( cut.getData()==
"negative" ) charge = 1;
1121 qualityLUT = l1tstr2int(cut.getData());
1124 case esCutType::Isolation: {
1126 isolationLUT = l1tstr2int(cut.getData());
1137 objParameter[cnt].ptHighThreshold = upperThresholdInd;
1138 objParameter[cnt].ptLowThreshold = lowerThresholdInd;
1140 objParameter[cnt].etaWindow1Lower = etaWindow1Lower;
1141 objParameter[cnt].etaWindow1Upper = etaWindow1Upper;
1142 objParameter[cnt].etaWindow2Lower = etaWindow2Lower;
1143 objParameter[cnt].etaWindow2Upper = etaWindow2Upper;
1145 objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
1146 objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
1147 objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
1148 objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
1151 objParameter[cnt].enableMip =
false;
1152 objParameter[cnt].enableIso =
false;
1153 objParameter[cnt].requestIso =
false;
1155 objParameter[cnt].charge =
charge;
1156 objParameter[cnt].qualityLUT = qualityLUT;
1157 objParameter[cnt].isolationLUT = isolationLUT;
1165 std::vector<GlobalObject> objType(nrObj,
gtMu);
1181 std::ostringstream myCoutStream;
1182 muonCond.
print(myCoutStream);
1183 LogTrace(
"TriggerMenuParser") << myCoutStream.str() <<
"\n" << std::endl;
1187 if ( !insertConditionIntoMap(muonCond, chipNr)) {
1189 <<
" Error: duplicate condition (" <<
name <<
")"
1194 LogDebug(
"TriggerMenuParser") <<
"Added Condition " <<
name <<
" to the ConditionMap" << std::endl;
1197 (m_corMuonTemplate[chipNr]).push_back(muonCond);
1200 LogDebug(
"TriggerMenuParser") <<
"Added Condition " <<
name <<
" to the vecMuonTemplate vector" << std::endl;
1201 (m_vecMuonTemplate[chipNr]).push_back(muonCond);
1212 unsigned int chipNr) {
1216 using namespace tmeventsetup;
1230 edm::LogError(
"TriggerMenuParser") <<
"Unknown type for muon-condition (" <<
type
1231 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1236 <<
"\n ****************************************** "
1238 <<
"\n condition = " << condition
1239 <<
"\n particle = " << particle
1240 <<
"\n type = " <<
type
1241 <<
"\n name = " <<
name
1249 std::vector<MuonTemplate::ObjectParameter> objParameter(nrObj);
1255 std::vector<boost::uint64_t> tmpValues((nrObj > 2) ? nrObj : 2);
1256 tmpValues.reserve( nrObj );
1262 unsigned int chargeCorrelation = 0;
1263 if( str_chargeCorrelation==
"ig" ) chargeCorrelation = 1;
1264 else if( str_chargeCorrelation==
"ls" ) chargeCorrelation = 2;
1265 else if( str_chargeCorrelation==
"os" ) chargeCorrelation = 4;
1268 corrParameter.chargeCorrelation = chargeCorrelation;
1281 relativeBx = corrMu->getBxOffset();
1284 int upperThresholdInd = -1;
1285 int lowerThresholdInd = 0;
1287 unsigned int etaWindow1Lower=-1, etaWindow1Upper=-1, etaWindow2Lower=-1, etaWindow2Upper=-1;
1289 unsigned int phiWindow1Lower=-1, phiWindow1Upper=-1, phiWindow2Lower=-1, phiWindow2Upper=-1;
1290 int isolationLUT = 0xF;
1292 int qualityLUT = 0xFFFF;
1294 const std::vector<esCut>&
cuts = corrMu->getCuts();
1299 switch(cut.getCutType()){
1300 case esCutType::Threshold:
1301 lowerThresholdInd = cut.getMinimum().index;
1302 upperThresholdInd = cut.getMaximum().index;
1308 etaWindow1Lower = cut.getMinimum().index;
1309 etaWindow1Upper = cut.getMaximum().index;
1310 }
else if(cntEta == 1) {
1311 etaWindow2Lower = cut.getMinimum().index;
1312 etaWindow2Upper = cut.getMaximum().index;
1314 edm::LogError(
"TriggerMenuParser") <<
"Too Many Eta Cuts for muon-condition ("
1315 << particle <<
")" << std::endl;
1325 phiWindow1Lower = cut.getMinimum().index;
1326 phiWindow1Upper = cut.getMaximum().index;
1327 }
else if(cntPhi == 1) {
1328 phiWindow2Lower = cut.getMinimum().index;
1329 phiWindow2Upper = cut.getMaximum().index;
1331 edm::LogError(
"TriggerMenuParser") <<
"Too Many Phi Cuts for muon-condition ("
1332 << particle <<
")" << std::endl;
1339 case esCutType::Charge:
1340 if( cut.getData()==
"positive" )
charge = 0;
1341 else if( cut.getData()==
"negative" )
charge = 1;
1346 qualityLUT = l1tstr2int(cut.getData());
1349 case esCutType::Isolation: {
1351 isolationLUT = l1tstr2int(cut.getData());
1362 objParameter[0].ptHighThreshold = upperThresholdInd;
1363 objParameter[0].ptLowThreshold = lowerThresholdInd;
1365 objParameter[0].etaWindow1Lower = etaWindow1Lower;
1366 objParameter[0].etaWindow1Upper = etaWindow1Upper;
1367 objParameter[0].etaWindow2Lower = etaWindow2Lower;
1368 objParameter[0].etaWindow2Upper = etaWindow2Upper;
1370 objParameter[0].phiWindow1Lower = phiWindow1Lower;
1371 objParameter[0].phiWindow1Upper = phiWindow1Upper;
1372 objParameter[0].phiWindow2Lower = phiWindow2Lower;
1373 objParameter[0].phiWindow2Upper = phiWindow2Upper;
1376 objParameter[0].enableMip =
false;
1377 objParameter[0].enableIso =
false;
1378 objParameter[0].requestIso =
false;
1380 objParameter[0].charge =
charge;
1381 objParameter[0].qualityLUT = qualityLUT;
1382 objParameter[0].isolationLUT = isolationLUT;
1386 std::vector<GlobalObject> objType(nrObj,
gtMu);
1399 std::ostringstream myCoutStream;
1400 muonCond.
print(myCoutStream);
1401 LogTrace(
"TriggerMenuParser") << myCoutStream.str() <<
"\n" << std::endl;
1417 (m_corMuonTemplate[chipNr]).push_back(muonCond);
1437 unsigned int chipNr,
const bool corrFlag) {
1441 using namespace tmeventsetup;
1451 <<
"\n ****************************************** "
1452 <<
"\n (in parseCalo) "
1453 <<
"\n condition = " << condition
1454 <<
"\n particle = " << particle
1455 <<
"\n type = " <<
type
1456 <<
"\n name = " <<
name
1467 if (condCalo.getType() == esConditionType::SingleEgamma) {
1472 }
else if (condCalo.getType() == esConditionType::DoubleEgamma) {
1477 }
else if (condCalo.getType() == esConditionType::TripleEgamma) {
1482 }
else if (condCalo.getType() == esConditionType::QuadEgamma) {
1487 }
else if (condCalo.getType() == esConditionType::SingleJet) {
1488 caloObjType =
gtJet;
1492 }
else if (condCalo.getType() == esConditionType::DoubleJet) {
1493 caloObjType =
gtJet;
1497 }
else if (condCalo.getType() == esConditionType::TripleJet) {
1498 caloObjType =
gtJet;
1502 }
else if (condCalo.getType() == esConditionType::QuadJet) {
1503 caloObjType =
gtJet;
1507 }
else if (condCalo.getType() == esConditionType::SingleTau) {
1508 caloObjType =
gtTau;
1512 }
else if (condCalo.getType() == esConditionType::DoubleTau) {
1513 caloObjType =
gtTau;
1517 }
else if (condCalo.getType() == esConditionType::TripleTau) {
1518 caloObjType =
gtTau;
1522 }
else if (condCalo.getType() == esConditionType::QuadTau) {
1523 caloObjType =
gtTau;
1528 edm::LogError(
"TriggerMenuParser") <<
"Wrong particle for calo-condition ("
1529 << particle <<
")" << std::endl;
1536 edm::LogError(
"TriggerMenuParser") <<
"Unknown type for calo-condition (" <<
type
1537 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1544 std::vector<CaloTemplate::ObjectParameter> objParameter(nrObj);
1550 std::vector<boost::uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1551 tmpValues.reserve( nrObj );
1554 if(
int(condCalo.getObjects().size())!=nrObj ){
1555 edm::LogError(
"TriggerMenuParser") <<
" condCalo objects: nrObj = " << nrObj
1556 <<
"condCalo.getObjects().size() = "
1557 << condCalo.getObjects().size()
1573 const std::vector<esObject>& objects = condCalo.getObjects();
1574 for (
size_t jj = 0;
jj < objects.size();
jj++) {
1576 const esObject
object = objects.at(
jj);
1580 relativeBx =
object.getBxOffset();
1583 int upperThresholdInd = -1;
1584 int lowerThresholdInd = 0;
1586 unsigned int etaWindow1Lower=-1, etaWindow1Upper=-1, etaWindow2Lower=-1, etaWindow2Upper=-1;
1588 unsigned int phiWindow1Lower=-1, phiWindow1Upper=-1, phiWindow2Lower=-1, phiWindow2Upper=-1;
1589 int isolationLUT = 0xF;
1590 int qualityLUT = 0xF;
1593 const std::vector<esCut>&
cuts =
object.getCuts();
1594 for (
size_t kk = 0;
kk < cuts.size();
kk++)
1596 const esCut
cut = cuts.at(
kk);
1598 switch(cut.getCutType()){
1599 case esCutType::Threshold:
1600 lowerThresholdInd = cut.getMinimum().index;
1601 upperThresholdInd = cut.getMaximum().index;
1606 etaWindow1Lower = cut.getMinimum().index;
1607 etaWindow1Upper = cut.getMaximum().index;
1608 }
else if(cntEta == 1) {
1609 etaWindow2Lower = cut.getMinimum().index;
1610 etaWindow2Upper = cut.getMaximum().index;
1612 edm::LogError(
"TriggerMenuParser") <<
"Too Many Eta Cuts for calo-condition ("
1613 << particle <<
")" << std::endl;
1623 phiWindow1Lower = cut.getMinimum().index;
1624 phiWindow1Upper = cut.getMaximum().index;
1625 }
else if(cntPhi == 1) {
1626 phiWindow2Lower = cut.getMinimum().index;
1627 phiWindow2Upper = cut.getMaximum().index;
1629 edm::LogError(
"TriggerMenuParser") <<
"Too Many Phi Cuts for calo-condition ("
1630 << particle <<
")" << std::endl;
1637 case esCutType::Charge: {
1639 edm::LogError(
"TriggerMenuParser") <<
"No charge cut for calo-condition ("
1640 << particle <<
")" << std::endl;
1646 qualityLUT = l1tstr2int(cut.getData());
1649 case esCutType::Isolation: {
1651 isolationLUT = l1tstr2int(cut.getData());
1661 objParameter[cnt].etHighThreshold = upperThresholdInd;
1662 objParameter[cnt].etLowThreshold = lowerThresholdInd;
1663 objParameter[cnt].etaWindow1Lower = etaWindow1Lower;
1664 objParameter[cnt].etaWindow1Upper = etaWindow1Upper;
1665 objParameter[cnt].etaWindow2Lower = etaWindow2Lower;
1666 objParameter[cnt].etaWindow2Upper = etaWindow2Upper;
1667 objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
1668 objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
1669 objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
1670 objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
1671 objParameter[cnt].isolationLUT = isolationLUT;
1672 objParameter[cnt].qualityLUT = qualityLUT;
1676 <<
"\n Calo ET high thresholds (hex) for calo object " << caloObjType <<
" " << cnt <<
" = "
1677 << std::hex << objParameter[cnt].etLowThreshold <<
" - " << objParameter[cnt].etHighThreshold
1678 <<
"\n etaWindow Lower / Upper for calo object " << cnt <<
" = 0x"
1679 << objParameter[cnt].etaWindow1Lower <<
" / 0x" << objParameter[cnt].etaWindow1Upper
1680 <<
"\n etaWindowVeto Lower / Upper for calo object " << cnt <<
" = 0x"
1681 << objParameter[cnt].etaWindow2Lower <<
" / 0x" << objParameter[cnt].etaWindow2Upper
1682 <<
"\n phiWindow Lower / Upper for calo object " << cnt <<
" = 0x"
1683 << objParameter[cnt].phiWindow1Lower <<
" / 0x" << objParameter[cnt].phiWindow1Upper
1684 <<
"\n phiWindowVeto Lower / Upper for calo object " << cnt <<
" = 0x"
1685 << objParameter[cnt].phiWindow2Lower <<
" / 0x" << objParameter[cnt].phiWindow2Upper
1686 <<
"\n Isolation LUT for calo object " << cnt <<
" = 0x"
1687 << objParameter[cnt].isolationLUT
1688 <<
"\n Quality LUT for calo object " << cnt <<
" = 0x"
1689 << objParameter[cnt].qualityLUT <<
std::dec
1698 std::vector<GlobalObject> objType(nrObj, caloObjType);
1720 std::ostringstream myCoutStream;
1721 caloCond.
print(myCoutStream);
1722 LogTrace(
"TriggerMenuParser") << myCoutStream.str() <<
"\n" << std::endl;
1728 if ( !insertConditionIntoMap(caloCond, chipNr)) {
1731 <<
" Error: duplicate condition (" <<
name <<
")"
1739 (m_corCaloTemplate[chipNr]).push_back(caloCond);
1742 (m_vecCaloTemplate[chipNr]).push_back(caloCond);
1766 unsigned int chipNr) {
1770 using namespace tmeventsetup;
1780 <<
"\n ****************************************** "
1781 <<
"\n (in parseCalo) "
1782 <<
"\n condition = " << condition
1783 <<
"\n particle = " << particle
1784 <<
"\n type = " <<
type
1785 <<
"\n name = " <<
name
1797 if (corrCalo->getType() == esObjectType::Egamma) {
1800 caloObjType =
gtJet;
1802 caloObjType =
gtTau;
1804 edm::LogError(
"TriggerMenuParser") <<
"Wrong particle for calo-condition ("
1805 << particle <<
")" << std::endl;
1813 edm::LogError(
"TriggerMenuParser") <<
"Unknown type for calo-condition (" <<
type
1814 <<
")" <<
"\nCan not determine number of trigger objects. " << std::endl;
1821 std::vector<CaloTemplate::ObjectParameter> objParameter(nrObj);
1827 std::vector<boost::uint64_t> tmpValues((nrObj > 1) ? nrObj : 1);
1828 tmpValues.reserve( nrObj );
1840 relativeBx = corrCalo->getBxOffset();
1843 int upperThresholdInd = -1;
1844 int lowerThresholdInd = 0;
1846 unsigned int etaWindow1Lower=-1, etaWindow1Upper=-1, etaWindow2Lower=-1, etaWindow2Upper=-1;
1848 unsigned int phiWindow1Lower=-1, phiWindow1Upper=-1, phiWindow2Lower=-1, phiWindow2Upper=-1;
1849 int isolationLUT = 0xF;
1850 int qualityLUT = 0xF;
1853 const std::vector<esCut>&
cuts = corrCalo->getCuts();
1858 switch(cut.getCutType()){
1859 case esCutType::Threshold:
1860 lowerThresholdInd = cut.getMinimum().index;
1861 upperThresholdInd = cut.getMaximum().index;
1866 etaWindow1Lower = cut.getMinimum().index;
1867 etaWindow1Upper = cut.getMaximum().index;
1868 }
else if(cntEta == 1) {
1869 etaWindow2Lower = cut.getMinimum().index;
1870 etaWindow2Upper = cut.getMaximum().index;
1872 edm::LogError(
"TriggerMenuParser") <<
"Too Many Eta Cuts for calo-condition ("
1873 << particle <<
")" << std::endl;
1883 phiWindow1Lower = cut.getMinimum().index;
1884 phiWindow1Upper = cut.getMaximum().index;
1885 }
else if(cntPhi == 1) {
1886 phiWindow2Lower = cut.getMinimum().index;
1887 phiWindow2Upper = cut.getMaximum().index;
1889 edm::LogError(
"TriggerMenuParser") <<
"Too Many Phi Cuts for calo-condition ("
1890 << particle <<
")" << std::endl;
1897 case esCutType::Charge: {
1899 edm::LogError(
"TriggerMenuParser") <<
"No charge cut for calo-condition ("
1900 << particle <<
")" << std::endl;
1906 qualityLUT = l1tstr2int(cut.getData());
1909 case esCutType::Isolation: {
1911 isolationLUT = l1tstr2int(cut.getData());
1921 objParameter[0].etLowThreshold = lowerThresholdInd;
1922 objParameter[0].etHighThreshold = upperThresholdInd;
1923 objParameter[0].etaWindow1Lower = etaWindow1Lower;
1924 objParameter[0].etaWindow1Upper = etaWindow1Upper;
1925 objParameter[0].etaWindow2Lower = etaWindow2Lower;
1926 objParameter[0].etaWindow2Upper = etaWindow2Upper;
1927 objParameter[0].phiWindow1Lower = phiWindow1Lower;
1928 objParameter[0].phiWindow1Upper = phiWindow1Upper;
1929 objParameter[0].phiWindow2Lower = phiWindow2Lower;
1930 objParameter[0].phiWindow2Upper = phiWindow2Upper;
1931 objParameter[0].isolationLUT = isolationLUT;
1932 objParameter[0].qualityLUT = qualityLUT;
1936 <<
"\n Calo ET high threshold (hex) for calo object " << caloObjType <<
" " <<
" = "
1937 << std::hex << objParameter[0].etLowThreshold <<
" - " << objParameter[0].etHighThreshold
1938 <<
"\n etaWindow Lower / Upper for calo object " <<
" = 0x"
1939 << objParameter[0].etaWindow1Lower <<
" / 0x" << objParameter[0].etaWindow1Upper
1940 <<
"\n etaWindowVeto Lower / Upper for calo object " <<
" = 0x"
1941 << objParameter[0].etaWindow2Lower <<
" / 0x" << objParameter[0].etaWindow2Upper
1942 <<
"\n phiWindow Lower / Upper for calo object " <<
" = 0x"
1943 << objParameter[0].phiWindow1Lower <<
" / 0x" << objParameter[0].phiWindow1Upper
1944 <<
"\n phiWindowVeto Lower / Upper for calo object " <<
" = 0x"
1945 << objParameter[0].phiWindow2Lower <<
" / 0x" << objParameter[0].phiWindow2Upper
1946 <<
"\n Isolation LUT for calo object " <<
" = 0x"
1947 << objParameter[0].isolationLUT
1948 <<
"\n Quality LUT for calo object " <<
" = 0x"
1949 << objParameter[0].qualityLUT <<
std::dec
1957 std::vector<GlobalObject> objType(nrObj, caloObjType);
1979 std::ostringstream myCoutStream;
1980 caloCond.
print(myCoutStream);
1981 LogTrace(
"TriggerMenuParser") << myCoutStream.str() <<
"\n" << std::endl;
1999 (m_corCaloTemplate[chipNr]).push_back(caloCond);
2019 unsigned int chipNr,
const bool corrFlag) {
2023 using namespace tmeventsetup;
2032 <<
"\n ****************************************** "
2033 <<
"\n (in parseEnergySum) "
2034 <<
"\n condition = " << condition
2035 <<
"\n type = " <<
type
2036 <<
"\n name = " <<
name
2045 if( condEnergySum.getType() == esConditionType::MissingEt ){
2049 else if( condEnergySum.getType() == esConditionType::TotalEt ){
2053 else if( condEnergySum.getType() == esConditionType::TotalEtEM ){
2057 else if( condEnergySum.getType() == esConditionType::TotalHt ){
2061 else if( condEnergySum.getType() == esConditionType::MissingHt ){
2065 else if( condEnergySum.getType() == esConditionType::MissingEtHF ){
2069 else if( condEnergySum.getType() == esConditionType::TowerCount ){
2073 else if( condEnergySum.getType() == esConditionType::MinBiasHFP0 ){
2077 else if( condEnergySum.getType() == esConditionType::MinBiasHFM0 ){
2081 else if( condEnergySum.getType() == esConditionType::MinBiasHFP1 ){
2085 else if( condEnergySum.getType() == esConditionType::MinBiasHFM1 ){
2091 <<
"Wrong type for energy-sum condition (" <<
type
2092 <<
")" << std::endl;
2106 std::vector<EnergySumTemplate::ObjectParameter> objParameter(nrObj);
2118 const std::vector<esObject>& objects = condEnergySum.getObjects();
2119 for (
size_t jj = 0;
jj < objects.size();
jj++) {
2121 const esObject
object = objects.at(
jj);
2125 relativeBx =
object.getBxOffset();
2128 int lowerThresholdInd = 0;
2129 int upperThresholdInd = -1;
2131 unsigned int phiWindow1Lower=-1, phiWindow1Upper=-1, phiWindow2Lower=-1, phiWindow2Upper=-1;
2134 const std::vector<esCut>&
cuts =
object.getCuts();
2135 for (
size_t kk = 0;
kk < cuts.size();
kk++)
2137 const esCut
cut = cuts.at(
kk);
2139 switch(cut.getCutType()){
2140 case esCutType::Threshold:
2141 lowerThresholdInd = cut.getMinimum().index;
2142 upperThresholdInd = cut.getMaximum().index;
2151 phiWindow1Lower = cut.getMinimum().index;
2152 phiWindow1Upper = cut.getMaximum().index;
2153 }
else if(cntPhi == 1) {
2154 phiWindow2Lower = cut.getMinimum().index;
2155 phiWindow2Upper = cut.getMaximum().index;
2157 edm::LogError(
"TriggerMenuParser") <<
"Too Many Phi Cuts for esum-condition ("
2158 <<
type <<
")" << std::endl;
2166 case esCutType::Count:
2167 lowerThresholdInd = cut.getMinimum().index;
2168 upperThresholdInd = 0xffffff;
2180 objParameter[cnt].etLowThreshold = lowerThresholdInd;
2181 objParameter[cnt].etHighThreshold = upperThresholdInd;
2182 objParameter[cnt].phiWindow1Lower = phiWindow1Lower;
2183 objParameter[cnt].phiWindow1Upper = phiWindow1Upper;
2184 objParameter[cnt].phiWindow2Lower = phiWindow2Lower;
2185 objParameter[cnt].phiWindow2Upper = phiWindow2Upper;
2190 <<
"\n EnergySum ET high threshold (hex) for energy sum object " << cnt <<
" = "
2191 << std::hex << objParameter[cnt].etLowThreshold <<
" - " << objParameter[cnt].etHighThreshold
2192 <<
"\n phiWindow Lower / Upper for calo object " << cnt <<
" = 0x"
2193 << objParameter[cnt].phiWindow1Lower <<
" / 0x" << objParameter[cnt].phiWindow1Upper
2194 <<
"\n phiWindowVeto Lower / Upper for calo object " << cnt <<
" = 0x"
2195 << objParameter[cnt].phiWindow2Lower <<
" / 0x" << objParameter[cnt].phiWindow2Upper <<
std::dec
2202 std::vector<GlobalObject> objType(nrObj, energySumObjType);
2218 std::ostringstream myCoutStream;
2219 energySumCond.
print(myCoutStream);
2220 LogTrace(
"TriggerMenuParser") << myCoutStream.str() <<
"\n" << std::endl;
2225 if ( !insertConditionIntoMap(energySumCond, chipNr)) {
2228 <<
" Error: duplicate condition (" <<
name <<
")"
2236 (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2240 (m_vecEnergySumTemplate[chipNr]).push_back(energySumCond);
2264 unsigned int chipNr) {
2268 using namespace tmeventsetup;
2277 <<
"\n ****************************************** "
2278 <<
"\n (in parseEnergySum) "
2279 <<
"\n condition = " << condition
2280 <<
"\n type = " <<
type
2281 <<
"\n name = " <<
name
2298 else if( corrESum->getType()== esObjectType::ETMHF ){
2302 else if( corrESum->getType()== esObjectType::TOWERCOUNT ){
2308 <<
"Wrong type for energy-sum correclation condition (" <<
type
2309 <<
")" << std::endl;
2323 std::vector<EnergySumTemplate::ObjectParameter> objParameter(nrObj);
2338 relativeBx = corrESum->getBxOffset();
2341 int lowerThresholdInd = 0;
2342 int upperThresholdInd = -1;
2344 unsigned int phiWindow1Lower=-1, phiWindow1Upper=-1, phiWindow2Lower=-1, phiWindow2Upper=-1;
2347 const std::vector<esCut>&
cuts = corrESum->getCuts();
2352 switch(cut.getCutType()){
2353 case esCutType::Threshold:
2354 lowerThresholdInd = cut.getMinimum().index;
2355 upperThresholdInd = cut.getMaximum().index;
2364 phiWindow1Lower = cut.getMinimum().index;
2365 phiWindow1Upper = cut.getMaximum().index;
2366 }
else if(cntPhi == 1) {
2367 phiWindow2Lower = cut.getMinimum().index;
2368 phiWindow2Upper = cut.getMaximum().index;
2370 edm::LogError(
"TriggerMenuParser") <<
"Too Many Phi Cuts for esum-condition ("
2371 <<
type <<
")" << std::endl;
2388 objParameter[0].etLowThreshold = lowerThresholdInd;
2389 objParameter[0].etHighThreshold = upperThresholdInd;
2390 objParameter[0].phiWindow1Lower = phiWindow1Lower;
2391 objParameter[0].phiWindow1Upper = phiWindow1Upper;
2392 objParameter[0].phiWindow2Lower = phiWindow2Lower;
2393 objParameter[0].phiWindow2Upper = phiWindow2Upper;
2398 <<
"\n EnergySum ET high threshold (hex) for energy sum object " << cnt <<
" = "
2399 << std::hex << objParameter[0].etLowThreshold <<
" - " << objParameter[0].etLowThreshold
2400 <<
"\n phiWindow Lower / Upper for calo object " << cnt <<
" = 0x"
2401 << objParameter[0].phiWindow1Lower <<
" / 0x" << objParameter[0].phiWindow1Upper
2402 <<
"\n phiWindowVeto Lower / Upper for calo object " << cnt <<
" = 0x"
2403 << objParameter[0].phiWindow2Lower <<
" / 0x" << objParameter[0].phiWindow2Upper <<
std::dec
2408 std::vector<GlobalObject> objType(nrObj, energySumObjType);
2424 std::ostringstream myCoutStream;
2425 energySumCond.
print(myCoutStream);
2426 LogTrace(
"TriggerMenuParser") << myCoutStream.str() <<
"\n" << std::endl;
2445 (m_corEnergySumTemplate[chipNr]).push_back(energySumCond);
2467 unsigned int chipNr) {
2470 using namespace tmeventsetup;
2481 <<
"\n ****************************************** "
2482 <<
"\n (in parseExternal) "
2483 <<
"\n condition = " << condition
2484 <<
"\n particle = " << particle
2485 <<
"\n type = " <<
type
2486 <<
"\n name = " <<
name
2497 unsigned int channelID = 0;
2500 const std::vector<esObject>& objects = condExt.getObjects();
2501 for (
size_t jj = 0;
jj < objects.size();
jj++) {
2503 const esObject
object = objects.at(
jj);
2504 if(
object.getType() == esObjectType::EXT) {
2505 relativeBx =
object.getBxOffset();
2506 channelID =
object.getExternalChannelId();
2515 std::vector<GlobalObject> objType(nrObj, extSignalType);
2528 << externalCond <<
"\n" << std::endl;
2531 if ( !insertConditionIntoMap(externalCond, chipNr)) {
2534 <<
" Error: duplicate condition (" <<
name
2535 <<
")" << std::endl;
2540 (m_vecExternalTemplate[chipNr]).push_back(externalCond);
2561 tmeventsetup::esCondition corrCond,
2562 unsigned int chipNr) {
2564 using namespace tmeventsetup;
2571 LogDebug(
"TriggerMenuParser") <<
" ****************************************** " << std::endl
2572 <<
" (in parseCorrelation) " << std::endl
2573 <<
" condition = " << condition << std::endl
2574 <<
" particle = " << particle << std::endl
2575 <<
" type = " <<
type << std::endl
2576 <<
" name = " <<
name << std::endl;
2585 if ( !insertConditionIntoMap(correlationCond, chipNr)) {
2588 <<
" Error: duplicate correlation condition (" <<
name <<
")"
2601 const int nrObj = 2;
2604 int intGEq[nrObj] = { -1, -1 };
2605 std::vector<GlobalObject> objType(nrObj);
2606 std::vector<GtConditionCategory> condCateg(nrObj);
2609 const bool corrFlag =
true;
2610 int corrIndexVal[nrObj] = { -1, -1 };
2619 const std::vector<esCut>&
cuts = corrCond.getCuts();
2624 if(cut.getCutType() == esCutType::ChargeCorrelation) {
2625 if( cut.getData()==
"ls" ) corrParameter.chargeCorrelation = 2;
2626 else if( cut.getData()==
"os" ) corrParameter.chargeCorrelation = 4;
2627 else corrParameter.chargeCorrelation = 1;
2633 double minV = cut.getMinimum().value;
2634 double maxV = cut.getMaximum().value;
2637 if(maxV > 1.0e6) maxV = 1.0e6;
2641 corrParameter.minEtaCutValue = (
long long)(minV *
pow(10.,cut.getMinimum().index));
2642 corrParameter.maxEtaCutValue = (
long long)(maxV *
pow(10.,cut.getMaximum().index));
2643 corrParameter.precEtaCut = cut.getMinimum().index;
2644 cutType = cutType | 0x1;
2647 corrParameter.minPhiCutValue = (
long long)(minV *
pow(10.,cut.getMinimum().index));
2648 corrParameter.maxPhiCutValue = (
long long)(maxV *
pow(10.,cut.getMaximum().index));
2649 corrParameter.precPhiCut = cut.getMinimum().index;
2650 cutType = cutType | 0x2;
2653 corrParameter.minDRCutValue = (
long long)(minV *
pow(10.,cut.getMinimum().index));
2654 corrParameter.maxDRCutValue = (
long long)(maxV *
pow(10.,cut.getMaximum().index));
2655 corrParameter.precDRCut = cut.getMinimum().index;
2656 cutType = cutType | 0x4;
2659 corrParameter.minMassCutValue = (
long long)(minV *
pow(10.,cut.getMinimum().index));
2660 corrParameter.maxMassCutValue = (
long long)(maxV *
pow(10.,cut.getMaximum().index));
2661 corrParameter.precMassCut = cut.getMinimum().index;
2662 cutType = cutType | 0x8;
2667 corrParameter.corrCutType = cutType;
2670 const std::vector<esObject>& objects = corrCond.getObjects();
2671 if(objects.size() != 2) {
2673 <<
"incorrect number of objects for the correlation condition " <<
name <<
" corrFlag " << corrFlag << std::endl;
2678 for (
size_t jj = 0;
jj < objects.size();
jj++)
2680 const esObject
object = objects.at(
jj);
2721 parseMuonCorr(&
object,chipNr);
2722 corrIndexVal[
jj] = (m_corMuonTemplate[chipNr]).
size() - 1;
2729 }
else if(
object.getType() == esObjectType::Egamma ||
2734 parseCaloCorr(&
object,chipNr);
2735 corrIndexVal[
jj] = (m_corCaloTemplate[chipNr]).
size() - 1;
2739 switch(
object.getType()) {
2740 case esObjectType::Egamma: {
2762 object.getType() == esObjectType::ETMHF ||
2763 object.getType() == esObjectType::TOWERCOUNT ||
2767 parseEnergySumCorr(&
object,chipNr);
2768 corrIndexVal[
jj] = (m_corEnergySumTemplate[chipNr]).
size() - 1;
2772 switch(
object.getType()) {
2781 case esObjectType::ETMHF: {
2785 case esObjectType::TOWERCOUNT: {
2799 <<
"Illegal Object Type " <<
object.getType()
2800 <<
" for the correlation condition " <<
name << std::endl;
2810 if (intGEq[0] != intGEq[1]) {
2812 <<
"Inconsistent GEq flags for sub-conditions "
2813 <<
" for the correlation condition " <<
name << std::endl;
2818 gEq = (intGEq[0] != 0);
2839 std::ostringstream myCoutStream;
2840 correlationCond.
print(myCoutStream);
2841 LogTrace(
"TriggerMenuParser") << myCoutStream.str() <<
"\n"
2849 (m_vecCorrelationTemplate[chipNr]).push_back(correlationCond);
2869 unsigned int chipNr) {
2872 using namespace tmeventsetup;
2880 if (algAlias ==
"") {
2883 <<
"\n No alias defined for algorithm. Alias set to algorithm name."
2884 <<
"\n Algorithm name: " << algName <<
"\n Algorithm alias: " << algAlias
2888 LogDebug(
"TriggerMenuParser") <<
"\n Alias defined for algorithm."
2889 <<
"\n Algorithm name: " << algName <<
"\n Algorithm alias: " << algAlias
2894 std::string logExpression = algorithm.getExpressionInCondition();
2897 <<
" Logical expression: " << logExpression
2898 <<
" Chip number: " << chipNr
2902 int outputPin = algorithm.getIndex();
2906 LogDebug(
"TriggerMenuParser") <<
" Output pin: " << outputPin
2912 int bitNumber = outputPin;
2915 LogDebug(
"TriggerMenuParser") <<
" Bit number: " << bitNumber
2925 std::ostringstream myCoutStream;
2926 alg.
print(myCoutStream);
2927 LogTrace(
"TriggerMenuParser") << myCoutStream.str() <<
"\n" << std::endl;
2932 if ( !insertAlgorithmIntoMap(alg)) {
void setCondGEq(const bool &cGEq)
void setAlgoAlias(const std::string &algoAliasValue)
void setCond0Index(const int &)
virtual void print(std::ostream &myCout) const
print the condition
unsigned int chargeCorrelation
std::vector< std::pair< double, double > > etaBins
virtual void print(std::ostream &myCout) const
print condition
std::vector< std::pair< double, double > > phiBins
void setCondType(const l1t::GtConditionType &cType)
void setCorrelationParameter(const CorrelationParameter &corrParameter)
virtual void print(std::ostream &myCout) const
print the condition
void setCondRelativeBx(const int &cRelativeBx)
virtual void print(std::ostream &myCout) const
print the condition
void setCondChipNr(const int &cChipNr)
VDouble InvariantMass(Tau)
int algoBitNumber() const
get / set algorithm bit number
Container::value_type value_type
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
void setExternalChannel(unsigned int extCh)
set functions
void setCond1Category(const l1t::GtConditionCategory &)
const int algoOutputPin(const int numberConditionChips, const int pinsOnConditionChip, const std::vector< int > &orderConditionChip) const
get the output pin on the condition chip for the algorithm
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
void setObjectType(const std::vector< GlobalObject > &objType)
const std::string & condName() const
get / set condition name
std::vector< std::pair< double, double > > etBins
const std::string algoName() const
get / set algorithm name
void setCond0Category(const l1t::GtConditionCategory &)
std::string const & algoAlias() const
get / set algorithm alias
void setAlgoChipNumber(const int algoChipNumberValue)
typedef for a single object template
void setConditionParameter(const std::vector< ObjectParameter > &objParameter, const CorrelationParameter &corrParameter)
set functions
typedef for correlation parameters
char data[epos_bytes_allocation]
typedef for correlation parameters
virtual void print(std::ostream &myCout) const
print the condition
std::map< std::string, GlobalAlgorithm > AlgorithmMap
map containing the algorithms
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
void setConditionParameter(const std::vector< ObjectParameter > &)
set functions
void setCond1Index(const int &)
const int algoChipNumber() const
get / set algorithm bit number