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

Public Member Functions

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

Public Attributes

str calibMode = 'correctData_CB':
 inputContainer
 containerName
 addGlobalFELinksDep
 recalibratePhyslite

Detailed Description

the ConfigBlock for the muon four-momentum correction

Definition at line 15 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonMomentumCalibrationConfig.__init__ ( self)

Definition at line 18 of file MuonAnalysisConfig.py.

18 def __init__ (self) :
19 super (MuonMomentumCalibrationConfig, self).__init__ ()
20 self.setBlockName('Muons')
21 self.addOption ('inputContainer', '', type=str,
22 info="the name of the input muon container. If left empty, automatically defaults "
23 "to `AnalysisMuons` for PHYSLITE or `Muons` otherwise.")
24 self.addOption ('containerName', '', type=str,
25 noneAction='error',
26 info="the name of the output container after calibration.")
27 self.addOption ('postfix', "", type=str,
28 info="a postfix to apply to decorations and algorithm names. "
29 "Typically not needed here since the calibration is common to "
30 "all muons.")
31 self.addOption ('minPt', 3.0*GeV, type=float,
32 info=r"$p_\mathrm{T}$ cut (in MeV) to apply to calibrated muons.")
33 self.addOption ('recalibratePhyslite', True, type=bool,
34 info="whether to run the `CP::MuonCalibrationAndSmearingAlg` on "
35 "PHYSLITE derivations.")
36 self.addOption ('maxEta', 2.7, type=float,
37 info=r"maximum muon $\vert\eta\vert$.")
38 self.addOption ('excludeNSWFromPrecisionLayers', False, type=bool,
39 info="only for testing purposes, turn on to ignore NSW hits and "
40 "fix a crash with older derivations (p-tag <p5834).")
41 self.addOption ('calibMode', 'correctData_CB', type=str, info='calibration mode of the `MuonCalibTool` needed to turn on the sagitta bias corrections and to select the muon track calibration type (CB or ID+MS), see https://atlas-mcp.docs.cern.ch/guidelines/muonmomentumcorrections/index.html#cpmuoncalibtool-tool.')
42 self.addOption ('decorateTruth', False, type=bool,
43 info="decorate truth particle information on the reconstructed one.")
44 self.addOption ('writeColumnarToolVariables', False, type=bool,
45 info="whether to add variables needed for running the columnar muon tool(s) on the output n-tuple (EXPERIMENTAL).",
46 expertMode=True)
47 self.addOption ('addGlobalFELinksDep', False, type=bool,
48 info="whether to add dependencies for the global FE links (needed for PHYSLITE production)",
49 expertMode=True)
50

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonMomentumCalibrationConfig.instanceName ( self)

Definition at line 51 of file MuonAnalysisConfig.py.

51 def instanceName (self) :
52 if self.postfix != "":
53 return self.postfix
54 else :
55 return self.containerName
56

◆ makeAlgs()

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

Definition at line 57 of file MuonAnalysisConfig.py.

57 def makeAlgs (self, config) :
58
59 log = logging.getLogger('MuonCalibrationConfig')
60
61 #make sure that this is sync with
62 #PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/MuonMomentumCorrections/MuonCalibTool.h#L31-37
63 if self.calibMode == 'correctData_CB':
64 calibMode = 0
65 elif self.calibMode == 'correctData_IDMS':
66 calibMode = 1
67 elif self.calibMode == 'notCorrectData_IDMS':
68 calibMode = 2
69 elif self.calibMode == 'notCorrectData_CB':
70 calibMode = 3
71 else :
72 raise ValueError ("invalid calibMode: \"" + self.calibMode + "\". Allowed values are correctData_CB, correctData_IDMS, notCorrectData_IDMS, notCorrectData_CB")
73
74 inputContainer = "AnalysisMuons" if config.isPhyslite() else "Muons"
75 if self.inputContainer:
76 inputContainer = self.inputContainer
77 config.setSourceName (self.containerName, inputContainer)
78 config.setContainerMeta (self.containerName, 'calibMode', calibMode)
79
80 # Set up a shallow copy to decorate
81 if config.wantCopy (self.containerName) :
82 alg = config.createAlgorithm( 'CP::AsgShallowCopyAlg', 'MuonShallowCopyAlg' )
83 alg.input = config.readName (self.containerName)
84 alg.output = config.copyName (self.containerName)
85 alg.outputType = 'xAOD::MuonContainer'
86 decorationList = ['DFCommonJetDr','neflowisol20_CloseByCorr',
87 'ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000_CloseByCorr',
88 'ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500_CloseByCorr',
89 'topoetcone20_CloseByCorr']
90 if self.addGlobalFELinksDep:
91 decorationList += ['neutralGlobalFELinks', 'chargedGlobalFELinks']
92 if config.dataType() is not DataType.Data:
93 decorationList += ['TruthLink']
94 if self.addGlobalFELinksDep or config.dataType() is not DataType.Data:
95 alg.declareDecorations = decorationList
96
97 # Set up the eta-cut on all muons prior to everything else
98 alg = config.createAlgorithm( 'CP::AsgSelectionAlg',
99 'MuonEtaCutAlg' )
100 config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
101 alg.selectionTool.maxEta = self.maxEta
102 alg.selectionDecoration = 'selectEta' + self.postfix + ',as_bits'
103 alg.particles = config.readName (self.containerName)
104 alg.preselection = config.getPreselection (self.containerName, '')
105 config.addSelection (self.containerName, '', alg.selectionDecoration)
106
107 # Set up the muon calibration and smearing algorithm:
108 alg = config.createAlgorithm( 'CP::MuonCalibrationAndSmearingAlg',
109 'MuonCalibrationAndSmearingAlg' )
110 config.addPrivateTool( 'calibrationAndSmearingTool',
111 'CP::MuonCalibTool' )
112
113 alg.calibrationAndSmearingTool.IsRun3Geo = config.geometry() >= LHCPeriod.Run3
114 alg.calibrationAndSmearingTool.calibMode = calibMode
115 if config.geometry() is LHCPeriod.Run4:
116 log.warning("Disabling NSW hits for Run4 geometry")
117 alg.calibrationAndSmearingTool.ExcludeNSWFromPrecisionLayers = True
118 else:
119 alg.calibrationAndSmearingTool.ExcludeNSWFromPrecisionLayers = self.excludeNSWFromPrecisionLayers and (config.geometry() >= LHCPeriod.Run3)
120 alg.muons = config.readName (self.containerName)
121 alg.muonsOut = config.copyName (self.containerName)
122 alg.preselection = config.getPreselection (self.containerName, '')
123 if config.isPhyslite() and not self.recalibratePhyslite :
124 alg.skipNominal = True
125
126 # Set up the the pt selection
127 if self.minPt > 0:
128 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'MuonPtCutAlg' )
129 alg.selectionDecoration = 'selectPt' + self.postfix + ',as_bits'
130 config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
131 alg.particles = config.readName (self.containerName)
132 alg.selectionTool.minPt = self.minPt
133 alg.preselection = config.getPreselection (self.containerName, '')
134 config.addSelection (self.containerName, '', alg.selectionDecoration,
135 preselection = True)
136
137 alg = config.createAlgorithm( 'CP::AsgEnergyDecoratorAlg', 'EnergyDecorator' )
138 alg.particles = config.readName (self.containerName)
139
140 config.addOutputVar (self.containerName, 'pt', 'pt')
141 config.addOutputVar (self.containerName, 'eta', 'eta', noSys=True)
142 config.addOutputVar (self.containerName, 'phi', 'phi', noSys=True)
143 config.addOutputVar (self.containerName, 'e_%SYS%', 'e')
144 config.addOutputVar (self.containerName, 'charge', 'charge', noSys=True)
145
146 # decorate truth information on the reconstructed object:
147 if self.decorateTruth and config.dataType() is not DataType.Data:
148 config.addOutputVar (self.containerName, "truthType", "truth_type", noSys=True)
149 config.addOutputVar (self.containerName, "truthOrigin", "truth_origin", noSys=True)
150
151 config.addOutputVar (self.containerName, 'muonType', 'muonType', noSys=True, enabled=self.writeColumnarToolVariables)
152
153

Member Data Documentation

◆ addGlobalFELinksDep

python.MuonAnalysisConfig.MuonMomentumCalibrationConfig.addGlobalFELinksDep

Definition at line 90 of file MuonAnalysisConfig.py.

◆ calibMode

str python.MuonAnalysisConfig.MuonMomentumCalibrationConfig.calibMode = 'correctData_CB':

Definition at line 63 of file MuonAnalysisConfig.py.

◆ containerName

python.MuonAnalysisConfig.MuonMomentumCalibrationConfig.containerName

Definition at line 77 of file MuonAnalysisConfig.py.

◆ inputContainer

python.MuonAnalysisConfig.MuonMomentumCalibrationConfig.inputContainer

Definition at line 75 of file MuonAnalysisConfig.py.

◆ recalibratePhyslite

python.MuonAnalysisConfig.MuonMomentumCalibrationConfig.recalibratePhyslite

Definition at line 123 of file MuonAnalysisConfig.py.


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