ATLAS Offline Software
Loading...
Searching...
No Matches
AccMap Class Reference

#include <AccMap.h>

Collaboration diagram for AccMap:

Public Member Functions

 ~AccMap ()=default
int Region (int region, int sampling, int eta) const noexcept
const CurrMapGetMap (int ifold, int ielecregion) const noexcept
const CurrMapGetMap (int ifold, int region, int sampling, int eta) const noexcept
float GetXmin (int ifold) const
float GetXmax (int ifold) const
float GetYmin (int ifold) const
float GetYmax (int ifold) const

Static Public Member Functions

static const AccMapGetAccMap ()

Static Public Attributes

static constexpr int MAX_FOLDS = 23
static constexpr int MAX_REGIONS = 10
static constexpr int N_MAX_VEC = 14

Private Member Functions

 AccMap ()

Private Attributes

std::array< std::array< std::unique_ptr< CurrMap >, MAX_REGIONS >, MAX_FOLDSm_fastMap
std::array< float, N_MAX_VECm_xmin {}
std::array< float, N_MAX_VECm_xmax {}
std::array< float, N_MAX_VECm_ymin {}
std::array< float, N_MAX_VECm_ymax {}

Detailed Description

Definition at line 13 of file AccMap.h.

Constructor & Destructor Documentation

◆ ~AccMap()

AccMap::~AccMap ( )
default

◆ AccMap()

AccMap::AccMap ( )
private

Definition at line 12 of file AccMap.cxx.

12 {
13 // Fold ranges for the 10 electronic regions
14 static constexpr std::array<int, 10> i1 = {0, 0, 3, 2, 9, 12, 10, 9, 0, 2};
15 static constexpr std::array<int, 10> i2 = {2, 1, 12, 12, 13, 13, 13, 13, 1, 4};
16 static constexpr double xnorm = 14.1591;
17
18#ifndef LARG4_STAND_ALONE
19 const std::string larLocation = PathResolver::find_directory("LArG4Barrel", "ATLASCALDATA");
20#endif
21
22 for (int iregion = 0; iregion < MAX_REGIONS; ++iregion) {
23
24 // 1. Process Accordion Folds
25 for (int ifold = i1[iregion]; ifold <= i2[iregion]; ++ifold) {
26 // Using std::format for cleaner filename generation
27 std::string filename = std::format("fold{}_region{}.map", ifold, iregion);
28
29 std::string fileLocation =
30#ifdef LARG4_STAND_ALONE
31 std::format("{}/{}", m_directory, filename);
32#else
33 std::format("{}/{}", larLocation, filename);
34#endif
35
36 auto cm = std::make_unique<CurrMap>(fileLocation, xnorm);
37
38 // Add rounding safety for primary folds
39 if (ifold < N_MAX_VEC) {
40 m_xmin[ifold] = cm->GetXmin() + 0.1f;
41 m_xmax[ifold] = cm->GetXmax() - 0.1f;
42 m_ymin[ifold] = cm->GetYmin() + 0.1f;
43 m_ymax[ifold] = cm->GetYmax() - 0.1f;
44 }
45 m_fastMap[ifold][iregion] = std::move(cm);
46 }
47
48 // 2. Process Straight Sections
49 for (int istr = 1; istr <= 2; ++istr) {
50 int ifold = 20 + istr; // Mapping istr 1,2 to index 21,22
51
52 std::string filename = std::format("straight{}_region{}.map", istr, iregion);
53
54 std::string fileLocation =
55#ifdef LARG4_STAND_ALONE
56 std::format("{}/{}", m_directory, filename);
57#else
58 std::format("{}/{}", larLocation, filename);
59#endif
60 m_fastMap[ifold][iregion] = std::make_unique<CurrMap>(fileLocation, xnorm);
61 }
62 }
63}
static constexpr int N_MAX_VEC
Definition AccMap.h:21
std::array< float, N_MAX_VEC > m_ymin
Definition AccMap.h:35
std::array< float, N_MAX_VEC > m_ymax
Definition AccMap.h:36
std::array< float, N_MAX_VEC > m_xmax
Definition AccMap.h:34
static constexpr int MAX_REGIONS
Definition AccMap.h:20
std::array< std::array< std::unique_ptr< CurrMap >, MAX_REGIONS >, MAX_FOLDS > m_fastMap
Definition AccMap.h:32
std::array< float, N_MAX_VEC > m_xmin
Definition AccMap.h:33
static std::string find_directory(const std::string &logical_file_name, const std::string &search_path)

Member Function Documentation

◆ GetAccMap()

const AccMap * AccMap::GetAccMap ( )
static

Definition at line 65 of file AccMap.cxx.

66{
67 static const AccMap instance;
68 return &instance;
69}
std::map< std::string, double > instance
AccMap()
Definition AccMap.cxx:12

◆ GetMap() [1/2]

const CurrMap * AccMap::GetMap ( int ifold,
int ielecregion ) const
noexcept

Definition at line 76 of file AccMap.cxx.

76 {
77 // Direct O(1) lookup with bounds safety
78 if (ifold >= 0 && ifold < MAX_FOLDS && ielecregion >= 0 && ielecregion < MAX_REGIONS) {
79 return m_fastMap[ifold][ielecregion].get();
80 }
81 std::cout << "Fold " << ifold << " Region " << ielecregion << " out of bounds." << std::endl;
82 return nullptr;
83}

◆ GetMap() [2/2]

const CurrMap * AccMap::GetMap ( int ifold,
int region,
int sampling,
int eta ) const
noexcept

Definition at line 71 of file AccMap.cxx.

72{
73 return this->GetMap(ifold,this->Region(region,sampling,eta));
74}
Scalar eta() const
pseudorapidity method
const CurrMap * GetMap(int ifold, int ielecregion) const noexcept
Definition AccMap.cxx:76

◆ GetXmax()

float AccMap::GetXmax ( int ifold) const
inline

Definition at line 27 of file AccMap.h.

27{ return (ifold >= 0 && ifold < N_MAX_VEC) ? m_xmax[ifold] : -999.0f; }

◆ GetXmin()

float AccMap::GetXmin ( int ifold) const
inline

Definition at line 26 of file AccMap.h.

26{ return (ifold >= 0 && ifold < N_MAX_VEC) ? m_xmin[ifold] : -999.0f; }

◆ GetYmax()

float AccMap::GetYmax ( int ifold) const
inline

Definition at line 29 of file AccMap.h.

29{ return (ifold >= 0 && ifold < N_MAX_VEC) ? m_ymax[ifold] : -999.0f; }

◆ GetYmin()

float AccMap::GetYmin ( int ifold) const
inline

Definition at line 28 of file AccMap.h.

28{ return (ifold >= 0 && ifold < N_MAX_VEC) ? m_ymin[ifold] : -999.0f; }

◆ Region()

int AccMap::Region ( int region,
int sampling,
int eta ) const
noexcept

Definition at line 85 of file AccMap.cxx.

86{
87 int elecregion=0;
88 // logic to compute region vs eta and sampling...
89 if (region==0) {
90 if (sampling==1) {
91 if (eta<256) elecregion=0;
92 else elecregion=1;
93 }
94 else if (sampling==2) {
95 if (eta<32) elecregion=2;
96 else elecregion=3;
97 }
98 else {
99 if (eta<9 || eta==26) elecregion=4;
100 if ((eta>8 && eta<13) || (eta>15 && eta<19)) elecregion=5;
101 if ((eta>12 && eta < 16) || (eta>18 && eta<21)) elecregion=6;
102 if ((eta>20 && eta < 26)) elecregion=7;
103 }
104 }
105 else {
106 if (sampling==1) elecregion=8;
107 else elecregion=9;
108 }
109 return elecregion;
110}

Member Data Documentation

◆ m_fastMap

std::array<std::array<std::unique_ptr<CurrMap>, MAX_REGIONS>, MAX_FOLDS> AccMap::m_fastMap
private

Definition at line 32 of file AccMap.h.

◆ m_xmax

std::array<float, N_MAX_VEC> AccMap::m_xmax {}
private

Definition at line 34 of file AccMap.h.

34{};

◆ m_xmin

std::array<float, N_MAX_VEC> AccMap::m_xmin {}
private

Definition at line 33 of file AccMap.h.

33{};

◆ m_ymax

std::array<float, N_MAX_VEC> AccMap::m_ymax {}
private

Definition at line 36 of file AccMap.h.

36{};

◆ m_ymin

std::array<float, N_MAX_VEC> AccMap::m_ymin {}
private

Definition at line 35 of file AccMap.h.

35{};

◆ MAX_FOLDS

int AccMap::MAX_FOLDS = 23
staticconstexpr

Definition at line 19 of file AccMap.h.

◆ MAX_REGIONS

int AccMap::MAX_REGIONS = 10
staticconstexpr

Definition at line 20 of file AccMap.h.

◆ N_MAX_VEC

int AccMap::N_MAX_VEC = 14
staticconstexpr

Definition at line 21 of file AccMap.h.


The documentation for this class was generated from the following files: