示例#1
0
             linewidth=1.5,
             label="bkg")
    plt.yscale('log', nonposy='clip')
    plt.legend(fontsize=12, frameon=False)
    plt.xlabel(feature_name, fontsize=15)
    plt.ylabel('Prob. Density (a.u.)', fontsize=15)
    #plt.show()
    if Save:
        plt.savefig("../graphs/{}.pdf".format(feature_name))
    #del fig, ax
    #return fig, ax


#creating output folder
save_path = "./CNN+Sequential"
mkdir_p(save_path)

#loading attributes

quark_var = np.load("./data_general/quark_var_3d.npy")
gluon_var = np.load("./data_general/gluon_var_3d.npy")

#shape = min(quark_var.shape[0], gluon_var.shape[0])
shape = 16000

quark_var = quark_var[:shape]
gluon_var = gluon_var[:shape]

final_var_data = np.concatenate((gluon_var, quark_var), axis=0)
final_y_var = np.concatenate(
    (np.ones(gluon_var.shape[0]), np.zeros(quark_var.shape[0])), axis=0)
示例#2
0
import numpy as np
import math as mt
from Creators.image_creator import image_creator
from Utils.plot_image import plot_image, plot_images
from Utils.generic_utils import mkdir_p
import ROOT 

#creating saving repo

save_path = "./data_general"
mkdir_p(save_path)

#importing libraries to read Delphes tree
ROOT.gSystem.Load("/Users/bcoder/MG5_aMC_v2_6_6/Delphes/libDelphes.so")
ROOT.gSystem.Load("/Users/bcoder/MG5_aMC_v2_6_6/Delphes/libDelphes.so")
ROOT.gSystem.Load("/Users/bcoder/MG5_aMC_v2_6_6/Delphes/external/libExRootAnalysis.so")
ROOT.gInterpreter.Declare('#include "/Users/bcoder/MG5_aMC_v2_6_6/ExRootAnalysis/ExRootAnalysis/ExRootTreeReader.h"')
ROOT.gInterpreter.Declare('#include "/Users/bcoder/MG5_aMC_v2_6_6/Delphes/classes/SortableObject.h"')
ROOT.gInterpreter.Declare('#include "/Users/bcoder/MG5_aMC_v2_6_6/Delphes/classes/DelphesClasses.h"')
ROOT.gInterpreter.Declare('#include "/Users/bcoder/MG5_aMC_v2_6_6/ExRootAnalysis/ExRootAnalysis/ExRootTreeReader.h"')
ROOT.gInterpreter.Declare('#include "/Users/bcoder/MG5_aMC_v2_6_6/ExRootAnalysis/ExRootAnalysis/ExRootTask.h"')
ROOT.gInterpreter.Declare('#include "/Users/bcoder/MG5_aMC_v2_6_6/Delphes/classes/SortableObject.h"')
ROOT.gInterpreter.Declare('#include "/Users/bcoder/MG5_aMC_v2_6_6/Delphes/classes/DelphesClasses.h"')

path_to_events = ['/Users/bcoder/qGanq/generation/pp_qq_jet_events/pp_qq_1.root']

event_info = image_creator.Jet_Pt_dist(path_to_events, n_ev = 10000)

#ECAL Pseudorapidity coverage in the endcap 1 < |eta| < 3
event_im = image_creator.create_CMS_image(event_info , bins=240, eta=[-3, 3], phi=[-3.14, 3.14])
np.save(save_path+"/events_im.npy", event_im)