Go to the documentation of this file.00001 #ifndef NUMBERS_H
00002 #define NUMBERS_H
00003
00012 #include <string>
00013 #include <stdexcept>
00014 #include <vector>
00015
00016 #include "FWCore/Framework/interface/EventSetup.h"
00017
00018 #include "DataFormats/DetId/interface/DetId.h"
00019 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00020
00021 class DetId;
00022 class EBDetId;
00023 class EEDetId;
00024
00025 class EcalTrigTowerDetId;
00026 class EcalElectronicsId;
00027 class EcalPnDiodeDetId;
00028 class EcalScDetId;
00029
00030 class EcalDCCHeaderBlock;
00031
00032 class EcalElectronicsMapping;
00033 class EcalTrigTowerConstituentsMap;
00034
00035 class Numbers {
00036
00037 public:
00038
00039 static void initGeometry( const edm::EventSetup& setup, bool verbose = false );
00040
00041 static int iEB( const int ism ) throw( std::runtime_error );
00042
00043 static std::string sEB( const int ism );
00044
00045 static int iEE( const int ism ) throw( std::runtime_error );
00046
00047 static std::string sEE( const int ism );
00048
00049 static EcalSubdetector subDet( const EBDetId& id );
00050
00051 static EcalSubdetector subDet( const EEDetId& id );
00052
00053 static EcalSubdetector subDet( const EcalTrigTowerDetId& id );
00054
00055 static EcalSubdetector subDet( const EcalScDetId& id );
00056
00057 static EcalSubdetector subDet( const EcalElectronicsId& id );
00058
00059 static EcalSubdetector subDet( const EcalPnDiodeDetId& id );
00060
00061 static EcalSubdetector subDet( const EcalDCCHeaderBlock& id ) throw( std::runtime_error );
00062
00063 static int iSM( const int ism, const EcalSubdetector subdet ) throw( std::runtime_error );
00064
00065 static int iSM( const EBDetId& id ) throw( std::runtime_error );
00066
00067 static int iSM( const EEDetId& id ) throw( std::runtime_error );
00068
00069 static int iSM( const EcalTrigTowerDetId& id ) throw( std::runtime_error );
00070
00071 static int iSM( const EcalElectronicsId& id ) throw( std::runtime_error );
00072
00073 static int iSM( const EcalPnDiodeDetId& id ) throw( std::runtime_error );
00074
00075 static int iSM( const EcalScDetId& id ) throw( std::runtime_error );
00076
00077 static int iSM( const EcalDCCHeaderBlock& id, const EcalSubdetector subdet ) throw( std::runtime_error );
00078
00079 static int iSC( const EcalScDetId& id ) throw( std::runtime_error );
00080
00081 static int iSC( const int ism, const EcalSubdetector subdet, const int i1, const int i2 ) throw( std::runtime_error );
00082
00083 static int iTT( const int ism, const EcalSubdetector subdet, const int i1, const int i2 ) throw( std::runtime_error );
00084
00085 static int iTT( const EcalTrigTowerDetId& id ) throw( std::runtime_error );
00086
00087 static int iTCC(const int ism, const EcalSubdetector subdet, const int i1, const int i2) throw( std::runtime_error );
00088
00089 static int iTCC(const EcalTrigTowerDetId& id) throw( std::runtime_error );
00090
00091 static std::vector<DetId>* crystals( const EcalTrigTowerDetId& id ) throw( std::runtime_error );
00092
00093 static std::vector<DetId>* crystals( const EcalElectronicsId& id ) throw( std::runtime_error );
00094
00095 static std::vector<DetId>* crystals( int idcc, int isc ) throw( std::runtime_error );
00096
00097 static const EcalScDetId getEcalScDetId( const EEDetId& id ) throw( std::runtime_error );
00098
00099 static int indexEB( const int ism, const int ie, const int ip );
00100
00101 static int indexEE( const int ism, const int ix, const int iy );
00102
00103 static int icEB( const int ism, const int ix, const int iy );
00104
00105 static int icEE( const int ism, const int ix, const int iy ) throw( std::runtime_error );
00106
00107 static int RtHalf(const EBDetId& id);
00108
00109 static int RtHalf(const EEDetId& id);
00110
00111 static int ix0EE( const int ism );
00112
00113 static int iy0EE( const int ism );
00114
00115 static bool validEE( const int ism, const int ix, const int iy );
00116
00117 private:
00118
00119 Numbers() {};
00120 ~Numbers() {};
00121
00122 static bool init;
00123
00124 static const EcalElectronicsMapping* map;
00125 static const EcalTrigTowerConstituentsMap* mapTT;
00126
00127 static std::vector<DetId> crystalsTCC_[100*108];
00128 static std::vector<DetId> crystalsDCC_[100* 54];
00129
00130 };
00131
00132 #endif // NUMBERS_H