diff --git a/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleToolSetup.py b/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleToolSetup.py index 82fb2db8cd1fe1db8bc0557520d5b82e3201d66f..635bbf01351cff21b93389171fcf16d8c39c49f2 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleToolSetup.py +++ b/InnerDetector/InDetConditions/SiLorentzAngleSvc/python/SCTLorentzAngleToolSetup.py @@ -60,7 +60,7 @@ class SCTLorentzAngleToolSetup: from AthenaCommon.AppMgr import ToolSvc if not hasattr(ToolSvc, "SCTLorentzAngleTool"): from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleTool - ToolSvc += SiLorentzAngleTool(name="SCTLorentzAngleTool", DetectorName="SCT") + ToolSvc += SiLorentzAngleTool(name="SCTLorentzAngleTool", DetectorName="SCT", SiLorentzAngleCondData="SCTSiLorentzAngleCondData") sctLorentzAngleTool = ToolSvc.SCTLorentzAngleTool # Pass the silicon conditions tool to the Lorentz angle tool # Also make sure UseMagFieldTool is True as AtlasGeoModel sets this to False diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py index cfd7f4546a2b99196f3c38c81b9b06a24e14c6bd..b359ade6acd8b63b43b8171befd53521f0035ad4 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py @@ -83,56 +83,27 @@ if DetFlags.haveRIO.pixel_on(): if InDetFlags.doPrintConfigurables(): print InDetSpecialPixelMapSvc - # Load pixel DCS information - from SiLorentzAngleSvc.PixelLorentzAngleSvcSetup import pixelLorentzAngleSvcSetup + if InDetFlags.usePixelDCS(): - from PixelConditionsServices.PixelConditionsServicesConf import PixelDCSSvc + + print "STSTST InDetExample 1 ",isData,athenaCommonFlags.isOnline() + + from PixelConditionsTools.PixelDCSConditionsToolSetup import PixelDCSConditionsToolSetup + pixelDCSConditionsToolSetup = PixelDCSConditionsToolSetup() + pixelDCSConditionsToolSetup.setIsDATA(isData) if athenaCommonFlags.isOnline(): - if not conddb.folderRequested('/PIXEL/HLT/DCS/TEMPERATURE'): - conddb.addFolder("PIXEL_ONL","/PIXEL/HLT/DCS/TEMPERATURE") - if not conddb.folderRequested('/PIXEL/HLT/DCS/HV'): - conddb.addFolder("PIXEL_ONL","/PIXEL/HLT/DCS/HV") - - InDetPixelDCSSvc = PixelDCSSvc(RegisterCallback = TRUE, - TemperatureFolder = "/PIXEL/HLT/DCS/TEMPERATURE", - HVFolder = "/PIXEL/HLT/DCS/HV", - TemperatureFieldName = "temperature", - HVFieldName = "HV") + print "STSTST InDetExample XXX" + pixelDCSConditionsToolSetup.setHVFolder("/PIXEL/HLT/DCS/HV") + pixelDCSConditionsToolSetup.setTempFolder("/PIXEL/HLT/DCS/TEMPERATURE") + pixelDCSConditionsToolSetup.setDbInstance("PIXEL_ONL") else: - if not conddb.folderRequested('/PIXEL/DCS/TEMPERATURE'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/TEMPERATURE") - if not conddb.folderRequested('/PIXEL/DCS/HV'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/HV") - if not conddb.folderRequested('/PIXEL/DCS/FSMSTATUS'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/FSMSTATUS") - if not conddb.folderRequested('/PIXEL/DCS/FSMSTATE'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/FSMSTATE") - from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as geoFlags - # from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as idGeoFlags - if (rec.doMonitoring() and globalflags.DataSource() == 'data' and ( geoFlags.Run() in ["RUN2", "RUN3"] ) and conddb.dbdata == "CONDBR2"): - # idGeoFlags.isIBL() == True may work too instead of ( geoFlags.Run() in ["RUN2", "RUN3"] ) - if not conddb.folderRequested('/PIXEL/DCS/PIPES'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/PIPES") - if not conddb.folderRequested('/PIXEL/DCS/LV'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/LV") - if not conddb.folderRequested('/PIXEL/DCS/HVCURRENT'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/HVCURRENT") - # not used anymore - # if not conddb.folderRequested('/PIXEL/DCS/PLANTS'): - # conddb.addFolder("DCS_OFL","/PIXEL/DCS/PLANTS") - - InDetPixelDCSSvc = PixelDCSSvc(RegisterCallback = TRUE, - TemperatureFolder = "/PIXEL/DCS/TEMPERATURE", - HVFolder = "/PIXEL/DCS/HV", - FSMStatusFolder = "/PIXEL/DCS/FSMSTATUS", - FSMStateFolder = "/PIXEL/DCS/FSMSTATE", - TemperatureFieldName = "temperature", - HVFieldName = "HV", - FSMStatusFieldName = "FSM_status", - FSMStateFieldName = "FSM_state" ) - ServiceMgr += InDetPixelDCSSvc - if InDetFlags.doPrintConfigurables(): - print InDetPixelDCSSvc + pixelDCSConditionsToolSetup.setHVFolder("/PIXEL/DCS/HV") + pixelDCSConditionsToolSetup.setTempFolder("/PIXEL/DCS/TEMPERATURE") + pixelDCSConditionsToolSetup.setDbInstance("DCS_OFL") + pixelDCSConditionsToolSetup.setup() + if (InDetFlags.doPrintConfigurables()): + print pixelDCSConditionsToolSetup.getTool() + # temporarily workaround incomplete conditions data for MC # by only enabling the usage of dcs in the pixel conditions summary service for data @@ -143,6 +114,69 @@ if DetFlags.haveRIO.pixel_on(): InDetPixelConditionsSummaryTool.UseDCS = isData InDetPixelConditionsSummaryTool.IsActiveStates = [ 'READY', 'ON', 'UNKNOWN', 'TRANSITION', 'UNDEFINED' ] InDetPixelConditionsSummaryTool.IsActiveStatus = [ 'OK', 'WARNING', 'ERROR', 'FATAL' ] + + +#STSTST # Load pixel DCS information +#STSTST from SiLorentzAngleSvc.PixelLorentzAngleSvcSetup import pixelLorentzAngleSvcSetup +#STSTST if InDetFlags.usePixelDCS(): +#STSTST from PixelConditionsServices.PixelConditionsServicesConf import PixelDCSSvc +#STSTST if athenaCommonFlags.isOnline(): +#STSTST if not conddb.folderRequested('/PIXEL/HLT/DCS/TEMPERATURE'): +#STSTST conddb.addFolder("PIXEL_ONL","/PIXEL/HLT/DCS/TEMPERATURE") +#STSTST if not conddb.folderRequested('/PIXEL/HLT/DCS/HV'): +#STSTST conddb.addFolder("PIXEL_ONL","/PIXEL/HLT/DCS/HV") +#STSTST +#STSTST InDetPixelDCSSvc = PixelDCSSvc(RegisterCallback = TRUE, +#STSTST TemperatureFolder = "/PIXEL/HLT/DCS/TEMPERATURE", +#STSTST HVFolder = "/PIXEL/HLT/DCS/HV", +#STSTST TemperatureFieldName = "temperature", +#STSTST HVFieldName = "HV") +#STSTST else: +#STSTST if not conddb.folderRequested('/PIXEL/DCS/TEMPERATURE'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/TEMPERATURE") +#STSTST if not conddb.folderRequested('/PIXEL/DCS/HV'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/HV") +#STSTST if not conddb.folderRequested('/PIXEL/DCS/FSMSTATUS'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/FSMSTATUS") +#STSTST if not conddb.folderRequested('/PIXEL/DCS/FSMSTATE'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/FSMSTATE") +#STSTST from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as geoFlags +#STSTST # from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags as idGeoFlags +#STSTST if (rec.doMonitoring() and globalflags.DataSource() == 'data' and ( geoFlags.Run() in ["RUN2", "RUN3"] ) and conddb.dbdata == "CONDBR2"): +#STSTST # idGeoFlags.isIBL() == True may work too instead of ( geoFlags.Run() in ["RUN2", "RUN3"] ) +#STSTST if not conddb.folderRequested('/PIXEL/DCS/PIPES'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/PIPES") +#STSTST if not conddb.folderRequested('/PIXEL/DCS/LV'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/LV") +#STSTST if not conddb.folderRequested('/PIXEL/DCS/HVCURRENT'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/HVCURRENT") +#STSTST # not used anymore +#STSTST # if not conddb.folderRequested('/PIXEL/DCS/PLANTS'): +#STSTST # conddb.addFolder("DCS_OFL","/PIXEL/DCS/PLANTS") +#STSTST +#STSTST InDetPixelDCSSvc = PixelDCSSvc(RegisterCallback = TRUE, +#STSTST TemperatureFolder = "/PIXEL/DCS/TEMPERATURE", +#STSTST HVFolder = "/PIXEL/DCS/HV", +#STSTST FSMStatusFolder = "/PIXEL/DCS/FSMSTATUS", +#STSTST FSMStateFolder = "/PIXEL/DCS/FSMSTATE", +#STSTST TemperatureFieldName = "temperature", +#STSTST HVFieldName = "HV", +#STSTST FSMStatusFieldName = "FSM_status", +#STSTST FSMStateFieldName = "FSM_state" ) +#STSTST ServiceMgr += InDetPixelDCSSvc +#STSTST if InDetFlags.doPrintConfigurables(): +#STSTST print InDetPixelDCSSvc +#STSTST +#STSTST # temporarily workaround incomplete conditions data for MC +#STSTST # by only enabling the usage of dcs in the pixel conditions summary service for data +#STSTST InDetPixelConditionsSummarySvc.UseDCS = isData +#STSTST InDetPixelConditionsSummarySvc.IsActiveStates = [ 'READY', 'ON', 'UNKNOWN', 'TRANSITION', 'UNDEFINED' ] +#STSTST InDetPixelConditionsSummarySvc.IsActiveStatus = [ 'OK', 'WARNING', 'ERROR', 'FATAL' ] +#STSTST +#STSTST InDetPixelConditionsSummaryTool.UseDCS = isData +#STSTST InDetPixelConditionsSummaryTool.IsActiveStates = [ 'READY', 'ON', 'UNKNOWN', 'TRANSITION', 'UNDEFINED' ] +#STSTST InDetPixelConditionsSummaryTool.IsActiveStatus = [ 'OK', 'WARNING', 'ERROR', 'FATAL' ] + else: pixelLorentzAngleSvcSetup.usePixelDefaults = True from PixelConditionsServices.PixelConditionsServicesConf import PixelSiliconConditionsSvc @@ -200,6 +234,13 @@ if DetFlags.haveRIO.pixel_on(): ToolSvc += InDetPixelConditionsSummaryTool if (InDetFlags.doPrintConfigurables()): print InDetPixelConditionsSummaryTool + + print "STSTST InDetExample 2" + # Setup Lorentz angle tool. + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + PixelLorentzAngleTool = pixelLorentzAngleToolSetup.PixelLorentzAngleTool + # # --- Load SCT Conditions Services # diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py index 7b4aab95c851f1451e835c46ea98534f09dac5d1..8b53bb586eff5a6721fa5711ebce51ab7405eb7b 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py @@ -16,6 +16,8 @@ if use_broad_cluster_sct == None : # detector specific settings will override the global setting: use_broad_cluster_any = use_broad_cluster_pix or use_broad_cluster_sct +print "STSTST InDetRecLoadTool 1" + #load common NN tools for clustering and ROT creation if InDetFlags.doPixelClusterSplitting() and not InDetFlags.doSLHC(): @@ -48,12 +50,22 @@ if InDetFlags.doPixelClusterSplitting() and not InDetFlags.doSLHC(): # --- since a correction is needed to fix biases when running on new run 2 compatible calibation # --- a better solution is needed... + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + print "STSTST",ToolSvc + print "STSTST",pixelLorentzAngleToolSetup + + print "STSTST InDetRecLoadTools" from SiClusterizationTool.SiClusterizationToolConf import InDet__NnClusterizationFactory from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags as geoFlags if ( not geoFlags.Run() in ["RUN2", "RUN3"] ) : NnClusterizationFactory = InDet__NnClusterizationFactory( name = "NnClusterizationFactory", +# PixelLorentzAngleTool= ToolSvc.PixelLorentzAngleTool, NetworkToHistoTool = NeuralNetworkToHistoTool, doRunI = True, useToT = False, @@ -66,6 +78,7 @@ if InDetFlags.doPixelClusterSplitting() and not InDetFlags.doSLHC(): else: NnClusterizationFactory = InDet__NnClusterizationFactory( name = "NnClusterizationFactory", +# PixelLorentzAngleTool= ToolSvc.PixelLorentzAngleTool, NetworkToHistoTool = NeuralNetworkToHistoTool, LoadNoTrackNetwork = True, useToT = InDetFlags.doNNToTCalibration(), @@ -88,13 +101,25 @@ if InDetFlags.doPixelClusterSplitting() and not InDetFlags.doSLHC(): if (InDetFlags.doPrintConfigurables()): print NnClusterizationFactory elif InDetFlags.doPixelClusterSplitting(): + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + print "STSTST",ToolSvc + print "STSTST",pixelLorentzAngleToolSetup + + print "STSTST InDetRecLoadTools X" + from SiClusterizationTool.SiClusterizationToolConf import InDet__TruthClusterizationFactory NnClusterizationFactory = InDet__TruthClusterizationFactory( name = "TruthClusterizationFactory") +# PixelLorentzAngleTool= ToolSvc.PixelLorentzAngleTool) ToolSvc += NnClusterizationFactory if (InDetFlags.doPrintConfigurables()): print NnClusterizationFactory +print "STSTST InDetRecLoadTool 2" # --- load cabling (if needed) include("InDetRecExample/InDetRecCabling.py") @@ -112,6 +137,9 @@ from TrkEventCnvTools import TrkEventCnvToolsConfig # # ----------- control loading of ROT_creator # + +print "STSTST InDetRecLoadTool 3 ",InDetFlags.loadRotCreator() + if InDetFlags.loadRotCreator(): # @@ -121,9 +149,14 @@ if InDetFlags.loadRotCreator(): # # load Pixel ROT creator, we overwrite the defaults for the # tool to always make conservative pixel cluster errors + # SiLorentzAngleTool + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() from SiClusterOnTrackTool.SiClusterOnTrackToolConf import InDet__PixelClusterOnTrackTool if InDetFlags.doDBM(): PixelClusterOnTrackToolDBM = InDet__PixelClusterOnTrackTool("InDetPixelClusterOnTrackToolDBM", + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool, DisableDistortions = True, applyNNcorrection = False, NNIBLcorrection = False, @@ -134,6 +167,7 @@ if InDetFlags.loadRotCreator(): ) ToolSvc += PixelClusterOnTrackToolDBM PixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("InDetPixelClusterOnTrackTool", + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool, DisableDistortions = (InDetFlags.doFatras() or InDetFlags.doDBMstandalone()), applyNNcorrection = ( InDetFlags.doPixelClusterSplitting() and InDetFlags.pixelClusterSplittingType() == 'NeuralNet' and not InDetFlags.doSLHC()), @@ -158,6 +192,7 @@ if InDetFlags.loadRotCreator(): print PixelClusterOnTrackToolDBM PixelClusterOnTrackToolDigital = InDet__PixelClusterOnTrackTool("InDetPixelClusterOnTrackToolDigital", + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool, DisableDistortions = (InDetFlags.doFatras() or InDetFlags.doDBMstandalone()), applyNNcorrection = False, NNIBLcorrection = False, @@ -229,11 +264,16 @@ if InDetFlags.loadRotCreator(): # --- configure broad cluster ROT creator # if DetFlags.haveRIO.pixel_on(): + # SiLorentzAngleTool + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() # # tool to always make conservative pixel cluster errors if not InDetFlags.doDBMstandalone(): from SiClusterOnTrackTool.SiClusterOnTrackToolConf import InDet__PixelClusterOnTrackTool BroadPixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("InDetBroadPixelClusterOnTrackTool", + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool, ErrorStrategy = 0, DisableDistortions = (InDetFlags.doFatras() or InDetFlags.doDBMstandalone()), applyNNcorrection = ( InDetFlags.doPixelClusterSplitting() and diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py index dc87370d4287157801b2c7d6991901a25ba15f59..9ab8477c36d4f219eb382305d6577b07a5643526 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py @@ -25,8 +25,12 @@ if InDetFlags.doPRDFormation(): if DetFlags.makeRIO.pixel_on() or DetFlags.makeRIO.SCT_on(): # - # --- SiLorentzAngleTool for SCT + # --- SiLorentzAngleTool # + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + if not hasattr(ToolSvc, "SCTLorentzAngleTool"): from SiLorentzAngleSvc.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() @@ -39,6 +43,7 @@ if InDetFlags.doPRDFormation(): PixelCalibSvc = None, PixelOfflineCalibSvc = None, UsePixelCalibCondDB = False, + PixelLorentzAngleTool = ToolSvc.PixelLorentzAngleTool, SCTLorentzAngleTool = ToolSvc.SCTLorentzAngleTool) if DetFlags.makeRIO.pixel_on() and not (athenaCommonFlags.isOnline() or InDetFlags.doSLHC()): diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConditionsAccess.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConditionsAccess.py index 01b08266143a9fd945dabb5abfad5d6988ad102f..1a917669d9e6a0c6cfd966c44d894a2be1300dd8 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConditionsAccess.py @@ -8,17 +8,23 @@ from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags +print "STSTST InDetTrigConditionsAccess 1" + if InDetTrigFlags.useConditionsClasses(): _useDCS = False _onlineMode = True _prefix = 'InDetTrig' #_prefix = '' + print "STSTST InDetTrigConditionsAccess 2" + from InDetTrigRecExample.InDetTrigConfigConditions import PixelConditionsSetup PixelConditionsSetup.config(useDCS=_useDCS,onlineMode=_onlineMode,prefix=_prefix) PixelConditionsSetup.lock() PixelConditionsSetup.createSvc() + PixelConditionsSetup.createTool() + print "STSTST InDetTrigConditionsAccess 3" from InDetTrigRecExample.InDetTrigConfigConditions import SCT_ConditionsSetup SCT_ConditionsSetup.config(useDCS=_useDCS, onlineMode=_onlineMode, prefix=_prefix) diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index 2466762585d08965a718d9cb5772714323f8ffc3..c254188e1835a7264af8acb8a98631a8fb88edc0 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration class PixelConditionsServicesSetup: """ @@ -16,6 +16,18 @@ class PixelConditionsServicesSetup: self._lock = False self.config(useDCS=True, onlineMode=False, prefix='') #default offline settings + ########### STSTST NEW ############## + from AthenaCommon.AppMgr import ServiceMgr + self.svcMgr = ServiceMgr + from AthenaCommon.AppMgr import ToolSvc + self.toolSvc = ToolSvc + + self.isData = False + from AthenaCommon.GlobalFlags import globalflags + if globalflags.DataSource() == 'data': + self.isData = True + ########### STSTST NEW ############## + def config(self, useDCS=True, onlineMode=False, prefix=''): if not self._lock: @@ -173,84 +185,139 @@ class PixelConditionsServicesSetup: # if self._print: print SpecialPixelMapSvc - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - from AthenaCommon.GlobalFlags import globalflags - if self.useDCS or self.onlineMode: - #sim - if globalflags.DataSource() == 'geant4' or (not athenaCommonFlags.isOnline()): - if not conddb.folderRequested('/PIXEL/DCS/TEMPERATURE'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/TEMPERATURE") - if not conddb.folderRequested('/PIXEL/DCS/HV'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/HV") - if not conddb.folderRequested('/PIXEL/DCS/FSMSTATUS'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/FSMSTATUS") - if not conddb.folderRequested('/PIXEL/DCS/FSMSTATE'): - conddb.addFolder("DCS_OFL","/PIXEL/DCS/FSMSTATE") - else: - if not conddb.folderRequested('/PIXEL/HLT/DCS/TEMPERATURE'): - conddb.addFolder("PIXEL_ONL","/PIXEL/HLT/DCS/TEMPERATURE") - #conddb.addFolder("PIXEL","/PIXEL/HLT/DCS/TEMPERATURE <tag>PixDCSTemp-UPD1-00</tag>") - if not conddb.folderRequested('/PIXEL/HLT/DCS/HV'): - conddb.addFolder("PIXEL_ONL","/PIXEL/HLT/DCS/HV") - #conddb.addFolder("PIXEL","/PIXEL/HLT/DCS/HV <tag>PixDCSHV-UPD1-00</tag>") - - - from PixelConditionsServices.PixelConditionsServicesConf import PixelDCSSvc - InDetPixelDCSSvc = PixelDCSSvc(name = 'TrigPixelDCSSvc', - RegisterCallback = True, - TemperatureFolder = "/PIXEL/DCS/TEMPERATURE", - HVFolder = "/PIXEL/DCS/HV", - FSMStatusFolder = "/PIXEL/DCS/FSMSTATUS", - FSMStateFolder = "/PIXEL/DCS/FSMSTATE", - TemperatureFieldName = "temperature", - HVFieldName = "HV", - FSMStatusFieldName = "FSM_status", - FSMStateFieldName = "FSM_state", - UseFSMStatus = False, - UseFSMState = False - ) - - if globalflags.DataSource() == 'data': - if (not athenaCommonFlags.isOnline()): - InDetPixelDCSSvc.TemperatureFolder = "/PIXEL/DCS/TEMPERATURE" - InDetPixelDCSSvc.HVFolder = "/PIXEL/DCS/HV" - else: - InDetPixelDCSSvc.TemperatureFolder = "/PIXEL/HLT/DCS/TEMPERATURE" - InDetPixelDCSSvc.HVFolder = "/PIXEL/HLT/DCS/HV" - - ServiceMgr += InDetPixelDCSSvc +#STSTST from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +#STSTST from AthenaCommon.GlobalFlags import globalflags +#STSTST if self.useDCS or self.onlineMode: +#STSTST #sim +#STSTST if globalflags.DataSource() == 'geant4' or (not athenaCommonFlags.isOnline()): +#STSTST if not conddb.folderRequested('/PIXEL/DCS/TEMPERATURE'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/TEMPERATURE") +#STSTST if not conddb.folderRequested('/PIXEL/DCS/HV'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/HV") +#STSTST if not conddb.folderRequested('/PIXEL/DCS/FSMSTATUS'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/FSMSTATUS") +#STSTST if not conddb.folderRequested('/PIXEL/DCS/FSMSTATE'): +#STSTST conddb.addFolder("DCS_OFL","/PIXEL/DCS/FSMSTATE") +#STSTST else: +#STSTST if not conddb.folderRequested('/PIXEL/HLT/DCS/TEMPERATURE'): +#STSTST conddb.addFolder("PIXEL_ONL","/PIXEL/HLT/DCS/TEMPERATURE") +#STSTST #conddb.addFolder("PIXEL","/PIXEL/HLT/DCS/TEMPERATURE <tag>PixDCSTemp-UPD1-00</tag>") +#STSTST if not conddb.folderRequested('/PIXEL/HLT/DCS/HV'): +#STSTST conddb.addFolder("PIXEL_ONL","/PIXEL/HLT/DCS/HV") +#STSTST #conddb.addFolder("PIXEL","/PIXEL/HLT/DCS/HV <tag>PixDCSHV-UPD1-00</tag>") +#STSTST +#STSTST +#STSTST from PixelConditionsServices.PixelConditionsServicesConf import PixelDCSSvc +#STSTST InDetPixelDCSSvc = PixelDCSSvc(name = 'TrigPixelDCSSvc', +#STSTST RegisterCallback = True, +#STSTST TemperatureFolder = "/PIXEL/DCS/TEMPERATURE", +#STSTST HVFolder = "/PIXEL/DCS/HV", +#STSTST FSMStatusFolder = "/PIXEL/DCS/FSMSTATUS", +#STSTST FSMStateFolder = "/PIXEL/DCS/FSMSTATE", +#STSTST TemperatureFieldName = "temperature", +#STSTST HVFieldName = "HV", +#STSTST FSMStatusFieldName = "FSM_status", +#STSTST FSMStateFieldName = "FSM_state", +#STSTST UseFSMStatus = False, +#STSTST UseFSMState = False +#STSTST ) +#STSTST +#STSTST if globalflags.DataSource() == 'data': +#STSTST if (not athenaCommonFlags.isOnline()): +#STSTST InDetPixelDCSSvc.TemperatureFolder = "/PIXEL/DCS/TEMPERATURE" +#STSTST InDetPixelDCSSvc.HVFolder = "/PIXEL/DCS/HV" +#STSTST else: +#STSTST InDetPixelDCSSvc.TemperatureFolder = "/PIXEL/HLT/DCS/TEMPERATURE" +#STSTST InDetPixelDCSSvc.HVFolder = "/PIXEL/HLT/DCS/HV" +#STSTST +#STSTST ServiceMgr += InDetPixelDCSSvc +#STSTST +#STSTST +#STSTST if self.useDCS or self.onlineMode: +#STSTST if self._print: print InDetPixelDCSSvc +#STSTST +#STSTST +#STSTST #this needs also updates how LorentzAngleSvc is accessed () +#STSTST from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc +#STSTST PixelLorentzAngleSvc = SiLorentzAngleSvc(name='PixelLorentzAngleSvc') +#STSTST from PixelConditionsServices.PixelConditionsServicesConf import PixelSiliconConditionsSvc +#STSTST pixelSiliconConditionsSvc=PixelSiliconConditionsSvc(name=self.instanceName('PixelSiliconConditionsSvc'), +#STSTST PixelDCSSvc = 'TrigPixelDCSSvc') +#STSTST ServiceMgr += pixelSiliconConditionsSvc +#STSTST +#STSTST PixelLorentzAngleSvc.SiConditionsServices = pixelSiliconConditionsSvc +#STSTST PixelLorentzAngleSvc.UseMagFieldSvc = True #may need also MagFieldSvc instance +#STSTST +#STSTST #if self.useDCS or self.onlineMode: +#STSTST #if (globalflags.DataSource() == 'data'): +#STSTST #else: +#STSTST #pixelSiliconConditionsSvc.ForceUseGeoModel = True +#STSTST #PixelLorentzAngleSvc.pixelForceUseGeoModel() +#STSTST if self._print: +#STSTST print pixelSiliconConditionsSvc +#STSTST print PixelLorentzAngleSvc + + + ########### STSTST NEW ############## + def createTool(self): + self.dcsTool = self.initDcsTool('InDetPixelDCSConditionsTool') + self.lorentzTool = self.initLorentzAngleTool('PixelLorentzAngleTool') + pass - if self.useDCS or self.onlineMode: - if self._print: print InDetPixelDCSSvc + def initDcsTool(self, instanceName): + "Init DCS conditions tool" + from PixelConditionsTools.PixelDCSConditionsToolSetup import PixelDCSConditionsToolSetup + pixelDCSConditionsToolSetup = PixelDCSConditionsToolSetup() + pixelDCSConditionsToolSetup.setToolName(instanceName) + pixelDCSConditionsToolSetup.setIsDATA(self.isData) + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + if athenaCommonFlags.isOnline(): + pixelDCSConditionsToolSetup.setHVFolder("/PIXEL/HLT/DCS/HV") + pixelDCSConditionsToolSetup.setTempFolder("/PIXEL/HLT/DCS/TEMPERATURE") + pixelDCSConditionsToolSetup.setDbInstance("PIXEL_ONL") + else: + pixelDCSConditionsToolSetup.setHVFolder("/PIXEL/DCS/HV") + pixelDCSConditionsToolSetup.setTempFolder("/PIXEL/DCS/TEMPERATURE") + pixelDCSConditionsToolSetup.setDbInstance("DCS_OFL") - #this needs also updates how LorentzAngleSvc is accessed () - from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleSvc - PixelLorentzAngleSvc = SiLorentzAngleSvc(name='PixelLorentzAngleSvc') - from PixelConditionsServices.PixelConditionsServicesConf import PixelSiliconConditionsSvc - pixelSiliconConditionsSvc=PixelSiliconConditionsSvc(name=self.instanceName('PixelSiliconConditionsSvc'), - PixelDCSSvc = 'TrigPixelDCSSvc') - ServiceMgr += pixelSiliconConditionsSvc + pixelDCSConditionsToolSetup.setup() + dcsTool = pixelDCSConditionsToolSetup.getTool() + return dcsTool - PixelLorentzAngleSvc.SiConditionsServices = pixelSiliconConditionsSvc - PixelLorentzAngleSvc.UseMagFieldSvc = True #may need also MagFieldSvc instance + def initLorentzAngleTool(self, instanceName): + "Inititalize Lorentz angle Tool" - #if self.useDCS or self.onlineMode: - #if (globalflags.DataSource() == 'data'): - #else: - #pixelSiliconConditionsSvc.ForceUseGeoModel = True - #PixelLorentzAngleSvc.pixelForceUseGeoModel() - if self._print: - print pixelSiliconConditionsSvc - print PixelLorentzAngleSvc + from SiPropertiesSvc.PixelSiPropertiesToolSetup import PixelSiPropertiesToolSetup + pixelSiPropertiesToolSetup = PixelSiPropertiesToolSetup() + pixelSiPropertiesToolSetup.setSiliconTool(self.dcsTool) + pixelSiPropertiesToolSetup.setup() + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, "PixelSiLorentzAngleCondAlg"): + from SiLorentzAngleSvc.SiLorentzAngleSvcConf import PixelSiLorentzAngleCondAlg + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + condSeq += PixelSiLorentzAngleCondAlg(name = "PixelSiLorentzAngleCondAlg", + PixelDCSConditionsTool = self.dcsTool, + SiPropertiesTool = pixelSiPropertiesToolSetup.getTool(), + UseMagFieldSvc = True, + UseMagFieldDcs = (not athenaCommonFlags.isOnline())) + pixelSiLorentzAngleCondAlg = condSeq.PixelSiLorentzAngleCondAlg + if not hasattr(self.toolSvc, instanceName): + from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleTool + self.toolSvc += SiLorentzAngleTool(name=instanceName, DetectorName="Pixel", SiLorentzAngleCondData="PixelSiLorentzAngleCondData") + pixelLorentzAngleTool = getattr(self.toolSvc, instanceName) + pixelLorentzAngleTool.UseMagFieldSvc = True - def instanceName(self,tool): - return self.prefix+tool + print "STSTST initLorentzAngleTool end ",instanceName + def instanceName(self, toolname): + return self.prefix+toolname + pass #to be moved to @@ -481,8 +548,7 @@ class SCT_ConditionsToolsSetup: "Inititalize Lorentz angle Tool" if not hasattr(self.toolSvc, instanceName): from SiLorentzAngleSvc.SiLorentzAngleSvcConf import SiLorentzAngleTool - self.toolSvc += SiLorentzAngleTool(name = instanceName, - DetectorName = "SCT") + self.toolSvc += SiLorentzAngleTool(name=instanceName, DetectorName="SCT", SiLorentzAngleCondData="SCTSiLorentzAngleCondData") SCTLorentzAngleTool = getattr(self.toolSvc, instanceName) SCTLorentzAngleTool.UseMagFieldSvc = True #may need also MagFieldSvc instance diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py index 3255f08d1999a5d00853cbc88f26c0bfc0d88123..c5e5af36d3a67f8cc81c78303017ad9e87094212 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py @@ -19,7 +19,10 @@ log = logging.getLogger("InDetTrigConfigRecLoadTools.py") from InDetTrigRecExample.InDetTrigConditionsAccess import PixelConditionsSetup -# SiLorentzAngleTool for SCT +if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + if not hasattr(ToolSvc, "SCTLorentzAngleTool"): from SiLorentzAngleSvc.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() @@ -35,13 +38,13 @@ InDetTrigClusterMakerTool = \ PixelOfflineCalibSvc = PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), #pixLorentzAnleSvc = "InDetTrigPixLorentzAngleSvc", #UseLorentzAngleCorrections = False + PixelLorentzAngleTool = ToolSvc.PixelLorentzAngleTool, SCTLorentzAngleTool = ToolSvc.SCTLorentzAngleTool ) if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigClusterMakerTool ToolSvc += InDetTrigClusterMakerTool - from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool InDetTrigSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(name="InDetTrigSiSpacePointMakerTool") if (InDetTrigFlags.doPrintConfigurables()): @@ -65,10 +68,10 @@ ToolSvc += SCT_TrigSpacePointTool # if InDetTrigFlags.loadRotCreator(): - # SiLorentzAngleTool if not hasattr(ToolSvc, "SCTLorentzAngleTool"): from SiLorentzAngleSvc.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() + #4 clusterOnTrack Tools # from SiClusterOnTrackTool.SiClusterOnTrackToolConf import InDet__SCT_ClusterOnTrackTool @@ -76,39 +79,50 @@ if InDetTrigFlags.loadRotCreator(): CorrectionStrategy = 0, # do correct position bias ErrorStrategy = 2, # do use phi dependent errors LorentzAngleTool = ToolSvc.SCTLorentzAngleTool) + ToolSvc += SCT_ClusterOnTrackTool if (InDetTrigFlags.doPrintConfigurables()): print SCT_ClusterOnTrackTool + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + # tool to always make conservative pixel cluster errors from SiClusterOnTrackTool.SiClusterOnTrackToolConf import InDet__PixelClusterOnTrackTool from InDetTrigRecExample.InDetTrigConditionsAccess import PixelConditionsSetup - InDetTrigPixelClusterOnTrackTool = \ - InDet__PixelClusterOnTrackTool("InDetTrigPixelClusterOnTrackTool", + InDetTrigPixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("InDetTrigPixelClusterOnTrackTool", PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), - ErrorStrategy = 2) + ErrorStrategy = 2, +# LorentzAngleTool = PixelConditionsSetup.instanceName('PixelLorentzAngleTool')) + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool) + + print "STSTST InDetTrigConfigRecLoadTools 1" + ToolSvc += InDetTrigPixelClusterOnTrackTool + + print "STSTST InDetTrigConfigRecLoadTools 2" + if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigPixelClusterOnTrackTool # tool to always make conservative sct cluster errors from SiClusterOnTrackTool.SiClusterOnTrackToolConf import InDet__SCT_ClusterOnTrackTool - InDetTrigBroadSCT_ClusterOnTrackTool = \ - InDet__SCT_ClusterOnTrackTool ("InDetTrigBroadSCT_ClusterOnTrackTool", - CorrectionStrategy = 0, # do correct position bias - ErrorStrategy = 0, # do use broad errors - LorentzAngleTool = ToolSvc.SCTLorentzAngleTool) + InDetTrigBroadSCT_ClusterOnTrackTool = InDet__SCT_ClusterOnTrackTool ("InDetTrigBroadSCT_ClusterOnTrackTool", + CorrectionStrategy = 0, # do correct position bias + ErrorStrategy = 0, # do use broad errors + LorentzAngleTool = ToolSvc.SCTLorentzAngleTool) ToolSvc += InDetTrigBroadSCT_ClusterOnTrackTool if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigBroadSCT_ClusterOnTrackTool #-- from InDetTrigRecExample.InDetTrigConditionsAccess import PixelConditionsSetup - InDetTrigBroadPixelClusterOnTrackTool = \ - InDet__PixelClusterOnTrackTool("InDetTrigBroadPixelClusterOnTrackTool", - PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), - ErrorStrategy = 0) + InDetTrigBroadPixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("InDetTrigBroadPixelClusterOnTrackTool", + PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), + ErrorStrategy = 0, + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool) ToolSvc += InDetTrigBroadPixelClusterOnTrackTool if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigBroadPixelClusterOnTrackTool @@ -141,8 +155,6 @@ if InDetTrigFlags.loadRotCreator(): if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigBroadInDetRotCreator - - # load error scaling from IOVDbSvc.CondDB import conddb if not (conddb.folderRequested( "/Indet/TrkErrorScaling" ) or \ @@ -165,7 +177,7 @@ if InDetTrigFlags.loadRotCreator(): if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigTRT_RefitRotCreator - + from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackCreator InDetTrigRefitRotCreator = Trk__RIO_OnTrackCreator(name = 'InDetTrigRefitRotCreator', ToolPixelCluster= InDetTrigPixelClusterOnTrackTool, @@ -186,7 +198,6 @@ if InDetTrigFlags.loadRotCreator(): # # ----------- control loading of the kalman updator # - if InDetTrigFlags.loadUpdator(): if InDetTrigFlags.kalmanUpdator() is "fast" : @@ -256,7 +267,7 @@ if InDetTrigFlags.loadExtrapolator(): ToolSvc += InDetTrigNavigator if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigNavigator - + # # Setup the MaterialEffectsUpdator # @@ -267,7 +278,6 @@ if InDetTrigFlags.loadExtrapolator(): if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigMaterialUpdator - # # Set up extrapolator # @@ -302,7 +312,6 @@ if InDetTrigFlags.loadExtrapolator(): if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigExtrapolator - # # ----------- control loading of fitters # @@ -357,7 +366,7 @@ if InDetTrigFlags.loadFitter(): ToolSvc += InDetTrigDNASeparator if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigDNASeparator - + else: InDetTrigDNAdjustor = None InDetTrigDNASeparator = None @@ -463,7 +472,6 @@ if InDetTrigFlags.loadFitter(): InDetTrigTrackFitter.MaxOutliers = 99 #only switch off for cosmics InDetTrigTrackFitter.Acceleration = False - InDetTrigTrackFitterLowPt = Trk__GlobalChi2Fitter(name = 'InDetTrigTrackFitterLowPt', ExtrapolationTool = InDetTrigExtrapolator, NavigatorTool = InDetTrigNavigator, @@ -587,7 +595,6 @@ if InDetTrigFlags.loadFitter(): print InDetTrigTrackFitterTRT - if DetFlags.haveRIO.pixel_on(): from PixelConditionsTools.PixelConditionsToolsConf import PixelConditionsSummaryTool from InDetTrigRecExample.InDetTrigConditionsAccess import PixelConditionsSetup @@ -619,7 +626,6 @@ if InDetTrigFlags.loadAssoTool(): # if InDetTrigFlags.loadSummaryTool(): - # Load Pixel Layer tool from InDetTestPixelLayer.InDetTestPixelLayerConf import InDet__InDetTestPixelLayerTool InDetTrigTestPixelLayerTool = InDet__InDetTestPixelLayerTool(name = "InDetTrigTestPixelLayerTool", @@ -671,7 +677,6 @@ if InDetTrigFlags.loadSummaryTool(): # except: # log.info("InDetTrigPixelToTPIDTool requested but not available") - if (InDetTrigFlags.doPrintConfigurables()): print 'InDetTrigPixelToTPIDTool ', InDetTrigPixelToTPIDTool @@ -799,7 +804,6 @@ if InDetTrigFlags.loadSummaryTool(): # # ----------- control loading of tools which are needed by new tracking and backtracking # - if InDetTrigFlags.doNewTracking() or InDetTrigFlags.doBackTracking() or InDetTrigFlags.doTrtSegments(): # Igor's propagator and updator for the pattern # @@ -875,7 +879,6 @@ if InDetTrigFlags.doNewTracking(): ) ToolSvc += InDetTrigSiDetElementsRoadMaker - # Local combinatorial track finding using space point seed and detector element road # from SiCombinatorialTrackFinderTool_xk.SiCombinatorialTrackFinderTool_xkConf import InDet__SiCombinatorialTrackFinder_xk @@ -918,8 +921,6 @@ if InDetTrigFlags.doAmbiSolving(): if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigAmbiTrackSelectionTool - - if InDetTrigFlags.doNewTracking(): # diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py index db1de369d68f9c026aade29460698d06bdf3a83b..131f2defc88cf08a1e5ad3d55c7a32192fcb6abe 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py @@ -58,7 +58,7 @@ class PixelClustering_EF( InDet__Pixel_TrgClusterization ): from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigClusterMakerTool from InDetTrigRecExample.InDetTrigConditionsAccess import PixelConditionsSetup - + # MergedPixelTool (public) from SiClusterizationTool.SiClusterizationToolConf import InDet__MergedPixelsTool from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPixelConditionsSummaryTool diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h index dec8ebccb2cb279166b85e66ab57313f7de1c934..58361e910ce7fb38a941b276b7771bda2c532570 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h @@ -1,211 +1,179 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// Header file for class PixelClusterOnTrackTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Interface for PixelClusterOnTrack production -/////////////////////////////////////////////////////////////////// -// started 1/05/2004 I.Gavrilenko - see ChangeLog for details -/////////////////////////////////////////////////////////////////// -#ifndef PixelClusterOnTrackTool_H -#define PixelClusterOnTrackTool_H - -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" - - -#include "TrkToolInterfaces/IRIO_OnTrackCreator.h" -#include "TrkToolInterfaces/IRIO_OnTrackErrorScalingTool.h" -#include "InDetRIO_OnTrack/PixelClusterOnTrack.h" - -#include "InDetPrepRawData/PixelGangedClusterAmbiguities.h" -#include "TrkParameters/TrackParameters.h" -//#include "InDetIdentifier/PixelID.h" -#include "GeoPrimitives/GeoPrimitives.h" -#include "TrkAmbiguityProcessor/dRMap.h" - -//#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" -//#include "PixelConditionsTools/IModuleDistortionsTool.h" - -#include "AthenaPoolUtilities/CondAttrListCollection.h" -class PixelID; -class IPixelOfflineCalibSvc; -class IModuleDistortionsTool; - -class StoreGateSvc; -class IIBLParameterSvc; - -namespace InDet { - - /** @brief creates PixelClusterOnTrack objects allowing to - calibrate cluster position and error using a given track hypothesis. - - See doxygen of Trk::RIO_OnTrackCreator for details. - Different strategies to calibrate the cluster error can be chosen - by job Option. Also the handle to the general hit-error scaling - is implemented. - - Special strategies for correction can be invoked by calling the - correct method with an additional argument from the - PixelClusterStrategy enumeration - - */ - - class NnClusterizationFactory; - - enum PixelClusterStrategy { - PIXELCLUSTER_DEFAULT=0, - PIXELCLUSTER_OUTLIER=1, - PIXELCLUSTER_SHARED =2, - PIXELCLUSTER_SPLIT =3 - }; - - - class PixelClusterOnTrackTool: - public AthAlgTool, virtual public Trk::IRIO_OnTrackCreator -{ - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - -public: - - //! AlgTool constructor - PixelClusterOnTrackTool(const std::string&,const std::string&, - const IInterface*); - virtual ~PixelClusterOnTrackTool (); - //! AlgTool initialisation - virtual StatusCode initialize() override; - //! AlgTool termination - virtual StatusCode finalize () override; - - - - void correctBow(const Identifier&, Amg::Vector2D& locpos, const double tanphi, const double taneta) const; - - double splineIBLPullX(float x, int layer) const; - - /** @brief produces a PixelClusterOnTrack (object factory!). - - Depending on job options it changes the pixel cluster position - and error according to the parameters (in particular, the angle) - of the intersecting track. - */ - virtual const InDet::PixelClusterOnTrack* correct(const Trk::PrepRawData&, - const Trk::TrackParameters&) const override; - - virtual const InDet::PixelClusterOnTrack* correctDefault(const Trk::PrepRawData&, - const Trk::TrackParameters&) const; - - virtual const InDet::PixelClusterOnTrack* correctNN(const Trk::PrepRawData&, const Trk::TrackParameters&) const; - - virtual bool getErrorsDefaultAmbi( const InDet::PixelCluster*, const Trk::TrackParameters&, - Amg::Vector2D&, Amg::MatrixX&) const; - - virtual bool getErrorsTIDE_Ambi( const InDet::PixelCluster*, const Trk::TrackParameters&, - Amg::Vector2D&, Amg::MatrixX&) const; - - virtual const InDet::PixelClusterOnTrack* correct - (const Trk::PrepRawData&, const Trk::TrackParameters&, - const InDet::PixelClusterStrategy) const; - - - /////////////////////////////////////////////////////////////////// - // Private methods: - /////////////////////////////////////////////////////////////////// - - private: - - /** @brief parametrizes the pixel cluster position error as a function of - the track angle alpha and the cluster width (number of rows) deltax */ - // double getBarrelPhiError(double& alpha, int& deltax) const; - // double getBarrelEtaError(double eta, int deltax, int deltay) const; - // double getEndcapPhiError(int etasize, int phisize) const; - // double getEndcapEtaError(int etasize, int phisize) const; - - void FillFromDataBase() const; - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - - ToolHandle<IModuleDistortionsTool> m_pixDistoTool ; - ToolHandle<Trk::IRIO_OnTrackErrorScalingTool> m_errorScalingTool; - ServiceHandle<IPixelOfflineCalibSvc> m_calibSvc ; - StoreGateSvc* m_detStore ; - /* ME: Test histos have nothing to do with production code, use a flag - IHistogram1D* m_h_Resx; - IHistogram1D* m_h_Resy; - IHistogram1D* m_h_Locx; - IHistogram1D* m_h_Locy; - IHistogram1D* m_h_PhiTrack; - IHistogram1D* m_h_ThetaTrack; - IHistogram1D* m_h_Rad; - IHistogram1D* m_h_Slope; - */ - - //! toolhandle for central error scaling - //! flag storing if errors need scaling or should be kept nominal - bool m_scalePixelCov ; - bool m_disableDistortions; - bool m_rel13like ; - int m_positionStrategy ; - mutable int m_errorStrategy ; - - - /** @brief Flag controlling how module distortions are taken into account: - - case 0 -----> No distorsions implemented; - - case 1 -----> Set curvature (in 1/meter) and twist (in radiant) equal for all modules; - - case 2 -----> Read curvatures and twists from textfile containing Survey data; - - case 3 -----> Set curvature and twist from Gaussian random generator with mean and RMS coming from Survey data; - - case 4 -----> Read curvatures and twists from database (not ready yet); - */ - //! identifier-helper - const PixelID* m_pixelid; - - /** Enable NN based calibration (do only if NN calibration is applied) **/ - mutable bool m_applyNNcorrection; - mutable bool m_applydRcorrection; - bool m_NNIBLcorrection; - bool m_IBLAbsent; - - /** NN clusterizationi factory for NN based positions and errors **/ - ToolHandle<NnClusterizationFactory> m_NnClusterizationFactory; - ServiceHandle<StoreGateSvc> m_storeGate; //!< Event store - ServiceHandle<IIBLParameterSvc> m_IBLParameterSvc; - - - SG::ReadHandleKey<InDet::DRMap> m_dRMap; //!< the actual dR map - std::string m_dRMapName; - - bool m_doNotRecalibrateNN; - bool m_noNNandBroadErrors; - - /** Enable different treatment of cluster errors based on NN information (do only if TIDE ambi is run) **/ - bool m_usingTIDE_Ambi; - SG::ReadHandleKey<InDet::PixelGangedClusterAmbiguities> m_splitClusterHandle; - mutable std::vector< std::vector<float> > m_fX, m_fY, m_fB, m_fC, m_fD; - - //moved from static to member variable - static constexpr int s_nbinphi=9; - static constexpr int s_nbineta=6; - double m_calphi[s_nbinphi]; - double m_caleta[s_nbineta][3]; - double m_calerrphi[s_nbinphi][3]; - double m_calerreta[s_nbineta][3]; - double m_phix[s_nbinphi+1]; - double m_etax[s_nbineta+1]; -}; - -} // end of namespace InDet - -#endif // PixelClusterOnTrackTool_H +#ifndef PixelClusterOnTrackTool_H +#define PixelClusterOnTrackTool_H + +#include "GaudiKernel/ToolHandle.h" +#include "AthenaBaseComps/AthAlgTool.h" + +#include "TrkToolInterfaces/IRIO_OnTrackCreator.h" +#include "TrkToolInterfaces/IRIO_OnTrackErrorScalingTool.h" +#include "InDetRIO_OnTrack/PixelClusterOnTrack.h" + +#include "InDetPrepRawData/PixelGangedClusterAmbiguities.h" +#include "TrkParameters/TrackParameters.h" +#include "GeoPrimitives/GeoPrimitives.h" +#include "TrkAmbiguityProcessor/dRMap.h" + +#include "InDetCondServices/ISiLorentzAngleTool.h" + +#include "AthenaPoolUtilities/CondAttrListCollection.h" + +class PixelID; +class IPixelOfflineCalibSvc; +class IModuleDistortionsTool; + +class StoreGateSvc; +class IIBLParameterSvc; + +namespace InDet { + + /** @brief creates PixelClusterOnTrack objects allowing to + calibrate cluster position and error using a given track hypothesis. + + See doxygen of Trk::RIO_OnTrackCreator for details. + Different strategies to calibrate the cluster error can be chosen + by job Option. Also the handle to the general hit-error scaling + is implemented. + + Special strategies for correction can be invoked by calling the + correct method with an additional argument from the + PixelClusterStrategy enumeration + + */ + + class NnClusterizationFactory; + + enum PixelClusterStrategy { + PIXELCLUSTER_DEFAULT=0, + PIXELCLUSTER_OUTLIER=1, + PIXELCLUSTER_SHARED =2, + PIXELCLUSTER_SPLIT =3 + }; + + class PixelClusterOnTrackTool: + public AthAlgTool, virtual public Trk::IRIO_OnTrackCreator + { + /////////////////////////////////////////////////////////////////// + // Public methods: + /////////////////////////////////////////////////////////////////// + + public: + + //! AlgTool constructor + PixelClusterOnTrackTool(const std::string&,const std::string&, const IInterface*); + virtual ~PixelClusterOnTrackTool(); + //! AlgTool initialisation + virtual StatusCode initialize() override; + //! AlgTool termination + virtual StatusCode finalize() override; + + void correctBow(const Identifier&, Amg::Vector2D& locpos, const double tanphi, const double taneta) const; + + double splineIBLPullX(float x, int layer) const; + + /** @brief produces a PixelClusterOnTrack (object factory!). + + Depending on job options it changes the pixel cluster position + and error according to the parameters (in particular, the angle) + of the intersecting track. + */ + virtual const InDet::PixelClusterOnTrack* correct(const Trk::PrepRawData&, const Trk::TrackParameters&) const override; + virtual const InDet::PixelClusterOnTrack* correctDefault(const Trk::PrepRawData&, const Trk::TrackParameters&) const; + virtual const InDet::PixelClusterOnTrack* correctNN(const Trk::PrepRawData&, const Trk::TrackParameters&) const; + virtual bool getErrorsDefaultAmbi(const InDet::PixelCluster*, const Trk::TrackParameters&, Amg::Vector2D&, Amg::MatrixX&) const; + virtual bool getErrorsTIDE_Ambi(const InDet::PixelCluster*, const Trk::TrackParameters&, Amg::Vector2D&, Amg::MatrixX&) const; + virtual const InDet::PixelClusterOnTrack* correct(const Trk::PrepRawData&, const Trk::TrackParameters&, const InDet::PixelClusterStrategy) const; + + /////////////////////////////////////////////////////////////////// + // Private methods: + /////////////////////////////////////////////////////////////////// + + private: + + /** @brief parametrizes the pixel cluster position error as a function of + the track angle alpha and the cluster width (number of rows) deltax */ + // double getBarrelPhiError(double& alpha, int& deltax) const; + // double getBarrelEtaError(double eta, int deltax, int deltay) const; + // double getEndcapPhiError(int etasize, int phisize) const; + // double getEndcapEtaError(int etasize, int phisize) const; + + void FillFromDataBase() const; + + /////////////////////////////////////////////////////////////////// + // Private data: + /////////////////////////////////////////////////////////////////// + + ToolHandle<IModuleDistortionsTool> m_pixDistoTool ; + ToolHandle<Trk::IRIO_OnTrackErrorScalingTool> m_errorScalingTool; + ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{this, "LorentzAngleTool", "SiLorentzAngleTool", "Tool to retreive Lorentz angle"}; + ServiceHandle<IPixelOfflineCalibSvc> m_calibSvc ; + StoreGateSvc* m_detStore ; + /* ME: Test histos have nothing to do with production code, use a flag + IHistogram1D* m_h_Resx; + IHistogram1D* m_h_Resy; + IHistogram1D* m_h_Locx; + IHistogram1D* m_h_Locy; + IHistogram1D* m_h_PhiTrack; + IHistogram1D* m_h_ThetaTrack; + IHistogram1D* m_h_Rad; + IHistogram1D* m_h_Slope; + */ + + //! toolhandle for central error scaling + //! flag storing if errors need scaling or should be kept nominal + bool m_scalePixelCov ; + bool m_disableDistortions; + bool m_rel13like ; + int m_positionStrategy ; + mutable int m_errorStrategy ; + + /** @brief Flag controlling how module distortions are taken into account: + case 0 -----> No distorsions implemented; + case 1 -----> Set curvature (in 1/meter) and twist (in radiant) equal for all modules; + case 2 -----> Read curvatures and twists from textfile containing Survey data; + case 3 -----> Set curvature and twist from Gaussian random generator with mean and RMS coming from Survey data; + case 4 -----> Read curvatures and twists from database (not ready yet); + */ + //! identifier-helper + const PixelID* m_pixelid; + + /** Enable NN based calibration (do only if NN calibration is applied) **/ + mutable bool m_applyNNcorrection; + mutable bool m_applydRcorrection; + bool m_NNIBLcorrection; + bool m_IBLAbsent; + + /** NN clusterizationi factory for NN based positions and errors **/ + ToolHandle<NnClusterizationFactory> m_NnClusterizationFactory; + ServiceHandle<StoreGateSvc> m_storeGate; //!< Event store + ServiceHandle<IIBLParameterSvc> m_IBLParameterSvc; + + + SG::ReadHandleKey<InDet::DRMap> m_dRMap; //!< the actual dR map + std::string m_dRMapName; + + bool m_doNotRecalibrateNN; + bool m_noNNandBroadErrors; + + /** Enable different treatment of cluster errors based on NN information (do only if TIDE ambi is run) **/ + bool m_usingTIDE_Ambi; + SG::ReadHandleKey<InDet::PixelGangedClusterAmbiguities> m_splitClusterHandle; + mutable std::vector< std::vector<float> > m_fX, m_fY, m_fB, m_fC, m_fD; + + //moved from static to member variable + static constexpr int s_nbinphi=9; + static constexpr int s_nbineta=6; + double m_calphi[s_nbinphi]; + double m_caleta[s_nbineta][3]; + double m_calerrphi[s_nbinphi][3]; + double m_calerreta[s_nbineta][3]; + double m_phix[s_nbinphi+1]; + double m_etax[s_nbineta+1]; + }; + +} // end of namespace InDet + +#endif // PixelClusterOnTrackTool_H diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx index b9e289c724f648e69c011ff3f36f7dd6bc34c1a3..8f0b0368aead48162d369f47b4e89e2e0de19083 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////// @@ -202,6 +202,7 @@ InDet::PixelClusterOnTrackTool::initialize() { #include "IBL_calibration.h" /// + ATH_CHECK(m_lorentzAngleTool.retrieve()); return StatusCode::SUCCESS; } @@ -378,7 +379,7 @@ InDet::PixelClusterOnTrackTool::correctDefault double boweta = atan2(trketacomp, trknormcomp); float etatrack = trackPar.eta(); - float tanl = element->getTanLorentzAnglePhi(); + float tanl = m_lorentzAngleTool->getTanLorentzAngle(iH); int readoutside = element->design().readoutSide(); // map the angles of inward-going tracks onto [-PI/2, PI/2] diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h index 634a6584d86562bcff01e4320bbcd42bbaed8041..e0c8b46a4add02b59e4daddaccce1dea10aa7425 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -142,6 +142,7 @@ private: bool m_calibrateCharge; ServiceHandle<IPixelCalibSvc> m_calibSvc; ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; + ToolHandle<ISiLorentzAngleTool> m_pixelLorentzAngleTool{this, "PixelLorentzAngleTool", "PixelLorentzAngleTool", "Tool to retreive Lorentz angle of Pixel"}; ToolHandle<ISiLorentzAngleTool> m_sctLorentzAngleTool{this, "SCTLorentzAngleTool", "SCTLorentzAngleTool", "Tool to retreive Lorentz angle of SCT"}; // Parametrization of the Pixel errors diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx index f9ef7ce6e78598cb82cf805a51b44a648c170207..bc6d9bd1979f6cf39f91fe54d5024092ec70c9b3 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ //*************************************************************************** @@ -105,6 +105,7 @@ StatusCode ClusterMakerTool::initialize(){ } } + ATH_CHECK(m_pixelLorentzAngleTool.retrieve()); ATH_CHECK(m_sctLorentzAngleTool.retrieve()); return StatusCode::SUCCESS; @@ -193,8 +194,8 @@ PixelCluster* ClusterMakerTool::pixelCluster( } } // ask for Lorentz correction, get global position - - double shift = element->getLorentzCorrection(); + + double shift = m_pixelLorentzAngleTool->getLorentzShift(element->identifyHash()); const InDetDD::SiLocalPosition& localPosition = InDetDD::SiLocalPosition(localPos[Trk::locY], localPos[Trk::locX]+shift,0); @@ -388,7 +389,7 @@ PixelCluster* ClusterMakerTool::pixelCluster( if (msgLvl(MSG::VERBOSE)) msg() << "omega = " << omegax << " " << omegay << endmsg; // ask for Lorentz correction, get global position - double shift = element->getLorentzCorrection(); + double shift = m_pixelLorentzAngleTool->getLorentzShift(element->identifyHash()); const InDetDD::SiLocalPosition& localPosition = InDetDD::SiLocalPosition(localPos[Trk::locY], localPos[Trk::locX]+shift,0); diff --git a/Trigger/TrigTools/TrigInDetTrackFitter/python/TrigInDetTrackFitter_Config.py b/Trigger/TrigTools/TrigInDetTrackFitter/python/TrigInDetTrackFitter_Config.py index 72ab137e485b1149ceccb3a3486f66aab9c9a7fc..753797cf0e243e9ca943679265201bbce2e28c43 100644 --- a/Trigger/TrigTools/TrigInDetTrackFitter/python/TrigInDetTrackFitter_Config.py +++ b/Trigger/TrigTools/TrigInDetTrackFitter/python/TrigInDetTrackFitter_Config.py @@ -69,6 +69,10 @@ class ConfiguredTrigL2_InDetRotCreator(Trk__RIO_OnTrackCreator) : from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags # SiLorentzAngleTool + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + if not hasattr(ToolSvc, "SCTLorentzAngleTool"): from SiLorentzAngleSvc.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() @@ -80,13 +84,19 @@ class ConfiguredTrigL2_InDetRotCreator(Trk__RIO_OnTrackCreator) : LorentzAngleTool = ToolSvc.SCTLorentzAngleTool) myL2_PixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("TrigL2_PixelClusterOnTrackTool", PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), - ErrorStrategy = 0) + ErrorStrategy = 0, + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool) + else: myL2_SCT_ClusterOnTrackTool = InDet__SCT_ClusterOnTrackTool("TrigL2_SCT_ClusterOnTrackTool", CorrectionStrategy = 0, ErrorStrategy = 2, LorentzAngleTool = ToolSvc.SCTLorentzAngleTool) - myL2_PixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("TrigL2_PixelClusterOnTrackTool",PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'),ErrorStrategy = 1) + myL2_PixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("TrigL2_PixelClusterOnTrackTool", + PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), + ErrorStrategy = 1, + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool) + from AthenaCommon.AppMgr import ToolSvc ToolSvc += myL2_PixelClusterOnTrackTool diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/FastPixelClusterization.h b/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/FastPixelClusterization.h index 1452b965ee9e72def348b25193460800f7a904de..45cb01897fdd9e8f4b0d86875831d161dae25ba5 100755 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/FastPixelClusterization.h +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/FastPixelClusterization.h @@ -1,16 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELCLUSTERIZATION_H #define PIXELCLUSTERIZATION_H -//#include "InDetPrepRawDataByteStream/SiClusterization.h" #include "InDetIdentifier/PixelID.h" #include "TrkPrepRawData/PrepRawDataCLASS_DEF.h" #include "InDetRawData/PixelRDORawData.h" #include "InDetPrepRawData/PixelClusterCollection.h" #include "InDetReadoutGeometry/PixelDetectorManager.h" #include "Identifier/Identifier.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" #include <vector> #include <list> @@ -21,278 +21,280 @@ class Identifier; class FastPixelClusterization { + public: + std::vector<InDet::PixelClusterCollection*>& getClusterCollections(); + + // void prnt_ClusterCollections(); - public: - std::vector<InDet::PixelClusterCollection*>& getClusterCollections(); + void initialize() { + m_firstWord = true; + m_splittedCollection=false; + if ( !m_clusterCollections.empty() ) m_clusterCollections.clear(); + } - // void prnt_ClusterCollections(); - - void initialize() { - m_firstWord = true; - m_splittedCollection=false; - if ( !m_clusterCollections.empty() ) m_clusterCollections.clear(); - } + void initializeGeometry(const InDetDD::PixelDetectorManager* manager); + public: - void initializeGeometry(const InDetDD::PixelDetectorManager* manager); + void setLorentzAngleTool(const ISiLorentzAngleTool* lorentzAngleTool) { m_lorentzAngleTool = lorentzAngleTool; } -public: + class LocalCoordinate { + public: + LocalCoordinate(unsigned int phi, unsigned int rz) : + m_phi(phi), m_rz(rz) {} + unsigned int phi() {return m_phi;} + unsigned int rz() {return m_rz;} + private: + unsigned int m_phi; + unsigned int m_rz; + }; - class LocalCoordinate { - public: - LocalCoordinate(unsigned int phi, unsigned int rz) : - m_phi(phi), m_rz(rz) {} - unsigned int phi() {return m_phi;} - unsigned int rz() {return m_rz;} - private: - unsigned int m_phi; - unsigned int m_rz; - }; + FastPixelClusterization (); - FastPixelClusterization (); + void setPixelID(const PixelID* pixelID){ m_pixelID = pixelID; } - void setPixelID(const PixelID* pixelID){ m_pixelID = pixelID; } + void addHit( const Identifier waferId, const IdentifierHash hashElemId, + const unsigned int phi_channel, const unsigned int rz_channel, + const PixelRDORawData* pHit = 0); - void addHit( const Identifier waferId, const IdentifierHash hashElemId, - const unsigned int phi_channel, const unsigned int rz_channel, - const PixelRDORawData* pHit = 0); + void finishHits(); - void finishHits(); + private: + void initializeHitmap(); -private: - void initializeHitmap(); + void setPixelPara(const Identifier& waferId); - void setPixelPara(const Identifier& waferId); + void initializeClusterPara(); - void initializeClusterPara(); - - void clustering(); + void clustering(); - void findCluster(unsigned int phi, unsigned int rz); - - void formCluster1(unsigned int phi, unsigned int rz); + void findCluster(unsigned int phi, unsigned int rz); - void formCluster2(unsigned int phi, unsigned int rz); + void formCluster1(unsigned int phi, unsigned int rz); - void formCluster3(unsigned int phi, unsigned int rz); + void formCluster2(unsigned int phi, unsigned int rz); - void collectHit(unsigned int phi, unsigned int rz); + void formCluster3(unsigned int phi, unsigned int rz); - void addCluster(const Identifier& pixId, double centrePhi, double centreRZ, - double widthPhi, double widthRz, std::vector<Identifier>& rdoList, - unsigned rdoWidthPhi, unsigned rdoWidthRz); + void collectHit(unsigned int phi, unsigned int rz); - inline bool values_ok (unsigned int phi, unsigned int rz) { - if (phi >= m_nPhi ) { - std::cout << "Wrong : phi = " << phi << " > " << " m_nPhi = " << m_nPhi << std::endl; - return false; + void addCluster(const Identifier& pixId, double centrePhi, double centreRZ, + double widthPhi, double widthRz, std::vector<Identifier>& rdoList, + unsigned rdoWidthPhi, unsigned rdoWidthRz); + + inline bool values_ok (unsigned int phi, unsigned int rz) { + if (phi >= m_nPhi ) { + std::cout << "Wrong : phi = " << phi << " > " << " m_nPhi = " << m_nPhi << std::endl; + return false; + } + if (rz >= m_nRz) { + std::cout << "Wrong : rz = " << rz << " > " << " m_nRz = " << m_nRz << std::endl; + return false; + } + return true; + } + + void set_hit(unsigned int phi, unsigned int rz, int tot) { + assert (values_ok(phi, rz)); + int val=m_nPhi*rz + phi; + int idx=val/32; + int idx2 = val%32; + m_hitmap[idx] = m_hitmap[idx] | (1 << idx2); + m_totmap[idx][idx2] = tot; } - if (rz >= m_nRz) { - std::cout << "Wrong : rz = " << rz << " > " << " m_nRz = " << m_nRz << std::endl; - return false; + + + void clear_hit(unsigned int phi, unsigned int rz) { + assert (values_ok(phi, rz)); + int val=m_nPhi*rz + phi; + int idx=val/32; + m_hitmap[idx] = m_hitmap[idx] & ~(1 << val%32); } - return true; - } - - void set_hit(unsigned int phi, unsigned int rz, int tot) { - assert (values_ok(phi, rz)); - int val=m_nPhi*rz + phi; - int idx=val/32; - int idx2 = val%32; - m_hitmap[idx] = m_hitmap[idx] | (1 << idx2); - m_totmap[idx][idx2] = tot; - } - - - void clear_hit(unsigned int phi, unsigned int rz) { - assert (values_ok(phi, rz)); - int val=m_nPhi*rz + phi; - int idx=val/32; - m_hitmap[idx] = m_hitmap[idx] & ~(1 << val%32); - } - - - bool hit_found(unsigned int phi, unsigned int rz) { - if (phi >= m_nPhi || rz >= m_nRz) return false; - int val=m_nPhi*rz + phi; - int idx=val/32; - return m_hitmap[idx] & (1 << val%32); - } - - int get_tot(unsigned int phi, unsigned int rz) { - if (phi >= m_nPhi || rz >= m_nRz) return false; - int val=m_nPhi*rz + phi; - int idx=val/32; - int idx2=val%32; - return m_totmap[idx][idx2]; - } - - double get_coordPhi( int phi ) { - double coordPhi = (double(phi) + 0.5)*m_pixelPitch; - coordPhi -= m_waferHalfWidth; - return coordPhi; - } - - double get_coordRz( int rz ) { - std::set<int>::iterator iter; - double coordRz = 0.0; - for (int ix = 0; ix < rz; ix++) { - if (m_isBlayer) { - iter = m_set_longpixel_Blayer.find(ix); - if (iter == m_set_longpixel_Blayer.end()) { - coordRz = coordRz + m_length_normalpixel; - } else { - coordRz = coordRz + m_length_longpixel; - } - } else { - iter = m_set_longpixel_normal.find(ix); - if (iter == m_set_longpixel_normal.end()) { - coordRz = coordRz + m_length_normalpixel; - } else { - coordRz = coordRz + m_length_longpixel; - } - } + + + bool hit_found(unsigned int phi, unsigned int rz) { + if (phi >= m_nPhi || rz >= m_nRz) return false; + int val=m_nPhi*rz + phi; + int idx=val/32; + return m_hitmap[idx] & (1 << val%32); } - - if (m_isBlayer) { - iter = m_set_longpixel_Blayer.find(rz); - if (iter == m_set_longpixel_Blayer.end()) { - coordRz = coordRz + m_length_normalpixel*0.5; - } else { - coordRz = coordRz + m_length_longpixel*0.5; + + int get_tot(unsigned int phi, unsigned int rz) { + if (phi >= m_nPhi || rz >= m_nRz) return false; + int val=m_nPhi*rz + phi; + int idx=val/32; + int idx2=val%32; + return m_totmap[idx][idx2]; + } + + double get_coordPhi( int phi ) { + double coordPhi = (double(phi) + 0.5)*m_pixelPitch; + coordPhi -= m_waferHalfWidth; + return coordPhi; + } + + double get_coordRz( int rz ) { + std::set<int>::iterator iter; + double coordRz = 0.0; + for (int ix = 0; ix < rz; ix++) { + if (m_isBlayer) { + iter = m_set_longpixel_Blayer.find(ix); + if (iter == m_set_longpixel_Blayer.end()) { + coordRz = coordRz + m_length_normalpixel; + } else { + coordRz = coordRz + m_length_longpixel; + } + } else { + iter = m_set_longpixel_normal.find(ix); + if (iter == m_set_longpixel_normal.end()) { + coordRz = coordRz + m_length_normalpixel; + } else { + coordRz = coordRz + m_length_longpixel; + } + } } - } else { - iter = m_set_longpixel_normal.find(rz); - if (iter == m_set_longpixel_normal.end()) { - coordRz = coordRz + m_length_normalpixel*0.5; - } else { - coordRz = coordRz + m_length_longpixel*0.5; - } - } - - coordRz -= m_waferHalfLength; - return coordRz; - } - - double get_widthPhi(int phi_min, int phi_max) { - double widthPhi = (double(phi_max) - double(phi_min) + 1.0) - * m_pixelPitch; - return widthPhi; - } - - double get_widthRz(int rz_min, int rz_max) { - std::set<int>::iterator iter; - double widthRz = 0.0; - for (int ix = rz_min; ix <= rz_max; ix++) { + if (m_isBlayer) { - iter = m_set_longpixel_Blayer.find(ix); + iter = m_set_longpixel_Blayer.find(rz); if (iter == m_set_longpixel_Blayer.end()) { - widthRz = widthRz + m_length_normalpixel; + coordRz = coordRz + m_length_normalpixel*0.5; } else { - widthRz = widthRz + m_length_longpixel; + coordRz = coordRz + m_length_longpixel*0.5; } } else { - iter = m_set_longpixel_normal.find(ix); + iter = m_set_longpixel_normal.find(rz); if (iter == m_set_longpixel_normal.end()) { - widthRz = widthRz + m_length_normalpixel; + coordRz = coordRz + m_length_normalpixel*0.5; } else { - widthRz = widthRz + m_length_longpixel; - } - } + coordRz = coordRz + m_length_longpixel*0.5; + } + } + + coordRz -= m_waferHalfLength; + return coordRz; + } + + double get_widthPhi(int phi_min, int phi_max) { + double widthPhi = (double(phi_max) - double(phi_min) + 1.0) + * m_pixelPitch; + return widthPhi; } - - return widthRz; - } - void filling_withHit(const unsigned int phi_channel, const unsigned int rz_channel, int tot) { - set_hit(phi_channel, rz_channel, tot); - LocalCoordinate lc(phi_channel, rz_channel); - m_pixelHitList.push_back(lc); + double get_widthRz(int rz_min, int rz_max) { + std::set<int>::iterator iter; + double widthRz = 0.0; + for (int ix = rz_min; ix <= rz_max; ix++) { + if (m_isBlayer) { + iter = m_set_longpixel_Blayer.find(ix); + if (iter == m_set_longpixel_Blayer.end()) { + widthRz = widthRz + m_length_normalpixel; + } else { + widthRz = widthRz + m_length_longpixel; + } + } else { + iter = m_set_longpixel_normal.find(ix); + if (iter == m_set_longpixel_normal.end()) { + widthRz = widthRz + m_length_normalpixel; + } else { + widthRz = widthRz + m_length_longpixel; + } + } + } + + return widthRz; + } + + void filling_withHit(const unsigned int phi_channel, const unsigned int rz_channel, int tot) { + set_hit(phi_channel, rz_channel, tot); + LocalCoordinate lc(phi_channel, rz_channel); + m_pixelHitList.push_back(lc); + + std::map<unsigned int, unsigned int>::iterator iter = m_map_gangedPixels.find(phi_channel); + if ( iter != m_map_gangedPixels.end() ) { + unsigned int phi_channel_gangedPixel = (*iter).second; + set_hit(phi_channel_gangedPixel, rz_channel, tot); + LocalCoordinate lc(phi_channel_gangedPixel, rz_channel); + m_pixelHitList.push_back(lc); + } + } + + private: + + InDetDD::PixelDetectorManager* m_man; + InDetDD::SiDetectorElement* m_detEl; + + const ISiLorentzAngleTool* m_lorentzAngleTool; + + bool m_firstWord; + bool m_splittedCollection; + + Identifier m_element; + + InDet::PixelCluster* m_currentCluster; - std::map<unsigned int, unsigned int>::iterator iter = m_map_gangedPixels.find(phi_channel); - if ( iter != m_map_gangedPixels.end() ) { - unsigned int phi_channel_gangedPixel = (*iter).second; - set_hit(phi_channel_gangedPixel, rz_channel, tot); - LocalCoordinate lc(phi_channel_gangedPixel, rz_channel); - m_pixelHitList.push_back(lc); - } - } + InDet::PixelClusterCollection* m_currentClusterColl; -private: + std::vector<InDet::PixelClusterCollection *> m_clusterCollections; - InDetDD::PixelDetectorManager* m_man; - InDetDD::SiDetectorElement* m_detEl; + //unsigned int m_last_phi; - bool m_firstWord; - bool m_splittedCollection; + //unsigned int m_last_rz; - Identifier m_element; - - InDet::PixelCluster* m_currentCluster; + std::list<LocalCoordinate> m_pixelHitList; - InDet::PixelClusterCollection* m_currentClusterColl; + double m_sum_rz; - std::vector<InDet::PixelClusterCollection *> m_clusterCollections; + double m_sum_phi; - //unsigned int m_last_phi; + unsigned int m_phi_min; - //unsigned int m_last_rz; + unsigned int m_phi_max; - std::list<LocalCoordinate> m_pixelHitList; - - double m_sum_rz; + unsigned int m_rz_min; - double m_sum_phi; + unsigned int m_rz_max; - unsigned int m_phi_min; + unsigned int m_entries; - unsigned int m_phi_max; - - unsigned int m_rz_min; + static const int m_hitmapSize = 2000; - unsigned int m_rz_max; - - unsigned int m_entries; + int m_hitmap[m_hitmapSize]; + int m_totmap[m_hitmapSize][32]; - static const int m_hitmapSize = 2000; + bool m_isBlayer; - int m_hitmap[m_hitmapSize]; - int m_totmap[m_hitmapSize][32]; - - bool m_isBlayer; + std::set<int> m_set_longpixel_normal; - std::set<int> m_set_longpixel_normal; + std::set<int> m_set_longpixel_Blayer; - std::set<int> m_set_longpixel_Blayer; + std::map<unsigned int, unsigned int> m_map_gangedPixels; - std::map<unsigned int, unsigned int> m_map_gangedPixels; + double m_waferHalfLength; + double m_waferHalfWidth; - double m_waferHalfLength; - double m_waferHalfWidth; + unsigned int m_nPhi; + unsigned int m_nRz; - unsigned int m_nPhi; - unsigned int m_nRz; + unsigned int m_nPhi_Cache[10]; + unsigned int m_nRz_Cache[10]; - unsigned int m_nPhi_Cache[10]; - unsigned int m_nRz_Cache[10]; + double m_length_B_longpixel; + double m_length_B_normalpixel; - double m_length_B_longpixel; - double m_length_B_normalpixel; + double m_length_nonB_longpixel; + double m_length_nonB_normalpixel; - double m_length_nonB_longpixel; - double m_length_nonB_normalpixel; + double m_length_longpixel; + double m_length_normalpixel; - double m_length_longpixel; - double m_length_normalpixel; - - double m_pixelPitch; - double m_B_etaPitch; - double m_nonB_etaPitch; + double m_pixelPitch; + double m_B_etaPitch; + double m_nonB_etaPitch; - const PixelID* m_pixelID; - std::vector<Identifier>* m_pixelList; - std::vector<int> m_totList; + const PixelID* m_pixelID; + std::vector<Identifier>* m_pixelList; + std::vector<int> m_totList; }; #endif diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/PixelClusterCacheTool.h b/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/PixelClusterCacheTool.h index a4f6d66fa36a87cbb1c3f66b23bb956ca50fc3ce..577cee585408bab24887dcee85bf1d1073680a00 100755 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/PixelClusterCacheTool.h +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/PixelClusterCacheTool.h @@ -18,6 +18,7 @@ #include "PixelConditionsServices/IPixelByteStreamErrorsSvc.h" #include "SiClusterizationTool/IPixelClusteringTool.h" #include "GaudiKernel/ToolHandle.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" #include <vector> #include <string> @@ -57,6 +58,7 @@ private: std::string m_rdoContainerName; ServiceHandle<IPixelByteStreamErrorsSvc> m_bsErrorSvc; ToolHandle<InDet::IPixelClusteringTool> m_clusteringTool; + ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{this, "LorentzAngleTool", "PixelLorentzAngleTool", "Tool to retreive Lorentz angle"}; bool m_doBS; }; diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py index 29f8e903f5e23fd1dbd9812fa5c8c3b3042e6666..743d9695c25660a2edc22f06350409cd20ca7477 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py @@ -23,7 +23,11 @@ class ConfiguredOnlineSpacePointProviderTool(OnlineSpacePointProviderTool) : from InDetTrigRecExample.InDetTrigConditionsAccess import PixelConditionsSetup from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags - # --- SiLorentzAngleTool for SCT + # --- SiLorentzAngleTool + if not hasattr(ToolSvc, "PixelLorentzAngleTool"): + from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + if not hasattr(ToolSvc, "SCTLorentzAngleTool"): from SiLorentzAngleSvc.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() @@ -31,6 +35,7 @@ class ConfiguredOnlineSpacePointProviderTool(OnlineSpacePointProviderTool) : InDetL2TrigClusterMakerTool = InDet__ClusterMakerTool( name = "InDetL2TrigClusterMakerTool", UsePixelCalibCondDB = False, PixelOfflineCalibSvc = PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), + PixelLorentzAngleTool = ToolSvc.PixelLorentzAngleTool, SCTLorentzAngleTool = ToolSvc.SCTLorentzAngleTool ) @@ -67,7 +72,8 @@ class ConfiguredOnlineSpacePointProviderTool(OnlineSpacePointProviderTool) : ToolSvc += FastSCT_RodDecoder(name = "FastSCT_RodDecoder", LorentzAngleTool=ToolSvc.SCTLorentzAngleTool) - ConfiguredPixelClusterCacheTool = PixelClusterCacheTool(PixelClusteringTool=InDetL2TrigMergedPixelsTool) + ConfiguredPixelClusterCacheTool = PixelClusterCacheTool(PixelClusteringTool=InDetL2TrigMergedPixelsTool, + LorentzAngleTool = ToolSvc.PixelLorentzAngleTool) ConfiguredSCT_ClusterCacheTool = SCT_ClusterCacheTool(SCT_ClusteringTool = InDetL2TrigSCT_ClusteringTool, FastSCT_RodDecoder = ToolSvc.FastSCT_RodDecoder ) diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/FastPixelClusterization.cxx b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/FastPixelClusterization.cxx index 113be2cfdd3483aa92b2896b2ae73b3a94c3a3b5..94bd1462da880f04182fe9233fc91ca3cea46876 100755 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/FastPixelClusterization.cxx +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/FastPixelClusterization.cxx @@ -438,7 +438,9 @@ void FastPixelClusterization::addCluster(const Identifier& pixId, Amg::Vector2D w1(widthPhi, widthRz); Amg::Vector2D dummy(rdoWidthPhi, rdoWidthRz); - double shift = m_detEl->getLorentzCorrection(); +// STSTST IdentifierHash hashId = m_pixelID->wafer_hash(pixId); + double shift = m_lorentzAngleTool->getLorentzShift(m_pixelID->wafer_hash(pixId)); + std::cout << "STSTST FastPixelClusterization " << shift << " " << m_pixelID->wafer_hash(pixId) << std::endl; Amg::Vector2D localpos(centrePhi+shift, centreRz); InDet::SiWidth siwidth(dummy, w1); Amg::MatrixX* locErrMat = nullptr; //No error matrix diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/PixelClusterCacheTool.cxx b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/PixelClusterCacheTool.cxx index de498f917d7d59b556b2ff06f473e4af3f333f73..a1005419e597f9c38a1d302601db5f6f854de46f 100755 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/PixelClusterCacheTool.cxx +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/PixelClusterCacheTool.cxx @@ -74,6 +74,7 @@ StatusCode PixelClusterCacheTool::initialize() { m_clusterization.setPixelID(m_pixel_id); m_clusterization.initializeGeometry(mgr); + m_clusterization.setLorentzAngleTool(m_lorentzAngleTool.get()); m_cntx_pix = m_pixel_id->wafer_context(); IToolSvc* toolSvc;