10 #include "UCTLogging.hh" 15 if(region >= NRegionsInCard) {
16 return processHFTower();
18 if(ecalET > etInputMax) ecalET = etInputMax;
19 if(hcalET > etInputMax) hcalET = etInputMax;
20 uint32_t calibratedECALET = ecalET;
21 uint32_t logECALET = (uint32_t) log2((
double) ecalET);
22 if(logECALET > erMaxV) logECALET = erMaxV;
24 uint32_t etaAddress = region * NEtaInRegion + iEta;
25 uint32_t fbAddress = 0;
26 if(ecalFG) fbAddress = 1;
27 uint32_t
value = (*ecalLUT)[etaAddress][fbAddress][ecalET];
28 calibratedECALET = value & etInputMax;
29 logECALET = (value & 0x7000) >> 12;
31 uint32_t calibratedHCALET = hcalET;
32 uint32_t logHCALET = (uint32_t) log2((
double) hcalET);
33 if(logHCALET > erMaxV) logHCALET = erMaxV;
35 uint32_t etaAddress = region * NEtaInRegion + iEta;
36 uint32_t fbAddress = 0;
37 if((hcalFB & 0x1) != 0) fbAddress = 1;
38 uint32_t
value = (*hcalLUT)[etaAddress][fbAddress][hcalET];
39 calibratedHCALET = value & etInputMax;
40 logHCALET = (value & 0x7000) >> 12;
45 if(calibratedECALET==0xFF && calibratedHCALET==0xFF)
47 else if(calibratedECALET==0xFF)
49 else if(calibratedHCALET==0xFF)
52 towerData = calibratedECALET + calibratedHCALET;
54 towerData = calibratedECALET + calibratedHCALET;
57 if(towerData > etMask) towerData = etMask;
59 if(calibratedECALET == 0 || calibratedHCALET == 0) {
61 towerData |= zeroFlagMask;
62 if(calibratedHCALET == 0 && calibratedECALET != 0)
63 towerData |= eohrFlagMask;
65 else if(calibratedECALET == calibratedHCALET) {
67 towerData |= eohrFlagMask;
69 else if(calibratedECALET > calibratedHCALET) {
70 er = logECALET - logHCALET;
71 if(er > erMaxV) er = erMaxV;
72 towerData |= eohrFlagMask;
75 er = logHCALET - logECALET;
76 if(er > erMaxV) er = erMaxV;
78 towerData |= (er << erShift);
83 if((hcalFB & 0x1) != 0) towerData |= hcalFlagMask;
84 if(ecalFG) towerData |= ecalFlagMask;
86 towerData |= (calibratedECALET << ecalShift);
87 towerData |= (calibratedHCALET << hcalShift);
92 bool UCTTower::processHFTower() {
93 uint32_t calibratedET = hcalET;
95 uint32_t etaAddress = (region - NRegionsInCard) * NHFEtaInRegion + iEta;
96 const std::array< uint32_t, 256>
a = hfLUT->at(etaAddress);
97 calibratedET = a[hcalET] & 0xFF;
99 uint32_t absCaloEta =
abs(caloEta());
100 if(absCaloEta > 29 && absCaloEta < 40) {
104 else if(absCaloEta == 40 || absCaloEta == 41) {
108 towerData = calibratedET | zeroFlagMask;
109 if((hcalFB & 0x1) == 0x1) towerData |= ecalFlagMask;
110 if((hcalFB & 0x2) == 0x2) towerData |= hcalFlagMask;
114 bool UCTTower::setECALData(
bool eFG, uint32_t eET) {
117 if(eET > etInputMax) {
118 LOG_ERROR <<
"UCTTower::setData - ecalET too high " << eET <<
"; Pegged to etInputMax" << std::endl;
124 bool UCTTower::setHCALData(uint32_t hFB, uint32_t hET) {
127 if(hET > etInputMax) {
128 LOG_ERROR <<
"UCTTower::setData - hcalET too high " << hET <<
"; Pegged to etInputMax" << std::endl;
132 LOG_ERROR <<
"UCTTower::setData - too many hcalFeatureBits " << std::hex << hFB
133 <<
"; Used only bottom 6 bits" << std::endl;
139 bool UCTTower::setHFData(uint32_t fbIn, uint32_t etIn) {
144 if(etIn > etInputMax) {
145 LOG_ERROR <<
"UCTTower::setData - HF ET too high " << etIn <<
"; Pegged to etInputMax" << std::endl;
149 LOG_ERROR <<
"UCTTower::setData - too many HF FeatureBits " << std::hex << fbIn
150 <<
"; Used only bottom 2 bits" << std::endl;
156 const uint16_t UCTTower::location()
const {
158 if(negativeEta) l = 0x8000;
167 UCTTower::UCTTower(uint16_t location,
int fwv) :
169 if((location & 0x8000) != 0) negativeEta =
true;
170 crate = (location & 0x1800) >> 11;
171 card = (location & 0x0700) >> 8;
172 region = (location & 0x00F0) >> 4;
173 iEta = (location & 0x000C) >> 2;
174 iPhi = (location & 0x0003);
178 const uint64_t UCTTower::extendedData()
const {
188 os <<
"Side Crt Crd Rgn iEta iPhi cEta cPhi eET eFG hET hFB Summary" << std::endl;
192 if(t.negativeEta) side =
"-eta ";
194 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
196 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
198 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
200 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
202 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
204 << std::setw(4) << std::setfill(
' ') <<
std::dec 205 << g.getCaloEtaIndex(t.negativeEta, t.region, t.iEta) <<
" " 206 << std::setw(4) << std::setfill(
' ') <<
std::dec 207 << g.getCaloPhiIndex(t.crate, t.card, t.region, t.iPhi) <<
" " 208 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
210 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
212 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
214 << std::showbase << std::internal << std::setfill(
'0') << std::setw(4) << std::hex
216 << std::showbase << std::internal << std::setfill(
'0') << std::setw(10) << std::hex
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