Skip to content

Commit 2644bae

Browse files
committed
Please consider the following formatting changes
1 parent 453614b commit 2644bae

3 files changed

Lines changed: 48 additions & 47 deletions

File tree

DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellCompressed.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ class CellCompressed
6060
public:
6161
// constants
6262
static constexpr float TIME_SHIFT = 600.,
63-
TIME_RANGE = 1500.,
64-
TIME_RESOLUTION = TIME_RANGE / 2047.,
65-
ENERGY_BITS = static_cast<float>(0x3FFF),
66-
HGLGTRANSITION = o2::emcal::constants::EMCAL_HGLGTRANSITION * o2::emcal::constants::EMCAL_ADCENERGY,
67-
ENERGY_TRUNCATION = 250.,
68-
ENERGY_RESOLUTION_LG = (ENERGY_TRUNCATION - HGLGTRANSITION) / ENERGY_BITS,
69-
ENERGY_RESOLUTION_HG = HGLGTRANSITION / ENERGY_BITS,
70-
ENERGY_RESOLUTION_TRU = ENERGY_TRUNCATION / ENERGY_BITS,
71-
ENERGY_RESOLUTION_LEDMON = ENERGY_TRUNCATION / ENERGY_BITS,
72-
CHI2_TRUNCATION = 10.,
73-
CHI_2BITS = static_cast<float>(0x3F),
74-
CHI2_RESOLUTION = CHI2_TRUNCATION / CHI_2BITS,
75-
ENERGY_RESOLUTION_OLD = ENERGY_TRUNCATION / 16383.;
63+
TIME_RANGE = 1500.,
64+
TIME_RESOLUTION = TIME_RANGE / 2047.,
65+
ENERGY_BITS = static_cast<float>(0x3FFF),
66+
HGLGTRANSITION = o2::emcal::constants::EMCAL_HGLGTRANSITION * o2::emcal::constants::EMCAL_ADCENERGY,
67+
ENERGY_TRUNCATION = 250.,
68+
ENERGY_RESOLUTION_LG = (ENERGY_TRUNCATION - HGLGTRANSITION) / ENERGY_BITS,
69+
ENERGY_RESOLUTION_HG = HGLGTRANSITION / ENERGY_BITS,
70+
ENERGY_RESOLUTION_TRU = ENERGY_TRUNCATION / ENERGY_BITS,
71+
ENERGY_RESOLUTION_LEDMON = ENERGY_TRUNCATION / ENERGY_BITS,
72+
CHI2_TRUNCATION = 10.,
73+
CHI_2BITS = static_cast<float>(0x3F),
74+
CHI2_RESOLUTION = CHI2_TRUNCATION / CHI_2BITS,
75+
ENERGY_RESOLUTION_OLD = ENERGY_TRUNCATION / 16383.;
7676
CellCompressed();
7777
CellCompressed(short tower, float energy, float time, ChannelType_t ctype = ChannelType_t::LOW_GAIN, float chi2 = 10.);
7878
~CellCompressed() = default; // override

DataFormats/Detectors/EMCAL/src/Cell.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Cell::Cell(short tower, float energy, float time, ChannelType_t type, float chi2
3333
mtime = time;
3434
mtype = type;
3535
mchi2 = chi2;
36-
3736
}
3837

3938
void Cell::setAll(short tower, float energy, float time, ChannelType_t type, float chi2)

Detectors/EMCAL/reconstruction/include/EMCALReconstruction/CTFCoder.h

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class CTFCoder : public o2::ctf::CTFCoderBase
4444
o2::ctf::CTFIOSize encode(VEC& buff, const gsl::span<const TriggerRecord>& trigData, const gsl::span<const CellCompressed>& cellData);
4545

4646
// repack energy old format -> new format
47-
template <typename T, typename U> T repackE(T packedE, U packedStatus);
47+
template <typename T, typename U>
48+
T repackE(T packedE, U packedStatus);
4849

4950
/// entropy decode data from buffer with CTF
5051
template <typename VTRG, typename VCELL>
@@ -136,35 +137,37 @@ o2::ctf::CTFIOSize CTFCoder::encode_impl(VEC& buff, const gsl::span<const Trigge
136137
}
137138

138139
// repack cell energy (needed for old version of CTF (subversion 1)
139-
template <typename T, typename U> T CTFCoder::repackE(T packedE, U packedStatus){
140-
T repackedE = packedE;
141-
double energyTmp = packedE * CellCompressed::ENERGY_RESOLUTION_OLD;
142-
double truncatedEnergyTmp = energyTmp;
143-
if (truncatedEnergyTmp < 0.) {
144-
truncatedEnergyTmp = 0.;
145-
} else if (truncatedEnergyTmp > CellCompressed::ENERGY_TRUNCATION) {
146-
truncatedEnergyTmp = CellCompressed::ENERGY_TRUNCATION;
140+
template <typename T, typename U>
141+
T CTFCoder::repackE(T packedE, U packedStatus)
142+
{
143+
T repackedE = packedE;
144+
double energyTmp = packedE * CellCompressed::ENERGY_RESOLUTION_OLD;
145+
double truncatedEnergyTmp = energyTmp;
146+
if (truncatedEnergyTmp < 0.) {
147+
truncatedEnergyTmp = 0.;
148+
} else if (truncatedEnergyTmp > CellCompressed::ENERGY_TRUNCATION) {
149+
truncatedEnergyTmp = CellCompressed::ENERGY_TRUNCATION;
150+
}
151+
switch (static_cast<o2::emcal::ChannelType_t>(packedStatus)) {
152+
case o2::emcal::ChannelType_t::HIGH_GAIN: {
153+
repackedE = static_cast<T>(std::round(truncatedEnergyTmp / CellCompressed::ENERGY_RESOLUTION_HG));
154+
break;
147155
}
148-
switch (static_cast<o2::emcal::ChannelType_t>(packedStatus)) {
149-
case o2::emcal::ChannelType_t::HIGH_GAIN: {
150-
repackedE = static_cast<T>(std::round(truncatedEnergyTmp / CellCompressed::ENERGY_RESOLUTION_HG));
151-
break;
152-
}
153-
case o2::emcal::ChannelType_t::LOW_GAIN: {
154-
repackedE = static_cast<T>(std::round(truncatedEnergyTmp / CellCompressed::ENERGY_RESOLUTION_LG));
155-
break;
156-
}
157-
case o2::emcal::ChannelType_t::TRU: {
158-
repackedE = static_cast<T>(std::round(truncatedEnergyTmp / CellCompressed::ENERGY_RESOLUTION_TRU));
159-
break;
160-
}
161-
case o2::emcal::ChannelType_t::LEDMON: {
162-
repackedE = static_cast<T>(std::round(truncatedEnergyTmp / CellCompressed::ENERGY_RESOLUTION_LEDMON));
163-
break;
164-
}
156+
case o2::emcal::ChannelType_t::LOW_GAIN: {
157+
repackedE = static_cast<T>(std::round(truncatedEnergyTmp / CellCompressed::ENERGY_RESOLUTION_LG));
158+
break;
159+
}
160+
case o2::emcal::ChannelType_t::TRU: {
161+
repackedE = static_cast<T>(std::round(truncatedEnergyTmp / CellCompressed::ENERGY_RESOLUTION_TRU));
162+
break;
163+
}
164+
case o2::emcal::ChannelType_t::LEDMON: {
165+
repackedE = static_cast<T>(std::round(truncatedEnergyTmp / CellCompressed::ENERGY_RESOLUTION_LEDMON));
166+
break;
165167
}
166-
return repackedE;
167-
}
168+
}
169+
return repackedE;
170+
}
168171

169172
/// decode entropy-encoded clusters to standard compact clusters
170173
template <typename VTRG, typename VCELL>
@@ -227,13 +230,12 @@ o2::ctf::CTFIOSize CTFCoder::decode(const CTF::base& ec, VTRG& trigVec, VCELL& c
227230

228231
firstEntry = cellVec.size();
229232

230-
231233
for (uint16_t ic = 0; ic < entries[itrig]; ic++) {
232234
// if old verion of CTF, do conversion to energy and then repack before setting packed content
233-
if(isVersion1){
234-
packedEnergy = repackE(energy[cellCount],status[cellCount]);
235-
} else{ // new CTFs don't require any repacking
236-
packedEnergy = energy[cellCount];
235+
if (isVersion1) {
236+
packedEnergy = repackE(energy[cellCount], status[cellCount]);
237+
} else { // new CTFs don't require any repacking
238+
packedEnergy = energy[cellCount];
237239
}
238240
cellCompressed.setPacked(tower[cellCount], cellTime[cellCount], packedEnergy, status[cellCount], chi2[cellCount]);
239241
cell.setAll(cellCompressed.getTower(), cellCompressed.getEnergy(), cellCompressed.getTimeStamp(), cellCompressed.getType(), cellCompressed.getChi2());

0 commit comments

Comments
 (0)