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(uint32_t crt, uint32_t crd,
bool ne, uint32_t rgn,
int fwv)
78 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
84 UCTRegion::~UCTRegion() {
85 for (uint32_t
i = 0;
i <
towers.size();
i++) {
91 const UCTTower* UCTRegion::getTower(uint32_t caloEta, uint32_t caloPhi)
const {
94 uint32_t
iEta =
g.getiEta(caloEta);
95 uint32_t iPhi =
g.getiPhi(caloPhi);
107 uint32_t regionET = 0;
108 uint32_t regionEcalET = 0;
109 for (uint32_t twr = 0; twr <
towers.size(); twr++) {
111 LOG_ERROR <<
"Tower level processing failed. Bailing out :(" << std::endl;
114 regionET +=
towers[twr]->et();
116 regionEcalET +=
towers[twr]->getEcalET();
118 if (regionET > RegionETMask) {
121 regionET = RegionETMask;
123 regionSummary = (RegionETMask & regionET);
124 if (regionEcalET > RegionETMask)
125 regionEcalET = RegionETMask;
129 if (
region < NRegionsInCard) {
134 uint32_t activeTowerET = 0;
135 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
138 if (towerET > activityLevel) {
139 activeTower[
iEta][iPhi] =
true;
142 activeTower[
iEta][iPhi] =
false;
145 if (activeTowerET > RegionETMask)
146 activeTowerET = RegionETMask;
148 uint32_t sumETIEta[4] = {0, 0, 0, 0};
150 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
152 sumETIEta[
iEta] += towerET;
156 uint32_t sumETIPhi[4] = {0, 0, 0, 0};
157 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
160 sumETIPhi[iPhi] += towerET;
164 uint32_t hitTowerLocation = hitIEta *
nPhi + hitIPhi;
166 bitset<4> activeTowerEtaPattern = 0;
168 bool activeStrip =
false;
169 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
170 if (activeTower[
iEta][iPhi])
174 activeTowerEtaPattern |= (0x1 <<
iEta);
176 bitset<4> activeTowerPhiPattern = 0;
177 for (uint32_t iPhi = 0; iPhi <
nPhi; iPhi++) {
178 bool activeStrip =
false;
180 if (activeTower[
iEta][iPhi])
184 activeTowerPhiPattern |= (0x1 << iPhi);
187 bool veto =
vetoBit(activeTowerEtaPattern, activeTowerPhiPattern);
192 if ((regionET - regionEcalET) > maxMiscActivityLevelForEG)
194 if ((regionET - activeTowerET) > maxMiscActivityLevelForTau)
198 regionSummary |= RegionEGVeto;
200 regionSummary |= RegionTauVeto;
202 regionSummary |= (hitTowerLocation << LocationShift);
207 regionSummary |= NegEtaBit;
208 regionSummary |= (
region << RegionNoShift);
209 regionSummary |= (card << CardNoShift);
210 regionSummary |= (
crate << CrateNoShift);
216 bool UCTRegion::clearEvent() {
218 for (uint32_t
i = 0;
i <
towers.size();
i++) {
225 bool UCTRegion::setECALData(UCTTowerIndex
t,
bool ecalFG, uint32_t ecalET) {
228 uint32_t absCaloEta =
abs(
t.first);
229 uint32_t absCaloPhi =
abs(
t.second);
230 uint32_t
iEta =
g.getiEta(absCaloEta);
231 uint32_t iPhi =
g.getiPhi(absCaloPhi);
233 return tower->setECALData(ecalFG, ecalET);
236 bool UCTRegion::setHCALData(UCTTowerIndex
t, uint32_t hcalFB, uint32_t hcalET) {
239 uint32_t absCaloEta =
abs(
t.first);
240 uint32_t absCaloPhi =
abs(
t.second);
241 uint32_t
iEta =
g.getiEta(absCaloEta);
242 uint32_t iPhiStart =
g.getiPhi(absCaloPhi);
243 if (absCaloEta > 29 && absCaloEta < 40) {
246 for (uint32_t iPhi = iPhiStart; iPhi < iPhiStart + 2; iPhi++) {
249 if (!
tower->setHFData(hcalFB, hcalET))
252 }
else if (absCaloEta == 40 || absCaloEta == 41) {
255 for (uint32_t iPhi = 0; iPhi < 4; iPhi++) {
258 if (!
tower->setHFData(hcalFB, hcalET))
262 uint32_t iPhi =
g.getiPhi(absCaloPhi);
264 return tower->setHCALData(hcalFB, hcalET);
269 bool UCTRegion::setRegionSummary(uint16_t regionData) {
271 regionSummary = regionData;
277 os <<
"UCTRegion Summary for negative eta " <<
r.region <<
" HitTower (eta, phi) = (" <<
std::dec <<
r.hitCaloEta()
278 <<
", " <<
r.hitCaloPhi() <<
")" 279 <<
" summary = " << std::hex <<
r.regionSummary << std::endl;
281 os <<
"UCTRegion Summary for positive eta " <<
r.region <<
" HitTower (eta, phi) = (" <<
std::dec <<
r.hitCaloEta()
282 <<
", " <<
r.hitCaloPhi() <<
")" 283 <<
" 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)