7 if value<bins[0]
or value>bins[len(bins)-1]:
return False
8 for i
in range(0,len(bins)-1):
9 if value>bins[i]
and value<bins[i+1]:
25 self.
varNames = { 0:
'mult', 1:
'ptD', 2:
'axis2' }
31 print "[QGLikelihoodCalculator]: Initializing from file: " + filename
33 f = ROOT.TFile.Open(filename)
34 if f.IsZombie() :
return False
43 print "[QGLikelihoodCalculator]: Initialized binning of pdfs..."
45 keys = f.GetListOfKeys()
47 if key.IsFolder() ==
False:
continue
48 hists = key.ReadObj().GetListOfKeys()
50 histogram = hist.ReadObj()
51 histogram.SetDirectory(0)
52 self.
pdfs[hist.GetName()] = histogram
54 print "[QGLikelihoodCalculator]: pdfs initialized..."
63 if pt < self.
ptBinsC[0]:
return False
65 if rho < self.
rhoBins[0]:
return False
67 if math.fabs(eta) < self.
etaBins[0]:
return False
68 if math.fabs(eta) > self.
etaBins[len(self.
etaBins)-1]:
return False
74 def findEntry( self, eta, pt, rho, qgIndex, varIndex ) :
77 if etaBin==-1:
return None
82 if ptBin==-1 :
return None
85 if rhoBin==-1 :
return None
87 histName = self.
varNames[varIndex] +
"_" + self.
qgNames[qgIndex] +
"_eta-" + str(etaBin) +
"_pt-" + str(ptBin) +
"_rho-" + str(rhoBin)
89 return self.
pdfs[histName]
97 if self.
isValidRange(jet.pt(), rho, jet.eta())==
False:
return -1
99 vars = {0:jet.mult, 1:jet.ptd, 2:jet.axis2}
116 qgEntry = self.
findEntry(jet.eta(), jet.pt(), rho, 0, i)
118 if qgEntry ==
None:
return -1
119 Qi = qgEntry.GetBinContent(qgEntry.FindBin(vars[i]))
120 mQ = qgEntry.GetMean()
124 qgEntry = self.
findEntry(jet.eta(), jet.pt(), rho, 1, i)
126 if qgEntry ==
None:
return -1
127 Gi = qgEntry.GetBinContent(qgEntry.FindBin(vars[i]))
128 mG = qgEntry.GetMean()
133 if Qi <= epsilon
and Gi <= epsilon :
156 else :
return Q/(Q+G)