Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:59

0001 #ifndef GlobalTrigger_L1GtEtaPhiConversions_h
0002 #define GlobalTrigger_L1GtEtaPhiConversions_h
0003 
0004 /**
0005  * \class L1GtEtaPhiConversions
0006  *
0007  *
0008  * Description: convert eta and phi between various L1 trigger objects.
0009  *
0010  * Implementation:
0011  *    <TODO: enter implementation details>
0012  *
0013  * \author: Vasile Mihai Ghete   - HEPHY Vienna
0014  *
0015  *
0016  */
0017 
0018 // system include files
0019 #include <cmath>
0020 #include <iostream>
0021 #include <utility>
0022 #include <vector>
0023 
0024 // user include files
0025 
0026 //   base class
0027 
0028 //
0029 #include "DataFormats/L1GlobalTrigger/interface/L1GtObject.h"
0030 
0031 // forward declarations
0032 class L1CaloGeometry;
0033 class L1MuTriggerScales;
0034 
0035 // class interface
0036 class L1GtEtaPhiConversions {
0037 public:
0038   /// constructor
0039   L1GtEtaPhiConversions();
0040 
0041   /// destructor
0042   virtual ~L1GtEtaPhiConversions();
0043 
0044 public:
0045   /// return the index of a pair in the vector m_gtObjectPairVec, to be used to
0046   /// extract the number of phi bins, the conversion of the indices, etc
0047   const unsigned int gtObjectPairIndex(const L1GtObject &, const L1GtObject &) const;
0048 
0049   /// convert the phi index initialIndex for an object from pair pairIndex, with
0050   /// position of object in pair positionPair to common scale for the L1GtObject
0051   /// pair converted index returned by reference method return true, if initial
0052   /// index within scale size otherwise (hardware error), return false
0053   const bool convertPhiIndex(const unsigned int pairIndex,
0054                              const unsigned int positionPair,
0055                              const unsigned int initialIndex,
0056                              unsigned int &convertedIndex) const;
0057 
0058   /// convert the eta index initialIndex for a L1GtObject object to common scale
0059   /// converted index returned by reference
0060   /// method return true, if initial index within scale size
0061   /// otherwise (hardware error), return false
0062   const bool convertEtaIndex(const L1GtObject &, const unsigned int initialIndex, unsigned int &convertedIndex) const;
0063 
0064   /// return the number of phi bins for a GT object
0065   const unsigned int gtObjectNrBinsPhi(const L1GtObject &) const;
0066 
0067   /// return the number of phi bins for a pair of GT objects, according to
0068   /// conversion rules
0069   const unsigned int gtObjectNrBinsPhi(const L1GtObject &, const L1GtObject &) const;
0070 
0071   /// return the number of phi bins for a pair of GT objects, according to
0072   /// conversion rules, when the index of the pair is used
0073   const unsigned int gtObjectNrBinsPhi(const unsigned int) const;
0074 
0075   /// perform all scale conversions
0076   void convertL1Scales(const L1CaloGeometry *, const L1MuTriggerScales *, const int, const int);
0077 
0078   inline void setVerbosity(const int verbosity) { m_verbosity = verbosity; }
0079 
0080   /// print all the performed conversions
0081   virtual void print(std::ostream &myCout) const;
0082 
0083 private:
0084   /// a bad index value, treated specially when performing the conversions or
0085   /// printing the conversion vectors
0086   static const unsigned int badIndex;
0087 
0088   ///
0089   static const double PiConversion;
0090 
0091   ///  convert phi from rad (-pi, pi] to deg (0, 360)
0092   const double rad2deg(const double &) const;
0093 
0094 private:
0095   /// vector of all L1GtObject pairs
0096   std::vector<std::pair<L1GtObject, L1GtObject>> m_gtObjectPairVec;
0097 
0098   /// decide which object to convert:
0099   /// if m_pairConvertPhiFirstGtObject true, convert pair.first and do not
0100   /// convert pair.second if m_pairConvertPhiFirstGtObject false, do not convert
0101   /// pair.first and convert pair.second
0102   std::vector<bool> m_pairConvertPhiFirstGtObject;
0103 
0104   /// number of phi bins for each L1GtObject pair in the scale used for that
0105   /// pair it is filled correlated with m_gtObjectPairVec, so the index of the
0106   /// pair in m_gtObjectPairVec is the index of the m_pairNrPhiBinsVec element
0107   /// containing the number of phi bins
0108   std::vector<const unsigned int *> m_pairNrPhiBinsVec;
0109 
0110   /// constant references to conversion LUT for a given L1GtObject pair
0111   /// it is filled correlated with m_gtObjectPairVec, so the index of the pair
0112   /// in m_gtObjectPairVec is the index of the m_pairPhiConvVec element
0113   /// containing the reference
0114   std::vector<const std::vector<unsigned int> *> m_pairPhiConvVec;
0115 
0116 private:
0117   /// pointer to calorimetry scales - updated in convertl1Scales method
0118   const L1CaloGeometry *m_l1CaloGeometry;
0119 
0120   /// pointer to muon scales - updated in convertl1Scales method
0121   const L1MuTriggerScales *m_l1MuTriggerScales;
0122 
0123 private:
0124   /// number of phi bins for muons
0125   unsigned int m_nrBinsPhiMu;
0126 
0127   /// number of phi bins for calorimeter objects (*Jet, *EG)
0128   unsigned int m_nrBinsPhiJetEg;
0129 
0130   /// number of phi bins for ETM
0131   unsigned int m_nrBinsPhiEtm;
0132 
0133   /// number of phi bins for HTM
0134   unsigned int m_nrBinsPhiHtm;
0135 
0136   /// number of eta bins for common scale
0137   unsigned int m_nrBinsEtaCommon;
0138 
0139 private:
0140   /// phi conversion for Mu to (*Jet, EG)
0141   std::vector<unsigned int> m_lutPhiMuToJetEg;
0142 
0143   /// phi conversion for Mu to ETM
0144   std::vector<unsigned int> m_lutPhiMuToEtm;
0145 
0146   /// phi conversion for Mu to HTM
0147   std::vector<unsigned int> m_lutPhiMuToHtm;
0148 
0149   /// phi conversion for ETM to (*Jet, EG)
0150   std::vector<unsigned int> m_lutPhiEtmToJetEg;
0151 
0152   /// phi conversion for ETM to HTM
0153   std::vector<unsigned int> m_lutPhiEtmToHtm;
0154 
0155   /// phi conversion for HTM to (*Jet, EG)
0156   std::vector<unsigned int> m_lutPhiHtmToJetEg;
0157 
0158   /// phi conversion for (*Jet, EG) to (*Jet, EG)
0159   /// return the same index as the input index, introduced only
0160   /// to simplify convertPhiIndex
0161   std::vector<unsigned int> m_lutPhiJetEgToJetEg;
0162 
0163 private:
0164   /// eta conversion of CenJet/TauJet & IsoEG/NoIsoEG
0165   /// to a common calorimeter eta scale
0166   std::vector<unsigned int> m_lutEtaCentralToCommonCalo;
0167 
0168   /// eta conversion of ForJet to the common calorimeter eta scale defined
0169   /// before
0170   std::vector<unsigned int> m_lutEtaForJetToCommonCalo;
0171 
0172   /// eta conversion of Mu to the common calorimeter eta scale defined before
0173   std::vector<unsigned int> m_lutEtaMuToCommonCalo;
0174 
0175 private:
0176   /// verbosity level
0177   int m_verbosity;
0178 
0179   /// cached edm::isDebugEnabled()
0180   bool m_isDebugEnabled;
0181 };
0182 
0183 #endif