Skip to content
Snippets Groups Projects
Commit bc50d408 authored by Dave Casper's avatar Dave Casper
Browse files

Realistic alignment database for Tracker

parent 7eaf54a7
No related branches found
No related tags found
No related merge requests found
Showing
with 1343 additions and 30 deletions
...@@ -67,7 +67,7 @@ class ConditionsTag(JobProperty): ...@@ -67,7 +67,7 @@ class ConditionsTag(JobProperty):
""" """
statusOn=True statusOn=True
allowedTypes=['str'] allowedTypes=['str']
StoredValue='OFLCOND-RUN12-SDR-31' StoredValue='OFLCOND-XXXX-XXX-XX'
# #
class DatabaseInstance(JobProperty): class DatabaseInstance(JobProperty):
......
...@@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PRIVATE ...@@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PRIVATE
Scintillator/ScintDetDescr/ScintReadoutGeometry Scintillator/ScintDetDescr/ScintReadoutGeometry
Tracker/TrackerDetDescr/TrackerReadoutGeometry Tracker/TrackerDetDescr/TrackerReadoutGeometry
MagneticField/MagFieldInterfaces MagneticField/MagFieldInterfaces
Tracker/TrackerAlignTools/TrackerAlignGenTools
) )
# External dependencies: # External dependencies:
...@@ -34,3 +35,4 @@ atlas_add_test( GeoModelCheck ...@@ -34,3 +35,4 @@ atlas_add_test( GeoModelCheck
#atlas_install_headers( GeoModelTest ) #atlas_install_headers( GeoModelTest )
#atlas_install_joboptions( share/*.py ) #atlas_install_joboptions( share/*.py )
atlas_install_python_modules( python/*.py ) atlas_install_python_modules( python/*.py )
atlas_install_scripts( scripts/*.sh )
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
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
def GeoModelTestCfg(flags): def GeoModelTestCfg(flags, name="GeoModelTestAlg", **kwargs):
from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg
a = FaserGeometryCfg(flags) a = FaserGeometryCfg(flags)
...@@ -11,46 +11,52 @@ def GeoModelTestCfg(flags): ...@@ -11,46 +11,52 @@ def GeoModelTestCfg(flags):
fieldSvc = a.getService("FaserFieldSvc") fieldSvc = a.getService("FaserFieldSvc")
from GeoModelTest.GeoModelTestConf import GeoModelTestAlg from GeoModelTest.GeoModelTestConf import GeoModelTestAlg
a.addEventAlgo(GeoModelTestAlg()) a.addEventAlgo(GeoModelTestAlg(name, **kwargs))
a.getEventAlgo("GeoModelTestAlg").FieldService = fieldSvc a.getEventAlgo(name).FieldService = fieldSvc
return a return a
if __name__ == "__main__": if __name__ == "__main__":
# from AthenaCommon.Logging import log, logging # from AthenaCommon.Logging import log, logging
#from AthenaCommon.Constants import VERBOSE, INFO from AthenaCommon.Constants import VERBOSE, INFO
# log.setLevel(VERBOSE)
from AthenaCommon.Configurable import Configurable from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior = True from AthenaConfiguration.ComponentFactory import CompFactory
# Flag definition
from CalypsoConfiguration.AllConfigFlags import ConfigFlags from CalypsoConfiguration.AllConfigFlags import ConfigFlags
# Flag specification
ConfigFlags.Input.isMC = True Configurable.configurableRun3Behavior = True
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-14" # Always needed, does nothing
ConfigFlags.GeoModel.FaserVersion = "FASER-00" # Flags for this job
ConfigFlags.GeoModel.GeoExportFile = "faserGeo.db" ConfigFlags.Input.isMC = True # Needed to bypass autoconfig
ConfigFlags.GeoModel.Align.Dynamic = False 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.SimulateVeto = True
ConfigFlags.Detector.SimulateFaserSCT = True ConfigFlags.Detector.SimulateFaserSCT = True
ConfigFlags.Detector.SimulateUpstreamDipole = True ConfigFlags.Detector.SimulateUpstreamDipole = True
ConfigFlags.Detector.SimulateCentralDipole = True ConfigFlags.Detector.SimulateCentralDipole = True
ConfigFlags.Detector.SimulateDownstreamDipole = True ConfigFlags.Detector.SimulateDownstreamDipole = True
ConfigFlags.lock() ConfigFlags.lock()
# ConfigFlags.dump()
# Configuration # Configure components
from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg
# from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
acc = MainServicesSerialCfg() acc = MainServicesSerialCfg()
# acc.merge(PoolReadCfg(ConfigFlags))
acc.merge(GeoModelTestCfg(ConfigFlags)) # Set things up to create a conditions DB with neutral Tracker alignment transforms
acc.getService("PoolSvc").SortReplicas = False # protects against random failures to find sqlite file 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) # logging.getLogger('forcomps').setLevel(VERBOSE)
# acc.foreach_component("*").OutputLevel = VERBOSE # acc.foreach_component("*").OutputLevel = VERBOSE
# acc.foreach_component("*ClassID*").OutputLevel = INFO # acc.foreach_component("*ClassID*").OutputLevel = INFO
# log.setLevel(VERBOSE)
# Execute and finish # Execute and finish
sys.exit(int(acc.run(maxEvents=1).isFailure())) sys.exit(int(acc.run(maxEvents=1).isFailure()))
#!/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
...@@ -22,6 +22,7 @@ GeoModelTestAlg::~GeoModelTestAlg() { } ...@@ -22,6 +22,7 @@ GeoModelTestAlg::~GeoModelTestAlg() { }
StatusCode GeoModelTestAlg::initialize() StatusCode GeoModelTestAlg::initialize()
{ {
ATH_CHECK(m_field.retrieve()); ATH_CHECK(m_field.retrieve());
ATH_CHECK(m_alignTool.retrieve());
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -62,6 +63,11 @@ StatusCode GeoModelTestAlg::execute() ...@@ -62,6 +63,11 @@ StatusCode GeoModelTestAlg::execute()
ATH_CHECK(testField()); 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; return StatusCode::SUCCESS;
} }
......
#include "AthenaBaseComps/AthAlgorithm.h" #include "AthenaBaseComps/AthAlgorithm.h"
#include "MagFieldInterfaces/IMagFieldSvc.h" #include "MagFieldInterfaces/IMagFieldSvc.h"
#include "TrackerAlignGenTools/ITrackerAlignDBTool.h"
// Minimalist algorithm to test retrieval of constructed geometry from DetStore // Minimalist algorithm to test retrieval of constructed geometry from DetStore
...@@ -32,4 +33,6 @@ class GeoModelTestAlg : public AthAlgorithm ...@@ -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"}; 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" }; ServiceHandle<MagField::IMagFieldSvc> m_field { this, "FieldService", "FaserFieldSvc" };
ToolHandle<ITrackerAlignDBTool> m_alignTool { this, "AlignDbTool", "TrackerAlignDBTool" };
}; };
\ No newline at end of file
...@@ -32,7 +32,7 @@ if __name__ == "__main__": ...@@ -32,7 +32,7 @@ if __name__ == "__main__":
# from AthenaConfiguration.TestDefaults import defaultTestFiles # from AthenaConfiguration.TestDefaults import defaultTestFiles
# Provide MC input # Provide MC input
# ConfigFlags.Input.Files = defaultTestFiles.HITS # 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.SimulateVeto = False
ConfigFlags.Detector.SimulateFaserSCT = False ConfigFlags.Detector.SimulateFaserSCT = False
ConfigFlags.Detector.SimulateUpstreamDipole = True ConfigFlags.Detector.SimulateUpstreamDipole = True
......
...@@ -3,10 +3,16 @@ ...@@ -3,10 +3,16 @@
# #
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
def FaserGeometryCfg (flags): def FaserGeometryCfg (flags):
acc = ComponentAccumulator() 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: if flags.Detector.SimulateScintillator or flags.Detector.GeometryScintillator:
from FaserGeoModel.ScintGMConfig import ScintGeometryCfg from FaserGeoModel.ScintGMConfig import ScintGeometryCfg
acc.merge(ScintGeometryCfg(flags)) acc.merge(ScintGeometryCfg(flags))
...@@ -19,4 +25,7 @@ def FaserGeometryCfg (flags): ...@@ -19,4 +25,7 @@ def FaserGeometryCfg (flags):
from FaserGeoModel.DipoleGMConfig import DipoleGeometryCfg from FaserGeoModel.DipoleGMConfig import DipoleGeometryCfg
acc.merge(DipoleGeometryCfg(flags)) acc.merge(DipoleGeometryCfg(flags))
# Protect against random failures to find sqlite files
# acc.getService("PoolSvc").SortReplicas = False
return acc return acc
...@@ -28,7 +28,7 @@ if __name__ == "__main__": ...@@ -28,7 +28,7 @@ if __name__ == "__main__":
# from AthenaConfiguration.TestDefaults import defaultTestFiles # from AthenaConfiguration.TestDefaults import defaultTestFiles
# Provide MC input # Provide MC input
# ConfigFlags.Input.Files = defaultTestFiles.HITS # ConfigFlags.Input.Files = defaultTestFiles.HITS
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX"
ConfigFlags.Detector.SimulateFaserSCT = True ConfigFlags.Detector.SimulateFaserSCT = True
ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.GeoModel.Align.Dynamic = False
# Provide data input # Provide data input
......
...@@ -28,7 +28,7 @@ if __name__ == "__main__": ...@@ -28,7 +28,7 @@ if __name__ == "__main__":
# from AthenaConfiguration.TestDefaults import defaultTestFiles # from AthenaConfiguration.TestDefaults import defaultTestFiles
# Provide MC input # Provide MC input
# ConfigFlags.Input.Files = defaultTestFiles.HITS # ConfigFlags.Input.Files = defaultTestFiles.HITS
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX"
ConfigFlags.Detector.SimulateVeto = True ConfigFlags.Detector.SimulateVeto = True
ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.GeoModel.Align.Dynamic = False
# Provide data input # Provide data input
......
...@@ -27,7 +27,7 @@ if __name__ == "__main__": ...@@ -27,7 +27,7 @@ if __name__ == "__main__":
ConfigFlags.Detector.SimulateUpstreamDipole = True ConfigFlags.Detector.SimulateUpstreamDipole = True
ConfigFlags.Detector.SimulateCentralDipole = True ConfigFlags.Detector.SimulateCentralDipole = True
ConfigFlags.Detector.SimulateDownstreamDipole = 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.GeoModel.Align.Dynamic = False
ConfigFlags.lock() ConfigFlags.lock()
......
...@@ -11,6 +11,7 @@ logging.getLogger().info("Importing %s", __name__) ...@@ -11,6 +11,7 @@ logging.getLogger().info("Importing %s", __name__)
from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
from AthenaCommon.GlobalFlags import GlobalFlags from AthenaCommon.GlobalFlags import GlobalFlags
from AthenaCommon import CfgMgr from AthenaCommon import CfgMgr
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from MagFieldServices.MagFieldServicesConf import MagField__FaserFieldSvc from MagFieldServices.MagFieldServicesConf import MagField__FaserFieldSvc
...@@ -20,12 +21,17 @@ def FaserFieldSvc(name="FaserFieldSvc",**kwargs): ...@@ -20,12 +21,17 @@ def FaserFieldSvc(name="FaserFieldSvc",**kwargs):
# configure properties of service, if any # configure properties of service, if any
return CfgMgr.MagField__FaserFieldSvc(name,**kwargs) return CfgMgr.MagField__FaserFieldSvc(name,**kwargs)
def GetFieldSvc(name="AtlasFieldSvc",**kwargs): def GetFieldSvc(name="FaserFieldSvc",**kwargs):
return FaserFieldSvc(name, **kwargs) return FaserFieldSvc(name, **kwargs)
# The magneticfields is going to need a big update for MT, so this is all temporary. Ed # The magneticfields is going to need a big update for MT, so this is all temporary. Ed
def MagneticFieldSvcCfg(flags, **kwargs): def MagneticFieldSvcCfg(flags, **kwargs):
result=ComponentAccumulator() 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 # initialise required conditions DB folders
from IOVDbSvc.IOVDbSvcConfig import addFolders from IOVDbSvc.IOVDbSvcConfig import addFolders
......
...@@ -10,7 +10,7 @@ if __name__ == "__main__": ...@@ -10,7 +10,7 @@ if __name__ == "__main__":
from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.TestDefaults import defaultTestFiles
ConfigFlags.Input.Files = defaultTestFiles.HITS 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.SimulatePixel = False
ConfigFlags.Detector.SimulateVeto = False ConfigFlags.Detector.SimulateVeto = False
# ConfigFlags.Detector.SimulateTRT = False # ConfigFlags.Detector.SimulateTRT = False
......
...@@ -46,7 +46,7 @@ if __name__ == "__main__": ...@@ -46,7 +46,7 @@ if __name__ == "__main__":
ConfigFlags.Beam.Type = "collisions" ConfigFlags.Beam.Type = "collisions"
ConfigFlags.Beam.Energy = 7*TeV # Informational, does not affect simulation ConfigFlags.Beam.Energy = 7*TeV # Informational, does not affect simulation
ConfigFlags.GeoModel.FaserVersion = "FASER-00" # Always needed 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 # Workaround for bug/missing flag; unimportant otherwise
ConfigFlags.addFlag("Input.InitialTimeStamp", 0) ConfigFlags.addFlag("Input.InitialTimeStamp", 0)
# Workaround to avoid failing metadata peek # Workaround to avoid failing metadata peek
...@@ -129,7 +129,6 @@ if __name__ == "__main__": ...@@ -129,7 +129,6 @@ if __name__ == "__main__":
acc.merge(veto) acc.merge(veto)
acc.merge(sct) acc.merge(sct)
acc.addService(G4GeometryNotifierSvcCfg(ConfigFlags, ActivateLVNotifier=True)) acc.addService(G4GeometryNotifierSvcCfg(ConfigFlags, ActivateLVNotifier=True))
acc.getService("PoolSvc").SortReplicas = False # protects against random failures to find sqlite file
# #
# Verbosity # Verbosity
......
################################################################################
# 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 )
/*
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
This diff is collapsed.
/*
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
#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 )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment