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 

Member Function Documentation

◆ instanceName()

def python.MuonAnalysisConfig.MuonCalibrationConfig.instanceName (   self)

Definition at line 47 of file MuonAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 53 of file MuonAnalysisConfig.py.

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

Member Data Documentation

◆ calibMode

python.MuonAnalysisConfig.MuonCalibrationConfig.calibMode

Definition at line 59 of file MuonAnalysisConfig.py.


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