diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx index e8b1c8df7a08686ad25ea969269e8f77652b98c2..c1908e1af419d076786ccd6420e42c93915eefdc 100755 --- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRTDetectorFactory_Full.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "GeoPrimitives/GeoPrimitives.h" @@ -965,38 +965,37 @@ void TRTDetectorFactory_Full::create(GeoPhysVol *world) // In barrel frame (generally the same as the global frame) m_detectorManager->addAlignableTransform(AlignmentLevelModule, idModule, xfx1, pShell, pBarrelVol); - Identifier TRT_Identifier; // Add the substructure here: pShell->add(new GeoIdentifierTag(iABC)); - TRT_Identifier = idHelper->straw_id(1, iMod, iABC, 1, 1); - int strawStatusHT = TRTCond::StrawStatus::Good; - if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier); - ActiveGasMixture agm = DecideGasMixture(strawStatusHT); - - // Ruslan: insert radiators with Ar-straws - // Artem: same for Kr - switch (agm) - { - case GM_ARGON: - ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier)); - pShell->add(pRadAR); - break; - case GM_KRYPTON: - ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier)); - pShell->add(pRadKR); - break; - case GM_XENON: - ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier) ); - pShell->add(pRad); - break; - default: - ATH_MSG_FATAL( "Unexpected gas mixture: " << agm ); - throw std::runtime_error("Unexpected gas mixture"); - return; - } + Identifier TRT_Identifier = idHelper->straw_id(1, iMod, iABC, 1, 1); + int strawStatusHT = TRTCond::StrawStatus::Good; + if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier); + ActiveGasMixture agm = DecideGasMixture(strawStatusHT); + + // Ruslan: insert radiators with Ar-straws + // Artem: same for Kr + switch (agm) + { + case GM_ARGON: + ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier)); + pShell->add(pRadAR); + break; + case GM_KRYPTON: + ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier)); + pShell->add(pRadKR); + break; + case GM_XENON: + ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier) ); + pShell->add(pRad); + break; + default: + ATH_MSG_FATAL( "Unexpected gas mixture: " << agm ); + throw std::runtime_error("Unexpected gas mixture"); + return; + } //-------------------------------------------------------------------// // // @@ -1279,37 +1278,36 @@ void TRTDetectorFactory_Full::create(GeoPhysVol *world) phiPlane += deltaPhiForStrawsA; } - Identifier TRT_Identifier; - int bar_ec = (iiSide) ? -2 : +2; - TRT_Identifier = idHelper->straw_id(bar_ec, 1, iiWheel, 1, 1); - int strawStatusHT = TRTCond::StrawStatus::Good; - if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier); - ActiveGasMixture agm = DecideGasMixture(strawStatusHT); + int bar_ec = (iiSide) ? -2 : +2; + Identifier TRT_Identifier = idHelper->straw_id(bar_ec, 1, iiWheel, 1, 1); + int strawStatusHT = TRTCond::StrawStatus::Good; + if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier); + ActiveGasMixture agm = DecideGasMixture(strawStatusHT); - // Ruslan: insert plane with Ar-straws - // Artem: same for Kr - switch (agm) - { - case GM_ARGON: - ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier) ); - childPlane = pStrawPlaneA_Ar->clone(); - break; - case GM_KRYPTON: - ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier) ); - childPlane = pStrawPlaneA_Kr->clone(); - break; - case GM_XENON: - ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier) ); - childPlane = pStrawPlaneA->clone(); - break; - default: - ATH_MSG_FATAL( "Unexpected gas mixture: " << agm ); - throw std::runtime_error("Unexpected gas mixture"); - return; - } + // Ruslan: insert plane with Ar-straws + // Artem: same for Kr + switch (agm) + { + case GM_ARGON: + ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier) ); + childPlane = pStrawPlaneA_Ar->clone(); + break; + case GM_KRYPTON: + ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier) ); + childPlane = pStrawPlaneA_Kr->clone(); + break; + case GM_XENON: + ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier) ); + childPlane = pStrawPlaneA->clone(); + break; + default: + ATH_MSG_FATAL( "Unexpected gas mixture: " << agm ); + throw std::runtime_error("Unexpected gas mixture"); + return; + } xfPlane = new GeoTransform(GeoTrf::TranslateZ3D(m_data->endCapLayerZPositionA[iiPlane] - m_data->endCapLengthOfWheelsA/2)*GeoTrf::RotateZ3D(phiPlane)); @@ -1579,40 +1577,37 @@ void TRTDetectorFactory_Full::create(GeoPhysVol *world) m_detectorManager->addAlignableTransform(AlignmentLevelSubWheel, idSubModule, xfAlignableModule, pWheelB); } - Identifier TRT_Identifier; - int bar_ec = (iiSide) ? -2 : +2; - TRT_Identifier = idHelper->straw_id(bar_ec, 1, iiWheel, 1, 1); - int strawStatusHT = TRTCond::StrawStatus::Good; - if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier); - ActiveGasMixture agm = DecideGasMixture(strawStatusHT); + int bar_ec = (iiSide) ? -2 : +2; + Identifier TRT_Identifier = idHelper->straw_id(bar_ec, 1, iiWheel, 1, 1); + int strawStatusHT = TRTCond::StrawStatus::Good; + if (m_strawsvcavailable && (m_doArgon || m_doKrypton)) strawStatusHT = m_sumTool->getStatusHT(TRT_Identifier); + ActiveGasMixture agm = DecideGasMixture(strawStatusHT); - //Ruslan: insert plane with Ar-straws - //Artem: same for Kr - switch (agm) - { - case GM_ARGON: - ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier) ); - childPlane = pStrawPlaneB_Ar->clone(); - break; - case GM_KRYPTON: - ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier)); - childPlane = pStrawPlaneB_Kr->clone(); - break; - case GM_XENON: - ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t" - << idHelper->print_to_string(TRT_Identifier)); - childPlane = pStrawPlaneB->clone(); - break; - default: - ATH_MSG_FATAL( "Unexpected gas mixture: " << agm); - throw std::runtime_error("Unexpected gas mixture"); - return; - } + //Ruslan: insert plane with Ar-straws + //Artem: same for Kr + switch (agm) + { + case GM_ARGON: + ATH_MSG_DEBUG( "Marking Argon straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier) ); + childPlane = pStrawPlaneB_Ar->clone(); + break; + case GM_KRYPTON: + ATH_MSG_DEBUG( "Marking Krypton straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier)); + childPlane = pStrawPlaneB_Kr->clone(); + break; + case GM_XENON: + ATH_MSG_DEBUG( "Marking Xenon straws from /TRT/Cond/StatusHT:\t" + << idHelper->print_to_string(TRT_Identifier)); + childPlane = pStrawPlaneB->clone(); + break; + default: + ATH_MSG_FATAL( "Unexpected gas mixture: " << agm); + throw std::runtime_error("Unexpected gas mixture"); + return; + } -// childPlane = pStrawPlaneB->clone(); - // phiPlane is phi of straw 0, sector 0 (online numbering) double phiPlane = m_data->endCapPhiOfFirstStraw + RotationsOfStrawPlanes[iiPlane%nStrawLayMaxEc]*deltaPhiForStrawsB; diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx index 28651a2f88392eefb605f93fef57657b2fc74482..fe917993d7abc0d50fe9b2a17ad0855e6a6e1df0 100755 --- a/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/src/TRT_DetectorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "TRT_DetectorTool.h" @@ -23,12 +23,6 @@ #include "CxxUtils/checker_macros.h" -//////////////////////////////////////////////////////////////////////////////////////////////////////// -// Please consult the README for more information about which options to set in your joboptions file. // -//////////////////////////////////////////////////////////////////////////////////////////////////////// - - - /////////////////////////////////// Constructor ////////////////////////////////// // TRT_DetectorTool::TRT_DetectorTool( const std::string& type, const std::string& name, const IInterface* parent ) @@ -76,17 +70,9 @@ StatusCode TRT_DetectorTool::create() // Get the straw status tool ATH_CHECK(m_sumTool.retrieve()); - DecodeVersionKey versionKey(&*m_geoDbTagSvc, "TRT"); - - // Unless we are using custom trt, the switch positions are going to - // come from the database: - ATH_MSG_INFO( "Building TRT with Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node() ); - - ServiceHandle<IRDBAccessSvc> accessSvc(m_geoDbTagSvc->getParamSvcName(),name()); ATH_CHECK( accessSvc.retrieve()); - // // Locate the top level experiment node // @@ -97,6 +83,16 @@ StatusCode TRT_DetectorTool::create() } GeoPhysVol *world = theExpt->getPhysVol(); + // Retrieve the Geometry DB Interface + ATH_CHECK( m_geometryDBSvc.retrieve() ); + + // Pass athena services to factory, etc + m_athenaComps = new InDetDD::AthenaComps("TRT_GeoModel"); + m_athenaComps->setDetStore(detStore().operator->()); + m_athenaComps->setGeoDbTagSvc(m_geoDbTagSvc.get()); + m_athenaComps->setRDBAccessSvc(accessSvc.get()); + m_athenaComps->setGeometryDBSvc(m_geometryDBSvc.get()); + GeoModelIO::ReadGeoModel* sqliteReader = m_geoDbTagSvc->getSqliteReader(); // // If we are using the SQLite reader, then we are not building the raw geometry but @@ -104,67 +100,29 @@ StatusCode TRT_DetectorTool::create() // taken in this factory. // if (sqliteReader) { - - if ( nullptr == m_detector ) { - - // Retrieve the Geometry DB Interface - ATH_CHECK( m_geometryDBSvc.retrieve() ); - - // Pass athena services to factory, etc - m_athenaComps = new InDetDD::AthenaComps("TRT_GeoModel"); - m_athenaComps->setDetStore(detStore().operator->()); - m_athenaComps->setGeoDbTagSvc(&*m_geoDbTagSvc); - m_athenaComps->setRDBAccessSvc(&*accessSvc); - m_athenaComps->setGeometryDBSvc(&*m_geometryDBSvc); - - ATH_MSG_INFO( " Building TRT geometry from GeoModel factory TRTDetectorFactory_Lite" ); - - - TRTDetectorFactory_Lite theTRTFactory(sqliteReader, - m_athenaComps, - m_sumTool.get(), - m_useOldActiveGasMixture, - m_DC2CompatibleBarrelCoordinates, - m_overridedigversion, - m_alignable, - m_useDynamicAlignFolders - ); - - theTRTFactory.create(world); - - m_manager=theTRTFactory.getDetectorManager(); - - // Register the TRTDetectorNode instance with the Transient Detector Store - if (m_manager) { - theExpt->addManager(m_manager); - - StatusCode sc = detStore()->record(m_manager,m_manager->getName()); - if (sc.isFailure() ) { - ATH_MSG_ERROR("Could not register TRT_DetectorManager"); - return( StatusCode::FAILURE ); - } - - ATH_MSG_INFO("TRT from SQLite BUILT!"); - return StatusCode::SUCCESS; - - } - } - - return StatusCode::FAILURE; - - + ATH_MSG_INFO( " Building TRT geometry from GeoModel factory TRTDetectorFactory_Lite" ); + TRTDetectorFactory_Lite theTRTFactory(sqliteReader, + m_athenaComps, + m_sumTool.get(), + m_useOldActiveGasMixture, + m_DC2CompatibleBarrelCoordinates, + m_overridedigversion, + m_alignable, + m_useDynamicAlignFolders + ); + + theTRTFactory.create(world); + m_manager=theTRTFactory.getDetectorManager(); } - - - else { + DecodeVersionKey versionKey(m_geoDbTagSvc.get(), "TRT"); + ATH_MSG_INFO( "Building TRT with Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node() ); // Print the TRT version tag: std::string trtVersionTag = accessSvc->getChildTag("TRT", versionKey.tag(), versionKey.node()); ATH_MSG_INFO("TRT Version: " << trtVersionTag ); - // Check if version is empty. If so, then the TRT cannot be built. This may or may not be intentional. We // just issue an INFO message. if (trtVersionTag.empty()) { @@ -172,116 +130,75 @@ StatusCode TRT_DetectorTool::create() return StatusCode::SUCCESS; } - std::string versionName; - if (versionKey.custom()) { - - ATH_MSG_WARNING( "TRT_DetectorTool: Detector Information coming from a custom configuration!!" ); - - } else { - ATH_MSG_DEBUG( "TRT_DetectorTool: Detector Information coming from the database and job options IGNORED."); - - ATH_MSG_DEBUG( "Keys for TRT Switches are " << versionKey.tag() << " " << versionKey.node() ); - IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr("TRTSwitches", versionKey.tag(), versionKey.node()); - const IRDBRecord *switches = (*switchSet)[0]; - - //Should be stored as booleans? - if (switches->getInt("DC1COMPATIBLE")) { - ATH_MSG_ERROR( "DC1COMPATIBLE flag set in database," - << " but DC1 is no longer supported in the code!!"); - } - m_DC2CompatibleBarrelCoordinates = switches->getInt("DC2COMPATIBLE"); - m_useOldActiveGasMixture = ( switches->getInt("GASVERSION") == 0 ); - m_initialLayout = switches->getInt("INITIALLAYOUT"); + ATH_MSG_DEBUG( "Keys for TRT Switches are " << versionKey.tag() << " " << versionKey.node() ); + IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr("TRTSwitches", versionKey.tag(), versionKey.node()); + const IRDBRecord *switches = (*switchSet)[0]; + if (switches->getInt("DC1COMPATIBLE")) { + ATH_MSG_ERROR( "DC1COMPATIBLE flag set in database, but DC1 is no longer supported in the code!!"); + return StatusCode::FAILURE; + } + + m_DC2CompatibleBarrelCoordinates = switches->getInt("DC2COMPATIBLE"); + m_useOldActiveGasMixture = ( switches->getInt("GASVERSION") == 0 ); + m_initialLayout = switches->getInt("INITIALLAYOUT"); - // Check if the new switches exists: - //bool result = true; - if ((m_doArgonMixture == 1) ||( m_doKryptonMixture == 1) ){ - try { - if(!switches->isFieldNull( "DOARGONMIXTURE")) { - if ( switches->getInt("DOARGONMIXTURE") == 0) m_doArgonMixture = 0; - else if ( switches->getInt("DOARGONMIXTURE") == 1) m_doArgonMixture = 1; - } else { - ATH_MSG_INFO( "Parameter DOARGONMIXTURE not available, m_doArgonMixture= " << m_doArgonMixture ); - } - - if(!switches->isFieldNull( "DOKRYPTONMIXTURE")) { - if ( switches->getInt("DOKRYPTONMIXTURE") == 0) m_doKryptonMixture = 0; - else if ( switches->getInt("DOKRYPTONMIXTURE") == 1) m_doKryptonMixture = 1; - } else { - ATH_MSG_INFO( "Parameter DOKRYPTONMIXTURE not available, m_doKryptonMixture= " << m_doKryptonMixture ); - } - } - catch(std::runtime_error& ex) { - ATH_MSG_INFO( "Exception caught: " << ex.what() ); - } - } - if (!switches->isFieldNull("VERSIONNAME")) { - versionName = switches->getString("VERSIONNAME"); + // Check if the new switches exists: + if ((m_doArgonMixture == 1) ||( m_doKryptonMixture == 1) ){ + if(!switches->isFieldNull( "DOARGONMIXTURE")) { + if ( switches->getInt("DOARGONMIXTURE") == 0) { m_doArgonMixture = 0; } + else if ( switches->getInt("DOARGONMIXTURE") == 1) { m_doArgonMixture = 1; } + } else { + ATH_MSG_INFO( "Parameter DOARGONMIXTURE not available, m_doArgonMixture= " << m_doArgonMixture ); } - }; - - // Set version name if it empty. This is only needed for preDC3 geometries. - if (versionName.empty()) { - if (m_DC2CompatibleBarrelCoordinates) { - versionName = "DC2"; + + if(!switches->isFieldNull( "DOKRYPTONMIXTURE")) { + if ( switches->getInt("DOKRYPTONMIXTURE") == 0) { m_doKryptonMixture = 0; } + else if ( switches->getInt("DOKRYPTONMIXTURE") == 1) { m_doKryptonMixture = 1; } } else { - versionName = "Rome"; + ATH_MSG_INFO( "Parameter DOKRYPTONMIXTURE not available, m_doKryptonMixture= " << m_doKryptonMixture ); } } + ATH_MSG_INFO( "Creating the TRT" ); - ATH_MSG_INFO( "TRT Geometry Options:" ); - ATH_MSG_INFO( " UseOldActiveGasMixture = " << (m_useOldActiveGasMixture ? "true" : "false") ); - ATH_MSG_INFO( " Do Argon = " << (m_doArgonMixture ? "true" : "false") ); - ATH_MSG_INFO( " Do Krypton = " << (m_doKryptonMixture ? "true" : "false") ); - ATH_MSG_INFO( " DC2CompatibleBarrelCoordinates = " << (m_DC2CompatibleBarrelCoordinates ? "true" : "false")); - ATH_MSG_INFO( " InitialLayout = " << (m_initialLayout ? "true" : "false") ); - ATH_MSG_INFO( " Alignable = " << (m_alignable ? "true" : "false") ); - ATH_MSG_INFO( " VersioName = " << versionName ); - - // Retrieve the Geometry DB Interface - ATH_CHECK( m_geometryDBSvc.retrieve() ); - - // Pass athena services to factory, etc - m_athenaComps = new InDetDD::AthenaComps("TRT_GeoModel"); - m_athenaComps->setDetStore(detStore().operator->()); - m_athenaComps->setGeoDbTagSvc(&*m_geoDbTagSvc); - m_athenaComps->setRDBAccessSvc(&*accessSvc); - m_athenaComps->setGeometryDBSvc(&*m_geometryDBSvc); - - - if ( nullptr == m_detector ) { - - ATH_MSG_INFO( " Building TRT geometry from GeoModel factory TRTDetectorFactory_Full" ); - - TRTDetectorFactory_Full theTRTFactory(m_athenaComps, - m_sumTool.get(), - m_useOldActiveGasMixture, - m_DC2CompatibleBarrelCoordinates, - m_overridedigversion, - m_alignable, - m_doArgonMixture, - m_doKryptonMixture, - m_useDynamicAlignFolders - ); - theTRTFactory.create(world); - m_manager=theTRTFactory.getDetectorManager(); - - // Register the TRTDetectorNode instance with the Transient Detector Store - if (m_manager) { - theExpt->addManager(m_manager); - - StatusCode sc = detStore()->record(m_manager,m_manager->getName()); - if (sc.isFailure() ) { - ATH_MSG_ERROR("Could not register TRT_DetectorManager"); - return( StatusCode::FAILURE ); - } + ATH_MSG_INFO( "TRT Geometry Options:" << std::boolalpha ); + ATH_MSG_INFO( " UseOldActiveGasMixture = " << m_useOldActiveGasMixture ); + ATH_MSG_INFO( " Do Argon = " << m_doArgonMixture ); + ATH_MSG_INFO( " Do Krypton = " << m_doKryptonMixture ); + ATH_MSG_INFO( " DC2CompatibleBarrelCoordinates = " << m_DC2CompatibleBarrelCoordinates ); + ATH_MSG_INFO( " InitialLayout = " << m_initialLayout ); + ATH_MSG_INFO( " Alignable = " << m_alignable ); + ATH_MSG_INFO( " VersioName = " << switches->getString("VERSIONNAME") ); + + ATH_MSG_INFO( " Building TRT geometry from GeoModel factory TRTDetectorFactory_Full" ); + + TRTDetectorFactory_Full theTRTFactory(m_athenaComps, + m_sumTool.get(), + m_useOldActiveGasMixture, + m_DC2CompatibleBarrelCoordinates, + m_overridedigversion, + m_alignable, + m_doArgonMixture, + m_doKryptonMixture, + m_useDynamicAlignFolders + ); + theTRTFactory.create(world); + m_manager=theTRTFactory.getDetectorManager(); + + } + + // Register the TRTDetectorNode instance with the Transient Detector Store + if (m_manager) { + theExpt->addManager(m_manager); - return StatusCode::SUCCESS; - } + StatusCode sc = detStore()->record(m_manager,m_manager->getName()); + if (sc.isFailure() ) { + ATH_MSG_ERROR("Could not register TRT_DetectorManager"); + return( StatusCode::FAILURE ); } - return StatusCode::FAILURE; + return StatusCode::SUCCESS; } + return StatusCode::FAILURE; }