** Warning **
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=lxr at /lxr/lib/LXR/Common.pm line 1113.
Last-Modified: Tue, 14 Oct 2024 22:39:56 GMT
Content-Type: text/html; charset=utf-8
/CMSSW_14_2_X_2024-10-14-2300/DataFormats/EcalDetId/src/EcalElectronicsId.cc
File indexing completed on 2024-04-06 12:04:03
0001 #include "DataFormats /EcalDetId /interface /EcalElectronicsId.h "
0002 #include "FWCore /Utilities /interface /Exception.h "
0003
0004 #include <ostream>
0005
0006 EcalElectronicsId ::EcalElectronicsId () { EcalElectronicsId_ = 0xFFFFFFFFu; }
0007
0008 EcalElectronicsId ::EcalElectronicsId (uint32_t id ) { EcalElectronicsId_ = id ; }
0009
0010 EcalElectronicsId ::EcalElectronicsId (int dccid , int towerid , int stripid , int xtalid ) {
0011 if ((dccid < MIN_DCCID ) || (dccid > MAX_DCCID ) || (towerid < MIN_TOWERID ) || (towerid > MAX_TOWERID ) ||
0012 (stripid < MIN_STRIPID ) || (stripid > MAX_STRIPID ) || (xtalid < MIN_XTALID ) || (xtalid > MAX_XTALID ))
0013 throw cms ::Exception ("InvalidDetId" )
0014 << "EcalElectronicsId: Cannot create object. Indexes out of bounds. Dcc tower strip xtal " << dccid << " "
0015 << towerid << " " << stripid << " " << xtalid << "." ;
0016 EcalElectronicsId_ = (xtalid & 0x7 ) | ((stripid & 0x7 ) << 3) | ((towerid & 0x7F) << 6) | ((dccid & 0x7F) << 13);
0017 }
0018
0019 EcalSubdetector EcalElectronicsId ::subdet () const {
0020 int dcc = dccId ();
0021 if ((dcc >= MIN_DCCID_EBM && dcc <= MAX_DCCID_EBM ) || (dcc >= MIN_DCCID_EBP && dcc <= MAX_DCCID_EBP ))
0022 return EcalBarrel ;
0023 else
0024 return EcalEndcap ;
0025 }
0026
0027 int EcalElectronicsId ::zside () const {
0028 int dcc = dccId ();
0029 if ((dcc >= MIN_DCCID_EEM && dcc <= MAX_DCCID_EEM ))
0030 return -1;
0031 if ((dcc >= MIN_DCCID_EBM && dcc <= MAX_DCCID_EBM ))
0032 return -1;
0033 if ((dcc >= MIN_DCCID_EEP && dcc <= MAX_DCCID_EEP ))
0034 return +1;
0035 if ((dcc >= MIN_DCCID_EBP && dcc <= MAX_DCCID_EBP ))
0036 return +1;
0037 return 0;
0038 }
0039
0040 static int EEQuadrant (int dcc , int dcc_channel ) {
0041
0042
0043
0044
0045
0046
0047
0048 int q = -1;
0049 if ((dcc == EcalElectronicsId ::DCC_EEP + 1) || (dcc == EcalElectronicsId ::DCC_EEP + 2) ||
0050 (dcc == EcalElectronicsId ::DCC_EEP && dcc_channel <= EcalElectronicsId ::kDCCChannelBoundary ) ||
0051 (dcc == EcalElectronicsId ::DCC_EEM + 3) || (dcc == EcalElectronicsId ::DCC_EEM + 4) ||
0052 (dcc == EcalElectronicsId ::DCC_EEM + 5 && dcc_channel <= EcalElectronicsId ::kDCCChannelBoundary ))
0053 q = 1;
0054 else if ((dcc == EcalElectronicsId ::DCC_EEP + 3) || (dcc == EcalElectronicsId ::DCC_EEP + 4) ||
0055 (dcc == EcalElectronicsId ::DCC_EEP + 5 && dcc_channel <= EcalElectronicsId ::kDCCChannelBoundary ) ||
0056 (dcc == EcalElectronicsId ::DCC_EEM && dcc_channel <= EcalElectronicsId ::kDCCChannelBoundary ) ||
0057 (dcc == EcalElectronicsId ::DCC_EEM + 1) || (dcc == EcalElectronicsId ::DCC_EEM + 2))
0058 q = 2;
0059 else if ((dcc == EcalElectronicsId ::DCC_EEP + 6) ||
0060 (dcc == EcalElectronicsId ::DCC_EEP + 5 && dcc_channel > EcalElectronicsId ::kDCCChannelBoundary ) ||
0061 (dcc == EcalElectronicsId ::DCC_EEP + 7 && dcc_channel > EcalElectronicsId ::kDCCChannelBoundary ) ||
0062 (dcc == EcalElectronicsId ::DCC_EEM && dcc_channel > EcalElectronicsId ::kDCCChannelBoundary ) ||
0063 (dcc == EcalElectronicsId ::DCC_EEM + 8) ||
0064 (dcc == EcalElectronicsId ::DCC_EEM + 7 && dcc_channel > EcalElectronicsId ::kDCCChannelBoundary ))
0065 q = 3;
0066 else
0067 q = 4;
0068 return q ;
0069 }
0070
0071 int EcalElectronicsId ::channelId () const {
0072 int dcc = dccId ();
0073 int dcc_channel = towerId ();
0074 int quadrant = EEQuadrant (dcc , dcc_channel );
0075 int strip = stripId ();
0076 int xtal = xtalId ();
0077 int channel ;
0078 if (quadrant == 1 || quadrant == 3)
0079 channel = 5 * (strip - 1) + xtal ;
0080 else
0081 channel = 5 * (xtal - 1) + strip ;
0082 return channel ;
0083 }
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109 std ::ostream& operator <<(std ::ostream& os , const EcalElectronicsId & id ) {
0110 return os << id .dccId () << ',' << id .towerId () << ',' << id .stripId () << ',' << id .xtalId ();
0111 }