ATLAS Offline Software
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 
13 
14 namespace LVL1 {
15 
16  // default constructor for persistency
17 
18 eFEXFormTOBs::eFEXFormTOBs(const std::string& type, const std::string& name, const IInterface* parent):
20  {
21  declareInterface<IeFEXFormTOBs>(this);
22  }
23 
26 {
27 }
28 
30 {
31  return StatusCode::SUCCESS;
32 }
33 
34 uint32_t eFEXFormTOBs::doFormTauTOBWord(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  //rescale from eFEX scale (25 MeV) to TOB scale (100 MeV)
39  // Do this using a bit shift to keep this 100% integer
40  unsigned int etTob = (et>>m_tobETshift);
41 
42  // If ET < minimum value return empty TOB
43  if (etTob < ptMinTopo) return tobWord;
44 
45  // Truncate at 12 bits, set to max value of 4095, 0xfff, or 111111111111
46  if (etTob > 0xfff) etTob = 0xfff;
47 
48  // Create tob word with et, eta, phi, and fpga index, bitshifted to the appropriate locations
49  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_tauAlgoVersionShift);
50 
51  return tobWord;
52 }
53 
54 uint32_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) const
55 {
56  uint32_t tobWord = doFormTauTOBWord(fpga, eta, phi, et, rhad, rcore, seed, und, ptMinTopo, 0);
57  ATH_MSG_DEBUG("Tau tobword: " << std::bitset<32>(tobWord) );
58  return tobWord;
59 }
60 
61 uint32_t eFEXFormTOBs::formTauBDTTOBWord(int fpga, int eta, int phi, unsigned int et, unsigned int rhad, unsigned int bdtCondition, unsigned int bdtSeed, unsigned int ptMinTopo) const
62 {
63  uint32_t tobWord = doFormTauTOBWord(fpga, eta, phi, et, rhad, bdtCondition, bdtSeed, 0, ptMinTopo, 1);
64  ATH_MSG_DEBUG("Tau BDT tobword: " << std::bitset<32>(tobWord) );
65  return tobWord;
66 }
67 
68 std::vector<uint32_t> eFEXFormTOBs::doFormTauxTOBWords(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) const
69 {
70  std::vector<uint32_t> tobWords = {0, 0};
71 
72  // If ET < minimum return empty xTOB. Threshold is at TOB scale, so rescale ET before applying
73  if ((et >> m_tobETshift) < ptMinTopo) return tobWords;
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_tauAlgoVersionShift);
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  return tobWords;
89 }
90 
91 std::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) const
92 {
93  std::vector<uint32_t> tobWords = doFormTauxTOBWords(efexid, fpga, eta, phi, et, rhad, rcore, seed, und, ptMinTopo, 0);
94 
95  ATH_MSG_DEBUG("Tau xtobwords: " << std::bitset<32>(tobWords[0]) << ", " << std::bitset<32>(tobWords[1]));
96 
97  return tobWords;
98 }
99 
100 std::vector<uint32_t> eFEXFormTOBs::formTauBDTxTOBWords(int efexid, int fpga, int eta, int phi, unsigned int et, unsigned int rhad, unsigned int bdtCondition, unsigned int bdtSeed, unsigned int ptMinTopo, unsigned int bdtScore) const
101 {
102  std::vector<uint32_t> tobWords = doFormTauxTOBWords(efexid, fpga, eta, phi, et, rhad, bdtCondition, bdtSeed, 0, ptMinTopo, 1);
103  if ( (tobWords[0] > 0) or (tobWords[1] > 0) ) {
104  tobWords[0] += bdtScore;
105  }
106 
107  ATH_MSG_DEBUG("Tau BDT xtobwords: " << std::bitset<32>(tobWords[0]) << ", " << std::bitset<32>(tobWords[1]));
108 
109  return tobWords;
110 }
111 
112 uint32_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) const
113 {
114  uint32_t tobWord = 0;
115 
116  // rescale from eFEX scale (25 MeV) to TOB scale (100 MeV)
117  // Do this using a bit shift to keep this 100% integer
118  unsigned int etTob = (et>>m_tobETshift);
119 
120  // If ET < minimum value return empty TOB
121  if (etTob < ptMinTopo) return tobWord;
122 
123  // Truncate at 12 bits, set to max value of 4095, 0xfff, or 111111111111
124  if (etTob > 0xfff) etTob = 0xfff;
125 
126  // Create bare minimum tob word with et, eta, phi, and fpga index, bitshifted to the appropriate locations
127  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;
128 
129  ATH_MSG_DEBUG("EM tobword: " << std::bitset<32>(tobWord) );
130 
131  return tobWord;
132 }
133 
134 
135 std::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) const
136 {
137  std::vector<uint32_t> tobWords = {0, 0};
138 
139  // If ET < minimum return empty xTOB. Threshold is at TOB scale, so rescale ET before applying
140  if ((et >> m_tobETshift) < ptMinTopo) return tobWords;
141 
142  // Truncate ET at 16 bits, set to max value of 0xffff
143  unsigned int etTob = (et < 0xffff ? et : 0xffff);
144 
145  // Calculate shelf and eFEX numbers from the efex index
146  uint8_t shelf = int(efexid/12);
147  uint8_t efex = efexid%12;
148 
149  // Create tob word 0 with eta, phi, and fpga index, bitshifted to the appropriate locations
150  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);
151 
152  // Create tob word 1 with et, efex and shelf indices, bitshifted to the appropriate locations
153  tobWords[1] = (shelf << m_shelfShift) + (efex << m_efexShift) + etTob;
154 
155  ATH_MSG_DEBUG("EM xtobwords: " << std::bitset<32>(tobWords[0]) << ", " << std::bitset<32>(tobWords[1]));
156 
157  return tobWords;
158 }
159 
160 } // end of namespace bracket
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
LVL1::eFEXFormTOBs::m_seedShift
const unsigned int m_seedShift
Definition: eFEXFormTOBs.h:56
LVL1::eFEXFormTOBs::m_taurcoreShift
const unsigned int m_taurcoreShift
Definition: eFEXFormTOBs.h:62
et
Extra patterns decribing particle interation process.
LVL1::eFEXFormTOBs::m_shelfShift
const unsigned int m_shelfShift
Definition: eFEXFormTOBs.h:59
LVL1::eFEXFormTOBs::eFEXFormTOBs
eFEXFormTOBs(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
Definition: eFEXFormTOBs.cxx:18
LVL1::eFEXFormTOBs::m_taurhadShift
const unsigned int m_taurhadShift
Definition: eFEXFormTOBs.h:61
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
LVL1::eFEXFormTOBs::m_tobETshift
const unsigned int m_tobETshift
Internal data.
Definition: eFEXFormTOBs.h:49
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1::eFEXFormTOBs::formTauxTOBWords
virtual std::vector< uint32_t > formTauxTOBWords(int, int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:91
LVL1::eFEXFormTOBs::doFormTauTOBWord
uint32_t doFormTauTOBWord(int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const
Definition: eFEXFormTOBs.cxx:34
LVL1::eFEXFormTOBs::formEmxTOBWords
virtual std::vector< uint32_t > formEmxTOBWords(int, int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:135
LVL1::eFEXFormTOBs::m_undShift
const unsigned int m_undShift
Definition: eFEXFormTOBs.h:57
LVL1::eFEXFormTOBs::m_efexShift
const unsigned int m_efexShift
Definition: eFEXFormTOBs.h:60
xAOD::wstot
setEt setPhi setE277 setWeta2 setEta1 setE2tsts1 wstot
Definition: TrigEMCluster_v1.cxx:49
LVL1::eFEXFormTOBs::m_rhadShift
const unsigned int m_rhadShift
Definition: eFEXFormTOBs.h:53
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::eFEXFormTOBs::m_tauAlgoVersionShift
const unsigned int m_tauAlgoVersionShift
Definition: eFEXFormTOBs.h:63
LVL1::eFEXFormTOBs::m_phiShift
const unsigned int m_phiShift
Definition: eFEXFormTOBs.h:52
LVL1::eFEXFormTOBs::doFormTauxTOBWords
std::vector< uint32_t > doFormTauxTOBWords(int, int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const
Definition: eFEXFormTOBs.cxx:68
LVL1::eFEXFormTOBs::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: eFEXFormTOBs.cxx:29
LVL1::eFEXFormTOBs::formTauBDTxTOBWords
virtual std::vector< uint32_t > formTauBDTxTOBWords(int, int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:100
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LVL1::eFEXFormTOBs::formTauBDTTOBWord
virtual uint32_t formTauBDTTOBWord(int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:61
TrigConf::name
Definition: HLTChainList.h:35
LVL1::eFEXFormTOBs::~eFEXFormTOBs
virtual ~eFEXFormTOBs()
Destructor.
Definition: eFEXFormTOBs.cxx:25
LVL1::eFEXFormTOBs::m_fpgaShift
const unsigned int m_fpgaShift
Definition: eFEXFormTOBs.h:50
LVL1::eFEXFormTOBs::m_etaShift
const unsigned int m_etaShift
Definition: eFEXFormTOBs.h:51
LVL1::eFEXFormTOBs::formEmTOBWord
virtual uint32_t formEmTOBWord(int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:112
LVL1::eFEXFormTOBs::m_seedMaxShift
const unsigned int m_seedMaxShift
Definition: eFEXFormTOBs.h:58
xAOD::rcore
rcore
Definition: TrigPhoton_v1.cxx:79
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LVL1::eFEXFormTOBs::m_retaShift
const unsigned int m_retaShift
Definition: eFEXFormTOBs.h:55
AthAlgTool
Definition: AthAlgTool.h:26
eFEXFormTOBs.h
LVL1::eFEXFormTOBs::m_wstotShift
const unsigned int m_wstotShift
Definition: eFEXFormTOBs.h:54
LVL1::eFEXFormTOBs::formTauTOBWord
virtual uint32_t formTauTOBWord(int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:54