DTTracoId

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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
//-------------------------------------------------
//
/**  \class DTTracoId
 *    TRACO Identifier
 *
 *   \author C.Grandi
 */
//
//--------------------------------------------------
#ifndef DT_TRACO_ID_H_
#define DT_TRACO_ID_H_

//------------------------------------
// Collaborating Class Declarations --
//------------------------------------

//----------------------
// Base Class Headers --
//----------------------
#include "DataFormats/MuonDetId/interface/DTChamberId.h"

//---------------
// C++ Headers --
//---------------

//---------------------------------------------------
//                      DTTracoChip
//---------------------------------------------------

//              ---------------------
//              -- Class Interface --
//              ---------------------

class DTTracoId {
public:
  ///  Constructor
  DTTracoId() : _traco(0) {}

  ///  Constructor
  DTTracoId(const DTChamberId& mu_stat_id, const int traco_id) : _statId(mu_stat_id), _traco(traco_id) {}

  ///  Constructor
  DTTracoId(const int wheel_id, const int station_id, const int sector_id, const int traco_id)
      : _statId(wheel_id, station_id, sector_id), _traco(traco_id) {}

  ///  Constructor
  DTTracoId(const DTTracoId& tracoId) : _statId(tracoId._statId), _traco(tracoId._traco) {}

  // Assignment Operator
  DTTracoId& operator=(const DTTracoId& tracoId) = default;

  /// Destructor
  virtual ~DTTracoId() {}

  /// Returns wheel number
  inline int wheel() const { return _statId.wheel(); }
  /// Returns station number
  inline int station() const { return _statId.station(); }
  /// Returns sector number
  inline int sector() const { return _statId.sector(); }
  /// Returns the traco
  inline int traco() const { return _traco; }
  /// Returns the chamber id
  inline DTChamberId ChamberId() const { return _statId; }

  bool operator==(const DTTracoId& id) const {
    if (wheel() != id.wheel())
      return false;
    if (sector() != id.sector())
      return false;
    if (station() != id.station())
      return false;
    if (_traco != id.traco())
      return false;
    return true;
  }

  bool operator<(const DTTracoId& id) const {
    if (wheel() < id.wheel())
      return true;
    if (wheel() > id.wheel())
      return false;

    if (station() < id.station())
      return true;
    if (station() > id.station())
      return false;

    if (sector() < id.sector())
      return true;
    if (sector() > id.sector())
      return false;

    if (traco() < id.traco())
      return true;
    if (traco() > id.traco())
      return false;

    return false;
  }

private:
  DTChamberId _statId;  // this is 3 bytes
  int _traco;
};

#endif