< method to process raw channels from a given vector and store them in collection
1046{
1047
1048 const TileDQstatus* DQstatus = nullptr;
1051 }
1052
1054 SG::ReadCondHandle<TileEMScale> emScale(
m_emScaleKey, ctx);
1056
1057
1058 int nTwo = 0;
1059 int nCell = 0;
1060 int nFake = 0;
1061 int nMBTS = 0;
1062 int nE4pr = 0;
1063 int nChan = 0;
1064 float eCh = 0.0;
1065 float eCellTot = 0.0;
1066 float eMBTSTot = 0.0;
1067 float eE4prTot = 0.0;
1068 bool EBdrawerPresent[128];
1069 memset(EBdrawerPresent, 0, sizeof(EBdrawerPresent));
1070 DataPool<TileCell> tileCellsP(5217);
1071
1072
1073
1074
1075
1076 std::vector<TileCell*> allCells (
m_tileID->cell_hash_max(),
nullptr);
1077
1078 for (ITERATOR rawItr = begin; rawItr !=
end; ++rawItr) {
1079
1080 const TileRawChannel* pChannel = (*rawItr);
1081 HWIdentifier adc_id = pChannel->
adc_HWID();
1088 continue;
1089 }
1091 if (channel == 0 && ros > 2) EBdrawerPresent[(
ros - 3) * 64 + drawer] =
true;
1092
1095
1100 amp = emScale->undoOnlineChannelCalibration(drawerIdx, channel, gain, amp,
params.m_RChUnit);
1101
1108 } else {
1110 ATH_MSG_ERROR(
"But amplitude correction works only with ADC counts " );
1111 ATH_MSG_ERROR(
"Please, disable CIS calibration in optimal filter " );
1112 }
1113 }
1114
1116
1117
1118 bool good_time = (fabs(time) <
params.m_maxTimeCorr);
1120 ? ((qual > 2.99 && qual < 4.01))
1122
1123
1124
1125
1126
1127
1128
1129 bool overflow = false;
1130 bool underflow = false;
1131 bool overfit = false;
1133 if (ped > 59500.) {
1135 } else if (ped > 39500.) {
1136
1138
1141
1143
1144 if (overflow
1146 && amp > 0
1149
1153 }
1154 }
1155 }
1156
1157
1158 if (
params.m_correctTime && good_time && non_zero_time)
1160 else
1162
1163 ++nChan;
1164 eCh += amp;
1165
1168
1170 int pmt2channel[48] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
1171 26,25,24,29,31,32,27,28,30,35,34,33,38,37,43,44,41,40,39,36,42,47,46,45};
1172 channel1 = pmt2channel[
channel];
1173
1175 && (ros == 2 && (drawer == 1 || drawer>2)) ) {
1176 int pmt2channel[48] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
1177 26,25,24,29,28,27,32,31,30,35,34,33,38,37,36,41,40,39,44,43,42,47,46,45};
1178 channel1 = pmt2channel[
channel];
1180 && (ros == 4 && drawer>=2) ) {
1181 int pmt2channelEB[48] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
1182 31,32,30,35, 33,34, 38,37,41,40,39,36, 26,25,24,29,28,27, 44,43,42,47,46,45};
1183 channel1 = pmt2channelEB[
channel];
1184 }
1185
1186 Identifier cell_id =
m_cabling->h2s_cell_id_index (ros, drawer, channel1, index, pmt);
1187
1188 if (index == -3) {
1189
1190 if (E4prCells) {
1191 ++nE4pr;
1192
1193
1194 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp, oldUnit
1196
1197 eE4prTot += ener;
1198 unsigned char iqual =
iquality(qual);
1199
1200 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1202 , overflow, underflow, overfit);
1206
1207 TileCell* pCell = tileCellsP.nextElementPtr();
1208
1209
1210 pCell->
set(NULL, cell_id);
1217
1218 if (msgLvl(MSG::VERBOSE)) {
1219 msg(MSG::VERBOSE) <<
" E4' cell_id=" <<
m_tileTBID->to_string(cell_id)
1220 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1221 << " ene= " << ener
1222 << " amp= " << amp
1223 <<
" time= " <<
time
1224 <<
" qual= " << pChannel->
quality()
1225 <<
" iqual= " << (
int) iqual
1226 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1227
1230 else
1232 }
1233
1235 *badChannels, pCell, adc_id))
1237 <<
" bad channel masked, new energy=" << pCell->
energy() );
1238
1240
1241 }
1242
1243 } else if (index == -2) {
1244
1245 if (MBTSCells) {
1246 ++nMBTS;
1247
1248
1249 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp , oldUnit
1251
1252 eMBTSTot += ener;
1253 unsigned char iqual =
iquality(qual);
1254
1255 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1256 ros, drawer, false, (good_time && non_zero_time),
1258
1262
1263 TileCell* pCell = tileCellsP.nextElementPtr();
1264
1265
1273
1274 if (msgLvl(MSG::VERBOSE)) {
1275 msg(MSG::VERBOSE) <<
" MBTS cell_id=" <<
m_tileTBID->to_string(cell_id)
1276 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1277 << " ene= " << ener
1278 << " amp= " << amp
1279 <<
" time= " <<
time
1280 <<
" qual= " << pChannel->
quality()
1281 <<
" iqual= " << (
int) iqual
1282 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1283
1286 else
1288 }
1289
1291 *badChannels, pCell, adc_id))
1293 <<
" bad channel masked, new energy=" << pCell->
energy() );
1294
1296
1297 }
1298 } else if (index != -1) {
1299
1300 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp
1302
1303 eCellTot += ener;
1304
1305 unsigned char iqual =
iquality(qual);
1306
1307 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1309 , overflow, underflow, overfit);
1310
1311
1313
1314 int drawer2 =
m_cabling->E1_merged_with_run2plus(ros,drawer);
1315 if (drawer2 != 0) {
1316 int side = (
ros == 3) ? 1 : -1;
1319 TileCell* pCell2 = tileCellsP.nextElementPtr();
1320 ++nCell;
1321 allCells[
index2] = pCell2;
1322 const CaloDetDescrElement* dde2 =
m_tileMgr->get_cell_element(index2);
1323 pCell2->
set(dde2, cell_id2);
1325 int pmt2(0);
1326 ener /= 2.0F;
1327 correctCell(pCell2, 1, pmt2, gain, ener, time, iqual, qbit, 1);
1328
1330 <<
" splitted into " <<
m_tileID->to_string(cell_id2));
1331
1332
1333 }
1334
1335 }
1336
1337 TileCell* pCell = allCells[
index];
1338 if (pCell) {
1339 ++nTwo;
1340 correctCell(pCell, 2, pmt, gain, ener, time, iqual, qbit, 0);
1341 } else {
1342 ++nCell;
1343 allCells[
index] = pCell = tileCellsP.nextElementPtr();
1344 const CaloDetDescrElement* dde =
m_tileMgr->get_cell_element(index);
1345 pCell->
set(dde, cell_id);
1348 correctCell(pCell, 1, pmt, gain, ener, time, iqual, qbit, ch_type);
1349 }
1350
1351 if (msgLvl(MSG::VERBOSE)) {
1352 float calib1 = (amp != 0) ? ener / amp : 0.0;
1353 msg(MSG::VERBOSE) <<
" cell_id=" <<
m_tileID->to_string(cell_id, -2)
1354 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1355 << " calib=" << calib1
1356 << " nCell=" << nCell
1357 <<
" energy=" << ener <<
" (" << pCell->
energy() <<
", " << pCell->
eneDiff() <<
")" <<
endmsg;
1358
1359 msg(MSG::VERBOSE) <<
" amp= " << amp
1360 <<
" time= " <<
time
1361 <<
" qual= " << pChannel->
quality()
1362 <<
" iqual= " << (
int) iqual
1363 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1364
1367 else
1369 }
1370
1371 } else {
1372
1373 if (msgLvl(MSG::VERBOSE)) {
1374
1375 unsigned char iqual =
iquality(qual);
1376 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1377 0, drawer, false, non_zero_time, false, overflow, underflow, overfit);
1378
1379 msg(MSG::VERBOSE) <<
" channel with adc_id=" <<
m_tileHWID->to_string(adc_id)
1380 <<
" is not connected" <<
endmsg;
1381
1382 msg(MSG::VERBOSE) <<
" amp= " << amp
1383 <<
" time= " <<
time
1384 <<
" qual= " << pChannel->
quality()
1385 <<
" iqual= " << (
int) iqual
1386 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1387
1390 else
1392 }
1393 }
1394 if (msgLvl(MSG::VERBOSE)) {
1395 if ((
params.m_correctTime && good_time && non_zero_time) || pChannel->
sizeTime() > 1) {
1396 msg(MSG::VERBOSE) <<
" OF_time = " << pChannel->
uncorrTime()
1398 }
1399 }
1400 }
1401
1402
1403
1404
1405 for (
unsigned int index = 0;
index < allCells.size(); ++
index) {
1406
1407 TileCell * pCell = allCells[
index];
1408
1409 if (pCell) {
1410
1412 if (
maskBadChannels (drawerEvtStatus, DQstatus, dcsState, *badChannels, pCell))
1414 <<
" bad channels masked, new energy=" << pCell->
energy() );
1415
1423
1424 coll->push_back(pCell);
1425
1426 } else {
1427
1428
1429
1430 }
1431
1432 allCells[
index] = 0;
1434
1435 pCell = tileCellsP.nextElementPtr();
1436 const CaloDetDescrElement* dde =
m_tileMgr->get_cell_element(index);
1438
1440
1442 if (EBdrawerPresent[ind]) {
1443 ++nFake;
1448 } else {
1452 }
1454
1456 <<
" ene=" << pCell->
energy()
1457 <<
" status=" << (pCell->
badcell() ?
"bad" :
"good") );
1458
1459 coll->push_back(pCell);
1460 }
1461 }
1462 }
1463 }
1464
1465 if (msgLvl(MSG::DEBUG)) {
1466 msg(MSG::DEBUG) <<
" nChan=" << nChan
1467 << " RawChSum=" << eCh
1468 << " nCell=" << nCell
1469 << " n2=" << nTwo
1470 << " nFake=" << nFake
1471 << " eneTot=" << eCellTot;
1472
1473 if (MBTSCells)
1474 msg(MSG::DEBUG) <<
" nMBTS=" << nMBTS
1475 << " eMBTS=" << eMBTSTot;
1476 if (E4prCells)
1477 msg(MSG::DEBUG) <<
" nE4pr=" << nE4pr
1478 << " eE4pr=" << eE4prTot;
1479
1481 }
1482}
#define ATH_MSG_VERBOSE(x)
double energy() const
get energy (data member)
void set(const CaloDetDescrElement *caloDDE, const Identifier &ID)
Fast method to change the identity of a cell.
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Identifier identify() const override final
cell identifier
IdentifierHash onl2() const
cell online identifier 2
value_type push_back(value_type pElem)
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
ToolHandle< TileCondToolTiming > m_tileToolTiming
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
bool maskBadChannel(TileDrawerEvtStatusArray &drawerEvtStatus, const TileDQstatus *DQstatus, const TileDCSState *dcsState, const TileBadChannels *badChannels, TileCell *pCell, HWIdentifier hwid) const
method to check if channels are good or bad.
bool maskBadChannels(TileDrawerEvtStatusArray &drawerEvtStatus, const TileDQstatus *DQstatus, const TileDCSState *dcsState, const TileBadChannels *badChannels, TileCell *pCell) const
unsigned char iquality(float qual) const
SG::ReadCondHandleKey< TileDCSState > m_DCSStateKey
Name of TileDCSState object in condition store.
float m_ADCmaskValuePlusEps
unsigned char qbits(TileDrawerEvtStatusArray &drawerEvtStatus, TileFragHash::TYPE RChType, int ros, int drawer, bool count_over, bool good_time, bool good_ener, bool overflow, bool underflow, bool good_overflowfit) const
method to compute the cell quality bits
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
void correctCell(TileCell *pCell, int correction, int pmt, int gain, float ener, float time, unsigned char iqual, unsigned char qbit, int ch_type) const
Compute calibrated energy, time, etc.
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
float m_ADCmaskValueMinusEps
uint8_t qual1(void) const
get quality of first PMT (data member)
float time1(void) const
get time of first PMT
void setEnergy_nonvirt(float e1, float e2, int gain1, int gain2)
void setQual2(unsigned char qual)
set quality of second PMT
virtual bool badcell(void) const override final
check if whole cell is bad (i.e.
void setTime_nonvirt(float t)
float eneDiff(void) const
all get methods
virtual void setEnergy(float ene) override final
set total energy, reset eneDiff to zero (final override of CaloCell method)
uint8_t qual2(void) const
get quality of second PMT (data member)
void setQbit1(unsigned char qbit)
set quality bits of first PMT
void setQbit2(unsigned char qbit)
set quality bits of second PMT
void setQuality(unsigned char qual, unsigned char qbit, int pmt)
set quality value and quality bits for one PMT (TileCell specific overloads)
void setQual1(unsigned char qual)
set quality of first PMT
virtual void setTime(float t) override final
set cell time, reset timeDiff
float timeDiff(void) const
get time diff for two PMTs (data member)
float time2(void) const
get time of second PMT
static const char * BadPatternName(float ped)
static double correctAmp(double phase, bool of2=true)
Amplitude correction factor according to the time when using weights for tau=0 without iterations.
float pedestal(void) const
float time(int ind=0) const
float quality(int ind=0) const
float amplitude(int ind=0) const
HWIdentifier adc_HWID(void) const
time(flags, cells_name, *args, **kw)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())