ATLAS Offline Software
Functions
python.TauAnalysisSequence Namespace Reference

Functions

def makeTauAnalysisSequence (dataType, workingPoint, postfix='', deepCopyOutput=False, shallowViewOutput=True, rerunTruthMatching=True, enableCutflow=False, enableKinematicHistograms=False, defineSystObjectLinks=False)
 
def makeTauCalibrationSequence (seq, dataType, postfix='', rerunTruthMatching=True)
 
def makeTauWorkingPointSequence (seq, dataType, workingPoint, postfix='')
 

Function Documentation

◆ makeTauAnalysisSequence()

def python.TauAnalysisSequence.makeTauAnalysisSequence (   dataType,
  workingPoint,
  postfix = '',
  deepCopyOutput = False,
  shallowViewOutput = True,
  rerunTruthMatching = True,
  enableCutflow = False,
  enableKinematicHistograms = False,
  defineSystObjectLinks = False 
)
Create a tau analysis algorithm sequence

Keyword arguments:
  dataType -- The data type to run on ("data", "mc" or "afii")
  deepCopyOutput -- If set to 'True', the output containers will be
                    standalone, deep copies (slower, but needed for xAOD
                    output writing)
  shallowViewOutput -- Create a view container if required
  postfix -- a postfix to apply to decorations and algorithm
             names.  this is mostly used/needed when using this
             sequence with multiple working points to ensure all
             names are unique.
  rerunTruthMatching -- Whether or not to rerun truth matching
  enableCutflow -- Whether or not to dump the cutflow
  enableKinematicHistograms -- Whether or not to dump the kinematic histograms

Definition at line 9 of file TauAnalysisSequence.py.

9 def makeTauAnalysisSequence( dataType, workingPoint, postfix = '',
10  deepCopyOutput = False,
11  shallowViewOutput = True,
12  rerunTruthMatching = True,
13  enableCutflow = False,
14  enableKinematicHistograms = False,
15  defineSystObjectLinks = False ):
16  """Create a tau analysis algorithm sequence
17 
18  Keyword arguments:
19  dataType -- The data type to run on ("data", "mc" or "afii")
20  deepCopyOutput -- If set to 'True', the output containers will be
21  standalone, deep copies (slower, but needed for xAOD
22  output writing)
23  shallowViewOutput -- Create a view container if required
24  postfix -- a postfix to apply to decorations and algorithm
25  names. this is mostly used/needed when using this
26  sequence with multiple working points to ensure all
27  names are unique.
28  rerunTruthMatching -- Whether or not to rerun truth matching
29  enableCutflow -- Whether or not to dump the cutflow
30  enableKinematicHistograms -- Whether or not to dump the kinematic histograms
31  """
32 
33  if dataType not in ["data", "mc", "afii"] :
34  raise ValueError ("invalid data type: " + dataType)
35 
36  if postfix != '' :
37  postfix = '_' + postfix
38  pass
39 
40  # Make sure selection options make sense
41  if deepCopyOutput and shallowViewOutput:
42  raise ValueError ("deepCopyOutput and shallowViewOutput can't both be true!")
43 
44  # Create the analysis algorithm sequence object:
45  seq = AnaAlgSequence( "TauAnalysisSequence" + postfix )
46 
47  seq.addMetaConfigDefault ("selectionDecorNames", [])
48  seq.addMetaConfigDefault ("selectionDecorNamesOutput", [])
49  seq.addMetaConfigDefault ("selectionDecorCount", [])
50 
51  makeTauCalibrationSequence (seq, dataType, postfix=postfix,
52  rerunTruthMatching = rerunTruthMatching)
53  makeTauWorkingPointSequence (seq, dataType, workingPoint, postfix=postfix)
54  makeSharedObjectSequence (seq, deepCopyOutput = deepCopyOutput,
55  shallowViewOutput = shallowViewOutput,
56  postfix = '_Tau' + postfix,
57  enableCutflow = enableCutflow,
58  enableKinematicHistograms = enableKinematicHistograms,
59  defineSystObjectLinks = defineSystObjectLinks )
60 
61  # Return the sequence:
62  return seq
63 
64 
65 
66 

◆ makeTauCalibrationSequence()

def python.TauAnalysisSequence.makeTauCalibrationSequence (   seq,
  dataType,
  postfix = '',
  rerunTruthMatching = True 
)
Create tau calibration analysis algorithms

This makes all the algorithms that need to be run first befor
all working point specific algorithms and that can be shared
between the working points.

Keyword arguments:
  dataType -- The data type to run on ("data", "mc" or "afii")
  postfix -- a postfix to apply to decorations and algorithm
             names.  this is mostly used/needed when using this
             sequence with multiple working points to ensure all
             names are unique.
  rerunTruthMatching -- Whether or not to rerun truth matching

Definition at line 67 of file TauAnalysisSequence.py.

67 def makeTauCalibrationSequence( seq, dataType,
68  postfix = '',
69  rerunTruthMatching = True):
70  """Create tau calibration analysis algorithms
71 
72  This makes all the algorithms that need to be run first befor
73  all working point specific algorithms and that can be shared
74  between the working points.
75 
76  Keyword arguments:
77  dataType -- The data type to run on ("data", "mc" or "afii")
78  postfix -- a postfix to apply to decorations and algorithm
79  names. this is mostly used/needed when using this
80  sequence with multiple working points to ensure all
81  names are unique.
82  rerunTruthMatching -- Whether or not to rerun truth matching
83  """
84 
85  if dataType not in ["data", "mc", "afii"] :
86  raise ValueError ("invalid data type: " + dataType)
87 
88  # Set up the tau truth matching algorithm:
89  if rerunTruthMatching and dataType != 'data':
90  alg = createAlgorithm( 'CP::TauTruthMatchingAlg',
91  'TauTruthMatchingAlg' + postfix )
92  addPrivateTool( alg, 'matchingTool',
93  'TauAnalysisTools::TauTruthMatchingTool' )
94  seq.append( alg, inputPropName = 'taus',
95  stageName = 'selection',
96  dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])} )
97  pass
98 
99  # Set up the tau 4-momentum smearing algorithm:
100  alg = createAlgorithm( 'CP::TauSmearingAlg', 'TauSmearingAlg' + postfix )
101  addPrivateTool( alg, 'smearingTool', 'TauAnalysisTools::TauSmearingTool' )
102  seq.append( alg, inputPropName = 'taus', outputPropName = 'tausOut',
103  stageName = 'calibration',
104  dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])} )
105 
106  pass
107 
108 
109 
110 
111 

◆ makeTauWorkingPointSequence()

def python.TauAnalysisSequence.makeTauWorkingPointSequence (   seq,
  dataType,
  workingPoint,
  postfix = '' 
)
Create tau analysis algorithms for a single working point

Keyword arguments:
  dataType -- The data type to run on ("data", "mc" or "afii")
  postfix -- a postfix to apply to decorations and algorithm
             names.  this is mostly used/needed when using this
             sequence with multiple working points to ensure all
             names are unique.

Definition at line 112 of file TauAnalysisSequence.py.

112 def makeTauWorkingPointSequence( seq, dataType, workingPoint, postfix = ''):
113  """Create tau analysis algorithms for a single working point
114 
115  Keyword arguments:
116  dataType -- The data type to run on ("data", "mc" or "afii")
117  postfix -- a postfix to apply to decorations and algorithm
118  names. this is mostly used/needed when using this
119  sequence with multiple working points to ensure all
120  names are unique.
121  """
122 
123  if dataType not in ["data", "mc", "afii"] :
124  raise ValueError ("invalid data type: " + dataType)
125 
126  splitWP = workingPoint.split ('.')
127  if len (splitWP) != 1 :
128  raise ValueError ('working point should be of format "quality", not ' + workingPoint)
129 
130  nameFormat = 'TauAnalysisAlgorithms/tau_selection_{}.conf'
131 
132  if splitWP[0] not in ['Tight', 'Medium', 'Loose', 'VeryLoose', 'NoID', 'Baseline'] :
133  raise ValueError ("invalid tau quality: \"" + splitWP[0] +
134  "\", allowed values are Tight, Medium, Loose, " +
135  "VeryLoose, NoID, Baseline")
136  inputfile = nameFormat.format(splitWP[0].lower())
137 
138  # Setup the tau selection tool
139  selectionTool = createPublicTool( 'TauAnalysisTools::TauSelectionTool',
140  'TauSelectionTool' + postfix)
141  selectionTool.ConfigPath = inputfile
142  seq.addPublicTool( selectionTool, stageName = 'selection' )
143 
144  # Set up the algorithm selecting taus:
145  alg = createAlgorithm( 'CP::AsgSelectionAlg', 'TauSelectionAlg' + postfix )
146  addPrivateTool( alg, 'selectionTool', 'TauAnalysisTools::TauSelectionTool' )
147  alg.selectionTool.ConfigPath = inputfile
148  alg.selectionDecoration = 'selected_tau' + postfix + ',as_bits'
149  seq.append( alg, inputPropName = 'particles',
150  stageName = 'selection',
151  metaConfig = {'selectionDecorNames' : [alg.selectionDecoration],
152  'selectionDecorNamesOutput' : [alg.selectionDecoration],
153  'selectionDecorCount' : [6]},
154  dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])} )
155 
156  # Set up the algorithm calculating the efficiency scale factors for the
157  # taus:
158  if dataType != 'data':
159  alg = createAlgorithm( 'CP::TauEfficiencyCorrectionsAlg',
160  'TauEfficiencyCorrectionsAlg' + postfix )
161  addPrivateTool( alg, 'efficiencyCorrectionsTool',
162  'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
163  alg.efficiencyCorrectionsTool.TauSelectionTool = '%s/%s' % \
164  ( selectionTool.getType(), selectionTool.getName() )
165  alg.scaleFactorDecoration = 'tau_effSF' + postfix + '_%SYS%'
166  alg.outOfValidity = 2 #silent
167  alg.outOfValidityDeco = 'bad_eff' + postfix
168  seq.append( alg, inputPropName = 'taus',
169  stageName = 'efficiency',
170  dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])} )
171 
172  # Set up an algorithm used for decorating baseline tau selection:
173  alg = createAlgorithm( 'CP::AsgSelectionAlg',
174  'TauSelectionSummary' + postfix )
175  alg.selectionDecoration = 'baselineSelection' + postfix + ',as_char'
176  seq.append( alg, inputPropName = 'particles',
177  stageName = 'selection',
178  dynConfig = {'preselection' : lambda meta : "&&".join (meta["selectionDecorNames"])} )
179 
180  pass
python.TauAnalysisSequence.makeTauWorkingPointSequence
def makeTauWorkingPointSequence(seq, dataType, workingPoint, postfix='')
Definition: TauAnalysisSequence.py:112
python.DualUseConfig.createPublicTool
def createPublicTool(typeName, toolName)
Definition: DualUseConfig.py:84
python.DualUseConfig.addPrivateTool
def addPrivateTool(alg, toolName, typeName)
Definition: DualUseConfig.py:180
python.TauAnalysisSequence.makeTauCalibrationSequence
def makeTauCalibrationSequence(seq, dataType, postfix='', rerunTruthMatching=True)
Definition: TauAnalysisSequence.py:67
python.DualUseConfig.createAlgorithm
def createAlgorithm(typeName, instanceName)
Definition: DualUseConfig.py:56
python.TauAnalysisSequence.makeTauAnalysisSequence
def makeTauAnalysisSequence(dataType, workingPoint, postfix='', deepCopyOutput=False, shallowViewOutput=True, rerunTruthMatching=True, enableCutflow=False, enableKinematicHistograms=False, defineSystObjectLinks=False)
Definition: TauAnalysisSequence.py:9