File indexing completed on 2023-03-17 11:11:00
0001 #include "L1Trigger/CSCTriggerPrimitives/interface/CSCALCTCrossCLCT.h"
0002 #include "DataFormats/CSCDigi/interface/CSCConstants.h"
0003 #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
0004 #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006
0007 namespace {
0008
0009
0010
0011 constexpr std::array<int, 48> wg_min_hs_ME1a_ = {
0012 {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, -1, -1, -1, -1, -1, -1, -1, -1,
0013 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
0014 constexpr std::array<int, 48> wg_max_hs_ME1a_ = {
0015 {223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 205, 189, 167, 150, -1, -1, -1, -1, -1, -1, -1, -1,
0016 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
0017 constexpr std::array<int, 48> wg_min_hs_ME1a_ganged_ = {
0018 {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, -1, -1, -1, -1, -1, -1, -1, -1,
0019 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
0020 constexpr std::array<int, 48> wg_max_hs_ME1a_ganged_ = {
0021 {159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 150, -1, -1, -1, -1, -1, -1, -1, -1,
0022 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
0023 constexpr std::array<int, 48> wg_min_hs_ME1b_ = {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, 73, 47, 22, 0, 0,
0024 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0025 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
0026 constexpr std::array<int, 48> wg_max_hs_ME1b_ = {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, 127,
0027 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
0028 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
0029 127, 127, 127, 127, 127, 127, 127, 127, 105, 93, 78, 63}};
0030 };
0031
0032 CSCALCTCrossCLCT::CSCALCTCrossCLCT(
0033 unsigned endcap, unsigned station, unsigned ring, bool ignoreAlctCrossClct, const edm::ParameterSet& conf)
0034 : endcap_(endcap), station_(station), ring_(ring) {
0035 const auto& commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
0036 gangedME1a_ = commonParams.getParameter<bool>("gangedME1a");
0037 ignoreAlctCrossClct_ = ignoreAlctCrossClct;
0038 }
0039
0040 bool CSCALCTCrossCLCT::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const {
0041
0042 if (!c.isValid() || !a.isValid()) {
0043 return false;
0044 }
0045
0046
0047 if (ignoreAlctCrossClct_)
0048 return true;
0049
0050
0051 if (station_ == 1 and ring_ == 1) {
0052 return doesWiregroupCrossHalfStrip(a.getKeyWG(), c.getKeyStrip());
0053 } else
0054 return true;
0055 }
0056
0057 bool CSCALCTCrossCLCT::doesWiregroupCrossHalfStrip(int wiregroup, int halfstrip) const {
0058
0059 if (wiregroup < 0 or wiregroup >= CSCConstants::NUM_WIREGROUPS_ME11)
0060 return false;
0061
0062 const int min_hs_ME1a = wg_min_hs_ME1a_[wiregroup];
0063 const int max_hs_ME1a = wg_max_hs_ME1a_[wiregroup];
0064 const int min_hs_ME1a_ganged = wg_min_hs_ME1a_ganged_[wiregroup];
0065 const int max_hs_ME1a_ganged = wg_max_hs_ME1a_ganged_[wiregroup];
0066 const int min_hs_ME1b = wg_min_hs_ME1b_[wiregroup];
0067 const int max_hs_ME1b = wg_max_hs_ME1b_[wiregroup];
0068
0069
0070 if (halfstrip > CSCConstants::MAX_HALF_STRIP_ME1B) {
0071 if (!gangedME1a_) {
0072
0073 if (endcap_ == 2) {
0074
0075 halfstrip -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
0076
0077 halfstrip = CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED - halfstrip;
0078
0079 halfstrip += 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
0080 }
0081 return halfstrip >= min_hs_ME1a && halfstrip <= max_hs_ME1a;
0082 }
0083
0084 else {
0085
0086 if (endcap_ == 2) {
0087
0088 halfstrip -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
0089
0090 halfstrip = CSCConstants::MAX_HALF_STRIP_ME1A_GANGED - halfstrip;
0091
0092 halfstrip += 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
0093 }
0094 return halfstrip >= min_hs_ME1a_ganged && halfstrip <= max_hs_ME1a_ganged;
0095 }
0096 }
0097
0098 else if (halfstrip <= CSCConstants::MAX_HALF_STRIP_ME1B) {
0099 if (endcap_ == 2) {
0100 halfstrip = CSCConstants::MAX_HALF_STRIP_ME1B - halfstrip;
0101 }
0102 return halfstrip >= min_hs_ME1b && halfstrip <= max_hs_ME1b;
0103 }
0104
0105 else
0106 return true;
0107 }