CMS 3D CMS Logo

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

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 L1GtVhdlWriter (const edm::ParameterSet &)
 constructor More...
 
 ~L1GtVhdlWriter () override
 destructor More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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::L1GtVhdlWriter ( const edm::ParameterSet parSet)
explicit

constructor

Definition at line 40 of file L1GtVhdlWriter.cc.

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

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

◆ ~L1GtVhdlWriter()

L1GtVhdlWriter::~L1GtVhdlWriter ( )
override

destructor

Definition at line 62 of file L1GtVhdlWriter.cc.

62  {
63  // empty
64 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 67 of file L1GtVhdlWriter.cc.

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

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

Member Data Documentation

◆ outputDir_

std::string L1GtVhdlWriter::outputDir_
private

◆ vhdlDir_

std::string L1GtVhdlWriter::vhdlDir_
private

templates directory

Definition at line 50 of file L1GtVhdlWriter.h.

Referenced by analyze(), and L1GtVhdlWriter().

L1GtVhdlWriter::vhdlDir_
std::string vhdlDir_
templates directory
Definition: L1GtVhdlWriter.h:50
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
L1GtTriggerMenuRcd
Definition: L1GtTriggerMenuRcd.h:32
AlgorithmMap
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
Definition: L1GtTriggerMenuFwd.h:31
edm::ESHandle
Definition: DTSurvey.h:22
eostools.mkdir
def mkdir(path)
Definition: eostools.py:251
L1GtTriggerMenu::print
void print(std::ostream &, int &) const
Definition: L1GtTriggerMenu.cc:454
L1GtVhdlWriter::outputDir_
std::string outputDir_
output directory
Definition: L1GtVhdlWriter.h:53
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
get
#define get
L1GtTriggerMenu::gtConditionMap
const std::vector< ConditionMap > & gtConditionMap() const
get / set / build the condition maps
Definition: L1GtTriggerMenu.h:80
L1GtVhdlWriterCore
Definition: L1GtVhdlWriterCore.h:42
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1GtVmeWriterCore
Definition: L1GtVmeWriterCore.h:34
L1GtTriggerMenu::gtAlgorithmMap
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
Definition: L1GtTriggerMenu.h:187