CMS 3D CMS Logo

CSCALCTCrossCLCT.cc
Go to the documentation of this file.
7 
9  unsigned endcap, unsigned station, unsigned ring, bool ignoreAlctCrossClct, const edm::ParameterSet& conf)
10  : endcap_(endcap), station_(station), ring_(ring) {
11  const auto& commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
12  gangedME1a_ = commonParams.getParameter<bool>("gangedME1a");
14 
15  if (!ignoreAlctCrossClct_) {
16  const edm::ParameterSet me11luts(conf.getParameter<edm::ParameterSet>("wgCrossHsME11Params"));
17  wgCrossHsME1aFiles_ = me11luts.getParameter<std::vector<std::string>>("wgCrossHsME1aFiles");
18  wgCrossHsME1aGangedFiles_ = me11luts.getParameter<std::vector<std::string>>("wgCrossHsME1aGangedFiles");
19  wgCrossHsME1bFiles_ = me11luts.getParameter<std::vector<std::string>>("wgCrossHsME1bFiles");
20  wg_cross_min_hs_ME1a_ = std::make_unique<CSCLUTReader>(wgCrossHsME1aFiles_[0]);
21  wg_cross_max_hs_ME1a_ = std::make_unique<CSCLUTReader>(wgCrossHsME1aFiles_[1]);
22  wg_cross_min_hs_ME1a_ganged_ = std::make_unique<CSCLUTReader>(wgCrossHsME1aGangedFiles_[0]);
23  wg_cross_max_hs_ME1a_ganged_ = std::make_unique<CSCLUTReader>(wgCrossHsME1aGangedFiles_[1]);
24  wg_cross_min_hs_ME1b_ = std::make_unique<CSCLUTReader>(wgCrossHsME1bFiles_[0]);
25  wg_cross_max_hs_ME1b_ = std::make_unique<CSCLUTReader>(wgCrossHsME1bFiles_[1]);
26  }
27 }
28 
30  const CSCCLCTDigi& bestCLCT,
31  const CSCALCTDigi& secondALCT,
32  const CSCCLCTDigi& secondCLCT,
33  unsigned& bestLCTCode,
34  unsigned& secondLCTCode) const {
35  // Each of these calls should return "1" when the ALCT and CLCT are valid.
36  const bool ok11 = doesALCTCrossCLCT(bestALCT, bestCLCT);
37  const bool ok12 = doesALCTCrossCLCT(bestALCT, secondCLCT);
38  const bool ok21 = doesALCTCrossCLCT(secondALCT, bestCLCT);
39  const bool ok22 = doesALCTCrossCLCT(secondALCT, secondCLCT);
40 
41  /*
42  With these okxx, we now calculate a 4-bit code that determines
43  the best and second LCT combinations.
44  */
45 
46  const unsigned code = (ok11 << 3) | (ok12 << 2) | (ok21 << 1) | (ok22);
47 
48  bestLCTCode = code_to_best_lct_->lookup(code);
49  secondLCTCode = code_to_second_lct_->lookup(code);
50 
51  edm::LogInfo("CSCALCTCrossCLCT") << "Calculate LCT combination code" << std::endl
52  << "ALCT1: " << bestALCT << std::endl
53  << "ALCT2: " << secondALCT << std::endl
54  << "CLCT1: " << bestCLCT << std::endl
55  << "CLCT2: " << secondCLCT << std::endl
56  << "LCT combination code: " << code << std::endl
57  << "LCT1: " << bestLCTCode << std::endl
58  << "LCT1: " << secondLCTCode << std::endl;
59 }
60 
62  // both need to valid
63  if (!c.isValid() || !a.isValid()) {
64  return false;
65  }
66 
67  // when non-overlapping half-strips and wiregroups don't matter
69  return true;
70 
71  // overlap only needs to be considered for ME1/1
72  if (station_ == 1 and ring_ == 1) {
73  return doesWiregroupCrossHalfStrip(a.getKeyWG(), c.getKeyStrip());
74  } else
75  return true;
76 }
77 
78 bool CSCALCTCrossCLCT::doesWiregroupCrossHalfStrip(int wiregroup, int halfstrip) const {
79  const int min_hs_ME1a = wg_cross_min_hs_ME1a_->lookup(wiregroup);
80  const int max_hs_ME1a = wg_cross_max_hs_ME1a_->lookup(wiregroup);
81  const int min_hs_ME1a_ganged = wg_cross_min_hs_ME1a_ganged_->lookup(wiregroup);
82  const int max_hs_ME1a_ganged = wg_cross_max_hs_ME1a_ganged_->lookup(wiregroup);
83  const int min_hs_ME1b = wg_cross_min_hs_ME1b_->lookup(wiregroup);
84  const int max_hs_ME1b = wg_cross_max_hs_ME1b_->lookup(wiregroup);
85 
86  // ME1/a half-strip starts at 128
87  if (halfstrip > CSCConstants::MAX_HALF_STRIP_ME1B) {
88  if (!gangedME1a_) {
89  // wrap around ME11 HS number for -z endcap
90  if (endcap_ == 2) {
91  // first subtract 128
92  halfstrip -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
93  // flip the HS
94  halfstrip = CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED - halfstrip;
95  // then add 128 again
96  halfstrip += 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
97  }
98  return halfstrip >= min_hs_ME1a && halfstrip <= max_hs_ME1a;
99  }
100 
101  else {
102  // wrap around ME11 HS number for -z endcap
103  if (endcap_ == 2) {
104  // first subtract 128
105  halfstrip -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
106  // flip the HS
107  halfstrip = CSCConstants::MAX_HALF_STRIP_ME1A_GANGED - halfstrip;
108  // then add 128 again
109  halfstrip += 1 + CSCConstants::MAX_HALF_STRIP_ME1B;
110  }
111  return halfstrip >= min_hs_ME1a_ganged && halfstrip <= max_hs_ME1a_ganged;
112  }
113  }
114  // ME1/b half-strip ends at 127
115  else if (halfstrip <= CSCConstants::MAX_HALF_STRIP_ME1B) {
116  if (endcap_ == 2) {
117  halfstrip = CSCConstants::MAX_HALF_STRIP_ME1B - halfstrip;
118  }
119  return halfstrip >= min_hs_ME1b && halfstrip <= max_hs_ME1b;
120  }
121  // all other cases, return true
122  else
123  return true;
124 }
MessageLogger.h
CSCALCTCrossCLCT::wgCrossHsME1bFiles_
std::vector< std::string > wgCrossHsME1bFiles_
Definition: CSCALCTCrossCLCT.h:77
CSCALCTCrossCLCT::doesALCTCrossCLCT
bool doesALCTCrossCLCT(const CSCALCTDigi &a, const CSCCLCTDigi &c) const
Definition: CSCALCTCrossCLCT.cc:61
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCALCTCrossCLCT::wg_cross_min_hs_ME1a_
std::unique_ptr< CSCLUTReader > wg_cross_min_hs_ME1a_
Definition: CSCALCTCrossCLCT.h:81
CSCALCTCrossCLCT::wgCrossHsME1aGangedFiles_
std::vector< std::string > wgCrossHsME1aGangedFiles_
Definition: CSCALCTCrossCLCT.h:76
CSCALCTCrossCLCT::wg_cross_max_hs_ME1b_
std::unique_ptr< CSCLUTReader > wg_cross_max_hs_ME1b_
Definition: CSCALCTCrossCLCT.h:86
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCALCTCrossCLCT::CSCALCTCrossCLCT
CSCALCTCrossCLCT(unsigned endcap, unsigned station, unsigned ring, bool ignoreAlctCrossClct, const edm::ParameterSet &conf)
Definition: CSCALCTCrossCLCT.cc:8
CSCALCTCrossCLCT::station_
unsigned station_
Definition: CSCALCTCrossCLCT.h:69
CSCALCTCrossCLCT::ignoreAlctCrossClct_
bool ignoreAlctCrossClct_
Definition: CSCALCTCrossCLCT.h:72
CSCALCTCrossCLCT::doesWiregroupCrossHalfStrip
bool doesWiregroupCrossHalfStrip(int wg, int keystrip) const
Definition: CSCALCTCrossCLCT.cc:78
CSCALCTDigi.h
CSCALCTCrossCLCT::wg_cross_min_hs_ME1b_
std::unique_ptr< CSCLUTReader > wg_cross_min_hs_ME1b_
Definition: CSCALCTCrossCLCT.h:85
CSCConstants::MAX_HALF_STRIP_ME1B
Definition: CSCConstants.h:88
CSCConstants.h
sistrip::ring_
static const char ring_[]
Definition: ConstantsForGranularity.h:35
CSCLUTReader.h
CSCALCTCrossCLCT::ring_
unsigned ring_
Definition: CSCALCTCrossCLCT.h:70
edm::ParameterSet
Definition: ParameterSet.h:47
CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED
Definition: CSCConstants.h:87
a
double a
Definition: hdecay.h:119
CSCALCTCrossCLCT::code_to_best_lct_
std::unique_ptr< CSCLUTReader > code_to_best_lct_
Definition: CSCALCTCrossCLCT.h:87
CSCALCTCrossCLCT::code_to_second_lct_
std::unique_ptr< CSCLUTReader > code_to_second_lct_
Definition: CSCALCTCrossCLCT.h:88
CSCConstants::MAX_HALF_STRIP_ME1A_GANGED
Definition: CSCConstants.h:86
CSCALCTCrossCLCT::wg_cross_min_hs_ME1a_ganged_
std::unique_ptr< CSCLUTReader > wg_cross_min_hs_ME1a_ganged_
Definition: CSCALCTCrossCLCT.h:83
CSCALCTCrossCLCT::endcap_
unsigned endcap_
Definition: CSCALCTCrossCLCT.h:68
CSCALCTDigi
Definition: CSCALCTDigi.h:17
CSCCLCTDigi.h
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
CSCALCTCrossCLCT::wg_cross_max_hs_ME1a_
std::unique_ptr< CSCLUTReader > wg_cross_max_hs_ME1a_
Definition: CSCALCTCrossCLCT.h:82
CSCALCTCrossCLCT::calculateLCTCodes
void calculateLCTCodes(const CSCALCTDigi &a1, const CSCCLCTDigi &c1, const CSCALCTDigi &a2, const CSCCLCTDigi &c2, unsigned &bestLCTCode, unsigned &secondLCTCode) const
Definition: CSCALCTCrossCLCT.cc:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCALCTCrossCLCT.h
CSCALCTCrossCLCT::gangedME1a_
bool gangedME1a_
Definition: CSCALCTCrossCLCT.h:71
tmbParams.ignoreAlctCrossClct
ignoreAlctCrossClct
Definition: tmbParams.py:43
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
CSCALCTCrossCLCT::wgCrossHsME1aFiles_
std::vector< std::string > wgCrossHsME1aFiles_
Definition: CSCALCTCrossCLCT.h:75
CSCALCTCrossCLCT::wg_cross_max_hs_ME1a_ganged_
std::unique_ptr< CSCLUTReader > wg_cross_max_hs_ME1a_ganged_
Definition: CSCALCTCrossCLCT.h:84