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

Functions

 jetMonitoringExampleConfig (inputFlags)

Variables

str fileName = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'
 flags = initConfigFlags()
 Files
 isMC
 HISTFileName
 cfg = MainServicesCfg(flags)
 exampleMonitorAcc = jetMonitoringExampleConfig(flags)

Detailed Description

@file JetMonitoringExample.py
@author P-A. Delsart
@date 2019-03-12
@brief Example python configuration for the Run III Jet Monitoring

Function Documentation

◆ jetMonitoringExampleConfig()

JetMonitoringExample.jetMonitoringExampleConfig ( inputFlags)
Function to configures some algorithms in the monitoring system.

Definition at line 12 of file JetMonitoringExample.py.

12def jetMonitoringExampleConfig(inputFlags):
13 '''Function to configures some algorithms in the monitoring system.'''
14
15
16
17 # The following class will make a sequence, configure algorithms, and link
18 # them to GenericMonitoringTools
19 from AthenaMonitoring import AthMonitorCfgHelper
20 helper = AthMonitorCfgHelper(inputFlags,'ExampleAthMonitorCfg')
21
22
24 from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, SelectSpec, ToolSpec
25 #from JetMonitoring.JetStandardHistoSpecs import knownHistos
26
27 # we use a specialized dictionnary (JetMonAlgSpec) which will be translated into the final C++ tool
28 ak4conf = JetMonAlgSpec(
29 "ak4lcMon",
30 JetContainerName = "AntiKt4LCTopoJets",
31 # TriggerChain = '' , --> no trigger filter yet.
32 )
33
34 # Then set the list of all histos we want to fill with this alg.
35 # We append each histo specification as arguments of the appendHistos()
36 # method of our specialized dictionnary.
37 # (again, each of this histo spec will be translated as C++ tool and then passed into
38 # 'FillerTools' property of the actual JetMonitoring C++ class)
39
40 # Now start filling the histo spec list
41 ak4conf.appendHistos(
42 # This python list can be filled with various type of entries :
43 # We can give aliases of standard spec :
44 "pt",
45 "highpt",
46 "m",
47 "eta",
48
49 "leadingJetsRel",
50
51 # See knownHistos in JetStandardHistoSpecs.py for the list of standard specification.
52
53
54 # or we can directly add our custom histo specification in the form of a HistoSpec :
55 HistoSpec('HECFrac', (50,-0.1,1.4), title="HEC E fraction;HEC frac;" ),
56 # the basic call is : HistoSpec( variable, histobins, title='histotile;xtitle,ytitle')
57
58
59 # Say we want a 2nd 'pt' plot but with different a binning than in the standard spec.
60 # WARNING : we can not re-use the same spec name in a given JetMonitoringAlg !!!
61 # so we give a new name AND we specify the actual variable with the argument 'xvar'
62 # (the ':GeV' means the variable is to be set at GeV scale)
63 HistoSpec( 'lowpt', (100,0,150) , title='p_{T};p_{T} [GeV];', xvar='pt:GeV'),
64 # An equivalent solution would have been to clone the existing spec like in :
65 # knownHistos.pt.clone('lowpt',bins= (100,0,200) ),
66
67
68 # 2D histos are usually refered to by concatenating vars with a ';' as in 'varx;vary'
69 "pt;m",
70 # if the 'vax;vary' alias doesn't exist in knownHistos but 'varx' and 'vary'
71 # do exist, then a spec fot 'vax;vary' will be automatically generated.
72 "pt;eta",
73
74
75 # TProfile : to be done ...
76
77 # TProfile2D : just use 3 variables. For now the sytem will automatically
78 # interpret it as a TProfile2D (the 3rd variable being profiled)
79 "phi;eta;e", # --> Average Energy vs pt and eta
80
81
82 # Histograms build from a selection of filtered jets.
83 # we declare a selection using a SelectSpec dictionnary. Here for central jets :
84 SelectSpec( 'central', # the name of the selection
85 '|eta|<0.5', # selection expression. The form 'min<var<max' is automatically interpreted.
86
87 # Then give a list of histo specs for the filtered jets
88 # these histos will be put under the 'central/' sub-directory
89 FillerTools = [
90 # exactly the same type of entries as for the JetMonAlgSpec/
91 # we can re-use aliases since we're going in a different path.
92 "pt",
93 "m",
94 "eta",
95 ] ),
96
97 # another selection : only sub-leading jets
98 SelectSpec( 'subleading',
99 '', # no selection on variables
100 SelectedIndex=1, # force 2nd (sub-leading) jet (we would set 0 for leading jets)
101 path='standardHistos', # force the path where the histos are saved in the final ROOT file
102 FillerTools = [
103 "pt",
104 "m",
105 ] ),
106
107
108 SelectSpec( 'highJVF',
109 '0.3<JVF[0]', # JVF is a vector<float> for each jets. Here we cut on the 0th entry of this vector
110 FillerTools = [
111 "pt",
112 ] ),
113 # Selecting jets passing the LooseBad selection from the JetCleaningTool.
114 SelectSpec( 'LooseBadJets',
115 'LooseBad', # this is not in the form 'min<x<max', so it will be assumed 'LooseBad' is an entry existing in JetStandardHistoSpecs.knownSelector
116 FillerTools = [
117 "pt",
118 ] ),
119
120
121 )
122
123
124
125 # then we turn the full specification into properly configured algorithm and tools.
126 # we use the method 'toAlg()' defined for the specialized dictionnary 'JetMonAlgSpec'
127 ak4conf.toAlg(helper)
128
129
130
136 def defineHistoForJetTrigg(conf, parentAlg, monhelper , path):
137 # create a monitoring group with the histo path starting from the parentAlg
138 group = monhelper.addGroup(parentAlg, conf.Group, 'Jets/'+parentAlg.JetContainerName)
139 # define the histogram
140 group.defineHistogram('trigPassed,jetVar',title='titletrig', type="TEfficiency", path='jetTrigg', xbins=100 , xmin=0, xmax=500000. ,)
141
142
143 from JetMonitoring.JetMonitoringConfig import retrieveVarToolConf
144 trigConf = JetMonAlgSpec( # the usual JetMonAlgSpec
145 "ak4lcTrigMon",
146 JetContainerName = "AntiKt4LCTopoJets",
147 TriggerChain = "HLT_j260",
148 )
149 trigConf.appendHistos(
150 # we pass directly the ToolSpec
151 ToolSpec('JetHistoTriggEfficiency', 'jetTrigg',
152 # below we pass the Properties of this JetHistoTriggEfficiency tool :
153 Group='jetTrigGroup',
154 Var=retrieveVarToolConf("pt"), # In this context we can not just pass a str alias to describe a histo variable
155 # so we use retrieveVarToolConf("pt") which returns a full specification for the "pt" histo variable.
156 ProbeTrigChain="HLT_j260",defineHistoFunc=defineHistoForJetTrigg),
157 )
158
159 trigConf.toAlg(helper)
160
161 return helper.result() # the AthMonitorCfgHelper returns an accumulator to be used by the general configuration system.
162

Variable Documentation

◆ cfg

JetMonitoringExample.cfg = MainServicesCfg(flags)

Definition at line 182 of file JetMonitoringExample.py.

◆ exampleMonitorAcc

JetMonitoringExample.exampleMonitorAcc = jetMonitoringExampleConfig(flags)

Definition at line 185 of file JetMonitoringExample.py.

◆ fileName

str JetMonitoringExample.fileName = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1'

Definition at line 172 of file JetMonitoringExample.py.

◆ Files

JetMonitoringExample.Files

Definition at line 174 of file JetMonitoringExample.py.

◆ flags

JetMonitoringExample.flags = initConfigFlags()

Definition at line 173 of file JetMonitoringExample.py.

◆ HISTFileName

JetMonitoringExample.HISTFileName

Definition at line 176 of file JetMonitoringExample.py.

◆ isMC

JetMonitoringExample.isMC

Definition at line 175 of file JetMonitoringExample.py.