diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/DataFiles.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/DataFiles.py deleted file mode 100644 index aff8b39c6fa48bacbf00ea009638abd78aa0aecf..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/DataFiles.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -## @file DataFiles.py A list of standard datasets to choose from when running MuonReco in standalone mode. -# -# Each dataset is identified with a key (the key in the dictionary), and it contains in addition to -# the list of files, the type of file (HITS,RDO,...) and the DetDescrVersion to use. -# A dataset is chosen by setting muonRecFlags.InputData to one of the keys. - -## @namespace python::DataFiles @copydoc DataFiles.py - -## ATLAS-GEO-02-01-00 - -## Zmumu -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/HITS/valid1.105145.PythiaZmumu.simul.HITS.e380_s494_tid040060/ -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.105145.PythiaZmumu.digit.RDO.e380_s494_tid040060/ -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/ESD/valid1.105145.PythiaZmumu.recon.ESD.e380_s494_r702_tid070477 -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/AOD/valid1.105145.PythiaZmumu.recon.AOD.e380_s494_r702_tid070477 - -## ttbar -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.105200.T1_McAtNlo_Jimmy.digit.RDO.e380_s494_tid040030/ - -## ttbar cavBG_2e33SF05 -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.105200.T1_McAtNlo_Jimmy.digit.RDO.e380_s494_d153_tid040636/ - -## H->4l (130 GeV) -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.005300.PythiaH130zz4l.digit.RDO.e322_s461_d156_tid044400/ - -## ZPrime -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.006601.Pythia_ZHuu2000.digit.RDO.e322_s461_d156_tid044407/ - -## mu 10GeV -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.007211.singlepart_mu10.digit.RDO.e322_s461_d156_tid044413/ - -## mu 100 GeV -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.007233.singlepart_mu100.digit.RDO.e322_s461_d156_tid044414/ - -## mu 200 GeV -## /castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.007234.singlepart_mu200.digit.RDO.e322_s461_d156_tid044415/ - - - -from MuonRecExample.MuonRecUtils import DataInfo - -DataFilesInfoMap = { - 'Zmumu' : - DataInfo("root://castoratlas//castor/cern.ch/atlas/atlascerngroupdisk/det-muon/ReferenceDatasets/Digitization/Zmumu_15616/", - 'RDO',maxFiles=10) , - - 'Zmumu_HITS' : - DataInfo('root://castoratlas//castor/cern.ch/grid/atlas/atlasmcdisk/valid1/HITS/valid1.105145.PythiaZmumu.simul.HITS.e380_s559_tid071852/', - 'HITS',maxFiles=10) , - - 'Zmumu_pile1sf5_old' : - DataInfo('root://castoratlas//castor/cern.ch/user/r/rtt/RTTdata/pile1sf05_misal1_csc11.005145.PythiaZmumu.digit.RDO.v12000605/pile1sf05_misal1_csc11.005145.PythiaZmumu.digit.RDO.v12000605_tid008668._[00001-10].pool.root.1', - 'RDO', 'ATLAS-CSC-01-02-00') , - - 'ttbar' : - DataInfo('root://castoratlas//castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.105200.T1_McAtNlo_Jimmy.digit.RDO.e380_s632_tid097896/', - 'RDO',maxFiles=10) , - - 'ttbar cavBG_2e33SF05' : - DataInfo('root://castoratlas//castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.105200.T1_McAtNlo_Jimmy.digit.RDO.e380_s494_d153_tid040636/', - 'RDO', 'ATLAS-GEO-02-01-00',maxFiles=10) , - - - 'H130ZZ4l' : - DataInfo('root://castoratlas//castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.005300.PythiaH130zz4l.digit.RDO.e322_s461_d156_tid044400/', - 'RDO', 'ATLAS-GEO-02-01-00',maxFiles=10) , - - - 'ZPrime' : - DataInfo('root://castoratlas//castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.006601.Pythia_ZHuu2000.digit.RDO.e322_s461_d156_tid044407/', - 'RDO', 'ATLAS-GEO-02-01-00',maxFiles=10) , - - 'p10' : - DataInfo('root://castoratlas//castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.007211.singlepart_mu10.digit.RDO.e322_s461_d156_tid044413/', - 'RDO', 'ATLAS-GEO-02-01-00',maxFiles=10) , - - 'p100' : - DataInfo('root://castoratlas//castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.007233.singlepart_mu100.digit.RDO.e322_s461_d156_tid044414/', - 'RDO', 'ATLAS-GEO-02-01-00',maxFiles=10) , - - 'p200' : - DataInfo('root://castoratlas//castor/cern.ch/grid/atlas/atlasmcdisk/valid1/RDO/valid1.007234.singlepart_mu200.digit.RDO.e322_s461_d156_tid044415/', - 'RDO', 'ATLAS-GEO-02-01-00') , - - - } - diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/Moore.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/Moore.py deleted file mode 100644 index 953f92a75864fabe354cdabad1c281dc776ae4ce..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/Moore.py +++ /dev/null @@ -1,120 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -__doc__ = """Configuration of Moore standalone muon reconstruction""" - -############################################################### -# -# Configuration for Moore -# -#============================================================== - -from AthenaCommon.GlobalFlags import globalflags -from AthenaCommon.BeamFlags import jobproperties -beamFlags = jobproperties.Beam -from AthenaCommon.BFieldFlags import jobproperties -from AthenaCommon import CfgMgr - -from RecExConfig.RecFlags import rec - -from MooreFlags import mooreFlags -from MuonRecFlags import muonRecFlags -from ConfiguredMuonRec import ConfiguredMuonRec - -from AthenaCommon.CfgGetter import getPrivateTool,getPrivateToolClone,getPublicTool,getPublicToolClone,getService,getServiceClone - -from MuonRecUtils import logMuon,ConfiguredBase,ExtraFlags -#============================================================== - -# call setDefaults to update flags -muonRecFlags.setDefaults() -mooreFlags.setDefaults() - - -class Moore(ConfiguredMuonRec): - def __init__(self,**kwargs): - ConfiguredMuonRec.__init__(self,"Moore",**kwargs) - # setup minimum config needed to get Storegate keys - # full setup is done in configure() - - # keys for segment building stage - self.addOutputKey("PhiPatterns" , "MuonCleanPhiPatterns") # hardcoded in C++ - self.addOutputKey("CscSegments" , "Csc4dSegmentCombinations") # C++ default - self.addOutputKey("MuonPatterns", "MuonHoughPatternCombinations") # C++ default - self.addOutputKey("MuonSegmentCombinations", "MooreSegmentCombinations") # C++ default - self.addOutputKey("MuonSegmentCombinationsForCalibration" , "MdtSegmentCombinations") # C++ default - self.addOutputKey("MuonSegments" , "MooreSegments") # C++ default - # keys for tracks building stage - self.addOutputKey("MuonTrackParticles" , "MooreTrackParticles") # C++ default - self.addOutputKey("MuonTracks" , "MooreTracks") # C++ default - - - def configure(self,keys=None): - super(Moore,self).configure(keys) - if not self.isEnabled(): return - # - # Segment builder - # - self.addAlg( CfgMgr.MooSegmentFinderAlg( "MooSegmentMaker", - SegmentFinder = getPublicTool("MooSegmentFinder"), - UseCSC = muonRecFlags.doCSCs(), - UseMDT = muonRecFlags.doMDTs(), - UseRPC = muonRecFlags.doRPCs(), - UseTGC = muonRecFlags.doTGCs(), - UseTGCPriorBC = muonRecFlags.doTGCs() and muonRecFlags.useTGCPriorNextBC(), - UseTGCNextBC = muonRecFlags.doTGCs() and muonRecFlags.useTGCPriorNextBC() )) - - # register some data keys, so configurable properties get updated - # intermediate results of tool - SegmentFinderTool = self.MooSegmentMaker.SegmentFinder # shortcut - self.registerOutputKey("MuonPatterns" ,self.MooSegmentMaker,"MuonPatternCombinationLocation") - self.registerOutputKey("CscSegments" ,SegmentFinderTool,"Csc4dSegmentCombinationLocation") - self.registerOutputKey("MuonSegmentCombinationsForCalibration",SegmentFinderTool,"MdtSegmentCombinationLocation") - # final result of alg - self.registerOutputKey("MuonSegmentCombinations", self.MooSegmentMaker, "MuonSegmentCombinationOutputLocation") - self.registerOutputKey("MuonSegments", self.MooSegmentMaker, "MuonSegmentOutputLocation") - - # - # Tracks builder - # - if not mooreFlags.doSegmentsOnly(): - # run Moore with the new steering algorithm - if mooreFlags.doNewMoore(): - # new Moore Algorithm - TrackSteeringTool = getPublicTool("MooreTrackSteering") - TrackBuilder = CfgMgr.MuPatTrackBuilder("MuonCombiTrackBuilder", TrackSteering = TrackSteeringTool) - self.addAlg( TrackBuilder ) - - self.registerInputKey ("MuonSegments", self.MuonCombiTrackBuilder, "MuonSegmentCollection" ) - self.registerOutputKey("MuonTracks", self.MuonCombiTrackBuilder, "SpectrometerTrackOutputLocation") - - else: - TrackSteeringTool = getPublicTool("MooTrackSteering") - self.addAlg( CfgMgr.MuonCombiTrackBuilder("MuonCombiTrackBuilder", TrackSteering = TrackSteeringTool) ) - self.registerInputKey ("MuonSegmentCombinations", self.MuonCombiTrackBuilder, "MuonSegmentCombinationInputLocation" ) - self.registerOutputKey("MuonTracks", self.MuonCombiTrackBuilder, "TrackOutputLocation") - - - - - - def getCalibConfig(self): - """Get the configuration to configure Calibration Ntuple output""" - doTracks = not mooreFlags.doSegmentsOnly() - if doTracks: - tracksKey = self.dataKey("MuonTracks") - else: - tracksKey = "" - - return { 'eventTag' : "Moore", - 'patternsKey' : self.dataKey("MuonPatterns"), - 'segmentsKey' : self.dataKey("MuonSegments"), - 'tracksKey' : tracksKey, - 'doPhi' : True, - 'segmentAuthor' : 4, - 'trackAuthor' : 0 } - - - - - - diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreFlags.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreFlags.py deleted file mode 100644 index fb019ad336a589af26976b7290e25f99e70ad106..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreFlags.py +++ /dev/null @@ -1,152 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -## @file MooreFlags.py Flags for configuring the %Moore muon reconstruction algorithm - -## @namespace python::MooreFlags @copydoc MooreFlags.py - - -from AthenaCommon.JobProperties import JobProperty,JobPropertyContainer,jobproperties -from MuonRecExample.MuonRecUtils import fillJobPropertyContainer -from AthenaCommon import BeamFlags -from AthenaCommon.GlobalFlags import globalflags - -# shortCut -beamFlags = jobproperties.Beam - -## Print out a summary for each event at each reco stage -class printSummary(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -class addEndcapMiddleSingleStationTracks(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=True - -class materialSourcePatRec(JobProperty): - statusOn=True - allowedTypes=['str'] - StoredValue="TGMat" - -class materialSourceFinalFit(JobProperty): - statusOn=True - allowedTypes=['str'] - StoredValue="TGMat" - -class useSegmentMatching(JobProperty) : - statusOn=True - allowedTypes=['bool'] - StoredValue=True - -class useTrackSegmentMatching(JobProperty) : - statusOn=True - allowedTypes=['bool'] - StoredValue=True - -class optimiseMomentumResolutionUsingChi2(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -class straightLineFitMomentum(JobProperty): - statusOn=True - allowedTypes=['float'] - StoredValue=5000.0 - -## stop reconstruction at segment level -class doSegmentsOnly(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## stop reconstruction at segment level -class updateSegmentSecondCoordinate(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=True - -## stop reconstruction at segment level -class rescaleCscClustersInTrackFinding(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## stop reconstruction at segment level -class useNewSteering(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=True - -## chi-squared per degree of freedom cut in fitter. -class Chi2NDofCut(JobProperty): - statusOn=True - allowedTypes=['float'] - StoredValue=20. - -## flag to turn on curved segment finding -class enableCurvedSegmentFinding(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - - -## flag to enable new Moore -class doNewMoore(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## track building strategy (only for New Moore) -# Default value copied on (30-01-2012) from MuonStandaloneFlags.MoorelikeStrategy to make it independent from 3rd chain -class strategy(JobProperty): - """ Allowed options for the strategy currently are: - CutSeedsOnTracks - CombineSegInStation - DynamicSeeding - PreferOutsideIn - AllowOneSharedHit - DoRefinement - DoAmbiSolving - """ - statusOn=True - allowedTypes=['list'] - StoredValue=[ - "BarrelCombined[CombineSegInStation,DoRefinement,DoAmbiSolving,CutSeedsOnTracks]:BML,BMS;BOL,BOS;BIL,BIS", - "EndcapCombined[CombineSegInStation,DoRefinement,DoAmbiSolving,CutSeedsOnTracks]:EML,EMS;EOL,EOS;EIL,EIS;CSL,CSS;EEL,EES;BEE", - "BarrelEndcap[CombineSegInStation,DoRefinement,DoAmbiSolving,CutSeedsOnTracks]:EML,EMS;BIL,BIS", - "EMandEE[CombineSegInStation,DoRefinement,DoAmbiSolving,CutSeedsOnTracks]:EML,EMS;EEL,EES"] - - -## Container with Configuration flags of %Moore reconstruction -class Moore(JobPropertyContainer): - ##set defaults of the flags depending on type of input (MC, data, cosmics etc.) - def setDefaults(self): - from MuonRecUtils import setJobPropertyDefault as setDefault - global beamFlags - setDefault(self.Chi2NDofCut,20.0) - setDefault(self.straightLineFitMomentum,2000.0) - if beamFlags.beamType()=='cosmics' or beamFlags.beamType()=='singlebeam': - setDefault(self.addEndcapMiddleSingleStationTracks,False) - setDefault(self.useSegmentMatching,False) - setDefault(self.updateSegmentSecondCoordinate,False) - else: - setDefault(self.addEndcapMiddleSingleStationTracks,True) - setDefault(self.straightLineFitMomentum,2000.0) - setDefault(self.useSegmentMatching,True) - setDefault(self.updateSegmentSecondCoordinate,True) - - - - -# add moore flags to container -jobproperties.add_Container(Moore) - -## shortcut to access flags -mooreFlags = jobproperties.Moore - -# add all properties in this module -fillJobPropertyContainer(mooreFlags,__name__) - -# set defaults for container -mooreFlags.setDefaults() diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py index 6daf51b328fdb90918339af722c8e7ebf52f83d7..a104055823cb794497f86647b3f36c825d76bce3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py @@ -31,14 +31,13 @@ from MuonRecTools import MuonExtrapolator, MuonChi2TrackFitter, MdtDriftCircleOn from MuonRecUtils import logMuon,ConfiguredBase,ExtraFlags -from MooreFlags import mooreFlags from MuonRecFlags import muonRecFlags from MuonStandaloneFlags import muonStandaloneFlags #============================================================== # call setDefaults to update flags muonRecFlags.setDefaults() -mooreFlags.setDefaults() +muonStandaloneFlags.setDefaults() # # Tools for Moore SegmentMaking @@ -58,13 +57,12 @@ def MuonPatternSegmentMaker(name="MuonPatternSegmentMaker",extraFlags=None,**kwa if doSegmentT0Fit: mdtCreator = getPublicToolClone( "MdtDriftCircleOnTrackCreatorSegmentFinding", "MdtDriftCircleOnTrackCreator", CreateTubeHit = False, TimeWindowSetting = mdtCalibWindowNumber('Collision_t0fit') ) - print "CONFIGMuonPatternSegmentMaker: doT0fit?!?!" else: mdtCreator = getPublicToolClone( "MdtDriftCircleOnTrackCreatorSegmentFinding", "MdtDriftCircleOnTrackCreator", CreateTubeHit = False, TimeWindowSetting = mdtCalibWindowNumber('Collision_data') ) kwargs["MdtCreator"] = mdtCreator - if beamType == 'cosmics' or muonRecFlags.forceCollisionsMode(): + if beamType == 'cosmics': kwargs.setdefault("AngleCutPhi", 1e9) kwargs.setdefault("DropDistance", 100000000.) @@ -76,27 +74,24 @@ class MuonCurvedSegmentCombiner(CfgMgr.Muon__MuonCurvedSegmentCombiner,Configure __slots__ = () def __init__(self,name="MuonCurvedSegmentCombiner",**kwargs): self.applyUserDefaults(kwargs,name) - super(MuonCurvedSegmentCombiner,self).__init__(name,**kwargs) - -MuonCurvedSegmentCombiner.setDefaultProperties( - MissedHitsCut = 4, - AddAll2DCscs = False, - UseCscSegments = muonRecFlags.doCSCs()) -if (beamFlags.beamType() == 'singlebeam' or beamFlags.beamType() == 'cosmics') and not muonRecFlags.forceCollisionsMode(): - MuonCurvedSegmentCombiner.setDefaultProperties( - DoCosmics = True, - MissedHitsCut = 100) -elif globalflags.DataSource() == 'data' or muonRecFlags.forceDataMode(): #collisions-data or simulation first data - MuonCurvedSegmentCombiner.setDefaultProperties( - DoCosmics = False, - MissedHitsCut = 100) + if (beamFlags.beamType() == 'singlebeam' or beamFlags.beamType() == 'cosmics'): + kwargs.setdefault( "MissedHitsCut", 100 ) + kwargs.setdefault( "AddUnassociatedMiddleEndcapSegments", False ) + elif globalflags.DataSource() == 'data': #collisions-data or simulation first data + kwargs.setdefault( "MissedHitsCut", 100 ) + else: + kwargs.setdefault( "MissedHitsCut", 4 ) + + kwargs.setdefault("DoCosmics", muonStandaloneFlags.reconstructionMode() != 'collisions' ) + kwargs.setdefault( "AddAll2DCscs", False ) + kwargs.setdefault( "UseCscSegments", muonRecFlags.doCSCs() ) + kwargs.setdefault( "AddUnassociatedMiddleEndcapSegments", True ) + + super(MuonCurvedSegmentCombiner,self).__init__(name,**kwargs) # end of class MuonCurvedSegmentCombiner -if mooreFlags.addEndcapMiddleSingleStationTracks(): - MuonCurvedSegmentCombiner.setDefaultProperties( - AddUnassociatedMiddleEndcapSegments = True ) # the segment making supertool @@ -107,7 +102,7 @@ class MooSegmentCombinationFinder(CfgMgr.Muon__MooSegmentCombinationFinder,Confi kwargs.setdefault( "SegmentCombiner", "MuonCurvedSegmentCombiner" ) kwargs.setdefault( "SegmentCombinationCleaner", "MuonSegmentCombinationCleanerTool" ) - if( beamFlags.beamType() != 'cosmics' and beamFlags.beamType() != 'singlebeam'): + if( muonStandaloneFlags.reconstructionMode() == 'collisions'): kwargs.setdefault( "HoughPatternFinder", "MuonLayerHoughTool" ) else: kwargs.setdefault( "HoughPatternFinder", "MuonHoughPatternFinderTool" ) @@ -142,7 +137,7 @@ def MooCandidateMatchingTool(name,extraFlags=None,**kwargs): namePrefix =getattr(extraFlags,"namePrefix","") namePostfix=getattr(extraFlags,"namePostfix","") doSegmentPhiMatching = getattr(extraFlags,"doSegmentPhiMatching",None) - useTrackSegmentMatching = getattr(extraFlags,"useTrackSegmentMatching",mooreFlags.useTrackSegmentMatching()) + useTrackSegmentMatching = getattr(extraFlags,"useTrackSegmentMatching",muonStandaloneFlags.useTrackSegmentMatching()) # segment-segment matching if doSegmentPhiMatching is not None: if not (namePrefix or namePostfix): @@ -160,21 +155,19 @@ def MooCandidateMatchingTool(name,extraFlags=None,**kwargs): # track-segment matching kwargs.setdefault("DoTrackSegmentMatching", useTrackSegmentMatching) - if (beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam') and not muonRecFlags.forceCollisionsMode(): - kwargs.setdefault("RequireSameSide", True) + kwargs.setdefault("RequireSameSide", muonStandaloneFlags.reconstructionMode() != "collisions") - if globalflags.DataSource() == 'data' or muonRecFlags.forceDataMode(): - if muonRecFlags.useAlignmentCorrections(): - kwargs.setdefault("AlignmentErrorPosX", 5.0) - kwargs.setdefault("AlignmentErrorPosY", 0.2) - kwargs.setdefault("AlignmentErrorAngleX", 0.002) - kwargs.setdefault("AlignmentErrorAngleY", 0.001) + if muonRecFlags.useAlignmentCorrections(): + kwargs.setdefault("AlignmentErrorPosX", 5.0) + kwargs.setdefault("AlignmentErrorPosY", 0.2) + kwargs.setdefault("AlignmentErrorAngleX", 0.002) + kwargs.setdefault("AlignmentErrorAngleY", 0.001) - else: # no alignment corrections - kwargs.setdefault("AlignmentErrorPosX", 10.0) - kwargs.setdefault("AlignmentErrorPosY", 5.0) - kwargs.setdefault("AlignmentErrorAngleX", 0.004) - kwargs.setdefault("AlignmentErrorAngleY", 0.002) + else: # no alignment corrections + kwargs.setdefault("AlignmentErrorPosX", 10.0) + kwargs.setdefault("AlignmentErrorPosY", 5.0) + kwargs.setdefault("AlignmentErrorAngleX", 0.004) + kwargs.setdefault("AlignmentErrorAngleY", 0.002) return CfgMgr.Muon__MooCandidateMatchingTool(name,**kwargs) @@ -185,12 +178,11 @@ def MooTrackFitter(name="MooTrackFitter", extraFlags=None, **kwargs): namePrefix =getattr(extraFlags,"namePrefix","") namePostfix=getattr(extraFlags,"namePostfix","") - materialSource=getattr(extraFlags,"materialSource",mooreFlags.materialSourcePatRec()) kwargs.setdefault("Fitter", "MCTBFitter") kwargs.setdefault("Propagator", "MuonPropagator") kwargs.setdefault("SLFit" , not jobproperties.BField.allToroidOn()) - kwargs.setdefault("ReducedChi2Cut", mooreFlags.Chi2NDofCut()) + kwargs.setdefault("ReducedChi2Cut", muonStandaloneFlags.Chi2NDofCut()) kwargs.setdefault("FitEtaStrips", True) kwargs.setdefault("SegmentMomentum", "MuonSegmentMomentumFromField") kwargs.setdefault("CleanPhiHits", True) @@ -198,7 +190,7 @@ def MooTrackFitter(name="MooTrackFitter", extraFlags=None, **kwargs): kwargs.setdefault("UsePrefit", False) kwargs.setdefault("SeedAtStartOfTrack", False) - if (beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam') and not muonRecFlags.forceCollisionsMode() : + if muonStandaloneFlags.reconstructionMode() == 'cosmics': kwargs.setdefault("SeedWithAvePhi", True) kwargs.setdefault("SeedWithSegmentTheta", False) kwargs.setdefault("Cosmics", True) @@ -212,11 +204,11 @@ def MooTrackFitter(name="MooTrackFitter", extraFlags=None, **kwargs): if namePrefix or namePostfix: oldFitterName = getProperty(fitter,"Fitter").getName() newFitterName = namePrefix + oldFitterName + namePostfix - fitter.Fitter = getPublicToolClone(newFitterName,oldFitterName,materialSource=materialSource) + fitter.Fitter = getPublicToolClone(newFitterName,oldFitterName) oldFitterName = getProperty(fitter,"FitterPreFit").getName() newFitterName = namePrefix + oldFitterName + namePostfix - fitter.FitterPreFit = getPublicToolClone(newFitterName,oldFitterName,materialSource=materialSource) + fitter.FitterPreFit = getPublicToolClone(newFitterName,oldFitterName) return fitter @@ -230,14 +222,11 @@ def MooTrackBuilder(name="MooTrackBuilderTemplate", namePrefix =getattr(extraFlags,"namePrefix","") namePostfix=getattr(extraFlags,"namePostfix","") - optimiseMomentumResolutionUsingChi2=getattr(extraFlags,"optimiseMomentumResolutionUsingChi2",mooreFlags.optimiseMomentumResolutionUsingChi2()) + optimiseMomentumResolutionUsingChi2=getattr(extraFlags,"optimiseMomentumResolutionUsingChi2",False) kwargs.setdefault("Fitter", "MooTrackFitter") kwargs.setdefault("SLFitter", "MooSLTrackFitter") - if muonRecFlags.doSegmentT0Fit() and beamFlags.beamType() == 'cosmics' : - kwargs.setdefault("RecalibrateMDTHitsOnTrack", False) - else: - kwargs.setdefault("RecalibrateMDTHitsOnTrack", True) + kwargs.setdefault("RecalibrateMDTHitsOnTrack", ( (not muonRecFlags.doSegmentT0Fit()) and muonStandaloneFlags.reconstructionMode() == 'collisions') ) # hardcode some properties before passing on to base class constructors if optimiseMomentumResolutionUsingChi2: @@ -269,122 +258,6 @@ def MooTrackBuilder(name="MooTrackBuilderTemplate", # end of factory function MooTrackBuilder -def MooTrackSteering(name="MooTrackSteering", - extraFlags=None, - **kwargs): - - # take defaults for extra args from MooreFlags - namePrefix = getattr(extraFlags,"namePrefix", "") - beamType = getattr(extraFlags,"beamType", beamFlags.beamType()) - doSegmentT0Fit = getattr(extraFlags,"doSegmentT0Fit", muonRecFlags.doSegmentT0Fit()) - - optimiseMomentumResolutionUsingChi2 = getattr(extraFlags,"optimiseMomentumResolutionUsingChi2", - mooreFlags.optimiseMomentumResolutionUsingChi2() or doSegmentT0Fit) - materialSourcePatRec = getattr(extraFlags,"materialSourcePatRec", mooreFlags.materialSourcePatRec()) - materialSourceFinalFit = getattr(extraFlags,"materialSourceFinalFit", mooreFlags.materialSourceFinalFit()) - - kwargs.setdefault("AmbiguityTool", "MuonAmbiProcessor") - kwargs.setdefault("EntryMatchingTool", "MooCandidateMatchingTool") - kwargs.setdefault("Propagator", "MCTBPropagator") - kwargs.setdefault("FindingMode", 2) - kwargs.setdefault("UseAllPhiHits", True) - kwargs.setdefault("ExtrapolateToMuonEntry", True) - kwargs.setdefault("ResolveAmbiguities", True) - kwargs.setdefault("CleanUpSeeds", True) - kwargs.setdefault("CleanUpCandidates", True) - kwargs.setdefault("HoleRecoveryTool", "MuonEORecoveryTool") - - if mooreFlags.addEndcapMiddleSingleStationTracks(): - kwargs.setdefault("AddUnassociatedMiddleEndcapSegments", True) - - if mooreFlags.printSummary(): - kwargs.setdefault("DoSummary", True) - - if beamType == 'collisions' or muonRecFlags.forceCollisionsMode() : - kwargs.setdefault("TrackExtrapolationTool",None) - else: # cosmics or single beam - kwargs.setdefault("TrackExtrapolationTool", "MuonTrackExtrapolationTool") - kwargs.setdefault("MaximumNumberOfAmbiguitiesPerCombi", 500) - kwargs.setdefault("MaximumNumberOfCombisPerEvent", 5) - kwargs.setdefault("MaximumNumberOfSeedsPerCombi", 10) - kwargs.setdefault("MaximumNumberOfCandidatesPerSeed", 30) - kwargs.setdefault("RetryAllChamberLayers", True) - kwargs.setdefault("SplitTracksCrossingCalo", True) - - if doSegmentT0Fit: - kwargs.setdefault("RecalibrateMDTHits", False) - - if extraFlags is not None: - fitterFlags = copy.deepcopy(extraFlags) - else: - fitterFlags = ExtraFlags() - # use separate fitter if material different - if materialSourcePatRec != materialSourceFinalFit: - if "TrackBuilder" not in kwargs: - fitterFlags.materialSource = materialSourcePatRec - fitter = getPublicToolClone(namePrefix+"MooTrackBuilder", "MooTrackBuilderTemplate", - extraFlags=fitterFlags) - kwargs["TrackBuilder"] = fitter - - if "TrackBuilderFinalFit" not in kwargs: - fitterFlags.materialSource = materialSourceFinalFit - fitterFlags.namePostfix="FinalFit" - fitter = getPublicToolClone(namePrefix+"MooTrackBuilderFinalFit", "MooTrackBuilderTemplate", - extraFlags=fitterFlags) - - kwargs["TrackBuilderFinalFit"] = fitter - - else: # same materialSource - if "TrackBuilder" not in kwargs or "TrackBuilderFinalFit" not in kwargs: - fitterFlags.materialSource = materialSourcePatRec - fitter = getPublicToolClone(namePrefix+"MooTrackBuilder", "MooTrackBuilderTemplate", - extraFlags=fitterFlags) - - kwargs.setdefault("TrackBuilder", fitter) - kwargs.setdefault("TrackBuilderFinalFit", fitter) - - return CfgMgr.Muon__MooTrackSteering(name,**kwargs) - -# end of factory function MooTrackSteering - - -## Moore-only configuration version of MuonStandalone.MuonTrackSteering -def MooreTrackSteering(name="MooreTrackSteering", extraFlags=None, **kwargs): - if extraFlags is None: - extraFlags = ExtraFlags() - - extraFlags.setFlagDefault("doSegmentPhiMatching", True) - extraFlags.setFlagDefault("materialSource",mooreFlags.materialSourcePatRec) - extraFlags.setFlagDefault(mooreFlags.optimiseMomentumResolutionUsingChi2) - extraFlags.setFlagDefault(mooreFlags.printSummary) - extraFlags.setFlagDefault(mooreFlags.strategy) - - kwargs.setdefault("StrategyList", extraFlags.strategy) - kwargs.setdefault("DoSummary", extraFlags.printSummary) - - kwargs.setdefault("OutputSingleStationTracks", True) - - if "TrackBuilderTool" not in kwargs: - extraFlags.setFlagDefault('UseTrackingHistory',True) - kwargs["TrackBuilderTool"] = getPublicToolClone("MooreTrackBuilder", "MooTrackBuilderTemplate", - extraFlags=extraFlags) - if "TrackRefinementTool" not in kwargs: - kwargs["TrackRefinementTool"] = getPublicToolClone("MooreTrackRefiner","MooTrackBuilderTemplate") - - - kwargs.setdefault("SegSeedQCut", 2) - kwargs.setdefault("Seg2ndQCut", 1) - - return CfgMgr.Muon__MuonTrackSteering(name,**kwargs) - - - - - -# -# End of Moore track finding tools -# - # @@ -394,19 +267,19 @@ class MuonSegmentSelectionTool(CfgMgr.Muon__MuonSegmentSelectionTool,ConfiguredB __slots__ = () def __init__(self,name="MuonSegmentSelectionTool",**kwargs): self.applyUserDefaults(kwargs,name) + if globalflags.DataSource() == 'data': #collisions-data or simulation first data + kwargs.setdefault("GoodADCFractionCut", 0.5 ) + kwargs.setdefault("MinADCPerSegmentCut", 100 ) super(MuonSegmentSelectionTool,self).__init__(name,**kwargs) - -if globalflags.DataSource() == 'data': #collisions-data or simulation first data - MuonSegmentSelectionTool.setDefaultProperties( GoodADCFractionCut = 0.5, MinADCPerSegmentCut=100 ) class MuonSegmentMatchingTool(CfgMgr.Muon__MuonSegmentMatchingTool): __slots__ = () def __init__(self,name='MuonSegmentMatchingTool',**kwargs): - kwargs.setdefault( "doThetaMatching", mooreFlags.useSegmentMatching() ) + kwargs.setdefault( "doThetaMatching", muonStandaloneFlags.useSegmentMatching() ) kwargs.setdefault( "doPhiMatching", False ) - if beamFlags.beamType() == 'cosmics' and not muonRecFlags.forceCollisionsMode(): + if beamFlags.beamType() == 'cosmics': # switch off cut of phi hit pulls kwargs.setdefault("OverlapMatchAveragePhiHitPullCut", 200. ) @@ -424,43 +297,23 @@ def MCTBExtrapolator(name='MCTBExtrapolator',**kwargs): # end of factory function MCTBExtrapolator -def MCTBFitter(name="MCTBFitter", materialSource=None, **kwargs): - if materialSource is None: materialSource = mooreFlags.materialSourcePatRec() - +def MCTBFitter(name="MCTBFitter", **kwargs): kwargs.setdefault("ExtrapolationTool", "MCTBExtrapolator") kwargs.setdefault("GetMaterialFromTrack", True) - - # setup track fitters to be used during track finding - if( materialSource == "MBoy" ): - #kwargs.setdefault("MboyMat", True) - #kwargs.setdefault("ExtrapolatorMaterial", False) - raise RuntimeError("Muonboy material no longer supported") - - elif( materialSource == "TGMat" ): - #kwargs.setdefault("MboyMat", False) - #kwargs.setdefault("ExtrapolatorMaterial", True) - pass - - elif( materialSource == "TGBlended" ): - #kwargs.setdefault("MboyMat", False) - #kwargs.setdefault("ExtrapolatorMaterial", True) - kwargs.setdefault("ExtrapolationTool", "MCTBExtrapolatorBlendedMat") - else: - raise RuntimeError("Unknown materialSource %r for MCTBFitter(%r)" % (materialSource,name) ) return MuonChi2TrackFitter(name,**kwargs) # end of MCTBFitter() -def MCTBSLFitter(name="MCTBFitter", materialSource=None, **kwargs): +def MCTBSLFitter(name="MCTBSLFitter", **kwargs): kwargs["StraightLine"] = True # always set - kwargs.setdefault("Momentum", mooreFlags.straightLineFitMomentum()) #only set if not yet set - return MCTBFitter(name, materialSource=materialSource, **kwargs) + kwargs.setdefault("Momentum", muonStandaloneFlags.straightLineFitMomentum()) #only set if not yet set + return MCTBFitter(name, **kwargs) def MuonSeededSegmentFinder(name="MuonSeededSegmentFinder",**kwargs): if "SegmentMaker" not in kwargs or "SegmentMakerNoHoles" not in kwargs: - if beamFlags.beamType() == 'collisions' or muonRecFlags.forceCollisionsMode(): + if beamFlags.beamType() == 'collisions': segMaker = getPublicToolClone("MCTBDCMathSegmentMaker", "DCMathSegmentMaker", MdtSegmentFinder = "MCTBMdtMathSegmentFinder", SinAngleCut = 0.04, DoGeometry = True ) @@ -512,7 +365,7 @@ class MuonTrackCleaner(CfgMgr.Muon__MuonTrackCleaner,ConfiguredBase): getPublicTool("ResidualPullCalculator") -MuonTrackCleaner.setDefaultProperties( Chi2Cut = mooreFlags.Chi2NDofCut(), +MuonTrackCleaner.setDefaultProperties( Chi2Cut = muonStandaloneFlags.Chi2NDofCut(), MaxAvePullSumPerChamber = 6 ) # end of class MuonTrackCleaner @@ -593,13 +446,11 @@ class MuonTrackSelectorTool(CfgMgr.Muon__MuonTrackSelectorTool,ConfiguredBase): self.applyUserDefaults(kwargs,name) super(MuonTrackSelectorTool,self).__init__(name,**kwargs) -if beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam' or globalflags.DataSource() == 'data' \ - or muonRecFlags.forceDataMode(): +if beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam' or globalflags.DataSource() == 'data' : MuonTrackSelectorTool.setDefaultProperties( UseRPCHoles = False, UseTGCHoles = False ) -if beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam' or globalflags.DataSource() == 'data' \ - or muonRecFlags.forceDataMode(): +if beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam' or globalflags.DataSource() == 'data': MuonTrackSelectorTool.setDefaultProperties( MaxMdtHolesOnTwoStationTrack = 10, MaxMdtHolesOnTrack = 30, @@ -619,7 +470,7 @@ class MuonTrackExtrapolationTool(CfgMgr.Muon__MuonTrackExtrapolationTool,Configu super(MuonTrackExtrapolationTool,self).__init__(name,**kwargs) MuonTrackExtrapolationTool.setDefaultProperties( TrackingGeometrySvc=ServiceMgr.AtlasTrackingGeometrySvc ) -if beamFlags.beamType() == 'cosmics' and not muonRecFlags.forceCollisionsMode(): +if beamFlags.beamType() == 'cosmics': MuonTrackExtrapolationTool.setDefaultProperties( Cosmics = True ) # end of class MuonTrackExtrapolationTool diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuPatTools.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuPatTools.py index 902d3259a2d5410ade357a7283d8550d2963bae3..18c6af537e434977fce6523e70d43a0e553d0225 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuPatTools.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuPatTools.py @@ -17,7 +17,6 @@ from AthenaCommon import CfgMgr from RecExConfig.RecFlags import rec -from MooreFlags import mooreFlags from MuonRecFlags import muonRecFlags from MuonStandaloneFlags import muonStandaloneFlags @@ -29,7 +28,6 @@ from AthenaCommon.CfgGetter import getPrivateTool,getPrivateToolClone,getPublicT # call setDefaults to update flags muonRecFlags.setDefaults() -mooreFlags.setDefaults() class MuPatCandidateTool(CfgMgr.Muon__MuPatCandidateTool,ConfiguredBase): __slots__ = () @@ -37,14 +35,8 @@ class MuPatCandidateTool(CfgMgr.Muon__MuPatCandidateTool,ConfiguredBase): def __init__(self,name='MuPatCandidateTool',**kwargs): self.applyUserDefaults(kwargs,name) super(MuPatCandidateTool,self).__init__(name,**kwargs) -if muonStandaloneFlags.trackBuilder == 'Muonboy': - MuPatCandidateTool.setDefaultProperties( SegmentExtender = "MboyMuonTrackBuilder" ) -else: - MuPatCandidateTool.setDefaultProperties( SegmentExtender = "" ) +MuPatCandidateTool.setDefaultProperties( SegmentExtender = "" ) -if (globalflags.DataSource() == 'data' or muonRecFlags.forceDataMode()) and mooreFlags.rescaleCscClustersInTrackFinding(): - MuPatCandidateTool.setDefaultProperties( DoCscRecreation = True, - CscRotCreator = "CscBroadClusterOnTrackCreator" ) class MuPatHitTool(CfgMgr.Muon__MuPatHitTool,ConfiguredBase): diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonCBNTFlags.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonCBNTFlags.py deleted file mode 100644 index 2a428097800be7e0209c5c3cf872e2e6b7c73e94..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonCBNTFlags.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -## @file MuonCBNTFlags.py Flags to steer Ntuple Filling of Muon Reconstruction - -## @namespace python::MuonCBNTFlags @copydoc MuonCBNTFlags.py - -from AthenaCommon.JobProperties import JobProperty,JobPropertyContainer,jobproperties -from AthenaCommon.Logging import logging -from AthenaCommon.GlobalFlags import globalflags -from RecExConfig.RecFlags import rec as recFlags -from MuonRecExample.MuonRecFlags import muonRecFlags -from MuonRecExample.MuonRecUtils import logMuon,RecConfigInfo,AutoLoadContainerJobProperty,\ - AutoLoadContainer,fillJobPropertyContainer - -import copy - - -## Add MDTs Raw Info (RDO,PRD) to Ntuple -class doMdtRaw(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## Add RPCs Raw Info (RDO,PRD) to Ntuple -class doRpcRaw(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## Add TGCs Raw Info (RDO,PRD) to Ntuple -class doTgcRaw(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## Add CSCs Raw Info (RDO,PRD) to Ntuple -class doCscRaw(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## Add Moore reconstruction Info to Ntuple -class doMoore(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## Add Muonboy reconstruction Info to Ntuple -class doMuonboy(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - - -## Container with flags to steer ntuple filling -class MuonCBNT(JobPropertyContainer): - def setDefaults(self): - global muonRecFlags,recFlags - from MuonRecUtils import setJobPropertyDefault as setDefault - muonRecFlags.setDefaults() - setDefault(self.doMdtRaw , False) - setDefault(self.doRpcRaw , globalflags.DataSource == 'data') - setDefault(self.doTgcRaw , False) - setDefault(self.doCscRaw , False) - setDefault(self.doMuonboy, False) - setDefault(self.doMoore , False) - - - - -jobproperties.add_Container(MuonCBNT) - -## shortcut to access flags -muonCBNT = jobproperties.MuonCBNT - -# fill properties in container and store for later use (due to lack of iterator) -fillJobPropertyContainer(muonCBNT,__name__) - -muonCBNT.setDefaults() diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonCalibConfig.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonCalibConfig.py index b3391103e39d972e5f3f112b1ed322800590a048..3dfcc35002ad7657a8d259ee131ac92e87b1b914 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonCalibConfig.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonCalibConfig.py @@ -30,27 +30,9 @@ muonRecFlags.setDefaults() topSequence = AlgSequence() # return a list of dictionaires containing the calib config info (keys etc) -# Each dictionary is typically returned by muonRec.Moore.getCalibConfig() and muonRec.Muonboy.getCalibConfig() def getCalibConfigs(): global muonRecFlags,rec configs = [] - if muonRecFlags.calibMoore and (muonRecFlags.doMoore or rec.readESD): - try: - configs.append( muonRec.getConfig("Moore").getCalibConfig() ) - except KeyError: - logMuon.warning("Could not get calibration config for Moore - not adding Moore info to calibration") - muonRecFlags.calibMoore = False - else: - muonRecFlags.calibMoore = False - - if muonRecFlags.calibMuonboy and (muonRecFlags.doMuonboy or rec.readESD): - try: - configs.append( muonRec.getConfig("Muonboy").getCalibConfig() ) - except KeyError: - logMuon.warning("Could not get calibration config for Muonboy - not adding Muonboy info to calibration") - muonRecFlags.calibMuonboy = False - else: - muonRecFlags.calibMuonboy = False if muonRecFlags.calibMuonStandalone and (muonRecFlags.doStandalone or rec.readESD): # try: configs.append( muonRec.getConfig("MuonStandalone").getCalibConfig() ) @@ -79,7 +61,6 @@ def getMuonSegmentToCalibSegment(): MuonSegmentToCalibSegment.DoTOF = getProperty(mdtCreator,"DoTofCorrection") # when doing segment fits with floating t0's MuonSegmentToCalibSegment.UpdateForT0Shift = type(MuonSegmentToCalibSegment.getDefaultProperty("UpdateForT0Shift")) (muonRecFlags.doSegmentT0Fit()) - # only do CSC segments if Moore is running and CSCs are on MuonSegmentToCalibSegment.UseCscSegments = False MuonSegmentToCalibSegment.SegmentLocations = [ "MuonSegments" ] MuonSegmentToCalibSegment.SegmentAuthors = [ 4,8 ] @@ -132,13 +113,12 @@ def setupMuonCalibNtuple(): try: configs = getCalibConfigs() # MuonSegmentToCalibSegment is only needed if we want segments - if muonRecFlags.calibNtupleSegments and (muonRecFlags.calibMoore or muonRecFlags.calibMuonboy or muonRecFlags.calibMuonStandalone): + if muonRecFlags.calibNtupleSegments and muonRecFlags.calibMuonStandalone: MuonSegmentToCalibSegment = getMuonSegmentToCalibSegment() # MuonCalibAlg is always needed eventTag="UNKNOWN" - if (muonRecFlags.calibNtupleSegments or muonRecFlags.calibNtupleTracks) and \ - (muonRecFlags.calibMoore or muonRecFlags.calibMuonboy): + if (muonRecFlags.calibNtupleSegments or muonRecFlags.calibNtupleTracks) and muonRecFlags.calibMuonStandalone: if len(configs) >= 1: eventTag = configs[0]["eventTag"] elif muonRecFlags.calibNtupleTrigger: @@ -184,7 +164,6 @@ def setupMuonCalibNtuple(): tool_nr+=1 # configure needed tools - # switch on hole search (Moore only) # add to topSequence topSequence += MuonCalibExtraTreeAlg diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRec.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRec.py index 7b833734b320991ba45d82d3f91c5172f0a89ec7..4f312df7b7e7ab2d9c83ef3818e0d7ea9a95e131 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRec.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRec.py @@ -1,8 +1,6 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration from MuonRecFlags import muonRecFlags -from MooreFlags import mooreFlags -from MuonboyFlags import muonboyFlags from MuonStandaloneFlags import muonStandaloneFlags from ConfiguredMuonRec import ParallelMuonRec @@ -10,8 +8,6 @@ from AthenaCommon.Logging import logging from AthenaCommon.AthenaCommonFlags import athenaCommonFlags muonRecFlags.setDefaults() -mooreFlags.setDefaults() -muonboyFlags.setDefaults() muonStandaloneFlags.setDefaults() class MuonRec(ParallelMuonRec): @@ -19,8 +15,6 @@ class MuonRec(ParallelMuonRec): # initialise ParallelMuonRec.__init__(self,"MuonRec",[],enabled=True,**kwargs) # add reco configs - #self.addConfig( "MuonRecExample.Muonboy.Muonboy", enabled = muonRecFlags.doMuonboy() ) - #self.addConfig( "MuonRecExample.Moore.Moore", enabled = muonRecFlags.doMoore() ) self.addConfig( "MuonRecExample.MuonStandalone.MuonStandalone", enabled = muonRecFlags.doStandalone() ) # and configure self.configure() diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py index fd69cf04ff35c5fef36f9f85b0e32f32a97412e0..19c0db5e4edc6d01942f89027ef3c488dfabfc47 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py @@ -32,8 +32,6 @@ addTool( "MuonRecExample.MuonRecTools.MdtTubeHitOnTrackCreator", "MdtTubeHitOnTr addTool( "MuonRecExample.MuonRecTools.AdjustableT0Tool", "AdjustableT0Tool" ) addTool( "MuonRecExample.MuonRecTools.MdtDriftCircleOnTrackCreatorAdjustableT0", "MdtDriftCircleOnTrackCreatorAdjustableT0") -addTool( "MuonRecExample.MuonRecTools.MdtDriftCircleOnTrackCreatorAdjustableT0Mboy", "MdtDriftCircleOnTrackCreatorAdjustableT0Mboy") -addTool( "MuonRecExample.MuonRecTools.MdtDriftCircleOnTrackCreatorAdjustableT0Moore", "MdtDriftCircleOnTrackCreatorAdjustableT0Moore") addTool( "MuonRecExample.MuonRecTools.MuonRotCreator", "MuonRotCreator" ) @@ -50,14 +48,11 @@ addTool( "Trk::MaterialEffectsUpdator", "MuonMaterialEffectsUpdator" ) addTool("MuonRecExample.MuonRecTools.MuonRK_Propagator","MuonRK_Propagator") addTool("MuonRecExample.MuonRecTools.MuonSTEP_Propagator","MuonSTEP_Propagator") addTool("MuonRecExample.MuonRecTools.MuonSTEP_Propagator","MuonPropagator") -addTool("MuonRecExample.MuonRecTools.MuonSTEP_Propagator","MCTBPropagator") # for Moore -#addTool("Trk::StraightLinePropagator", "MuonStraightLinePropagator") +addTool("MuonRecExample.MuonRecTools.MuonSTEP_Propagator","MCTBPropagator") addTool("Trk::STEP_Propagator", "MuonStraightLinePropagator") addTool("MuonRecExample.MuonRecTools.MuonExtrapolator", "MuonExtrapolator") -addTool("MuonRecExample.MuonRecTools.MuonRK_Extrapolator", "MuonRK_Extrapolator") -addTool("MuonRecExample.MuonRecTools.MuonSTEP_Extrapolator", "MuonSTEP_Extrapolator") -addTool("MuonRecExample.MuonRecTools.MuonStraightLineExtrapolator", "MuonStraightLineExtrapolator") +addTool("MuonRecExample.MuonRecTools.MuonExtrapolator", "MuonStraightLineExtrapolator") addTool("Trk::KalmanUpdator", "MuonMeasUpdator") @@ -104,8 +99,6 @@ addTool( "MuonRecExample.MuonRecTools.DCMathSegmentMaker", "DCMathSegmentMaker" addTool( "MuonRecExample.MuonRecTools.MuonClusterSegmentFinderTool", "MuonClusterSegmentFinderTool" ) -addTool( "MuonRecExample.MuonRecTools.MuonSegmentMerger", "MuonSegmentMerger" ) - addTool( "MuonRecExample.MuonRecTools.MuonLayerHoughTool","MuonLayerHoughTool" ) addTool( "Muon::MuonTruthSummaryTool","MuonTruthSummaryTool") @@ -216,11 +209,6 @@ addTool( "MuonRecExample.MooreTools.MooTrackFitter", "MooSLTrackFitter", addTool( "MuonRecExample.MooreTools.MooTrackBuilder", "MooTrackBuilderTemplate") -addTool( "MuonRecExample.MooreTools.MooTrackSteering", "MooTrackSteering" ) -addTool( "MuonRecExample.MooreTools.MooreTrackSteering", "MooreTrackSteering" ) - - - addTool("MuonRecExample.CscTools.CscAlignmentTool","CscAlignmentTool") addTool("MuonRecExample.CscTools.CscClusterUtilTool","CscClusterUtilTool") diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecFlags.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecFlags.py index 40ac9429bbd0ec3f4915794e1d640553283adb11..93a9d021616ec38c97bcea028eda207381a721f8 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecFlags.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecFlags.py @@ -13,9 +13,7 @@ from AthenaCommon.BeamFlags import jobproperties beamFlags = jobproperties.Beam from RecExConfig.RecFlags import rec from MuonRecUtils import logMuon,logMuonResil,RecConfigInfo,fillJobPropertyContainer,SummaryJobProperty -# Load and give access to Muonboy and Moore flags (for convenience) -from MuonboyFlags import muonboyFlags -from MooreFlags import mooreFlags + from MuonStandaloneFlags import muonStandaloneFlags from MuonCnvExample.MuonCalibFlags import mdtCalibFlags @@ -24,31 +22,21 @@ import copy logMuon.info("Importing %s", __name__) - -## Run the Muonboy muon reconstruction algorithm -class doMuonboy(JobProperty): +## @brief Switch on VP1 event display. Only used in Muon Standalone. +# +# This flag should really be in AthenaCommon or RecExConfig +class doVP1(JobProperty): statusOn=True allowedTypes=['bool'] StoredValue=False -## Run the Moore muon reconstruction algorithm -class doMoore(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - ## Run the integrated muon reconstruction algorithm class doStandalone(JobProperty): statusOn=True allowedTypes=['bool'] StoredValue=True -## Run the new third chain configuration -class doNewThirdChain(JobProperty): - StatusOn=True - allowedType=['bool'] - StoredValue=False ## Run the new third chain configuration for the NSW class doNSWNewThirdChain(JobProperty): StatusOn=True @@ -80,72 +68,6 @@ class doMSVertex(JobProperty): StoredValue=False -## @brief OBSOLETE. Use instead: doMoore, doMuonboy -# -# List of top-level tags (strings) of pre-configured Muon reco configurations -# to be run. Only recos in this list are run. To switch off a certain reco, -# remove it from this list, e.g. with the remove() function. -# Format of the tags: -# \"[package].[module].[class]\" -# [class] : the name of the configuration class -# -# [module] (optional) : the name of the python module (inside package) -# default: equal to <class> -# [package] (optional): the name of the package that contains the python module -# default: MuonRecExample -# Examples of available tags: -# \"Muonboy\" -# \"Moore\" (currently equal to Moore.StandardMoore) -# \"Moore.StandardMoore\" -# \"Moore.MoMuMoore\" -# \"Moore.Csc4dMoore\" -# \"Moore.MoMu\" -# Note that one can choose only one among the Moore variants. -class SelectReco(JobProperty): - - statusOn=False - allowedTypes=['list'] - StoredValue=['Muonboy','Moore'] - - def find(self,partOfTag,ignoreStatusOn=False): - """Check that the <partOfTag> string is part of one of the selected configuration tags. - It returns the full first matched tag, or an empty string if not found""" - if not self.statusOn and not ignoreStatusOn: return '' - for t in self.StoredValue: - if partOfTag in t: return t - return '' - - def contains(self,partOfTag,ignoreStatusOn=False): - """Returns bool that indicated if the <partOfTag> string is part of one of the selected configuration tags.""" - return self.find(partOfTag,ignoreStatusOn) != '' - - def remove(self,partOfTag,ignoreStatusOn=True): - """Remove all entries that match <partOfTag>""" - if not self.statusOn and not ignoreStatusOn: return - oldList = self.StoredValue - newList = [] - for t in oldList: - if partOfTag not in t: newList.append(t) - if newList != oldList: - self.set_Value(newList) - - def _do_action(self): - """Load JobPropertyContainers and Modules associated to requested configs, - and unload all others (given in SelectReco.Containers)""" - print "muonRecFlags.SelectReco is obsolete. Please use muonRecFlags.doMoore and doMuonboy instead" - global muonRecFlags - fullTag = self.find("Muonboy") - if fullTag: - muonRecFlags.doMuonboy = True - else: - muonRecFlags.doMuonboy = False - fullTag = self.find("Moore") - if fullTag: - muonRecFlags.doMoore = True - else: - muonRecFlags.doMoore = False - - ## Re-run muon digitization on-the-fly just before reconstruction. Needs DIGITS as input file. class doDigitization(JobProperty): statusOn=True @@ -188,13 +110,6 @@ class doCalib(JobProperty): allowedTypes=['bool'] StoredValue=False - -## Write Trk D3PDs -class doTrkD3PD(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - ## Write calibration ntuple class doCalibNtuple(JobProperty): statusOn=True @@ -231,17 +146,6 @@ class calibNtupleRawTGC(JobProperty): allowedTypes=['bool'] StoredValue=False -## Write moore tracks and segment to calibration ntuple -class calibMoore(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=True - -## Write muonboy tracks and segment to calibration ntuple -class calibMuonboy(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=True ## Write muonboy tracks and segment to calibration ntuple class calibMuonStandalone(JobProperty): @@ -265,20 +169,6 @@ class doSegmentsOnly(JobProperty): allowedTypes=['bool'] StoredValue=False - def _change_action(self): - value = self.get_Value() - logMuon.info("Forwarding muonRecFlags.doSegmentsOnly = %r to muonboyFlags.doSegmentsOnly and mooreFlags.doSegmentsOnly", value ) - muonboyFlags.doSegmentsOnly = value - mooreFlags.doSegmentsOnly = value - muonStandaloneFlags.doSegmentsOnly = value - - def _do_action(self): - self._change_action() - - def _undo_action(self): - self._change_action() - - ## @brief Fit MDT segments using a variable t0. # @@ -288,26 +178,7 @@ class doSegmentT0Fit(JobProperty): statusOn=True allowedTypes=['bool'] StoredValue=False - -## @brief Force some reconstruction settings to be in collision mode. -# -# Used to test collisions-data mode with cosmics-data. -# Affects MuonRecTools.py and Moore.py. -class forceCollisionsMode(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - -## @brief Force some reconstruction settings to be in data mode. -# -# Used to test collisions-data mode with collisions-simulation. -# Affects MuonRecTools.py and Moore.py. -class forceDataMode(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - - + ## turn on error tuning to account for misalignments class enableErrorTuning(JobProperty): statusOn=True @@ -402,27 +273,9 @@ class doPrdSelect(JobProperty): allowedTypes=['bool'] StoredValue=False - -## @brief Choose data taking period. -# -# Possible values: Sector13,MU1,MU2,MU3,M3,M4,M5,M6,P1,P2,P3,P4,Reproc08,Reproc09,LHC -# It indicates an old way (up to release 15.3.0) to access the calibration constants from -# special <tags> from the Db on real data only. -# Now we are accessing constants from the tag in the Db associated to a global conditions tag -# for all cases, Data (online or offline) and MC -# The flag is set by default to "LHC" but it has no effect anymore -# -class dataPeriod(JobProperty): - statusOn=True - allowedTypes=['str'] - allowedValues=["MU1","MU2","MU3","Sector13","M3","M4","M5","M6","M7","M8","P1","P2","P3","P4","LHC","Reproc08","Reproc09"] - StoredValue="LHC" - - # @brief run truth-matching on tracks to evaluate tracking performance # -# It will enable matching for Moore and/or Muonboy depending on flags doMoore and doMuonboy -# It uses MuonTrackPerformanceAlg +# It will MuonTrackPerformanceAlg class doTrackPerformance(JobProperty): statusOn=True allowedTypes=['bool'] @@ -458,6 +311,12 @@ class writeSDOs(JobProperty): allowedTypes=['bool'] StoredValue=False +# @brief Write out Muon RDOs into a file (i.e. ESDs) +class writeRDOs(JobProperty): + statusOn=True + allowedTypes=['bool'] + StoredValue=False + # @brief Write out Muon exit layer and filter it class writeMuonExitLayer(JobProperty): statusOn=True @@ -472,31 +331,19 @@ class makePRDs(JobProperty): allowedTypes=['bool'] StoredValue=True -# @brief Run in commissioning mode (looser cuts) -# -# Replaces rec.Commissioning (which is to be removed). The default is set equal to rec.Commissioning -class Commissioning(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False ## The flags to steer muon reconstruction class MuonRec(JobPropertyContainer): ##set defaults of the flags depending on type of input (MC, data, cosmics etc.) def setDefaults(self): - global globalflags,mooreFlags,muonboyFlags - mooreFlags.setDefaults() - muonboyFlags.setDefaults() + global globalflags from MuonRecUtils import setJobPropertyDefault as setDefault # as long as rec.Commissioning is alive, sync the default to it - setDefault(self.Commissioning,rec.Commissioning()) # in case of BS->RDO, RDO->RDO, RDO->BS, BS->BS: don't run RIO (i.e RDO->PRD) setDefault(self.makePRDs, rec.readRDO() and not rec.doWriteRDO() and not rec.doWriteBS()) - #setDefault(self.doMuonboy,True) - #setDefault(self.doMoore,True) setDefault(self.doStandalone,True) setDefault(self.doDigitization,False) setDefault(self.doCalib,False) @@ -506,28 +353,13 @@ class MuonRec(JobPropertyContainer): setDefault(self.doRPCs,True) setDefault(self.doTGCs,True) setDefault(self.doCSCs,True) - setDefault(self.doMSVertex,False) - setDefault(self.forceDataMode,self.Commissioning()) - setDefault(self.forceCollisionsMode,False) + setDefault(self.doMSVertex,True) setDefault(self.useWireSagCorrections,False) setDefault(self.enableErrorTuning,True) setDefault(self.useLooseErrorTuning,False) setDefault(self.useAlignmentCorrections,DetFlags.detdescr.Muon_on() and rec.doMuon()) setDefault(self.writeSDOs, rec.doWriteESD() and globalflags.DataSource != 'data') - if globalflags.DataSource == 'data': - setDefault(self.useTGCPriorNextBC,True) -# setDefault(self.doCSCs,False) - elif self.forceDataMode(): - if beamFlags.beamType == 'collisions': - # NB: this is setting a flag from another container!!! - setDefault(mdtCalibFlags.correctMdtRtForBField,True) - setDefault(self.useTGCPriorNextBC,False) -# setDefault(self.doCSCs,False) - setDefault(self.useAlignmentCorrections,DetFlags.detdescr.Muon_on() and rec.doMuon()) - else: - setDefault(self.useTGCPriorNextBC,False) -# setDefault(self.doCSCs,True) -# setDefault(self.useAlignmentCorrections,False) + setDefault(self.useTGCPriorNextBC,True) if beamFlags.beamType == 'cosmics' or beamFlags.beamType == 'singlebeam': setDefault(self.doSegmentT0Fit,True) @@ -535,11 +367,8 @@ class MuonRec(JobPropertyContainer): setDefault(self.doSegmentT0Fit,False) setDefault(self.doPrdSelect,False) - setDefault(self.dataPeriod,"LHC") # Default for MuonCalibration ntuple - setDefault(self.calibMoore, muonRecFlags.doMoore() or rec.readESD() ) - setDefault(self.calibMuonboy, muonRecFlags.doMuonboy() or rec.readESD() ) setDefault(self.calibMuonStandalone, muonRecFlags.doStandalone() or rec.readESD() ) try: from MuonCnvExample.MuonCalibFlags import muonCalibFlags @@ -549,17 +378,8 @@ class MuonRec(JobPropertyContainer): self.doCalib = False self.doCalibNtuple = False else: - # for backwards compat: synchronise with muoncalibFlags - if not muonCalibFlags.EventTag.statusOn: - muonCalibFlags.EventTag = 'Moore' - - if muonCalibFlags.EventTag == 'Muonboy': - logMuon.info("Setting muonRecFlags.calibMoore = False because muonCalibFlags.EventTag == \'Muonboy\'") - setDefault(self.calibMoore, False) - - doTracks = (muonRecFlags.calibMoore() and not mooreFlags.doSegmentsOnly()) or \ - (muonRecFlags.calibMuonboy() and not muonboyFlags.doSegmentsOnly()) or \ - self.calibMuonStandalone() + + doTracks = self.calibMuonStandalone() # chose a default if not muonCalibFlags.Mode.statusOn: if doTracks: @@ -725,10 +545,7 @@ muonRecFlags = jobproperties.MuonRec fillJobPropertyContainer(muonRecFlags,__name__) -## @brief Enable or disable the Muon Reconstruction (Moore and Muonboy). -# -# True : run Moore and/or Muonboy depending on the flags doMoore and doMuonboy -# False : do not run Moore nor Muonboy +## @brief Enable or disable the Muon Reconstruction class Enabled(SummaryJobProperty): statusOn=True allowedTypes=['bool'] @@ -736,10 +553,9 @@ class Enabled(SummaryJobProperty): # list of flags controlled by Enable flag _properties = [ muonRecFlags.makePRDs, - muonRecFlags.doMuonboy, - muonRecFlags.doMoore, muonRecFlags.doStandalone, - muonRecFlags.doDigitization ] + muonRecFlags.doDigitization, + muonRecFlags.doMSVertex ] muonRecFlags.add_JobProperty(Enabled) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecStandaloneFlags.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecStandaloneFlags.py deleted file mode 100644 index 72b7fe53d7522a199b676fce8ae50f755221fef6..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecStandaloneFlags.py +++ /dev/null @@ -1,215 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -## @file MuonRecStandaloneFlags.py Some extra flags available when running Muon Reconstruction using MuonRec_myTopOptions.py - -## @namespace python::MuonRecStandaloneFlags @copydoc MuonRecStandaloneFlags.py - -from AthenaCommon.JobProperties import JobProperty,jobproperties -from AthenaCommon.GlobalFlags import globalflags -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.Logging import logging -from MuonRecExample.MuonRecUtils import FileList, fillJobPropertyContainer -from MuonRecExample.DataFiles import DataInfo,DataFilesInfoMap -from MuonRecExample.MuonRecFlags import muonRecFlags,muonboyFlags,mooreFlags -from RecExConfig.RecFlags import rec - -muonRecFlags.setDefaults() - -## @brief Switch on VP1 event display. Only used in Muon Standalone. -# -# This flag should really be in AthenaCommon or RecExConfig -class doVP1(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - - -_athenaCommonInputFilesFlags = { - 'BS' : 'BSRDOInput' , - 'RAW' : 'BSRDOInput' , # RAW is alias for BS - 'EVGEN' : 'PoolRDOInput' , - 'HITS' : 'PoolRDOInput' , - 'RDO' : 'PoolRDOInput' , - 'ESD' : 'PoolESDInput' , - 'AOD' : 'PoolAODInput' , - 'TAG' : 'PoolTAGInput' - } - -_recFlagsReadFlags = { - 'BS' : 'readRDO' , - 'RAW' : 'readRDO' , # RAW is alias for BS - 'EVGEN' : 'readRDO' , - 'HITS' : 'readRDO' , - 'RDO' : 'readRDO' , - 'ESD' : 'readESD' , - 'AOD' : 'readAOD' , - 'TAG' : 'readTAG' , - } - -_poolDataTypes = [ 'EVGEN', 'HITS', 'RDO', 'ESD', 'AOD', 'TAG' ] -_byteStreamDataTypes = [ 'BS', 'RAW' ] - -## @brief Select a set of input data. -# -# Only used in Muon Standalone running (MuonRec_myTopOptions.py) -# Possible values are given in DataFiles.py -# It serves several purposes: -# - shorthand for a standard list of input files -# - a database: it selects the correct data type, data format, geometry tag and conditions tag -# - it sets the flags rec.readRDO, .readESD, .readAOD etc. depending on input data type -# - it sets globalflags.InputFormat, .DetDescrVersion, .ConditionsTag -# - it assigns the input files to the correct athenaCommonFlags.PoolXYZInput and .BSRDOInput -class InputData(JobProperty): - - statusOn=False - allowedTypes=['str'] - allowedValues=[] - StoredValue='' - - selectedData = DataInfo([],'','','') - _rawFiles = [] - _expandedFiles = [] - _maxFiles = 10 - _dataType = '' - _detDescr = '' - _condTag = '' - - _log = logging.getLogger( 'muonRecFlags.InputData' ) - - def _syncFileList(self): - fileList = self.fileList() - dataType = self.dataType() - # ignore empty list - if self._rawFiles and not fileList: - self._log.warning("Not setting athenaCommonFlags.FilesInput to empty input filelist coming from %r",self._rawFiles) - return - - oldList = athenaCommonFlags.FilesInput() - if oldList != fileList: - self._log.info("Setting athenaCommonFlags.FilesInput = %r",fileList) - athenaCommonFlags.FilesInput = fileList - - def dataType(self): - return self._dataType - - def setDataType(self,value): - global athenaCommonFlags,rec,muonRecFlags,globalflags - self._dataType = value - # init all read flags to False - for f in _recFlagsReadFlags.values(): - setattr(rec,f,False) - # enable the chosen type - try: - recFlagToEnable = _recFlagsReadFlags[value] - except KeyError: - raise RuntimeError("Unknown rec.readXXX for dataType: %r"%value) - else: - self._log.info("Setting rec.%s = True", recFlagToEnable) - setattr(rec,recFlagToEnable,True) - - # set input format - if value in _poolDataTypes: - self._log.info("Setting globalflags.InputFormat = 'pool'") - globalflags.InputFormat = 'pool' - elif value in _byteStreamDataTypes: - self._log.info("Setting globalflags.InputFormat = 'bytestream'") - globalflags.InputFormat = 'bytestream' - # no Truth for bytestream - self._log.info("Setting rec.doTruth = False for bytestream data format") - rec.doTruth = False - - # synchronise doDigitization - if value == 'HITS': - if not muonRecFlags.doDigitization(): - self._log.info("Setting doDigitization = True" ) - muonRecFlags.doDigitization = True - else: - if muonRecFlags.doDigitization(): - self._log.info("Setting doDigitization = False" ) - muonRecFlags.doDigitization = False - - - def fileList(self): - if self._expandedFiles is None: - self._expandedFiles = FileList.expandAndReadDirs(self._rawFiles) - - nFiles = min(self._maxFiles,len(self._expandedFiles)) - return self._expandedFiles[:nFiles-1] - - def setFileList(self,value): - self._log.debug("Setting filelist to %r", value) - # only set if list if different (maintain raw version of list) - if value != self._rawFiles: - self._rawFiles = value - self._expandedFiles = None - self._syncFileList() - - - def maxFiles(self): - return self._maxFiles - - def setMaxFiles(self,value): - if value != self._maxFiles: - self._maxFiles = value - self._syncFileList() - - def detDescr(self): - return self._detDescr - - def setDetDescr(self,value): - global globalflags,rec - self._detDescr = value - # synchronise globalflags.DetDescrVersion - oldDetDescr = globalflags.DetDescrVersion() - if value != oldDetDescr: - if value == 'AUTO': - self._log.info("Adding FieldAndGeo to AutoConfig to configure DetDescrVersion and BField settings") - if "FieldAndGeo" not in rec.AutoConfiguration(): - rec.AutoConfiguration += [ 'FieldAndGeo' ] - else: - if "FieldAndGeo" in rec.AutoConfiguration(): - self._log.info("Removing FieldAndGeo from AutoConfig, and adding Field") - rec.AutoConfiguration = [ c for c in rec.AutoConfiguration() if c != 'FieldAndGeo' and c != 'Geo' ] - rec.AutoConfiguration += [ 'Field' ] - if "Geo" in rec.AutoConfiguration(): - self._log.info("Removing Geo from AutoConfig") - rec.AutoConfiguration = [ c for c in rec.AutoConfiguration() if c != 'FieldAndGeo' and c != 'Geo' ] - self._log.info("Setting globalflags.DetDescrVersion = %r" % (value,) ) - globalflags.DetDescrVersion = value - - def setCondTag(self,value): - global globalflags,rec - self._condTag = value - # synchronise globalflags.ConditionsTag - oldConditionsTag = globalflags.ConditionsTag() - if value != oldConditionsTag: - if value == 'AUTO': - self._log.info("Adding ConditionsTag to AutoConfig") - if "ConditionsTag" not in rec.AutoConfiguration(): - rec.AutoConfiguration += [ 'ConditionsTag' ] - else: - if "ConditionsTag" in rec.AutoConfiguration(): - self._log.info("Removing ConditionsTag from AutoConfig") - rec.AutoConfiguration = [ c for c in rec.AutoConfiguration() if c != 'ConditionsTag' ] - self._log.info("Setting globalflags.ConditionsTag = %r" % (value,) ) - globalflags.ConditionsTag = value - - def _do_action(self): - """Set some other flags""" - global DataFilesInfoMap - val = self.get_Value() - self._log.info("Setting InputData = %r", val) - self.selectedData = DataFilesInfoMap[val] - # trigger synchronisation with other flags - self.setDetDescr(self.selectedData.detDescr) - self.setCondTag(self.selectedData.condTag) - self.setDataType(self.selectedData.type) - self.setFileList(self.selectedData.fileList) - self.setMaxFiles(self.selectedData.maxFiles) - self._syncFileList() - - -fillJobPropertyContainer(muonRecFlags,__name__) - - - diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecStandaloneOnlySetup.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecStandaloneOnlySetup.py index 54a3626a4867d82094d0adb6077d9350f88ed0a3..88ce9f2a9804060dd8ca80e4d8957695927ba52c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecStandaloneOnlySetup.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecStandaloneOnlySetup.py @@ -3,7 +3,7 @@ __doc__ = """Set up the flags (for RecExCommon) so that only Muon Standalone Reconstruction is run. It sets default values for muonRecFlags, recFlags, globalflags, DetFlags.""" -from MuonRecExample.MuonRecStandaloneFlags import muonRecFlags +from MuonRecExample.MuonRecFlags import muonRecFlags from MuonRecExample.MuonRecUtils import logMuon,logMuonResil from AthenaCommon.DetFlags import DetFlags from AthenaCommon.GlobalFlags import globalflags diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py index 42a3986559220aadc4db000903ac597a9a36b6d3..d65043ca6e097f016f0cd95f4ebd8e666fc37493 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecTools.py @@ -14,9 +14,11 @@ beamFlags = jobproperties.Beam from MuonCnvExample.MuonCnvUtils import mdtCalibWindowNumber from MuonRecUtils import logMuon,ConfiguredBase,uglyHackedInclude -from MuonRecFlags import muonRecFlags,mooreFlags +from MuonRecFlags import muonRecFlags muonRecFlags.setDefaults() -mooreFlags.setDefaults() + +from MuonStandaloneFlags import muonStandaloneFlags +muonStandaloneFlags.setDefaults() from MuonCnvExample.MuonCalibFlags import mdtCalibFlags mdtCalibFlags.setDefaults() @@ -69,13 +71,7 @@ def MdtDriftCircleOnTrackCreator(name="MdtDriftCircleOnTrackCreator",**kwargs): kwargs.setdefault("DoWireSag", muonRecFlags.useWireSagCorrections()) kwargs.setdefault("DoSlewingCorrection", mdtCalibFlags.correctMdtRtForTimeSlewing()) - if muonRecFlags.forceCollisionsMode(): #this setting uses loose collisions settings, with cosmics timing - kwargs.setdefault("DoTofCorrection", False) - kwargs.setdefault("DoFixedError", True) - kwargs.setdefault("MuonTofTool", None) - kwargs.setdefault("TimingMode", 1) - - elif beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam' : + if beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam' : kwargs.setdefault("DoTofCorrection", False) kwargs.setdefault("DoFixedError", True) kwargs.setdefault("TimingMode", 1) @@ -112,12 +108,8 @@ def MdtTubeHitOnTrackCreator(name="MdtTubeHitOnTrackCreator",**kwargs): # DoTof must be consistent with the one in MdtDriftCircleOnTrackCreator def AdjustableT0Tool(name="AdjustableT0Tool",**kwargs): # NB: the following 'ifs' are the same as in the MdtDriftCircleOnTrackCreator, so that the ToF setting is the same - if muonRecFlags.forceCollisionsMode(): #this setting uses loose collisions settings, with cosmics timing + if muonStandaloneFlags.reconstructionMode() == 'cosmics': kwargs.setdefault("DoTof", 0) - elif beamFlags.beamType() == 'cosmics' or beamFlags.beamType() == 'singlebeam' : - kwargs.setdefault("DoTof", 0) - elif globalflags.DataSource() == 'data' or muonRecFlags.forceDataMode(): # collisions real data or simulated first data - kwargs.setdefault("DoTof", 1) else: # collisions simulation final precise cuts kwargs.setdefault("DoTof", 1) @@ -131,19 +123,8 @@ def MdtDriftCircleOnTrackCreatorAdjustableT0(name="MdtDriftCircleOnTrackCreatorA kwargs.setdefault("DoTofCorrection", True) kwargs.setdefault("TimeWindowSetting", mdtCalibWindowNumber('Collision_data')) kwargs.setdefault("MuonTofTool", "AdjustableT0Tool") - return MdtDriftCircleOnTrackCreator(name,**kwargs) -def MdtDriftCircleOnTrackCreatorAdjustableT0Mboy(name="MdtDriftCircleOnTrackCreatorAdjustableT0Mboy",**kwargs): - kwargs["MuonTofTool"] = getPublicToolClone("AdjustableT0ToolMboy","AdjustableT0Tool") - return MdtDriftCircleOnTrackCreatorAdjustableT0(name,**kwargs) - - -def MdtDriftCircleOnTrackCreatorAdjustableT0Moore(name="MdtDriftCircleOnTrackCreatorAdjustableT0Moore",**kwargs): - kwargs["MuonTofTool"] = getPublicToolClone("AdjustableT0ToolMoore","AdjustableT0Tool") - return MdtDriftCircleOnTrackCreatorAdjustableT0(name,**kwargs) - - # default RIO_OnTrackCreator for muons # make a dedicated class to delay instantiation of the muon RIO_OnTrack creators members from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackCreator @@ -152,38 +133,32 @@ class MuonRotCreator(Trk__RIO_OnTrackCreator,ConfiguredBase): def __init__(self,name="MuonRotCreator",**kwargs): self.applyUserDefaults(kwargs,name) + kwargs.setdefault("ToolMuonDriftCircle", "MdtDriftCircleOnTrackCreator") + kwargs.setdefault("ToolMuonCluster", "MuonClusterOnTrackCreator") + kwargs.setdefault("Mode", 'muon' ) super(MuonRotCreator,self).__init__(name,**kwargs) - -MuonRotCreator.setDefaultProperties( - ToolMuonDriftCircle = "MdtDriftCircleOnTrackCreator" , - ToolMuonCluster = "MuonClusterOnTrackCreator" , - Mode = 'muon' ) # end of class MuonRotCreator # configure the pattern recognition def MuonCombinePatternTool(name="MuonCombinePatternTool",**kwargs): - if beamFlags.beamType() == 'collisions' or muonRecFlags.forceCollisionsMode(): - kwargs.setdefault("UseTightAssociation", True) - else: #cosmics or singlebeam - kwargs.setdefault("UseCosmics", True) - + kwargs.setdefault("UseTightAssociation", muonStandaloneFlags.reconstructionMode() == 'collisions') + kwargs.setdefault("UseCosmics", muonStandaloneFlags.reconstructionMode() != 'collisions' ) return CfgMgr.MuonCombinePatternTool(name,**kwargs) # end of factory function MuonCombinePatternTool def MuonHoughPatternTool(name="MuonHoughPatternTool",**kwargs): - if beamFlags.beamType() != 'collisions' and not muonRecFlags.forceCollisionsMode(): + if muonStandaloneFlags.reconstructionMode() == 'collisions': kwargs.setdefault("UseCosmics", True) kwargs.setdefault("NumberOfMaximaPerIterations", 1) - return CfgMgr.MuonHoughPatternTool(name,**kwargs) # end of factory function MuonHoughPatternTool def MuonHoughPatternFinderTool(name="MuonHoughPatternFinderTool",**kwargs): getPublicTool("MuonCombinePatternTool") getPublicTool("MuonHoughPatternTool") - if beamFlags.beamType() != 'collisions' and not muonRecFlags.forceCollisionsMode(): + if muonStandaloneFlags.reconstructionMode() == 'collisions': kwargs.setdefault("MDT_TDC_cut", False) kwargs.setdefault("RecordAll",False) return CfgMgr.Muon__MuonHoughPatternFinderTool(name,**kwargs) @@ -214,9 +189,8 @@ class MuonRK_Propagator(Trk__RungeKuttaPropagator,ConfiguredBase): def __init__(self,name="MuonRK_Propagator",**kwargs): self.applyUserDefaults(kwargs,name) + kwargs.setdefault("AccuracyParameter", 0.0002 ) super(MuonRK_Propagator,self).__init__(name,**kwargs) - -MuonRK_Propagator.setDefaultProperties( AccuracyParameter = 0.0002 ) # end of class MuonRK_Propagator from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator @@ -224,13 +198,11 @@ class MuonSTEP_Propagator(Trk__STEP_Propagator,ConfiguredBase): __slots__ = () def __init__(self,name="MuonSTEP_Propagator",**kwargs): + kwargs.setdefault("Tolerance", 0.00001 ) + kwargs.setdefault("MaterialEffects", True ) + kwargs.setdefault("IncludeBgradients", True ) self.applyUserDefaults(kwargs,name) super(MuonSTEP_Propagator,self).__init__(name,**kwargs) - -MuonSTEP_Propagator.setDefaultProperties( - Tolerance = 0.00001 , - MaterialEffects = True , - IncludeBgradients = True ) # end of class MuonSTEP_Propagator @@ -244,22 +216,6 @@ def MuonExtrapolator(name='MuonExtrapolator',**kwargs): return CfgMgr.Trk__Extrapolator(name,**kwargs) # end of factory function MuonExtrapolator - -def MuonRK_Extrapolator(name="MuonRK_Extrapolator",**kwargs): - kwargs["Propagators"] = ["MuonRK_Propagator"] - return MuonExtrapolator(name,**kwargs) - - -def MuonSTEP_Extrapolator(name="MuonSTEP_Extrapolator",**kwargs): - kwargs["Propagators"] = ["MuonSTEP_Propagator"] - return MuonExtrapolator(name,**kwargs) - - -def MuonStraightLineExtrapolator(name="MuonStraightLineExtrapolator",**kwargs): - kwargs["Propagators"] = ["MuonStraightLinePropagator"] - return MuonExtrapolator(name,**kwargs) - - def MuonEDMHelperTool(name='MuonEDMHelperTool',**kwargs): # configure some tools that are used but are not declared as properties (they should be!) getPublicTool("MuonIdHelperTool") @@ -282,42 +238,9 @@ class MuonEDMPrinterTool(Muon__MuonEDMPrinterTool,ConfiguredBase): # end of class MuonEDMPrinterTool -from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanFitter -class MuonKalmanTrackFitter(Trk__KalmanFitter,ConfiguredBase): - __slots__ = () - - def __init__(self,name='MuonKalmanTrackFitter',**kwargs): - self.applyUserDefaults(kwargs,name) - super(MuonKalmanTrackFitter,self).__init__(name,**kwargs) - -MuonKalmanTrackFitter.setDefaultProperties( - ExtrapolatorHandle = "MuonExtrapolator" , - MeasurementUpdatorHandle = "MuonMeasUpdator" , - RIO_OnTrackCreatorHandle = None , - DynamicNoiseAdjustorHandle = None , - AlignableSurfaceProviderHandle = None ) -## InternalDAFHandle = None ) -# end of class MuonKalmanTrackFitter - - -#def MuonHolesOnTrackTool(name='MuonHolesOnTrackTool',**kwargs): -# kwargs.setdefault("ExtrapolatorName" , "MuonExtrapolator" ) -# kwargs.setdefault("RIO_OnTrackCreator" , "MuonRotCreator" ) -# kwargs.setdefault("DoHolesIdentification" , True ) -# kwargs.setdefault("DoParameterUpdate", True ) -# kwargs.setdefault("LowerTrackMomentumCut", 2000.0 ) -# AtlasTrackingGeometrySvc = getService("AtlasTrackingGeometrySvc") -# kwargs.setdefault("TrackingGeometryName", AtlasTrackingGeometrySvc.TrackingGeometryName ) - -# from MuonTGRecTools.MuonTGRecToolsConf import Muon__MuonHolesOnTrackTool -# return Muon__MuonHolesOnTrackTool(name,**kwargs) -# end of factory function MuonHolesOnTrackTool - - def MuonTrackSummaryHelper(name="MuonTrackSummaryHelper",**kwargs): AtlasTrackingGeometrySvc = getService("AtlasTrackingGeometrySvc") kwargs.setdefault("TrackingGeometryName", AtlasTrackingGeometrySvc.TrackingGeometryName) - #kwargs.setdefault("HoleOnTrackTool", "MuonHolesOnTrackTool") kwargs.setdefault("DoHolesOnTrack", False) kwargs.setdefault("CalculateCloseHits", True) @@ -333,12 +256,10 @@ class MuonTrackSummaryTool(Trk__TrackSummaryTool,ConfiguredBase): def __init__(self,name="MuonTrackSummaryTool",**kwargs): self.applyUserDefaults(kwargs,name) + kwargs.setdefault("MuonSummaryHelperTool", "MuonTrackSummaryHelper" ) + kwargs.setdefault("doSharedHits", False ) + kwargs.setdefault("AddDetailedMuonSummary", True ) super(MuonTrackSummaryTool,self).__init__(name,**kwargs) - -MuonTrackSummaryTool.setDefaultProperties( - MuonSummaryHelperTool = "MuonTrackSummaryHelper" , - doSharedHits = False, - AddDetailedMuonSummary = True ) # end of class MuonTrackSummaryTool @@ -348,14 +269,12 @@ class MuonParticleCreatorTool(Trk__TrackParticleCreatorTool,ConfiguredBase): def __init__(self,name="MuonParticleCreatorTool",**kwargs): self.applyUserDefaults(kwargs,name) + kwargs.setdefault("Extrapolator", "AtlasExtrapolator" ) + kwargs.setdefault("TrackSummaryTool", "MuonTrackSummaryTool" ) + kwargs.setdefault("KeepAllPerigee", True ) + kwargs.setdefault("UseMuonSummaryTool", True) + kwargs.setdefault("PerigeeExpression", "Origin" ) super(MuonParticleCreatorTool,self).__init__(name,**kwargs) - -MuonParticleCreatorTool.setDefaultProperties( - Extrapolator = "AtlasExtrapolator" , - TrackSummaryTool = "MuonTrackSummaryTool", - KeepAllPerigee=True, - UseMuonSummaryTool=True, - PerigeeExpression="Origin") # end of class MuonParticleCreatorTool def MuonChi2TrackFitter(name='MuonChi2TrackFitter',**kwargs): @@ -378,7 +297,6 @@ def MuonChi2TrackFitter(name='MuonChi2TrackFitter',**kwargs): from MuonSegmentMomentum.MuonSegmentMomentumConf import MuonSegmentMomentumFromField as MuonSegMomField - class MuonSegmentMomentumFromField(MuonSegMomField,ConfiguredBase): __slots__ = () @@ -395,16 +313,13 @@ MuonSegmentMomentumFromField.setDefaultProperties( def MuonPhiHitSelector(name="MuonPhiHitSelector",**kwargs): kwargs.setdefault("MakeClusters", True) kwargs.setdefault("CompetingRios", True) - if beamFlags.beamType() != 'collisions' and not muonRecFlags.forceCollisionsMode() : - kwargs.setdefault("DoCosmics", True) + kwargs.setdefault("DoCosmics", muonStandaloneFlags.reconstructionMode() != 'collisions') return CfgMgr.MuonPhiHitSelector(name,**kwargs) # end of factory function MuonPhiHitSelector def MuonSegmentMomentum(name="MuonSegmentMomentum",**kwargs): - if beamFlags.beamType() != 'collisions' and not muonRecFlags.forceCollisionsMode() : - kwargs.setdefault("DoCosmics", True) - + kwargs.setdefault("DoCosmics", muonStandaloneFlags.reconstructionMode() != 'collisions') return CfgMgr.MuonSegmentMomentum(name,**kwargs) # end of factory function MuonSegmentMomentum @@ -416,10 +331,9 @@ def MdtSegmentT0Fitter(name="MdtSegmentT0Fitter",**kwargs): def MdtMathSegmentFinder(name="MdtMathSegmentFinder",extraFlags=None,**kwargs): beamType = getattr(extraFlags,"beamType", beamFlags.beamType()) doSegmentT0Fit = getattr(extraFlags,"doSegmentT0Fit",muonRecFlags.doSegmentT0Fit()) - enableCurvedSegmentFinding = getattr(extraFlags,"enableCurvedSegmentFinding", mooreFlags.enableCurvedSegmentFinding()) + enableCurvedSegmentFinding = getattr(extraFlags,"enableCurvedSegmentFinding", muonStandaloneFlags.enableCurvedSegmentFinding()) - if beamType == 'singlebeam' or beamType == 'cosmics' or \ - globalflags.DataSource() == 'data' or muonRecFlags.forceDataMode(): + if beamType == 'singlebeam' or beamType == 'cosmics' or globalflags.DataSource() == 'data': if doSegmentT0Fit: kwargs.setdefault("AssociationRoadWidth", 3.) @@ -443,8 +357,8 @@ def MuonClusterSegmentFinderTool(name="MuonClusterSegmentFinderTool", extraFlags def DCMathSegmentMaker(name='DCMathSegmentMaker',extraFlags=None,**kwargs): beamType = getattr(extraFlags,"beamType", beamFlags.beamType()) doSegmentT0Fit = getattr(extraFlags,"doSegmentT0Fit", muonRecFlags.doSegmentT0Fit()) - updateSegmentSecondCoordinate = getattr(extraFlags,"updateSegmentSecondCoordinate", mooreFlags.updateSegmentSecondCoordinate()) - enableCurvedSegmentFinding = getattr(extraFlags,"enableCurvedSegmentFinding", mooreFlags.enableCurvedSegmentFinding()) + updateSegmentSecondCoordinate = getattr(extraFlags,"updateSegmentSecondCoordinate", muonStandaloneFlags.updateSegmentSecondCoordinate()) + enableCurvedSegmentFinding = getattr(extraFlags,"enableCurvedSegmentFinding", muonStandaloneFlags.enableCurvedSegmentFinding()) kwargs.setdefault("MdtSegmentFinder", "MdtMathSegmentFinder") kwargs.setdefault("RefitSegment", True) @@ -453,14 +367,14 @@ def DCMathSegmentMaker(name='DCMathSegmentMaker',extraFlags=None,**kwargs): kwargs.setdefault("DCFitProvider", "MdtSegmentT0Fitter") #kwargs.setdefault("CurvedErrorScaling", False) - if (beamType == 'singlebeam' or beamType == 'cosmics') and not muonRecFlags.forceCollisionsMode : + if (beamType == 'singlebeam' or beamType == 'cosmics'): kwargs.setdefault("SinAngleCut", 0.9) kwargs.setdefault("AddUnassociatedPhiHits", True) kwargs.setdefault("RecoverBadRpcCabling", True) kwargs.setdefault("CurvedErrorScaling", False) kwargs.setdefault("UsePreciseError", True) kwargs.setdefault("PreciseErrorScale", 2.) - elif globalflags.DataSource() == 'data' or muonRecFlags.forceDataMode: # collisions real data or simulation first data + elif globalflags.DataSource() == 'data': # collisions real data or simulation first data kwargs.setdefault("SinAngleCut", 0.4) kwargs.setdefault("AddUnassociatedPhiHits", True) kwargs.setdefault("RecoverBadRpcCabling", True) @@ -468,8 +382,8 @@ def DCMathSegmentMaker(name='DCMathSegmentMaker',extraFlags=None,**kwargs): kwargs.setdefault("PreciseErrorScale", 2.) if doSegmentT0Fit: - kwargs.setdefault("MdtCreatorT0", "MdtDriftCircleOnTrackCreatorAdjustableT0Moore") - kwargs.setdefault("TofTool", "AdjustableT0ToolMoore") + kwargs.setdefault("MdtCreatorT0", "MdtDriftCircleOnTrackCreatorAdjustableT0") + kwargs.setdefault("TofTool", "AdjustableT0Tool") if updateSegmentSecondCoordinate: kwargs.setdefault("UpdatePhiUsingPhiHits",True) @@ -483,14 +397,8 @@ def DCMathSegmentMaker(name='DCMathSegmentMaker',extraFlags=None,**kwargs): # end of factory function DCMathSegmentMaker -def MuonSegmentMerger(name='MuonSegmentMerger',extraFlags=None,**kwargs): - kwargs.setdefault("TriggerHitAssociator", getPublicToolClone("TriggerHitAssociator", "DCMathSegmentMaker",Redo2DFit=False) ) - - return CfgMgr.Muon__MuonSegmentMerger(name,**kwargs) - def MuonLayerHoughTool(name='MuonLayerHoughTool',extraFlags=None,**kwargs): kwargs.setdefault("DoTruth", rec.doTruth() ) - return CfgMgr.Muon__MuonLayerHoughTool(name,**kwargs) @@ -506,7 +414,6 @@ if DetFlags.detdescr.Muon_on() and rec.doMuon(): getPublicTool("MuonCombinePatternTool") getPublicTool("MuonPhiHitSelector") getPublicTool("MuonEDMPrinterTool") - getPublicTool("MuonSTEP_Extrapolator") getPublicTool("MuonSegmentMomentum") getPublicTool("MuonClusterOnTrackCreator") getPublicTool("CscClusterOnTrackCreator") @@ -517,4 +424,4 @@ if DetFlags.detdescr.Muon_on() and rec.doMuon(): #getService("SomeService") else: # not (DetFlags.Muon_on() and rec.doMuon()) - logMuon.warning("Muon reconstruction tools only loaded on-demand because Muons are off") + logMuon.warning("Muon reconstruction tools only loaded on-demand because Muons") diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py index e03b0a56d762d6f99ba0acbe2a0577743b278426..24535dbae100055604d016ee7acd6dd5b4bcf575 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py @@ -9,7 +9,7 @@ __doc__ = """Configuration of Muon Spectrometer Standalone muon reconstruction"" #============================================================== from AthenaCommon import CfgMgr -from MuonStandaloneFlags import muonStandaloneFlags,MuonboylikeStrategy,MoorelikeStrategy +from MuonStandaloneFlags import muonStandaloneFlags,MoorelikeStrategy from MuonRecFlags import muonRecFlags from ConfiguredMuonRec import ConfiguredMuonRec @@ -35,7 +35,6 @@ def MuonTrackSteering(name="MuonTrackSteering", extraFlags=None, **kwargs): extraFlags.setFlagDefault("namePrefix", "MuSt_") extraFlags.setFlagDefault("doSegmentPhiMatching", True) - extraFlags.setFlagDefault("materialSource",muonStandaloneFlags.materialSourcePatRec) extraFlags.setFlagDefault(muonStandaloneFlags.optimiseMomentumResolutionUsingChi2) # take name & value from JobProperty extraFlags.setFlagDefault(muonStandaloneFlags.strategy) extraFlags.setFlagDefault(muonStandaloneFlags.trackBuilder) @@ -45,31 +44,19 @@ def MuonTrackSteering(name="MuonTrackSteering", extraFlags=None, **kwargs): if extraFlags.strategy: kwargs.setdefault("StrategyList", extraFlags.strategy) else: - if extraFlags.trackBuilder == 'Muonboy': - kwargs.setdefault("StrategyList", MuonboylikeStrategy) - elif extraFlags.trackBuilder == 'Moore': - kwargs.setdefault("StrategyList", MoorelikeStrategy) + kwargs.setdefault("StrategyList", MoorelikeStrategy) + kwargs.setdefault("DoSummary", extraFlags.printSummary) kwargs.setdefault("OutputSingleStationTracks", True) kwargs.setdefault("HoleRecoveryTool", "MuonEORecoveryTool") if "TrackBuilderTool" not in kwargs: - if extraFlags.trackBuilder == 'Muonboy': - kwargs["TrackBuilderTool"] = getPublicTool("MboyMuonTrackBuilder") - kwargs["TrackRefinementTool"] = getPublicTool("MboyMuonTrackBuilder") - elif extraFlags.trackBuilder == 'Moore': - extraFlags.setFlagDefault('UseTrackingHistory',True) - kwargs["TrackBuilderTool"] = getPublicToolClone("MooMuonTrackBuilder", "MooTrackBuilderTemplate", - extraFlags=extraFlags) - if "TrackRefinementTool" not in kwargs: - if extraFlags.refinementTool == 'Muonboy': - kwargs["TrackRefinementTool"] = getPublicTool("MboyMuonTrackBuilder") - elif extraFlags.refinementTool == 'Moore': - kwargs["TrackRefinementTool"] = getPublicTool("MooTrackBuilderTemplate") - if extraFlags.trackBuilder == 'Moore': - kwargs.setdefault("SegSeedQCut", 2) - kwargs.setdefault("Seg2ndQCut", 1) - if muonStandaloneFlags.segmentOrigin == 'Muonboy': - kwargs.setdefault("MuonSegmentMerger",getPublicTool("MuonSegmentMerger")) + extraFlags.setFlagDefault('UseTrackingHistory',True) + kwargs["TrackBuilderTool"] = getPublicToolClone("MooMuonTrackBuilder", "MooTrackBuilderTemplate", + extraFlags=extraFlags) + if "TrackRefinementTool" not in kwargs: + kwargs["TrackRefinementTool"] = getPublicTool("MooTrackBuilderTemplate") + kwargs.setdefault("SegSeedQCut", 2) + kwargs.setdefault("Seg2ndQCut", 1) return CfgMgr.Muon__MuonTrackSteering(name,**kwargs) @@ -83,108 +70,94 @@ class MuonStandalone(ConfiguredMuonRec): # full setup is done in configure() # keys for output of segment building stage - # Temporarily hardcoded - if muonStandaloneFlags.segmentOrigin == 'Muonboy': - self.addOutputKey("MuonSegments", "MuonSegments") - elif muonStandaloneFlags.segmentOrigin == 'Moore': - self.addOutputKey("MuonSegments", "MooreSegments") - elif muonStandaloneFlags.segmentOrigin == 'TruthTracking': - self.addOutputKey("MuonSegments", "MuonSegments") - elif muonStandaloneFlags.segmentOrigin == 'ThirdChain' : - self.addOutputKey("MuonSegments", "MuonSegments") - elif muonStandaloneFlags.segmentOrigin == 'Muon' : - self.addOutputKey("MuonSegments", "MuonSegments") - else: - raise RuntimeError("Unknown segmentOrigin: %r" % (muonStandaloneFlags.segmentOrigin()) ) + self.addOutputKey("MuonSegments", "MuonSegments") def configure(self,keys=None): super(MuonStandalone,self).configure(keys) if not self.isEnabled(): return + print " configuring MuonStandalone: flags ", muonStandaloneFlags + from AthenaCommon.BeamFlags import jobproperties beamFlags = jobproperties.Beam - if beamFlags.beamType()=='cosmics': - self.addAlg( CfgMgr.MooSegmentFinderAlg( "MuonSegmentMaker", - SegmentFinder = getPublicTool("MooSegmentFinder"), - MuonSegmentOutputLocation = "MuonSegments", - UseCSC = muonRecFlags.doCSCs(), - UseMDT = muonRecFlags.doMDTs(), - UseRPC = muonRecFlags.doRPCs(), - UseTGC = muonRecFlags.doTGCs(), - UseTGCPriorBC = muonRecFlags.doTGCs() and muonRecFlags.useTGCPriorNextBC(), - UseTGCNextBC = muonRecFlags.doTGCs() and muonRecFlags.useTGCPriorNextBC() )) - - elif muonStandaloneFlags.segmentOrigin == 'Muon': - SegmentLocation = "MuonSegments" - if muonStandaloneFlags.segmentOrigin == 'TruthTracking': - SegmentLocation = "ThirdChainSegments" - - if muonRecFlags.doNSWNewThirdChain(): - getPublicTool("MuonLayerHoughTool") - self.addAlg( CfgMgr.MuonLayerHoughAlg( "MuonLayerHoughAlg", PrintSummary = muonStandaloneFlags.printSummary() ) ) - if not muonStandaloneFlags.patternsOnly(): - SegmentFinder = getPublicTool("MuonClusterSegmentFinderTool") - Cleaner = getPublicToolClone("MuonTrackCleaner_seg","MuonTrackCleaner") - Cleaner.PullCut = 3 - Cleaner.PullCutPhi = 3 - SegmentFinder.TrackCleaner = Cleaner - # for test purposes allow parallel running of truth segment finding and new segment finder - MuonSegmentFinderAlg = CfgMgr.MuonSegmentFinderAlg( "MuonSegmentMaker",SegmentCollectionName=SegmentLocation, - MuonPatternCalibration = getPublicTool("MuonPatternCalibration"), - MuonPatternSegmentMaker = getPublicTool("MuonPatternSegmentMaker"), - MuonTruthSummaryTool = None, - PrintSummary = muonStandaloneFlags.printSummary() ) - if( muonRecFlags.doCSCs() ): - getPublicTool("CscSegmentUtilTool") - getPublicTool("Csc2dSegmentMaker") - getPublicTool("Csc4dSegmentMaker") - else: - MuonSegmentFinderAlg.Csc2dSegmentMaker = None - MuonSegmentFinderAlg.Csc4dSegmentMaker = None - self.addAlg( MuonSegmentFinderAlg ) - else: - getPublicTool("MuonLayerHoughTool") - self.addAlg( CfgMgr.MooSegmentFinderAlg( "MuonSegmentMaker", - SegmentFinder = getPublicToolClone("MuonSegmentFinder","MooSegmentFinder", - DoSummary=muonStandaloneFlags.printSummary()), - MuonSegmentOutputLocation = SegmentLocation, - UseCSC = muonRecFlags.doCSCs(), - UseMDT = muonRecFlags.doMDTs(), - UseRPC = muonRecFlags.doRPCs(), - UseTGC = muonRecFlags.doTGCs(), - UseTGCPriorBC = muonRecFlags.doTGCs() and muonRecFlags.useTGCPriorNextBC(), - UseTGCNextBC = muonRecFlags.doTGCs() and muonRecFlags.useTGCPriorNextBC() )) - - - elif muonStandaloneFlags.segmentOrigin == 'Muonboy': - TheThirdChainMboyMuonSegmentMakerTester = CfgMgr.MboyMuonSegmentMakerTester("MuonSegmentMaker", - MboyMuonSegmentMaker = getPublicTool("ThirdChainMboyMuonSegmentMaker"), - SegmentCollectionLocation = "MuonSegments" ) - self.addAlg( TheThirdChainMboyMuonSegmentMakerTester ) + SegmentLocation = "MuonSegments" + if muonStandaloneFlags.segmentOrigin == 'TruthTracking': + SegmentLocation = "ThirdChainSegments" + + if muonRecFlags.doNSWNewThirdChain(): + getPublicTool("MuonLayerHoughTool") + self.addAlg( CfgMgr.MuonLayerHoughAlg( "MuonLayerHoughAlg", PrintSummary = muonStandaloneFlags.printSummary() ) ) + if not muonStandaloneFlags.patternsOnly(): + SegmentFinder = getPublicTool("MuonClusterSegmentFinderTool") + Cleaner = getPublicToolClone("MuonTrackCleaner_seg","MuonTrackCleaner") + Cleaner.PullCut = 3 + Cleaner.PullCutPhi = 3 + SegmentFinder.TrackCleaner = Cleaner + # for test purposes allow parallel running of truth segment finding and new segment finder + MuonSegmentFinderAlg = CfgMgr.MuonSegmentFinderAlg( "MuonSegmentMaker",SegmentCollectionName=SegmentLocation, + MuonPatternCalibration = getPublicTool("MuonPatternCalibration"), + MuonPatternSegmentMaker = getPublicTool("MuonPatternSegmentMaker"), + MuonTruthSummaryTool = None, + PrintSummary = muonStandaloneFlags.printSummary() ) + if( muonRecFlags.doCSCs() ): + getPublicTool("CscSegmentUtilTool") + getPublicTool("Csc2dSegmentMaker") + getPublicTool("Csc4dSegmentMaker") + else: + MuonSegmentFinderAlg.Csc2dSegmentMaker = None + MuonSegmentFinderAlg.Csc4dSegmentMaker = None + self.addAlg( MuonSegmentFinderAlg ) + else: + getPublicTool("MuonLayerHoughTool") + self.addAlg( CfgMgr.MooSegmentFinderAlg( "MuonSegmentMaker", + SegmentFinder = getPublicToolClone("MuonSegmentFinder","MooSegmentFinder", + DoSummary=muonStandaloneFlags.printSummary()), + MuonSegmentOutputLocation = SegmentLocation, + UseCSC = muonRecFlags.doCSCs(), + UseMDT = muonRecFlags.doMDTs(), + UseRPC = muonRecFlags.doRPCs(), + UseTGC = muonRecFlags.doTGCs(), + UseTGCPriorBC = muonRecFlags.doTGCs() and muonRecFlags.useTGCPriorNextBC(), + UseTGCNextBC = muonRecFlags.doTGCs() and muonRecFlags.useTGCPriorNextBC() )) + + + + self.addAlg( CfgMgr.MooSegmentFinderAlg( "MuonSegmentMaker_NCB", + SegmentFinder = getPublicToolClone("MooSegmentFinder_NCB","MuonSegmentFinder", + DoSummary=muonStandaloneFlags.printSummary(), + Csc2dSegmentMaker = getPublicToolClone("Csc2dSegmentMaker_NCB","Csc2dSegmentMaker", + segmentTool = getPublicToolClone("CscSegmentUtilTool_NCB", + "CscSegmentUtilTool", + TightenChi2 = False, + IPconstraint=False)), + Csc4dSegmentMaker = getPublicToolClone("Csc4dSegmentMaker_NCB","Csc4dSegmentMaker", + segmentTool = getPublicTool("CscSegmentUtilTool_NCB")), + DoMdtSegments=False,DoSegmentCombinations=False,DoSegmentCombinationCleaning=False), + MuonPatternCombinationLocation = "NCB_MuonHoughPatternCombinations", + MuonSegmentOutputLocation = "NCB_MuonSegments", + MuonSegmentCombinationOutputLocation = "NCB_MooreSegmentCombinations", + UseCSC = muonRecFlags.doCSCs(), + UseMDT = False, + UseRPC = False, + UseTGC = False, + UseTGCPriorBC = False, + UseTGCNextBC = False ) ) self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg") ) + self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg_NCB",SegmentContainerName="NCB_MuonSegments",xAODContainerName="NCB_MuonSegments") ) if muonStandaloneFlags.doSegmentsOnly(): - return + return # Tracks builder # # add the algorithm (which uses the MuonTrackSteering) # - if( muonStandaloneFlags.trackBuilder == 'Muonboy' or muonStandaloneFlags.trackBuilder == 'Moore' ): - TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering = getPublicTool("MuonTrackSteering") ) - if muonStandaloneFlags.trackBuilder == 'Muonboy': - TrackBuilder.ExtrapolatedTrackOutputLocation = "ExtrapolatedMuonSpectrometerTracks" - TrackBuilder.TrackToParticleTool = CfgMgr.MuonboyToParticleTool("MuonboyToParticleTool") - TrackBuilder.MuonBackTracker = getPublicTool("MuonBackTracker") - self.addAlg( TrackBuilder ) - - self.registerInputKey ("MuonSegments", self.MuPatTrackBuilder, "MuonSegmentCollection" ) - self.registerOutputKey("MuonSpectrometerTracks", self.MuPatTrackBuilder, "SpectrometerTrackOutputLocation") - - if muonStandaloneFlags.trackBuilder == 'Muonboy': - self.registerOutputKey("MuonSpectrometerParticles", self.MuPatTrackBuilder, "SpectrometerParticleOutputLocation") - self.registerOutputKey("ExtrapolatedMuonSpectrometerTracks", self.MuPatTrackBuilder, "ExtrapolatedTrackOutputLocation") - self.registerOutputKey("ExtrapolatedMuonSpectrometerParticles", self.MuPatTrackBuilder, "ExtrapolatedParticleOutputLocation") + TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering = getPublicTool("MuonTrackSteering") ) + self.addAlg( TrackBuilder ) + + self.registerOutputKey("MuonSpectrometerTracks", self.MuPatTrackBuilder, "SpectrometerTrackOutputLocation") + self.registerInputKey ("MuonSegments", self.MuPatTrackBuilder, "MuonSegmentCollection" ) + if muonStandaloneFlags.createTrackParticles(): from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandaloneFlags.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandaloneFlags.py index e0a1082b9c55fd4d9c7d7847f8cdfcda03e72d4a..e9f3eb8e113648a80510aa257c02448361616677 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandaloneFlags.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandaloneFlags.py @@ -7,6 +7,8 @@ from AthenaCommon.JobProperties import JobProperty,JobPropertyContainer,jobproperties from MuonRecExample.MuonRecUtils import fillJobPropertyContainer from AthenaCommon.GlobalFlags import globalflags +from AthenaCommon.BeamFlags import jobproperties +beamFlags = jobproperties.Beam ## Print out a summary for each event at each reco stage class printSummary(JobProperty): @@ -18,7 +20,13 @@ class segmentOrigin(JobProperty): statusOn=True allowedTypes=['str'] StoredValue="Muon" - allowedValues=['Muon','Muonboy','Moore','TruthTracking'] + allowedValues=['Muon','TruthTracking'] + +class reconstructionMode(JobProperty): + statusOn=True + allowedTypes=['str'] + StoredValue="collisions" + allowedValues=['collisions','cosmics'] class strategy(JobProperty): """ Allowed options for the strategy currently are: @@ -38,49 +46,66 @@ class trackBuilder(JobProperty): statusOn=True allowedTypes=['str'] StoredValue="Moore" - allowedValues=['Muonboy','Moore','TruthTracking','None'] + allowedValues=['Moore','TruthTracking','None'] class refinementTool(JobProperty): statusOn=True allowedTypes=['str'] StoredValue="Moore" - allowedValues=['Muonboy','Moore'] + allowedValues=['Moore'] -class overwriteMoore(JobProperty): +class optimiseMomentumResolutionUsingChi2(JobProperty): statusOn=True allowedTypes=['bool'] StoredValue=False -class overwriteMuonboy(JobProperty): +class patternsOnly(JobProperty): statusOn=True allowedTypes=['bool'] StoredValue=False -class materialSourcePatRec(JobProperty): +class createTrackParticles(JobProperty): statusOn=True - allowedTypes=['str'] - StoredValue="TGMat" + allowedTypes=['bool'] + StoredValue=True -class optimiseMomentumResolutionUsingChi2(JobProperty): +class straightLineFitMomentum(JobProperty): + statusOn=True + allowedTypes=['float'] + StoredValue=2000.0 + +## stop reconstruction at segment level +class doSegmentsOnly(JobProperty): statusOn=True allowedTypes=['bool'] StoredValue=False -class patternsOnly(JobProperty): +## chi-squared per degree of freedom cut in fitter. +class Chi2NDofCut(JobProperty): + statusOn=True + allowedTypes=['float'] + StoredValue=20. + +## flag to turn on curved segment finding +class enableCurvedSegmentFinding(JobProperty): statusOn=True allowedTypes=['bool'] StoredValue=False -class createTrackParticles(JobProperty): +class updateSegmentSecondCoordinate(JobProperty): statusOn=True allowedTypes=['bool'] StoredValue=True -## stop reconstruction at segment level -class doSegmentsOnly(JobProperty): +class useSegmentMatching(JobProperty) : statusOn=True allowedTypes=['bool'] - StoredValue=False + StoredValue=True + +class useTrackSegmentMatching(JobProperty) : + statusOn=True + allowedTypes=['bool'] + StoredValue=True ## Container with Configuration flags of %Standalone reconstruction class MuonStandalone(JobPropertyContainer): @@ -88,7 +113,16 @@ class MuonStandalone(JobPropertyContainer): def setDefaults(self): from MuonRecUtils import setJobPropertyDefault as setDefault -# add moore flags to container + global beamFlags + if beamFlags.beamType()=='cosmics' or beamFlags.beamType()=='singlebeam': + setDefault(self.reconstructionMode,'cosmics') + setDefault(self.useSegmentMatching,False) + setDefault(self.updateSegmentSecondCoordinate,False) + else: + setDefault(self.useSegmentMatching,True) + setDefault(self.updateSegmentSecondCoordinate,True) + +# add flags to container jobproperties.add_Container(MuonStandalone) ## shortcut to access flags @@ -104,13 +138,3 @@ MoorelikeStrategy=[ "BarrelCombined[CombineSegInStation,DoRefinement,DoAmbiSolving,CutSeedsOnTracks]:BML,BMS;BOL,BOS;BIL,BIS", "EndcapCombined[CombineSegInStation,DoRefinement,DoAmbiSolving,CutSeedsOnTracks]:EML,EMS;EOL,EOS;EIL,EIS;CSL,CSS;EEL,EES;BEE", "BarrelEndcap[CombineSegInStation,DoRefinement,DoAmbiSolving,CutSeedsOnTracks,BarrelEndcapFilter]:EML,EMS;EEL,EES;BML,BMS;EIL,EIS;BIL,BIS;BOL,BOS"] - -MuonboylikeStrategy=[ - "BarrelCombinedLarge[DoRefinement,DoAmbiSolving]:BML;BOL;BIL" , - "BarrelCombinedSmall[DoRefinement,DoAmbiSolving]:BMS;BOS;BIS" , - "EndcapCombinedLarge[DoRefinement,DoAmbiSolving]:EML;EOL;EIL;CSL;EEL;BEE" , - "EndcapCombinedSmall[DoRefinement,DoAmbiSolving]:EMS;EOS;EIS;CSS;EES;BEE" , - "BarrelEndcapLarge[DoRefinement,DoAmbiSolving]:EML;BIL" , - "BarrelEndcapSmall[DoRefinement,DoAmbiSolving]:EMS;BIS" , - "EndcapBarrelLS[DoRefinement,DoAmbiSolving]:EML;EIS;BIS", - "EndcapBarrelSL[DoRefinement,DoAmbiSolving]:EMS;EIL;BIL"] diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/Muonboy.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/Muonboy.py deleted file mode 100644 index f83cea936815b0c2f15bbae43900e4dabf9d474a..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/Muonboy.py +++ /dev/null @@ -1,414 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from AthenaCommon.AppMgr import ToolSvc, ServiceMgr -from MuonboyFlags import muonboyFlags -from MuonRecFlags import muonRecFlags -from ConfiguredMuonRec import ConfiguredMuonRec - -from AthenaCommon.GlobalFlags import globalflags -from AthenaCommon.JobProperties import jobproperties -from AthenaCommon.BFieldFlags import jobproperties -from AthenaCommon.BeamFlags import jobproperties - -from AthenaCommon.CfgGetter import getPublicTool,getService - -muonRecFlags.setDefaults() - -from MboySvc.MboySvcConf import MboySvc -class MboySvcConfig(MboySvc,ConfiguredBase): - __slots__ = () - - def __init__(self,name="MboySvc",**kwargs): - self.applyUserDefaults(kwargs,name) - super(MboySvcConfig,self).__init__(name,**kwargs) - # setup required geo reading - uglyHackedInclude("AmdcAth/AmdcAth_jobOptions.py") - -MboySvcConfig.setDefaultProperties(MinuitFileOut = 0) -# end of class MboySvcConfig - - -class Muonboy(ConfiguredMuonRec): - def __init__(self,**kwargs): - ConfiguredMuonRec.__init__(self,"Muonboy",**kwargs) - # setup minimum config needed to get the Storegate keys - # full setup is done in functions configure() - self.addOutputKey("MuonSegments", "ConvertedMBoySegments") # C++ default - self.addOutputKey("MuonTracks", "ConvertedMBoyTracks") # C++ default - self.addOutputKey("MuonTracksForCalibration", "ConvertedMBoyTracks") # same as MuonTracks - # end of __init__ - - - def configure(self,keys=None): - super(Muonboy,self).configure(keys) - if not self.isEnabled(): return - - configureMboySegmentMaking() - - global ToolSvc,ServiceMgr - from AthenaCommon.Include import include - - from MboyEDMTool.MboyEDMToolConf import Trk__MuonboyToTrackTool,MboyRTTool,AdjT0__AdjustableT0Tool - - from AthenaCommon.AppMgr import ToolSvc - TheMdtDriftCircleOnTrackCreator = getPublicTool('MdtDriftCircleOnTrackCreator') - TheMdtDriftCircleOnTrackCreatorAdjustableT0 = getPublicTool('MdtDriftCircleOnTrackCreatorAdjustableT0Mboy') - - # ToolSvc += Trk__MuonboyToSegmentTool("MuonboyToSegmentToolAdjustableT0", - # IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreatorAdjustableT0) - ToolSvc += Trk__MuonboyToTrackTool("MuonboyToTrackToolAdjustableT0", - IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreatorAdjustableT0) - # ToolSvc += Trk__MuonboyToSegmentTool("MuonboyToSegmentTool", - # IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreator) - ToolSvc += Trk__MuonboyToTrackTool("MuonboyToTrackTool", - IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreator) - # ToolSvc += MboyRTTool( - # IAdjustableT0Tool = TheMdtDriftCircleOnTrackCreatorAdjustableT0.MuonTofTool, - # IMdtDriftCircleOnTrackCreatorAdjustableT0 = TheMdtDriftCircleOnTrackCreatorAdjustableT0 , - # IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreator - # ) - - MboySvc = getService("MboySvc") - # MboySvc.MuonboyToSegmentToolAdjustableT0 = ToolSvc.MuonboyToSegmentToolAdjustableT0 - MboySvc.MuonboyToTrackToolAdjustableT0 = ToolSvc.MuonboyToTrackToolAdjustableT0 - # MboySvc.MuonboyToSegmentTool = ToolSvc.MuonboyToSegmentTool - MboySvc.MuonboyToTrackTool = ToolSvc.MuonboyToTrackTool - # MboySvc.MboyRTTool = ToolSvc.MboyRTTool - - #----------------------------------------------------------------- - # setup MboyGetPrepDataFromEventTool - # from MboyEDMTool.MboyEDMToolConf import MboyGetPrepDataFromEventTool - # if muonboyFlags.BarrelOnly(): - # GetPDTool = self.addPublicTool( MboyGetPrepDataFromEventTool( - # CollectMDT = 1 , - # CollectRPC = 1 , - # CollectTGC = 0 , - # CollectCSC = 0 , - # CollectCscCluster = 0 ) ) - # else: - # GetPDTool = self.addPublicTool( MboyGetPrepDataFromEventTool() ) - - # self.MboyGetPrepDataFromEventTool.TgcPrepDataContainerNameList = [ "TGC_Measurements" ] - # if muonRecFlags.useTGCPriorNextBC(): - # self.MboyGetPrepDataFromEventTool.TgcPrepDataContainerNameList += [ "TGC_MeasurementsNextBC" ] - # self.MboyGetPrepDataFromEventTool.TgcPrepDataContainerNameList += [ "TGC_MeasurementsPriorBC" ] - # - # if muonRecFlags.doCSCs(): - # self.MboyGetPrepDataFromEventTool.CollectCscCluster = 1 - # else: - # self.MboyGetPrepDataFromEventTool.CollectCscCluster = 0 - -# #----------------------------------------------------------------- -# #Masking EEL EES chambers, dead layers of CSCs at reconstruction level -# MboySvc.MultiLayerOut[:] = [ ] -# # MboySvc.MultiLayerOut += [ "EES/*/*/*/*" ] -# # MboySvc.MultiLayerOut += [ "EEL/*/1/*/*" , "EEL/*/2/*/*" ] -# # MboySvc.MultiLayerOut += [ "EEL/*/4/*/*" , "EEL/*/5/*/*" ] -# # MboySvc.MultiLayerOut += [ "EEL/-1/6/*/*" , "EEL/-2/6/*/*" ] -# # MboySvc.MultiLayerOut += [ "EEL/1/8/*/*" , "EEL/2/8/*/*" ] -# if not muonRecFlags.doCSCs(): -# MboySvc.MultiLayerOut += [ "CSS/*/*/*/*" ] -# MboySvc.MultiLayerOut += [ "CSL/*/*/*/*" ] -# elif globalflags.DataSource() == 'data' : -# #remove the know dead layers -# MboySvc.MultiLayerOut += [ "CSL/1/3/CSC/2/3" ] -# MboySvc.MultiLayerOut += [ "CSL/1/5/CSC/2/1" ] - - #----------------------------------------------------------------- - #MboyDigiEmptyLoop: empty loop on digits (Muonboy independent) - if not muonboyFlags.DumpOnly(): - from MuonboyAth.MuonboyAthConf import MboyDigiEmptyLoop - self.addAlg( MboyDigiEmptyLoop(MboyGetPrepDataFromEventTool = ToolSvc.MboyGetPrepDataFromEventTool) ) - - #----------------------------------------------------------------- - #MboyRec: reconstruction - from MuonboyAth.MuonboyAthConf import MboyRec - # ProcessingStage = 3 : until tracks (no combined) - self.addAlg( MboyRec(MboyGetPrepDataFromEventTool = ToolSvc.MboyGetPrepDataFromEventTool) ) - if muonboyFlags.DumpOnly(): - self.MboyRec.SwitchOff = 1 - - if muonboyFlags.doSegmentsOnly(): - # Until Segments - self.MboyRec.ProcessingStage = 1 - MboySvc.LevelOfRecons = 1 - else: - # Full standalone reco - self.MboyRec.ProcessingStage = 3 # until TrackParticles - MboySvc.LevelOfRecons = 3 - - # register some dataKeys - self.registerOutputKey("MuonSegments", self.MboyRec, "SegmentCollectionLocation") - self.registerOutputKey("MuonTracks" , self.MboyRec, "TrackCollectionLocation") - self.registerOutputKey("MuonTracksForCalibration" , self.MboyRec, "TrackCollectionLocation") - - from MuonboyAth.MuonboyAthConf import MboyMuonChamberT0s - self.addAlg( MboyMuonChamberT0s(IAdjustableT0Tool = TheMdtDriftCircleOnTrackCreatorAdjustableT0.MuonTofTool) ) - - #----------------------------------------------------------------- - if muonboyFlags.AllChecks(): - from MuonboyAth.MuonboyAthConf import MboyChecks, MboySegmentCheck - self.addAlg( MboyChecks() ) - self.addAlg( MboySegmentCheck() ) - self.MboyRec.DoDump = 1 - self.MboyRec.ShortSummaryTrack = 1 - self.MboyRec.ShortSummarySegment = 1 - self.MboyRec.PrintDigitsSummary = 1 - # - # MboySvc.MdtAdcCut = 50. - # MboySvc.SegAdcCut = 80. - # if globalflags.DataSource() == 'data' : - # MboySvc.AtlasSimulationSample = 0 - # else: - # MboySvc.AtlasSimulationSample = 1 - # - # if muonRecFlags.doSegmentT0Fit(): - # MboySvc.DoT0Fit = 1 - # MboySvc.UseT0Fit = 1 - # else: - # MboySvc.DoT0Fit = 0 - # MboySvc.UseT0Fit = 0 - # - # if muonRecFlags.useAlignmentCorrections(): - # MboySvc.AlignementLock = 0 - # ServiceMgr.AmdcsimrecAthenaSvc.AlignmentCorr = 3 - # ServiceMgr.AmdcsimrecAthenaSvc.AlignmentSource = 2 - # - # if muonRecFlags.useWireSagCorrections(): - # MboySvc.RimpfromRTSvc = 1 - # MboySvc.WireSagOn = 1 - - # if jobproperties.Beam.beamType() == 'singlebeam' or jobproperties.Beam.beamType() == 'cosmics' : - # MboySvc.UseRoaFromMdt = 0 - # MboySvc.UseAllSegments = 1 - # MboySvc.TubeResolutionWhenNoT0 = 0.05 - # if jobproperties.Beam.beamType() == 'cosmics': - # MboySvc.AtlasCosmicsSample = 1 - # else: - # MboySvc.AtlasCosmicsSample = 2 - # else: - # MboySvc.TubeResolutionWhenNoT0 = 0.02 - # - # - # if muonRecFlags.enableErrorTuning() or jobproperties.Beam.beamType() == 'singlebeam' or jobproperties.Beam.beamType() == 'cosmics': - # MboySvc.FinalChi2Cut = 120 - # MboySvc.MDTTubeResolution = 0.0090 - # if muonRecFlags.enableErrorTuning(): - # MboySvc.DoAlignementFit = 2 - # MboySvc.BarrelAngularAlig = 0.00010 - # MboySvc.EndcapAngularAlig = 0.00017 - # MboySvc.AligStationBarrel = 0.0040 - # MboySvc.AligStationEndcap = 0.0080 - # MboySvc.AligStationCSC = 0.0080 - # MboySvc.AligBarrelEndcap = 0.0300 - # MboySvc.CSCLayerAlignError = 0.0000 - # MboySvc.ResBadlyAlignedBIS = 0.2 - # MboySvc.ResBadlyAlignedBEE = 0.1 - # MboySvc.ResBadlyAlignedEIL = 0.2 - # MboySvc.ResBadlyAlignedEEL = 0.3 - # MboySvc.ResBadlyAligned = 0.3 - # MboySvc.ResBadTomo = 0.1 - # MboySvc.AligTGCeta = 0.6 - # MboySvc.ErrZMsIdBarrel = 0.1 - # MboySvc.ErrZMsIdEndcap = 0.1 - - # end of configure() - - - - def getCalibConfig(self): - """Get the configuration object to configure Calibration Ntuple output""" - doTracks = not muonboyFlags.doSegmentsOnly() - if doTracks: - tracksKey = self.dataKey("MuonTracksForCalibration") - else: - tracksKey = "" - - return { 'eventTag' : "Muonboy", - 'patternsKey' : '????', - 'segmentsKey' : self.dataKey("MuonSegments"), - 'tracksKey' : tracksKey, - 'doPhi' : False, - 'segmentAutor' : 3, - 'trackAuthor' : 100} - -def configureMboySegmentMaking(): - global ToolSvc,ServiceMgr - from AthenaCommon.Include import include - - from MboyEDMTool.MboyEDMToolConf import Trk__MuonboyToSegmentTool,MboyRTTool,AdjT0__AdjustableT0Tool - - from AthenaCommon.AppMgr import ToolSvc - TheMdtDriftCircleOnTrackCreator = getPublicTool('MdtDriftCircleOnTrackCreator') - TheMdtDriftCircleOnTrackCreatorAdjustableT0 = getPublicTool('MdtDriftCircleOnTrackCreatorAdjustableT0Mboy') - - ToolSvc += Trk__MuonboyToSegmentTool("MuonboyToSegmentToolAdjustableT0", - IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreatorAdjustableT0) - # ToolSvc += Trk__MuonboyToTrackTool("MuonboyToTrackToolAdjustableT0", - # IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreatorAdjustableT0) - ToolSvc += Trk__MuonboyToSegmentTool("MuonboyToSegmentTool", - IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreator) - # ToolSvc += Trk__MuonboyToTrackTool("MuonboyToTrackTool", - # IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreator) - ToolSvc += MboyRTTool( - IAdjustableT0Tool = TheMdtDriftCircleOnTrackCreatorAdjustableT0.MuonTofTool, - IMdtDriftCircleOnTrackCreatorAdjustableT0 = TheMdtDriftCircleOnTrackCreatorAdjustableT0 , - IMdtDriftCircleOnTrackCreator = TheMdtDriftCircleOnTrackCreator - ) - - MboySvc = getService("MboySvc") - MboySvc.MuonboyToSegmentToolAdjustableT0 = ToolSvc.MuonboyToSegmentToolAdjustableT0 - # MuonboyToTrackToolAdjustableT0 = ToolSvc.MuonboyToTrackToolAdjustableT0 - MboySvc.MuonboyToSegmentTool = ToolSvc.MuonboyToSegmentTool - # MboySvc.MuonboyToTrackTool = ToolSvc.MuonboyToTrackTool - MboySvc.MboyRTTool = ToolSvc.MboyRTTool - - #----------------------------------------------------------------- - # setup MboyGetPrepDataFromEventTool - from MboyEDMTool.MboyEDMToolConf import MboyGetPrepDataFromEventTool - if muonboyFlags.BarrelOnly(): - GetPDTool = MboyGetPrepDataFromEventTool( - CollectMDT = 1 , - CollectRPC = 1 , - CollectTGC = 0 , - CollectCSC = 0 , - CollectCscCluster = 0 ) - else: - GetPDTool = MboyGetPrepDataFromEventTool() - - GetPDTool.TgcPrepDataContainerNameList = [ "TGC_MeasurementsAllBCs" ] - GetPDTool.TgcUseCurrentBC =True - GetPDTool.TgcUsePrevBC = muonRecFlags.useTGCPriorNextBC() - GetPDTool.TgcUseNextBC = muonRecFlags.useTGCPriorNextBC() - - -# if muonRecFlags.useTGCPriorNextBC(): -# GetPDTool.TgcPrepDataContainerNameList += [ "TGC_MeasurementsNextBC" ] -# GetPDTool.TgcPrepDataContainerNameList += [ "TGC_MeasurementsPriorBC" ] - - if muonRecFlags.doCSCs(): - GetPDTool.CollectCscCluster = 1 - else: - GetPDTool.CollectCscCluster = 0 - - ToolSvc += GetPDTool - - #----------------------------------------------------------------- - #Masking EEL EES chambers, dead layers of CSCs at reconstruction level - MboySvc.MultiLayerOut[:] = [ ] -# MboySvc.MultiLayerOut += [ "EES/*/*/*/*" ] -# MboySvc.MultiLayerOut += [ "EEL/*/1/*/*" , "EEL/*/2/*/*" ] -# MboySvc.MultiLayerOut += [ "EEL/*/4/*/*" , "EEL/*/5/*/*" ] -# MboySvc.MultiLayerOut += [ "EEL/-1/6/*/*" , "EEL/-2/6/*/*" ] -# MboySvc.MultiLayerOut += [ "EEL/1/8/*/*" , "EEL/2/8/*/*" ] - if not muonRecFlags.doCSCs(): - MboySvc.MultiLayerOut += [ "CSS/*/*/*/*" ] - MboySvc.MultiLayerOut += [ "CSL/*/*/*/*" ] - elif globalflags.DataSource() == 'data' : - #remove the know dead layers - MboySvc.MultiLayerOut += [ "CSL/1/3/CSC/2/3" ] - MboySvc.MultiLayerOut += [ "CSL/1/5/CSC/2/1" ] - - #----------------------------------------------------------------- - #MboyDigiEmptyLoop: empty loop on digits (Muonboy independent) - # if not muonboyFlags.DumpOnly(): - # from MuonboyAth.MuonboyAthConf import MboyDigiEmptyLoop - # self.addAlg( MboyDigiEmptyLoop(MboyGetPrepDataFromEventTool = GetPDTool) ) - - #----------------------------------------------------------------- - #MboyRec: reconstruction - from MuonboyAth.MuonboyAthConf import MboyRec - # ProcessingStage = 3 : until tracks (no combined) - # self.addAlg( MboyRec(MboyGetPrepDataFromEventTool = GetPDTool) ) - # if muonboyFlags.DumpOnly(): - # self.MboyRec.SwitchOff = 1 - - # if muonboyFlags.doSegmentsOnly(): - # # Until Segments - # self.MboyRec.ProcessingStage = 1 - MboySvc.LevelOfRecons = 1 - # else: - # # Full standalone reco - # self.MboyRec.ProcessingStage = 3 # until TrackParticles - # MboySvc.LevelOfRecons = 3 - - # register some dataKeys - # self.registerOutputKey("MuonSegments", self.MboyRec, "SegmentCollectionLocation") - # self.registerOutputKey("MuonTracks" , self.MboyRec, "TrackCollectionLocation") - # self.registerOutputKey("MuonTracksForCalibration" , self.MboyRec, "TrackCollectionLocation") - - # from MuonboyAth.MuonboyAthConf import MboyMuonChamberT0s - # self.addAlg( MboyMuonChamberT0s(IAdjustableT0Tool = TheMdtDriftCircleOnTrackCreatorAdjustableT0.MuonTofTool) ) - - #----------------------------------------------------------------- - # if muonboyFlags.AllChecks(): - # from MuonboyAth.MuonboyAthConf import MboyChecks, MboySegmentCheck - # self.addAlg( MboyChecks() ) - # self.addAlg( MboySegmentCheck() ) - # self.MboyRec.DoDump = 1 - # self.MboyRec.ShortSummaryTrack = 1 - # self.MboyRec.ShortSummarySegment = 1 - # self.MboyRec.PrintDigitsSummary = 1 - - MboySvc.MdtAdcCut = 50. - MboySvc.SegAdcCut = 80. - if globalflags.DataSource() == 'data' : - MboySvc.AtlasSimulationSample = 0 - else: - MboySvc.AtlasSimulationSample = 1 - - if muonRecFlags.doSegmentT0Fit(): - MboySvc.DoT0Fit = 1 - MboySvc.UseT0Fit = 1 - else: - MboySvc.DoT0Fit = 0 - MboySvc.UseT0Fit = 0 - - if muonRecFlags.useAlignmentCorrections(): - MboySvc.AlignementLock = 0 - ServiceMgr.AmdcsimrecAthenaSvc.AlignmentCorr = 3 - ServiceMgr.AmdcsimrecAthenaSvc.AlignmentSource = 2 - - if muonRecFlags.useWireSagCorrections(): - MboySvc.RimpfromRTSvc = 1 - MboySvc.WireSagOn = 1 - - if jobproperties.Beam.beamType() == 'singlebeam' or jobproperties.Beam.beamType() == 'cosmics' : - MboySvc.UseRoaFromMdt = 0 - MboySvc.UseAllSegments = 1 - MboySvc.TubeResolutionWhenNoT0 = 0.05 - if jobproperties.Beam.beamType() == 'cosmics': - MboySvc.AtlasCosmicsSample = 1 - else: - MboySvc.AtlasCosmicsSample = 2 - else: - MboySvc.TubeResolutionWhenNoT0 = 0.02 - - - if muonRecFlags.enableErrorTuning() or jobproperties.Beam.beamType() == 'singlebeam' or jobproperties.Beam.beamType() == 'cosmics': - MboySvc.FinalChi2Cut = 120 - MboySvc.MDTTubeResolution = 0.0090 - if muonRecFlags.enableErrorTuning(): - MboySvc.DoAlignementFit = 2 - MboySvc.BarrelAngularAlig = 0.00010 - MboySvc.EndcapAngularAlig = 0.00017 - MboySvc.AligStationBarrel = 0.0040 - MboySvc.AligStationEndcap = 0.0080 - MboySvc.AligStationCSC = 0.0080 - MboySvc.AligBarrelEndcap = 0.0300 - MboySvc.CSCLayerAlignError = 0.0000 - MboySvc.ResBadlyAlignedBIS = 0.2 - MboySvc.ResBadlyAlignedBEE = 0.1 - MboySvc.ResBadlyAlignedEIL = 0.2 - MboySvc.ResBadlyAlignedEEL = 0.3 - MboySvc.ResBadlyAligned = 0.3 - MboySvc.ResBadTomo = 0.1 - MboySvc.AligTGCeta = 0.6 - MboySvc.ErrZMsIdBarrel = 0.1 - MboySvc.ErrZMsIdEndcap = 0.1 - - -# for backwards compatibility -MuonboyStandalone = Muonboy -MuonboyCombined = Muonboy - diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonboyFlags.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonboyFlags.py deleted file mode 100644 index 1b0c6a7e98de8c6e879aafa740b3f314115ff4f8..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonboyFlags.py +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -## @file MuonboyFlags.py Flags for configuring the %Muonboy muon reconstruction algorithm - -## @namespace python::MuonboyFlags @copydoc MuonboyFlags.py - - - -from AthenaCommon.JobProperties import JobProperty,JobPropertyContainer,jobproperties -from AthenaCommon.Logging import logging -from MuonRecExample.MuonRecUtils import fillJobPropertyContainer - -# message logger -log = logging.getLogger( __name__ ) - - -## if True, TGC and CSC are not used in the reconstruction -class BarrelOnly(JobProperty): - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - - ## Check consistency of flags - def _do_action(self): - _check_flags_consistency() - - -## if True, segments and tracks reconstruction are switched off -class DumpOnly(JobProperty): - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - - ## Check consistency of flags - def _do_action(self): - _check_flags_consistency() - - -## if True add 2 TopAlg, MboyChecks and MboySegmentCheck, doing dumps -class AllChecks(JobProperty): - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - - ## check constistency of flags - def _do_action(self): - _check_flags_consistency() - -## stop reconstruction at segment level -class doSegmentsOnly(JobProperty): - statusOn=True - allowedTypes=['bool'] - StoredValue=False - - - - -## Container with flags to steer Muonboy -class Muonboy(JobPropertyContainer): - - def setDefaults(self): - pass - - -def _check_flags_consistency(): - global muonboyFlags - # check consistency between DumpOnly and AllChecks - if muonboyFlags.DumpOnly() and muonboyFlags.AllChecks(): - log.warning("Setting AllChecks to False because DumpOnly is True") - muonboyFlags.AllChecks = False - - - -# add muonboy container -jobproperties.add_Container(Muonboy) - -## shortcut to access flags -muonboyFlags = jobproperties.Muonboy - -# add all properties in this module -fillJobPropertyContainer(muonboyFlags,__name__) - -# -# Backwards compatibility -# -oldtonew = { 'doMuonboyBarrelOnly' : 'muonboyFlags.BarrelOnly' , - 'doMuonboyDumpOnly' : 'muonboyFlags.DumpOnly' , - 'doMuonboyAllChecks' : 'muonboyFlags.AllChecks' } -import __main__ -varlist = vars(__main__) -for oldflag,newflag in oldtonew.items(): - try: - oldValue = varlist[oldflag] - except KeyError: - pass - else: - # set new flag to old flag value - exec newflag + ' = %r' % oldValue - # print a deprecated warning - log.warning( '%s flag is deprecated. Use %s instead (%s)', - oldflag, newflag, - 'from ' + __name__ + ' import muonboyFlags' ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonDataRec_myTopOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonDataRec_myTopOptions.py deleted file mode 100644 index 49497ae1f26ce59303c84380843c5f0f3c04a769..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonDataRec_myTopOptions.py +++ /dev/null @@ -1,177 +0,0 @@ -# ####################################################################### -# TopOptions to process cosmics /single beam data -# M. Woudstra, R. Nikolaidou -# -# By default we run on 10 events of the 121080 (taken on June 2009) run, -# autoconfiguration of bfield and conditions tag, full reconstruction -# Muonboy and Moore and we produce as -# output : ESD, Monitoring, ascii file with the configuration of the job -# ####################################################################### - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.BeamFlags import jobproperties -from AthenaCommon.GlobalFlags import globalflags -from AthenaCommon.BFieldFlags import jobproperties -from AthenaCommon.AlgSequence import AlgSequence -from AthenaCommon.DetFlags import DetFlags -from AthenaCommon.AppMgr import ServiceMgr as svcMgr - -from RecExConfig.RecFlags import rec -from RecExConfig.RecConfFlags import recConfFlags - -# setup environment -from MuonRecExample.MuonRecFlags import muonRecFlags,muonboyFlags,mooreFlags -from MuonRecExample import MuonRecStandaloneOnlySetup -from MuonRecExample import MuonRecUtils -from MuonRecExample.MuonRecUtils import assertCastorStager,hasJobPropertyBeenSet - -# in Standalone mode, don't allow any configuration errors -athenaCommonFlags.AllowIgnoreConfigError = False - -# Set properly beam type, DataSource, InputFormat, Detector Description, Conditions Tag -globalflags.DataSource.set_Value_and_Lock('data') -##jobproperties.Beam.beamType.set_Value_and_Lock("cosmics") -globalflags.InputFormat.set_Value_and_Lock('bytestream') - -############################################################################## -if not hasJobPropertyBeenSet(athenaCommonFlags.FilesInput): - assertCastorStager("castoratlast3","atlascerngroupdisk") - athenaCommonFlags.FilesInput.set_Value_and_Lock(['rfio:/castor/cern.ch/atlas/atlascerngroupdisk/det-muon/Bytestream2010/MuonBytestreamRun155697_selectedCbMu10Events.data']) - - -# set the following to override the auto-config -#globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEO-08-00-01') -#jobproperties.BField.solenoidOn.set_Value_and_Lock(True) -#jobproperties.BField.barrelToroidOn.set_Value_and_Lock(True) -#jobproperties.BField.endcapToroidOn.set_Value_and_Lock(True) -#globalflags.ConditionsTag.set_Value_and_Lock('COMCOND-REPC-002-03') -#rec.triggerStream = "RPCwBeam" -rec.AutoConfiguration = ['TriggerStream','FieldAndGeo', 'ConditionsTag', 'BeamType' ] - - -## Descoping exercise (disable various parts in muon reconstruction chain ## -## - - -#----> DESCOPING EXERCISE (disable various parts of reconstruction chain) -# - -# Stop at formation of PRDs only -#muonRecFlags.Enabled = False - -# Disable MDTs -#muonRecFlags.doMDTs=False - -# Disable RPCs -#muonRecFlags.doRPCs=False - -# Disable TGCs -#muonRecFlags.doTGCs=False - -# Disable CSCs -#muonRecFlags.doCSCs=False - -# Stop Muonboy at segment level -#muonboyFlags.doSegmentsOnly = True - -# Stop Moore at segment level -#mooreFlags.doSegmentsOnly = True - -# Don't run on Muonboy at all -#muonRecFlags.doMuonboy = False - -# Don't run on Moore at all -#muonRecFlags.doMoore = False - -#----> END OF CONFIGURATION FOR DESCOPING EXERCISE -# - - - -# Run from an ESD file -#rec.readESD = True -#rec.doESD = False - -#rec.doPerfMon = True -#rec.doDetailedAuditor = True - -# Switch off the alignment corrections (on by default for data) -#muonRecFlags.useAlignmentCorrections = False - -# Switch on/off the T0 fit (on by default for data) -#muonRecFlags.doSegmentT0Fit = False - -# Calibration ntuple -#muonRecFlags.doCalibNtuple = False # write calibration ntuple? -#muonRecFlags.calibNtupleSegments = False # write segments to ntuple? -#muonRecFlags.calibNtupleTracks = False # write tracks to ntuple? -#muonRecFlags.calibNtupleTrigger = False # write trigger info to ntuple? -#muonRecFlags.calibMoore = False # write Moore tracks/segments to ntuple? -#muonRecFlags.calibMuonboy = False # write Muonboy tracks/segments to ntuple? - - - -# no truth when running on data -rec.doTruth = False - -# Switch Perfmon studies -rec.doPerfMon = True -rec.doDetailedPerfMon = True -rec.doNameAuditor = True - -# For Trigger MBTS and L1 Calo we need the Tile Calorimeter -# the algorithm: MuonCalibExtraTreeTriggerAlg stores trigger info -DetFlags.makeRIO.Calo_setOn() -DetFlags.detdescr.LVL1_setOn() -DetFlags.readRDOBS.LVL1_setOn() -# Temporarily switch off Tile because of crash (bug #51240) -# ==> Will have less (trigger) info in Calibration Ntuple !!! -rec.doTile = False -# Write ESDs -rec.doWriteESD = True - - -# Enable Persint Display -rec.doPersint.set_Value_and_Lock(False) - - -#-------------------------------------------------------------------------------- -# end of user flags -#-------------------------------------------------------------------------------- - -rec.doDetStatus.set_Value_and_Lock(False) # because of bug in DetectorStatus/DetStatusSvc_CondDB.py" -rec.Commissioning = True -# lock all flags. Very important! -#rec.lock_JobProperties() -muonRecFlags.lock_JobProperties() - - -# The main jobOption file -try: - include("MuonRecExample/MuonRec_topOptions.py") - ###### put any user finetuning after this line ##### - - ###### put any user finetuning before this line ##### - -##### DO NOT ADD ANYTHING AFTER THIS LINE ##### -except: - # print the stacktrace (saving could fail, and would then obscure the real problem) - import traceback - print traceback.format_exc().rstrip() - - # always write config so far for debugging - from AthenaCommon.ConfigurationShelve import saveToAscii - saveToAscii("config.txt") - # add DetFlags - from MuonRecExample.MuonRecUtils import dumpDetFlags - dumpDetFlags("config.txt") - # but still exit with error - import sys - sys.exit(10) -else: - # and write config to include user changes after topOptions - from AthenaCommon.ConfigurationShelve import saveToAscii - saveToAscii("config.txt") - # add DetFlags - from MuonRecExample.MuonRecUtils import dumpDetFlags - dumpDetFlags("config.txt") diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRDO_to_PRD_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRDO_to_PRD_jobOptions.py index e32bad35dfc1df6d6d29ba16eee9673516eaac66..e623d0e1f787b25102e9f4f0255dd08c42231f9a 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRDO_to_PRD_jobOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRDO_to_PRD_jobOptions.py @@ -36,33 +36,6 @@ if muonRecFlags.doTGCs() and DetFlags.makeRIO.TGC_on() and (DetFlags.haveRDO.TGC # if muonRecFlags.doPrdSelect(): include("MuonPrdSelector/MuonPrdSelector_jobOptions.py") - # cut away part of simulation for Commissioning setups - if globalflags.DataSource() == 'geant4' and beamFlags.beamType() == 'cosmics': - ToolSvc.MuonIdCutTool.MdtBarrelEtaList = [] - ToolSvc.MuonIdCutTool.MdtSectorList = [] - ToolSvc.MuonIdCutTool.RpcEtaList = [] - ToolSvc.MuonIdCutTool.RpcSectorList = [] - if muonRecFlags.dataPeriod() == 'M3': - ToolSvc.MuonIdCutTool.MdtBarrelEtaList = [] - ToolSvc.MuonIdCutTool.MdtSectorList = [5,6] - ToolSvc.MuonIdCutTool.RpcEtaList = [1,2,3,4,5,6,7,8] #sec 5A used to trigger - ToolSvc.MuonIdCutTool.RpcSectorList = [5] - elif muonRecFlags.dataPeriod() == 'M4': - ToolSvc.MuonIdCutTool.MdtBarrelEtaList = [] - ToolSvc.MuonIdCutTool.MdtSectorList = [3,4,5,6] - ToolSvc.MuonIdCutTool.RpcEtaList = [] - ToolSvc.MuonIdCutTool.RpcSectorList = [4,5] - elif muonRecFlags.dataPeriod() == 'M5': - ToolSvc.MuonIdCutTool.MdtBarrelEtaList = [] - ToolSvc.MuonIdCutTool.MdtSectorList = [1,2,3,4,5,6,7,8,9,10] - ToolSvc.MuonIdCutTool.RpcEtaList = [] - ToolSvc.MuonIdCutTool.RpcSectorList = [3,4,5,6] - elif muonRecFlags.dataPeriod() == 'M6': - ToolSvc.MuonIdCutTool.MdtBarrelEtaList = [] - ToolSvc.MuonIdCutTool.MdtSectorList = [1,2,3,4,5,6,7,8,9,10,11,12] - ToolSvc.MuonIdCutTool.RpcEtaList = [] - ToolSvc.MuonIdCutTool.RpcSectorList = [7,8] - if muonRecFlags.doCSCs() and DetFlags.makeRIO.CSC_on(): topSequence += getAlgorithm("CscThresholdClusterBuilder") diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecD3PDCreation.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecD3PDCreation.py deleted file mode 100644 index 9230fd6f40394a764d0aa89bd29df71b12e02f4f..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecD3PDCreation.py +++ /dev/null @@ -1,110 +0,0 @@ -## copied from InDetRecD3PDCreation.py -## Edward.Moyse@cern.ch - -import D3PDMakerCoreComps -import EventCommonD3PDMaker -from D3PDMakerCoreComps.D3PDObject import D3PDObject -from MuonRecExample.MuonRecFlags import muonRecFlags -from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags -from TrackD3PDMaker.TruthTrackD3PDObject import TruthTrackD3PDObject -from RecExConfig.RecFlags import rec -from MuonD3PDMaker.MuonD3PDMakerFlags import MuonD3PDFlags - -from MuonRecExample.MuonStandaloneFlags import muonStandaloneFlags - -## D3PD Maker alg -MuonTrackD3PDMaker = D3PDMakerCoreComps.MakerAlg('MuonTrackTree', -topSequence, -'MuonTrackD3PD.root') - -## Add blocks to the tree -from EventCommonD3PDMaker.EventInfoD3PDObject import EventInfoD3PDObject - -levelOfDetail = 2 - -if muonRecFlags.doTrkD3PD(): - - MuonD3PDFlags.doSegmentTruth.set_Value_and_Lock(rec.doTruth()) - - from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags - TrackD3PDFlags.doTruth = rec.doTruth() - TrackD3PDFlags.storeTRTHitsOnTrack = False - TrackD3PDFlags.storePixelHitsOnTrack = False - TrackD3PDFlags.storeSCTHitsOnTrack = False - TrackD3PDFlags.storeBLayerHitsOnTrack = False - TrackD3PDFlags.storeCSCHitsOnTrack = True - TrackD3PDFlags.storeMDTHitsOnTrack = True - TrackD3PDFlags.storeRPCHitsOnTrack = True - TrackD3PDFlags.storeTGCHitsOnTrack = True - TrackD3PDFlags.storePullsAndResiduals = True - ## Disable some things that are on by default - TrackD3PDFlags.storeVertexFitQuality = False - TrackD3PDFlags.storeVertexKinematics = False - TrackD3PDFlags.storeVertexPurity = False - TrackD3PDFlags.storeVertexTrackAssociation = False - TrackD3PDFlags.storeVertexTrackIndexAssociation = False - TrackD3PDFlags.storeTrackPredictionAtBLayer = False - TrackD3PDFlags.storeVertexType = False - TrackD3PDFlags.storeDetailedTruth = True - - #print TrackD3PDFlags - - from TrackD3PDMaker.TrackD3PDObject import TrackParticleD3PDObject - from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject - - if (levelOfDetail>10): - MuonTrackD3PDObject = TrackD3PDObject(_label='muon', - _prefix='mu_', - _sgkey='MuonSpectrometerTracks', - typeName='TrackCollection', - truthTarget='mc', - truthPrefix='mc_', - detailedTruthPrefix='detailed_mc_', - truthMapKey='MuonSpectrometerTrackTruthCollection', - detailedTruthMapKey='DetailedTrackTruth', - SGKeyForDetailedTruth='MuonSpectrometerTracks', - flags=TrackD3PDFlags) - - - MuonTrackD3PDMaker += MuonTrackD3PDObject(levelOfDetail) - - if rec.doTruth(): - MuonTrackD3PDMaker += TruthTrackD3PDObject(levelOfDetail) - - - MuonTrackPartD3PDObject = TrackD3PDObject(_label='muTP', - _prefix='muTP_', - _sgkey='MuonSpectrometerParticles', - typeName='Rec::TrackParticleContainer', - truthTarget='mc', - truthPrefix='mc_', - detailedTruthPrefix='detailed_mc_', - truthMapKey='MuonSpectrometerParticlesTruth', - detailedTruthMapKey='MuonSpectrometerTracksTruth', - flags=TrackD3PDFlags) - MuonTrackD3PDMaker += MuonTrackPartD3PDObject(levelOfDetail) - - # TODO - add segments? - from MuonD3PDMaker.MuonSegmentD3PDObject import MuonSegmentD3PDObject - from MuonD3PDMaker.MuonSegmentTruthD3PDObject import MuonSegmentTruthD3PDObject - MuonTrackD3PDMaker += MuonSegmentD3PDObject( 10, name = 'MuonSeg', - sgkey='MuonSegments', - prefix='muonseg_', - include = ['MuonSegmentT0'], - exclude = ['MuonboySegmentT0'], - allowMissing=True - ) - if muonRecFlags.doStandalone() and muonRecFlags.doNSWNewThirdChain() and muonStandaloneFlags.segmentOrigin == 'TruthTracking': - MuonTrackD3PDMaker += MuonSegmentD3PDObject( 10, name = 'MuonSeg2', - sgkey='ThirdChainSegments', - prefix='muonseg2_', - include = ['MuonSegmentT0'], - exclude = ['MuonboySegmentT0'], - allowMissing=True - ) - - # Truth - if rec.doTruth(): - from MuonD3PDMaker.TrackRecordD3PDObject import TrackRecordD3PDObject - MuonTrackD3PDMaker += TrackRecordD3PDObject(10, "TrackRecord") - diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecLoadTools.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecLoadTools.py index dfa766e978126188efeb575a45b6ee9bf2c90a12..ac163350ae9a7b9558fd61b9fad7c6a9b27acfb6 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecLoadTools.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecLoadTools.py @@ -9,12 +9,9 @@ MuonMaterialUpdator = CfgGetter.getPublicTool("MuonMaterialEffectsUpda MuonPropagator = CfgGetter.getPublicTool('MuonPropagator') MuonExtrapolator = CfgGetter.getPublicTool('MuonExtrapolator') MuonMeasUpdator = CfgGetter.getPublicTool('MuonMeasUpdator') -MuonKalmanTrackFitter = CfgGetter.getPublicTool('MuonKalmanTrackFitter') -#MuonHolesOnTrackTool = CfgGetter.getPublicTool('MuonHolesOnTrackTool') MuonTrackSummaryHelperTool = CfgGetter.getPublicTool("MuonTrackSummaryHelper") MuonTrackSummaryTool = CfgGetter.getPublicTool("MuonTrackSummaryTool") AtlasExtrapolator = CfgGetter.getPublicTool("AtlasExtrapolator") -#MuonDynamicLayerCreator = CfgGetter.getPublicTool("MuonDynamicLayerCreator") MuonChi2TrackFitter = CfgGetter.getPublicTool('MuonChi2TrackFitter') MuonChi2SLTrackFitter = CfgGetter.getPublicTool("MuonChi2SLTrackFitter") DCMathSegmentMaker = CfgGetter.getPublicTool("DCMathSegmentMaker") diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecOutputItemList_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecOutputItemList_jobOptions.py index 2d9bf42db083c7ea04009eae9ec61868e9bb7e20..5b72d3d27038601278cc2c0c5611da9218a6848f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecOutputItemList_jobOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRecOutputItemList_jobOptions.py @@ -12,6 +12,9 @@ if DetFlags.detdescr.Muon_on() and (rec.doWriteAOD() or rec.doWriteESD()): MuonAODList+=[ "xAOD::MuonSegmentContainer#MuonSegments" ] MuonAODList+=[ "xAOD::MuonSegmentAuxContainer#MuonSegmentsAux." ] + MuonAODList+=[ "xAOD::MuonSegmentContainer#NCB_MuonSegments" ] + MuonAODList+=[ "xAOD::MuonSegmentAuxContainer#NCB_MuonSegmentsAux." ] + # TrackParticles MuonAODList+=[ "xAOD::TrackParticleContainer#MuonSpectrometerTrackParticles" ] MuonAODList+=[ "xAOD::TrackParticleAuxContainer#MuonSpectrometerTrackParticlesAux." ] @@ -76,6 +79,7 @@ if DetFlags.detdescr.Muon_on() and rec.doWriteESD(): # Segments MuonESDList+=["Trk::SegmentCollection#MuonSegments"] + MuonESDList+=["Trk::SegmentCollection#NCB_MuonSegments"] # Tracks MuonESDList+=["TrackCollection#MuonSpectrometerTracks"] @@ -100,7 +104,7 @@ if DetFlags.detdescr.Muon_on() and rec.doWriteESD(): MuonESDList+=["MuonSimDataCollection#STGC_SDO"] MuonESDList+=["MuonSimDataCollection#MM_SDO"] - if muonRecFlags.Commissioning(): + if muonRecFlags.writeRDOs(): # Write out CSC, RPC, and MDT RDOs. # I'm wondering if we should be doing something in MuonCnvExample to ensure we have the right # configuration? See bug#59676 diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py index 7ba739947ffe76c354dafe1e0d1d5b0a175f99c9..dec58fc72fbdd71e48c670d87f4613fa9d6bfe11 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_jobOptions.py @@ -3,7 +3,6 @@ # @brief Main jobOptions to setup muon reconstruction. Main muon entry point for RecExCommon. # # Setup the data converters depending on the type of input file and run muon standalone reconstruction -# depending on MuonRecFlags.doMuonboy and doMoore. # It can optionally write out the calibration ntuple (depending on muonRecFlags.doCalib) # # @author Martin Woudstra @@ -102,21 +101,19 @@ if rec.doTruth() and DetFlags.makeRIO.Muon_on(): #load default tools: -if muonRecFlags.doMoore() or muonRecFlags.doMuonboy() or (muonRecFlags.doStandalone() and not muonStandaloneFlags.patternsOnly()) \ - or muonRecFlags.doPseudoTracking(): +if muonRecFlags.doStandalone() or muonRecFlags.doPseudoTracking(): include ("MuonRecExample/MuonRecLoadTools.py") if muonRecFlags.doPseudoTracking(): include("MuonRecExample/MuonTrackTruthCreation.py") -if muonRecFlags.doMoore() or muonRecFlags.doMuonboy() or muonRecFlags.doStandalone(): +if muonRecFlags.doStandalone(): # - # Load reconstruction algorithms (Muonboy,Moore,MuonStandalone) + # Load reconstruction algorithms (MuonStandalone) # from MuonRecExample.MuonRec import muonRec - muonRecFlags.doMSVertex = True if rec.doTruth(): from MuonTruthAlgs.MuonTruthAlgsConf import MuonDetailedTrackTruthMaker @@ -153,12 +150,6 @@ if muonRecFlags.doCalib() or muonRecFlags.doCalibNtuple(): if muonRecFlags.doTrackPerformance(): include("MuonRecExample/MuonTrackPerformance_jobOptions.py") -#-------------------------------------------------------------------------- -# Make D3PDs -#-------------------------------------------------------------------------- -if muonRecFlags.doTrkD3PD(): - include("MuonRecExample/MuonRecD3PDCreation.py") - if muonRecFlags.doMSVertex(): from MSVertexRecoAlg.MSVertexRecoAlgConf import MSVertexRecoAlg topSequence+=MSVertexRecoAlg("MSVertexRecoAlg") diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py index b319a725465afd93520af0f58bcdf199cf7dfaa3..306d008d81183adc21b9ab4a344d5b42b17041eb 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_myTopOptions.py @@ -6,23 +6,12 @@ from AthenaCommon.AthenaCommonFlags import athenaCommonFlags ## flag to set number of events to be processed EvtMax = -1 -## flag to run low-level muon D3PD making (temporary workaround until MuonD3PDMaker is fully migrated) -## In Mig5: it requires to compile locally packages from ~mbellomo/public/muValid/eigen/setupToRunRecoD3PD -## In devval : it requires to check-out and compile trunk of MuonRecoD3PDMaker -doD3PD = False - ## flag for running in mig5 doMig5 = False -# flags to tweak standalone muon reconstruction -from MuonRecExample.MuonStandaloneFlags import muonStandaloneFlags - # in Standalone mode, don't allow any configuration errors athenaCommonFlags.AllowIgnoreConfigError = False -# add some more flags available for standalone running -import MuonRecExample.MuonRecStandaloneFlags - # configure flags so that only Muon Standalone reco is run import MuonRecExample.MuonRecStandaloneOnlySetup @@ -61,15 +50,7 @@ muonRecFlags.doCalibNtuple = False # write calibration ntuple? #muonRecFlags.calibNtupleSegments = False # write segments to ntuple? #muonRecFlags.calibNtupleTracks = False # write tracks to ntuple? #muonRecFlags.calibNtupleTrigger = False # write trigger info to ntuple? -#muonRecFlags.calibMoore = False # write Moore tracks/segments to ntuple? -#muonRecFlags.calibMuonboy = False # write Muonboy tracks/segments to ntuple? -#muonRecFlags.doTrkD3PD = True # write d3PDs ### -#muonRecFlags.doMuonboy = False # switch on or off Muonboy -#muonRecFlags.doMoore = False # switch on or off Moore - -### Switch on/off d3PDs -#muonRecFlags.doTrkD3PD = False #rec.doNameAuditor = True #muonRecFlags.doVP1 = True # Decide whether to run Virtual Point1 graphical event display @@ -81,8 +62,6 @@ rec.doTruth=True #muonRecFlags.useAlignmentCorrections = True rec.doTrigger = False #recFlags.doTruth.set_Value_and_Lock(False) -muonRecFlags.doMoore.set_Value_and_Lock(False) -muonRecFlags.doMuonboy.set_Value_and_Lock(False) muonRecFlags.doStandalone.set_Value_and_Lock(True) # Read geometry alignment corrections from DB #muonRecFlags.useAlignmentCorrections = True @@ -125,11 +104,6 @@ try: ###### put any user finetuning before this line ##### - # D3PD - if doD3PD: - from MuonRecoD3PDMaker.muonRecoD3PD import muonRecoD3PD - muonRecoD3PD ("muon_reco.root") - ##### DO NOT ADD ANYTHING AFTER THIS LINE ##### except: # print the stacktrace (saving could fail, and would then obscure the real problem) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_topOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_topOptions.py index 5f5cd0956e351a1d917cdc037ec6459f7a8adcb7..ce824b0e692bbabb9f4f71573a62da4edc69457e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_topOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonRec_topOptions.py @@ -29,9 +29,6 @@ from RecExConfig.RecConfFlags import recConfFlags from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.GlobalFlags import globalflags -# add some more flags available for standalone running -import MuonRecExample.MuonRecStandaloneFlags - # configure flags so that only Muon Standalone reco is run import MuonRecExample.MuonRecStandaloneOnlySetup @@ -114,16 +111,6 @@ if muonRecFlags.doVP1(): from VP1Algs.VP1AlgsConf import VP1Alg topSequence += VP1Alg() - -if rec.doPersint(): - from MboyView.MboyViewConf import MboyView - theMboyView = MboyView() - if muonRecFlags.doMuonboy(): - theMboyView.TrkTrackCollectionLocationList+=["ConvertedMBoyTracks"] - if muonRecFlags.doMoore(): - theMboyView.TrkTrackCollectionLocationList+=["MooreTracks"] - theMboyView.TrkSegmentCollectionLocationList+=["MooreSegments"] - #-------------------------------------------------------------------------- # Dump configuration to file #-------------------------------------------------------------------------- diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonTrackPerformance_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonTrackPerformance_jobOptions.py index 1feb473965c9d3355303dd70de81073c27a37680..24f3bad94f2dd3e8c92c1c161969e15dbd9a7783 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonTrackPerformance_jobOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/MuonTrackPerformance_jobOptions.py @@ -5,25 +5,10 @@ muonRecFlags.setDefaults() from MuonTrackPerformance.MuonTrackPerformanceConf import MuonTrackPerformanceAlg from AthenaCommon.CfgGetter import getPublicTool -getPublicTool("MuonTrackTruthTool") - -if muonRecFlags.doMoore: - topSequence += MuonTrackPerformanceAlg("MoorePerformanceAlg", - TrackInputLocation = "MooreTracks", - DoSummary = muonRecFlags.TrackPerfSummaryLevel(), - DoTruth = rec.doTruth(), - DoTrackDebug = muonRecFlags.TrackPerfDebugLevel() ) - - -if muonRecFlags.doMuonboy: - topSequence += MuonTrackPerformanceAlg("MuonboyPerformanceAlg", - TrackInputLocation = "ConvertedMBoyMuonSpectroOnlyTracks", - DoSummary = muonRecFlags.TrackPerfSummaryLevel(), - DoTruth = rec.doTruth(), - DoTrackDebug = muonRecFlags.TrackPerfDebugLevel() ) if muonRecFlags.doStandalone: + getPublicTool("MuonTrackTruthTool") topSequence += MuonTrackPerformanceAlg("MuonStandalonePerformanceAlg", TrackInputLocation = "MuonSpectrometerTracks", DoSummary = muonRecFlags.TrackPerfSummaryLevel(), diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/muonReprocOptions.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/muonReprocOptions.py deleted file mode 100644 index 45a3d36090b76d08244b07930d63dc8b27cd5ced..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/share/muonReprocOptions.py +++ /dev/null @@ -1,45 +0,0 @@ -from OutputStreamAthenaPool.MultipleStreamManager import MSMgr -if MSMgr.StreamExists("StreamESD"): - myStream=MSMgr.GetStream("StreamESD") - myStream.AddItem("TrackCollection#Tracks_split") - myStream.AddItem("Rec::TrackParticleContainer#TrackParticleCandidate_split") - -from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags -muonCombinedRecFlags.doTrackNtuple = True - - - - -if hasattr(runArgs,"inputBSFile"): - - - from InDetTrackSplitterTool.InDetTrackSplitterToolConf import InDet__InDetTrackSplitterTool - splittertoolcomb= InDet__InDetTrackSplitterTool(name='MuonCombinedSplitterTool', - TrackFitter=ToolSvc.MuonCombinedTrackFitter) - ToolSvc += splittertoolcomb - - from InDetTrackValidation.InDetTrackValidationConf import InDet__InDetSplittedTracksCreator - splittercomb=InDet__InDetSplittedTracksCreator(name='MuonCombinedTrackSplitter', - TrackSplitterTool = splittertoolcomb, - TrackCollection = "Combined_Tracks", - OutputTrackCollection = "Combined_Tracks_split") - topSequence+=splittercomb - - from InDetTrackSplitterTool.InDetTrackSplitterToolConf import InDet__InDetTrackSplitterTool - splittertoolcomb= InDet__InDetTrackSplitterTool(name='MuonCombinedSplitterTool', - TrackFitter=ToolSvc.MuonCombinedTrackFitter) - ToolSvc += splittertoolcomb - - from InDetTrackValidation.InDetTrackValidationConf import InDet__InDetSplittedTracksCreator - splittercomb=InDet__InDetSplittedTracksCreator(name='MuonCombinedTrackSplitter', - TrackSplitterTool = splittertoolcomb, - TrackCollection = "Combined_Tracks", - OutputTrackCollection = "Combined_Tracks_split") - topSequence+=splittercomb - - theStacoMaster.IDTrackParticleCollectionLocation="TrackParticleCandidate_split" - theStaco.SelectUpDown = -2 - theStacoUP.SelectUpDown - 2 - - - diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/test/MuonRecFlags_test.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/test/MuonRecFlags_test.py index b7ee0fd0c7fc9000d46ee1350ba371e12fc76652..7b3350e786984a5b2c4c50be80e3880a121759b2 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/test/MuonRecFlags_test.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/test/MuonRecFlags_test.py @@ -14,355 +14,6 @@ from AthenaCommon.Logging import logging log = logging.getLogger("MuonRecFlags_test.py") log.setLevel(logging.DEBUG) -oldMuonboyFlags = { 'doMuonboy' : 'Muonboy' } -oldMooreFlags = { 'doStandardMoore' : 'Moore.StandardMoore' , - 'doMoMuMoore' : 'Moore.MoMuMoore' , - 'doCsc4dMoore' : 'Moore.Csc4dMoore' , - 'doMoMu' : 'Moore.MoMu' } - -oldRecoFlags = { 'doMoore' : 'Moore' } -oldRecoFlags.update(oldMooreFlags) -oldRecoFlags.update(oldMuonboyFlags) - -class MuonRecFlagsTestCase(UnitTest.TestCase): - def setUp(self): - UnitTest.TestCase.setUp(self) - # remove all old moore flags - import __main__ - self.removeOldFlags() - from MuonRecExample import MuonRecFlags - self.MuonRecFlags = MuonRecFlags - self.muonRecFlags = MuonRecFlags.muonRecFlags - MuonRecFlags.log.setLevel(logging.DEBUG) - - def removeOldFlags(self): - global __main__,oldRecoFlags - for f in oldRecoFlags: - try: - delattr(__main__,f) - except AttributeError: - pass - - - def setOldFlags(self,**flagList): - global __main__ - for n,v in flagList.items(): - setattr(__main__,n,v) - - - def getOldFlag(self,name): - global __main__ - return getattr(__main__,name,None) - - def getFlagsString(self): - oldFlags = {} - for f in oldRecoFlags: - try: - oldFlags[f] = getattr(__main__,f) - except AttributeError: - pass - return ', '.join( [ '%s=%s' % (n,v) for n,v in oldFlags.items() ] ) - - - -class SelectRecoTestCase(MuonRecFlagsTestCase): - """Tests of the muonRecFlags.SelectReco""" - def setUp(self): - MuonRecFlagsTestCase.setUp(self) - self.SelectReco = self.muonRecFlags.SelectReco - - def assertSelectReco(self,value,message): - # get combination of flags for error message - global __main__ - shortSelected = [ RecConfigInfo(s).shortTag for s in self.SelectReco() ] - shortExpected = [ RecConfigInfo(s).shortTag for s in value ] - message += os.linesep + \ - 'Expected new flags: %r' % (shortExpected,) + os.linesep + \ - ' Got new flags: %r' % (shortSelected,) - - self.assertEqual( shortSelected, shortExpected, message ) - - - def assertNewFlagsOK(self,enableMoore,enableMuonboy,outFlags,**inFlags): - global oldRecoFlags - self.SelectReco._doNewToOldFlags = False - self.MuonRecFlags.resetOriginalState() - self.removeOldFlags() - self.setOldFlags( **inFlags ) - self.MuonRecFlags.doNewStyleMooreConfig = enableMoore - self.MuonRecFlags.doNewStyleMuonboyConfig = enableMuonboy - inputOldFlags = "newStyleMuonboy=%r newStyleMoore=%r %s" % (enableMuonboy, enableMoore, self.getFlagsString()) - self.SelectReco.set_Off() - inputNewFlags = None - self.SelectReco.oldToNewFlags() - message = os.linesep + \ - ' Input new flags: %r' % (inputNewFlags,) + os.linesep + \ - ' Input old flags: %s' % (inputOldFlags,) - self.assertSelectReco( outFlags, message ) - self.SelectReco.set_On() - inputNewFlags = self.SelectReco.get_Value() - self.SelectReco.oldToNewFlags() - message = os.linesep + \ - ' Input new flags: %r' % (inputNewFlags,) + os.linesep + \ - ' Input old flags: %s' % (inputOldFlags,) - self.assertSelectReco( outFlags, message ) - - - def testAllOff(self): - """All Muon Reco off""" - self.assertNewFlagsOK( False, False, [] ) - self.assertNewFlagsOK( False, False, [], doMoore=False, doMuonboy=False ) - self.assertNewFlagsOK( False, False, [], doMoore=True, doMuonboy=True ) - self.assertNewFlagsOK( True, True, [], doMoore=False, doMuonboy=False ) - self.assertNewFlagsOK( False, True, [], doMoore=False, doMuonboy=False ) - self.assertNewFlagsOK( False, True, [], doMoore=True, doMuonboy=False ) - self.assertNewFlagsOK( True, False, [], doMoore=False, doMuonboy=False ) - self.assertNewFlagsOK( True, False, [], doMoore=False, doMuonboy=True ) - self.assertNewFlagsOK( False, False, [], doMoore=True, doMuonboy=True ) - self.assertNewFlagsOK( False, False, [], doMoore=True, doStandardMoore=True ) - self.assertNewFlagsOK( True, False, [], doMoore=False, doStandardMoore=True ) - self.assertNewFlagsOK( False, False, [], doMoore=True, doMoMuMoore=True ) - self.assertNewFlagsOK( True, False, [], doMoore=False, doMoMuMoore=True ) - - - def testMuonboyOldMoore(self): - """Muonboy with old-style Moore""" - self.assertNewFlagsOK( False, True, ['Muonboy'] ) - self.assertNewFlagsOK( False, True, ['Muonboy'], doMuonboy=True ) - self.assertNewFlagsOK( False, True, ['Muonboy'], doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( False, True, ['Muonboy'], doMuonboy=True, doStandardMoore=True ) - self.assertNewFlagsOK( False, True, ['Muonboy'], doMuonboy=True, doStandardMoore=True, doMoore=True ) - - - def testDefaultMooreOldMuonboy(self): - """Default Moore with new-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, False, ['Moore'], # from default - doMoore=True ) - # doMuonboy=False - self.assertNewFlagsOK( True, False, ['Moore'], - doMoore=True, doMuonboy=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, False, ['Moore'], - doMoore=True, doMuonboy=True ) - - - def testDefaultMooreNewMuonboy(self): - """Default Moore with new-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, True, ['Muonboy','Moore'], # from default - doMoore=True ) - # doMuonboy=False - self.assertNewFlagsOK( True, True, ['Moore'], - doMoore=True, doMuonboy=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, True, ['Muonboy','Moore'], - doMoore=True, doMuonboy=True ) - - - def testStandardMooreOldMuonboy(self): - """StandardMoore with old-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, False, ['Moore.StandardMoore'], - doStandardMoore=True ) - self.assertNewFlagsOK( True, False, ['Moore.StandardMoore'], - doStandardMoore=True, doMoore = True ) - self.assertNewFlagsOK( True, False, [], - doStandardMoore=True, doMoore = False ) - # doMuonboy=False - self.assertNewFlagsOK( True, False, ['Moore.StandardMoore'], - doStandardMoore=True, doMuonboy=False ) - self.assertNewFlagsOK( True, False, ['Moore.StandardMoore'], - doStandardMoore=True, doMuonboy=False, doMoore=True ) - self.assertNewFlagsOK( True, False, [], - doStandardMoore=True, doMuonboy=False, doMoore=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, False, ['Moore.StandardMoore'], - doStandardMoore=True, doMuonboy=True ) - self.assertNewFlagsOK( True, False, ['Moore.StandardMoore'], - doStandardMoore=True, doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( True, False, [], - doStandardMoore=True, doMuonboy=True, doMoore=False ) - - - def testStandardMooreNewMuonboy(self): - """StandardMoore with new-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.StandardMoore'], - doStandardMoore=True ) - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.StandardMoore'], - doStandardMoore=True, doMoore = True ) - self.assertNewFlagsOK( True, True, ['Muonboy'], - doStandardMoore=True, doMoore = False ) - # doMuonboy=False - self.assertNewFlagsOK( True, True, ['Moore.StandardMoore'], - doStandardMoore=True, doMuonboy=False ) - self.assertNewFlagsOK( True, True, ['Moore.StandardMoore'], - doStandardMoore=True, doMuonboy=False, doMoore=True ) - self.assertNewFlagsOK( True, True, [], - doStandardMoore=True, doMuonboy=False, doMoore=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.StandardMoore'], - doStandardMoore=True, doMuonboy=True ) - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.StandardMoore'], - doStandardMoore=True, doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( True, True, ['Muonboy'], - doStandardMoore=True, doMuonboy=True, doMoore=False ) - - - def testMoMuMooreOldMuonboy(self): - """MoMuMoore with old-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, False, ['Moore.MoMuMoore'], - doMoMuMoore=True ) - self.assertNewFlagsOK( True, False, ['Moore.MoMuMoore'], - doMoMuMoore=True, doMoore = True ) - self.assertNewFlagsOK( True, False, [], - doMoMuMoore=True, doMoore = False ) - # doMuonboy=False - self.assertNewFlagsOK( True, False, ['Moore.MoMuMoore'], - doMoMuMoore=True, doMuonboy=False ) - self.assertNewFlagsOK( True, False, ['Moore.MoMuMoore'], - doMoMuMoore=True, doMuonboy=False, doMoore=True ) - self.assertNewFlagsOK( True, False, [], - doMoMuMoore=True, doMuonboy=False, doMoore=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, False, ['Moore.MoMuMoore'], - doMoMuMoore=True, doMuonboy=True ) - self.assertNewFlagsOK( True, False, ['Moore.MoMuMoore'], - doMoMuMoore=True, doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( True, False, [], - doMoMuMoore=True, doMuonboy=True, doMoore=False ) - - - def testMoMuMooreNewMuonboy(self): - """MoMuMoore with new-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.MoMuMoore'], - doMoMuMoore=True ) - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.MoMuMoore'], - doMoMuMoore=True, doMoore = True ) - self.assertNewFlagsOK( True, True, ['Muonboy'], - doMoMuMoore=True, doMoore = False ) - # doMuonboy=False - self.assertNewFlagsOK( True, True, ['Moore.MoMuMoore'], - doMoMuMoore=True, doMuonboy=False ) - self.assertNewFlagsOK( True, True, ['Moore.MoMuMoore'], - doMoMuMoore=True, doMuonboy=False, doMoore=True ) - self.assertNewFlagsOK( True, True, [], - doMoMuMoore=True, doMuonboy=False, doMoore=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.MoMuMoore'], - doMoMuMoore=True, doMuonboy=True ) - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.MoMuMoore'], - doMoMuMoore=True, doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( True, True, ['Muonboy'], - doMoMuMoore=True, doMuonboy=True, doMoore=False ) - - - def testCsc4dMooreOldMuonboy(self): - """Csc4dMoore with old-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, False, ['Moore.Csc4dMoore'], - doCsc4dMoore=True ) - self.assertNewFlagsOK( True, False, ['Moore.Csc4dMoore'], - doCsc4dMoore=True, doMoore = True ) - self.assertNewFlagsOK( True, False, [], - doCsc4dMoore=True, doMoore = False ) - # doMuonboy=False - self.assertNewFlagsOK( True, False, ['Moore.Csc4dMoore'], - doCsc4dMoore=True, doMuonboy=False ) - self.assertNewFlagsOK( True, False, ['Moore.Csc4dMoore'], - doCsc4dMoore=True, doMuonboy=False, doMoore=True ) - self.assertNewFlagsOK( True, False, [], - doCsc4dMoore=True, doMuonboy=False, doMoore=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, False, ['Moore.Csc4dMoore'], - doCsc4dMoore=True, doMuonboy=True ) - self.assertNewFlagsOK( True, False, ['Moore.Csc4dMoore'], - doCsc4dMoore=True, doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( True, False, [], - doCsc4dMoore=True, doMuonboy=True, doMoore=False ) - - - def testCsc4dMooreNewMuonboy(self): - """Csc4dMoore with new-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.Csc4dMoore'], - doCsc4dMoore=True ) - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.Csc4dMoore'], - doCsc4dMoore=True, doMoore = True ) - self.assertNewFlagsOK( True, True, ['Muonboy'], - doCsc4dMoore=True, doMoore = False ) - # doMuonboy=False - self.assertNewFlagsOK( True, True, ['Moore.Csc4dMoore'], - doCsc4dMoore=True, doMuonboy=False ) - self.assertNewFlagsOK( True, True, ['Moore.Csc4dMoore'], - doCsc4dMoore=True, doMuonboy=False, doMoore=True ) - self.assertNewFlagsOK( True, True, [], - doCsc4dMoore=True, doMuonboy=False, doMoore=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.Csc4dMoore'], - doCsc4dMoore=True, doMuonboy=True ) - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.Csc4dMoore'], - doCsc4dMoore=True, doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( True, True, ['Muonboy'], - doCsc4dMoore=True, doMuonboy=True, doMoore=False ) - - - def testMoMuOldMuonboy(self): - """MoMu with old-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, False, ['Moore.MoMu'], - doMoMu=True ) - self.assertNewFlagsOK( True, False, ['Moore.MoMu'], - doMoMu=True, doMoore = True ) - self.assertNewFlagsOK( True, False, [], - doMoMu=True, doMoore = False ) - # doMuonboy=False - self.assertNewFlagsOK( True, False, ['Moore.MoMu'], - doMoMu=True, doMuonboy=False ) - self.assertNewFlagsOK( True, False, ['Moore.MoMu'], - doMoMu=True, doMuonboy=False, doMoore=True ) - self.assertNewFlagsOK( True, False, [], - doMoMu=True, doMuonboy=False, doMoore=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, False, ['Moore.MoMu'], - doMoMu=True, doMuonboy=True ) - self.assertNewFlagsOK( True, False, ['Moore.MoMu'], - doMoMu=True, doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( True, False, [], - doMoMu=True, doMuonboy=True, doMoore=False ) - - - def testMoMuNewMuonboy(self): - """MoMu with new-style Muonboy""" - # no doMuonboy defined - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.MoMu'], - doMoMu=True ) - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.MoMu'], - doMoMu=True, doMoore = True ) - self.assertNewFlagsOK( True, True, ['Muonboy'], - doMoMu=True, doMoore = False ) - # doMuonboy=False - self.assertNewFlagsOK( True, True, ['Moore.MoMu'], - doMoMu=True, doMuonboy=False ) - self.assertNewFlagsOK( True, True, ['Moore.MoMu'], - doMoMu=True, doMuonboy=False, doMoore=True ) - self.assertNewFlagsOK( True, True, [], - doMoMu=True, doMuonboy=False, doMoore=False ) - # doMuonboy=True - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.MoMu'], - doMoMu=True, doMuonboy=True ) - self.assertNewFlagsOK( True, True, ['Muonboy','Moore.MoMu'], - doMoMu=True, doMuonboy=True, doMoore=True ) - self.assertNewFlagsOK( True, True, ['Muonboy'], - doMoMu=True, doMuonboy=True, doMoore=False ) - - - - - # execute the tests if __name__ == "__main__": UnitTest.main()