9 if(!
isValidRange(pt, rho, eta, QGLParamsColl->qgValidRange))
return -1;
12 for(
unsigned int varIndex = 0; varIndex < vars.size(); ++varIndex){
14 auto qgEntry =
findEntry(QGLParamsColl->data, eta, pt, rho, 0, varIndex);
15 if(!qgEntry)
return -1;
16 float Qi = qgEntry->histogram.binContent(qgEntry->histogram.findBin(vars[varIndex]));
17 float mQ = qgEntry->mean;
19 qgEntry =
findEntry(QGLParamsColl->data, eta, pt, rho, 1, varIndex);
20 if(!qgEntry)
return -1;
21 float Gi = qgEntry->histogram.binContent(qgEntry->histogram.findBin(vars[varIndex]));
22 float mG = qgEntry->mean;
26 if(Qi <= epsilon && Gi <= epsilon){
28 if(vars[varIndex] > mQ){ Qi = 1-
delta; Gi =
delta;}
29 else if(vars[varIndex] < mG){ Qi =
delta; Gi = 1-
delta;}
32 if(vars[varIndex]<mQ) { Qi = 1-
delta; Gi =
delta;}
33 else if(vars[varIndex]>mG){Qi =
delta;Gi = 1-
delta;}
50 myParameters.
Eta = fabs(eta);
54 auto myDataObject = data.begin();
55 while(!(myParameters == myDataObject->category)){
57 if(myDataObject == data.end()){
58 edm::LogWarning(
"QGLCategoryNotFound") <<
"Jet passed qgValidRange criteria, but no category found with rho=" << rho <<
", pt=" << pt <<
", eta=" << eta
59 <<
"\nPlease contact cms-qg-workinggroup@cern.ch" << std::endl;
63 return &*myDataObject;
69 if(pt < qgValidRange.
PtMin)
return false;
70 if(pt > qgValidRange.
PtMax)
return false;
71 if(rho < qgValidRange.
RhoMin)
return false;
72 if(rho > qgValidRange.
RhoMax)
return false;
73 if(fabs(eta) < qgValidRange.
EtaMin)
return false;
74 if(fabs(eta) > qgValidRange.
EtaMax)
return false;
81 float x=(x0-
min)/(max-min);
85 float x1= tanh(a*atanh(2.*x-1.)+b)/2.+.5;
89 return x1*(max-
min)+min;
94 if(qgValue < 0 || qgValue > 1)
return -1.;
99 myParameters.
Eta = fabs(eta);
100 myParameters.
QGIndex = qgIndex;
103 auto myDataObject = QGLSystematicsColl->data.begin();
104 while(!(myParameters == myDataObject->systCategory)){
106 if(myDataObject == QGLSystematicsColl->data.end())
return -1;
108 return smearingFunction(qgValue, myDataObject->a, myDataObject->b, myDataObject->lmin, myDataObject->lmax);
float smearingFunction(float x0, float a, float b, float min, float max)
Return the smeared qgLikelihood value, given input x0 and parameters a, b, min and max...
const T & max(const T &a, const T &b)
float computeQGLikelihood(edm::ESHandle< QGLikelihoodObject > &QGLParamsColl, float pt, float eta, float rho, std::vector< float > vars)
Compute likelihood for a jet using the QGLikelihoodObject information and a set of variables...
Category structure: ranges associated with QGLikelihood histograms.
char data[epos_bytes_allocation]
const QGLikelihoodObject::Entry * findEntry(std::vector< QGLikelihoodObject::Entry > const &data, float eta, float pt, float rho, int qgIndex, int varIndex)
Find matching entry in vector for a given eta, pt, rho, qgIndex and varIndex.
bool isValidRange(float pt, float rho, float eta, const QGLikelihoodCategory &qgValidRange)
Check the valid range of this qg tagger.
float systematicSmearing(edm::ESHandle< QGLikelihoodSystematicsObject > &QGLParamsColl, float pt, float eta, float rho, float qgValue, int qgIndex)