Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:07

0001 #ifndef L1GtConfigProducers_L1GtVmeWriterCore_h
0002 #define L1GtConfigProducers_L1GtVmeWriterCore_h
0003 
0004 /**
0005  * \class L1GtVmeWriterCore
0006  * 
0007  * 
0008  * Description: core class to write the VME xml file.  
0009  *
0010  * Implementation:
0011  *    Core class to write the VME xml file: L1GtVmeWriter is an EDM wrapper for this class.
0012  *    L1GtVmeWriterCore can also be used in L1 Trigger Supervisor framework,  with another 
0013  *    wrapper - it must be therefore EDM-framework free.
0014  *   
0015  * \author: Vasile Mihai Ghete - HEPHY Vienna
0016  * 
0017  *
0018  */
0019 
0020 // system include files
0021 #include <string>
0022 #include <vector>
0023 
0024 // user include files
0025 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtXmlParserTags.h"
0026 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtVhdlTemplateFile.h"
0027 
0028 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
0029 #include "CondFormats/L1TObjects/interface/L1GtFwd.h"
0030 
0031 // forward declarations
0032 
0033 // class declaration
0034 class L1GtVmeWriterCore : public L1GtXmlParserTags {
0035 public:
0036   /// constructor
0037   L1GtVmeWriterCore(const std::string &outputDir, const std::string &vmeXmlFile);
0038 
0039   /// destructor
0040   ~L1GtVmeWriterCore() override;
0041 
0042   void writeVME(const std::vector<ConditionMap> &conditionMap,
0043                 const std::map<std::string, int> &cond2intMap,
0044                 const L1GtVhdlTemplateFile &header,
0045                 const int spacesPerLevel = 2);
0046 
0047   /// opens a new xml tag
0048   std::string openTag(const std::string &tag);
0049 
0050   /// closes xml tag
0051   std::string closeTag(const std::string &tag);
0052 
0053   /// returns a string containing spaces dependant on level
0054   std::string spaces(const unsigned int &level);
0055 
0056   /// builds a address value block
0057   std::string vmeAddrValueBlock(const std::string &addr,
0058                                 const int &val,
0059                                 const int &spaceLevel,
0060                                 const bool setMsb = false);
0061 
0062   /// conversion algorithm for condition index to hex value
0063   /// used to calculate address values
0064   int condIndex2reg(const unsigned int &index);
0065 
0066   /// calculates address
0067   std::string calculateAddress(const L1GtObject &obj,
0068                                const L1GtConditionType &type,
0069                                const std::string &reg,
0070                                const int &index);
0071 
0072   /// calculates addresses for jets counts
0073   std::string calculateJetsAddress(const int &countIndex, const int &obj, const int &index);
0074 
0075 private:
0076   /// output directory
0077   std::string m_outputDir;
0078 
0079   /// output file
0080   std::string m_vmeXmlFile;
0081 
0082   std::map<L1GtObject, int> object2reg_;
0083 
0084   std::map<L1GtConditionType, int> type2reg_;
0085 
0086   std::map<std::string, int> reg2hex_;
0087 
0088   std::map<int, int> jetType2reg_;
0089 
0090   std::map<int, int> jetObj2reg_;
0091 
0092   int spacesPerLevel_;
0093 };
0094 
0095 #endif /*L1GtConfigProducers_L1GtVmeWriterCore_h*/