Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h"
0002 
0003 CSCBaseboard::Parameters::Parameters(const edm::ParameterSet& conf)
0004     : conf_(&conf),
0005       commonParams_(conf.getParameter<edm::ParameterSet>("commonParam")),
0006       showerParams_(conf.getParameterSet("showerParam")){};
0007 
0008 void CSCBaseboard::Parameters::chooseParams(std::string_view tmb, std::string_view alct, std::string_view clct) {
0009   if (tmbName_ != tmb) {
0010     tmbParams_ = conf_->getParameter<edm::ParameterSet>(std::string(tmb));
0011     tmbName_ = tmb;
0012   }
0013   if (alctName_ != alct) {
0014     alctParams_ = conf_->getParameter<edm::ParameterSet>(std::string(alct));
0015     alctName_ = alct;
0016   }
0017   if (clctName_ != clct) {
0018     clctParams_ = conf_->getParameter<edm::ParameterSet>(std::string(clct));
0019     clctName_ = clct;
0020   }
0021 }
0022 
0023 CSCBaseboard::CSCBaseboard(
0024     unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, Parameters& conf)
0025     : theEndcap(endcap), theStation(station), theSector(sector), theSubsector(subsector), theTrigChamber(chamber) {
0026   theRegion = (theEndcap == 1) ? 1 : -1;
0027 
0028   theRing = CSCTriggerNumbering::ringFromTriggerLabels(theStation, theTrigChamber);
0029 
0030   theChamber = CSCTriggerNumbering::chamberFromTriggerLabels(theSector, theSubsector, theStation, theTrigChamber);
0031   isME11_ = (theStation == 1 && theRing == 1);
0032   isME21_ = (theStation == 2 && theRing == 1);
0033   isME31_ = (theStation == 3 && theRing == 1);
0034   isME41_ = (theStation == 4 && theRing == 1);
0035   isME12_ = (theStation == 1 && theRing == 2);
0036   isME22_ = (theStation == 2 && theRing == 2);
0037   isME32_ = (theStation == 3 && theRing == 2);
0038   isME42_ = (theStation == 4 && theRing == 2);
0039   isME13_ = (theStation == 1 && theRing == 3);
0040 
0041   const bool hasTMB(isME12_ or isME22_ or isME32_ or isME42_ or isME13_);
0042   const bool hasOTMB(isME11_ or isME21_ or isME31_ or isME41_);
0043   cscId_ = CSCDetId(theEndcap, theStation, theRing, theChamber, 0);
0044 
0045   theCSCName_ = CSCDetId::chamberName(theEndcap, theStation, theRing, theChamber);
0046 
0047   runPhase2_ = conf.commonParams().getParameter<bool>("runPhase2");
0048 
0049   enableAlctPhase2_ = conf.commonParams().getParameter<bool>("enableAlctPhase2");
0050 
0051   disableME1a_ = conf.commonParams().getParameter<bool>("disableME1a");
0052 
0053   gangedME1a_ = conf.commonParams().getParameter<bool>("gangedME1a");
0054 
0055   runME11Up_ = conf.commonParams().getParameter<bool>("runME11Up");
0056   runME21Up_ = conf.commonParams().getParameter<bool>("runME21Up");
0057   runME31Up_ = conf.commonParams().getParameter<bool>("runME31Up");
0058   runME41Up_ = conf.commonParams().getParameter<bool>("runME41Up");
0059 
0060   runME11ILT_ = conf.commonParams().getParameter<bool>("runME11ILT");
0061   runME21ILT_ = conf.commonParams().getParameter<bool>("runME21ILT");
0062 
0063   run3_ = conf.commonParams().getParameter<bool>("run3");
0064   runCCLUT_TMB_ = conf.commonParams().getParameter<bool>("runCCLUT_TMB");
0065   runCCLUT_OTMB_ = conf.commonParams().getParameter<bool>("runCCLUT_OTMB");
0066   // check if CCLUT should be on in this chamber
0067   runCCLUT_ = (hasTMB and runCCLUT_TMB_) or (hasOTMB and runCCLUT_OTMB_);
0068 
0069   // general case
0070   std::string_view tmbParams = "tmbPhase1";
0071   std::string_view alctParams = "alctPhase1";
0072   std::string_view clctParams = "clctPhase1";
0073 
0074   const bool upgradeME11 = runPhase2_ and isME11_ and runME11Up_;
0075   const bool upgradeME21 = runPhase2_ and isME21_ and runME21Up_;
0076   const bool upgradeME31 = runPhase2_ and isME31_ and runME31Up_;
0077   const bool upgradeME41 = runPhase2_ and isME41_ and runME41Up_;
0078   const bool upgradeME = upgradeME11 or upgradeME21 or upgradeME31 or upgradeME41;
0079 
0080   if (upgradeME) {
0081     tmbParams = "tmbPhase2";
0082     clctParams = "clctPhase2";
0083     // upgrade ME1/1
0084     if (upgradeME11) {
0085       // do not run the Phase-2 ALCT for Run-3
0086       if (enableAlctPhase2_) {
0087         alctParams = "alctPhase2";
0088       }
0089 
0090       if (runME11ILT_) {
0091         tmbParams = "tmbPhase2GE11";
0092         clctParams = "clctPhase2GEM";
0093       }
0094     }
0095     // upgrade ME2/1
0096     if (upgradeME21 and runME21ILT_) {
0097       tmbParams = "tmbPhase2GE21";
0098       clctParams = "clctPhase2GEM";
0099       alctParams = "alctPhase2GEM";
0100     }
0101   }
0102   conf.chooseParams(tmbParams, alctParams, clctParams);
0103 }
0104 
0105 CSCBaseboard::CSCBaseboard() : theEndcap(1), theStation(1), theSector(1), theSubsector(1), theTrigChamber(1) {
0106   theRing = 1;
0107   theChamber = 1;
0108   runPhase2_ = false;
0109   disableME1a_ = false;
0110   gangedME1a_ = false;
0111 }
0112 
0113 CSCChamber const* CSCBaseboard::cscChamber(const CSCGeometry& g) const { return g.chamber(cscId_); }
0114 
0115 void CSCBaseboard::checkConfigParameters(unsigned int& var,
0116                                          const unsigned int var_max,
0117                                          const unsigned int var_def,
0118                                          const std::string& var_str) {
0119   // Make sure that the parameter values are within the allowed range.
0120   if (var >= var_max) {
0121     edm::LogError("CSCConfigError") << "+++ Value of " + var_str + ", " << var << ", exceeds max allowed, " << var - 1
0122                                     << " +++\n"
0123                                     << "+++ Try to proceed with the default value, " + var_str + "=" << var_def
0124                                     << " +++\n";
0125     var = var_def;
0126   }
0127 }