ATLAS Offline Software
Loading...
Searching...
No Matches
eFEXFormTOBs.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5//***************************************************************************
6// eFEXFormTOBs
7// -------------------
8// begin : 30 04 2021
9// email : nicholas.andrew.luongo@cern.ch
10// ***************************************************************************/
11
12#include "eFEXFormTOBs.h"
13
14namespace LVL1 {
15
16 // default constructor for persistency
17
18eFEXFormTOBs::eFEXFormTOBs(const std::string& type, const std::string& name, const IInterface* parent):
19 AthAlgTool(type, name, parent)
20 {
21 declareInterface<eFEXFormTOBs>(this);
22 }
23
28
30{
31 return StatusCode::SUCCESS;
32}
33
34uint32_t eFEXFormTOBs::formTauTOBWord(int fpga, int eta, int phi, unsigned int et, unsigned int rhad, unsigned int rcore, unsigned int seed, unsigned int und, unsigned int ptMinTopo, unsigned int algoVersion) const
35{
36 uint32_t tobWord = 0;
37
38 if(algoVersion>0) {
39 und = 0; // no und bit in BDT TOBs
40 }
41
42 //rescale from eFEX scale (25 MeV) to TOB scale (100 MeV)
43 // Do this using a bit shift to keep this 100% integer
44 unsigned int etTob = (et>>m_tobETshift);
45
46 // If ET < minimum value return empty TOB
47 if (etTob < ptMinTopo) return tobWord;
48
49 // Truncate at 12 bits, set to max value of 4095, 0xfff, or 111111111111
50 if (etTob > 0xfff) etTob = 0xfff;
51
52 // Create tob word with et, eta, phi, and fpga index, bitshifted to the appropriate locations
53 tobWord = (fpga << m_fpgaShift) + (eta << m_etaShift) + (phi << m_phiShift) + (rhad << m_taurhadShift) + (rcore << m_taurcoreShift) + (seed << m_seedShift) + (und << m_undShift) + (0x1 << m_seedMaxShift) + etTob + (algoVersion << m_algoVersionShift);
54
55 if(algoVersion==0) {
56 ATH_MSG_DEBUG("Tau tobword: " << std::bitset<32>(tobWord));
57 } else {
58 ATH_MSG_DEBUG("Tau BDT tobword: " << std::bitset<32>(tobWord) );
59 }
60
61 return tobWord;
62}
63
64std::vector<uint32_t> eFEXFormTOBs::formTauxTOBWords(int efexid, int fpga, int eta, int phi, unsigned int et, unsigned int rhad, unsigned int rcore, unsigned int seed, unsigned int und, unsigned int ptMinTopo, unsigned int algoVersion, unsigned int bdtScore) const
65{
66 std::vector<uint32_t> tobWords = {0, 0};
67
68 // If ET < minimum return empty xTOB. Threshold is at TOB scale, so rescale ET before applying
69 if ((et >> m_tobETshift) < ptMinTopo) return tobWords;
70
71 if(algoVersion>0) {
72 und = 0; // no und bit in BDT xTOBs
73 }
74
75 // Truncate ET at 16 bits, set to max value of 0xffff
76 unsigned int etTob = (et < 0xffff ? et : 0xffff);
77
78 // Calculate shelf and eFEX numbers from the efex index
79 uint8_t shelf = int(efexid/12);
80 uint8_t efex = efexid%12;
81
82 // Create tob word 0 with eta, phi, and fpga index, bitshifted to the appropriate locations
83 tobWords[0] = (fpga << m_fpgaShift) + (eta << m_etaShift) + (phi << m_phiShift) + (rhad << m_taurhadShift) + (rcore << m_taurcoreShift) + (seed << m_seedShift) + (und << m_undShift) + (0x1 << m_seedMaxShift) + (algoVersion << m_algoVersionShift);
84
85 // Create tob word 1 with et, efex and shelf indices, bitshifted to the appropriate locations
86 tobWords[1] = (shelf << m_shelfShift) + (efex << m_efexShift) + etTob;
87
88 if (algoVersion == 0) {
89 ATH_MSG_DEBUG("Tau xtobwords: " << std::bitset<32>(tobWords[0]) << ", " << std::bitset<32>(tobWords[1]));
90 } else {
91 tobWords[0] += bdtScore; // put score in the LSBs of xtob word0
92 ATH_MSG_DEBUG("Tau BDT xtobwords: " << std::bitset<32>(tobWords[0]) << ", " << std::bitset<32>(tobWords[1]));
93 }
94
95 return tobWords;
96}
97
98
99uint32_t eFEXFormTOBs::formEmTOBWord(int fpga, int eta, int phi, unsigned int rhad, unsigned int wstot, unsigned int reta, unsigned int seed, unsigned int und, unsigned int et, unsigned int ptMinTopo, unsigned int algoVersion) const
100{
101 uint32_t tobWord = 0;
102
103 // rescale from eFEX scale (25 MeV) to TOB scale (100 MeV)
104 // Do this using a bit shift to keep this 100% integer
105 unsigned int etTob = (et>>m_tobETshift);
106
107 // If ET < minimum value return empty TOB
108 if (etTob < ptMinTopo) return tobWord;
109
110 // Truncate at 12 bits, set to max value of 4095, 0xfff, or 111111111111
111 if (etTob > 0xfff) etTob = 0xfff;
112
113 // Create bare minimum tob word with et, eta, phi, and fpga index, bitshifted to the appropriate locations
114 tobWord = (fpga << m_fpgaShift) + (eta << m_etaShift) + (phi << m_phiShift) + (rhad << m_rhadShift) + (wstot << m_wstotShift) + (reta << m_retaShift) + (seed << m_seedShift) + (und << m_undShift) + (0x1 << m_seedMaxShift) + etTob + (algoVersion << m_algoVersionShift);
115
116 ATH_MSG_DEBUG("EM tobword: " << std::bitset<32>(tobWord) );
117
118 return tobWord;
119}
120
121
122std::vector<uint32_t> eFEXFormTOBs::formEmxTOBWords(int efexid, int fpga, int eta, int phi, unsigned int rhad, unsigned int wstot, unsigned int reta, unsigned int seed, unsigned int und, unsigned int et, unsigned int ptMinTopo, unsigned int algoVersion) const
123{
124 std::vector<uint32_t> tobWords = {0, 0};
125
126 // If ET < minimum return empty xTOB. Threshold is at TOB scale, so rescale ET before applying
127 if ((et >> m_tobETshift) < ptMinTopo) return tobWords;
128
129 // Truncate ET at 16 bits, set to max value of 0xffff
130 unsigned int etTob = (et < 0xffff ? et : 0xffff);
131
132 // Calculate shelf and eFEX numbers from the efex index
133 uint8_t shelf = int(efexid/12);
134 uint8_t efex = efexid%12;
135
136 // Create tob word 0 with eta, phi, and fpga index, bitshifted to the appropriate locations
137 tobWords[0] = (fpga << m_fpgaShift) + (eta << m_etaShift) + (phi << m_phiShift) + (rhad << m_rhadShift) + (wstot << m_wstotShift) + (reta << m_retaShift) + (seed << m_seedShift) + (und << m_undShift) + (0x1 << m_seedMaxShift) + (algoVersion << m_algoVersionShift);
138
139 // Create tob word 1 with et, efex and shelf indices, bitshifted to the appropriate locations
140 tobWords[1] = (shelf << m_shelfShift) + (efex << m_efexShift) + etTob;
141
142 ATH_MSG_DEBUG("EM xtobwords: " << std::bitset<32>(tobWords[0]) << ", " << std::bitset<32>(tobWords[1]));
143
144 return tobWords;
145}
146
147} // end of namespace bracket
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const unsigned int m_taurcoreShift
virtual uint32_t formEmTOBWord(int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const
const unsigned int m_seedShift
const unsigned int m_fpgaShift
virtual ~eFEXFormTOBs()
Destructor.
const unsigned int m_etaShift
const unsigned int m_shelfShift
const unsigned int m_wstotShift
const unsigned int m_efexShift
const unsigned int m_algoVersionShift
virtual std::vector< uint32_t > formTauxTOBWords(int, int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const
const unsigned int m_tobETshift
Internal data.
const unsigned int m_rhadShift
const unsigned int m_phiShift
eFEXFormTOBs(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
virtual uint32_t formTauTOBWord(int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const
const unsigned int m_taurhadShift
const unsigned int m_retaShift
const unsigned int m_undShift
virtual StatusCode initialize()
standard Athena-Algorithm method
const unsigned int m_seedMaxShift
virtual std::vector< uint32_t > formEmxTOBWords(int, int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Extra patterns decribing particle interation process.