Commit c9ee7559 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'master-calodd-p2' into 'master'

First version of the condition algorithm for applying LAr alignments to GeoModel

See merge request atlas/athena!45878
parents 73edeb68 211874bb
......@@ -234,10 +234,10 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
if(r_max < embElement->r()+0.5*embElement->dr())
r_max = embElement->r()+0.5*embElement->dr();
if(z_min > fabs(embElement->z_raw())-0.5*embElement->dz())
z_min = fabs(embElement->z_raw())-0.5*embElement->dz();
if(z_max < fabs(embElement->z_raw())+0.5*embElement->dz())
z_max = fabs(embElement->z_raw())+0.5*embElement->dz();
if(z_min > std::abs(embElement->z_raw())-0.5*embElement->dz())
z_min = std::abs(embElement->z_raw())-0.5*embElement->dz();
if(z_max < std::abs(embElement->z_raw())+0.5*embElement->dz())
z_max = std::abs(embElement->z_raw())+0.5*embElement->dz();
if(reg_min > embElement->eta()-0.5*embElement->deta())
reg_min = embElement->eta()-0.5*embElement->deta();
......@@ -258,7 +258,7 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
: embRegion->getDescriptor()->getEtaBinning().getStart();
double eta_max = (embRegion->getDescriptor()->getEtaBinning()).getEnd();
double phi_max = phi_min + std::fabs((embRegion->getDescriptor()->getPhiBinning()).getDelta())*embDescr->n_phi();
double phi_max = phi_min + std::abs((embRegion->getDescriptor()->getPhiBinning()).getDelta())*embDescr->n_phi();
// 'ideal' values
embDescr->setCaloEtaMin(eta_min);
......@@ -391,10 +391,10 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
if(r_max < emecElement->r()+0.5*emecElement->dr())
r_max = emecElement->r()+0.5*emecElement->dr();
if(z_min > fabs(emecElement->z_raw())-0.5*emecElement->dz())
z_min = fabs(emecElement->z_raw())-0.5*emecElement->dz();
if(z_max < fabs(emecElement->z_raw())+0.5*emecElement->dz())
z_max = fabs(emecElement->z_raw())+0.5*emecElement->dz();
if(z_min > std::abs(emecElement->z_raw())-0.5*emecElement->dz())
z_min = std::abs(emecElement->z_raw())-0.5*emecElement->dz();
if(z_max < std::abs(emecElement->z_raw())+0.5*emecElement->dz())
z_max = std::abs(emecElement->z_raw())+0.5*emecElement->dz();
if(reg_min > emecElement->eta()-0.5*emecElement->deta())
reg_min = emecElement->eta()-0.5*emecElement->deta();
......@@ -403,8 +403,8 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
// depths
if(iPhi==emecRegion->beginPhiIndex()) {
depth_in.push_back(fabs(emecElement->z_raw())-emecElement->dz());
depth_out.push_back(fabs(emecElement->z_raw())+emecElement->dz());
depth_in.push_back(std::abs(emecElement->z_raw())-emecElement->dz());
depth_out.push_back(std::abs(emecElement->z_raw())+emecElement->dz());
}
} // Eta loop
} // Phi loop
......@@ -412,7 +412,7 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
double eta_min = emecRegion->getDescriptor()->getEtaBinning().getStart();
double eta_max = emecRegion->getDescriptor()->getEtaBinning().getEnd();
double phi_max = phi_min + std::fabs(emecRegion->getDescriptor()->getPhiBinning().getDelta())*emecDescr->n_phi();
double phi_max = phi_min + std::abs(emecRegion->getDescriptor()->getPhiBinning().getDelta())*emecDescr->n_phi();
// 'ideal' values
emecDescr->setCaloEtaMin(eta_min);
......@@ -522,10 +522,10 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
if(r_max < cellPtr->getRMaxLocalNominal(HECCell::FRONT))
r_max = cellPtr->getRMaxLocalNominal(HECCell::FRONT);
if(z_min > fabs(hecElement->z_raw())-hecElement->dz())
z_min = fabs(hecElement->z_raw())-hecElement->dz();
if(z_max < fabs(hecElement->z_raw())+hecElement->dz())
z_max = fabs(hecElement->z_raw())+hecElement->dz();
if(z_min > std::abs(hecElement->z_raw())-hecElement->dz())
z_min = std::abs(hecElement->z_raw())-hecElement->dz();
if(z_max < std::abs(hecElement->z_raw())+hecElement->dz())
z_max = std::abs(hecElement->z_raw())+hecElement->dz();
if(reg_min > hecElement->eta()-0.5*hecElement->deta())
reg_min = hecElement->eta()-0.5*hecElement->deta();
......@@ -533,8 +533,8 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
reg_max = hecElement->eta()+0.5*hecElement->deta();
if(iPhi==hecregion->beginPhiIndex() && iEta==hecregion->beginEtaIndex()) {
depth_in.push_back(fabs(hecElement->z_raw())-hecElement->dz());
depth_out.push_back(fabs(hecElement->z_raw())+hecElement->dz());
depth_in.push_back(std::abs(hecElement->z_raw())-hecElement->dz());
depth_out.push_back(std::abs(hecElement->z_raw())+hecElement->dz());
}
}
......@@ -544,7 +544,7 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
double eta_min = hecregion->getDescriptor()->getEtaBinning().getStart();
double eta_max = hecregion->getDescriptor()->getEtaBinning().getEnd();
double phi_max = phi_min + std::fabs(hecregion->getDescriptor()->getPhiBinning().getDelta())*hecDescr->n_phi();
double phi_max = phi_min + std::abs(hecregion->getDescriptor()->getPhiBinning().getDelta())*hecDescr->n_phi();
// 'ideal' values
hecDescr->setCaloEtaMin(eta_min);
......@@ -645,26 +645,26 @@ StatusCode CaloMgrDetDescrCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pOb
caloMgr->add(fcalElement);
if(eta_min > std::fabs(fcalElement->eta_raw())-0.5*fcalElement->deta())
eta_min = std::fabs(fcalElement->eta_raw())-0.5*fcalElement->deta();
if(eta_max < std::fabs(fcalElement->eta_raw())+0.5*fcalElement->deta())
eta_max = std::fabs(fcalElement->eta_raw())+0.5*fcalElement->deta();
if(eta_min > std::abs(fcalElement->eta_raw())-0.5*fcalElement->deta())
eta_min = std::abs(fcalElement->eta_raw())-0.5*fcalElement->deta();
if(eta_max < std::abs(fcalElement->eta_raw())+0.5*fcalElement->deta())
eta_max = std::abs(fcalElement->eta_raw())+0.5*fcalElement->deta();
if(r_min > fcalElement->r() - 0.5*fcalElement->dr())
r_min = fcalElement->r() - 0.5*fcalElement->dr();
if(r_max < fcalElement->r() + 0.5*fcalElement->dr())
r_max = fcalElement->r() + 0.5*fcalElement->dr();
if(z_min > fabs(fcalElement->z_raw()) - 0.5*fcalElement->dz())
z_min = fabs(fcalElement->z_raw()) - 0.5*fcalElement->dz();
if(z_max < fabs(fcalElement->z_raw()) + 0.5*fcalElement->dz())
z_max = fabs(fcalElement->z_raw()) + 0.5*fcalElement->dz();
if(z_min > std::abs(fcalElement->z_raw()) - 0.5*fcalElement->dz())
z_min = std::abs(fcalElement->z_raw()) - 0.5*fcalElement->dz();
if(z_max < std::abs(fcalElement->z_raw()) + 0.5*fcalElement->dz())
z_max = std::abs(fcalElement->z_raw()) + 0.5*fcalElement->dz();
if(reg_min > fcalElement->eta()-0.5*fcalElement->deta())
reg_min = fcalElement->eta()-0.5*fcalElement->deta();
if(reg_max < fcalElement->eta()+0.5*fcalElement->deta())
reg_max = fcalElement->eta()+0.5*fcalElement->deta();
if(fcaltileIt==fcalmodule->beginTiles()) {
depth_in.push_back(std::fabs(fcalElement->z_raw()) - fcalElement->dz());
depth_out.push_back(std::fabs(fcalElement->z_raw()) + fcalElement->dz());
depth_in.push_back(std::abs(fcalElement->z_raw()) - fcalElement->dz());
depth_out.push_back(std::abs(fcalElement->z_raw()) + fcalElement->dz());
}
}
......
......@@ -16,7 +16,8 @@
#define CALOREC_CALOCELLPOSITIONSHIFT_H
#include "AthenaKernel/CLASS_DEF.h"
#include "AthenaKernel/CLASS_DEF.h"
#include "AthenaKernel/CondCont.h"
#include <vector>
namespace CaloRec {
......@@ -75,5 +76,6 @@ class CaloCellPositionShift
}// end namespace
CLASS_DEF(CaloRec::CaloCellPositionShift,96609121,1)
CONDCONT_DEF(CaloRec::CaloCellPositionShift,219045687);
#endif
/*
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 DETDESCRCOND_KEYTRANS_H
#define DETDESCRCOND_KEYTRANS_H
// DetCondKeyTrans.h - class to hold set of HepGeom::Transform3D keyed by string
// value for storage in the conditions DB
// typically for holding top-level transforms for GeoModel/G4
// This class can be persistified (converters in DetDescrCondAthenaPool)
//
// Richard Hawkings, started 23/6/05
#ifndef DETDESCRCONDITIONS_DETCONDKEYTRANS_H
#define DETDESCRCONDITIONS_DETCONDKEYTRANS_H
/**
* @file DetCondKeyTrans.h
*
* @class DetCondKeyTrans
*
* @brief Class to hold set of HepGeom::Transform3D keyed by string
* value for storage in the conditions DB typically for holding top-level transforms
* for GeoModel/G4. This class can be persistified (converters in DetDescrCondAthenaPool)
*
* @author Richard Hawkings, started 23/6/05
*
**/
#include <string>
#include <map>
#include "CLHEP/Geometry/Transform3D.h"
#include "AthenaKernel/CLASS_DEF.h"
#include "AthenaKernel/CondCont.h"
class DetCondKeyTrans {
public:
......@@ -44,6 +52,7 @@ private:
};
CLASS_DEF(DetCondKeyTrans,254546453,1)
CONDCONT_DEF( DetCondKeyTrans , 116888117 );
// iterator declaration for SEAL dictionary
// removed - perhaps will not be needed for reflex, causes problem for gcc344
......
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( LArAlignmentAlgs )
......@@ -7,7 +7,7 @@ atlas_subdir( LArAlignmentAlgs )
atlas_add_component( LArAlignmentAlgs
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel DetDescrConditions RegistrationServicesLib )
LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel DetDescrConditions RegistrationServicesLib GeoModelUtilities LArGeoCode )
# Install files from the package:
atlas_install_joboptions( share/*.py )
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "LArAlignCondAlg.h"
#include "GeoModelKernel/GeoAlignableTransform.h"
#include "GeoModelUtilities/GeoAlignmentStore.h"
#include <memory>
StatusCode LArAlignCondAlg::initialize()
{
ATH_MSG_DEBUG("initialize " << name());
ATH_CHECK(m_condSvc.retrieve());
ATH_CHECK(m_readKey.initialize());
ATH_CHECK(m_writeKey.initialize());
// Register Write Cond Handle
if(m_condSvc->regHandle(this, m_writeKey).isFailure()) {
ATH_MSG_ERROR("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
StatusCode LArAlignCondAlg::execute(const EventContext& ctx) const
{
// ____________ Construct Write Cond Handle and check its validity ____________
SG::WriteCondHandle<GeoAlignmentStore> writeHandle{m_writeKey,ctx};
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("Found valid write handle");
return StatusCode::SUCCESS;
}
// ____________ Get Read Cond Object ____________
SG::ReadCondHandle<DetCondKeyTrans> readHandle{m_readKey,ctx};
const DetCondKeyTrans* readCdo{*readHandle};
if(!readCdo) {
ATH_MSG_ERROR("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG("Retrieved DetCondKeyTrans object form the Condition Store");
writeHandle.addDependency(readHandle);
// ____________ Construct new Write Cond Object and apply alignments ____________
std::unique_ptr<GeoAlignmentStore> writeCdo = std::make_unique<GeoAlignmentStore>();
if(m_alignHelper.applyAlignments(detStore(),readCdo,writeCdo.get()).isFailure()) {
ATH_MSG_ERROR("Failed to apply LAr alignments");
return StatusCode::FAILURE;
}
ATH_CHECK(writeHandle.record(std::move(writeCdo)));
ATH_MSG_INFO("recorded new GeoAlignmentStore object for LAr with key " << writeHandle.key()
<< " and range " << writeHandle.getRange());
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef LARALIGNMENTALGS_LARALIGNCONDALG_H
#define LARALIGNMENTALGS_LARALIGNCONDALG_H
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ICondSvc.h"
#include "DetDescrConditions/DetCondKeyTrans.h"
#include "GeoModelUtilities/GeoAlignmentStore.h"
#include "GeoModelUtilities/StoredAlignX.h"
#include "LArGeoCode/LArAlignHelper.h"
/**
* @class LArAlignCondAlg
*
* @brief Condition Algorithm for applying LAr Alignments
*
**/
class LArAlignCondAlg final : public AthReentrantAlgorithm
{
public:
using AthReentrantAlgorithm::AthReentrantAlgorithm;
virtual ~LArAlignCondAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode finalize() override {return StatusCode::SUCCESS;};
private:
SG::ReadCondHandleKey<DetCondKeyTrans> m_readKey {this
, "LArAlignFolder"
, "/LAR/Align"
, "SG key of DetCondKeyTrans object with LAr alignments" };
SG::WriteCondHandleKey<GeoAlignmentStore> m_writeKey {this
, "LArAlignmentStore"
, "LArAlignmentStore"
, "SG key of the resulting GeoAlignmentStore for LAr" };
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
LArAlignHelper m_alignHelper;
};
#endif
#include "../LArAlignDbAlg.h"
#include "../LArAlignCondAlg.h"
DECLARE_COMPONENT( LArAlignDbAlg )
DECLARE_COMPONENT( LArAlignCondAlg )
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
#Job options needed to enable LAr alignment
from IOVDbSvc.CondDB import conddb
if conddb.isMC:
#Monte Carlo case:
conddb.addFolder("LAR_OFL","/LAR/Align")
conddb.addFolder("LAR_OFL","/LAR/LArCellPositionShift")
else:
#Regular offline data processing
conddb.addFolder("LAR_ONL","/LAR/Align")
conddb.addFolder("LAR_ONL","/LAR/LArCellPositionShift")
#Job options needed to enable LAr alignment
from AthenaCommon.DetFlags import DetFlags
import os
activateCondAlgs = (not DetFlags.simulate.any_on() or DetFlags.overlay.any_on()) and "AthSimulation_DIR" not in os.environ
from IOVDbSvc.CondDB import conddb
if conddb.isMC:
#Monte Carlo case:
if activateCondAlgs:
conddb.addFolder("LAR_OFL","/LAR/Align",className="DetCondKeyTrans")
conddb.addFolder("LAR_OFL","/LAR/LArCellPositionShift",className="CaloRec::CaloCellPositionShift")
else:
conddb.addFolder("LAR_OFL","/LAR/Align")
conddb.addFolder("LAR_OFL","/LAR/LArCellPositionShift")
else:
#Regular offline data processing
conddb.addFolder("LAR_ONL","/LAR/Align",className="DetCondKeyTrans")
conddb.addFolder("LAR_ONL","/LAR/LArCellPositionShift",className="CaloRec::CaloCellPositionShift")
if activateCondAlgs:
from AthenaCommon.AlgSequence import AthSequencer
condSeq = AthSequencer("AthCondSeq")
if not hasattr(condSeq,"LArAlignCondAlg"):
from LArAlignmentAlgs.LArAlignmentAlgsConf import LArAlignCondAlg
condSeq += LArAlignCondAlg("LArAlignCondAlg")
#Job options needed to enable LAr alignment
include("DetDescrCondAthenaPool/DetDescrCondAthenaPool_joboptions.py" )
from IOVDbSvc.CondDB import conddb
if conddb.isMC:
#Monte Carlo case:
conddb.addFolder("LAR_OFL","/LAR/Align")
conddb.addFolder("LAR_OFL","/LAR/LArCellPositionShift")
else:
#Regular offline data processing
conddb.addFolder("LAR_ONL","/LAR/Align")
conddb.addFolder("LAR_ONL","/LAR/LArCellPositionShift")
print "including share/LArAlignable"
......@@ -248,17 +248,10 @@ StatusCode LArDetectorToolNV::registerCallback()
return StatusCode::FAILURE;
}
std::string folderName = "/LAR/Align";
const DataHandle<DetCondKeyTrans> dckt;
ATH_MSG_DEBUG("Registering callback on DetCondKeyTrans with folder " << folderName);
StatusCode sc = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), dckt, folderName);
if(sc.isSuccess()) {
ATH_MSG_DEBUG(" Successfully registered ");
}
else {
ATH_MSG_DEBUG(" Registration failed ");
}
StatusCode sc = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), dckt, LAR_ALIGN);
ATH_MSG_DEBUG( (sc.isSuccess() ? "Successfully registered" : "Registration failed for")
<< " callback on DetCondKeyTrans with folder " << LAR_ALIGN);
return sc;
}
......@@ -270,40 +263,13 @@ StatusCode LArDetectorToolNV::align(IOVSVC_CALLBACK_ARGS)
return StatusCode::SUCCESS;
}
std::vector<std::string> alignNames {
"LARCRYO_B"
,"LARCRYO_EC_POS"
,"LARCRYO_EC_NEG"
,"PRESAMPLER_B_POS"
,"PRESAMPLER_B_NEG"
,"EMB_POS"
,"EMB_NEG"
,"PRESAMPLER_EC_POS"
,"PRESAMPLER_EC_NEG"
,"EMEC_POS"
,"EMEC_NEG"
,"HEC_POS" // Policy: either HEC_POS is present or HEC1_POS and HEC2_POS
,"HEC_NEG" // Same with HEC_NEG. Now in recent releases if HEC_POS is found
,"HEC1_POS" // it will be applied to both HEC1 and HEC2...
,"HEC1_NEG"
,"HEC2_POS"
,"HEC2_NEG"
,"FCAL1_POS"
,"FCAL1_NEG"
,"FCAL2_POS"
,"FCAL2_NEG"
,"FCAL3_POS"
,"FCAL3_NEG"
,"SOLENOID"
};
if(m_manager==nullptr) {
ATH_MSG_ERROR(" LArDetDescrManager not created yet, cannot align !");
return StatusCode::FAILURE;
}
const DetCondKeyTrans* align=0;
if(detStore()->contains<DetCondKeyTrans>(LAR_ALIGN)) {
const DetCondKeyTrans* align{nullptr};
StatusCode sc = detStore()->retrieve(align, LAR_ALIGN);
if(sc.isFailure()) {
......@@ -311,144 +277,22 @@ StatusCode LArDetectorToolNV::align(IOVSVC_CALLBACK_ARGS)
return sc;
}
if(0 == align) {
ATH_MSG_ERROR(" LAr DetCondKeyTrans ptr is 0");
if(align==nullptr) {
ATH_MSG_ERROR("LAr DetCondKeyTrans ptr is null");
return StatusCode::FAILURE;
}
ATH_MSG_DEBUG(" LAr DetCondKeyTrans retrieved ");
// Special treatment for the HEC:
StoredAlignX *hec1AlxPos{nullptr};
StoredAlignX *hec2AlxPos{nullptr};
StoredAlignX *hec1AlxNeg{nullptr};
StoredAlignX *hec2AlxNeg{nullptr};
if (detStore()->contains<StoredAlignX> ("HEC1_POS")) {
if (detStore()->retrieve(hec1AlxPos,"HEC1_POS")!=StatusCode::SUCCESS) {
ATH_MSG_WARNING(" Unable to retrieve StoredAlignX for the key HEC1_POS");
}
}
if (detStore()->contains<StoredAlignX> ("HEC1_NEG")) {
if (detStore()->retrieve(hec1AlxNeg,"HEC1_NEG")!=StatusCode::SUCCESS) {
ATH_MSG_WARNING(" Unable to retrieve StoredAlignX for the key HEC1_NEG");
}
}
if (detStore()->contains<StoredAlignX> ("HEC2_POS")) {
if (detStore()->retrieve(hec2AlxPos,"HEC2_POS")!=StatusCode::SUCCESS) {
ATH_MSG_WARNING(" Unable to retrieve StoredAlignX for the key HEC2_POS");
}
}
if (detStore()->contains<StoredAlignX> ("HEC2_NEG")) {
if (detStore()->retrieve(hec2AlxNeg,"HEC2_NEG")!=StatusCode::SUCCESS) {
ATH_MSG_WARNING(" Unable to retrieve StoredAlignX for the key HEC2_NEG");
}
if(m_alignHelper.applyAlignments(detStore(),align,nullptr).isFailure()) {
ATH_MSG_ERROR("Failed to apply LAr alignments to GeoModel");
return StatusCode::FAILURE;
}
GeoAlignableTransform *hec1GatPos = hec1AlxPos ? hec1AlxPos->getAlignX(): nullptr;
GeoAlignableTransform *hec1GatNeg = hec1AlxPos ? hec1AlxNeg->getAlignX(): nullptr;
GeoAlignableTransform *hec2GatPos = hec2AlxPos ? hec2AlxPos->getAlignX(): nullptr;
GeoAlignableTransform *hec2GatNeg = hec2AlxPos ? hec2AlxNeg->getAlignX(): nullptr;
// loop over align names
// if the transform presented alter its delta
// if the transform is not presented clear its delta
for(unsigned int i=0; i<alignNames.size(); i++) {
std::string alignName = alignNames[i];
HepGeom::Transform3D newDelta;
// First try to retrieve StoredAlignX
if(detStore()->contains<StoredAlignX>(alignName)) {
StoredAlignX* alignX{nullptr};
sc = detStore()->retrieve(alignX,alignName);
if(sc.isFailure()) {
ATH_MSG_ERROR(" Unable to retrieve StoredAlignX for the key " << alignName);
return sc;
}
if(!alignX) {
ATH_MSG_ERROR(" 0 pointer to StoredAlignX for the key " << alignName);
return StatusCode::FAILURE;
}
GeoAlignableTransform* gat = alignX->getAlignX();
if(!gat) {
ATH_MSG_ERROR(" 0 pointer to GeoAlignableTransform for the key " << alignName);
return StatusCode::FAILURE;
}
// check existence of new delta in DetCondKeyTrans
if(align->getTransform(alignName,newDelta)) {
gat->setDelta(Amg::CLHEPTransformToEigen(newDelta));
}
else {
gat->clearDelta();
}
}
else if (alignName=="HEC_POS") {
if (hec1GatPos) {
if(align->getTransform(alignName,newDelta)) {
hec1GatPos->setDelta(Amg::CLHEPTransformToEigen(newDelta));
}
else {
hec1GatPos->clearDelta();
}
}
if (hec2GatPos) {
if(align->getTransform(alignName,newDelta)) {
hec2GatPos->setDelta(Amg::CLHEPTransformToEigen(newDelta));
}
else {
hec2GatPos->clearDelta();
}
}
}
else if (alignName=="HEC_NEG") {
if (hec1GatNeg) {
if(align->getTransform(alignName,newDelta)) {
hec1GatNeg->setDelta(Amg::CLHEPTransformToEigen(newDelta));
}
else {
hec1GatNeg->clearDelta();
}
}
if (hec2GatNeg) {
if(align->getTransform(alignName,newDelta)) {
hec2GatNeg->setDelta(Amg::CLHEPTransformToEigen(newDelta));
}
else {
hec2GatNeg->clearDelta();
}
}