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

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 203 of file MuonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.instanceName ( self)

Definition at line 241 of file MuonAnalysisConfig.py.

241 def instanceName (self) :
242 if self.postfix is not None:
243 return self.containerName + '_' + self.postfix
244 else:
245 return self.containerName + '_' + self.selectionName
246

◆ makeAlgs()

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

Definition at line 247 of file MuonAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.containerName

Definition at line 288 of file MuonAnalysisConfig.py.

◆ quality

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

Definition at line 251 of file MuonAnalysisConfig.py.

◆ selectionName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.selectionName

Definition at line 288 of file MuonAnalysisConfig.py.

◆ trackSelection

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.trackSelection

Definition at line 279 of file MuonAnalysisConfig.py.


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