75{
77
80
83 && (bsFlags & (1U << 26U)) == 0) {
84
87
88 const TileEMScale* emScale{nullptr};
90
92 SG::ReadCondHandle<TileEMScale> emScaleHandle(
m_emScaleKey, ctx);
94 emScale = emScaleHandle.cptr();
95
98 digitsContainer = allDigits.cptr();
99 }
100 }
101
102 const TileSampleNoise* sampleNoise = nullptr;
103 const TileSampleNoise* onlineSampleNoise = nullptr;
105 SG::ReadCondHandle<TileSampleNoise> sampleNoiseHandle(
m_sampleNoiseKey, ctx);
106 ATH_CHECK( sampleNoiseHandle.isValid() );
107 sampleNoise = sampleNoiseHandle.retrieve();
108
110 ATH_CHECK( onlineSampleNoiseHandle.isValid() );
111 onlineSampleNoise = onlineSampleNoiseHandle.retrieve();
112 }
113
114
116 TileRawChannelCollection* rawChannelCollection = rchCont.
indexFindPtr (hash);
117
118 int fragId = rawChannelCollection->
identify();
119 unsigned int drawer = (fragId & 0x3F);
120 unsigned int ros = fragId >> 8;
122
123 bool checkDigits(false);
125 if (digitsContainer) {
126 IdentifierHash fragHash = (digitsContainer->hashFunc())(fragId);
127 const TileDigitsCollection* digitsCollection = digitsContainer->indexFindPtr(fragHash);
130 checkDigits = true;
131 } else {
133 }
134
135 for (const TileDigits* tile_digits : *digitsCollection) {
138 }
139 }
140
141 for (TileRawChannel* rawChannel : *rawChannelCollection) {
142 HWIdentifier adcId = rawChannel->adc_HWID();
145
147
148 float pedestal = sampleNoise->
getPed(drawerIdx, channel, gain);
149 float onlinePedestal = onlineSampleNoise->
getPed(drawerIdx, channel, gain);
150 float onlinePedestalDifference = emScale->
calibrateOnlineChannel(drawerIdx, channel, gain, (onlinePedestal - pedestal), rawChannelUnit);
152 TileOfcWeightsStruct weights;
154 float weightsSum(0.0);
155 for (
int i = 0;
i < weights.
n_samples; ++
i) weightsSum += weights.
w_a[i];
156 float energyCorrection = onlinePedestalDifference * weightsSum;
158 << " ch" << channel << (gain ? " HG: " : " LG: ")
159 << "online pedestal difference: " << onlinePedestalDifference
160 << "; OFC weights (a) sum: " << weightsSum
161 << " => energy correction: " << energyCorrection);
162
163 rawChannel->setAmplitude(rawChannel->amplitude() + energyCorrection);
164
165 }
166
167 if (checkDigits && noDigits[channel]) {
168
170 float minimuAmplitudeThreshold(-99999.0);
171 float maximumAmplitudeThreshold(99999.0);
172 m_tileDspThreshold->getAmplitudeThresholds(drawerIdx, channel, gain, minimuAmplitudeThreshold, maximumAmplitudeThreshold);
173 if (amplitude < minimuAmplitudeThreshold
174 || amplitude > maximumAmplitudeThreshold)
175 {
176
178 << " ch" << channel << (gain ? " HG:" : " LG:")
179 << " amplitude: " << amplitude << " [ADC]"
180 << " outside range: " << minimuAmplitudeThreshold << ".." << maximumAmplitudeThreshold
181 << " without digits => set apmlitude/time/quality: 0.0/0.0/15.0");
182
183 rawChannel->insert(0.0F, 0.0F, 15.0F);
184
185 }
186
187 }
188
189 }
190 }
191
192 }
193
194 return StatusCode::SUCCESS;
195}
#define ATH_MSG_VERBOSE(x)
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current TileDigitsContainer
virtual std::vector< IdentifierHash > GetAllCurrentHashes() const override final
Returns a collection of all hashes availiable in this IDC.
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
static const unsigned int MAX_CHAN
Number of channels in drawer.
uint32_t getFragBCID() const
Get BCID.
float undoOnlineChannelCalibration(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude, TileRawChannelUnit::UNIT onlUnit) const
Undo the calibration applied in ROD signal reconstruction.
float calibrateOnlineChannel(unsigned int drawerIdx, unsigned int channel, unsigned int adc, float amplitude, TileRawChannelUnit::UNIT onlUnit) const
Calibrate an online Tile channel from OnlineADCcounts to an arbitrary Online unit,...
Collection * indexFindPtr(IdentifierHash hash)
Look up a (non-const) collection via hash.
uint32_t get_bsflags() const
float getPed(unsigned int drawerIdx, unsigned int channel, unsigned int adc) const