ATLAS Offline Software
Loading...
Searching...
No Matches
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
9namespace LVL1
10{
11 namespace gFEX
12 {
13
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
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
74std::ostream &operator<<(std::ostream &os, LVL1::gFEX::FPGA fpga)
75{
76 return os << LVL1::gFEX::FPGAToString(fpga);
77}
Scalar eta() const
pseudorapidity method
std::ostream & operator<<(std::ostream &os, LVL1::gFEX::FPGA fpga)
std::string FPGAToString(FPGA fpga)
Get the name of an FPGA.
float towerArea(float eta)
Get the GCaloTower areas from their eta bins.
FPGA getFPGA(float eta)
Get the FPGA code from the tower eta.
FPGA FPGAFromString(std::string name)
Get the enum from the name of an FPGA. Returning N_FPGA means that the string wasn't correct.
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...