ATLAS Offline Software
Loading...
Searching...
No Matches
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
7using namespace std;
8using namespace htt;
9
10FPGATrackSimModuleRelabel::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.
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
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
: FPGATrackSim-specific class to represent an hit in the detector.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
bool isBarrel() const
int getEtaModule(bool old=false) const
unsigned getPhysLayer(bool old=false) const
void setPhysLayer(unsigned v)
bool isPixel() const
void setEtaModule(int v)
bool isRemapped() const
unsigned getEtaIndex() const
bool remap(FPGATrackSimHit &hit) const
const std::vector< uint > * m_ringIndex
FPGATrackSimModuleRelabel(const std::string &geokey, bool remapModules)
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
const std::map< const std::string, const std::vector< uint > > ringIndices
STL namespace.