00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <iostream>
00016
00017
00018 #include "SimG4CMS/HcalTestBeam/interface/HcalTBNumberingScheme.h"
00019 #include "SimG4CMS/Calo/interface/HcalTestNumberingScheme.h"
00020 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
00021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00022
00023
00024
00025
00026
00027 uint32_t HcalTBNumberingScheme::getUnitID(const uint32_t idHit,
00028 const int mode) {
00029
00030 int subdet, zside, group, ieta, iphi, lay;
00031 HcalTestNumbering::unpackHcalIndex(idHit, subdet, zside, group,
00032 ieta, iphi, lay);
00033 LogDebug("HcalTBSim") << "HcalTBNumberingScheme: i/p ID 0x" << std::hex
00034 << idHit << std::dec << " det " << zside << " group "
00035 << group << " layer " << lay << " eta " << ieta
00036 << " phi " << iphi;
00037
00038 uint32_t idunit;
00039 if (subdet == static_cast<int>(HcalBarrel)) {
00040 if (lay <= 17) group = 1;
00041 else group = 2;
00042 }
00043 if (mode > 0) {
00044 if (subdet == static_cast<int>(HcalBarrel) && iphi > 4) {
00045 if (lay <= 17) {
00046
00047 if (ieta > 4 && ieta < 10) {
00048 idunit = HcalTestNumbering::packHcalIndex(0,0,1,0,iphi,lay);
00049 } else {
00050 idunit = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,group);
00051 }
00052 } else {
00053
00054 idunit = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,18);
00055 }
00056 } else {
00057
00058 idunit = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,group);
00059 }
00060 } else {
00061 idunit = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,group);
00062 }
00063
00064 HcalTestNumbering::unpackHcalIndex(idunit, subdet, zside, group,
00065 ieta, iphi, lay);
00066 LogDebug("HcalTBSim") << "HcalTBNumberingScheme: idHit 0x" << std::hex
00067 << idHit << " idunit 0x" << idunit << std::dec << "\n"
00068 << "HcalTBNumberingScheme: o/p ID 0x" << std::hex
00069 << idunit << std::dec << " det " << zside << " group "
00070 << group << " layer " << lay << " eta " << ieta
00071 << " phi " << iphi;
00072
00073 return idunit;
00074 }
00075
00076 std::vector<uint32_t> HcalTBNumberingScheme::getUnitIDs(const int type,
00077 const int mode) {
00078
00079 std::vector<uint32_t> tmp;
00080 int iphi, ieta, lay;
00081 uint32_t id;
00082
00083 if (type != 1) {
00084
00085 if (mode>0) {
00086
00087 for (ieta=1; ieta<17; ieta++) {
00088 for (iphi=1; iphi<9; iphi++) {
00089 id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,1);
00090 tmp.push_back(id);
00091 }
00092 }
00093
00094 for (ieta=1; ieta<16; ieta++) {
00095 for (iphi=2; iphi<5; iphi++) {
00096 id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,2);
00097 tmp.push_back(id);
00098 }
00099 }
00100
00101 for (lay=1; lay<18; lay++) {
00102 for (iphi=5; iphi<9; iphi++) {
00103 id = HcalTestNumbering::packHcalIndex(0,0,1,0,iphi,lay);
00104 tmp.push_back(id);
00105 }
00106 }
00107
00108 lay = 18;
00109 for (ieta=1; ieta<16; ieta++) {
00110 for (iphi=5; iphi<8; iphi++) {
00111 id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,lay);
00112 tmp.push_back(id);
00113 }
00114 }
00115 } else {
00116
00117 for (ieta=1; ieta<17; ieta++) {
00118 for (iphi=1; iphi<9; iphi++) {
00119 id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,1);
00120 tmp.push_back(id);
00121 }
00122 }
00123
00124 for (ieta=1; ieta<16; ieta++) {
00125 for (iphi=2; iphi<8; iphi++) {
00126 id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,2);
00127 tmp.push_back(id);
00128 }
00129 }
00130 }
00131 }
00132
00133 if (type > 0) {
00134
00135 for (ieta=15; ieta<17; ieta++) {
00136 for (iphi=3; iphi<7; iphi++) {
00137 id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,3);
00138 tmp.push_back(id);
00139 }
00140 }
00141 for (iphi=3; iphi<7; iphi++) {
00142 id = HcalTestNumbering::packHcalIndex(0,0,1,17,iphi,1);
00143 tmp.push_back(id);
00144 }
00145 for (ieta=18; ieta<21; ieta++) {
00146 for (iphi=3; iphi<7; iphi++) {
00147 for (int idep=1; idep<3; idep++) {
00148 id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,idep);
00149 tmp.push_back(id);
00150 }
00151 }
00152 }
00153 for (ieta=21; ieta<26; ieta++) {
00154 for (iphi=2; iphi<4; iphi++) {
00155 for (int idep=1; idep<3; idep++) {
00156 id = HcalTestNumbering::packHcalIndex(0,0,1,ieta,iphi,idep);
00157 tmp.push_back(id);
00158 }
00159 }
00160 }
00161 }
00162
00163 return tmp;
00164 }