Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:19

0001 #ifndef DataFormats_PatCandidates_interface_LookupTableRecord_h
0002 #define DataFormats_PatCandidates_interface_LookupTableRecord_h
0003 
0004 /** \class    pat::LookupTableRecord LookupTableRecord.h "DataFormats/PatCandidates/interface/LookupTableRecord.h"
0005  *
0006  *  \brief    Class to store the result of a lookup table fetch, e.g. for efficiencies. 
0007  *
0008  *  Stores a value, an uncertainty and a bin index (needed to take into account correlations from multiple lookups) 
0009  *
0010  *  \author   Giovanni Petrucciani
0011  *
0012  *
0013  */
0014 
0015 #include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1DFloat.h"
0016 #include <cstdint>
0017 
0018 namespace pat {
0019   class LookupTableRecord {
0020   public:
0021     LookupTableRecord() : value_(0), error_(0), bin_(0) {}
0022     LookupTableRecord(float value, float error, uint16_t bin = 0) : value_(value), error_(error), bin_(bin) {}
0023     LookupTableRecord(float value, uint16_t bin = 0) : value_(value), error_(0), bin_(bin) {}
0024     LookupTableRecord(const Measurement1DFloat &meas, uint16_t bin = 0)
0025         : value_(meas.value()), error_(meas.error()), bin_(bin) {}
0026 
0027     // Get the stored value
0028     float value() const { return value_; }
0029     // Get the uncertainty on the stored value (note: it CAN be ZERO)
0030     float error() const { return error_; }
0031     // Get the bin of the table used to compute this value (if available, otherwise 0)
0032     uint16_t bin() const { return bin_; }
0033 
0034   private:
0035     float value_, error_;
0036     uint16_t bin_;
0037   };
0038 }  // namespace pat
0039 
0040 #endif