Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:00

0001 #ifndef DataFormats_CTPPSPixelDetId_h
0002 #define DataFormats_CTPPSPixelDetId_h
0003 
0004 /*
0005   Author: F.Ferro INFN Genova
0006   October 2016
0007 
0008 */
0009 
0010 #include <DataFormats/CTPPSDetId/interface/CTPPSDetId.h>
0011 #include <FWCore/Utilities/interface/Exception.h>
0012 
0013 #include <iosfwd>
0014 #include <iostream>
0015 
0016 class CTPPSPixelDetId : public CTPPSDetId {
0017 public:
0018   /// Construct from a packed id.
0019   explicit CTPPSPixelDetId(uint32_t id);
0020 
0021   CTPPSPixelDetId(const CTPPSDetId& id) : CTPPSDetId(id) {}
0022   /// Construct from fully qualified identifier.
0023   CTPPSPixelDetId(uint32_t Arm, uint32_t Station, uint32_t RP = 0, uint32_t Plane = 0);
0024 
0025   /// Bit 24 = Arm: 0=z>0 1=z<0
0026   /// Bits [22:23] Station (0 = 210 or ex 147)
0027   /// Bits [19:21] RP
0028   /// Bits [16:18] Si Plane
0029 
0030   static const uint32_t startPlaneBit, maskPlane, maxPlane;
0031 
0032   static bool check(unsigned int raw) {
0033     return (((raw >> DetId::kDetOffset) & 0xF) == DetId::VeryForward &&
0034             ((raw >> DetId::kSubdetOffset) & 0x7) == sdTrackingPixel);
0035   }
0036 
0037   uint32_t plane() const { return int((id_ >> startPlaneBit) & maskPlane); }
0038 
0039   void set(uint32_t a, uint32_t b, uint32_t c, uint32_t d) { this->init(a, b, c, d); }
0040 
0041   void setPlane(uint32_t pl) {
0042     id_ &= ~(maskPlane << startPlaneBit);
0043     id_ |= ((pl & maskPlane) << startPlaneBit);
0044   }
0045 
0046 private:
0047   void init(uint32_t Arm, uint32_t Station, uint32_t RP, uint32_t Plane);
0048 
0049 };  // CTPPSPixelDetId
0050 
0051 std::ostream& operator<<(std::ostream& os, const CTPPSPixelDetId& id);
0052 
0053 #endif