CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MEEEGeom.cc
Go to the documentation of this file.
1 #include <assert.h>
2 #include <iostream>
3 #include <stdlib.h>
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  string
42  str_
43  (
44  // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
45  " -01-01-01""-09-09-09 " // 20
46  " -01-01-01-01-01-01""-09-09-09-09-09-09 " // 19
47  " -02-01-01-01-01-01-01""-09-09-09-09-09-09-08 " // 18
48  " -02-02-02-01-01-01-01-01""-09-09-09-09-09-08-08-08 " // 17
49  " -02-02-02-02-01-01-01-01-01""-09-09-09-09-09-08-08-08-08 " // 16
50  " -02-02-02-02-02-01-01-01-01""-09-09-09-09-08-08-08-08-08 " // 15
51  " -02-02-02-02-02-02-01-01-01""-09-09-09-08-08-08-08-08-08 " // 14
52  "-02-02-02-02-02-02-02-02-01-01""-09-09-08-08-08-08-08-08-08-08" // 13
53  "-03-03-02-02-02-02-02-02-02 "" -08-08-08-08-08-08-08-07-07" // 12
54  "-03-03-03-03-03-03-03-02 "" -08-07-07-07-07-07-07-07" // 11
55  "-03-03-03-03-03-03-03-03 "" -07-07-07-07-07-07-07-07" // 10
56  "-03-03-03-03-03-03-03-04-04 "" -06-06-07-07-07-07-07-07-07" // 9
57  "-03-03-03-03-03-03-04-04-04-05""-05-06-06-06-07-07-07-07-07-07" // 8
58  " -03-03-03-04-04-04-04-04-05""-05-06-06-06-06-06-07-07-07 " // 7
59  " -03-04-04-04-04-04-04-05-05""-05-05-06-06-06-06-06-06-07 " // 6
60  " -04-04-04-04-04-04-04-05-05""-05-05-06-06-06-06-06-06-06 " // 5
61  " -04-04-04-04-04-04-05-05""-05-05-06-06-06-06-06-06 " // 4
62  " -04-04-04-04-05-05-05""-05-05-05-06-06-06-06 " // 3
63  " -04-04-04-05-05-05""-05-05-05-06-06-06 " // 2
64  " -05-05-05""-05-05-05 " // 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  int iym, ixm, nc, il, ic, ii;
69  iym=20;
70  ixm=20;
71  int iX_ = iX;
72  int iY_ = iY;
73  nc=3;
74  il=iym-iY_;
75  ic=nc*(iX_-1);
76  ii=il*nc*ixm+ic;
77  if( str_.substr(ii,1).find("-")==string::npos ) return -1;
78  return atoi( str_.substr(ii+1,2).c_str() );
79 }
80 
81 int
83 {
84  // this is *my* convention. To be consistent with the barrel
85  // sm goes from 1 to 9 for iz+ and from 10 to 18 for iz-
86  int ism_ = sector( iX, iY );
87  if( ism_<0 ) return ism_;
88  if( iz<0 ) ism_+=9;
89  return ism_;
90 }
91 
92 int
94 {
95  //
96  // laser monitoring modules for EE-F and EE+F
97  // for EE-N and EE+N : iX ---> 20-iX+1
98  //
99  string
100  str_
101  (
102  // 1 2 3 4 5 6 7 8 9 A
103  //------------------------------
104  " -01-01-01"
105  " -02-01-01-01-01-01"
106  " -05-02-02-02-02-02-01"
107  " -05-05-05-03-03-02-02-02"
108  " -08-05-05-05-03-03-03-03-03"
109  " -08-08-05-06-06-04-04-04-03"
110  " -08-08-05-06-06-07-04-04-04"
111  "-08-08-08-06-06-07-07-07-04-04"
112  "-09-09-08-06-06-07-07-07-07 "
113  "-09-09-09-10-10-11-11-07 "
114  "-12-09-09-10-10-11-11-11 "
115  "-12-12-13-10-10-11-11-17-17 "
116  "-12-12-13-13-13-11-17-17-17-19"
117  " -12-13-13-14-15-17-17-17-19"
118  " -12-14-14-14-15-16-17-19-19"
119  " -14-14-14-14-15-16-16-19-19"
120  " -14-15-15-15-16-16-19-19"
121  " -15-15-15-16-18-18-18"
122  " -16-16-16-18-18-18"
123  " -18-18-18"
124  );
125 
126  int iym, ixm, nc, il, ic, ii;
127  iym=20;
128  ixm=10;
129  int iX_ = iX;
130  if( iX>=11 ) iX_ = 20-iX+1;
131  int iY_ = iY;
132  nc=3;
133  il=iym-iY_;
134  ic=nc*(iX_-1);
135  ii=il*nc*ixm+ic;
136  if( str_.substr(ii,1).find("-")==string::npos ) return -1;
137  return atoi( str_.substr(ii+1,2).c_str() );
138 }
139 
140 int
142 {
143  string
144  str_
145  (
146  // 1 2 3 4 5 6 7 8 9 A
147  //-----------------------------------
148  "-77-71-63-55-46-37-28-18 " // A
149  "-78-72-64-56-47-38-29-19-09 " // 9
150  "-79-73-65-57-48-39-30-20-10-01" // 8
151  " -74-66-58-49-40-31-21-11-02" // 7
152  " -75-67-59-50-41-32-22-12-03" // 6
153  " -76-68-60-51-42-33-23-13-04" // 5
154  " -69-61-52-43-34-24-14-05" // 4
155  " -70-62-53-44-35-25-15-06" // 3
156  " -54-45-36-26-16-07" // 2
157  " -27-17-08" // 1
158  //-----------------------------------
159  );
160  int iym, ixm, nc, il, ic, ii;
161  iym=10;
162  ixm=10;
163  int iX_ = iX;
164  if( iX>=11 ) iX_ = 20-iX+1;
165  int iY_ = iY;
166  if( iY>=11 ) iY_ = 20-iY+1;
167  nc=3;
168  il=iym-iY_;
169  ic=nc*(iX_-1);
170  ii=il*nc*ixm+ic;
171  if( str_.substr(ii,1).find("-")==string::npos ) return -1;
172  return atoi( str_.substr(ii+1,2).c_str() );
173 }
174 
175 int
177 {
178  string
179  str_
180  (
181  // there are seven types of super-crystals
182  // 1 2 3 4 5 6 7 8 9 10
183  //-----------------------------------
184  "-00-00-00-00-00-00-00-03 " // 10
185  "-00-00-00-00-00-00-00-00-02 " // 9
186  "-06-00-00-00-00-00-00-00-00-01" // 8
187  " -00-00-00-00-00-00-00-00-00" // 7
188  " -00-00-00-00-00-00-00-00-00" // 6
189  " -06-00-00-00-00-00-00-00-00" // 5
190  " -06-00-00-00-00-00-00-00" // 4
191  " -05-04-00-00-00-00-00-00" // 3
192  " -04-00-00-00-00-00" // 2
193  " -04-00-00" // 1
194  //-----------------------------------
195  );
196  int iym, ixm, nc, 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  nc=3;
204  il=iym-iY_;
205  ic=nc*(iX_-1);
206  ii=il*nc*ixm+ic;
207  if( str_.substr(ii,1).find("-")==string::npos ) return -1;
208  return atoi( str_.substr(ii+1,2).c_str() );
209 }
210 
211 int
213 {
214  int isc_in_quad = sc_in_quad( iX, iY );
215  assert( isc_in_quad!=0 );
216  if( isc_in_quad<0 ) return -1;
217 
218  int iquad = quadrant( iX, iY );
219  return 79*(iquad-1)+isc_in_quad;
220 }
221 
222 int
224 {
225  // end-cap minus:
226  // S7 --> DCC-1 (N)
227  // S8 --> DCC-2 (N)
228  // S9 --> DCC-3 (N)
229  // S1 --> DCC-4 (F)
230  // S2 --> DCC-5 (F)
231  // S3 --> DCC-6 (F)
232  // S4 --> DCC-7 (F)
233  // S5 --> DCC-8 (F and N)
234  // S6 --> DCC-9 (N)
235  // for the end-cap plus, add 45 to the DCC number
236  int isect = sector( iX, iY );
237  assert( isect!=0 );
238  assert( abs(iz)==1 );
239  if( isect<0 ) return -1;
240 
241  int idcc=0;
242 
243  idcc = isect-6;
244  if( idcc<=0 ) idcc+=9;
245  if( iz==+1 ) idcc+=45;
246 
247  return idcc;
248 }
249 
250 int
252 {
253  // laser monitoring regions
254  // end-cap minus:
255  // S7 --> LM-1
256  // S8 --> LM-2
257  // S9 --> LM-3
258  // S1 --> LM-4
259  // S2 --> LM-5
260  // S3 --> LM-6
261  // S4 --> LM-7
262  // S5 --> LM-8 (F) and LM-9 (N)
263  // S6 --> LM-10
264  // for the end-cap plus, add 72 to the LM number
265  // for the end-cap minus, add 82 to the LM number
266 
267  int iquad = quadrant( iX, iY );
268  int isect = sector( iX, iY );
269  assert( isect!=0 );
270  assert( abs(iz)==1 );
271  if( isect<0 ) return -1;
272 
273  int ilmr=0;
274  ilmr = isect-6;
275  if( ilmr<=0 ) ilmr+=9;
276  if( ilmr==9 ) ilmr++;
277  if( ilmr==8 && iquad==4 ) ilmr++;
278  if( iz==+1 ) ilmr+=72;
279  else ilmr+=82;
280 
281  return ilmr;
282 }
283 
284 int
286 {
287  int iquad = quadrant( iX, iY );
288  int idee=0;
289  bool far = ( iquad==2 || iquad==3 ); bool near = !far;
290  bool plus = (iz>0); bool minus = !plus;
291  if( far && plus ) idee=1;
292  if( near && plus ) idee=2;
293  if( near && minus ) idee=3;
294  if( far && minus ) idee=4;
295 
296  return idee;
297 }
298 
299 int
301 {
302  // the seven types of super-crystals
303  string
304  str_[7] =
305  {
306  "+21+16+11+06+01"
307  "+22+17+12+07+02"
308  "+23+18+13+08+03"
309  "+24+19+14+09+04"
310  "+25+20+15+10+05"
311  ,
312  " "
313  "+22+17+12+07+02"
314  "+23+18+13+08+03"
315  "+24+19+14+09+04"
316  "+25+20+15+10+05"
317  ,
318  " "
319  " "
320  "+23 "
321  "+24+19 "
322  "+25+20+15 "
323  ,
324  "+21+16+11+06 "
325  "+22+17+12+07 "
326  "+23+18+13+08 "
327  "+24+19+14+09 "
328  "+25+20+15+10 "
329  ,
330  "+21+16+11+06+01"
331  "+22+17+12+07+02"
332  " "
333  " "
334  " "
335  ,
336  " "
337  " "
338  " "
339  " "
340  " "
341  ,
342  " +06+01"
343  " +07+02"
344  " +08+03"
345  " +09+04"
346  " +10+05"
347  };
348 
349  int iX, iY, jx, jy;
350  int iX_ = (ix-1)/5+1;
351  int iY_ = (iy-1)/5+1;
352  int jx_ = ix - 5*(iX_-1);
353  int jy_ = iy - 5*(iY_-1);
354 
355  int iquad = quadrant( iX_, iY_ );
356  if( iX_>=11 )
357  {
358  iX_ = 20-iX_+1;
359  jx_ = 5-jx_+1;
360  }
361  if( iY_>=11 )
362  {
363  iY_ = 20-iY_+1;
364  jy_ = 5-jy_+1;
365  }
366 
367  // FIXME : this is stupid !!!
368  if( iquad==1 || iquad==3 )
369  {
370  iX = iX_;
371  iY = iY_;
372  jx = jx_;
373  jy = jy_;
374  }
375  else
376  {
377  iX = iY_;
378  iY = iX_;
379  jx = jy_;
380  jy = jx_;
381  }
382 
383  int isc_type = sc_type( iX, iY );
384  assert( isc_type>=0 && isc_type<7 );
385 
386  int iym, ixm, nc, il, ic, ii;
387  iym=5;
388  ixm=5;
389  nc=3;
390  il=iym-jy;
391  ic=nc*(jx-1);
392  ii=il*nc*ixm+ic;
393  if( str_[isc_type].substr(ii,1).find("+")==string::npos ) return -1;
394  return atoi( str_[isc_type].substr(ii+1,2).c_str() );
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 0;
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:22
static int lmmod(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:93
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
#define abs(x)
Definition: mlp_lapack.h:159
static int dcc(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:223
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:141
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:82
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
tuple out
Definition: dbtoconf.py:99
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
long long int num
Definition: procUtils.cc:71
static std::vector< int > apdRefChannels(int ilmmod)
Definition: MEEEGeom.cc:1097
static int crystal_in_sc(CrysCoord ix, CrysCoord iy)
Definition: MEEEGeom.cc:300
static int dee(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:285
tuple cout
Definition: gather_cfg.py:41
static int quadrant(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:16
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:47
static int sc(SuperCrysCoord iX, SuperCrysCoord iY)
Definition: MEEEGeom.cc:212
static int lmr(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Definition: MEEEGeom.cc:251
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