Пример #1
0
parser.add_argument('-o',
                    '--outpath',
                    action='store',
                    default='.',
                    dest='outpath',
                    help='Directory for storing output plots')
parser.add_argument('-t',
                    '--selection',
                    action='store',
                    default='events',
                    dest='selection',
                    help='Treename used for making histograms')
results = parser.parse_args()

outpath = results.outpath
files = util.file2list(results.listOfFiles)
histograms = util.file2list(results.listOfHists)
selection = results.selection
betterColors = hpt.betterColors()['linecolors']
variables = hpl.variable_labels()
sample_labels = hpl.sample_labels()
metadata = util.loadMetadata(
    "config/sampleMetaData.txt")  # dictionary of metadata; key=primary dataset

#numberOfHists = 0
# Access data -- assumes you are plotting histograms from multiple sources in one figure

for hi, histogram in enumerate(histograms):

    histogramName = histogram[2:].replace(
        "_" + selection, "")  # turn "h_jet_pt_events" into "jet_pt"
Пример #2
0
vb = util.VERBOSE()

## Set configuration options ##
if len(sys.argv) < 2:
    vb.HELP()
    sys.exit(1)

vb.level = config['verbose_level']
vb.initialize()

## Set output directory
output_dir = "nMCMC{0}_".format(config.nMCMC)
output_dir += "nThin{0}_".format(config.nThin)

hep_data_name = config.hep_data.split('/')[-1].split('.')[0]
listOfSystematics = util.file2list(config['listOfSystematics'])

## Setup Deep Learning class
fbu = Unfolding()

fbu.nMCMC = config.nMCMC
fbu.nThin = config.nThin
fbu.monitoring = config.monitoring
fbu.output_dir = output

#fbu.stat_only = config['stat_only']
#data files

if not os.path.isdir(output_dir):
    vb.INFO("RUN : '{0}' does not exist ".format(output))
    vb.INFO("RUN :       Creating the directory. ")
Пример #3
0
    "eos root://cmseos.fnal.gov/ mkdir -p {0}".format(eos_path_full))
if os_err:
    print "RUNBATCH :: INFO : Attemp to make directory {0}".format(
        eos_path_full)
    print "RUNBATCH :: INFO : Message = {0}".format(os_err)
else:
    print "RUNBATCH :: INFO : Created directory {0}".format(eos_path_full)

# define the directory to write the output
if cfg['output_dir'] == 'eos':
    batch.output_dir = 'root://cmseos.fnal.gov/' + eos_path
else:
    batch.output_dir = cfg['output_dir']

## Submit
batch.execute()

## Metadata so that we know what the samples are weeks later!
metadata
git_branches = commands.getoutput("git branch").split(
)  # '  cwoala-dev\n* hadtop-plotter\n  master\n  ttbarAC_skim_v0.5'
git_branch = git_branches[git_branches.index(
    "*")]  # the current branch follows the '*'
outputdir = batch.output_dir
inputfiles = util.file2list(batch.file)[0].split(
    "/"
)  # get the input directory from the first input file (assumes all input files are in the same directory)
inputdir = "/".join(inputfiles[:-1])

## THE END ##
Пример #4
0
            name = metadata[
                pd].sampleType  # compare primary dataset with metadatafile

        for h in histograms:
            try:
                h_temp = getattr(f, h)
                h_temp.SetDirectory(0)
                hists[h].Add(h_temp)
            except KeyError:
                hists[h] = getattr(f, h)  # retrieve the histogram
                hists[h].SetDirectory(0)

    return {"hists": hists, "primaryDataset": pd, "name": name}


ttbar_files = util.file2list("config/samples_cyminiana/listOfTtbarFiles.txt")
ttbar_files += util.file2list(
    "config/samples_cyminiana/listOfTtbarExtFiles.txt")
signal1_files = util.file2list(
    "config/samples_cyminiana/listOfWp1500NarTp1200NarLHFiles.txt")
signal2_files = util.file2list(
    "config/samples_cyminiana/listOfWp2500NarTp1200NarLHFiles.txt")

outpath = 'plots/b2g-workshop'
x_labels = hpl.variable_labels()
sample_labels = hpl.sample_labels()

selections = ['mujets', 'ejets']
histograms = util.file2list("config/listOfHists_noReco.txt")
histograms = [i.format(sel) for sel in selections for i in histograms]
Пример #5
0
    default='share/listOfSytsDataMC.txt',
    help='Name of file that contains detector systematics to plot')
parser.add_argument('-o',
                    '--outpath',
                    action='store',
                    default='plots/datamc/',
                    dest='outpath',
                    help='Directory for storing output plots')
results = parser.parse_args()

detectorSystematics = []
outpath = results.outpath
samples = hpl.sample_labels()  # labels and binnings for samples
variables = hpl.variable_labels()  # labels and binnings for variables
selections = ['ejets', 'mujets']
histograms = util.file2list(results.listOfHists)
histograms = [i.format(sel) for sel in selections for i in histograms]

# Load information
ttbar_files = util.file2list("config/samples_cyminiana/listOfTtbarFiles.txt")
#ttbar_files  += util.file2list("config/samples_cyminiana/listOfTtbarExtFiles.txt")
#signal_files  = util.file2list("config/samples_cyminiana/listOfWp1500NarTp1200NarLHFiles.txt")

#wjets
#zjets
#singletop
#diboson
ttbar_files = util.file2list(
    "config/samples_cyminiana/listOfTtbarFiles.txt") + util.file2list(
        "config/samples_cyminiana/listOfTtbarExtFiles.txt")
ejets_files = []
Пример #6
0
                    help='Name of file that contains root files to plot')
parser.add_argument('--hists',
                    action='store',
                    default=None,
                    dest='listOfHists',
                    help='Name of file that contains histograms to plot')
parser.add_argument('-o',
                    '--outpath',
                    action='store',
                    default=None,
                    dest='outpath',
                    help='Directory for storing output plots')
results = parser.parse_args()

outpath = results.outpath
files = util.file2list(results.listOfFiles)  # ROOT files to read
histograms = util.file2list(
    results.listOfEffs)  # TEfficiencies/Histograms to plot

labels = hpl.variable_labels()
variable = 'jet_pt'  # Setup to plot multiple efficiencies/hists as a function of one variable
betterColors = hpt.betterColors()['linecolors']

## Add the data from each file
## Assume the data is structured such that you want to plot
## multiple efficiencies from the same file in one plot
## -> change to your desired structure / plot
##    e.g., to plot efficiencies from two sources (files) on 1 plot:
##          switch order of file & hist loops
##          To plot multiple kinds of variables on different plots,
##          you'll need another loop