Skip to content
Snippets Groups Projects
Commit 931c5751 authored by Thomas Strebler's avatar Thomas Strebler Committed by Johannes Elmsheuser
Browse files

Move TTVA lepton selection from calibration to WorkingPoint block config

Move TTVA lepton selection from calibration to WorkingPoint block config
parent fef21c42
No related branches found
No related tags found
No related merge requests found
......@@ -33,10 +33,6 @@ class ElectronCalibrationConfig (ConfigBlock) :
info="whether or not to perform isolation corrections (leakage "
"corrections), i.e. set up an instance of "
"CP::EgammaIsolationCorrectionAlg.")
self.addOption ('trackSelection', True, type=bool,
info="whether or not to set up an instance of "
"CP::AsgLeptonTrackSelectionAlg, with the recommended d_0 and "
"z_0 sin(theta) cuts. The default is True.")
self.addOption ('recalibratePhyslite', True, type=bool,
info="whether to run the CP::EgammaCalibrationAndSmearingAlg on "
"PHYSLITE derivations. The default is True.")
......@@ -79,17 +75,6 @@ class ElectronCalibrationConfig (ConfigBlock) :
alg.preselection = config.getPreselection (self.containerName, '')
config.addSelection (self.containerName, '', alg.selectionDecoration)
# Set up the track selection algorithm:
if self.trackSelection :
alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg',
'ElectronTrackSelectionAlg' + self.postfix )
alg.selectionDecoration = 'trackSelection' + self.postfix + ',as_bits'
alg.maxD0Significance = 5
alg.maxDeltaZ0SinTheta = 0.5
alg.particles = config.readName (self.containerName)
alg.preselection = config.getPreselection (self.containerName, '')
config.addSelection (self.containerName, '', alg.selectionDecoration)
# Select electrons only with good object quality.
alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronObjectQualityAlg' + self.postfix )
alg.selectionDecoration = 'goodOQ' + self.postfix + ',as_bits'
......@@ -164,6 +149,16 @@ class ElectronWorkingPointConfig (ConfigBlock) :
self.addOption ('postfix', None, type=str,
info="a postfix to apply to decorations and algorithm names. "
"Typically not needed here as selectionName is used internally.")
self.addOption ('trackSelection', True, type=bool,
info="whether or not to set up an instance of "
"CP::AsgLeptonTrackSelectionAlg, with the recommended d_0 and "
"z_0 sin(theta) cuts. The default is True.")
self.addOption ('maxD0Significance', 5, type=float,
info="maximum d0 significance used for the trackSelection"
"The default is 5")
self.addOption ('maxDeltaZ0SinTheta', 0.5, type=float,
info="maximum z0sinTheta in mm used for the trackSelection"
"The default is 0.5 mm")
self.addOption ('likelihoodWP', None, type=str,
info="the ID WP (string) to use. Supported ID WPs: TightLH, "
"MediumLH, LooseBLayerLH. ")
......@@ -211,6 +206,17 @@ class ElectronWorkingPointConfig (ConfigBlock) :
if postfix != '' and postfix[0] != '_' :
postfix = '_' + postfix
# Set up the track selection algorithm:
if self.trackSelection :
alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg',
'ElectronTrackSelectionAlg' + postfix )
alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits'
alg.maxD0Significance = self.maxD0Significance
alg.maxDeltaZ0SinTheta = self.maxDeltaZ0SinTheta
alg.particles = config.readName (self.containerName)
alg.preselection = config.getPreselection (self.containerName, '')
config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration)
if 'LH' in self.likelihoodWP:
# Set up the likelihood ID selection algorithm
# It is safe to do this before calibration, as the cluster E is used
......
......@@ -21,10 +21,6 @@ class MuonCalibrationConfig (ConfigBlock):
self.addOption ('ptSelectionOutput', False, type=bool,
info="pT cut to apply to calibrated muons, in MeV. "
"The default is 3.0 GeV.")
self.addOption ('trackSelection', True, type=bool,
info="whether or not to set up an instance of "
"CP::AsgLeptonTrackSelectionAlg, with the recommended d_0 and "
"z_0 sin(theta) cuts. The default is True.")
self.addOption ('recalibratePhyslite', True, type=bool,
info="whether to run the CP::EgammaCalibrationAndSmearingAlg on "
"PHYSLITE derivations. The default is True.")
......@@ -71,17 +67,6 @@ class MuonCalibrationConfig (ConfigBlock):
alg.preselection = config.getPreselection (self.containerName, '')
config.addSelection (self.containerName, '', alg.selectionDecoration)
# Set up the track selection algorithm:
if self.trackSelection :
alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg',
'MuonTrackSelectionAlg' + self.postfix )
alg.selectionDecoration = 'trackSelection' + self.postfix + ',as_bits'
alg.maxD0Significance = 3
alg.maxDeltaZ0SinTheta = 0.5
alg.particles = config.readName (self.containerName)
alg.preselection = config.getPreselection (self.containerName, '')
config.addSelection (self.containerName, '', alg.selectionDecoration)
# Set up the muon calibration and smearing algorithm:
alg = config.createAlgorithm( 'CP::MuonCalibrationAndSmearingAlg',
'MuonCalibrationAndSmearingAlg' + self.postfix )
......@@ -131,6 +116,16 @@ class MuonWorkingPointConfig (ConfigBlock) :
self.addOption ('postfix', selectionName, type=str,
info="a postfix to apply to decorations and algorithm names. "
"Typically not needed here as selectionName is used internally.")
self.addOption ('trackSelection', True, type=bool,
info="whether or not to set up an instance of "
"CP::AsgLeptonTrackSelectionAlg, with the recommended d_0 and "
"z_0 sin(theta) cuts. The default is True.")
self.addOption ('maxD0Significance', 3, type=float,
info="maximum d0 significance used for the trackSelection"
"The default is 3")
self.addOption ('maxDeltaZ0SinTheta', 0.5, type=float,
info="maximum Delta z0sinTheta in mm used for the trackSelection"
"The default is 0.5 mm")
self.addOption ('quality', None, type=str,
info="the ID WP (string) to use. Supported ID WPs: Tight, Medium, "
"Loose, LowPt, HighPt.")
......@@ -183,6 +178,17 @@ class MuonWorkingPointConfig (ConfigBlock) :
if postfix != '' and postfix[0] != '_' :
postfix = '_' + postfix
# Set up the track selection algorithm:
if self.trackSelection :
alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg',
'MuonTrackSelectionAlg' + postfix )
alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits'
alg.maxD0Significance = self.maxD0Significance
alg.maxDeltaZ0SinTheta = self.maxDeltaZ0SinTheta
alg.particles = config.readName (self.containerName)
alg.preselection = config.getPreselection (self.containerName, '')
config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration, preselection=self.qualitySelectionOutput)
# Setup the muon quality selection
alg = config.createAlgorithm( 'CP::MuonSelectionAlgV2',
'MuonSelectionAlg' + postfix )
......
......@@ -48,10 +48,10 @@ def CPAlgorithmsCfg(flags):
logPLCPAlgCfg.info('Do Muons')
subConfig = factory.makeConfig ('Muons', containerName='AnalysisMuons')
subConfig.setOptionValue ('.trackSelection', False)
configSeq += subConfig
subConfig = factory.makeConfig ('Muons.WorkingPoint', containerName='AnalysisMuons',
selectionName='loose')
selectionName='loose')
subConfig.setOptionValue ('.trackSelection', False)
subConfig.setOptionValue ('.quality', 'Loose')
subConfig.setOptionValue ('.isolation', 'NonIso')
configSeq += subConfig
......@@ -68,12 +68,12 @@ def CPAlgorithmsCfg(flags):
subConfig = factory.makeConfig ('Electrons', containerName='AnalysisElectrons')
subConfig.setOptionValue ('.forceFullSimConfig', forceEGammaFullSimConfig)
subConfig.setOptionValue ('.trackSelection', False)
subConfig.setOptionValue ('.isolationCorrection', True)
subConfig.setOptionValue ('.minPt', 0.)
configSeq += subConfig
subConfig = factory.makeConfig ('Electrons.WorkingPoint', containerName='AnalysisElectrons',
selectionName='loose')
selectionName='loose')
subConfig.setOptionValue ('.trackSelection', False)
subConfig.setOptionValue ('.likelihoodWP', 'LooseLHElectron')
subConfig.setOptionValue ('.isolationWP', 'NonIso')
subConfig.setOptionValue ('.doFSRSelection', True)
......@@ -89,12 +89,12 @@ def CPAlgorithmsCfg(flags):
# So SiHit electrons - should come after the standard selection in order to avoid keeping the same electrons twice
subConfig = factory.makeConfig ('Electrons', containerName='AnalysisSiHitElectrons')
subConfig.setOptionValue ('.forceFullSimConfig', forceEGammaFullSimConfig)
subConfig.setOptionValue ('.trackSelection', False)
subConfig.setOptionValue ('.isolationCorrection', True)
subConfig.setOptionValue ('.minPt', 0.)
subConfig.setOptionValue ('.postfix', 'SiHit')
configSeq += subConfig
subConfig = factory.makeConfig ('Electrons.WorkingPoint', containerName='AnalysisSiHitElectrons', selectionName='SiHits')
subConfig.setOptionValue ('.trackSelection', False)
subConfig.setOptionValue ('.likelihoodWP', 'SiHitElectron')
subConfig.setOptionValue ('.isolationWP', 'NonIso')
subConfig.setOptionValue ('.doFSRSelection', True) # needed to veto FSR electrons
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment