EcalTriggerPrimitiveDigi

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

#include <ostream>
#include <vector>

#include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
#include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveSample.h"

/** \class EcalTriggerPrimitiveDigi

see also EcalTrigPrimCompactColl.

*/

class EcalTriggerPrimitiveDigi {
public:
  typedef EcalTrigTowerDetId key_type;  ///< For the sorted collection

  EcalTriggerPrimitiveDigi();  // for persistence
  explicit EcalTriggerPrimitiveDigi(const EcalTrigTowerDetId& id);

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

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

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

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

  static const int MAXSAMPLES = 20;

  /// get the encoded/compressed Et of interesting sample
  int compressedEt() const;

  /// get the fine-grain bit of interesting sample
  bool fineGrain() const;

  /// get the Trigger tower Flag of interesting sample
  int ttFlag() const;

  /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection
  /// @return 0 spike like pattern
  ///         1 EM shower like pattern
  int sFGVB() const;

  /// Gets the L1A spike detection flag. Beware the flag is inverted.
  /// Deprecated, use instead sFGVB() method, whose name is less missleading
  /// @return 0 spike like pattern
  ///         1 EM shower like pattern
  int l1aSpike() const { return sFGVB(); }

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

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

private:
  EcalTrigTowerDetId id_;
  int size_;
  std::vector<EcalTriggerPrimitiveSample> data_;
};

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

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

#endif