Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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::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 
64 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, 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 
99 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, 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 
122 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, 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
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
LVL1::eFEXFormTOBs::m_seedShift
const unsigned int m_seedShift
Definition: eFEXFormTOBs.h:51
LVL1::eFEXFormTOBs::m_taurcoreShift
const unsigned int m_taurcoreShift
Definition: eFEXFormTOBs.h:57
et
Extra patterns decribing particle interation process.
LVL1::eFEXFormTOBs::m_shelfShift
const unsigned int m_shelfShift
Definition: eFEXFormTOBs.h:54
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:56
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
LVL1::eFEXFormTOBs::m_tobETshift
const unsigned int m_tobETshift
Internal data.
Definition: eFEXFormTOBs.h:44
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
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, unsigned int) const override
Definition: eFEXFormTOBs.cxx:122
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1::eFEXFormTOBs::formEmTOBWord
virtual uint32_t formEmTOBWord(int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:99
LVL1::eFEXFormTOBs::m_undShift
const unsigned int m_undShift
Definition: eFEXFormTOBs.h:52
LVL1::eFEXFormTOBs::m_efexShift
const unsigned int m_efexShift
Definition: eFEXFormTOBs.h:55
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:48
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
LVL1::eFEXFormTOBs::m_phiShift
const unsigned int m_phiShift
Definition: eFEXFormTOBs.h:47
LVL1::eFEXFormTOBs::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: eFEXFormTOBs.cxx:29
LVL1::eFEXFormTOBs::formTauTOBWord
virtual uint32_t formTauTOBWord(int, int, int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:34
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
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
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, unsigned int, unsigned int) const override
Definition: eFEXFormTOBs.cxx:64
test_pyathena.parent
parent
Definition: test_pyathena.py:15
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:45
LVL1::eFEXFormTOBs::m_etaShift
const unsigned int m_etaShift
Definition: eFEXFormTOBs.h:46
LVL1::eFEXFormTOBs::m_seedMaxShift
const unsigned int m_seedMaxShift
Definition: eFEXFormTOBs.h:53
xAOD::rcore
rcore
Definition: TrigPhoton_v1.cxx:79
LVL1::eFEXFormTOBs::m_retaShift
const unsigned int m_retaShift
Definition: eFEXFormTOBs.h:50
AthAlgTool
Definition: AthAlgTool.h:26
eFEXFormTOBs.h
LVL1::eFEXFormTOBs::m_wstotShift
const unsigned int m_wstotShift
Definition: eFEXFormTOBs.h:49
LVL1::eFEXFormTOBs::m_algoVersionShift
const unsigned int m_algoVersionShift
Definition: eFEXFormTOBs.h:58