File indexing completed on 2024-04-06 12:04:04
0001
0002
0003
0004
0005
0006 #include <DataFormats/EcalDetId/interface/EBDetId.h>
0007 #include <DataFormats/EcalDetId/interface/EEDetId.h>
0008
0009 #include <iostream>
0010
0011 int main() {
0012 std::cout << "Example of loop on DetId" << std::endl;
0013 int cntEB = 0;
0014 int cntEE = 0;
0015
0016 std::cerr << "BARREL --" << std::endl;
0017 for (int i = 0; i < EBDetId::kSizeForDenseIndexing; ++i) {
0018 EBDetId id = EBDetId::unhashIndex(i);
0019 if (id != EBDetId(0)) {
0020 std::cout << " id " << id.rawId() << " -> (" << id.ieta() << ", " << id.iphi() << ") " << id.ic() << "\n";
0021 }
0022 ++cntEB;
0023 }
0024
0025 std::cerr << "ENDCAP --" << std::endl;
0026 for (int i = 0; i < EEDetId::kSizeForDenseIndexing; ++i) {
0027 EEDetId id = EEDetId::unhashIndex(i);
0028 if (id != EEDetId(0)) {
0029 std::cout << " id " << id.rawId() << " -> (" << id.ix() << ", " << id.iy() << ", " << id.zside() << ")\n";
0030 }
0031 ++cntEE;
0032 }
0033 std::cerr << "Total of " << cntEB << " DetId's counted for EB and " << cntEE << " for EE.\n";
0034 return 0;
0035 }