ATLAS Offline Software
Loading...
Searching...
No Matches
HistoDefinitionHelpers Namespace Reference

Functions

 createHistoDefTool (name, title=None, nbinsx=10, xlow=10.0, xup=1.0, nbinsy=10, ylow=0.0, yup=1.0, hname=None)
 mergeHistoDefinition (hdef1, hdef2)

Function Documentation

◆ createHistoDefTool()

HistoDefinitionHelpers.createHistoDefTool ( name,
title = None,
nbinsx = 10,
xlow = 10.0,
xup = 1.0,
nbinsy = 10,
ylow = 0.0,
yup = 1.0,
hname = None )
Short cut to return a HistoDefinitionTool from a compact list of arguments

Definition at line 5 of file HistoDefinitionHelpers.py.

5def createHistoDefTool( name, title=None,nbinsx=10, xlow=10.0, xup=1.0, nbinsy=10, ylow=0.0, yup=1.0, hname=None):
6 """Short cut to return a HistoDefinitionTool from a compact list of arguments"""
7 if title is None : title = name
8 if hname is None : hname = name
9 name = "hdef_"+name # athena can causes conflicts when tools of different types have same names
10 return HistoDefinitionTool(name,hname=hname, title=title,nbinsx=nbinsx, xlow=xlow, xup=xup, nbinsy=nbinsy, ylow=ylow, yup=yup)
11
This tool does no particular tasks.

◆ mergeHistoDefinition()

HistoDefinitionHelpers.mergeHistoDefinition ( hdef1,
hdef2 )
Merge 2 histo definitions (assumming 1D definition) into a 2D histo definiton
 hdef1/2 are either
   - HistoDefinitionTool instances
   - tuple in the form ('title', nbins, xlow, xup)
   returns a tuple form

Definition at line 12 of file HistoDefinitionHelpers.py.

12def mergeHistoDefinition(hdef1, hdef2):
13 """Merge 2 histo definitions (assumming 1D definition) into a 2D histo definiton
14 hdef1/2 are either
15 - HistoDefinitionTool instances
16 - tuple in the form ('title', nbins, xlow, xup)
17 returns a tuple form
18 """
19 def makeTuple(hdef):
20 if isinstance(hdef,HistoDefinitionTool):
21 return (hdef.title, hdef.nbinsx, hdef.xlow, hdef.xup)
22 return hdef
23 hdef1 = makeTuple(hdef1)
24 hdef2 = makeTuple(hdef2)
25 # rebuild a full 2D title specification
26 topT1, xT1, n = hdef1[0].split(';')
27 topT2, xT2, n = hdef2[0].split(';')
28 title = ';'.join([topT2+' vs '+topT1 , xT1, xT2 ])
29 # build (title, binning1+binning2 ) as a 2D binning def
30 hdef = (title, ) + hdef1[1:] + hdef2[1:]
31 return hdef
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177