diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGM.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGM.py index f4a051c12f2b6c921a29b83606b1e94b8a392335..dbbaa82341541e9afa70ebdcdde93475f00f1a97 100755 --- a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGM.py +++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGM.py @@ -47,10 +47,7 @@ elif ( DetFlags.detdescr.ID_on() ): ToolSvc += blmTool GeoModelSvc.DetectorTools['PixelDetectorTool'].BLM_Tool = blmTool - GeoModelSvc.DetectorTools['PixelDetectorTool'].useDynamicAlignFolders = GeometryFlags.useDynamicAlignFolders() - if ( DetFlags.detdescr.SCT_on() ): - if GeometryFlags.isSLHC(): #SLHC specific code if "GMX" == GeometryFlags.StripGeoType(): @@ -73,15 +70,12 @@ elif ( DetFlags.detdescr.ID_on() ): from AthenaCommon import CfgGetter GeoModelSvc.DetectorTools += [ CfgGetter.getPrivateTool("SCT_DetectorTool", checkType=True) ] - GeoModelSvc.DetectorTools['SCT_DetectorTool'].useDynamicAlignFolders = GeometryFlags.useDynamicAlignFolders() - if ( DetFlags.detdescr.TRT_on() ): from TRT_GeoModel.TRT_GeoModelConf import TRT_DetectorTool trtDetectorTool = TRT_DetectorTool() if ( DetFlags.simulate.TRT_on() ): trtDetectorTool.DoXenonArgonMixture = True trtDetectorTool.DoKryptonMixture = True - trtDetectorTool.useDynamicAlignFolders = GeometryFlags.useDynamicAlignFolders() GeoModelSvc.DetectorTools += [ trtDetectorTool ] from InDetServMatGeoModel.InDetServMatGeoModelConf import InDetServMatTool diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py index 610794a2e873e61ba909cc8f00bfae563684c81a..eff1ea5eecd4b7bcab02775262251868f697dcfb 100755 --- a/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py +++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/InDetGMJobProperties.py @@ -191,13 +191,6 @@ class StripGeoType(JobProperty): allowedTypes = ['str'] StoredValue = "UNDEFINED" -class useDynamicAlignFolders(JobProperty): - """ Use to turn on dynamic alignment constants folder scheme (first deployed in 2016) """ - statusOn = True - allowedTypes = ['bool'] - StoredValue = False - - # add to jobproperties class GeometryFlags_JobProperties(JobPropertyContainer): @@ -259,7 +252,6 @@ jobproperties.GeometryFlags_JobProperties.add_JobProperty(isDBM) jobproperties.GeometryFlags_JobProperties.add_JobProperty(Run) jobproperties.GeometryFlags_JobProperties.add_JobProperty(GeoType) jobproperties.GeometryFlags_JobProperties.add_JobProperty(StripGeoType) -jobproperties.GeometryFlags_JobProperties.add_JobProperty(useDynamicAlignFolders) GeometryFlags = jobproperties.GeometryFlags_JobProperties GeometryFlags.setupValuesFromDB() diff --git a/InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py b/InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py index b8fd140b9a81418d40cd54b8275e3f8a3518dadf..01056a88de06cea6a6fe526d8749af7d1720733a 100644 --- a/InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py +++ b/InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py @@ -17,9 +17,14 @@ conddb.addFolderSplitOnline("INDET","/Indet/Onl/IBLDist","/Indet/IBLDist") # Adding protection against new dynamic folder scheme; # In future we might want to add also to MC DB # Solution below is not pretty but in response to JIRA ATLASSIM-2746 - -from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags -if geoFlags.useDynamicAlignFolders(): +useDynamicAlignFolders = False +try: + from InDetRecExample.InDetJobProperties import InDetFlags + if InDetFlags.useDynamicAlignFolders and conddb.dbdata == "CONDBR2": + useDynamicAlignFolders = True +except ImportError: + pass +if useDynamicAlignFolders: conddb.addFolderSplitOnline("INDET","/Indet/Onl/AlignL1/ID","/Indet/AlignL1/ID") conddb.addFolderSplitOnline("INDET","/Indet/Onl/AlignL2/PIX","/Indet/AlignL2/PIX") conddb.addFolderSplitOnline("INDET","/Indet/Onl/AlignL2/SCT","/Indet/AlignL2/SCT") @@ -29,3 +34,4 @@ if geoFlags.useDynamicAlignFolders(): else: conddb.addFolderSplitOnline("INDET","/Indet/Onl/Align","/Indet/Align") conddb.addFolderSplitOnline("TRT","/TRT/Onl/Align","/TRT/Align") +del useDynamicAlignFolders #tidy up diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelDetectorFactory.h b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelDetectorFactory.h index cbdc029d95fc328c17579b7f520e0549cbdbb56d..bec4be43cf146ac386723d60247d171f18c30874 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelDetectorFactory.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelDetectorFactory.h @@ -32,6 +32,8 @@ class PixelDetectorFactory : public InDetDD::DetectorFactoryBase { // Access to the results: virtual const InDetDD::PixelDetectorManager * getDetectorManager() const; + // Determine which alignment folders are loaded to decide if we register old or new folders + virtual InDetDD::AlignFolderType getAlignFolderType() const; private: @@ -43,9 +45,6 @@ class PixelDetectorFactory : public InDetDD::DetectorFactoryBase { PixelGeometryManager * m_geometryManager; void doChecks(); - -private: - bool m_useDynamicAlignFolders; }; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelDetectorTool.h b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelDetectorTool.h index 28e8fa98d305b4653be26f9cd3b314d2fdf1a4dd..ce6918b56ea107bfac9cee1080cdd649b8ae4548 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelDetectorTool.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelDetectorTool.h @@ -52,7 +52,6 @@ private: bool m_initialLayout; bool m_devVersion; bool m_buildDBM; - bool m_useDynamicAlignFolders; ToolHandle< IGeoSubDetTool > m_bcmTool; ToolHandle< IGeoSubDetTool > m_blmTool; ToolHandle< IInDetServMatBuilderTool > m_serviceBuilderTool; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelSwitches.h b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelSwitches.h index 27f2119debd22ef3202460384ff89b5d09594d5f..68eadf25111da8d9b5d4e0929bb70af8f23e1b8e 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelSwitches.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/PixelSwitches.h @@ -51,10 +51,6 @@ public: void setDBM(bool flag = false); bool dbm() const; - //dynamic alignment folders - void setDynamicAlignFolders(const bool useDynAlignFolders); - bool dynamicAlignFolders() const; - private: // flag to build also the services @@ -84,8 +80,6 @@ private: // DBM bool m_dbm; - //controls which set of alignment folders is used - bool m_dynAlignFolders; }; #endif // PixelSwitches_H diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.cxx index ad94ef9e327949f6fcb310f77dc080b63df23c9e..8579934f433d6271d1ef630de7a42309fdab5f8e 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.cxx @@ -34,8 +34,7 @@ using InDetDD::SiCommonItems; PixelDetectorFactory::PixelDetectorFactory(const PixelGeoModelAthenaComps * athenaComps, const PixelSwitches & switches) : InDetDD::DetectorFactoryBase(athenaComps), - m_detectorManager(0), - m_useDynamicAlignFolders(false) + m_detectorManager(0) { // Create the detector manager m_detectorManager = new PixelDetectorManager(detStore()); @@ -98,8 +97,6 @@ PixelDetectorFactory::PixelDetectorFactory(const PixelGeoModelAthenaComps * athe versionPatchNumber); m_detectorManager->setVersion(version); - m_useDynamicAlignFolders = switches.dynamicAlignFolders(); - } @@ -165,8 +162,10 @@ void PixelDetectorFactory::create(GeoPhysVol *world) // Register the callbacks and keys and the level corresponding to the key. if (m_geometryManager->Alignable()) { - if (!m_useDynamicAlignFolders){ - m_detectorManager->addAlignFolderType(InDetDD::static_run1); + InDetDD::AlignFolderType AlignFolder = getAlignFolderType(); + m_detectorManager->addAlignFolderType(AlignFolder); + + if (AlignFolder==InDetDD::static_run1){ m_detectorManager->addFolder("/Indet/Align"); m_detectorManager->addChannel("/Indet/Align/ID", 2, InDetDD::global); m_detectorManager->addChannel("/Indet/Align/PIX", 1, InDetDD::global); @@ -182,8 +181,7 @@ void PixelDetectorFactory::create(GeoPhysVol *world) m_detectorManager->addChannel("/Indet/Align/PIXEC3", 0, InDetDD::local); } - else { - m_detectorManager->addAlignFolderType(InDetDD::timedependent_run2); + if (AlignFolder==InDetDD::timedependent_run2){ m_detectorManager->addGlobalFolder("/Indet/AlignL1/ID"); m_detectorManager->addGlobalFolder("/Indet/AlignL2/PIX"); m_detectorManager->addChannel("/Indet/AlignL1/ID", 2, InDetDD::global); @@ -368,4 +366,31 @@ PixelDetectorFactory::doChecks() } +// Determine which alignment folders are loaded to decide if we register old or new folders +InDetDD::AlignFolderType PixelDetectorFactory::getAlignFolderType() const +{ + + bool static_folderStruct = false; + bool timedep_folderStruct = false; + if (detStore()->contains<CondAttrListCollection>("/Indet/AlignL1/ID") && + detStore()->contains<CondAttrListCollection>("/Indet/AlignL2/PIX") && + detStore()->contains<AlignableTransformContainer>("/Indet/AlignL3") ) timedep_folderStruct = true; + + if (detStore()->contains<AlignableTransformContainer>("/Indet/Align") ) static_folderStruct = true; + + if (static_folderStruct && !timedep_folderStruct){ + msg(MSG::INFO) << " Static run1 type alignment folder structure found" << endmsg; + return InDetDD::static_run1; + } + else if (!static_folderStruct && timedep_folderStruct){ + msg(MSG::INFO) << " Time dependent run2 type alignment folder structure found" << endmsg; + return InDetDD::timedependent_run2; + } + else if (static_folderStruct && timedep_folderStruct){ + throw std::runtime_error("Old and new alignment folders are loaded at the same time! This should not happen!"); + } + else return InDetDD::none; + +} + diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorTool.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorTool.cxx index be6a7ee9b21407af4bdef309fea167f32aa1de4d..3aff1ba7c39c5f5af882f19512f944d998b420df 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorTool.cxx @@ -42,7 +42,6 @@ PixelDetectorTool::PixelDetectorTool( const std::string& type, const std::string m_detectorName("PixelDetector"), m_IBLParameterSvc("IBLParameterSvc",name), m_buildDBM(0), - m_useDynamicAlignFolders(false), m_bcmTool(""), m_blmTool(""), m_serviceBuilderTool(""), @@ -68,7 +67,6 @@ PixelDetectorTool::PixelDetectorTool( const std::string& type, const std::string declareProperty("GeoModelSvc", m_geoModelSvc); declareProperty("LorentzAngleSvc", m_lorentzAngleSvc); declareProperty("OverrideVersionName", m_overrideVersionName); - declareProperty("useDynamicAlignFolders", m_useDynamicAlignFolders); } /** ** Destructor @@ -200,7 +198,6 @@ StatusCode PixelDetectorTool::create( StoreGateSvc* detStore ) if (versionName == "SLHC") switches.setSLHC(); if (versionName == "IBL") switches.setIBL(); switches.setDBM(m_buildDBM); //DBM flag - switches.setDynamicAlignFolders(m_useDynamicAlignFolders); //JBdV switches.setServicesOnLadder(m_servicesOnLadder); @@ -386,7 +383,7 @@ PixelDetectorTool::registerCallback( StoreGateSvc* detStore) StatusCode sc = StatusCode::FAILURE; if (m_alignable) { - if (m_useDynamicAlignFolders) { + { std::string folderName = "/Indet/AlignL1/ID"; if (detStore->contains<CondAttrListCollection>(folderName)) { msg(MSG::DEBUG) << "Registering callback on global Container with folder " << folderName << endmsg; @@ -438,7 +435,7 @@ PixelDetectorTool::registerCallback( StoreGateSvc* detStore) } - else { + { std::string folderName = "/Indet/Align"; if (detStore->contains<AlignableTransformContainer>(folderName)) { if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endmsg; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelSwitches.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelSwitches.cxx index 7de1740d43e48d277f847dce7336fbe5211c3343..fd244ad0111eca751eeb0f2764d40023b3c53e68 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelSwitches.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelSwitches.cxx @@ -13,8 +13,7 @@ PixelSwitches::PixelSwitches() m_alignable(true), m_slhc(false), m_ibl(false), - m_dbm(false), - m_dynAlignFolders(false) + m_dbm(false) {} void PixelSwitches::setServices(bool flag) {m_services = flag;} @@ -47,5 +46,3 @@ bool PixelSwitches::ibl() const {return m_ibl;} void PixelSwitches::setDBM(bool flag) {m_dbm = flag;} //switch to build the DBM bool PixelSwitches::dbm() const {return m_dbm;} -void PixelSwitches::setDynamicAlignFolders(const bool useDynAlignFolders){m_dynAlignFolders = useDynAlignFolders;} -bool PixelSwitches::dynamicAlignFolders() const { return m_dynAlignFolders;} diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorFactory.h b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorFactory.h index 822cea24a084f1dc0b778720200895e2f518b63a..634c767f63553fbefeee324a86c1030ce51b356e 100755 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorFactory.h +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorFactory.h @@ -31,6 +31,9 @@ class SCT_DetectorFactory : public InDetDD::DetectorFactoryBase // Access to the results: virtual const InDetDD::SCT_DetectorManager * getDetectorManager() const; + // Determine which alignment folders are loaded to decide if we register old or new folders + virtual InDetDD::AlignFolderType getAlignFolderType() const; + private: // Copy and assignments operations illegal and so are made private SCT_DetectorFactory(const SCT_DetectorFactory &right); @@ -38,7 +41,6 @@ class SCT_DetectorFactory : public InDetDD::DetectorFactoryBase InDetDD::SCT_DetectorManager *m_detectorManager; SCT_GeometryManager *m_geometryManager; - bool m_useDynamicAlignFolders; }; diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorTool.h b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorTool.h index 3d7db762dc43b7e2708b026dd32ec6e46308192c..503354587f7a3daefd9a1575f789322e2cbec01c 100755 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorTool.h +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_DetectorTool.h @@ -45,7 +45,6 @@ private: bool m_initialLayout; bool m_alignable; bool m_cosmic; - bool m_useDynamicAlignFolders; const InDetDD::SCT_DetectorManager * m_manager; diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_Options.h b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_Options.h index fd79a5649692bf709ce1a415cf741b15b20968a1..e20e1900bc6ea69173d2558135d0971a33ee96ac 100755 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_Options.h +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/SCT_GeoModel/SCT_Options.h @@ -25,9 +25,6 @@ public: void setAlignable(bool flag = true); void setAlignAtModuleLevel(bool flag = true); - //dynamic alignment folders - void setDynamicAlignFolders(const bool flag = true); - bool dynamicAlignFolders() const; private: @@ -36,7 +33,7 @@ private: bool m_dc2Geometry; bool m_alignable; bool m_alignModule; - bool m_dynAlignFolders; //controls which set of alignment folders is used + }; diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorFactory.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorFactory.cxx index 26b5b37ea82c280233ffbc5ed54bcee527388c55..226f75905bb34e17d5881e329c780ef94ab12609 100755 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorFactory.cxx +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorFactory.cxx @@ -63,8 +63,7 @@ using InDetDD::SiCommonItems; SCT_DetectorFactory::SCT_DetectorFactory(const SCT_GeoModelAthenaComps * athenaComps, const SCT_Options & options) - : InDetDD::DetectorFactoryBase(athenaComps), - m_useDynamicAlignFolders(false) + : InDetDD::DetectorFactoryBase(athenaComps) { // Create the detector manager @@ -77,8 +76,6 @@ SCT_DetectorFactory::SCT_DetectorFactory(const SCT_GeoModelAthenaComps * athenaC m_geometryManager = new SCT_GeometryManager(); m_geometryManager->setOptions(options); m_geometryManager->setAthenaComps(athenaComps); - - m_useDynamicAlignFolders = options.dynamicAlignFolders(); // Pass the Athena components the data base access class SCT_DataBase::setAthenaComps(athenaComps); @@ -277,15 +274,14 @@ void SCT_DetectorFactory::create(GeoPhysVol *world) // Register the keys and the level corresponding to the key // and whether it expects a global or local shift. // level 0: sensor, level 1: module, level 2, layer/disc, level 3: whole barrel/enccap + InDetDD::AlignFolderType AlignFolder = getAlignFolderType(); + m_detectorManager->addAlignFolderType(AlignFolder); - - if (!m_useDynamicAlignFolders){ - - m_detectorManager->addAlignFolderType(InDetDD::static_run1); + if (AlignFolder==InDetDD::static_run1){ m_detectorManager->addFolder("/Indet/Align"); m_detectorManager->addChannel("/Indet/Align/ID",3,InDetDD::global); m_detectorManager->addChannel("/Indet/Align/SCT",2,InDetDD::global); - + if (barrelPresent) { m_detectorManager->addChannel("/Indet/Align/SCTB1",1,InDetDD::local); m_detectorManager->addChannel("/Indet/Align/SCTB2",1,InDetDD::local); @@ -315,9 +311,8 @@ void SCT_DetectorFactory::create(GeoPhysVol *world) m_detectorManager->addChannel("/Indet/Align/SCTEC9",1,InDetDD::local); } } - - else { - m_detectorManager->addAlignFolderType(InDetDD::timedependent_run2); + + if (AlignFolder==InDetDD::timedependent_run2){ m_detectorManager->addGlobalFolder("/Indet/AlignL1/ID"); m_detectorManager->addGlobalFolder("/Indet/AlignL2/SCT"); m_detectorManager->addChannel("/Indet/AlignL1/ID",3,InDetDD::global); @@ -366,3 +361,29 @@ const SCT_DetectorManager * SCT_DetectorFactory::getDetectorManager() const } +// Determine which alignment folders are loaded to decide if we register old or new folders +InDetDD::AlignFolderType SCT_DetectorFactory::getAlignFolderType() const +{ + + bool static_folderStruct = false; + bool timedep_folderStruct = false; + if (detStore()->contains<CondAttrListCollection>("/Indet/AlignL1/ID") && + detStore()->contains<CondAttrListCollection>("/Indet/AlignL2/SCT") && + detStore()->contains<AlignableTransformContainer>("/Indet/AlignL3") ) timedep_folderStruct = true; + + if (detStore()->contains<AlignableTransformContainer>("/Indet/Align") ) static_folderStruct = true; + + if (static_folderStruct && !timedep_folderStruct){ + msg(MSG::INFO) << " Static run1 type alignment folder structure found" << endreq; + return InDetDD::static_run1; + } + else if (!static_folderStruct && timedep_folderStruct){ + msg(MSG::INFO) << " Time dependent run2 type alignment folder structure found" << endreq; + return InDetDD::timedependent_run2; + } + else if (static_folderStruct && timedep_folderStruct){ + throw std::runtime_error("Old and new alignment folders are loaded at the same time! This should not happen!"); + } + else return InDetDD::none; + +} diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx index 8eb23959723dc66505f747c5a70dfe8ceb29c929..3153d98a2062cefa169001fb70ff8049026bd219 100755 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_DetectorTool.cxx @@ -42,7 +42,6 @@ SCT_DetectorTool::SCT_DetectorTool( const std::string& type, m_initialLayout(false), m_alignable(true), m_cosmic(false), - m_useDynamicAlignFolders(false), m_manager(0), m_athenaComps(0), m_geoModelSvc("GeoModelSvc",name), @@ -59,7 +58,6 @@ SCT_DetectorTool::SCT_DetectorTool( const std::string& type, declareProperty("GeometryDBSvc", m_geometryDBSvc); declareProperty("GeoModelSvc", m_geoModelSvc); declareProperty("LorentzAngleSvc", m_lorentzAngleSvc); - declareProperty("useDynamicAlignFolders", m_useDynamicAlignFolders); } // @@ -173,7 +171,7 @@ SCT_DetectorTool::create( StoreGateSvc* detStore ) SCT_Options options; options.setAlignable(m_alignable); - options.setDynamicAlignFolders(m_useDynamicAlignFolders); + m_manager = 0; @@ -298,7 +296,7 @@ SCT_DetectorTool::registerCallback( StoreGateSvc* detStore) StatusCode sc = StatusCode::FAILURE; if (m_alignable) { - if (m_useDynamicAlignFolders) { + { std::string folderName = "/Indet/AlignL1/ID"; if (detStore->contains<CondAttrListCollection>(folderName)) { msg(MSG::DEBUG) << "Registering callback on global Container with folder " << folderName << endreq; @@ -350,7 +348,7 @@ SCT_DetectorTool::registerCallback( StoreGateSvc* detStore) } - else { + { std::string folderName = "/Indet/Align"; if (detStore->contains<AlignableTransformContainer>(folderName)) { if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endreq; diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_Options.cxx b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_Options.cxx index 6b7119b2b16a2d774ca051296ea0a99a73b78e44..a8a7557952ae3e16b62af289cd5853018d86f894 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_Options.cxx +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/src/SCT_Options.cxx @@ -9,8 +9,7 @@ SCT_Options::SCT_Options() m_dc1Geometry(false), m_dc2Geometry(true), m_alignable(true), - m_alignModule(true), - m_dynAlignFolders(false) + m_alignModule(true) {} void @@ -77,12 +76,3 @@ SCT_Options::alignAtModuleLevel() const return m_alignModule; } -void SCT_Options::setDynamicAlignFolders(const bool flag) -{ - m_dynAlignFolders = flag; -} - -bool SCT_Options::dynamicAlignFolders() const -{ - return m_dynAlignFolders; -} diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/TRT_GeoModel/TRTDetectorFactory_Full.h b/InnerDetector/InDetDetDescr/TRT_GeoModel/TRT_GeoModel/TRTDetectorFactory_Full.h index dfc5d5326a405c72c01565e92ff689364fcadb8c..8e3d09eadaabcb1aaa1de0834b1e5be89eda3e4f 100755 --- a/InnerDetector/InDetDetDescr/TRT_GeoModel/TRT_GeoModel/TRTDetectorFactory_Full.h +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/TRT_GeoModel/TRTDetectorFactory_Full.h @@ -44,8 +44,7 @@ class TRTDetectorFactory_Full : public InDetDD::DetectorFactoryBase { int overridedigversion, // bool alignable, // bool doArgon, // - bool doKrypton, // - bool useDynamicAlignmentFolders); // + bool doKrypton); // // // // Destructor: // ~TRTDetectorFactory_Full(); // @@ -63,6 +62,8 @@ class TRTDetectorFactory_Full : public InDetDD::DetectorFactoryBase { return n; } + // Determine which alignment folders are loaded to decide if we register old or new folders + virtual InDetDD::AlignFolderType getAlignFolderType() const; private: @@ -104,7 +105,6 @@ class TRTDetectorFactory_Full : public InDetDD::DetectorFactoryBase { bool m_strawsvcavailable; bool m_doArgon; bool m_doKrypton; - bool m_useDynamicAlignFolders; }; #endif // TRTDetectorFactory_Full_h diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/TRT_GeoModel/TRT_DetectorTool.h b/InnerDetector/InDetDetDescr/TRT_GeoModel/TRT_GeoModel/TRT_DetectorTool.h index 291ca80bcc0b0d6301edb2509d7a50d5f95b94de..658ad2cd8881123c38ce6abe4dc75d63b0a318a7 100755 --- a/InnerDetector/InDetDetDescr/TRT_GeoModel/TRT_GeoModel/TRT_DetectorTool.h +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/TRT_GeoModel/TRT_DetectorTool.h @@ -58,7 +58,6 @@ public: bool m_doArgonMixture; bool m_doKryptonMixture; - bool m_useDynamicAlignFolders; const InDetDD::TRT_DetectorManager * m_manager; InDetDD::AthenaComps * m_athenaComps; diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx index 9c00f02ef21c89819f52deffc6e8e6f448058d0e..b0c95bf37365760f605d433578bd5f06ed74a17d 100755 --- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx @@ -69,8 +69,7 @@ TRTDetectorFactory_Full::TRTDetectorFactory_Full(const InDetDD::AthenaComps * at int overridedigversion, bool alignable, bool doArgon, - bool doKrypton, - bool useDynamicAlignmentFolders) + bool doKrypton) : InDetDD::DetectorFactoryBase(athenaComps), m_detectorManager(0), m_materialManager(0), @@ -82,10 +81,9 @@ TRTDetectorFactory_Full::TRTDetectorFactory_Full(const InDetDD::AthenaComps * at m_sumSvc("TRT_StrawStatusSummarySvc","InDetTRTStrawStatusSummarySvc"), m_strawsvcavailable(0), m_doArgon(doArgon), - m_doKrypton(doKrypton), - m_useDynamicAlignFolders(useDynamicAlignmentFolders) + m_doKrypton(doKrypton) { - m_sumSvc=m_summarySvc; +m_sumSvc=m_summarySvc; } ////////////////////////////////////////////////////////////////////////////////// @@ -282,9 +280,10 @@ void TRTDetectorFactory_Full::create(GeoPhysVol *world) const int AlignmentLevelTop = 3; // Level 1 if (m_alignable) { + InDetDD::AlignFolderType AlignFolder = getAlignFolderType(); + m_detectorManager->addAlignFolderType(AlignFolder); - if (!m_useDynamicAlignFolders){ - m_detectorManager->addAlignFolderType(InDetDD::static_run1); + if (AlignFolder==InDetDD::static_run1){ m_detectorManager->addFolder("/TRT/Align"); m_detectorManager->addChannel("/TRT/Align/TRT", AlignmentLevelTop, InDetDD::global); @@ -301,9 +300,7 @@ void TRTDetectorFactory_Full::create(GeoPhysVol *world) } } - else { - m_detectorManager->addAlignFolderType(InDetDD::timedependent_run2); - + if (AlignFolder==InDetDD::timedependent_run2){ m_detectorManager->addGlobalFolder("/TRT/AlignL1/TRT"); m_detectorManager->addChannel("/TRT/AlignL1/TRT", AlignmentLevelTop, InDetDD::global); m_detectorManager->addFolder("/TRT/AlignL2"); @@ -2572,4 +2569,30 @@ TRTDetectorFactory_Full::ActiveGasMixture TRTDetectorFactory_Full::DecideGasMixt return return_agm; } +// Determine which alignment folders are loaded to decide if we register old or new folders +InDetDD::AlignFolderType TRTDetectorFactory_Full::getAlignFolderType() const +{ + + bool static_folderStruct = false; + bool timedep_folderStruct = false; + if (detStore()->contains<CondAttrListCollection>("/TRT/AlignL1/TRT") && + detStore()->contains<AlignableTransformContainer>("/TRT/AlignL2") ) timedep_folderStruct = true; + + if (detStore()->contains<AlignableTransformContainer>("/TRT/Align") ) static_folderStruct = true; + + if (static_folderStruct && !timedep_folderStruct){ + msg(MSG::INFO) << " Static run1 type alignment folder structure found" << endreq; + return InDetDD::static_run1; + } + else if (!static_folderStruct && timedep_folderStruct){ + msg(MSG::INFO) << " Time dependent run2 type alignment folder structure found" << endreq; + return InDetDD::timedependent_run2; + } + else if (static_folderStruct && timedep_folderStruct){ + throw std::runtime_error("Old and new alignment folders are loaded at the same time! This should not happen!"); + } + else return InDetDD::none; + +} + ////////////////////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx index ceeb7e221206fff876ab7ae5ebc483d890c8e6ea..4aced09164cf774020959094c7b3fe94933b21e4 100755 --- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx @@ -38,7 +38,6 @@ TRT_DetectorTool::TRT_DetectorTool( const std::string& type, const std::string& m_sumSvc("TRT_StrawStatusSummarySvc", name), m_doArgonMixture(0), m_doKryptonMixture(0), - m_useDynamicAlignFolders(false), m_manager(0), m_athenaComps(0) { @@ -52,8 +51,6 @@ TRT_DetectorTool::TRT_DetectorTool( const std::string& type, const std::string& declareProperty("InDetTRTStrawStatusSummarySvc", m_sumSvc); // need for Argon declareProperty("DoXenonArgonMixture", m_doArgonMixture); // Set to 1 to use argon. DEFAULT VALUE is 0. Overridden by DOARGONMIXTURE switch declareProperty("DoKryptonMixture", m_doKryptonMixture); // Set to 1 to use krypton. DEFAULT VALUE is 0. Overridden by DOKRYPTONMIXTURE switch - declareProperty("useDynamicAlignFolders", m_useDynamicAlignFolders); - } @@ -212,8 +209,7 @@ StatusCode TRT_DetectorTool::create( StoreGateSvc* detStore ) m_overridedigversion, m_alignable, m_doArgonMixture, - m_doKryptonMixture, - m_useDynamicAlignFolders + m_doKryptonMixture ); theTRTFactory.create(world); m_manager=theTRTFactory.getDetectorManager(); @@ -248,59 +244,59 @@ TRT_DetectorTool::registerCallback( StoreGateSvc* detStore) if (m_alignable) { - + // Regular alignment new shema { + std::string folderName = "/TRT/AlignL1/TRT"; + if (detStore->contains<CondAttrListCollection>(folderName)) { + msg(MSG::DEBUG) << "Registering callback on global Container with folder " << folderName << endreq; + const DataHandle<CondAttrListCollection> calc; + StatusCode trttmp = detStore->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool*>(this), calc, folderName); + // We don't expect this to fail as we have already checked that the detstore contains the object. + if (trttmp.isFailure()) { + msg(MSG::ERROR) << "Problem when register callback on global Container with folder " << folderName <<endreq; + } else { + sc = StatusCode::SUCCESS; + } + } else { + msg(MSG::WARNING) << "Unable to register callback on global Container with folder " << folderName <<endreq; + //return StatusCode::FAILURE; + } - if (m_useDynamicAlignFolders){ // Regular alignment new shema - std::string folderName = "/TRT/AlignL1/TRT"; - if (detStore->contains<CondAttrListCollection>(folderName)) { - msg(MSG::DEBUG) << "Registering callback on global Container with folder " << folderName << endreq; - const DataHandle<CondAttrListCollection> calc; - StatusCode trttmp = detStore->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool*>(this), calc, folderName); - // We don't expect this to fail as we have already checked that the detstore contains the object. - if (trttmp.isFailure()) { - msg(MSG::ERROR) << "Problem when register callback on global Container with folder " << folderName <<endreq; - } else { - sc = StatusCode::SUCCESS; - } - } else { - msg(MSG::WARNING) << "Unable to register callback on global Container with folder " << folderName <<endreq; - //return StatusCode::FAILURE; - } - - folderName = "/TRT/AlignL2"; - if (detStore->contains<AlignableTransformContainer>(folderName)) { - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endreq; - const DataHandle<AlignableTransformContainer> atc; - StatusCode sctmp = detStore->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, folderName); - if(sctmp.isFailure()) { - msg(MSG::ERROR) << "Problem when register callback on AlignableTransformContainer with folder " << folderName <<endreq; - } else { - sc = StatusCode::SUCCESS; - } - } - else { - msg(MSG::WARNING) << "Unable to register callback on AlignableTransformContainer with folder " - << folderName << endreq; - //return StatusCode::FAILURE; - } + folderName = "/TRT/AlignL2"; + if (detStore->contains<AlignableTransformContainer>(folderName)) { + if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endreq; + const DataHandle<AlignableTransformContainer> atc; + StatusCode sctmp = detStore->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, folderName); + if(sctmp.isFailure()) { + msg(MSG::ERROR) << "Problem when register callback on AlignableTransformContainer with folder " << folderName <<endreq; + } else { + sc = StatusCode::SUCCESS; + } + } + else { + msg(MSG::WARNING) << "Unable to register callback on AlignableTransformContainer with folder " + << folderName << endreq; + //return StatusCode::FAILURE; } - else { // Regular alignment old schema - std::string folderName = "/TRT/Align"; - if (detStore->contains<AlignableTransformContainer>(folderName)) { - msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endreq; - const DataHandle<AlignableTransformContainer> atc; - StatusCode sctmp = detStore->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, folderName); - // We don't expect this to fail as we have already checked that the detstore contains the object. - if (sctmp.isFailure()) { - msg(MSG::ERROR) << "Problem when register callback on AlignableTransformContainer with folder " << folderName <<endreq; - } else { - sc = StatusCode::SUCCESS; - } + } + + + // Regular alignment + { + std::string folderName = "/TRT/Align"; + if (detStore->contains<AlignableTransformContainer>(folderName)) { + msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endreq; + const DataHandle<AlignableTransformContainer> atc; + StatusCode sctmp = detStore->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, folderName); + // We don't expect this to fail as we have already checked that the detstore contains the object. + if (sctmp.isFailure()) { + msg(MSG::ERROR) << "Problem when register callback on AlignableTransformContainer with folder " << folderName <<endreq; } else { - msg(MSG::WARNING) << "Unable to register callback on AlignableTransformContainer with folder " - << folderName << ", Alignments disabled! (Only if no Run2 schema is loaded)" << endreq; + sc = StatusCode::SUCCESS; } + } else { + msg(MSG::WARNING) << "Unable to register callback on AlignableTransformContainer with folder " + << folderName << ", Alignments disabled! (Only if no Run2 schema is loaded)" << endreq; } } diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py index f90df27a4e91d2eb3e0084426692941caa608fc5..9322b4710d7d7a27261ab0652c7c342020a5dfc2 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py @@ -420,6 +420,12 @@ class doMonitoringAlignment(InDetFlagsJobProperty): allowedTypes = ['bool'] StoredValue = False +class useDynamicAlignFolders(InDetFlagsJobProperty): + """ Use to turn on dynamic alignment constants folder scheme (new development for 2016) """ + statusOn = True + allowedTypes = ['bool'] + StoredValue = False + class doPerfMon(InDetFlagsJobProperty): """ Use to turn on PerfMon """ statusOn = True @@ -2518,9 +2524,7 @@ class InDetJobProperties(JobPropertyContainer): print '* use non-standard SCT DCS based on ~20V HV cut' if self.useTrtDCS(): print '* use TRT DCS' - - from AtlasGeoModel.InDetGMJobProperties import GeometryFlags as geoFlags - if geoFlags.useDynamicAlignFolders(): + if self.useDynamicAlignFolders(): print '* use of Dynamic alignment folder scheme enabled' if not self.doPRDFormation(): @@ -2660,6 +2664,7 @@ _list_InDetJobProperties = [Enabled, doMonitoringSCT, doMonitoringTRT, doMonitoringAlignment, + useDynamicAlignFolders, doPerfMon, AODall, useBeamConstraint,