10 const int region(csc_id.
zendcap());
13 const int csc_trig_chid((3*(csc_trig_sect-1)+csc_trig_id)%18 +1);
14 const int rpc_trig_sect((csc_trig_chid-1)/3+1);
15 const int rpc_trig_subsect((csc_trig_chid-1)%3+1);
16 return RPCDetId(region,1,csc_id.
station(),rpc_trig_sect,1,rpc_trig_subsect,0);
21 if (theStation==1)
generateLUTsME11(theEndcap, theSector, theSubsector, theTrigChamber);
22 if (theStation==2)
generateLUTsME21(theEndcap, theSector, theSubsector, theTrigChamber);
23 if (theStation==3)
generateLUTsME3141(theEndcap, 3, theSector, theSubsector, theTrigChamber);
24 if (theStation==4)
generateLUTsME3141(theEndcap, 4, theSector, theSubsector, theTrigChamber);
29 bool gemGeometryAvailable(
false);
30 if (
gem_g !=
nullptr) {
31 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")
32 <<
"+++ generateLUTsME11() called for ME11 chamber! +++ \n";
33 gemGeometryAvailable =
true;
37 if (not gemGeometryAvailable){
38 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")
39 <<
"+++ generateLUTsME11() called for ME11 chamber without valid GEM geometry! +++ \n";
45 const CSCDetId me1bId(theEndcap, 1, 1, chid, 0);
46 const CSCDetId me1aId(theEndcap, 1, 4, chid, 0);
49 const CSCLayer* keyLayerME1b(cscChamberME1b->layer(3));
50 const CSCLayer* keyLayerME1a(cscChamberME1a->layer(3));
53 const int region((theEndcap == 1) ? 1: -1);
61 std::vector<std::pair<double,double> > gemRollEtaLimits_l1;
62 std::vector<std::pair<double,double> > gemRollEtaLimits_l2;
63 std::vector<std::pair<double,double> > cscWGToEtaLimits;
64 std::vector<std::pair<int,int> > cscWgToGemRoll_l1;
65 std::vector<std::pair<int,int> > cscWgToGemRoll_l2;
66 std::vector<std::pair<int,int> > cscHsToGemPadME1a;
67 std::vector<std::pair<int,int> > cscHsToGemPadME1b;
68 std::vector<int> gemPadToCscHsME1a;
69 std::vector<int> gemPadToCscHsME1b;
74 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1);
75 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2);
83 os <<
"ME11 "<< me1bId <<std::endl;
85 os <<
"GEM L1 roll to eta limits" << std::endl;
86 os << gemRollEtaLimits_l1;
88 os <<
"GEM L2 roll to eta limits" << std::endl;
89 os << gemRollEtaLimits_l2;
91 os <<
"ME1b "<< me1bId <<std::endl;
92 os <<
"WG roll to eta limits" << std::endl;
93 os << cscWGToEtaLimits;
95 os <<
"WG to Roll L1" << std::endl;
96 os << cscWgToGemRoll_l1;
98 os <<
"WG to Roll L2" << std::endl;
99 os << cscWgToGemRoll_l2;
101 os <<
"CSC HS to GEM pad LUT in ME1a" << std::endl;
102 os << cscHsToGemPadME1a;
104 os <<
"CSC HS to GEM pad LUT in ME1b" << std::endl;
105 os << cscHsToGemPadME1b;
107 os <<
"GEM pad to CSC HS LUT in ME1a" << std::endl;
108 os << gemPadToCscHsME1a;
110 os <<
"GEM pad to CSC HS LUT in ME1b" << std::endl;
111 os << gemPadToCscHsME1b;
114 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
119 bool gemGeometryAvailable(
false);
120 if (
gem_g !=
nullptr) {
121 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME11() called for ME21 chamber! +++ \n";
122 gemGeometryAvailable =
true;
126 if (not gemGeometryAvailable){
127 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME21() called for ME21 chamber without valid GEM geometry! +++ \n";
133 const CSCDetId csc_id(theEndcap, 2, 1, chid, 0);
135 const CSCLayer* keyLayer(cscChamber->layer(3));
138 const int region((theEndcap == 1) ? 1: -1);
146 std::vector<std::pair<double,double> > gemRollEtaLimits_l1;
147 std::vector<std::pair<double,double> > gemRollEtaLimits_l2;
148 std::vector<std::pair<double,double> > cscWGToEtaLimits;
149 std::vector<std::pair<int,int> > cscWgToGemRoll_l1;
150 std::vector<std::pair<int,int> > cscWgToGemRoll_l2;
151 std::vector<std::pair<int,int> > cscHsToGemPad;
152 std::vector<int> gemPadToCscHs;
157 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1);
158 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2);
162 std::stringstream os;
163 os <<
"ME21 "<< csc_id <<std::endl;
165 os <<
"GEM roll to eta limits L1" << std::endl;
166 os << gemRollEtaLimits_l1;
168 os <<
"GEM roll to eta limits L2" << std::endl;
169 os << gemRollEtaLimits_l2;
171 os <<
"WG to eta limits" << std::endl;
172 os << cscWGToEtaLimits;
174 os <<
"WG to Roll L1" << std::endl;
175 os << cscWgToGemRoll_l1;
177 os <<
"WG to Roll L2" << std::endl;
178 os << cscWgToGemRoll_l2;
180 os <<
"CSC HS to GEM pad LUT in ME21" << std::endl;
183 os <<
"GEM pad to CSC HS LUT in ME21" << std::endl;
187 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
192 bool rpcGeometryAvailable(
false);
193 if (
rpc_g !=
nullptr) {
194 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")<<
"+++ generateLUTsME3141() called for ME3141 chamber! +++ \n";
195 rpcGeometryAvailable =
true;
198 if (not rpcGeometryAvailable){
199 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME3141() called for ME3141 chamber without valid RPC geometry! +++ \n";
205 const CSCDetId csc_id(theEndcap, theStation, 1, chid, 0);
207 const CSCLayer* keyLayer(cscChamber->layer(3));
212 const RPCRoll* randRoll(rpcChamber->roll(2));
215 std::vector<std::pair<double,double> > rpcRollToEtaLimits;
216 std::vector<std::pair<double,double> > cscWGToEtaLimits;
217 std::vector<std::pair<int,int> > cscWgToRpcRoll;
218 std::vector<std::pair<int,int> > cscHsToRpcStrip;
219 std::vector<int> rpcStripToCscHs;
223 cscWgToRollLUT(cscWGToEtaLimits, rpcRollToEtaLimits, cscWgToRpcRoll);
227 std::stringstream os;
228 os <<
"ME31/41 "<< csc_id <<std::endl;
230 os <<
"RPC roll to eta limits" << std::endl;
231 os << rpcRollToEtaLimits;
233 os <<
"WG to eta limits" << std::endl;
234 os << cscWGToEtaLimits;
236 os <<
"WG to Roll" << std::endl;
237 os << cscWgToRpcRoll;
239 os <<
"CSC HS to RPC strip LUT in ME3141" << std::endl;
240 os << cscHsToRpcStrip;
242 os <<
"RPC strip to CSC HS LUT in ME3141" << std::endl;
243 os << rpcStripToCscHs;
246 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
252 for(
const auto&
p : lut_) {
266 const float half_striplength(roll->specs()->specificTopology().stripLength()/2.);
267 const LocalPoint lp_top(0., half_striplength, 0.);
268 const LocalPoint lp_bottom(0., -half_striplength, 0.);
270 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
278 for(
const auto& roll : rpcChamber->
rolls()) {
279 const float half_striplength(roll->specs()->specificTopology().stripLength()/2.);
280 const LocalPoint lp_top(0., half_striplength, 0.);
281 const LocalPoint lp_bottom(0., -half_striplength, 0.);
283 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
289 const std::vector<std::pair<double,double> >& inLUT2,
290 std::vector<std::pair<int,int> >& outLUT)
const 292 for (
const auto&
p: inLUT1){
302 const int numberOfWG(keyLayerGeometry->numberOfWireGroups());
303 for (
int i = 0;
i< numberOfWG; ++
i){
304 const float middle_wire(keyLayerGeometry->middleWireOfGroup(
i));
305 const std::pair<LocalPoint, LocalPoint> wire_ends(keyLayerGeometry->wireTopology()->wireEnds(middle_wire));
308 lut.emplace_back(gp_top.eta(), gp_bottom.eta());
314 int minH,
int maxH, std::vector<std::pair<int,int> >&
lut)
const 317 auto nStrips(keyLayerGeometry->numberOfStrips());
318 for (
float i = 0;
i< nStrips;
i =
i+0.5){
319 const LocalPoint lpCSC(keyLayerGeometry->topology()->localPosition(
i));
323 const bool edge(HS < minH or HS > maxH);
324 const float pad(edge ? -99 : randRoll->
pad(lpGEM));
325 lut.emplace_back(std::floor(pad),std::ceil(pad));
332 std::vector<int>&
lut)
const 334 const int nGEMPads(randRoll->
npads());
336 for (
int i = 1;
i<= nGEMPads; ++
i){
340 const float strip(keyLayerGeometry->strip(lpCSC));
341 lut.push_back( (
int) (
strip)/0.5 );
348 int minH,
int maxH, std::vector<std::pair<int,int> >&
lut)
const 351 auto nStrips(keyLayerGeometry->numberOfStrips());
352 for (
float i = 0;
i< nStrips;
i =
i+0.5){
353 const LocalPoint lpCSC(keyLayerGeometry->topology()->localPosition(
i));
357 const bool edge(HS < minH or HS > maxH);
358 const float strip(edge ? -99 : randRoll->
strip(lpRPC));
365 const RPCRoll* randRoll, std::vector<int>&
lut)
const 367 const int nRPCStrips(randRoll->
nstrips());
369 for (
int i = 1;
i<= nRPCStrips; ++
i){
373 const float strip(keyLayerGeometry->strip(lpCSC));
374 lut.push_back( (
int) (
strip-0.25)/0.5 );
float strip(const LocalPoint &lp) const
LocalPoint centreOfStrip(int strip) const
const CSCGeometry * csc_g
void cscHsToRpcStripLUT(const CSCLayer *, const RPCRoll *, int minH, int maxH, std::vector< std::pair< int, int > > &) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
void generateLUTsME3141(unsigned e, unsigned s, unsigned se, unsigned sb, unsigned c) const
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
const RPCChamber * chamber(RPCDetId id) const
void cscHsToGemPadLUT(const CSCLayer *, const GEMEtaPartition *, int minH, int maxH, std::vector< std::pair< int, int > > &) const
static RPCDetId getRPCfromCSC(const CSCDetId &csc_id)
void gemRollToEtaLimitsLUT(const GEMChamber *c, std::vector< std::pair< double, double > > &) const
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Abs< T >::type abs(const T &t)
void rpcStripToCscHsLUT(const CSCLayer *, const RPCRoll *, std::vector< int > &) const
void cscWgToEtaLimitsLUT(const CSCLayer *, std::vector< std::pair< double, double > > &) const
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return the eta partitions.
static int triggerCscIdFromLabels(int station, int ring, int chamber)
const RPCGeometry * rpc_g
short int zendcap() const
void rpcRollToEtaLimitsLUT(const RPCChamber *c, std::vector< std::pair< double, double > > &) const
void cscWgToRollLUT(const std::vector< std::pair< double, double > > &, const std::vector< std::pair< double, double > > &, std::vector< std::pair< int, int > > &) const
static int triggerSectorFromLabels(int station, int ring, int chamber)
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)