CMS 3D CMS Logo

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

#include <L1GtVhdlWriter.h>

Inheritance diagram for L1GtVhdlWriter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
 L1GtVhdlWriter (const edm::ParameterSet &)
 constructor More...
 
virtual ~L1GtVhdlWriter ()
 destructor More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::string outputDir_
 output directory More...
 
std::string vhdlDir_
 templates directory More...
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: write VHDL templates for the L1 GT.

Implementation: <TODO: enter implementation details>

Author
: Philipp Wagner

Definition at line 38 of file L1GtVhdlWriter.h.

Constructor & Destructor Documentation

L1GtVhdlWriter::L1GtVhdlWriter ( const edm::ParameterSet parSet)
explicit

constructor

Definition at line 42 of file L1GtVhdlWriter.cc.

References edm::ParameterSet::getParameter(), outputDir_, AlCaHLTBitMon_QueryRunRegistry::string, and vhdlDir_.

43 {
44 
45  // directory in /data for the VHDL templates
46  vhdlDir_ = parSet.getParameter<std::string>("VhdlTemplatesDir");
47  outputDir_ = parSet.getParameter<std::string>("OutputDir");
48 
49  if (vhdlDir_[vhdlDir_.length()-1]!= '/')
50  vhdlDir_+="/";
51  if (outputDir_[outputDir_.length()-1]!= '/')
52  outputDir_+="/";
53 
54  // // def.xml file
55  // std::string defXmlFileName = parSet.getParameter<std::string>("DefXmlFile");
56  //
57  // edm::FileInPath f1("L1TriggerConfig/L1GtConfigProducers/data/" +
58  // vhdlDir + "/" + defXmlFileName);
59  //
60  // m_defXmlFile = f1.fullPath();
61 
62  edm::LogInfo("L1GtConfigProducers") << "\n\nL1 GT VHDL directory: "
63  << vhdlDir_ << "\n\n" << std::endl;
64 
65 }
T getParameter(std::string const &) const
std::string outputDir_
output directory
std::string vhdlDir_
templates directory
L1GtVhdlWriter::~L1GtVhdlWriter ( )
virtual

destructor

Definition at line 68 of file L1GtVhdlWriter.cc.

69 {
70  // empty
71 }

Member Function Documentation

void L1GtVhdlWriter::analyze ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 74 of file L1GtVhdlWriter.cc.

References L1GtVhdlWriterCore::buildCommonHeader(), gather_cfg::cout, edm::EventSetup::get(), L1GtVhdlWriterCore::getCond2IntMap(), L1GtVhdlWriterCore::makeFirmware(), eostools::mkdir(), outputDir_, L1GtVhdlWriterCore::retrunCommonHeader(), AlCaHLTBitMon_QueryRunRegistry::string, vhdlDir_, and L1GtVmeWriterCore::writeVME().

76 {
77 
79  evSetup.get< L1GtTriggerMenuRcd >().get(l1GtMenu) ;
80 
81  std::vector<ConditionMap> conditionMap = l1GtMenu->gtConditionMap();
82  AlgorithmMap algorithmMap = l1GtMenu->gtAlgorithmMap();
83 
84  // print with various level of verbosities
85  int printVerbosity = 0;
86  l1GtMenu->print(std::cout, printVerbosity);
87 
88  //---------------------Here the VHDL files will be created---------------------------------------
89 
90  // information that will be delivered by the parser in future
91  std::map<std::string,std::string> headerParameters;
92  std::vector<std::string> channelVector;
93 
94  headerParameters["vhdl_path"]="/vhdllibrarypath";
95  headerParameters["designer_date"]="20.05.1986";
96  headerParameters["designer_name"]="Philipp Wagner";
97  headerParameters["version"]="2.0";
98  headerParameters["designer_comments"]="produced in CMSSW";
99  headerParameters["gtl_setup_name"]="L1Menu2007NovGR";
100 
101  channelVector.push_back("-- ca1: ieg");
102  channelVector.push_back("-- ca2: eg");
103  channelVector.push_back("-- ca3: jet");
104  channelVector.push_back("-- ca4: fwdjet");
105  channelVector.push_back("-- ca5: tau");
106  channelVector.push_back("-- ca6: esums");
107  channelVector.push_back("-- ca7: jet_cnts");
108  channelVector.push_back("-- ca8: free");
109  channelVector.push_back("-- ca9: free");
110  channelVector.push_back("-- ca10: free");
111 
112  // check, weather output directory exists and create it on the fly if not
113  if (boost::filesystem::is_directory(outputDir_))
114  {
115  std::cout<<std::endl<<"Ok - Output directory exists!"<<std::endl;
116  } else
117  {
118  if (!mkdir(outputDir_.c_str(), 0666))
119  std::cout<<std::endl<<"Directory: "<<outputDir_<<" has been created!"<<std::endl;
120  else
121  std::cout<<std::endl<<"Error while creating directory: "<<outputDir_<<" !"<<std::endl;
122  }
123 
124  // prepare a core with common header
125  L1GtVhdlWriterCore vhdlWriter(vhdlDir_, outputDir_, true);
126  vhdlWriter.buildCommonHeader(headerParameters, channelVector);
127  // write the firmware
128  if (vhdlWriter.makeFirmware(conditionMap, algorithmMap))
129  {
130  std::cout << std::endl << std::endl
131  <<"*********************** I'm ready ;-) **************************"
132  <<std::endl <<std::endl
133  <<"You can find the firmware in dircetory: " <<outputDir_
134  <<std::endl <<std::endl
135  <<"******************************************************************"
136  <<std::endl;
137  }
138 
139  // Create the VME - XML
140  std::string vmeFile = "vme.xml";
141 
142  L1GtVmeWriterCore vmeWriter(outputDir_, vmeFile);
143  vmeWriter.writeVME(conditionMap, vhdlWriter.getCond2IntMap(),
144  vhdlWriter.retrunCommonHeader());
145 }
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
std::string outputDir_
output directory
std::string vhdlDir_
templates directory
const T & get() const
Definition: EventSetup.h:55
def mkdir
Definition: eostools.py:248
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::string L1GtVhdlWriter::outputDir_
private
std::string L1GtVhdlWriter::vhdlDir_
private

templates directory

Definition at line 54 of file L1GtVhdlWriter.h.

Referenced by analyze(), and L1GtVhdlWriter().