ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.MuonAnalysisConfig.MuonCalibrationConfig Class Reference
Inheritance diagram for python.MuonAnalysisConfig.MuonCalibrationConfig:
Collaboration diagram for python.MuonAnalysisConfig.MuonCalibrationConfig:

Public Member Functions

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

Public Attributes

 calibMode
 

Detailed Description

the ConfigBlock for the muon four-momentum correction

Definition at line 13 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.MuonAnalysisConfig.MuonCalibrationConfig.__init__ (   self)

Definition at line 16 of file MuonAnalysisConfig.py.

16  def __init__ (self) :
17  super (MuonCalibrationConfig, self).__init__ ()
18  self.setBlockName('Muons')
19  self.addOption ('inputContainer', '', type=str,
20  info="select muon input container, by default set to Muons")
21  self.addOption ('containerName', '', type=str,
22  noneAction='error',
23  info="the name of the output container after calibration.")
24  self.addOption ('postfix', "", type=str,
25  info="a postfix to apply to decorations and algorithm names. "
26  "Typically not needed here since the calibration is common to "
27  "all muons.")
28  self.addOption ('minPt', 3.0*GeV, type=float,
29  info="pT cut to apply to calibrated muons, in MeV. "
30  "The default is 3.0 GeV.")
31  self.addOption ('recalibratePhyslite', True, type=bool,
32  info="whether to run the CP::EgammaCalibrationAndSmearingAlg on "
33  "PHYSLITE derivations. The default is True.")
34  self.addOption ('maxEta', 2.7, type=float,
35  info="maximum muon |eta| (float). The default is 2.7.")
36  self.addOption ('excludeNSWFromPrecisionLayers', False, type=bool,
37  info="only for testing purposes, turn on to ignore NSW hits and "
38  "fix a crash with older derivations (p-tag <p5834)")
39  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')
40  self.addOption ('decorateTruth', False, type=bool,
41  info="decorate truth particle information on the reconstructed one")
42  self.addOption ('writeTrackD0Z0', False, type = bool,
43  info="save the d0 significance and z0sinTheta variables so they can be written out")
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 

Member Function Documentation

◆ instanceName()

def python.MuonAnalysisConfig.MuonCalibrationConfig.instanceName (   self)

Definition at line 48 of file MuonAnalysisConfig.py.

48  def instanceName (self) :
49  if self.postfix != "":
50  return self.postfix
51  else :
52  return self.containerName
53 

◆ makeAlgs()

def python.MuonAnalysisConfig.MuonCalibrationConfig.makeAlgs (   self,
  config 
)

Definition at line 54 of file MuonAnalysisConfig.py.

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

Member Data Documentation

◆ calibMode

python.MuonAnalysisConfig.MuonCalibrationConfig.calibMode

Definition at line 60 of file MuonAnalysisConfig.py.


The documentation for this class was generated from the following file:
python.processes.powheg.ZZj_MiNNLO.ZZj_MiNNLO.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZj_MiNNLO.py:18