Example #1
0
	def __init__(self,filename,debug,data = False):
		self.commandLine = CommandLineHandler('[TimeWindow] ')
		self.fileHandler = RootFileHandler(filename)
		self.fileHandler.printStatus()
		if( not os.path.exists('plots')):
			os.mkdir('plots')
		if( not os.path.exists('plots/efficiencyWithTime')):
			os.mkdir('plots/efficiencyWithTime')
		setPlotStyle()
		self.data = data
Example #2
0
 def __init__(self, filename=None, data=False, debug=False):
     setPlotStyle()
     self.commandLine = CommandLineHandler('[' + self.__class__.__name__ +
                                           ']')
     self.key = 'L1MuonPresent' if data else 'L1MuonTruth'
     self.data = data
     self.DEBUG = debug
     self.filename = filename
     if self.DEBUG:
         self.debug("Creating plot module %s" % self.__class__.__name__)
     if filename != None:
         self.fileHandler = self.createFileHandler(filename)
     pass
Example #3
0
import sys
from ROOT import TCanvas, TLegend, THStack, TLegend
from plotting.RootFileHandler import RootFileHandler
from plotting.PlotStyle import setupAxes,setPlotStyle, colorRwthDarkBlue,\
 drawLabelCmsPrivateSimulation, colorRwthLightBlue, colorRwthGruen,\
 colorRwthTuerkis, colorRwthRot, colorRwthMagenta, setupPalette
from plotting.OutputModule import CommandLineHandler, CliColors
fileHandler = RootFileHandler(sys.argv[1])

setPlotStyle()
cli = CommandLineHandler('[QualityCodes] ')

qualityCodeDict = {
    1: 'Halo Muon',
    2: 'Very low qual. Type 1',
    3: 'Very low qual. Type 2',
    4: 'Very low qual. Type 3',
    5: 'unmatched RPC',
    6: 'unmatched DT or CSC',
    7: 'matched DT-RPC or CSC-RPC'
}

gridSizeDict = {0: 'Central', 1: '3x3', 2: '5x5'}


def plotQualityCodes():
    c = TCanvas('cQualityCodes')
    c.SetLogy()
    qualityCodes = fileHandler.getHistogram(
        'multiplicity/L1MuonQualityCodesCentral_Multiplicity')
    qualityCodesFail = fileHandler.getHistogram(
Example #4
0
from matchingLibrary import calculateDeltaEta, calculateDeltaPhi
from numpy import math
from plotting.OutputModule import CommandLineHandler
from ROOT import gROOT
HO_BIN = math.pi / 36.
E_THR = 0.2

commandLine = CommandLineHandler('[HoMatcher] ')
gROOT.ProcessLine(".L $HOMUONTRIGGER_BASE/python/loader.C+")

from ROOT import HoRecHitData, L1MuonData


def isEtaPhiInGrid(l1Eta, l1Phi, hoEta, hoPhi, gridSize):
    deltaEta = calculateDeltaEta(l1Eta, hoEta)
    deltaPhi = calculateDeltaPhi(l1Phi, hoPhi)

    deltaIEta = 0
    deltaIPhi = 0

    if (deltaEta > HO_BIN / 2.):
        deltaIEta = 1 + int((deltaEta - HO_BIN / 2.) / HO_BIN)
    elif (deltaEta < -HO_BIN / 2.):
        deltaIEta = -1 + int((deltaEta + HO_BIN / 2.) / HO_BIN)

    if (deltaPhi > HO_BIN / 2.):
        deltaIPhi = 1 + int((deltaPhi - HO_BIN / 2.) / HO_BIN)
    elif (deltaPhi < -HO_BIN / 2.):
        deltaIPhi = -1 + int((deltaPhi + HO_BIN / 2.) / HO_BIN)

    if abs(deltaIEta) > gridSize or abs(deltaIPhi) > gridSize:
Example #5
0
#!/bin/env python
import os
from ROOT import TChain,TFile,SetOwnership,Double
from plotting.OutputModule import CommandLineHandler

commandLine = CommandLineHandler('[RootFileHandler] ')

class RootFileHandler:
	#Look, how many files with the given name trunk in filename exist in the directory
	def getNumberOfFiles(self):
		fileCounter = 0
		self.fileNameList = []
		#cut away file extension
		if self.filename.rfind('.root') != -1:
			self.filename = self.filename[:-5]
		commandLine.debug(self.filepath)
		commandLine.debug(self.filename)
		for f in os.listdir(self.filepath):
			if f.find(self.filename) == 0:
				fileCounter += 1
				self.fileNameList.append(f)
		self.numberOfFiles = fileCounter
		pass
	
	#Initialize object
	def __init__(self,filename,debug = False):
		self.DEBUG = debug
		if filename[0] == '/':
			self.filepath = ''
		else:
			self.filepath = './'
Example #6
0
import subprocess 
import json
import sys

from plotting.OutputModule import CommandLineHandler

cli = CommandLineHandler('[getFilesFromLumiJson] ')

jsonFile = sys.argv[1]
dataset = sys.argv[2]

inputJson = json.load(open(jsonFile))
output = file('files%s' % (dataset.replace('/','_')),'w+')

cli.output('Searching files for dataset')

for i,key in enumerate(inputJson.keys()):
	cmd = 'das_client.py --query=\"file dataset=%s run=%s\"' % (dataset,key)
	p = subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True)
	res,err = p.communicate()
	for line in res.split():
		if line.find('.root') == -1:
			pass
		else:
			output.write('root://xrootd.unl.edu/' + line + '\n')
			print line
	cli.printProgress(i+1,len(inputJson.keys()))
print
Example #7
0
'''

cmsswSourceFiles = 'cmsswSourceFiles'
outputFileTrunk = 'sourceList'

globalTags = {
    'noPu': 'autoCond[\'run2_mc\']',
    'pu': 'autoCond[\'run2_mc\']',
    'design': 'autoCond[\'run2_design\']',
    'data': 'autoCond[\'run2_data\']'
}

print

cli = CommandLineHandler('[runParallel] ')

global configTemplate
configTemplate = os.environ[
    'HOMUONTRIGGER_BASE'] + '/python/runConfig_template.py'

parser = argparse.ArgumentParser()

parser.add_argument('--nJobs',
                    '-n',
                    dest='nJobs',
                    type=int,
                    help='Create N jobs')

parser.add_argument('--test',
                    dest='test',
#!/usr/bin/python
from plotting.OutputModule import CommandLineHandler
import sys, os
from plotting.RootFileHandler import RootFileHandler
from ROOT import TH1D, TCanvas, gROOT, TH2D
from OfflineAnalysis.matchingLibrary import calculateDeltaPhi, getDeltaEtaList, getDeltaPhiList
from OfflineAnalysis.HoMatcher import isHoHitInGrid, getEMaxHoHitInGrid, HO_BIN, getEMaxMatches
from plotting.Utils import comparePythonAndRoot2DHist, compareTwoRoot2DHists
import matplotlib
from matplotlib.colors import LogNorm

commandLine = CommandLineHandler('[makeDataTreeAnalysis] ')

import matplotlib.pyplot as plt
import numpy as np
import math

if len(sys.argv) < 2:
    print 'First argument has to be the file name scheme!'

if (not os.path.exists('plots')):
    os.mkdir('plots')
if (not os.path.exists('plots/dataTreeAnalysis')):
    os.mkdir('plots/dataTreeAnalysis')

gROOT.ProcessLine(".L $HOMUONTRIGGER_BASE/python/loader.C+")

fileHandler = RootFileHandler(sys.argv[1])
dataChain = fileHandler.getTChain()
nEvents = dataChain.GetEntries()