CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
L1GtVhdlWriterCore Class Reference

#include <L1GtVhdlWriterCore.h>

Inheritance diagram for L1GtVhdlWriterCore:
L1GtVhdlDefinitions

Public Member Functions

void addJetCountsToCond2IntMap (const int chip, const std::vector< ConditionMap > &conditionMap, std::map< std::string, int > &conditionToIntegerMap)
 
void buildCommonHeader (std::map< std::string, std::string > &headerParameters, const std::vector< std::string > &connectedChannels)
 builds the common header for all files More...
 
std::string buildDefValString (const int &conditionIndex, const std::vector< int > &values)
 
bool buildDefValuesBuffer (L1GtVhdlTemplateFile &buffer, const std::map< L1GtConditionType, std::string > &typeList, const std::vector< std::string > &defValuesList, const L1GtObject &object)
 
std::string chip2OutputSubDir (const int &chip)
 
void countCondsAndAdd2NumberVec (const L1GtConditionType &type, const L1GtConditionCategory &category, const L1GtObject &object, const ConditionMap &map, ConditionMap &outputMap, const int &condChip)
 
bool findObjectType (const L1GtObject &object, ConditionMap &map)
 
bool getCaloSetupContentFromTriggerMenu (const unsigned short int &condChip, std::map< std::string, std::string > &caloParameters, const L1GtObject &caloObject)
 
L1GtConditionCategory getCategoryFromObject (const L1GtObject &object)
 gets condition category from object More...
 
std::map< std::string, int > getCond2IntMap ()
 
bool getCondChipVhdContentFromTriggerMenu (const unsigned short int &condChip, std::map< std::string, L1GtVhdlTemplateFile > &templates, std::map< std::string, std::string > &commonParams)
 
std::string getDefValsFromTriggerMenu (const L1GtConditionType &type, const L1GtObject &object, const VmeRegister &reg)
 
bool getEsumsSetupContentFromTriggerMenu (const unsigned short int &condChip, const L1GtObject &object, std::string &energySumParameter)
 contains only one subsitution parameter which is stored in reference energySumParameter More...
 
bool getIntVal (const std::map< std::string, int > &map, const std::string &searchValue, int &intVal)
 checks weather value searchValue exists in a <string,int> map, saves it in &intVal if it exists and returns false if not More...
 
std::vector< std::string > getMsgBuf ()
 returns intern message buffer More...
 
void getMuonSetupContentFromTriggerMenu (const unsigned short int &condChip, std::map< std::string, std::string > &muonParameters)
 
bool getSubstParamCommonFromTriggerMenu (const unsigned short int &condChip, L1GtVhdlTemplateFile &particle, const L1GtObject &object, const L1GtConditionCategory &category, std::string &parameterStr)
 builds the parameters particle_common for the cond_chip.vhd's More...
 
std::string gtTemplatesPath ()
 returns the templates path More...
 
std::string index4CondChipVhd (int intval)
 
void initializeDeltaConditions ()
 
 L1GtVhdlWriterCore (const std::string &templatesDirectory, const std::string &outputDirectory, const bool &debug)
 constructor More...
 
bool makeFirmware (const std::vector< ConditionMap > &conditionMap, const AlgorithmMap &algorithmMap)
 produces the firmware code More...
 
void msg (const std::string &message)
 adds a string to intern message buffer More...
 
L1GtVhdlTemplateFile openVhdlFileWithCommonHeader (const std::string &filename, const std::string &outputFilename)
 opens a new template file and inserts the common header More...
 
void printCommonHeader ()
 prints the common header More...
 
void printConditionsOfCategory (const L1GtConditionCategory &category, const ConditionMap &map)
 for debuggin More...
 
bool processAlgorithmMap (std::vector< std::map< int, std::string > > &algoStrings)
 
std::string retNumberOfConditionsString (const std::string &typeStr, const int &number)
 
L1GtVhdlTemplateFile retrunCommonHeader ()
 returns the common header More...
 
bool returnConditionsOfOneClass (const L1GtConditionType &type, const L1GtConditionCategory &category, const L1GtObject &object, const ConditionMap &map, ConditionMap &outputMap)
 
std::string sp (const std::string &name)
 converts string name to substiution parameter synthax; name –> More...
 
void writeAlgoSetup (std::vector< std::map< int, std::string > > &algoStrings)
 builds the prealgo_and_or setup More...
 
void writeCond2intMap2File ()
 produces a control output file for condition to integer conversion More...
 
void writeCondChipPkg (const int &chip)
 
void writeConditionChipSetup (const std::map< std::string, L1GtVhdlTemplateFile > &templates, const std::map< std::string, std::string > &common, const unsigned short int &chip)
 builds cond_chip.vhds More...
 
void writeDefValPkg (const std::vector< ConditionMap > &conditionMap, const int &chip)
 writes def_val_pkg.vhd More...
 
void writeEtmSetup (std::string &etmString, const int &condChip)
 builds etm setup files More...
 
void writeMuonSetupVhdl (std::map< std::string, std::string > &muonParameters, const std::string &particle, unsigned short int &condChip)
 builds muon setup files More...
 
void writeQsfSetupFiles (const std::string &version)
 builds the two quartus setup files. This routine is called in buildCommonHeader! More...
 
 ~L1GtVhdlWriterCore ()
 destructor More...
 
- Public Member Functions inherited from L1GtVhdlDefinitions
const std::map< L1GtObject,
std::string > 
getCalo2IntMap ()
 
const std::map
< L1GtConditionType,
std::string > 
getCond2StrMap ()
 
const std::map< L1GtObject,
std::string > 
getObj2StrMap ()
 
 L1GtVhdlDefinitions ()
 constructor More...
 
std::string obj2str (const L1GtObject &type)
 converts object type to firmware string More...
 
std::string type2str (const L1GtConditionType &type)
 converts a condition type to firmware string More...
 
virtual ~L1GtVhdlDefinitions ()
 destructor More...
 

Static Public Member Functions

static std::string int2str (const int &integerValue)
 converts a integer into a string More...
 

Private Attributes

const AlgorithmMapalgorithmMap_
 algorithm map More...
 
L1GtVhdlWriterBitManager bm_
 bit manager for bit operations More...
 
std::vector< L1GtObjectcaloObjects_
 list of all possible calo objects More...
 
std::map< L1GtObject, std::string > caloType2Int_
 converts L1GtObject to calo_nr More...
 
L1GtVhdlTemplateFile commonHeader_
 common header for all files More...
 
const std::vector< ConditionMap > * conditionMap_
 condition map More...
 
std::map< std::string, int > conditionToIntegerMap_
 stores to condition name to integer conversion table More...
 
std::map< L1GtConditionType,
std::string > 
condType2Str_
 converts L1GtConditionType to firmware string More...
 
bool debugMode_
 class will produce some additional debugging output if set More...
 
std::vector< L1GtObjectesumObjects_
 list of all possible esums objects More...
 
std::vector< std::string > internMessageBuf_
 
std::vector< std::vector
< std::string > > 
numberOfConditions_
 vector containing the initialization of all conditions More...
 
std::map< L1GtObject, std::string > objType2Str_
 converts L1GtObject to string More...
 
std::string outputDir_
 output directory More...
 
std::string version_
 
std::string vhdlDir_
 templates directory More...
 

Additional Inherited Members

- Public Types inherited from L1GtVhdlDefinitions
enum  VmeRegister {
  RegPtHighThreshold, RegPtLowThreshold, RegQualityRange, RegChargeCorrelation,
  RegEtThreshold
}
 
- Static Protected Attributes inherited from L1GtVhdlDefinitions
static const std::string outputSubDir1_
 
static const std::string outputSubDir2_
 
static const std::string quartusSetupFileChip1_
 
static const std::string quartusSetupFileChip2_
 
static const std::string stringConstantAlgo_
 
static const std::string stringConstantCalo_
 
static const std::string stringConstantCharge1s_
 
static const std::string stringConstantCharge2s_
 
static const std::string stringConstantCharge2wsc_
 
static const std::string stringConstantCharge3s_
 
static const std::string stringConstantCharge4s_
 
static const std::string stringConstantCommon_
 
static const std::string stringConstantConstantNr_
 
static const std::string stringConstantDefValId_
 
static const std::string stringConstantEsumsHigh_
 
static const std::string stringConstantEsumsLHighDefVal_
 
static const std::string stringConstantEsumsLow_
 
static const std::string stringConstantEsumsLowDefVal_
 
static const std::string stringConstantJetCountsDefVal_
 
static const std::string stringConstantPth_
 
static const std::string stringConstantPtHighDefVal_
 
static const std::string stringConstantPtl_
 
static const std::string stringConstantPtLowDefVal_
 
static const std::string stringConstantQuality_
 
static const std::string stringConstantQualityDefVal_
 
static const std::string stringConstantQuargeDefVal_
 
static const std::string substParamAlgos_
 
static const std::string substParamCaloDefVals_
 
static const std::string substParamCaloOrMuon_
 
static const std::string substParamCharge_
 
static const std::string substParamContent_
 
static const std::string substParamDefValId_
 
static const std::string substParamDefValType_
 
static const std::string substParamEsumsDefVals_
 
static const std::string substParamJetCntsCommon_
 
static const std::string substParamJetsDefVals_
 
static const std::string substParamMaxNr_
 
static const std::string substParamMuonDefVals_
 
static const std::string substParamOthers_
 
static const std::string substParamParticle_
 
static const std::string substParamType_
 
static const std::string vhdlTemplateAlgoAndOr_
 
static const std::string vhdlTemplateCaloSetup_
 
static const std::string vhdlTemplateCondChip_
 
static const std::string vhdlTemplateCondChipPkg1_
 
static const std::string vhdlTemplateCondChipPkg2_
 
static const std::string vhdlTemplateDefValPkg_
 
static const std::string vhdlTemplateEtmSetup_
 
static const std::string vhdlTemplateMuonSetup_
 

Detailed Description

writes the actual VHDL code and stores global information like the common header. This class is using parameter maps containing the substitution parameters and their content.

Implementation: <TODO: enter implementation details>

Author
Philipp Wagner

Description: a class to deal with VHDL template files

Implementation: <TODO: enter implementation details>

Author
: Philipp Wagner

Definition at line 42 of file L1GtVhdlWriterCore.h.

Constructor & Destructor Documentation

L1GtVhdlWriterCore::L1GtVhdlWriterCore ( const std::string &  templatesDirectory,
const std::string &  outputDirectory,
const bool &  debug 
)

constructor

Definition at line 49 of file L1GtVhdlWriterCore.cc.

L1GtVhdlWriterCore::~L1GtVhdlWriterCore ( )

destructor

Definition at line 88 of file L1GtVhdlWriterCore.cc.

Member Function Documentation

void L1GtVhdlWriterCore::addJetCountsToCond2IntMap ( const int  chip,
const std::vector< ConditionMap > &  conditionMap,
std::map< std::string, int > &  conditionToIntegerMap 
)

calculates the integer value for jet counts conditions and furthermore counts how many jet counts of one type are in trigger menu

Definition at line 1377 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::buildCommonHeader ( std::map< std::string, std::string > &  headerParameters,
const std::vector< std::string > &  connectedChannels 
)

builds the common header for all files

Definition at line 1039 of file L1GtVhdlWriterCore.cc.

Referenced by L1GtVhdlWriter::analyze().

std::string L1GtVhdlWriterCore::buildDefValString ( const int &  conditionIndex,
const std::vector< int > &  values 
)

builds the string representing a condition in def_val_pkg.vhd. Parameters are condition index and a vector containig default values.

Definition at line 1474 of file L1GtVhdlWriterCore.cc.

bool L1GtVhdlWriterCore::buildDefValuesBuffer ( L1GtVhdlTemplateFile buffer,
const std::map< L1GtConditionType, std::string > &  typeList,
const std::vector< std::string > &  defValuesList,
const L1GtObject object 
)

helper, used by writeDefValPkg. Builds default values buffer for each object type. this buffer finally is inserte in the def_val_pkg.vhd template file

Definition at line 1661 of file L1GtVhdlWriterCore.cc.

std::string L1GtVhdlWriterCore::chip2OutputSubDir ( const int &  chip)

Definition at line 900 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::countCondsAndAdd2NumberVec ( const L1GtConditionType type,
const L1GtConditionCategory category,
const L1GtObject object,
const ConditionMap map,
ConditionMap outputMap,
const int &  condChip 
)

returns conditions of a class in output map and counts the occurance of all conditions of a certain type at the same time with the result being stored in numberOfConditions_ in the following format: CONSTANT nr_muon_3 : integer := 0; Tis is the format for the cond_chip_pkg files.

Definition at line 1766 of file L1GtVhdlWriterCore.cc.

bool L1GtVhdlWriterCore::findObjectType ( const L1GtObject object,
ConditionMap map 
)

Definition at line 116 of file L1GtVhdlWriterCore.cc.

bool L1GtVhdlWriterCore::getCaloSetupContentFromTriggerMenu ( const unsigned short int &  condChip,
std::map< std::string, std::string > &  caloParameters,
const L1GtObject caloObject 
)

Definition at line 316 of file L1GtVhdlWriterCore.cc.

L1GtConditionCategory L1GtVhdlWriterCore::getCategoryFromObject ( const L1GtObject object)

gets condition category from object

Definition at line 1833 of file L1GtVhdlWriterCore.cc.

std::map< std::string, int > L1GtVhdlWriterCore::getCond2IntMap ( )

Definition at line 1909 of file L1GtVhdlWriterCore.cc.

Referenced by L1GtVhdlWriter::analyze().

bool L1GtVhdlWriterCore::getCondChipVhdContentFromTriggerMenu ( const unsigned short int &  condChip,
std::map< std::string, L1GtVhdlTemplateFile > &  templates,
std::map< std::string, std::string > &  commonParams 
)

builds the substitution parameters for the cond_chip.vhd the condition chip that will be processed

Parameters
conditionToIntegerMapthis has to be a already FILLED conversion map. therefore this routine has to be called after all those which are adding information to the conditionToIntegerMap map (getMuonSetupContentFromTriggerMenu, buildCaloParameterMap...)
templatesin this map the final content for the subsitution parameters is stored in VHDL template file format

Definition at line 528 of file L1GtVhdlWriterCore.cc.

std::string L1GtVhdlWriterCore::getDefValsFromTriggerMenu ( const L1GtConditionType type,
const L1GtObject object,
const VmeRegister reg 
)

this routine extracts default values for def_val_pkg.vhd from trigger menu. it is used from buildDefValuesBuffer.

Definition at line 1482 of file L1GtVhdlWriterCore.cc.

bool L1GtVhdlWriterCore::getEsumsSetupContentFromTriggerMenu ( const unsigned short int &  condChip,
const L1GtObject object,
std::string &  energySumParameter 
)

contains only one subsitution parameter which is stored in reference energySumParameter

Definition at line 436 of file L1GtVhdlWriterCore.cc.

bool L1GtVhdlWriterCore::getIntVal ( const std::map< std::string, int > &  map,
const std::string &  searchValue,
int &  intVal 
)

checks weather value searchValue exists in a <string,int> map, saves it in &intVal if it exists and returns false if not

Definition at line 1361 of file L1GtVhdlWriterCore.cc.

std::vector< std::string > L1GtVhdlWriterCore::getMsgBuf ( )

returns intern message buffer

Definition at line 1356 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::getMuonSetupContentFromTriggerMenu ( const unsigned short int &  condChip,
std::map< std::string, std::string > &  muonParameters 
)

builds a parameter map that can be used by the L1GtVhdlWriterCore class the output is written into the parameter

Parameters
conditionToIntegerMapis the condition is added to this conversion map
muonParametershere the routine stores the content of the subsitution parameters
conditionMapcontaining the input

Definition at line 141 of file L1GtVhdlWriterCore.cc.

bool L1GtVhdlWriterCore::getSubstParamCommonFromTriggerMenu ( const unsigned short int &  condChip,
L1GtVhdlTemplateFile particle,
const L1GtObject object,
const L1GtConditionCategory category,
std::string &  parameterStr 
)

builds the parameters particle_common for the cond_chip.vhd's

Definition at line 482 of file L1GtVhdlWriterCore.cc.

std::string L1GtVhdlWriterCore::gtTemplatesPath ( )

returns the templates path

Definition at line 1026 of file L1GtVhdlWriterCore.cc.

std::string L1GtVhdlWriterCore::index4CondChipVhd ( int  intval)

builds the index for the cond_chip vhds. (They have to start at 1 so one has to be added to the value in conversion map)

Definition at line 1371 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::initializeDeltaConditions ( )

Definition at line 1788 of file L1GtVhdlWriterCore.cc.

std::string L1GtVhdlWriterCore::int2str ( const int &  integerValue)
static

converts a integer into a string

Definition at line 1031 of file L1GtVhdlWriterCore.cc.

bool L1GtVhdlWriterCore::makeFirmware ( const std::vector< ConditionMap > &  conditionMap,
const AlgorithmMap algorithmMap 
)

produces the firmware code

Definition at line 911 of file L1GtVhdlWriterCore.cc.

Referenced by L1GtVhdlWriter::analyze().

void L1GtVhdlWriterCore::msg ( const std::string &  message)

adds a string to intern message buffer

Definition at line 1351 of file L1GtVhdlWriterCore.cc.

L1GtVhdlTemplateFile L1GtVhdlWriterCore::openVhdlFileWithCommonHeader ( const std::string &  filename,
const std::string &  outputFilename 
)

opens a new template file and inserts the common header

Definition at line 1068 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::printCommonHeader ( )

prints the common header

Definition at line 1314 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::printConditionsOfCategory ( const L1GtConditionCategory category,
const ConditionMap map 
)

for debuggin

Definition at line 1858 of file L1GtVhdlWriterCore.cc.

bool L1GtVhdlWriterCore::processAlgorithmMap ( std::vector< std::map< int, std::string > > &  algoStrings)

processes algorithm map delivered by parser, replaces condition names by types and serial numbers, splits the map in a vector two seperate ones for the two condition chips

Definition at line 822 of file L1GtVhdlWriterCore.cc.

std::string L1GtVhdlWriterCore::retNumberOfConditionsString ( const std::string &  typeStr,
const int &  number 
)

Definition at line 1900 of file L1GtVhdlWriterCore.cc.

L1GtVhdlTemplateFile L1GtVhdlWriterCore::retrunCommonHeader ( )

returns the common header

Definition at line 1319 of file L1GtVhdlWriterCore.cc.

Referenced by L1GtVhdlWriter::analyze().

bool L1GtVhdlWriterCore::returnConditionsOfOneClass ( const L1GtConditionType type,
const L1GtConditionCategory category,
const L1GtObject object,
const ConditionMap map,
ConditionMap outputMap 
)

returns all condition of the same class. Conditions belong to one class if they are matching in type (Type1s, Type2s..) category (CondMuon, CondCalo,)and are defined for the same object (Mu, fwdJet..)

Parameters
mapis the ConditionMap that shall be filtered
conditionToIntegerMapis the condition is added to this conversion map
outputMaphere the conditions matching the requirements are stored

Definition at line 93 of file L1GtVhdlWriterCore.cc.

std::string L1GtVhdlWriterCore::sp ( const std::string &  name)

converts string name to substiution parameter synthax; name –>

Definition at line 1914 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::writeAlgoSetup ( std::vector< std::map< int, std::string > > &  algoStrings)

builds the prealgo_and_or setup

Definition at line 1247 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::writeCond2intMap2File ( )

produces a control output file for condition to integer conversion

Definition at line 1427 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::writeCondChipPkg ( const int &  chip)

Definition at line 1873 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::writeConditionChipSetup ( const std::map< std::string, L1GtVhdlTemplateFile > &  templates,
const std::map< std::string, std::string > &  common,
const unsigned short int &  chip 
)

builds cond_chip.vhds

Definition at line 1202 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::writeDefValPkg ( const std::vector< ConditionMap > &  conditionMap,
const int &  chip 
)

writes def_val_pkg.vhd

Definition at line 1530 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::writeEtmSetup ( std::string &  etmString,
const int &  condChip 
)

builds etm setup files

Definition at line 1283 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::writeMuonSetupVhdl ( std::map< std::string, std::string > &  muonParameters,
const std::string &  particle,
unsigned short int &  condChip 
)

builds muon setup files

Definition at line 1082 of file L1GtVhdlWriterCore.cc.

void L1GtVhdlWriterCore::writeQsfSetupFiles ( const std::string &  version)

builds the two quartus setup files. This routine is called in buildCommonHeader!

Definition at line 1324 of file L1GtVhdlWriterCore.cc.

Member Data Documentation

const AlgorithmMap* L1GtVhdlWriterCore::algorithmMap_
private

algorithm map

Definition at line 197 of file L1GtVhdlWriterCore.h.

L1GtVhdlWriterBitManager L1GtVhdlWriterCore::bm_
private

bit manager for bit operations

Definition at line 224 of file L1GtVhdlWriterCore.h.

std::vector<L1GtObject> L1GtVhdlWriterCore::caloObjects_
private

list of all possible calo objects

Definition at line 212 of file L1GtVhdlWriterCore.h.

std::map<L1GtObject,std::string> L1GtVhdlWriterCore::caloType2Int_
private

converts L1GtObject to calo_nr

Definition at line 206 of file L1GtVhdlWriterCore.h.

L1GtVhdlTemplateFile L1GtVhdlWriterCore::commonHeader_
private

common header for all files

Definition at line 229 of file L1GtVhdlWriterCore.h.

const std::vector<ConditionMap>* L1GtVhdlWriterCore::conditionMap_
private

condition map

Definition at line 194 of file L1GtVhdlWriterCore.h.

std::map<std::string,int> L1GtVhdlWriterCore::conditionToIntegerMap_
private

stores to condition name to integer conversion table

Definition at line 200 of file L1GtVhdlWriterCore.h.

std::map<L1GtConditionType,std::string> L1GtVhdlWriterCore::condType2Str_
private

converts L1GtConditionType to firmware string

Definition at line 203 of file L1GtVhdlWriterCore.h.

bool L1GtVhdlWriterCore::debugMode_
private

class will produce some additional debugging output if set

Definition at line 237 of file L1GtVhdlWriterCore.h.

std::vector<L1GtObject> L1GtVhdlWriterCore::esumObjects_
private

list of all possible esums objects

Definition at line 215 of file L1GtVhdlWriterCore.h.

std::vector<std::string> L1GtVhdlWriterCore::internMessageBuf_
private

Definition at line 231 of file L1GtVhdlWriterCore.h.

std::vector<std::vector<std::string> > L1GtVhdlWriterCore::numberOfConditions_
private

vector containing the initialization of all conditions

Definition at line 234 of file L1GtVhdlWriterCore.h.

std::map<L1GtObject,std::string> L1GtVhdlWriterCore::objType2Str_
private

converts L1GtObject to string

Definition at line 209 of file L1GtVhdlWriterCore.h.

std::string L1GtVhdlWriterCore::outputDir_
private

output directory

Definition at line 221 of file L1GtVhdlWriterCore.h.

std::string L1GtVhdlWriterCore::version_
private

Definition at line 226 of file L1GtVhdlWriterCore.h.

std::string L1GtVhdlWriterCore::vhdlDir_
private

templates directory

Definition at line 218 of file L1GtVhdlWriterCore.h.