96 {
97
98 std::vector<float> thresholds;
99
101 ATH_MSG_VERBOSE(
"ATT: RUN1 settings TileMuonReceiverDecision will end now" );
102 return StatusCode::SUCCESS;
103 }
105 ATH_MSG_VERBOSE(
"ATT: RUN2 settings TileMuonReceiverDecsionTool will run now" );
107
112 }
114 ATH_MSG_VERBOSE(
"ATT: RUN3 settings TileMuonReceiverDecsionTool will run now" );
116
120 }
121
122 SG::ReadCondHandle<TileEMScale> emScale(
m_emScaleKey, ctx);
124
125
126
129
130
131
132 std::vector<bool> tile2SL(4,false);
133 std::vector<float> ene(2,0.0);
134 std::vector<float>
time(2,0.0);
135
136
137
139 ATH_CHECK( decisionContainer.record(std::make_unique<TileMuonReceiverContainer>()) );
140
141
142 std::unique_ptr<TileMuonReceiverObj> tileMuRcvObj = std::make_unique<TileMuonReceiverObj>(0,thresholds);
143 decisionContainer->push_back(tileMuRcvObj.release());
144
145
146
147#define nEBchan 6
148#define nLBchan 9
149#define maxCell 5
150
151 int EBchan[
nEBchan]={17,16,37,38,3,2};
152
153 int LBchan[
nLBchan]={0,13,14,25,24,41,44,39,40};
154
155 int EBIdCell[
nEBchan]={0,0,1,1,2,2};
156 int LBIdCell[
nLBchan]={0,1,1,2,2,3,3,4,4};
157
158 float energy_HLX[
maxCell]={0.,0.,0.,0.,0.};
159 float time_HLX[
maxCell]={0.,0.,0.,0.,0.};
160
161 int suppression_counter = 20;
162 bool suppress_printout = false;
163
164 for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
165
166 if (rawChannelCollection->empty()) continue;
167
168 float energy_d5 = 0.0;
169 float energy_d6 = 0.0;
170 float energy_d5d6 = 0.0;
171 float time_d6 = 0.0;
172 float time_d5d6 = 0.0;
173
174 int ich = 0;
175 int jch6 = 0;
176 int jch56 = 0;
177
178 int frag_id = rawChannelCollection->identify();
180 int ros = frag_id>>8;
183
184 if (
msgLvl(MSG::VERBOSE)) {
185 int drawer = (frag_id&0xFF);
186 memset(energy_HLX,0,sizeof(energy_HLX));
187 memset(time_HLX,0,sizeof(time_HLX));
188 ATH_MSG_VERBOSE(
"(E.0.0) Frag_id: 0x"<< MSG::hex << frag_id << MSG::dec <<
" ros: "<< ros <<
" drawer: "<< drawer );
189 }
190
191 for (const TileRawChannel* rawChannel : *rawChannelCollection) {
192
193 ++ich;
194
195 HWIdentifier adc_id = rawChannel->adc_HWID() ;
196
198 if ( TMDBchan >= upperLim ) {
199 if ( !suppress_printout ) {
200 if ( suppression_counter-- ) {
201 ATH_MSG_WARNING(
"(E.1."<< ich <<
") hwid: "<<
m_tileHWID->to_string(adc_id,-1) <<
" ch: "<< TMDBchan <<
" --> Tile ch: UNKNOWN" );
202 }
203 else {
204 ATH_MSG_WARNING(
"Too many HWID WARNINGS - suppressing further output - switch to debug mode to view them all" );
205 suppress_printout = true;
206 }
207 }
208 else {
209 ATH_MSG_DEBUG(
"(E.1."<< ich <<
") hwid: "<<
m_tileHWID->to_string(adc_id,-1) <<
" ch: "<< TMDBchan <<
" --> Tile ch: UNKNOWN" );
210 }
211 continue;
212 }
213
214 int TILEchan = (eb_ros) ? EBchan[TMDBchan] : LBchan[TMDBchan];
215
216 float ADC2MeV_factor = emScale->calibrateChannel(drawerIdx, TILEchan,
TileID::LOWGAIN, 1.
220
221 float energy = rawChannel->amplitude()*ADC2MeV_factor;
222 float time = rawChannel->time();
223
224 ATH_MSG_DEBUG(
"(E.1."<< ich <<
") hwid: "<<
m_tileHWID->to_string(adc_id,-1) <<
" ch: "<< TMDBchan <<
" --> Tile ch: "<< TILEchan );
225 ATH_MSG_DEBUG(
" E[ADC]: "<<rawChannel->amplitude()<<
" E[MeV]: "<<energy<<
" t[ns]: "<<time<<
" QF: "<<rawChannel->quality() );
226
227 if ( eb_ros ) {
228 if ( TMDBchan<4 ) {
231 ++jch56;
232
233 if ( TMDBchan==2 || TMDBchan==3 ) {
236 ++jch6;
237 }
238 if ( TMDBchan==0 || TMDBchan==1 ) {
240 }
241
242 }
243 if (
msgLvl(MSG::VERBOSE)) {
244 energy_HLX[EBIdCell[TMDBchan]] +=
energy;
245 time_HLX[EBIdCell[TMDBchan]] +=
time;
246 }
247 } else {
248 if (
msgLvl(MSG::VERBOSE)) {
249 energy_HLX[LBIdCell[TMDBchan]] +=
energy;
250 time_HLX[LBIdCell[TMDBchan]] +=
time;
251 }
252 }
253 }
254
255 if (
msgLvl(MSG::VERBOSE)) {
256 ATH_MSG_VERBOSE(
"(X.0.0) Summary of the extended results for HL-LHC: " );
257 if ( eb_ros ) {
258 ATH_MSG_VERBOSE(
"(X.1.0) Energy D-5 "<<energy_HLX[0]<<
" D-6 "<<energy_HLX[1]<<
" D-4 "<<energy_HLX[2] );
259 ATH_MSG_VERBOSE(
"(X.2.0) Time D-5 "<<time_HLX[0]/2.<<
" D-6 "<<time_HLX[1]/2.<<
" D-4 "<<time_HLX[2]/2. );
260 } else {
261 ATH_MSG_VERBOSE(
"(X.1.0) Energy D-0 "<<energy_HLX[0]<<
" D-1 "<<energy_HLX[1]<<
" D-2 "<<energy_HLX[2]<<
" D-3 "<<energy_HLX[3]<<
" BC-8 "<<energy_HLX[4] );
262 ATH_MSG_VERBOSE(
"(X.2.0) Time D-0 "<<time_HLX[0]<<
" D-1 "<<time_HLX[1]/2.<<
" D-2 "<<time_HLX[2]/2.<<
" D-3 "<<time_HLX[3]/2.<<
" BC-8 "<<time_HLX[4]/2. );
263 }
264 }
265
266 if (jch56 == 0) {
268 continue;
269 }
270
271 if (jch56>1) {
272 time_d5d6 /= jch56;
273 if (jch6>1) time_d6 /= jch6;
274 }
275
276
277
278
279
283
284
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303 if (
m_runPeriod == 2 ) tile2SL = { pass_d5d6_hi, (!pass_d5d6_hi && pass_d5d6_lo), pass_d6_hi, !pass_d6_hi && pass_d6_lo};
304 if (
m_runPeriod == 3 ) tile2SL = { 0, pass_d5d6, pass_d6, pass_d5};
305
306
307
308
309
310
311 if (
msgLvl(MSG::VERBOSE)) {
313 ATH_MSG_VERBOSE(
"(E.2.0) Summary: e(d5+d6)= " << energy_d5d6 <<
" e(d6)= " << energy_d6 );
315 ATH_MSG_VERBOSE(
"(E.4.0) Check which thresholds were passed: d56 high " << pass_d5d6_hi <<
" d56 low " << pass_d5d6_lo <<
" d6 high " << pass_d6_hi <<
" d6 low " << pass_d6_lo );
316 ATH_MSG_VERBOSE(
"(E.5.0) Output to SL: " << tile2SL[0] << tile2SL[1] << tile2SL[2] << tile2SL[3] );
317 }
319 ATH_MSG_VERBOSE(
"(E.2.0) Summary: e(d5+d6)= " << energy_d5d6 <<
" e(d6)= " << energy_d6 <<
" e(d5)= " << energy_d5 );
321 ATH_MSG_VERBOSE(
"(E.4.0) Check which thresholds were passed: d56 " << pass_d5d6 <<
" d6 " << pass_d6 <<
" d5 " << pass_d5 );
322 ATH_MSG_VERBOSE(
"(E.5.0) Output to SL: " << tile2SL[0] << tile2SL[1] << tile2SL[2] << tile2SL[3] );
323 }
324 }
325 if (tile2SL[0] || tile2SL[1] || tile2SL[2] || tile2SL[3]) {
326 ene[0] = energy_d5d6; ene[1] = energy_d6;
327 time[0] = time_d5d6 ;
time[1] = time_d6;
328 std::unique_ptr<TileMuonReceiverObj> tileMuRcvObj = std::make_unique<TileMuonReceiverObj>(frag_id,ene,time,tile2SL);
329 decisionContainer->push_back(tileMuRcvObj.release());
330 } else {
332 }
333 }
334
336 ATH_MSG_DEBUG(
"== Print TileD decision container output to SL" );
337 decisionContainer->print();
338 }
339
340 ATH_MSG_DEBUG(
"TileMuonReceiverDecision execution completed" );
341 return StatusCode::SUCCESS;
342}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
bool msgLvl(const MSG::Level lvl) const
static unsigned int getDrawerIdxFromFragId(unsigned int fragId)
Returns a drawer hash from fragId This function assumes drawer context (i.e.
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
SG::WriteHandleKey< TileMuonReceiverContainer > m_muonReceiverContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
time(flags, cells_name, *args, **kw)