Skip to content

Commit

Permalink
applying patches from code checks and code format
Browse files Browse the repository at this point in the history
  • Loading branch information
gk199 authored and rekovic committed Oct 29, 2021
1 parent 2c8e555 commit 4a3e72e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
34 changes: 19 additions & 15 deletions CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) {

unsigned int mipMax = 0;
unsigned int mipMin = 0;
unsigned int bit12_energy = 0; // defaults for energy requirement for bits 12-15 are high / low to avoid FG bit 0-4 being set when not intended
unsigned int bit12_energy =
0; // defaults for energy requirement for bits 12-15 are high / low to avoid FG bit 0-4 being set when not intended
unsigned int bit13_energy = 0;
unsigned int bit14_energy = 999;
unsigned int bit15_energy = 999;
Expand All @@ -405,10 +406,10 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) {
const HcalTPChannelParameter* channelParameters = conditions.getHcalTPChannelParameter(cell);
mipMax = channelParameters->getFGBitInfo() >> 16;
mipMin = channelParameters->getFGBitInfo() & 0xFFFF;
bit12_energy = 16; // depths 1,2 max energy
bit13_energy = 80; // depths 3+ min energy
bit14_energy = 64; // prompt min energy
bit15_energy = 64; // delayed min energy
bit12_energy = 16; // depths 1,2 max energy
bit13_energy = 80; // depths 3+ min energy
bit14_energy = 64; // prompt min energy
bit15_energy = 64; // delayed min energy
}

int lutId = getLUTId(cell);
Expand Down Expand Up @@ -520,17 +521,18 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) {
containmentCorrection / nominalgain_ / granularity)),
MASK);

unsigned int linearizedADC = lut[adc]; // used for bits 12, 13, 14, 15 for Group 0 LUT for LLP time and depth bits that rely on linearized energies
unsigned int linearizedADC =
lut[adc]; // used for bits 12, 13, 14, 15 for Group 0 LUT for LLP time and depth bits that rely on linearized energies

if (qieType == QIE11) {
if ((linearizedADC < bit12_energy and cell.depth() <= 2) or (cell.depth() >= 3))
lut[adc] |= 1 << 12;
if (linearizedADC >= bit13_energy and cell.depth() >= 3)
lut[adc] |= 1 << 13;
if (linearizedADC >= bit14_energy)
lut[adc] |= 1 << 14;
if (linearizedADC >= bit15_energy)
lut[adc] |= 1 << 15;
if ((linearizedADC < bit12_energy and cell.depth() <= 2) or (cell.depth() >= 3))
lut[adc] |= 1 << 12;
if (linearizedADC >= bit13_energy and cell.depth() >= 3)
lut[adc] |= 1 << 13;
if (linearizedADC >= bit14_energy)
lut[adc] |= 1 << 14;
if (linearizedADC >= bit15_energy)
lut[adc] |= 1 << 15;
if (adc >= mipMin and adc < mipMax)
lut[adc] |= QIE11_LUT_MSB0;
else if (adc >= mipMax)
Expand Down Expand Up @@ -596,8 +598,10 @@ std::vector<unsigned short> HcaluLUTTPGCoder::group0FGbits(const QIE11DataFrame&
int lutId = getLUTId(HcalDetId(df.id()));
const Lut& lut = inputLUT_.at(lutId);
std::vector<unsigned short> group0LLPbits;
group0LLPbits.reserve(df.samples());
for (int i = 0; i < df.samples(); i++) {
group0LLPbits.push_back((lut.at(df[i].adc()) >> 12) & 0xF); // four bits (12-15) of LUT used to set 6 finegrain bits from uHTR
group0LLPbits.push_back((lut.at(df[i].adc()) >> 12) &
0xF); // four bits (12-15) of LUT used to set 6 finegrain bits from uHTR
}
return group0LLPbits;
}
Expand Down
14 changes: 8 additions & 6 deletions SimCalorimetry/HcalTrigPrimAlgos/src/HcalFinegrainBit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ std::bitset<6> HcalFinegrainBit::compute(const HcalFinegrainBit::TowerTDC& tower

for (size_t i = 0; i < 7; i++) {
int bit12_15set = tower[i].first;
int bit12 = (bit12_15set & 0b0001); // low depth 1,2 energy
int bit13 = (bit12_15set & 0b0010) >> 1; // high depth 3+ energy
int bit14 = (bit12_15set & 0b0100) >> 2; // prompt energy passed
int bit15 = (bit12_15set & 0b1000) >> 3; // delayed energy passed
int bit12 = (bit12_15set & 0b0001); // low depth 1,2 energy
int bit13 = (bit12_15set & 0b0010) >> 1; // high depth 3+ energy
int bit14 = (bit12_15set & 0b0100) >> 2; // prompt energy passed
int bit15 = (bit12_15set & 0b1000) >> 3; // delayed energy passed
int TDC = tower[i].second.first;
int ADC = tower[i].second.second;

Expand Down Expand Up @@ -85,9 +85,11 @@ std::bitset<6> HcalFinegrainBit::compute(const HcalFinegrainBit::TowerTDC& tower

// depth bit
if (ADC > 0 && bit12 == 0)
EarlyEnergy += 1; // early layers, depth 1 and 2. If bit12 = 0, too much energy in early layers. Require ADC > 0 to ensure valid hit in cell
EarlyEnergy +=
1; // early layers, depth 1 and 2. If bit12 = 0, too much energy in early layers. Require ADC > 0 to ensure valid hit in cell
if (ADC > 0 && bit13 == 1)
DeepEnergy += 1; // deep layers, 3+. If bit13 = 1, energy in deep layers. Require ADC > 0 to ensure valid hit in cell
DeepEnergy +=
1; // deep layers, 3+. If bit13 = 1, energy in deep layers. Require ADC > 0 to ensure valid hit in cell
}

// very delayed (100000), slightly delayed (010000), prompt (001000), 2 reserved bits (000110), depth flag (000001)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,8 @@ void HcalTriggerPrimitiveAlgo::addUpgradeTDCFG(const HcalTrigTowerDetId& id, con
assert(ids.size() == 1 || ids.size() == 2);
IntegerCaloSamples samples1(ids[0], int(frame.samples()));
samples1.setPresamples(frame.presamples());
incoder_->adc2Linear(frame, samples1); // use linearization LUT
std::vector<unsigned short> bits12_15 = incoder_->group0FGbits(frame); // get 4 energy bits (12-15) from group 0 LUT
incoder_->adc2Linear(frame, samples1); // use linearization LUT
std::vector<unsigned short> bits12_15 = incoder_->group0FGbits(frame); // get 4 energy bits (12-15) from group 0 LUT

auto it = fgUpgradeTDCMap_.find(id);
if (it == fgUpgradeTDCMap_.end()) {
Expand Down

0 comments on commit 4a3e72e

Please sign in to comment.