8 if value<bins[0]
or value>bins[len(bins)-1]:
return False 9 for i
in range(0,len(bins)-1):
10 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 37 self.
ptBins = f.Get(
"ptBins")
46 for it
in range(0,len(self.
qgNames)):
48 for iv
in range(0,len(self.
varNames)):
50 for ie
in range(0,len(self.
etaBins)):
52 for ip
in range(0,len(self.
ptBins)):
54 for ir
in range(0,len(self.
rhoBins)):
59 print "[QGLikelihoodCalculator]: Initialized binning of pdfs..." 61 keys = f.GetListOfKeys()
63 if key.IsFolder() ==
False:
continue 64 hists = key.ReadObj().GetListOfKeys()
66 pieces = hist.GetName().
split(
"_")
72 etaBin =
int(etaStr.split(
"eta")[1])
73 ptBin =
int( ptStr.split(
"pt") [1])
74 rhoBin =
int(rhoStr.split(
"rho")[1])
75 histogram = hist.ReadObj()
76 histogram.SetDirectory(0)
77 self.
pdfs[qgType][varName][etaBin][ptBin][rhoBin] = histogram
79 print "[QGLikelihoodCalculator]: pdfs initialized..." 89 if pt < self.
ptBins[0]:
return False 91 if rho < self.
rhoBins[0]:
return False 93 if math.fabs(eta) < self.
etaBins[0]:
return False 94 if math.fabs(eta) > self.
etaBins[len(self.
etaBins)-1]:
return False 103 if etaBin==-1:
return None 105 if ptBin==-1 :
return None 108 if rhoBin==-1 :
return None 110 return self.
pdfs[qgType][varName][etaBin][ptBin][rhoBin]
118 if self.
isValidRange(jet.pt(), rho, jet.eta())==
False:
return -1
121 vars = {0:jet.mult, 1:jet.ptd, 2:jet.axis2}
140 if qgEntry ==
None:
return -1
141 Qi = qgEntry.GetBinContent(qgEntry.FindBin(vars[i]))
142 mQ = qgEntry.GetMean()
148 if qgEntry ==
None:
return -1
149 Gi = qgEntry.GetBinContent(qgEntry.FindBin(vars[i]))
150 mG = qgEntry.GetMean()
155 if Qi <= epsilon
and Gi <= epsilon :
178 else :
return Q/(Q+G)
def isValidRange(self, pt, rho, eta)
def __init__(self, filename)
def computeQGLikelihood(self, jet, rho)
def findEntry(self, eta, pt, rho, qgType, varName)
def getBinNumber(bins, value)