Go to the documentation of this file.00001 #ifndef L1GtConfigProducers_L1GtTriggerMenuConfigOnlineProd_h
00002 #define L1GtConfigProducers_L1GtTriggerMenuConfigOnlineProd_h
00003
00020
00021 #include "boost/shared_ptr.hpp"
00022 #include "boost/lexical_cast.hpp"
00023
00024 #include <string>
00025 #include <vector>
00026 #include <iomanip>
00027 #include <iostream>
00028
00029
00030
00031 #include "CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h"
00032
00033 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00034 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00035
00036 #include "CondFormats/L1TObjects/interface/L1GtMuonTemplate.h"
00037 #include "CondFormats/L1TObjects/interface/L1GtCaloTemplate.h"
00038 #include "CondFormats/L1TObjects/interface/L1GtEnergySumTemplate.h"
00039 #include "CondFormats/L1TObjects/interface/L1GtJetCountsTemplate.h"
00040 #include "CondFormats/L1TObjects/interface/L1GtCastorTemplate.h"
00041 #include "CondFormats/L1TObjects/interface/L1GtHfBitCountsTemplate.h"
00042 #include "CondFormats/L1TObjects/interface/L1GtHfRingEtSumsTemplate.h"
00043 #include "CondFormats/L1TObjects/interface/L1GtCorrelationTemplate.h"
00044 #include "CondFormats/L1TObjects/interface/L1GtBptxTemplate.h"
00045 #include "CondFormats/L1TObjects/interface/L1GtExternalTemplate.h"
00046
00047
00048
00049
00050 class L1GtTriggerMenuConfigOnlineProd :
00051 public L1ConfigOnlineProdBase<L1GtTriggerMenuRcd, L1GtTriggerMenu>
00052 {
00053
00054 public:
00055
00057 L1GtTriggerMenuConfigOnlineProd(const edm::ParameterSet&);
00058
00060 ~L1GtTriggerMenuConfigOnlineProd();
00061
00063 virtual boost::shared_ptr<L1GtTriggerMenu> newObject(const std::string& objectKey);
00064
00066 void init(const int numberConditionChips);
00067
00068
00069 private:
00070
00072
00073 struct TableMenuGeneral {
00074 std::string menuInterface;
00075 std::string menuImplementation;
00076 std::string algoImplTag;
00077 std::string scalesKey;
00078 };
00079
00080 struct TableMenuAlgo {
00081 short bitNumberSh;
00082 std::string algName;
00083 std::string algAlias;
00084 std::string logExpression;
00085 };
00086
00087 struct TableMenuAlgoCond {
00088 short bitNumberSh;
00089 float condIndexF;
00090 std::string condFK;
00091 };
00092
00093 struct TableMenuCond {
00094 std::string cond;
00095 std::string condCategory;
00096 std::string condType;
00097 std::string gtObject1;
00098 std::string gtObject2;
00099 bool condGEq;
00100 float countIndex;
00101 float countThreshold;
00102 float chargeCorrelation;
00103 std::string objectParameter1FK;
00104 std::string objectParameter2FK;
00105 std::string objectParameter3FK;
00106 std::string objectParameter4FK;
00107 std::string deltaEtaRange;
00108 std::string deltaPhiRange;
00109 };
00110
00111 struct TableMenuObjectParameters {
00112 std::string opId;
00113 float ptHighThreshold;
00114 float ptLowThreshold;
00115 float enableMip;
00116 float enableIso;
00117 float requestIso;
00118 float energyOverflow;
00119 float etThreshold;
00120 std::string etaRange;
00121 std::string phiRange;
00122 float phiHigh;
00123 float phiLow;
00124 std::string qualityRange;
00125 float charge;
00126
00127 };
00128
00129 struct TableMenuTechTrig {
00130 short bitNumberSh;
00131 std::string techName;
00132 };
00133
00135
00137 bool tableMenuGeneralFromDB(const std::string& gtSchema, const std::string& objKey);
00138
00140 bool tableMenuAlgoFromDB(const std::string& gtSchema, const std::string& objKey);
00141
00143 bool tableMenuAlgoCondFromDB(const std::string& gtSchema, const std::string& objKey);
00144
00146 bool tableMenuCondFromDB(const std::string& gtSchema, const std::string& objKey);
00147
00149 bool tableMenuObjectParametersFromDB(const std::string& gtSchema, const std::string& objKey);
00150
00152 bool tableMenuTechTrigFromDB(const std::string& gtSchema, const std::string& objKey);
00153
00154 private:
00155
00158 const std::map<int, std::string> condIndexNameMap(const short bitNr) const;
00159
00161 std::string convertLogicalExpression(const std::string&, const std::map<int, std::string>&) const;
00162
00164 int chipNumber(short) const;
00165
00167 void buildAlgorithmMap();
00168
00170 void buildTechnicalTriggerMap();
00171
00173 L1GtConditionCategory strToEnumCondCategory(const std::string& strCategory);
00174
00176 L1GtConditionType strToEnumCondType(const std::string& strType);
00177
00179 L1GtObject strToEnumL1GtObject(const std::string& strObject);
00180
00182 void splitHexStringInTwo64bitWords(
00183 const std::string& hexStr, std::string& hex0WordStr, std::string& hex1WordStr);
00184
00186 std::list<int> listChipNumber(const std::string&);
00187
00188 void fillMuonObjectParameter(const std::string& opFK, L1GtMuonTemplate::ObjectParameter&);
00189 void addMuonCondition(const TableMenuCond&);
00190
00191 void fillCaloObjectParameter(const std::string& opFK, L1GtCaloTemplate::ObjectParameter&);
00192 void addCaloCondition(const TableMenuCond&);
00193
00194 void fillEnergySumObjectParameter(
00195 const std::string& opFK, L1GtEnergySumTemplate::ObjectParameter&, const L1GtObject&);
00196 void addEnergySumCondition(const TableMenuCond&);
00197
00198 void addJetCountsCondition(const TableMenuCond&);
00199 void addHfBitCountsCondition(const TableMenuCond&);
00200 void addHfRingEtSumsCondition(const TableMenuCond&);
00201 void addCastorCondition(const TableMenuCond&);
00202 void addBptxCondition(const TableMenuCond&);
00203 void addExternalCondition(const TableMenuCond&);
00204 void addCorrelationCondition(const TableMenuCond&);
00205
00207 void addConditions();
00208
00209
00210 private:
00211 template<typename Result, typename Source>
00212 Result lexical_cast_from_hex(Source & value) const;
00213
00214
00215 private:
00216
00218
00219 TableMenuGeneral m_tableMenuGeneral;
00220 std::vector<TableMenuAlgo> m_tableMenuAlgo;
00221 std::vector<TableMenuAlgoCond> m_tableMenuAlgoCond;
00222 std::vector<TableMenuCond> m_tableMenuCond;
00223 std::vector<TableMenuObjectParameters> m_tableMenuObjectParameters;
00224 std::vector<TableMenuTechTrig> m_tableMenuTechTrig;
00225
00226 private:
00227
00229
00231 std::string m_triggerMenuInterface;
00232 std::string m_triggerMenuName;
00233 std::string m_triggerMenuImplementation;
00234
00236 std::string m_scaleDbKey;
00237
00240 std::vector<std::vector<L1GtMuonTemplate> > m_vecMuonTemplate;
00241 std::vector<std::vector<L1GtCaloTemplate> > m_vecCaloTemplate;
00242 std::vector<std::vector<L1GtEnergySumTemplate> > m_vecEnergySumTemplate;
00243 std::vector<std::vector<L1GtJetCountsTemplate> > m_vecJetCountsTemplate;
00244 std::vector<std::vector<L1GtCastorTemplate> > m_vecCastorTemplate;
00245 std::vector<std::vector<L1GtHfBitCountsTemplate> > m_vecHfBitCountsTemplate;
00246 std::vector<std::vector<L1GtHfRingEtSumsTemplate> > m_vecHfRingEtSumsTemplate;
00247 std::vector<std::vector<L1GtBptxTemplate> > m_vecBptxTemplate;
00248 std::vector<std::vector<L1GtExternalTemplate> > m_vecExternalTemplate;
00249
00250 std::vector<std::vector<L1GtCorrelationTemplate> > m_vecCorrelationTemplate;
00251 std::vector<std::vector<L1GtMuonTemplate> > m_corMuonTemplate;
00252 std::vector<std::vector<L1GtCaloTemplate> > m_corCaloTemplate;
00253 std::vector<std::vector<L1GtEnergySumTemplate> > m_corEnergySumTemplate;
00254
00256 AlgorithmMap m_algorithmMap;
00257
00259 AlgorithmMap m_algorithmAliasMap;
00260
00262 AlgorithmMap m_technicalTriggerMap;
00263
00264 private:
00265
00266 bool m_isDebugEnabled;
00267
00268
00269 };
00270
00271
00272
00273 template<typename Result, typename Source>
00274 Result L1GtTriggerMenuConfigOnlineProd::lexical_cast_from_hex(Source & value) const {
00275
00276 std::stringstream convertor;
00277 convertor << value;
00278
00279 Result result;
00280 if (! ( convertor >> std::hex >> result ) || !convertor.eof()) {
00281 throw boost::bad_lexical_cast();
00282 }
00283
00284 return result;
00285 }
00286
00287
00288 #endif