DcsStatus

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 108 109 110 111 112
/*X
 *  File: DataFormats/Scalers/interface/DcsStatus.h   (W.Badgett)
 *
 *  The online computed DcsStatus flag values
 *
 */

#ifndef DATAFORMATS_SCALERS_DCSSTATUS_H
#define DATAFORMATS_SCALERS_DCSSTATUS_H

#include "DataFormats/Scalers/interface/TimeSpec.h"

#include <ctime>
#include <iosfwd>
#include <vector>
#include <string>

/*! \file DcsStatus.h
 * \Header file for online DcsStatus value
 * 
 * \author: William Badgett
 *
 */

/// \class DcsStatus.h
/// \brief Persistable copy of online DcsStatus flag values

class DcsStatus {
public:
  static const int partitionList[];
  static const char* const partitionName[];

  enum {
    EBp = 0,
    EBm = 1,
    EEp = 2,
    EEm = 3,
    HBHEa = 5,
    HBHEb = 6,
    HBHEc = 7,
    HF = 8,
    HO = 9,
    RPC = 12,
    DT0 = 13,
    DTp = 14,
    DTm = 15,
    CSCp = 16,
    CSCm = 17,
    CASTOR = 20,
    ZDC = 22,
    TIBTID = 24,
    TOB = 25,
    TECp = 26,
    TECm = 27,
    BPIX = 28,
    FPIX = 29,
    ESp = 30,
    ESm = 31,
    nPartitions = 25
  };

  DcsStatus();
  DcsStatus(const unsigned char* rawData);
  virtual ~DcsStatus();

  /// name method
  std::string name() const { return "DcsStatus"; }

  /// empty method (= false)
  bool empty() const { return false; }

  unsigned int trigType() const { return (trigType_); }
  unsigned int eventID() const { return (eventID_); }
  unsigned int sourceID() const { return (sourceID_); }
  unsigned int bunchNumber() const { return (bunchNumber_); }

  int version() const { return (version_); }
  timespec collectionTime() const { return (collectionTime_.get_timespec()); }

  unsigned int ready() const { return (ready_); }

  bool ready(int partitionNumber) const { return ((ready_ & (1 << partitionNumber)) != 0); }

  float magnetCurrent() const { return (magnetCurrent_); }
  float magnetTemperature() const { return (magnetTemperature_); }

  /// equality operator
  int operator==(const DcsStatus& e) const { return false; }

  /// inequality operator
  int operator!=(const DcsStatus& e) const { return false; }

protected:
  unsigned int trigType_;
  unsigned int eventID_;
  unsigned int sourceID_;
  unsigned int bunchNumber_;

  int version_;

  TimeSpec collectionTime_;
  unsigned int ready_;
  float magnetCurrent_;
  float magnetTemperature_;
};

/// Pretty-print operator for DcsStatus
std::ostream& operator<<(std::ostream& s, const DcsStatus& c);

typedef std::vector<DcsStatus> DcsStatusCollection;

#endif