EcalEBTriggerPrimitiveDigi

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
#ifndef ECALEBTRIGGERPRIMITIVEDIGI_H
#define ECALEBTRIGGERPRIMITIVEDIGI_H 1

#include <ostream>
#include <vector>
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDigi/interface/EcalEBTriggerPrimitiveSample.h"

/** \class EcalEBTriggerPrimitiveDigi
\author N. Marinelli - Univ. of Notre Dame


*/

class EcalEBTriggerPrimitiveDigi {
public:
  typedef EBDetId key_type;  ///< For the sorted collection

  EcalEBTriggerPrimitiveDigi();  // for persistence
  EcalEBTriggerPrimitiveDigi(const EBDetId& id);

  void swap(EcalEBTriggerPrimitiveDigi& rh) {
    std::swap(id_, rh.id_);
    std::swap(size_, rh.size_);
    std::swap(data_, rh.data_);
  }

  const EBDetId& id() const { return id_; }
  int size() const { return size_; }

  const EcalEBTriggerPrimitiveSample& operator[](int i) const { return data_[i]; }
  const EcalEBTriggerPrimitiveSample& sample(int i) const { return data_[i]; }

  void setSize(int size);
  void setSample(int i, const EcalEBTriggerPrimitiveSample& sam);
  void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); }

  static const int MAXSAMPLES = 20;

  /// get the 10 bits Et of interesting sample
  int encodedEt() const;

  /// Spike flag
  bool l1aSpike() const;

  /// Time info
  int time() const;

  /// True if debug mode (# of samples > 1)
  bool isDebug() const;

  /// Gets the interesting sample
  int sampleOfInterest() const;

private:
  EBDetId id_;
  int size_;
  std::vector<EcalEBTriggerPrimitiveSample> data_;
};

inline void swap(EcalEBTriggerPrimitiveDigi& lh, EcalEBTriggerPrimitiveDigi& rh) { lh.swap(rh); }

std::ostream& operator<<(std::ostream& s, const EcalEBTriggerPrimitiveDigi& digi);

#endif