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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const 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
 
bool wantsStreamRuns () const
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 40 of file L1GtVhdlWriter.cc.

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

40  {
41  // directory in /data for the VHDL templates
42  vhdlDir_ = parSet.getParameter<std::string>("VhdlTemplatesDir");
43  outputDir_ = parSet.getParameter<std::string>("OutputDir");
45 
46  if (vhdlDir_[vhdlDir_.length() - 1] != '/')
47  vhdlDir_ += "/";
48  if (outputDir_[outputDir_.length() - 1] != '/')
49  outputDir_ += "/";
50 
51  // // def.xml file
52  // std::string defXmlFileName = parSet.getParameter<std::string>("DefXmlFile");
53  //
54  // edm::FileInPath f1("L1TriggerConfig/L1GtConfigProducers/data/" +
55  // vhdlDir + "/" + defXmlFileName);
56  //
57  // m_defXmlFile = f1.fullPath();
58 
59  edm::LogInfo("L1GtConfigProducers") << "\n\nL1 GT VHDL directory: " << vhdlDir_ << "\n\n" << std::endl;
60 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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 63 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().

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