CMS 3D CMS Logo

CSCALCTCrossCLCT.cc
Go to the documentation of this file.
6 
7 namespace {
8 
9  // LUTs to map wiregroup onto min and max half-strip number that it crosses in ME1/1
10  // These LUTs are deliberately not implemented as eventsetup objects
11  constexpr std::array<int, 48> wg_min_hs_ME1a_ = {
12  {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, -1, -1, -1, -1, -1, -1, -1, -1,
13  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
14  constexpr std::array<int, 48> wg_max_hs_ME1a_ = {
15  {223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 205, 189, 167, 150, -1, -1, -1, -1, -1, -1, -1, -1,
16  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
17  constexpr std::array<int, 48> wg_min_hs_ME1a_ganged_ = {
18  {128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, -1, -1, -1, -1, -1, -1, -1, -1,
19  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
20  constexpr std::array<int, 48> wg_max_hs_ME1a_ganged_ = {
21  {159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 150, -1, -1, -1, -1, -1, -1, -1, -1,
22  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
23  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,
24  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
26  constexpr std::array<int, 48> wg_max_hs_ME1b_ = {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, 127,
27  127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
28  127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
29  127, 127, 127, 127, 127, 127, 127, 127, 105, 93, 78, 63}};
30 }; // namespace
31 
33  unsigned endcap, unsigned station, unsigned ring, bool ignoreAlctCrossClct, const edm::ParameterSet& conf)
34  : endcap_(endcap), station_(station), ring_(ring) {
35  const auto& commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
36  gangedME1a_ = commonParams.getParameter<bool>("gangedME1a");
38 }
39 
41  // both need to valid
42  if (!c.isValid() || !a.isValid()) {
43  return false;
44  }
45 
46  // when non-overlapping half-strips and wiregroups don't matter
48  return true;
49 
50  // overlap only needs to be considered for ME1/1
51  if (station_ == 1 and ring_ == 1) {
52  return doesWiregroupCrossHalfStrip(a.getKeyWG(), c.getKeyStrip());
53  } else
54  return true;
55 }
56 
57 bool CSCALCTCrossCLCT::doesWiregroupCrossHalfStrip(int wiregroup, int halfstrip) const {
58  // sanity-check for invalid wiregroups
59  if (wiregroup < 0 or wiregroup >= CSCConstants::NUM_WIREGROUPS_ME11)
60  return false;
61 
62  const int min_hs_ME1a = wg_min_hs_ME1a_[wiregroup];
63  const int max_hs_ME1a = wg_max_hs_ME1a_[wiregroup];
64  const int min_hs_ME1a_ganged = wg_min_hs_ME1a_ganged_[wiregroup];
65  const int max_hs_ME1a_ganged = wg_max_hs_ME1a_ganged_[wiregroup];
66  const int min_hs_ME1b = wg_min_hs_ME1b_[wiregroup];
67  const int max_hs_ME1b = wg_max_hs_ME1b_[wiregroup];
68 
69  // ME1/a half-strip starts at 128
70  if (halfstrip > CSCConstants::MAX_HALF_STRIP_ME1B) {
71  if (!gangedME1a_) {
72  // wrap around ME11 HS number for -z endcap
73  if (endcap_ == 2) {
74  // first subtract 128
75  halfstrip -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
76  // flip the HS
77  halfstrip = CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED - halfstrip;
78  // then add 128 again
79  halfstrip += 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
80  }
81  return halfstrip >= min_hs_ME1a && halfstrip <= max_hs_ME1a;
82  }
83 
84  else {
85  // wrap around ME11 HS number for -z endcap
86  if (endcap_ == 2) {
87  // first subtract 128
88  halfstrip -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
89  // flip the HS
90  halfstrip = CSCConstants::MAX_HALF_STRIP_ME1A_GANGED - halfstrip;
91  // then add 128 again
92  halfstrip += 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
93  }
94  return halfstrip >= min_hs_ME1a_ganged && halfstrip <= max_hs_ME1a_ganged;
95  }
96  }
97  // ME1/b half-strip ends at 127
98  else if (halfstrip <= CSCConstants::MAX_HALF_STRIP_ME1B) {
99  if (endcap_ == 2) {
100  halfstrip = CSCConstants::MAX_HALF_STRIP_ME1B - halfstrip;
101  }
102  return halfstrip >= min_hs_ME1b && halfstrip <= max_hs_ME1b;
103  }
104  // all other cases, return true
105  else
106  return true;
107 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static const char ring_[]
CSCALCTCrossCLCT(unsigned endcap, unsigned station, unsigned ring, bool ignoreAlctCrossClct, const edm::ParameterSet &conf)
double a
Definition: hdecay.h:119
bool doesALCTCrossCLCT(const CSCALCTDigi &a, const CSCCLCTDigi &c) const
ignoreAlctCrossClct
Definition: tmbParams.py:45
bool doesWiregroupCrossHalfStrip(int wg, int keystrip) const