Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:41

0001 #ifndef DataFormats_SiStripDetId_PXFDetId_H
0002 #define DataFormats_SiStripDetId_PXFDetId_H
0003 
0004 #include <ostream>
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0007 
0008 /** 
0009  *  Det identifier class for the PixelEndcap
0010  */
0011 class PXFDetId;
0012 
0013 std::ostream& operator<<(std::ostream& os, const PXFDetId& id);
0014 
0015 class PXFDetId : public DetId {
0016 public:
0017   /** Constructor of a null id */
0018   PXFDetId();
0019   /** Constructor from a raw value */
0020   PXFDetId(uint32_t rawid);
0021   /**Construct from generic DetId */
0022   PXFDetId(const DetId& id);
0023 
0024   PXFDetId(uint32_t side, uint32_t disk, uint32_t blade, uint32_t panel, uint32_t module)
0025       : DetId(DetId::Tracker, PixelSubdetector::PixelEndcap) {
0026     id_ |= (side & sideMask_) << sideStartBit_ | (disk & diskMask_) << diskStartBit_ |
0027            (blade & bladeMask_) << bladeStartBit_ | (panel & panelMask_) << panelStartBit_ |
0028            (module & moduleMask_) << moduleStartBit_;
0029   }
0030 
0031   /// positive or negative id
0032   unsigned int side() const { return int((id_ >> sideStartBit_) & sideMask_); }
0033 
0034   /// disk id
0035   unsigned int disk() const { return int((id_ >> diskStartBit_) & diskMask_); }
0036 
0037   /// blade id
0038   unsigned int blade() const { return ((id_ >> bladeStartBit_) & bladeMask_); }
0039 
0040   /// panel id
0041   unsigned int panel() const { return ((id_ >> panelStartBit_) & panelMask_); }
0042 
0043   /// det id
0044   unsigned int module() const { return ((id_ >> moduleStartBit_) & moduleMask_); }
0045 
0046 private:
0047   /// two bits would be enough, but  we could use the number "0" as a wildcard
0048   static const unsigned int sideStartBit_ = 23;
0049   static const unsigned int diskStartBit_ = 16;
0050   static const unsigned int bladeStartBit_ = 10;
0051   static const unsigned int panelStartBit_ = 8;
0052   static const unsigned int moduleStartBit_ = 2;
0053   /// two bits would be enough, but  we could use the number "0" as a wildcard
0054 
0055   static const unsigned int sideMask_ = 0x3;
0056   static const unsigned int diskMask_ = 0xF;
0057   static const unsigned int bladeMask_ = 0x3F;
0058   static const unsigned int panelMask_ = 0x3;
0059   static const unsigned int moduleMask_ = 0x3F;
0060 };
0061 
0062 #endif