File indexing completed on 2024-04-06 12:04:03
0001 #ifndef ECALDETID_ECALTRIGTOWERDETID_H
0002 #define ECALDETID_ECALTRIGTOWERDETID_H
0003
0004 #include <iosfwd>
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0007
0008
0009
0010
0011
0012
0013
0014 class EcalTrigTowerDetId : public DetId {
0015 public:
0016
0017 EcalTrigTowerDetId();
0018
0019 EcalTrigTowerDetId(uint32_t rawid);
0020
0021
0022 EcalTrigTowerDetId(int zside, EcalSubdetector subdet, int i, int j, int mode = SUBDETIJMODE);
0023
0024
0025 EcalTrigTowerDetId(const DetId& id);
0026
0027 EcalTrigTowerDetId& operator=(const DetId& id);
0028
0029
0030 int zside() const { return (id_ & 0x8000) ? (1) : (-1); }
0031
0032
0033 EcalSubdetector subDet() const { return (id_ & 0x4000) ? EcalBarrel : EcalEndcap; }
0034
0035
0036 int ietaAbs() const {
0037
0038 return (id_ >> 7) & 0x7f;
0039
0040
0041 }
0042
0043
0044 int ieta() const {
0045
0046 return zside() * ietaAbs();
0047
0048
0049 }
0050
0051
0052 int iphi() const {
0053
0054 return id_ & 0x7F;
0055
0056
0057 }
0058
0059 int iquadrant() const;
0060
0061
0062 int ix() const {
0063 if (subDet() == EcalEndcap)
0064 return (id_ >> 7) & 0x7f;
0065 else
0066 throw(std::runtime_error("EcalTrigTowerDetId: ix not applicable for this subDetector."));
0067 }
0068
0069
0070 int iy() const {
0071 if (subDet() == EcalEndcap)
0072 return id_ & 0x7F;
0073 else
0074 throw(std::runtime_error("EcalTrigTowerDetId: ix not applicable for this subDetector."));
0075 }
0076
0077
0078 int hashedIndex() const;
0079
0080 uint32_t denseIndex() const { return hashedIndex(); }
0081
0082 static bool validDenseIndex(uint32_t din) { return (din < kSizeForDenseIndexing); }
0083
0084 static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di);
0085
0086
0087 static bool validDetId(int iz, EcalSubdetector sd, int i, int j);
0088
0089
0090 int iDCC() const;
0091
0092
0093 int iTT() const;
0094
0095 static const int MIN_I = 1;
0096 static const int MIN_J = 1;
0097 static const int MAX_I = 127;
0098 static const int MAX_J = 127;
0099
0100 static const int kEBTowersInPhi = 4;
0101 static const int kEBTowersPerSM = 68;
0102 static const int kEBTowersInEta = 17;
0103
0104 static const int kEETowersInPhiPerQuadrant = 18;
0105
0106
0107 static const int SUBDETIJMODE = 0;
0108 static const int SUBDETDCCTTMODE = 1;
0109
0110 static constexpr int kEETowersInPhiPerEndcap = 4 * kEETowersInPhiPerQuadrant, kEEOuterEta = 18, kEEInnerEta = 28,
0111 kEETowersInEta = (kEEInnerEta - kEEOuterEta + 1), kEBHalfTowers = kEBTowersPerSM * 18,
0112 kEBTotalTowers = kEBHalfTowers * 2,
0113 kEETowersPerEndcap = kEETowersInEta * kEETowersInPhiPerEndcap - 72,
0114 kEETotalTowers = kEETowersPerEndcap * 2, kSizeForDenseIndexing = kEBTotalTowers + kEETotalTowers;
0115 };
0116
0117 std::ostream& operator<<(std::ostream&, const EcalTrigTowerDetId& id);
0118
0119 #endif