From a8ecea4577f3d43ec24865978d9b93fb1c095f91 Mon Sep 17 00:00:00 2001
From: Johannes Junggeburth <johannes.josef.junggeburth@cern.ch>
Date: Fri, 22 Mar 2024 17:22:33 +0100
Subject: [PATCH] MuonChamberAssembleTool -- Split BOL7 chambers from the
 generic BOL sector

MuonChamberAssembleTool -- Split BOL7 chambers from the generic BOL sector
---
 .../MuonGeoModelR4/src/ChamberAssembleTool.cxx   | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/ChamberAssembleTool.cxx b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/ChamberAssembleTool.cxx
index 2cb359fa1455..0dc0d0482da9 100644
--- a/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/ChamberAssembleTool.cxx
+++ b/MuonSpectrometer/MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/ChamberAssembleTool.cxx
@@ -54,7 +54,12 @@ StatusCode ChamberAssembleTool::buildReadOutElements(MuonDetectorManager &mgr) {
                                    tgcStationIndex("T1E"), tgcStationIndex("T1F"),
                                    tgcStationIndex("T2E"), tgcStationIndex("T2F"),
                                    tgcStationIndex("T3E"), tgcStationIndex("T3F")};
- 
+   
+   const std::set<Identifier> BOE_ids{m_idHelperSvc->mdtIdHelper().elementID("BOL", 7,7),
+                                                               m_idHelperSvc->mdtIdHelper().elementID("BOL", -7,7),
+                                                               m_idHelperSvc->rpcIdHelper().elementID( "BOL", -8, 7, 1),
+                                                               m_idHelperSvc->rpcIdHelper().elementID( "BOL", 8, 7, 1)};
+
    std::vector<MuonReadoutElement*> allReadOutEles = mgr.getAllReadoutElements();
 
    std::vector<defineArgs> muonChamberCandidates{};
@@ -65,7 +70,7 @@ StatusCode ChamberAssembleTool::buildReadOutElements(MuonDetectorManager &mgr) {
    for (const MuonReadoutElement* readOutEle : allReadOutEles) {
       std::vector<defineArgs>::iterator exist = 
             std::find_if(muonChamberCandidates.begin(), muonChamberCandidates.end(), 
-                         [this, readOutEle, &stIndicesEIL, &stIndicesEM](const defineArgs& args){
+                         [this, readOutEle, &stIndicesEIL, &stIndicesEM, &BOE_ids](const defineArgs& args){
                             const MuonReadoutElement* refEle = args.readoutEles[0];
                             const Identifier refId = refEle->identify();
                             const Identifier testId = readOutEle->identify();
@@ -77,6 +82,11 @@ StatusCode ChamberAssembleTool::buildReadOutElements(MuonDetectorManager &mgr) {
                             if (m_idHelperSvc->sector(testId) != m_idHelperSvc->sector(refId)) {
                                  return false;
                             }
+                            /// Separate out the BOE chambers
+                            if (BOE_ids.count(m_idHelperSvc->chamberId(refId)) !=
+                                 BOE_ids.count(m_idHelperSvc->chamberId(testId))){
+                                    return false;
+                            }
                             /// Summarize all readout element in the same sector & layer
                             /// into a single chamber
                             if (readOutEle->stationName() == refEle->stationName()) {
@@ -193,4 +203,4 @@ StatusCode ChamberAssembleTool::buildReadOutElements(MuonDetectorManager &mgr) {
 }
 
 }
-#endif
\ No newline at end of file
+#endif
-- 
GitLab