41 def makeAlgs (self, config) :
45 if self.calibMode ==
'correctData_CB':
47 elif self.calibMode ==
'correctData_IDMS':
49 elif self.calibMode ==
'notCorrectData_IDMS':
51 elif self.calibMode ==
'notCorrectData_CB':
54 raise ValueError (
"invalid calibMode: \"" + self.calibMode +
"\". Allowed values are correctData_CB, correctData_IDMS, notCorrectData_IDMS, notCorrectData_CB")
56 config.setSourceName (self.containerName,
57 "AnalysisMuons" if config.isPhyslite()
else "Muons",
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)
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)
77 alg = config.createAlgorithm(
'CP::MuonCalibrationAndSmearingAlg',
78 'MuonCalibrationAndSmearingAlg' + self.postfix )
79 config.addPrivateTool(
'calibrationAndSmearingTool',
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
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
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,
107 alg = config.createAlgorithm(
'CP::AsgEnergyDecoratorAlg',
'EnergyDecorator' + self.containerName + self.postfix )
108 alg.particles = config.readName (self.containerName)
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)
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)