Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Kazuya Mochizuki
athena
Commits
6d81b516
Commit
6d81b516
authored
Oct 21, 2021
by
Vakhtang Tsulaia
Browse files
Merge branch 'cherry_19Oct21' into 'master'
sweep missing infrastructure changes from 21.2 to master See merge request
!47393
parents
442207ae
450ddb46
Changes
11
Hide whitespace changes
Inline
Side-by-side
PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisSequence.py
View file @
6d81b516
...
...
@@ -66,12 +66,12 @@ def makeElectronAnalysisSequence( dataType, workingPoint,
seq
=
AnaAlgSequence
(
"ElectronAnalysisSequence"
+
postfix
)
# Variables keeping track of the selections being applied.
selectionDecorNames
=
[]
selectionDecorCount
=
[]
seq
.
addMetaConfigDefault
(
"selectionDecorNames"
,
[])
seq
.
addMetaConfigDefault
(
"selectionDecorNamesOutput"
,
[])
seq
.
addMetaConfigDefault
(
"selectionDecorCount"
,
[])
# Set up the eta-cut on all electrons prior to everything else
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'ElectronEtaCutAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
selectionDecoration
=
'selectEta'
+
postfix
+
',as_bits'
addPrivateTool
(
alg
,
'selectionTool'
,
'CP::AsgPtEtaSelectionTool'
)
alg
.
selectionTool
.
maxEta
=
2.47
...
...
@@ -81,76 +81,76 @@ def makeElectronAnalysisSequence( dataType, workingPoint,
alg
.
selectionTool
.
useClusterEta
=
True
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
outputPropName
=
'particlesOut'
,
stageName
=
'calibration'
)
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
if
crackVeto
:
selectionDecorCount
.
append
(
5
)
else
:
selectionDecorCount
.
append
(
4
)
stageName
=
'calibration'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorNamesOutput'
:
[
alg
.
selectionDecoration
],
'selectionDecorCount'
:
[
5
if
crackVeto
else
4
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Set up the track selection algorithm:
alg
=
createAlgorithm
(
'CP::AsgLeptonTrackSelectionAlg'
,
'ElectronTrackSelectionAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
selectionDecoration
=
'trackSelection'
+
postfix
+
',as_bits'
alg
.
maxD0Significance
=
5
alg
.
maxDeltaZ0SinTheta
=
0.5
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
stageName
=
'selection'
)
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
selectionDecorCount
.
append
(
3
)
stageName
=
'selection'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorNamesOutput'
:
[
alg
.
selectionDecoration
],
'selectionDecorCount'
:
[
3
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
if
'LH'
in
likelihoodWP
:
# Set up the likelihood ID selection algorithm
# It is safe to do this before calibration, as the cluster E is used
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'ElectronLikelihoodAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
selectionDecoration
=
'selectLikelihood'
+
postfix
+
',as_bits'
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
if
recomputeLikelihood
:
# Rerun the likelihood ID
addPrivateTool
(
alg
,
'selectionTool'
,
'AsgElectronLikelihoodTool'
)
alg
.
selectionTool
.
primaryVertexContainer
=
'PrimaryVertices'
alg
.
selectionTool
.
WorkingPoint
=
likelihoodWP
selection
DecorCount
.
append
(
7
)
alg
DecorCount
=
7
else
:
# Select from Derivation Framework flags
addPrivateTool
(
alg
,
'selectionTool'
,
'CP::AsgFlagSelectionTool'
)
dfFlag
=
"DFCommonElectronsLH"
+
likelihoodWP
.
split
(
'LH'
)[
0
]
alg
.
selectionTool
.
selectionFlags
=
[
dfFlag
]
selection
DecorCount
.
append
(
1
)
alg
DecorCount
=
1
else
:
# Set up the DNN ID selection algorithm
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'ElectronDNNAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
selectionDecoration
=
'selectDNN'
+
postfix
+
',as_bits'
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
if
recomputeLikelihood
:
# Rerun the DNN ID
addPrivateTool
(
alg
,
'selectionTool'
,
'AsgElectronSelectorTool'
)
alg
.
selectionTool
.
WorkingPoint
=
likelihoodWP
selection
DecorCount
.
append
(
6
)
alg
DecorCount
=
6
else
:
# Select from Derivation Framework flags
raise
ValueError
(
"DNN working points are not available in derivations yet."
)
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
stageName
=
'selection'
)
stageName
=
'selection'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorNamesOutput'
:
[
alg
.
selectionDecoration
],
'selectionDecorCount'
:
[
algDecorCount
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Select electrons only with good object quality.
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'ElectronObjectQualityAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
selectionDecoration
=
'goodOQ'
+
postfix
+
',as_bits'
addPrivateTool
(
alg
,
'selectionTool'
,
'CP::EgammaIsGoodOQSelectionTool'
)
alg
.
selectionTool
.
Mask
=
xAOD
.
EgammaParameters
.
BADCLUSELECTRON
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
stageName
=
'calibration'
)
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
selectionDecorCount
.
append
(
1
)
stageName
=
'calibration'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorNamesOutput'
:
[
alg
.
selectionDecoration
],
'selectionDecorCount'
:
[
1
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Set up the calibration and smearing algorithm:
alg
=
createAlgorithm
(
'CP::EgammaCalibrationAndSmearingAlg'
,
'ElectronCalibrationAndSmearingAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
addPrivateTool
(
alg
,
'calibrationAndSmearingTool'
,
'CP::EgammaCalibrationAndSmearingTool'
)
alg
.
calibrationAndSmearingTool
.
ESModel
=
'es2018_R21_v0'
...
...
@@ -161,25 +161,25 @@ def makeElectronAnalysisSequence( dataType, workingPoint,
alg
.
calibrationAndSmearingTool
.
useAFII
=
0
pass
seq
.
append
(
alg
,
inputPropName
=
'egammas'
,
outputPropName
=
'egammasOut'
,
stageName
=
'calibration'
)
stageName
=
'calibration'
,
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Set up the the pt selection
ptSelectionDecoration
=
'selectPt'
+
postfix
+
',as_bits'
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'ElectronPtCutAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
selectionDecoration
=
ptSelectionDecoration
alg
.
selectionDecoration
=
'selectPt'
+
postfix
+
',as_bits'
addPrivateTool
(
alg
,
'selectionTool'
,
'CP::AsgPtEtaSelectionTool'
)
alg
.
selectionTool
.
minPt
=
4.5e3
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
stageName
=
'selection'
)
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
selectionDecorCount
.
append
(
2
)
stageName
=
'selection'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorNamesOutput'
:
[
alg
.
selectionDecoration
]
if
ptSelectionOutput
else
[],
'selectionDecorCount'
:
[
2
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Set up the isolation correction algorithm:
if
isolationCorrection
:
alg
=
createAlgorithm
(
'CP::EgammaIsolationCorrectionAlg'
,
'ElectronIsolationCorrectionAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
addPrivateTool
(
alg
,
'isolationCorrectionTool'
,
'CP::IsolationCorrectionTool'
)
if
dataType
==
'data'
:
...
...
@@ -188,26 +188,27 @@ def makeElectronAnalysisSequence( dataType, workingPoint,
alg
.
isolationCorrectionTool
.
IsMC
=
1
pass
seq
.
append
(
alg
,
inputPropName
=
'egammas'
,
outputPropName
=
'egammasOut'
,
stageName
=
'calibration'
)
stageName
=
'calibration'
,
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Set up the isolation selection algorithm:
if
isolationWP
!=
'NonIso'
:
alg
=
createAlgorithm
(
'CP::EgammaIsolationSelectionAlg'
,
'ElectronIsolationSelectionAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
selectionDecoration
=
'isolated'
+
postfix
+
',as_bits'
addPrivateTool
(
alg
,
'selectionTool'
,
'CP::IsolationSelectionTool'
)
alg
.
selectionTool
.
ElectronWP
=
isolationWP
seq
.
append
(
alg
,
inputPropName
=
'egammas'
,
stageName
=
'selection'
)
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
selectionDecorCount
.
append
(
1
)
stageName
=
'selection'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorNamesOutput'
:
[
alg
.
selectionDecoration
],
'selectionDecorCount'
:
[
1
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Select electrons only if they don't appear to have flipped their charge.
if
chargeIDSelection
:
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'ElectronChargeIDSelectionAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
selectionDecoration
=
'chargeID'
+
postfix
+
',as_bits'
addPrivateTool
(
alg
,
'selectionTool'
,
'AsgElectronChargeIDSelectorTool'
)
...
...
@@ -216,55 +217,50 @@ def makeElectronAnalysisSequence( dataType, workingPoint,
alg
.
selectionTool
.
WorkingPoint
=
'Loose'
alg
.
selectionTool
.
CutOnBDT
=
-
0.337671
# Loose 97%
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
stageName
=
'selection'
)
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
selectionDecorCount
.
append
(
1
)
stageName
=
'selection'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorNamesOutput'
:
[
alg
.
selectionDecoration
],
'selectionDecorCount'
:
[
1
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
pass
# Set up an algorithm used for decorating baseline electron selection:
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'ElectronSelectionSummary'
+
postfix
)
addPrivateTool
(
alg
,
'selectionTool'
,
'CP::AsgFlagSelectionTool'
)
alg
.
selectionTool
.
selectionFlags
=
selectionDecorNames
[
:
]
alg
.
selectionDecoration
=
'baselineSelection'
+
postfix
+
',as_char'
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
stageName
=
'selection'
)
stageName
=
'selection'
,
dynConfig
=
{
'selectionTool.selectionFlags'
:
lambda
meta
:
meta
[
"selectionDecorNames"
]
[
:
]}
)
# Set up an algorithm used to create electron selection cutflow:
if
enableCutflow
:
alg
=
createAlgorithm
(
'CP::ObjectCutFlowHistAlg'
,
'ElectronCutFlowDumperAlg'
+
postfix
)
alg
.
histPattern
=
'electron_cflow_%SYS%'
+
postfix
alg
.
selection
=
selection
DecorNames
[
:
]
alg
.
selectionNCuts
=
selectionDecor
Count
[
:
]
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
)
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'
selection
'
,
dynConfig
=
{
'selection'
:
lambda
meta
:
meta
[
"
selectionDecor
Names"
][:],
'selectionNCuts'
:
lambda
meta
:
meta
[
"selectionDecorCount"
][:]}
)
# Set up an algorithm dumping the kinematic properties of the electrons:
if
enableKinematicHistograms
:
alg
=
createAlgorithm
(
'CP::KinematicHistAlg'
,
'ElectronKinematicDumperAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
histPattern
=
'electron_%VAR%_%SYS%'
+
postfix
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
)
# Set up the output selection
if
shallowViewOutput
or
deepCopyOutput
:
selectionDecorNamesOutput
=
selectionDecorNames
[
:
]
if
not
ptSelectionOutput
:
selectionDecorNamesOutput
.
remove
(
ptSelectionDecoration
)
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
,
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Set up an algorithm that makes a view container using the selections
# performed previously:
if
shallowViewOutput
:
alg
=
createAlgorithm
(
'CP::AsgViewFromSelectionAlg'
,
'ElectronViewFromSelectionAlg'
+
postfix
)
alg
.
selection
=
selectionDecorNamesOutput
[
:
]
seq
.
append
(
alg
,
inputPropName
=
'input'
,
outputPropName
=
'output'
,
stageName
=
'selection'
)
stageName
=
'selection'
,
dynConfig
=
{
'selection'
:
lambda
meta
:
meta
[
"selectionDecorNamesOutput"
][:]}
)
pass
# Set up the electron efficiency correction algorithm:
alg
=
createAlgorithm
(
'CP::ElectronEfficiencyCorrectionAlg'
,
'ElectronEfficiencyCorrectionAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
addPrivateTool
(
alg
,
'efficiencyCorrectionTool'
,
'AsgElectronEfficiencyCorrectionTool'
)
alg
.
scaleFactorDecoration
=
'effSF'
+
postfix
+
'_%SYS%'
...
...
@@ -281,17 +277,18 @@ def makeElectronAnalysisSequence( dataType, workingPoint,
alg
.
outOfValidityDeco
=
'bad_eff'
+
postfix
if
dataType
!=
'data'
:
seq
.
append
(
alg
,
inputPropName
=
'electrons'
,
stageName
=
'efficiency'
)
stageName
=
'efficiency'
,
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
pass
# Set up a final deep copy making algorithm if requested:
if
deepCopyOutput
:
alg
=
createAlgorithm
(
'CP::AsgViewFromSelectionAlg'
,
'ElectronDeepCopyMaker'
+
postfix
)
alg
.
selection
=
selectionDecorNamesOutput
[:]
alg
.
deepCopy
=
True
seq
.
append
(
alg
,
inputPropName
=
'input'
,
outputPropName
=
'output'
,
stageName
=
'selection'
)
stageName
=
'selection'
,
dynConfig
=
{
'selection'
:
lambda
meta
:
meta
[
"selectionDecorNamesOutput"
][:]}
)
pass
# Return the sequence:
...
...
PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/PhotonAnalysisSequence.py
View file @
6d81b516
...
...
@@ -63,30 +63,30 @@ def makePhotonAnalysisSequence( dataType, workingPoint,
seq
=
AnaAlgSequence
(
"PhotonAnalysisSequence"
+
postfix
)
# Variables keeping track of the selections being applied.
selectionDecorNames
=
[]
selectionDecorCount
=
[]
seq
.
addMetaConfigDefault
(
"
selectionDecorNames
"
,
[]
)
seq
.
addMetaConfigDefault
(
"
selectionDecorCount
"
,
[]
)
# Set up the photon selection algorithm:
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'PhotonIsEMSelectorAlg'
+
postfix
)
alg
.
selectionDecoration
=
'selectEM'
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
if
recomputeIsEM
:
# Rerun the cut-based ID
addPrivateTool
(
alg
,
'selectionTool'
,
'AsgPhotonIsEMSelector'
)
alg
.
selectionTool
.
isEMMask
=
quality
alg
.
selectionTool
.
ConfigFile
=
\
'ElectronPhotonSelectorTools/offline/20180116/PhotonIsEMTightSelectorCutDefs.conf'
selectionDecorCount
.
append
(
32
)
else
:
# Select from Derivation Framework flags
addPrivateTool
(
alg
,
'selectionTool'
,
'CP::AsgFlagSelectionTool'
)
dfFlag
=
'DFCommonPhotonsIsEM'
+
qualityWP
alg
.
selectionTool
.
selectionFlags
=
[
dfFlag
]
selectionDecorCount
.
append
(
1
)
pass
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
outputPropName
=
'particlesOut'
,
stageName
=
'calibration'
)
stageName
=
'calibration'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorCount'
:
[
32
if
recomputeIsEM
else
1
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Select electrons only with good object quality.
alg
=
createAlgorithm
(
'CP::AsgSelectionAlg'
,
'PhotonObjectQualityAlg'
+
postfix
)
...
...
@@ -95,18 +95,19 @@ def makePhotonAnalysisSequence( dataType, workingPoint,
alg
.
selectionTool
.
Mask
=
xAOD
.
EgammaParameters
.
BADCLUSPHOTON
seq
.
append
(
alg
,
inputPropName
=
'particles'
,
outputPropName
=
'particlesOut'
,
stageName
=
'calibration'
)
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
selectionDecorCount
.
append
(
1
)
stageName
=
'calibration'
,
metaConfig
=
{
'selectionDecorNames'
:
[
alg
.
selectionDecoration
],
'selectionDecorCount'
:
[
1
]},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Only run subsequent processing on the objects passing all of these cuts.
# Since these are independent of the photon calibration, and this speeds
# up the job.
alg
=
createAlgorithm
(
'CP::AsgViewFromSelectionAlg'
,
'PhotonPreSelViewFromSelectionAlg'
+
postfix
)
alg
.
selection
=
selectionDecorNames
[
:
]
seq
.
append
(
alg
,
inputPropName
=
'input'
,
outputPropName
=
'output'
,
stageName
=
'calibration'
)
stageName
=
'calibration'
,
dynConfig
=
{
'selection'
:
lambda
meta
:
meta
[
"selectionDecorNames"
]
[:]}
)
# Set up the calibration ans smearing algorithm.
alg
=
createAlgorithm
(
'CP::EgammaCalibrationAndSmearingAlg'
,
...
...
@@ -154,9 +155,9 @@ def makePhotonAnalysisSequence( dataType, workingPoint,
addPrivateTool
(
alg
,
'selectionTool'
,
'CP::IsolationSelectionTool'
)
alg
.
selectionTool
.
PhotonWP
=
isolationWP
seq
.
append
(
alg
,
inputPropName
=
'egammas'
,
outputPropName
=
'egammasOut'
,
stageName
=
'selection'
)
selectionDecorNames
.
append
(
alg
.
selectionDecoration
)
selectionDecorCount
.
append
(
1
)
stageName
=
'selection'
,
metaConfig
=
{
'
selectionDecorNames
'
:
[
alg
.
selectionDecoration
],
'
selectionDecorCount
'
:
[
1
]}
)
# Set up the photon efficiency correction algorithm.
alg
=
createAlgorithm
(
'CP::PhotonEfficiencyCorrectionAlg'
,
...
...
@@ -176,9 +177,9 @@ def makePhotonAnalysisSequence( dataType, workingPoint,
if
dataType
!=
'data'
:
seq
.
append
(
alg
,
inputPropName
=
'photons'
,
outputPropName
=
'photonsOut'
,
stageName
=
'efficiency'
)
selectionDecorNames
.
append
(
alg
.
outOfValidityDeco
)
selectionDecorCount
.
append
(
1
)
stageName
=
'efficiency'
,
metaConfig
=
{
'
selectionDecorNames
'
:
[
alg
.
outOfValidityDeco
],
'
selectionDecorCount
'
:
[
1
]}
)
pass
# Set up an algorithm used to create photon selection cutflow:
...
...
@@ -186,26 +187,26 @@ def makePhotonAnalysisSequence( dataType, workingPoint,
alg
=
createAlgorithm
(
'CP::ObjectCutFlowHistAlg'
,
'PhotonCutFlowDumperAlg'
+
postfix
)
alg
.
histPattern
=
'photon_cflow_%SYS%'
+
postfix
alg
.
selection
=
selectionDecorNames
[
:
]
alg
.
selectionNCuts
=
selectionDecorCount
[
:
]
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
)
stageName
=
'selection'
,
dynConfig
=
{
'selection'
:
lambda
meta
:
meta
[
"selectionDecorNames"
][:],
'selectionNCuts'
:
lambda
meta
:
meta
[
"selectionDecorCount"
][:]}
)
# Set up an algorithm that makes a view container using the selections
# performed previously:
alg
=
createAlgorithm
(
'CP::AsgViewFromSelectionAlg'
,
'PhotonViewFromSelectionAlg'
+
postfix
)
alg
.
selection
=
selectionDecorNames
[
:
]
seq
.
append
(
alg
,
inputPropName
=
'input'
,
outputPropName
=
'output'
,
stageName
=
'selection'
)
stageName
=
'selection'
,
dynConfig
=
{
'selection'
:
lambda
meta
:
meta
[
"selectionDecorNames"
]
[:]}
)
# Set up an algorithm dumping the kinematic properties of the photons:
if
enableKinematicHistograms
:
alg
=
createAlgorithm
(
'CP::KinematicHistAlg'
,
'PhotonKinematicDumperAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
selectionDecorNames
)
alg
.
histPattern
=
'photon_%VAR%_%SYS%'
+
postfix
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
)
stageName
=
'selection'
,
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
# Set up a final deep copy making algorithm if requested:
if
deepCopyOutput
:
...
...
PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetAnalysisSequence.py
View file @
6d81b516
...
...
@@ -85,45 +85,45 @@ def makeJetAnalysisSequence( dataType, jetCollection, postfix = '',
seq
.
append
(
alg
,
inputPropName
=
'jets'
,
outputPropName
=
'jetsOut'
,
stageName
=
'calibration'
)
# record all the selections each subfunction makes
cutlist
=
[]
cutlength
=
[]
seq
.
addMetaConfigDefault
(
"selectionDecorNames"
,
[]
)
seq
.
addMetaConfigDefault
(
"selectionDecorCount"
,
[]
)
if
radius
==
4
:
makeSmallRJetAnalysisSequence
(
seq
,
cutlist
,
cutlength
,
makeSmallRJetAnalysisSequence
(
seq
,
dataType
,
jetCollection
,
jetInput
=
jetInput
,
postfix
=
postfix
,
**
kwargs
)
elif
radius
in
[
2
,
6
]:
makeRScanJetAnalysisSequence
(
seq
,
cutlist
,
cutlength
,
makeRScanJetAnalysisSequence
(
seq
,
dataType
,
jetCollection
,
jetInput
=
jetInput
,
radius
=
radius
,
postfix
=
postfix
,
**
kwargs
)
else
:
trim
=
match
.
group
(
3
)
if
trim
==
""
:
raise
ValueError
(
"Untrimmed large-R jets are not supported!"
)
makeLargeRJetAnalysisSequence
(
seq
,
cutlist
,
cutlength
,
makeLargeRJetAnalysisSequence
(
seq
,
dataType
,
jetCollection
,
jetInput
=
jetInput
,
postfix
=
postfix
,
**
kwargs
)
# Set up an algorithm used to create jet selection cutflow:
if
enableCutflow
:
alg
=
createAlgorithm
(
'CP::ObjectCutFlowHistAlg'
,
'JetCutFlowDumperAlg'
+
postfix
)
alg
.
histPattern
=
'jet_cflow_%SYS%'
+
postfix
alg
.
selection
=
cutlist
alg
.
selectionNCuts
=
cutlength
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
)
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
,
dynConfig
=
{
'selection'
:
lambda
meta
:
meta
[
"selectionDecorNames"
][:],
'selectionNCuts'
:
lambda
meta
:
meta
[
"selectionDecorCount"
][:]}
)
# Set up an algorithm dumping the kinematic properties of the jets:
if
enableKinematicHistograms
:
alg
=
createAlgorithm
(
'CP::KinematicHistAlg'
,
'JetKinematicDumperAlg'
+
postfix
)
alg
.
preselection
=
"&&"
.
join
(
cutlist
)
alg
.
histPattern
=
'jet_%VAR%_%SYS%'
+
postfix
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
)
seq
.
append
(
alg
,
inputPropName
=
'input'
,
stageName
=
'selection'
,
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
if
shallowViewOutput
:
# Set up an algorithm that makes a view container using the selections
# performed previously:
alg
=
createAlgorithm
(
'CP::AsgViewFromSelectionAlg'
,
'JetViewFromSelectionAlg'
+
postfix
)
alg
.
selection
=
cutlist
seq
.
append
(
alg
,
inputPropName
=
'input'
,
outputPropName
=
'output'
,
stageName
=
'selection'
)
stageName
=
'selection'
,
dynConfig
=
{
'selection'
:
lambda
meta
:
meta
[
"selectionDecorNames"
][:]}
)
# Set up a final deep copy making algorithm if requested:
if
deepCopyOutput
:
...
...
@@ -134,7 +134,7 @@ def makeJetAnalysisSequence( dataType, jetCollection, postfix = '',
return
seq
def
makeSmallRJetAnalysisSequence
(
seq
,
cutlist
,
cutlength
,
dataType
,
jetCollection
,
def
makeSmallRJetAnalysisSequence
(
seq
,
dataType
,
jetCollection
,
jetInput
,
postfix
=
''
,
runJvtUpdate
=
False
,
runFJvtUpdate
=
False
,
runJvtSelection
=
True
,
runFJvtSelection
=
False
,
...
...
@@ -144,8 +144,6 @@ def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
Keyword arguments
seq -- The sequence to add the algorithms to
cutlist -- Insert any cuts into this
cutlength -- Insert the lengths of any cuts into this
dataType -- The data type to run on ("data", "mc" or "afii")
jetCollection -- The jet container to run on.
jetInput -- The type of input used, read from the collection name.
...
...
@@ -282,16 +280,14 @@ def makeSmallRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
stageName
=
'selection'
)
# Return the sequence:
return
seq
,
cutlist
,
cutlength
return
seq
def
makeRScanJetAnalysisSequence
(
seq
,
cutlist
,
cutlength
,
dataType
,
jetCollection
,
def
makeRScanJetAnalysisSequence
(
seq
,
dataType
,
jetCollection
,
jetInput
,
radius
,
postfix
=
''
):
"""Add algorithms for the R-scan jets.
Keyword arguments
seq -- The sequence to add the algorithms to
cutlist -- Insert any cuts into this
cutlength -- Insert the lengths of any cuts into this
dataType -- The data type to run on ("data", "mc" or "afii")
jetCollection -- The jet container to run on.
jetInput -- The type of input used, read from the collection name.
...
...
@@ -316,14 +312,12 @@ def makeRScanJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollecti
# Logging would be good
print
(
"WARNING: uncertainties for R-Scan jets are not yet released!"
)
def
makeLargeRJetAnalysisSequence
(
seq
,
cutlist
,
cutlength
,
dataType
,
jetCollection
,
def
makeLargeRJetAnalysisSequence
(
seq
,
dataType
,
jetCollection
,
jetInput
,
postfix
=
''
,
largeRMass
=
"Comb"
):
"""Add algorithms for the R=1.0 jets.
Keyword arguments
seq -- The sequence to add the algorithms to
cutlist -- Insert any cuts into this
cutlength -- Insert the lengths of any cuts into this
dataType -- The data type to run on ("data", "mc" or "afii")
jetCollection -- The jet container to run on.
jetInput -- The type of input used, read from the collection name.
...
...
@@ -373,7 +367,6 @@ def makeLargeRJetAnalysisSequence( seq, cutlist, cutlength, dataType, jetCollect
alg
.
uncertaintiesTool
.
MCType
=
"MC16a"
alg
.
uncertaintiesTool
.
IsData
=
(
dataType
==
"data"
)
seq
.
append
(
alg
,
inputPropName
=
'jets'
,
outputPropName
=
'jetsOut'
,
stageName
=
'calibration'
)
cutlist
.
append
(
'outOfValidity'
)
cutlength
.
append
(
1
)
stageName
=
'calibration'
,
metaConfig
=
{
'selectionDecorNames'
:
[
'outOfValidity'
],
'selectionDecorCount'
:
[
1
]}
)
PhysicsAnalysis/Algorithms/JetAnalysisAlgorithms/python/JetJvtAnalysisSequence.py
View file @
6d81b516
...
...
@@ -5,7 +5,6 @@ from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence
from
AnaAlgorithm.DualUseConfig
import
createAlgorithm
def
makeJetJvtAnalysisSequence
(
dataType
,
jetCollection
,
preselection
=
''
,
enableFJvt
=
False
,
globalSF
=
True
,
runSelection
=
True
,
...
...
@@ -32,52 +31,50 @@ def makeJetJvtAnalysisSequence( dataType, jetCollection,
# Define a list of cuts to apply later on and the
# number of bits in the corresponding TAccept
cutlist
=
[]
cutlength
=
[]
seq
.
addMetaConfigDefault
(
"selectionDecorNames"
,
[]
)
seq
.
addMetaConfigDefault
(
"selectionDecorCount"
,
[]
)
# Set up the per-event jet efficiency scale factor calculation algorithm
if
dataType
!=
'data'
and
globalSF
:
alg
=
createAlgorithm
(
'CP::AsgEventScaleFactorAlg'
,
'JvtEventScaleFactorAlg'
)
alg
.
preselection
=
preselection
+
'&&no_jvt'
if
preselection
else
'no_jvt'
alg
.
scaleFactorInputDecoration
=
'jvt_effSF_%SYS%'
alg
.
scaleFactorOutputDecoration
=
'jvt_effSF_%SYS%'
seq
.
append
(
alg
,
inputPropName
=
{
'jets'
:
'particles'
,
'eventInfo'
:
'eventInfo'
}
)
'eventInfo'
:
'eventInfo'
},
dynConfig
=
{
'preselection'
:
lambda
meta
:
"&&"
.
join
(
meta
[
"selectionDecorNames"
])}
)
if
enableFJvt
:
alg
=
createAlgorithm
(
'CP::AsgEventScaleFactorAlg'
,
'ForwardJvtEventScaleFactorAlg'
)
alg
.
preselection
=
preselection
+
'&&no_fjvt'
if
preselection
else
'no_fjvt'
alg
.
scaleFactorInputDecoration
=
'fjvt_effSF_%SYS%'
alg
.
scaleFactorOutputDecoration
=
'fjvt_effSF_%SYS%'
seq
.
append
(
alg
,
inputPropName
=
{
'jets'
:
'particles'
,