Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:05

0001 #include "Geometry/HGCalCommonData/interface/HGCalTypes.h"
0002 
0003 int32_t HGCalTypes::packTypeUV(int type, int u, int v) {
0004   int32_t iu = std::abs(u);
0005   int32_t iv = std::abs(v);
0006   int32_t copy = type * factype_ + iv * facv_ + iu;
0007   if (u < 0)
0008     copy += signu_;
0009   if (v < 0)
0010     copy += signv_;
0011   return copy;
0012 }
0013 
0014 int32_t HGCalTypes::getUnpackedType(int copy) { return ((copy / factype_) % maxtype_); }
0015 
0016 int32_t HGCalTypes::getUnpackedU(int copy) {
0017   int32_t iu = (copy % maxuv_);
0018   int32_t u = (((copy / signu_) % maxsign_) > 0) ? -iu : iu;
0019   return u;
0020 }
0021 
0022 int32_t HGCalTypes::getUnpackedV(int copy) {
0023   int32_t iv = ((copy / facv_) % maxuv_);
0024   int32_t v = (((copy / signv_) % maxsign_) > 0) ? -iv : iv;
0025   return v;
0026 }
0027 
0028 int32_t HGCalTypes::packCellTypeUV(int type, int u, int v) { return (type * faccelltype_ + v * faccell_ + u); }
0029 
0030 int32_t HGCalTypes::getUnpackedCellType(int copy) { return ((copy / faccelltype_) % faccell_); }
0031 
0032 int32_t HGCalTypes::getUnpackedCellU(int copy) { return (copy % faccell_); }
0033 
0034 int32_t HGCalTypes::getUnpackedCellV(int copy) { return ((copy / faccell_) % faccell_); }
0035 
0036 int32_t HGCalTypes::packCellType6(int type, int cell) { return (type * faccell6_ + cell); }
0037 
0038 int32_t HGCalTypes::getUnpackedCellType6(int id) { return (id / faccell6_); }
0039 
0040 int32_t HGCalTypes::getUnpackedCell6(int id) { return (id % faccell6_); }
0041 
0042 int32_t HGCalTypes::layerType(int type) {
0043   static constexpr int32_t types[5] = {HGCalTypes::WaferCenter,
0044                                        HGCalTypes::WaferCenterB,
0045                                        HGCalTypes::CornerCenterYp,
0046                                        HGCalTypes::CornerCenterYm,
0047                                        HGCalTypes::WaferCenterR};
0048   return ((type >= 0 && type < 5) ? types[type] : HGCalTypes::WaferCenter);
0049 }