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, containerName='')
 
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,
  containerName = '' 
)

Definition at line 16 of file MuonAnalysisConfig.py.

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

Member Function Documentation

◆ makeAlgs()

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

Definition at line 41 of file MuonAnalysisConfig.py.

41  def makeAlgs (self, config) :
42 
43  #make sure that this is sync with
44  #PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/MuonMomentumCorrections/MuonCalibTool.h#L31-37
45  if self.calibMode == 'correctData_CB':
46  calibMode = 0
47  elif self.calibMode == 'correctData_IDMS':
48  calibMode = 1
49  elif self.calibMode == 'notCorrectData_IDMS':
50  calibMode = 2
51  elif self.calibMode == 'notCorrectData_CB':
52  calibMode = 3
53  else :
54  raise ValueError ("invalid calibMode: \"" + self.calibMode + "\". Allowed values are correctData_CB, correctData_IDMS, notCorrectData_IDMS, notCorrectData_CB")
55 
56  config.setSourceName (self.containerName,
57  "AnalysisMuons" if config.isPhyslite() else "Muons",
58  calibMode=calibMode)
59 
60  # Set up a shallow copy to decorate
61  if config.wantCopy (self.containerName) :
62  alg = config.createAlgorithm( 'CP::AsgShallowCopyAlg', 'MuonShallowCopyAlg' + self.postfix )
63  alg.input = config.readName (self.containerName)
64  alg.output = config.copyName (self.containerName)
65 
66  # Set up the eta-cut on all muons prior to everything else
67  alg = config.createAlgorithm( 'CP::AsgSelectionAlg',
68  'MuonEtaCutAlg' + self.postfix )
69  config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
70  alg.selectionTool.maxEta = self.maxEta
71  alg.selectionDecoration = 'selectEta' + self.postfix + ',as_bits'
72  alg.particles = config.readName (self.containerName)
73  alg.preselection = config.getPreselection (self.containerName, '')
74  config.addSelection (self.containerName, '', alg.selectionDecoration)
75 
76  # Set up the muon calibration and smearing algorithm:
77  alg = config.createAlgorithm( 'CP::MuonCalibrationAndSmearingAlg',
78  'MuonCalibrationAndSmearingAlg' + self.postfix )
79  config.addPrivateTool( 'calibrationAndSmearingTool',
80  'CP::MuonCalibTool' )
81 
82  alg.calibrationAndSmearingTool.IsRun3Geo = config.geometry() >= LHCPeriod.Run3
83  alg.calibrationAndSmearingTool.calibMode = calibMode
84  if config.geometry() is LHCPeriod.Run4:
85  logging.warning("MuonCalibrationConfig: disabling NSW hits for Run4 geometry")
86  alg.calibrationAndSmearingTool.ExcludeNSWFromPrecisionLayers = True
87  else:
88  alg.calibrationAndSmearingTool.ExcludeNSWFromPrecisionLayers = self.excludeNSWFromPrecisionLayers and (config.geometry() >= LHCPeriod.Run3)
89  alg.muons = config.readName (self.containerName)
90  alg.muonsOut = config.copyName (self.containerName)
91  alg.preselection = config.getPreselection (self.containerName, '')
92  if config.isPhyslite() and not self.recalibratePhyslite :
93  alg.skipNominal = True
94 
95  # Set up the the pt selection
96  if self.minPt > 0:
97  alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'MuonPtCutAlg' + self.postfix )
98  alg.selectionDecoration = 'selectPt' + self.postfix + ',as_bits'
99  config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
100  alg.particles = config.readName (self.containerName)
101  alg.selectionTool.minPt = self.minPt
102  alg.preselection = config.getPreselection (self.containerName, '')
103  config.addSelection (self.containerName, '', alg.selectionDecoration,
104  preselection = True)
105 
106  # Additional decorations
107  alg = config.createAlgorithm( 'CP::AsgEnergyDecoratorAlg', 'EnergyDecorator' + self.containerName + self.postfix )
108  alg.particles = config.readName (self.containerName)
109 
110  config.addOutputVar (self.containerName, 'pt', 'pt')
111  config.addOutputVar (self.containerName, 'eta', 'eta', noSys=True)
112  config.addOutputVar (self.containerName, 'phi', 'phi', noSys=True)
113  config.addOutputVar (self.containerName, 'e_%SYS%', 'e')
114  config.addOutputVar (self.containerName, 'charge', 'charge', noSys=True)
115 
116  # decorate truth information on the reconstructed object:
117  if self.decorateTruth and config.dataType() is not DataType.Data:
118  config.addOutputVar (self.containerName, "truthType", "truth_type", noSys=True)
119  config.addOutputVar (self.containerName, "truthOrigin", "truth_origin", noSys=True)
120 

Member Data Documentation

◆ calibMode

python.MuonAnalysisConfig.MuonCalibrationConfig.calibMode

Definition at line 45 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