CMS 3D CMS Logo

L1GtVhdlWriter Class Reference

Description: write VHDL templates for the L1 GT. More...

#include <L1TriggerConfig/L1GtConfigProducers/interface/L1GtVhdlWriter.h>

Inheritance diagram for L1GtVhdlWriter:

edm::EDAnalyzer

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 L1GtVhdlWriter (const edm::ParameterSet &)
 constructor
virtual ~L1GtVhdlWriter ()
 destructor

Private Attributes

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


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 lat::endl(), edm::ParameterSet::getParameter(), outputDir_, and vhdlDir_.

00045 {
00046 
00047     // directory in /data for the VHDL templates
00048     vhdlDir_ = parSet.getParameter<std::string>("VhdlTemplatesDir");
00049     outputDir_ = parSet.getParameter<std::string>("OutputDir");
00050 
00051     if (vhdlDir_[vhdlDir_.length()-1]!= '/')
00052         vhdlDir_+="/";
00053     if (outputDir_[outputDir_.length()-1]!= '/')
00054         outputDir_+="/";
00055 
00056     //    // def.xml file
00057     //    std::string defXmlFileName = parSet.getParameter<std::string>("DefXmlFile");
00058     //
00059     //    edm::FileInPath f1("L1TriggerConfig/L1GtConfigProducers/data/" +
00060     //                       vhdlDir + "/" + defXmlFileName);
00061     //
00062     //    m_defXmlFile = f1.fullPath();
00063 
00064     edm::LogInfo("L1GtConfigProducers") << "\n\nL1 GT VHDL directory: "
00065             << vhdlDir_ << "\n\n" << std::endl;
00066 
00067 }

L1GtVhdlWriter::~L1GtVhdlWriter (  )  [virtual]

destructor

Definition at line 70 of file L1GtVhdlWriter.cc.

00071 {
00072     // empty
00073 }


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(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::EventSetup::get(), L1GtVhdlWriterCore::getCond2IntMap(), L1GtVhdlWriterCore::makeFirmware(), outputDir_, L1GtVhdlWriterCore::retrunCommonHeader(), vhdlDir_, and L1GtVmeWriterCore::writeVME().

00078 {
00079 
00080     edm::ESHandle< L1GtTriggerMenu > l1GtMenu;
00081     evSetup.get< L1GtTriggerMenuRcd >().get(l1GtMenu) ;
00082 
00083     std::vector<ConditionMap> conditionMap = l1GtMenu->gtConditionMap();
00084     AlgorithmMap algorithmMap = l1GtMenu->gtAlgorithmMap();
00085 
00086     // print with various level of verbosities
00087     int printVerbosity = 0;
00088     l1GtMenu->print(std::cout, printVerbosity);
00089 
00090     //---------------------Here the VHDL files will be created---------------------------------------
00091 
00092     // information that will be delivered by the parser in future
00093     std::map<std::string,std::string> headerParameters;
00094     std::vector<std::string> channelVector;
00095 
00096     headerParameters["vhdl_path"]="/vhdllibrarypath";
00097     headerParameters["designer_date"]="20.05.1986";
00098     headerParameters["designer_name"]="Philipp Wagner";
00099     headerParameters["version"]="2.0";
00100     headerParameters["designer_comments"]="produced in CMSSW";
00101     headerParameters["gtl_setup_name"]="L1Menu2007NovGR";
00102 
00103     channelVector.push_back("-- ca1: ieg");
00104     channelVector.push_back("-- ca2: eg");
00105     channelVector.push_back("-- ca3: jet");
00106     channelVector.push_back("-- ca4: fwdjet");
00107     channelVector.push_back("-- ca5: tau");
00108     channelVector.push_back("-- ca6: esums");
00109     channelVector.push_back("-- ca7: jet_cnts");
00110     channelVector.push_back("-- ca8: free");
00111     channelVector.push_back("-- ca9: free");
00112     channelVector.push_back("-- ca10: free");
00113     
00114     // check, weather output directory exists and create it on the fly if not
00115     if (boost::filesystem::is_directory(outputDir_))
00116     {
00117         std::cout<<std::endl<<"Ok - Output directory exists!"<<std::endl;
00118     } else
00119     {
00120         if (!mkdir(outputDir_.c_str(), 0666))
00121             std::cout<<std::endl<<"Directory: "<<outputDir_<<" has been created!"<<std::endl;
00122         else 
00123             std::cout<<std::endl<<"Error while creating directory: "<<outputDir_<<" !"<<std::endl;
00124     }
00125     
00126     // prepare a core with common header
00127     L1GtVhdlWriterCore vhdlWriter(vhdlDir_, outputDir_, true);
00128     vhdlWriter.buildCommonHeader(headerParameters, channelVector);
00129     // write the firmware
00130     if (vhdlWriter.makeFirmware(conditionMap, algorithmMap))
00131     {
00132         std::cout << std::endl << std::endl
00133                 <<"***********************   I'm ready ;-) **************************"
00134                 <<std::endl <<std::endl
00135                 <<"You can find the firmware in dircetory: " <<outputDir_
00136                 <<std::endl <<std::endl
00137                 <<"******************************************************************"
00138                 <<std::endl;
00139     }
00140 
00141     // Create the VME - XML
00142     std::string vmeFile = "vme.xml";
00143 
00144     L1GtVmeWriterCore vmeWriter(outputDir_, vmeFile);
00145     vmeWriter.writeVME(conditionMap, vhdlWriter.getCond2IntMap(),
00146             vhdlWriter.retrunCommonHeader());
00147 }


Member Data Documentation

std::string L1GtVhdlWriter::outputDir_ [private]

output directory

Definition at line 59 of file L1GtVhdlWriter.h.

Referenced by analyze(), and L1GtVhdlWriter().

std::string L1GtVhdlWriter::vhdlDir_ [private]

templates directory

Definition at line 56 of file L1GtVhdlWriter.h.

Referenced by analyze(), and L1GtVhdlWriter().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:46 2009 for CMSSW by  doxygen 1.5.4