def MooTrackBuilder(name="MooTrackBuilderTemplate", extraFlags=None, **kwargs): namePrefix = getattr(extraFlags, "namePrefix", "") namePostfix = getattr(extraFlags, "namePostfix", "") optimiseMomentumResolutionUsingChi2 = getattr( extraFlags, "optimiseMomentumResolutionUsingChi2", False) kwargs.setdefault("Fitter", "MooTrackFitter") kwargs.setdefault("SLFitter", "MooSLTrackFitter") kwargs.setdefault( "RecalibrateMDTHitsOnTrack", ((not muonRecFlags.doSegmentT0Fit()) and muonStandaloneFlags.reconstructionMode() == 'collisions')) # hardcode some properties before passing on to base class constructors if optimiseMomentumResolutionUsingChi2: if "ErrorOptimisationTool" not in kwargs: if namePrefix or namePostfix: tool = getPublicToolClone( namePrefix + "MuonErrorOptimisationTool" + namePostfix, "MuonErrorOptimisationTool", extraFlags=extraFlags) else: tool = getPublicTool("MuonErrorOptimisationTool") kwargs["ErrorOptimisationTool"] = tool builder = CfgMgr.Muon__MooTrackBuilder(name, **kwargs) # make clones of some tools if namePrefix (e.g. for TrigMuonEF) or namePostfix (e.g. for FinalFit) is given if namePrefix or namePostfix: oldFitterName = getProperty(builder, "Fitter").getName() newFitterName = namePrefix + oldFitterName + namePostfix builder.Fitter = getPublicToolClone(newFitterName, oldFitterName, extraFlags=extraFlags) oldFitterName = getProperty(builder, "SLFitter").getName() newFitterName = namePrefix + oldFitterName + namePostfix builder.SLFitter = getPublicToolClone(newFitterName, oldFitterName, extraFlags=extraFlags) oldMatchingToolName = getProperty(builder, "CandidateMatchingTool").getName() newMatchingToolName = namePrefix + oldMatchingToolName + namePostfix builder.CandidateMatchingTool = getPublicToolClone( newMatchingToolName, oldMatchingToolName, extraFlags=extraFlags) import MuonCombinedRecExample.CombinedMuonTrackSummary from AthenaCommon.AppMgr import ToolSvc kwargs.setdefault("TrackSummaryTool", ToolSvc.CombinedMuonTrackSummary) return builder
def getMuonSegmentToCalibSegment(): global topSequence, muonRecFlags try: return topSequence.MuonSegmentToCalibSegment except AttributeError: from MuonCalibPatRec.MuonCalibPatRecConf import MuonCalib__MuonSegmentToCalibSegment MuonSegmentToCalibSegment = MuonCalib__MuonSegmentToCalibSegment( "MuonSegmentToCalibSegment") # set consistent time-of-flight correction with MdtDriftCircleOnTrackCreator mdtCreator = getPublicTool("MdtDriftCircleOnTrackCreator") MuonSegmentToCalibSegment.DoTOF = getProperty(mdtCreator, "DoTofCorrection") # when doing segment fits with floating t0's MuonSegmentToCalibSegment.UpdateForT0Shift = type( MuonSegmentToCalibSegment.getDefaultProperty("UpdateForT0Shift"))( muonRecFlags.doSegmentT0Fit()) MuonSegmentToCalibSegment.UseCscSegments = False MuonSegmentToCalibSegment.SegmentLocations = ["MuonSegments"] MuonSegmentToCalibSegment.SegmentAuthors = [4, 8] MuonSegmentToCalibSegment.ReadSegments = True # rather than SegmentCombinations from MuonCnvExample import MuonCalibConfig MuonCalibConfig.setupMdtCondDB() # finally add it to topSequence topSequence += MuonSegmentToCalibSegment return topSequence.MuonSegmentToCalibSegment
def get(self): try: return getProperty(self.configurable, self.property) except AttributeError: # change type of exception to avoid misleading error message raise RuntimeError( "Configurable \'%s\' does not have property \'%s\'" % (self.configurable.__class__.__name__, self.property))
def MooTrackFitter(name="MooTrackFitter", extraFlags=None, **kwargs): namePrefix =getattr(extraFlags,"namePrefix","") namePostfix=getattr(extraFlags,"namePostfix","") kwargs.setdefault("Fitter", "MCTBFitter") kwargs.setdefault("Propagator", "MuonPropagator") kwargs.setdefault("SLFit" , not jobproperties.BField.allToroidOn()) kwargs.setdefault("ReducedChi2Cut", muonStandaloneFlags.Chi2NDofCut()) kwargs.setdefault("FitEtaStrips", True) kwargs.setdefault("SegmentMomentum", "MuonSegmentMomentumFromField") kwargs.setdefault("CleanPhiHits", True) kwargs.setdefault("UsePreciseHits", True) kwargs.setdefault("UsePrefit", False) kwargs.setdefault("SeedAtStartOfTrack", False) if muonStandaloneFlags.reconstructionMode() == 'cosmics': kwargs.setdefault("SeedWithAvePhi", True) kwargs.setdefault("SeedWithSegmentTheta", False) kwargs.setdefault("Cosmics", True) kwargs.setdefault("PreCleaningReducedChi2Cut", 5000) kwargs.setdefault("SegmentMomentum", "MuonSegmentMomentum") # make instance fitter = CfgMgr.Muon__MooTrackFitter(name,**kwargs) # make some clones if needed if namePrefix or namePostfix: oldFitterName = getProperty(fitter,"Fitter").getName() newFitterName = namePrefix + oldFitterName + namePostfix fitter.Fitter = getPublicToolClone(newFitterName,oldFitterName) oldFitterName = getProperty(fitter,"FitterPreFit").getName() newFitterName = namePrefix + oldFitterName + namePostfix fitter.FitterPreFit = getPublicToolClone(newFitterName,oldFitterName) return fitter