41 m_outputDir(outputDir), m_vmeXmlFile(vmeXmlFile)
80 reg2hex_[
"jet_cnt_threshold"]=0x0000000;
111 return (indexcp << 8);
121 std::bitset<24> bs(result);
123 std::ostringstream
buffer;
136 std::bitset<25> bs(result);
138 std::ostringstream
buffer;
147 return "<"+tag+
">\n";
152 return "</"+tag+
">\n";
156 const int &
val,
const int &spaceLevel,
const bool setMsb)
158 std::ostringstream
buffer;
160 std::bitset<8> bsVal(val);
166 <<
spaces(spaceLevel+1) << addr << std::endl
168 <<
spaces(spaceLevel+1) << bsVal <<std::endl
178 std::ostringstream
buffer;
190 const std::map<std::string,int>& _cond2intMap,
const L1GtVhdlTemplateFile& _header,
const int spacesPerLevel)
192 std::vector<ConditionMap> conditionMap = _conditionMap;
193 std::map<std::string,int> cond2intMap = _cond2intMap;
210 header.
substitute(
"vhdl_file_name", m_vmeXmlFile);
215 for (
unsigned int i = 0;
i< lines.size();
i++)
231 for (ConditionMap::iterator iterCond = conditionMap.at(
index-1).begin(); iterCond != conditionMap.at(
index-1).end(); iterCond++)
237 << maps.
type2str(iterCond->second->condType())<<
"\">" 240 switch ((iterCond->second)->condCategory())
248 const std::vector<L1GtMuonTemplate::ObjectParameter>* op =
252 unsigned int nObjects = iterCond->second->nrObjects();
254 for (
unsigned int i =0;
i<nObjects;
i++)
262 cond2intMap[iterCond->first]);
271 cond2intMap[iterCond->first]);
279 +opi), cond2intMap[iterCond->first]);
295 cond2intMap[iterCond->first]);
308 const std::vector<L1GtCaloTemplate::ObjectParameter>* op =
312 unsigned int nObjects = iterCond->second->nrObjects();
314 for (
unsigned int i =0;
i<nObjects;
i++)
320 cond2intMap[iterCond->first]);
336 const std::vector<L1GtEnergySumTemplate::ObjectParameter>* op =
340 unsigned int nObjects = iterCond->second->nrObjects();
342 for (
unsigned int i =0;
i<nObjects;
i++)
349 cond2intMap[iterCond->first]);
365 const std::vector<L1GtJetCountsTemplate::ObjectParameter>* op =
372 int ci = (*op)[0].countIndex;
383 cond2intMap[iterCond->first]);
426 << m_vmeXmlFile <<
" written sucessfully! *******"<<std::endl;
std::string obj2str(const L1GtObject &type)
converts object type to firmware string
std::map< L1GtConditionType, int > type2reg_
std::string type2str(const L1GtConditionType &type)
converts a condition type to firmware string
bool substitute(const std::string &searchString, const std::string &replaceString)
replaces searchString with replaceString
const CorrelationParameter * correlationParameter() const
std::string m_outputDir
output directory
L1GtVmeWriterCore(const std::string &outputDir, const std::string &vmeXmlFile)
constructor
static std::string int2str(const int &integerValue)
converts a integer into a string
std::map< int, int > jetObj2reg_
void writeVME(const std::vector< ConditionMap > &conditionMap, const std::map< std::string, int > &cond2intMap, const L1GtVhdlTemplateFile &header, const int spacesPerLevel=2)
const std::vector< ObjectParameter > * objectParameter() const
const std::vector< ObjectParameter > * objectParameter() const
const std::vector< ObjectParameter > * objectParameter() const
std::string m_vmeXmlFile
output file
std::string closeTag(const std::string &tag)
closes xml tag
std::string calculateJetsAddress(const int &countIndex, const int &obj, const int &index)
calculates addresses for jets counts
std::map< int, int > jetType2reg_
std::string openTag(const std::string &tag)
opens a new xml tag
std::map< std::string, int > reg2hex_
std::vector< std::string > returnLines() const
returns a string vector with the current content of the VHDL File
std::string spaces(const unsigned int &level)
returns a string containing spaces dependant on level
~L1GtVmeWriterCore() override
destructor
std::map< L1GtObject, int > object2reg_
int condIndex2reg(const unsigned int &index)
const std::vector< ObjectParameter > * objectParameter() const
std::string vmeAddrValueBlock(const std::string &addr, const int &val, const int &spaceLevel, const bool setMsb=false)
builds a address value block
bool removeEmptyLines()
deletes all empty lines in a template file
std::string calculateAddress(const L1GtObject &obj, const L1GtConditionType &type, const std::string ®, const int &index)
calculates address