Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • andesai/calypso
  • sazhang/calypso
  • yuxu/calypso
  • wfilali/calypso
  • bewilson/calypso
  • ovaldesm/calypso
  • xai/calypso
  • ymaruya/calypso
  • anburger/calypso
  • seley/calypso
  • sudatta/calypso
  • notarann/calypso
  • hhjelm/calypso
  • tarai/calypso
  • lmccoy/calypso
  • agarabag/calypso
  • fneuhaus/calypso
  • vlian/calypso
  • yechou/calypso
  • vlian/calypso-official
  • fasermc/calypso
  • schsu/calypso
  • maprim/calypso
  • cantel/calypso
  • jwspence/calypso
  • diwang/calypso
  • ccavanag/calypso
  • gwilliam/calypso
  • asalman/calypso
  • toinada/calypso
  • jboyd/calypso
  • abarkley/calypso
  • yafik/calypso
  • cpandini/calypso
  • tboeckh/calypso
  • sshively/calypso
  • keli/calypso
  • dfellers/calypso
  • torrence/calypso
  • coccaro/calypso
  • dcasper/calypso
  • faser/calypso
42 results
Show changes
Commits on Source (3)
Showing
with 1251 additions and 62 deletions
......@@ -32,5 +32,5 @@ atlas_add_test( GeoModelCheck
# Install files from the package:
#atlas_install_headers( GeoModelTest )
atlas_install_joboptions( share/*.py )
#atlas_install_joboptions( share/*.py )
atlas_install_python_modules( python/*.py )
#!/usr/bin/env python
import sys
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
def GeoModelTestCfg(flags):
......@@ -20,7 +19,7 @@ def GeoModelTestCfg(flags):
if __name__ == "__main__":
# 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
......@@ -28,6 +27,8 @@ if __name__ == "__main__":
# Flag definition
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
......@@ -46,6 +47,7 @@ if __name__ == "__main__":
acc = MainServicesSerialCfg()
# acc.merge(PoolReadCfg(ConfigFlags))
acc.merge(GeoModelTestCfg(ConfigFlags))
acc.getService("PoolSvc").SortReplicas = False # protects against random failures to find sqlite file
# logging.getLogger('forcomps').setLevel(VERBOSE)
# acc.foreach_component("*").OutputLevel = VERBOSE
# acc.foreach_component("*ClassID*").OutputLevel = INFO
......
MessageSvc.OutputLevel = VERBOSE
from AthenaCommon.GlobalFlags import globalflags
globalflags.DetDescrVersion.set_Value_and_Lock( "FASER-00" )
#globalflags.ConditionsTag.set_Value_and_Lock( "OFLCOND-MC16-SDR-14" )
#from IOVDbSvc.CondDB import conddb
#conddb.setGlobalTag(globalflags.ConditionsTag())
#from AthenaCommon.DetFlags import DetFlags
#DetFlags.geometry.SCT_setOn()
#DetFlags.detdescr.SCT_setOn()
#include('ISF_Config/AllDet_detDescr.py')
from FaserGeoModel import SetGeometryVersion
from FaserGeoModel import GeoModelInit
from GeoModelSvc.GeoModelSvcConf import GeoModelSvc
GeoModelSvc = GeoModelSvc()
GeoModelSvc.PrintMaterials = True
GeoModelSvc.GeoExportFile = "faserGeo.db"
#DetFlags.Print()
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
from GeoModelTest.GeoModelTestConf import GeoModelTestAlg
topSequence += GeoModelTestAlg()
from AthenaCommon.AppMgr import theApp
theApp.EvtMax = 1
# Uses SQLite by default (if available)
# These lines suppress SQLite for geometry
#from DBReplicaSvc.DBReplicaSvcConf import DBReplicaSvc
#
#DBReplicaSvc.UseGeomSQLite = False
# This only affects conditions, not geometry
#include('PyJobTransforms/UseFrontier.py')
# Quiet some very spammy (on VERBOSE) components we don't care about
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
svcMgr.ClassIDSvc.OutputLevel = INFO
svcMgr.AthenaSealSvc.OutputLevel = INFO
svcMgr.IncidentSvc.OutputLevel = INFO
......@@ -6,4 +6,14 @@
<service name="sqlite_file:DetectorDescription/GeoModel/FaserGeoModel/geomDB_sqlite" accessMode="read" />
</logicalservice>
<logicalservice name="COOLOFL_SCT">
<service name="sqlite_file:data/ALLP200.db" accessMode="read" />
<service name="sqlite_file:Tracker/TrackerConditions/FaserSCT_ConditionsData/ALLP200.db" accessMode="read" />
</logicalservice>
<logicalservice name="COOLOFL_DCS">
<service name="sqlite_file:data/ALLP200.db" accessMode="read" />
<service name="sqlite_file:Tracker/TrackerConditions/FaserSCT_ConditionsData/ALLP200.db" accessMode="read" />
</logicalservice>
</servicelist>
......@@ -319,6 +319,7 @@ INSERT INTO "HVS_NODE" VALUES (213, "SctFaserGeneral", 21, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (214, "SctSwitches", 21, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (215, "SCTMaterials", 21, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (216, "SCTMatComponents", 21, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (217, "SctConditions", 21, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (220, "DipoleTopLevel", 22, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (221, "DipoleGeneral", 22, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (224, "DipoleSwitches", 22, 0, NULL);
......@@ -356,6 +357,7 @@ INSERT INTO "HVS_TAG2NODE" VALUES (213, "SctFaserGeneral-00", 106789, NULL, 0, 0
INSERT INTO "HVS_TAG2NODE" VALUES (214, "SctSwitches-00", 107782, NULL, 0, 0, 1567987200000000000, NULL, 22);
INSERT INTO "HVS_TAG2NODE" VALUES (215, "SctMaterials-00", 107777, NULL, 0, 0, 1567987200000000000, NULL, 22);
INSERT INTO "HVS_TAG2NODE" VALUES (216, "SctMatComponents-00", 107778, NULL, 0, 0, 1567987200000000000, NULL, 22);
INSERT INTO "HVS_TAG2NODE" VALUES (217, "SctConditions-00", 107779, NULL, 0, 0, 1579564800000000000, NULL, 22);
INSERT INTO "HVS_TAG2NODE" VALUES (220, "DipoleTopLevel-00", 100029, NULL, 0, 0, 1568678400000000000, NULL, 22);
INSERT INTO "HVS_TAG2NODE" VALUES (221, "DipoleGeneral-00", 100004, NULL, 0, 0, 1568678400000000000, NULL, 22);
INSERT INTO "HVS_TAG2NODE" VALUES (224, "DipoleSwitches-00", 100028, NULL, 0, 0, 1568678400000000000, NULL, 22);
......@@ -404,6 +406,7 @@ INSERT INTO "HVS_LTAG2LTAG" VALUES (21, 100026, 213, 106789);
INSERT INTO "HVS_LTAG2LTAG" VALUES (21, 100026, 214, 107782);
INSERT INTO "HVS_LTAG2LTAG" VALUES (21, 100026, 215, 107777);
INSERT INTO "HVS_LTAG2LTAG" VALUES (21, 100026, 216, 107778);
INSERT INTO "HVS_LTAG2LTAG" VALUES (21, 100026, 217, 107779);
INSERT INTO "HVS_LTAG2LTAG" VALUES (2, 100002, 22, 100027);
INSERT INTO "HVS_LTAG2LTAG" VALUES (22, 100027, 220, 100029);
INSERT INTO "HVS_LTAG2LTAG" VALUES (22, 100027, 221, 100004);
......@@ -430,6 +433,7 @@ INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "SctFaserGeneral", "SCTFaserGe
INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "SctSwitches", "SCTSwitches-00", 107782);
INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "SCTMaterials", "SCTMaterials-00", 107777);
INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "SCTMatComponents", "SCTMatComponents-00", 107778);
INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "SctConditions", "SctConditions-00", 107779);
INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "Dipole", "Dipole-00", 100027);
INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "DipoleTopLevel", "DipoleTopLevel-00", 100029);
INSERT INTO "HVS_TAGCACHE" VALUES ("FASER-00", "DipoleGeneral", "DipoleGeneral-00", 100004);
......@@ -1092,6 +1096,14 @@ CREATE TABLE "SCTSWITCHES_DATA2TAG" ( "SCTSWITCHES_TAG_ID" SLONGLONG ,"SCTSWITCH
INSERT INTO "SCTSWITCHES_DATA2TAG" VALUES(107782,0);
--
--
DROP TABLE IF EXISTS "SCTCONDITIONS_DATA";
CREATE TABLE "SCTCONDITIONS_DATA" ( "SCTCONDITIONS_DATA_ID" SLONGLONG, "TEMPERATURE" DOUBLE, "BIASVOLT" DOUBLE, "DEPLETIONVOLT" DOUBLE, "USECONDDB" INT, UNIQUE ( "SCTCONDITIONS_DATA_ID" ) );
INSERT INTO "SCTCONDITIONS_DATA" VALUES(0, 4.6, 70.0, 150.0, 0);
DROP TABLE IF EXISTS "SCTCONDITIONS_DATA2TAG";
CREATE TABLE "SCTCONDITIONS_DATA2TAG" ( "SCTCONDITIONS_TAG_ID" SLONGSLONG , "SCTCONDITIONS_DATA_ID" SLONGLONG );
INSERT INTO "SCTCONDITIONS_DATA2TAG" VALUES(107779, 0);
--
--
DROP TABLE IF EXISTS "DIPOLESWITCHES_DATA";
CREATE TABLE "DIPOLESWITCHES_DATA" ( "DIPOLESWITCHES_DATA_ID" SLONGLONG ,"DETECTORNAME" TEXT ,"G3COMPATIBLE" INT ,"G3DIGITSCOMPATIBLE" INT ,"DC2GEOMETRY" INT ,"USEMAGFIELDSVC" INT ,"COSMICLAYOUT" INT ,"VERSIONNAME" TEXT ,"LAYOUT" TEXT ,"DESCRIPTION" TEXT , UNIQUE ( "DIPOLESWITCHES_DATA_ID" ) );
INSERT INTO "DIPOLESWITCHES_DATA" VALUES(0,'Dipole',0,0,0,1,0,'GEO','Prelim','Faser Geometry 2019');
......
......@@ -28,11 +28,11 @@ def MagneticFieldSvcCfg(flags, **kwargs):
result=ComponentAccumulator()
# initialise required conditions DB folders
# from IOVDbSvc.IOVDbSvcConfig import addFolders
from IOVDbSvc.IOVDbSvcConfig import addFolders
# # This handles addFolderSplitMC https://gitlab.cern.ch/atlas/athena/blob/master/Database/IOVDbSvc/python/CondDB.py#L240
# # i.e. replaces conddb.addFolderSplitMC('GLOBAL','/GLOBAL/BField/Maps <noover/>','/GLOBAL/BField/Maps <noover/>')
# # def addFolders(configFlags,folderstrings,detDb=None,className=None):
# This handles addFolderSplitMC https://gitlab.cern.ch/atlas/athena/blob/master/Database/IOVDbSvc/python/CondDB.py#L240
# i.e. replaces conddb.addFolderSplitMC('GLOBAL','/GLOBAL/BField/Maps <noover/>','/GLOBAL/BField/Maps <noover/>')
# def addFolders(configFlags,folderstrings,detDb=None,className=None):
# if flags.Input.isMC:
# db='GLOBAL_OFL'
# else:
......@@ -40,9 +40,14 @@ def MagneticFieldSvcCfg(flags, **kwargs):
# result.merge(addFolders(flags,['/GLOBAL/BField/Maps <noover/>'],detDb=db) )
# if not flags.Common.isOnline:
# result.merge(addFolders(flags, ['/EXT/DCS/MAGNETS/SENSORDATA'], detDb='DCS_OFL', className="CondAttrListCollection") )
if not flags.Common.isOnline:
result.merge(addFolders(flags, ['/EXT/DCS/MAGNETS/SENSORDATA'], detDb='DCS_OFL', className="CondAttrListCollection") )
# if flags.Common.isOnline:
# kwargs.setdefault( "UseDCS", False )
# else:
# kwargs.setdefault( "UseDCS", True )
mag_field_svc = GetFieldSvc("FaserFieldSvc",**kwargs)
result.addService(mag_field_svc,primary=True)
return result
......
......@@ -129,6 +129,8 @@ 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
#
......
###############################################################################
# Package: FaserSCT_ConditionsAlgorithms
################################################################################
# Declare the package name:
atlas_subdir( FaserSCT_ConditionsAlgorithms )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
Control/AthenaKernel
Control/StoreGate
Database/AthenaPOOL/AthenaPoolUtilities
DetectorDescription/Identifier
DetectorDescription/DetDescrCond/DetDescrConditions
DetectorDescription/GeoModel/GeoModelUtilities
DetectorDescription/GeoModel/GeoModelFaserUtilities
DetectorDescription/GeoPrimitives
GaudiKernel
InnerDetector/InDetConditions/InDetConditionsSummaryService
Tracker/TrackerConditions/FaserSCT_ConditionsData
InnerDetector/InDetConditions/SCT_ConditionsTools
InnerDetector/InDetDetDescr/SCT_Cabling
PRIVATE
Tracker/TrackerDetDescr/TrackerIdentifier
Tracker/TrackerDetDescr/TrackerReadoutGeometry
Tracking/TrkDetDescr/TrkGeometry )
# External dependencies:
find_package( Boost COMPONENTS filesystem thread system )
# Component(s) in the package:
atlas_add_component( FaserSCT_ConditionsAlgorithms
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier DetDescrConditions GeoModelUtilities GeoModelFaserUtilities GaudiKernel FaserSCT_ConditionsData SCT_CablingLib AthenaPoolUtilities TrackerIdentifier TrackerReadoutGeometry TrkGeometry SCT_ConditionsToolsLib )
#atlas_add_test( TestCalibChipRead
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testCalibChipRead.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestCalibRead
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testCalibRead.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestConfig
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testConfig.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestDCSConditions
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testDCSConditions.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestLinkMasking
# SCRIPT share/TestLinkMasking.sh
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestMajority
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testMajority.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestModuleVeto
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testModuleVeto.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestMonRead
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testMonRead.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestParameters
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testParameters.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestReadout
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testReadout.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestRodVeto
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testRodVeto.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestSensors
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testSensors.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestSilicon
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testSilicon.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestStripVeto
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testStripVeto.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestSummary
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testSummary.py
# PROPERTIES TIMEOUT 600
# ENVIRONMENT THREADS=5 )
#atlas_add_test( TestTdaqEnabled
# SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testTdaqEnabled.py
# PROPERTIES TIMEOUT 720
# ENVIRONMENT THREADS=5 )
# Install files from the package:
atlas_install_joboptions( share/*.py )
atlas_install_python_modules( python/*.py )
atlas_install_scripts( share/*.sh )
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "FaserSCT_AlignCondAlg.h"
#include "TrackerReadoutGeometry/SCT_DetectorManager.h"
#include "TrackerReadoutGeometry/SiDetectorElement.h"
#include <memory>
FaserSCT_AlignCondAlg::FaserSCT_AlignCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthAlgorithm(name, pSvcLocator)
, m_writeKey{"SCTAlignmentStore", "SCTAlignmentStore"}
{
declareProperty("WriteKey", m_writeKey);
}
StatusCode FaserSCT_AlignCondAlg::initialize()
{
ATH_MSG_DEBUG("initialize " << name());
// CondSvc
ATH_CHECK(m_condSvc.retrieve());
// Read Handles
// Static
ATH_CHECK(m_readKeyStatic.initialize(!m_useDynamicAlignFolders.value()));
// Dynamic
// ATH_CHECK(m_readKeyDynamicL1.initialize(m_useDynamicAlignFolders.value()));
// ATH_CHECK(m_readKeyDynamicL2.initialize(m_useDynamicAlignFolders.value()));
// ATH_CHECK(m_readKeyDynamicL3.initialize(m_useDynamicAlignFolders.value()));
// Write Handles
ATH_CHECK(m_writeKey.initialize());
// Register write handle
ATH_CHECK(m_condSvc->regHandle(this, m_writeKey));
ATH_CHECK(detStore()->retrieve(m_detManager, "SCT"));
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_AlignCondAlg::execute()
{
ATH_MSG_DEBUG("execute " << name());
// ____________ Construct Write Cond Handle and check its validity ____________
SG::WriteCondHandle<GeoAlignmentStore> writeHandle{m_writeKey};
// Do we have a valid Write Cond Handle for current time?
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< ". In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
// Get SiDetectorElements
const TrackerDD::SiDetectorElementCollection* oldColl{m_detManager->getDetectorElementCollection()};
if (oldColl==nullptr) {
ATH_MSG_FATAL("Null pointer is returned by getDetectorElementCollection()");
return StatusCode::FAILURE;
}
// ____________ Construct new Write Cond Object ____________
std::unique_ptr<GeoAlignmentStore> writeCdo{std::make_unique<GeoAlignmentStore>()};
EventIDRange rangeW;
if (not m_useDynamicAlignFolders.value()) { // Static
// ____________ Get Read Cond Object ____________
SG::ReadCondHandle<AlignableTransformContainer> readHandleStatic{m_readKeyStatic};
const AlignableTransformContainer* readCdoStatic{*readHandleStatic};
if (readCdoStatic==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object of " << m_readKeyStatic.key());
return StatusCode::FAILURE;
}
// ____________ Apply alignments to SCT GeoModel ____________
// Construct Container for read CDO.
TrackerDD::RawAlignmentObjects readCdoContainerStatic;
readCdoContainerStatic.emplace(m_readKeyStatic.key(), readCdoStatic);
ATH_CHECK(m_detManager->align(readCdoContainerStatic, writeCdo.get()));
// Define validity of the output cond object and record it
if (not readHandleStatic.range(rangeW)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleStatic.key());
return StatusCode::FAILURE;
}
} else { // Dynamic
ATH_MSG_FATAL("Dynamic alignment not supported");
// // ____________ Get Read Cond Object ____________
// SG::ReadCondHandle<CondAttrListCollection> readHandleDynamicL1{m_readKeyDynamicL1};
// const CondAttrListCollection* readCdoDynamicL1{*readHandleDynamicL1};
// if (readCdoDynamicL1==nullptr) {
// ATH_MSG_FATAL("Null pointer to the read conditions object of " << m_readKeyDynamicL1.key());
// return StatusCode::FAILURE;
// }
// SG::ReadCondHandle<CondAttrListCollection> readHandleDynamicL2{m_readKeyDynamicL2};
// const CondAttrListCollection* readCdoDynamicL2{*readHandleDynamicL2};
// if (readCdoDynamicL2==nullptr) {
// ATH_MSG_FATAL("Null pointer to the read conditions object of " << readHandleDynamicL2.key());
// return StatusCode::FAILURE;
// }
// SG::ReadCondHandle<AlignableTransformContainer> readHandleDynamicL3{m_readKeyDynamicL3};
// const AlignableTransformContainer* readCdoDynamicL3{*readHandleDynamicL3};
// if (readCdoDynamicL3==nullptr) {
// ATH_MSG_FATAL("Null pointer to the read conditions object of " << readHandleDynamicL3.key());
// return StatusCode::FAILURE;
// }
// // ____________ Apply alignments to SCT GeoModel ____________
// // Construct Container for read CDO-s.
// TrackerDD::RawAlignmentObjects readCdoContainerDynamicL1;
// readCdoContainerDynamicL1.emplace(m_readKeyDynamicL1.key(), readCdoDynamicL1);
// ATH_CHECK(m_detManager->align(readCdoContainerDynamicL1, writeCdo.get()));
// TrackerDD::RawAlignmentObjects readCdoContainerDynamicL2;
// readCdoContainerDynamicL2.emplace(m_readKeyDynamicL2.key(), readCdoDynamicL2);
// ATH_CHECK(m_detManager->align(readCdoContainerDynamicL2, writeCdo.get()));
// TrackerDD::RawAlignmentObjects readCdoContainerDynamicL3;
// readCdoContainerDynamicL3.emplace(m_readKeyDynamicL3.key(), readCdoDynamicL3);
// ATH_CHECK(m_detManager->align(readCdoContainerDynamicL3, writeCdo.get()));
// // Define validity of the output cond object and record it
// EventIDRange rangeWL1;
// if (not readHandleDynamicL1.range(rangeWL1)) {
// ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleDynamicL1.key());
// return StatusCode::FAILURE;
// }
// EventIDRange rangeWL2;
// if (not readHandleDynamicL2.range(rangeWL2)) {
// ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleDynamicL2.key());
// return StatusCode::FAILURE;
// }
// EventIDRange rangeWL3;
// if (not readHandleDynamicL3.range(rangeWL3)) {
// ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleDynamicL3.key());
// return StatusCode::FAILURE;
// }
// rangeW = EventIDRange::intersect(rangeWL1, rangeWL2, rangeWL3);
}
// Set (default) absolute transforms in alignment store by calling them.
for (const TrackerDD::SiDetectorElement* oldEl: *oldColl) {
oldEl->getMaterialGeom()->getAbsoluteTransform(writeCdo.get());
oldEl->getMaterialGeom()->getDefAbsoluteTransform(writeCdo.get());
}
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record GeoAlignmentStore " << writeHandle.key()
<< " with EventRange " << rangeW
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_AlignCondAlg::finalize()
{
ATH_MSG_DEBUG("finalize " << name());
return StatusCode::SUCCESS;
}
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FASERSCT_CONDITIONSALGORITHMS_SCT_ALIGNCONDALG_H
#define FASERSCT_CONDITIONSALGORITHMS_SCT_ALIGNCONDALG_H
#include "AthenaBaseComps/AthAlgorithm.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ICondSvc.h"
#include "DetDescrConditions/AlignableTransformContainer.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "GeoModelUtilities/GeoAlignmentStore.h"
namespace TrackerDD {
class SCT_DetectorManager;
}
// SCT_AlignCondAlg cannot inherit AthReentrantAlgorithm.
// SCT_AlignCondAlg::execute uses the following methods.
// InDetDD::InDetDetectorManager::align
// InDetDD::InDetDetectorManager::processAlignmentContainer
// InDetDD::InDetDetectorManager::processKey
// InDetDD::SCT_DetectorManager::setAlignableTransformDelta
// InDetDD::SiDetectorElement::defModuleTransform
// InDetDD::SiDetectorElement::defTransform
// InDetDD::SiDetectorElement::defTransformCLHEP
// GeoVFullPhysVol::getDefAbsoluteTransform
// GeoVFullPhysVol::getDefAbsoluteTransform is used without argument.
// To be thread-safe, we need to pass non-const GeoVAlignmentStore pointer.
// However, we cannot give non-const pointer for SiDetectorElement
// in SCT_DetectorManager in the above chain.
class FaserSCT_AlignCondAlg : public AthAlgorithm
{
public:
FaserSCT_AlignCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~FaserSCT_AlignCondAlg() override = default;
virtual StatusCode initialize() override;
virtual StatusCode execute() override;
virtual StatusCode finalize() override;
private:
BooleanProperty m_useDynamicAlignFolders{this, "UseDynamicAlignFolders", false, "Flag of dynamic or static ID alignment folders"};
SG::ReadCondHandleKey<AlignableTransformContainer> m_readKeyStatic{this, "ReadKeyStatic", "/Tracker/Align", "Key for the static alignment folder"};
// SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyDynamicL1{this, "ReadKeyDynamicL1", "/Indet/AlignL1/ID", "Key for the dynamic L1 alignment folder"};
// SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyDynamicL2{this, "ReadKeyDynamicL2", "/Indet/AlignL2/SCT", "Key for the dynamic L2 alignment folder"};
// SG::ReadCondHandleKey<AlignableTransformContainer> m_readKeyDynamicL3{this, "ReadKeyDynamicL3", "/Indet/AlignL3", "Key for the dynamic L3 alignment folder"};
SG::WriteCondHandleKey<GeoAlignmentStore> m_writeKey;
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
const TrackerDD::SCT_DetectorManager* m_detManager{nullptr};
};
#endif // FASERSCT_CONDITIONSALGORITHMS_SCT_ALIGNCONDALG_H
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "FaserSCT_DCSConditionsHVCondAlg.h"
#include "Identifier/IdentifierHash.h"
#include "GaudiKernel/EventIDRange.h"
#include <memory>
FaserSCT_DCSConditionsHVCondAlg::FaserSCT_DCSConditionsHVCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
{
}
StatusCode FaserSCT_DCSConditionsHVCondAlg::initialize() {
ATH_MSG_DEBUG("initialize " << name());
// CondSvc
ATH_CHECK(m_condSvc.retrieve());
if (m_returnHVTemp.value()) {
// Read Cond Handle
ATH_CHECK(m_readKey.initialize());
// Write Cond Handle
ATH_CHECK(m_writeKey.initialize());
if (m_condSvc->regHandle(this, m_writeKey).isFailure()) {
ATH_MSG_FATAL("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_DCSConditionsHVCondAlg::execute(const EventContext& ctx) const {
ATH_MSG_DEBUG("execute " << name());
if (not m_returnHVTemp.value()) {
return StatusCode::SUCCESS;
}
// Write Cond Handle
SG::WriteCondHandle<FaserSCT_DCSFloatCondData> writeHandle{m_writeKey, ctx};
// Do we have a valid Write Cond Handle for current time?
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< ". In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
// Read Cond Handle
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey, ctx};
const CondAttrListCollection* readCdo{*readHandle};
if (readCdo==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
// Get the validitiy range
EventIDRange rangeW;
if (not readHandle.range(rangeW)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_INFO("Range of input is " << rangeW);
// Construct the output Cond Object and fill it in
std::unique_ptr<FaserSCT_DCSFloatCondData> writeCdo{std::make_unique<FaserSCT_DCSFloatCondData>()};
// Read temperature info
std::string param{"HVCHVOLT_RECV"};
CondAttrListCollection::const_iterator attrList{readCdo->begin()};
CondAttrListCollection::const_iterator end{readCdo->end()};
// CondAttrListCollection doesn't support C++11 type loops, no generic 'begin'
for (; attrList!=end; ++attrList) {
// A CondAttrListCollection is a map of ChanNum and AttributeList
CondAttrListCollection::ChanNum channelNumber{attrList->first};
const CondAttrListCollection::AttributeList &payload{attrList->second};
if (payload.exists(param) and not payload[param].isNull()) {
float val{payload[param].data<float>()};
writeCdo->setValue(channelNumber, val);
} else {
ATH_MSG_WARNING(param << " does not exist for ChanNum " << channelNumber);
}
}
// Record the output cond object
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record FaserSCT_DCSFloatCondData " << writeHandle.key()
<< " with EventRange " << rangeW
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_DCSConditionsHVCondAlg::finalize()
{
ATH_MSG_DEBUG("finalize " << name());
return StatusCode::SUCCESS;
}
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FASERSCT_DCSCONDITIONSHVCONDALG
#define FASERSCT_DCSCONDITIONSHVCONDALG
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "FaserSCT_ConditionsData/FaserSCT_DCSFloatCondData.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ICondSvc.h"
#include "GaudiKernel/Property.h"
class FaserSCT_DCSConditionsHVCondAlg : public AthReentrantAlgorithm
{
public:
FaserSCT_DCSConditionsHVCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~FaserSCT_DCSConditionsHVCondAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode finalize() override;
/** Make this algorithm clonable. */
virtual bool isClonable() const override { return true; };
private:
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey{this, "ReadKey", "/SCT/DCS/HV", "Key of input (raw) HV conditions folder"};
SG::WriteCondHandleKey<FaserSCT_DCSFloatCondData> m_writeKey{this, "WriteKey", "SCT_DCSHVCondData", "Key of output (derived) HV conditions data"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
BooleanProperty m_returnHVTemp{this, "ReturnHVTemp", true};
};
#endif // SCT_DCSCONDITIONSHVCONDALG
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "FaserSCT_DCSConditionsStatCondAlg.h"
#include "Identifier/IdentifierHash.h"
#include "GaudiKernel/EventIDRange.h"
#include <memory>
FaserSCT_DCSConditionsStatCondAlg::FaserSCT_DCSConditionsStatCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
{
}
StatusCode FaserSCT_DCSConditionsStatCondAlg::initialize() {
ATH_MSG_DEBUG("initialize " << name());
m_doState = ((m_readAllDBFolders.value() and m_returnHVTemp.value()) or (not m_readAllDBFolders.value() and not m_returnHVTemp.value()));
// CondSvc
ATH_CHECK(m_condSvc.retrieve());
if (m_returnHVTemp.value()) {
// Read Cond Handle (HV)
ATH_CHECK(m_readKeyHV.initialize());
}
if (m_doState) {
// Read Cond Handle (state)
ATH_CHECK(m_readKeyState.initialize());
// Write Cond Handle
ATH_CHECK(m_writeKeyState.initialize());
if (m_condSvc->regHandle(this, m_writeKeyState).isFailure()) {
ATH_MSG_FATAL("unable to register WriteCondHandle " << m_writeKeyState.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
}
if (m_useHV.value()) {
m_hvLowLimit = m_useHVLowLimit;
m_hvUpLimit = m_useHVUpLimit;
m_chanstatCut = m_useHVChanCut;
ATH_MSG_INFO("Using HV and Chanstat"<< m_chanstatCut << " for marking modules bad. >=Hvlow: "
<< m_hvLowLimit<< " and <=Hv Up: " << m_hvUpLimit <<
". Note: UseHV Overrides hv limit and chanstat values in joboptions!!");
}
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_DCSConditionsStatCondAlg::execute(const EventContext& ctx) const {
ATH_MSG_DEBUG("execute " << name());
if (not m_doState) {
return StatusCode::SUCCESS;
}
// Write Cond Handle (state)
SG::WriteCondHandle<FaserSCT_DCSStatCondData> writeHandle{m_writeKeyState, ctx};
// Do we have a valid Write Cond Handle for current time?
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< ". In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
// Read Cond Handle (state)
SG::ReadCondHandle<CondAttrListCollection> readHandleState{m_readKeyState, ctx};
const CondAttrListCollection* readCdoState{*readHandleState};
if (readCdoState==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object (state)");
return StatusCode::FAILURE;
}
// Get the validitiy range (state)
EventIDRange rangeState;
if (not readHandleState.range(rangeState)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleState.key());
return StatusCode::FAILURE;
}
ATH_MSG_INFO("Size of CondAttrListCollection " << readHandleState.fullKey() << " readCdo->size()= " << readCdoState->size());
ATH_MSG_INFO("Range of state input is " << rangeState);
// Construct the output Cond Object and fill it in
std::unique_ptr<FaserSCT_DCSStatCondData> writeCdoState{std::make_unique<FaserSCT_DCSStatCondData>()};
// Read state info
std::string paramState{"STATE"};
CondAttrListCollection::const_iterator attrListState{readCdoState->begin()};
CondAttrListCollection::const_iterator endState{readCdoState->end()};
// CondAttrListCollection doesn't support C++11 type loops, no generic 'begin'
for (; attrListState!=endState; ++attrListState) {
// A CondAttrListCollection is a map of ChanNum and AttributeList
CondAttrListCollection::ChanNum channelNumber{attrListState->first};
const CondAttrListCollection::AttributeList &payload{attrListState->second};
if (payload.exists(paramState) and not payload[paramState].isNull()) {
unsigned int val{payload[paramState].data<unsigned int>()};
unsigned int hvstate{val bitand 240};
unsigned int lvstate{val bitand 15};
if ( ( (m_chanstatCut=="NORM") and not ((hvstate==16 or hvstate==48) and (lvstate==1 or lvstate==3)) )
or ( (m_chanstatCut=="NSTBY") and not ((hvstate==16 or hvstate==48 or hvstate==32) and (lvstate==1 or lvstate==3 or lvstate==2)) )
or ( (m_chanstatCut=="LOOSE") and not ((hvstate==16 or hvstate==48 or hvstate==32 or hvstate==128) and (lvstate==1 or lvstate==3 or lvstate==2 or lvstate==8)) )) {
writeCdoState->fill(channelNumber, paramState);
} else {
writeCdoState->remove(channelNumber, paramState);
}
} else {
ATH_MSG_WARNING(paramState << " does not exist for ChanNum " << channelNumber);
}
}
if (m_returnHVTemp.value()) {
// Read Cond Handle
SG::ReadCondHandle<CondAttrListCollection> readHandleHV{m_readKeyHV, ctx};
const CondAttrListCollection* readCdoHV{*readHandleHV};
if (readCdoHV==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object (HV)");
return StatusCode::FAILURE;
}
// Get the validitiy range (HV)
EventIDRange rangeHV;
if (not readHandleHV.range(rangeHV)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleHV.key());
return StatusCode::FAILURE;
}
ATH_MSG_INFO("Size of CondAttrListCollection " << readHandleHV.fullKey() << " readCdo->size()= " << readCdoHV->size());
ATH_MSG_INFO("Range of HV input is " << rangeHV);
// Combined the validity ranges of state and range
EventIDRange rangeIntersection{EventIDRange::intersect(rangeState, rangeHV)};
if (rangeIntersection.stop().isValid() and rangeIntersection.start()>rangeIntersection.stop()) {
ATH_MSG_FATAL("Invalid intersection range: " << rangeIntersection);
return StatusCode::FAILURE;
}
rangeState = rangeIntersection;
std::string paramHV{"HVCHVOLT_RECV"};
CondAttrListCollection::const_iterator attrListHV{readCdoHV->begin()};
CondAttrListCollection::const_iterator endHV{readCdoHV->end()};
// CondAttrListCollection doesn't support C++11 type loops, no generic 'begin'
for (; attrListHV!=endHV; ++attrListHV) {
// A CondAttrListCollection is a map of ChanNum and AttributeList
CondAttrListCollection::ChanNum channelNumber{attrListHV->first};
const CondAttrListCollection::AttributeList &payload{attrListHV->second};
if (payload.exists(paramHV) and not payload[paramHV].isNull()) {
float hvval{payload[paramHV].data<float>()};
if ((hvval<m_hvLowLimit) or (hvval>m_hvUpLimit)) {
writeCdoState->fill(channelNumber, paramHV);
} else {
writeCdoState->remove(channelNumber, paramHV);
}
} else {
ATH_MSG_WARNING(paramHV << " does not exist for ChanNum " << channelNumber);
}
}
}
// Record the output cond object
if (writeHandle.record(rangeState, std::move(writeCdoState)).isFailure()) {
ATH_MSG_FATAL("Could not record FaserSCT_DCSStatCondData " << writeHandle.key()
<< " with EventRange " << rangeState
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeState << " into Conditions Store");
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_DCSConditionsStatCondAlg::finalize()
{
ATH_MSG_DEBUG("finalize " << name());
return StatusCode::SUCCESS;
}
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FASERSCT_DCSCONDITIONSSTATCONDALG
#define FASERSCT_DCSCONDITIONSSTATCONDALG
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "FaserSCT_ConditionsData/FaserSCT_DCSStatCondData.h"
#include "GaudiKernel/ICondSvc.h"
#include "GaudiKernel/Property.h"
class FaserSCT_DCSConditionsStatCondAlg : public AthReentrantAlgorithm
{
public:
FaserSCT_DCSConditionsStatCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~FaserSCT_DCSConditionsStatCondAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode finalize() override;
/** Make this algorithm clonable. */
virtual bool isClonable() const override { return true; }
private:
SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyHV{this, "ReadKeyHV", "/SCT/DCS/HV", "Key of input (raw) HV conditions folder"};
SG::ReadCondHandleKey<CondAttrListCollection> m_readKeyState{this, "ReadKeyState", "/SCT/DCS/CHANSTAT", "Key of input (raw) State conditions folder"};
SG::WriteCondHandleKey<FaserSCT_DCSStatCondData> m_writeKeyState{this, "WriteKeyState", "SCT_DCSStatCondData", "Key of output (derived) State conditions data"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
bool m_doState{true};
BooleanProperty m_readAllDBFolders{this, "ReadAllDBFolders", true};
BooleanProperty m_returnHVTemp{this, "ReturnHVTemp", true};
StringProperty m_chanstatCut{this, "StateCut", "NORM"};
FloatProperty m_hvLowLimit{this, "HVCutLow", 0.0};
FloatProperty m_hvUpLimit{this, "HVCutUp", 1000000.0};
BooleanProperty m_useHV{this, "UseDefaultHV", false};
FloatProperty m_useHVLowLimit{this, "useHVLow", 19.};
FloatProperty m_useHVUpLimit{this, "useHVUp", 1000000.0};
StringProperty m_useHVChanCut{this, "useHVChan", "LOOSE"};
};
#endif // FASERSCT_DCSCONDITIONSSTATCONDALG
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "FaserSCT_DCSConditionsTempCondAlg.h"
#include "Identifier/IdentifierHash.h"
#include "GaudiKernel/EventIDRange.h"
#include <memory>
FaserSCT_DCSConditionsTempCondAlg::FaserSCT_DCSConditionsTempCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
{
}
StatusCode FaserSCT_DCSConditionsTempCondAlg::initialize() {
ATH_MSG_DEBUG("initialize " << name());
// CondSvc
ATH_CHECK(m_condSvc.retrieve());
if (m_returnHVTemp.value()) {
// Read Cond Handle
ATH_CHECK(m_readKey.initialize());
// Write Cond Handles
ATH_CHECK(m_writeKey.initialize());
if (m_condSvc->regHandle(this, m_writeKey).isFailure()) {
ATH_MSG_FATAL("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
}
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_DCSConditionsTempCondAlg::execute(const EventContext& ctx) const {
ATH_MSG_DEBUG("execute " << name());
if (not m_returnHVTemp.value()) {
return StatusCode::SUCCESS;
}
// Write Cond Handle
SG::WriteCondHandle<FaserSCT_DCSFloatCondData> writeHandle{m_writeKey, ctx};
// Do we have a valid Write Cond Handle for current time?
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< ". In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
// Read Cond Handle
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey, ctx};
const CondAttrListCollection* readCdo{*readHandle};
if (readCdo==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
// Get the validitiy range
EventIDRange rangeW;
if (not readHandle.range(rangeW)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_INFO("Range of input is " << rangeW);
// Construct the output Cond Object and fill it in
std::unique_ptr<FaserSCT_DCSFloatCondData> writeCdo{std::make_unique<FaserSCT_DCSFloatCondData>()};
// Read temperature info
std::string param{"MOCH_TM0_RECV"};
CondAttrListCollection::const_iterator attrList{readCdo->begin()};
CondAttrListCollection::const_iterator end{readCdo->end()};
// CondAttrListCollection doesn't support C++11 type loops, no generic 'begin'
for (; attrList!=end; ++attrList) {
// A CondAttrListCollection is a map of ChanNum and AttributeList
CondAttrListCollection::ChanNum channelNumber{attrList->first};
const CondAttrListCollection::AttributeList &payload{attrList->second};
if (payload.exists(param) and not payload[param].isNull()) {
float val{payload[param].data<float>()};
writeCdo->setValue(channelNumber, val);
} else {
ATH_MSG_WARNING(param << " does not exist for ChanNum " << channelNumber);
}
}
// Record the output cond object
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record FaserSCT_DCSFloatCondData " << writeHandle.key()
<< " with EventRange " << rangeW
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_DCSConditionsTempCondAlg::finalize()
{
ATH_MSG_DEBUG("finalize " << name());
return StatusCode::SUCCESS;
}
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FASERSCT_DCSCONDITIONSTEMPCONDALG
#define FASERSCT_DCSCONDITIONSTEMPCONDALG
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "FaserSCT_ConditionsData/FaserSCT_DCSFloatCondData.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ICondSvc.h"
#include "GaudiKernel/Property.h"
class FaserSCT_DCSConditionsTempCondAlg : public AthReentrantAlgorithm
{
public:
FaserSCT_DCSConditionsTempCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~FaserSCT_DCSConditionsTempCondAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode finalize() override;
/** Make this algorithm clonable. */
virtual bool isClonable() const override { return true; };
private:
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey{this, "ReadKey", "/SCT/DCS/MODTEMP", "Key of input (raw) temperature conditions folder"};
SG::WriteCondHandleKey<FaserSCT_DCSFloatCondData> m_writeKey{this, "WriteKey", "SCT_DCSTemp0CondData", "Key of output (derived) temperature conditions data"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
BooleanProperty m_returnHVTemp{this, "ReturnHVTemp", true};
};
#endif // FASERSCT_DCSCONDITIONSTEMPCONDALG
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "FaserSCT_DetectorElementCondAlg.h"
#include "TrackerReadoutGeometry/SCT_DetectorManager.h"
#include "TrackerReadoutGeometry/SiDetectorElement.h"
#include "TrkGeometry/Layer.h"
#include "TrkSurfaces/Surface.h"
#include <map>
FaserSCT_DetectorElementCondAlg::FaserSCT_DetectorElementCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
, m_readKey{"SCTAlignmentStore", "SCTAlignmentStore"}
{
declareProperty("ReadKey", m_readKey);
}
StatusCode FaserSCT_DetectorElementCondAlg::initialize()
{
ATH_MSG_DEBUG("initialize " << name());
// Read Handle
ATH_CHECK(m_readKey.initialize());
// Write Handle
ATH_CHECK(m_writeKey.initialize());
// CondSvc
ATH_CHECK(m_condSvc.retrieve());
// Register write handle
ATH_CHECK(m_condSvc->regHandle(this, m_writeKey));
ATH_CHECK(detStore()->retrieve(m_detManager, "SCT"));
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_DetectorElementCondAlg::execute(const EventContext& ctx) const
{
ATH_MSG_DEBUG("execute " << name());
// ____________ Construct Write Cond Handle and check its validity ____________
SG::WriteCondHandle<TrackerDD::SiDetectorElementCollection> writeHandle{m_writeKey, ctx};
// Do we have a valid Write Cond Handle for current time?
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< ". In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
const TrackerDD::SiDetectorElementCollection* oldColl{m_detManager->getDetectorElementCollection()};
if (oldColl==nullptr) {
ATH_MSG_FATAL("Null pointer is returned by getDetectorElementCollection()");
return StatusCode::FAILURE;
}
// ____________ Construct new Write Cond Object ____________
std::unique_ptr<TrackerDD::SiDetectorElementCollection> writeCdo{std::make_unique<TrackerDD::SiDetectorElementCollection>()};
EventIDRange rangeW;
// ____________ Get Read Cond Object ____________
SG::ReadCondHandle<GeoAlignmentStore> readHandle{m_readKey, ctx};
const GeoAlignmentStore* readCdo{*readHandle};
if (readCdo==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object of " << m_readKey.key());
return StatusCode::FAILURE;
}
// Define validity of the output cond object and record it
if (not readHandle.range(rangeW)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
// ____________ Update writeCdo using readCdo ____________
std::map<const TrackerDD::SiDetectorElement*, const TrackerDD::SiDetectorElement*> oldToNewMap;
oldToNewMap[nullptr] = nullptr;
writeCdo->resize(oldColl->size(), nullptr);
TrackerDD::SiDetectorElementCollection::iterator newEl{writeCdo->begin()};
for (const TrackerDD::SiDetectorElement* oldEl: *oldColl) {
*newEl = new TrackerDD::SiDetectorElement(oldEl->identify(),
&(oldEl->design()),
oldEl->GeoVDetectorElement::getMaterialGeom(),
oldEl->getCommonItems(),
readCdo);
oldToNewMap[oldEl] = *newEl;
newEl++;
}
// Set neighbours and other side
// Set layer to surface
TrackerDD::SiDetectorElementCollection::const_iterator oldIt{oldColl->begin()};
for (TrackerDD::SiDetectorElement* newEl: *writeCdo) {
if (oldToNewMap[(*oldIt)]!=newEl) {
ATH_MSG_ERROR("Old and new elements are not synchronized!");
}
newEl->setNextInEta(oldToNewMap[(*oldIt)->nextInEta()]);
newEl->setPrevInEta(oldToNewMap[(*oldIt)->prevInEta()]);
newEl->setNextInPhi(oldToNewMap[(*oldIt)->nextInPhi()]);
newEl->setPrevInPhi(oldToNewMap[(*oldIt)->prevInPhi()]);
newEl->setOtherSide(oldToNewMap[(*oldIt)->otherSide()]);
// Layer of old element is set by InDet::SiLayerBuilder::registerSurfacesToLayer.
const Trk::Layer* layer{(*oldIt)->surface().associatedLayer()};
if (layer) {
newEl->surface().associateLayer(*layer);
}
oldIt++;
}
// Apply alignment using readCdo passed to SiDetectorElement
for (TrackerDD::SiDetectorElement* newEl: *writeCdo) {
newEl->setCache();
}
// Record WriteCondHandle
const std::size_t size{writeCdo->size()};
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record " << writeHandle.key()
<< " with EventRange " << rangeW
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " with size of " << size << " into Conditions Store");
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_DetectorElementCondAlg::finalize()
{
ATH_MSG_DEBUG("finalize " << name());
return StatusCode::SUCCESS;
}
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FASERSCT_CONDITIONSALGORITHMS_SCT_DETECTORELEMENTCONDALG_H
#define FASERSCT_CONDITIONSALGORITHMS_SCT_DETECTORELEMENTCONDALG_H
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "GeoPrimitives/GeoPrimitives.h"
#include "GeoModelUtilities/GeoAlignmentStore.h"
#include "TrackerReadoutGeometry/SiDetectorElementCollection.h"
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "GaudiKernel/ICondSvc.h"
namespace TrackerDD {
class SCT_DetectorManager;
}
class FaserSCT_DetectorElementCondAlg : public AthReentrantAlgorithm
{
public:
FaserSCT_DetectorElementCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~FaserSCT_DetectorElementCondAlg() override = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode finalize() override;
/** Make this algorithm clonable. */
virtual bool isClonable() const override { return true; };
private:
SG::ReadCondHandleKey<GeoAlignmentStore> m_readKey;
SG::WriteCondHandleKey<TrackerDD::SiDetectorElementCollection> m_writeKey{this, "WriteKey", "SCT_DetectorElementCollection", "Key of output SiDetectorElementCollection for SCT"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
const TrackerDD::SCT_DetectorManager* m_detManager{nullptr};
};
#endif // FASERSCT_CONDITIONSALGORITHMS_SCT_DETECTORELEMENTCONDALG_H
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "FaserSCT_ReadCalibChipGainCondAlg.h"
#include "Identifier/IdentifierHash.h"
#include "TrackerIdentifier/FaserSCT_ID.h"
#include "FaserSCT_ConditionsData/FaserSCT_ConditionsParameters.h"
#include "SCT_ConditionsTools/SCT_ReadCalibChipUtilities.h"
#include "GaudiKernel/EventIDRange.h"
#include <memory>
using namespace FaserSCT_ConditionsData;
using namespace SCT_ReadCalibChipUtilities;
FaserSCT_ReadCalibChipGainCondAlg::FaserSCT_ReadCalibChipGainCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
{
}
StatusCode FaserSCT_ReadCalibChipGainCondAlg::initialize() {
ATH_MSG_DEBUG("initialize " << name());
// CondSvc
ATH_CHECK(m_condSvc.retrieve());
// Get SCT helper
ATH_CHECK(detStore()->retrieve(m_id_sct, "FaserSCT_ID"));
// Read Cond Handle
ATH_CHECK(m_readKey.initialize());
// Write Cond Handle
ATH_CHECK(m_writeKey.initialize());
if (m_condSvc->regHandle(this, m_writeKey).isFailure()) {
ATH_MSG_FATAL("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc");
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_ReadCalibChipGainCondAlg::execute(const EventContext& ctx) const {
ATH_MSG_DEBUG("execute " << name());
// Write Cond Handle
SG::WriteCondHandle<FaserSCT_GainCalibData> writeHandle{m_writeKey, ctx};
// Do we have a valid Write Cond Handle for current time?
if (writeHandle.isValid()) {
ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
<< ". In theory this should not be called, but may happen"
<< " if multiple concurrent events are being processed out of order.");
return StatusCode::SUCCESS;
}
// Read Cond Handle
SG::ReadCondHandle<CondAttrListCollection> readHandle{m_readKey, ctx};
const CondAttrListCollection* readCdo{*readHandle};
if (readCdo==nullptr) {
ATH_MSG_FATAL("Null pointer to the read conditions object");
return StatusCode::FAILURE;
}
// Get the validitiy range
EventIDRange rangeW;
if (not readHandle.range(rangeW)) {
ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key());
return StatusCode::FAILURE;
}
ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size());
ATH_MSG_INFO("Range of input is " << rangeW);
// Construct the output Cond Object and fill it in
std::unique_ptr<FaserSCT_GainCalibData> writeCdo{std::make_unique<FaserSCT_GainCalibData>()};
// Initialization
const float errVal{std::numeric_limits<float>::quiet_NaN()};
for (int m{0}; m!=NUMBER_OF_MODULES; ++m) {
for (int p{0}; p!=N_NPTGAIN; ++p) {
for (int c{0}; c!=CHIPS_PER_MODULE; ++c) {
(*writeCdo)[m][p][c]=errVal;
}
}
}
// loop over collection
CondAttrListCollection::const_iterator itLoop{readCdo->begin()};
CondAttrListCollection::const_iterator itLoop_end{readCdo->end()};
for (; itLoop!=itLoop_end; ++itLoop) {
CondAttrListCollection::ChanNum chanNum{itLoop->first};
const coral::AttributeList &anAttrList{itLoop->second};
// Convert chanNum=offlineID into identifier
Identifier32 moduleId{chanNum};
//find the corresponding hash
const IdentifierHash hashId{m_id_sct->wafer_hash(moduleId)};
//find the index to the module (hash is for each side), to use as index into array
const unsigned int moduleIdx{hashId/SIDES_PER_MODULE};
FaserSCT_ModuleGainCalibData& theseCalibData{(*writeCdo)[moduleIdx]};
insertNptGainFolderData(theseCalibData, anAttrList);
}
// Record the output cond object
if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
ATH_MSG_FATAL("Could not record FaserSCT_GainCalibData " << writeHandle.key()
<< " with EventRange " << rangeW
<< " into Conditions Store");
return StatusCode::FAILURE;
}
ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store");
return StatusCode::SUCCESS;
}
StatusCode FaserSCT_ReadCalibChipGainCondAlg::finalize() {
ATH_MSG_DEBUG("finalize " << name());
return StatusCode::SUCCESS;
}
void
FaserSCT_ReadCalibChipGainCondAlg::insertNptGainFolderData(FaserSCT_ModuleGainCalibData& theseCalibData, const coral::AttributeList& folderData) const {
for (int i{0}; i!=N_NPTGAIN; ++i) {
FaserSCT_ModuleCalibParameter& datavec{theseCalibData[i]};
const std::string &dbData{((folderData)[nPtGainDbParameterNames[i]]).data<std::string>()};
fillFromString(dbData, datavec);
}
}
// -*- C++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FaserSCT_ReadCalibChipGainCondAlg_h
#define FaserSCT_ReadCalibChipGainCondAlg_h
// Include parent class
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
// Include Gaudi classes
#include "GaudiKernel/ICondSvc.h"
#include "GaudiKernel/Property.h"
// Include Athena classes
#include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/WriteCondHandleKey.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "FaserSCT_ConditionsData/FaserSCT_GainCalibData.h"
// Include boost stuff
#include "boost/array.hpp"
// Forward declarations
class FaserSCT_ID;
class FaserSCT_ReadCalibChipGainCondAlg : public AthReentrantAlgorithm
{
public:
FaserSCT_ReadCalibChipGainCondAlg(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~FaserSCT_ReadCalibChipGainCondAlg() = default;
virtual StatusCode initialize() override;
virtual StatusCode execute(const EventContext& ctx) const override;
virtual StatusCode finalize() override;
/** Make this algorithm clonable. */
virtual bool isClonable() const override { return true; };
private:
void insertNptGainFolderData(FaserSCT_ModuleGainCalibData& theseCalibData, const coral::AttributeList& folderData) const;
SG::ReadCondHandleKey<CondAttrListCollection> m_readKey{this, "ReadKey", "/SCT/DAQ/Calibration/ChipGain", "Key of input (raw) gain conditions folder"};
SG::WriteCondHandleKey<FaserSCT_GainCalibData> m_writeKey{this, "WriteKey", "SCT_GainCalibData", "Key of output (derived) gain conditions data"};
ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"};
const FaserSCT_ID* m_id_sct{nullptr}; //!< Handle to FaserSCT ID helper
};
#endif // FaserSCT_ReadCalibChipGainCondAlg_h