9 if (theStation==1)
generateLUTsME11(theEndcap, theSector, theSubsector, theTrigChamber);
10 if (theStation==2)
generateLUTsME21(theEndcap, theSector, theSubsector, theTrigChamber);
15 bool gemGeometryAvailable(
false);
16 if (
gem_g !=
nullptr) {
17 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")
18 <<
"+++ generateLUTsME11() called for ME11 chamber! +++ \n";
19 gemGeometryAvailable =
true;
23 if (not gemGeometryAvailable){
24 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")
25 <<
"+++ generateLUTsME11() called for ME11 chamber without valid GEM geometry! +++ \n";
31 const CSCDetId me1bId(theEndcap, 1, 1, chid, 0);
32 const CSCDetId me1aId(theEndcap, 1, 4, chid, 0);
35 const CSCLayer* keyLayerME1b(cscChamberME1b->layer(3));
36 const CSCLayer* keyLayerME1a(cscChamberME1a->layer(3));
39 const int region((theEndcap == 1) ? 1: -1);
47 std::vector<std::pair<double,double> > gemRollEtaLimits_l1;
48 std::vector<std::pair<double,double> > gemRollEtaLimits_l2;
49 std::vector<std::pair<double,double> > cscWGToEtaLimits;
50 std::vector<std::pair<int,int> > cscWgToGemRoll_l1;
51 std::vector<std::pair<int,int> > cscWgToGemRoll_l2;
52 std::vector<std::pair<int,int> > cscHsToGemPadME1a;
53 std::vector<std::pair<int,int> > cscHsToGemPadME1b;
54 std::vector<int> gemPadToCscHsME1a;
55 std::vector<int> gemPadToCscHsME1b;
60 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1);
61 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2);
69 os <<
"ME11 "<< me1bId <<std::endl;
71 os <<
"GEM L1 roll to eta limits" << std::endl;
72 os << gemRollEtaLimits_l1;
74 os <<
"GEM L2 roll to eta limits" << std::endl;
75 os << gemRollEtaLimits_l2;
77 os <<
"ME1b "<< me1bId <<std::endl;
78 os <<
"WG roll to eta limits" << std::endl;
79 os << cscWGToEtaLimits;
81 os <<
"WG to Roll L1" << std::endl;
82 os << cscWgToGemRoll_l1;
84 os <<
"WG to Roll L2" << std::endl;
85 os << cscWgToGemRoll_l2;
87 os <<
"CSC HS to GEM pad LUT in ME1a" << std::endl;
88 os << cscHsToGemPadME1a;
90 os <<
"CSC HS to GEM pad LUT in ME1b" << std::endl;
91 os << cscHsToGemPadME1b;
93 os <<
"GEM pad to CSC HS LUT in ME1a" << std::endl;
94 os << gemPadToCscHsME1a;
96 os <<
"GEM pad to CSC HS LUT in ME1b" << std::endl;
97 os << gemPadToCscHsME1b;
100 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
105 bool gemGeometryAvailable(
false);
106 if (
gem_g !=
nullptr) {
107 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME11() called for ME21 chamber! +++ \n";
108 gemGeometryAvailable =
true;
112 if (not gemGeometryAvailable){
113 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME21() called for ME21 chamber without valid GEM geometry! +++ \n";
119 const CSCDetId csc_id(theEndcap, 2, 1, chid, 0);
121 const CSCLayer* keyLayer(cscChamber->layer(3));
124 const int region((theEndcap == 1) ? 1: -1);
132 std::vector<std::pair<double,double> > gemRollEtaLimits_l1;
133 std::vector<std::pair<double,double> > gemRollEtaLimits_l2;
134 std::vector<std::pair<double,double> > cscWGToEtaLimits;
135 std::vector<std::pair<int,int> > cscWgToGemRoll_l1;
136 std::vector<std::pair<int,int> > cscWgToGemRoll_l2;
137 std::vector<std::pair<int,int> > cscHsToGemPad;
138 std::vector<int> gemPadToCscHs;
143 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1);
144 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2);
148 std::stringstream os;
149 os <<
"ME21 "<< csc_id <<std::endl;
151 os <<
"GEM roll to eta limits L1" << std::endl;
152 os << gemRollEtaLimits_l1;
154 os <<
"GEM roll to eta limits L2" << std::endl;
155 os << gemRollEtaLimits_l2;
157 os <<
"WG to eta limits" << std::endl;
158 os << cscWGToEtaLimits;
160 os <<
"WG to Roll L1" << std::endl;
161 os << cscWgToGemRoll_l1;
163 os <<
"WG to Roll L2" << std::endl;
164 os << cscWgToGemRoll_l2;
166 os <<
"CSC HS to GEM pad LUT in ME21" << std::endl;
169 os <<
"GEM pad to CSC HS LUT in ME21" << std::endl;
173 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
179 for(
const auto&
p : lut_) {
193 const float half_striplength(roll->specs()->specificTopology().stripLength()/2.);
194 const LocalPoint lp_top(0., half_striplength, 0.);
195 const LocalPoint lp_bottom(0., -half_striplength, 0.);
197 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
204 const std::vector<std::pair<double,double> >& inLUT2,
205 std::vector<std::pair<int,int> >& outLUT)
const 207 for (
const auto&
p: inLUT1){
217 const int numberOfWG(keyLayerGeometry->numberOfWireGroups());
218 for (
int i = 0;
i< numberOfWG; ++
i){
219 const float middle_wire(keyLayerGeometry->middleWireOfGroup(
i));
220 const std::pair<LocalPoint, LocalPoint> wire_ends(keyLayerGeometry->wireTopology()->wireEnds(middle_wire));
223 lut.emplace_back(gp_top.eta(), gp_bottom.eta());
229 int minH,
int maxH, std::vector<std::pair<int,int> >&
lut)
const 232 auto nStrips(keyLayerGeometry->numberOfStrips());
233 for (
float i = 0;
i< nStrips;
i =
i+0.5){
234 const LocalPoint lpCSC(keyLayerGeometry->topology()->localPosition(
i));
238 const bool edge(HS < minH or HS > maxH);
239 const float pad(edge ? -99 : randRoll->
pad(lpGEM));
240 lut.emplace_back(std::floor(pad),std::ceil(pad));
247 std::vector<int>&
lut)
const 249 const int nGEMPads(randRoll->
npads());
251 for (
int i = 1;
i<= nGEMPads; ++
i){
255 const float strip(keyLayerGeometry->strip(lpCSC));
256 lut.push_back( (
int) (
strip)/0.5 );
const CSCGeometry * csc_g
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
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)