Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:49

0001 #ifndef DataFormats_L1GlobalTrigger_L1GtTriggerMenuLite_h
0002 #define DataFormats_L1GlobalTrigger_L1GtTriggerMenuLite_h
0003 
0004 /**
0005  * \class L1GtTriggerMenuLite
0006  *
0007  *
0008  * Description: L1 trigger menu and masks, lite version not using event setup.
0009  *
0010  * Implementation:
0011  *    This is the lite version of the L1 trigger menu, with trigger masks included,
0012  *    to be used in the environments not having access to event setup. It offers
0013  *    limited access to the full L1 trigger menu which is implemented as event setup
0014  *    (CondFormats/L1TObjects/interface/L1GtTriggerMenu.h). The masks are provided for
0015  *    the physics partition only.
0016  *
0017  *    An EDM product is created and saved in the Run Data, under the assumption that the
0018  *    menu remains the same in a run.
0019  *    The corresponding producer will read the full L1 trigger menu and the trigger masks
0020  *    from event setup, fill the corresponding members and save it as EDM product.
0021  *
0022  * \author: Vasile Mihai Ghete - HEPHY Vienna
0023  *
0024  *
0025  */
0026 
0027 // system include files
0028 #include <string>
0029 #include <vector>
0030 #include <map>
0031 
0032 #include <iosfwd>
0033 
0034 // user include files
0035 
0036 // forward declarations
0037 
0038 // class declaration
0039 class L1GtTriggerMenuLite {
0040 public:
0041   /// map containing the physics algorithms or the technical triggers
0042   typedef std::map<unsigned int, std::string> L1TriggerMap;
0043 
0044   /// iterators through map containing the physics algorithms or the technical triggers
0045   typedef L1TriggerMap::const_iterator CItL1Trig;
0046   typedef L1TriggerMap::iterator ItL1Trig;
0047 
0048 public:
0049   /// constructor
0050   L1GtTriggerMenuLite();
0051 
0052   L1GtTriggerMenuLite(const std::string&,
0053                       const L1TriggerMap&,
0054                       const L1TriggerMap&,
0055                       const L1TriggerMap&,
0056                       const std::vector<unsigned int>&,
0057                       const std::vector<unsigned int>&,
0058                       const std::vector<std::vector<int> >&,
0059                       const std::vector<std::vector<int> >&);
0060 
0061   /// copy constructor
0062   L1GtTriggerMenuLite(const L1GtTriggerMenuLite&);
0063 
0064   // destructor
0065   virtual ~L1GtTriggerMenuLite();
0066 
0067   /// assignment operator
0068   L1GtTriggerMenuLite& operator=(const L1GtTriggerMenuLite&);
0069 
0070   /// equal operator
0071   bool operator==(const L1GtTriggerMenuLite&) const;
0072 
0073   /// unequal operator
0074   bool operator!=(const L1GtTriggerMenuLite&) const;
0075 
0076   /// merge rule: test on isProductEqual
0077   bool isProductEqual(const L1GtTriggerMenuLite&) const;
0078 
0079 public:
0080   /// get / set the trigger menu names
0081   inline const std::string& gtTriggerMenuInterface() const { return m_triggerMenuInterface; }
0082 
0083   void setGtTriggerMenuInterface(const std::string&);
0084 
0085   //
0086   inline const std::string& gtTriggerMenuName() const { return m_triggerMenuName; }
0087 
0088   void setGtTriggerMenuName(const std::string&);
0089 
0090   //
0091   inline const std::string& gtTriggerMenuImplementation() const { return m_triggerMenuImplementation; }
0092 
0093   void setGtTriggerMenuImplementation(const std::string&);
0094 
0095   /// menu associated scale key
0096   inline const std::string& gtScaleDbKey() const { return m_scaleDbKey; }
0097 
0098   void setGtScaleDbKey(const std::string&);
0099 
0100   /// get / set the algorithm map (by name)
0101   inline const L1TriggerMap& gtAlgorithmMap() const { return m_algorithmMap; }
0102 
0103   void setGtAlgorithmMap(const L1TriggerMap&);
0104 
0105   /// get / set the algorithm map (by alias)
0106   inline const L1TriggerMap& gtAlgorithmAliasMap() const { return m_algorithmAliasMap; }
0107 
0108   void setGtAlgorithmAliasMap(const L1TriggerMap&);
0109 
0110   /// get / set the technical trigger map
0111   inline const L1TriggerMap& gtTechnicalTriggerMap() const { return m_technicalTriggerMap; }
0112 
0113   void setGtTechnicalTriggerMap(const L1TriggerMap&);
0114 
0115   /// get the trigger mask for physics algorithms
0116   inline const std::vector<unsigned int>& gtTriggerMaskAlgoTrig() const { return m_triggerMaskAlgoTrig; }
0117 
0118   /// set the trigger mask for physics algorithms
0119   void setGtTriggerMaskAlgoTrig(const std::vector<unsigned int>&);
0120 
0121   /// get the trigger mask for technical triggers
0122   inline const std::vector<unsigned int>& gtTriggerMaskTechTrig() const { return m_triggerMaskTechTrig; }
0123 
0124   /// set the trigger mask for technical triggers
0125   void setGtTriggerMaskTechTrig(const std::vector<unsigned int>&);
0126 
0127   /// get the prescale factors by reference / set the prescale factors
0128   inline const std::vector<std::vector<int> >& gtPrescaleFactorsAlgoTrig() const { return m_prescaleFactorsAlgoTrig; }
0129 
0130   void setGtPrescaleFactorsAlgoTrig(const std::vector<std::vector<int> >&);
0131 
0132   inline const std::vector<std::vector<int> >& gtPrescaleFactorsTechTrig() const { return m_prescaleFactorsTechTrig; }
0133 
0134   void setGtPrescaleFactorsTechTrig(const std::vector<std::vector<int> >&);
0135 
0136   /// print the trigger menu
0137   /// allow various verbosity levels
0138   void print(std::ostream&, int&) const;
0139 
0140   /// output stream operator
0141   friend std::ostream& operator<<(std::ostream&, const L1GtTriggerMenuLite&);
0142 
0143 public:
0144   /// get the alias for a physics algorithm with a given bit number
0145   const std::string* gtAlgorithmAlias(const unsigned int bitNumber, int& errorCode) const;
0146 
0147   /// get the name for a physics algorithm or a technical trigger
0148   /// with a given bit number
0149   const std::string* gtAlgorithmName(const unsigned int bitNumber, int& errorCode) const;
0150   const std::string* gtTechTrigName(const unsigned int bitNumber, int& errorCode) const;
0151 
0152   /// get the bit number for a physics algorithm or a technical trigger
0153   /// with a given name or alias
0154   const unsigned int gtBitNumber(const std::string& trigName, int& errorCode) const;
0155 
0156   /// get the result for a physics algorithm or a technical trigger with name trigName
0157   /// use directly the format of decisionWord (no typedef)
0158   const bool gtTriggerResult(const std::string& trigName, const std::vector<bool>& decWord, int& errorCode) const;
0159 
0160 private:
0161   /// menu names
0162   std::string m_triggerMenuInterface;
0163   std::string m_triggerMenuName;
0164   std::string m_triggerMenuImplementation;
0165 
0166   /// menu associated scale key
0167   std::string m_scaleDbKey;
0168 
0169   /// map containing the physics algorithms (by name)
0170   L1TriggerMap m_algorithmMap;
0171 
0172   /// map containing the physics algorithms (by alias)
0173   L1TriggerMap m_algorithmAliasMap;
0174 
0175   /// map containing the technical triggers
0176   L1TriggerMap m_technicalTriggerMap;
0177 
0178   /// trigger mask for physics algorithms
0179   std::vector<unsigned int> m_triggerMaskAlgoTrig;
0180 
0181   /// trigger mask for technical triggers
0182   std::vector<unsigned int> m_triggerMaskTechTrig;
0183 
0184   /// prescale factors
0185   std::vector<std::vector<int> > m_prescaleFactorsAlgoTrig;
0186   std::vector<std::vector<int> > m_prescaleFactorsTechTrig;
0187 };
0188 
0189 #endif /*DataFormats_L1GlobalTrigger_L1GtTriggerMenuLite_h*/