PXFDetId.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef DataFormats_SiStripDetId_PXFDetId_H
  2. #define DataFormats_SiStripDetId_PXFDetId_H
  3. #include <ostream>
  4. #include "DataFormats/DetId/interface/DetId.h"
  5. #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
  6. /**
  7. * Det identifier class for the PixelEndcap
  8. */
  9. class PXFDetId;
  10. std::ostream& operator<<(std::ostream& os,const PXFDetId& id);
  11. class PXFDetId : public DetId {
  12. public:
  13. /** Constructor of a null id */
  14. PXFDetId();
  15. /** Constructor from a raw value */
  16. PXFDetId(uint32_t rawid);
  17. /**Construct from generic DetId */
  18. PXFDetId(const DetId& id);
  19. PXFDetId(uint32_t side,
  20. uint32_t disk,
  21. uint32_t blade,
  22. uint32_t panel,
  23. uint32_t module) : DetId(DetId::Tracker,PixelSubdetector::PixelEndcap){
  24. id_ |= (side& sideMask_) << sideStartBit_ |
  25. (disk& diskMask_) << diskStartBit_ |
  26. (blade& bladeMask_) << bladeStartBit_ |
  27. (panel& panelMask_) << panelStartBit_ |
  28. (module& moduleMask_) << moduleStartBit_ ;
  29. }
  30. /// positive or negative id
  31. unsigned int side() const{
  32. return int((id_>>sideStartBit_) & sideMask_);
  33. }
  34. /// disk id
  35. unsigned int disk() const{
  36. return int((id_>>diskStartBit_) & diskMask_);
  37. }
  38. /// blade id
  39. unsigned int blade() const
  40. { return ((id_>>bladeStartBit_) & bladeMask_) ;}
  41. /// panel id
  42. unsigned int panel() const
  43. { return ((id_>>panelStartBit_) & panelMask_) ;}
  44. /// det id
  45. unsigned int module() const
  46. { return ((id_>>moduleStartBit_) & moduleMask_) ;}
  47. private:
  48. /// two bits would be enough, but we could use the number "0" as a wildcard
  49. static const unsigned int sideStartBit_= 23;
  50. static const unsigned int diskStartBit_= 16;
  51. static const unsigned int bladeStartBit_= 10;
  52. static const unsigned int panelStartBit_= 8;
  53. static const unsigned int moduleStartBit_= 2;
  54. /// two bits would be enough, but we could use the number "0" as a wildcard
  55. static const unsigned int sideMask_= 0x3;
  56. static const unsigned int diskMask_= 0xF;
  57. static const unsigned int bladeMask_= 0x3F;
  58. static const unsigned int panelMask_= 0x3;
  59. static const unsigned int moduleMask_= 0x3F;
  60. };
  61. #endif