ATLAS Offline Software
Functions | Variables
ParseNonClosureInput Namespace Reference

Functions

def ReadNonClosureHistograms (dirName)
 
def ReadNonClosureHistograms (dirName, freezepT=False)
 

Variables

dictionary SystematicNameDictionary
 
dictionary jetDefDict
 

Function Documentation

◆ ReadNonClosureHistograms() [1/2]

def ParseNonClosureInput.ReadNonClosureHistograms (   dirName)

Definition at line 22 of file Final2012/ParseNonClosureInput.py.

22 def ReadNonClosureHistograms(dirName):
23  if not dirName.endswith("/"):
24  dirName = dirName + "/"
25 
26  # Run over each file (one per jet definition)
27  histos = {}
28  files = sorted(glob.glob(dirName+"*.root"))
29  for aFileName in files:
30  # Determine the jet definition
31  jetDef = ""
32  for aFileDef,aJetDef in jetDefDict.iteritems():
33  if aFileDef in aFileName:
34  jetDef = aJetDef
35  break
36  if jetDef == "":
37  print "Failed to determine jet definition for file:",aFileName
38  return None
39  histos[jetDef] = {}
40 
41  # Read in the histogram from the file
42  inFile = TFile(aFileName,"READ")
43  for aName,aSystName in SystematicNameDictionary.iteritems():
44  systematicName = aSystName + "_" + jetDef
45  histo = inFile.Get(aName)
46  if histo is None:
47  print "Failed to get histogram:",systematicName
48  return None
49 
50  histoSym = ProviderHistoHelpers.SymmetrizeHistoInEta(histo,systematicName)
51  histoSym.SetDirectory(0)
52  histos[jetDef][aSystName] = histoSym
53 
54  # Also add a blank nonclosure histo for Pythia8
55  # Also add a blank Closeby histo for both AFII and Pythia8
57  histos[jetDef]["RelativeNonClosure_Pythia8"] = ProviderHistoHelpers.MakeProviderHisto("RelativeNonClosure_Pythia8",ptBins=[15,1000,2500],etaBins=etaBins)
58  histos[jetDef]["RelativeNonClosure_Pythia8"].SetDirectory(0)
59  histos[jetDef]["CloseBy_Pythia8"] = ProviderHistoHelpers.MakeProviderHisto("CloseBy_Pythia8",ptBins=[15,1000,2500],etaBins=etaBins)
60  histos[jetDef]["CloseBy_Pythia8"].SetDirectory(0)
61  histos[jetDef]["CloseBy_AFII"] = ProviderHistoHelpers.MakeProviderHisto("CloseBy_AFII",ptBins=[15,1000,2500],etaBins=etaBins)
62  histos[jetDef]["CloseBy_AFII"].SetDirectory(0)
63 
64  # Done reading, close the file
65  inFile.Close()
66 
67  return histos

◆ ReadNonClosureHistograms() [2/2]

def ParseNonClosureInput.ReadNonClosureHistograms (   dirName,
  freezepT = False 
)

Definition at line 23 of file ICHEP2016/ParseNonClosureInput.py.

23 def ReadNonClosureHistograms(dirName,freezepT=False):
24  if dirName.endswith(".root") :
25  files = [dirName]
26 
27  elif not dirName.endswith("/") :
28  dirName = dirName + "/"
29  files = sorted(glob.glob(dirName+"*.root"))
30 
31  # Run over each file (one per jet definition)
32  histos = {}
33  for aFileName in files:
34  # Determine the jet definition
35  jetDef = ""
36  for aFileDef,aJetDef in jetDefDict.iteritems():
37  if aFileDef in aFileName:
38  jetDef = aJetDef
39  break
40  if jetDef == "":
41  print "Failed to determine jet definition for file:",aFileName
42  return None
43  histos[jetDef] = {}
44 
45  # Read in the histogram from the file
46  inFile = TFile(aFileName,"READ")
47  for aName,aSystName in SystematicNameDictionary.iteritems():
48  if not aFileDef in aName : continue
49  systematicName = aSystName + "_" + jetDef
50  histo = inFile.Get(aName)
51  if histo is None:
52  print "Failed to get histogram:",systematicName
53  return None
54 
55  if freezepT :
56  # Loop over eta bins.
57  for ybin in range(histo.GetNbinsY()+2) :
58  # Loop out in pT.
59  freezeval = 0
60  for xbin in range(histo.GetNbinsX()+2) :
61  inbin = histo.GetBinContent(xbin,ybin)
62  #print "Bin at pT ",histo.GetXaxis().GetBinCenter(xbin)," and [ylow,y,yhigh] = ", binYLow, histo.GetYaxis().GetBinCenter(ybin), binYHigh
63  # Store bin contents as we go out: last one is one we want as frozen value.
64  if inbin > -0.5 :
65  freezeval = inbin
66  else :
67  histo.SetBinContent(xbin,ybin,freezeval)
68 
69 
70  histoSym = ProviderHistoHelpers.SymmetrizeHistoInEta(histo,systematicName)
71  histoSym.SetDirectory(0)
72  histos[jetDef][aSystName] = histoSym
73  print "Added hist with name",aSystName,"for jetDef",jetDef
74 
75  # Also add a blank nonclosure histo for Pythia8
76  # Also add a blank Closeby histo for both AFII and Pythia8
78  histos[jetDef]["RelativeNonClosure_MC15"] = ProviderHistoHelpers.MakeProviderHisto("RelativeNonClosure_MC15",ptBins=[15,1000,2500],etaBins=etaBins)
79  histos[jetDef]["RelativeNonClosure_MC15"].SetDirectory(0)
80  histos[jetDef]["CloseBy_Pythia8"] = ProviderHistoHelpers.MakeProviderHisto("CloseBy_MC15",ptBins=[15,1000,2500],etaBins=etaBins)
81  histos[jetDef]["CloseBy_Pythia8"].SetDirectory(0)
82  histos[jetDef]["CloseBy_AFII"] = ProviderHistoHelpers.MakeProviderHisto("CloseBy_AFII",ptBins=[15,1000,2500],etaBins=etaBins)
83  histos[jetDef]["CloseBy_AFII"].SetDirectory(0)
84 
85  # Done reading, close the file
86  inFile.Close()
87 
88  return histos

Variable Documentation

◆ jetDefDict

dictionary ParseNonClosureInput.jetDefDict
Initial value:
1 = {
2  '4EM' : 'AntiKt4Topo_EMJES',
3  '6EM' : 'AntiKt6Topo_EMJES',
4  '4LC' : 'AntiKt4Topo_LCJES',
5  '6LC' : 'AntiKt6Topo_LCJES'
6  }

Definition at line 15 of file Final2012/ParseNonClosureInput.py.

◆ SystematicNameDictionary

dictionary ParseNonClosureInput.SystematicNameDictionary
Initial value:
1 = {
2  'AFIIunc' : 'RelativeNonClosure_AFII'
3  }

Definition at line 11 of file Final2012/ParseNonClosureInput.py.

ParseNonClosureInput.ReadNonClosureHistograms
def ReadNonClosureHistograms(dirName)
Definition: Final2012/ParseNonClosureInput.py:22
max
#define max(a, b)
Definition: cfImp.cxx:41
ProviderHistoHelpers.GetDefaultEtaBins
def GetDefaultEtaBins()
Definition: Final2012/ProviderHistoHelpers.py:18
ProviderHistoHelpers.MakeProviderHisto
def MakeProviderHisto(histoName, ptBins=GetDefaultPtBins(), etaBins=GetDefaultEtaBins())
Definition: Final2012/ProviderHistoHelpers.py:40
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
ProviderHistoHelpers.SymmetrizeHistoInEta
def SymmetrizeHistoInEta(histo, histoName)
Definition: Final2012/ProviderHistoHelpers.py:127
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
min
#define min(a, b)
Definition: cfImp.cxx:40
RCU::SetDirectory
bool SetDirectory(TObject *object, TDirectory *directory)
effects: set the directory this object is associated with returns: whether the object type actively k...
Definition: RootUtils.cxx:28
ParseNonClosureInput.ReadNonClosureHistograms
def ReadNonClosureHistograms(dirName, freezepT=False)
Definition: ICHEP2016/ParseNonClosureInput.py:23