10 #include "UCTLogging.hh" 15 if (
region >= NRegionsInCard) {
16 return processHFTower();
18 if (ecalET > etInputMax)
20 if (hcalET > etInputMax)
22 uint32_t calibratedECALET = ecalET;
23 uint32_t logECALET = (uint32_t)log2((
double)ecalET);
24 if (logECALET > erMaxV)
26 if (ecalLUT !=
nullptr) {
27 uint32_t etaAddress =
region * NEtaInRegion +
iEta;
28 uint32_t fbAddress = 0;
31 uint32_t
value = (*ecalLUT)[etaAddress][fbAddress][ecalET];
32 calibratedECALET =
value & etInputMax;
33 logECALET = (
value & 0x7000) >> 12;
35 uint32_t calibratedHCALET = hcalET;
36 uint32_t logHCALET = (uint32_t)log2((
double)hcalET);
37 if (logHCALET > erMaxV)
39 if (hcalLUT !=
nullptr) {
40 uint32_t etaAddress =
region * NEtaInRegion +
iEta;
41 uint32_t fbAddress = 0;
42 if ((hcalFB & 0
x1) != 0)
44 uint32_t
value = (*hcalLUT)[etaAddress][fbAddress][hcalET];
45 calibratedHCALET =
value & etInputMax;
46 logHCALET = (
value & 0x7000) >> 12;
51 if (calibratedECALET == 0xFF && calibratedHCALET == 0xFF)
53 else if (calibratedECALET == 0xFF)
55 else if (calibratedHCALET == 0xFF)
58 towerData = calibratedECALET + calibratedHCALET;
60 towerData = calibratedECALET + calibratedHCALET;
63 if (towerData > etMask)
66 if (calibratedECALET == 0 || calibratedHCALET == 0) {
68 towerData |= zeroFlagMask;
69 if (calibratedHCALET == 0 && calibratedECALET != 0)
70 towerData |= eohrFlagMask;
71 }
else if (calibratedECALET == calibratedHCALET) {
73 towerData |= eohrFlagMask;
74 }
else if (calibratedECALET > calibratedHCALET) {
75 er = logECALET - logHCALET;
78 towerData |= eohrFlagMask;
80 er = logHCALET - logECALET;
84 towerData |= (er << erShift);
89 if ((hcalFB & 0
x1) != 0)
90 towerData |= hcalFlagMask;
92 towerData |= ecalFlagMask;
94 towerData |= (calibratedECALET << ecalShift);
95 towerData |= (calibratedHCALET << hcalShift);
100 bool UCTTower::processHFTower() {
102 uint32_t calibratedET = hcalET;
103 if (hfLUT !=
nullptr) {
104 uint32_t etaAddress = (
region - NRegionsInCard) * NHFEtaInRegion +
iEta;
105 const std::array<uint32_t, 256>&
a = hfLUT->at(etaAddress);
106 calibratedET =
a[hcalET] & 0x1FF;
108 towerData = calibratedET | zeroFlagMask;
109 if ((hcalFB & 0
x1) == 0
x1)
110 towerData |= ecalFlagMask;
111 if ((hcalFB & 0
x2) == 0
x2)
112 towerData |= hcalFlagMask;
114 uint32_t calibratedET = hcalET;
115 if (hfLUT !=
nullptr) {
116 uint32_t etaAddress = (
region - NRegionsInCard) * NHFEtaInRegion +
iEta;
117 const std::array<uint32_t, 256>&
a = hfLUT->at(etaAddress);
118 calibratedET =
a[hcalET] & 0xFF;
120 uint32_t absCaloEta =
abs(caloEta());
121 if (absCaloEta > 29 && absCaloEta < 40) {
124 }
else if (absCaloEta == 40 || absCaloEta == 41) {
128 towerData = calibratedET | zeroFlagMask;
129 if ((hcalFB & 0
x1) == 0
x1)
130 towerData |= ecalFlagMask;
131 if ((hcalFB & 0
x2) == 0
x2)
132 towerData |= hcalFlagMask;
137 bool UCTTower::setECALData(
bool eFG, uint32_t eET) {
140 if (eET > etInputMax) {
141 LOG_ERROR <<
"UCTTower::setData - ecalET too high " << eET <<
"; Pegged to etInputMax" << std::endl;
147 bool UCTTower::setHCALData(uint32_t hFB, uint32_t hET) {
150 if (hET > etInputMax) {
151 LOG_ERROR <<
"UCTTower::setData - hcalET too high " << hET <<
"; Pegged to etInputMax" << std::endl;
155 LOG_ERROR <<
"UCTTower::setData - too many hcalFeatureBits " << std::hex << hFB <<
"; Used only bottom 6 bits" 162 bool UCTTower::setHFData(uint32_t fbIn, uint32_t etIn) {
167 if (etIn > etInputMax) {
168 LOG_ERROR <<
"UCTTower::setData - HF ET too high " << etIn <<
"; Pegged to etInputMax" << std::endl;
172 LOG_ERROR <<
"UCTTower::setData - too many HF FeatureBits " << std::hex << fbIn <<
"; Used only bottom 2 bits" 202 const uint64_t UCTTower::extendedData()
const {
212 os <<
"Side Crt Crd Rgn iEta iPhi cEta cPhi eET eFG hET hFB Summary" << std::endl;
218 os <<
side << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.crate <<
" " 219 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.card <<
" " 220 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.region <<
" " 221 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.iEta <<
" " 222 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.iPhi <<
" " << std::setw(4)
223 << std::setfill(
' ') <<
std::dec <<
g.getCaloEtaIndex(
t.negativeEta,
t.region,
t.iEta) <<
" " << std::setw(4)
224 << std::setfill(
' ') <<
std::dec <<
g.getCaloPhiIndex(
t.crate,
t.card,
t.region,
t.iPhi) <<
" " << std::showbase
225 << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.ecalET <<
" " << std::showbase
226 << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.ecalFG <<
" " << std::showbase
227 << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.hcalET <<
" " << std::showbase
228 << std::internal << std::setfill(
'0') << std::setw(4) << std::hex <<
t.hcalFB <<
" " << std::showbase
229 << std::internal << std::setfill(
'0') << std::setw(10) << std::hex <<
t.towerData << std::endl;
ALPAKA_FN_ACC int side(int ieta, int iphi)
location
10.6 INPUT and workflows
std::ostream & operator<<(std::ostream &os, const UCTTower &t)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Abs< T >::type abs(const T &t)
unsigned long long uint64_t