CTPPSPixelDetId

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#ifndef DataFormats_CTPPSPixelDetId_h
#define DataFormats_CTPPSPixelDetId_h

/*
  Author: F.Ferro INFN Genova
  October 2016

*/

#include <DataFormats/CTPPSDetId/interface/CTPPSDetId.h>
#include <FWCore/Utilities/interface/Exception.h>

#include <iosfwd>
#include <iostream>

class CTPPSPixelDetId : public CTPPSDetId {
public:
  /// Construct from a packed id.
  explicit CTPPSPixelDetId(uint32_t id);

  CTPPSPixelDetId(const CTPPSDetId& id) : CTPPSDetId(id) {}
  /// Construct from fully qualified identifier.
  CTPPSPixelDetId(uint32_t Arm, uint32_t Station, uint32_t RP = 0, uint32_t Plane = 0);

  /// Bit 24 = Arm: 0=z>0 1=z<0
  /// Bits [22:23] Station (0 = 210 or ex 147)
  /// Bits [19:21] RP
  /// Bits [16:18] Si Plane

  static const uint32_t startPlaneBit, maskPlane, maxPlane;

  static bool check(unsigned int raw) {
    return (((raw >> DetId::kDetOffset) & 0xF) == DetId::VeryForward &&
            ((raw >> DetId::kSubdetOffset) & 0x7) == sdTrackingPixel);
  }

  uint32_t plane() const { return int((id_ >> startPlaneBit) & maskPlane); }

  void set(uint32_t a, uint32_t b, uint32_t c, uint32_t d) { this->init(a, b, c, d); }

  void setPlane(uint32_t pl) {
    id_ &= ~(maskPlane << startPlaneBit);
    id_ |= ((pl & maskPlane) << startPlaneBit);
  }

private:
  void init(uint32_t Arm, uint32_t Station, uint32_t RP, uint32_t Plane);

};  // CTPPSPixelDetId

std::ostream& operator<<(std::ostream& os, const CTPPSPixelDetId& id);

#endif