HGCHEDetId

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 54 55 56 57 58 59 60 61 62 63
#ifndef DataFormats_ForwardDetId_HGCHEDetId_H
#define DataFormats_ForwardDetId_HGCHEDetId_H 1

#include <iosfwd>
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"

class HGCHEDetId : public DetId {
public:
  static const int kHGCHECellOffset = 0;
  static const int kHGCHECellMask = 0xFFF;
  static const int kHGCHESectorOffset = 12;
  static const int kHGCHESectorMask = 0x3F;
  static const int kHGCHESubSectorOffset = 18;
  static const int kHGCHESubSectorMask = 0x1;
  static const int kHGCHELayerOffset = 19;
  static const int kHGCHELayerMask = 0x1F;
  static const int kHGCHEZsideOffset = 24;
  static const int kHGCHEZsideMask = 0x1;
  /** Create a null cellid*/
  HGCHEDetId();
  /** Create cellid from raw id (0=invalid tower id) */
  HGCHEDetId(uint32_t rawid);
  /** Constructor from subdetector, zplus, layer, module, cell numbers */
  HGCHEDetId(ForwardSubdetector subdet, int zp, int lay, int mod, int subsec, int cell);
  /** Constructor from a generic cell id */
  HGCHEDetId(const DetId& id);
  /** Assignment from a generic cell id */
  HGCHEDetId& operator=(const DetId& id);

  /** Converter for a geometry cell id
   * @param id full EKDetId 
   */
  HGCHEDetId geometryCell() const;

  /// get the subdetector
  ForwardSubdetector subdet() const { return (ForwardSubdetector)(subdetId()); }

  /// get the absolute value of the cell #'s in x and y
  int cell() const { return id_ & kHGCHECellMask; }

  /// get the sector #
  int sector() const { return (id_ >> kHGCHESectorOffset) & kHGCHESectorMask; }

  /// get the degree subsector
  int subsector() const { return ((id_ >> kHGCHESubSectorOffset) & kHGCHESubSectorMask ? 1 : -1); }

  /// get the layer #
  int layer() const { return (id_ >> kHGCHELayerOffset) & kHGCHELayerMask; }

  /// get the z-side of the cell (1/-1)
  int zside() const { return ((id_ >> kHGCHEZsideOffset) & kHGCHEZsideMask ? 1 : -1); }

  /// consistency check
  bool isHE() const { return true; }
  bool isForward() const { return true; }

  static const HGCHEDetId Undefined;
};

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

#endif