L1CaloHcalScale

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

 Description: Class to handle conversion between Et scales in L1 hardware

 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 L1CaloHcalScale {
public:
  //  static const unsigned short nBinRank = 0xff;
  static const unsigned short nBinRank = 1 << 8;
  static const unsigned short nBinEta = 32;  // per half, includes HF, eta index is 1-32

  /// constructor (creates a linear scale with an LSB - no LSB gives identity)
  L1CaloHcalScale(double lsb = 1.0);

  /// destructor
  ~L1CaloHcalScale();

  // eta = |eta|
  // etaSign = +1 or -1

  /// set scale element; use this to create non-linear scales
  void setBin(unsigned short rank,
              unsigned short eta,  // input eta index is 1-28
              short etaSign,
              double et);

  /// convert from physical Et in GeV to rank scale
  uint16_t rank(double et,
                unsigned short eta,  // input eta index is 1-28
                short etaSign) const;

  /// convert from rank to physically meaningful quantity
  double et(unsigned short rank,
            unsigned short eta,  // input eta index is 1-28
            short etaSign) const;

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

private:
  /// thresholds associated with rank scale in GeV
  // First nBinEta eta bins for positive eta, second nBinEta bins for negative
  double m_scale[nBinRank][2 * nBinEta];

  COND_SERIALIZABLE;
};

#endif