CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/SimDataFormats/CaloTest/src/HcalTestNumbering.cc

Go to the documentation of this file.
00001 
00002 // File: HcalTestNumbering.cc
00003 // Description: Numbering scheme packing for test beam hadron calorimeter
00005 #include "SimDataFormats/CaloTest/interface/HcalTestNumbering.h"
00006 
00007 uint32_t HcalTestNumbering::packHcalIndex(int det, int z, int depth,
00008                                           int eta, int phi, int lay) {
00009 
00010   uint32_t idx=(det&15)<<28;      //bits 28-31 
00011   idx+=((depth-1)&3)<<26;         //bits 26-27  
00012   idx+=((lay-1)&31)<<21;          //bits 21-25
00013   idx+=(z&1)<<20;                 //bits 20
00014   idx+=(eta&1023)<<10;            //bits 10-19
00015   idx+=(phi&1023);                //bits  0-9
00016 
00017   return idx;
00018 
00019 }
00020 
00021 void HcalTestNumbering::unpackHcalIndex(const uint32_t & idx, int& det, int& z,
00022                                         int& depth, int& eta, int& phi,
00023                                         int& lay) {
00024   det  = (idx>>28)&15;
00025   depth= (idx>>26)&3;  depth+=1;
00026   lay  = (idx>>21)&31; lay+=1;
00027   z    = (idx>>20)&1;
00028   eta  = (idx>>10)&1023;
00029   phi  = (idx&1023);
00030 }