10 if (theStation==1)
generateLUTsME11(theEndcap, theSector, theSubsector, theTrigChamber);
11 if (theStation==2)
generateLUTsME21(theEndcap, theSector, theSubsector, theTrigChamber);
12 if (theStation==3)
generateLUTsME3141(theEndcap, 3, theSector, theSubsector, theTrigChamber);
13 if (theStation==4)
generateLUTsME3141(theEndcap, 4, theSector, theSubsector, theTrigChamber);
18 bool gemGeometryAvailable(
false);
19 if (
gem_g !=
nullptr) {
20 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")
21 <<
"+++ 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;
63 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1);
64 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2);
72 os <<
"ME11 "<< me1bId <<std::endl;
74 os <<
"GEM L1 roll to eta limits" << std::endl;
75 os << gemRollEtaLimits_l1;
77 os <<
"GEM L2 roll to eta limits" << std::endl;
78 os << gemRollEtaLimits_l2;
80 os <<
"ME1b "<< me1bId <<std::endl;
81 os <<
"WG roll to eta limits" << std::endl;
82 os << cscWGToEtaLimits;
84 os <<
"WG to Roll L1" << std::endl;
85 os << cscWgToGemRoll_l1;
87 os <<
"WG to Roll L2" << std::endl;
88 os << cscWgToGemRoll_l2;
90 os <<
"CSC HS to GEM pad LUT in ME1a" << std::endl;
91 os << cscHsToGemPadME1a;
93 os <<
"CSC HS to GEM pad LUT in ME1b" << std::endl;
94 os << cscHsToGemPadME1b;
96 os <<
"GEM pad to CSC HS LUT in ME1a" << std::endl;
97 os << gemPadToCscHsME1a;
99 os <<
"GEM pad to CSC HS LUT in ME1b" << std::endl;
100 os << gemPadToCscHsME1b;
103 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
108 bool gemGeometryAvailable(
false);
109 if (
gem_g !=
nullptr) {
110 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME11() called for ME21 chamber! +++ \n";
111 gemGeometryAvailable =
true;
115 if (not gemGeometryAvailable){
116 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME21() called for ME21 chamber without valid GEM geometry! +++ \n";
122 const CSCDetId csc_id(theEndcap, 2, 1, chid, 0);
124 const CSCLayer* keyLayer(cscChamber->layer(3));
127 const int region((theEndcap == 1) ? 1: -1);
135 std::vector<std::pair<double,double> > gemRollEtaLimits_l1;
136 std::vector<std::pair<double,double> > gemRollEtaLimits_l2;
137 std::vector<std::pair<double,double> > cscWGToEtaLimits;
138 std::vector<std::pair<int,int> > cscWgToGemRoll_l1;
139 std::vector<std::pair<int,int> > cscWgToGemRoll_l2;
140 std::vector<std::pair<int,int> > cscHsToGemPad;
141 std::vector<int> gemPadToCscHs;
146 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1);
147 cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2);
151 std::stringstream os;
152 os <<
"ME21 "<< csc_id <<std::endl;
154 os <<
"GEM roll to eta limits L1" << std::endl;
155 os << gemRollEtaLimits_l1;
157 os <<
"GEM roll to eta limits L2" << std::endl;
158 os << gemRollEtaLimits_l2;
160 os <<
"WG to eta limits" << std::endl;
161 os << cscWGToEtaLimits;
163 os <<
"WG to Roll L1" << std::endl;
164 os << cscWgToGemRoll_l1;
166 os <<
"WG to Roll L2" << std::endl;
167 os << cscWgToGemRoll_l2;
169 os <<
"CSC HS to GEM pad LUT in ME21" << std::endl;
172 os <<
"GEM pad to CSC HS LUT in ME21" << std::endl;
176 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
181 bool rpcGeometryAvailable(
false);
182 if (
rpc_g !=
nullptr) {
183 LogTrace(
"CSCUpgradeMotherboardLUTGenerator")<<
"+++ generateLUTsME3141() called for ME3141 chamber! +++ \n";
184 rpcGeometryAvailable =
true;
187 if (not rpcGeometryAvailable){
188 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") <<
"+++ generateLUTsME3141() called for ME3141 chamber without valid RPC geometry! +++ \n";
194 const CSCDetId csc_id(theEndcap, theStation, 1, chid, 0);
196 const CSCLayer* keyLayer(cscChamber->layer(3));
199 const RPCDetId rpc_id(getRPCfromCSC(csc_id));
201 const RPCRoll* randRoll(rpcChamber->roll(2));
204 std::vector<std::pair<double,double> > rpcRollToEtaLimits;
205 std::vector<std::pair<double,double> > cscWGToEtaLimits;
206 std::vector<std::pair<int,int> > cscWgToRpcRoll;
207 std::vector<std::pair<int,int> > cscHsToRpcStrip;
208 std::vector<int> rpcStripToCscHs;
212 cscWgToRollLUT(cscWGToEtaLimits, rpcRollToEtaLimits, cscWgToRpcRoll);
216 std::stringstream os;
217 os <<
"ME31/41 "<< csc_id <<std::endl;
219 os <<
"RPC roll to eta limits" << std::endl;
220 os << rpcRollToEtaLimits;
222 os <<
"WG to eta limits" << std::endl;
223 os << cscWGToEtaLimits;
225 os <<
"WG to Roll" << std::endl;
226 os << cscWgToRpcRoll;
228 os <<
"CSC HS to RPC strip LUT in ME3141" << std::endl;
229 os << cscHsToRpcStrip;
231 os <<
"RPC strip to CSC HS LUT in ME3141" << std::endl;
232 os << rpcStripToCscHs;
235 LogTrace(
"CSCUpgradeMotherboardLUTGenerator") << os.str();
241 for(
const auto&
p : lut_) {
255 const float half_striplength(roll->specs()->specificTopology().stripLength()/2.);
256 const LocalPoint lp_top(0., half_striplength, 0.);
257 const LocalPoint lp_bottom(0., -half_striplength, 0.);
259 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
267 for(
const auto& roll : rpcChamber->
rolls()) {
268 const float half_striplength(roll->specs()->specificTopology().stripLength()/2.);
269 const LocalPoint lp_top(0., half_striplength, 0.);
270 const LocalPoint lp_bottom(0., -half_striplength, 0.);
272 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
278 const std::vector<std::pair<double,double> >& inLUT2,
279 std::vector<std::pair<int,int> >& outLUT)
const 281 for (
const auto&
p: inLUT1){
291 const int numberOfWG(keyLayerGeometry->numberOfWireGroups());
292 for (
int i = 0;
i< numberOfWG; ++
i){
293 const float middle_wire(keyLayerGeometry->middleWireOfGroup(
i));
294 const std::pair<LocalPoint, LocalPoint> wire_ends(keyLayerGeometry->wireTopology()->wireEnds(middle_wire));
297 lut.emplace_back(gp_top.eta(), gp_bottom.eta());
303 int minH,
int maxH, std::vector<std::pair<int,int> >&
lut)
const 306 auto nStrips(keyLayerGeometry->numberOfStrips());
307 for (
float i = 0;
i< nStrips;
i =
i+0.5){
308 const LocalPoint lpCSC(keyLayerGeometry->topology()->localPosition(
i));
312 const bool edge(HS < minH or HS > maxH);
313 const float pad(edge ? -99 : randRoll->
pad(lpGEM));
314 lut.emplace_back(std::floor(pad),std::ceil(pad));
321 std::vector<int>&
lut)
const 323 const int nGEMPads(randRoll->
npads());
325 for (
int i = 1;
i<= nGEMPads; ++
i){
329 const float strip(keyLayerGeometry->strip(lpCSC));
330 lut.push_back( (
int) (
strip)/0.5 );
337 int minH,
int maxH, std::vector<std::pair<int,int> >&
lut)
const 340 auto nStrips(keyLayerGeometry->numberOfStrips());
341 for (
float i = 0;
i< nStrips;
i =
i+0.5){
342 const LocalPoint lpCSC(keyLayerGeometry->topology()->localPosition(
i));
346 const bool edge(HS < minH or HS > maxH);
347 const float strip(edge ? -99 : randRoll->
strip(lpRPC));
354 const RPCRoll* randRoll, std::vector<int>&
lut)
const 356 const int nRPCStrips(randRoll->
nstrips());
358 for (
int i = 1;
i<= nRPCStrips; ++
i){
362 const float strip(keyLayerGeometry->strip(lpCSC));
363 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
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.
const RPCGeometry * rpc_g
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
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)