< method to process raw channels from a given vector and store them in collection
1037{
1038
1039 const TileDQstatus* DQstatus = nullptr;
1042 }
1043
1045 SG::ReadCondHandle<TileEMScale> emScale(
m_emScaleKey, ctx);
1047
1048
1049 int nTwo = 0;
1050 int nCell = 0;
1051 int nFake = 0;
1052 int nMBTS = 0;
1053 int nE4pr = 0;
1054 int nChan = 0;
1055 float eCh = 0.0;
1056 float eCellTot = 0.0;
1057 float eMBTSTot = 0.0;
1058 float eE4prTot = 0.0;
1059 bool EBdrawerPresent[128];
1060 memset(EBdrawerPresent, 0, sizeof(EBdrawerPresent));
1061 DataPool<TileCell> tileCellsP(5217);
1062
1063
1064
1065
1066
1067 std::vector<TileCell*> allCells (
m_tileID->cell_hash_max(),
nullptr);
1068
1069 for (ITERATOR rawItr = begin; rawItr !=
end; ++rawItr) {
1070
1071 const TileRawChannel* pChannel = (*rawItr);
1072 HWIdentifier adc_id = pChannel->
adc_HWID();
1079 continue;
1080 }
1082 if (channel == 0 && ros > 2) EBdrawerPresent[(
ros - 3) * 64 + drawer] =
true;
1083
1086
1091 amp = emScale->undoOnlineChannelCalibration(drawerIdx, channel, gain, amp,
params.m_RChUnit);
1092
1099 } else {
1101 ATH_MSG_ERROR(
"But amplitude correction works only with ADC counts " );
1102 ATH_MSG_ERROR(
"Please, disable CIS calibration in optimal filter " );
1103 }
1104 }
1105
1107
1108
1109 bool good_time = (fabs(time) <
params.m_maxTimeCorr);
1111 ? ((qual > 2.99 && qual < 4.01))
1113
1114
1115
1116
1117
1118
1119
1120 bool overflow = false;
1121 bool underflow = false;
1122 bool overfit = false;
1124 if (ped > 59500.) {
1126 } else if (ped > 39500.) {
1127
1129
1132
1134
1135 if (overflow
1137 && amp > 0
1140
1144 }
1145 }
1146 }
1147
1148
1149 if (
params.m_correctTime && good_time && non_zero_time)
1151 else
1153
1154 ++nChan;
1155 eCh += amp;
1156
1159
1161 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,
1162 26,25,24,29,31,32,27,28,30,35,34,33,38,37,43,44,41,40,39,36,42,47,46,45};
1163 channel1 = pmt2channel[
channel];
1164
1166 && (ros == 2 && (drawer == 1 || drawer>2)) ) {
1167 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,
1168 26,25,24,29,28,27,32,31,30,35,34,33,38,37,36,41,40,39,44,43,42,47,46,45};
1169 channel1 = pmt2channel[
channel];
1171 && (ros == 4 && drawer>=2) ) {
1172 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,
1173 31,32,30,35, 33,34, 38,37,41,40,39,36, 26,25,24,29,28,27, 44,43,42,47,46,45};
1174 channel1 = pmt2channelEB[
channel];
1175 }
1176
1177 Identifier cell_id =
m_cabling->h2s_cell_id_index (ros, drawer, channel1, index, pmt);
1178
1179 if (index == -3) {
1180
1181 if (E4prCells) {
1182 ++nE4pr;
1183
1184
1185 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp, oldUnit
1187
1188 eE4prTot += ener;
1189 unsigned char iqual =
iquality(qual);
1190
1191 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1193 , overflow, underflow, overfit);
1197
1198 TileCell* pCell = tileCellsP.nextElementPtr();
1199
1200
1201 pCell->
set(NULL, cell_id);
1208
1209 if (msgLvl(MSG::VERBOSE)) {
1210 msg(MSG::VERBOSE) <<
" E4' cell_id=" <<
m_tileTBID->to_string(cell_id)
1211 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1212 << " ene= " << ener
1213 << " amp= " << amp
1214 <<
" time= " <<
time
1215 <<
" qual= " << pChannel->
quality()
1216 <<
" iqual= " << (
int) iqual
1217 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1218
1221 else
1223 }
1224
1226 *badChannels, pCell, adc_id))
1228 <<
" bad channel masked, new energy=" << pCell->
energy() );
1229
1231
1232 }
1233
1234 } else if (index == -2) {
1235
1236 if (MBTSCells) {
1237 ++nMBTS;
1238
1239
1240 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp , oldUnit
1242
1243 eMBTSTot += ener;
1244 unsigned char iqual =
iquality(qual);
1245
1246 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1247 ros, drawer, false, (good_time && non_zero_time),
1249
1253
1254 TileCell* pCell = tileCellsP.nextElementPtr();
1255
1256
1264
1265 if (msgLvl(MSG::VERBOSE)) {
1266 msg(MSG::VERBOSE) <<
" MBTS cell_id=" <<
m_tileTBID->to_string(cell_id)
1267 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1268 << " ene= " << ener
1269 << " amp= " << amp
1270 <<
" time= " <<
time
1271 <<
" qual= " << pChannel->
quality()
1272 <<
" iqual= " << (
int) iqual
1273 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1274
1277 else
1279 }
1280
1282 *badChannels, pCell, adc_id))
1284 <<
" bad channel masked, new energy=" << pCell->
energy() );
1285
1287
1288 }
1289 } else if (index != -1) {
1290
1291 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp
1293
1294 eCellTot += ener;
1295
1296 unsigned char iqual =
iquality(qual);
1297
1298 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1300 , overflow, underflow, overfit);
1301
1302
1304
1305 int drawer2 =
m_cabling->E1_merged_with_run2plus(ros,drawer);
1306 if (drawer2 != 0) {
1307 int side = (
ros == 3) ? 1 : -1;
1310 TileCell* pCell2 = tileCellsP.nextElementPtr();
1311 ++nCell;
1312 allCells[
index2] = pCell2;
1313 const CaloDetDescrElement* dde2 =
m_tileMgr->get_cell_element(index2);
1314 pCell2->
set(dde2, cell_id2);
1316 int pmt2(0);
1317 ener /= 2.0F;
1318 correctCell(pCell2, 1, pmt2, gain, ener, time, iqual, qbit, 1);
1319
1321 <<
" splitted into " <<
m_tileID->to_string(cell_id2));
1322
1323
1324 }
1325
1326 }
1327
1328 TileCell* pCell = allCells[
index];
1329 if (pCell) {
1330 ++nTwo;
1331 correctCell(pCell, 2, pmt, gain, ener, time, iqual, qbit, 0);
1332 } else {
1333 ++nCell;
1334 allCells[
index] = pCell = tileCellsP.nextElementPtr();
1335 const CaloDetDescrElement* dde =
m_tileMgr->get_cell_element(index);
1336 pCell->
set(dde, cell_id);
1339 correctCell(pCell, 1, pmt, gain, ener, time, iqual, qbit, ch_type);
1340 }
1341
1342 if (msgLvl(MSG::VERBOSE)) {
1343 float calib1 = (amp != 0) ? ener / amp : 0.0;
1344 msg(MSG::VERBOSE) <<
" cell_id=" <<
m_tileID->to_string(cell_id, -2)
1345 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1346 << " calib=" << calib1
1347 << " nCell=" << nCell
1348 <<
" energy=" << ener <<
" (" << pCell->
energy() <<
", " << pCell->
eneDiff() <<
")" <<
endmsg;
1349
1350 msg(MSG::VERBOSE) <<
" amp= " << amp
1351 <<
" time= " <<
time
1352 <<
" qual= " << pChannel->
quality()
1353 <<
" iqual= " << (
int) iqual
1354 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1355
1358 else
1360 }
1361
1362 } else {
1363
1364 if (msgLvl(MSG::VERBOSE)) {
1365
1366 unsigned char iqual =
iquality(qual);
1367 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1368 0, drawer, false, non_zero_time, false, overflow, underflow, overfit);
1369
1370 msg(MSG::VERBOSE) <<
" channel with adc_id=" <<
m_tileHWID->to_string(adc_id)
1371 <<
" is not connected" <<
endmsg;
1372
1373 msg(MSG::VERBOSE) <<
" amp= " << amp
1374 <<
" time= " <<
time
1375 <<
" qual= " << pChannel->
quality()
1376 <<
" iqual= " << (
int) iqual
1377 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1378
1381 else
1383 }
1384 }
1385 if (msgLvl(MSG::VERBOSE)) {
1386 if ((
params.m_correctTime && good_time && non_zero_time) || pChannel->
sizeTime() > 1) {
1387 msg(MSG::VERBOSE) <<
" OF_time = " << pChannel->
uncorrTime()
1389 }
1390 }
1391 }
1392
1393
1394
1395
1396 for (
unsigned int index = 0;
index < allCells.size(); ++
index) {
1397
1398 TileCell * pCell = allCells[
index];
1399
1400 if (pCell) {
1401
1403 if (
maskBadChannels (drawerEvtStatus, DQstatus, dcsState, *badChannels, pCell))
1405 <<
" bad channels masked, new energy=" << pCell->
energy() );
1406
1414
1415 coll->push_back(pCell);
1416
1417 } else {
1418
1419
1420
1421 }
1422
1423 allCells[
index] = 0;
1425
1426 pCell = tileCellsP.nextElementPtr();
1427 const CaloDetDescrElement* dde =
m_tileMgr->get_cell_element(index);
1429
1431
1433 if (EBdrawerPresent[ind]) {
1434 ++nFake;
1439 } else {
1443 }
1445
1447 <<
" ene=" << pCell->
energy()
1448 <<
" status=" << (pCell->
badcell() ?
"bad" :
"good") );
1449
1450 coll->push_back(pCell);
1451 }
1452 }
1453 }
1454 }
1455
1456 if (msgLvl(MSG::DEBUG)) {
1457 msg(MSG::DEBUG) <<
" nChan=" << nChan
1458 << " RawChSum=" << eCh
1459 << " nCell=" << nCell
1460 << " n2=" << nTwo
1461 << " nFake=" << nFake
1462 << " eneTot=" << eCellTot;
1463
1464 if (MBTSCells)
1465 msg(MSG::DEBUG) <<
" nMBTS=" << nMBTS
1466 << " eMBTS=" << eMBTSTot;
1467 if (E4prCells)
1468 msg(MSG::DEBUG) <<
" nE4pr=" << nE4pr
1469 << " eE4pr=" << eE4prTot;
1470
1472 }
1473}
#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())