L1CaloEtScale

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
#ifndef L1TObjects_L1CaloEtScale_h
#define L1TObjects_L1CaloEtScale_h
// -*- C++ -*-
//
// Package:     L1TObjects
// Class  :     L1CaloEtScale
//
/**\class L1CaloEtScale L1CaloEtScale.h CondFormats/L1TObjects/interface/L1CaloEtScale.h

 Description: Class to handle non-linear scales in L1 calo trigger hardware, including, e/gamma rank, jet rank, Htmiss


 Usage:
    <usage>

*/
//
// Author:      Jim Brooke
// Created:     Wed Sep 27 17:18:27 CEST 2006
// $Id:
//

#include "CondFormats/Serialization/interface/Serializable.h"

#include <vector>
#include <ostream>
#include <cstdint>

class L1CaloEtScale {
public:
  /// default constructor, for testing (out = in)
  L1CaloEtScale();

  /// ctor that provides backwards compatibility with fixed scale max values
  /// OK to use this with e/gamma and jet rank scales
  L1CaloEtScale(const double linearLsbInGeV, const std::vector<double>& thresholdsInGeV);

  /// general case ctor that sets scale max values
  L1CaloEtScale(const unsigned linScaleMax,
                const unsigned rankScaleMax,
                const double linearLsbInGeV,
                const std::vector<double>& thresholdsInGeV);

  // destructor
  ~L1CaloEtScale();

  // get input scale size
  unsigned linScaleMax() const { return m_linScaleMax; }

  // get output scale size
  unsigned rankScaleMax() const { return m_rankScaleMax; }

  /// get LSB of linear input scale
  double linearLsb() const { return m_linearLsb; }

  /// convert from linear Et scale to rank scale
  uint16_t rank(const uint16_t linear) const;

  /// convert from physical Et in GeV to rank scale
  uint16_t rank(const double EtInGeV) const;

  /// convert from rank to physically meaningful quantity
  double et(const uint16_t rank) const;

  /// get thresholds
  const std::vector<double>& getThresholds() const { return m_thresholds; }

  void print(std::ostream& s) const;

private:
  /// linear scale maximum
  uint16_t m_linScaleMax;

  /// rank scale maximum
  uint16_t m_rankScaleMax;

  /// LSB of linear scale in GeV
  double m_linearLsb;

  /// thresholds associated with rank scale in GeV
  std::vector<double> m_thresholds;

  COND_SERIALIZABLE;
};

std::ostream& operator<<(std::ostream& os, const L1CaloEtScale onj);

#endif