Skip to content
Snippets Groups Projects
Commit d8690130 authored by Johannes Junggeburth's avatar Johannes Junggeburth :dog2: Committed by Vakhtang Tsulaia
Browse files

Tschuuuuus MuonRecExample... Tschuuuus MuonCombinedRecExample

Tschuuuuus MuonRecExample... Tschuuuus MuonCombinedRecExample
parent 5bec6f89
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 2989 deletions
......@@ -7,6 +7,3 @@ atlas_subdir( MuonCnvExample )
# Install files from the package:
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
atlas_install_joboptions( share/*.py )
atlas_install_runtime( share/*.data )
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.Logging import logging
log = logging.getLogger()
log.info("importing module %r",__name__)
from AthenaCommon.GlobalFlags import globalflags
from MuonByteStream.MuonByteStreamFlags import muonByteStreamFlags
from AthenaCommon.AppMgr import theApp,ToolSvc,ServiceMgr
from AthenaCommon.DetFlags import DetFlags
from MuonCnvExample.MuonCnvFlags import muonCnvFlags
from MuonRecExample.MuonRecFlags import muonRecFlags
from AthenaCommon.AlgSequence import AthSequencer
from MuonMDT_Cabling.MuonMDT_CablingConf import MuonMDT_CablingAlg
from MuonNRPC_Cabling.MuonNRPC_CablingConf import MuonNRPC_CablingAlg
condSequence = AthSequencer("AthCondSeq")
if DetFlags.MDT_on():
condSequence += MuonMDT_CablingAlg("MuonMDT_CablingAlg")
from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags
condSequence.MuonMDT_CablingAlg.isRun3 = CommonGeometryFlags.Run not in ["RUN1","RUN2"]
if DetFlags.MM_on() and globalflags.DataSource() == 'data': # the MM cabling correction is only needed for data
from MuonMM_Cabling.MuonMM_CablingConf import MuonMM_CablingAlg
condSequence += MuonMM_CablingAlg("MuonMM_CablingAlg")
# defaults have to be re-set now since the jobproperties and trigger flags are now available # SS
muonCnvFlags.setDefaults()
if globalflags.DataSource() == 'data':
# TODO: move these flags to this package - or remove them altogether
muonByteStreamFlags.TgcDataType = "atlas"
muonByteStreamFlags.RpcDataType = "atlas"
muonByteStreamFlags.MdtDataType = "atlas"
log.info("configuring Muon cabling in MuonCablingConfig")
if DetFlags.readRDOBS.RPC_on() or DetFlags.readRDOPool.RPC_on() or DetFlags.readRIOPool.RPC_on() or DetFlags.digitize.RPC_on():
try:
log.info("importing the MetaReader for MuoncablingConfig")
from PyUtils.MetaReaderPeekerFull import metadata
if 'RPC_CablingType' in metadata['/TagInfo']:
cablingTag = metadata['/TagInfo']['RPC_CablingType']
log.info("Have retrieved RPC taginfo of " + str(cablingTag) + ". Setting default mode to new" )
muonCnvFlags.RpcCablingMode = 'new'
else:
log.info("No RPC cabling taginfo found. Using normal configuration.")
except KeyError:
log.info("No metadata/Taginfo found. Using normal configuration for RPC")
log.info("RPC cabling is using mode: %s",muonCnvFlags.RpcCablingMode())
isMC = globalflags.DataSource() != 'data'
rpcDbName = 'RPC_OFL' if isMC else 'RPC'
dbRepo="MuonRPC_Cabling/ATLAS.data"
rpcCabMap="/RPC/CABLING/MAP_SCHEMA"
rpcCabMapCorr="/RPC/CABLING/MAP_SCHEMA_CORR"
rpcTrigEta="/RPC/TRIGGER/CM_THR_ETA"
rpcTrigPhi="/RPC/TRIGGER/CM_THR_PHI"
from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
# This block with conditions override is only used in Trigger and Reco, and only needed until mid-May 2022.
# See ATR-25059 for discussion. To avoid this ConfigFlags based block being executed in Digitization,
# skip this if the DetFlags digitization flag for Muons is set.
if not DetFlags.digitize.Muon_on():
from AthenaConfiguration.AllConfigFlags import ConfigFlags
if ConfigFlags.Trigger.enableL1MuonPhase1 and ConfigFlags.Trigger.doLVL1:
# Run3 trigger roads are not avaialble in the global tag yet (OFLCOND-MC16-SDR-RUN3-01)
# Relevant folder tags are set for now, until new global tag (RUN3-02) becomes avaialble
rpcTrigEta="/RPC/TRIGGER/CM_THR_ETA <tag>RPCTriggerCMThrEta_RUN12_MC16_04</tag> <forceRunNumber>330000</forceRunNumber>"
rpcTrigPhi="/RPC/TRIGGER/CM_THR_PHI <tag>RPCTriggerCMThrPhi_RUN12_MC16_04</tag> <forceRunNumber>330000</forceRunNumber>"
if isMC and MuonGeometryFlags.hasSTGC(): # Run3-geometry
rpcCabMap="/RPC/CABLING/MAP_SCHEMA <tag>RPCCablingMapSchema_2015-2018Run3-4</tag> <forceRunNumber>330000</forceRunNumber>"
rpcCabMapCorr="/RPC/CABLING/MAP_SCHEMA_CORR <tag>RPCCablingMapSchemaCorr_2015-2018Run3-4</tag> <forceRunNumber>330000</forceRunNumber>"
from IOVDbSvc.CondDB import conddb
conddb.addFolder(rpcDbName,rpcCabMap,className='CondAttrListCollection')
conddb.addFolder(rpcDbName,rpcCabMapCorr,className='CondAttrListCollection')
# Same protection of digitization as above, ATR-25059
if not DetFlags.digitize.Muon_on() and not isMC and ConfigFlags.Trigger.doLVL1:
# RPC trigger roads in the online database are not up-to-dated
# Use offline database for now
# Will switch to online database once online database has been updated (ATR-23465)
conddb._SetAcc('RPC_OFL','COOLOFL_RPC')
conddb.blockFolder("/RPC/TRIGGER/CM_THR_ETA")
conddb.blockFolder("/RPC/TRIGGER/CM_THR_PHI")
if ConfigFlags.Trigger.enableL1MuonPhase1:
conddb.addFolder('RPC_OFL',rpcTrigEta,className='CondAttrListCollection')
conddb.addFolder('RPC_OFL',rpcTrigPhi,className='CondAttrListCollection')
else:
conddbNameOffline = ConfigFlags.Trigger.L1MuonSim.CondDBOffline if ConfigFlags.Trigger.L1MuonSim.CondDBOffline != '' else "OFLCOND-MC16-SDR-RUN2-04"
conddb.addFolderWithTag('RPC_OFL',rpcTrigEta,conddbNameOffline,className='CondAttrListCollection',forceMC=True,force=True)
conddb.addFolderWithTag('RPC_OFL',rpcTrigPhi,conddbNameOffline,className='CondAttrListCollection',forceMC=True,force=True)
else:
conddb.addFolder(rpcDbName,rpcTrigEta,className='CondAttrListCollection')
conddb.addFolder(rpcDbName,rpcTrigPhi,className='CondAttrListCollection')
from RPC_CondCabling.RPC_CondCablingConf import RpcCablingCondAlg
condSequence += RpcCablingCondAlg("RpcCablingCondAlg",DatabaseRepository=dbRepo)
if muonRecFlags.doNRPCs():
condSequence += MuonNRPC_CablingAlg("MuonNRPC_CablingAlg")
if DetFlags.readRDOBS.TGC_on() or DetFlags.readRDOPool.TGC_on() or DetFlags.readRIOPool.TGC_on() or DetFlags.digitize.TGC_on():
log.info("TGC cabling is using mode: %s",muonCnvFlags.TgcCablingMode())
from MuonCablingServers.MuonCablingServersConf import TGCcablingServerSvc
ServiceMgr += TGCcablingServerSvc()
theApp.CreateSvc += [ "TGCcablingServerSvc" ]
if muonCnvFlags.TgcCablingMode =='8-fold':
ServiceMgr.TGCcablingServerSvc.Atlas=False
elif muonCnvFlags.TgcCablingMode not in ['auto', '12-fold']:
# No longer support 'old 12-fold' since it apparently relies on a service which is gone
raise RuntimeError("TgcCablingMode=%r not supported" % muonCnvFlags.TgcCablingMode())
# COOL setting for MuonTGC_Cabling
if muonCnvFlags.TgcCablingMode=='12-fold' or muonCnvFlags.TgcCablingMode=='auto':
from IOVDbSvc.CondDB import conddb
conddb.addFolderSplitMC('TGC','/TGC/CABLING/MAP_SCHEMA','/TGC/CABLING/MAP_SCHEMA')
from TGC_CondCabling.TGC_CondCablingConf import TGCCablingDbTool
TGCCablingDbTool = TGCCablingDbTool()
if globalflags.DataSource() == 'geant4':
TGCCablingDbTool.filename_ASD2PP_DIFF_12='ASD2PP_diff_12_OFL.db'
else:
TGCCablingDbTool.filename_ASD2PP_DIFF_12='ASD2PP_diff_12_ONL.db'
ToolSvc+=TGCCablingDbTool
if DetFlags.readRDOBS.MDT_on() or DetFlags.readRDOPool.MDT_on() or DetFlags.readRIOPool.MDT_on() or DetFlags.digitize.MDT_on():
log.info("MDT cabling is using mode: %s",muonCnvFlags.MdtCablingMode())
if muonCnvFlags.MdtCablingMode!='old':
# new cabling service, access to COOL for cabling map
log.info("Adding MDT/CABLING folders to conddb")
from IOVDbSvc.CondDB import conddb
IOVDbSvc = ServiceMgr.IOVDbSvc
if globalflags.DataSource()=='data':
conddb.addFolder("MDT","/MDT/CABLING/MAP_SCHEMA",className='CondAttrListCollection')
conddb.addFolder("MDT","/MDT/CABLING/MEZZANINE_SCHEMA",className='CondAttrListCollection')
condSequence.MuonMDT_CablingAlg.MapFolders = "/MDT/CABLING/MAP_SCHEMA"
condSequence.MuonMDT_CablingAlg.MezzanineFolders = "/MDT/CABLING/MEZZANINE_SCHEMA"
else:
conddb.addFolder("MDT_OFL","/MDT/Ofl/CABLING/MAP_SCHEMA",className='CondAttrListCollection')
conddb.addFolder("MDT_OFL","/MDT/Ofl/CABLING/MEZZANINE_SCHEMA",className='CondAttrListCollection')
condSequence.MuonMDT_CablingAlg.MapFolders = "/MDT/Ofl/CABLING/MAP_SCHEMA"
condSequence.MuonMDT_CablingAlg.MezzanineFolders = "/MDT/Ofl/CABLING/MEZZANINE_SCHEMA"
if DetFlags.readRDOBS.MM_on() or DetFlags.readRDOPool.MM_on() or DetFlags.readRIOPool.MM_on() or DetFlags.digitize.MM_on():
log.info("Adding Micromegas cabling folders to conddb")
from IOVDbSvc.CondDB import conddb
IOVDbSvc = ServiceMgr.IOVDbSvc
if globalflags.DataSource()=='data':
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
if athenaCommonFlags.isOnline():
conddb.addFolderWithTag("MDT_ONL","/MDT/Onl/MM/CABLING","MmCabling-FrontEndShifts-v1",className="CondAttrListCollection")
condSequence.MuonMM_CablingAlg.CablingFolder="/MDT/MM/CABLING"
else:
conddb.addFolderWithTag("MDT_OFL","/MDT/MM/CABLING","MmCabling-FrontEndShifts-v1",className="CondAttrListCollection")
condSequence.MuonMM_CablingAlg.CablingFolder="/MDT/MM/CABLING"
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#--------------------------------------------------------------
# JobOption fragments for Condition Database access
# of muon calibration constants
from AthenaCommon.Logging import logging
logging.getLogger().info("Importing %s", __name__)
logMuon = logging.getLogger(__name__)
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.JobProperties import jobproperties
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
from AthenaCommon import CfgMgr
#--------------------------------------------------------------
from MuonCnvExample.MuonCnvUtils import specialAddFolderSplitOnline,mdtCalibWindowNumber
from MuonCnvExample.MuonCalibFlags import mdtCalibFlags,cscCalibFlags
mdtCalibFlags.setDefaults()
cscCalibFlags.setDefaults()
################################################################################
# CSC calibration
################################################################################
def setupCscCondDB():
# Access to the CSC calibration database
# Copied and modified from:
# include( "CscCalibTools/CscCalibTool_jobOptions.py" )
from MuonCondSvc.CscCondDB import cscCondDB
## Load Ped File
if cscCalibFlags.CscPedFromLocalFile():
cscCondDB.useLocalFile( True ) #All following "add" db folder commands are from local files
cscCondDB.addPedFolder() #<--- Adds pedestal and noise folders
cscCondDB.useLocalFile( False ) #To make sure to stop refering to local sqlite DB file
else:
cscCondDB.addPedFolder() #<--- Adds pedestal and noise folders
## Load Noise File
if cscCalibFlags.CscNoiseFromLocalFile():
cscCondDB.useLocalFile( True ) #All following "add" db folder commands are from local files
cscCondDB.addNoiseFolder() #<--- Adds pedestal and noise folders
cscCondDB.useLocalFile( False ) #To make sure to stop refering to local sqlite DB file
else:
cscCondDB.addNoiseFolder() #<--- Adds pedestal and noise folders
## Load PSlope File
if cscCalibFlags.CscPSlopeFromLocalFile():
cscCondDB.useLocalFile( True ) #All following "add" db folder commands are from local files
cscCondDB.addPSlopeFolder() #<--- Adds pedestal and noise folders
cscCondDB.useLocalFile( False ) #To make sure to stop refering to local sqlite DB file
else:
cscCondDB.addPSlopeFolder() #<--- Adds pedestal and noise folders
## Load Status File
if cscCalibFlags.CscStatusFromLocalFile():
cscCondDB.useLocalFile( True ) #All following "add" db folder commands are from local files
cscCondDB.addStatusFolder() #<--- Adds pedestal and noise folders
cscCondDB.useLocalFile( False ) #To make sure to stop refering to local sqlite DB file
else:
cscCondDB.addStatusFolder() #<--- Adds pedestal and noise folders
## Load Rms File
if cscCalibFlags.CscRmsFromLocalFile():
cscCondDB.useLocalFile( True ) #All following "add" db folder commands are from local files
cscCondDB.addRmsFolder() #<--- Adds pedestal and noise folders
cscCondDB.useLocalFile( False ) #To make sure to stop refering to local sqlite DB file
else:
cscCondDB.addRmsFolder() #<--- Adds pedestal and noise folders
## Load F001 File
if cscCalibFlags.CscF001FromLocalFile():
cscCondDB.useLocalFile( True ) #All following "add" db folder commands are from local files
cscCondDB.addF001Folder()
cscCondDB.useLocalFile( False ) #To make sure to stop refering to local sqlite DB file
else:
cscCondDB.addF001Folder()
if not athenaCommonFlags.isOnline():
log = logging.getLogger(__name__+".setupCscCondDB()")
log.info("This is for OffLine so T0Base and T0Phase folders are added!!")
## Load T0Base File
if cscCalibFlags.CscT0BaseFromLocalFile():
cscCondDB.useLocalFile( True ) #All following "add" db folder commands are from local files
cscCondDB.addT0BaseFolder()
cscCondDB.useLocalFile( False ) #To make sure to stop refering to local sqlite DB file
else:
cscCondDB.addT0BaseFolder()
## Load T0Phase File
if cscCalibFlags.CscT0PhaseFromLocalFile():
cscCondDB.useLocalFile( True ) #All following "add" db folder commands are from local files
cscCondDB.addT0PhaseFolder()
cscCondDB.useLocalFile( False ) #To make sure to stop refering to local sqlite DB file
else:
cscCondDB.addT0PhaseFolder()
#cscCondDB.addPedFolders() #<--- Adds pedestal and noise folders
#cscCondDB.addAllFolders()
# end of function setupCscCondDB()
def CscCalibTool(name,**kwargs):
# without the following line, the CscCondDbAlg is not scheduled, thus add flake8 ignore flag
import MuonCondAlg.CscCondDbAlgConfig # noqa: F401
# make tool
return CfgMgr.CscCalibTool(
Slope=0.19,
Noise=3.5,
Pedestal=2048.0,
ReadFromDatabase=True,
SlopeFromDatabase=False,
integrationNumber=12.0,
integrationNumber2=11.66,
samplingTime=50.0,
signalWidth=14.40922,
timeOffset=71.825,
IsOnline = athenaCommonFlags.isOnline(),
Latency = 119
)
# timeOffset=46.825) + 25 SimHIT digit time
################################################################################
# MDT calibration
################################################################################
if mdtCalibFlags.readMDTCalibFromBlob():
mdt_folder_name_appendix = "BLOB"
else:
mdt_folder_name_appendix=""
def setupMdtCondDB():
global mdt_folder_name_appendix
from IOVDbSvc.CondDB import conddb
if mdtCalibFlags.mdtCalibrationSource()=="MDT":
if not conddb.folderRequested('/MDT/Onl/RT' + mdt_folder_name_appendix) and not conddb.folderRequested('/MDT/RT' + mdt_folder_name_appendix):
conddb.addFolderSplitOnline("MDT", '/MDT/Onl/RT' + mdt_folder_name_appendix,'/MDT/RT' + mdt_folder_name_appendix, className='CondAttrListCollection')
if not conddb.folderRequested('/MDT/Onl/T0' + mdt_folder_name_appendix) and not conddb.folderRequested('/MDT/T0' + mdt_folder_name_appendix):
conddb.addFolderSplitOnline("MDT", '/MDT/Onl/T0' + mdt_folder_name_appendix,'/MDT/T0' + mdt_folder_name_appendix, className='CondAttrListCollection')
else:
from AthenaCommon.AppMgr import ServiceMgr
ServiceMgr.TagInfoMgr.ExtraTagValuePairs.update({"MDTCalibrationSource": mdtCalibFlags.mdtCalibrationSource()})
if not conddb.folderRequested('/MDT/Onl/RT' + mdt_folder_name_appendix) and not conddb.folderRequested('/MDT/RT' + mdt_folder_name_appendix):
specialAddFolderSplitOnline(mdtCalibFlags.mdtCalibrationSource(), '/MDT/Onl/RT' + mdt_folder_name_appendix,'/MDT/RT' + mdt_folder_name_appendix)
if not conddb.folderRequested('/MDT/Onl/T0' + mdt_folder_name_appendix) and not conddb.folderRequested('/MDT/T0' + mdt_folder_name_appendix):
specialAddFolderSplitOnline(mdtCalibFlags.mdtCalibrationSource(), '/MDT/Onl/T0' + mdt_folder_name_appendix,'/MDT/T0' + mdt_folder_name_appendix)
from AthenaCommon.AlgSequence import AthSequencer
from MuonCondAlg.MuonCondAlgConf import MdtCalibDbAlg
condSequence = AthSequencer("AthCondSeq")
if not hasattr(condSequence,"MdtCalibDbAlg"):
condSequence += MdtCalibDbAlg("MdtCalibDbAlg")
if conddb.isOnline and not conddb.isMC:
condSequence.MdtCalibDbAlg.ReadKeyTube = "/MDT/T0"
condSequence.MdtCalibDbAlg.ReadKeyRt = "/MDT/RT"
else:
condSequence.MdtCalibDbAlg.ReadKeyTube = "/MDT/T0" + mdt_folder_name_appendix
condSequence.MdtCalibDbAlg.ReadKeyRt = "/MDT/RT" + mdt_folder_name_appendix
condSequence.MdtCalibDbAlg.RT_InputFile = "Muon_RT_default.data"
if globalflags.DataSource == 'data':
condSequence.MdtCalibDbAlg.defaultT0 = 40
elif globalflags.DataSource == 'geant4':
condSequence.MdtCalibDbAlg.defaultT0 = 799
condSequence.MdtCalibDbAlg.UseMLRt = mdtCalibFlags.useMLRt()
condSequence.MdtCalibDbAlg.TimeSlewingCorrection = mdtCalibFlags.correctMdtRtForTimeSlewing()
condSequence.MdtCalibDbAlg.MeanCorrectionVsR = [ -5.45973, -4.57559, -3.71995, -3.45051, -3.4505, -3.4834, -3.59509, -3.74869, -3.92066, -4.10799, -4.35237, -4.61329, -4.84111, -5.14524 ]
condSequence.MdtCalibDbAlg.PropagationSpeedBeta = mdtCalibFlags.mdtPropagationSpeedBeta()
# the same as MdtCalibrationDbTool
condSequence.MdtCalibDbAlg.CreateBFieldFunctions = mdtCalibFlags.correctMdtRtForBField()
condSequence.MdtCalibDbAlg.CreateWireSagFunctions = mdtCalibFlags.correctMdtRtWireSag()
condSequence.MdtCalibDbAlg.CreateSlewingFunctions = mdtCalibFlags.correctMdtRtForTimeSlewing()
def MdtCalibrationTool(name="MdtCalibrationTool", **kwargs):
from MdtCalibSvc.MdtCalibSvcConf import MdtCalibrationTool
kwargs.setdefault("DoSlewingCorrection", mdtCalibFlags.correctMdtRtForTimeSlewing())
# Hack to use DoTemperatureCorrection for applyRtScaling; but applyRtScaling should not be used anyway, since MLRT can be used
kwargs.setdefault("DoTemperatureCorrection", mdtCalibFlags.applyRtScaling())
kwargs.setdefault("DoWireSagCorrection", mdtCalibFlags.correctMdtRtWireSag())
# for collisions cut away hits that are far outside of the MDT time window
if jobproperties.Beam.beamType() == 'collisions':
kwargs.setdefault("DoTofCorrection", True)
if globalflags.DataSource() == 'geant4' or globalflags.DataSource() == 'data':
kwargs.setdefault("TimeWindowSetting", mdtCalibWindowNumber('Collision_G4'))
else: # cosmics or single beam
kwargs.setdefault("DoTofCorrection", False)
return MdtCalibrationTool(name, **kwargs)
# return a list of dictionaires containing the calib config info (keys etc)
def getCalibConfigs():
from MuonRecExample.MuonRecFlags import muonRecFlags
from RecExConfig.RecFlags import rec
from MuonRecExample.MuonRec import muonRec
configs = []
if muonRecFlags.calibMuonStandalone and (muonRecFlags.doStandalone or rec.readESD):
configs.append(muonRec.getConfig("MuonStandalone").getCalibConfig())
else:
muonRecFlags.calibMuonStandalone = False
return configs
## Setup MuonSegmenToCalibSegment algorithm.
# @param[in] segmentKeys list of segment keys to use or single segments key (string)
def getMuonSegmentToCalibSegment():
from MuonRecExample.MuonRecFlags import muonRecFlags
from AthenaCommon.AppMgr import topSequence
try:
return topSequence.MuonSegmentToCalibSegment
except AttributeError:
from AthenaCommon.CfgGetter import getPublicTool
from MuonCalibPatRec.MuonCalibPatRecConf import MuonCalib__MuonSegmentToCalibSegment
MuonSegmentToCalibSegment = MuonCalib__MuonSegmentToCalibSegment("MuonSegmentToCalibSegment")
# set consistent time-of-flight correction with MdtDriftCircleOnTrackCreator
mdtCreator = getPublicTool("MdtDriftCircleOnTrackCreator")
from AthenaCommon.ConfiguredFactory import getProperty
MuonSegmentToCalibSegment.DoTOF = getProperty(mdtCreator,"DoTofCorrection")
# when doing segment fits with floating t0's
MuonSegmentToCalibSegment.UpdateForT0Shift = type(MuonSegmentToCalibSegment.getDefaultProperty("UpdateForT0Shift")) (muonRecFlags.doSegmentT0Fit())
MuonSegmentToCalibSegment.UseCscSegments = False
MuonSegmentToCalibSegment.SegmentLocations = [ "MuonSegments" ]
MuonSegmentToCalibSegment.SegmentAuthors = [ 4,8 ]
MuonSegmentToCalibSegment.ReadSegments = True # rather than SegmentCombinations
from MuonCnvExample import MuonCalibConfig
MuonCalibConfig.setupMdtCondDB()
MuonSegmentToCalibSegment.CalibrationTool = MuonCalibConfig.MdtCalibrationTool()
# finally add it to topSequence
topSequence += MuonSegmentToCalibSegment
return topSequence.MuonSegmentToCalibSegment
## Setup the basic MuonCalibAlg algorithm. Needs further configuration after this call
# depending on the use-case.
# @param[in] evenTag The event tag written to file
def getMuonCalibAlg(eventTag):
from AthenaCommon.AppMgr import topSequence
from MuonRecExample.MuonRecFlags import muonRecFlags
from RecExConfig.RecFlags import rec
try:
return topSequence.MuonCalibAlg
except AttributeError:
from MuonCalibAlgs.MuonCalibAlgsConf import MuonCalib__MuonCalibAlg
MuonCalibAlg = MuonCalib__MuonCalibAlg("MuonCalibAlg",
doMDTs = muonRecFlags.doMDTs(),
doCSCs = muonRecFlags.doCSCs(),
doRPCs = muonRecFlags.doRPCs(),
doTGCs = (muonRecFlags.doTGCs() and muonRecFlags.calibNtupleRawTGC()),
doTGCCoinData = (muonRecFlags.doTGCs() and muonRecFlags.calibNtupleRawTGC()),
doTruth = rec.doTruth(),
DoPrdSelect = muonRecFlags.doPrdSelect(), # optional cutting away of PRD hits to simulate dead channels
NtupleName = muonRecFlags.calibNtupleOutput(), # set the name of the output calibration ntuple
EventTag = eventTag )
if jobproperties.Beam.beamType() == 'singlebeam' or jobproperties.Beam.beamType() == 'cosmics':
MuonCalibAlg.addTriggerTag = False
else:
MuonCalibAlg.addTriggerTag = rec.doTrigger()
MuonCalibAlg.doTruth=rec.doTruth()
topSequence += MuonCalibAlg
return topSequence.MuonCalibAlg
def setupMuonCalibNtuple():
from MuonRecExample.MuonRecFlags import muonRecFlags
from AthenaCommon.DetFlags import DetFlags
from RecExConfig.RecFlags import rec
from AthenaCommon.AppMgr import topSequence
from AthenaCommon.AppMgr import ToolSvc
if not rec.doMuon() or not DetFlags.Muon_on():
logMuon.warning("Not setting up requested Muon Calibration Ntuple because Muons are off")
return
logMuon.info("Setting up Muon Calibration Ntuple")
configs = getCalibConfigs()
# MuonSegmentToCalibSegment is only needed if we want segments
if muonRecFlags.calibNtupleSegments and muonRecFlags.calibMuonStandalone:
getMuonSegmentToCalibSegment()
# MuonCalibAlg is always needed
eventTag="UNKNOWN"
if (muonRecFlags.calibNtupleSegments or muonRecFlags.calibNtupleTracks) and muonRecFlags.calibMuonStandalone:
if len(configs) >= 1:
eventTag = configs[0]["eventTag"]
elif muonRecFlags.calibNtupleTrigger:
eventTag = "TRIG"
else:
eventTag = "HITS"
MuonCalibAlg = getMuonCalibAlg(eventTag)
# configure for writing ntuple
from MuonCalibTools.MuonCalibToolsConf import MuonCalib__PatternNtupleMaker
MuonCalibTool = MuonCalib__PatternNtupleMaker("MuonCalibPatternNtupleMaker")
MuonCalibTool.FillTruth = rec.doTruth()
MuonCalibTool.DoRawTGC = (muonRecFlags.doTGCs() and muonRecFlags.calibNtupleRawTGC())
ToolSvc += MuonCalibTool
MuonCalibAlg.MuonCalibTool = MuonCalibTool
# MuonCalibExtraTree only if we want to write tracks
if muonRecFlags.calibNtupleTracks:
MuonCalibTool.DelayFinish = True
from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__MuonCalibExtraTreeAlg
MuonCalibExtraTreeAlg = MuonCalib__MuonCalibExtraTreeAlg("MuonCalibExtraTreeAlg",
NtupleName = "PatternNtupleMaker",
)
segmentOnTrackSelector=None
if hasattr(topSequence, "MuonSegmentToCalibSegment"):
from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__SegmentOnTrackSelector
segmentOnTrackSelector=MuonCalib__SegmentOnTrackSelector()
segmentOnTrackSelector.PattternLocation = "PatternsForCalibration"
ToolSvc+=segmentOnTrackSelector
MuonCalibExtraTreeAlg.SegmentOnTrackSelector= segmentOnTrackSelector
if not rec.doMuonCombined():
tool_nr=0
from AthenaCommon.CfgGetter import getPrivateToolClone
for config in configs:
MuonCalibExtraTreeAlg.TrackFillerTools.append(getPrivateToolClone("ExtraTreeTrackFillerTool"+str(tool_nr), "ExtraTreeTrackFillerTool", TrackCollectionKey=config['tracksKey'], SegmentAuthors=[config['segmentAuthor']], TrackAuthor=config['trackAuthor']))
tool_nr+=1
# configure needed tools
# add to topSequence
topSequence += MuonCalibExtraTreeAlg
# MuonCalibExtraTreeTriggerAlg only if trigger is available
if muonRecFlags.calibNtupleTrigger: # and DetFlags.detdescr.LVL1_on() and DetFlags.haveRDO.LVL1_on():
# delay writing of MuonCalibAlg
MuonCalibTool.DelayFinish = True
# also delay MuonCalibExtraTreeAlg if it is running
try:
topSequence.MuonCalibExtraTreeAlg.DelayFinish = True
except AttributeError:
pass
from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__MuonCalibExtraTreeTriggerAlg
topSequence += MuonCalib__MuonCalibExtraTreeTriggerAlg( 'MuonCalibExtraTreeTriggerAlg',
doMuCTPI = True,
doLVL1Calo = rec.doTile() or rec.doLArg() or DetFlags.haveRDO.Calo_on(),
doMBTS = rec.doTile() or DetFlags.haveRDO.Tile_on() )
def setupMuonCalib():
from RecExConfig.RecFlags import rec
from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.DetFlags import DetFlags
if not rec.doMuon() or not DetFlags.Muon_on():
logMuon.warning("Not setting up requested Muon Calibration because Muons are off")
return
logMuon.info("Setting up Muon Calibration")
from MuonCnvExample.MuonCalibFlags import muonCalibFlags
muonCalibFlags.setDefaults()
getCalibConfigs()
#
# MuonSegmentToCalibSegment
#
from MuonRecExample.MuonRec import muonRec
muonRec.allConfigs()[0].getCalibConfig() #muonRec.getConfig(muonCalibFlags.EventTag()).getCalibConfig()
getMuonSegmentToCalibSegment()
#
# MuonCalibAlg
#
MuonCalibAlg = getMuonCalibAlg(muonCalibFlags.EventTag())
from MdtCalibTools.MdtCalibToolsConf import MuonCalib__MdtCalibTool
MuonCalibTool = MuonCalib__MdtCalibTool()
calibMode = muonCalibFlags.Mode()
if calibMode == 'regionNtuple':
from MdtCalibTools.MdtCalibToolsConf import MuonCalib__MdtCalibNtupleMakerTool
MdtCalibTool = MuonCalib__MdtCalibNtupleMakerTool()
else:
raise RuntimeError( "Unknown Muon Calibration Mode: %r" % calibMode )
ToolSvc += MdtCalibTool
MuonCalibTool.MdtCalibTool = MdtCalibTool
ToolSvc += MuonCalibTool
MuonCalibAlg.MuonCalibTool = MuonCalibTool
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.Logging import logging
logging.getLogger().info("Importing module %s",__name__)
from AthenaCommon.JobProperties import JobProperty,JobPropertyContainer,jobproperties
import AthenaCommon.BeamFlags
beamFlags = AthenaCommon.BeamFlags.jobproperties.Beam
from MuonCnvExample.MuonCnvUtils import setJobPropertyDefault
logMuon = logging.getLogger(__name__)
def setDefault(prop,value):
return setJobPropertyDefault(prop,value,logMuon)
################################################################################
# MDT calibration flags
################################################################################
class MdtCalib(JobPropertyContainer):
def setDefaults(self):
global beamFlags
from AthenaCommon.GlobalFlags import globalflags
if globalflags.DataSource == 'data' and beamFlags.beamType == 'collisions':
setDefault(self.correctMdtRtForBField,True)
else:
setDefault(self.correctMdtRtForBField,False)
if globalflags.DataSource == 'data':
setDefault(self.correctMdtRtForTimeSlewing,True)
setDefault(self.mdtPropagationSpeedBeta, 0.85)
else:
setDefault(self.correctMdtRtForTimeSlewing,False)
setDefault(self.mdtPropagationSpeedBeta, 1.0)
jobproperties.add_Container(MdtCalib)
mdtCalibFlags = jobproperties.MdtCalib
##read mdt tube calibration from blob-folders
class readMDTCalibFromBlob(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=True
mdtCalibFlags.add_JobProperty(readMDTCalibFromBlob)
# @brief Apply B-field correction to drift times
class correctMdtRtForBField(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
mdtCalibFlags.add_JobProperty(correctMdtRtForBField)
# @brief Apply time slewing correction to drift time
class correctMdtRtForTimeSlewing(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
mdtCalibFlags.add_JobProperty(correctMdtRtForTimeSlewing)
# @brief use ML-RT functions from COOL
class useMLRt(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=True
mdtCalibFlags.add_JobProperty(useMLRt)
# @brief Apply rt scaling correction (multilayer t_max diff)
# Never used, replaced by using ML-RTs
class applyRtScaling(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
mdtCalibFlags.add_JobProperty(applyRtScaling)
# @brief Apply RT wiresag correction
class correctMdtRtWireSag(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
mdtCalibFlags.add_JobProperty(correctMdtRtWireSag)
## @brief Source for MDT t0s and rts
class mdtCalibrationSource(JobProperty):
statusOn=True
allowedTypes=['str']
StoredValue="MDT"
mdtCalibFlags.add_JobProperty(mdtCalibrationSource)
class mdtPropagationSpeedBeta(JobProperty):
statusOn=True
allowedTypes=['float']
StoredValue=0.85
mdtCalibFlags.add_JobProperty(mdtPropagationSpeedBeta)
# now that all flags are added, set their default values
mdtCalibFlags.setDefaults()
################################################################################
# CSC calibration flags
################################################################################
class CscCalib(JobPropertyContainer):
def setDefaults(self):
pass
# nothing for the moment
jobproperties.add_Container(CscCalib)
cscCalibFlags = jobproperties.CscCalib
class CscPedFromLocalFile(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
cscCalibFlags.add_JobProperty(CscPedFromLocalFile)
class CscNoiseFromLocalFile(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
cscCalibFlags.add_JobProperty(CscNoiseFromLocalFile)
class CscPSlopeFromLocalFile(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
cscCalibFlags.add_JobProperty(CscPSlopeFromLocalFile)
class CscStatusFromLocalFile(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
cscCalibFlags.add_JobProperty(CscStatusFromLocalFile)
class CscRmsFromLocalFile(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
cscCalibFlags.add_JobProperty(CscRmsFromLocalFile)
class CscF001FromLocalFile(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
cscCalibFlags.add_JobProperty(CscF001FromLocalFile)
class CscT0BaseFromLocalFile(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
cscCalibFlags.add_JobProperty(CscT0BaseFromLocalFile)
class CscT0PhaseFromLocalFile(JobProperty):
statusOn=True
allowedTypes=['bool']
StoredValue=False
cscCalibFlags.add_JobProperty(CscT0PhaseFromLocalFile)
# now that all flags are added, set their default values
cscCalibFlags.setDefaults()
class EventTag(JobProperty):
"""Tag that chooses input to use for calibration"""
statusOn=False
allowedTypes=['str']
StoredValue='MoMu'
class Mode(JobProperty):
"""Choose the (MDT) calibration mode.
'ntuple' : write standard calibration ntuple (up to segments)
'trackNtuple' : write standard ntuple + tracks
'regionNtuple' : write one ntuple per calibration region
't0Classic' : do classic t0 calibration
't0MT' : do MT t0 calibration
'rtClassic' : do classic rt calibration
'rtAnalytic' : do analytic rt calibration"""
statusOn=False
allowedTypes=['str']
allowedValues=[ 'ntuple', 'trackNtuple', 'regionNtuple']
StoredValue='ntuple'
class MuonCalib(JobPropertyContainer):
"""Flags to configure the Muon Calibration algorithms"""
def setDefaults(self):
"""For backwards compatibility: Use old flags if values are not yet set"""
if self._locked:
# properties can not be set if locked
return
import __main__
mainvars = vars(__main__)
# The source
if not self.EventTag.statusOn:
self.EventTag.set_On()
# The destination
if not self.Mode.statusOn:
# order is important: last one wins
oldFlags = [ 'doCalibFullNtuple' ,
'doTrackNtuple' ,
'doCalibRegionNtuple']
oldtonew = {
'doCalibFullNtuple' : 'ntuple' ,
'doCalibRegionNtuple' : 'regionNtuple' ,
'doTrackNtuple' : 'trackNtuple' }
for oldflag in oldFlags:
newflag = oldtonew[oldflag]
try:
oldValue = mainvars[oldflag]
except KeyError:
pass
else:
if oldValue:
self.Mode = newflag
# print a deprecated warning
logMuon.warning( '%s flag is deprecated. Use muonCalibFlags.Mode = %r instead (%s)',
oldflag, newflag,
'from ' + __name__ + ' import muonCalibFlags' )
# if still not set, set to default
if not self.Mode.statusOn:
self.Mode.set_On()
# initialise container
jobproperties.add_Container(MuonCalib)
muonCalibFlags = jobproperties.MuonCalib
for f in [ EventTag, Mode ]:
muonCalibFlags.add_JobProperty(f)
del f
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
def BaseCscDigitToCscRDOTool(name,**kwargs):
kwargs.setdefault("NumSamples", 4)
kwargs.setdefault("Latency", 0)
from Digitization.DigitizationFlags import digitizationFlags
kwargs.setdefault("addNoise", digitizationFlags.doMuonNoise())
kwargs.setdefault("cscCalibTool", "CscCalibTool")
from AthenaCommon import CfgMgr
return CfgMgr.CscDigitToCscRDOTool(name,**kwargs)
def CscDigitToCscRDOTool(name,**kwargs):
from Digitization.DigitizationFlags import digitizationFlags
if digitizationFlags.PileUpPresampling and 'LegacyOverlay' not in digitizationFlags.experimentalDigi():
from OverlayCommonAlgs.OverlayFlags import overlayFlags
kwargs.setdefault("OutputObjectName", overlayFlags.bkgPrefix() + "CSCRDO")
else:
kwargs.setdefault("OutputObjectName", "CSCRDO")
return BaseCscDigitToCscRDOTool(name,**kwargs)
def CscDigitToCscRDOTool2(name,**kwargs):
kwargs.setdefault("NumSamples", 2)
kwargs.setdefault("addNoise", False)
from OverlayCommonAlgs.OverlayFlags import overlayFlags
if overlayFlags.isOverlayMT():
kwargs.setdefault("InputObjectName", overlayFlags.sigPrefix() + "CSC_DIGITS")
kwargs.setdefault("OutputObjectName", overlayFlags.sigPrefix() + "CSCRDO")
else:
kwargs.setdefault("InputObjectName", overlayFlags.evtStore()+"+CSC_DIGITS")
kwargs.setdefault("OutputObjectName", overlayFlags.evtStore()+"+CSCRDO")
return BaseCscDigitToCscRDOTool(name,**kwargs)
def CscDigitToCscRDOTool4(name,**kwargs):
kwargs.setdefault("NumSamples", 4)
kwargs.setdefault("addNoise", False)
from OverlayCommonAlgs.OverlayFlags import overlayFlags
if overlayFlags.isOverlayMT():
kwargs.setdefault("InputObjectName", overlayFlags.sigPrefix() + "CSC_DIGITS")
kwargs.setdefault("OutputObjectName", overlayFlags.sigPrefix() + "CSCRDO")
else:
kwargs.setdefault("InputObjectName", overlayFlags.evtStore()+"+CSC_DIGITS")
kwargs.setdefault("OutputObjectName", overlayFlags.evtStore()+"+CSCRDO")
return BaseCscDigitToCscRDOTool(name,**kwargs)
def CscDigitToCscRDO(name,**kwargs):
kwargs.setdefault("CscDigitToRDOTool", "CscDigitToCscRDOTool")
from AthenaCommon import CfgMgr
return CfgMgr.CscDigitToCscRDO(name,**kwargs)
def CscDigitToCscRDO4(name="CscDigitToCscRDO",**kwargs):
kwargs.setdefault("CscDigitToRDOTool", "CscDigitToCscRDOTool4")
from AthenaCommon import CfgMgr
return CfgMgr.CscDigitToCscRDO(name,**kwargs)
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.CfgGetter import addTool, addService, addAlgorithm
################################################################################
# Standard BS algorithms
################################################################################
addTool( "MuonCnvExample.MuonReadBSConfig.MdtROD_Decoder", "MdtROD_Decoder" )
addTool( "MuonCnvExample.MuonReadBSConfig.MdtRawDataProviderTool", "MdtRawDataProviderTool" )
addAlgorithm( "Muon::MdtRawDataProvider", "MdtRawDataProvider" )
addTool( "MuonCnvExample.MuonReadBSConfig.RpcROD_Decoder", "RpcROD_Decoder" )
addTool( "MuonCnvExample.MuonReadBSConfig.RpcRawDataProviderTool", "RpcRawDataProviderTool" )
addAlgorithm( "Muon::RpcRawDataProvider", "RpcRawDataProvider" )
addTool( "MuonCnvExample.MuonReadBSConfig.TgcROD_Decoder", "TgcROD_Decoder" )
addTool( "MuonCnvExample.MuonReadBSConfig.TgcRawDataProviderTool", "TgcRawDataProviderTool" )
addAlgorithm("Muon::TgcRawDataProvider", "TgcRawDataProvider" )
addTool( "MuonCnvExample.MuonReadBSConfig.CscROD_Decoder", "CscROD_Decoder" )
addTool( "MuonCnvExample.MuonReadBSConfig.CscRawDataProviderTool", "CscRawDataProviderTool" )
addAlgorithm("Muon::CscRawDataProvider", "CscRawDataProvider" )
addTool( "MuonCnvExample.MuonReadBSConfig.MmROD_Decoder", "MmROD_Decoder" )
addTool( "MuonCnvExample.MuonReadBSConfig.MmRawDataProviderTool", "MmRawDataProviderTool" )
addAlgorithm( "Muon::MM_RawDataProvider", "MmRawDataProvider" )
addTool( "MuonCnvExample.MuonReadBSConfig.sTgcROD_Decoder", "sTgcROD_Decoder" )
addTool( "MuonCnvExample.MuonReadBSConfig.sTgcRawDataProviderTool", "sTgcRawDataProviderTool" )
addAlgorithm("Muon::sTgcRawDataProvider", "sTgcRawDataProvider" )
addTool( "MuonCnvExample.MuonReadBSConfig.sTgcPadTriggerROD_Decoder", "sTgcPadTriggerROD_Decoder" )
addTool( "MuonCnvExample.MuonReadBSConfig.sTgcPadTriggerRawDataProviderTool", "sTgcPadTriggerRawDataProviderTool" )
addAlgorithm("Muon::sTgcPadTriggerRawDataProvider", "sTgcPadTriggerRawDataProvider" )
################################################################################
# Tools/algorithms/services from MuonCnvExample.MuonCalibConfig
################################################################################
addTool( "MuonCnvExample.MuonCalibConfig.CscCalibTool", "CscCalibTool")
addTool( "MuonCnvExample.MuonCalibConfig.MdtCalibDbTool", "MdtCalibDbTool")
addService( "MuonCnvExample.MuonCalibConfig.MdtCalibrationDbSvc", "MdtCalibrationDbSvc")
addService( "MuonCnvExample.MuonCalibConfig.MdtCalibrationSvc", "MdtCalibrationSvc")
################################################################################
# Tools/algorithms/services from MuonCnvExample.MuonCnvConfig
################################################################################
addTool( "MuonCnvExample.MuonCnvConfig.CscDigitToCscRDOTool", "CscDigitToCscRDOTool" )
addTool( "MuonCnvExample.MuonCnvConfig.CscDigitToCscRDOTool2", "CscDigitToCscRDOTool2" )
addTool( "MuonCnvExample.MuonCnvConfig.CscDigitToCscRDOTool4", "CscDigitToCscRDOTool4" )
addAlgorithm( "MuonCnvExample.MuonCnvConfig.CscDigitToCscRDO", "CscDigitToCscRDO" )
addAlgorithm( "MuonCnvExample.MuonCnvConfig.CscDigitToCscRDO4", "CscDigitToCscRDO4" )
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.Logging import logging
logging.getLogger().info("Importing %s", __name__)
### Simple function holding connecting names to the different calibration window options
# The window values themselves are defined in C++ in MdtCalibSvc/MdtCalibrationSvcSettings.h
# Author: Mike Flowerdew <michael.flowerdew@cern.ch>
__mdtCalibWindows = ['User',
'Default', ## 1000,2000
'Collision_G4', ## 20,30
'Collision_data', ## 10,30
'Collision_t0fit', ## 50,100
]
def mdtCalibWindowNumber(name):
"""Returns index number corresponding to the calibration window name.
This will throw a ValueError if name is not in the list.
"""
return __mdtCalibWindows.index(name)
def mdtCalibWindowName(number):
"""Returns calibration name corresponding to the index number.
This will throw an IndexError if number is out of range.
"""
return __mdtCalibWindows[number]
def specialAddFolderSplitOnline(ident,folder1,folder2,force=False,forceMC=False,forceData=False):
"Add access to given folder, using folder1 online, folder2 offline but do not append _OFL to the ident"
from IOVDbSvc.CondDB import conddb
if conddb.isOnline and not conddb.isMC:
conddb.addFolder(ident,folder1,force=force,forceMC=forceMC,forceData=forceData)
else:
conddb.addFolder(ident,folder2,force=force,forceMC=forceMC,forceData=forceData)
## Set the default value of JobProperty @c prop to @c value. Should really go to AthenaCommon
def setJobPropertyDefault(prop,value,log=None):
global logMuon
if value != prop.__class__.StoredValue:
mess = "Changing default %s = %r" % ( prop.__name__, value )
if prop.__class__.StoredValue is not prop.StoredValue:
mess += " (current value: %r)" % prop.get_Value()
if log is not None: log.info(mess)
prop.__class__.StoredValue = value
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
from AthenaCommon import CfgMgr
from RecExConfig.ObjKeyStore import cfgKeyStore
from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
dependencies = [('MuonGM::MuonDetectorManager', 'ConditionStore+MuonDetectorManager')]
prepdata_container = [
("Muon::RpcPrepDataContainer", "RPC_Measurements"),
("Muon::TgcPrepDataContainer", "TGC_MeasurementsAllBCs"),
("Muon::MdtPrepDataContainer", "MDT_DriftCircles"),
("Muon::CscStripPrepDataContainer", "CSC_Measurements"),
("Muon::CscPrepDataContainer", "CSC_Clusters"),
("Muon::MMPrepDataContainer", "MM_Measurements"),
("Muon::sTgcPrepDataContainer", "STGC_Measurements"),
]
for cont_type, cont_key in prepdata_container:
if not cfgKeyStore.isInInput(type=cont_type , key=cont_key):
continue
condSeq += CfgMgr.AthReadAlg("AthReadAlg_"+cont_key,
Key="%s/%s"%(cont_type, cont_key),
ExtraInputs = dependencies)
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.AppMgr import ServiceMgr
from AthenaCommon import CfgMgr
from OverlayCommonAlgs.OverlayFlags import overlayFlags
if DetFlags.readRDOBS.Muon_on():
if not hasattr( ServiceMgr, "ByteStreamAddressProviderSvc" ):
from ByteStreamCnvSvcBase. ByteStreamCnvSvcBaseConf import ByteStreamAddressProviderSvc
ServiceMgr += ByteStreamAddressProviderSvc()
#================================================================================
# MDT Bytestream reading setup
#================================================================================
def MdtROD_Decoder(name="MdtROD_Decoder",**kwargs):
# setup cabling service needed by this tool
return CfgMgr.MdtROD_Decoder(name,**kwargs)
def MdtRawDataProviderTool(name="MdtRawDataProviderTool",**kwargs):
kwargs.setdefault("Decoder", "MdtROD_Decoder")
if DetFlags.overlay.MDT_on() and overlayFlags.isDataOverlay():
if overlayFlags.isOverlayMT():
kwargs.setdefault("RdoLocation",overlayFlags.bkgPrefix()+"MDTCSM")
else:
kwargs.setdefault("RdoLocation",overlayFlags.dataStore()+"+MDTCSM")
return CfgMgr.Muon__MDT_RawDataProviderToolMT(name,**kwargs)
#================================================================================
# RPC Bytestream reading setup
#================================================================================
def RpcROD_Decoder(name="RpcROD_Decoder",**kwargs):
# setup cabling service needed by this tool
return CfgMgr.Muon__RpcROD_Decoder(name,**kwargs)
def RpcRawDataProviderTool(name = "RpcRawDataProviderTool",**kwargs):
kwargs.setdefault("Decoder", "RpcROD_Decoder")
if DetFlags.overlay.RPC_on() and overlayFlags.isDataOverlay():
if overlayFlags.isOverlayMT():
kwargs.setdefault("RdoLocation", overlayFlags.bkgPrefix()+"RPCPAD")
else:
kwargs.setdefault("RdoLocation", overlayFlags.dataStore()+"+RPCPAD")
return CfgMgr.Muon__RPC_RawDataProviderToolMT(name,**kwargs)
#================================================================================
# TGC Bytestream reading setup
#================================================================================
def TgcROD_Decoder(name = "TgcROD_Decoder",**kwargs):
# setup cabling service needed by this tool
return CfgMgr.Muon__TGC_RodDecoderReadout(name,**kwargs)
def TgcRawDataProviderTool(name = "TgcRawDataProviderTool",**kwargs):
kwargs.setdefault("Decoder", "TgcROD_Decoder")
if DetFlags.overlay.TGC_on() and overlayFlags.isDataOverlay():
if overlayFlags.isOverlayMT():
kwargs.setdefault("RdoLocation", overlayFlags.bkgPrefix()+"TGCRDO")
else:
kwargs.setdefault("RdoLocation", overlayFlags.dataStore()+"+TGCRDO")
return CfgMgr.Muon__TGC_RawDataProviderToolMT(name,**kwargs)
#================================================================================
# CSC Bytestream reading setup
#================================================================================
def CscROD_Decoder(name = "CscROD_Decoder",**kwargs):
return CfgMgr.Muon__CscROD_Decoder(name,**kwargs)
def CscRawDataProviderTool(name = "CscRawDataProviderTool",**kwargs):
kwargs.setdefault("Decoder", "CscROD_Decoder")
if DetFlags.overlay.CSC_on() and overlayFlags.isDataOverlay():
if overlayFlags.isOverlayMT():
kwargs.setdefault("RdoLocation", overlayFlags.bkgPrefix()+"CSCRDO")
else:
kwargs.setdefault("RdoLocation", overlayFlags.dataStore()+"+CSCRDO")
return CfgMgr.Muon__CSC_RawDataProviderToolMT(name,**kwargs)
#================================================================================
# MM Bytestream reading setup
#================================================================================
def MmROD_Decoder(name="MmROD_Decoder",**kwargs):
kwargs.setdefault("DcsKey", "")
return CfgMgr.Muon__MM_ROD_Decoder(name,**kwargs)
def MmRawDataProviderTool(name="MmRawDataProviderTool",**kwargs):
kwargs.setdefault("Decoder", "MmROD_Decoder")
if DetFlags.overlay.MM_on() and overlayFlags.isDataOverlay():
if overlayFlags.isOverlayMT():
kwargs.setdefault("RdoLocation", overlayFlags.bkgPrefix() + "MMRDO")
else:
kwargs.setdefault("RdoLocation", overlayFlags.dataStore() + "+MMRDO")
return CfgMgr.Muon__MM_RawDataProviderToolMT(name,**kwargs)
#================================================================================
# sTGC Bytestream reading setup
#================================================================================
def sTgcROD_Decoder(name = "sTgcROD_Decoder",**kwargs):
kwargs.setdefault("DcsKey", "")
return CfgMgr.Muon__STGC_ROD_Decoder(name,**kwargs)
def sTgcRawDataProviderTool(name = "sTgcRawDataProviderTool",**kwargs):
kwargs.setdefault("Decoder", "sTgcROD_Decoder")
if DetFlags.overlay.sTGC_on() and overlayFlags.isDataOverlay():
if overlayFlags.isOverlayMT():
kwargs.setdefault("RdoLocation", overlayFlags.bkgPrefix()+"sTGCRDO")
else:
kwargs.setdefault("RdoLocation", overlayFlags.dataStore()+"+sTGCRDO")
return CfgMgr.Muon__STGC_RawDataProviderToolMT(name,**kwargs)
#================================================================================
# sTGC Pad Trigger Bytestream reading setup
#================================================================================
def sTgcPadTriggerROD_Decoder(name = "sTgcPadTriggerROD_Decoder", **kwargs):
return CfgMgr.Muon__PadTrig_ROD_Decoder(name, **kwargs)
def sTgcPadTriggerRawDataProviderTool(name = "sTgcPadTriggerRawDataProviderTool", **kwargs):
kwargs.setdefault("Decoder", "sTgcPadTriggerROD_Decoder")
return CfgMgr.Muon__PadTrig_RawDataProviderToolMT(name, **kwargs)
#
# For backwards compat - TO BE REMOVED as soon as all clients get these tools via AthenaCommon.CfgGetter
#
from AthenaCommon.CfgGetter import getPublicTool
if DetFlags.readRDOBS.MDT_on():
MuonMdtRawDataProviderTool = getPublicTool("MdtRawDataProviderTool")
else:
MuonMdtRawDataProviderTool = None
if DetFlags.readRDOBS.RPC_on():
MuonRpcRawDataProviderTool = getPublicTool("RpcRawDataProviderTool")
else:
MuonRpcRawDataProviderTool = None
if DetFlags.readRDOBS.TGC_on():
MuonTgcRawDataProviderTool = getPublicTool("TgcRawDataProviderTool")
else:
MuonTgcRawDataProviderTool = None
if DetFlags.readRDOBS.CSC_on():
MuonCscRawDataProviderTool = getPublicTool("CscRawDataProviderTool")
else:
MuonCscRawDataProviderTool = None
if DetFlags.readRDOBS.MM_on():
MuonMmRawDataProviderTool = getPublicTool("MmRawDataProviderTool")
else:
MuonMmRawDataProviderTool = None
if DetFlags.readRDOBS.sTGC_on():
MuonsTgcRawDataProviderTool = getPublicTool("sTgcRawDataProviderTool")
MuonsTgcPadTriggerRawDataProviderTool = getPublicTool("sTgcPadTriggerRawDataProviderTool")
else:
MuonsTgcRawDataProviderTool = None
MuonsTgcPadTriggerRawDataProviderTool = None
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
## @file MuonCnvExample/share/MuonReadBS_jobOptions.py
#
# @brief jobOptions for data conversion from bytestream to RDO for offline (i.e. decode full event)
#
# Used when reading raw date file (bytestream format).
# Adds the algorithms that convert the full muon bytestream data in RDO collections.
# The actual conversion tools and services used by the algorithms are configured in python/MuonRecTools.py.
# There is one algorithm per detector technology and a specific algorithm is added or not depending on the flags<br>
# <code>DetFlags.readRODBS.MDT_on(), RPC_on(), TGC_on() and CSC_on()</code><br>
include.block("MuonCnvExample/MuonReadBS_jobOptions.py")
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.CfgGetter import getAlgorithm
from MuonRecExample.MuonRecFlags import muonRecFlags
from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags
# ================= MDT ===========================
if DetFlags.readRDOBS.MDT_on() and muonRecFlags.makePRDs():
topSequence += getAlgorithm("MdtRawDataProvider")
# ================= RPC ===========================
if DetFlags.readRDOBS.RPC_on() and muonRecFlags.makePRDs():
topSequence += getAlgorithm("RpcRawDataProvider")
# ================= TGC ===========================
if DetFlags.readRDOBS.TGC_on() and muonRecFlags.makePRDs():
topSequence += getAlgorithm("TgcRawDataProvider")
# ================= CSC ===========================
if MuonGeometryFlags.hasCSC():
if DetFlags.readRDOBS.CSC_on() and muonRecFlags.makePRDs():
topSequence += getAlgorithm("CscRawDataProvider")
# ================= NSW ===========================
if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()):
if DetFlags.readRDOBS.MM_on() and muonRecFlags.makePRDs():
topSequence += getAlgorithm("MmRawDataProvider")
if DetFlags.readRDOBS.sTGC_on() and muonRecFlags.makePRDs():
topSequence += getAlgorithm("sTgcRawDataProvider")
topSequence += getAlgorithm("sTgcPadTriggerRawDataProvider")
# setup muon cabling needed to read RDO
from MuonCnvExample import MuonCablingConfig
v1.0 1 RtCalibrationAnalytic 15 2094 0 0 0 0 dummy 68 100
0 0.135205 1
0.378595 7.43798 1
0.386117 14.7408 1
0.413325 22.0435 1
0.535358 29.3463 1
0.839255 36.6491 1
1.21737 43.9519 1
1.56322 51.2546 1
1.86568 58.5574 1
2.22248 65.8602 1
2.5778 73.163 1
2.93638 80.4657 1
3.30413 87.7685 1
3.64213 95.0713 1
3.95106 102.374 1
4.24649 109.677 1
4.51808 116.98 1
4.79906 124.282 1
5.07841 131.585 1
5.333 138.888 1
5.59839 146.191 1
5.81862 153.493 1
6.01845 160.796 1
6.228 168.099 1
6.44991 175.402 1
6.66089 182.705 1
6.85355 190.007 1
7.03437 197.31 1
7.20473 204.613 1
7.37082 211.916 1
7.54571 219.218 1
7.72488 226.521 1
7.89188 233.824 1
8.05016 241.127 1
8.20812 248.43 1
8.36082 255.732 1
8.50232 263.035 1
8.63691 270.338 1
8.77083 277.641 1
8.90572 284.943 1
9.04113 292.246 1
9.17568 299.549 1
9.30722 306.852 1
9.43443 314.155 1
9.55736 321.457 1
9.67658 328.76 1
9.79455 336.063 1
9.91455 343.366 1
10.0365 350.668 1
10.1563 357.971 1
10.2704 365.274 1
10.3801 372.577 1
10.4889 379.88 1
10.5989 387.182 1
10.709 394.485 1
10.8171 401.788 1
10.9224 409.091 1
11.0255 416.393 1
11.1271 423.696 1
11.2279 430.999 1
11.3284 438.302 1
11.4291 445.605 1
11.5298 452.907 1
11.6298 460.21 1
11.7279 467.513 1
11.8242 474.816 1
11.919 482.118 1
12.0129 489.421 1
12.106 496.724 1
12.1978 504.027 1
12.2872 511.33 1
12.3743 518.632 1
12.4601 525.935 1
12.5455 533.238 1
12.6312 540.541 1
12.7174 547.843 1
12.8038 555.146 1
12.8905 562.449 1
12.9777 569.752 1
13.0664 577.054 1
13.1577 584.357 1
13.252 591.66 1
13.3487 598.963 1
13.446 606.266 1
13.5426 613.568 1
13.6365 620.871 1
13.7264 628.174 1
13.8109 635.477 1
13.8888 642.779 1
13.9604 650.082 1
14.0266 657.385 1
14.0884 664.688 1
14.1472 671.991 1
14.2047 679.293 1
14.2628 686.596 1
14.3246 693.899 1
14.3941 701.202 1
14.4788 708.504 1
14.593 715.807 1
14.6 723.11 1
# #######################################################################
# TopOptions to process cosmics /single beam data
# M. Woudstra, R. Nikolaidou
#
# By default we run on 10 events of the 87863 run, full reconstruction
# Muonboy and Moore and we produce as
# output : CBNT, 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 theApp
# from RecExConfig.RecFlags import rec
# from RecExConfig.RecConfFlags import recConfFlags
# in Standalone mode, don't allow any configuration errors
athenaCommonFlags.AllowIgnoreConfigError = False
#Just Muons
DetFlags.Muon_setOn()
# print DetFlag
#
# command line parameters (-c)
#
if 'EvtMax' not in dir():
EvtMax = 10 # maximum number of events to process
if 'SkipEvents' not in dir():
SkipEvents = 0
theApp.evtMax=EvtMax
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
svcMgr.MessageSvc.OutputLevel = VERBOSE
# Set properly beam type, DataSource, InputFormat, Detector Description, Conditions Tag
from IOVDbSvc.CondDB import conddb
globalflags.DataSource.set_Value_and_Lock('data')
if globalflags.DataSource() == 'data':
jobproperties.Beam.beamType.set_Value_and_Lock("cosmics")
globalflags.InputFormat.set_Value_and_Lock('bytestream')
globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEONF-04-00-00')
else :
globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEONF-02-01-00')
globalflags.ConditionsTag.set_Value_and_Lock('OFLCOND-SIM-00-00-00')
include ("RecExCond/AllDet_detDescr.py")
# for running over data with field on need this to be set to true
jobproperties.BField.solenoidOn.set_Value_and_Lock(False)
jobproperties.BField.barrelToroidOn.set_Value_and_Lock(False)
jobproperties.BField.endcapToroidOn.set_Value_and_Lock(False)
# Max number of events to run, number of events to skip
athenaCommonFlags.EvtMax.set_Value_and_Lock(EvtMax)
athenaCommonFlags.SkipEvents.set_Value_and_Lock(SkipEvents)
# setup environment
athenaCommonFlags.BSRDOInput.set_Value_and_Lock(['/castor/cern.ch/grid/atlas/atlasdatadisk/data08_cos/RAW/data08_cos.00091060.physics_RPCwBeam.daq.RAW.o4/daq.ATLAS.0091060.physics.RPCwBeam.LB0001.SFO-1._0001.data'])
# '/castor/cern.ch/grid/atlas/DAQ/2008/87863/physics_BPTX/daq.NoTag.0087863.physics.BPTX.LB0000.SFO-1._0001.data'])
globalflags.ConditionsTag.set_Value_and_Lock('COMCOND-REPC-001-03')
include ("MuonCnvExample/MuonReadBS_jobOptions.py")
include ("MuonTestEDM/MuonTestEDM_jobOptions.py")
MyEDMTester.DoDumpPRDs=False
MyEDMTester.DoDumpTracks=False
MyEDMTester.DoDumpRDOs=True
MyEDMTester.DoDumpSegments=False
print MyEDMTester
if MyEDMTester.DoDumpRDOs:
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
StreamESD = AthenaPoolOutputStream( "StreamESD" )
# Add RDOs to output, if we're comparing these too
StreamESD.ItemList+=["MdtCsmContainer#*"]
StreamESD.ItemList+=["CscRawDataContainer#*"]
StreamESD.ItemList+=["RpcPadContainer#*"]
StreamESD.ItemList+=["TgcRdoContainer#*"]
from TrkEventCnvTools.TrkEventCnvToolsConf import Trk__EventCnvSuperTool
TrkEventCnvSuperTool = Trk__EventCnvSuperTool(name="EventCnvSuperTool", DoID=False)
ToolSvc += TrkEventCnvSuperTool
print TrkEventCnvSuperTool
MuonSpectrometer/MuonReconstruction/MuonRecExample
......@@ -7,5 +7,3 @@ atlas_subdir( MuonRecExample )
# Install files from the package:
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
atlas_install_joboptions( share/*.py )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@page MuonRecExample_page MuonRecExample
@author Martin Woudstra (current main maintainer)
@author Rosy Nikolaidou (contributor)
@author Kevin Black (contributor)
@author Niels van Eldik (contributor)
@author Jochem Snuverink (contributor)
@author Ketevi Assamagan (contributor)
@author Stephane Willocq (contributor)
@author Ed Moyse (contributor)
@section MuonRecExample_MuonRecExampleIntro Introduction
This package configures the Muon Standalone Reconstruction. It contains only python jobOptions
and python modules for configuration purposes. It contains no C++ code.
It has a dual role:
- It provides the main entry point to setup the muon standalone reconstruction within RecExCommon:
- share/MuonRec_jobOptions.py
- It includes some example top level jobOptions for users to run only the muon standalone reconstruction:
- share/MuonRec_myTopOptions.py: run on Monte-Carlo events
- share/MuonDataRec_myTopOptions.py: run on real data events
@section MuonRecExample_MuonRecExampleRun Running Muon Standalone Reconstruction
To run on Monte Carlo:<br>
<code>
get_joboptions MuonRecExample/MuonRec_myTopOptions.py<br>
</code>
edit MuonRec_myTopOptions.py to set the flags according to your wishes<br>
<code>
athena MuonRec_myTopOptions.py<br>
</code>
To run on real data use MuonRecExample/MuonDataRec_myTopOptions.py instead.
@subsection MuonRecExampleCustom Customize the muon reconstruction for your purpose
There are two complementary ways to configure the muon reconstruction: Flags and Configurable Properties.
- Flags (a.k.a. JobProperties) are set in the beginning of the jobOptions file, and generally configure
a number of algorithm, services and/or tools, add algorithms to the topSequence etc.
This provides a 'coarse' configurability.
- Configurable Properties are set at the end of the jobOptions file and directly set individuel Properties
of individual algorithms, services and/or tools. This is to fine-tune the configuration.
- If your desired configuration is not provided by the Flags, then you will need to use Configurable Properties.
@subsubsection MuonRecExampleFlags Flags to steer Muon Reconstruction
There are several %Flags containers (JobPropertyContainers) that influence the configuration:
- @link python/MuonRecFlags.py <code>from MuonRecExample.MuonRecFlags import muonRecFlags</code> @endlink
@copydoc python::MuonRecFlags
- @link python/MooreFlags.py <code>from MuonRecExample.MooreFlags import mooreFlags</code> @endlink
@copydoc python::MooreFlags
- @link python/MuonboyFlags.py <code>from MuonRecExample.MuonboyFlags import muonboyFlags</code> @endlink
@copydoc python::MuonboyFlags
- @link python/MuonRecStandaloneFlags.py <code>from MuonRecExample.MuonRecStandaloneFlags import muonRecFlags</code> @endlink
@copydoc python::MuonRecStandaloneFlags
- <code>from AthenaCommon.DetFlags import DetFlags</code> Switch on/off specific tasks per detector technology
- <code>from AthenaCommon.GlobalFlags import globalflags</code> DetDescrVersion, ConditionsTag, DataSource, InputFormat, ...
- <code>from AthenaCommon.AthenaCommonFlags athenaCommonFlags</code> Input and output filenames
- <code>from AthenaCommon.BeamFlags import jobproperties<br>
beamFlags = jobproperties.Beam</code> beamType ("collisions", "cosmics", "singlebeam"), ...
- <code>from AthenaCommon.BFieldFlags import jobproperties<br>
bFieldFlags = jobproperties.BField</code> Which magnetic fields are on/off: Solonoid, Toriod (Barrel/Endcap)
- <code>from RecExConfig.RecFlags import rec</code> readRDO, doWriteESD, ...
- <code>from RecExConfig.RecAlgsFlags import recAlgs</code> (only using doTrackRecordFilter)
See the respective modules for the full list of available flags and their meaning.
@subsubsection MuonRecExampleConverters Configuring the data converters
The data converters convert BS (bytestream) into RDO (Raw Data Object), and RDO in PRD (Prepared Raw Data).
python/MuonRecTools.py.The converter algorithms for RDO to PRD are configured in the jobOptions file share/MuonRDO_to_PRD_jobOptions.py,
which calls the external jobOptions MuonRdoToPrepData/MuonRdoToMuonPrepData_jobOptions.py, which also sets up the converter tools (by
including other jobOptions).
\todo Move configuration of all converter tools to module python/MuonRecCnvTools.py.
The converters are configured by the following flags:
- BS to RDO converters
- <code>DetFlags.readRDOBS.MDT_setOn()</code> Run the MDT BS to RDO converters (tools + algorithms)
- <code>DetFlags.readRDOBS.RPC_setOn()</code> Run the RPC BS to RDO converters (tools + algorithms)
- <code>DetFlags.readRDOBS.CSC_setOn()</code> Run the CSC BS to RDO converters (tools + algorithms)
- <code>DetFlags.readRDOBS.TGC_setOn()</code> Run the TGC BS to RDO converters (tools + algorithms)
- <code>DetFlags.readRDOBS.Muon_setOn()</code> Run the BS to RDO converters for all technologies
- <code>DetFlags.readRDOBS.Muon_setOff()</code> Don't run any BS to RDO converters
- @link python::MuonRecFlags::doSpecialTGC <code>muonRecFlags.doSpecialTGC</code> @endlink Use special TGC ROD decoder to fix bug in DAQ
(2008 real data).
- RDO to PRD converters
- <code>DetFlags.makeRIO.MDT_setOn()</code> Run the MDT RDO to PRD converters (tools + algorithms)
- <code>DetFlags.makeRIO.RPC_setOn()</code> Run the RPC RDO to PRD converters (tools + algorithms)
- <code>DetFlags.makeRIO.CSC_setOn()</code> Run the CSC RDO to PRD converters (tools + algorithms)
- <code>DetFlags.makeRIO.TGC_setOn()</code> Run the TGC RDO to PRD converters (tools + algorithms)
- <code>DetFlags.makeRIO.Muon_setOn()</code> Run the RDO to PRD converters for all technologies
- <code>DetFlags.makeRIO.Muon_setOff()</code> Don't run any BS to RDO converters
- To switch off a converter, replace <code>_setOn()</code> above with <code>_setOff()</code>
- IMPORTANT: These DetFlags are also controlled by <code>muonRecFlags.doMDTs, doRPCs, doCSCs and doTGCs</code>, in conjuction with
<code>rec.readRDO (True/False)</code> and <code>globalflags.DataFormat ("pool","bytestream")</code>. The setting of these flags will be
forwarded to the above converter @c DetFlags as appropriate. This is done in the function @c MuonRecFlags.sync_DetFlags(), and you normally
don't have to set the @c DetFlags manually. In case you do want to override these @c DetFlags directly compared to what the @c
muonRecFlags.doXXXs flags set them to, you need to set the @c DetFlags after<br> <code>include("RecExCond/RecExCommon_Flags.py")</code><br>
because that calls the function @c MuonRecFlags.sync_DetFlags() and you will lose the changes you set before.
*/
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
__doc__ = """Configuration of tools for CSC reconstruction"""
###############################################################
#
# Configuration for Moore
#
#==============================================================
from AthenaCommon.Logging import logging
logging.getLogger().info("Importing %s", __name__)
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.BeamFlags import jobproperties
beamFlags = jobproperties.Beam
from AthenaCommon import CfgMgr
from AthenaCommon.CfgGetter import getPublicTool, getPrivateTool
from MuonRecExample.MuonAlignFlags import muonAlignFlags
def CscAlignmentTool(name="CscAlignmentTool",extraFlags=None,**kwargs):
etaposAlignConsts = [ # 1st, 2nd, 3rd, 4th layer
0.0, -0.0902347, -0.0984321, -0.141175, #sector -16
0.0, -0.166412, -0.150399, -0.18592, #sector -15
0.0, -0.0544449, 0.101448, -0.0433321, #sector -14
0.0, -0.047769, -0.156247, -0.0854826, #sector -13
0.0, -0.0970101, -0.227578, -0.301079, #sector -12
0.0, -0.152912, -0.365218, -0.314042, #sector -11
0.0, 0.0338696, -0.264766, -0.224567, #sector -10
0.0, -0.107372, -0.16099, -0.13508, #sector -9
0.0, -0.0663979, -0.0312645, -0.130711, #sector -8
0.0, -0.249974, -0.269372, -0.353648, #sector -7
0.0, -0.194175, 0.0238348, -0.188433, #sector -6
0.0, 0.0977346, 0.0492461, 0.150434, #sector -5
0.0, 0.0444637, -0.0871214, -0.0627541, #sector -4
0.0, 0.0347245, -0.0226186, -0.0826478, #sector -3
0.0, -0.00408879, -0.0638005, -0.206868, #sector -2
0.0, 0.0331328, 0.0402103, 0.118611, #sector -1
0.0, -0.0634537, -0.0516743, 0.0045364, #sector 1
0.0, -0.0957718, -0.235246, -0.439811, #sector 2
0.0, -0.163504, -0.0129115, 0.00140143, #sector 3
0.0, -0.182903, -0.0503858, -0.207799, #sector 4
0.0, -0.0970927, 0, 0.124744, #sector 5
0.0, -0.0169602, -0.0527447, 0.0319154, #sector 6
0.0, -0.176499, -0.196542, -0.0846979, #sector 7
0.0, 0.0589994, 0.0131431, 0.0461769, #sector 8
0.0, -0.0237507, -0.0307316, 0.144429, #sector 9
0.0, -0.0144483, -0.0328234, -0.00553684, #sector 10
0.0, 0.113188, -0.176182, 0.0635706, #sector 11
0.0, -0.109776, -0.727705, -0.756824, #sector 12
0.0, -0.0553061, -0.056162, -0.0336955, #sector 13
0.0, -0.070077, -0.127203, -0.140082, #sector 14
0.0, -0.0844368, -0.0735331, -0.016667, #sector 15
0.0, 0.0426443, -0.153659, -0.129711, #sector 16
]
phiposAlignConsts = [ # 1st, 2nd, 3rd, 4th layer
0.0, 0.0, 0.0, 0.0, #-16
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #-14
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #-12
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #-10
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #-8
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #-6
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #-4
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #-2
0.0, 0.0, 0.0, 0.0, #-1
0.0, 0.0, 0.0, 0.0, # sector =1 and above...
0.0, 0.0, 0.0, 0.0, #2
0.0, 0.0, 0.0, 0.0, #3
0.0, 0.0, 0.0, 0.0, #4
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #6
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #8
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #10
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #12
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, #14
0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0 #16
]
kwargs.setdefault("phiposAlignConsts", phiposAlignConsts)
kwargs.setdefault("etaposAlignConsts", etaposAlignConsts)
kwargs.setdefault("useAlignment", (globalflags.DataSource() == 'data' and not muonAlignFlags.UseIlines() ) )
return CfgMgr.CscAlignmentTool(name,**kwargs)
# end of factory function CscAlignmentTool
def SimpleCscClusterFitter(name="SimpleCscClusterFitter",extraFlags=None,**kwargs):
kwargs.setdefault("CscAlignmentTool", getPublicTool("CscAlignmentTool") )
return CfgMgr.SimpleCscClusterFitter(name,**kwargs)
def CscPeakThresholdClusterBuilderTool(name="CscPeakThresholdClusterBuilderTool",extraFlags=None,**kwargs):
kwargs.setdefault("default_fitter", getPublicTool("SimpleCscClusterFitter") )
kwargs.setdefault("precision_fitter", getPublicTool("QratCscClusterFitter") )
kwargs.setdefault("split_fitter", getPublicTool("CscSplitClusterFitter") )
kwargs.setdefault("strip_fitter", getPublicTool("CalibCscStripFitter") )
return CfgMgr.CscPeakThresholdClusterBuilderTool(name,**kwargs)
def CscThresholdClusterBuilderTool(name="CscThresholdClusterBuilderTool",extraFlags=None,**kwargs):
kwargs.setdefault("default_fitter", getPublicTool("SimpleCscClusterFitter") )
kwargs.setdefault("precision_fitter", getPublicTool("QratCscClusterFitter") )
kwargs.setdefault("split_fitter", getPublicTool("CscSplitClusterFitter") )
kwargs.setdefault("strip_fitter", getPublicTool("CalibCscStripFitter") )
kwargs.setdefault("cscCalibTool", getPublicTool("CscCalibTool") )
return CfgMgr.CscThresholdClusterBuilderTool(name,**kwargs)
def CscClusterUtilTool(name = "CscClusterUtilTool",extraFlags=None,**kwargs):
kwargs.setdefault("strip_fitter", getPrivateTool("CalibCscStripFitter") )
kwargs.setdefault("precision_fitter", getPrivateTool("QratCscClusterFitter") )
return CfgMgr.CscClusterUtilTool(name,**kwargs)
def CalibCscStripFitter(name = "CalibCscStripFitter",extraFlags=None,**kwargs):
kwargs.setdefault("cscCalibTool", getPrivateTool("CscCalibTool") )
return CfgMgr.CalibCscStripFitter(name,**kwargs)
def CscSplitClusterFitter(name="CscSplitClusterFitter",extraFlags=None,**kwargs):
kwargs.setdefault("precision_fitter", getPublicTool("QratCscClusterFitter") )
kwargs.setdefault("default_fitter", getPublicTool("SimpleCscClusterFitter") )
return CfgMgr.CscSplitClusterFitter(name,**kwargs)
def CscThresholdClusterBuilder( name = "CscThresholdClusterBuilder",extraFlags=None,**kwargs):
kwargs.setdefault("cluster_builder", getPublicTool("CscThresholdClusterBuilderTool") )
return CfgMgr.CscThresholdClusterBuilder(name,**kwargs)
def QratCscClusterFitter( name="QratCscClusterFitter",extraFlags=None,**kwargs):
qratcor_css_eta = [
0.000000, 0.000000, 0.000000, 0.000000, 0.0699381, 0.178291, 0.271303, 0.345611,
0.400738, 0.452451, 0.493772, 0.526792, 0.553845, 0.580111, 0.603337, 0.624749,
0.646065, 0.663924, 0.681897, 0.701345, 0.716067, 0.730324, 0.743168, 0.760598,
0.773341, 0.786406, 0.798358, 0.811339, 0.820949, 0.832676, 0.843917, 0.85412,
0.863914, 0.873229, 0.88251, 0.892856, 0.903296, 0.910067, 0.917892, 0.928028,
0.93461, 0.943679, 0.951617, 0.958326, 0.964428, 0.97341, 0.978204, 0.987075,
0.994789, 1.000000
]
qratcor_csl_eta = [
0.000000, 0.000000, 0.000000, 0.000000, 0.0290177, 0.0834867, 0.188683, 0.269967,
0.334887, 0.393036, 0.440317, 0.481884, 0.51725, 0.545107, 0.56959, 0.592327,
0.614087, 0.635344, 0.655252, 0.672766, 0.690929, 0.707293, 0.722742, 0.738323,
0.753562, 0.76749, 0.780983, 0.79354, 0.806521, 0.818085, 0.829987, 0.841443,
0.853723, 0.863393, 0.87431, 0.883139, 0.892962, 0.902803, 0.911276, 0.921417,
0.929387, 0.938106, 0.947072, 0.954406, 0.961692, 0.97055, 0.978517, 0.985133,
0.992257, 1.000000
]
kwargs.setdefault("qratcor_csl_eta",qratcor_csl_eta)
kwargs.setdefault("qratcor_css_eta",qratcor_css_eta)
kwargs.setdefault("CscAlignmentTool", getPrivateTool("CscAlignmentTool") )
return CfgMgr.QratCscClusterFitter(name,**kwargs)
def CscSegmentUtilTool(name= "CscSegmentUtilTool",extraFlags=None,**kwargs):
kwargs.setdefault("rot_creator", getPublicTool("CscClusterOnTrackCreator") )
return CfgMgr.CscSegmentUtilTool(name,**kwargs)
def Csc2dSegmentMaker(name= "Csc2dSegmentMaker",extraFlags=None,**kwargs):
kwargs.setdefault("segmentTool", getPublicTool("CscSegmentUtilTool") )
return CfgMgr.Csc2dSegmentMaker(name,**kwargs)
def Csc4dSegmentMaker(name= "Csc4dSegmentMaker",extraFlags=None,**kwargs):
kwargs.setdefault("segmentTool", getPublicTool("CscSegmentUtilTool") )
return CfgMgr.Csc4dSegmentMaker(name,**kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment