diff --git a/Trigger/TrigT1/TrigT1NSW/share/NSWL1.py b/Trigger/TrigT1/TrigT1NSW/share/NSWL1.py index 2e89fd9cf379a7f740f7454274bce8f4cc2418ed..b0ab258ac1905b331b9e496018776f20e5831ff6 100755 --- a/Trigger/TrigT1/TrigT1NSW/share/NSWL1.py +++ b/Trigger/TrigT1/TrigT1NSW/share/NSWL1.py @@ -1,108 +1,46 @@ -# This is the configuration file to run ATLAS Digitization -# Use the following switches for: -# athenaCommonFlags.EvtMax = <NEvents> Number of events to digitize (set to -1 for all) -# athenaCommonFlags.SkipEvents = <NSkip> Number of events from input file collection to skip -# athenaCommonFlags.PoolHitsInput=<FileName> Input collections. The list of files with the hits to digitize -# athenaCommonFlags.PoolRDOOutput=<FileName> Output file name - -#-------------------------------------------------------------- -# AthenaCommon configuration -#-------------------------------------------------------------- - - -import glob -import os -#to run on mutliple files at once please use -c "customInput='/some/path/*pattern*.root'" -#otherwise it looks for input.rdo.pool.root -if 'customInput' not in locals() or 'customInput' not in globals(): - print("customInput not defined yet setting the default as input.rdo.pool.root") - customInput='input.rdo.pool.root' - -if(not os.path.isdir(customInput) and not os.path.isfile(customInput) ): - checklist=glob.glob(customInput) - if len(checklist)==0: - print("Invalid INPUT : "+customInput) - os.sys.exit() -if(os.path.isdir(customInput)): - customInput+="/*.root" +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +####################################### +# some basic settings +####################################### MessageSvc.defaultLimit=100 MessageSvc.useColors = True MessageSvc.Format = "% F%30W%S%7W%R%T %0W%M" - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.AllowIgnoreConfigError=False #This job will stop if an include fails. -from AthenaCommon.GlobalFlags import globalflags -globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-RUN12-SDR-25") -globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R3-2021-00-00-00") - -from RecExConfig.RecFlags import rec as recFlags -recFlags.doNameAuditor = True - -globalflags.InputFormat.set_Value_and_Lock('pool') - athenaCommonFlags.EvtMax = -1 athenaCommonFlags.SkipEvents = 0 -import AthenaPoolCnvSvc.ReadAthenaPool - - -svcMgr.EventSelector.InputCollections=glob.glob(customInput) - - -#svcMgr.EventSelector.InputCollections = [ "input.rdo.pool.root" ] +from AthenaCommon.AppMgr import ServiceMgr as svcMgr +import AthenaPoolCnvSvc.ReadAthenaPool # needed to use EventSelector +svcMgr.EventSelector.InputCollections=["input.rdo.pool.root"] +####################################### -from AthenaCommon.DetFlags import DetFlags -#with tgc setOn we get sagfault and crash -#DetFlags.ID_setOff() -#DetFlags.Calo_setOff() -#DetFlags.Muon_setOff() -#DetFlags.MDT_setOff() -#DetFlags.CSC_setOff() -#DetFlags.TGC_setOff() -#DetFlags.RPC_setOff() -DetFlags.sTGC_setOn() -DetFlags.Micromegas_setOff() - -#DetFlags.digitize.MDT_setOff() -#DetFlags.digitize.TGC_setOff() -#DetFlags.digitize.RPC_setOff() -#DetFlags.digitize.CSC_setOff() -#DetFlags.digitize.Micromegas_setOff() -DetFlags.digitize.sTGC_setOn() -#DetFlags.Truth_setOff() - -# initialize GeoModel with layout set in globalflags.DetDescrVersion +####################################### +# initialize the geometry +####################################### +from AthenaCommon.GlobalFlags import jobproperties +jobproperties.Global.DetDescrVersion="ATLAS-R3S-2021-01-00-00" from AtlasGeoModel import SetGeometryVersion from AtlasGeoModel import GeoModelInit - from GeoModelSvc.GeoModelSvcConf import GeoModelSvc GeoModelSvc = GeoModelSvc() -GeoModelSvc.MuonVersionOverride = "MuonSpectrometer-R.09.00.NSW" +from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags +# initialize the MuonIdHelperService +from MuonIdHelpers.MuonIdHelpersConf import Muon__MuonIdHelperSvc +svcMgr += Muon__MuonIdHelperSvc("MuonIdHelperSvc",HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=MuonGeometryFlags.hasSTGC(), HasMM=MuonGeometryFlags.hasMM()) +# create the MuonDetectorTool (which creates the MuonDetectorManager needed by PadTdsOfflineTool) from MuonGeoModel.MuonGeoModelConf import MuonDetectorTool -DetDescrCnvSvc = Service( "DetDescrCnvSvc" ) - - -# get AGDD service -from AGDD2GeoSvc.AGDD2GeoSvcConf import AGDDtoGeoSvc -Agdd2GeoSvc = AGDDtoGeoSvc() -from AthenaCommon import CfgGetter - -# get AGDD tool for inert material -ToolSvc += CfgGetter.getPublicTool("MuonSpectrometer", checkType=True) -Agdd2GeoSvc.Builders += ["MuonAGDDTool/MuonSpectrometer"] - -#get AGDD tool for NSW geometry -ToolSvc += CfgGetter.getPublicTool("NewSmallWheel", checkType=True) -Agdd2GeoSvc.Builders += ["NSWAGDDTool/NewSmallWheel"] +GeoModelSvc.DetectorTools += [ MuonDetectorTool(HasCSC=MuonGeometryFlags.hasCSC(), HasSTgc=MuonGeometryFlags.hasSTGC(), HasMM=MuonGeometryFlags.hasMM()) ] +####################################### -theApp.CreateSvc += ["AGDDtoGeoSvc"] -ServiceMgr += Agdd2GeoSvc +####################################### +# now the trigger related things +####################################### include('RegionSelector/RegionSelector_jobOptions.py') -include ('TrigT1NSW/TrigT1NSW_jobOptions.py') +include('TrigT1NSW/TrigT1NSW_jobOptions.py') #Switch on and off trigger simulaton components sTGC / MicroMegas #October 2019 : MM not working so keep it False until fixed diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/PadTdsOfflineTool.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/PadTdsOfflineTool.h index 63bac09e487c0205eb4fd0f8d981933114f773dc..bb0b6bc1c7dc13bb0ed936608e560521aecfc5ab 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/PadTdsOfflineTool.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/PadTdsOfflineTool.h @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// -*-c++-*- #ifndef PADTDSOFFLINETOOL_H #define PADTDSOFFLINETOOL_H @@ -14,11 +13,10 @@ #include "TrigT1NSWSimTools/IPadTdsTool.h" #include "PadTdsValidationTree.h" - +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class IIncidentSvc; class IAtRndmGenSvc; -class sTgcIdHelper; class sTgcDigit; class TTree; class MuonSimDataCollection; @@ -137,9 +135,9 @@ namespace NSWL1 { // needed Servives, Tools and Helpers ServiceHandle< IIncidentSvc > m_incidentSvc; //!< Athena/Gaudi incident Service ServiceHandle< IAtRndmGenSvc > m_rndmSvc; //!< Athena random number service + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; CLHEP::HepRandomEngine* m_rndmEngine; //!< Random number engine const MuonGM::MuonDetectorManager* m_detManager; //!< MuonDetectorManager - const sTgcIdHelper* m_sTgcIdHelper; //!< sTgc offline Id helper // hidden variables std::vector< std::vector<std::shared_ptr<PadData>> > m_pad_cache; //!< cache for the PAD hit data in the event (one per sector) diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTdsOfflineTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTdsOfflineTool.cxx index c1740519b3c153f02a7b5745c24ced3ce34d3ec4..b4c7177b8cbfd9560a8fea19e95c3f05ae0cd462 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTdsOfflineTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTdsOfflineTool.cxx @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// Athena/Gaudi includes #include "GaudiKernel/ITHistSvc.h" #include "GaudiKernel/IIncidentSvc.h" #include "AGDDKernel/AGDDDetector.h" @@ -16,7 +15,6 @@ #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/sTgcReadoutElement.h" -#include "MuonIdHelpers/sTgcIdHelper.h" #include "MuonDigitContainer/sTgcDigitContainer.h" #include "MuonDigitContainer/sTgcDigit.h" #include "MuonSimData/MuonSimDataCollection.h" @@ -63,7 +61,6 @@ namespace NSWL1 { m_rndmSvc("AtRndmGenSvc",name), m_rndmEngine(0), m_detManager(0), - m_sTgcIdHelper(0), m_pad_cache_runNumber(-1), m_pad_cache_eventNumber(-1), m_pad_cache_status(CLEARED), @@ -143,10 +140,8 @@ namespace NSWL1 { return StatusCode::FAILURE; } - // retrieve the MuonDetectormanager - ATH_CHECK( detStore()->retrieve( m_detManager) ); - // retrieve the sTGC offline Id helper - ATH_CHECK( detStore()->retrieve( m_sTgcIdHelper )); + ATH_CHECK(detStore()->retrieve(m_detManager)); + ATH_CHECK(m_idHelperSvc.retrieve()); bool testGeometryAccess=false; // for now this is just an example DG-2014-07-11 if(testGeometryAccess) printStgcGeometryFromAgdd(); @@ -392,16 +387,15 @@ namespace NSWL1 { //------------------------------------------------------------------------------ bool PadTdsOfflineTool::is_pad_digit(const sTgcDigit* digit) const { - return (digit && - m_sTgcIdHelper->channelType(digit->identify())==0); + return (digit && m_idHelperSvc->stgcIdHelper().channelType(digit->identify())==0); } //------------------------------------------------------------------------------ int PadTdsOfflineTool::cache_index(const sTgcDigit* digit) const { Identifier Id = digit->identify(); - int stationEta = m_sTgcIdHelper->stationEta(Id); - int stationPhi = m_sTgcIdHelper->stationPhi(Id); - std::string stName = m_sTgcIdHelper->stationNameString(m_sTgcIdHelper->stationName(Id)); + int stationEta = m_idHelperSvc->stgcIdHelper().stationEta(Id); + int stationPhi = m_idHelperSvc->stgcIdHelper().stationPhi(Id); + std::string stName = m_idHelperSvc->stgcIdHelper().stationNameString(m_idHelperSvc->stgcIdHelper().stationName(Id)); int isSmall = stName[2] == 'S'; int trigger_sector = (isSmall)? stationPhi*2-1 : stationPhi*2-2; return (stationEta>0)? trigger_sector + 16 : trigger_sector; @@ -530,15 +524,15 @@ namespace NSWL1 { { if(!is_pad_digit(digit)) return; Identifier Id = digit->identify(); - std::string stName = m_sTgcIdHelper->stationNameString(m_sTgcIdHelper->stationName(Id)); - int stationEta = m_sTgcIdHelper->stationEta(Id); - int stationPhi = m_sTgcIdHelper->stationPhi(Id); - int multiplet = m_sTgcIdHelper->multilayer(Id); - int gas_gap = m_sTgcIdHelper->gasGap(Id); - int channel_type = m_sTgcIdHelper->channelType(Id); - int channel = m_sTgcIdHelper->channel(Id); - int pad_eta = m_sTgcIdHelper->padEta(Id); - int pad_phi = m_sTgcIdHelper->padPhi(Id); + std::string stName = m_idHelperSvc->stgcIdHelper().stationNameString(m_idHelperSvc->stgcIdHelper().stationName(Id)); + int stationEta = m_idHelperSvc->stgcIdHelper().stationEta(Id); + int stationPhi = m_idHelperSvc->stgcIdHelper().stationPhi(Id); + int multiplet = m_idHelperSvc->stgcIdHelper().multilayer(Id); + int gas_gap = m_idHelperSvc->stgcIdHelper().gasGap(Id); + int channel_type = m_idHelperSvc->stgcIdHelper().channelType(Id); + int channel = m_idHelperSvc->stgcIdHelper().channel(Id); + int pad_eta = m_idHelperSvc->stgcIdHelper().padEta(Id); + int pad_phi = m_idHelperSvc->stgcIdHelper().padPhi(Id); ATH_MSG_DEBUG("sTGC Pad hit:" <<" cache index ["<<cache_index(digit)<<"]"