Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:47:05

0001 #ifndef QGLikelihoodObject_h
0002 #define QGLikelihoodObject_h
0003 
0004 #include "CondFormats/PhysicsToolsObjects/interface/Histogram.h"
0005 #include "CondFormats/Serialization/interface/Serializable.h"
0006 #include <vector>
0007 
0008 /// Category structure: ranges associated with QGLikelihood histograms
0009 struct QGLikelihoodCategory {
0010   float RhoMin, RhoMax, PtMin, PtMax, EtaMin, EtaMax;
0011   int QGIndex, VarIndex;
0012   COND_SERIALIZABLE;
0013 };
0014 
0015 /// Parameters structure
0016 struct QGLikelihoodParameters {
0017   float Rho, Pt, Eta;
0018   int QGIndex, VarIndex;
0019 };
0020 
0021 /// QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used anymore, only for backward backward compatibility with older DB constructs)
0022 struct QGLikelihoodObject {
0023   typedef PhysicsTools::Calibration::HistogramF Histogram;
0024 
0025   struct Entry {
0026     QGLikelihoodCategory category;
0027     Histogram histogram;
0028     float mean;
0029     COND_SERIALIZABLE;
0030   };
0031 
0032   QGLikelihoodCategory qgValidRange;
0033   std::vector<Entry> data;
0034   COND_SERIALIZABLE;
0035 };
0036 
0037 /// QGLikelihoodSystematicsObject containing the parameters for the systematic smearing
0038 struct QGLikelihoodSystematicsObject {
0039   struct Entry {
0040     QGLikelihoodCategory systCategory;
0041     float a, b, lmin, lmax;
0042     COND_SERIALIZABLE;
0043   };
0044   std::vector<Entry> data;
0045   COND_SERIALIZABLE;
0046 };
0047 
0048 /// Test if parameters are compatible with category
0049 inline bool operator==(const QGLikelihoodParameters& lhs, const QGLikelihoodCategory& rhs) {
0050   if (lhs.QGIndex != rhs.QGIndex)
0051     return false;
0052   if (lhs.VarIndex != rhs.VarIndex)
0053     return false;
0054   if (lhs.Eta < rhs.EtaMin)
0055     return false;
0056   if (lhs.Eta > rhs.EtaMax)
0057     return false;
0058   if (lhs.Rho < rhs.RhoMin)
0059     return false;
0060   if (lhs.Rho > rhs.RhoMax)
0061     return false;
0062   if (lhs.Pt < rhs.PtMin)
0063     return false;
0064   if (lhs.Pt > rhs.PtMax)
0065     return false;
0066   return true;
0067 }
0068 
0069 #endif