LookupTableRecord

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
#ifndef DataFormats_PatCandidates_interface_LookupTableRecord_h
#define DataFormats_PatCandidates_interface_LookupTableRecord_h

/** \class    pat::LookupTableRecord LookupTableRecord.h "DataFormats/PatCandidates/interface/LookupTableRecord.h"
 *
 *  \brief    Class to store the result of a lookup table fetch, e.g. for efficiencies. 
 *
 *  Stores a value, an uncertainty and a bin index (needed to take into account correlations from multiple lookups) 
 *
 *  \author   Giovanni Petrucciani
 *
 *
 */

#include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1DFloat.h"
#include <cstdint>

namespace pat {
  class LookupTableRecord {
  public:
    LookupTableRecord() : value_(0), error_(0), bin_(0) {}
    LookupTableRecord(float value, float error, uint16_t bin = 0) : value_(value), error_(error), bin_(bin) {}
    LookupTableRecord(float value, uint16_t bin = 0) : value_(value), error_(0), bin_(bin) {}
    LookupTableRecord(const Measurement1DFloat &meas, uint16_t bin = 0)
        : value_(meas.value()), error_(meas.error()), bin_(bin) {}

    // Get the stored value
    float value() const { return value_; }
    // Get the uncertainty on the stored value (note: it CAN be ZERO)
    float error() const { return error_; }
    // Get the bin of the table used to compute this value (if available, otherwise 0)
    uint16_t bin() const { return bin_; }

  private:
    float value_, error_;
    uint16_t bin_;
  };
}  // namespace pat

#endif