ATLAS Offline Software
Loading...
Searching...
No Matches
Final2012/ParseEtaIntercalInput.py
Go to the documentation of this file.
1# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3from ROOT import *
4from array import array
5import glob
6import re
7import math
8import ProviderHistoHelpers
9
10SystematicNames = ['EtaIntercalibration_TotalStat','EtaIntercalibration_Modelling']
11
12jetDefDict = {
13 'AntiKt4TopoEM' : 'AntiKt4Topo_EMJES',
14 'AntiKt6TopoEM' : 'AntiKt6Topo_EMJES',
15 'AntiKt4LCTopo' : 'AntiKt4Topo_LCJES',
16 'AntiKt6LCTopo' : 'AntiKt6Topo_LCJES'
17 }
18
20 if not dirName.endswith("/"):
21 dirName = dirName + "/"
22
23 # Run over each file (one per jet definition)
24 histos = {}
25 files = sorted(glob.glob(dirName+"*.root"))
26 for aFileName in files:
27 # Determine the jet definition
28 jetDef = ""
29 for aFileDef,aJetDef in jetDefDict.iteritems():
30 if aFileDef in aFileName:
31 jetDef = aJetDef
32 break
33 if jetDef == "":
34 print "Failed to determine jet definition for file:",aFileName
35 return None
36 histos[jetDef] = {}
37
38 # Read in the histograms of interest from the file
39 inFile = TFile(aFileName,"READ")
40 for aName in SystematicNames:
41 systematicName = aName + "_" + jetDef
42 histo = inFile.Get(systematicName)
43 if histo is None:
44 print "Failed to get histogram:",systematicName
45 return None
46 histo.SetName(systematicName+"_old")
47
48 # Histo has different range, extend it
49 histoNew = ProviderHistoHelpers.ExtendPtRangeOfHisto(histo,systematicName)
50 histoNew.SetDirectory(0)
51 histos[jetDef][aName] = histoNew
52
53 # Done reading, close the file
54 inFile.Close()
55
56 return histos