CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/L1TriggerConfig/DTTPGConfig/src/DTConfigSectColl.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: DTConfigSectColl
00004 //
00005 //   Description: Configurable parameters and constants 
00006 //   for Level1 Mu DT Trigger - Sector Collector chip
00007 //
00008 //
00009 //   Author List:
00010 //   C. Battilana
00011 //
00012 //-----------------------------------------------------------------------
00013 
00014 //-----------------------
00015 // This Class's Header --
00016 //-----------------------
00017 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfigSectColl.h"
00018 
00019 //---------------
00020 // C++ Headers --
00021 //---------------
00022 
00023 //-------------------------------
00024 // Collaborating Class Headers --
00025 //-------------------------------
00026 #include "FWCore/Utilities/interface/Exception.h"
00027 
00028 //----------------
00029 // Constructors --
00030 //----------------
00031 DTConfigSectColl::DTConfigSectColl() { 
00032 
00033   m_debug = 0;
00034   for (int i=1; i<4; i++)
00035     setSCCarryFlag(0,i);
00036   for (int i=1; i<5; i++)
00037     setCoarseSync(0,i);
00038 
00039 }
00040 
00041 DTConfigSectColl::DTConfigSectColl(const edm::ParameterSet& ps) { 
00042 
00043   setDefaults(ps);
00044   if(debug()) print();
00045 
00046 }
00047 
00048 //--------------
00049 // Destructor --
00050 //--------------
00051 DTConfigSectColl::~DTConfigSectColl() {}
00052 
00053 //--------------
00054 // Operations --
00055 //--------------
00056 
00057 void
00058 DTConfigSectColl::setSCCarryFlag(bool scecf,int istat) {
00059 
00060   if (istat<1 || istat>4){
00061       throw cms::Exception("DTTPG") << "DTConfigSectColl::setSCCarryFlag: station number out of range: istat=" << istat << std::endl;
00062     } 
00063   m_scecf[istat-1] = scecf;
00064 
00065 }  
00066 
00067 void
00068 DTConfigSectColl::setCoarseSync(int sccsp, int istat) {
00069 
00070   if (istat<1 || istat>5){
00071     throw cms::Exception("DTTPG") << "DTConfigSectColl::setCoarseSync: station number out of range: istat=" << istat << std::endl;
00072   }
00073   if (sccsp<0 || sccsp>7){
00074     throw cms::Exception("DTTPG") << "DTConfigSectColl::setCoarseSync: wrong SCCSP"<< istat << "  value!" << std::endl;
00075   }
00076   m_sccsp[istat-1] = sccsp;
00077 
00078 }
00079 
00080 void
00081 DTConfigSectColl::setDefaults(const edm::ParameterSet& ps) {
00082 
00083   // Debug flag 
00084   m_debug = ps.getUntrackedParameter<bool>("Debug");
00085 
00086   //  Enabling Carry in Sector Collector for MB1 (1 means enabled, 0 disabled)
00087   m_scecf[0] = ps.getParameter<bool>("SCECF1");
00088 
00089   //  Enabling Carry in Sector Collector for MB2 (1 means enabled, 0 disabled)
00090   m_scecf[1] = ps.getParameter<bool>("SCECF2");
00091 
00092   //  Enabling Carry in Sector Collector for MB3 (1 means enabled, 0 disabled)
00093   m_scecf[2] = ps.getParameter<bool>("SCECF3");
00094 
00095   //  Enabling Carry in Sector Collector for MB4  (1 means enabled, 0 disabled)
00096   m_scecf[3] = ps.getParameter<bool>("SCECF4");
00097 
00098   // Progammable Coars Sync parameter in Sector Collector for MB1 (possible values [0-7])
00099   int mycsp = ps.getParameter<int>("SCCSP1");
00100   setCoarseSync(mycsp,1);
00101 
00102   // Progammable Coars Sync parameter in Sector Collector for MB2 (possible values [0-7])
00103   mycsp = ps.getParameter<int>("SCCSP2");
00104   setCoarseSync(mycsp,2);
00105   
00106   // Progammable Coars Sync parameter in Sector Collector for MB3 (possible values [0-7])
00107   mycsp = ps.getParameter<int>("SCCSP3");
00108   setCoarseSync(mycsp,3);
00109 
00110   // Progammable Coars Sync parameter in Sector Collector for firts MB4 station (possible values [0-7])
00111   mycsp = ps.getParameter<int>("SCCSP4");
00112   setCoarseSync(mycsp,4);
00113 
00114   // Progammable Coars Sync parameter in Sector Collector for second MB4 station (sectors 4 & 10) (possible values [0-7])
00115   mycsp = ps.getParameter<int>("SCCSP5");
00116   setCoarseSync(mycsp,5);
00117 
00118 }
00119 
00120 void 
00121 DTConfigSectColl::print() const {
00122 
00123   std::cout << "******************************************************************************" << std::endl;
00124   std::cout << "*              DTTrigger configuration : SectorCollector chips               *" << std::endl;
00125   std::cout << "******************************************************************************" << std::endl << std::endl;
00126   std::cout << "Debug flag : " <<  debug()     << std::endl;
00127   std::cout << "SCECF1 :" << SCGetCarryFlag(1) << std::endl;
00128   std::cout << "SCECF2 :" << SCGetCarryFlag(2) << std::endl;
00129   std::cout << "SCECF3 :" << SCGetCarryFlag(3) << std::endl;
00130   std::cout << "SCECF4 :" << SCGetCarryFlag(4) << std::endl;
00131   std::cout << "SCCSP1 :" << CoarseSync(1)     << std::endl;
00132   std::cout << "SCCSP2 :" << CoarseSync(2)     << std::endl;
00133   std::cout << "SCCSP3 :" << CoarseSync(3)     << std::endl;
00134   std::cout << "SCCSP4 :" << CoarseSync(4)     << std::endl;
00135   std::cout << "SCCSP5 :" << CoarseSync(5)     << std::endl;
00136   std::cout << "******************************************************************************" << std::endl;
00137 
00138 }
00139