ATLAS Offline Software
Loading...
Searching...
No Matches
python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig Class Reference
Inheritance diagram for python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig:
Collaboration diagram for python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig:

Public Member Functions

 __init__ (self)
 instanceName (self)
 makeAlgs (self, config)

Public Attributes

str quality = 'Tight' :
 trackSelection
 containerName
 selectionName

Detailed Description

the ConfigBlock for the muon working point selection

Definition at line 198 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 201 of file MuonAnalysisConfig.py.

201 def __init__ (self) :
202 super (MuonWorkingPointSelectionConfig, self).__init__ ()
203 self.setBlockName('MuonWorkingPointSelection')
204 self.addOption ('containerName', '', type=str,
205 noneAction='error',
206 info="the name of the input container.")
207 self.addOption ('selectionName', '', type=str,
208 noneAction='error',
209 info="the name of the muon selection to define (e.g. `tight` or `loose`).")
210 self.addOption ('postfix', None, type=str,
211 info="a postfix to apply to decorations and algorithm names. "
212 "Typically not needed here as `selectionName` is used internally.")
213 self.addOption ('trackSelection', True, type=bool,
214 info="whether or not to set up an instance of "
215 "`CP::AsgLeptonTrackSelectionAlg`, with the recommended $d_0$ and "
216 r"$z_0\sin\theta$ cuts.")
217 self.addOption ('maxD0Significance', 3, type=float,
218 info="maximum $d_0$ significance used for the track selection.")
219 self.addOption ('maxDeltaZ0SinTheta', 0.5, type=float,
220 info=r"maximum $\Delta z_0\sin\theta$ (in mm) used for the track selection.")
221 self.addOption ('quality', None, type=str,
222 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, "
223 "`Loose`, `LowPt`, `HighPt`.")
224 self.addOption ('isolation', None, type=str,
225 info="the isolation WP to use. Supported isolation WPs: "
226 "`PflowLoose_VarRad`, `PflowTight_VarRad`, `Loose_VarRad`, "
227 "`Tight_VarRad`, `NonIso`.")
228 self.addOption ('addSelectionToPreselection', True, type=bool,
229 info="whether to retain only muons satisfying the working point "
230 "requirements.")
231 self.addOption ('isoDecSuffix', '', type=str,
232 info="the `isoDecSuffix` name if using close-by-corrected isolation working points.")
233 self.addOption ('excludeNSWFromPrecisionLayers', False, type=bool,
234 info="only for testing purposes, turn on to ignore NSW hits and "
235 "fix a crash with older derivations (p-tag <p5834).")
236

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.instanceName ( self)

Definition at line 237 of file MuonAnalysisConfig.py.

237 def instanceName (self) :
238 if self.postfix is not None:
239 return self.containerName + '_' + self.postfix
240 else:
241 return self.containerName + '_' + self.selectionName
242

◆ makeAlgs()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.makeAlgs ( self,
config )

Definition at line 243 of file MuonAnalysisConfig.py.

243 def makeAlgs (self, config) :
244 log = logging.getLogger('MuonWorkingPointSelectionConfig')
245
246 from xAODMuon.xAODMuonEnums import xAODMuonEnums
247 if self.quality == 'Tight' :
248 quality = xAODMuonEnums.Quality.Tight
249 elif self.quality == 'Medium' :
250 quality = xAODMuonEnums.Quality.Medium
251 elif self.quality == 'Loose' :
252 quality = xAODMuonEnums.Quality.Loose
253 elif self.quality == 'VeryLoose' :
254 quality = xAODMuonEnums.Quality.VeryLoose
255 elif self.quality == 'HighPt' :
256 quality = 4
257 elif self.quality == 'LowPt' :
258 quality = 5
259 else :
260 raise ValueError ("invalid muon quality: \"" + self.quality +
261 "\", allowed values are Tight, Medium, Loose, " +
262 "VeryLoose, HighPt, LowPt")
263
264 # The setup below is inappropriate for Run 1
265 if config.geometry() is LHCPeriod.Run1:
266 raise ValueError ("Can't set up the MuonWorkingPointSelectionConfig with %s, there must be something wrong!" % config.geometry().value)
267
268 postfix = self.postfix
269 if postfix is None :
270 postfix = self.selectionName
271 if postfix != '' and postfix[0] != '_' :
272 postfix = '_' + postfix
273
274 # Set up the track selection algorithm:
275 if self.trackSelection:
276 alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg',
277 'MuonTrackSelectionAlg',
278 reentrant=True )
279 alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits'
280 alg.maxD0Significance = self.maxD0Significance
281 alg.maxDeltaZ0SinTheta = self.maxDeltaZ0SinTheta
282 alg.particles = config.readName (self.containerName)
283 alg.preselection = config.getPreselection (self.containerName, '')
284 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration, preselection=self.addSelectionToPreselection)
285
286 # Setup the muon quality selection
287 alg = config.createAlgorithm( 'CP::MuonSelectionAlgV2',
288 'MuonSelectionAlg' )
289 config.addPrivateTool( 'selectionTool', 'CP::MuonSelectionTool' )
290 alg.selectionTool.MuQuality = quality
291 alg.selectionTool.IsRun3Geo = config.geometry() >= LHCPeriod.Run3
292 if config.geometry() is LHCPeriod.Run4:
293 log.warning("Disabling NSW hits for Run4 geometry")
294 alg.selectionTool.ExcludeNSWFromPrecisionLayers = True
295 else:
296 alg.selectionTool.ExcludeNSWFromPrecisionLayers = self.excludeNSWFromPrecisionLayers and (config.geometry() >= LHCPeriod.Run3)
297 alg.selectionDecoration = 'good_muon' + postfix + ',as_char'
298 alg.badMuonVetoDecoration = 'is_bad' + postfix + ',as_char'
299 alg.muons = config.readName (self.containerName)
300 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
301 config.addSelection (self.containerName, self.selectionName,
302 alg.selectionDecoration,
303 preselection=self.addSelectionToPreselection)
304 if self.quality == 'HighPt':
305 config.addOutputVar (self.containerName, 'is_bad' + postfix, 'is_bad' + postfix)
306
307 # Set up the isolation calculation algorithm:
308 if self.isolation != 'NonIso' :
309 alg = config.createAlgorithm( 'CP::MuonIsolationAlg',
310 'MuonIsolationAlg' )
311 config.addPrivateTool( 'isolationTool', 'CP::IsolationSelectionTool' )
312 alg.isolationTool.MuonWP = self.isolation
313 alg.isolationTool.IsoDecSuffix = self.isoDecSuffix
314 alg.isolationDecoration = 'isolated_muon' + postfix + ',as_char'
315 alg.muons = config.readName (self.containerName)
316 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
317 config.addSelection (self.containerName, self.selectionName,
318 alg.isolationDecoration,
319 preselection=self.addSelectionToPreselection)
320
321

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.containerName

Definition at line 284 of file MuonAnalysisConfig.py.

◆ quality

str python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.quality = 'Tight' :

Definition at line 247 of file MuonAnalysisConfig.py.

◆ selectionName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.selectionName

Definition at line 284 of file MuonAnalysisConfig.py.

◆ trackSelection

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.trackSelection

Definition at line 275 of file MuonAnalysisConfig.py.


The documentation for this class was generated from the following file: