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

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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: write VHDL templates for the L1 GT.

Implementation: <TODO: enter implementation details>

Author
: Philipp Wagner

$Date$ $Revision$

Definition at line 40 of file L1GtVhdlWriter.h.

Constructor & Destructor Documentation

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

constructor

Definition at line 44 of file L1GtVhdlWriter.cc.

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

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

destructor

Definition at line 70 of file L1GtVhdlWriter.cc.

71 {
72  // empty
73 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 76 of file L1GtVhdlWriter.cc.

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

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

Member Data Documentation

std::string L1GtVhdlWriter::outputDir_
private

output directory

Definition at line 59 of file L1GtVhdlWriter.h.

Referenced by analyze(), L1GtVhdlWriter(), and valtools.webpage::readCaptions().

std::string L1GtVhdlWriter::vhdlDir_
private

templates directory

Definition at line 56 of file L1GtVhdlWriter.h.

Referenced by analyze(), and L1GtVhdlWriter().