From 38fdd5ffc91bf69a99c97845e8a763ac397f2c1b Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Fri, 11 Oct 2024 15:30:27 +0200
Subject: [PATCH 01/10] first introduction of an online id generator and test

---
 .../InDetDetDescr/ITkStripCabling/CMakeLists.txt       | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/CMakeLists.txt b/InnerDetector/InDetDetDescr/ITkStripCabling/CMakeLists.txt
index f0f0526d040e..3a1a6ee7f68f 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/CMakeLists.txt
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/CMakeLists.txt
@@ -45,6 +45,16 @@ atlas_add_test( ITkStripCablingAlg_test
     InDetIdentifier
   POST_EXEC_SCRIPT nopost.sh
 )
+
+atlas_add_test( OnlineIdGenerator_test	
+  SOURCES 
+  src/OnlineIdGenerator.cxx  test/OnlineIdGenerator_test.cxx 
+  INCLUDE_DIRS  ${Boost_INCLUDE_DIRS}  
+  LINK_LIBRARIES ${Boost_LIBRARIES} TestTools AthenaBaseComps  
+    PathResolver StoreGateLib IdDictParser ITkStripCablingLib 
+    InDetIdentifier
+  POST_EXEC_SCRIPT nopost.sh
+)
 atlas_install_joboptions(share/*.txt)
 atlas_install_runtime(share/*.dat)
 
-- 
GitLab


From 6f75980a5d2c32cb1743de15e6133034077edd51 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Fri, 11 Oct 2024 16:36:07 +0200
Subject: [PATCH 02/10] add counting of module sides

---
 .../test/ITkStripCablingAlg_test.cxx           | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
index 2bf6d45971c6..3294b9340fba 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
@@ -109,12 +109,30 @@ BOOST_AUTO_TEST_SUITE(ITkStripCablingAlgTest )
       BOOST_TEST(pITkId->initialize_from_dictionary(idd)==0);
       std::ostringstream os;
       ExpandedIdentifier e{};
+      struct Numerology{
+        int barrelA{};
+        int barrelC{};
+        int endcapA{};
+        int endcapC{};
+      } num;
       for(auto i = pITkId->wafer_begin();i!=pITkId->wafer_end();++i){
+        if (pITkId->is_barrel(*i)){
+          if (pITkId->eta_module(*i) > 0) ++num.barrelA;
+          else ++num.barrelC;
+        } else {
+          if (pITkId->barrel_ec(*i) > 0) ++num.endcapA;
+          else ++num.endcapC;
+        }
         pITkId->get_expanded_id(*i,e);
         os<<*i<<" "<<e<<"\n";
       }
       BOOST_TEST_MESSAGE("Wafer Identifiers and Expanded Identifiers {2/2/Bec/LayerDisk/Phi/Eta/Side/0/0}:");
       BOOST_TEST_MESSAGE(os.str());
+      std::string stats = "nBarrel A: "+std::to_string(num.barrelA)+"\n";
+      stats+= "nBarrel C: "+std::to_string(num.barrelC)+"\n";
+      stats+= "nEndcap A: "+std::to_string(num.endcapA)+"\n";
+      stats+= "nEndcap C: "+std::to_string(num.endcapC)+"\n";
+      BOOST_TEST_MESSAGE(stats);
       BOOST_TEST(detStore->record(std::move(pITkId), "SCT_ID").isSuccess());
     }//Now the ITkStripID is in StoreGate, ready to be used by the cabling
     ITkStripCablingAlg a("MyAlg", g.svcLoc);
-- 
GitLab


From 1bf6a30f90b9802cdd1d25e10a0312f59eb60715 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Fri, 11 Oct 2024 16:50:32 +0200
Subject: [PATCH 03/10] small changes

---
 .../ITkStripCabling/src/OnlineIdGenerator.cxx | 50 +++++++++++++++++++
 .../ITkStripCabling/src/OnlineIdGenerator.h   | 50 +++++++++++++++++++
 .../test/OnlineIdGenerator_test.cxx           | 45 +++++++++++++++++
 3 files changed, 145 insertions(+)
 create mode 100644 InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
 create mode 100644 InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
 create mode 100644 InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
new file mode 100644
index 000000000000..db358bf64c7a
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
@@ -0,0 +1,50 @@
+/*
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "src/OnlineIdGenerator.h"
+#include "ITkStripCabling/ITkStripOnlineId.h"
+#include "Identifier/Identifier.h"
+#include "IdDict/IdDictDefs.h"
+#include "IdDictParser/IdDictParser.h"
+#include "InDetIdentifier/SCT_ID.h"
+
+#include <string>
+
+namespace ITkStripCabling{
+//hardcoded: to be replaced later
+static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_ITK_HGTD_23.xml"};
+
+OnlineIdGenerator::OnlineIdGenerator(){
+  IdDictParser parser;
+  parser.register_external_entity("InnerDetector", itkDictFilename);
+  IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
+  m_pITkId=std::make_unique<SCT_ID>();
+  if (m_pITkId->initialize_from_dictionary(idd) !=0){
+    throw std::runtime_error("OnlineIdGenerator() could not initialise");
+  };
+}
+
+  OnlineIdGenerator::RodId 
+  OnlineIdGenerator::rod32(int bec, int eta) const{
+    OnlineIdGenerator::RodId result = UNKNOWN;
+    if (bec == 0){
+      result = (eta>0) ? BARREL_A : BARREL_C;
+    } else if (bec == -2){
+      result = ENDCAP_C;
+    } else if (bec == 2){
+      result = ENDCAP_A;
+    }
+    return result;
+  }
+  
+  ITkStripOnlineId 
+  OnlineIdGenerator::operator()(const Identifier & offId){
+    const int bec =  m_pITkId->barrel_ec(offId);
+    const int eta = m_pITkId->eta_module(offId);
+    int rod = rod32(bec,eta);
+    return ITkStripOnlineId(rod);
+  }
+
+
+}
\ No newline at end of file
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
new file mode 100644
index 000000000000..c3a7f60ea7a6
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
@@ -0,0 +1,50 @@
+/*
+  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef OnlineIdGenerator_h
+#define OnlineIdGenerator_h
+
+/**   
+ *   @file OnlineIdGenerator.cxx
+ *
+ *   @brief Algorithmically generates a dummy OnlineId from an Identifier
+ *
+ *   @author Shaun Roe
+ *   @date October 2024
+**/
+#include <cstdint> //uint32_t
+#include <memory>
+#include "InDetIdentifier/SCT_ID.h"
+
+ 
+class ITkStripOnlineId;
+class Identifier;
+
+
+ 
+namespace ITkStripCabling{
+  class OnlineIdGenerator{
+  public:
+    enum RodId : std::uint32_t {
+      BARREL_A = 0x21000000,
+      BARREL_C = 0x22000000, 
+      ENDCAP_A = 0x23000000, 
+      ENDCAP_C = 0x24000000,
+      UNKNOWN = 0xFF000000
+    };
+    OnlineIdGenerator(); 
+    ITkStripOnlineId operator()(const Identifier & offId);
+  
+  private:
+    std::unique_ptr<SCT_ID> m_pITkId{};
+    
+    //get rod by bec, eta
+    RodId rod32(int bec, int eta=0) const;
+  };
+}
+ 
+ 
+ 
+ 
+ #endif
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
new file mode 100644
index 000000000000..c54fa6416ef0
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
@@ -0,0 +1,45 @@
+/*
+   Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
+ */
+ 
+ 
+/**
+ * @file ITkStripCabling/test/OnlineIdGenerator_test.cxx
+ * @author Shaun Roe
+ * @date October 2024
+ * @brief Some tests for OnlineIdGenerator
+ */
+ 
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MAIN
+#define BOOST_TEST_MODULE TEST_ITkStripCabling
+
+#include "CxxUtils/checker_macros.h"
+ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
+#include <boost/test/unit_test.hpp>
+
+#include "src/OnlineIdGenerator.h"
+#include "ITkStripCabling/ITkStripOnlineId.h"
+#include "Identifier/Identifier.h"
+#include <sstream>
+#include <cstdint>
+
+namespace utf = boost::unit_test;
+using namespace ITkStripCabling;
+
+BOOST_AUTO_TEST_SUITE(OnlineIdGeneratorTest)
+
+  BOOST_AUTO_TEST_CASE(OnlineIdGeneratorConstructors){
+    BOOST_CHECK_NO_THROW([[maybe_unused]] OnlineIdGenerator s);
+  }
+  
+  BOOST_AUTO_TEST_CASE(OnlineIdGeneratorConversion){
+    OnlineIdGenerator s;
+    Identifier offId(0x800380000000000ull);
+    ITkStripOnlineId onId(0x24000000);
+    BOOST_TEST(s(offId) == onId);
+  }
+
+
+BOOST_AUTO_TEST_SUITE_END()
+
-- 
GitLab


From dfd151f5705ec92c734bd67a8212fd0d8b7bb73f Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Tue, 22 Oct 2024 17:07:55 +0200
Subject: [PATCH 04/10] progress in dividing up rods/fibres

---
 .../ITkStripCabling/src/OnlineIdGenerator.cxx | 63 +++++++++++++------
 .../ITkStripCabling/src/OnlineIdGenerator.h   | 11 +++-
 .../test/OnlineIdGenerator_test.cxx           | 17 +++--
 3 files changed, 66 insertions(+), 25 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
index db358bf64c7a..60b54a28a1b1 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
@@ -15,35 +15,62 @@ namespace ITkStripCabling{
 //hardcoded: to be replaced later
 static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_ITK_HGTD_23.xml"};
 
-OnlineIdGenerator::OnlineIdGenerator(){
-  IdDictParser parser;
-  parser.register_external_entity("InnerDetector", itkDictFilename);
-  IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
-  m_pITkId=std::make_unique<SCT_ID>();
-  if (m_pITkId->initialize_from_dictionary(idd) !=0){
-    throw std::runtime_error("OnlineIdGenerator() could not initialise");
-  };
-}
+  OnlineIdGenerator::OnlineIdGenerator(){
+    IdDictParser parser;
+    parser.register_external_entity("InnerDetector", itkDictFilename);
+    IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
+    m_pITkId=std::make_unique<SCT_ID>();
+    if (m_pITkId->initialize_from_dictionary(idd) !=0){
+      throw std::runtime_error("OnlineIdGenerator() could not initialise");
+    };
+  }
 
-  OnlineIdGenerator::RodId 
-  OnlineIdGenerator::rod32(int bec, int eta) const{
-    OnlineIdGenerator::RodId result = UNKNOWN;
+  std::uint32_t 
+  OnlineIdGenerator::rod32(int bec, int layer_disk, int phi, int eta) const{
+    static constexpr std::array<std::uint32_t,6> layerOffset{0x00000000, 0x00100000, 0x00200000, 0x00300000,0x00400000, 0x00500000};
+    std::uint32_t result = RodId::UNKNOWN;
+    const auto absBec = std::abs(bec);
     if (bec == 0){
       result = (eta>0) ? BARREL_A : BARREL_C;
-    } else if (bec == -2){
-      result = ENDCAP_C;
-    } else if (bec == 2){
-      result = ENDCAP_A;
+      //barrels 2 and 3 have 56 and 72 phi indices, exceeding the felix 48 fibres per unit
+      // so I'm going to hard code halving that into two felixes (rods)
+      if (((layer_disk == 2) and (phi>=28)) or ((layer_disk == 3) and (phi>=36))) result |= 0x00010000;
+    } else if (absBec == 2){
+      result = (bec>0)? ENDCAP_A:ENDCAP_C;
+      //for eta 10-17, the phi goes to 0-63, so split this in two
+      if ((eta>=10) and (phi>=32)) result |= 0x00010000;
     }
+    result |= layerOffset[layer_disk];
     return result;
   }
   
+  std::uint32_t 
+  OnlineIdGenerator::barrelLink16(int layer_disk, int phi) const{
+    int offset = 0;
+    if ((layer_disk == 2) and (phi>=28)) offset = 28;
+    if ((layer_disk == 3) and (phi>=36)) offset = 36;
+    if (const int fibre = (phi - offset);(fibre < 0) or (fibre > 47)) return INVALID_LINK;
+    else  return static_cast< std::uint32_t>(fibre);
+  }
+  std::uint32_t 
+  OnlineIdGenerator::endcapLink16(int eta, int phi) const{
+    int offset = 0;
+    if ((eta >= 10) and (phi>=32)) offset = 32;
+    if (const int fibre = (phi - offset);(fibre < 0) or (fibre > 47)) return INVALID_LINK;
+    else  return static_cast< std::uint32_t>(fibre);
+  }
+  
   ITkStripOnlineId 
   OnlineIdGenerator::operator()(const Identifier & offId){
     const int bec =  m_pITkId->barrel_ec(offId);
+    const auto absBec = std::abs(bec);
     const int eta = m_pITkId->eta_module(offId);
-    int rod = rod32(bec,eta);
-    return ITkStripOnlineId(rod);
+    const int layer_disk = m_pITkId->layer_disk(offId);
+    const int phi = m_pITkId->phi_module(offId);
+    const std::uint32_t rod = rod32(bec, layer_disk, phi, eta);
+    const std::uint32_t fibre = (absBec == 0)? barrelLink16(layer_disk, phi) : endcapLink16(eta, phi);
+    const auto rodFibre = rod | fibre;
+    return ITkStripOnlineId(rodFibre);
   }
 
 
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
index c3a7f60ea7a6..91e427e35b58 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
@@ -33,14 +33,19 @@ namespace ITkStripCabling{
       ENDCAP_C = 0x24000000,
       UNKNOWN = 0xFF000000
     };
+    static constexpr std::uint32_t INVALID_LINK{0x0000FFFF};
     OnlineIdGenerator(); 
     ITkStripOnlineId operator()(const Identifier & offId);
+    //
+    //get rod by bec, layer_disk, eta
+    std::uint32_t rod32(int bec, int layer_disk, int phi, int eta=0) const;
+    //get link as lower 16 bits of 32 bit word
+    std::uint32_t barrelLink16(int layer_disk, int phi) const;
+    std::uint32_t endcapLink16(int eta, int phi) const;
   
   private:
     std::unique_ptr<SCT_ID> m_pITkId{};
-    
-    //get rod by bec, eta
-    RodId rod32(int bec, int eta=0) const;
+   
   };
 }
  
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
index c54fa6416ef0..2eeab1996111 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
@@ -32,12 +32,21 @@ BOOST_AUTO_TEST_SUITE(OnlineIdGeneratorTest)
   BOOST_AUTO_TEST_CASE(OnlineIdGeneratorConstructors){
     BOOST_CHECK_NO_THROW([[maybe_unused]] OnlineIdGenerator s);
   }
-  
+
   BOOST_AUTO_TEST_CASE(OnlineIdGeneratorConversion){
     OnlineIdGenerator s;
-    Identifier offId(0x800380000000000ull);
-    ITkStripOnlineId onId(0x24000000);
-    BOOST_TEST(s(offId) == onId);
+    //endcap C, disk 0
+    Identifier ec1offId(0x800380000000000ull);
+    ITkStripOnlineId onId1(0x24000000);
+    BOOST_TEST(s(ec1offId) == onId1);
+    //endcap C, disk 1
+    Identifier ec2offId(0x841c60000000000ull);
+    ITkStripOnlineId onId2(0x24100003);
+    BOOST_TEST(s(ec2offId) == onId2);
+    //barrel C side, layer 3
+    Identifier brloffId(0xacc8c0000000000ull);
+    ITkStripOnlineId onId3(0x22300019);
+    BOOST_TEST(s(brloffId) == onId3);
   }
 
 
-- 
GitLab


From 8025e48fb8d17d3582cd53bfdaba79a0bf14bbe7 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Tue, 22 Oct 2024 17:20:37 +0200
Subject: [PATCH 05/10] update test; not yet fully functional

---
 .../InDetDetDescr/ITkStripCabling/CMakeLists.txt       | 10 ++++++----
 .../ITkStripCabling/test/ITkStripCablingAlg_test.cxx   |  6 +++++-
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/CMakeLists.txt b/InnerDetector/InDetDetDescr/ITkStripCabling/CMakeLists.txt
index 3a1a6ee7f68f..637c82387e8c 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/CMakeLists.txt
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/CMakeLists.txt
@@ -36,9 +36,11 @@ atlas_add_test( ITkStripCablingData_test
   POST_EXEC_SCRIPT nopost.sh
 )
 
-atlas_add_test( ITkStripCablingAlg_test	
+
+
+atlas_add_test( OnlineIdGenerator_test	
   SOURCES 
-  src/ITkStripCablingAlg.cxx src/components/*.cxx test/ITkStripCablingAlg_test.cxx 
+  src/OnlineIdGenerator.cxx  test/OnlineIdGenerator_test.cxx 
   INCLUDE_DIRS  ${Boost_INCLUDE_DIRS}  
   LINK_LIBRARIES ${Boost_LIBRARIES} TestTools AthenaBaseComps  
     PathResolver StoreGateLib IdDictParser ITkStripCablingLib 
@@ -46,9 +48,9 @@ atlas_add_test( ITkStripCablingAlg_test
   POST_EXEC_SCRIPT nopost.sh
 )
 
-atlas_add_test( OnlineIdGenerator_test	
+atlas_add_test( ITkStripCablingAlg_test	
   SOURCES 
-  src/OnlineIdGenerator.cxx  test/OnlineIdGenerator_test.cxx 
+  src/ITkStripCablingAlg.cxx src/OnlineIdGenerator.cxx src/components/*.cxx test/ITkStripCablingAlg_test.cxx 
   INCLUDE_DIRS  ${Boost_INCLUDE_DIRS}  
   LINK_LIBRARIES ${Boost_LIBRARIES} TestTools AthenaBaseComps  
     PathResolver StoreGateLib IdDictParser ITkStripCablingLib 
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
index 3294b9340fba..a004892a270f 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
@@ -29,7 +29,10 @@
 #include "IdDictParser/IdDictParser.h"  
 #include "InDetIdentifier/SCT_ID.h"
 #include "src/ITkStripCablingAlg.h"
+#include "src/OnlineIdGenerator.h"
 #include "StoreGate/ReadHandleKey.h"
+
+
 #include <string>
 #include <sstream>      // std::ostringstream
 #include <memory>
@@ -107,6 +110,7 @@ BOOST_AUTO_TEST_SUITE(ITkStripCablingAlgTest )
       IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
       auto pITkId=std::make_unique<SCT_ID>();
       BOOST_TEST(pITkId->initialize_from_dictionary(idd)==0);
+      ITkStripCabling::OnlineIdGenerator gen;
       std::ostringstream os;
       ExpandedIdentifier e{};
       struct Numerology{
@@ -124,7 +128,7 @@ BOOST_AUTO_TEST_SUITE(ITkStripCablingAlgTest )
           else ++num.endcapC;
         }
         pITkId->get_expanded_id(*i,e);
-        os<<*i<<" "<<e<<"\n";
+        os<<*i<<" "<<e<<", "<<gen(*i)<<"\n";
       }
       BOOST_TEST_MESSAGE("Wafer Identifiers and Expanded Identifiers {2/2/Bec/LayerDisk/Phi/Eta/Side/0/0}:");
       BOOST_TEST_MESSAGE(os.str());
-- 
GitLab


From 56141c370518d311f736baefa6d3205023a9b69e Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Wed, 23 Oct 2024 11:04:58 +0200
Subject: [PATCH 06/10] add valid testing file

---
 ...DictInnerDetector_ITK-P2-RUN4-03-00-00.xml | 1303 +++++++++++++++++
 1 file changed, 1303 insertions(+)
 create mode 100644 InnerDetector/InDetDetDescr/InDetIdDictFiles/data/IdDictInnerDetector_ITK-P2-RUN4-03-00-00.xml

diff --git a/InnerDetector/InDetDetDescr/InDetIdDictFiles/data/IdDictInnerDetector_ITK-P2-RUN4-03-00-00.xml b/InnerDetector/InDetDetDescr/InDetIdDictFiles/data/IdDictInnerDetector_ITK-P2-RUN4-03-00-00.xml
new file mode 100644
index 000000000000..cc0dd5743005
--- /dev/null
+++ b/InnerDetector/InDetDetDescr/InDetIdDictFiles/data/IdDictInnerDetector_ITK-P2-RUN4-03-00-00.xml
@@ -0,0 +1,1303 @@
+<!--
+
+   The InnerDetector identifier is arranged as follows
+
+   InnerDetector
+     part=Pixel
+       side=barrel
+         layer phi_module eta_module phi_index eta_index
+       side=endcap
+         disk phi_module eta_module phi_index eta_index
+     part=SCT
+       side=barrel
+         layer phi_module eta_module side strip
+       side=endcap
+         disk phi_module eta_module side strip
+     part=TRT
+       side=barrel
+         layer phi_module straw_layer straw
+       side=endcap
+         wheel phi_module straw_layer straw
+     part=HGTD
+       endcap layer moduleInLayer padInModuleRow padInModuleColum
+
+  -->
+
+<IdDictionary name="InnerDetector" version="P2-RUN4" >
+  <field name="part" >
+    <label name="Pixel"               value="1" />
+    <label name="SCT"                 value="2" />
+    <label name="LuminosityDetectors" value="3" />
+    <label name="HGTD"                value="4" />
+  </field>
+
+  <field name="barrel_endcap">
+    <label name="negative_plr"    value="-4" />
+    <label name="negative_endcap" value="-2" />
+    <label name="negative_barrel" value="-1" />
+    <label name="barrel"          value="0" />
+    <label name="positive_barrel" value="+1"  />
+    <label name="positive_endcap" value="+2"  />
+    <label name="positive_plr"    value="+4"  />
+  </field>
+
+  <!-- <field name="hgtd_endcap">
+    <label name="negative_endcap" value="-2" />
+    <label name="positive_endcap" value="+2" />
+  </field> -->
+
+  <field name="PLR_or_BCM">
+    <label name="PLR" value="1" />
+    <label name="BCM" value="2" />
+  </field>
+
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="11" wraparound="TRUE" />
+    <range field="eta_module" values="-12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9 10 11 12 " />
+    <range field="phi_index" minvalue="0" maxvalue="767" />
+    <range field="eta_index" minvalue="0" maxvalue="200" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" values="-6 -5 -4 -3 -2 -1 1 2 3 4 5 6 " />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" values="-9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9 " />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="3" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" values="-9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9 " />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" values="-9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9 " />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="6" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="7" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="8" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="9" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="10" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="11" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="12" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="13" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="17" wraparound="TRUE" />
+    <range field="eta_module" value="14" />
+    <range field="phi_index" minvalue="0" maxvalue="400" />
+    <range field="eta_index" minvalue="0" maxvalue="383" />
+  </region>
+  
+    <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="29" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+    <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="29" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="29" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+    <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="29" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+    <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="29" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+    <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="29" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  
+  
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="6" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="7" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="8" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="9" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="10" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="11" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="12" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="13" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="14" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="14" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="15" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="16" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="17" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="18" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="19" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="20" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="21" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="19" wraparound="TRUE" />
+    <range field="eta_module" value="22" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="3" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="3" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="3" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="3" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="3" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="3" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="6" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="7" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="8" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="9" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="4" />
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="10" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="5" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="5" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="5" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="5" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="5" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="5" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="5" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="6" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="5" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="7" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="6" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="6 " />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="6" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="6" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="6" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="6" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="6" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="6" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="6" />
+    <range field="phi_module" minvalue="0" maxvalue="43" wraparound="TRUE" />
+    <range field="eta_module" value="7" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="6" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="7" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="7" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" value="8" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="6" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="7" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+  <region group="pixel" >
+    <range field="part" value="Pixel" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" value="8" />
+    <range field="phi_module" minvalue="0" maxvalue="51" wraparound="TRUE" />
+    <range field="eta_module" value="8" />
+    <range field="phi_index" minvalue="0" maxvalue="772" />
+    <range field="eta_index" minvalue="0" maxvalue="804" />
+  </region>
+
+<region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="0" />
+    <range field="phi_module" minvalue="0" maxvalue="27" wraparound="TRUE" />
+    <range field="eta_module" values="-56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1279" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="39" wraparound="TRUE" />
+    <range field="eta_module" values="-56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 " />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1279" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="2" />
+    <range field="phi_module" minvalue="0" maxvalue="55" wraparound="TRUE" />
+    <range field="eta_module" values="-28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1279" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" value="barrel" />
+    <range field="layer" value="3" />
+    <range field="phi_module" minvalue="0" maxvalue="71" wraparound="TRUE" />
+    <range field="eta_module" values="-28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1279" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="0" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1023" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1023" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="2" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1151" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="3" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1151" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="4" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1279" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="5" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1279" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="6" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1407" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="7" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1407" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="8" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1535" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="31" wraparound="TRUE" />
+    <range field="eta_module" value="9" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="strip" minvalue="0" maxvalue="1535" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="63" wraparound="TRUE" />
+    <range field="eta_module" value="10" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="895" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="63" wraparound="TRUE" />
+    <range field="eta_module" value="11" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="895" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="63" wraparound="TRUE" />
+    <range field="eta_module" value="12" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="895" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="63" wraparound="TRUE" />
+    <range field="eta_module" value="13" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="895" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="63" wraparound="TRUE" />
+    <range field="eta_module" value="14" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1023" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="63" wraparound="TRUE" />
+    <range field="eta_module" value="15" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1023" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="63" wraparound="TRUE" />
+    <range field="eta_module" value="16" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1151" />
+  </region>
+
+  <region group="sct" >
+    <range field="part" value="SCT" />
+    <range field="barrel_endcap" values="negative_endcap positive_endcap" />
+    <range field="disk" minvalue="0" maxvalue="5"/>
+    <range field="phi_module" minvalue="0" maxvalue="63" wraparound="TRUE" />
+    <range field="eta_module" value="17" />
+    <range field="side" minvalue="0" maxvalue="1" />
+    <range field="row" value="0" />
+    <range field="strip" minvalue="0" maxvalue="1151" />
+  </region>
+
+  <region group="plr" >
+    <range field="part" value="LuminosityDetectors" />
+    <range field="PLR_or_BCM" values="PLR" />
+    <range field="barrel_endcap" values="negative_plr positive_plr" />
+    <range field="disk" value="1" />
+    <range field="phi_module" minvalue="0" maxvalue="23" wraparound="TRUE" />
+    <range field="eta_module" value="1" />
+    <range field="phi_index" minvalue="0" maxvalue="767" />
+    <range field="eta_index" minvalue="0" maxvalue="199" />
+  </region>
+
+<!-- HGTD positive endcap(2) -->
+  <region group="hgtd" >
+    <range field="part" value="HGTD" />
+    <range field="endcap" value="2" />
+    <range field="layer" value="0" />
+    <range field="moduleInLayer" minvalue="1" maxvalue="1004" />
+    <range field="dummyVariable"  value="0" />
+    <range field="padInModuleRow" minvalue="0" maxvalue="14" />
+    <range field="padInModuleColumn" minvalue="0" maxvalue="29" />
+  </region>
+
+  <region group="hgtd" >
+    <range field="part" value="HGTD" />
+    <range field="endcap" value="2" />
+    <range field="layer" value="1" />
+    <range field="moduleInLayer" minvalue="1" maxvalue="1004" />
+    <range field="dummyVariable" value="0" />
+    <range field="padInModuleRow" minvalue="0" maxvalue="14" />
+    <range field="padInModuleColumn" minvalue="0" maxvalue="29" />
+  </region>
+  
+  <region group="hgtd" >
+    <range field="part" value="HGTD" />
+    <range field="endcap" value="2" />
+    <range field="layer" value="2" />
+    <range field="moduleInLayer" minvalue="1" maxvalue="1004"/>
+    <range field="dummyVariable" value="0" />
+    <range field="padInModuleRow" minvalue="0" maxvalue="14" />
+    <range field="padInModuleColumn" minvalue="0" maxvalue="29" />
+  </region>
+  
+  <region group="hgtd" >
+    <range field="part" value="HGTD" />
+    <range field="endcap" value="2" />
+    <range field="layer" value="3" />
+    <range field="moduleInLayer" minvalue="1" maxvalue="1004" />
+    <range field="dummyVariable" value="0" />
+    <range field="padInModuleRow" minvalue="0" maxvalue="14" />
+    <range field="padInModuleColumn" minvalue="0" maxvalue="29" />
+  </region>
+
+  <!-- HGTD negative endcap(-2) -->
+  <region group="hgtd" >
+    <range field="part" value="HGTD" />
+    <range field="endcap" value="-2" />
+    <range field="layer" value="0" />
+    <range field="moduleInLayer"  minvalue="1" maxvalue="1004"/>
+    <range field="dummyVariable"  value="0" />
+    <range field="padInModuleRow" minvalue="0" maxvalue="14" />
+    <range field="padInModuleColumn" minvalue="0" maxvalue="29" />
+  </region>
+
+  <region group="hgtd" >
+    <range field="part" value="HGTD" />
+    <range field="endcap" value="-2" />
+    <range field="layer" value="1" />
+    <range field="moduleInLayer" minvalue="1" maxvalue="1004" />
+    <range field="dummyVariable" value="0" />
+    <range field="padInModuleRow" minvalue="0" maxvalue="14" />
+    <range field="padInModuleColumn" minvalue="0" maxvalue="29" />
+  </region>
+  
+  <region group="hgtd" >
+    <range field="part" value="HGTD" />
+    <range field="endcap" value="-2" />
+    <range field="layer" value="2" />
+    <range field="moduleInLayer" minvalue="1" maxvalue="1004" />
+    <range field="dummyVariable" value="0" />
+    <range field="padInModuleRow" minvalue="0" maxvalue="14" />
+    <range field="padInModuleColumn" minvalue="0" maxvalue="29" />
+  </region>
+  
+  <region group="hgtd" >
+    <range field="part" value="HGTD" />
+    <range field="endcap" value="-2" />
+    <range field="layer" value="3" />
+    <range field="moduleInLayer" minvalue="1" maxvalue="1004"/>
+    <range field="dummyVariable" value="0" />
+    <range field="padInModuleRow" minvalue="0" maxvalue="14" />
+    <range field="padInModuleColumn" minvalue="0" maxvalue="29" />
+  </region>
+
+</IdDictionary>
-- 
GitLab


From 2cfbda0f06fab6a8587c35b2bf3e6f445e0a5700 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Wed, 23 Oct 2024 14:01:44 +0200
Subject: [PATCH 07/10] use real xml to generate IDs and fix code

---
 .../ITkStripCabling/src/OnlineIdGenerator.cxx | 43 +++++++++----------
 .../ITkStripCabling/src/OnlineIdGenerator.h   | 17 ++++----
 .../test/ITkStripCablingAlg_test.cxx          | 15 +++++--
 .../test/OnlineIdGenerator_test.cxx           |  8 ++--
 4 files changed, 44 insertions(+), 39 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
index 60b54a28a1b1..4a49c124ee44 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
@@ -10,10 +10,11 @@
 #include "InDetIdentifier/SCT_ID.h"
 
 #include <string>
+#include <cmath>
 
 namespace ITkStripCabling{
 //hardcoded: to be replaced later
-static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_ITK_HGTD_23.xml"};
+static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_ITK-P2-RUN4-03-00-00.xml"};
 
   OnlineIdGenerator::OnlineIdGenerator(){
     IdDictParser parser;
@@ -27,37 +28,34 @@ static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_I
 
   std::uint32_t 
   OnlineIdGenerator::rod32(int bec, int layer_disk, int phi, int eta) const{
-    static constexpr std::array<std::uint32_t,6> layerOffset{0x00000000, 0x00100000, 0x00200000, 0x00300000,0x00400000, 0x00500000};
     std::uint32_t result = RodId::UNKNOWN;
     const auto absBec = std::abs(bec);
     if (bec == 0){
       result = (eta>0) ? BARREL_A : BARREL_C;
-      //barrels 2 and 3 have 56 and 72 phi indices, exceeding the felix 48 fibres per unit
-      // so I'm going to hard code halving that into two felixes (rods)
-      if (((layer_disk == 2) and (phi>=28)) or ((layer_disk == 3) and (phi>=36))) result |= 0x00010000;
+      result |= (static_cast<std::uint32_t>(phi)<<8);
     } else if (absBec == 2){
       result = (bec>0)? ENDCAP_A:ENDCAP_C;
-      //for eta 10-17, the phi goes to 0-63, so split this in two
-      if ((eta>=10) and (phi>=32)) result |= 0x00010000;
+      result |= (static_cast<std::uint32_t>(std::abs(eta))<<8);
     }
-    result |= layerOffset[layer_disk];
-    return result;
+    return result+layer_disk;
   }
   
   std::uint32_t 
-  OnlineIdGenerator::barrelLink16(int layer_disk, int phi) const{
-    int offset = 0;
-    if ((layer_disk == 2) and (phi>=28)) offset = 28;
-    if ((layer_disk == 3) and (phi>=36)) offset = 36;
-    if (const int fibre = (phi - offset);(fibre < 0) or (fibre > 47)) return INVALID_LINK;
-    else  return static_cast< std::uint32_t>(fibre);
+  OnlineIdGenerator::rod(const Identifier & offId) const{
+    const int bec =  m_pITkId->barrel_ec(offId);
+    const int eta = m_pITkId->eta_module(offId);
+    const int layer_disk = m_pITkId->layer_disk(offId);
+    const int phi = m_pITkId->phi_module(offId);
+    return rod32(bec, layer_disk, phi, eta);
+  }
+  
+  std::uint32_t 
+  OnlineIdGenerator::barrelLink16(int eta) const{
+    return static_cast< std::uint32_t>(std::abs(eta));
   }
   std::uint32_t 
-  OnlineIdGenerator::endcapLink16(int eta, int phi) const{
-    int offset = 0;
-    if ((eta >= 10) and (phi>=32)) offset = 32;
-    if (const int fibre = (phi - offset);(fibre < 0) or (fibre > 47)) return INVALID_LINK;
-    else  return static_cast< std::uint32_t>(fibre);
+  OnlineIdGenerator::endcapLink16(int phi) const{
+    return static_cast< std::uint32_t>(phi);
   }
   
   ITkStripOnlineId 
@@ -68,9 +66,8 @@ static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_I
     const int layer_disk = m_pITkId->layer_disk(offId);
     const int phi = m_pITkId->phi_module(offId);
     const std::uint32_t rod = rod32(bec, layer_disk, phi, eta);
-    const std::uint32_t fibre = (absBec == 0)? barrelLink16(layer_disk, phi) : endcapLink16(eta, phi);
-    const auto rodFibre = rod | fibre;
-    return ITkStripOnlineId(rodFibre);
+    const std::uint32_t fibre = (absBec == 0)? barrelLink16(eta) : endcapLink16(phi);
+    return ITkStripOnlineId(rod,fibre);
   }
 
 
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
index 91e427e35b58..549a2e9b370d 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
@@ -27,21 +27,22 @@ namespace ITkStripCabling{
   class OnlineIdGenerator{
   public:
     enum RodId : std::uint32_t {
-      BARREL_A = 0x21000000,
-      BARREL_C = 0x22000000, 
-      ENDCAP_A = 0x23000000, 
-      ENDCAP_C = 0x24000000,
-      UNKNOWN = 0xFF000000
+      BARREL_A = 0x210000,
+      BARREL_C = 0x220000, 
+      ENDCAP_A = 0x230000, 
+      ENDCAP_C = 0x240000,
+      UNKNOWN = 0xFF0000
     };
     static constexpr std::uint32_t INVALID_LINK{0x0000FFFF};
     OnlineIdGenerator(); 
     ITkStripOnlineId operator()(const Identifier & offId);
-    //
+    //get rod by Identifier
+    std::uint32_t rod(const Identifier & offId) const;
     //get rod by bec, layer_disk, eta
     std::uint32_t rod32(int bec, int layer_disk, int phi, int eta=0) const;
     //get link as lower 16 bits of 32 bit word
-    std::uint32_t barrelLink16(int layer_disk, int phi) const;
-    std::uint32_t endcapLink16(int eta, int phi) const;
+    std::uint32_t barrelLink16(int eta) const;
+    std::uint32_t endcapLink16(int phi) const;
   
   private:
     std::unique_ptr<SCT_ID> m_pITkId{};
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
index a004892a270f..16a6442a8329 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
@@ -36,6 +36,7 @@
 #include <string>
 #include <sstream>      // std::ostringstream
 #include <memory>
+#include <set>
 
 namespace utf = boost::unit_test;
 
@@ -55,7 +56,7 @@ struct GaudiKernelFixture{
 
 ISvcLocator* GaudiKernelFixture::svcLoc = nullptr;
 
-static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_ITK_HGTD_23.xml"};
+static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_ITK-P2-RUN4-03-00-00.xml"};
 
 //from EventIDBase
 typedef unsigned int number_type;
@@ -119,6 +120,8 @@ BOOST_AUTO_TEST_SUITE(ITkStripCablingAlgTest )
         int endcapA{};
         int endcapC{};
       } num;
+      std::set<ITkStripOnlineId> onlineIds;
+      std::set<std::uint32_t> rodIds;
       for(auto i = pITkId->wafer_begin();i!=pITkId->wafer_end();++i){
         if (pITkId->is_barrel(*i)){
           if (pITkId->eta_module(*i) > 0) ++num.barrelA;
@@ -128,14 +131,18 @@ BOOST_AUTO_TEST_SUITE(ITkStripCablingAlgTest )
           else ++num.endcapC;
         }
         pITkId->get_expanded_id(*i,e);
+        onlineIds.insert(gen(*i));
+        rodIds.insert(gen.rod(*i));
         os<<*i<<" "<<e<<", "<<gen(*i)<<"\n";
       }
       BOOST_TEST_MESSAGE("Wafer Identifiers and Expanded Identifiers {2/2/Bec/LayerDisk/Phi/Eta/Side/0/0}:");
       BOOST_TEST_MESSAGE(os.str());
       std::string stats = "nBarrel A: "+std::to_string(num.barrelA)+"\n";
-      stats+= "nBarrel C: "+std::to_string(num.barrelC)+"\n";
-      stats+= "nEndcap A: "+std::to_string(num.endcapA)+"\n";
-      stats+= "nEndcap C: "+std::to_string(num.endcapC)+"\n";
+      stats+= "nBarrel C : "+std::to_string(num.barrelC)+"\n";
+      stats+= "nEndcap A : "+std::to_string(num.endcapA)+"\n";
+      stats+= "nEndcap C : "+std::to_string(num.endcapC)+"\n";
+      stats+= "n onlineId: "+std::to_string(onlineIds.size())+"\n";
+      stats+= "n robs    : "+std::to_string(rodIds.size())+"\n";
       BOOST_TEST_MESSAGE(stats);
       BOOST_TEST(detStore->record(std::move(pITkId), "SCT_ID").isSuccess());
     }//Now the ITkStripID is in StoreGate, ready to be used by the cabling
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
index 2eeab1996111..0004525000ce 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
@@ -37,15 +37,15 @@ BOOST_AUTO_TEST_SUITE(OnlineIdGeneratorTest)
     OnlineIdGenerator s;
     //endcap C, disk 0
     Identifier ec1offId(0x800380000000000ull);
-    ITkStripOnlineId onId1(0x24000000);
+    ITkStripOnlineId onId1(0x240000);
     BOOST_TEST(s(ec1offId) == onId1);
     //endcap C, disk 1
     Identifier ec2offId(0x841c60000000000ull);
-    ITkStripOnlineId onId2(0x24100003);
+    ITkStripOnlineId onId2(0x3240e01);
     BOOST_TEST(s(ec2offId) == onId2);
     //barrel C side, layer 3
-    Identifier brloffId(0xacc8c0000000000ull);
-    ITkStripOnlineId onId3(0x22300019);
+    Identifier brloffId(0xad39c0000000000ull);
+    ITkStripOnlineId onId3(0x1c222703);
     BOOST_TEST(s(brloffId) == onId3);
   }
 
-- 
GitLab


From 2e4f233c9ac3d2962dae9c4a1d5fcfe5260a9ab2 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Wed, 23 Oct 2024 14:59:10 +0200
Subject: [PATCH 08/10] add constructor with SCT_ID helper

---
 .../ITkStripCabling/src/OnlineIdGenerator.cxx | 12 +----------
 .../ITkStripCabling/src/OnlineIdGenerator.h   |  7 +++----
 .../test/ITkStripCablingAlg_test.cxx          |  2 +-
 .../test/OnlineIdGenerator_test.cxx           | 21 +++++++++++++++++--
 4 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
index 4a49c124ee44..1d2739f7a4aa 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
@@ -5,8 +5,6 @@
 #include "src/OnlineIdGenerator.h"
 #include "ITkStripCabling/ITkStripOnlineId.h"
 #include "Identifier/Identifier.h"
-#include "IdDict/IdDictDefs.h"
-#include "IdDictParser/IdDictParser.h"
 #include "InDetIdentifier/SCT_ID.h"
 
 #include <string>
@@ -14,16 +12,8 @@
 
 namespace ITkStripCabling{
 //hardcoded: to be replaced later
-static const std::string itkDictFilename{"InDetIdDictFiles/IdDictInnerDetector_ITK-P2-RUN4-03-00-00.xml"};
 
-  OnlineIdGenerator::OnlineIdGenerator(){
-    IdDictParser parser;
-    parser.register_external_entity("InnerDetector", itkDictFilename);
-    IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
-    m_pITkId=std::make_unique<SCT_ID>();
-    if (m_pITkId->initialize_from_dictionary(idd) !=0){
-      throw std::runtime_error("OnlineIdGenerator() could not initialise");
-    };
+  OnlineIdGenerator::OnlineIdGenerator(SCT_ID * sctId):m_pITkId(sctId){
   }
 
   std::uint32_t 
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
index 549a2e9b370d..cb6b529bf8e2 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.h
@@ -14,12 +14,11 @@
  *   @date October 2024
 **/
 #include <cstdint> //uint32_t
-#include <memory>
-#include "InDetIdentifier/SCT_ID.h"
 
  
 class ITkStripOnlineId;
 class Identifier;
+class SCT_ID;
 
 
  
@@ -34,7 +33,7 @@ namespace ITkStripCabling{
       UNKNOWN = 0xFF0000
     };
     static constexpr std::uint32_t INVALID_LINK{0x0000FFFF};
-    OnlineIdGenerator(); 
+    OnlineIdGenerator(SCT_ID * pITkIdHelper); 
     ITkStripOnlineId operator()(const Identifier & offId);
     //get rod by Identifier
     std::uint32_t rod(const Identifier & offId) const;
@@ -45,7 +44,7 @@ namespace ITkStripCabling{
     std::uint32_t endcapLink16(int phi) const;
   
   private:
-    std::unique_ptr<SCT_ID> m_pITkId{};
+    SCT_ID * m_pITkId{};
    
   };
 }
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
index 16a6442a8329..883183168108 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/ITkStripCablingAlg_test.cxx
@@ -111,7 +111,7 @@ BOOST_AUTO_TEST_SUITE(ITkStripCablingAlgTest )
       IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
       auto pITkId=std::make_unique<SCT_ID>();
       BOOST_TEST(pITkId->initialize_from_dictionary(idd)==0);
-      ITkStripCabling::OnlineIdGenerator gen;
+      ITkStripCabling::OnlineIdGenerator gen(pITkId.get());
       std::ostringstream os;
       ExpandedIdentifier e{};
       struct Numerology{
diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
index 0004525000ce..668bd936a5cb 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
@@ -21,20 +21,37 @@ ATLAS_NO_CHECK_FILE_THREAD_SAFETY;
 #include "src/OnlineIdGenerator.h"
 #include "ITkStripCabling/ITkStripOnlineId.h"
 #include "Identifier/Identifier.h"
+#include "IdDictParser/IdDictParser.h"
+#include "IdDict/IdDictDefs.h"
+#include "InDetIdentifier/SCT_ID.h"
+
+
 #include <sstream>
 #include <cstdint>
 
 namespace utf = boost::unit_test;
 using namespace ITkStripCabling;
+static const std::string defaultFilename{"InDetIdDictFiles/IdDictInnerDetector_ITK-P2-RUN4-03-00-00.xml"};
+
 
 BOOST_AUTO_TEST_SUITE(OnlineIdGeneratorTest)
 
   BOOST_AUTO_TEST_CASE(OnlineIdGeneratorConstructors){
-    BOOST_CHECK_NO_THROW([[maybe_unused]] OnlineIdGenerator s);
+    IdDictParser parser;
+    parser.register_external_entity("InnerDetector", defaultFilename);
+    IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
+    auto pITkId=std::make_unique<SCT_ID>();
+    BOOST_CHECK(pITkId->initialize_from_dictionary(idd) ==0);
+    BOOST_CHECK_NO_THROW([[maybe_unused]] OnlineIdGenerator s(pITkId.get()));
   }
 
   BOOST_AUTO_TEST_CASE(OnlineIdGeneratorConversion){
-    OnlineIdGenerator s;
+    IdDictParser parser;
+    parser.register_external_entity("InnerDetector", defaultFilename);
+    IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
+    pITkId=std::make_unique<SCT_ID>();
+    BOOST_CHECK(pITkId->initialize_from_dictionary(idd) ==0);
+    OnlineIdGenerator s(pITkId.get());
     //endcap C, disk 0
     Identifier ec1offId(0x800380000000000ull);
     ITkStripOnlineId onId1(0x240000);
-- 
GitLab


From 1a27d6fe4f0b3d7d4192f9fea66475575d748e4f Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Wed, 23 Oct 2024 15:03:40 +0200
Subject: [PATCH 09/10] solve compiler error

---
 .../ITkStripCabling/test/OnlineIdGenerator_test.cxx             | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
index 668bd936a5cb..5cedb4dbfc6f 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/test/OnlineIdGenerator_test.cxx
@@ -49,7 +49,7 @@ BOOST_AUTO_TEST_SUITE(OnlineIdGeneratorTest)
     IdDictParser parser;
     parser.register_external_entity("InnerDetector", defaultFilename);
     IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml");
-    pITkId=std::make_unique<SCT_ID>();
+    auto pITkId=std::make_unique<SCT_ID>();
     BOOST_CHECK(pITkId->initialize_from_dictionary(idd) ==0);
     OnlineIdGenerator s(pITkId.get());
     //endcap C, disk 0
-- 
GitLab


From 76f53661b289e756a0a99536e7780ead4d2b9d08 Mon Sep 17 00:00:00 2001
From: Shaun Roe <shaun.roe@cern.ch>
Date: Fri, 25 Oct 2024 08:37:22 +0200
Subject: [PATCH 10/10] Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: Thomas Strebler <thomas.strebler@cern.ch>
---
 .../InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
index 1d2739f7a4aa..f1e501956a56 100644
--- a/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
+++ b/InnerDetector/InDetDetDescr/ITkStripCabling/src/OnlineIdGenerator.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
 */
 
-#include "src/OnlineIdGenerator.h"
+#include "OnlineIdGenerator.h"
 #include "ITkStripCabling/ITkStripOnlineId.h"
 #include "Identifier/Identifier.h"
 #include "InDetIdentifier/SCT_ID.h"
-- 
GitLab