ATLAS Offline Software
OnlineIdGenerator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "OnlineIdGenerator.h"
7 #include "Identifier/Identifier.h"
9 
10 #include <string>
11 #include <cmath>
12 
13 namespace ITkStripCabling{
14 //hardcoded: to be replaced later
15 
16  OnlineIdGenerator::OnlineIdGenerator(SCT_ID * sctId):m_pITkId(sctId){
17  }
18 
20  OnlineIdGenerator::rod32(int bec, int layer_disk, int phi, int eta) const{
22  const auto absBec = std::abs(bec);
23  if (bec == 0){
24  result = (eta>0) ? BARREL_A : BARREL_C;
25  result |= (static_cast<std::uint32_t>(phi)<<8);
26  } else if (absBec == 2){
27  result = (bec>0)? ENDCAP_A:ENDCAP_C;
28  result |= (static_cast<std::uint32_t>(std::abs(eta))<<8);
29  }
30  return result+layer_disk;
31  }
32 
34  OnlineIdGenerator::rod(const Identifier & offId) const{
35  const int bec = m_pITkId->barrel_ec(offId);
36  const int eta = m_pITkId->eta_module(offId);
37  const int layer_disk = m_pITkId->layer_disk(offId);
38  const int phi = m_pITkId->phi_module(offId);
39  return rod32(bec, layer_disk, phi, eta);
40  }
41 
44  return static_cast< std::uint32_t>(std::abs(eta));
45  }
48  return static_cast< std::uint32_t>(phi);
49  }
50 
53  const int bec = m_pITkId->barrel_ec(offId);
54  const auto absBec = std::abs(bec);
55  const int eta = m_pITkId->eta_module(offId);
56  const int layer_disk = m_pITkId->layer_disk(offId);
57  const int phi = m_pITkId->phi_module(offId);
58  const std::uint32_t rod = rod32(bec, layer_disk, phi, eta);
59  const std::uint32_t fibre = (absBec == 0)? barrelLink16(eta) : endcapLink16(phi);
60  return ITkStripOnlineId(rod,fibre);
61  }
62 
63 
64 }
python.StoreID.UNKNOWN
int UNKNOWN
Definition: StoreID.py:16
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
get_generator_info.result
result
Definition: get_generator_info.py:21
ITkStripCabling::OnlineIdGenerator::OnlineIdGenerator
OnlineIdGenerator(SCT_ID *pITkIdHelper)
Definition: OnlineIdGenerator.cxx:16
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ITkStripCabling::OnlineIdGenerator::m_pITkId
SCT_ID * m_pITkId
Definition: OnlineIdGenerator.h:47
ITkStripCabling::OnlineIdGenerator::endcapLink16
std::uint32_t endcapLink16(int phi) const
Definition: OnlineIdGenerator.cxx:47
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: SCT_ID.h:740
ITkStripCabling::OnlineIdGenerator::ENDCAP_C
@ ENDCAP_C
Definition: OnlineIdGenerator.h:32
ITkStripCabling::OnlineIdGenerator::operator()
ITkStripOnlineId operator()(const Identifier &offId)
Definition: OnlineIdGenerator.cxx:52
ITkStripCabling::OnlineIdGenerator::rod32
std::uint32_t rod32(int bec, int layer_disk, int phi, int eta=0) const
Definition: OnlineIdGenerator.cxx:20
ITkStripCabling::OnlineIdGenerator::barrelLink16
std::uint32_t barrelLink16(int eta) const
Definition: OnlineIdGenerator.cxx:43
ITkStripOnlineId.h
ITkStripCabling
Definition: OnlineIdGenerator.cxx:13
ITkStripCabling::OnlineIdGenerator::BARREL_A
@ BARREL_A
Definition: OnlineIdGenerator.h:29
OnlineIdGenerator.h
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
ITkStripCabling::OnlineIdGenerator::BARREL_C
@ BARREL_C
Definition: OnlineIdGenerator.h:30
ITkStripCabling::OnlineIdGenerator::rod
std::uint32_t rod(const Identifier &offId) const
Definition: OnlineIdGenerator.cxx:34
SCT_ID
Definition: SCT_ID.h:68
ITkStripOnlineId
Definition: ITkStripOnlineId.h:16
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition: SCT_ID.h:746
ITkStripCabling::OnlineIdGenerator::ENDCAP_A
@ ENDCAP_A
Definition: OnlineIdGenerator.h:31
Identifier
Definition: IdentifierFieldParser.cxx:14