Skip to content
Snippets Groups Projects
Verified Commit 50021b28 authored by Tadej Novak's avatar Tadej Novak
Browse files

PixelConditionsAlgorithms: more flexibility to be able to run with ITk

parent c7a9bf01
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "PixelAlignCondAlg.h"
......@@ -28,7 +28,7 @@ StatusCode PixelAlignCondAlg::initialize()
ATH_CHECK(m_readKeyDynamicL1.initialize(m_useDynamicAlignFolders.value()));
ATH_CHECK(m_readKeyDynamicL2.initialize(m_useDynamicAlignFolders.value()));
ATH_CHECK(m_readKeyDynamicL3.initialize(m_useDynamicAlignFolders.value()));
ATH_CHECK(m_readKeyIBLDist.initialize());
ATH_CHECK(m_readKeyIBLDist.initialize(!m_readKeyIBLDist.empty()));
// Write Handles
ATH_CHECK(m_writeKey.initialize());
......@@ -36,7 +36,7 @@ StatusCode PixelAlignCondAlg::initialize()
// Register write handle
ATH_CHECK(m_condSvc->regHandle(this, m_writeKey));
ATH_CHECK(detStore()->retrieve(m_detManager, "Pixel"));
ATH_CHECK(detStore()->retrieve(m_detManager, m_detManagerName));
return StatusCode::SUCCESS;
}
......@@ -76,39 +76,40 @@ StatusCode PixelAlignCondAlg::execute(const EventContext& ctx) const
return StatusCode::FAILURE;
}
SG::ReadCondHandle<CondAttrListCollection> readHandleIBLDist{m_readKeyIBLDist, ctx};
const CondAttrListCollection* readCdoIBLDist{*readHandleIBLDist};
if (readCdoIBLDist==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object of " << readHandleIBLDist.key());
return StatusCode::FAILURE;
}
// ____________ Apply alignments to Pixel GeoModel ____________
// Construct Container for read CDO.
InDetDD::RawAlignmentObjects readCdoContainerStatic;
readCdoContainerStatic.emplace(m_readKeyStatic.key(), readCdoStatic);
ATH_CHECK(m_detManager->align(readCdoContainerStatic, writeCdo.get()));
// This absolutely needs to go last, since it relies on deltas from other alignment
// already be set in the alignment store!!!
InDetDD::RawAlignmentObjects readCdoContainerIBLDist;
readCdoContainerIBLDist.emplace(m_readKeyIBLDist.key(), readCdoIBLDist);
ATH_CHECK(m_detManager->align(readCdoContainerIBLDist, writeCdo.get()));
if (not readHandleStatic.range(rangeW)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleStatic.key());
return StatusCode::FAILURE;
}
EventIDRange rangeWIBL;
if (not readHandleIBLDist.range(rangeWIBL)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleIBLDist.key());
return StatusCode::FAILURE;
// IBL
if (!m_readKeyIBLDist.empty()) {
// This absolutely needs to go last, since it relies on deltas from other alignment
// already be set in the alignment store!!!
SG::ReadCondHandle<CondAttrListCollection> readHandleIBLDist{m_readKeyIBLDist, ctx};
const CondAttrListCollection* readCdoIBLDist{*readHandleIBLDist};
if (readCdoIBLDist==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object of " << readHandleIBLDist.key());
return StatusCode::FAILURE;
}
InDetDD::RawAlignmentObjects readCdoContainerIBLDist;
readCdoContainerIBLDist.emplace(m_readKeyIBLDist.key(), readCdoIBLDist);
ATH_CHECK(m_detManager->align(readCdoContainerIBLDist, writeCdo.get()));
EventIDRange rangeWIBL;
if (not readHandleIBLDist.range(rangeWIBL)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleIBLDist.key());
return StatusCode::FAILURE;
}
rangeW = EventIDRange::intersect(rangeW, rangeWIBL);
}
rangeW = EventIDRange::intersect(rangeW, rangeWIBL);
} else { // Dynamic
// ____________ Get Read Cond Object ____________
SG::ReadCondHandle<CondAttrListCollection> readHandleDynamicL1{m_readKeyDynamicL1, ctx};
......@@ -132,13 +133,6 @@ StatusCode PixelAlignCondAlg::execute(const EventContext& ctx) const
return StatusCode::FAILURE;
}
SG::ReadCondHandle<CondAttrListCollection> readHandleIBLDist{m_readKeyIBLDist, ctx};
const CondAttrListCollection* readCdoIBLDist{*readHandleIBLDist};
if (readCdoIBLDist==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object of " << readHandleIBLDist.key());
return StatusCode::FAILURE;
}
// ____________ Apply alignments to Pixel GeoModel ____________
// Construct Container for read CDO-s.
......@@ -154,12 +148,6 @@ StatusCode PixelAlignCondAlg::execute(const EventContext& ctx) const
readCdoContainerDynamicL3.emplace(m_readKeyDynamicL3.key(), readCdoDynamicL3);
ATH_CHECK(m_detManager->align(readCdoContainerDynamicL3, writeCdo.get()));
// This absolutely needs to go last, since it relies on deltas from other alignment
// already be set in the alignment store!!!
InDetDD::RawAlignmentObjects readCdoContainerIBLDist;
readCdoContainerIBLDist.emplace(m_readKeyIBLDist.key(), readCdoIBLDist);
ATH_CHECK(m_detManager->align(readCdoContainerIBLDist, writeCdo.get()));
// Define validity of the output cond object and record it
EventIDRange rangeWL1;
if (not readHandleDynamicL1.range(rangeWL1)) {
......@@ -179,15 +167,33 @@ StatusCode PixelAlignCondAlg::execute(const EventContext& ctx) const
return StatusCode::FAILURE;
}
EventIDRange rangeWIBL;
if (not readHandleIBLDist.range(rangeWIBL)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleIBLDist.key());
return StatusCode::FAILURE;
// IBL
if (!m_readKeyIBLDist.empty()) {
// This absolutely needs to go last, since it relies on deltas from other alignment
// already be set in the alignment store!!!
SG::ReadCondHandle<CondAttrListCollection> readHandleIBLDist{m_readKeyIBLDist, ctx};
const CondAttrListCollection* readCdoIBLDist{*readHandleIBLDist};
if (readCdoIBLDist==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object of " << readHandleIBLDist.key());
return StatusCode::FAILURE;
}
InDetDD::RawAlignmentObjects readCdoContainerIBLDist;
readCdoContainerIBLDist.emplace(m_readKeyIBLDist.key(), readCdoIBLDist);
ATH_CHECK(m_detManager->align(readCdoContainerIBLDist, writeCdo.get()));
EventIDRange rangeWIBL;
if (not readHandleIBLDist.range(rangeWIBL)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleIBLDist.key());
return StatusCode::FAILURE;
}
rangeW = EventIDRange::intersect(rangeWL1, rangeWL2, rangeWL3, rangeWIBL);
} else {
rangeW = EventIDRange::intersect(rangeWL1, rangeWL2, rangeWL3);
}
rangeW = EventIDRange::intersect(rangeWL1, rangeWL2, rangeWL3, rangeWIBL);
}
// Set (default) absolute transforms in alignment store by calling them.
for (const InDetDD::SiDetectorElement* oldEl: *oldColl) {
oldEl->getMaterialGeom()->getAbsoluteTransform(writeCdo.get());
......
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PIXELCONDITIONSALGORITHMS_PIXELALIGNCONDALG_H
......@@ -48,6 +48,8 @@ class PixelAlignCondAlg : public AthReentrantAlgorithm
this, "WriteKey", "PixelAlignmentStore", "Output pixel alignment data"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
StringProperty m_detManagerName{this, "DetManagerName", "Pixel", "Name of the DeterctorManager to retrieve"};
const InDetDD::PixelDetectorManager* m_detManager{nullptr};
};
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "PixelDetectorElementCondAlg.h"
......@@ -34,7 +34,7 @@ StatusCode PixelDetectorElementCondAlg::initialize()
ATH_CHECK(m_condSvc->regHandle(this, m_writeKey));
// We need the detector manager
ATH_CHECK(detStore()->retrieve(m_detManager, "Pixel"));
ATH_CHECK(detStore()->retrieve(m_detManager, m_detManagerName));
return StatusCode::SUCCESS;
}
......
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PIXELCONDITIONSALGORITHMS_PIXELDETECTORELEMENTCONDALG_H
......@@ -40,6 +40,8 @@ class PixelDetectorElementCondAlg : public AthReentrantAlgorithm
{this, "WriteKey", "PixelDetectorElementCollection", "Key of output SiDetectorElementCollection for Pixel"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
StringProperty m_detManagerName{this, "DetManagerName", "Pixel", "Name of the DeterctorManager to retrieve"};
const InDetDD::PixelDetectorManager* m_detManager{nullptr};
};
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.Enums import ProductionStep
from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline
def ITkPixelGeometryCfg(flags):
from AtlasGeoModel.GeoModelConfig import GeoModelCfg
......@@ -17,8 +18,32 @@ def ITkPixelGeometryCfg(flags):
ITkPixelDetectorTool.Alignable = False # make this a flag? Set true as soon as decided on folder structure
ITkPixelDetectorTool.DetectorName = "ITkPixel"
if flags.GeoModel.useLocalGeometry:
# Setting this filename triggers reading from local file rather than DB
ITkPixelDetectorTool.GmxFilename = flags.ITk.pixelGeometryFilename
# Setting this filename triggers reading from local file rather than DB
ITkPixelDetectorTool.GmxFilename = flags.ITk.pixelGeometryFilename
geoModelSvc.DetectorTools += [ ITkPixelDetectorTool ]
# Alignment corrections and DetElements to conditions
if flags.GeoModel.Align.Dynamic:
raise RuntimeError("ITk dynamic alignment not supported yet!")
else:
if flags.Common.Project != "AthSimulation" and (flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay):
acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align", className="AlignableTransformContainer"))
else:
acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align"))
if flags.Common.Project != "AthSimulation": # Protection for AthSimulation builds
if flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay:
PixelAlignCondAlg = CompFactory.PixelAlignCondAlg
pixelAlignCondAlg = PixelAlignCondAlg(name = "ITkPixelAlignCondAlg",
DetManagerName = "ITkPixel",
ReadKeyIBLDist = "",
WriteKey = "ITkPixelAlignmentStore",
UseDynamicAlignFolders = flags.GeoModel.Align.Dynamic)
acc.addCondAlgo(pixelAlignCondAlg)
PixelDetectorElementCondAlg = CompFactory.PixelDetectorElementCondAlg
pixelDetectorElementCondAlg = PixelDetectorElementCondAlg(name = "ITkPixelDetectorElementCondAlg",
DetManagerName = "ITkPixel",
ReadKey = "ITkPixelAlignmentStore",
WriteKey = "ITkPixelDetectorElementCollection")
acc.addCondAlgo(pixelDetectorElementCondAlg)
return acc
......@@ -12,43 +12,36 @@ def ITkStripGeometryCfg( flags ):
acc.addService(GeometryDBSvc("ITkGeometryDBSvc"))
StripDetectorTool=CompFactory.StripDetectorTool
ITkStripDetectorTool = StripDetectorTool()
#ITkStripDetectorTool.useDynamicAlignFolders = flags.GeoModel.Align.Dynamic #Will we need to do dynamic alignment for ITk?
# ITkStripDetectorTool.useDynamicAlignFolders = flags.GeoModel.Align.Dynamic #Will we need to do dynamic alignment for ITk?
ITkStripDetectorTool.Alignable = False # make this a flag? Set true as soon as decided on folder structure
ITkStripDetectorTool.DetectorName = "ITkStrip"
if flags.GeoModel.useLocalGeometry:
#Setting this filename triggers reading from local file rather than DB
ITkStripDetectorTool.GmxFilename = flags.ITk.stripGeometryFilename
# Setting this filename triggers reading from local file rather than DB
ITkStripDetectorTool.GmxFilename = flags.ITk.stripGeometryFilename
geoModelSvc.DetectorTools += [ ITkStripDetectorTool ]
#Alignment corrections and DetElements to conditions
# Alignment corrections and DetElements to conditions
if flags.GeoModel.Align.Dynamic:
raise RuntimeError("ITk dynamic alignment not supported yet!")
else:
if flags.Common.Project != "AthSimulation" and (flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay):
acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align", className="AlignableTransformContainer"))
else:
acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align"))
if flags.Common.Project != "AthSimulation": # Protection for AthSimulation builds
if flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay:
acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align",className="AlignableTransformContainer")) #Just load a single static folder for the moment - to be revisted with ITk-specific folders
SCT_AlignCondAlg=CompFactory.SCT_AlignCondAlg
SCT_AlignCondAlg = CompFactory.SCT_AlignCondAlg
ITkStripAlignCondAlg = SCT_AlignCondAlg(name = "ITkStripAlignCondAlg",
UseDynamicAlignFolders = flags.GeoModel.Align.Dynamic,
DetManagerName = "ITkStrip",
WriteKey = "ITkStripAlignmentStore")
WriteKey = "ITkStripAlignmentStore",
UseDynamicAlignFolders = flags.GeoModel.Align.Dynamic)
acc.addCondAlgo(ITkStripAlignCondAlg)
SCT_DetectorElementCondAlg=CompFactory.SCT_DetectorElementCondAlg
SCT_DetectorElementCondAlg = CompFactory.SCT_DetectorElementCondAlg
ITkStripDetectorElementCondAlg = SCT_DetectorElementCondAlg(name = "ITkStripDetectorElementCondAlg",
DetManagerName = "ITkStrip",
ReadKey = "ITkStripAlignmentStore",
WriteKey = "ITkStripDetectorElementCollection",
DetManagerName = "ITkStrip")
WriteKey = "ITkStripDetectorElementCollection")
acc.addCondAlgo(ITkStripDetectorElementCondAlg)
"""
# All this stuff probably needs revisting - comment for now...
if flags.GeoModel.Align.Dynamic:
acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL1/ID","/Indet/AlignL1/ID",className="CondAttrListCollection"))
acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL2/SCT","/Indet/AlignL2/SCT",className="CondAttrListCollection"))
acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL3","/Indet/AlignL3",className="AlignableTransformContainer"))
else:
if flags.Common.Project != "AthSimulation" and (flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay):
acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align",className="AlignableTransformContainer"))
else:
acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align"))
"""
return acc
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