ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetMonitoring
python
HistoDefinitionHelpers.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3
from
JetMonitoring.JetMonitoringConf
import
HistoDefinitionTool
4
5
def
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
12
def
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
HistoDefinitionTool
This tool does no particular tasks.
Definition
HistoDefinitionTool.h:31
split
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition
hcg.cxx:179
HistoDefinitionHelpers.createHistoDefTool
createHistoDefTool(name, title=None, nbinsx=10, xlow=10.0, xup=1.0, nbinsy=10, ylow=0.0, yup=1.0, hname=None)
Definition
HistoDefinitionHelpers.py:5
HistoDefinitionHelpers.mergeHistoDefinition
mergeHistoDefinition(hdef1, hdef2)
Definition
HistoDefinitionHelpers.py:12
Generated on
for ATLAS Offline Software by
1.17.0