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 
27  // Quick sanity check, if we get here somehow without configuring a valid geokey.
28  if (not m_ringIndex) {
29  ATH_MSG_ERROR("No configured ring index relabel for geometry " << m_geoKey);
30  return false;
31  }
32 
33  // Re-assign layers in the pixel endcap to be each individual disk
34  if (hit.isPixel() && !hit.isBarrel()) {
35  if (hit.getPhysLayer() < m_ringIndex->size()) {
36  unsigned newlayer = hit.getEtaModule() + (*m_ringIndex)[hit.getPhysLayer()];
37  int newmodule = 100*newlayer + hit.getEtaIndex() / 10;
38 
39  hit.setPhysLayer(newlayer);
40  if (m_remapModules) {
41  hit.setEtaModule(newmodule);
42  }
43  }
44  else {
45  ATH_MSG_ERROR("Error: requesting "<< hit.getPhysLayer() << " element in m_ringIndex which is of size " << m_ringIndex->size());
46  return false;
47  }
48 
49  }
50  return true;
51 }
52 
FPGATrackSimHit::getPhysLayer
unsigned getPhysLayer() const
Definition: FPGATrackSimHit.cxx:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
htt
Definition: FPGATrackSimModuleRelabel.h:22
FPGATrackSimHit::getEtaModule
unsigned getEtaModule() const
Definition: FPGATrackSimHit.h:82
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
FPGATrackSimHit
Definition: FPGATrackSimHit.h:38
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:72
FPGATrackSimModuleRelabel.h
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
FPGATrackSimHit::getEtaIndex
unsigned getEtaIndex() const
Definition: FPGATrackSimHit.h:102
FPGATrackSimHit::setPhysLayer
void setPhysLayer(unsigned v)
FPGATrackSimHit::isPixel
bool isPixel() const
Definition: FPGATrackSimHit.h:61
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:63
FPGATrackSimModuleRelabel::remap
bool remap(FPGATrackSimHit &hit) const
Definition: FPGATrackSimModuleRelabel.cxx:25