CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1GtVhdlWriter Class Reference

#include <L1GtVhdlWriter.h>

Inheritance diagram for L1GtVhdlWriter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 L1GtVhdlWriter (const edm::ParameterSet &)
 constructor More...
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcdmenuToken_
 
std::string outputDir_
 output directory More...
 
std::string vhdlDir_
 templates directory More...
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: write VHDL templates for the L1 GT.

Implementation: <TODO: enter implementation details>

Author
: Philipp Wagner

Definition at line 41 of file L1GtVhdlWriter.h.

Constructor & Destructor Documentation

◆ L1GtVhdlWriter()

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

constructor

Definition at line 37 of file L1GtVhdlWriter.cc.

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

37  {
38  // directory in /data for the VHDL templates
39  vhdlDir_ = parSet.getParameter<std::string>("VhdlTemplatesDir");
40  outputDir_ = parSet.getParameter<std::string>("OutputDir");
42 
43  if (vhdlDir_[vhdlDir_.length() - 1] != '/')
44  vhdlDir_ += "/";
45  if (outputDir_[outputDir_.length() - 1] != '/')
46  outputDir_ += "/";
47 
48  // // def.xml file
49  // std::string defXmlFileName = parSet.getParameter<std::string>("DefXmlFile");
50  //
51  // edm::FileInPath f1("L1TriggerConfig/L1GtConfigProducers/data/" +
52  // vhdlDir + "/" + defXmlFileName);
53  //
54  // m_defXmlFile = f1.fullPath();
55 
56  edm::LogInfo("L1GtConfigProducers") << "\n\nL1 GT VHDL directory: " << vhdlDir_ << "\n\n" << std::endl;
57 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string outputDir_
output directory
std::string vhdlDir_
templates directory
Log< level::Info, false > LogInfo
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > menuToken_

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 60 of file L1GtVhdlWriter.cc.

References L1GtVhdlWriterCore::buildCommonHeader(), gather_cfg::cout, L1GtVhdlWriterCore::getCond2IntMap(), edm::EventSetup::getHandle(), L1GtTriggerMenu::gtAlgorithmMap(), L1GtTriggerMenu::gtConditionMap(), L1GtVhdlWriterCore::makeFirmware(), menuToken_, eostools::mkdir(), outputDir_, L1GtTriggerMenu::print(), L1GtVhdlWriterCore::retrunCommonHeader(), AlCaHLTBitMon_QueryRunRegistry::string, vhdlDir_, and L1GtVmeWriterCore::writeVME().

60  {
62 
63  std::vector<ConditionMap> const& conditionMap = l1GtMenu->gtConditionMap();
64  AlgorithmMap const& algorithmMap = l1GtMenu->gtAlgorithmMap();
65 
66  // print with various level of verbosities
67  int printVerbosity = 0;
68  l1GtMenu->print(std::cout, printVerbosity);
69 
70  //---------------------Here the VHDL files will be created---------------------------------------
71 
72  // information that will be delivered by the parser in future
73  std::map<std::string, std::string> headerParameters;
74  std::vector<std::string> channelVector;
75 
76  headerParameters["vhdl_path"] = "/vhdllibrarypath";
77  headerParameters["designer_date"] = "20.05.1986";
78  headerParameters["designer_name"] = "Philipp Wagner";
79  headerParameters["version"] = "2.0";
80  headerParameters["designer_comments"] = "produced in CMSSW";
81  headerParameters["gtl_setup_name"] = "L1Menu2007NovGR";
82 
83  channelVector.reserve(10);
84  channelVector.push_back("-- ca1: ieg");
85  channelVector.push_back("-- ca2: eg");
86  channelVector.push_back("-- ca3: jet");
87  channelVector.push_back("-- ca4: fwdjet");
88  channelVector.push_back("-- ca5: tau");
89  channelVector.push_back("-- ca6: esums");
90  channelVector.push_back("-- ca7: jet_cnts");
91  channelVector.push_back("-- ca8: free");
92  channelVector.push_back("-- ca9: free");
93  channelVector.push_back("-- ca10: free");
94 
95  // check, weather output directory exists and create it on the fly if not
96  if (std::filesystem::is_directory(outputDir_)) {
97  std::cout << std::endl << "Ok - Output directory exists!" << std::endl;
98  } else {
99  if (!mkdir(outputDir_.c_str(), 0666))
100  std::cout << std::endl << "Directory: " << outputDir_ << " has been created!" << std::endl;
101  else
102  std::cout << std::endl << "Error while creating directory: " << outputDir_ << " !" << std::endl;
103  }
104 
105  // prepare a core with common header
106  L1GtVhdlWriterCore vhdlWriter(vhdlDir_, outputDir_, true);
107  vhdlWriter.buildCommonHeader(headerParameters, channelVector);
108  // write the firmware
109  if (vhdlWriter.makeFirmware(conditionMap, algorithmMap)) {
110  std::cout << std::endl
111  << std::endl
112  << "*********************** I'm ready ;-) **************************" << std::endl
113  << std::endl
114  << "You can find the firmware in dircetory: " << outputDir_ << std::endl
115  << std::endl
116  << "******************************************************************" << std::endl;
117  }
118 
119  // Create the VME - XML
120  std::string vmeFile = "vme.xml";
121 
122  L1GtVmeWriterCore vmeWriter(outputDir_, vmeFile);
123  vmeWriter.writeVME(conditionMap, vhdlWriter.getCond2IntMap(), vhdlWriter.retrunCommonHeader());
124 }
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
std::string outputDir_
output directory
std::string vhdlDir_
templates directory
void print(std::ostream &, int &) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const std::vector< ConditionMap > & gtConditionMap() const
get / set / build the condition maps
def mkdir(path)
Definition: eostools.py:251
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > menuToken_

Member Data Documentation

◆ menuToken_

edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> L1GtVhdlWriter::menuToken_
private

Definition at line 55 of file L1GtVhdlWriter.h.

Referenced by analyze(), and L1GtVhdlWriter().

◆ outputDir_

std::string L1GtVhdlWriter::outputDir_
private

output directory

Definition at line 53 of file L1GtVhdlWriter.h.

Referenced by analyze(), L1GtVhdlWriter(), and batchmanager.BatchManager::PrepareJob().

◆ vhdlDir_

std::string L1GtVhdlWriter::vhdlDir_
private

templates directory

Definition at line 50 of file L1GtVhdlWriter.h.

Referenced by analyze(), and L1GtVhdlWriter().