示例#1
0
print "Accessed the trees"

# get input variable names from branches
vars = tools.getBranchNames(treeJJ)
treeVars = vars
print "Training with these variables: ", vars

# create selection criteria
#sel = ""
sel = "jetAK8_pt > 50 && jetAK8_mass > 50"
#sel = "tau32 < 9999. && et > 500. && et < 2500. && bDisc1 > -0.05 && SDmass < 400"

# make arrays from the trees
arrayJJ = tree2array(treeJJ, treeVars, sel)
arrayJJ = tools.appendTreeArray(arrayJJ)

arrayHH4W = tree2array(treeHH4W, treeVars, sel)
arrayHH4W = tools.appendTreeArray(arrayHH4W)

arrayHH4B = tree2array(treeHH4B, treeVars, sel)
arrayHH4B = tools.appendTreeArray(arrayHH4B)

# make an array with all of the datasets
arrayData = [arrayJJ, arrayHH4W, arrayHH4B]

# copy the arrays so that copies of the arrays are not deleted in the randomize function
# without this, deleting arrayData will delete all tree arrays
arrayJJ = copy.copy(arrayJJ)
arrayHH4W = copy.copy(arrayHH4W)
arrayHH4B = copy.copy(arrayHH4B)
print "Accessed the trees"

# get input variable names from branches
vars = img.getBoostCandBranchNames(treeHH4B)
treeVars = vars
print "Variables for jet image creation: ", vars

# create selection criteria
#sel = ""
sel = "jetAK8_pt > 500 && jetAK8_mass > 50"
#sel = "tau32 < 9999. && et > 500. && et < 2500. && bDisc1 > -0.05 && SDmass < 400"

# make arrays from the trees
start, stop, step = 0, 167262, 1
arrayHH4B = tree2array(treeHH4B, treeVars, sel, None, start, stop, step)
arrayHH4B = tools.appendTreeArray(arrayHH4B)

print "Number of Jets that will be imaged: ", len(arrayHH4B)

imgArrayHH4B = img.makeBoostCandFourVector(arrayHH4B)

print "Made candidate 4 vector arrays from the datasets"

#==================================================================================
# Store BEST Variables ////////////////////////////////////////////////////////////
#==================================================================================

# get BEST variable names from branches
bestVars = tools.getBestBranchNames(treeHH4B)
print "Boosted Event Shape Variables: ", bestVars
print "Accessed the trees"

# get input variable names from branches
vars = img.getBoostCandBranchNames(treeQCD)
treeVars = vars
print "Variables for jet image creation: ", vars

# create selection criteria
#sel = ""
sel = "jetAK8_pt > 500 && jetAK8_mass > 50"
#sel = "tau32 < 9999. && et > 500. && et < 2500. && bDisc1 > -0.05 && SDmass < 400"

# make arrays from the trees
start, stop, step = 0, 167262, 1
arrayQCD = tree2array(treeQCD, treeVars, sel, None, start, stop, step )
arrayQCD = tools.appendTreeArray(arrayQCD)

print "Number of Jets that will be imaged: ", len(arrayQCD)

imgArrayQCD = img.makeBoostCandFourVector(arrayQCD)

print "Made candidate 4 vector arrays from the datasets"

#==================================================================================
# Store BEST Variables ////////////////////////////////////////////////////////////
#==================================================================================

# get BEST variable names from branches
bestVars = tools.getBestBranchNames(treeQCD)
print "Boosted Event Shape Variables: ", bestVars
print "Accessed the trees"

# get input variable names from branches
vars = img.getBoostCandBranchNames(treeHH4W)
treeVars = vars
print "Variables for jet image creation: ", vars

# create selection criteria
#sel = ""
sel = "jetAK8_pt > 500 && jetAK8_mass > 50"
#sel = "tau32 < 9999. && et > 500. && et < 2500. && bDisc1 > -0.05 && SDmass < 400"

# make arrays from the trees
#start, stop, step = 0, 200000, 1
arrayHH4W = tree2array(treeHH4W, treeVars, sel)#, None, start, stop, step )
arrayHH4W = tools.appendTreeArray(arrayHH4W)

print "Number of Jets that will be imaged: ", len(arrayHH4W)

imgArrayHH4W = img.makeBoostCandFourVector(arrayHH4W)

print "Made candidate 4 vector arrays from the datasets"

#==================================================================================
# Store BEST Variables ////////////////////////////////////////////////////////////
#==================================================================================

# get BEST variable names from branches
bestVars = tools.getBestBranchNames(treeHH4W)
print "Boosted Event Shape Variables: ", bestVars
print "Accessed the trees"

# get input variable names from branches
vars = img.getBoostCandBranchNames(treeHH4B)
treeVars = vars
print "Variables for jet image creation: ", vars

# create selection criteria
#sel = ""
sel = "jetAK8_pt > 500 && jetAK8_mass > 50"
#sel = "tau32 < 9999. && et > 500. && et < 2500. && bDisc1 > -0.05 && SDmass < 400"

# make arrays from the trees
arrayHH4Blong = tree2array(treeHH4B, treeVars, sel)
arrayHH4B = arrayHH4Blong[:4000]
arrayHH4B = tools.appendTreeArray(arrayHH4B)
imgArrayHH4B = img.makeBoostCandFourVector(arrayHH4B)

print "Made candidate 4 vector arrays from the datasets"

#==================================================================================
# Make Jet Images /////////////////////////////////////////////////////////////////
#==================================================================================

jetImagesDF = {}
print "Creating boosted Jet Images for HH->bbbb"
jetImagesDF['HH4B'] = img.prepareBoostedImages(imgArrayHH4B, arrayHH4B, 30,
                                               boostAxis)

print "Made jet image data frames"