From bc50d408fec589454e0f4e8a692980c592012931 Mon Sep 17 00:00:00 2001 From: Dave Casper <dcasper@uci.edu> Date: Sun, 26 Jan 2020 00:56:41 +0000 Subject: [PATCH] Realistic alignment database for Tracker --- Control/CalypsoCommon/python/GlobalFlags.py | 2 +- .../GeoModelTest/CMakeLists.txt | 2 + Control/CalypsoExample/GeoModelTest/README.md | 19 + .../GeoModelTest/python/GeoModelTestConfig.py | 48 +- .../GeoModelTest/scripts/CopyAlignFolder.sh | 5 + .../GeoModelTest/src/GeoModelTestAlg.cxx | 6 + .../GeoModelTest/src/GeoModelTestAlg.h | 3 + .../FaserGeoModel/python/DipoleGMConfig.py | 2 +- .../python/FaserGeoModelConfig.py | 9 + .../FaserGeoModel/python/SCTGMConfig.py | 2 +- .../FaserGeoModel/python/ScintGMConfig.py | 2 +- .../test/FaserGeometryConfig_EVNT_test.py | 2 +- .../python/MagFieldServicesConfig.py | 8 +- .../VetoGeoModel/test/VetoGMConfig_test.py | 2 +- Simulation/G4Faser/G4FaserApp/test/runG4.py | 3 +- .../TrackerAlignGenTools/CMakeLists.txt | 60 ++ .../ITrackerAlignDBTool.h | 70 ++ .../src/TrackerAlignDBTool.cxx | 916 ++++++++++++++++++ .../src/TrackerAlignDBTool.h | 193 ++++ .../TrackerAlignGenTools_entries.cxx | 19 + .../data/SCT_Conditions.py | 155 ++- .../test/DipoleGMConfig_test.py | 2 +- .../src/SCT_DetectorFactory.cxx | 12 +- .../FaserSCT_GeoModel/src/SCT_Plane.cxx | 6 +- .../test/FaserSCT_GMConfig_test.py | 2 +- .../src/SCT_DetectorManager.cxx | 16 +- .../src/TrackerDetectorManager.cxx | 13 +- .../FaserSCT_Digitization/CMakeLists.txt | 1 + .../FaserSCT_Digitization/README.md | 27 + .../test/FaserSCT_DigitizationDbg.py | 8 +- .../test/SCT_DigitizationConfigNew_test.py | 2 +- graphics/VTI12/VTI12Algs/share/vti12.py | 4 +- 32 files changed, 1488 insertions(+), 133 deletions(-) create mode 100644 Control/CalypsoExample/GeoModelTest/README.md create mode 100644 Control/CalypsoExample/GeoModelTest/scripts/CopyAlignFolder.sh create mode 100644 Tracker/TrackerAlignTools/TrackerAlignGenTools/CMakeLists.txt create mode 100644 Tracker/TrackerAlignTools/TrackerAlignGenTools/TrackerAlignGenTools/ITrackerAlignDBTool.h create mode 100644 Tracker/TrackerAlignTools/TrackerAlignGenTools/src/TrackerAlignDBTool.cxx create mode 100644 Tracker/TrackerAlignTools/TrackerAlignGenTools/src/TrackerAlignDBTool.h create mode 100644 Tracker/TrackerAlignTools/TrackerAlignGenTools/src/components/TrackerAlignGenTools_entries.cxx create mode 100644 Tracker/TrackerDigitization/FaserSCT_Digitization/README.md diff --git a/Control/CalypsoCommon/python/GlobalFlags.py b/Control/CalypsoCommon/python/GlobalFlags.py index b5905af7..4ac04ed3 100644 --- a/Control/CalypsoCommon/python/GlobalFlags.py +++ b/Control/CalypsoCommon/python/GlobalFlags.py @@ -67,7 +67,7 @@ class ConditionsTag(JobProperty): """ statusOn=True allowedTypes=['str'] - StoredValue='OFLCOND-RUN12-SDR-31' + StoredValue='OFLCOND-XXXX-XXX-XX' # class DatabaseInstance(JobProperty): diff --git a/Control/CalypsoExample/GeoModelTest/CMakeLists.txt b/Control/CalypsoExample/GeoModelTest/CMakeLists.txt index 1c5a6a25..1bed9607 100644 --- a/Control/CalypsoExample/GeoModelTest/CMakeLists.txt +++ b/Control/CalypsoExample/GeoModelTest/CMakeLists.txt @@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PRIVATE Scintillator/ScintDetDescr/ScintReadoutGeometry Tracker/TrackerDetDescr/TrackerReadoutGeometry MagneticField/MagFieldInterfaces + Tracker/TrackerAlignTools/TrackerAlignGenTools ) # External dependencies: @@ -34,3 +35,4 @@ atlas_add_test( GeoModelCheck #atlas_install_headers( GeoModelTest ) #atlas_install_joboptions( share/*.py ) atlas_install_python_modules( python/*.py ) +atlas_install_scripts( scripts/*.sh ) diff --git a/Control/CalypsoExample/GeoModelTest/README.md b/Control/CalypsoExample/GeoModelTest/README.md new file mode 100644 index 00000000..b05f0c34 --- /dev/null +++ b/Control/CalypsoExample/GeoModelTest/README.md @@ -0,0 +1,19 @@ +This example package actually serves several purposes: + +*) It illustrates how to initialize and access the detector description and magnetic field. +*) It checks that the expected number of detector elements are created. +*) It generates a set of neutral alignment constants for the Tracker, which can be folded into the conditions database. +*) It dumps a standalone GeoModel sqlite geometry database which could be used by external programs to display FASER without requiring any FASER software (only GeoModel) + +To run the algorithm, in a run directory where Calypso has been installed, do + +run > ./setup.sh +run > python python/GeoModelTest/GeoModelTestConfig.py + +The file GeoModelTestConfig.py can be edited to change some run options. + +After running the algorithm, to add the alignment data into your local conditions DB, do: + +run > CopyAlignFolder.sh + + diff --git a/Control/CalypsoExample/GeoModelTest/python/GeoModelTestConfig.py b/Control/CalypsoExample/GeoModelTest/python/GeoModelTestConfig.py index cf1c0cb2..15e048a5 100644 --- a/Control/CalypsoExample/GeoModelTest/python/GeoModelTestConfig.py +++ b/Control/CalypsoExample/GeoModelTest/python/GeoModelTestConfig.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -def GeoModelTestCfg(flags): +def GeoModelTestCfg(flags, name="GeoModelTestAlg", **kwargs): from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg a = FaserGeometryCfg(flags) @@ -11,46 +11,52 @@ def GeoModelTestCfg(flags): fieldSvc = a.getService("FaserFieldSvc") from GeoModelTest.GeoModelTestConf import GeoModelTestAlg - a.addEventAlgo(GeoModelTestAlg()) - a.getEventAlgo("GeoModelTestAlg").FieldService = fieldSvc + a.addEventAlgo(GeoModelTestAlg(name, **kwargs)) + a.getEventAlgo(name).FieldService = fieldSvc return a if __name__ == "__main__": # from AthenaCommon.Logging import log, logging - #from AthenaCommon.Constants import VERBOSE, INFO - # log.setLevel(VERBOSE) - + from AthenaCommon.Constants import VERBOSE, INFO from AthenaCommon.Configurable import Configurable - Configurable.configurableRun3Behavior = True -# Flag definition + from AthenaConfiguration.ComponentFactory import CompFactory from CalypsoConfiguration.AllConfigFlags import ConfigFlags -# Flag specification - ConfigFlags.Input.isMC = True - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-14" # Always needed, does nothing - ConfigFlags.GeoModel.FaserVersion = "FASER-00" - ConfigFlags.GeoModel.GeoExportFile = "faserGeo.db" - ConfigFlags.GeoModel.Align.Dynamic = False + + Configurable.configurableRun3Behavior = True + +# Flags for this job + ConfigFlags.Input.isMC = True # Needed to bypass autoconfig + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" # Needed to bypass autoconfig, only the "OFLCOND" matters at the moment + ConfigFlags.GeoModel.FaserVersion = "FASER-00" # Default FASER geometry + ConfigFlags.GeoModel.GeoExportFile = "faserGeo.db" # Writes out a GeoModel file with the full geometry tree (optional, comment out to skip) ConfigFlags.Detector.SimulateVeto = True ConfigFlags.Detector.SimulateFaserSCT = True ConfigFlags.Detector.SimulateUpstreamDipole = True ConfigFlags.Detector.SimulateCentralDipole = True ConfigFlags.Detector.SimulateDownstreamDipole = True ConfigFlags.lock() - # ConfigFlags.dump() -# Configuration +# Configure components from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg - # from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - acc = MainServicesSerialCfg() - # acc.merge(PoolReadCfg(ConfigFlags)) - acc.merge(GeoModelTestCfg(ConfigFlags)) - acc.getService("PoolSvc").SortReplicas = False # protects against random failures to find sqlite file + +# Set things up to create a conditions DB with neutral Tracker alignment transforms + acc.merge(GeoModelTestCfg(ConfigFlags, + AlignDbTool=CompFactory.TrackerAlignDBTool("AlignDbTool", + OutputTool = CompFactory.AthenaOutputStreamTool("DbStreamTool", + OutputFile = "FaserSCT_AlignDb.pool.root")))) + acc.addService(CompFactory.IOVRegistrationSvc(PayloadTable=False)) + acc.getService("IOVRegistrationSvc").OutputLevel = VERBOSE + acc.getService("IOVDbSvc").dbConnection = "sqlite://;schema=ALLP200.db;dbname=OFLP200" + +# Configure verbosity + # ConfigFlags.dump() # logging.getLogger('forcomps').setLevel(VERBOSE) # acc.foreach_component("*").OutputLevel = VERBOSE # acc.foreach_component("*ClassID*").OutputLevel = INFO + # log.setLevel(VERBOSE) # Execute and finish sys.exit(int(acc.run(maxEvents=1).isFailure())) diff --git a/Control/CalypsoExample/GeoModelTest/scripts/CopyAlignFolder.sh b/Control/CalypsoExample/GeoModelTest/scripts/CopyAlignFolder.sh new file mode 100644 index 00000000..3e95b231 --- /dev/null +++ b/Control/CalypsoExample/GeoModelTest/scripts/CopyAlignFolder.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +AtlCoolCopy "sqlite://;schema=./ALLP200.db;dbname=OFLP200" "sqlite://;schema=data/ALLP200.db;dbname=OFLP200" -a -fnp -ot "OFLCOND-XXXX-XXX-XX" +cp -n PoolFileCatalog.xml data/ +cp -n FaserSCT_AlignDb.pool.root data/ \ No newline at end of file diff --git a/Control/CalypsoExample/GeoModelTest/src/GeoModelTestAlg.cxx b/Control/CalypsoExample/GeoModelTest/src/GeoModelTestAlg.cxx index e93deaa7..908a2971 100644 --- a/Control/CalypsoExample/GeoModelTest/src/GeoModelTestAlg.cxx +++ b/Control/CalypsoExample/GeoModelTest/src/GeoModelTestAlg.cxx @@ -22,6 +22,7 @@ GeoModelTestAlg::~GeoModelTestAlg() { } StatusCode GeoModelTestAlg::initialize() { ATH_CHECK(m_field.retrieve()); + ATH_CHECK(m_alignTool.retrieve()); return StatusCode::SUCCESS; } @@ -62,6 +63,11 @@ StatusCode GeoModelTestAlg::execute() ATH_CHECK(testField()); + ATH_CHECK(m_alignTool->createDB()); + ATH_CHECK(m_alignTool->sortTrans()); + ATH_CHECK(m_alignTool->outputObjs()); + ATH_CHECK(m_alignTool->fillDB("",1,0,9999999,9999999)); + return StatusCode::SUCCESS; } diff --git a/Control/CalypsoExample/GeoModelTest/src/GeoModelTestAlg.h b/Control/CalypsoExample/GeoModelTest/src/GeoModelTestAlg.h index 2f19d3fd..a7ad5848 100644 --- a/Control/CalypsoExample/GeoModelTest/src/GeoModelTestAlg.h +++ b/Control/CalypsoExample/GeoModelTest/src/GeoModelTestAlg.h @@ -1,6 +1,7 @@ #include "AthenaBaseComps/AthAlgorithm.h" #include "MagFieldInterfaces/IMagFieldSvc.h" +#include "TrackerAlignGenTools/ITrackerAlignDBTool.h" // Minimalist algorithm to test retrieval of constructed geometry from DetStore @@ -32,4 +33,6 @@ class GeoModelTestAlg : public AthAlgorithm Gaudi::Property<int> m_numSctStripsPerSensor {this, "NumSCTStripsPerSensor", 768,"Number of readout strips per sensor in the SCT detector"}; ServiceHandle<MagField::IMagFieldSvc> m_field { this, "FieldService", "FaserFieldSvc" }; + + ToolHandle<ITrackerAlignDBTool> m_alignTool { this, "AlignDbTool", "TrackerAlignDBTool" }; }; \ No newline at end of file diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/DipoleGMConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/DipoleGMConfig.py index d5171d36..bd096f18 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/python/DipoleGMConfig.py +++ b/DetectorDescription/GeoModel/FaserGeoModel/python/DipoleGMConfig.py @@ -32,7 +32,7 @@ if __name__ == "__main__": # from AthenaConfiguration.TestDefaults import defaultTestFiles # Provide MC input # ConfigFlags.Input.Files = defaultTestFiles.HITS - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" ConfigFlags.Detector.SimulateVeto = False ConfigFlags.Detector.SimulateFaserSCT = False ConfigFlags.Detector.SimulateUpstreamDipole = True diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/FaserGeoModelConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/FaserGeoModelConfig.py index e4d95081..bc6e08ed 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/python/FaserGeoModelConfig.py +++ b/DetectorDescription/GeoModel/FaserGeoModel/python/FaserGeoModelConfig.py @@ -3,10 +3,16 @@ # from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.ComponentFactory import CompFactory def FaserGeometryCfg (flags): acc = ComponentAccumulator() + # Hack to avoid randomly failing to find sqlite file + poolSvc = CompFactory.PoolSvc() + poolSvc.SortReplicas = False + acc.addService(poolSvc) + if flags.Detector.SimulateScintillator or flags.Detector.GeometryScintillator: from FaserGeoModel.ScintGMConfig import ScintGeometryCfg acc.merge(ScintGeometryCfg(flags)) @@ -19,4 +25,7 @@ def FaserGeometryCfg (flags): from FaserGeoModel.DipoleGMConfig import DipoleGeometryCfg acc.merge(DipoleGeometryCfg(flags)) + # Protect against random failures to find sqlite files + # acc.getService("PoolSvc").SortReplicas = False + return acc diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py index faae2c0d..cbc2b678 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py +++ b/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py @@ -28,7 +28,7 @@ if __name__ == "__main__": # from AthenaConfiguration.TestDefaults import defaultTestFiles # Provide MC input # ConfigFlags.Input.Files = defaultTestFiles.HITS - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" ConfigFlags.Detector.SimulateFaserSCT = True ConfigFlags.GeoModel.Align.Dynamic = False # Provide data input diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/ScintGMConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/ScintGMConfig.py index 35068f9a..d1534eaf 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/python/ScintGMConfig.py +++ b/DetectorDescription/GeoModel/FaserGeoModel/python/ScintGMConfig.py @@ -28,7 +28,7 @@ if __name__ == "__main__": # from AthenaConfiguration.TestDefaults import defaultTestFiles # Provide MC input # ConfigFlags.Input.Files = defaultTestFiles.HITS - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" ConfigFlags.Detector.SimulateVeto = True ConfigFlags.GeoModel.Align.Dynamic = False # Provide data input diff --git a/DetectorDescription/GeoModel/FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py b/DetectorDescription/GeoModel/FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py index 1d738620..4ceb868f 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py +++ b/DetectorDescription/GeoModel/FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py @@ -27,7 +27,7 @@ if __name__ == "__main__": ConfigFlags.Detector.SimulateUpstreamDipole = True ConfigFlags.Detector.SimulateCentralDipole = True ConfigFlags.Detector.SimulateDownstreamDipole = True - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.lock() diff --git a/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py b/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py index 0b8f7963..28c510b9 100644 --- a/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py +++ b/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py @@ -11,6 +11,7 @@ logging.getLogger().info("Importing %s", __name__) from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.GlobalFlags import GlobalFlags from AthenaCommon import CfgMgr +from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from MagFieldServices.MagFieldServicesConf import MagField__FaserFieldSvc @@ -20,12 +21,17 @@ def FaserFieldSvc(name="FaserFieldSvc",**kwargs): # configure properties of service, if any return CfgMgr.MagField__FaserFieldSvc(name,**kwargs) -def GetFieldSvc(name="AtlasFieldSvc",**kwargs): +def GetFieldSvc(name="FaserFieldSvc",**kwargs): return FaserFieldSvc(name, **kwargs) # The magneticfields is going to need a big update for MT, so this is all temporary. Ed def MagneticFieldSvcCfg(flags, **kwargs): result=ComponentAccumulator() + + # Hack to avoid randomly failing to find sqlite file + poolSvc = CompFactory.PoolSvc() + poolSvc.SortReplicas = False + result.addService(poolSvc) # initialise required conditions DB folders from IOVDbSvc.IOVDbSvcConfig import addFolders diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py b/Scintillator/ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py index 1f75ad6d..ce28152d 100644 --- a/Scintillator/ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py +++ b/Scintillator/ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py @@ -10,7 +10,7 @@ if __name__ == "__main__": from AthenaConfiguration.TestDefaults import defaultTestFiles ConfigFlags.Input.Files = defaultTestFiles.HITS - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" # ConfigFlags.Detector.SimulatePixel = False ConfigFlags.Detector.SimulateVeto = False # ConfigFlags.Detector.SimulateTRT = False diff --git a/Simulation/G4Faser/G4FaserApp/test/runG4.py b/Simulation/G4Faser/G4FaserApp/test/runG4.py index 57d4d541..1b4a8c17 100644 --- a/Simulation/G4Faser/G4FaserApp/test/runG4.py +++ b/Simulation/G4Faser/G4FaserApp/test/runG4.py @@ -46,7 +46,7 @@ if __name__ == "__main__": ConfigFlags.Beam.Type = "collisions" ConfigFlags.Beam.Energy = 7*TeV # Informational, does not affect simulation ConfigFlags.GeoModel.FaserVersion = "FASER-00" # Always needed - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-14" # Always needed + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" # Always needed; only the OFLCOND part matters # Workaround for bug/missing flag; unimportant otherwise ConfigFlags.addFlag("Input.InitialTimeStamp", 0) # Workaround to avoid failing metadata peek @@ -129,7 +129,6 @@ if __name__ == "__main__": acc.merge(veto) acc.merge(sct) acc.addService(G4GeometryNotifierSvcCfg(ConfigFlags, ActivateLVNotifier=True)) - acc.getService("PoolSvc").SortReplicas = False # protects against random failures to find sqlite file # # Verbosity diff --git a/Tracker/TrackerAlignTools/TrackerAlignGenTools/CMakeLists.txt b/Tracker/TrackerAlignTools/TrackerAlignGenTools/CMakeLists.txt new file mode 100644 index 00000000..a3a2597d --- /dev/null +++ b/Tracker/TrackerAlignTools/TrackerAlignGenTools/CMakeLists.txt @@ -0,0 +1,60 @@ +################################################################################ +# Package: TrackerAlignGenTools +################################################################################ + +# Declare the package name: +atlas_subdir( TrackerAlignGenTools ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaBaseComps + Control/AthenaKernel + Database/AthenaPOOL/AthenaPoolUtilities + DetectorDescription/GeoPrimitives + DetectorDescription/Identifier +# Event/EventPrimitives +# InnerDetector/InDetAlignEvent/InDetAlignTrkInfo +# InnerDetector/InDetAlignTools/InDetAlignToolInterfaces +# InnerDetector/InDetRecEvent/InDetPrepRawData +# Tracking/TrkEvent/TrkEventPrimitives +# Tracking/TrkEvent/TrkEventUtils +# Tracking/TrkEvent/TrkTrack +# Tracking/TrkExtrapolation/TrkExInterfaces +# Tracking/TrkTools/TrkToolInterfaces + Event/EventContainers + PRIVATE + Control/AthContainers + Database/RegistrationServices + DetectorDescription/FaserDetDescr + DetectorDescription/DetDescrCond/DetDescrConditions + GaudiKernel + Tracker/TrackerDetDescr/TrackerIdentifier + Tracker/TrackerDetDescr/TrackerReadoutGeometry +# Simulation/G4Sim/TrackRecord +# Tracking/TrkEvent/TrkMeasurementBase +# Tracking/TrkEvent/TrkParameters +# Tracking/TrkEvent/TrkPrepRawData +# Tracking/TrkEvent/TrkRIO_OnTrack +# Tracking/TrkEvent/TrkTrackSummary +# Tracking/TrkEvent/TrkTruthData +# Tracking/TrkFitter/TrkFitterInterfaces + ) + +# External dependencies: +find_package( CLHEP ) +find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) +find_package( Eigen ) +find_package( HepMC ) +find_package( HepPDT ) + +# Component(s) in the package: +atlas_add_component( TrackerAlignGenTools + src/*.cxx + src/components/*.cxx + INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${CORAL_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives Identifier EventPrimitives AthenaKernel AthContainers FaserDetDescr DetDescrConditions GaudiKernel TrackerIdentifier TrackerReadoutGeometry ) +# LINK_LIBRARIES ${CORAL_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives Identifier EventPrimitives InDetAlignTrkInfo InDetPrepRawData TrkEventPrimitives TrkEventUtils TrkTrack TrkExInterfaces TrkToolInterfaces AthenaKernel AthContainers AtlasDetDescr DetDescrConditions GaudiKernel InDetIdentifier InDetReadoutGeometry TrkMeasurementBase TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces EventContainers ) + +# Install files from the package: +atlas_install_headers( TrackerAlignGenTools ) + diff --git a/Tracker/TrackerAlignTools/TrackerAlignGenTools/TrackerAlignGenTools/ITrackerAlignDBTool.h b/Tracker/TrackerAlignTools/TrackerAlignGenTools/TrackerAlignGenTools/ITrackerAlignDBTool.h new file mode 100644 index 00000000..e5fa2174 --- /dev/null +++ b/Tracker/TrackerAlignTools/TrackerAlignGenTools/TrackerAlignGenTools/ITrackerAlignDBTool.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKERALIGNTOOLS_ALIGNDBTOOL_IH +#define TRACKERALIGNTOOLS_ALIGNDBTOOL_IH +// ITrackerAlignDBTool.h +// an AlgTool to manage the tracker alignment database classes +// abstract interface class, actual implementation and doc +// is in TrackerAlignDBTool.h +// Richard Hawkings, started 11/4/05 + +#include "GaudiKernel/IAlgTool.h" +#include "EventPrimitives/EventPrimitives.h" +#include "GeoPrimitives/GeoPrimitives.h" + + +class Identifier; + +static const InterfaceID +IID_TRACKERALIGN_ITrackerAlignDBTool("ITrackerAlignDBTool",1,0); + +class ITrackerAlignDBTool: virtual public IAlgTool { + public: + static const InterfaceID& interfaceID(); + + virtual StatusCode createDB() const =0; +// virtual void dispGroup(const int, const int, const int, const int, const int, +// const float, const float, const float, +// const int, const int, const int) const =0; + +// virtual void writeFile(const bool, const std::string) const =0; +// virtual void writeGlobalFolderFile( const std::string file) const =0; +// virtual void readTextFile(const std::string) const =0; +// virtual void readNtuple(const std::string) const =0; + +// virtual bool idToDetSet(const Identifier, +// int&,int&,int&,int&,int&) const =0; +// virtual std::string dirkey(const Identifier&, const int) const =0; +// virtual std::string dirkey(const int,const int, const int, const int) const =0; // new function + +// virtual bool setTrans(const Identifier&, const int, const Amg::Transform3D& ) +// const =0; +// virtual bool setTrans(const Identifier& ident, const int level, +// const Amg::Vector3D & translate, double alpha, double beta, double gamma) const = 0; +// virtual bool tweakTrans(const Identifier&, const int, const Amg::Transform3D&) +// const =0; +// virtual bool tweakTrans(const Identifier& ident, const int level, +// const Amg::Vector3D& translate, double alpha, +// double beta, double gamma) const = 0; + +// virtual Identifier getL1L2fromL3Identifier( const Identifier& ident +// , const int& level +// ) const=0 ; +// virtual Amg::Transform3D getTransL123( const Identifier& ident ) const=0 ; +// virtual Amg::Transform3D getTrans(const Identifier&, const int) const=0; + virtual StatusCode outputObjs() const=0; + virtual StatusCode fillDB(const std::string, const unsigned int,const unsigned int, + const unsigned int, const unsigned int) const=0; + virtual StatusCode printDB(const int) const=0; + virtual StatusCode sortTrans() const=0; +// virtual void extractAlphaBetaGamma(const Amg::Transform3D & trans, +// double& alpha, double& beta, double &gamma) const=0; +}; + +inline const InterfaceID& ITrackerAlignDBTool::interfaceID() +{ return IID_TRACKERALIGN_ITrackerAlignDBTool; } + + +#endif // TRACKERALIGNTOOLS_ALIGNDBTOOL_IH diff --git a/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/TrackerAlignDBTool.cxx b/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/TrackerAlignDBTool.cxx new file mode 100644 index 00000000..f1f2fcde --- /dev/null +++ b/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/TrackerAlignDBTool.cxx @@ -0,0 +1,916 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// TrackerAlignDBTool.cxx +// AlgTool to manage the SCT AlignableTransforms in the conditions store +// Richard Hawkings, started 8/4/05 + +#include "CoralBase/AttributeListSpecification.h" +#include "CoralBase/Attribute.h" + +#include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "AthenaPoolUtilities/AthenaAttributeList.h" + +#include <fstream> +#include <iostream> + +#include "GeoPrimitives/CLHEPtoEigenConverter.h" + +#include "AthenaKernel/IAthenaOutputStreamTool.h" +#include "TrackerReadoutGeometry/SCT_DetectorManager.h" +#include "TrackerReadoutGeometry/SiDetectorElementCollection.h" +#include "TrackerReadoutGeometry/SiDetectorElement.h" +#include "TrackerReadoutGeometry/TrackerDD_Defs.h" + +#include "TrackerIdentifier/FaserSCT_ID.h" + +#include "DetDescrConditions/AlignableTransformContainer.h" +#include "RegistrationServices/IIOVRegistrationSvc.h" + +#include "TrackerAlignDBTool.h" + + +// name of the folder for ID alignment information +#define TRACKER_ALIGN "/Tracker/Align" + +TrackerAlignDBTool::TrackerAlignDBTool(const std::string& type, + const std::string& name, const IInterface* parent) + : AthAlgTool(type,name,parent), + p_toolsvc("ToolSvc",name), + m_sctid(nullptr), + m_sctman(nullptr), + m_par_scttwoside(false), + m_par_dbroot( TRACKER_ALIGN ), + m_par_dbkey( TRACKER_ALIGN ), + m_dynamicDB(false), + m_forceUserDBConfig(false) +{ + declareInterface<ITrackerAlignDBTool>(this); + declareProperty("IToolSvc", p_toolsvc); + declareProperty("SCTTwoSide", m_par_scttwoside); + declareProperty("DBRoot", m_par_dbroot,"name of the root folder for constants"); + declareProperty("DBKey", m_par_dbkey,"base part of the key for loading AlignableTransforms"); + declareProperty("forceUserDBConfig",m_forceUserDBConfig, "Set to true to override any DB auto-configuration"); +} + +TrackerAlignDBTool::~TrackerAlignDBTool() +{} + +StatusCode TrackerAlignDBTool::initialize() +{ + + ATH_MSG_DEBUG("initializing"); + + m_alignobjs.clear(); + m_alignchans.clear(); + int ndet {0}; + + // get storegate access to conditions store + ATH_CHECK(detStore().retrieve()); + + ATH_CHECK( p_toolsvc.retrieve() ); + + // attempt to get ID helpers from detector store + // (relying on GeoModel to put them) + + ATH_CHECK(detStore()->retrieve(m_sctman,"SCT")); + + if (m_sctman->m_alignfoldertype == TrackerDD::static_run1 && + !m_forceUserDBConfig) + { + m_par_dbroot = "/Tracker/Align"; + m_dynamicDB = false; + } + else if (m_sctman->m_alignfoldertype == TrackerDD::timedependent_run2 && + !m_forceUserDBConfig) + { + m_par_dbroot = "/Tracker/AlignL3"; + m_dynamicDB = true; + } + m_par_dbkey = m_par_dbroot; + + ATH_CHECK(detStore()->retrieve(m_sctid)); + + // setup list of alignable transforms from geometry + int chan[3]; + int TransfLevel_low = 0; // depending on alignfolder sheme; 0 for old, 2 for new + if (m_dynamicDB) TransfLevel_low = 2; + + for (int i=0;i<3;++i) chan[i]=100*i; + + std::string man_name; + for (const TrackerDD::SiDetectorElement* element : *(m_sctman->getDetectorElementCollection())) + { + if (element!=0) + { + const Identifier ident=element->identify(); + int station, layer, eta, phi, side; + if (idToDetSet(ident, station, layer, eta, phi, side)) + { + std::string level[3]; + for (int i=TransfLevel_low; i<3; ++i) + { + level[i]=dirkey(station, layer, 1+i, phi); + // add this to list if not seen already + std::vector<std::string>::const_iterator ix = + find(m_alignobjs.begin(), m_alignobjs.end(), level[i]); + if (ix==m_alignobjs.end()) + { + m_alignobjs.push_back(level[i]); + m_alignchans.push_back(chan[i]++); + } + } + ++ndet; + } + else + { + ATH_MSG_ERROR("Error translating element identifier." ); + } + } + } + + ATH_CHECK(m_outputTool.retrieve()); + + if (msgLvl(MSG::DEBUG)) + { + ATH_MSG_DEBUG( "Database root folder " << m_par_dbroot ); + ATH_MSG_DEBUG( "Geometry initialisation sees " << ndet << + " SCT modules giving " << m_alignobjs.size() << " alignment keys" ); + ATH_MSG_DEBUG("Keys/channels are:"); + + for (unsigned int i=0; i < m_alignobjs.size(); ++i) + ATH_MSG_DEBUG( " " << m_alignobjs[i] << " [" << m_alignchans[i] << "]" ); + + } + + return StatusCode::SUCCESS; +} + +StatusCode TrackerAlignDBTool::finalize() +{ + ATH_MSG_DEBUG( "finalizing" ); + return StatusCode::SUCCESS; +} + +StatusCode TrackerAlignDBTool::createDB() const +{ + + ATH_MSG_DEBUG("createDB method called"); + AlignableTransform* pat = nullptr; + + // loop over all SiDetectorElements and fill corresponding + // AlignableTransform objects with default values + + // first create the empty AlignableTransform objects in TDS + // check object does not already exist + + if (detStore()->contains<AlignableTransformContainer>(m_par_dbroot)) + { + ATH_MSG_WARNING("createDB: AlignableTransformContainer already exists" ); + return StatusCode::FAILURE; + } + + // put them in a collection /Indet/Align + ATH_MSG_DEBUG( "Setup database structures in AlignableTransformContainer" ); + AlignableTransformContainer* patc = new AlignableTransformContainer; + + if (m_par_scttwoside) ATH_MSG_DEBUG( "Produce separate transforms for each side of SCT modules" ); + else ATH_MSG_DEBUG( "Treat both sides of SCT module as single entity" ); + + for (unsigned int i = 0; i < m_alignobjs.size(); ++i) + { + pat = new AlignableTransform(m_alignobjs[i]); + // add to collection and set corresponding channel number + patc->push_back(pat); + patc->add( m_alignchans[i] ); + } + + // record collection in SG + + ATH_CHECK( detStore()->record(patc, m_par_dbroot) ); + ATH_MSG_DEBUG( "Collection has size " << patc->size() ); + + // now loop over all detector modules and add null level 3 transforms + std::vector<std::string> level2; + for (const TrackerDD::SiDetectorElement* element : *(m_sctman->getDetectorElementCollection()) ) + { + if (element != 0) + { + const Identifier ident = element->identify(); + std::string key = dirkey(ident,3); + // do not produce AlignableTrasnforms for SCT side 1 if option set + if (!(m_sctid->side(ident)==1) || m_par_scttwoside) + { + if ((pat=getTransPtr(key))) + { + pat->add(ident,Amg::EigenTransformToCLHEP( Amg::Transform3D::Identity() ) ); + } + else + { + ATH_MSG_ERROR( "Cannot retrieve AlignableTransform for key " << key ); + } + // add level 2 transform if needed - do this the first time a module + // for this level 3 key is seen + std::vector<std::string>::const_iterator ix= + find(level2.begin(),level2.end(),key); + if (ix==level2.end()) + { + level2.push_back(key); + // construct identifier of level 2 transform + Identifier ident2; + ident2=m_sctid->wafer_id(m_sctid->station(ident), + m_sctid->layer(ident), + 0, 0, 0); + std::string key2 = dirkey(ident, 2); + if ((pat = getTransPtr(key2))) + { + pat->add(ident2, + Amg::EigenTransformToCLHEP( Amg::Transform3D::Identity() ) ); + } + else + { + ATH_MSG_ERROR( "Cannot retrieve AlignableTransform for key " << key2 ); + } + } + } + } + } + + // create the global object with positions for the stations + Identifier ident1; + std::string key1 = dirkey(ident1, 1); + if ((pat = getTransPtr(key1))) + { + Amg::Transform3D globshift; + globshift.setIdentity(); + // Tracker upstream + ident1 = m_sctid->wafer_id(-1, 0, 0, 0, 0); + pat->add(ident1, Amg::EigenTransformToCLHEP(globshift)); + // Tracker central + ident1 = m_sctid->wafer_id(0, 0, 0, 0, 0); + pat->add(ident1, Amg::EigenTransformToCLHEP(globshift)); + // Tracker downstream + ident1 = m_sctid->wafer_id(1, 0, 0, 0, 0); + pat->add(ident1, Amg::EigenTransformToCLHEP(globshift)); + } + else + { + ATH_MSG_ERROR( "Cannot retrieve AlignableTransform for key " << key1 ); + } + + // sort the created objects (in case, usually come out sorted from GeoModel) + sortTrans(); + // list out size of all created objects + ATH_MSG_DEBUG( "Dumping size of created AlignableTransform objects"); + for (unsigned int i = 0; i < m_alignobjs.size(); ++i) + if ((pat = getTransPtr(m_alignobjs[i]))) pat->print(); + + return StatusCode::SUCCESS; +} + +bool TrackerAlignDBTool::idToDetSet(const Identifier ident, int& station, + int& layer, int& eta, int& phi, int& side) const +{ + // transform Identifier to list of integers specifiying station,layer + // eta, phi, side + + station = m_sctid->station(ident); + layer = m_sctid->layer(ident); + eta = m_sctid->eta_module(ident); + phi = m_sctid->phi_module(ident); + side = m_sctid->side(ident); + return true; +} + +std::string TrackerAlignDBTool::dirkey(const Identifier& ident, + const int level) const +{ + // given SCT identifier, and level (1, 2 or 3) return + // directory key name for associated alignment data + int station, layer, eta, phi, side; + idToDetSet(ident, station, layer, eta, phi, side); + return dirkey(station, layer, level, phi); +} + +std::string TrackerAlignDBTool::dirkey(const int station, + const int layer, + const int level, + const int ) const +{ + // channel info and level (1,2 or 3) return + // directory key name for associated alignment data + std::ostringstream result; + if (m_dynamicDB) + { + result << "/Tracker/AlignL"; + result << level; + result << "/" ; // new folders have L1, L2, L3 structure + } + else + { + result << m_par_dbkey << "/" ; + } + + if (level==1) { + result << "Stations"; + } else { + if (level==2) result << "Planes"; + if (level==3) { + if (station == 1 ) result << "Downstream"; + if (station == 0 ) result << "Central"; + if (station ==-1 ) result << "Upstream"; + result << 1+layer; + } + } + return result.str(); +} + +// void InDetAlignDBTool::dispGroup(const int dettype, const int bec, +// const int layer,const int ring, const int sector, +// const float rphidisp, const float rdisp, const float zdisp, +// const int syst, const int level, const int skip) const { + +// ATH_MSG_DEBUG( "dispGroup called: level " << level << " syst " << syst); +// int nmod=0; +// // random number service +// IRndmGenSvc* randsvc; +// if (StatusCode::SUCCESS!=service("RndmGenSvc",randsvc,true)) +// ATH_MSG_ERROR("Cannot find RndmGenSvc" ); +// Rndm::Numbers gauss(randsvc,Rndm::Gauss(0.,1.)); +// if (skip>0) { +// ATH_MSG_DEBUG("Skip random numbers " << skip ); +// for (int i=0;i<skip;++i) gauss(); +// } +// // for syst 5, choose random shifts based on the input numbers +// float rpd=0,rd=0,zd=0; +// if (syst==5) { +// rpd=rphidisp*gauss(); +// rd=rdisp*gauss(); +// zd=zdisp*gauss(); +// } +// // keep a list of level1/2 transform IDs to make sure they are only set once +// std::vector<Identifier> lvl12id; +// // loop over all pixel and SCT modules +// AlignableTransform* pat; +// for (int idet=1;idet<3;++idet) { +// for (const InDetDD::SiDetectorElement* element: *(idet==1 ? m_pixman->getDetectorElementCollection() : m_sctman->getDetectorElementCollection())) { +// if (element!=0) { +// const Identifier ident=element->identify(); +// int mdet,mbec,mlayer,mring,msector,mside; +// idToDetSet(ident,mdet,mbec,mlayer,mring,msector,mside); +// // find matching modules - note side=1 modules never touched +// if ((dettype==-1 || mdet==dettype) && (bec==-1 || std::abs(2*mbec)==bec) && +// (layer==-1 || mlayer==layer) && (ring==-1 || mring==ring) && +// (sector== -1 || msector==sector) && mside==0) { +// // displace this module - first choose displacement type +// // dont choose new displacements if seeing second side of SCT module +// // ensures they both move together +// // depends on the side1 module immediatly following side 0 in list +// // which is currently the case - fragile +// // also for syst 6 choose number only for new ring (eta) slice +// if (dettype!=2 || mside!=1) { +// if (syst==2 || syst==4 || (syst==6 && mring==-6)) { +// rpd=rphidisp*gauss(); +// rd=rdisp*gauss(); +// zd=zdisp*gauss(); +// if (syst==6) ATH_MSG_DEBUG("New rndm at layer/ring " << +// mlayer << " " << mring << " z " << zd ); +// } else if (syst<5) { +// rpd=rphidisp; +// rd=rdisp; +// zd=zdisp; +// } +// } +// // interpretation as rphi/r or x/y +// float xd,yd; +// if (syst<=2 || syst==6) { +// // rphi displacement - calculate from module position in x/y +// const Amg::Vector3D modcent=element->center(); +// float dx=modcent.x(); +// float dy=modcent.y(); +// float dr=sqrt(dx*dx+dy*dy); +// xd=(rd*dx-rpd*dy)/dr; +// yd=(rd*dy+rpd*dx)/dr; +// } else { +// xd=rpd; +// yd=rd; +// } +// // find the corresponding AlignableTransform object +// std::string key=dirkey(mdet,mbec,mlayer,level); +// // first get as const as transforms might have been read in +// const AlignableTransform* cpat=cgetTransPtr(key); +// pat=const_cast<AlignableTransform*>(cpat); +// if (pat) { +// Identifier ident2; +// bool update=true; +// if (level==3) { +// ident2=ident; +// } else if (level==2) { +// // identifier for layer in level 2 transform +// if (mdet==1) { +// ident2=m_pixid->wafer_id(m_pixid->barrel_ec(ident), +// m_pixid->layer_disk(ident),0,0); +// } else { +// ident2=m_sctid->wafer_id(m_sctid->barrel_ec(ident), +// m_sctid->layer_disk(ident),0,0,0); +// } +// // check this identifier has not been updated before +// std::vector<Identifier>::const_iterator ix= +// find(lvl12id.begin(),lvl12id.end(),ident2); +// if (ix==lvl12id.end()) { +// lvl12id.push_back(ident2); +// } else { +// update=false; +// } +// } else { +// // identifier for ID +// if (mdet==1) { +// ident2=m_pixid->wafer_id(0,0,0,0); +// } else { +// ident2=m_sctid->wafer_id(0,0,0,0,0); +// } +// // check this identifier has not been updated before +// std::vector<Identifier>::const_iterator ix= +// find(lvl12id.begin(),lvl12id.end(),ident2); +// if (ix==lvl12id.end()) { +// lvl12id.push_back(ident2); +// } else { +// update=false; +// } +// } +// // update, adding to any existing shift +// if (update) { + +// Amg::Transform3D shift = Amg::Translation3D(xd,yd,zd) * Amg::RotationMatrix3D::Identity(); +// pat->tweak(ident2,Amg::EigenTransformToCLHEP(shift)); +// ATH_MSG_VERBOSE( "Updated module " << mdet << "," << mbec +// << "," << mlayer << "," << mring << "," << msector << " to xyz" << +// xd << "," << yd << "," << zd ); +// ++nmod; +// } +// } else { +// ATH_MSG_ERROR("Cannot find AlignableTransform for key" << key ); +// } +// } +// } +// } +// } +// ATH_MSG_DEBUG( "Added displacement to " << nmod << " modules " << dettype << "," +// << bec << "," << layer << " [" << rphidisp << "," << rdisp +// << "," << zdisp << "]" +// << " type " << syst ); +// } + + +// bool InDetAlignDBTool::setTrans(const Identifier& ident, const int level, +// const Amg::Transform3D& trans) const { + +// bool result=false; + +// // New additions for new global folder structure -- setTrans for this might need to be revisited +// // No ATs exist for levels 1 & 2 --> need alternative +// if (m_dynamicDB && level!=3){ +// result=tweakGlobalFolder(ident, level, trans); +// if (!result ) ATH_MSG_ERROR( "Attempt tweak GlobalDB folder failed" ); +// } +// else { +// // find transform key, then set appropriate transform +// // do storegate const retrieve, then cast to allow update of locked data +// std::string key=dirkey(ident,level); +// const AlignableTransform* pat; +// AlignableTransform* pat2; +// bool result=false; +// if ((pat=cgetTransPtr(key))) { +// pat2=const_cast<AlignableTransform*>(pat); +// if (pat2!=0) { +// result=pat2->update(ident, Amg::EigenTransformToCLHEP(trans) ); +// if (!result) ATH_MSG_ERROR( "Attempt to set non-existant transform" ); +// } +// } else { +// ATH_MSG_ERROR( "setTrans: cannot retrieve AlignableTransform for key" << key ); +// } +// } + +// return result; +// } + +// bool InDetAlignDBTool::setTrans(const Identifier& ident, const int level, +// const Amg::Vector3D& translate, double alpha, double beta, double gamma) const +// { + +// Amg::Translation3D newtranslation(translate); +// Amg::Transform3D newtrans = newtranslation * Amg::RotationMatrix3D::Identity(); +// newtrans *= Amg::AngleAxis3D(gamma, Amg::Vector3D(0.,0.,1.)); +// newtrans *= Amg::AngleAxis3D(beta, Amg::Vector3D(0.,1.,0.)); +// newtrans *= Amg::AngleAxis3D(alpha, Amg::Vector3D(1.,0.,0.)); + +// return setTrans(ident, level, newtrans); +// } + + +// bool InDetAlignDBTool::tweakTrans(const Identifier& ident, const int level, +// const Amg::Transform3D& trans) const { + +// bool result=false; + +// // New additions for new global folder structure +// // No ATs exist for levels 1 & 2 --> need alternative +// if (m_dynamicDB && level!=3){ +// result=tweakGlobalFolder(ident, level, trans); +// if (!result ) ATH_MSG_ERROR( "Attempt tweak GlobalDB folder failed" ); +// } +// else { +// // find transform key, then set appropriate transform +// std::string key=dirkey(ident,level); +// const AlignableTransform* pat; +// AlignableTransform* pat2; +// if ((pat=cgetTransPtr(key))) { +// pat2=const_cast<AlignableTransform*>(pat); +// if (pat2!=0) { +// result=pat2->tweak(ident,Amg::EigenTransformToCLHEP(trans)); +// if (!result) ATH_MSG_ERROR( +// "Attempt to tweak non-existant transform" ); +// } else { +// ATH_MSG_ERROR("tweakTrans: cast fails for key " << key ); +// } +// } else { +// ATH_MSG_ERROR( +// "tweakTrans: cannot retrieve AlignableTransform for key" << key ); +// } +// } + +// return result; +// } + +// bool InDetAlignDBTool::tweakTrans(const Identifier& ident, const int level, +// const Amg::Vector3D& translate, double alpha, double beta, double gamma) const +// { + +// Amg::Translation3D newtranslation(translate); +// Amg::Transform3D newtrans = newtranslation * Amg::RotationMatrix3D::Identity(); +// newtrans *= Amg::AngleAxis3D(gamma, Amg::Vector3D(0.,0.,1.)); +// newtrans *= Amg::AngleAxis3D(beta, Amg::Vector3D(0.,1.,0.)); +// newtrans *= Amg::AngleAxis3D(alpha, Amg::Vector3D(1.,0.,0.)); + +// return tweakTrans(ident, level, newtrans); +// } + +// /** convert L3 module identifier to L1 or L2 */ +// Identifier InDetAlignDBTool::getL1L2fromL3Identifier( const Identifier& ident +// , const int& level +// ) const { +// if( level == 3 ) return ident ; //!< no translation needed +// /** check whether PIX */ +// if( m_pixid->is_pixel(ident) ) { +// if( level == 1 ) { +// return m_pixid->wafer_id( 0, 0, 0, 0 ) ; //!< Whole pixel det. at L1 +// } +// if( level == 2 ) { +// int barrel_ec = m_pixid->barrel_ec( ident ) ; +// int layer_disk = m_pixid->layer_disk( ident ) ; +// return m_pixid->wafer_id( barrel_ec, layer_disk, 0, 0 ) ; +// } +// } +// /** check whether SCT */ +// if( m_sctid->is_sct(ident) ) { +// if( level == 1 ) { +// int barrel_ec = m_sctid->barrel_ec( ident ) ; +// return m_sctid->wafer_id( barrel_ec, 0, 0, 0, 0 ) ; //!< barrel + 2 x EC at L1 +// } +// if( level == 2 ) { +// int barrel_ec = m_sctid->barrel_ec( ident ) ; +// int layer_disk = m_sctid->layer_disk( ident ) ; +// return m_sctid->wafer_id( barrel_ec, layer_disk, 0, 0, 0 ) ; +// } +// } +// return ident ; //!< take care of the case where level != 1,2,3 or ident neither pix nor sct +// } + +// /** get cumulative L1, L2, L3 trafo for (L3-) module */ +// Amg::Transform3D InDetAlignDBTool::getTransL123( const Identifier& ident ) const { + +// Amg::Transform3D result ; +// InDetDD::SiDetectorElement* element = m_pixman->getDetectorElement( ident ) ; +// if( !element ) { +// element = m_sctman->getDetectorElement( ident ) ; +// } +// if( !element ) { +// ATH_MSG_ERROR("getTransL123(): Module not found in PIX or SCT!" ); +// return result ; +// } +// Amg::Transform3D trfL1 = getTrans( ident, 1 ) ; +// Amg::Transform3D trfL2 = getTrans( ident, 2 ) ; +// Amg::Transform3D trfL3 = getTrans( ident, 3 ) ; +// ATH_MSG_FATAL("Code needs to corrected otherwise you will get nonsensical results-- IndetAlignDBTool:2060"); +// //const Amg::Transform3D trfNominal ; //= element->defModuleTransform() ; +// //result = trfNominal.inverse() * trfL1 * trfL2 * trfNominal * trfL3 ; +// result = trfL1 * trfL2 * trfL3 ; +// return result ; +// } + +// /** return value of particular transform specified by identifier and level +// calculates L1 and L2 identifiers automatically by getL1L2fromL3Identifier +// if L3 identifier passed */ +// Amg::Transform3D InDetAlignDBTool::getTrans(const Identifier& ident, +// const int level) const { +// const Identifier identifier = getL1L2fromL3Identifier( ident, level ) ; +// Amg::Transform3D result; +// const std::string key=dirkey(identifier,level); +// const AlignableTransform* pat; +// if ((pat=cgetTransPtr(key))) { +// AlignableTransform::AlignTransMem_citr itr=pat->findIdent(identifier); +// if (itr!=pat->end()) result= Amg::CLHEPTransformToEigen(itr->transform()); +// } +// return result; +// } + +StatusCode TrackerAlignDBTool::outputObjs() const { + + ATH_MSG_DEBUG( "Output AlignableTranform objects to stream" << m_outputTool ); + // get the AthenaOutputStream tool +// IAthenaOutputStreamTool* optool {nullptr}; + +// ATH_CHECK(p_toolsvc->retrieveTool("AthenaOutputStreamTool", m_par_condstream, optool)); + +// ATH_CHECK(optool->connectOutput("myAlignFile.pool.root")); + ATH_CHECK(m_outputTool->connectOutput()); + + // construct list of objects to be written out, either + // AlignableTransformContainer or several of AlignableTransforms + int npairs=1; + IAthenaOutputStreamTool::TypeKeyPairs typekeys(npairs); + typekeys[0]= + IAthenaOutputStreamTool::TypeKeyPair("AlignableTransformContainer", + m_par_dbroot); + if (!(detStore()->contains<AlignableTransformContainer>(m_par_dbroot))) + ATH_MSG_ERROR( + "Expected " << m_par_dbroot << " object not found" ); + // write objects to stream +// ATH_CHECK(optool->streamObjects(typekeys, "myAlignFile.pool.root")); + ATH_CHECK(m_outputTool->streamObjects(typekeys)); + + // commit output + ATH_CHECK(m_outputTool->commitOutput()); + ATH_MSG_DEBUG( "Written " << typekeys.size() << " objects to stream " << m_outputTool); + return StatusCode::SUCCESS; +} + +StatusCode TrackerAlignDBTool::fillDB(const std::string tag, + const unsigned int run1, const unsigned int event1, + const unsigned int run2, const unsigned int event2) const +{ + + ATH_MSG_DEBUG( "fillDB: Data tag " << tag ); + ATH_MSG_DEBUG( "Run/evt1 [" << run1 << "," << event1 << "]" ); + ATH_MSG_DEBUG( "Run/evt2 [" << run2 << "," << event2 << "]" ); + + // get pointer to registration svc + IIOVRegistrationSvc* regsvc {nullptr}; + ATH_CHECK(service("IOVRegistrationSvc", regsvc)); + + // loop over all AlignableTransform objects created earlier and save them + + ATH_CHECK(regsvc->registerIOV( + "AlignableTransformContainer",m_par_dbroot, tag, run1, run2, event1, event2)); + + ATH_MSG_DEBUG( "Stored AlignableTransform object " << m_par_dbroot ); + ATH_MSG_DEBUG( " Wrote one AlignableTransformContainer objects to conditions database" ); + return StatusCode::SUCCESS; +} + +StatusCode TrackerAlignDBTool::printDB(const int level) const +{ + + ATH_MSG_DEBUG("Printout TrackerAlign database contents, detail level" << level ); + + for (std::vector<std::string>::const_iterator iobj = m_alignobjs.begin(); + iobj != m_alignobjs.end(); + ++iobj) + { + const AlignableTransform* pat; + if ((pat = cgetTransPtr(*iobj))) + { + ATH_MSG_DEBUG( "AlignableTransform object " << *iobj ); + int nobj = 0; + for (AlignableTransform::AlignTransMem_citr cit = pat->begin(); + cit!=pat->end(); + ++cit) + { + const Identifier& ident = cit->identify(); + const Amg::Transform3D& trans = Amg::CLHEPTransformToEigen( cit->transform() ); + Amg::Vector3D shift = trans.translation(); + //Amg::RotationMatrix3D rot=trans.rotation(); + int station, layer, eta, phi, side; + if (idToDetSet(ident, station, layer, eta, phi, side)) + { + if (level > 1) + { + double alpha, beta, gamma; + extractAlphaBetaGamma(trans, alpha, beta, gamma); + ATH_MSG_DEBUG( "Tracker [" << station << "," << layer << + "," << eta << "," << phi << "," << side << "] Trans:(" << + shift.x() << "," << shift.y() << "," << shift.z() << ") Rot:{" + << alpha << "," << beta << "," << gamma << "}"); + } + ++nobj; + } + else + { + ATH_MSG_ERROR("Unknown identifier in AlignableTransform" ); + } + } + ATH_MSG_DEBUG( "Object contains " << nobj << " transforms" ); + } + else + { + ATH_MSG_ERROR( "AlignableTransform " << *iobj << " not found" ); + } + } + return StatusCode::SUCCESS; +} + +// ========================================== + +AlignableTransform* TrackerAlignDBTool::getTransPtr(const std::string key) + const { + // look in collection to retrieve pointer to AlignableTransform object of + // given key and return it, return 0 if not collection or key value not found + AlignableTransformContainer* patc; + AlignableTransform* pat {nullptr}; + + if(detStore()->retrieve(patc,m_par_dbroot ).isFailure()) + { + ATH_MSG_ERROR("Unable to retrieve alignment container from DetStore."); + return nullptr; + } + + for (DataVector<AlignableTransform>::iterator dva=patc->begin(); + dva!=patc->end();++dva) + { + if ((*dva)->tag()==key) + { + pat=*dva; + break; + } + } + return pat; +} + +const AlignableTransform* TrackerAlignDBTool::cgetTransPtr(const std::string key) const +{ + // look in collection to retrieve pointer to AlignableTransform object of + // given key and return it, return 0 if not collection or key value not found + // const version + const AlignableTransformContainer* patc; + const AlignableTransform* pat {nullptr}; + + if(detStore()->retrieve(patc, m_par_dbroot ).isFailure()) + { + ATH_MSG_ERROR("Unable to retrieve alignment container from DetStore."); + return nullptr; + } + + for (DataVector<AlignableTransform>::const_iterator dva=patc->begin(); + dva!=patc->end(); + ++dva) + { + if ((*dva)->tag() == key) + { + pat=*dva; + break; + } + } + return pat; +} + +StatusCode TrackerAlignDBTool::sortTrans() const +{ + // loop through all the AlignableTransform objects and sort them + + ATH_MSG_DEBUG( "Sorting all AlignableTransforms in TDS" ); + AlignableTransform* pat; + // use cget and a const cast to allow containers that have been read in + // (and hence are locked by StoreGate) to be sorted + for (unsigned int i=0; i<m_alignobjs.size(); ++i) + if ((pat = const_cast<AlignableTransform*>(cgetTransPtr(m_alignobjs[i])))) pat->sortv(); + + return StatusCode::SUCCESS; +} + +void TrackerAlignDBTool::extractAlphaBetaGamma(const Amg::Transform3D & trans, + double& alpha, double& beta, double &gamma) const +{ + double siny = trans(0,2); + beta = asin(siny); + // Check if cosy = 0. This requires special treatment. + // can check either element (1,2),(2,2) both equal zero + // or (0,1) and (0,0) + // Probably not likely it will be exactly 0 and may still + // have some problems when very close to zero. We mostly + // deal with small rotations so its not too important. + if ((trans(1,2) == 0) && (trans(2,2) == 0)) { + // alpha and gamma are degenerate. We arbitrarily choose + // gamma = 0. + gamma = 0; + alpha = atan2(trans(1,1),trans(2,1)); + } else { + alpha = atan2(-trans(1,2),trans(2,2)); + gamma = atan2(-trans(0,1),trans(0,0)); + if (alpha == 0) alpha = 0; // convert -0 to 0 + if (gamma == 0) gamma = 0; // convert -0 to 0 + } +} + + +// bool InDetAlignDBTool::tweakGlobalFolder(const Identifier& ident, const int level, +// const Amg::Transform3D& trans ) const { + +// // find transform key, then set appropriate transform +// const CondAttrListCollection* atrlistcol1=0; +// CondAttrListCollection* atrlistcol2=0; +// bool result=false; +// std::string key=dirkey(ident,level); +// int det,bec,layer,ring,sector,side; +// idToDetSet(ident,det,bec,layer,ring,sector,side); +// const unsigned int DBident=det*10000+2*bec*1000+layer*100+ring*10+sector; +// // so far not a very fancy DB identifier, but seems elaborate enough for this simple structure + +// if (StatusCode::SUCCESS==detStore()->retrieve(atrlistcol1,key)) { +// // loop over objects in collection +// //atrlistcol1->dump(); +// atrlistcol2 = const_cast<CondAttrListCollection*>(atrlistcol1); +// if (atrlistcol2!=0){ +// for (CondAttrListCollection::const_iterator citr=atrlistcol2->begin(); citr!=atrlistcol2->end();++citr) { + +// const coral::AttributeList& atrlist=citr->second; +// coral::AttributeList& atrlist2 = const_cast<coral::AttributeList&>(atrlist); + +// if(citr->first!=DBident) continue; +// else { +// msg(MSG::DEBUG) << "Tweak Old global DB -- channel: " << citr->first +// << " ,det: " << atrlist2["det"].data<int>() +// << " ,bec: " << atrlist2["bec"].data<int>() +// << " ,layer: " << atrlist2["layer"].data<int>() +// << " ,ring: " << atrlist2["ring"].data<int>() +// << " ,sector: " << atrlist2["sector"].data<int>() +// << " ,Tx: " << atrlist2["Tx"].data<float>() +// << " ,Ty: " << atrlist2["Ty"].data<float>() +// << " ,Tz: " << atrlist2["Tz"].data<float>() +// << " ,Rx: " << atrlist2["Rx"].data<float>() +// << " ,Ry: " << atrlist2["Ry"].data<float>() +// << " ,Rz: " << atrlist2["Rz"].data<float>() << endmsg; + + +// // Order of rotations is defined as around z, then y, then x. +// Amg::Translation3D oldtranslation(atrlist2["Tx"].data<float>(),atrlist2["Ty"].data<float>(),atrlist2["Tz"].data<float>()); +// Amg::Transform3D oldtrans = oldtranslation * Amg::RotationMatrix3D::Identity(); +// oldtrans *= Amg::AngleAxis3D(atrlist2["Rz"].data<float>()*CLHEP::mrad, Amg::Vector3D(0.,0.,1.)); +// oldtrans *= Amg::AngleAxis3D(atrlist2["Ry"].data<float>()*CLHEP::mrad, Amg::Vector3D(0.,1.,0.)); +// oldtrans *= Amg::AngleAxis3D(atrlist2["Rx"].data<float>()*CLHEP::mrad, Amg::Vector3D(1.,0.,0.)); + +// // get the new transform +// Amg::Transform3D newtrans = trans*oldtrans; + +// // Extract the values we need to write to DB +// Amg::Vector3D shift=newtrans.translation(); +// double alpha, beta, gamma; +// extractAlphaBetaGamma(newtrans, alpha, beta, gamma); + +// atrlist2["Tx"].data<float>() = shift.x(); +// atrlist2["Ty"].data<float>() = shift.y(); +// atrlist2["Tz"].data<float>() = shift.z(); +// atrlist2["Rx"].data<float>() = alpha/CLHEP::mrad ; +// atrlist2["Ry"].data<float>() = beta/CLHEP::mrad ; +// atrlist2["Rz"].data<float>() = gamma/CLHEP::mrad ; + +// result = true; +// msg(MSG::DEBUG) << "Tweak New global DB -- channel: " << citr->first +// << " ,det: " << atrlist2["det"].data<int>() +// << " ,bec: " << atrlist2["bec"].data<int>() +// << " ,layer: " << atrlist2["layer"].data<int>() +// << " ,ring: " << atrlist2["ring"].data<int>() +// << " ,sector: " << atrlist2["sector"].data<int>() +// << " ,Tx: " << atrlist2["Tx"].data<float>() +// << " ,Ty: " << atrlist2["Ty"].data<float>() +// << " ,Tz: " << atrlist2["Tz"].data<float>() +// << " ,Rx: " << atrlist2["Rx"].data<float>() +// << " ,Ry: " << atrlist2["Ry"].data<float>() +// << " ,Rz: " << atrlist2["Rz"].data<float>() << endmsg; + +// } +// } +// } +// else { +// ATH_MSG_ERROR("tweakGlobalFolder: cast fails for DBident " << DBident ); +// return false; +// } +// } +// else { +// ATH_MSG_ERROR("tweakGlobalFolder: cannot retrieve CondAttrListCollection for key " << key ); +// return false; +// } + +// return result; +// } + diff --git a/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/TrackerAlignDBTool.h b/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/TrackerAlignDBTool.h new file mode 100644 index 00000000..47d7e8ee --- /dev/null +++ b/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/TrackerAlignDBTool.h @@ -0,0 +1,193 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKERALIGNGENTOOLS_ALIGNDBTOOL_H +#define TRACKERALIGNGENTOOLS_ALIGNDBTOOL_H +// TrackerAlignDBTool.h +// an AlgTool to manage the tracker alignment database classes +// Richard Hawkings, started 8/4/05 +// +// This AlgTool provides utilities to manage the Tracker alignment conditions +// data in the transient store, and to read and write it in a variety of +// formats +// Tool methods provided: +// createDB - create a 'null' set of AlignableTransforms, with no shifts +// dispGroup - apply a pattern to displace a group of modules randomly +// or systematically +// printDB - printout details of all the module transforms +// writeFile - export database contents on a text file or ntuple +// readTextFile - import database from text file +// readNtuple - import database from ntuple +// +// The following utility methods are also exposed +// idToDetSet - convert an SCT/pixel Identifier to set of integers +// specifying detector,barrel/ec,layer,ring, sector (and side for SCT) +// dirkey - return the AlignableTransform TDS key for a given module +// (by Identifier or set of integers) +// setTrans - set the transformation for a particular module, identified by +// a given Identifier +// tweakTrans - tweak (add to existing transform) the transformation for +// a particular module, identified by a given Identifier + +#include <vector> +#include <string> +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "TrackerAlignGenTools/ITrackerAlignDBTool.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "AthenaKernel/IAthenaOutputStreamTool.h" + + +class FaserSCT_ID; +class AlignableTransform; + +namespace TrackerDD { + class SCT_DetectorManager; +} + +class TrackerAlignDBTool: virtual public ITrackerAlignDBTool, public AthAlgTool { + public: + TrackerAlignDBTool(const std::string& type, const std::string& name, + const IInterface* parent); + virtual ~TrackerAlignDBTool(); + + virtual StatusCode initialize(); + virtual StatusCode finalize(); + + // tool methods + // create null database in TDS for subsequent manipulation + + virtual StatusCode createDB() const; + + // displace a group of modules + // modules to effect are specified by dettype (1=pixel, 2=SCT, -1 both), + // bec (barrel=0, 2 for both endcaps, -1 for all), layer (0 to n-1, -1=all) + // ring (-1=all) and sector (-1=all) + // rphidisp,rdisp and zdisp specify the offsets to be used + // syst specifies what will be done, 1=systematic displacement of affected + // modules, 2=random (rphidisp etc are RMS), 3,4=systematic and random + // displacements but interpreting r/phi/zdisp as x/y/z, 5 chooses the + // same randomised numbers for all modules; + // level specifies the level oill look for the right balance of CERN staff supervisors and ATLAS + //USERS supervisors; f transformations affected + // skip=n optionally skips n random numbers to enable different patterns + +// virtual void dispGroup(const int dettype, const int bec, const int layer, +// const int ring, const int sector, +// const float rphidisp, const float rdisp, const float zdisp, +// const int syst, const int level, const int skip) const; + + // write database contents to flat text file or ntuple + // for flat file, file gives filename, for ntuple, file is e.g. + // /NTUPLES/FILE1 +// virtual void writeFile(const bool ntuple, const std::string file) const; + + // write GlobalFolder txt files +// virtual void writeGlobalFolderFile( const std::string file) const; + + // read back database from text file +// virtual void readTextFile(const std::string file) const; + + // read back database from text file + // void readOldTextFile(const std::string file) const; + + // read back database from ntuple +// virtual void readNtuple(const std::string file) const; + + // set a particular transform specified by Identifier +// virtual bool setTrans(const Identifier& ident, const int level, +// const Amg::Transform3D& trans) const; + + // As above but takes translation and rotations alpha, beta, gamma (rotations around x,y,z axes) as input. + // Calculates transform as HepGeom::Translate3D(translate) * HepGeom::RotateX3D(alpha) * HepGeom::RotateY3D(beta) * HepGeom::RotateZ3D(gamma) +// virtual bool setTrans(const Identifier& ident, const int level, +// const Amg::Vector3D& translate, double alpha, double beta, double gamma) const; + + + // tweak a particular transform specified by Identifier (i.e. add to + // already existing transformation) +// virtual bool tweakTrans(const Identifier& ident, const int level, +// const Amg::Transform3D& trans) const; + + // As above but takes translation and rotations alpha, beta, gamma (rotations around x,y,z axes) as input. + // Calculates transform as HepGeom::Translate3D(translate) * HepGeom::RotateX3D(alpha) * HepGeom::RotateY3D(beta) * HepGeom::RotateZ3D(gamma) +// virtual bool tweakTrans(const Identifier& ident, const int level, +// const Amg::Vector3D& translate, double alpha, double beta, double gamma) const; + + /** This is the tweak function for the GlobalFolder DB **/ +// virtual bool tweakGlobalFolder(const Identifier& ident, const int level, +// const Amg::Transform3D& trans) const ; + + /** convert L3 module identifier to L1 or L2 */ +// virtual Identifier getL1L2fromL3Identifier( const Identifier& ident +// , const int& level +// ) const ; + + /** get cumulative L1, L2, L3 trafo for (L3-) module. Result is in local frame. */ +// virtual Amg::Transform3D getTransL123( const Identifier& ident ) const ; + + /** return value of particular transform specified by identifier and level + calculates L1 and L2 identifiers automatically by getL1L2fromL3Identifier + if L3 identifier passed. L1, L2 are in global, L3 in local frame. */ +// virtual Amg::Transform3D getTrans( const Identifier& ident +// , const int level +// ) const ; + + // write the transforms to outputstream + virtual StatusCode outputObjs() const; + + // write the transform IOVs to IOVDB + virtual StatusCode fillDB(const std::string tag, + const unsigned int run1, const unsigned int event1, + const unsigned int run2, const unsigned int event2) const; + + // print the transforms, level=1 lists sizes, level=2 lists all transforms + virtual StatusCode printDB(const int level) const; + + // sort all the AlignableTransform objects so searches/inserts work properly + virtual StatusCode sortTrans() const; + + + private: + + // convert an Identifier to a set of integers specifying station + // layer, ring (eta), sector (phi), and side (0/1) + virtual bool idToDetSet(const Identifier ident, + int& bec,int& layer,int& ring,int& sector,int& side) const; + + // return the AlignableTransform name where the transform for the given + // module can be found, 3 levels corresponding to alignment hierarchy + virtual std::string dirkey(const Identifier&, const int) const; + virtual std::string dirkey(const int,const int, const int, const int) const; + + //calculate three rotations around locX,locY,locY = alpha,beta,gamma out of an HepGeom::Transform3D + void extractAlphaBetaGamma(const Amg::Transform3D & trans, + double& alpha, double& beta, double &gamma) const; + + ServiceHandle < IToolSvc > p_toolsvc; + + const FaserSCT_ID* m_sctid; + const TrackerDD::SCT_DetectorManager* m_sctman; + + std::vector<std::string> m_alignobjs; + std::vector<int> m_alignchans; + + bool m_par_scttwoside; // create structures with separated SCT module sides + /** name of the root folder for constants, which can be set via + the <key> syntax. Default: /Tracker/Align. */ + std::string m_par_dbroot; + /** the base part of the key for loading AlignableTransform objects + from the Transient Data Store. Default: /Tracker/Align */ + std::string m_par_dbkey; + + AlignableTransform* getTransPtr(const std::string key) const; + const AlignableTransform* cgetTransPtr(const std::string key) const; + bool m_dynamicDB; + bool m_forceUserDBConfig; + + mutable ToolHandle<IAthenaOutputStreamTool> m_outputTool { this, "OutputTool", "AthenaOutputStreamTool/CondStream1"} ; + +}; + +#endif // TRACKERALIGNGENTOOLS_ALIGNDBTOOL_H diff --git a/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/components/TrackerAlignGenTools_entries.cxx b/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/components/TrackerAlignGenTools_entries.cxx new file mode 100644 index 00000000..6b54f172 --- /dev/null +++ b/Tracker/TrackerAlignTools/TrackerAlignGenTools/src/components/TrackerAlignGenTools_entries.cxx @@ -0,0 +1,19 @@ +#include "../TrackerAlignDBTool.h" +// #include "InDetAlignGenTools/InDetAlignTrackSelTool.h" +// #include "InDetAlignGenTools/InDetAlignFillTrack.h" + +// #include "InDetAlignGenTools/InDetAlignOverlapTool.h" +// #include "InDetAlignGenTools/InDetAlignFillSiCluster.h" +// #include "InDetAlignGenTools/RefitSiOnlyTool.h" +// #include "InDetAlignGenTools/InDetAlignHitQualSelTool.h" + + +DECLARE_COMPONENT( TrackerAlignDBTool ) +// DECLARE_COMPONENT( InDetAlignTrackSelTool ) +// DECLARE_COMPONENT( InDetAlignFillTrack ) + +// DECLARE_COMPONENT( InDetAlignOverlapTool ) +// DECLARE_COMPONENT( InDetAlignFillSiCluster ) +// DECLARE_COMPONENT( InDetAlignHitQualSelTool ) +// DECLARE_COMPONENT( InDetAlignment::RefitSiOnlyTool ) + diff --git a/Tracker/TrackerConditions/FaserSCT_ConditionsData/data/SCT_Conditions.py b/Tracker/TrackerConditions/FaserSCT_ConditionsData/data/SCT_Conditions.py index f490cb12..b679b251 100644 --- a/Tracker/TrackerConditions/FaserSCT_ConditionsData/data/SCT_Conditions.py +++ b/Tracker/TrackerConditions/FaserSCT_ConditionsData/data/SCT_Conditions.py @@ -6,7 +6,7 @@ description = '<timeStamp>run-lumi</timeStamp><addrHeader><address_header clid=" descriptionDCS = '<timeStamp>time</timeStamp><addrHeader><address_header service_type="71" clid="1238547719" /></addrHeader><typeName>CondAttrListCollection</typeName><cache>600</cache>' -descriptionAlign = '<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type="71" clid="1170039409" /></addrHeader><typeName>AlignableTransformContainer</typeName>' +# descriptionAlign = '<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type="71" clid="1170039409" /></addrHeader><typeName>AlignableTransformContainer</typeName>' descriptionMagnet = '<timeStamp>time</timeStamp><addrHeader><address_header service_type="71" clid="1238547719" /></addrHeader><typeName>CondAttrListCollection</typeName><cache>600</cache><named/>' @@ -19,83 +19,82 @@ print 'recreating database' dbSvc.dropDatabase( connectString ) db = dbSvc.createDatabase( connectString ) -alignSpec = cool.RecordSpecification() -alignSpec.extend( 'PoolRef', cool.StorageType.String4k ) - -alignRecord = cool.Record(alignSpec) - -alignFolderSpec = cool.FolderSpecification(alignSpec) -alignFolder = db.createFolder('/Tracker/Align', alignFolderSpec, descriptionAlign, True) - -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000000]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 0) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000001]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 100) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000002]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 101) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000003]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 200) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000004]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 201) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000005]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 202) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000006]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 203) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000007]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 204) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000008]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 205) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000009]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 206) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000A]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 207) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000B]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 208) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000C]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 209) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000D]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 210) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000E]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 211) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000F]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 212) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000010]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 213) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000011]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 214) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000012]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 215) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000013]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 216) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000014]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 217) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000015]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 218) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000016]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 219) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000017]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 220) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000018]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 221) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000019]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 222) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001A]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 223) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001B]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 224) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001C]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 225) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001D]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 226) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001E]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 227) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001F]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 228) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000020]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 229) -alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000021]' -alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 230) - +# alignSpec = cool.RecordSpecification() +# alignSpec.extend( 'PoolRef', cool.StorageType.String4k ) + +# alignRecord = cool.Record(alignSpec) + +# alignFolderSpec = cool.FolderSpecification(alignSpec) +# alignFolder = db.createFolder('/Tracker/Align', alignFolderSpec, descriptionAlign, True) + +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000000]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 0) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000001]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 100) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000002]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 101) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000003]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 200) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000004]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 201) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000005]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 202) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000006]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 203) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000007]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 204) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000008]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 205) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000009]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 206) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000A]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 207) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000B]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 208) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000C]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 209) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000D]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 210) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000E]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 211) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000000F]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 212) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000010]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 213) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000011]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 214) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000012]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 215) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000013]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 216) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000014]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 217) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000015]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 218) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000016]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 219) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000017]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 220) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000018]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 221) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000019]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 222) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001A]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 223) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001B]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 224) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001C]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 225) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001D]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 226) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001E]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 227) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-0000001F]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 228) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000020]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 229) +# alignRecord[ 'PoolRef' ] = '[DB=D0709FD7-6A55-E011-925D-002481043EC0][CNT=CollectionTreeAlignableTransform][CLID=E779C6B5-3F2A-473E-B35E-6CCB345E0665][TECH=00000202][OID=00000003-00000021]' +# alignFolder.storeObject( cool.ValidityKeyMin, cool.ValidityKeyMax, alignRecord, 230) gainSpec = cool.RecordSpecification() gainSpec.extend( 'serialNumber' , cool.StorageType.UInt63 ) diff --git a/Tracker/TrackerDetDescr/DipoleGeoModel/test/DipoleGMConfig_test.py b/Tracker/TrackerDetDescr/DipoleGeoModel/test/DipoleGMConfig_test.py index fa4ccba9..251319ec 100755 --- a/Tracker/TrackerDetDescr/DipoleGeoModel/test/DipoleGMConfig_test.py +++ b/Tracker/TrackerDetDescr/DipoleGeoModel/test/DipoleGMConfig_test.py @@ -10,7 +10,7 @@ if __name__ == "__main__": from AthenaConfiguration.TestDefaults import defaultTestFiles ConfigFlags.Input.Files = defaultTestFiles.HITS - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" ConfigFlags.Detector.SimulateDipole = True ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.lock() diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_DetectorFactory.cxx b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_DetectorFactory.cxx index c13d6942..b43e4b32 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_DetectorFactory.cxx +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_DetectorFactory.cxx @@ -179,7 +179,17 @@ void SCT_DetectorFactory::create(GeoPhysVol *world) m_detectorManager->addAlignFolderType(TrackerDD::static_run1); m_detectorManager->addFolder("/Tracker/Align"); - m_detectorManager->addChannel("/Tracker/Align/Tracker", 3, TrackerDD::global); + m_detectorManager->addChannel("/Tracker/Align/Stations", 3, TrackerDD::global); // Stations in world + m_detectorManager->addChannel("/Tracker/Align/Planes", 2, TrackerDD::global); // Planes in world + m_detectorManager->addChannel("/Tracker/Align/Upstream1", 1, TrackerDD::local); // Modules in planes and wafers in modules + m_detectorManager->addChannel("/Tracker/Align/Upstream2", 1, TrackerDD::local); + m_detectorManager->addChannel("/Tracker/Align/Upstream3", 1, TrackerDD::local); + m_detectorManager->addChannel("/Tracker/Align/Central1" , 1, TrackerDD::local); + m_detectorManager->addChannel("/Tracker/Align/Central2" , 1, TrackerDD::local); + m_detectorManager->addChannel("/Tracker/Align/Central3" , 1, TrackerDD::local); + m_detectorManager->addChannel("/Tracker/Align/Downstream1", 1, TrackerDD::local); + m_detectorManager->addChannel("/Tracker/Align/Downstream2", 1, TrackerDD::local); + m_detectorManager->addChannel("/Tracker/Align/Downstream3", 1, TrackerDD::local); // m_detectorManager->addFolder("/Indet/Align"); // m_detectorManager->addChannel("/Indet/Align/ID",3,InDetDD::global); // m_detectorManager->addChannel("/Indet/Align/SCT",2,InDetDD::global); diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Plane.cxx b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Plane.cxx index 164c40df..70e43372 100644 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Plane.cxx +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/src/SCT_Plane.cxx @@ -107,13 +107,11 @@ SCT_Plane::build(SCT_Identifier id) plane->add(new GeoNameTag("Side#" + intToString(side))); plane->add(new GeoIdentifierTag(side)); int iz = -1 + 2 * side; - GeoAlignableTransform* transform = new GeoAlignableTransform(GeoTrf::Translate3D(0.0, 0.0, iz * m_sideHalfPitch) * - GeoTrf::RotateY3D(-iz * 90 * Gaudi::Units::deg)); + GeoTransform* transform = new GeoTransform(GeoTrf::Translate3D(0.0, 0.0, iz * m_sideHalfPitch) * + GeoTrf::RotateY3D(-iz * 90 * Gaudi::Units::deg)); plane->add(transform); GeoVPhysVol* halfPlanePV = m_halfPlane->build(id, -iz); plane->add(halfPlanePV); - // Store alignable transform; unclear if we can do this... - m_detectorManager->addAlignableTransform(2, id.getWaferId(), transform, halfPlanePV); } // Extra Material diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py index 13b78ebe..15ccb863 100755 --- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py +++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py @@ -10,7 +10,7 @@ if __name__ == "__main__": from AthenaConfiguration.TestDefaults import defaultTestFiles ConfigFlags.Input.Files = defaultTestFiles.HITS - ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" ConfigFlags.Detector.SimulateFaserSCT = False ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.lock() diff --git a/Tracker/TrackerDetDescr/TrackerReadoutGeometry/src/SCT_DetectorManager.cxx b/Tracker/TrackerDetDescr/TrackerReadoutGeometry/src/SCT_DetectorManager.cxx index 47ed2b77..33aa094f 100755 --- a/Tracker/TrackerDetDescr/TrackerReadoutGeometry/src/SCT_DetectorManager.cxx +++ b/Tracker/TrackerDetDescr/TrackerReadoutGeometry/src/SCT_DetectorManager.cxx @@ -179,7 +179,6 @@ namespace TrackerDD { FrameType frame, GeoVAlignmentStore* alignStore) const { - if (level == 0) { // 0 - At the element level // We retrieve it via a hashId. @@ -329,8 +328,9 @@ namespace TrackerDD { // New global alignment folders bool SCT_DetectorManager::processGlobalAlignment(const std::string & key, int level, FrameType frame, const CondAttrListCollection* obj, GeoVAlignmentStore* alignStore) const - { - ATH_MSG_INFO("Processing new global alignment containers with key " << key << " in the " << frame << " frame at level "); + { + ATH_MSG_FATAL("Calling un-updated SCT_DetectorManager::processGlobalAlignment method with key " << key << " and level " << level); + ATH_MSG_INFO("Processing new global alignment containers with key " << key << " in the " << frame << " frame at level " << level); const CondAttrListCollection* atrlistcol=obj; if(atrlistcol==nullptr and m_detStore->retrieve(atrlistcol,key)!=StatusCode::SUCCESS) { @@ -394,13 +394,15 @@ namespace TrackerDD { } bool SCT_DetectorManager::processSpecialAlignment( - const std::string &, TrackerDD::AlignFolderType) const { + const std::string &, + TrackerDD::AlignFolderType) const { return false; } -bool SCT_DetectorManager::processSpecialAlignment(const std::string& /*key*/, - const CondAttrListCollection* /*obj*/, - GeoVAlignmentStore* /*alignStore*/) const { +bool SCT_DetectorManager::processSpecialAlignment( + const std::string& /*key*/, + const CondAttrListCollection* /*obj*/, + GeoVAlignmentStore* /*alignStore*/) const { return false; } diff --git a/Tracker/TrackerDetDescr/TrackerReadoutGeometry/src/TrackerDetectorManager.cxx b/Tracker/TrackerDetDescr/TrackerReadoutGeometry/src/TrackerDetectorManager.cxx index 9395182d..41c0ab60 100755 --- a/Tracker/TrackerDetDescr/TrackerReadoutGeometry/src/TrackerDetectorManager.cxx +++ b/Tracker/TrackerDetDescr/TrackerReadoutGeometry/src/TrackerDetectorManager.cxx @@ -205,7 +205,7 @@ namespace TrackerDD StatusCode TrackerDetectorManager::align(const RawAlignmentObjects& alignObjects, GeoVAlignmentStore* alignStore) const { - ATH_MSG_DEBUG("align() called from an alignment CondAlg"); + ATH_MSG_DEBUG("align() called from an alignment CondAlg with " << alignObjects.size() << " folders in RawAlignmentObjects"); if (!getIdHelper()) return StatusCode::SUCCESS; // To Do: is it really a success? bool alignmentChange = false; @@ -273,7 +273,7 @@ namespace TrackerDD { bool alignmentChange = false; - ATH_MSG_DEBUG("Dealing with key as container"); + ATH_MSG_DEBUG("Dealing with AlignmentContainer " << key ); const AlignableTransformContainer* container; if (StatusCode::SUCCESS!=m_detStore->retrieve(container, key)) { ATH_MSG_ERROR("Cannot find AlignableTransformContainer for key " @@ -309,11 +309,16 @@ namespace TrackerDD // This should not occur in normal situations so we force job to abort. throw std::runtime_error("Unable to apply Tracker alignments."); } + else + { + ATH_MSG_DEBUG("Processing container with " << container->size() << " AlignableTransforms"); + } // loop over all the AlignableTransform objects in the collection // use only the last ones. std::map<const std::string, const AlignableTransform*> stringToTransform; for (DataVector<AlignableTransform>::const_iterator pat=container->begin(); pat!=container->end();++pat) { + ATH_MSG_DEBUG("Found AlignableTransform with tag " << (*pat)->tag()); stringToTransform[(*pat)->tag()] = *pat; } for (std::pair<const std::string, const AlignableTransform*> value: stringToTransform) { @@ -333,9 +338,9 @@ namespace TrackerDD // returns -1 if unrecognized. const LevelInfo & levelInfo = getLevel(key); if (levelInfo.isValid()) { - ATH_MSG_VERBOSE("Processing channel: " << key); + ATH_MSG_VERBOSE("Processing channel: " << key << " with " << transformCollection->size() << " elements"); } else { - ATH_MSG_DEBUG("Channel " << key << " not registered in this manager"); + ATH_MSG_DEBUG("Channel " << key << " with " << transformCollection->size() << " elements not registered in this manager"); } // return silently if unrecognised - this can happen in container mode // when a single container holds transforms for both pixel and SCT diff --git a/Tracker/TrackerDigitization/FaserSCT_Digitization/CMakeLists.txt b/Tracker/TrackerDigitization/FaserSCT_Digitization/CMakeLists.txt index 73035d82..684a7222 100644 --- a/Tracker/TrackerDigitization/FaserSCT_Digitization/CMakeLists.txt +++ b/Tracker/TrackerDigitization/FaserSCT_Digitization/CMakeLists.txt @@ -53,4 +53,5 @@ atlas_add_component( FaserSCT_Digitization atlas_install_headers( FaserSCT_Digitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) +atlas_install_scripts( test/FaserSCT_DigitizationDbg.py ) diff --git a/Tracker/TrackerDigitization/FaserSCT_Digitization/README.md b/Tracker/TrackerDigitization/FaserSCT_Digitization/README.md new file mode 100644 index 00000000..4b8569c2 --- /dev/null +++ b/Tracker/TrackerDigitization/FaserSCT_Digitization/README.md @@ -0,0 +1,27 @@ +This package will translate Geant4 hits (HITS) into RawDataObject (RDO) data files. + +Because input data and alignment is needed, there are a few steps to prepare. From a run directory where calypso is installed, do: + +*) run > ./setup.sh + +This sets up the runtime environment after building. The "." is mandatory. + +*) run > runG4.py >& runG4.log + +This will create a HITS file. + +*) run > python python/GeoModelTest/GeoModelTestConfig.py + +This will generate a set of neutral alignment data + +*) run > CopyAlignFolder.sh + +This will merge the alignment data into the conditions DB. + +All the above steps need only be done once after building calypso (but the second and third steps must be repeated each time you do "make install"). + +Now you can run digitization on the HITS file you generated with the command: + +run > FaserSCT_DigitizationDbg.py >& digi.log + +This will read your g4.HITS.root generate an RDO data file with digitized raw data objects. diff --git a/Tracker/TrackerDigitization/FaserSCT_Digitization/test/FaserSCT_DigitizationDbg.py b/Tracker/TrackerDigitization/FaserSCT_Digitization/test/FaserSCT_DigitizationDbg.py index 251c4a68..666ff440 100644 --- a/Tracker/TrackerDigitization/FaserSCT_Digitization/test/FaserSCT_DigitizationDbg.py +++ b/Tracker/TrackerDigitization/FaserSCT_Digitization/test/FaserSCT_DigitizationDbg.py @@ -24,14 +24,14 @@ Configurable.configurableRun3Behavior = True # Configure ConfigFlags.Input.Files = ['g4.HITS.root'] ConfigFlags.Output.RDOFileName = "myRDO.pool.root" -ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" +ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.Concurrency.NumThreads = 1 ConfigFlags.Beam.NumberOfCollisions = 0. #ConfigFlags.Detector.SimulateFaserSCT = True ConfigFlags.GeoModel.FaserVersion = "FASER-00" # Always needed -ConfigFlags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" # Always needed to fool autoconfig +ConfigFlags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" # Always needed to fool autoconfig; value ignored ConfigFlags.Digitization.TruthOutput = True @@ -64,12 +64,12 @@ logging.getLogger('forcomps').setLevel(VERBOSE) acc.foreach_component("*").OutputLevel = VERBOSE acc.foreach_component("*ClassID*").OutputLevel = INFO acc.getCondAlgo("FaserSCT_AlignCondAlg").OutputLevel = VERBOSE -acc.getService("PoolSvc").SortReplicas = False +acc.getCondAlgo("FaserSCT_DetectorElementCondAlg").OutputLevel = VERBOSE acc.getService("StoreGateSvc").Dump = True acc.getService("ConditionStore").Dump = True acc.printConfig(withDetails=True) ConfigFlags.dump() # Execute and finish -sc = acc.run(maxEvents=5) +sc = acc.run(maxEvents=-1) # Success should be 0 sys.exit(not sc.isSuccess()) diff --git a/Tracker/TrackerDigitization/FaserSCT_Digitization/test/SCT_DigitizationConfigNew_test.py b/Tracker/TrackerDigitization/FaserSCT_Digitization/test/SCT_DigitizationConfigNew_test.py index 0c3c3219..2139bfc6 100644 --- a/Tracker/TrackerDigitization/FaserSCT_Digitization/test/SCT_DigitizationConfigNew_test.py +++ b/Tracker/TrackerDigitization/FaserSCT_Digitization/test/SCT_DigitizationConfigNew_test.py @@ -19,7 +19,7 @@ log.setLevel(DEBUG) Configurable.configurableRun3Behavior = True # Configure ConfigFlags.Input.Files = defaultTestFiles.HITS -ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" +ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX" ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.Concurrency.NumThreads = 1 ConfigFlags.lock() diff --git a/graphics/VTI12/VTI12Algs/share/vti12.py b/graphics/VTI12/VTI12Algs/share/vti12.py index 6acbbac5..3b07e0a3 100644 --- a/graphics/VTI12/VTI12Algs/share/vti12.py +++ b/graphics/VTI12/VTI12Algs/share/vti12.py @@ -95,7 +95,7 @@ if (vp1InputFiles == []): # Set conditions tag if not 'vp1GlobCond' in dir(): - vp1GlobCond="OFLCOND-SDR-BS7T-05-14" + vp1GlobCond="OFLCOND-XXXX-XXX-XX" from IOVDbSvc.CondDB import conddb conddb.setGlobalTag(vp1GlobCond) @@ -145,7 +145,7 @@ else: # Set conditions tag if not 'vp1GlobCond' in dir(): if (vp1Mc): - vp1GlobCond="OFLCOND-SIM-BS7T-02" + vp1GlobCond="OFLCOND-XXXX-XXX-XX" else: vp1GlobCond="COMCOND-BLKPST-004-01" -- GitLab