ATLAS Offline Software
GTowerHelpers.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GTowerHelpers.h"
6 #include <algorithm>
7 #include <cctype>
8 
9 namespace LVL1
10 {
11  namespace gFEX
12  {
13 
15  FPGA getFPGA(float eta)
16  {
17  if (eta > -2.5 && eta <= 0)
18  return FPGA::A;
19  else if (eta > 0 && eta <= 2.5)
20  return FPGA::B;
21  else if (std::abs(eta) > 2.5)
22  return FPGA::C;
23  else
24  // Given the conditions above this should never trigger...
25  return FPGA::N_FPGAS;
26  }
27 
29  std::string FPGAToString(FPGA fpga)
30  {
31  switch (fpga)
32  {
33  case FPGA::A:
34  return "A";
35  case FPGA::B:
36  return "B";
37  case FPGA::C:
38  return "C";
39  default:
40  return "NOTANFPGA";
41  }
42  }
43 
45  FPGA FPGAFromString(std::string name)
46  {
47  // Convert the string to uppercase
48  std::transform(name.begin(), name.end(), name.begin(), toupper);
49  if (name == "A")
50  return FPGA::A;
51  else if (name == "B")
52  return FPGA::B;
53  else if (name == "C")
54  return FPGA::C;
55  else
56  return FPGA::N_FPGAS;
57  }
58 
59  float towerArea(float eta)
60  {
61  eta = std::abs(eta);
62  if (eta < 2.4)
63  return 1;
64  else if (eta < 2.5)
65  return 0.5;
66  else if (eta < 3.1)
67  return 1;
68  else
69  return 4;
70  }
71  } // namespace gFEX
72 } // namespace LVL1
73 
74 std::ostream &operator<<(std::ostream &os, LVL1::gFEX::FPGA fpga)
75 {
76  return os << LVL1::gFEX::FPGAToString(fpga);
77 }
LVL1::gFEX::towerArea
float towerArea(float eta)
Get the GCaloTower areas from their eta bins.
Definition: GTowerHelpers.cxx:59
LVL1::gFEX::getFPGA
FPGA getFPGA(float eta)
Get the FPGA code from the tower eta.
Definition: GTowerHelpers.cxx:15
LVL1::gFEX::FPGA::C
@ C
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
GTowerHelpers.h
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::gFEX::FPGA::B
@ B
FEXReprocessingRun3.gFEX
gFEX
Definition: FEXReprocessingRun3.py:288
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TrigConf::name
Definition: HLTChainList.h:35
LVL1::gFEX::FPGA::A
@ A
LVL1::gFEX::FPGAToString
std::string FPGAToString(FPGA fpga)
Get the name of an FPGA.
Definition: GTowerHelpers.cxx:29
LVL1::gFEX::FPGAFromString
FPGA FPGAFromString(std::string name)
Get the enum from the name of an FPGA. Returning N_FPGA means that the string wasn't correct.
Definition: GTowerHelpers.cxx:45
LVL1::gFEX::FPGA
FPGA
Definition: GTowerHelpers.h:17
LVL1::gFEX::FPGA::N_FPGAS
@ N_FPGAS
operator<<
std::ostream & operator<<(std::ostream &os, LVL1::gFEX::FPGA fpga)
Definition: GTowerHelpers.cxx:74