7 bool gemGeometryAvailable(
false);
8 if (
gem_g !=
nullptr) {
10 <<
"+++ generateLUTsME11() called for ME11 chamber! +++ \n";
11 gemGeometryAvailable =
true;
16 const CSCChamber* cscChamberME1b(geo_manager->
chamber(theEndcap, theStation, theSector, theSubsector, theTrigChamber));
17 const CSCDetId me1bId(cscChamberME1b->id());
18 const CSCDetId me1aId(me1bId.endcap(), 1, 4, me1bId.chamber());
22 if (not gemGeometryAvailable){
23 LogTrace(
"CSCGEMTriggerLUTGenerator")
24 <<
"+++ generateLUTsME11() called for ME11 chamber without valid GEM geometry! +++ \n";
29 const CSCLayer* keyLayerME1b(cscChamberME1b->layer(3));
31 const CSCLayer* keyLayerME1a(cscChamberME1a->layer(3));
34 const int region((theEndcap == 1) ? 1: -1);
35 const GEMDetId gem_id(region, 1, theStation, 1, me1bId.chamber(), 0);
39 std::vector<std::pair<double,double> > gemRollToEtaLimits_;
41 for(
auto roll : gemChamber->etaPartitions()) {
42 const float half_striplength(roll->specs()->specificTopology().stripLength()/2.);
43 const LocalPoint lp_top(0., half_striplength, 0.);
44 const LocalPoint lp_bottom(0., -half_striplength, 0.);
46 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
47 gemRollToEtaLimits_.push_back(std::make_pair(gp_top.eta(), gp_bottom.eta()));
50 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"GEM roll to eta limits" << std::endl;
51 for(
auto p : gemRollToEtaLimits_) {
52 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"{" <<
p.first <<
", " <<
p.second <<
"}, " << std::endl;
56 std::vector<std::pair<double,double> > cscWGToEtaLimits_;
58 const int numberOfWG(keyLayerGeometryME1b->numberOfWireGroups());
59 for (
int i = 0;
i< numberOfWG; ++
i){
60 const float middle_wire(keyLayerGeometryME1b->middleWireOfGroup(
i));
61 const std::pair<LocalPoint, LocalPoint> wire_ends(keyLayerGeometryME1b->wireTopology()->wireEnds(middle_wire));
63 const GlobalPoint gp_top(keyLayerME1b->toGlobal(wire_ends.first));
64 const GlobalPoint gp_bottom(keyLayerME1b->toGlobal(wire_ends.first));
65 cscWGToEtaLimits_.push_back(std::make_pair(gp_top.eta(), gp_bottom.eta()));
68 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"ME1b "<< me1bId <<std::endl;
69 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"WG roll to eta limits" << std::endl;
70 for(
auto p : cscWGToEtaLimits_) {
71 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"{" <<
p.first <<
", " <<
p.second <<
"}, " << std::endl;
75 std::vector<std::pair<int,int> > cscWgToGemRoll_;
77 for (
int i = 0;
i< numberOfWG; ++
i){
83 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"WG to ROLL" << std::endl;
84 for(
auto p : cscWgToGemRoll_) {
85 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"{" <<
p.first <<
", " <<
p.second <<
"}, " << std::endl;
86 if (i%8==0)
LogTrace(
"CSCGEMTriggerLUTGenerator") << std::endl;
92 std::vector<std::pair<int,int> > cscHsToGemPadME1a_;
93 std::vector<std::pair<int,int> > cscHsToGemPadME1b_;
96 auto randRoll(gemChamber->etaPartition(2));
99 auto nStripsME1a(keyLayerGeometryME1a->numberOfStrips());
100 for (
float i = 0; i< nStripsME1a; i = i+0.5){
101 const LocalPoint lpCSC(keyLayerGeometryME1a->topology()->localPosition(i));
105 const bool edge(HS < 4 or HS > 93);
106 const float pad(edge ? -99 : randRoll->pad(lpGEM));
107 cscHsToGemPadME1a_.push_back(std::make_pair(std::floor(pad),std::ceil(pad)));
111 auto nStripsME1b(keyLayerGeometryME1b->numberOfStrips());
112 for (
float i = 0; i< nStripsME1b; i = i+0.5){
113 const LocalPoint lpCSC(keyLayerGeometryME1b->topology()->localPosition(i));
117 const bool edge(HS < 5 or HS > 124);
118 const float pad(edge ? -99 : randRoll->pad(lpGEM));
119 cscHsToGemPadME1b_.push_back(std::make_pair(std::floor(pad),std::ceil(pad)));
122 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"CSC HS to GEM pad LUT in ME1a";
124 for(
auto p : cscHsToGemPadME1a_) {
125 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"{" <<
p.first <<
", " <<
p.second <<
"}, " << std::endl;
126 if (i%8==0)
LogTrace(
"CSCGEMTriggerLUTGenerator") << std::endl;
129 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"CSC HS to GEM pad LUT in ME1b";
131 for(
auto p : cscHsToGemPadME1b_) {
132 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"{" <<
p.first <<
", " <<
p.second <<
"}, " << std::endl;
133 if (i%8==0)
LogTrace(
"CSCGEMTriggerLUTGenerator") << std::endl;
138 std::vector<int> gemPadToCscHsME1a_;
139 std::vector<int> gemPadToCscHsME1b_;
141 const int nGEMPads(randRoll->npads());
142 for (
int i = 0; i< nGEMPads; ++
i){
143 const LocalPoint lpGEM(randRoll->centreOfPad(i));
147 const float stripME1a(keyLayerGeometryME1a->strip(lpCSCME1a));
148 const float stripME1b(keyLayerGeometryME1b->strip(lpCSCME1b));
149 gemPadToCscHsME1a_.push_back( (
int) (stripME1a)/0.5);
150 gemPadToCscHsME1b_.push_back( (
int) (stripME1b)/0.5);
153 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"GEM pad to CSC HS LUT in ME1a";
155 for(
auto p : gemPadToCscHsME1a_) {
156 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
p;
157 if (i%8==0)
LogTrace(
"CSCGEMTriggerLUTGenerator") << std::endl;
160 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"GEM pad to CSC HS LUT in ME1b";
162 for(
auto p : gemPadToCscHsME1b_) {
163 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
p;
164 if (i%8==0)
LogTrace(
"CSCGEMTriggerLUTGenerator") << std::endl;
171 bool gemGeometryAvailable(
false);
172 if (
gem_g !=
nullptr) {
173 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"+++ generateLUTsME11() called for ME21 chamber! +++ \n";
174 gemGeometryAvailable =
true;
179 const CSCChamber* cscChamber(geo_manager->
chamber(theEndcap, theStation, theSector, theSubsector, theTrigChamber));
180 const CSCDetId csc_id(cscChamber->id());
183 if (not gemGeometryAvailable){
184 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"+++ generateLUTsME11() called for ME21 chamber without valid GEM geometry! +++ \n";
189 const CSCLayer* keyLayer(cscChamber->layer(3));
192 const int region((theEndcap == 1) ? 1: -1);
193 const GEMDetId gem_id(region, 1, 2, 1, csc_id.chamber(), 0);
196 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"ME21 "<< csc_id <<std::endl;
199 std::vector<std::pair<double,double> > gemRollToEtaLimits_;
201 for(
auto roll : gemChamber->etaPartitions()) {
202 const float half_striplength(roll->specs()->specificTopology().stripLength()/2.);
203 const LocalPoint lp_top(0., half_striplength, 0.);
204 const LocalPoint lp_bottom(0., -half_striplength, 0.);
206 const GlobalPoint gp_bottom(roll->toGlobal(lp_bottom));
207 gemRollToEtaLimits_[
n] = std::make_pair(gp_top.eta(), gp_bottom.eta());
211 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"GEM roll to eta limits" << std::endl;
212 for(
auto p : gemRollToEtaLimits_) {
213 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"{"<<
p.first <<
", " <<
p.second <<
"}, " << std::endl;
217 std::vector<double> cscWGToEtaLimits_;
218 const int numberOfWG(keyLayerGeometry->numberOfWireGroups());
220 for (
int i = 0;
i< numberOfWG; ++
i){
221 const LocalPoint wire_loc(keyLayerGeometry->localCenterOfWireGroup(
i));
223 cscWGToEtaLimits_.push_back(
gp.eta() );
227 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"WG to eta limits" << std::endl;
228 for(
auto p : cscWGToEtaLimits_) {
229 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
p << std::endl;
233 std::vector<int> cscWgToGemRoll_;
234 for (
int i = 0;
i< numberOfWG; ++
i){
235 auto eta(cscWGToEtaLimits_[
i]);
239 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"WG to roll" << std::endl;
241 for(
auto p : cscWgToGemRoll_) {
242 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
p;
243 if (i%8==0)
LogTrace(
"CSCGEMTriggerLUTGenerator") << std::endl;
248 std::vector<int> gemPadToCscHs_;
249 std::vector<std::pair<int,int>> cscHsToGemPad_;
251 auto randRoll(gemChamber->etaPartition(2));
252 auto nStrips(keyLayerGeometry->numberOfStrips());
253 for (
float i = 0; i< nStrips; i = i+0.5){
254 const LocalPoint lpCSC(keyLayerGeometry->topology()->localPosition(i));
258 const bool edge(HS < 5 or HS > 155);
259 const float pad(edge ? -99 : randRoll->pad(lpGEM));
261 cscHsToGemPad_.push_back( std::make_pair(std::floor(pad),std::ceil(pad)) );
264 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"CSC HS to GEM pad LUT in ME21";
266 for(
auto p : cscHsToGemPad_) {
267 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"{"<<
p.first <<
", " <<
p.second <<
"}, " << std::endl;
268 if (i%8==0)
LogTrace(
"CSCGEMTriggerLUTGenerator") << std::endl;
273 const int nGEMPads(randRoll->npads());
274 for (
int i = 0; i< nGEMPads; ++
i){
275 const LocalPoint lpGEM(randRoll->centreOfPad(i));
278 const float strip(keyLayerGeometry->strip(lpCSC));
280 gemPadToCscHs_.push_back( (
int) (
strip)/0.5 );
283 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
"GEM pad to CSC HS LUT in ME21";
285 for(
auto p : gemPadToCscHs_) {
286 LogTrace(
"CSCGEMTriggerLUTGenerator") <<
p;
287 if (i%8==0)
LogTrace(
"CSCGEMTriggerLUTGenerator") << std::endl;
296 for(
auto p : gemRollToEtaLimits_) {
300 if (minEta <= eta and eta <= maxEta) {
CSCChamber * chamber(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned tcscid) const
Return the CSCChamber for a corresponding endcap/station/sector/subsector/trigger cscid...
const GEMGeometry * gem_g
U second(std::pair< T, U > const &p)
static CSCTriggerGeomManager * get()
int assignGEMRoll(const std::vector< std::pair< double, double > > &, double eta)
void generateLUTsME11(unsigned theEndcap, unsigned theStation, unsigned theSector, unsigned theSubSector, unsigned theTrigChamber)
const CSCGeometry * csc_g
const GEMChamber * chamber(GEMDetId id) const
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
void generateLUTsME21(unsigned theEndcap, unsigned theStation, unsigned theSector, unsigned theSubSector, unsigned theTrigChamber)