CMS 3D CMS Logo

L1GtTriggerMenuConfigOnlineProd.h
Go to the documentation of this file.
1 #ifndef L1GtConfigProducers_L1GtTriggerMenuConfigOnlineProd_h
2 #define L1GtConfigProducers_L1GtTriggerMenuConfigOnlineProd_h
3 
18 // system include files
19 #include "boost/lexical_cast.hpp"
20 
21 #include <memory>
22 #include <string>
23 #include <vector>
24 #include <iomanip>
25 #include <iostream>
26 
27 // user include files
28 // base class
30 
33 
44 
45 // forward declarations
46 
47 // class declaration
48 class L1GtTriggerMenuConfigOnlineProd : public L1ConfigOnlineProdBase<L1GtTriggerMenuRcd, L1GtTriggerMenu> {
49 public:
52 
55 
57  std::unique_ptr<L1GtTriggerMenu> newObject(const std::string& objectKey) override;
58 
60  void init(const int numberConditionChips);
61 
62 private:
64 
70  };
71 
72  struct TableMenuAlgo {
73  short bitNumberSh;
77  };
78 
80  short bitNumberSh;
81  float condIndexF;
83  };
84 
85  struct TableMenuCond {
91  bool condGEq;
92  short countIndex;
94 
95  // Oracle / Coral pretends that chargeCorrelation is bool in OMDS
96  // can not be - it has three values...
97  // but it reads/writes correctly the numerical value from OMDS (1, 2...)
105  };
106 
111  bool enableMip;
112  bool enableIso;
115  float etThreshold;
118  short phiHigh;
119  short phiLow;
121  bool charge;
122  };
123 
125  short bitNumberSh;
127  };
128 
130 
132  bool tableMenuGeneralFromDB(const std::string& gtSchema, const std::string& objKey);
133 
135  bool tableMenuAlgoFromDB(const std::string& gtSchema, const std::string& objKey);
136 
138  bool tableMenuAlgoCondFromDB(const std::string& gtSchema, const std::string& objKey);
139 
141  bool tableMenuCondFromDB(const std::string& gtSchema, const std::string& objKey);
142 
144  bool tableMenuObjectParametersFromDB(const std::string& gtSchema, const std::string& objKey);
145 
147  bool tableMenuTechTrigFromDB(const std::string& gtSchema, const std::string& objKey);
148 
149 private:
152  const std::map<int, std::string> condIndexNameMap(const short bitNr) const;
153 
155  std::string convertLogicalExpression(const std::string&, const std::map<int, std::string>&) const;
156 
158  int chipNumber(short) const;
159 
161  void buildAlgorithmMap();
162 
165 
168 
171 
173  L1GtObject strToEnumL1GtObject(const std::string& strObject);
174 
176  void splitHexStringInTwo64bitWords(const std::string& hexStr, std::string& hex0WordStr, std::string& hex1WordStr);
177 
179  std::list<int> listChipNumber(const std::string&);
180 
182  void addMuonCondition(const TableMenuCond&);
183 
185  void addCaloCondition(const TableMenuCond&);
186 
187  void fillEnergySumObjectParameter(const std::string& opFK,
189  const L1GtObject&);
191 
195  void addCastorCondition(const TableMenuCond&);
196  void addBptxCondition(const TableMenuCond&);
197  void addExternalCondition(const TableMenuCond&);
199 
201  void addConditions();
202 
203 private:
204  template <typename Result, typename Source>
205  Result lexical_cast_from_hex(Source& value) const;
206 
207 private:
209 
211  std::vector<TableMenuAlgo> m_tableMenuAlgo;
212  std::vector<TableMenuAlgoCond> m_tableMenuAlgoCond;
213  std::vector<TableMenuCond> m_tableMenuCond;
214  std::vector<TableMenuObjectParameters> m_tableMenuObjectParameters;
215  std::vector<TableMenuTechTrig> m_tableMenuTechTrig;
216 
217 private:
219 
224 
227 
230  std::vector<std::vector<L1GtMuonTemplate> > m_vecMuonTemplate;
231  std::vector<std::vector<L1GtCaloTemplate> > m_vecCaloTemplate;
232  std::vector<std::vector<L1GtEnergySumTemplate> > m_vecEnergySumTemplate;
233  std::vector<std::vector<L1GtJetCountsTemplate> > m_vecJetCountsTemplate;
234  std::vector<std::vector<L1GtCastorTemplate> > m_vecCastorTemplate;
235  std::vector<std::vector<L1GtHfBitCountsTemplate> > m_vecHfBitCountsTemplate;
236  std::vector<std::vector<L1GtHfRingEtSumsTemplate> > m_vecHfRingEtSumsTemplate;
237  std::vector<std::vector<L1GtBptxTemplate> > m_vecBptxTemplate;
238  std::vector<std::vector<L1GtExternalTemplate> > m_vecExternalTemplate;
239 
240  std::vector<std::vector<L1GtCorrelationTemplate> > m_vecCorrelationTemplate;
241  std::vector<std::vector<L1GtMuonTemplate> > m_corMuonTemplate;
242  std::vector<std::vector<L1GtCaloTemplate> > m_corCaloTemplate;
243  std::vector<std::vector<L1GtEnergySumTemplate> > m_corEnergySumTemplate;
244 
247 
250 
253 
254 private:
256 };
257 
258 template <typename Result, typename Source>
260  std::stringstream convertor;
261  convertor << value;
262 
263  Result result;
264  if (!(convertor >> std::hex >> result) || !convertor.eof()) {
265  throw boost::bad_lexical_cast();
266  }
267 
268  return result;
269 }
270 
271 #endif
const std::map< int, std::string > condIndexNameMap(const short bitNr) const
L1GtTriggerMenuConfigOnlineProd(const edm::ParameterSet &)
constructor
void fillMuonObjectParameter(const std::string &opFK, L1GtMuonTemplate::ObjectParameter &)
bool tableMenuAlgoCondFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with conditions associated to physics algorithms from DB
Result lexical_cast_from_hex(Source &value) const
bool tableMenuAlgoFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with physics algorithms from DB
void fillCaloObjectParameter(const std::string &opFK, L1GtCaloTemplate::ObjectParameter &)
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
std::vector< std::vector< L1GtCorrelationTemplate > > m_vecCorrelationTemplate
bool tableMenuCondFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with list of conditions in the menu
std::vector< std::vector< L1GtJetCountsTemplate > > m_vecJetCountsTemplate
std::unique_ptr< L1GtTriggerMenu > newObject(const std::string &objectKey) override
public methods
L1GtConditionType
void fillEnergySumObjectParameter(const std::string &opFK, L1GtEnergySumTemplate::ObjectParameter &, const L1GtObject &)
std::vector< std::vector< L1GtBptxTemplate > > m_vecBptxTemplate
std::vector< std::vector< L1GtCaloTemplate > > m_corCaloTemplate
std::vector< std::vector< L1GtCaloTemplate > > m_vecCaloTemplate
std::vector< std::vector< L1GtExternalTemplate > > m_vecExternalTemplate
AlgorithmMap m_algorithmAliasMap
map containing the physics algorithms (by alias)
std::vector< std::vector< L1GtCastorTemplate > > m_vecCastorTemplate
TableMenuGeneral m_tableMenuGeneral
member to keep various tables retrieved from DB
L1GtConditionType strToEnumCondType(const std::string &strType)
string to enum L1GtConditionType conversion
void buildAlgorithmMap()
build the algorithm map in the menu
L1GtConditionCategory
condition categories
std::vector< TableMenuTechTrig > m_tableMenuTechTrig
std::string convertLogicalExpression(const std::string &, const std::map< int, std::string > &) const
convert a logical expression with indices to a logical expression with names
typedef for a single object template
Definition: value.py:1
void addConditions()
add the conditions from a menu to the corresponding list
std::list< int > listChipNumber(const std::string &)
get a list of chip numbers from the m_tableMenuAlgoCond table for a condition
std::string m_scaleDbKey
menu associated scale key
bool tableMenuTechTrigFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with technical triggers from DB
AlgorithmMap m_technicalTriggerMap
map containing the technical triggers
int chipNumber(short) const
return the chip number for an algorithm with index bitNumberSh
define simple structures to get the tables from DB
bool tableMenuGeneralFromDB(const std::string &gtSchema, const std::string &objKey)
methods to retrieve the tables from DB
std::vector< TableMenuObjectParameters > m_tableMenuObjectParameters
std::vector< std::vector< L1GtMuonTemplate > > m_vecMuonTemplate
void splitHexStringInTwo64bitWords(const std::string &hexStr, std::string &hex0WordStr, std::string &hex1WordStr)
split a hex string in two 64-bit words returned as hex strings
void buildTechnicalTriggerMap()
build the technical trigger map in the menu
void init(const int numberConditionChips)
initialize the class (mainly reserve/resize)
void addHfRingEtSumsCondition(const TableMenuCond &)
std::vector< TableMenuAlgoCond > m_tableMenuAlgoCond
std::string m_triggerMenuInterface
menu representation
std::vector< std::vector< L1GtEnergySumTemplate > > m_vecEnergySumTemplate
std::vector< std::vector< L1GtEnergySumTemplate > > m_corEnergySumTemplate
std::vector< std::vector< L1GtMuonTemplate > > m_corMuonTemplate
AlgorithmMap m_algorithmMap
map containing the physics algorithms (by name)
std::vector< std::vector< L1GtHfBitCountsTemplate > > m_vecHfBitCountsTemplate
std::vector< std::vector< L1GtHfRingEtSumsTemplate > > m_vecHfRingEtSumsTemplate
L1GtConditionCategory strToEnumCondCategory(const std::string &strCategory)
string to enum L1GtConditionCategory conversion
bool tableMenuObjectParametersFromDB(const std::string &gtSchema, const std::string &objKey)
retrieve table with object parameters from DB
typedef for a single object template
L1GtObject strToEnumL1GtObject(const std::string &strObject)
string to enum L1GtObject conversion