File indexing completed on 2024-09-10 02:58:36
0001
0002
0003 #include <iostream>
0004 #include <string>
0005 #include <stdexcept>
0006 #include <iomanip>
0007
0008 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0009
0010 using namespace std;
0011
0012 ostream& pcenter(unsigned w, string s) {
0013 int pad = ((int)w - (int)s.size()) / 2;
0014
0015 for (int i = 0; i < pad; ++i)
0016 cout << " ";
0017 cout << s;
0018 for (int i = pad + s.size(); i < (int)w; ++i)
0019 cout << " ";
0020 return cout;
0021 }
0022
0023 int main(int argc, char* argv[]) {
0024 const int colsize = 8;
0025 #define COL cout << setw(colsize)
0026
0027 cout << right;
0028 pcenter(3 * (colsize + 1) - 1, "input") << "|";
0029 pcenter(11 * (colsize + 1), "detid") << "|";
0030 pcenter(4 * (colsize + 1), "detid->(isc,ic,iz)->detid") << "|";
0031 pcenter(3 * (colsize + 1), "sc_detid") << "\n";
0032
0033
0034 COL << "ix"
0035 << " ";
0036 COL << "iy"
0037 << " ";
0038 COL << "iz"
0039 << "|";
0040
0041
0042 COL << "ix"
0043 << " ";
0044 COL << "iy"
0045 << " ";
0046 COL << "zside"
0047 << " ";
0048 COL << "iquad"
0049 << " ";
0050 COL << "Z"
0051 << " ";
0052 COL << "phi_out"
0053 << " ";
0054 COL << "hash_ind"
0055 << " ";
0056 COL << "hash_chk"
0057 << " ";
0058 COL << "dense_ind"
0059 << " ";
0060 COL << "isc"
0061 << " ";
0062 COL << "ic"
0063 << "|";
0064
0065
0066 COL << "ix"
0067 << " ";
0068 COL << "iy"
0069 << " ";
0070 COL << "iz"
0071 << " ";
0072 COL << "iscic_chk"
0073 << "\n";
0074
0075
0076 COL << "ix"
0077 << " ";
0078 COL << "iy"
0079 << " ";
0080 COL << "iz"
0081 << " ";
0082
0083 try {
0084 for (int iz = -1; iz <= 1; iz += 2) {
0085 COL << "========== " << (iz > 0 ? "EE+" : "EE-") << " ========== \n";
0086 for (int ix = 1; ix <= 100; ++ix) {
0087 for (int iy = 1; iy <= 100; ++iy) {
0088 if (!EEDetId::validDetId(ix, iy, iz))
0089 continue;
0090
0091
0092 COL << ix << " ";
0093 COL << iy << " ";
0094 COL << iz << " ";
0095
0096 EEDetId id(ix, iy, iz);
0097 COL << id.ix() << (ix != id.ix() ? "!!!" : "") << " ";
0098 COL << id.iy() << (iy != id.iy() ? "!!!" : "") << " ";
0099 COL << id.zside() << (iz != id.zside() ? "!!!" : "") << " ";
0100 COL << id.iquadrant() << " ";
0101 COL << (id.positiveZ() ? "z+" : "z-") << (id.positiveZ() != (iz > 0) ? "!!!" : "") << " ";
0102 COL << id.iPhiOuterRing() << " ";
0103
0104
0105 int ih = id.hashedIndex();
0106 COL << ih << " ";
0107 if (!EEDetId::validHashIndex(ih) || EEDetId::unhashIndex(ih) != id ||
0108 EEDetId::unhashIndex(ih).rawId() != id.rawId()) {
0109 COL << "ERR!!!"
0110 << " ";
0111 } else {
0112 COL << "OK"
0113 << " ";
0114 }
0115
0116 COL << id.denseIndex() << (id.denseIndex() != (uint32_t)ih ? "!!!" : "") << " ";
0117
0118
0119 const int isc = id.isc();
0120 COL << isc << " ";
0121 const int icInSc = id.ic();
0122 COL << icInSc << " ";
0123 EEDetId id1(isc, icInSc, iz, EEDetId::SCCRYSTALMODE);
0124 COL << id1.ix() << (id1.ix() != ix ? "!!!" : "") << " ";
0125 COL << id1.iy() << (id1.iy() != iy ? "!!!" : "") << " ";
0126 COL << id1.zside() << (id1.zside() != iz ? "!!!" : "") << " ";
0127 if (id != id1 || id.rawId() != id1.rawId()) {
0128 COL << "ERR!!!"
0129 << " ";
0130 } else {
0131 COL << "OK"
0132 << " ";
0133 }
0134
0135
0136 COL << id.sc().ix() << " ";
0137 COL << id.sc().iy() << " ";
0138 COL << id.sc().zside() << " ";
0139 COL << "\n";
0140 }
0141 }
0142 }
0143 } catch (exception& e) {
0144 cerr << e.what();
0145 }
0146 }