1 #ifndef L1Trigger_L1TCommon_Setting_h 2 #define L1Trigger_L1TCommon_Setting_h 15 #include <boost/shared_ptr.hpp> 16 #include <boost/lexical_cast.hpp> 17 #include <boost/spirit/include/classic.hpp> 18 #include <boost/spirit/include/classic_push_back_actor.hpp> 40 std::shared_ptr< std::vector<std::string> >
row_;
41 std::shared_ptr< std::vector<std::string> >
types_;
42 std::shared_ptr< std::vector<std::string> >
columns_;
43 std::shared_ptr< std::map<std::string,int> >
colDict_;
58 void addTableRow(
const std::string& row,
const std::vector<std::string>& types,
const std::vector<std::string>& columns);
64 template <
class varType> varType
getValue();
65 template <
class varType> std::vector<varType> getVector();
67 l1t::LUT getLUT(
size_t addrWidth = 0,
size_t dataWidth = 31,
int padding = -1,
std::string delim =
",");
81 if ( type_.find(
"vector") == std::string::npos )
82 throw std::runtime_error(
"The registered type: " + type_ +
" is not vector so you need to call the getValue method");
84 std::vector<std::string>
vals;
87 std::vector<varType> newVals;
88 for(
auto it=vals.begin(); it!=vals.end(); it++)
89 newVals.push_back(convertVariable<varType>(*it));
93 std::ostringstream tempStr;
94 tempStr <<
"l1t::Setting::getVector\tReturning vector with values " << this->getValueAsStr() <<
" from parameter with id: " << this->
getId() << std::endl;
103 if ( type_.find(
"vector") != std::string::npos )
104 throw std::runtime_error(
"The registered type: " + type_ +
" is vector so you need to call the getVector method");
108 std::ostringstream tempStr;
109 tempStr <<
"l1t::Setting::getValue\tReturning value " << this->getValueAsStr() <<
" from parameter with id: " << this->
getId() << std::endl;
112 return convertVariable<varType>(value_);
117 std::map<std::string,int>::const_iterator it =
colDict_->find(col);
119 throw std::runtime_error (
"Column " + col +
"not found in table " +
tableId_);
123 std::ostringstream tempStr;
124 tempStr <<
"l1t::Setting::getRowValue\tReturning value " << convertVariable<varType>(
row_->at(it->second)) <<
" from table " <<
tableId_ <<
" and row " << this->
getRowAsStr() << std::endl;
127 return convertVariable<varType>(
row_->at(it->second));
std::shared_ptr< std::map< std::string, int > > colDict_
std::shared_ptr< std::vector< std::string > > types_
static unsigned int getId(void)
std::shared_ptr< std::vector< std::string > > row_
void setId(const std::string &id)
void setLogStringVar(std::string *strVar)
void setRowTypes(const std::vector< std::string > &types)
bool setValue(Container &, const reco::JetBaseRef &, const JetExtendedData &)
associate jet with value. Returns false and associate nothing if jet is already associated ...
std::vector< TableRow > getTableRows()
varType getRowValue(const std::string &col)
std::vector< std::string > str2VecStr_(const std::string &aStr, const std::string &delim)
void setProcRole(const std::string &procRole)
std::string getRowAsStr()
std::string getValueAsStr()
std::vector< std::string > getRow()
std::vector< varType > getVector()
std::string getProcRole()
std::shared_ptr< std::vector< std::string > > columns_
std::vector< TableRow > TableRows_
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
void setRowColumns(const std::vector< std::string > &columns)
void setLogStringVar(std::string *strVar)
std::vector< std::string > getColumnNames()
void setTableId(const std::string &id)