CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/L1Trigger/GlobalMuonTrigger/src/L1MuGMTReg.h

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   
00011 //
00012 //   $Date: 2009/12/18 21:21:57 $
00013 //   $Revision: 1.5 $
00014 //
00015 //   Author :
00016 //   H. Sakulin            HEPHY Vienna
00017 //
00018 //   Migrated to CMSSW:
00019 //   I. Mikulec
00020 //
00021 //--------------------------------------------------
00022 #ifndef L1TriggerGlobalMuonTrigger_L1MuGMTReg_h
00023 #define L1TriggerGlobalMuonTrigger_L1MuGMTReg_h
00024 
00025 //---------------
00026 // C++ Headers --
00027 //---------------
00028 
00029 #include <string>
00030 #include <vector>
00031 
00032 //-------------------------------
00033 // Collaborating Class Headers --
00034 //-------------------------------
00035 
00036 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00037 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
00038 #include "CondFormats/L1TObjects/interface/L1MuGMTParameters.h"
00039 
00040 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00041 
00042 //              ---------------------
00043 //              -- Class Interface --
00044 //              ---------------------
00045 
00046 
00047 class L1MuGMTReg {
00048 
00049  public:  
00051   L1MuGMTReg(int ninst = 2) : m_value(ninst, 0) { };
00052 
00054   virtual ~L1MuGMTReg() {};
00055 
00057   unsigned getValue(int idx) { return m_value[idx]; };
00058 
00060   unsigned getNumberOfInstances() { return m_value.size(); }
00061   
00063   virtual std::string getName() =0;
00064   
00065  protected:
00066   std::vector<unsigned> m_value;
00067 };
00068 
00069 //
00071 //
00073 //
00074 
00075 class L1MuGMTRegMMConfig : public L1MuGMTReg {
00076 
00077  public: 
00078   enum MergeMethods { takeDTCSC, takeRPC, byRank, byMinPt, byCombi, Special };
00079 
00081   L1MuGMTRegMMConfig(const std::string& param, MergeMethods def_brl, MergeMethods def_fwd) :
00082     m_param(param) { 
00083     m_default[0] = def_brl;
00084     m_default[1] = def_fwd;
00085     setMergeMethod(); 
00086   };
00087 
00089   virtual ~L1MuGMTRegMMConfig() {};
00090 
00092   virtual std::string getName() { return "MMConfig_" + m_param; };
00093 
00095   void setMergeMethod() {
00096     static MergeMethods avlMethods[6] = { takeDTCSC, takeRPC, byRank, byMinPt, byCombi, Special };
00097     std::string mn[6] = { "takeDT", "takeRPC", "byRank", "byMinPt", "byCombi", "Special" };
00098     
00099     MergeMethods mm;
00100     std::string mm_str;
00101 
00102     mm = m_default[0];
00103     if(m_param=="Phi")         mm_str = L1MuGMTConfig::getGMTParams()->getMergeMethodPhiBrl();
00104     else if(m_param=="Eta")    mm_str = L1MuGMTConfig::getGMTParams()->getMergeMethodEtaBrl();
00105     else if(m_param=="Pt")     mm_str = L1MuGMTConfig::getGMTParams()->getMergeMethodPtBrl();
00106     else if(m_param=="Charge") mm_str = L1MuGMTConfig::getGMTParams()->getMergeMethodChargeBrl();
00107     for(int ii=0; ii<6; ii++) if(mm_str == mn[ii]) {mm = avlMethods[ii]; break;}
00108     m_value[0] = 1 << (5-(int) MergeMethods(mm));
00109     if ( L1MuGMTConfig::Debug(1) ) edm::LogVerbatim("GMT_Register_Info") << " "
00110                       << "MergeMethod" << m_param << "Brl"
00111                       << " is " << mm
00112                       << "( value " << m_value[0] << " )";
00113     
00114     mm = m_default[1];
00115     mn[0] = "takeCSC";
00116     if(m_param=="Phi")         mm_str = L1MuGMTConfig::getGMTParams()->getMergeMethodPhiFwd();
00117     else if(m_param=="Eta")    mm_str = L1MuGMTConfig::getGMTParams()->getMergeMethodEtaFwd();
00118     else if(m_param=="Pt")     mm_str = L1MuGMTConfig::getGMTParams()->getMergeMethodPtFwd();
00119     else if(m_param=="Charge") mm_str = L1MuGMTConfig::getGMTParams()->getMergeMethodChargeFwd();
00120     for(int ii=0; ii<6; ii++) if(mm_str == mn[ii]) {mm = avlMethods[ii]; break;}
00121     m_value[1] = 1 << (5-(int) MergeMethods(mm));
00122     if ( L1MuGMTConfig::Debug(1) ) edm::LogVerbatim("GMT_Register_Info") << " "
00123                       << "MergeMethod" << m_param << "Fwd"
00124                       << " is " << mm
00125                       << "( value " << m_value[1] << " )";
00126     
00127     
00128   };
00129 
00130  protected:
00131   std::string m_param;
00132   MergeMethods m_default[2];
00133 } ;
00134 
00135 //
00137 //
00139  
00140 class L1MuGMTRegMMConfigPhi : public L1MuGMTRegMMConfig {
00141 public:
00142   L1MuGMTRegMMConfigPhi() : L1MuGMTRegMMConfig("Phi", L1MuGMTRegMMConfig::takeDTCSC, L1MuGMTRegMMConfig::takeDTCSC ) {};
00143 };
00144 
00145 //
00147 //
00149  
00150 class L1MuGMTRegMMConfigEta : public L1MuGMTRegMMConfig {
00151  public:
00152   L1MuGMTRegMMConfigEta() : L1MuGMTRegMMConfig("Eta", L1MuGMTRegMMConfig::Special, L1MuGMTRegMMConfig::Special ) {};
00153 };
00154 
00155 //
00157 //
00159  
00160 class L1MuGMTRegMMConfigPt : public L1MuGMTRegMMConfig {
00161  public:
00162   L1MuGMTRegMMConfigPt() : L1MuGMTRegMMConfig("Pt", L1MuGMTRegMMConfig::byMinPt, L1MuGMTRegMMConfig::byMinPt ) {};
00163 };
00164 
00165 //
00167 //
00169  
00170 class L1MuGMTRegMMConfigCharge : public L1MuGMTRegMMConfig {
00171  public:
00172   L1MuGMTRegMMConfigCharge() : L1MuGMTRegMMConfig("Charge", L1MuGMTRegMMConfig::takeDTCSC, L1MuGMTRegMMConfig::takeDTCSC ) {};
00173 };
00174 
00175 
00176 
00177 //
00179 //
00181 //
00182 
00183 class L1MuGMTRegMMConfigMIPISO : public L1MuGMTRegMMConfig {
00184 
00185  public: 
00187   L1MuGMTRegMMConfigMIPISO(const std::string& param, MergeMethods def_brl, MergeMethods def_fwd, bool def_and_brl, bool def_and_fwd) :
00188     L1MuGMTRegMMConfig(param, def_brl, def_fwd) { 
00189 
00190     bool doAND = false;
00191     
00192     if(m_param=="MIP")      doAND = L1MuGMTConfig::getGMTParams()->getMergeMethodMIPSpecialUseANDBrl();
00193     else if(m_param=="ISO") doAND = L1MuGMTConfig::getGMTParams()->getMergeMethodISOSpecialUseANDBrl();
00194     if(doAND) m_value[0] |= 64;
00195     if ( L1MuGMTConfig::Debug(1) ) edm::LogVerbatim("GMT_Register_Info") << " "
00196                       << "MergeMethod" << m_param  << "SpecialUseANDBrl"
00197                       << " is " << doAND;
00198 
00199     if(m_param=="MIP")      doAND = L1MuGMTConfig::getGMTParams()->getMergeMethodMIPSpecialUseANDFwd();
00200     else if(m_param=="ISO") doAND = L1MuGMTConfig::getGMTParams()->getMergeMethodISOSpecialUseANDFwd();
00201     if(doAND) m_value[1] |= 64;
00202     if ( L1MuGMTConfig::Debug(1) ) edm::LogVerbatim("GMT_Register_Info") << " "
00203                       << "MergeMethod" << m_param  << "SpecialUseANDFwd"
00204                       << " is " << doAND;
00205 
00206   };
00207 
00209   virtual ~L1MuGMTRegMMConfigMIPISO() {};
00210 } ;
00211 
00212 
00213 //
00215 //
00217  
00218 class L1MuGMTRegMMConfigMIP : public L1MuGMTRegMMConfigMIPISO {
00219  public:
00220   L1MuGMTRegMMConfigMIP() : L1MuGMTRegMMConfigMIPISO("MIP", L1MuGMTRegMMConfig::Special, L1MuGMTRegMMConfig::Special, false, false ) {};
00221 };
00222 
00223 //
00225 //
00227  
00228 class L1MuGMTRegMMConfigISO : public L1MuGMTRegMMConfigMIPISO {
00229  public:
00230   L1MuGMTRegMMConfigISO() : L1MuGMTRegMMConfigMIPISO("ISO", L1MuGMTRegMMConfig::Special, L1MuGMTRegMMConfig::Special, true, true ) {};
00231 };
00232 
00233 //
00235 //
00237 //
00238 
00239 class L1MuGMTRegMMConfigSRK : public L1MuGMTRegMMConfig {
00240 
00241  public: 
00243   L1MuGMTRegMMConfigSRK() : L1MuGMTRegMMConfig("SRK", L1MuGMTRegMMConfig::takeDTCSC, L1MuGMTRegMMConfig::takeDTCSC) { 
00244 
00245     bool haloOverwrites;
00246   
00247     haloOverwrites = L1MuGMTConfig::getGMTParams()->getHaloOverwritesMatchedBrl();
00248     if (haloOverwrites) m_value[0] |= 64;
00249     if ( L1MuGMTConfig::Debug(1) ) edm::LogVerbatim("GMT_Register_info") << " "
00250                       << "HaloOverwritesMatchedBrl"
00251                       << " is " << haloOverwrites;
00252 
00253     haloOverwrites = L1MuGMTConfig::getGMTParams()->getHaloOverwritesMatchedFwd();
00254     if (haloOverwrites) m_value[1] |= 64;
00255     if ( L1MuGMTConfig::Debug(1) ) edm::LogVerbatim("GMT_Register_info") << " "
00256                       << "HaloOverwritesMatchedFwd"
00257                       << " is " << haloOverwrites;
00258 
00259   };
00260 
00262   virtual ~L1MuGMTRegMMConfigSRK() {};
00263 } ;
00264 
00265 //
00267 //
00269 //
00270 
00271 class L1MuGMTRegSortRankOffset : public L1MuGMTReg {
00272 
00273  public: 
00275   L1MuGMTRegSortRankOffset() {
00276 
00277     m_value[0] = L1MuGMTConfig::getGMTParams()->getSortRankOffsetBrl();
00278     if ( L1MuGMTConfig::Debug(1) ) 
00279        edm::LogVerbatim("GMT_Register_info") << " SortRankOffsetBrl is " << m_value[0];
00280 
00281     m_value[1] = L1MuGMTConfig::getGMTParams()->getSortRankOffsetFwd();
00282     if ( L1MuGMTConfig::Debug(1) ) 
00283        edm::LogVerbatim("GMT_Register_info") << " SortRankOffsetFwd is " << m_value[1];
00284 
00285   };
00286 
00288   virtual std::string getName() { return "SortRankOffset"; };
00289 
00291   virtual ~L1MuGMTRegSortRankOffset() {};
00292 } ;
00293 
00294 //
00296 //
00298 //
00299 
00300 class L1MuGMTRegCDLConfig : public L1MuGMTReg {
00301 
00302  public: 
00304   L1MuGMTRegCDLConfig() : L1MuGMTReg(4) { 
00305     setCDLConfig(); 
00306   };
00307 
00309   virtual ~L1MuGMTRegCDLConfig() {};
00310 
00312   virtual std::string getName() { return std::string("CDLConfig"); };
00313 
00315   void setCDLConfig() {
00316 
00317     m_value[0] = L1MuGMTConfig::getGMTParams()->getCDLConfigWordDTCSC();
00318     if ( L1MuGMTConfig::Debug(1) ) 
00319          edm::LogVerbatim("GMT_Register_info") << " CDLConfigWordDTCSC is " << m_value[0];
00320     
00321     m_value[1] = L1MuGMTConfig::getGMTParams()->getCDLConfigWordCSCDT();
00322     if ( L1MuGMTConfig::Debug(1) ) 
00323          edm::LogVerbatim("GMT_Register_info") << " CDLConfigWordCSCDT is " << m_value[1];
00324     
00325     m_value[2] = L1MuGMTConfig::getGMTParams()->getCDLConfigWordbRPCCSC();
00326     if ( L1MuGMTConfig::Debug(1) ) 
00327          edm::LogVerbatim("GMT_Register_info") << " CDLConfigWordbRPCCSC is " << m_value[2];
00328     
00329     m_value[3] = L1MuGMTConfig::getGMTParams()->getCDLConfigWordfRPCDT();
00330     if ( L1MuGMTConfig::Debug(1) ) 
00331          edm::LogVerbatim("GMT_Register_info") << " CDLConfigWordfRPCDT is " << m_value[3];
00332     
00333   };
00334 
00335  protected:
00336 } ;
00337 
00338 
00339 #endif
00340 
00341 
00342 
00343 
00344 
00345 
00346 
00347 
00348 
00349 
00350 
00351