< method to process raw channels from a given vector and store them in collection
949{
950
951 const TileDQstatus* DQstatus = nullptr;
954 }
955
957 SG::ReadCondHandle<TileEMScale> emScale(
m_emScaleKey, ctx);
959
960
961 int nTwo = 0;
962 int nCell = 0;
963 int nFake = 0;
964 int nMBTS = 0;
965 int nE4pr = 0;
966 int nChan = 0;
967 float eCh = 0.0;
968 float eCellTot = 0.0;
969 float eMBTSTot = 0.0;
970 float eE4prTot = 0.0;
971 bool EBdrawerPresent[128];
972 memset(EBdrawerPresent, 0, sizeof(EBdrawerPresent));
973 DataPool<TileCell> tileCellsP(5217);
974
975
976
977
978
979 std::vector<TileCell*> allCells (
m_tileID->cell_hash_max(),
nullptr);
980
981 for (ITERATOR rawItr = begin; rawItr !=
end; ++rawItr) {
982
983 const TileRawChannel* pChannel = (*rawItr);
984 HWIdentifier adc_id = pChannel->
adc_HWID();
991 continue;
992 }
994 if (channel == 0 && ros > 2) EBdrawerPresent[(
ros - 3) * 64 + drawer] =
true;
995
998
1003 amp = emScale->undoOnlineChannelCalibration(drawerIdx, channel, gain, amp,
params.m_RChUnit);
1004
1011 } else {
1013 ATH_MSG_ERROR(
"But amplitude correction works only with ADC counts " );
1014 ATH_MSG_ERROR(
"Please, disable CIS calibration in optimal filter " );
1015 }
1016 }
1017
1019
1020
1021 bool good_time = (fabs(time) <
params.m_maxTimeCorr);
1023 ? ((qual > 2.99 && qual < 4.01))
1025
1026
1027
1028
1029
1030
1031
1032 bool overflow = false;
1033 bool underflow = false;
1034 bool overfit = false;
1036 if (ped > 59500.) {
1038 } else if (ped > 39500.) {
1039
1041
1044
1046
1047 if (overflow
1049 && amp > 0
1052
1056 }
1057 }
1058 }
1059
1060
1061 if (
params.m_correctTime && good_time && non_zero_time)
1063 else
1065
1066 ++nChan;
1067 eCh += amp;
1068
1071
1073 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,
1074 26,25,24,29,31,32,27,28,30,35,34,33,38,37,43,44,41,40,39,36,42,47,46,45};
1075 channel1 = pmt2channel[
channel];
1076
1078 && (ros == 2 && (drawer == 1 || drawer>2)) ) {
1079 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,
1080 26,25,24,29,28,27,32,31,30,35,34,33,38,37,36,41,40,39,44,43,42,47,46,45};
1081 channel1 = pmt2channel[
channel];
1083 && (ros == 4 && drawer>=2) ) {
1084 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,
1085 31,32,30,35, 33,34, 38,37,41,40,39,36, 26,25,24,29,28,27, 44,43,42,47,46,45};
1086 channel1 = pmt2channelEB[
channel];
1087 }
1088
1089 Identifier cell_id =
m_cabling->h2s_cell_id_index (ros, drawer, channel1, index, pmt);
1090
1091 if (index == -3) {
1092
1093 if (E4prCells) {
1094 ++nE4pr;
1095
1096
1097 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp, oldUnit
1099
1100 eE4prTot += ener;
1101 unsigned char iqual =
iquality(qual);
1102
1103 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1105 , overflow, underflow, overfit);
1109
1110 TileCell* pCell = tileCellsP.nextElementPtr();
1111
1112
1113 pCell->
set(NULL, cell_id);
1120
1121 if (msgLvl(MSG::VERBOSE)) {
1122 msg(MSG::VERBOSE) <<
" E4' cell_id=" <<
m_tileTBID->to_string(cell_id)
1123 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1124 << " ene= " << ener
1125 << " amp= " << amp
1126 <<
" time= " <<
time
1127 <<
" qual= " << pChannel->
quality()
1128 <<
" iqual= " << (
int) iqual
1129 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1130
1133 else
1135 }
1136
1138 *badChannels, pCell, adc_id))
1140 <<
" bad channel masked, new energy=" << pCell->
energy() );
1141
1143
1144 }
1145
1146 } else if (index == -2) {
1147
1148 if (MBTSCells) {
1149 ++nMBTS;
1150
1151
1152 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp , oldUnit
1154
1155 eMBTSTot += ener;
1156 unsigned char iqual =
iquality(qual);
1157
1158 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1159 ros, drawer, false, (good_time && non_zero_time),
1161
1165
1166 TileCell* pCell = tileCellsP.nextElementPtr();
1167
1168
1176
1177 if (msgLvl(MSG::VERBOSE)) {
1178 msg(MSG::VERBOSE) <<
" MBTS cell_id=" <<
m_tileTBID->to_string(cell_id)
1179 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1180 << " ene= " << ener
1181 << " amp= " << amp
1182 <<
" time= " <<
time
1183 <<
" qual= " << pChannel->
quality()
1184 <<
" iqual= " << (
int) iqual
1185 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1186
1189 else
1191 }
1192
1194 *badChannels, pCell, adc_id))
1196 <<
" bad channel masked, new energy=" << pCell->
energy() );
1197
1199
1200 }
1201 } else if (index != -1) {
1202
1203 float ener = emScale->calibrateChannel(drawerIdx, channel, gain, amp
1205
1206 eCellTot += ener;
1207
1208 unsigned char iqual =
iquality(qual);
1209
1210 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1212 , overflow, underflow, overfit);
1213
1214
1216
1217 int drawer2 =
m_cabling->E1_merged_with_run2plus(ros,drawer);
1218 if (drawer2 != 0) {
1219 int side = (
ros == 3) ? 1 : -1;
1222 TileCell* pCell2 = tileCellsP.nextElementPtr();
1223 ++nCell;
1224 allCells[
index2] = pCell2;
1225 const CaloDetDescrElement* dde2 =
m_tileMgr->get_cell_element(index2);
1226 pCell2->
set(dde2, cell_id2);
1228 int pmt2(0);
1229 ener /= 2.0F;
1230 correctCell(pCell2, 1, pmt2, gain, ener, time, iqual, qbit, 1);
1231
1233 <<
" splitted into " <<
m_tileID->to_string(cell_id2));
1234
1235
1236 }
1237
1238 }
1239
1240 TileCell* pCell = allCells[
index];
1241 if (pCell) {
1242 ++nTwo;
1243 correctCell(pCell, 2, pmt, gain, ener, time, iqual, qbit, 0);
1244 } else {
1245 ++nCell;
1246 allCells[
index] = pCell = tileCellsP.nextElementPtr();
1247 const CaloDetDescrElement* dde =
m_tileMgr->get_cell_element(index);
1248 pCell->
set(dde, cell_id);
1251 correctCell(pCell, 1, pmt, gain, ener, time, iqual, qbit, ch_type);
1252 }
1253
1254 if (msgLvl(MSG::VERBOSE)) {
1255 float calib1 = (amp != 0) ? ener / amp : 0.0;
1256 msg(MSG::VERBOSE) <<
" cell_id=" <<
m_tileID->to_string(cell_id, -2)
1257 <<
" adc_id=" <<
m_tileHWID->to_string(adc_id)
1258 << " calib=" << calib1
1259 << " nCell=" << nCell
1260 <<
" energy=" << ener <<
" (" << pCell->
energy() <<
", " << pCell->
eneDiff() <<
")" <<
endmsg;
1261
1262 msg(MSG::VERBOSE) <<
" amp= " << amp
1263 <<
" time= " <<
time
1264 <<
" qual= " << pChannel->
quality()
1265 <<
" iqual= " << (
int) iqual
1266 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1267
1270 else
1272 }
1273
1274 } else {
1275
1276 if (msgLvl(MSG::VERBOSE)) {
1277
1278 unsigned char iqual =
iquality(qual);
1279 unsigned char qbit =
qbits(drawerEvtStatus,
params.m_RChType,
1280 0, drawer, false, non_zero_time, false, overflow, underflow, overfit);
1281
1282 msg(MSG::VERBOSE) <<
" channel with adc_id=" <<
m_tileHWID->to_string(adc_id)
1283 <<
" is not connected" <<
endmsg;
1284
1285 msg(MSG::VERBOSE) <<
" amp= " << amp
1286 <<
" time= " <<
time
1287 <<
" qual= " << pChannel->
quality()
1288 <<
" iqual= " << (
int) iqual
1289 << " qbit = 0x" << MSG::hex << (int) qbit << MSG::dec;
1290
1293 else
1295 }
1296 }
1297 if (msgLvl(MSG::VERBOSE)) {
1298 if ((
params.m_correctTime && good_time && non_zero_time) || pChannel->
sizeTime() > 1) {
1299 msg(MSG::VERBOSE) <<
" OF_time = " << pChannel->
uncorrTime()
1301 }
1302 }
1303 }
1304
1305
1306
1307
1308 for (
unsigned int index = 0;
index < allCells.size(); ++
index) {
1309
1310 TileCell * pCell = allCells[
index];
1311
1312 if (pCell) {
1313
1315 if (
maskBadChannels (drawerEvtStatus, DQstatus, dcsState, *badChannels, pCell))
1317 <<
" bad channels masked, new energy=" << pCell->
energy() );
1318
1326
1327 coll->push_back(pCell);
1328
1329 } else {
1330
1331
1332
1333 }
1334
1335 allCells[
index] = 0;
1337
1338 pCell = tileCellsP.nextElementPtr();
1339 const CaloDetDescrElement* dde =
m_tileMgr->get_cell_element(index);
1341
1343
1345 if (EBdrawerPresent[ind]) {
1346 ++nFake;
1351 } else {
1355 }
1357
1359 <<
" ene=" << pCell->
energy()
1360 <<
" status=" << (pCell->
badcell() ?
"bad" :
"good") );
1361
1362 coll->push_back(pCell);
1363 }
1364 }
1365 }
1366 }
1367
1368 if (msgLvl(MSG::DEBUG)) {
1369 msg(MSG::DEBUG) <<
" nChan=" << nChan
1370 << " RawChSum=" << eCh
1371 << " nCell=" << nCell
1372 << " n2=" << nTwo
1373 << " nFake=" << nFake
1374 << " eneTot=" << eCellTot;
1375
1376 if (MBTSCells)
1377 msg(MSG::DEBUG) <<
" nMBTS=" << nMBTS
1378 << " eMBTS=" << eMBTSTot;
1379 if (E4prCells)
1380 msg(MSG::DEBUG) <<
" nE4pr=" << nE4pr
1381 << " eE4pr=" << eE4prTot;
1382
1384 }
1385}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#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
const TileDetDescrManager * m_tileMgr
Pointer to TileDetDescrManager.
Gaudi::Property< bool > m_fakeCrackCells
Gaudi::Property< float > m_eneForTimeCut
Gaudi::Property< float > m_ampMinThresh
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
const TileTBID * m_tileTBID
Pointer to TileTBID.
Gaudi::Property< bool > m_maskBadChannels
Gaudi::Property< int > m_qualityCut
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.
Gaudi::Property< float > m_minChi2
const MbtsDetDescrManager * m_mbtsMgr
Pointer to MbtsDetDescrManager.
Gaudi::Property< float > m_maxTime
bool maskBadChannels(TileDrawerEvtStatusArray &drawerEvtStatus, const TileDQstatus *DQstatus, const TileDCSState *dcsState, const TileBadChannels *badChannels, TileCell *pCell) const
Gaudi::Property< float > m_eneForTimeCutMBTS
Gaudi::Property< float > m_timeMaxThresh
unsigned char iquality(float qual) const
bool m_thresholdNotSet
bool variable to check whether some threshold have been set
SG::ReadCondHandleKey< TileDCSState > m_DCSStateKey
Name of TileDCSState object in condition store.
float m_ADCmaskValuePlusEps
Gaudi::Property< float > m_minTime
const TileCablingService * m_cabling
TileCabling instance.
Gaudi::Property< float > m_maxChi2
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
const TileHWID * m_tileHWID
Pointer to TileHWID.
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
Gaudi::Property< float > m_eThreshold
Gaudi::Property< float > m_timeMinThresh
Gaudi::Property< float > m_maxTimeDiff
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.
Gaudi::Property< bool > m_checkDCS
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
Gaudi::Property< int > m_useDemoCabling
Gaudi::Property< int > m_skipGain
float m_ADCmaskValueMinusEps
const TileID * m_tileID
Pointer to TileID.
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())