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 204 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 207 of file MuonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.instanceName ( self)

Definition at line 245 of file MuonAnalysisConfig.py.

245 def instanceName (self) :
246 if self.postfix is not None:
247 return self.containerName + '_' + self.postfix
248 else:
249 return self.containerName + '_' + self.selectionName
250

◆ makeAlgs()

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

Definition at line 251 of file MuonAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.containerName

Definition at line 292 of file MuonAnalysisConfig.py.

◆ quality

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

Definition at line 255 of file MuonAnalysisConfig.py.

◆ selectionName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.selectionName

Definition at line 292 of file MuonAnalysisConfig.py.

◆ trackSelection

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.trackSelection

Definition at line 283 of file MuonAnalysisConfig.py.


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