CMS 3D CMS Logo

MEEEGeom.cc
Go to the documentation of this file.
1 #include <cassert>
2 #include <iostream>
3 #include <cstdlib>
4 #include <string>
5 using namespace std;
6 
9 
10 //GHM ClassImp(MEEEGeom)
11 
12 bool
13 MEEEGeom::pnTheory = true;
14 
15 int
17 {
18  bool near = iX>=11; bool far = !near;
19  bool top = iY>=11; bool bot = !top;
20 
21  int iquad=0;
22  if( near && top ) iquad=1;
23  if( far && top ) iquad=2;
24  if( far && bot ) iquad=3;
25  if( near && bot ) iquad=4;
26 
27  return iquad;
28 }
29 
30 int
32 {
33 
34  // Y (towards the surface)
35  // T
36  // |
37  // |
38  // |
39  // o---------| X (towards center of LHC)
40  //
41  static const int
42  idx_[] =
43  {
44  // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
45  0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, // 20
46  0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, // 19
47  0, 0, 0, 2, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 8, 0, 0, 0, // 18
48  0, 0, 2, 2, 2, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 8, 8, 8, 0, 0, // 17
49  0, 2, 2, 2, 2, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 8, 8, 8, 8, 0, // 16
50  0, 2, 2, 2, 2, 2, 1, 1, 1, 1, 9, 9, 9, 9, 8, 8, 8, 8, 8, 0, // 15
51  0, 2, 2, 2, 2, 2, 2, 1, 1, 1, 9, 9, 9, 8, 8, 8, 8, 8, 8, 0, // 14
52  2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, // 13
53  3, 3, 2, 2, 2, 2, 2, 2, 2, 0, 0, 8, 8, 8, 8, 8, 8, 8, 7, 7, // 12
54  3, 3, 3, 3, 3, 3, 3, 2, 0, 0, 0, 0, 8, 7, 7, 7, 7, 7, 7, 7, // 11
55  3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, // 10
56  3, 3, 3, 3, 3, 3, 3, 4, 4, 0, 0, 6, 6, 7, 7, 7, 7, 7, 7, 7, // 9
57  3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, // 8
58  0, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 0, // 7
59  0, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 0, // 6
60  0, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 0, // 5
61  0, 0, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 0, 0, // 4
62  0, 0, 0, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 0, 0, 0, // 3
63  0, 0, 0, 0, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 0, 0, 0, 0, // 2
64  0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0 // 1
65  // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
66  };
67 
68 
69  int iym, ixm, il, ic, ii;
70  iym=20;
71  ixm=20;
72  int iX_ = iX;
73  int iY_ = iY;
74  il=iym-iY_;
75  ic=iX_-1;
76  ii=il*ixm+ic;
77 
78  if(ii < 0 || ii > (int)(sizeof(idx_)/sizeof(int)) || idx_[ii] == 0) { return -1; };
79  return idx_[ii];
80 }
81 
82 int
84 {
85  // this is *my* convention. To be consistent with the barrel
86  // sm goes from 1 to 9 for iz+ and from 10 to 18 for iz-
87  int ism_ = sector( iX, iY );
88  if( ism_<0 ) return ism_;
89  if( iz<0 ) ism_+=9;
90  return ism_;
91 }
92 
93 int
95 {
96  //
97  // laser monitoring modules for EE-F and EE+F
98  // for EE-N and EE+N : iX ---> 20-iX+1
99  //
100 
101  static const int
102  idx_[] =
103  {
104  // 1 2 3 4 5 6 7 8 9 A
105  //------------------------------
106  0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
107  0, 0, 0, 0, 2, 1, 1, 1, 1, 1,
108  0, 0, 0, 5, 2, 2, 2, 2, 2, 1,
109  0, 0, 5, 5, 5, 3, 3, 2, 2, 2,
110  0, 8, 5, 5, 5, 3, 3, 3, 3, 3,
111  0, 8, 8, 5, 6, 6, 4, 4, 4, 3,
112  0, 8, 8, 5, 6, 6, 7, 4, 4, 4,
113  8, 8, 8, 6, 6, 7, 7, 7, 4, 4,
114  9, 9, 8, 6, 6, 7, 7, 7, 7, 0,
115  9, 9, 9, 10, 10, 11, 11, 7, 0, 0,
116  12, 9, 9, 10, 10, 11, 11, 11, 0, 0,
117  12, 12, 13, 10, 10, 11, 11, 17, 17, 0,
118  12, 12, 13, 13, 13, 11, 17, 17, 17, 19,
119  0, 12, 13, 13, 14, 15, 17, 17, 17, 19,
120  0, 12, 14, 14, 14, 15, 16, 17, 19, 19,
121  0, 14, 14, 14, 14, 15, 16, 16, 19, 19,
122  0, 0, 14, 15, 15, 15, 16, 16, 19, 19,
123  0, 0, 0, 15, 15, 15, 16, 18, 18, 18,
124  0, 0, 0, 0, 16, 16, 16, 18, 18, 18,
125  0, 0, 0, 0, 0, 0, 0, 18, 18, 18
126  };
127 
128  int iym, ixm, il, ic, ii;
129  iym=20;
130  ixm=10;
131  int iX_ = iX;
132  if( iX>=11 ) iX_ = 20-iX+1;
133  int iY_ = iY;
134  il=iym-iY_;
135  ic=iX_-1;
136  ii=il*ixm+ic;
137  if(ii < 0 || ii > (int)(sizeof(idx_)/sizeof(int)) || idx_[ii] == 0) { return -1; };
138  return idx_[ii];
139 }
140 
141 int
143 {
144  static const int
145  idx_[] =
146  {
147  // 1 2 3 4 5 6 7 8 9 A
148  //-----------------------------------
149  77, 71, 63, 55, 46, 37, 28, 18, 0, 0, // A
150  78, 72, 64, 56, 47, 38, 29, 19, 9, 0, // 9
151  79, 73, 65, 57, 48, 39, 30, 20, 10, 1, // 8
152  0, 74, 66, 58, 49, 40, 31, 21, 11, 2, // 7
153  0, 75, 67, 59, 50, 41, 32, 22, 12, 3, // 6
154  0, 76, 68, 60, 51, 42, 33, 23, 13, 4, // 5
155  0, 0, 69, 61, 52, 43, 34, 24, 14, 5, // 4
156  0, 0, 70, 62, 53, 44, 35, 25, 15, 6, // 3
157  0, 0, 0, 0, 54, 45, 36, 26, 16, 7, // 2
158  0, 0, 0, 0, 0, 0, 0, 27, 17, 8, // 1
159  //-----------------------------------
160  };
161  int iym, ixm, il, ic, ii;
162  iym=10;
163  ixm=10;
164  int iX_ = iX;
165  if( iX>=11 ) iX_ = 20-iX+1;
166  int iY_ = iY;
167  if( iY>=11 ) iY_ = 20-iY+1;
168  il=iym-iY_;
169  ic=iX_-1;
170  ii=il*ixm+ic;
171  if(ii < 0 || ii > (int)(sizeof(idx_)/sizeof(int)) || idx_[ii] == 0) { return -1; };
172  return idx_[ii];
173 }
174 
175 int
177 {
178  static const int
179  idx_[] =
180  {
181  // there are seven types of super-crystals
182  // 1 2 3 4 5 6 7 8 9 10
183  //-----------------------------------
184  0, 0, 0, 0, 0, 0, 0, 3, -1, -1, // 10
185  0, 0, 0, 0, 0, 0, 0, 0, 2, -1, // 9
186  6, 0, 0, 0, 0, 0, 0, 0, 0, 1, // 8
187  -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
188  -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
189  -1, 6, 0, 0, 0, 0, 0, 0, 0, 0, // 5
190  -1, -1, 6, 0, 0, 0, 0, 0, 0, 0, // 4
191  -1, -1, 5, 4, 0, 0, 0, 0, 0, 0, // 3
192  -1, -1, -1, -1, 4, 0, 0, 0, 0, 0, // 2
193  -1, -1, -1, -1, -1, -1, -1, 4, 0, 0, // 1
194  //-----------------------------------
195  };
196  int iym, ixm, il, ic, ii;
197  iym=10;
198  ixm=10;
199  int iX_ = iX;
200  if( iX>=11 ) iX_ = 20-iX+1;
201  int iY_ = iY;
202  if( iY>=11 ) iY_ = 20-iY+1;
203  il=iym-iY_;
204  ic=iX_-1;
205  ii=il*ixm+ic;
206  if(ii < 0 || ii > (int)(sizeof(idx_)/sizeof(int)) || idx_[ii] == -1) { return -1; };
207  return idx_[ii];
208 }
209 
210 int
212 {
213  int isc_in_quad = sc_in_quad( iX, iY );
214  assert( isc_in_quad!=0 );
215  if( isc_in_quad<0 ) return -1;
216 
217  int iquad = quadrant( iX, iY );
218  return 79*(iquad-1)+isc_in_quad;
219 }
220 
221 int
223 {
224  // end-cap minus:
225  // S7 --> DCC-1 (N)
226  // S8 --> DCC-2 (N)
227  // S9 --> DCC-3 (N)
228  // S1 --> DCC-4 (F)
229  // S2 --> DCC-5 (F)
230  // S3 --> DCC-6 (F)
231  // S4 --> DCC-7 (F)
232  // S5 --> DCC-8 (F and N)
233  // S6 --> DCC-9 (N)
234  // for the end-cap plus, add 45 to the DCC number
235  int isect = sector( iX, iY );
236  assert( isect!=0 );
237  assert( abs(iz)==1 );
238  if( isect<0 ) return -1;
239 
240  int idcc=0;
241 
242  idcc = isect-6;
243  if( idcc<=0 ) idcc+=9;
244  if( iz==+1 ) idcc+=45;
245 
246  return idcc;
247 }
248 
249 int
251 {
252  // laser monitoring regions
253  // end-cap minus:
254  // S7 --> LM-1
255  // S8 --> LM-2
256  // S9 --> LM-3
257  // S1 --> LM-4
258  // S2 --> LM-5
259  // S3 --> LM-6
260  // S4 --> LM-7
261  // S5 --> LM-8 (F) and LM-9 (N)
262  // S6 --> LM-10
263  // for the end-cap plus, add 72 to the LM number
264  // for the end-cap minus, add 82 to the LM number
265 
266  int iquad = quadrant( iX, iY );
267  int isect = sector( iX, iY );
268  assert( isect!=0 );
269  assert( abs(iz)==1 );
270  if( isect<0 ) return -1;
271 
272  int ilmr=0;
273  ilmr = isect-6;
274  if( ilmr<=0 ) ilmr+=9;
275  if( ilmr==9 ) ilmr++;
276  if( ilmr==8 && iquad==4 ) ilmr++;
277  if( iz==+1 ) ilmr+=72;
278  else ilmr+=82;
279 
280  return ilmr;
281 }
282 
283 int
285 {
286  int iquad = quadrant( iX, iY );
287  int idee=0;
288  bool far = ( iquad==2 || iquad==3 ); bool near = !far;
289  bool plus = (iz>0); bool minus = !plus;
290  if( far && plus ) idee=1;
291  if( near && plus ) idee=2;
292  if( near && minus ) idee=3;
293  if( far && minus ) idee=4;
294 
295  return idee;
296 }
297 
298 int
300 {
301  // the seven types of super-crystals
302  static const int
303  idx_[7][25] =
304  {
305  {
306  21, 16, 11, 6, 1,
307  22, 17, 12, 7, 2,
308  23, 18, 13, 8, 3,
309  24, 19, 14, 9, 4,
310  25, 20, 15, 10, 5
311  }, {
312  -1, -1, -1, -1, -1,
313  22, 17, 12, 7, 2,
314  23, 18, 13, 8, 3,
315  24, 19, 14, 9, 4,
316  25, 20, 15, 10, 5,
317  }, {
318  -1, -1, -1, -1, -1,
319  -1, -1, -1, -1, -1,
320  23, -1, -1, -1, -1,
321  24, 19, -1, -1, -1,
322  25, 20, 15, -1, -1
323  }, {
324  21, 16, 11, 6, -1,
325  22, 17, 12, 7, -1,
326  23, 18, 13, 8, -1,
327  24, 19, 14, 9, -1,
328  25, 20, 15, 10, -1
329  }, {
330  21, 16, 11, 6, 1,
331  22, 17, 12, 7, 2,
332  -1, -1, -1, -1, -1,
333  -1, -1, -1, -1, -1,
334  -1, -1, -1, -1, -1,
335  }, {
336  -1, -1, -1, -1, -1,
337  -1, -1, -1, -1, -1,
338  -1, -1, -1, -1, -1,
339  -1, -1, -1, -1, -1,
340  -1, -1, -1, -1, -1,
341  }, {
342  -1, -1, -1, 6, 1,
343  -1, -1, -1, 7, 2,
344  -1, -1, -1, 8, 3,
345  -1, -1, -1, 9, 4,
346  -1, -1, -1, 10, 5
347  }
348  };
349 
350  int iX, iY, jx, jy;
351  int iX_ = (ix-1)/5+1;
352  int iY_ = (iy-1)/5+1;
353  int jx_ = ix - 5*(iX_-1);
354  int jy_ = iy - 5*(iY_-1);
355 
356  int iquad = quadrant( iX_, iY_ );
357  if( iX_>=11 )
358  {
359  iX_ = 20-iX_+1;
360  jx_ = 5-jx_+1;
361  }
362  if( iY_>=11 )
363  {
364  iY_ = 20-iY_+1;
365  jy_ = 5-jy_+1;
366  }
367 
368  // FIXME : this is stupid !!!
369  if( iquad==1 || iquad==3 )
370  {
371  iX = iX_;
372  iY = iY_;
373  jx = jx_;
374  jy = jy_;
375  }
376  else
377  {
378  iX = iY_;
379  iY = iX_;
380  jx = jy_;
381  jy = jx_;
382  }
383 
384  int isc_type = sc_type( iX, iY );
385  assert( isc_type>=0 && isc_type<7 );
386 
387  int iym, ixm, il, ic, ii;
388  iym=5;
389  ixm=5;
390  il=iym-jy;
391  ic=jx-1;
392  ii=il*ixm+ic;
393  if(ii < 0 || ii > (int)(sizeof(idx_)/sizeof(int)) || idx_[isc_type][ii] == -1) { return -1; };
394  return idx_[isc_type][ii];
395 }
396 
397 int
399 {
400 
401  int iX = (ix-1)/5+1;
402  int iY = (iy-1)/5+1;
403  int isc = sc( iX, iY );
404  assert( isc!=0 );
405  if( isc<0 ) return -2;
406 
407  int icr_in_sc = crystal_in_sc( ix, iy );
408  assert( icr_in_sc!=0 );
409  if( icr_in_sc<0 ) return -1;
410 
411  return 25*(isc-1) + icr_in_sc;
412 }
413 
414 TString
416 {
417  assert( ism>=1 && ism<=18 );
418  TString out = "EE+";
419  if( ism>9 )
420  {
421  out = "EE-";
422  ism -= 9;
423  }
424  out += ism;
425  return out;
426 }
427 
428 int
430 {
431  assert( ism>=1 && ism<=18 );
432  int dcc_[18] =
433  { 49, 50, 51, 52, 53, 54, 46, 47, 48,
434  4, 5, 6, 7, 8, 9, 1, 2, 3 };
435  return dcc_[ism-1];
436 }
437 
438 int
440 {
441  if( idcc>600 ) idcc-=600; // also works with FEDids
442  int ism(0);
443  if( idcc>=1 && idcc<=9 )
444  {
445  ism = 6+idcc;
446  if( ism>9 ) ism-=9;
447  ism+=9;
448  }
449  else if( idcc>=46 && idcc<=54 )
450  {
451  ism = idcc-46+7;
452  if( ism>9 ) ism-=9;
453  }
454  else
455  abort();
456  return ism;
457 }
458 
459 TGraph*
460 MEEEGeom::getGraphBoundary( int type, int num, int iz, int xside )
461 {
462  std::list< std::pair< float, float > > l;
463  getBoundary( l, type, num, iz, xside );
464  int n = l.size();
465  if( n==0 ) return nullptr;
466 
467  // GHM : changed to comply to CMSSW compilator options
468  float ix[1000];
469  float iy[1000];
470  assert( n<1000 );
471 
472  int ii=0;
473  std::list< std::pair< float, float > >::const_iterator l_it;
474  for( l_it=l.begin(); l_it!=l.end(); ++l_it )
475  {
476  // std::cout << "[" << l_it->first << "," << l_it->second << "]" << std::endl;
477  ix[ii] = l_it->first;
478  iy[ii] = l_it->second;
479  ii++;
480  }
481  assert( ii==n );
482  return new TGraph( n, ix, iy );
483 }
484 
485 void
486 MEEEGeom::getBoundary( std::list< std::pair< float, float > >& l, int type, int num, int iz, int xside )
487 {
488  // for each iy, get first and last ix for <whatever>
489  std::multimap< int, std::pair< int, int > > map_;
490 
491  int iymin=1;
492  int iymax=100;
493  int ixmin=1;
494  int ixmax=100;
495  if( xside==1 )
496  {
497  ixmin=1; ixmax=50;
498  }
499  if( xside==2 )
500  {
501  ixmin=51; ixmax=100;
502  }
503 
504  for( int iy=iymin; iy<=iymax; iy++ )
505  {
506  bool in=false;
507  int firstix(0);
508  int lastix(0);
509  for( int ix=ixmin; ix<=ixmax; ix++ )
510  {
511 
512  int icr = crystal( ix, iy );
513  bool ok = icr>0;
514 
515  int iX = (ix-1)/5+1;
516  int iY = (iy-1)/5+1;
517 
518  int num_(0);
519  switch( type )
520  {
521  case iDee:
522  num_ = dee( iX, iY, iz ); break;
523  case iQuadrant:
524  num_ = quadrant( iX, iY ); break;
525  case iSector:
526  num_ = sector( iX, iY ); break;
527  case iLMRegion:
528  num_ = lmr( iX, iY, iz ); break;
529  case iLMModule:
530  num_ = lmmod( iX, iY ); break;
531  case iDCC:
532  num_ = dcc( iX, iY, iz ); break;
533  case iSuperCrystal:
534  num_ = sc( iX, iY ); break;
535  case iCrystal:
536  num_ = crystal( ix, iy ); break;
537  default:
538  abort();
539  };
540  ok &= num_==num;
541 
542  if( !in && !ok ) continue;
543  if( in && ok )
544  {
545  lastix = ix;
546  continue;
547  }
548  if( !in && ok )
549  {
550  in = true;
551  firstix = ix;
552  }
553  else if( in && !ok )
554  {
555  in = false;
556  map_.insert( std::pair< int, std::pair<int, int> >( iy, std::pair<int,int>( firstix, lastix ) ) );
557  }
558  }
559  if( in ) map_.insert( std::pair< int, std::pair<int, int> >( iy, std::pair<int,int>( firstix, lastix ) ) );
560 
561  }
562 
563  // clean the list
564  l.clear();
565 
566  std::multimap< int, std::pair< int, int > >::const_iterator it;
567  std::multimap< int, std::pair< int, int > >::const_iterator lastelement;
568  std::list< std::pair< float, float > > rightl;
569  for( int iy=1; iy<=100; iy++ )
570  {
571  it = map_.find(iy);
572  if( it==map_.end() ) continue;
573  int n_ = map_.count( iy );
574  // std::cout << "n[" << iy << "]=" << n_ << std::endl;
575  assert( n_==1 ); // fixme !
576 
577  lastelement = map_.upper_bound(iy);
578  for( ; it!=lastelement; ++it )
579  {
580  std::pair<float,float> p_ = it->second;
581  l.push_back( std::pair<float,float>( p_.first-0.5, iy-0.5 ) );
582  l.push_back( std::pair<float,float>( p_.first-0.5, iy+0.5 ) );
583  rightl.push_back( std::pair<float,float>( p_.second+0.5, iy-0.5 ) );
584  rightl.push_back( std::pair<float,float>( p_.second+0.5, iy+0.5 ) );
585 
586  }
587  }
588  l.unique();
589  rightl.unique();
590  rightl.reverse();
591 
592  std::list< std::pair< float, float > >::const_iterator rightl_it;
593  for( rightl_it=rightl.begin(); rightl_it!=rightl.end(); ++rightl_it )
594  {
595  l.push_back( std::pair<float,float>( rightl_it->first, rightl_it->second ) );
596  }
597  l.push_back( *l.begin() );
598 
599 }
600 
601 int
603 {
604  int imem_ = imem%600;
605  int dee_(0);
606  if( imem_==50 || imem_==51 ) dee_=1;
607  else if( imem_==47 || imem_==46 ) dee_=2;
608  else if( imem_==1 || imem_==2 ) dee_=3;
609  else if( imem_==5 || imem_==6 ) dee_=4;
610  else abort();
611  return dee_;
612 }
613 
614 std::pair< int, int >
615 MEEEGeom::pn( int dee, int ilmmod )
616 {
617  // table below
618  // convention to be consistent with Marc's numbering
619  // PNA = 100 + pn + 1
620  // PNB = 200 + pn + 1
621 
622  // LMR=73 EE+7(646/0)
623  // -- module 9 PNA=(647)106 PNB=(646)201
624  // -- module 10 PNA=(647)103 PNB=(646)208
625  // -- module 11 PNA=(647)103 PNB=(646)203
626  // -- module 12 PNA=(647)101 PNB=(646)206
627  // -- module 13 PNA=(647)104 PNB=(646)209
628  // LMR=74 EE+8(647/0)
629  // -- module 5 PNA=(647)105 PNB=(646)210
630  // -- module 6 PNA=(647)110 PNB=(646)205
631  // -- module 7 PNA=(647)107 PNB=(646)202
632  // -- module 8 PNA=(647)105 PNB=(646)210
633  // LMR=75 EE+9(648/0)
634  // -- module 1 PNA=(647)110 PNB=(646)205
635  // -- module 2 PNA=(647)107 PNB=(646)202
636  // -- module 3 PNA=(647)105 PNB=(646)210
637  // -- module 4 PNA=(647)105 PNB=(646)210
638  // LMR=76 EE+1(649/0)
639  // -- module 1 PNA=(650)102 PNB=(651)206
640  // -- module 2 PNA=(650)102 PNB=(651)207
641  // -- module 3 PNA=(650)103 PNB=(651)208
642  // -- module 4 PNA=(650)104 PNB=(651)209
643  // LMR=77 EE+2(650/0)
644  // -- module 5 PNA=(650)103 PNB=(651)208
645  // -- module 6 PNA=(650)102 PNB=(651)206
646  // -- module 7 PNA=(650)102 PNB=(651)207
647  // -- module 8 PNA=(650)104 PNB=(651)209
648  // LMR=78 EE+3(651/0)
649  // -- module 9 PNA=(650)106 PNB=(651)201
650  // -- module 10 PNA=(650)107 PNB=(651)202
651  // -- module 11 PNA=(650)108 PNB=(651)203
652  // -- module 12 PNA=(650)109 PNB=(651)204
653  // -- module 13 PNA=(650)110 PNB=(651)205
654  // LMR=79 EE+4(652/0)
655  // -- module 14 PNA=(650)108 PNB=(651)203
656  // -- module 15 PNA=(650)106 PNB=(651)201
657  // -- module 16 PNA=(650)107 PNB=(651)202
658  // -- module 17 PNA=(650)110 PNB=(651)205
659  // LMR=80 EE+5(653/0)
660  // -- module 18 PNA=(650)105 PNB=(651)210
661  // -- module 19 PNA=(650)109 PNB=(651)204
662  // LMR=81 EE+5(653/1)
663  // -- module 18 PNA=(647)101 PNB=(646)206
664  // -- module 19 PNA=(647)101 PNB=(646)206
665  // LMR=82 EE+6(654/0)
666  // -- module 14 PNA=(647)108 PNB=(646)203
667  // -- module 15 PNA=(647)106 PNB=(646)201
668  // -- module 16 PNA=(647)103 PNB=(646)208
669  // -- module 17 PNA=(647)104 PNB=(646)209
670  // LMR=83 EE-7(601/0)
671  // -- module 9 PNA=(601)108 PNB=(602)203
672  // -- module 10 PNA=(601)105 PNB=(602)210
673  // -- module 11 PNA=(601)106 PNB=(602)201
674  // -- module 12 PNA=(601)110 PNB=(602)205
675  // -- module 13 PNA=(601)110 PNB=(602)205
676  // LMR=84 EE-8(602/0)
677  // -- module 5 PNA=(601)103 PNB=(602)208
678  // -- module 6 PNA=(601)101 PNB=(602)206
679  // -- module 7 PNA=(601)101 PNB=(602)206
680  // -- module 8 PNA=(601)103 PNB=(602)209
681  // LMR=85 EE-9(603/0)
682  // -- module 1 PNA=(601)101 PNB=(602)206
683  // -- module 2 PNA=(601)101 PNB=(602)206
684  // -- module 3 PNA=(601)103 PNB=(602)208
685  // -- module 4 PNA=(601)103 PNB=(602)209
686  // LMR=86 EE-1(604/0)
687  // -- module 1 PNA=(605)105 PNB=(606)210
688  // -- module 2 PNA=(605)102 PNB=(606)207
689  // -- module 3 PNA=(605)102 PNB=(606)207
690  // -- module 4 PNA=(605)110 PNB=(606)205
691  // LMR=87 EE-2(605/0)
692  // -- module 5 PNA=(605)105 PNB=(606)210
693  // -- module 6 PNA=(605)105 PNB=(606)210
694  // -- module 7 PNA=(605)102 PNB=(606)207
695  // -- module 8 PNA=(605)110 PNB=(606)205
696  // LMR=88 EE-3(606/0)
697  // -- module 9 PNA=(605)101 PNB=(606)206
698  // -- module 10 PNA=(605)108 PNB=(606)203
699  // -- module 11 PNA=(605)103 PNB=(606)208
700  // -- module 12 PNA=(605)106 PNB=(606)201
701  // -- module 13 PNA=(605)109 PNB=(606)204
702  // LMR=89 EE-4(607/0)
703  // -- module 14 PNA=(605)103 PNB=(606)208
704  // -- module 15 PNA=(605)101 PNB=(606)206
705  // -- module 16 PNA=(605)108 PNB=(606)203
706  // -- module 17 PNA=(605)109 PNB=(606)204
707  // LMR=90 EE-5(608/0)
708  // -- module 18 PNA=(605)106 PNB=(606)201
709  // -- module 19 PNA=(605)106 PNB=(606)201
710  // LMR=91 EE-5(608/1)
711  // -- module 18 PNA=(601)107 PNB=(602)202
712  // -- module 19 PNA=(601)110 PNB=(602)205
713  // LMR=92 EE-6(609/0)
714  // -- module 14 PNA=(601)106 PNB=(602)201
715  // -- module 15 PNA=(601)108 PNB=(602)203
716  // -- module 16 PNA=(601)105 PNB=(602)210
717  // -- module 17 PNA=(601)105 PNB=(602)210
718 
719  if( ilmmod==20 ) ilmmod=18;
720  if( ilmmod==21 ) ilmmod=19;
721 
722  std::pair<int,int> pns(0,0);
723 
724  if( pnTheory )
725  {
726  switch( ilmmod )
727  {
728  case 1: pns.first=0; pns.second=5; break;
729  case 2: pns.first=1; pns.second=6; break;
730  case 3: pns.first=2; pns.second=7; break;
731  case 4: pns.first=3; pns.second=8; break;
732  case 5: pns.first=2; pns.second=7; break;
733  case 6: pns.first=0; pns.second=5; break;
734  case 7: pns.first=1; pns.second=6; break;
735  case 8: pns.first=3; pns.second=8; break;
736  case 9: pns.first=5; pns.second=0; break;
737  case 10: pns.first=6; pns.second=1; break;
738  case 11: pns.first=7; pns.second=2; break;
739  case 12: pns.first=8; pns.second=3; break;
740  case 13: pns.first=9; pns.second=4; break;
741  case 14: pns.first=7; pns.second=2; break;
742  case 15: pns.first=5; pns.second=0; break;
743  case 16: pns.first=6; pns.second=1; break;
744  case 17: pns.first=9; pns.second=4; break;
745  case 18: pns.first=4; pns.second=9; break;
746  case 19: pns.first=8; pns.second=3; break;
747  default:
748  abort();
749  };
750  }
751  else
752  {
753  // theoretical ~ dee 1
754  if( dee==1 )
755  {
756  switch( ilmmod )
757  {
758  // case 1: pns.first=0; pns.second=5; break;
759  case 1: pns.first=1; pns.second=5; break; // missing PNA
760  case 2: pns.first=1; pns.second=6; break;
761  case 3: pns.first=2; pns.second=7; break;
762  case 4: pns.first=3; pns.second=8; break;
763  case 5: pns.first=2; pns.second=7; break;
764  // case 6: pns.first=0; pns.second=5; break;
765  case 6: pns.first=1; pns.second=5; break; // missing PNA
766  case 7: pns.first=1; pns.second=6; break;
767  case 8: pns.first=3; pns.second=8; break;
768  case 9: pns.first=5; pns.second=0; break;
769  case 10: pns.first=6; pns.second=1; break;
770  case 11: pns.first=7; pns.second=2; break;
771  case 12: pns.first=8; pns.second=3; break;
772  case 13: pns.first=9; pns.second=4; break;
773  case 14: pns.first=7; pns.second=2; break;
774  case 15: pns.first=5; pns.second=0; break;
775  case 16: pns.first=6; pns.second=1; break;
776  case 17: pns.first=9; pns.second=4; break;
777  case 18: pns.first=4; pns.second=9; break;
778  case 19: pns.first=8; pns.second=3; break;
779  default:
780  abort();
781  };
782  }
783  else if( dee==2 )
784  {
785  switch( ilmmod )
786  {
787  case 1: pns.first=9; pns.second=4; break;
788  case 2: pns.first=6; pns.second=1; break;
789  // case 3: pns.first=2; pns.second=7; break;
790  case 3: pns.first=4; pns.second=9; break; // missing PNA & PNB
791  case 4: pns.first=4; pns.second=9; break;
792  // case 5: pns.first=2; pns.second=7; break;
793  case 5: pns.first=4; pns.second=9; break; // missing PNA & PNB
794  case 6: pns.first=9; pns.second=4; break;
795  case 7: pns.first=6; pns.second=1; break;
796  case 8: pns.first=4; pns.second=9; break;
797  case 9: pns.first=5; pns.second=0; break;
798  case 10: pns.first=2; pns.second=7; break;
799  // case 11: pns.first=7; pns2second=2; break;
800  case 11: pns.first=2; pns.second=2; break; // PNA - fibre cassee
801  case 12: pns.first=0; pns.second=5; break;
802  case 13: pns.first=3; pns.second=8; break;
803  case 14: pns.first=7; pns.second=2; break;
804  case 15: pns.first=5; pns.second=0; break;
805  case 16: pns.first=2; pns.second=7; break;
806  case 17: pns.first=3; pns.second=8; break;
807  // case 18: pns.first=4; pns.second=9; break;
808  case 18: pns.first=0; pns.second=5; break; // missing PNA & PNB
809  case 19: pns.first=0; pns.second=5; break;
810  default:
811  abort();
812  };
813  }
814  else if( dee==3 )
815  {
816  switch( ilmmod )
817  {
818  case 1: pns.first=0; pns.second=5; break;
819  // case 2: pns.first=0; pns.second=1; break;
820  case 2: pns.first=0; pns.second=5; break; // missing PNA & PNB
821  case 3: pns.first=2; pns.second=7; break;
822  // case 4: pns.first=4; pns.second=9; break;
823  case 4: pns.first=2; pns.second=8; break; // missing PNA
824  case 5: pns.first=2; pns.second=7; break;
825  case 6: pns.first=0; pns.second=5; break;
826  // case 7: pns.first=6; pns.second=1; break;
827  case 7: pns.first=0; pns.second=5; break; // missing PNA & PNB
828  // case 8: pns.first=4; pns.second=9; break;
829  case 8: pns.first=2; pns.second=8; break; // missing PNA
830  case 9: pns.first=7; pns.second=2; break;
831  case 10: pns.first=4; pns.second=9; break;
832  case 11: pns.first=5; pns.second=0; break;
833  case 12: pns.first=9; pns.second=4; break;
834  // case 13: pns.first=3; pns.second=8; break;
835  case 13: pns.first=9; pns.second=4; break; // missing PNA & PNB
836  case 14: pns.first=5; pns.second=0; break;
837  case 15: pns.first=7; pns.second=2; break;
838  case 16: pns.first=4; pns.second=9; break;
839  // case 17: pns.first=3; pns.second=8; break;
840  case 17: pns.first=4; pns.second=9; break; // missing PNA & PNB
841  case 18: pns.first=6; pns.second=1; break;
842  case 19: pns.first=9; pns.second=4; break;
843  default:
844  abort();
845  };
846  }
847  else if( dee==4 )
848  {
849  switch( ilmmod )
850  {
851  case 1: pns.first=4; pns.second=9; break;
852  case 2: pns.first=1; pns.second=6; break;
853  // case 3: pns.first=6; pns.second=1; break;
854  case 3: pns.first=1; pns.second=6; break; // missing PNA & PNB
855  case 4: pns.first=9; pns.second=4; break;
856  // case 5: pns.first=4; pns.second=9; break;
857  case 5: pns.first=4; pns.second=9; break; // missing PNA & PNB
858  case 6: pns.first=4; pns.second=9; break;
859  case 7: pns.first=1; pns.second=6; break;
860  case 8: pns.first=9; pns.second=4; break;
861  case 9: pns.first=0; pns.second=5; break;
862  case 10: pns.first=7; pns.second=2; break;
863  case 11: pns.first=2; pns.second=7; break;
864  case 12: pns.first=5; pns.second=0; break;
865  case 13: pns.first=8; pns.second=3; break;
866  case 14: pns.first=2; pns.second=7; break;
867  case 15: pns.first=0; pns.second=5; break;
868  case 16: pns.first=7; pns.second=2; break;
869  case 17: pns.first=8; pns.second=3; break;
870  // case 18: pns.first=9; pns.second=4; break;
871  case 18: pns.first=5; pns.second=0; break; // missing PNA & PNB
872  case 19: pns.first=5; pns.second=0; break;
873  default:
874  abort();
875  };
876  }
877  }
878  return pns;
879 }
880 
881 int
882 MEEEGeom::dee( int ilmr )
883 {
884  int dee_(0);
885  int i_[7] = { 73 , 76 , 81 , 83 , 86 , 91 , 93 };
886  int d_[6] = { 2 , 1 , 2 , 3 , 4 , 3 };
887  for( int ii=0; ii<6; ii ++ )
888  {
889  if( ilmr>=i_[ii] && ilmr <i_[ii+1] )
890  {
891  dee_=d_[ii];
892  break;
893  }
894  }
895  if( dee_==0 )
896  {
897  std::cout << "ilmr=" << ilmr << std::endl;
898  }
899  assert( dee_!=0 );
900  return dee_;
901 }
902 
903 std::pair< int, int >
905 {
906  std::pair< int, int > out_;
907  int dee_ = dee( ilmr );
908  if( dee_==1 ) // EE+F
909  {
910  out_.first = 50;
911  out_.second = 51;
912  }
913  else if( dee_==2 ) // EE+N
914  {
915  out_.first = 47; // JM: warning -- inverted !!
916  out_.second = 46;
917  }
918  else if( dee_==3 ) // EE-N
919  {
920  out_.first = 1;
921  out_.second = 2;
922  }
923  else if( dee_==4 )
924  {
925  out_.first = 5;
926  out_.second = 6;
927  }
928  return out_;
929 }
930 
931 bool
932 MEEEGeom::near( int ilmr )
933 {
934  int idee = dee( ilmr );
935  return ( idee==2 || idee==3 );
936 }
937 
938 int
940 {
941  int side = 0;
942  int ilmr = lmr( iX, iY, iz );
943  if ( ilmr == 81 || ilmr == 91 ) side=1;
944 
945  return side;
946 }
947 std::vector<int>
949 {
950 
951  std::vector<int> vec;
952 
953  std::pair<int, int> dccAndSide_ = ME::dccAndSide( ilmr );
954  int idcc = dccAndSide_.first;
955  int iside = dccAndSide_.second;
956  bool near_ = near(ilmr);
957  int ism = smFromDcc( idcc );
958  if( ism>9 ) ism-=9;
959  assert( iside==0 || ism==5 );
960  if ( ism==5 || (ism<5 && !near_) || (ism>5 && near_) )
961  {}
962  else
963  {
964  std::cout << "ism/near " << ism << "/" << near_ << std::endl;
965  }
966 
967  if( ism==1 || ism==9 )
968  {
969  vec.push_back(1);
970  vec.push_back(2);
971  vec.push_back(3);
972  vec.push_back(4);
973  }
974  else if( ism==2 || ism==8 )
975  {
976  vec.push_back(5);
977  vec.push_back(6);
978  vec.push_back(7);
979  vec.push_back(8);
980  }
981  else if( ism==3 || ism==7 )
982  {
983  vec.push_back(9);
984  vec.push_back(10);
985  vec.push_back(11);
986  vec.push_back(12);
987  vec.push_back(13);
988  }
989  else if( ism==4 || ism==6 )
990  {
991  vec.push_back(14);
992  vec.push_back(15);
993  vec.push_back(16);
994  vec.push_back(17);
995  }
996  else
997  {
998  assert( ism==5 );
999  vec.push_back(18);
1000  vec.push_back(19);
1001  }
1002  return vec;
1003 }
1004 
1005 int
1006 MEEEGeom::apdRefTower( int ilmr, int ilmmod )
1007 {
1008  int ilmr10=ilmr%10;
1009  int tower=0;
1010 
1011  if( ilmr10==3 ){
1012  switch( ilmmod ){
1013  case 9: tower=77; break;
1014  case 10: tower=55; break;
1015  case 11: tower=37; break;
1016  case 12: tower=310; break;
1017  case 13: tower=294; break;
1018  default:
1019  abort();
1020  }
1021  }else if( ilmr10==4 ){
1022  switch( ilmmod ){
1023  case 5: tower=52; break;
1024  case 6: tower=41; break;
1025  case 7: tower=18; break;
1026  case 8: tower=65; break;
1027  default:
1028  abort();
1029  }
1030  }else if( ilmr10==5 ){
1031 
1032  switch( ilmmod ){
1033  case 1: tower=45; break;
1034  case 2: tower=53; break;
1035  case 3: tower=42; break;
1036  case 4: tower=32; break;
1037  default:
1038  abort();
1039  }
1040  }else if( ilmr10==6 ){
1041  switch( ilmmod ){
1042  case 1: tower=124; break;
1043  case 2: tower=132; break;
1044  case 3: tower=121; break;
1045  case 4: tower=111; break;
1046  default:
1047  abort();
1048  }
1049  }else if( ilmr10==7 ){
1050  switch( ilmmod ){
1051  case 5: tower=147; break;
1052  case 6: tower=135; break;
1053  case 7: tower=117; break;
1054  case 8: tower=158; break;
1055  default:
1056  abort();
1057  }
1058 
1059  }else if( ilmr10==8 ){
1060  switch( ilmmod ){
1061  case 9: tower=156; break;
1062  case 10: tower=214; break;
1063  case 11: tower=197; break;
1064  case 12: tower=237; break;
1065  case 13: tower=224; break;
1066  default:
1067  abort();
1068  }
1069  }else if( ilmr10==9 ){
1070  switch( ilmmod ){
1071  case 14: tower=234; break;
1072  case 15: tower=220; break;
1073  case 16: tower=212; break;
1074  case 17: tower=189; break;
1075  default:
1076  abort();
1077  }
1078  }else if( ilmr10==0 ){
1079  switch( ilmmod ){
1080  case 18: tower=185; break;
1081  case 19: tower=172; break;
1082  default:
1083  abort();
1084  }
1085  }else if( ilmr10==1 ){
1086  switch( ilmmod ){
1087  case 18: tower=264; break;
1088  case 19: tower=251; break;
1089  default:
1090  abort();
1091  }
1092  }
1093  return tower;
1094 }
1095 
1096 std::vector< int>
1098 {
1099 
1100  std::vector< int> vec;
1101  switch( ilmmod )
1102  {
1103  case 1: vec.push_back(0); vec.push_back(1); break;
1104  case 2: vec.push_back(0); vec.push_back(1); break;
1105  case 3: vec.push_back(0); vec.push_back(1); break;
1106  case 4: vec.push_back(0); vec.push_back(1); break;
1107  case 5: vec.push_back(0); vec.push_back(1); break;
1108  case 6: vec.push_back(0); vec.push_back(1); break;
1109  case 7: vec.push_back(0); vec.push_back(1); break;
1110  case 8: vec.push_back(0); vec.push_back(1); break;
1111  case 9: vec.push_back(0); vec.push_back(1); break;
1112  case 10: vec.push_back(0); vec.push_back(1); break;
1113  case 11: vec.push_back(0); vec.push_back(1); break;
1114  case 12: vec.push_back(0); vec.push_back(1); break;
1115  case 13: vec.push_back(0); vec.push_back(1); break;
1116  case 14: vec.push_back(0); vec.push_back(1); break;
1117  case 15: vec.push_back(0); vec.push_back(1); break;
1118  case 16: vec.push_back(0); vec.push_back(1); break;
1119  case 17: vec.push_back(0); vec.push_back(1); break;
1120  case 18: vec.push_back(0); vec.push_back(1); break;
1121  case 19: vec.push_back(0); vec.push_back(1); break;
1122  case 20: vec.push_back(0); vec.push_back(1); break;
1123  case 21: vec.push_back(0); vec.push_back(1); break;
1124 
1125  default:
1126  abort();
1127  }
1128  return vec;
1129 }
1130 
static std::pair< int, int > memFromLmr(int ilmr)
Definition: MEEEGeom.cc:904
int CrysCoord
Definition: MEEEGeom.h:23
type
Definition: HCALResponse.h:21
static int lmmod(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:94
static int crystal(CrysCoord ix, CrysCoord iy)
Definition: MEEEGeom.cc:398
static void getBoundary(std::list< std::pair< float, float > > &l, int type, int num, int iz=-1, int xside=0)
Definition: MEEEGeom.cc:486
static int apdRefTower(int ilmr, int ilmmod)
Definition: MEEEGeom.cc:1006
static int smFromDcc(int idcc)
Definition: MEEEGeom.cc:439
static int side(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:939
static bool near(int ilmr)
Definition: MEEEGeom.cc:932
static int dcc(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:222
static int sc_type(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:176
static bool pnTheory
Definition: MEEEGeom.h:48
static int sc_in_quad(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:142
static std::pair< int, int > pn(int dee, int ilmod)
Definition: MEEEGeom.cc:615
static int dccFromSm(int ism)
Definition: MEEEGeom.cc:429
static TString smName(int ism)
Definition: MEEEGeom.cc:415
static std::pair< int, int > dccAndSide(int ilmr)
Definition: ME.cc:313
static int sm(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:83
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int sector(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:31
static std::vector< int > lmmodFromLmr(int ilmr)
Definition: MEEEGeom.cc:948
int SuperCrysCoord
Definition: MEEEGeom.h:22
ii
Definition: cuy.py:590
static TGraph * getGraphBoundary(int type, int num, int iz=-1, int xside=0)
Definition: MEEEGeom.cc:460
static int deeFromMem(int imem)
Definition: MEEEGeom.cc:602
static std::vector< int > apdRefChannels(int ilmmod)
Definition: MEEEGeom.cc:1097
static int crystal_in_sc(CrysCoord ix, CrysCoord iy)
Definition: MEEEGeom.cc:299
static int dee(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:284
static int quadrant(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:16
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
static int sc(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:211
static int lmr(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:250
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run