ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
PMGSystematicsTools
data
RivetAnalysis_JO_MEfromFile.py
Go to the documentation of this file.
1
import
os
2
3
theApp.EvtMax = -1
4
5
import
AthenaPoolCnvSvc.ReadAthenaPool
6
svcMgr.EventSelector.InputCollections = [
"!TESTSAMPLE!"
]
7
from
PyUtils.MetaReader
import
read_metadata
8
filename = svcMgr.EventSelector.InputCollections[0]
9
#Below are some example
10
systWeights=
None
11
12
13
def
safeFileName
(name):
14
name=name.strip()
15
name= name.replace(
"."
,
"p"
).
replace
(
" "
,
"_"
)
16
name= name.replace(
"pyoda"
,
".yoda"
)
17
name= name.replace(
":"
,
"_"
)
18
return
name
19
20
21
metadata = read_metadata(filename,
None
,
'full'
)[filename]
22
if
'/Generation/Parameters'
in
metadata:
23
genpars=metadata[
'/Generation/Parameters'
]
24
if
'HepMCWeightNames'
in
genpars:
25
systWeights=genpars[
'HepMCWeightNames'
]
26
else
:
27
print
(
'HepMCWeightName not found in /Generation/Parameters:'
)
28
print
(genpars)
29
else
:
30
print
(
'/Generation/Parameters not found in metadata:'
)
31
print
(metadata)
32
33
34
from
AthenaCommon.AlgSequence
import
AlgSequence
35
job = AlgSequence()
36
37
from
Rivet_i.Rivet_iConf
import
Rivet_i
38
39
40
from
AthenaCommon.AppMgr
import
ServiceMgr
as
svcMgr
41
from
GaudiSvc.GaudiSvcConf
import
THistSvc
42
43
svcMgr += THistSvc()
44
analyses=
"!RIVETANALYSIS!"
45
if
systWeights==
None
: systWeights={
'Nominal'
: 0}
46
for
i
in
systWeights:
47
systName=
safeFileName
(i)
48
49
print
(
'weight name:'
,i,
', output name'
,systName)
50
51
rivet =
Rivet_i
(systName)
52
for
analysis
in
analyses.split(
","
):
53
rivet.Analyses +=[analysis]
54
55
rivet.RunName =
""
56
if
i!=
"Nominal"
: rivet.WeightName=i
57
rivet.HistoFile = systName
58
rivet.DoRootHistos =
False
59
rivet.AnalysisPath = os.environ[
'PWD'
]
60
rivet.CrossSection = 1.0
61
62
job += rivet
63
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
Rivet_i
Interface to the Rivet analysis package.
Definition
Rivet_i.h:31
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition
hcg.cxx:312
RivetAnalysis_JO_MEfromFile.safeFileName
safeFileName(name)
Definition
RivetAnalysis_JO_MEfromFile.py:13
Generated on
for ATLAS Offline Software by
1.17.0