10 #include "UCTRegion.hh" 12 #include "UCTGeometry.hh" 13 #include "UCTLogging.hh" 15 #include "UCTTower.hh" 29 bool vetoBit(bitset<4> etaPattern, bitset<4> phiPattern) {
30 bitset<4> badPattern5(
string(
"0101"));
31 bitset<4> badPattern7(
string(
"0111"));
32 bitset<4> badPattern9(
string(
"1001"));
33 bitset<4> badPattern10(
string(
"1010"));
34 bitset<4> badPattern11(
string(
"1011"));
35 bitset<4> badPattern13(
string(
"1101"));
36 bitset<4> badPattern14(
string(
"1110"));
37 bitset<4> badPattern15(
string(
"1111"));
41 if (etaPattern != badPattern5 && etaPattern != badPattern7 && etaPattern != badPattern10 &&
42 etaPattern != badPattern11 && etaPattern != badPattern13 && etaPattern != badPattern14 &&
43 etaPattern != badPattern15 && phiPattern != badPattern5 &&
45 phiPattern != badPattern10 && phiPattern != badPattern11 && phiPattern != badPattern13 &&
47 etaPattern != badPattern9 && phiPattern != badPattern9) {
54 uint32_t etSum =
et[0] +
et[1] +
et[2] +
et[3];
55 uint32_t iEtSum = (
et[0] >> 1) +
56 (
et[1] >> 1) +
et[1] +
57 (
et[2] >> 1) + (
et[2] << 1) +
58 (
et[3] << 2) - (
et[3] >> 1);
59 uint32_t iAve = 0xDEADBEEF;
62 else if (iEtSum <= (etSum << 1))
64 else if (iEtSum <= (etSum + (etSum << 1)))
71 UCTRegion::UCTRegion(
const UCTRegion& otherRegion)
73 card(otherRegion.card),
76 regionSummary(otherRegion.regionSummary),
79 UCTRegion::UCTRegion(uint32_t crt, uint32_t crd,
bool ne, uint32_t rgn,
int fwv)
86 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
92 const std::shared_ptr<UCTTower> UCTRegion::getTower(uint32_t caloEta, uint32_t caloPhi)
const {
95 uint32_t
iEta =
g.getiEta(caloEta);
96 uint32_t iPhi =
g.getiPhi(caloPhi);
108 uint32_t regionET = 0;
109 uint32_t regionEcalET = 0;
110 for (uint32_t twr = 0; twr <
towers.size(); twr++) {
112 LOG_ERROR <<
"Tower level processing failed. Bailing out :(" << std::endl;
115 regionET +=
towers[twr]->et();
117 regionEcalET +=
towers[twr]->getEcalET();
119 if (regionET > RegionETMask) {
122 regionET = RegionETMask;
124 regionSummary = (RegionETMask & regionET);
125 if (regionEcalET > RegionETMask)
126 regionEcalET = RegionETMask;
130 if (
region < NRegionsInCard) {
135 uint32_t activeTowerET = 0;
136 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
139 if (towerET > activityLevel) {
140 activeTower[
iEta][iPhi] =
true;
143 activeTower[
iEta][iPhi] =
false;
146 if (activeTowerET > RegionETMask)
147 activeTowerET = RegionETMask;
149 uint32_t sumETIEta[4] = {0, 0, 0, 0};
151 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
153 sumETIEta[
iEta] += towerET;
157 uint32_t sumETIPhi[4] = {0, 0, 0, 0};
158 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
161 sumETIPhi[iPhi] += towerET;
165 uint32_t hitTowerLocation = hitIEta *
nPhi + hitIPhi;
167 bitset<4> activeTowerEtaPattern = 0;
169 bool activeStrip =
false;
170 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
171 if (activeTower[
iEta][iPhi])
175 activeTowerEtaPattern |= (0x1 <<
iEta);
177 bitset<4> activeTowerPhiPattern = 0;
178 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
179 bool activeStrip =
false;
181 if (activeTower[
iEta][iPhi])
185 activeTowerPhiPattern |= (0x1 << iPhi);
188 bool veto =
vetoBit(activeTowerEtaPattern, activeTowerPhiPattern);
193 if ((regionET - regionEcalET) > maxMiscActivityLevelForEG)
195 if ((regionET - activeTowerET) > maxMiscActivityLevelForTau)
199 regionSummary |= RegionEGVeto;
201 regionSummary |= RegionTauVeto;
203 regionSummary |= (hitTowerLocation << LocationShift);
208 regionSummary |= NegEtaBit;
209 regionSummary |= (
region << RegionNoShift);
210 regionSummary |= (card << CardNoShift);
211 regionSummary |= (
crate << CrateNoShift);
217 bool UCTRegion::clearEvent() {
219 for (uint32_t
i = 0;
i <
towers.size();
i++) {
226 bool UCTRegion::setECALData(UCTTowerIndex
t,
bool ecalFG, uint32_t ecalET) {
229 uint32_t absCaloEta =
abs(
t.first);
230 uint32_t absCaloPhi =
abs(
t.second);
231 uint32_t
iEta =
g.getiEta(absCaloEta);
232 uint32_t iPhi =
g.getiPhi(absCaloPhi);
234 return tower->setECALData(ecalFG, ecalET);
237 bool UCTRegion::setHCALData(UCTTowerIndex
t, uint32_t hcalFB, uint32_t hcalET) {
240 uint32_t absCaloEta =
abs(
t.first);
241 uint32_t absCaloPhi =
abs(
t.second);
242 uint32_t
iEta =
g.getiEta(absCaloEta);
243 uint32_t iPhiStart =
g.getiPhi(absCaloPhi);
244 if (absCaloEta > 29 && absCaloEta < 40) {
247 for (uint32_t iPhi = iPhiStart; iPhi < iPhiStart + 2; iPhi++) {
250 if (!
tower->setHFData(hcalFB, hcalET))
253 }
else if (absCaloEta == 40 || absCaloEta == 41) {
256 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
259 if (!
tower->setHFData(hcalFB, hcalET))
263 uint32_t iPhi =
g.getiPhi(absCaloPhi);
265 return tower->setHCALData(hcalFB, hcalET);
270 bool UCTRegion::setRegionSummary(uint16_t regionData) {
272 regionSummary = regionData;
278 os <<
"UCTRegion Summary for negative eta " <<
r.region <<
" HitTower (eta, phi) = (" <<
std::dec <<
r.hitCaloEta()
279 <<
", " <<
r.hitCaloPhi() <<
")" 280 <<
" summary = " << std::hex <<
r.regionSummary << std::endl;
282 os <<
"UCTRegion Summary for positive eta " <<
r.region <<
" HitTower (eta, phi) = (" <<
std::dec <<
r.hitCaloEta()
283 <<
", " <<
r.hitCaloPhi() <<
")" 284 <<
" summary = " << std::hex <<
r.regionSummary << std::endl;
bool vetoBit(bitset< 4 > etaPattern, bitset< 4 > phiPattern)
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
const float miscActivityFraction
const float ecalActivityFraction
Abs< T >::type abs(const T &t)
std::ostream & operator<<(std::ostream &os, const UCTRegion &r)
const float activityFraction
uint32_t getHitTowerLocation(uint32_t *et)