Commit bc181d0e authored by Noemi Calace's avatar Noemi Calace Committed by Tadej Novak
Browse files

21.9: Adding changes to create and apply misalignment with ITk

parent fd1469cd
......@@ -36,7 +36,7 @@ MisalignModeMap = {0:'no Misalignment',
2: 'random misalignment',
11: 'R deltaR (radial expansion)', 12: 'Phi deltaR (ellipse)',13: 'Z deltaR (funnel)',
21: 'R deltaPhi (curl)', 22: 'Phi deltaPhi (clamshell) ',23:'Z deltaPhi (twist)',
31: 'R deltaZ (telescope)',32:'Phi deltaZ (skew)',33:'Z deltaZ (z-expansion)'}
31: 'R deltaZ (telescope)',32:'Phi deltaZ (skew)',33:'Z deltaZ (z-expansion)', 99:'testing'}
# construct Alignmentparameter Input filename
AlignmentInFilename = InFile + '.pool.root'
......@@ -50,13 +50,16 @@ ASCIIFilename = OutFiles
# Setup geometry
from AthenaCommon.GlobalFlags import globalflags
globalflags.DataSource='geant4'
globalflags.DetDescrVersion = 'ATLAS-P2-ITK-22-02-00'
globalflags.DetDescrVersion = 'ATLAS-P2-ITK-23-00-03'
include("InDetSLHC_Example/preInclude.SLHC.py")
include("InDetSLHC_Example/preInclude.SiliconOnly.py")
include("InDetSLHC_Example/preInclude.SLHC_Setup.py")
include("InDetSLHC_Example/preInclude.SLHC_Setup_Strip_GMX.py")
from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags
#SLHC_Flags.UseLocalGeometry = True
# Full job is a list of algorithms
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
......@@ -70,19 +73,28 @@ ServiceMgr += GeoModelSvc
GeoModelSvc.AtlasVersion = globalflags.DetDescrVersion()
from IOVDbSvc.CondDB import conddb
conddb.setGlobalTag('OFLCOND-MC15c-SDR-14-03')
#conddb.setGlobalTag('OFLCOND-MC15c-SDR-14-03')
conddb.setGlobalTag('OFLCOND-SIM-00-00-00')
import AthenaCommon.AtlasUnixGeneratorJob
ServiceMgr.EventSelector.RunNumber = 222222
#ServiceMgr.EventSelector.RunNumber = 222222
ServiceMgr.MessageSvc.defaultLimit = 9999999 # all messages
ITkAlignFolder="/Indet/AlignITk"
from InDetAlignGenTools.InDetAlignGenToolsConf import InDetAlignDBTool
InDetDBTool = InDetAlignDBTool()
InDetDBTool.SCTTwoSide=True
InDetDBTool.DBRoot=ITkAlignFolder
InDetDBTool.DBKey=ITkAlignFolder
InDetDBTool.forceUserDBConfig=True
InDetDBTool.OutputLevel=VERBOSE
ToolSvc += InDetDBTool
print InDetDBTool
print "CreateMisalignAlg: Creation of misalignment mode %s: %s" % (MisalignmentMode,MisalignModeMap.get(MisalignmentMode,'unknown'))
from InDetAlignGenAlgs.InDetAlignGenAlgsConf import InDetAlignment__CreateMisalignAlg
myMisalignAlg = InDetAlignment__CreateMisalignAlg( name = "MyMisalignmentAlg",
IDAlignDBTool = InDetDBTool,
......@@ -92,21 +104,21 @@ myMisalignAlg = InDetAlignment__CreateMisalignAlg( name = "MyMisalignmentAlg",
MisalignMode = MisalignmentMode,
MisalignmentX = 0.0,
MisalignmentY = 0.0,
MisalignmentZ = 0.,
MisalignmentZ = 0.0,
MisalignmentAlpha = 0.,
MisalignmentBeta = 0.,
MisalignmentGamma = 0.,
IBLBowingTshift = 1,
ScalePixelIBL = 0.1,
ScalePixelBarrel=0.1,
ScalePixelEndcap=0.1,
ScaleSCTBarrel=0.1,
IBLBowingTshift = 0.,
ScalePixelIBL = 0.,
ScalePixelBarrel=1.,
ScalePixelEndcap=0.,
ScaleSCTBarrel=1.,
ScaleSCTEndcap=0.,
ScaleTRTBarrel=0.,
ScaleTRTEndcap=0.,
MaxShift = MaximumShift,
doPixel = True,
doSCT = False,
doSCT = True,
doTRT = False,
OutputLevel = VERBOSE)
......@@ -151,7 +163,11 @@ if WriteDBPoolFile:
regSvc.RecreateFolders = False
IOVDbSvc = Service( "IOVDbSvc" )
IOVDbSvc.dbConnection = "sqlite://;schema=%s;dbname=COMP200" % (DatabaseFilename)
IOVDbSvc.dbConnection = "sqlite://;schema=%s;dbname=OFLP200" % (DatabaseFilename)
from IOVDbSvc.CondDB import conddb
# block folders that you want to override
conddb.blockFolder("/Indet/Align")
......@@ -161,3 +177,4 @@ svcMgr.StatusCodeSvc.SuppressCheck = True
svcMgr.StatusCodeSvc.AbortOnError = False
include("InDetSLHC_Example/postInclude.SLHC_Setup_ITK.py")
SCT_GMX_DetectorTool.Alignable = True
from IOVDbSvc.CondDB import conddb
conddb.blockFolder("/Indet/Align")
conddb.blockFolder("/Indet/AlignITk")
DataBaseConnection = "<dbConnection>sqlite://;schema=MisalignmentSet2_p01.db;dbname=OFLP200</dbConnection>"
conddb.addFolderWithTag("",DataBaseConnection+"/Indet/AlignITk","InDetSi_MisalignmentMode_", force=True)
DataBaseConnection = "<dbConnection>sqlite://;schema=MisalignmentSet99.db;dbname=OFLP200</dbConnection>"
conddb.addFolderWithTag("",DataBaseConnection+"/Indet/AlignITk","InDetSi_MisalignmentMode_99", force=True)
conddb.blockFolder("/Indet/IBLDist")
SCT_GMX_DetectorTool.Alignable=True
pixelTool = svcMgr.GeoModelSvc.DetectorTools['PixelDetectorTool']
pixelTool.Alignable = True
......@@ -65,6 +65,8 @@ class IInDetAlignDBTool: virtual public IAlgTool {
virtual void sortTrans() const=0;
virtual void extractAlphaBetaGamma(const Amg::Transform3D & trans,
double& alpha, double& beta, double &gamma) const=0;
virtual bool useSCTtwoSide() const = 0;
};
inline const InterfaceID& IInDetAlignDBTool::interfaceID()
......
......@@ -170,6 +170,8 @@ class InDetAlignDBTool: virtual public IInDetAlignDBTool, public AthAlgTool {
//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;
bool useSCTtwoSide() const { return par_scttwoside;};
private:
ServiceHandle < IToolSvc > p_toolsvc;
......
......@@ -230,22 +230,30 @@ void PixelDetectorFactoryFastGeo::create(GeoPhysVol *world)
// Register the callbacks and keys and the level corresponding to the key.
if (m_geometryManager->Alignable()) {
m_detectorManager->addFolder("/Indet/Align");
m_detectorManager->addChannel("/Indet/Align/ID", 2, InDetDD::global);
m_detectorManager->addChannel("/Indet/Align/PIX", 1, InDetDD::global);
m_detectorManager->addChannel("/Indet/Align/PIXB1", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXB2", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXB3", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXB4", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXB5", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXEA1", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXEA2", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXEA3", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXEA4", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXEC1", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXEC2", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXEC3", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/Align/PIXEC4", 0, InDetDD::local);
m_detectorManager->addFolder("/Indet/AlignITk");
m_detectorManager->addChannel("/Indet/AlignITk/ID", 2, InDetDD::global);
m_detectorManager->addChannel("/Indet/AlignITk/PIX", 1, InDetDD::global);
m_detectorManager->addChannel("/Indet/AlignITk/PIXB1", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXB2", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXB3", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXB4", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXB5", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEA1", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEA2", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEA3", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEA4", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEA5", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEA6", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEA7", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEA8", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEC1", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEC2", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEC3", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEC4", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEC5", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEC6", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEC7", 0, InDetDD::local);
m_detectorManager->addChannel("/Indet/AlignITk/PIXEC8", 0, InDetDD::local);
}
// Check that there are no missing elements.
......
......@@ -453,6 +453,8 @@ PixelDetectorTool::registerCallback( StoreGateSvc* detStore)
else {
std::string folderName = "/Indet/Align";
// fast builder only used for ITk geometry, hence change the alignment folder
if (m_bFastBuildGeoModel) folderName = "/Indet/AlignITk";
if (detStore->contains<AlignableTransformContainer>(folderName)) {
if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endreq;
const DataHandle<AlignableTransformContainer> atc;
......
......@@ -303,7 +303,7 @@ InDetDD::AlignFolderType SCT_DetectorFactory::getAlignFolderType() const {
detStore()->contains<CondAttrListCollection>("/Indet/AlignL2/SCT") &&
detStore()->contains<AlignableTransformContainer>("/Indet/AlignL3") ) timedep_folderStruct = true;
if (detStore()->contains<AlignableTransformContainer>("/Indet/Align") ) static_folderStruct = true;
if (detStore()->contains<AlignableTransformContainer>("/Indet/AlignITk") ) static_folderStruct = true;
if (static_folderStruct && !timedep_folderStruct){
msg(MSG::INFO) << "Static run1 type alignment folder structure found" << endmsg;
......
......@@ -160,6 +160,7 @@ class SLHC_Setup :
pixelTool.Alignable = False
pixelTool.FastBuildGeoModel = True
pixelTool.ConfigGeoAlgTool = True
pixelTool.TweakIBLDist = False
pixelTool.ReadXMLFromDB = bReadXMLfromDB
pixelTool.ConfigGeoBase = "GeoPixelEnvelopeInclRefTool"
......
......@@ -3,8 +3,6 @@
# Job options
#
# This is for validation of ITk tracking geometry.
# Modified version of Tracking/TrkExtrapolation/TrkExUnitTests/share/ExtrapolationEngineTest_jobOptions.py. (TrkExUnitTests-00-00-08)
# See https://twiki.cern.ch/twiki/bin/view/Atlas/UpgradeSimulationInnerTrackerMigrationRel20p3p3#Validation_of_database_files
#==============================================================
#--------------------------------------------------------------
......@@ -25,22 +23,35 @@ import AthenaCommon.AtlasUnixGeneratorJob
from AthenaCommon.DetFlags import DetFlags
DetFlags.ID_setOn()
DetFlags.BCM_setOff()
DetFlags.Calo_setOff()
DetFlags.Muon_setOff()
# build GeoModel
#DetDescrVersion = "ATLAS-P2-ITK-22-02-00"
DetDescrVersion = "ATLAS-P2-ITK-23-00-03"
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetDescrVersion = DetDescrVersion
from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
TrkDetFlags.InDetBuildingOutputLevel = INFO
from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags
#SLHC_Flags.UseLocalGeometry = True
#from AthenaCommon.DetFlags import DetFlags
#DetFlags.geometry.HGTD_setOn()
#DetFlags.HGTD_setOn()
include("InDetSLHC_Example/preInclude.SLHC.py")
include("InDetSLHC_Example/preInclude.SiliconOnly.py")
include("InDetSLHC_Example/preInclude.SLHC_Setup.py")
include("InDetSLHC_Example/preInclude.SLHC_Setup_Strip_GMX.py")
# Full job is a list of algorithms
from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()
# build GeoModel
if 'DetDescrVersion' not in dir():
DetDescrVersion = 'ATLAS-P2-ITK-01-00-00'
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetDescrVersion = DetDescrVersion
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
......@@ -50,32 +61,14 @@ ServiceMgr += GeoModelSvc
GeoModelSvc.AtlasVersion = DetDescrVersion
from IOVDbSvc.CondDB import conddb
#conddb.setGlobalTag('OFLCOND-MC15c-SDR-14-03')
#ServiceMgr.EventSelector.RunNumber = 222222
conddb.setGlobalTag('OFLCOND-SIM-00-00-00')
# switch the material loading off
## Material information and AtlasTrackingGeometrySvc loaded here
from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
TrkDetFlags.PixelBuildingOutputLevel = INFO
TrkDetFlags.SCT_BuildingOutputLevel = INFO
TrkDetFlags.TRT_BuildingOutputLevel = INFO
TrkDetFlags.ConfigurationOutputLevel = INFO
TrkDetFlags.TRT_BuildStrawLayers = True
TrkDetFlags.SLHC_Geometry = True
TrkDetFlags.MaterialDatabaseLocal = True
if TrkDetFlags.MaterialDatabaseLocal() is True :
TrkDetFlags.MaterialSource = 'COOL'
TrkDetFlags.MaterialVersion = 17
TrkDetFlags.MaterialSubVersion = ""
# splitGeo = DetDescrVersion.split('-')
# TrkDetFlags.MaterialMagicTag = splitGeo[0] + '-' + splitGeo[1] + '-' + splitGeo[2]
TrkDetFlags.MaterialMagicTag = DetDescrVersion
TrkDetFlags.MaterialStoreGateKey = '/GLOBAL/TrackingGeo/LayerMaterialITK'
TrkDetFlags.MaterialDatabaseLocalPath = './'
TrkDetFlags.MaterialDatabaseLocalName = 'AtlasLayerMaterial-'+DetDescrVersion+'.db'
# load the tracking geometry service
from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc
#TrkDetFlags.MaterialSource = 'Input'
include("InDetSLHC_Example/SLHC_Setup_Reco_TrackingGeometry_GMX.py")
#--------------------------------------------------------------
# Event related parameters
......@@ -84,9 +77,9 @@ from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc
# Number of events to be processed (default is until the end of
# input, or -1, however, since we have no input, a limit needs
# to be set explicitly, here, choose 10)
theApp.EvtMax = 1 # 100
ExToolOutputLevel = VERBOSE # INFO #
ExAlgorithmOutputLevel = INFO #
theApp.EvtMax = 1000
ExToolOutputLevel = INFO #VERBOSE # INFO #
ExAlgorithmOutputLevel = INFO #VERBOSE # INFO #
from AthenaCommon.AppMgr import ServiceMgr
# output level
......@@ -106,8 +99,13 @@ from IOVDbSvc.CondDB import conddb
conddb.addOverride('/GLOBAL/BField/Map','BFieldMap-FullAsym-09-solTil3')
from TrkExEngine.AtlasExtrapolationEngine import AtlasExtrapolationEngine
ExtrapolationEninge = AtlasExtrapolationEngine(name='Extrapolation', nameprefix='Atlas', ToolOutputLevel=ExToolOutputLevel)
ToolSvc += ExtrapolationEninge
ExtrapolationEngine = AtlasExtrapolationEngine(name='Extrapolation', nameprefix='Atlas', ToolOutputLevel=ExToolOutputLevel)
ToolSvc += ExtrapolationEngine
from TrkValTools.TrkValToolsConf import Trk__PositionMomentumWriter as PmWriter
PmWriter = PmWriter()
ToolSvc += PmWriter
#--------------------------------------------------------------
# Algorithm setup
......@@ -116,28 +114,56 @@ ToolSvc += ExtrapolationEninge
# Add top algorithms to be run
from TrkExUnitTests.TrkExUnitTestsConf import Trk__ExtrapolationEngineTest
ExtrapolationEngineTest = Trk__ExtrapolationEngineTest('ExtrapolationEngineTest')
# how many tests you want per event
ExtrapolationEngineTest.NumberOfTestsPerEvent = 100
# parameters mode: 0 - neutral tracks, 1 - charged particles
ExtrapolationEngineTest.ParametersMode = 1
# do the full test backwards as well
ExtrapolationEngineTest.BackExtrapolation = False
# pT range for testing
ExtrapolationEngineTest.PtMin = 100000
ExtrapolationEngineTest.PtMax = 100000
# The test range in Eta
ExtrapolationEngineTest.EtaMin = -0.5
ExtrapolationEngineTest.EtaMax = 0.5
# Configure how you wanna run
ExtrapolationEngineTest.CollectSensitive = True
ExtrapolationEngineTest.CollectPassive = True
ExtrapolationEngineTest.CollectBoundary = True
# the path limit to test
ExtrapolationEngineTest.PathLimit = -1.
ExtrapolationEngineTest.ParametersMode = 1
# do the full test backwards as well
ExtrapolationEngineTest.BackExtrapolation = False
# Smear the production vertex - standard primary vertex paramters
ExtrapolationEngineTest.SmearOrigin = False
ExtrapolationEngineTest.SimgaOriginD0 = 2./3.
ExtrapolationEngineTest.SimgaOriginZ0 = 50.
ExtrapolationEngineTest.SmearFlatOriginZ0 = False
ExtrapolationEngineTest.Z0Min = -150.
ExtrapolationEngineTest.Z0Max = 150.
ExtrapolationEngineTest.Z0Values = [-150., 0., 150.]
ExtrapolationEngineTest.SmearFlatOriginD0 = False
ExtrapolationEngineTest.D0Min = -2.0
ExtrapolationEngineTest.D0Max = 2.0
# pT range for testing
ExtrapolationEngineTest.PtMin = 1000
ExtrapolationEngineTest.PtMax = 1000
# The test range in Eta
ExtrapolationEngineTest.EtaMin = -5.
ExtrapolationEngineTest.EtaMax = 5.
#ExtrapolationEngineTest.EtaMin = -2.0
#ExtrapolationEngineTest.EtaMax = 2.0
#ExtrapolationEngineTest.PhiMin = -0.5
#ExtrapolationEngineTest.PhiMax = 0.5
# Configure how you wanna run
ExtrapolationEngineTest.CollectSensitive = True
ExtrapolationEngineTest.CollectPassive = True
ExtrapolationEngineTest.CollectBoundary = True
ExtrapolationEngineTest.CollectMaterial = True
ExtrapolationEngineTest.UseHGTD = DetFlags.HGTD_on()
# the path limit to test
ExtrapolationEngineTest.PathLimit = -1.
# give it the engine
ExtrapolationEngineTest.ExtrapolationEngine = ExtrapolationEninge
ExtrapolationEngineTest.ExtrapolationEngine = ExtrapolationEngine
# validation tool
ExtrapolationEngineTest.PositionMomentumWriter = PmWriter
# output formatting
ExtrapolationEngineTest.OutputLevel = ExAlgorithmOutputLevel
ExtrapolationEngineTest.OutputLevel = ExAlgorithmOutputLevel
job += ExtrapolationEngineTest # 1 alg, named 'ExtrapolationEngineTest'
# Start VP1
# VP1 setup
#from VP1Algs.VP1AlgsConf import VP1Alg
#VP1Alg.InitiallyLoadedVP1Files = [ "myCookieVisualisation.vp1" ] ## Extra line from Sabine
#job += VP1Alg()
#################################################################
theApp.Dlls += [ 'RootHistCnv' ]
......@@ -162,11 +188,23 @@ if not hasattr(ServiceMgr, 'THistSvc'):
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
# add the G4 validation output stream
ServiceMgr.THistSvc.Output += [ "val DATAFILE='ExtrapolationEngineTest.root' TYPE='ROOT' OPT='RECREATE'" ]
ServiceMgr.THistSvc.Output += [ "val DATAFILE='ExtrapolationEngineTest_"+DetDescrVersion+"_mis.root' TYPE='ROOT' OPT='RECREATE'" ]
include("InDetSLHC_Example/postInclude.SLHC_Setup_ITK.py")
#include("InDetAlignGenAlgs/postInclude.loadMyLocalBD.py")
from AthenaCommon.ConfigurationShelve import saveToAscii;
saveToAscii("config_job.txt");
include("InDetSLHC_Example/postInclude.SLHC_Setup.py")
#==============================================================
#
# End of job options file
#
###############################################################
# VP1 setup
##from VP1Algs.VP1AlgsConf import VP1Alg
##VP1Alg.InitiallyLoadedVP1Files = [ "BasicVisualisationGeoModel.vp1" ] ## Extra line from Sabine
##job += VP1Alg()
......@@ -8,3 +8,4 @@ if SLHC_Flags.UseLocalGeometry():
SCT_GMX_DetectorTool.GmxFilename = "ITkStrip.gmx"
else:
SCT_GMX_DetectorTool.GmxFilename = ""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment