ATLAS Offline Software
Functions
python.OverlapAnalysisSequence Namespace Reference

Functions

def makeOverlapAnalysisSequence (dataType, inputLabel='', outputLabel='passesOR', linkOverlapObjects=False, doEleEleOR=False, doElectrons=True, doMuons=True, doJets=True, doTaus=True, doTauAntiTauJetOR=False, doPhotons=True, doFatJets=False, enableUserPriority=False, bJetLabel='', antiTauIDTauLabel='', antiTauLabel='', antiTauBJetLabel='', boostedLeptons=False, postfix='', shallowViewOutput=True, enableCutflow=False)
 

Function Documentation

◆ makeOverlapAnalysisSequence()

def python.OverlapAnalysisSequence.makeOverlapAnalysisSequence (   dataType,
  inputLabel = '',
  outputLabel = 'passesOR',
  linkOverlapObjects = False,
  doEleEleOR = False,
  doElectrons = True,
  doMuons = True,
  doJets = True,
  doTaus = True,
  doTauAntiTauJetOR = False,
  doPhotons = True,
  doFatJets = False,
  enableUserPriority = False,
  bJetLabel = '',
  antiTauIDTauLabel = '',
  antiTauLabel = '',
  antiTauBJetLabel = '',
  boostedLeptons = False,
  postfix = '',
  shallowViewOutput = True,
  enableCutflow = False 
)
Function creating the overlap removal algorithm sequence

The function sets up a multi-input/multi-output analysis algorithm sequnce,
which needs to be used in a quite particular way. First off you need to set
the arguments of this function correctly.

Then, you need to call the configure(...) method on the algorithm sequence
returned by this function in the following way:

  overlapSequence.configure(
     inputName = {
        'electrons' : 'AnalysisElectrons_%SYS%',
        'photons'   : 'AnalysisPhotons_%SYS%',
        'muons'     : 'AnalysisMuons_%SYS%',
        'jets'      : 'AnalysisJets_%SYS%',
        'taus'      : 'AnalysisTauJets_%SYS%' },
     outputName = {
        'electrons' : 'AnalysisElectronsOR_%SYS%',
        'photons'   : 'AnalysisPhotonsOR_%SYS%',
        'muons'     : 'AnalysisMuonsOR_%SYS%',
        'jets'      : 'AnalysisJetsOR_%SYS%',
        'taus'      : 'AnalysisTauJetsOR_%SYS%' } )

Where:
  - You need to provide input and output names in pairs, you must not skip
    specifying an output name if you specified an input name, and vice
    versa.
  - You only define inputs/outputs that your analysis uses. The "labels" of
    the possible inputs/outputs are: "electrons", "photons", "muons",
    "jets", "taus" and "fatJets".

Function keyword arguments:
  dataType -- The data type to run on ("data", "mc" or "afii")
  inputLabel -- Any possible label to pick up the selected objects with. If
                left empty, all objects from the input containers are
                considered.
  outputLabel -- Decoration put on the output variables. Set to "true" for
                 objects passing the overlap removal.
  linkOverlapObjects -- Set up an element link between overlapping objects
  doEleEleOR -- Set up electron-electron overlap removal
  doTauAntiTauJetOR -- Set up Tau-AntiTau-Jet overlap removal
  doXXXX     -- these flags enable/disable object types to
                configure tools for: doElectrons, doMuons,
                doJets, doTaus, doPhotons, doFatJets.
  enableUserPriority -- If enabled, the Ele-, Mu-, Tau- and PhoJetOR tools
                        will respect the user priority in the inputLabel.
                        E.g. SUSYTools assigns all signal objects the
                        priority 2 and pre-selected jets the priority 1.
  bJetLabel -- Flag to select b-jets with for lepton OR.
               If left empty, no b-jets are used in the overlap removal.
  antiTauIDTauLabel -- Flag to select ID tau with for Tau-AntiTau-Jet OR.
  antiTauLabel -- Flag to select antiTau with. Required for Tau-AntiTau-Jet OR.
  antiTauBJetLabel -- Flag to select b-jets with for Tau-AntiTau-Jet OR.
  boostedLeptons -- Set to True to enable boosted lepton overlap removal
  shallowViewOutput -- Create a view container if required
  enableCutflow -- Whether or not to dump the cutflow

Definition at line 7 of file OverlapAnalysisSequence.py.

7 def makeOverlapAnalysisSequence( dataType,
8  inputLabel = '', outputLabel = 'passesOR',
9  linkOverlapObjects = False,
10  doEleEleOR = False, doElectrons = True,
11  doMuons = True, doJets = True,
12  doTaus = True, doTauAntiTauJetOR = False,
13  doPhotons = True, doFatJets = False,
14  enableUserPriority = False,
15  bJetLabel = '',
16  antiTauIDTauLabel = '', antiTauLabel = '',
17  antiTauBJetLabel = '',
18  boostedLeptons = False,
19  postfix = '',
20  shallowViewOutput = True,
21  enableCutflow = False ):
22  """Function creating the overlap removal algorithm sequence
23 
24  The function sets up a multi-input/multi-output analysis algorithm sequnce,
25  which needs to be used in a quite particular way. First off you need to set
26  the arguments of this function correctly.
27 
28  Then, you need to call the configure(...) method on the algorithm sequence
29  returned by this function in the following way:
30 
31  overlapSequence.configure(
32  inputName = {
33  'electrons' : 'AnalysisElectrons_%SYS%',
34  'photons' : 'AnalysisPhotons_%SYS%',
35  'muons' : 'AnalysisMuons_%SYS%',
36  'jets' : 'AnalysisJets_%SYS%',
37  'taus' : 'AnalysisTauJets_%SYS%' },
38  outputName = {
39  'electrons' : 'AnalysisElectronsOR_%SYS%',
40  'photons' : 'AnalysisPhotonsOR_%SYS%',
41  'muons' : 'AnalysisMuonsOR_%SYS%',
42  'jets' : 'AnalysisJetsOR_%SYS%',
43  'taus' : 'AnalysisTauJetsOR_%SYS%' } )
44 
45  Where:
46  - You need to provide input and output names in pairs, you must not skip
47  specifying an output name if you specified an input name, and vice
48  versa.
49  - You only define inputs/outputs that your analysis uses. The "labels" of
50  the possible inputs/outputs are: "electrons", "photons", "muons",
51  "jets", "taus" and "fatJets".
52 
53  Function keyword arguments:
54  dataType -- The data type to run on ("data", "mc" or "afii")
55  inputLabel -- Any possible label to pick up the selected objects with. If
56  left empty, all objects from the input containers are
57  considered.
58  outputLabel -- Decoration put on the output variables. Set to "true" for
59  objects passing the overlap removal.
60  linkOverlapObjects -- Set up an element link between overlapping objects
61  doEleEleOR -- Set up electron-electron overlap removal
62  doTauAntiTauJetOR -- Set up Tau-AntiTau-Jet overlap removal
63  doXXXX -- these flags enable/disable object types to
64  configure tools for: doElectrons, doMuons,
65  doJets, doTaus, doPhotons, doFatJets.
66  enableUserPriority -- If enabled, the Ele-, Mu-, Tau- and PhoJetOR tools
67  will respect the user priority in the inputLabel.
68  E.g. SUSYTools assigns all signal objects the
69  priority 2 and pre-selected jets the priority 1.
70  bJetLabel -- Flag to select b-jets with for lepton OR.
71  If left empty, no b-jets are used in the overlap removal.
72  antiTauIDTauLabel -- Flag to select ID tau with for Tau-AntiTau-Jet OR.
73  antiTauLabel -- Flag to select antiTau with. Required for Tau-AntiTau-Jet OR.
74  antiTauBJetLabel -- Flag to select b-jets with for Tau-AntiTau-Jet OR.
75  boostedLeptons -- Set to True to enable boosted lepton overlap removal
76  shallowViewOutput -- Create a view container if required
77  enableCutflow -- Whether or not to dump the cutflow
78  """
79 
80  if dataType not in ["data", "mc", "afii"] :
81  raise ValueError ("invalid data type: " + dataType)
82 
83  # Create the analysis algorithm sequence object:
84  seq = AnaAlgSequence( 'OverlapAnalysisSequence' + postfix )
85 
86  # Create the overlap removal algorithm:
87  alg = createAlgorithm( 'CP::OverlapRemovalAlg', 'OverlapRemovalAlg' + postfix )
88  alg.OutputLabel = outputLabel
89  if not shallowViewOutput:
90  alg.electronsDecoration = outputLabel + '_%SYS%,as_char'
91  alg.muonsDecoration = outputLabel + '_%SYS%,as_char'
92  alg.tausDecoration = outputLabel + '_%SYS%,as_char'
93  alg.jetsDecoration = outputLabel + '_%SYS%,as_char'
94  alg.photonsDecoration = outputLabel + '_%SYS%,as_char'
95  alg.fatJetsDecoration = outputLabel + '_%SYS%,as_char'
96 
97  # Create its main tool, and set its basic properties:
98  addPrivateTool( alg, 'overlapTool', 'ORUtils::OverlapRemovalTool' )
99  alg.overlapTool.InputLabel = inputLabel
100  alg.overlapTool.OutputLabel = outputLabel
101 
102  # By default the OverlapRemovalTool would flag objects that need to be
103  # suppressed, with a "true" value. But since the analysis algorithms expect
104  # the opposite behaviour from selection flags, we need to tell the tool
105  # explicitly to use the "true" flag on objects that pass the overlap
106  # removal.
107  alg.overlapTool.OutputPassValue = True
108 
109  # Set up the electron-electron overlap removal, if requested.
110  if doElectrons and doEleEleOR:
111  addPrivateTool( alg, 'overlapTool.EleEleORT',
112  'ORUtils::EleEleOverlapTool' )
113  alg.overlapTool.EleEleORT.InputLabel = inputLabel
114  alg.overlapTool.EleEleORT.OutputLabel = outputLabel
115  alg.overlapTool.EleEleORT.LinkOverlapObjects = linkOverlapObjects
116  alg.overlapTool.EleEleORT.OutputPassValue = True
117  pass
118 
119  # Set up the electron-muon overlap removal.
120  if doElectrons and doMuons:
121  addPrivateTool( alg, 'overlapTool.EleMuORT',
122  'ORUtils::EleMuSharedTrkOverlapTool' )
123  alg.overlapTool.EleMuORT.InputLabel = inputLabel
124  alg.overlapTool.EleMuORT.OutputLabel = outputLabel
125  alg.overlapTool.EleMuORT.LinkOverlapObjects = linkOverlapObjects
126  alg.overlapTool.EleMuORT.OutputPassValue = True
127  pass
128 
129  # Set up the electron-(narrow-)jet overlap removal.
130  if doElectrons and doJets:
131  addPrivateTool( alg, 'overlapTool.EleJetORT',
132  'ORUtils::EleJetOverlapTool' )
133  alg.overlapTool.EleJetORT.InputLabel = inputLabel
134  alg.overlapTool.EleJetORT.OutputLabel = outputLabel
135  alg.overlapTool.EleJetORT.LinkOverlapObjects = linkOverlapObjects
136  alg.overlapTool.EleJetORT.BJetLabel = bJetLabel
137  alg.overlapTool.EleJetORT.UseSlidingDR = boostedLeptons
138  alg.overlapTool.EleJetORT.EnableUserPriority = enableUserPriority
139  alg.overlapTool.EleJetORT.OutputPassValue = True
140  pass
141 
142  # Set up the muon-(narrow-)jet overlap removal.
143  if doMuons and doJets:
144  addPrivateTool( alg, 'overlapTool.MuJetORT',
145  'ORUtils::MuJetOverlapTool' )
146  alg.overlapTool.MuJetORT.InputLabel = inputLabel
147  alg.overlapTool.MuJetORT.OutputLabel = outputLabel
148  alg.overlapTool.MuJetORT.LinkOverlapObjects = linkOverlapObjects
149  alg.overlapTool.MuJetORT.BJetLabel = bJetLabel
150  alg.overlapTool.MuJetORT.UseSlidingDR = boostedLeptons
151  alg.overlapTool.MuJetORT.EnableUserPriority = enableUserPriority
152  alg.overlapTool.MuJetORT.OutputPassValue = True
153  pass
154 
155  # Set up the tau-electron overlap removal.
156  if doTaus and doElectrons:
157  addPrivateTool( alg, 'overlapTool.TauEleORT',
158  'ORUtils::DeltaROverlapTool' )
159  alg.overlapTool.TauEleORT.InputLabel = inputLabel
160  alg.overlapTool.TauEleORT.OutputLabel = outputLabel
161  alg.overlapTool.TauEleORT.LinkOverlapObjects = linkOverlapObjects
162  alg.overlapTool.TauEleORT.DR = 0.2
163  alg.overlapTool.TauEleORT.OutputPassValue = True
164  pass
165 
166  # Set up the tau-muon overlap removal.
167  if doTaus and doMuons:
168  addPrivateTool( alg, 'overlapTool.TauMuORT',
169  'ORUtils::DeltaROverlapTool' )
170  alg.overlapTool.TauMuORT.InputLabel = inputLabel
171  alg.overlapTool.TauMuORT.OutputLabel = outputLabel
172  alg.overlapTool.TauMuORT.LinkOverlapObjects = linkOverlapObjects
173  alg.overlapTool.TauMuORT.DR = 0.2
174  alg.overlapTool.TauMuORT.OutputPassValue = True
175  pass
176 
177  # Set up the tau-(narrow-)jet overlap removal.
178  if doTaus and doJets:
179  if doTauAntiTauJetOR:
180  addPrivateTool( alg, 'overlapTool.TauJetORT',
181  'ORUtils::TauAntiTauJetOverlapTool' )
182  alg.overlapTool.TauJetORT.TauLabel = antiTauIDTauLabel
183  alg.overlapTool.TauJetORT.AntiTauLabel = antiTauLabel
184  alg.overlapTool.TauJetORT.BJetLabel = antiTauBJetLabel
185  else:
186  addPrivateTool( alg, 'overlapTool.TauJetORT',
187  'ORUtils::DeltaROverlapTool' )
188 
189  alg.overlapTool.TauJetORT.InputLabel = inputLabel
190  alg.overlapTool.TauJetORT.OutputLabel = outputLabel
191  alg.overlapTool.TauJetORT.LinkOverlapObjects = linkOverlapObjects
192  alg.overlapTool.TauJetORT.DR = 0.2
193  alg.overlapTool.TauJetORT.EnableUserPriority = enableUserPriority
194  alg.overlapTool.TauJetORT.OutputPassValue = True
195  pass
196 
197  # Set up the photon-electron overlap removal.
198  if doPhotons and doElectrons:
199  addPrivateTool( alg, 'overlapTool.PhoEleORT',
200  'ORUtils::DeltaROverlapTool' )
201  alg.overlapTool.PhoEleORT.InputLabel = inputLabel
202  alg.overlapTool.PhoEleORT.OutputLabel = outputLabel
203  alg.overlapTool.PhoEleORT.LinkOverlapObjects = linkOverlapObjects
204  alg.overlapTool.PhoEleORT.OutputPassValue = True
205  pass
206 
207  # Set up the photon-muon overlap removal.
208  if doPhotons and doMuons:
209  addPrivateTool( alg, 'overlapTool.PhoMuORT',
210  'ORUtils::DeltaROverlapTool' )
211  alg.overlapTool.PhoMuORT.InputLabel = inputLabel
212  alg.overlapTool.PhoMuORT.OutputLabel = outputLabel
213  alg.overlapTool.PhoMuORT.LinkOverlapObjects = linkOverlapObjects
214  alg.overlapTool.PhoMuORT.OutputPassValue = True
215  pass
216 
217  # Set up the photon-(narrow-)jet overlap removal.
218  if doPhotons and doJets:
219  addPrivateTool( alg, 'overlapTool.PhoJetORT',
220  'ORUtils::DeltaROverlapTool' )
221  alg.overlapTool.PhoJetORT.InputLabel = inputLabel
222  alg.overlapTool.PhoJetORT.OutputLabel = outputLabel
223  alg.overlapTool.PhoJetORT.LinkOverlapObjects = linkOverlapObjects
224  alg.overlapTool.PhoJetORT.EnableUserPriority = enableUserPriority
225  alg.overlapTool.PhoJetORT.OutputPassValue = True
226  pass
227 
228  # Set up the electron-fat-jet overlap removal.
229  if doElectrons and doFatJets:
230  addPrivateTool( alg, 'overlapTool.EleFatJetORT',
231  'ORUtils::DeltaROverlapTool' )
232  alg.overlapTool.EleFatJetORT.InputLabel = inputLabel
233  alg.overlapTool.EleFatJetORT.OutputLabel = outputLabel
234  alg.overlapTool.EleFatJetORT.LinkOverlapObjects = linkOverlapObjects
235  alg.overlapTool.EleFatJetORT.DR = 1.0
236  alg.overlapTool.EleFatJetORT.OutputPassValue = True
237  pass
238 
239  # Set up the (narrow-)jet-fat-jet overlap removal.
240  if doJets and doFatJets:
241  addPrivateTool( alg, 'overlapTool.JetFatJetORT',
242  'ORUtils::DeltaROverlapTool' )
243  alg.overlapTool.JetFatJetORT.InputLabel = inputLabel
244  alg.overlapTool.JetFatJetORT.OutputLabel = outputLabel
245  alg.overlapTool.JetFatJetORT.LinkOverlapObjects = linkOverlapObjects
246  alg.overlapTool.JetFatJetORT.DR = 1.0
247  alg.overlapTool.JetFatJetORT.OutputPassValue = True
248  pass
249 
250  # Add the algorithm to the analysis sequence.
251  if shallowViewOutput:
252  seq.append( alg,
253  inputPropName = { 'electrons' : 'electrons',
254  'muons' : 'muons',
255  'jets' : 'jets',
256  'taus' : 'taus',
257  'photons' : 'photons',
258  'fatJets' : 'fatJets' },
259  outputPropName = { 'electrons' : 'electronsOut',
260  'muons' : 'muonsOut',
261  'jets' : 'jetsOut',
262  'taus' : 'tausOut',
263  'photons' : 'photonsOut',
264  'fatJets' : 'fatJetsOut' } )
265  pass
266  else:
267  seq.append( alg,
268  inputPropName = { 'electrons' : 'electrons',
269  'muons' : 'muons',
270  'jets' : 'jets',
271  'taus' : 'taus',
272  'photons' : 'photons',
273  'fatJets' : 'fatJets' } )
274  pass
275 
276  # Add view container creation algorithms for all types.
277  if shallowViewOutput:
278  for container in [ ( 'electrons', doElectrons ),
279  ( 'muons', doMuons ),
280  ( 'jets', doJets ),
281  ( 'taus', doTaus ),
282  ( 'photons', doPhotons ),
283  ( 'fatJets', doFatJets ) ]:
284 
285  # Skip setting up a view container if the type is not being processed.
286  if not container[ 1 ]:
287  continue
288 
289  # Set up a cutflow alg.
290  if enableCutflow:
291  alg = createAlgorithm( 'CP::ObjectCutFlowHistAlg',
292  'OverlapRemovalCutFlowDumperAlg_%s' % container[ 0 ] + postfix )
293  alg.histPattern = container[ 0 ] + postfix + '_OR_cflow_%SYS%'
294  if inputLabel:
295  alg.selections = [ '%s,as_char' % inputLabel,
296  '%s,as_char' % outputLabel ]
297  else:
298  alg.selections = [ '%s,as_char' % outputLabel ]
299  seq.append( alg, inputPropName = { container[ 0 ] : 'input' } )
300 
301  # Set up a view container for the type.
302  alg = createAlgorithm( 'CP::AsgViewFromSelectionAlg',
303  'OverlapRemovalViewMaker_%s' % container[ 0 ] + postfix )
304  alg.selection = [ '%s,as_char' % outputLabel ]
305  seq.append( alg, inputPropName = { container[ 0 ] : 'input' },
306  outputPropName = { container[ 0 ] : 'output' } )
307  pass
308 
309  # Return the sequence:
310  return seq
python.DualUseConfig.addPrivateTool
def addPrivateTool(alg, toolName, typeName)
Definition: DualUseConfig.py:180
python.DualUseConfig.createAlgorithm
def createAlgorithm(typeName, instanceName)
Definition: DualUseConfig.py:56
python.OverlapAnalysisSequence.makeOverlapAnalysisSequence
def makeOverlapAnalysisSequence(dataType, inputLabel='', outputLabel='passesOR', linkOverlapObjects=False, doEleEleOR=False, doElectrons=True, doMuons=True, doJets=True, doTaus=True, doTauAntiTauJetOR=False, doPhotons=True, doFatJets=False, enableUserPriority=False, bJetLabel='', antiTauIDTauLabel='', antiTauLabel='', antiTauBJetLabel='', boostedLeptons=False, postfix='', shallowViewOutput=True, enableCutflow=False)
Definition: OverlapAnalysisSequence.py:7