diff --git a/CMakeLists.txt b/CMakeLists.txt index f7e7029343913c3e7b8d4bd235339fe703584963..75a280a29a901c5b8d3d7789d2b3fb55d960c7c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,8 @@ include_directories(Core/include Detector/Rich1/include Detector/Rich2/include Detector/Magnet/include - Detector/Muon/include) + Detector/Muon/include + Detector/CB/include) dd4hep_configure_output (INSTALL ${CMAKE_INSTALL_PREFIX}) @@ -168,6 +169,14 @@ add_library(DetectorLib SHARED Detector/Muon/src/ReadoutCond.cpp Detector/Muon/src/ReadoutCondJson.cpp Detector/Muon/src/Tell40PCIBoard.cpp + Detector/CB/src/CODEXb_geo.cpp + Detector/CB/src/DeCB.cpp + Detector/CB/src/DeCBFace.cpp + Detector/CB/src/DeCBConditionCalls.cpp + Detector/CB/src/DeCBTriplet.cpp + Detector/CB/src/DeCBGasGap.cpp + Detector/CB/src/DeCBHandles.cpp + ) if(CMAKE_CXX_COMPILER_ID STREQUAL Clang AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16) @@ -183,6 +192,7 @@ target_include_directories(DetectorLib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Detector/Muon/include/> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Detector/FT/include/> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Detector/Magnet/include/> + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Detector/CB/include/> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Detector/Rich/include/> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Detector/Rich1/include/> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Detector/Rich2/include/> @@ -258,6 +268,9 @@ add_detector_plugin(DetectorPlugins Detector/Infrastructure/src/BLS_geo.cpp Detector/Infrastructure/src/DetectorRegion.cpp Detector/Infrastructure/src/MBXW_geo.cpp + Detector/CB/src/CB_Cond.cpp + Detector/CB/src/CODEXb_geo.cpp + ) set(FS_LIBS stdc++fs) target_link_libraries(DetectorPlugins GitCondDB::GitCondDB ${FS_LIB} DetectorLib) @@ -309,7 +322,7 @@ endif() install(DIRECTORY Core/include Detector/VP/include Detector/FT/include Detector/Magnet/include Detector/Rich/include Detector/Rich1/include Detector/Rich2/include Detector/Calo/include Detector/Muon/include - Detector/UT/include Detector/FT/include Detector/MP/include Detector/LHCb/include Detector/TV/include Detector/UP/include + Detector/UT/include Detector/FT/include Detector/CB/include Detector/MP/include Detector/LHCb/include Detector/TV/include Detector/UP/include DESTINATION .) install(DIRECTORY compact DESTINATION .) @@ -355,7 +368,7 @@ export PATH=${PROJECT_BINARY_DIR}/bin:${CMAKE_BINARY_DIR}/toolchain:${DD4hep_DIR export LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/lib:${DD4hep_DIR}/lib:\$LD_LIBRARY_PATH export PYTHONPATH=${DD4hep_DIR}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages:\$PYTHONPATH -export ROOT_INCLUDE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/Detector/UT/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/VP/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/FT/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/MP/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/TV/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/MT/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/UP/include:${CMAKE_CURRENT_SOURCE_DIR}/Core/include:${GitCondDB_DIR}/../../../include:${DD4hep_DIR}/include:\$ROOT_INCLUDE_PATH +export ROOT_INCLUDE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/Detector/UT/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/VP/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/CB/include:${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_SOURCE_DIR}/Detector/FT/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/MP/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/TV/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/MT/include:${CMAKE_CURRENT_SOURCE_DIR}/Detector/UP/include:${CMAKE_CURRENT_SOURCE_DIR}/Core/include:${GitCondDB_DIR}/../../../include:${DD4hep_DIR}/include:\$ROOT_INCLUDE_PATH exec " _run_data "${_run_data}") file(WRITE ${PROJECT_BINARY_DIR}/bin/run "${_run_data}") diff --git a/Detector/CB/include/Detector/CB/CBChannelID.h b/Detector/CB/include/Detector/CB/CBChannelID.h new file mode 100644 index 0000000000000000000000000000000000000000..4e3d1d6fa74677e08bd164bee16ce0758c9ac3d3 --- /dev/null +++ b/Detector/CB/include/Detector/CB/CBChannelID.h @@ -0,0 +1,82 @@ +/*****************************************************************************\ +* (c) Copyright 2024 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#pragma once +#include "CBConstants.h" +#include <algorithm> +#include <bitset> +#include <cassert> +#include <fmt/format.h> +#include <iostream> +#include <ostream> +#include <vector> + +namespace CBConstants = LHCb::Detector::CB; +namespace LHCb::Detector { + + class CBChannelID final { + + public: + // Default Constructor + constexpr CBChannelID() = default; + + // Constructor from int + explicit CBChannelID(int sensVolID) { + int firstDigit = sensVolID / 1000000 % 10 - 1; + int secondDigit = sensVolID / 100000 % 10 - 1; + int thirdDigit = sensVolID / 10000 % 10 - 1; + int fourthDigit = sensVolID / 1000 % 10; + int fifthDigit = sensVolID / 100 % 10; + int sixthDigit = sensVolID / 10 % 10; + int seventhDigit = sensVolID % 10; + + /* std::cout << "-----------------" << std::endl; + std::cout << "sensVolID: " << sensVolID << std::endl; + std::cout << "-----------------" << std::endl; + std::cout << "firstDigit: " << firstDigit <<"Bitwise" <<std::bitset<3>(firstDigit & 0b111)<< std::endl; + std::cout << "-----------------" << std::endl; + std::cout << "secondDigit: " << secondDigit <<"Bitwise" <<std::bitset<1>(secondDigit & 0b1)<< std::endl; + std::cout << "-----------------" << std::endl; + std::cout << "thirdDigit: " << thirdDigit <<"Bitwise" <<std::bitset<2>(thirdDigit & 0b11)<< std::endl; + std::cout << "-----------------" << std::endl; */ + /* std::cout << "fourthDigit: " << fourthDigit << std::endl; + std::cout << "fifthDigit: " << fifthDigit << std::endl; + std::cout << "sixthDigit: " << sixthDigit << std::endl; + std::cout << "seventhDigit: " << seventhDigit << std::endl; */ + /* std::cout<<"Bitwise Eta :: "<<std::bitset<5>(((fourthDigit * 10 + fifthDigit) - 1) & 0b11111) <<std::endl; + std::cout << "-----------------" << std::endl; + std::cout<<"Bitwise Phi :: "<<std::bitset<6>(((sixthDigit * 10 + seventhDigit) - 1) & 0b111111)<<std::endl; + std::cout << "-----------------" << std::endl; */ + + // Concatenate bits + std::bitset<17> result = + ((firstDigit & 0b111) << 14) | // Shift left by 13 to leave space for next bits + ((secondDigit & 0b1) << 13) | // Shift left by 12 to leave space for next bits + ((thirdDigit & 0b11) << 11) | // Shift left by 10 to leave space for next bits + ((((fourthDigit * 10 + fifthDigit) - 1) & 0b11111) << 6) | // Shift left by 5 to leave space for next bits + (((sixthDigit * 10 + seventhDigit) - 1) & 0b111111); // Least significant 6 bits + + m_channelID = result; + /* std::cout << "ChannelID: " << result << std::endl; + std::cout << "-----------------" << std::endl; + std::cout << "-----------------" << std::endl; */ + + } + // + // Cast operator to bitset + constexpr operator std::bitset<17>() const { return m_channelID; } + constexpr std::bitset<17> getChannelID() const { return m_channelID ;} + + private: + static constexpr unsigned int m_systemID{140}; ///< system ID + std::bitset<17> m_channelID{0}; ///< Channel ID + }; + +} // namespace LHCb::Detector \ No newline at end of file diff --git a/Detector/CB/include/Detector/CB/CBConstants.h b/Detector/CB/include/Detector/CB/CBConstants.h new file mode 100644 index 0000000000000000000000000000000000000000..47cbe07d370c840aac24175928508bc004eb5b4f --- /dev/null +++ b/Detector/CB/include/Detector/CB/CBConstants.h @@ -0,0 +1,25 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#pragma once + +#include <array> +#include <bitset> +#include <set> + +namespace LHCb::Detector { + namespace CB { + + constexpr unsigned int ngaps = 3; + constexpr unsigned int ntrips = 2; + constexpr unsigned int nfaces = 7; + } // namespace CB + +} // namespace LHCb::Detector diff --git a/Detector/CB/include/Detector/CB/DeCB.h b/Detector/CB/include/Detector/CB/DeCB.h new file mode 100644 index 0000000000000000000000000000000000000000..fbf443a70e671e1606768281b847b489926953a9 --- /dev/null +++ b/Detector/CB/include/Detector/CB/DeCB.h @@ -0,0 +1,132 @@ +#pragma once +#include "Core/DeIOV.h" +#include "Core/Units.h" +#include "Detector/CB/DeCBFace.h" +#include "Detector/CB/CBChannelID.h" +#include <array> +#include <bitset> +#include <set> +#include <functional> +#include <optional> +#include <string> +#include <cmath> + +namespace LHCb::Detector { + +namespace detail { + + struct DeCBObject : DeIOVObject { + DeCBObject(const dd4hep::DetElement& de, dd4hep::cond::ConditionUpdateContext& ctxt); + std::array<DeCBFaceObject, CB::nfaces> m_faces; + void applyToAllChildren(const std::function<void(LHCb::Detector::DeIOV)>& /*func*/) const override { + // Implementation + }; + }; + +} // namespace detail + +struct DeCB : DeIOVElement<detail::DeCBObject> { + using DeIOVElement::DeIOVElement; + dd4hep::DetElement detector() const { return this->access()->detector(); } + ROOT::Math::XYZPoint localToGlobal(const ROOT::Math::XYZPoint& point) const { return toGlobal(point); } + ROOT::Math::XYZPoint globalToLocal(const ROOT::Math::XYZPoint& point) const { return toLocal(point); } + + [[nodiscard]] const std::optional<DeCBFace> findFace(const ROOT::Math::XYZPoint& aPoint) const { + const auto iS = std::find_if(std::begin(this->access()->m_faces), std::end(this->access()->m_faces), + [&aPoint](detail::DeCBFaceObject const& s) { return DeCBFace{&s}.isInside(aPoint); }); + return iS != this->access()->m_faces.end() ? std::optional<DeCBFace>{iS} : std::optional<DeCBFace>{}; + } + + [[nodiscard]] const std::optional<DeCBTriplet> findTriplet(const ROOT::Math::XYZPoint& aPoint) const { + const auto s = findFace(aPoint); + return s ? s->findTriplet(aPoint) : std::optional<DeCBTriplet>{}; + } + + [[nodiscard]] const std::optional<DeCBGasGap> findGasGap(const ROOT::Math::XYZPoint& aPoint) const { + const auto l = findTriplet(aPoint); + return l ? l->findGasGap(aPoint) : std::optional<DeCBGasGap>{}; + } + + int extractLastDigit(const std::string& name) const { + char lastChar = name.back(); + return lastChar - '0'; + } + + int VolumeID(const ROOT::Math::XYZPoint& point) const { + // Initialize std::optional to represent unset values + std::optional<int> ID_s[5]; + + // Find the face and process if available + const auto& face = findFace(point); + if (face.has_value()) { + std::string face_name = face.value().detector().name(); + int facenum = extractLastDigit(face_name); + ID_s[0] = facenum; + + const auto& triplet = face.value().findTriplet(point); + if (triplet.has_value()) { + std::string trip_name = triplet.value().detector().name(); + int tripnum = extractLastDigit(trip_name); + ID_s[1] = tripnum; + + const auto& gg = triplet.value().findGasGap(point); + if (gg.has_value()) { + std::string gg_name = gg.value().detector().name(); + int ggnum = extractLastDigit(gg_name); + ID_s[2] = ggnum; + + // Convert coordinates and calculate ID values + double x = gg.value().toLocal(point).y(); + + double y = gg.value().toLocal(point).z(); + + int n_eta = std::floor(x / 28.09); + int n_phi = std::floor(y / 27.07); + double transform_eta = x - (n_eta * 28.09); + double transform_phi = y - (n_phi * 27.07); + + + /* */ + + if (transform_eta >= 1.4 && transform_eta <= 26.09) { + ID_s[3] = n_eta + 17; + } else { + /* std::cout<<"The actual coordinates are this : "<<point<<"The global point is "<<gg.value().toLocal(point)<<std::endl; + std::cout<<"For eta we use this local point : "<<x<<std::endl; + std::cout<<"Number for eta :" <<n_eta<<std::endl; + std::cout<<"Transformed eta : "<<transform_eta<<std::endl; */ + ID_s[3] = 33; // Adjusting ID_s[3] when transform_eta is out of the valid range + } + + if (transform_phi >= 1.47 && transform_phi <= 26.54) { + ID_s[4] = n_phi + 33; + } else { + ID_s[4] = 65; // Adjusting ID_s[4] when transform_phi is out of the valid range + } + } + } + } + + // Check if all required IDs are set + if (ID_s[0].has_value() && ID_s[1].has_value() && ID_s[2].has_value()) { + int faceID = ID_s[0].value(); + int tripletID = ID_s[1].value(); + int singletID = ID_s[2].value(); + int etaID = ID_s[3].value_or(0); // Default to 0 if not set + int phiID = ID_s[4].value_or(0); // Default to 0 if not set + + int sensVolID = (faceID + 1) * 1000000 + // 10^6 Face + (tripletID + 1) * 100000 + // 10^5 Triplet + (singletID + 1) * 10000 + // 10^4 Singlet + etaID * 100 + // 10^2 Eta + phiID; // 10^0 Phi + + return sensVolID; + } else { + // Return a sentinel value indicating that sensVolID could not be computed + return -1; // or some other value to indicate failure + } + } +}; // End of struct DeCB + +} // namespace LHCb::Detector diff --git a/Detector/CB/include/Detector/CB/DeCBConditionCalls.h b/Detector/CB/include/Detector/CB/DeCBConditionCalls.h new file mode 100644 index 0000000000000000000000000000000000000000..2527a5b001838c8bcf0f157c6f8adad83fc7027a --- /dev/null +++ b/Detector/CB/include/Detector/CB/DeCBConditionCalls.h @@ -0,0 +1,27 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +#pragma once + +#include "Core/DeConditionCall.h" +#include "DD4hep/ConditionDerived.h" + +namespace LHCb::Detector { + + /// Condition derivation call to build the top level Muon DetElement condition information + struct DeCBConditionCall : DeConditionCall { + using DeConditionCall::DeConditionCall; + /// Interface to client Callback in order to update the condition + virtual dd4hep::Condition operator()( const dd4hep::ConditionKey& key, + dd4hep::cond::ConditionUpdateContext& context ) override final; + }; + +} // namespace LHCb::Detector diff --git a/Detector/CB/include/Detector/CB/DeCBFace.h b/Detector/CB/include/Detector/CB/DeCBFace.h new file mode 100644 index 0000000000000000000000000000000000000000..9321ebbe3504c2ddcb54e06fe40086a3722a6eda --- /dev/null +++ b/Detector/CB/include/Detector/CB/DeCBFace.h @@ -0,0 +1,62 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#pragma once +#include "Core/DeIOV.h" +#include "Core/Keys.h" +#include "Core/PrintHelpers.h" +#include "Core/Units.h" +#include "DD4hep/Printout.h" +#include "Detector/CB/DeCBTriplet.h" +#include <array> +#include <bitset> +#include <deque> +#include <set> +#include <vector> + +namespace LHCb::Detector { + + namespace detail { + + struct DeCBFaceObject : DeIOVObject { + DeCBFaceObject( const dd4hep::DetElement& de, dd4hep::cond::ConditionUpdateContext& ctxt ); + std::array<DeCBTripletObject, CB::ntrips> m_triplets; + void applyToAllChildren( const std::function<void( LHCb::Detector::DeIOV )>& ) const override{ + + }; + }; + }; // namespace detail + + struct DeCBFace : DeIOVElement<detail::DeCBFaceObject> { + using DeIOVElement::DeIOVElement; + + const DeCBTriplet first_triplet() const { // acces the first triplet + const auto obj = this->access(); + return {&obj->m_triplets[0]}; + }; + + ROOT::Math::XYZPoint localToGlobal( const ROOT::Math::XYZPoint& point ) const { return toGlobal( point ); } + ROOT::Math::XYZPoint globalToLocal( const ROOT::Math::XYZPoint& point ) const { return toLocal( point ); } + + dd4hep::DetElement detector() const { return this->access()->detector(); } + + [[nodiscard]] const std::optional<DeCBTriplet> findTriplet( const ROOT::Math::XYZPoint& aPoint ) const { + const auto iS = std::find_if( + std::begin( this->access()->m_triplets ), std::end( this->access()->m_triplets ), + [&aPoint]( detail::DeCBTripletObject const& s ) { return DeCBTriplet{&s}.isInside( aPoint ); } ); + return iS != this->access()->m_triplets.end() ? std::optional<DeCBTriplet>{iS} : std::optional<DeCBTriplet>{}; + } + + const std::array<const DeCBTriplet, CB::ntrips> triplets() const { + const auto obj = this->access(); + return {&obj->m_triplets[0], &obj->m_triplets[1]}; + }; + }; +} // namespace LHCb::Detector diff --git a/Detector/CB/include/Detector/CB/DeCBGasGap.h b/Detector/CB/include/Detector/CB/DeCBGasGap.h new file mode 100644 index 0000000000000000000000000000000000000000..8f972f6cee31a328fded951d38bcef9962a3b396 --- /dev/null +++ b/Detector/CB/include/Detector/CB/DeCBGasGap.h @@ -0,0 +1,41 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +#pragma once +#include "Core/DeIOV.h" +#include "Core/Keys.h" +#include "Core/Units.h" +#include "Detector/CB/CBChannelID.h" +#include <array> +#include <bitset> +#include <set> +#include <vector> + +namespace LHCb::Detector { + + namespace detail { + + struct DeCBGasGapObject : DeIOVObject { + DeCBGasGapObject( const dd4hep::DetElement& de, dd4hep::cond::ConditionUpdateContext& ctxt ); + + void applyToAllChildren( const std::function<void( LHCb::Detector::DeIOV )>& ) const override {} + }; + }; // namespace detail + struct DeCBGasGap : DeIOVElement<detail::DeCBGasGapObject> { + using DeIOVElement::DeIOVElement; + + dd4hep::DetElement gasgap() const { return this->access()->detector(); } + + ROOT::Math::XYZPoint localToGlobal( const ROOT::Math::XYZPoint& point ) const { return toGlobal( point ); } + /// Convert global position to local position + ROOT::Math::XYZPoint globalToLocal( const ROOT::Math::XYZPoint& point ) const { return toLocal( point ); } + }; +} // namespace LHCb::Detector diff --git a/Detector/CB/include/Detector/CB/DeCBTriplet.h b/Detector/CB/include/Detector/CB/DeCBTriplet.h new file mode 100644 index 0000000000000000000000000000000000000000..0fc5f61425a3ee43a97328f0713ba692a918dcf9 --- /dev/null +++ b/Detector/CB/include/Detector/CB/DeCBTriplet.h @@ -0,0 +1,58 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#pragma once +#include "Core/DeIOV.h" +#include "Core/Keys.h" +#include "Core/Units.h" +#include "Detector/CB/CBConstants.h" +#include "Detector/CB/DeCBGasGap.h" + +#include "Core/PrintHelpers.h" +#include "DD4hep/Printout.h" +#include "Detector/CB/DeCBConditionCalls.h" +#include <array> +#include <bitset> +#include <deque> +#include <set> +#include <vector> + +namespace LHCb::Detector { + + namespace detail { + + struct DeCBTripletObject : DeIOVObject { + + DeCBTripletObject( const dd4hep::DetElement& de, dd4hep::cond::ConditionUpdateContext& ctxt ); + std::array<DeCBGasGapObject, CB::ngaps> m_gasgaps; + void applyToAllChildren( const std::function<void( LHCb::Detector::DeIOV )>& ) const override{ + // for ( auto& station : m_gasgaps ) { func( &station ); }; + }; + }; + }; // namespace detail + + struct DeCBTriplet : DeIOVElement<detail::DeCBTripletObject> { + using DeIOVElement::DeIOVElement; + + dd4hep::DetElement detector() const { return this->access()->detector(); } + + [[nodiscard]] const std::optional<DeCBGasGap> findGasGap( const ROOT::Math::XYZPoint& aPoint ) const { + const auto iS = + std::find_if( std::begin( this->access()->m_gasgaps ), std::end( this->access()->m_gasgaps ), + [&aPoint]( detail::DeCBGasGapObject const& s ) { return DeCBGasGap{&s}.isInside( aPoint ); } ); + return iS != this->access()->m_gasgaps.end() ? std::optional<DeCBGasGap>{iS} : std::optional<DeCBGasGap>{}; + } + + const std::array<const DeCBGasGap, CB::ngaps> gasgaps() const { + const auto obj = this->access(); + return {&obj->m_gasgaps[0], &obj->m_gasgaps[1], &obj->m_gasgaps[2]}; + }; + }; +} // namespace LHCb::Detector diff --git a/Detector/CB/src/CB_Cond.cpp b/Detector/CB/src/CB_Cond.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5a1aaf33b31d50d1e922e3563acd85d1f01c55e7 --- /dev/null +++ b/Detector/CB/src/CB_Cond.cpp @@ -0,0 +1,19 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#include "Core/ConditionHelper.h" +#include "Detector/CB/DeCB.h" +#include "Detector/CB/DeCBConditionCalls.h" +static long create_conditions_recipes( dd4hep::Detector& description, xml_h e ) { + LHCb::Detector::ConditionConfigHelper<LHCb::Detector::DeCBConditionCall> config_helper{description, "CB", e}; + config_helper.configure(); + return 1; +} +DECLARE_XML_DOC_READER( LHCb_CB_cond, create_conditions_recipes ) diff --git a/Detector/CB/src/CODEXb_geo.cpp b/Detector/CB/src/CODEXb_geo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d0c767a82068503a1214ca0b0ba862b8c09cde0d --- /dev/null +++ b/Detector/CB/src/CODEXb_geo.cpp @@ -0,0 +1,395 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : B.Dey for CODEX-beta +// +//========================================================================== +// +// Specialized generic detector constructor +// +//========================================================================== +#include "Core/UpgradeTags.h" +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Printout.h" +#include "DD4hep/detail/DetectorInterna.h" +#include "TClass.h" +#include "XML/Utilities.h" + +using namespace dd4hep; + +namespace { + + /// Helper class to build the CODEX-beta detector + struct CBBuild : public xml::tools::VolumeBuilder { + + // Debug flags: To be enables/disbaled by the <debug/> section in the detector.xml file. + bool m_build_passive = true; + bool m_local_debug = false; + std::string m_attach_volume; + + // General constants used by several member functions to build the geometry + // https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonGeoModel/src/RpcLayer.cxx + // Strip panel + double cb_Fo_t = 3.5; // CB:Forex_t + double cb_Cu_t = 0.3; // CB:Copper_t + // Gas gap + double cb_Ai_t = 0.52; // CB:Air_t (PET+glue, not simulated). Even Air is filled with Bakelite in ATLAS sim. Note + // that this is the total Air thickness within singlet. + double cb_Bkl_t = 1.2; // CB:Bakelite_t + double cb_GG_t = 1.0; // CB:GG_t + // Singlet + double cb_sing_t = 11.8; // CB:singlet_t + double cb_gg_dead_w = 0.; + double cb_gg_dead_l = 0.; + // Triplet + double cb_trip_AlSk_t = 2.0; // + double cb_trip_t = 36.0; // CB:triplet_t (11.8*3 = 35.4 mm + additional 0.6mm). Without the Al skins + double cb_trip_w = 970.0; + double cb_trip_l = 1820.0; // + + // CX frame + double cb_cx_t = 57.15; + double cb_cx_w = 1028.7; + double cb_cx_l = 1879.6; + double cb_cx_w_gap = 12.7; // gap from Dave + + double eps = 0.0; // CB:eps + + int nGG = 3; + + std::map<std::string, DetElement> m_detElements; + + /// Utility function to register detector elements for cloning. Will all be deleted! + void registerDetElement( const std::string& nam, DetElement de ); + /// Utility function to access detector elements for cloning. Will all be deleted! + DetElement detElement( const std::string& nam ) const; + + /// Initializing constructor + CBBuild( Detector& description, xml_elt_t e, SensitiveDetector sens ); + CBBuild() = delete; + CBBuild( CBBuild&& ) = delete; + CBBuild( const CBBuild& ) = delete; + CBBuild& operator=( const CBBuild& ) = delete; + + /// Default destructor + virtual ~CBBuild(); + void build_singlet(); + void build_triplet(); + void build_face(); + void build_detector(); + }; + + void CBBuild::registerDetElement( const std::string& nam, DetElement de ) { m_detElements[nam] = de; } + + DetElement CBBuild::detElement( const std::string& nam ) const { + auto i = m_detElements.find( nam ); + if ( i == m_detElements.end() ) { + printout( ERROR, "CODEX-b geo", "Attempt to access non-existing detector element %s", nam.c_str() ); + } + return ( *i ).second; + } + + /// Initializing constructor + CBBuild::CBBuild( Detector& dsc, xml_elt_t e, SensitiveDetector sens ) : xml::tools::VolumeBuilder( dsc, e, sens ) { + // Process debug flags + xml_comp_t x_dbg = x_det.child( _U( debug ), false ); + if ( x_dbg ) { + for ( xml_coll_t i( x_dbg, _U( item ) ); i; ++i ) { + xml_comp_t c( i ); + std::string n = c.nameStr(); + if ( n == "build_passive" ) m_build_passive = c.attr<bool>( _U( value ) ); + if ( n == "local_debug" ) m_local_debug = c.attr<bool>( _U( value ) ); + if ( n == "attach_volume" ) m_attach_volume = c.attr<std::string>( _U( value ) ); + if ( n == "debug" ) debug = c.attr<bool>( _U( value ) ); + } + } + + eps = _toDouble( "CB:eps" ); + nGG = _toInt( "CB:nGG" ); + + cb_Fo_t = _toDouble( "CB:Forex_t" ); + cb_Cu_t = _toDouble( "CB:Copper_t" ); + cb_Ai_t = _toDouble( "CB:Air_t" ); + cb_Bkl_t = _toDouble( "CB:Bakelite_t" ); + cb_GG_t = _toDouble( "CB:GG_t" ); + cb_sing_t = _toDouble( "CB:singlet_t" ); + cb_gg_dead_l = _toDouble( "CB:gg_deadarea_w" ); + cb_gg_dead_w = _toDouble( "CB:gg_deadarea_l" ); + cb_trip_AlSk_t = _toDouble( "CB:triplet_AlSkin" ); + cb_trip_t = _toDouble( "CB:triplet_t" ); + cb_trip_w = _toDouble( "CB:triplet_w" ); + cb_trip_l = _toDouble( "CB:triplet_l" ); + cb_cx_t = _toDouble( "CB:CX_t" ); + cb_cx_l = _toDouble( "CB:CX_l" ); + cb_cx_w = _toDouble( "CB:CX_w" ); + cb_cx_w_gap = _toDouble( "CB:CX_w_gap" ); + } + + CBBuild::~CBBuild() { + for ( auto& d : m_detElements ) dd4hep::detail::destroyHandle( d.second ); + } + + void CBBuild::build_singlet() { // build BI7 + + // Debugging 2024.01.12. + + // Build the logical volumes ----- + + // Singlet Box + + Box singlet_box( cb_sing_t / 2.0, cb_trip_w / 2.0, cb_trip_l / 2.0 ); // length+width same as the triplet box + // added on 26th Jan 2024. Otherwise there were overlaps + Box gg_box2subtr( cb_GG_t / 2.0, cb_trip_w / 2.0, cb_trip_l / 2.0 ); + Solid singlet_solid = SubtractionSolid( singlet_box, gg_box2subtr, Position( 0, 0, 0 ) ); + Volume singlet_vol( "lvSing", singlet_solid, description.air() ); + singlet_vol.setVisAttributes( description, "CB:singlet" ); + + // Strip panel ----- + // Forex box + + Box forex_box( cb_Fo_t / 2.0 - cb_Cu_t - eps, cb_trip_w / 2.0 - cb_Cu_t - eps, cb_trip_l / 2.0 - cb_Cu_t - eps ); + Volume forex_vol( "lvForex", forex_box, description.material( "CB:Forex" ) ); + forex_vol.setVisAttributes( description, "CB:Forex" ); + registerVolume( forex_vol.name(), forex_vol ); + + // 0.3cmm Cu skin around Forex box + Box cuskin_box( cb_Fo_t / 2.0, cb_trip_w / 2.0, cb_trip_l / 2.0 ); + Solid cuskin_solid = SubtractionSolid( cuskin_box, forex_box, Position( 0, 0, 0 ) ); + Volume cu_vol = Volume( "lvCuSkin", cuskin_solid, description.material( "Copper" ) ); + cu_vol.setVisAttributes( description, "CB:CuSkin" ); + registerVolume( cu_vol.name(), cu_vol ); + // ----------------- + + // are there any additional dead areas for the GG inside the singlet? + Box gg_box( cb_GG_t / 2.0, cb_trip_w / 2.0 - cb_gg_dead_w, cb_trip_l / 2.0 - cb_gg_dead_l ); + Volume gg_vol( "lvGG", gg_box, description.material( "CB:RPCgas" ) ); + gg_vol.setVisAttributes( description, "CB:RPCgas" ); + gg_vol.setSensitiveDetector( sensitive ); + registerVolume( gg_vol.name(), gg_vol ); + + // in ATLAS the Air (PET+glue) is also filled with Bakelite + Box bl_box( ( cb_GG_t + cb_Ai_t + 2. * cb_Bkl_t ) / 2.0, cb_trip_w / 2.0, cb_trip_l / 2.0 ); + Solid bl_solid = SubtractionSolid( bl_box, gg_box, Position( 0, 0, 0 ) ); + Volume bl_vol( "lvBl", bl_solid, description.material( "CB:Bakelite" ) ); + bl_vol.setVisAttributes( description, "CB:Bakelite" ); + registerVolume( bl_vol.name(), bl_vol ); + + // place all the passive elements inside the singlet box + singlet_vol.placeVolume( bl_vol, Position( 0, 0, 0 ) ); // Bakelite + singlet_vol.placeVolume( + forex_vol, Position( -( cb_GG_t + cb_Ai_t + 2. * cb_Bkl_t + cb_Fo_t ) / 2.0, 0, 0 ) ); // Phi Strip panel + singlet_vol.placeVolume( cu_vol, Position( -( cb_GG_t + cb_Ai_t + 2. * cb_Bkl_t + cb_Fo_t ) / 2.0, 0, 0 ) ); + singlet_vol.placeVolume( + forex_vol, Position( ( cb_GG_t + cb_Ai_t + 2. * cb_Bkl_t + cb_Fo_t ) / 2.0, 0, 0 ) ); // Eta Strip panel + singlet_vol.placeVolume( cu_vol, Position( ( cb_GG_t + cb_Ai_t + 2. * cb_Bkl_t + cb_Fo_t ) / 2.0, 0, 0 ) ); + registerVolume( singlet_vol.name(), singlet_vol ); + } + + void CBBuild::build_triplet() { // only BI7 for now + + PlacedVolume pv; + Position pos; + + // Full RPC triplet (CX not created) + Box triplet_box( cb_trip_t / 2. + cb_trip_AlSk_t, cb_trip_w / 2. + cb_trip_AlSk_t, + cb_trip_l / 2. + cb_trip_AlSk_t ); // al skins added + Volume triplet_vol( "lvTrip", triplet_box, description.air() ); + triplet_vol.setVisAttributes( description, "CB:triplet" ); + registerVolume( triplet_vol.name(), triplet_vol ); + DetElement de_trip( "triplet", id ); + registerDetElement( triplet_vol.name(), de_trip ); + + // 2cmm Al skin inside the bos + Box al_box_in( cb_trip_t, cb_trip_w, cb_trip_l ); + Solid alskin_solid = SubtractionSolid( triplet_box, al_box_in, Position( 0, 0, 0 ) ); + Volume al_vol = Volume( "lvAlSkin", alskin_solid, description.material( "Aluminum" ) ); + al_vol.setVisAttributes( description, "CB:AlSkin" ); + + // place all the passive elements inside the triplet box + if ( m_build_passive ) { + triplet_vol.placeVolume( al_vol, Position( 0, 0, 0 ) ); // al skin + triplet_vol.placeVolume( volume( "lvSing" ), Position( -cb_sing_t, 0, 0 ) ); + triplet_vol.placeVolume( volume( "lvSing" ), Position( 0, 0, 0 ) ); + triplet_vol.placeVolume( volume( "lvSing" ), Position( cb_sing_t, 0, 0 ) ); + } + + // now place the three sensitive gas gaps + DetElement de_gg; + + // GG0 + pv = triplet_vol.placeVolume( volume( "lvGG" ), Position( -cb_sing_t, 0, 0 ) ); + pv.addPhysVolID( "GG", 0 ); + de_gg = DetElement( de_trip, "GG0", 0 ); + de_gg.setPlacement( pv ); + + // de_trip.add( de_gg ); + + // GG1 + pv = triplet_vol.placeVolume( volume( "lvGG" ), Position( 0, 0, 0 ) ); + pv.addPhysVolID( "GG", 1 ); + de_gg = DetElement( de_trip, "GG1", 1 ); + de_gg.setPlacement( pv ); + + // de_trip.add( de_gg ); + + // GG2 + pv = triplet_vol.placeVolume( volume( "lvGG" ), Position( cb_sing_t, 0, 0 ) ); + pv.addPhysVolID( "GG", 2 ); + de_gg = DetElement( de_trip, "GG2", 2 ); + de_gg.setPlacement( pv ); + + // de_trip.add( de_gg ); + } + + void CBBuild::build_face() { + + // build_singlet(); + // build_triplet(); + // DetElement de_trip; + + PlacedVolume pv; + Position pos; + DetElement de_face( "face", id ); + DetElement de_triplet; + dd4hep::Volume vol_trip = volume( "lvTrip" ); + + Box face_box( cb_cx_t / 2.0, cb_cx_w + cb_cx_w_gap / 2.0, cb_cx_l / 2.0 ); + Volume face_vol( "lvFace", face_box, description.air() ); + face_vol.setVisAttributes( description, "CB:Envelope" ); + registerVolume( face_vol.name(), face_vol ); + registerDetElement( face_vol.name(), de_face ); + + // Volume vol_trip = volume( "lvTrip" ); + // DetElement de_trip = detElement( "lvTrip" ); + + // place the two RPCs in a face along the y-direction + pv = face_vol.placeVolume( vol_trip, Position( 0, -( cb_cx_w + cb_cx_w_gap ) / 2., 0 ) ); + pv.addPhysVolID( "triplet", 0 ); + // de = detElement( pv.volume().name() ); + // de_triplet = de.clone( "R0", 0 ); + // de_face.add( de_triplet ); + + de_triplet = detElement( vol_trip.name() ).clone( "R0", 0 ); + de_triplet.setPlacement( pv ); // front + de_face.add( de_triplet ); + + // the R/O strips for the two RPCs are on opposite ends. Give a rotation by 180 deg around z-axis, and then shift in + // y? + pv = face_vol.placeVolume( vol_trip, Position( 0, ( cb_cx_w + cb_cx_w_gap ) / 2., 0 ) ); + pv.addPhysVolID( "triplet", 1 ); + de_triplet = detElement( vol_trip.name() ).clone( "R1", 1 ); + de_triplet.setPlacement( pv ); // front + de_face.add( de_triplet ); + } + + void CBBuild::build_detector() { + + Position pos; + PlacedVolume pv; + DetElement de; + Volume vol; + + RotationZYX rot_X( 0, 0, M_PI / 2. ); + RotationZYX rot_Y( 0, M_PI / 2., 0 ); + RotationZYX rot_Z( M_PI / 2., 0, 0 ); + + // these are arbitrary atm + double sq_len = 2. * cb_cx_w + cb_cx_w_gap + 200.; // this assumes a square + double pos_shift = sq_len / 2.0 - cb_cx_t / 2.0 - 10; + + Box cb_box( sq_len / 2., sq_len / 2., sq_len / 2. ); + Volume cb_vol( "lvCB", cb_box, description.air() ); + + cb_vol.setVisAttributes( description, xml_det_t( x_det ).visStr() ); + sensitive.setType( "tracker" ); + buildVolumes( x_det ); + placeDaughters( detector, cb_vol, x_det ); + build_singlet(); + build_triplet(); + build_face(); + + if ( m_attach_volume.empty() ) { + + dd4hep::Volume vol_face0 = volume( "lvFace" ); + dd4hep::DetElement de_face; + // put the 7 faces by hand at this point + + pv = cb_vol.placeVolume( volume( "lvFace" ), + Transform3D( RotationZYX( 0, 0, M_PI / 2. ), Position( pos_shift, 0, 0 ) ) ); + pv.addPhysVolID( "face", 0 ); + + de_face = detElement( vol_face0.name() ).clone( "F0", 0 ); + de_face.setPlacement( pv ); // front + detector.add( de_face ); + + pv = cb_vol.placeVolume( volume( "lvFace" ), + Transform3D( RotationZYX( 0, 0, M_PI / 2. ), Position( -pos_shift, 0, 0 ) ) ); + pv.addPhysVolID( "face", 1 ); + de_face = detElement( vol_face0.name() ).clone( "F1", 1 ); + de_face.setPlacement( pv ); // front + detector.add( de_face ); + + pv = cb_vol.placeVolume( volume( "lvFace" ), + Transform3D( RotationZYX( 0, M_PI / 2., 0 ) * RotationZYX( 0, 0, M_PI / 2. ), + Position( 0, 0, -pos_shift ) ) ); + pv.addPhysVolID( "face", 2 ); + de_face = detElement( vol_face0.name() ).clone( "F2", 2 ); + de_face.setPlacement( pv ); // front + detector.add( de_face ); + + pv = cb_vol.placeVolume( + volume( "lvFace" ), + Transform3D( RotationZYX( 0, M_PI / 2., 0 ) * RotationZYX( 0, 0, M_PI / 2. ), Position( 0, 0, pos_shift ) ) ); + pv.addPhysVolID( "face", 3 ); + de_face = detElement( vol_face0.name() ).clone( "F3", 3 ); + de_face.setPlacement( pv ); // front + detector.add( de_face ); + + pv = cb_vol.placeVolume( + volume( "lvFace" ), + Transform3D( RotationZYX( M_PI / 2., 0, 0 ) * RotationZYX( 0, 0, M_PI / 2. ), Position( 0, pos_shift, 0 ) ) ); + pv.addPhysVolID( "face", 4 ); + de_face = detElement( vol_face0.name() ).clone( "F4", 4 ); + de_face.setPlacement( pv ); // front + detector.add( de_face ); + + pv = cb_vol.placeVolume( volume( "lvFace" ), + Transform3D( RotationZYX( M_PI / 2., 0, 0 ) * RotationZYX( 0, 0, M_PI / 2. ), + Position( 0, -pos_shift, 0 ) ) ); + pv.addPhysVolID( "face", 5 ); + de_face = detElement( vol_face0.name() ).clone( "F5", 5 ); + de_face.setPlacement( pv ); // front + detector.add( de_face ); + + pv = cb_vol.placeVolume( volume( "lvFace" ), Transform3D( RotationZYX( 0, 0, M_PI / 2. ), Position( 0, 0, 0 ) ) ); + pv.addPhysVolID( "face", 6 ); + de_face = detElement( vol_face0.name() ).clone( "F6", 6 ); + de_face.setPlacement( pv ); // front + detector.add( de_face ); + + } else if ( !m_attach_volume.empty() ) { + // Test display of individual entities + cb_vol.placeVolume( vol = volume( m_attach_volume ) ); + de = detElement( vol.name() ); + detector.add( de.clone( m_attach_volume ) ); + } + + xml_h x_tr = x_det.child( _U( transformation ) ); + pv = placeDetector( cb_vol, x_tr ); + pv.addPhysVolID( "system", id ); + } +} // namespace + +static Ref_t create_element( Detector& description, xml_h e, SensitiveDetector sens_det ) { + CBBuild builder( description, e, sens_det ); + builder.build_detector(); + return builder.detector; +} + +DECLARE_DETELEMENT( CB_geo, create_element ) diff --git a/Detector/CB/src/DeCB.cpp b/Detector/CB/src/DeCB.cpp new file mode 100644 index 0000000000000000000000000000000000000000..885196f8f4393704fa2eee8e1162ad27a5a39de6 --- /dev/null +++ b/Detector/CB/src/DeCB.cpp @@ -0,0 +1,40 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#include "Detector/CB/DeCB.h" +#include "Core/PrintHelpers.h" +#include "Detector/CB/DeCBConditionCalls.h" + +#include "Core/Keys.h" + +#include <vector> + +#include "Core/DeIOV.h" +#include "Core/Units.h" +#include "Core/yaml_converters.h" +#include "DD4hep/Detector.h" +#include "DD4hep/Printout.h" +#include <TGeoNavigator.h> +#include <array> +#include <cassert> +#include <cmath> +#include <iostream> +#include <regex> +#include <string> +LHCb::Detector::detail::DeCBObject::DeCBObject( const dd4hep::DetElement& de, + dd4hep::cond::ConditionUpdateContext& ctxt ) + : DeIOVObject( de, ctxt ) + , m_faces{{{DeCBFaceObject( de.child( "F0" ), ctxt )}, + {DeCBFaceObject( de.child( "F1" ), ctxt )}, + {DeCBFaceObject( de.child( "F2" ), ctxt )}, + {DeCBFaceObject( de.child( "F3" ), ctxt )}, + {DeCBFaceObject( de.child( "F4" ), ctxt )}, + {DeCBFaceObject( de.child( "F5" ), ctxt )}, + {DeCBFaceObject( de.child( "F6" ), ctxt )}}} {} diff --git a/Detector/CB/src/DeCBConditionCalls.cpp b/Detector/CB/src/DeCBConditionCalls.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7e29d995cf60394c3da37c46dfb2ed24b01bc3f3 --- /dev/null +++ b/Detector/CB/src/DeCBConditionCalls.cpp @@ -0,0 +1,28 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#include "Detector/CB/DeCBConditionCalls.h" +#include "Detector/CB/DeCB.h" + +#include "DD4hep/Detector.h" +#include "Detector/CB/DeCBFace.h" +#include "Detector/CB/DeCBGasGap.h" +#include "Detector/CB/DeCBTriplet.h" +#include "Detector/FT/DeFT.h" +#include "XML/XML.h" + +#include "DD4hep/DetectorProcessor.h" +#include "Math/Transform3D.h" + +dd4hep::Condition LHCb::Detector::DeCBConditionCall::operator()( const dd4hep::ConditionKey& /* key */, + dd4hep::cond::ConditionUpdateContext& ctxt ) { + ctxt.condition( Keys::alignmentsComputedKey ); + return DeIOV( new DeCB::Object( dd4hep::Detector::getInstance().detector( "CB" ), ctxt ) ); +} diff --git a/Detector/CB/src/DeCBFace.cpp b/Detector/CB/src/DeCBFace.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f1bc1caa892f0b0533db418aa7097913880c1407 --- /dev/null +++ b/Detector/CB/src/DeCBFace.cpp @@ -0,0 +1,31 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +#include "Detector/CB/DeCBFace.h" +#include "Core/DeIOV.h" +#include "Core/Units.h" +#include "Core/yaml_converters.h" +#include "DD4hep/Detector.h" +#include "DD4hep/Printout.h" +#include "Detector/CB/DeCBGasGap.h" +#include "Detector/CB/DeCBTriplet.h" +#include <Core/Keys.h> +#include <TGeoNavigator.h> +#include <array> +#include <iostream> +#include <regex> +#include <string> +#include <yaml-cpp/yaml.h> + +LHCb::Detector::detail::DeCBFaceObject::DeCBFaceObject( const dd4hep::DetElement& de, + dd4hep::cond::ConditionUpdateContext& ctxt ) + : DeIOVObject( de, ctxt ) + , m_triplets{{{DeCBTripletObject( de.child( "R0" ), ctxt )}, {DeCBTripletObject( de.child( "R1" ), ctxt )}}} {} diff --git a/Detector/CB/src/DeCBGasGap.cpp b/Detector/CB/src/DeCBGasGap.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b5d41bd1dae0d721f78241988aa14044f205a68e --- /dev/null +++ b/Detector/CB/src/DeCBGasGap.cpp @@ -0,0 +1,28 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +#include "Detector/CB/DeCBGasGap.h" + +#include "Core/DeIOV.h" +#include "Core/Units.h" +#include "Core/yaml_converters.h" +#include "DD4hep/Detector.h" +#include "DD4hep/Printout.h" +#include "Detector/CB/DeCB.h" +#include <TGeoNavigator.h> +#include <array> +#include <iostream> +#include <regex> +#include <string> + +LHCb::Detector::detail::DeCBGasGapObject::DeCBGasGapObject( const dd4hep::DetElement& de, + dd4hep::cond::ConditionUpdateContext& ctxt ) + : DeIOVObject( de, ctxt ) {} diff --git a/Detector/CB/src/DeCBHandles.cpp b/Detector/CB/src/DeCBHandles.cpp new file mode 100644 index 0000000000000000000000000000000000000000..697ca80434e87aa53d538d40a82c22a561c7aee1 --- /dev/null +++ b/Detector/CB/src/DeCBHandles.cpp @@ -0,0 +1,25 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#include "DD4hep/detail/Handle.inl" + +#include "Detector/CB/DeCB.h" +#include "Detector/CB/DeCBFace.h" +#include "Detector/CB/DeCBGasGap.h" +#include "Detector/CB/DeCBTriplet.h" + +DD4HEP_INSTANTIATE_HANDLE_UNNAMED( LHCb::Detector::detail::DeCBObject, LHCb::Detector::detail::DeIOVObject, + ConditionObject ); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED( LHCb::Detector::detail::DeCBFaceObject, LHCb::Detector::detail::DeIOVObject, + ConditionObject ); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED( LHCb::Detector::detail::DeCBTripletObject, LHCb::Detector::detail::DeIOVObject, + ConditionObject ); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED( LHCb::Detector::detail::DeCBGasGapObject, LHCb::Detector::detail::DeIOVObject, + ConditionObject ); diff --git a/Detector/CB/src/DeCBTriplet.cpp b/Detector/CB/src/DeCBTriplet.cpp new file mode 100644 index 0000000000000000000000000000000000000000..39186f7102b23c6e975aa1422a9fd492ce7fa632 --- /dev/null +++ b/Detector/CB/src/DeCBTriplet.cpp @@ -0,0 +1,33 @@ +/*****************************************************************************\ +* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +#include "Core/DeIOV.h" +#include "Core/Units.h" +#include "Core/yaml_converters.h" +#include "DD4hep/Detector.h" +#include "DD4hep/Printout.h" +#include <Core/Keys.h> +#include <TGeoNavigator.h> +#include <array> +#include <iostream> +#include <regex> +#include <string> +#include <yaml-cpp/yaml.h> + +#include "Detector/CB/DeCBGasGap.h" +#include "Detector/CB/DeCBTriplet.h" + +#include "Detector/CB/DeCB.h" +LHCb::Detector::detail::DeCBTripletObject::DeCBTripletObject( const dd4hep::DetElement& de, + dd4hep::cond::ConditionUpdateContext& ctxt ) + : DeIOVObject( de, ctxt ) + , m_gasgaps{{{DeCBGasGapObject( de.child( "GG0" ), ctxt )}, + {DeCBGasGapObject( de.child( "GG1" ), ctxt )}, + {DeCBGasGapObject( de.child( "GG2" ), ctxt )}}} {} diff --git a/compact/common/global/definitions.xml b/compact/common/global/definitions.xml index eb6797b054050ceff14c19e51c6c37b57d092a23..4ba3362cd48ded611d42ec60d576724b6c4faedd 100644 --- a/compact/common/global/definitions.xml +++ b/compact/common/global/definitions.xml @@ -32,6 +32,7 @@ <constant name="UT:Hcal" value="110"/> <constant name="UT:Muon" value="120"/> <constant name="MP:ID" value="130"/> + <constant name="CB:ID" value="140"/> <constant name="Muon:ID" value="200"/> <constant name="M2Station:ID" value="202"/> <constant name="M3Station:ID" value="203"/> @@ -53,6 +54,7 @@ <constant name="UP:parent" value="/world/BeforeMagnetRegion" type="string"/> <constant name="FT:parent" value="/world/AfterMagnetRegion/T" type="string"/> <constant name="MP:parent" value="/world/AfterMagnetRegion/T" type="string"/> + <constant name="CB:parent" value="/world/CodexRegion" type="string"/> <constant name="Rich1:parent" value="/world/BeforeMagnetRegion" type="string"/> <constant name="Rich2:parent" value="/world/AfterMagnetRegion" type="string"/> <constant name="Muon:parent" value="/world/DownstreamRegion" type="string"/> @@ -88,5 +90,6 @@ <constant name="MagnetRegion:ignore" value="0"/> <constant name="AfterMagnetRegion:ignore" value="0"/> <constant name="DownstreamRegion:ignore" value="0"/> + <constant name="CodexRegion:ignore" value="0"/> </define> </lccdd> diff --git a/compact/components/CB/2024-v00.00/CB.xml b/compact/components/CB/2024-v00.00/CB.xml new file mode 100644 index 0000000000000000000000000000000000000000..f17fdeeb61a616fac70ae67926113c0f47c26a99 --- /dev/null +++ b/compact/components/CB/2024-v00.00/CB.xml @@ -0,0 +1,16 @@ + +<!-- + (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration + + This software is distributed under the terms of the GNU General Public + Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". + + In applying this licence, CERN does not waive the privileges and immunities + granted to it by virtue of its status as an Intergovernmental Organization + or submit itself to any jurisdiction. +--> +<lccdd> + <include ref="parameters.xml"/> + <include ref="detector.xml"/> + <include ref="conditions.xml"/> +</lccdd> diff --git a/compact/components/CB/2024-v00.00/conditions.xml b/compact/components/CB/2024-v00.00/conditions.xml new file mode 100644 index 0000000000000000000000000000000000000000..9887d2906a650339cfea04c154a9def6e6887d71 --- /dev/null +++ b/compact/components/CB/2024-v00.00/conditions.xml @@ -0,0 +1,20 @@ +<lccdd> +<!-- + (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration + + This software is distributed under the terms of the GNU General Public + Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". + + In applying this licence, CERN does not waive the privileges and immunities + granted to it by virtue of its status as an Intergovernmental Organization + or submit itself to any jurisdiction. +--> + + <plugins> + <plugin name="LHCb_CB_cond_XML_reader" type="xml"> + <conditions_config prefix="Conditions/CB"/> + <alignment detector="CB" path="global.yml" name="CBSystem"/> + </plugin> + </plugins> + +</lccdd> diff --git a/compact/components/CB/2024-v00.00/detector.xml b/compact/components/CB/2024-v00.00/detector.xml new file mode 100644 index 0000000000000000000000000000000000000000..6b32bd7aec71ed1dfd973b8f7014e0e90bac5b69 --- /dev/null +++ b/compact/components/CB/2024-v00.00/detector.xml @@ -0,0 +1,57 @@ +<!--==========================================================================--> +<!-- LHCb Detector Description --> +<!--==========================================================================--> +<!-- --> +<!-- Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) --> +<!-- All rights reserved. --> +<!-- --> +<!-- @author B. Dey --> +<!-- @date 14/10/2018, 06/04/2020(last rev.) --> +<!-- --> +<!--==========================================================================--> +<!-- XML description of CODEX-beta --> +<!--==========================================================================--> + +<lccdd> + + <detectors> + <detector id="CB:ID" name="CB" type="CB_geo" parent="${CB:parent}" readout="CBHits" vis="CB:Envelope"> + + + <transformation> + <position/> + </transformation> + <position /> + + <debug> +<!-- + <item name="attach_volume" value="lvLayer5X1"/> + <item name="attach_volume" value="lvLayer5V"/> + <item name="attach_volume" value="lvStation5"/> + + <item name="attach_volume" value="lvFTModuleFull"/> + <item name="attach_volume" value="lvFTModuleHoleLeftU"/> + <item name="attach_volume" value="lvFTModuleHoleRightV"/> + <item name="attach_volume" value="lvFTModuleHoleRightX"/> + <item name="attach_volume" value="lvFTModuleHoleRightU"/> + <item name="attach_volume" value="lvFTModuleHoleLeftV"/> + + <item name="attach_volume" value="lvLayer5V"/> + + <item name="attach_volume" value="lvStation5"/> + <item name="attach_volume" value="lvTrip"/> +--> + <item name="build_passive" value="1"/> + <item name="local_debug" value="0"/> + <item name="debug" value="0"/> + </debug> + + </detector> + </detectors> + + <readouts> + <readout name="CBHits"> + <id>system:8,face:5,triplet:6,GG:2</id> + </readout> + </readouts> +</lccdd> diff --git a/compact/components/CB/2024-v00.00/parameters.xml b/compact/components/CB/2024-v00.00/parameters.xml new file mode 100644 index 0000000000000000000000000000000000000000..643f6a73f9617cff0058d73390b8eb9dfa9bcdc4 --- /dev/null +++ b/compact/components/CB/2024-v00.00/parameters.xml @@ -0,0 +1,176 @@ +<!--==========================================================================--> +<!-- LHCb Detector Description --> +<!--==========================================================================--> +<!-- --> +<!-- Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) --> +<!-- All rights reserved. --> +<!-- --> +<!-- @author B.Dey --> +<!-- @date 21/12/2021 --> +<!-- --> +<!--==========================================================================--> +<!-- XML description of CODEX-beta --> +<!--==========================================================================--> + +<lccdd> + + <define> + <constant name="CB:eps" value="float:epsilon"/> + <constant name="CB:nGG" value="3"/> + + <!-- BI7 frame including 30mm uninstrumented perimeter (Dave) --> + <!-- CX-1 --> + <constant name="CB:ZShift" value="200*mm"/> <!-- 2.25 inches --> + <constant name="CB:CX_t" value="57.15*mm"/> <!-- 2.25 inches --> + <constant name="CB:CX_w" value="1028.7*mm"/> <!-- 40.5 inches --> + <constant name="CB:CX_l" value="1879.6*mm"/> <!-- 74 inches --> + <constant name="CB:CX_w_gap" value="12.7*mm"/> <!-- 0.5 inches gap between the RPC frames --> + + <constant name="CB:triplet_AlSkin" value="2.0*mm"/> <!-- --> + <constant name="CB:triplet_t" value="36.0*mm"/> <!-- rpc3GapMaxThickness --> + <constant name="CB:triplet_w" value="970.0*mm"/> <!-- --> + <constant name="CB:triplet_l" value="1820.0*mm"/> <!-- --> + + <!-- additional dead areas for the gas gaps inside a triplet --> + <constant name="CB:gg_deadarea_w" value="0.0"/> <!-- --> + <constant name="CB:gg_deadarea_l" value="0.0"/> <!-- --> + + <!-- //https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonGeoModel/src/RpcLayer.cxx#L167 --> + <constant name="CB:Forex_t" value="3.5*mm"/> <!-- rpc3GapStrPanThickness --> + <constant name="CB:Copper_t" value="0.3*mm"/> <!-- rpc3GapStrPanCopThickness --> + <constant name="CB:Air_t" value="0.52*mm"/> <!-- rpc3GapTotAirThickness (corresponds to PET+glue. NOT simulated but filled with Bakelite) --> + <constant name="CB:Bakelite_t" value="1.2*mm"/> <!-- rpc3GapBakelThickness --> + <constant name="CB:GG_t" value="1.0*mm"/> <!-- rpc3GapGThickness --> + <constant name="CB:singlet_t" value="11.8*mm"/> <!-- rpc3GapLayerThickness --> + + <!-- Singlets (email from Michael Wilkinson on 22nd June 2023) --> + <constant name="CB:phi_thickness" value="25.07*mm"/> <!-- Phi Strip width --> + <constant name="CB:phi_lgap" value="1.47*mm"/> <!-- Phi Strip left gap for controls? --> + <constant name="CB:phi_rgap" value="0.53*mm"/> <!-- Phi Strip small right gap --> + <constant name="CB:phi_pitch" value="CB:phi_thickness+CB:phi_lgap+CB:phi_rgap"/> <!-- 27.07mm --> + <constant name="CB:phi_nstrips" value="64"/> <!-- 8 X 8 --> + + <constant name="CB:eta_thickness" value="26.09*mm"/> <!-- Phi Strip width --> + <constant name="CB:eta_bgap" value="1.4*mm"/> <!-- Phi Strip bottom gap for controls? --> + <constant name="CB:eta_tgap" value="0.6*mm"/> <!-- Phi Strip small top gap --> + <constant name="CB:eta_pitch" value="CB:eta_thickness+CB:eta_tgap+CB:eta_bgap"/> <!-- 28.09 mm --> + <constant name="CB:eta_nstrips" value="32"/> <!-- 4 X 8 --> + + </define> + + + <!-- RPC materials from Matteo Negrini on 29th April 2021 --> + <materials> + + <material name="CB:Scintillator"> <!--0--> + <D type="density" value="1.06" unit="g/cm3"/> + <fraction ref="Carbon" n="0.8571"/> + <fraction ref="Hydrogen" n="0.1429"/> + </material> + + <material name="CB:CO2"> <!--1--> + <D type="density" value="0.00184" unit="g/cm3"/> + <composite n="1" ref="Carbon"/> + <composite n="2" ref="Oxygen"/> + </material> + + <material name="CB:ArCO2"> <!--2--> + <D type="density" value="0.0054" unit="g/cm3"/> + <fraction n="0.93" ref="Argon"/> + <fraction n="0.07" ref="CB:CO2"/> + </material> + + <material name="CB:RPVC"> <!--3--> + <D type="density" value="1.2" unit="g/cm3"/> + <fraction n="0.375" ref="Carbon"/> + <fraction n="0.09375" ref="Hydrogen"/> + <fraction n="0.53125" ref="Chlorine"/> + </material> + + <material name="CB:RPCgas"> <!--4--> + <D type="density" value="0.006" unit="g/cm3"/> + <composite n="2" ref="Carbon"/> + <composite n="2" ref="Hydrogen"/> + <composite n="4" ref="Fluorine"/> + </material> + + <material name="CB:RpcFoam"> <!--5--> + <D type="density" value="0.155" unit="g/cm3"/> + <composite n="1" ref="Carbon"/> + <composite n="1" ref="Hydrogen"/> + </material> + + <material name="CB:RpcPapHonC"> <!--6--> + <D type="density" value="0.042" unit="g/cm3"/> + <composite n="6" ref="Carbon"/> + <composite n="10" ref="Hydrogen"/> + <composite n="5" ref="Oxygen"/> + </material> + + <material name="CB:TGCGas"> <!--8 --> + <D type="density" value="0.0026" unit="g/cm3"/> + <fraction n="0.55" ref="CB:CO2"/> + <fraction n="0.075439" ref="Hydrogen"/> + <fraction n="0.374561" ref="Carbon"/> + </material> + + <material name="CB:Honeycomb"> <!--9--> + <D type="density" value="0.042" unit="g/cm3"/> + <composite n="2" ref="Carbon"/> + <composite n="3" ref="Hydrogen"/> + </material> + + <material name="CB:PET"> <!--10--> + <D type="density" value="1.4" unit="g/cm3"/> + <composite n="10" ref="Carbon"/> + <composite n="8" ref="Hydrogen"/> + </material> + + <material name="CB:Foam"> <!--11--> + <D type="density" value="0.035" unit="g/cm3"/> + <composite n="1" ref="Carbon"/> + <composite n="1" ref="Hydrogen"/> + </material> + + <material name="CB:CscArCO2"> <!-- 12 --> + <D type="density" value="0.00174" unit="g/cm3"/> + <fraction n="0.8" ref="Argon"/> + <fraction n="0.2" ref="CB:CO2"/> + </material> + + <material name="CB:Forex"> <!-- 13 --> + <D type="density" value="0.7" unit="g/cm3"/> + <composite n="2" ref="Carbon"/> + <composite n="3" ref="Hydrogen"/> + <composite n="1" ref="Chlorine"/> + </material> + + <material name="CB:FR4"> <!--14--> + <D type="density" value="1.85" unit="g/cm3"/> + <fraction n="0.164" ref="Oxygen"/> + <fraction n="0.073" ref="Hydrogen"/> + <fraction n="0.763" ref="Carbon"/> + </material> + + <material name="CB:Bakelite"> <!--NIST--> + <D type="density" value="1.25" unit="g/cm3"/> + <fraction n="0.057441" ref="Hydrogen"/> + <fraction n="0.774591" ref="Carbon"/> + <fraction n="0.167968" ref="Oxygen"/> + </material> + + </materials> + + <display> + <vis name="CB:singlet" alpha="0.1" r="0.2" g="0.1" b="0.0" showDaughters="true" visible="false"/> + <vis name="CB:Forex" alpha="0.1" r="0.0" g="1.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="CB:RPCGas" alpha="0.5" r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="CB:CuSkin" alpha="0.1" r="0.0" g="0.1" b="0.3" showDaughters="true" visible="true"/> + <vis name="CB:Bakelite" alpha="0.1" r="0.0" g="0.1" b="1.0" showDaughters="true" visible="true"/> + <vis name="CB:triplet" alpha="0.2" r="0.2" g="0.1" b="0.1" showDaughters="true" visible="false"/> + <vis name="CB:AlSkin" alpha="0.1" r="0.0" g="0.3" b="0.0" showDaughters="true" visible="false"/> + <vis name="CB:Air" alpha="0.1" r="0.0" g="0.3" b="0.0" showDaughters="true" visible="false"/> + <vis name="CB:Envelope" alpha="0.1" r="0.0" g="0.3" b="0.0" showDaughters="true" visible="true"/> + </display> + +</lccdd> diff --git a/compact/components/CB/trunk/CB.xml b/compact/components/CB/trunk/CB.xml new file mode 100644 index 0000000000000000000000000000000000000000..f17fdeeb61a616fac70ae67926113c0f47c26a99 --- /dev/null +++ b/compact/components/CB/trunk/CB.xml @@ -0,0 +1,16 @@ + +<!-- + (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration + + This software is distributed under the terms of the GNU General Public + Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". + + In applying this licence, CERN does not waive the privileges and immunities + granted to it by virtue of its status as an Intergovernmental Organization + or submit itself to any jurisdiction. +--> +<lccdd> + <include ref="parameters.xml"/> + <include ref="detector.xml"/> + <include ref="conditions.xml"/> +</lccdd> diff --git a/compact/components/CB/trunk/conditions.xml b/compact/components/CB/trunk/conditions.xml new file mode 100644 index 0000000000000000000000000000000000000000..9887d2906a650339cfea04c154a9def6e6887d71 --- /dev/null +++ b/compact/components/CB/trunk/conditions.xml @@ -0,0 +1,20 @@ +<lccdd> +<!-- + (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration + + This software is distributed under the terms of the GNU General Public + Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". + + In applying this licence, CERN does not waive the privileges and immunities + granted to it by virtue of its status as an Intergovernmental Organization + or submit itself to any jurisdiction. +--> + + <plugins> + <plugin name="LHCb_CB_cond_XML_reader" type="xml"> + <conditions_config prefix="Conditions/CB"/> + <alignment detector="CB" path="global.yml" name="CBSystem"/> + </plugin> + </plugins> + +</lccdd> diff --git a/compact/components/CB/trunk/detector.xml b/compact/components/CB/trunk/detector.xml new file mode 100644 index 0000000000000000000000000000000000000000..6b32bd7aec71ed1dfd973b8f7014e0e90bac5b69 --- /dev/null +++ b/compact/components/CB/trunk/detector.xml @@ -0,0 +1,57 @@ +<!--==========================================================================--> +<!-- LHCb Detector Description --> +<!--==========================================================================--> +<!-- --> +<!-- Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) --> +<!-- All rights reserved. --> +<!-- --> +<!-- @author B. Dey --> +<!-- @date 14/10/2018, 06/04/2020(last rev.) --> +<!-- --> +<!--==========================================================================--> +<!-- XML description of CODEX-beta --> +<!--==========================================================================--> + +<lccdd> + + <detectors> + <detector id="CB:ID" name="CB" type="CB_geo" parent="${CB:parent}" readout="CBHits" vis="CB:Envelope"> + + + <transformation> + <position/> + </transformation> + <position /> + + <debug> +<!-- + <item name="attach_volume" value="lvLayer5X1"/> + <item name="attach_volume" value="lvLayer5V"/> + <item name="attach_volume" value="lvStation5"/> + + <item name="attach_volume" value="lvFTModuleFull"/> + <item name="attach_volume" value="lvFTModuleHoleLeftU"/> + <item name="attach_volume" value="lvFTModuleHoleRightV"/> + <item name="attach_volume" value="lvFTModuleHoleRightX"/> + <item name="attach_volume" value="lvFTModuleHoleRightU"/> + <item name="attach_volume" value="lvFTModuleHoleLeftV"/> + + <item name="attach_volume" value="lvLayer5V"/> + + <item name="attach_volume" value="lvStation5"/> + <item name="attach_volume" value="lvTrip"/> +--> + <item name="build_passive" value="1"/> + <item name="local_debug" value="0"/> + <item name="debug" value="0"/> + </debug> + + </detector> + </detectors> + + <readouts> + <readout name="CBHits"> + <id>system:8,face:5,triplet:6,GG:2</id> + </readout> + </readouts> +</lccdd> diff --git a/compact/components/CB/trunk/parameters.xml b/compact/components/CB/trunk/parameters.xml new file mode 100644 index 0000000000000000000000000000000000000000..643f6a73f9617cff0058d73390b8eb9dfa9bcdc4 --- /dev/null +++ b/compact/components/CB/trunk/parameters.xml @@ -0,0 +1,176 @@ +<!--==========================================================================--> +<!-- LHCb Detector Description --> +<!--==========================================================================--> +<!-- --> +<!-- Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) --> +<!-- All rights reserved. --> +<!-- --> +<!-- @author B.Dey --> +<!-- @date 21/12/2021 --> +<!-- --> +<!--==========================================================================--> +<!-- XML description of CODEX-beta --> +<!--==========================================================================--> + +<lccdd> + + <define> + <constant name="CB:eps" value="float:epsilon"/> + <constant name="CB:nGG" value="3"/> + + <!-- BI7 frame including 30mm uninstrumented perimeter (Dave) --> + <!-- CX-1 --> + <constant name="CB:ZShift" value="200*mm"/> <!-- 2.25 inches --> + <constant name="CB:CX_t" value="57.15*mm"/> <!-- 2.25 inches --> + <constant name="CB:CX_w" value="1028.7*mm"/> <!-- 40.5 inches --> + <constant name="CB:CX_l" value="1879.6*mm"/> <!-- 74 inches --> + <constant name="CB:CX_w_gap" value="12.7*mm"/> <!-- 0.5 inches gap between the RPC frames --> + + <constant name="CB:triplet_AlSkin" value="2.0*mm"/> <!-- --> + <constant name="CB:triplet_t" value="36.0*mm"/> <!-- rpc3GapMaxThickness --> + <constant name="CB:triplet_w" value="970.0*mm"/> <!-- --> + <constant name="CB:triplet_l" value="1820.0*mm"/> <!-- --> + + <!-- additional dead areas for the gas gaps inside a triplet --> + <constant name="CB:gg_deadarea_w" value="0.0"/> <!-- --> + <constant name="CB:gg_deadarea_l" value="0.0"/> <!-- --> + + <!-- //https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonGeoModel/src/RpcLayer.cxx#L167 --> + <constant name="CB:Forex_t" value="3.5*mm"/> <!-- rpc3GapStrPanThickness --> + <constant name="CB:Copper_t" value="0.3*mm"/> <!-- rpc3GapStrPanCopThickness --> + <constant name="CB:Air_t" value="0.52*mm"/> <!-- rpc3GapTotAirThickness (corresponds to PET+glue. NOT simulated but filled with Bakelite) --> + <constant name="CB:Bakelite_t" value="1.2*mm"/> <!-- rpc3GapBakelThickness --> + <constant name="CB:GG_t" value="1.0*mm"/> <!-- rpc3GapGThickness --> + <constant name="CB:singlet_t" value="11.8*mm"/> <!-- rpc3GapLayerThickness --> + + <!-- Singlets (email from Michael Wilkinson on 22nd June 2023) --> + <constant name="CB:phi_thickness" value="25.07*mm"/> <!-- Phi Strip width --> + <constant name="CB:phi_lgap" value="1.47*mm"/> <!-- Phi Strip left gap for controls? --> + <constant name="CB:phi_rgap" value="0.53*mm"/> <!-- Phi Strip small right gap --> + <constant name="CB:phi_pitch" value="CB:phi_thickness+CB:phi_lgap+CB:phi_rgap"/> <!-- 27.07mm --> + <constant name="CB:phi_nstrips" value="64"/> <!-- 8 X 8 --> + + <constant name="CB:eta_thickness" value="26.09*mm"/> <!-- Phi Strip width --> + <constant name="CB:eta_bgap" value="1.4*mm"/> <!-- Phi Strip bottom gap for controls? --> + <constant name="CB:eta_tgap" value="0.6*mm"/> <!-- Phi Strip small top gap --> + <constant name="CB:eta_pitch" value="CB:eta_thickness+CB:eta_tgap+CB:eta_bgap"/> <!-- 28.09 mm --> + <constant name="CB:eta_nstrips" value="32"/> <!-- 4 X 8 --> + + </define> + + + <!-- RPC materials from Matteo Negrini on 29th April 2021 --> + <materials> + + <material name="CB:Scintillator"> <!--0--> + <D type="density" value="1.06" unit="g/cm3"/> + <fraction ref="Carbon" n="0.8571"/> + <fraction ref="Hydrogen" n="0.1429"/> + </material> + + <material name="CB:CO2"> <!--1--> + <D type="density" value="0.00184" unit="g/cm3"/> + <composite n="1" ref="Carbon"/> + <composite n="2" ref="Oxygen"/> + </material> + + <material name="CB:ArCO2"> <!--2--> + <D type="density" value="0.0054" unit="g/cm3"/> + <fraction n="0.93" ref="Argon"/> + <fraction n="0.07" ref="CB:CO2"/> + </material> + + <material name="CB:RPVC"> <!--3--> + <D type="density" value="1.2" unit="g/cm3"/> + <fraction n="0.375" ref="Carbon"/> + <fraction n="0.09375" ref="Hydrogen"/> + <fraction n="0.53125" ref="Chlorine"/> + </material> + + <material name="CB:RPCgas"> <!--4--> + <D type="density" value="0.006" unit="g/cm3"/> + <composite n="2" ref="Carbon"/> + <composite n="2" ref="Hydrogen"/> + <composite n="4" ref="Fluorine"/> + </material> + + <material name="CB:RpcFoam"> <!--5--> + <D type="density" value="0.155" unit="g/cm3"/> + <composite n="1" ref="Carbon"/> + <composite n="1" ref="Hydrogen"/> + </material> + + <material name="CB:RpcPapHonC"> <!--6--> + <D type="density" value="0.042" unit="g/cm3"/> + <composite n="6" ref="Carbon"/> + <composite n="10" ref="Hydrogen"/> + <composite n="5" ref="Oxygen"/> + </material> + + <material name="CB:TGCGas"> <!--8 --> + <D type="density" value="0.0026" unit="g/cm3"/> + <fraction n="0.55" ref="CB:CO2"/> + <fraction n="0.075439" ref="Hydrogen"/> + <fraction n="0.374561" ref="Carbon"/> + </material> + + <material name="CB:Honeycomb"> <!--9--> + <D type="density" value="0.042" unit="g/cm3"/> + <composite n="2" ref="Carbon"/> + <composite n="3" ref="Hydrogen"/> + </material> + + <material name="CB:PET"> <!--10--> + <D type="density" value="1.4" unit="g/cm3"/> + <composite n="10" ref="Carbon"/> + <composite n="8" ref="Hydrogen"/> + </material> + + <material name="CB:Foam"> <!--11--> + <D type="density" value="0.035" unit="g/cm3"/> + <composite n="1" ref="Carbon"/> + <composite n="1" ref="Hydrogen"/> + </material> + + <material name="CB:CscArCO2"> <!-- 12 --> + <D type="density" value="0.00174" unit="g/cm3"/> + <fraction n="0.8" ref="Argon"/> + <fraction n="0.2" ref="CB:CO2"/> + </material> + + <material name="CB:Forex"> <!-- 13 --> + <D type="density" value="0.7" unit="g/cm3"/> + <composite n="2" ref="Carbon"/> + <composite n="3" ref="Hydrogen"/> + <composite n="1" ref="Chlorine"/> + </material> + + <material name="CB:FR4"> <!--14--> + <D type="density" value="1.85" unit="g/cm3"/> + <fraction n="0.164" ref="Oxygen"/> + <fraction n="0.073" ref="Hydrogen"/> + <fraction n="0.763" ref="Carbon"/> + </material> + + <material name="CB:Bakelite"> <!--NIST--> + <D type="density" value="1.25" unit="g/cm3"/> + <fraction n="0.057441" ref="Hydrogen"/> + <fraction n="0.774591" ref="Carbon"/> + <fraction n="0.167968" ref="Oxygen"/> + </material> + + </materials> + + <display> + <vis name="CB:singlet" alpha="0.1" r="0.2" g="0.1" b="0.0" showDaughters="true" visible="false"/> + <vis name="CB:Forex" alpha="0.1" r="0.0" g="1.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="CB:RPCGas" alpha="0.5" r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> + <vis name="CB:CuSkin" alpha="0.1" r="0.0" g="0.1" b="0.3" showDaughters="true" visible="true"/> + <vis name="CB:Bakelite" alpha="0.1" r="0.0" g="0.1" b="1.0" showDaughters="true" visible="true"/> + <vis name="CB:triplet" alpha="0.2" r="0.2" g="0.1" b="0.1" showDaughters="true" visible="false"/> + <vis name="CB:AlSkin" alpha="0.1" r="0.0" g="0.3" b="0.0" showDaughters="true" visible="false"/> + <vis name="CB:Air" alpha="0.1" r="0.0" g="0.3" b="0.0" showDaughters="true" visible="false"/> + <vis name="CB:Envelope" alpha="0.1" r="0.0" g="0.3" b="0.0" showDaughters="true" visible="true"/> + </display> + +</lccdd> diff --git a/compact/components/FT/trunk/FT.xml b/compact/components/FT/trunk/FT.xml index 920629da1aaa9553f3661a3e5e0a6ada3301780a..c54eaeee1661a3191584562b67fc9f61705cdcbd 100644 --- a/compact/components/FT/trunk/FT.xml +++ b/compact/components/FT/trunk/FT.xml @@ -13,4 +13,4 @@ <include ref="visualization.xml"/> <include ref="detector.xml"/> <include ref="conditions.xml"/> -</lccdd> \ No newline at end of file +</lccdd> diff --git a/compact/components/Regions/trunk/detector.xml b/compact/components/Regions/trunk/detector.xml index 58109b1eb8e615fcc085ac2c8f6ca4fcd3a6653e..791720510aadb348e7516e39662d5056a8c94742 100644 --- a/compact/components/Regions/trunk/detector.xml +++ b/compact/components/Regions/trunk/detector.xml @@ -80,5 +80,11 @@ <position x="0*cm" y="0*cm" z="Regions:DownstreamZPos"/> </detector> + <detector name="CodexRegion" type="DD4hep_VolumeAssembly" parent="/world" ignore="CodexRegion:ignore" vis="Regions:CodexRegion"> + <envelope name="lvCodexRegion" type="Box" material="Air" + dx="300*cm" dy="300*cm" dz="300*cm"/> + <position x="0*m" y="0*m" z="4*m"/> + </detector> + </detectors> </lccdd> diff --git a/compact/run3/trunk/LHCb.xml b/compact/run3/trunk/LHCb.xml index e6465889e6884b9aa7c5359be4b677cd5aad30cb..076a1e079adf5e8f17b335baeaf559fbbc29d995 100644 --- a/compact/run3/trunk/LHCb.xml +++ b/compact/run3/trunk/LHCb.xml @@ -69,4 +69,6 @@ <include ref="${path:Pipe}/PipeDownstream.xml" /> <include ref="${path:Pipe}/PipeAfterMuon.xml" /> + <!-- Codex Region --> + <include ref="${path:CB}/CB.xml" /> </lccdd> diff --git a/compact/run3/trunk/path.xml b/compact/run3/trunk/path.xml index 75ce9e250f4a27bde50e6131ac984af93d0d2a08..e5db502f78473c9d218ebda3de48b559ed69e6aa 100644 --- a/compact/run3/trunk/path.xml +++ b/compact/run3/trunk/path.xml @@ -17,6 +17,7 @@ <constant name="path:MBXW" value="../../components/MBXW/trunk" type="string"/> <constant name="path:Pipe" value="../../components/Pipe/trunk" type="string"/> <constant name="path:Rich" value="../../components/Rich/trunk" type="string"/> + <constant name="path:CB" value="../../components/CB/trunk" type="string"/> <constant name="path:VP" value="../../components/VP/trunk" type="string"/> <constant name="path:UT" value="../../components/UT/trunk" type="string"/> <constant name="path:Magnet" value="../../components/Magnet/trunk" type="string"/>