ATLAS Offline Software
FPGATrackSimModuleRelabel.cxx
Go to the documentation of this file.
1 // Copyright (C) 2023-2024 CERN for the benefit of the ATLAS collaboration
2 
3 
6 
7 using namespace std;
8 using namespace htt;
9 
10 FPGATrackSimModuleRelabel::FPGATrackSimModuleRelabel(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  if(hit.isRemapped()){
27  return false;
28  }
29  // Quick sanity check, if we get here somehow without configuring a valid geokey.
30  if (not m_ringIndex) {
31  ATH_MSG_ERROR("No configured ring index relabel for geometry " << m_geoKey);
32  return false;
33  }
34 
35  // Re-assign layers in the pixel endcap to be each individual disk
36  if (hit.isPixel() && !hit.isBarrel()) {
37  if (hit.getPhysLayer() < m_ringIndex->size()) {
38  unsigned newlayer = hit.getEtaModule() + (*m_ringIndex)[hit.getPhysLayer()];
39  int newmodule = 100*newlayer + hit.getEtaIndex() / 10;
40 
41  hit.setPhysLayer(newlayer);
42  if (m_remapModules) {
43  hit.setEtaModule(newmodule);
44  }
45  }
46  else {
47  ATH_MSG_ERROR("Error: requesting "<< hit.getPhysLayer() << " element in m_ringIndex which is of size " << m_ringIndex->size());
48  return false;
49  }
50 
51  }
52  hit.setRemap();
53  return true;
54 }
55 
FPGATrackSimHit::getPhysLayer
unsigned getPhysLayer() const
Definition: FPGATrackSimHit.cxx:69
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
htt
Definition: FPGATrackSimModuleRelabel.h:22
FPGATrackSimHit::getEtaModule
int getEtaModule() const
Definition: FPGATrackSimHit.h:87
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
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
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:107
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
FPGATrackSimModuleRelabel::m_ringIndex
const std::vector< uint > * m_ringIndex
Definition: FPGATrackSimModuleRelabel.h:49
FPGATrackSimModuleRelabel::FPGATrackSimModuleRelabel
FPGATrackSimModuleRelabel(std::string geokey, bool remapModules)
Definition: FPGATrackSimModuleRelabel.cxx:10
FPGATrackSimHit::isBarrel
bool isBarrel() const
Definition: FPGATrackSimHit.h:66
FPGATrackSimModuleRelabel::remap
bool remap(FPGATrackSimHit &hit) const
Definition: FPGATrackSimModuleRelabel.cxx:25