ATLAS Offline Software
FPGATrackSimModuleRelabel.cxx
Go to the documentation of this file.
1 // Copyright (C) 2023-2025 CERN for the benefit of the ATLAS collaboration
2 
3 
6 
7 using namespace std;
8 using namespace htt;
9 
10 FPGATrackSimModuleRelabel::FPGATrackSimModuleRelabel(const std::string & geokey, bool remapModules) :
11  AthMessaging("FPGATrackSimModuleRelabel"),
12  m_geoKey(geokey),
13  m_remapModules(remapModules)
14 {
15  // Set up the ring index reference based on configured geokey.
16  if (htt::ringIndices.count(m_geoKey) == 0) {
17  m_ringIndex = nullptr;
18  ATH_MSG_ERROR("Bad geometry version " << m_geoKey);
19  } else {
21  ATH_MSG_INFO("Allocating map for geometry " << m_geoKey << " diskIndex size=" << m_ringIndex->size());
22  }
23 }
24 
26 
27  if(hit.isRemapped()){
28  return false;
29  }
30  // Quick sanity check, if we get here somehow without configuring a valid geokey.
31  if (not m_ringIndex) {
32  ATH_MSG_ERROR("No configured ring index relabel for geometry " << m_geoKey);
33  return false;
34  }
35 
36  // Re-assign layers in the pixel endcap to be each individual disk
37  if (hit.isPixel() && !hit.isBarrel()) {
38  if (hit.getPhysLayer() < m_ringIndex->size()) {
39  unsigned newlayer = hit.getEtaModule() + (*m_ringIndex)[hit.getPhysLayer()];
40  int newmodule = 100*newlayer + hit.getEtaIndex() / 10;
41 
42  hit.setPhysLayer(newlayer);
43  if (m_remapModules) {
44  hit.setEtaModule(newmodule);
45  }
46  else {
47  hit.setEtaModule(hit.getEtaModule()); // allows us to save the old value
48  }
49  }
50  else {
51  ATH_MSG_ERROR("Error: requesting "<< hit.getPhysLayer() << " element in m_ringIndex which is of size " << m_ringIndex->size());
52  return false;
53  }
54  }
55  else { // allows us to save the old value
56  hit.setEtaModule(hit.getEtaModule());
57  hit.setPhysLayer(hit.getPhysLayer());
58  }
59 
60  hit.setRemap();
61  return true;
62 }
63 
FPGATrackSimHit::getEtaModule
int getEtaModule(bool old=false) const
Definition: FPGATrackSimHit.h:87
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
htt
Definition: FPGATrackSimModuleRelabel.h:22
XMLtoHeader.count
count
Definition: XMLtoHeader.py:84
FPGATrackSimHit
Definition: FPGATrackSimHit.h:41
FPGATrackSimHit::isRemapped
bool isRemapped() const
Definition: FPGATrackSimHit.cxx:20
htt::ringIndices
const std::map< const std::string, const std::vector< uint > > ringIndices
Definition: FPGATrackSimModuleRelabel.h:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
FPGATrackSimModuleRelabel::FPGATrackSimModuleRelabel
FPGATrackSimModuleRelabel(const std::string &geokey, bool remapModules)
Definition: FPGATrackSimModuleRelabel.cxx:10
FPGATrackSimHit::setEtaModule
void setEtaModule(int v)
Definition: FPGATrackSimHit.h:76
FPGATrackSimModuleRelabel.h
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
FPGATrackSimHit::getEtaIndex
unsigned getEtaIndex() const
Definition: FPGATrackSimHit.h:108
FPGATrackSimHit::setPhysLayer
void setPhysLayer(unsigned v)
Definition: FPGATrackSimHit.cxx:55
FPGATrackSimHit::isPixel
bool isPixel() const
Definition: FPGATrackSimHit.h:64
FPGATrackSimHit::setRemap
void setRemap()
Definition: FPGATrackSimHit.cxx:24
FPGATrackSimModuleRelabel::m_geoKey
std::string m_geoKey
Definition: FPGATrackSimModuleRelabel.h:42
FPGATrackSimHit.h
: FPGATrackSim-specific class to represent an hit in the detector.
FPGATrackSimModuleRelabel::m_remapModules
bool m_remapModules
Definition: FPGATrackSimModuleRelabel.h:45
FPGATrackSimHit::getPhysLayer
unsigned getPhysLayer(bool old=false) const
Definition: FPGATrackSimHit.cxx:72
FPGATrackSimModuleRelabel::m_ringIndex
const std::vector< uint > * m_ringIndex
Definition: FPGATrackSimModuleRelabel.h:49
FPGATrackSimHit::isBarrel
bool isBarrel() const
Definition: FPGATrackSimHit.h:66
FPGATrackSimModuleRelabel::remap
bool remap(FPGATrackSimHit &hit) const
Definition: FPGATrackSimModuleRelabel.cxx:25