ATLAS Offline Software
Functions | Variables
ParseHighPtInput Namespace Reference

Functions

def GetKeyNames (self, dir="")
 
def ReadHighPtHistograms (dirName)
 
def ReadHighPtHistogramsFromOldFile (fileName)
 

Variables

list jetDefList = ['AntiKt4Topo_EMJES','AntiKt6Topo_EMJES','AntiKt4Topo_LCJES','AntiKt6Topo_LCJES']
 

Function Documentation

◆ GetKeyNames()

def ParseHighPtInput.GetKeyNames (   self,
  dir = "" 
)

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

11 def GetKeyNames(self,dir=""):
12  self.cd(dir)
13  return [key.GetName() for key in gDirectory.GetListOfKeys()]
14 TFile.GetKeyNames = GetKeyNames
15 

◆ ReadHighPtHistograms()

def ParseHighPtInput.ReadHighPtHistograms (   dirName)

Definition at line 18 of file Final2012/ParseHighPtInput.py.

18 def ReadHighPtHistograms(dirName):
19  if not dirName.endswith("/"):
20  dirName = dirName + "/"
21 
22  # Run over the two files
23  emFileList = sorted(glob.glob(dirName+"EM*/*.root"))
24  lcFileList = sorted(glob.glob(dirName+"LC*/*.root"))
25  if len(emFileList) != 1:
26  print "Found a number of EM root files not equal to 1 in dir:",dirName
27  return None
28  if len(lcFileList) != 1:
29  print "Found a number of LC root files not equal to 1 in dir:",dirName
30  return None
31  emFile = TFile(emFileList[0],"READ")
32  lcFile = TFile(lcFileList[0],"READ")
33 
34  histos = {}
35  for aJetDef in jetDefList:
36  histos[aJetDef] = {}
37 
38  rootFile = None
39  if "EMJES" in aJetDef:
40  rootFile = emFile
41  elif "LCJES" in aJetDef:
42  rootFile = lcFile
43  else:
44  print "Unexpected jet def:",aJetDef
45  return None
46 
47  for histName in rootFile.GetKeyNames():
48  if aJetDef not in histName: continue
49  histo = rootFile.Get(histName)
50  if histo is None:
51  print "Failed to get histogram:",histName
52  return None
53  histo.SetName(histName+"_1D")
54 
55  histos[aJetDef][re.sub("_%s"%(aJetDef),"",histName)] = ProviderHistoHelpers.ConvertPtHistoToProviderHisto(histo,histName)
56  histos[aJetDef][re.sub("_%s"%(aJetDef),"",histName)].SetDirectory(0)
57 
58  lcFile.Close()
59  emFile.Close()
60 
61 
67 
68  #histos = {}
69  #for aJetDef in jetDefList:
70  # histos[aJetDef] = {}
71 
72  # for histName in rootFile.GetKeyNames():
73  # if aJetDef not in histName: continue
74  # histo = rootFile.Get(histName)
75  # if histo is None:
76  # print "Failed to get histogram:",histName
77  # return None
78  # histo.SetName(histName+"_1D")
79 
80  # histos[aJetDef][re.sub("_%s"%(aJetDef),"",histName)] = ProviderHistoHelpers.ConvertPtHistoToProviderHisto(histo,histName)
81  # histos[aJetDef][re.sub("_%s"%(aJetDef),"",histName)].SetDirectory(0)
82 
83 
85 
86  return histos
87 

◆ ReadHighPtHistogramsFromOldFile()

def ParseHighPtInput.ReadHighPtHistogramsFromOldFile (   fileName)

Definition at line 18 of file ICHEP2016/ParseHighPtInput.py.

18 def ReadHighPtHistogramsFromOldFile(fileName) :
19 
20  histos = {}
21  for jetDef in jetDefList :
22  histos[jetDef] = {}
23  inFile = TFile(fileName,"READ")
24  uncNames = ["SingleParticle_HighPt"]
25  jetCollections = {"AntiKt4EMTopo" : "AntiKt4Topo_EMJES", "AntiKt4LCTopo" : "AntiKt4Topo_LCJES"}
26  for name in uncNames :
27  for jetCollection in jetCollections.keys() :
28  getJetType = jetCollections[jetCollection]
29  fetchName = name+"_"+getJetType
30  hist = inFile.Get(fetchName)
31  print "retrieved",fetchName
32  hist.SetDirectory(0)
33  histos[jetCollections[jetCollection]][name] = hist
34 
35  return histos
36 

Variable Documentation

◆ jetDefList

list ParseHighPtInput.jetDefList = ['AntiKt4Topo_EMJES','AntiKt6Topo_EMJES','AntiKt4Topo_LCJES','AntiKt6Topo_LCJES']

Definition at line 16 of file Final2012/ParseHighPtInput.py.

ParseHighPtInput.GetKeyNames
def GetKeyNames(self, dir="")
Definition: Final2012/ParseHighPtInput.py:11
ParseHighPtInput.ReadHighPtHistogramsFromOldFile
def ReadHighPtHistogramsFromOldFile(fileName)
Definition: ICHEP2016/ParseHighPtInput.py:18
ProviderHistoHelpers.ConvertPtHistoToProviderHisto
def ConvertPtHistoToProviderHisto(histo1D, histoName)
Definition: Final2012/ProviderHistoHelpers.py:44
ParseHighPtInput.ReadHighPtHistograms
def ReadHighPtHistograms(dirName)
Definition: Final2012/ParseHighPtInput.py:18
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.
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