8 unsigned theEndcap,
unsigned theStation,
unsigned theSector,
unsigned theSubsector,
unsigned theTrigChamber)
const {
17 unsigned theSubsector,
18 unsigned theTrigChamber)
const {
19 bool gemGeometryAvailable(
false);
20 if (
gem_g !=
nullptr) {
21 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME11() called for ME11 chamber! +++ \n";
22 gemGeometryAvailable =
true;
26 if (not gemGeometryAvailable) {
27 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")
28 <<
"+++ generateLUTsME11() called for ME11 chamber without valid GEM geometry! +++ \n";
34 const CSCDetId me1bId(theEndcap, 1, 1, chid, 0);
35 const CSCDetId me1aId(theEndcap, 1, 4, chid, 0);
38 const CSCLayer* keyLayerME1b(cscChamberME1b->layer(3));
39 const CSCLayer* keyLayerME1a(cscChamberME1a->layer(3));
42 const int region((theEndcap == 1) ? 1 : -1);
50 std::vector<std::pair<double, double> > gemRollEtaLimits_l1;
51 std::vector<std::pair<double, double> > gemRollEtaLimits_l2;
52 std::vector<std::pair<double, double> > cscWGToEtaLimits;
53 std::vector<std::pair<int, int> > cscWgToGemRoll_l1;
54 std::vector<std::pair<int, int> > cscWgToGemRoll_l2;
55 std::vector<std::pair<int, int> > cscHsToGemPadME1a;
56 std::vector<std::pair<int, int> > cscHsToGemPadME1b;
57 std::vector<int> gemPadToCscHsME1a;
58 std::vector<int> gemPadToCscHsME1b;
59 std::vector<int> gemRollToCscWg1b;
64 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1);
65 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2);
74 os <<
"ME11 " << me1bId << std::endl;
76 os <<
"GEM L1 roll to eta limits" << std::endl;
77 os << gemRollEtaLimits_l1;
79 os <<
"GEM L2 roll to eta limits" << std::endl;
80 os << gemRollEtaLimits_l2;
82 os <<
"ME1b " << me1bId << std::endl;
83 os <<
"WG roll to eta limits" << std::endl;
84 os << cscWGToEtaLimits;
86 os <<
"WG to Roll L1" << std::endl;
87 os << cscWgToGemRoll_l1;
89 os <<
"WG to Roll L2" << std::endl;
90 os << cscWgToGemRoll_l2;
92 os <<
"CSC HS to GEM pad LUT in ME1a" << std::endl;
93 os << cscHsToGemPadME1a;
95 os <<
"CSC HS to GEM pad LUT in ME1b" << std::endl;
96 os << cscHsToGemPadME1b;
98 os <<
"GEM pad to CSC HS LUT in ME1a" << std::endl;
99 os << gemPadToCscHsME1a;
101 os <<
"GEM pad to CSC HS LUT in ME1b" << std::endl;
102 os << gemPadToCscHsME1b;
104 os <<
"GEM roll to CSC WG" << std::endl;
105 os << gemRollToCscWg1b;
108 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
113 unsigned theSubsector,
114 unsigned theTrigChamber)
const {
115 bool gemGeometryAvailable(
false);
116 if (
gem_g !=
nullptr) {
117 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME11() called for ME21 chamber! +++ \n";
118 gemGeometryAvailable =
true;
122 if (not gemGeometryAvailable) {
123 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")
124 <<
"+++ generateLUTsME21() called for ME21 chamber without valid GEM geometry! +++ \n";
130 const CSCDetId csc_id(theEndcap, 2, 1, chid, 0);
132 const CSCLayer* keyLayer(cscChamber->layer(3));
135 const int region((theEndcap == 1) ? 1 : -1);
143 std::vector<std::pair<double, double> > gemRollEtaLimits_l1;
144 std::vector<std::pair<double, double> > gemRollEtaLimits_l2;
145 std::vector<std::pair<double, double> > cscWGToEtaLimits;
146 std::vector<std::pair<int, int> > cscWgToGemRoll_l1;
147 std::vector<std::pair<int, int> > cscWgToGemRoll_l2;
148 std::vector<std::pair<int, int> > cscHsToGemPad;
149 std::vector<int> gemPadToCscHs;
150 std::vector<int> gemRollToCscWg;
155 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1);
156 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2);
161 std::stringstream os;
162 os <<
"ME21 " << csc_id << std::endl;
164 os <<
"GEM roll to eta limits L1" << std::endl;
165 os << gemRollEtaLimits_l1;
167 os <<
"GEM roll to eta limits L2" << std::endl;
168 os << gemRollEtaLimits_l2;
170 os <<
"WG to eta limits" << std::endl;
171 os << cscWGToEtaLimits;
173 os <<
"WG to Roll L1" << std::endl;
174 os << cscWgToGemRoll_l1;
176 os <<
"WG to Roll L2" << std::endl;
177 os << cscWgToGemRoll_l2;
179 os <<
"CSC HS to GEM pad LUT in ME21" << std::endl;
182 os <<
"GEM pad to CSC HS LUT in ME21" << std::endl;
185 os <<
"GEM roll to CSC WG" << std::endl;
186 os << gemRollToCscWg;
189 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
196 for (
const auto&
p : lut) {
209 std::vector<std::pair<double, double> >& lut)
const {
211 const float half_striplength(roll->specs()->specificTopology().stripLength() / 2.);
212 const LocalPoint lp_top(0., half_striplength, 0.);
213 const LocalPoint lp_bottom(0., -half_striplength, 0.);
215 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
216 const double bottom_eta(
std::abs(gp_bottom.eta()));
217 const double top_eta(
std::abs(gp_top.eta()));
218 lut.emplace_back(
std::min(bottom_eta, top_eta),
std::max(bottom_eta, top_eta));
223 const std::vector<std::pair<double, double> >& inLUT2,
224 std::vector<std::pair<int, int> >& outLUT)
const {
225 for (
const auto&
p : inLUT1) {
233 std::vector<std::pair<double, double> >& lut)
const {
235 const int numberOfWG(keyLayerGeometry->numberOfWireGroups());
236 for (
int i = 0;
i < numberOfWG; ++
i) {
237 const float middle_wire(keyLayerGeometry->middleWireOfGroup(
i));
238 const std::pair<LocalPoint, LocalPoint> wire_ends(keyLayerGeometry->wireTopology()->wireEnds(middle_wire));
241 const double bottom_eta(
std::abs(gp_bottom.eta()));
242 const double top_eta(
std::abs(gp_top.eta()));
243 lut.emplace_back(
std::min(bottom_eta, top_eta),
std::max(bottom_eta, top_eta));
251 std::vector<std::pair<int, int> >& lut)
const {
253 auto nStrips(keyLayerGeometry->numberOfStrips());
255 const LocalPoint lpCSC(keyLayerGeometry->topology()->localPosition(
i));
258 const float pad(randRoll->
pad(lpGEM));
259 lut.emplace_back(std::floor(pad),
std::ceil(pad));
265 std::vector<int>& lut)
const {
266 const int nGEMPads(randRoll->
npads());
268 for (
int i = 0;
i < nGEMPads; ++
i) {
272 const float strip(keyLayerGeometry->strip(lpCSC));
273 lut.push_back(
int(
strip * 2));
279 std::vector<int>& lut)
const {
282 const float half_striplength(roll->specs()->specificTopology().stripLength() / 2.);
283 const LocalPoint lp_top(0., half_striplength, 0.);
284 const LocalPoint lp_bottom(0., -half_striplength, 0.);
286 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
288 x = (gp_top.x() + gp_bottom.x()) / 2.;
289 y = (gp_top.y() + gp_bottom.y()) / 2.;
290 z = (gp_top.z() + gp_bottom.z()) / 2.;
293 const int wire(keyLayerGeometry->nearestWire(lp_ave));
294 const int wg(keyLayerGeometry->wireGroup(wire));
295 lut.emplace_back(wg);
const CSCGeometry * csc_g
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
void gemRollToCscWgLUT(const CSCLayer *, const GEMChamber *, std::vector< int > &) const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
constexpr int32_t ceil(float num)
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
int assignRoll(const std::vector< std::pair< double, double > > &, double eta) const
void cscHsToGemPadLUT(const CSCLayer *, const GEMEtaPartition *, int minH, int maxH, std::vector< std::pair< int, int > > &) const
void gemRollToEtaLimitsLUT(const GEMChamber *c, std::vector< std::pair< double, double > > &) const
Abs< T >::type abs(const T &t)
void cscWgToEtaLimitsLUT(const CSCLayer *, std::vector< std::pair< double, double > > &) const
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return the eta partitions.
void cscWgToRollLUT(const std::vector< std::pair< double, double > > &, const std::vector< std::pair< double, double > > &, std::vector< std::pair< int, int > > &) const
const GEMChamber * chamber(GEMDetId id) const
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
void generateLUTsME21(unsigned e, unsigned se, unsigned sb, unsigned c) const
void generateLUTs(unsigned e, unsigned s, unsigned se, unsigned sb, unsigned c) const
generate and print LUT
const GEMGeometry * gem_g
void generateLUTsME11(unsigned e, unsigned se, unsigned sb, unsigned c) const
void gemPadToCscHsLUT(const CSCLayer *, const GEMEtaPartition *, std::vector< int > &) const
const CSCLayerGeometry * geometry() const
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)