CMS 3D CMS Logo

Numbers.cc

Go to the documentation of this file.
00001 // $Id: Numbers.cc,v 1.64 2008/09/05 13:39:13 emanuele Exp $
00002 
00011 #include <sstream>
00012 #include <iomanip>
00013 
00014 #include <DataFormats/EcalDetId/interface/EBDetId.h>
00015 #include <DataFormats/EcalDetId/interface/EEDetId.h>
00016 
00017 #include <DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h>
00018 #include <DataFormats/EcalDetId/interface/EcalElectronicsId.h>
00019 #include <DataFormats/EcalDetId/interface/EcalPnDiodeDetId.h>
00020 #include <DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h>
00021 
00022 #include "FWCore/Framework/interface/NoRecordException.h"
00023 
00024 #include "FWCore/Framework/interface/ESHandle.h"
00025 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
00026 #include "Geometry/EcalMapping/interface/EcalMappingRcd.h"
00027 
00028 #include "DQM/EcalCommon/interface/Numbers.h"
00029 
00030 //-------------------------------------------------------------------------
00031 
00032 const EcalElectronicsMapping* Numbers::map = 0;
00033 
00034 bool Numbers::init = false;
00035 
00036 //-------------------------------------------------------------------------
00037 
00038 void Numbers::initGeometry( const edm::EventSetup& setup, bool verbose ) {
00039 
00040   if( Numbers::init ) return;
00041 
00042   if ( verbose ) std::cout << "Initializing EcalElectronicsMapping ..." << std::endl;
00043 
00044   Numbers::init = true;
00045 
00046   edm::ESHandle< EcalElectronicsMapping > handle;
00047   setup.get< EcalMappingRcd >().get(handle);
00048   Numbers::map = handle.product();
00049 
00050   if ( verbose ) std::cout << "done." << std::endl;
00051 
00052 }
00053 
00054 //-------------------------------------------------------------------------
00055 
00056 int Numbers::iEB( const int ism ) throw( std::runtime_error ) {
00057 
00058   // EB-
00059   if( ism >=  1 && ism <= 18 ) return( -ism );
00060 
00061   // EB+
00062   if( ism >= 19 && ism <= 36 ) return( +ism - 18 );
00063 
00064   std::ostringstream s;
00065   s << "Wrong SM id determination: iSM = " << ism;
00066   throw( std::runtime_error( s.str() ) );
00067 
00068 }
00069 
00070 //-------------------------------------------------------------------------
00071 
00072 std::string Numbers::sEB( const int ism  ) {
00073 
00074   int ieb = Numbers::iEB( ism );
00075 
00076   std::ostringstream s;
00077   s << "EB" << std::setw(3) << std::setfill('0')
00078     << std::setiosflags( std::ios::showpos )
00079     << std::setiosflags( std::ios::internal )
00080     << ieb
00081     << std::resetiosflags( std::ios::showpos )
00082     << std::resetiosflags( std::ios::internal );
00083   return( s.str() );
00084 
00085 }
00086 
00087 //-------------------------------------------------------------------------
00088 
00089 int Numbers::iEE( const int ism ) throw( std::runtime_error ) {
00090 
00091   // EE-
00092   if( ism ==  1 ) return( -7 );
00093   if( ism ==  2 ) return( -8 );
00094   if( ism ==  3 ) return( -9 );
00095   if( ism ==  4 ) return( -1 );
00096   if( ism ==  5 ) return( -2 );
00097   if( ism ==  6 ) return( -3 );
00098   if( ism ==  7 ) return( -4 );
00099   if( ism ==  8 ) return( -5 );
00100   if( ism ==  9 ) return( -6 );
00101 
00102   // EE+
00103   if( ism == 10 ) return( +7 );
00104   if( ism == 11 ) return( +8 );
00105   if( ism == 12 ) return( +9 );
00106   if( ism == 13 ) return( +1 );
00107   if( ism == 14 ) return( +2 );
00108   if( ism == 15 ) return( +3 );
00109   if( ism == 16 ) return( +4 );
00110   if( ism == 17 ) return( +5 );
00111   if( ism == 18 ) return( +6 );
00112 
00113   std::ostringstream s;
00114   s << "Wrong SM id determination: iSM = " << ism;
00115   throw( std::runtime_error( s.str() ) );
00116 
00117 }
00118 
00119 //-------------------------------------------------------------------------
00120 
00121 EcalSubdetector Numbers::subDet( const EBDetId& id ) {
00122 
00123   return( id.subdet() );
00124 
00125 }
00126 
00127 //-------------------------------------------------------------------------
00128 
00129 EcalSubdetector Numbers::subDet( const EEDetId& id ) {
00130 
00131   return( id.subdet() );
00132 
00133 }
00134 
00135 //-------------------------------------------------------------------------
00136 
00137 EcalSubdetector Numbers::subDet( const EcalTrigTowerDetId& id ) {
00138 
00139   return( id.subDet() );
00140 
00141 }
00142 
00143 //-------------------------------------------------------------------------
00144 
00145 EcalSubdetector Numbers::subDet( const EcalElectronicsId& id ) {
00146 
00147   return( id.subdet() );
00148 
00149 }
00150 
00151 //-------------------------------------------------------------------------
00152 
00153 EcalSubdetector Numbers::subDet( const EcalPnDiodeDetId& id ) {
00154 
00155   return( (EcalSubdetector) id.iEcalSubDetectorId() );
00156 
00157 }
00158 
00159 //-------------------------------------------------------------------------
00160 
00161 EcalSubdetector Numbers::subDet( const EcalDCCHeaderBlock& id ) throw( std::runtime_error ) {
00162 
00163   int idcc = id.id();
00164 
00165   // EE-
00166   if ( idcc >=  1 && idcc <=  9 ) return( EcalEndcap );
00167 
00168   // EB-/EB+
00169   if ( idcc >= 10 && idcc <= 45 ) return( EcalBarrel);
00170 
00171   // EE+
00172   if ( idcc >= 46 && idcc <= 54 ) return( EcalEndcap );
00173 
00174   std::ostringstream s;
00175   s << "Wrong DCC id: dcc = " << idcc;
00176   throw( std::runtime_error( s.str() ) );
00177 
00178 }
00179 
00180 //-------------------------------------------------------------------------
00181 
00182 std::string Numbers::sEE( const int ism  ) {
00183 
00184   int iee = Numbers::iEE( ism );
00185 
00186   std::ostringstream s;
00187   s << "EE" << std::setw(3) << std::setfill('0')
00188     << std::setiosflags( std::ios::showpos )
00189     << std::setiosflags( std::ios::internal )
00190     << iee
00191     << std::resetiosflags( std::ios::showpos )
00192     << std::resetiosflags( std::ios::internal );
00193   return( s.str() );
00194 
00195 }
00196 
00197 //-------------------------------------------------------------------------
00198 
00199 int Numbers::iSM( const int ism, const EcalSubdetector subdet ) throw( std::runtime_error ) {
00200 
00201   if( subdet == EcalBarrel ) {
00202 
00203     // EB-
00204     if( ism >=  1 && ism <= 18 ) return( ism+18 );
00205 
00206     // EB+
00207     if( ism >= 19 && ism <= 36 ) return( ism-18 );
00208 
00209     std::ostringstream s;
00210     s << "Wrong SM id: iSM = " << ism;
00211     throw( std::runtime_error( s.str() ) );
00212 
00213   } else if( subdet == EcalEndcap ) {
00214 
00215     // EE-
00216     if( ism >=  1 && ism <=  9 ) return( ism+9 );
00217 
00218     // EE+
00219     if (ism >= 10 && ism <= 18 ) return( ism-9 );
00220 
00221     std::ostringstream s;
00222     s << "Wrong SM id: iSM = " << ism;
00223     throw( std::runtime_error( s.str() ) );
00224 
00225   } else {
00226 
00227     std::ostringstream s;
00228     s << "Invalid subdetector: subdet = " << subdet;
00229     throw( std::runtime_error( s.str() ) );
00230 
00231   }
00232 
00233 }
00234 
00235 //-------------------------------------------------------------------------
00236 
00237 int Numbers::iSM( const EBDetId& id ) throw( std::runtime_error ) {
00238 
00239   if( Numbers::map ) {
00240 
00241     EcalElectronicsId eid = Numbers::map->getElectronicsId(id);
00242     int idcc = eid.dccId();
00243 
00244     // EB-/EB+
00245     if( idcc >= 10 && idcc <= 45 ) return( idcc - 9 );
00246 
00247     std::ostringstream s;
00248     s << "Wrong DCC id: dcc = " << idcc;
00249     throw( std::runtime_error( s.str() ) );
00250 
00251   } else {
00252 
00253     std::ostringstream s;
00254     s << "ECAL Geometry not available";
00255     throw( std::runtime_error( s.str() ) );
00256 
00257   }
00258 
00259 }
00260 
00261 //-------------------------------------------------------------------------
00262 
00263 int Numbers::iSM( const EEDetId& id ) throw( std::runtime_error ) {
00264 
00265   if( Numbers::map ) {
00266 
00267     EcalElectronicsId eid = Numbers::map->getElectronicsId(id);
00268     int idcc = eid.dccId();
00269 
00270     // EE-
00271     if( idcc >=  1 && idcc <=  9 ) return( idcc );
00272 
00273     // EE+
00274     if( idcc >= 46 && idcc <= 54 ) return( idcc - 45 + 9 );
00275 
00276     std::ostringstream s;
00277     s << "Wrong DCC id: dcc = " << idcc;
00278     throw( std::runtime_error( s.str() ) );
00279 
00280   } else {
00281 
00282     std::ostringstream s;
00283     s << "ECAL Geometry not available";
00284     throw( std::runtime_error( s.str() ) );
00285 
00286   }
00287 
00288 }
00289 
00290 //-------------------------------------------------------------------------
00291 
00292 int Numbers::iSM( const EcalTrigTowerDetId& id ) throw( std::runtime_error ) {
00293 
00294   EcalSubdetector subdet = Numbers::subDet( id );
00295 
00296   if( subdet == EcalBarrel ) {
00297 
00298     if( Numbers::map ) {
00299 
00300       int idcc = Numbers::map->DCCid(id);
00301 
00302       // EB-/EB+
00303       if( idcc >= 10 && idcc <= 45 ) return( idcc - 9 );
00304 
00305       std::ostringstream s;
00306       s << "Wrong DCC id: dcc = " << idcc;
00307       throw( std::runtime_error( s.str() ) );
00308 
00309     } else {
00310 
00311       std::ostringstream s;
00312       s << "ECAL Geometry not available";
00313       throw( std::runtime_error( s.str() ) );
00314 
00315     }
00316 
00317   } else if( subdet ==  EcalEndcap) {
00318 
00319     if( Numbers::map ) {
00320 
00321       int idcc = Numbers::map->DCCid(id);
00322 
00323       // EE-
00324       if( idcc >=  1 && idcc <=  9 ) return( idcc );
00325 
00326       // EE+
00327       if( idcc >= 46 && idcc <= 54 ) return( idcc - 45 + 9 );
00328 
00329       std::ostringstream s;
00330       s << "Wrong DCC id: dcc = " << idcc;
00331       throw( std::runtime_error( s.str() ) );
00332 
00333     } else {
00334 
00335       std::ostringstream s;
00336       s << "ECAL Geometry not available";
00337       throw( std::runtime_error( s.str() ) );
00338 
00339     }
00340 
00341   } else {
00342 
00343     std::ostringstream s;
00344     s << "Invalid subdetector: subdet = " << subdet;
00345     throw( std::runtime_error( s.str() ) );
00346 
00347   }
00348 
00349 }
00350 
00351 //-------------------------------------------------------------------------
00352 
00353 int Numbers::iSM( const EcalElectronicsId& id ) throw( std::runtime_error ) {
00354 
00355   int idcc = id.dccId();
00356 
00357   // EE-
00358   if( idcc >=  1 && idcc <=  9 ) return( idcc );
00359 
00360   // EB-/EB+
00361   if( idcc >= 10 && idcc <= 45 ) return( idcc - 9 );
00362 
00363   // EE+
00364   if( idcc >= 46 && idcc <= 54 ) return( idcc - 45 + 9 );
00365 
00366   std::ostringstream s;
00367   s << "Wrong DCC id: dcc = " << idcc;
00368   throw( std::runtime_error( s.str() ) );
00369 
00370 }
00371 
00372 //-------------------------------------------------------------------------
00373 
00374 int Numbers::iSM( const EcalPnDiodeDetId& id ) throw( std::runtime_error ) {
00375 
00376   int idcc = id.iDCCId();
00377 
00378   // EE-
00379   if( idcc >=  1 && idcc <=  9 ) return( idcc );
00380 
00381   // EB-/EB+
00382   if( idcc >= 10 && idcc <= 45 ) return( idcc - 9 );
00383 
00384   // EE+
00385   if( idcc >= 46 && idcc <= 54 ) return( idcc - 45 + 9 );
00386 
00387   std::ostringstream s;
00388   s << "Wrong DCC id: dcc = " << idcc;
00389   throw( std::runtime_error( s.str() ) );
00390 
00391 }
00392 
00393 //-------------------------------------------------------------------------
00394 
00395 int Numbers::iSM( const EcalDCCHeaderBlock& id, const EcalSubdetector subdet ) throw( std::runtime_error ) {
00396 
00397   int idcc = id.id();
00398 
00399   // EE-
00400   if( idcc >=  1 && idcc <=  9 ) return( idcc );
00401 
00402   // EB-/EB+
00403   if( idcc >= 10 && idcc <= 45 ) return( idcc - 9 );
00404 
00405   // EE+
00406   if( idcc >= 46 && idcc <= 54 ) return( idcc - 45 + 9 );
00407 
00408   std::ostringstream s;
00409   s << "Wrong DCC id: dcc = " << idcc;
00410   throw( std::runtime_error( s.str() ) );
00411 
00412 }
00413 
00414 //-------------------------------------------------------------------------
00415 
00416 int Numbers::iTT( const int ism, const EcalSubdetector subdet, const int i1, const int i2 ) throw( std::runtime_error ) {
00417 
00418   if( subdet == EcalBarrel ) {
00419 
00420     int iet = 1 + ((i1-1)/5);
00421     int ipt = 1 + ((i2-1)/5);
00422 
00423     return( (ipt-1) + 4*(iet-1) + 1 );
00424 
00425   } else if( subdet == EcalEndcap ) {
00426 
00427     int iz = 0;
00428 
00429     if( ism >=  1 && ism <=  9 ) iz = -1;
00430     if( ism >= 10 && ism <= 18 ) iz = +1;
00431 
00432     if( EEDetId::validDetId(i1, i2, iz) ) {
00433 
00434       EEDetId id(i1, i2, iz, EEDetId::XYMODE);
00435 
00436       if( Numbers::iSM( id ) != ism ) return( -1 );
00437 
00438       if( Numbers::map ) {
00439 
00440         EcalElectronicsId eid = Numbers::map->getElectronicsId(id);
00441 
00442         return( eid.towerId() );
00443 
00444       } else {
00445 
00446         std::ostringstream s;
00447         s << "ECAL Geometry not available";
00448         throw( std::runtime_error( s.str() ) );
00449 
00450       }
00451 
00452     } else {
00453 
00454       return( -1 );
00455 
00456     }
00457 
00458   } else {
00459 
00460     std::ostringstream s;
00461     s << "Invalid subdetector: subdet = " << subdet;
00462     throw( std::runtime_error( s.str() ) );
00463 
00464   }
00465 
00466 }
00467 
00468 //-------------------------------------------------------------------------
00469 
00470 int Numbers::iTT( const EcalTrigTowerDetId& id ) throw( std::runtime_error ) {
00471 
00472   EcalSubdetector subdet = Numbers::subDet( id );
00473 
00474   if( subdet == EcalBarrel ) {
00475 
00476     if( Numbers::map ) {
00477 
00478       return( Numbers::map->iTT(id) );
00479 
00480     } else {
00481 
00482       std::ostringstream s;
00483       s << "ECAL Geometry not available";
00484       throw( std::runtime_error( s.str() ) );
00485 
00486     }
00487 
00488   } else if( subdet ==  EcalEndcap) {
00489 
00490     if( Numbers::map ) {
00491 
00492       return( Numbers::map->iTT(id) );
00493 
00494     } else {
00495 
00496       std::ostringstream s;
00497       s << "ECAL Geometry not available";
00498       throw( std::runtime_error( s.str() ) );
00499 
00500     }
00501 
00502   } else {
00503 
00504     std::ostringstream s;
00505     s << "Invalid subdetector: subdet = " << subdet;
00506     throw( std::runtime_error( s.str() ) );
00507 
00508   }
00509 
00510 }
00511 
00512 //-------------------------------------------------------------------------
00513 
00514 int Numbers::TCCid( const EcalTrigTowerDetId& id ) throw( std::runtime_error ) {
00515 
00516   EcalSubdetector subdet = Numbers::subDet( id );
00517 
00518   if( subdet == EcalBarrel ) {
00519 
00520     if( Numbers::map ) {
00521 
00522       return( Numbers::map->TCCid(id) );
00523 
00524     } else {
00525 
00526       std::ostringstream s;
00527       s << "ECAL Geometry not available";
00528       throw( std::runtime_error( s.str() ) );
00529 
00530     }
00531 
00532   } else if( subdet ==  EcalEndcap) {
00533 
00534     if( Numbers::map ) {
00535 
00536       return( Numbers::map->TCCid(id) );
00537 
00538     } else {
00539 
00540       std::ostringstream s;
00541       s << "ECAL Geometry not available";
00542       throw( std::runtime_error( s.str() ) );
00543 
00544     }
00545 
00546   } else {
00547 
00548     std::ostringstream s;
00549     s << "Invalid subdetector: subdet = " << subdet;
00550     throw( std::runtime_error( s.str() ) );
00551 
00552   }
00553 
00554 }
00555 
00556 //-------------------------------------------------------------------------
00557 
00558 std::vector<DetId> Numbers::crystals( const EcalSubdetector subdet, int itcc, int itt ) throw( std::runtime_error ) {
00559 
00560 
00561   if( Numbers::map ) {
00562 
00563     EcalSubdetector sub = Numbers::map->subdet(itcc,1);
00564 
00565     if( subdet == sub ) {
00566       
00567       return( Numbers::map->ttConstituents( itcc, itt ) );
00568       
00569     } else {
00570 
00571       std::vector<DetId> empty;
00572       empty.clear();
00573       return empty;
00574 
00575     }
00576     
00577   }  else {
00578     
00579     std::ostringstream s;
00580     s << "ECAL Geometry not available";
00581     throw( std::runtime_error( s.str() ) );
00582     
00583   }
00584 
00585 }
00586 
00587 //-------------------------------------------------------------------------
00588 
00589 std::vector<DetId> Numbers::crystals( const EcalTrigTowerDetId& id ) throw( std::runtime_error ) {
00590 
00591   if( Numbers::map ) {
00592 
00593     int itcc = Numbers::map->TCCid(id);
00594     int itt = Numbers::map->iTT(id);
00595 
00596     return( Numbers::map->ttConstituents( itcc, itt ) );
00597 
00598   } else {
00599 
00600     std::ostringstream s;
00601     s << "ECAL Geometry not available";
00602     throw( std::runtime_error( s.str() ) );
00603 
00604   }
00605 
00606 }
00607 
00608 //-------------------------------------------------------------------------
00609 
00610 int Numbers::RtHalf(const EBDetId& id) {
00611 
00612   int ic = id.ic();
00613   int ie = (ic-1)/20 + 1;
00614   int ip = (ic-1)%20 + 1;
00615 
00616   if( ie > 5 && ip < 11 ) return 1;
00617 
00618   return 0;
00619 
00620 }
00621 
00622 //-------------------------------------------------------------------------
00623 
00624 int Numbers::RtHalf(const EEDetId& id) {
00625 
00626   int ix = id.ix();
00627 
00628   int ism = Numbers::iSM( id );
00629 
00630   // EE-05
00631   if ( ism ==  8 && ix > 50 ) return 1;
00632 
00633   // EE+05
00634   if ( ism == 17 && ix > 50 ) return 1;
00635 
00636   return 0;
00637 
00638 }
00639 
00640 //-------------------------------------------------------------------------
00641 
00642 std::vector<DetId> Numbers::crystals( const EcalElectronicsId& id ) throw( std::runtime_error ) {
00643 
00644   if( Numbers::map ) {
00645 
00646     int idcc = id.dccId();
00647     int itt = id.towerId();
00648 
00649     return( Numbers::map->dccTowerConstituents( idcc, itt ) );
00650 
00651   } else {
00652 
00653     std::ostringstream s;
00654     s << "ECAL Geometry not available";
00655     throw( std::runtime_error( s.str() ) );
00656 
00657   }
00658 
00659 }
00660 
00661 //-------------------------------------------------------------------------
00662 
00663 int Numbers::indexEB( const int ism, const int ie, const int ip ){
00664 
00665   return( (ip-1) + 20*(ie-1) + 1 );
00666 
00667 }
00668 
00669 //-------------------------------------------------------------------------
00670 
00671 int Numbers::indexEE( const int ism, const int ix, const int iy ){
00672 
00673   int iz = 0;
00674 
00675   if( ism >=  1 && ism <=  9 ) iz = -1;
00676   if( ism >= 10 && ism <= 18 ) iz = +1;
00677 
00678   if( EEDetId::validDetId(ix, iy, iz) ) {
00679 
00680     return( 1000*ix + iy );
00681 
00682   } else {
00683 
00684     return( -1 );
00685 
00686   }
00687 
00688 }
00689 
00690 //-------------------------------------------------------------------------
00691 
00692 int Numbers::icEB( const int ism, const int ie, const int ip ) {
00693 
00694   return( (ip-1) + 20*(ie-1) + 1 );
00695 
00696 }
00697 
00698 //-------------------------------------------------------------------------
00699 
00700 int Numbers::icEE( const int ism, const int ix, const int iy ) throw( std::runtime_error ) {
00701 
00702   int iz = 0;
00703 
00704   if( ism >=  1 && ism <=  9 ) iz = -1;
00705   if( ism >= 10 && ism <= 18 ) iz = +1;
00706 
00707   if( EEDetId::validDetId(ix, iy, iz) ) {
00708 
00709     EEDetId id(ix, iy, iz, EEDetId::XYMODE);
00710 
00711     if( Numbers::iSM( id ) != ism ) return( -1 );
00712 
00713     if( Numbers::map ) {
00714 
00715       EcalElectronicsId eid = Numbers::map->getElectronicsId(id);
00716 
00717       int vfe = eid.towerId();
00718       int strip = eid.stripId();
00719       int channel = eid.xtalId();
00720 
00721       // EE-05 & EE+05
00722       if( ism == 8 || ism == 17 ) {
00723         if( vfe > 17 ) vfe = vfe - 7;
00724       }
00725 
00726       return ( (vfe-1)*25 + (strip-1)*5 + channel );
00727 
00728     } else {
00729 
00730       std::ostringstream s;
00731       s << "ECAL Geometry not available";
00732       throw( std::runtime_error( s.str() ) );
00733 
00734     }
00735 
00736   } else {
00737 
00738     return( -1 );
00739 
00740   }
00741 
00742 }
00743 
00744 //-------------------------------------------------------------------------
00745 
00746 int Numbers::ixSectorsEE[202] = {61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 55, 55, 45, 45, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 45, 45, 55, 55, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 0,100,100, 97, 97, 95, 95, 92, 92, 87, 87, 85, 85, 80, 80, 75, 75, 65, 65, 60, 60, 40, 40, 35, 35, 25, 25, 20, 20, 15, 15, 13, 13,  8,  8,  5,  5,  3,  3,  0,  0,  3,  3,  5,  5,  8,  8, 13, 13, 15, 15, 20, 20, 25, 25, 35, 35, 40, 40, 60, 60, 65, 65, 75, 75, 80, 80, 85, 85, 87, 87, 92, 92, 95, 95, 97, 97,100,100,  0, 61, 65, 65, 70, 70, 80, 80, 90, 90, 92,  0, 61, 65, 65, 90, 90, 97,  0, 57, 60, 60, 65, 65, 70, 70, 75, 75, 80, 80,  0, 50, 50,  0, 43, 40, 40, 35, 35, 30, 30, 25, 25, 20, 20,  0, 39, 35, 35, 10, 10,  3,  0, 39, 35, 35, 30, 30, 20, 20, 10, 10,  8,  0, 45, 45, 40, 40, 35, 35,  0, 55, 55, 60, 60, 65, 65};
00747 
00748 int Numbers::iySectorsEE[202] = {50, 55, 55, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 55, 55, 45, 45, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 45, 45, 50,  0, 50, 60, 60, 65, 65, 75, 75, 80, 80, 85, 85, 87, 87, 92, 92, 95, 95, 97, 97,100,100, 97, 97, 95, 95, 92, 92, 87, 87, 85, 85, 80, 80, 75, 75, 65, 65, 60, 60, 40, 40, 35, 35, 25, 25, 20, 20, 15, 15, 13, 13,  8,  8,  5,  5,  3,  3,  0,  0,  3,  3,  5,  5,  8,  8, 13, 13, 15, 15, 20, 20, 25, 25, 35, 35, 40, 40, 50,  0, 45, 45, 40, 40, 35, 35, 30, 30, 25, 25,  0, 50, 50, 55, 55, 60, 60,  0, 60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87,  0, 61,100,  0, 60, 60, 65, 65, 70, 70, 75, 75, 85, 85, 87,  0, 50, 50, 55, 55, 60, 60,  0, 45, 45, 40, 40, 35, 35, 30, 30, 25, 25,  0, 39, 30, 30, 15, 15,  5,  0, 39, 30, 30, 15, 15,  5};
00749 
00750 //-------------------------------------------------------------------------
00751 
00752 // from EC-_CCUID_to_IP.gif
00753 
00754 int Numbers::inTowersEE[400] = { 0, 0, 0, 0, 0, 0, 0, 27, 37, 41, 17, 13, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 31, 29, 26, 36, 40, 16, 12, 2, 29, 31, 21, 0, 0, 0, 0, 0, 0, 0, 21, 27, 30, 28, 25, 35, 39, 15, 11, 1, 28, 30, 27, 21, 0, 0, 0, 0, 0, 14, 26, 25, 24, 23, 22, 34, 38, 14, 10, 22, 23, 24, 25, 26, 14, 0, 0, 0, 14, 20, 19, 18, 17, 16, 15, 29, 33, 9, 5, 15, 16, 17, 18, 19, 20, 14, 0, 0, 33, 13, 12, 11, 10, 9, 8, 28, 32, 8, 4, 8, 9, 10, 11, 12, 13, 33, 0, 0, 30, 32, 31, 7, 6, 5, 4, 33, 31, 7, 33, 4, 5, 6, 7, 31, 32, 30, 0, 34, 29, 28, 27, 26, 25, 3, 2, 32, 30, 6, 32, 2, 3, 25, 26, 27, 28, 29, 34, 24, 23, 22, 21, 20, 19, 18, 1, 21, 14, 21, 14, 1, 18, 19, 20, 21, 22, 23, 24, 17, 16, 15, 14, 13, 12, 11, 10, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 9, 8, 7, 6, 5, 4, 3, 32, 0, 0, 0, 0, 32, 3, 4, 5, 6, 7, 8, 9, 2, 1, 31, 30, 29, 28, 27, 26, 25, 3, 25, 3, 26, 27, 28, 29, 30, 31, 1, 2, 25, 24, 23, 22, 21, 20, 19, 18, 16, 12, 12, 16, 18, 19, 20, 21, 22, 23, 24, 25, 0, 17, 16, 15, 14, 13, 12, 33, 15, 11, 11, 15, 33, 12, 13, 14, 15, 16, 17, 0, 0, 11, 10, 9, 8, 7, 32, 31, 14, 10, 10, 14, 31, 32, 7, 8, 9, 10, 11, 0, 0, 25, 6, 5, 4, 29, 28, 27, 13, 9, 9, 13, 27, 28, 29, 4, 5, 6, 25, 0, 0, 0, 3, 2, 1, 26, 25, 24, 8, 4, 4, 8, 24, 25, 26, 1, 2, 3, 0, 0, 0, 0, 0, 3, 23, 22, 21, 20, 7, 3, 3, 7, 20, 21, 22, 23, 3, 0, 0, 0, 0, 0, 0, 0, 30, 19, 18, 17, 6, 2, 2, 6, 17, 18, 19, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 5, 1, 1, 5, 30, 0, 0, 0, 0, 0, 0, 0};
00755 
00756 //-------------------------------------------------------------------------
00757 
00758 int Numbers::ix0EE( const int ism ) {
00759 
00760   if( ism == 1 || ism == 15 ) return( -  5 );
00761   if( ism == 2 || ism == 14 ) return( +  0 );
00762   if( ism == 3 || ism == 13 ) return( + 10 );
00763   if( ism == 4 || ism == 12 ) return( + 40 );
00764   if( ism == 5 || ism == 11 ) return( + 50 );
00765   if( ism == 6 || ism == 10 ) return( + 55 );
00766   if( ism == 7 || ism == 18 ) return( + 50 );
00767   if( ism == 8 || ism == 17 ) return( + 25 );
00768   if( ism == 9 || ism == 16 ) return( +  0 );
00769 
00770   return( + 0 );
00771 
00772 }
00773 
00774 //-------------------------------------------------------------------------
00775 
00776 int Numbers::iy0EE( const int ism ) {
00777 
00778   if( ism == 1 || ism == 10 ) return( + 20 );
00779   if( ism == 2 || ism == 11 ) return( + 45 );
00780   if( ism == 3 || ism == 12 ) return( + 55 );
00781   if( ism == 4 || ism == 13 ) return( + 55 );
00782   if( ism == 5 || ism == 14 ) return( + 45 );
00783   if( ism == 6 || ism == 15 ) return( + 20 );
00784   if( ism == 7 || ism == 16 ) return( +  0 );
00785   if( ism == 8 || ism == 17 ) return( -  5 );
00786   if( ism == 9 || ism == 18 ) return( +  0 );
00787 
00788   return( + 0 );
00789 
00790 }
00791 
00792 //-------------------------------------------------------------------------
00793 
00794 bool Numbers::validEE( const int ism, const int ix, const int iy ) {
00795 
00796   int iz = 0;
00797 
00798   if( ism >=  1 && ism <=  9 ) iz = -1;
00799   if( ism >= 10 && ism <= 18 ) iz = +1;
00800 
00801   if( EEDetId::validDetId(ix, iy, iz) ) {
00802 
00803     EEDetId id(ix, iy, iz, EEDetId::XYMODE);
00804 
00805     if( Numbers::iSM( id ) == ism ) return true;
00806 
00807   }
00808 
00809   return false;
00810 
00811 }
00812 
00813 //-------------------------------------------------------------------------

Generated on Tue Jun 9 17:32:48 2009 for CMSSW by  doxygen 1.5.4