47 #define WRONG_SAMPLE(frag,chan,size) \
48 msg(MSG::ERROR) << "Wrong no. of samples (" << size \
49 << ") for channel " << chan \
50 << " in frag 0x"<<MSG::hex << frag << MSG::dec \
51 << " - " << BeamFragName[frag&0x1F] << endmsg;
53 #define WRONG_CHANNEL(frag,chan) \
54 msg(MSG::ERROR) << "Wrong channel " << chan \
55 << " in frag 0x"<<MSG::hex << frag << MSG::dec \
56 << " - " << BeamFragName[frag&0x1F] << endmsg;
58 #define FRAG_FOUND(frag,chan,size) \
59 if (msgLvl(MSG::DEBUG)) \
60 msg(MSG::DEBUG) << "Found channel " << chan \
61 << " in frag 0x"<<MSG::hex << frag << MSG::dec \
62 << " - " << BeamFragName[frag&0x1F] \
63 << " of size " << size << endmsg;
66 #define SIGNAL_FOUND(frag,chan,amplitude) \
67 if (msgLvl(MSG::DEBUG)) \
68 msg(MSG::DEBUG) << "Found channel " << chan \
69 << " in frag 0x"<<MSG::hex << frag << MSG::dec \
70 << " - " << BeamFragName[frag&0x1F] \
71 << " with amp=" << amplitude << endmsg;
73 #define MAX_DRAWERS 256
84 , m_thistSvc(
"THistSvc",
name)
89 char frg[6] =
"0x000";
95 sprintf(frg,
"0x%3.3x",
i);
125 return StatusCode::SUCCESS;
240 if (
sc.isFailure()) {
242 return StatusCode::FAILURE;
252 ATH_MSG_INFO(
"Final offline units are not set, will use DSP units" );
258 ATH_MSG_INFO(
"calibrateEnergy is disabled, don't want to use DSP units" );
271 msg(MSG::INFO) <<
"drawerList " << MSG::hex;
278 msg(MSG::INFO) <<
" 0x" << frag;
292 msg(MSG::INFO) <<
" - negative number, will read frag IDs from the data" << MSG::dec <<
endmsg;
294 msg(MSG::INFO) <<
"is empty, no drawer fragments in ntuple" << MSG::dec <<
endmsg;
305 msg(MSG::INFO) << MSG::INFO <<
"drawerType ";
316 msg(MSG::INFO) << MSG::INFO <<
"Beam Frag List " << MSG::hex;
322 msg(MSG::INFO) <<
" 0x" << frag;
326 msg(MSG::INFO) <<
"is empty, no beam fragments in ntuple" << MSG::dec <<
endmsg;
358 return StatusCode::SUCCESS;
363 const EventContext& ctx = Gaudi::Hive::currentContext();
389 m_run = ctx.eventID().run_number();
390 m_evt = ctx.eventID().event_number();
393 if (ctx.eventID().time_stamp() > 0) {
394 m_evTime = ctx.eventID().time_stamp();
447 return StatusCode::SUCCESS;
458 return StatusCode::FAILURE;
522 return StatusCode::SUCCESS;
528 return StatusCode::SUCCESS;
540 if ( collItr!=lastColl ) {
541 m_l1ID.at(nDrawersAll) = (*collItr)->getLvl1Id();
542 m_l1Type.at(nDrawersAll) = (*collItr)->getLvl1Type();
543 m_evType.at(nDrawersAll) = (*collItr)->getDetEvType();
544 m_evBCID.at(nDrawersAll) = (*collItr)->getRODBCID();
546 m_l1ID.at(nDrawersAll) = 0xFFFFFFFF;
547 m_l1Type.at(nDrawersAll) = 0xFFFFFFFF;
548 m_evType.at(nDrawersAll) = 0xFFFFFFFF;
549 m_evBCID.at(nDrawersAll) = 0xFFFFFFFF;
556 for(; collItr != lastColl; ++collItr) {
563 for (; beamItr != lastBeam; ++beamItr) {
565 std::vector<uint32_t> digits = (*beamItr)->get_digits();
567 << MSG::hex <<
" frag: 0x" << (*collItr)->identify()
569 <<
" digits size " << digits.size() <<
endmsg;
571 for (
unsigned int k = 0;
k < digits.size();
k++)
576 beamItr = (*collItr)->begin();
579 int frag = (*collItr)->identify();
583 if (
m_trigType == 0 && (*collItr)->getLvl1Type() != 0 )
589 for (; beamItr != lastBeam; ++beamItr) {
592 std::vector<uint32_t> digits = (*beamItr)->get_digits();
594 int dsize = digits.size();
621 if(cha < 8)
m_btdc1[cha] = amplitude;
622 else if(cha < 16)
m_btdc2[cha-8] = amplitude;
631 case 0:
m_s1cou = amplitude;
break;
632 case 1:
m_s2cou = amplitude;
break;
633 case 2:
m_s3cou = amplitude;
break;
634 case 3:
m_cher1 = amplitude;
break;
635 case 4:
m_cher2 = amplitude;
break;
636 case 5:
m_muTag = amplitude;
break;
644 case 0:
m_s1cou = amplitude;
break;
645 case 1:
m_s2cou = amplitude;
break;
646 case 2:
m_s3cou = amplitude;
break;
647 case 3:
m_cher1 = amplitude;
break;
648 case 4:
m_muTag = amplitude;
break;
649 case 5:
m_cher2 = amplitude;
break;
653 case 8:
m_las0 = amplitude;
break;
654 case 9:
m_las1 = amplitude;
break;
655 case 10:
m_las2 = amplitude;
break;
656 case 11:
m_las3 = amplitude;
break;
666 case 0:
m_sc1 = amplitude;
break;
667 case 1:
m_sc2 = amplitude;
break;
682 if(cha < 14)
m_muBack[cha] = amplitude;
684 else if (cha < 16)
m_muCalib[cha - 14] = amplitude;
691 if(cha < 6)
m_muBack[cha + 8] = amplitude;
693 else if (cha < 8)
m_muCalib[cha - 6] = amplitude;
702 if (amplitude & 0xFF00)
m_trigType = amplitude >> 8;
712 case 0:
m_las0 = amplitude;
break;
713 case 1:
m_las1 = amplitude;
break;
714 case 2:
m_las2 = amplitude;
break;
715 case 3:
m_las3 = amplitude;
break;
728 for (
int k = 0;
k < dsize;
k++) {
747 m_qdc[cha] = amplitude;
749 }
else if (cha == 15) {
759 if(cha < 8)
m_ecal[cha] = amplitude;
767 if(cha < 16)
m_cispar[cha] = amplitude;
774 if (
m_run > 2211444) {
777 case 0:
m_s1cou = amplitude;
break;
778 case 1:
m_s2cou = amplitude;
break;
780 if (
m_run < 2310000) {
787 case 3:
m_cher1 = amplitude;
break;
788 case 4:
m_cher2 = amplitude;
break;
789 case 5:
m_cher3 = amplitude;
break;
790 default:
m_muBack[cha - 6] = amplitude;
795 case 0:
m_s1cou = amplitude;
break;
796 case 1:
m_s2cou = amplitude;
break;
797 case 2:
m_s3cou = amplitude;
break;
798 case 3:
m_cher1 = amplitude;
break;
799 case 4:
m_cher2 = amplitude;
break;
800 case 5:
m_cher3 = amplitude;
break;
809 case 0:
m_s1cou = amplitude;
break;
810 case 1:
m_s2cou = amplitude;
break;
811 case 2:
m_s3cou = amplitude;
break;
812 case 3:
m_muTag = amplitude;
break;
813 case 4:
m_cher1 = amplitude;
break;
814 case 5:
m_cher2 = amplitude;
break;
849 if (
m_run > 2310000 && cha < 16) {
851 }
else if (cha == 0) {
863 m_tof[cha] = amplitude;
875 m_tof[cha] = amplitude;
882 if(cha < 8)
m_tof[cha] = amplitude;
890 if ((cha > 11) && (cha < 16) && (
m_run > 2211136)) {
891 m_tof[cha] = amplitude;
899 (*m_btdc)[cha].push_back(amplitude);
907 if(cha < 16)
m_btdc2[cha] = amplitude;
915 for (
int ibit = 0; ibit < 32; ++ibit){
918 }
else if (cha == 3) {
928 for (
int ibit=0; ibit < 32; ++ibit){
931 }
else if (cha == 3) {
941 for (
int ibit = 0; ibit < 32; ++ibit){
944 }
else if (cha == 3) {
954 for (
int ibit = 0; ibit < 32; ++ibit){
957 }
else if (cha == 3) {
967 for (
int ibit = 0; ibit < 32; ++ibit){
970 }
else if (cha == 3) {
980 for (
int ibit = 0; ibit < 32; ++ibit){
983 }
else if (cha == 3) {
993 for (
int ibit = 0; ibit < 32; ++ibit){
996 }
else if (cha == 3) {
1006 for (
int ibit = 0; ibit < 32; ++ibit){
1009 }
else if (cha == 3) {
1023 for (
int i=0;
i<8; ++
i) {
1039 if (
m_run > 2211444) {
1055 if (
m_run > 2211444) {
1081 if (
m_run > 2211444) {
1146 ATH_MSG_ERROR(
"No EventInfo object found! Can't read run number!" );
1173 return StatusCode::SUCCESS;
1185 , std::vector<std::array<float, MAX_CHAN>>* eneVec
1186 , std::vector<std::array<float, MAX_CHAN>>* timeVec
1187 , std::vector<std::array<float, MAX_CHAN>>* chi2Vec
1188 , std::vector<std::array<float, MAX_CHAN>>* pedVec
1189 ,
bool saveDQstatus)
1193 if (containerKey.
empty()) {
1194 return StatusCode::FAILURE;
1197 bool isFELIX = containerKey.
key().find(
"Flx") != std::string::npos;
1216 ATH_MSG_ERROR(
"RawChannel units are not ADC counts, can't apply DSP-like calibration" );
1217 return StatusCode::FAILURE;
1233 int drawerIndex, fragType;
1238 int fragId = rawChannelCollection->identify();
1242 if ( itr != drawerMap.end() ) {
1243 drawerIndex = (*itr).second;
1248 if (drawerIndex < 0) {
1249 if ( !rawChannelCollection->empty() )
1250 ATH_MSG_DEBUG(
"frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing TRC!" );
1252 fragType = isFELIX ? fragId >> 8 :
m_drawerType[drawerIndex];
1255 <<
" Frag id 0x" << MSG::hex << fragId << MSG::dec
1256 <<
" index "<< drawerIndex );
1260 int index = drawerIndex;
1273 double energy = rch->amplitude();
1285 (
m_TBperiod==2017 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x203))) ||
1286 (
m_TBperiod==2018 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x402))) ||
1287 (
m_TBperiod==2019 && ((fragId&0xFF)<5 && !(fragId == 0x201 || fragId == 0x203 || fragId >= 0x402))) ||
1288 (
m_TBperiod==2022 && ((fragId&0xFF)<4 && !(fragId == 0x201 || (
m_run >= 2210456 && fragId == 0x402)))))
1302 <<
" time=" << rch->time()
1303 <<
" chi2=" << rch->quality()
1304 <<
" ped=" << rch->pedestal()
1306 <<
" index " <<
index );
1310 if (saveDQstatus && !isFELIX) {
1321 for (
unsigned int dmu = 0; dmu <
MAX_DMU; ++dmu) {
1335 return StatusCode::SUCCESS;
1346 if (containerKey.
empty()) {
1347 return StatusCode::FAILURE;
1353 bool emptyColl =
true;
1356 int drawerIndex, fragType,
channel;
1358 std::vector<float> sampleVec;
1359 std::vector<uint32_t> headerVec;
1360 std::vector<uint32_t> headerVecHi;
1368 int fragId = digitsCollection->identify();
1369 int ros = (fragId >> 8);
1370 int drawer = fragId & 0x3F;
1374 drawerIndex = (*itr).second;
1379 if (drawerIndex < 0) {
1380 if ( !digitsCollection->empty() )
1381 ATH_MSG_DEBUG(
"frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing TRC!" );
1387 <<
" Frag id 0x" << MSG::hex << fragId << MSG::dec
1388 <<
" index " << drawerIndex
1392 <<
" BCID=" << digitsCollection->getFragBCID()<<MSG::hex
1393 <<
" CRC=0x" << (digitsCollection->getFragCRC()&0xffff)
1394 <<
" DMUMask=0x" << (digitsCollection->getFragDMUMask()&0xffff)<<MSG::dec );
1397 <<
" Lvl1Type=" << digitsCollection->getLvl1Type()
1398 <<
" EvBCID=" << digitsCollection->getRODBCID()
1399 <<
" EvType=" << digitsCollection->getDetEvType() );
1401 ATH_MSG_DEBUG(
" Header=" << digitsCollection->getFragChipHeaderWords() );
1408 m_l1ID.at(drawerIndex) = digitsCollection->getLvl1Id();
1409 m_l1Type.at(drawerIndex) = digitsCollection->getLvl1Type();
1410 m_evType.at(drawerIndex) = digitsCollection->getDetEvType();
1411 m_evBCID.at(drawerIndex) = digitsCollection->getRODBCID();
1413 m_frBCID.at(drawerIndex) = digitsCollection->getFragBCID();
1421 int drawerIndexHi = drawerIndex +
m_nDrawers;
1423 if (!digitsCollection->empty()) {
1426 m_rodBCIDVec.at(drawerIndex) = digitsCollection->getRODBCID();
1427 m_sizeVec.at(drawerIndex) = digitsCollection->getFragSize();
1428 m_sizeVec.at(drawerIndexHi) = digitsCollection->getFragSize();
1432 headerVec = digitsCollection->getFragChipHeaderWords();
1433 headerVecHi = digitsCollection->getFragChipHeaderWordsHigh();
1434 CRCmask = digitsCollection->getFragDMUMask();
1435 fe_crc = CRCmask & 0xFFFF;
1436 rod_crc = CRCmask >> 16;
1438 unsigned int headsize =
std::min(16U,
static_cast<unsigned int>(headerVec.size()));
1439 unsigned int headsizehi =
std::min(16U,
static_cast<unsigned int>(headerVecHi.size()));
1441 for (
unsigned int ih = 0; ih < headsize; ++ih) {
1443 m_bcidVec.at(drawerIndex)[ih] = (headerVec[ih] & 0xFFF);
1450 m_feCRCVec.at(drawerIndex)[ih] = (fe_crc >> ih & 0x1);
1451 m_rodCRCVec.at(drawerIndex)[ih] = (rod_crc >> ih & 0x1);
1459 for (
unsigned int ihhi = 0; ihhi < headsizehi; ++ihhi) {
1460 m_bcidVec.at(drawerIndexHi)[ihhi] = (headerVecHi[ihhi] & 0xFFF);
1476 m_slinkCRCVec.at(drawerIndex)[0] = (digitsCollection->getFragCRC() >> 16) & 0xffff;
1477 m_dmuMaskVec.at(drawerIndex)[0] = (digitsCollection->getFragDMUMask() >> 16) & 0xffff;
1478 m_slinkCRCVec.at(drawerIndex)[1] = digitsCollection->getFragCRC() & 0xffff;
1479 m_dmuMaskVec.at(drawerIndex)[1] = digitsCollection->getFragDMUMask() & 0xffff;
1481 m_slinkCRCVec.at(drawerIndexHi)[0] = (digitsCollection->getFragCRC() >> 16) & 0xffff;
1482 m_dmuMaskVec.at(drawerIndexHi)[0] = (digitsCollection->getFragDMUMask() >> 16) & 0xffff;
1483 m_slinkCRCVec.at(drawerIndexHi)[1] = digitsCollection->getFragCRC() & 0xffff;
1484 m_dmuMaskVec.at(drawerIndexHi)[1] = digitsCollection->getFragDMUMask() & 0xffff;
1487 for (
const TileDigits* tile_digits : *digitsCollection) {
1495 int index = (
gain == 1) ? drawerIndexHi : drawerIndex;
1505 (
m_TBperiod==2017 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x203))) ||
1506 (
m_TBperiod==2018 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x402))) ||
1507 (
m_TBperiod==2019 && ((fragId&0xFF)<5 && !(fragId == 0x201 || fragId == 0x203 || fragId >= 0x402))) ||
1508 (
m_TBperiod==2022 && ((fragId&0xFF)<4 && !(fragId == 0x201 || (
m_run >= 2210456 && fragId == 0x402)))))
1518 <<
" index " <<
index );
1521 sampleVec = tile_digits->samples();
1522 int siz = sampleVec.size();
1525 msg(
MSG::DEBUG) <<
"Digits(" << siz <<
")." << (dcnt++) <<
" {";
1526 for (
int i = 0;
i < siz;
i++) {
1530 if (siz > nSamplesInDrawer) {
1537 if (siz > nSamplesInDrawer) siz = nSamplesInDrawer;
1544 m_rodBCIDVec.at(drawerIndex) = digitsCollection->getRODBCID();
1545 m_sizeVec.at(drawerIndex) = digitsCollection->getFragSize();
1548 headerVec = digitsCollection->getFragChipHeaderWords();
1549 CRCmask = digitsCollection->getFragDMUMask();
1550 fe_crc = CRCmask & 0xFFFF;
1551 rod_crc = CRCmask >> 16;
1553 int headsize = headerVec.size();
1555 for (
int ih = 0; ih < headsize; ++ih) {
1556 m_bcidVec.at(drawerIndex)[ih] = (headerVec[ih] & 0xFFF);
1563 m_feCRCVec.at(drawerIndex)[ih] = (fe_crc >> ih & 0x1);
1564 m_rodCRCVec.at(drawerIndex)[ih] = (rod_crc >> ih & 0x1);
1572 m_slinkCRCVec.at(drawerIndex)[0] = (digitsCollection->getFragCRC() >> 16) & 0xffff;
1573 m_dmuMaskVec.at(drawerIndex)[0] = (digitsCollection->getFragDMUMask() >> 16) & 0xffff;
1574 m_slinkCRCVec.at(drawerIndex)[1] = digitsCollection->getFragCRC() & 0xffff;
1575 m_dmuMaskVec.at(drawerIndex)[1] = digitsCollection->getFragDMUMask() & 0xffff;
1581 for (
const TileDigits* tile_digits : *digitsCollection) {
1591 (
m_TBperiod==2017 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x203))) ||
1592 (
m_TBperiod==2018 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x402))) ||
1593 (
m_TBperiod==2019 && ((fragId&0xFF)<5 && !(fragId == 0x201 || fragId == 0x203 || fragId >= 0x402))) ||
1594 (
m_TBperiod==2022 && ((fragId&0xFF)<4 && !(fragId == 0x201 || (
m_run >= 2210456 && fragId == 0x402)))))
1604 sampleVec = tile_digits->samples();
1605 int siz = sampleVec.size();
1607 msg(
MSG::DEBUG) <<
"Digits(" << siz <<
")." << (dcnt++) <<
" {";
1609 for (
int i = 0;
i < siz;
i++) {
1613 if (siz > nSamplesInDrawer) {
1620 if (siz > nSamplesInDrawer) siz = nSamplesInDrawer;
1621 std::transform(sampleVec.begin(), sampleVec.begin() + siz, &
m_sampleVec.at(drawerIndex).get()[0] + nSamplesInDrawer *
channel, [] (
float v) {return static_cast<int>(v);});
1629 return StatusCode::FAILURE;
1631 return StatusCode::SUCCESS;
1637 if (containerKey.
empty()) {
1638 return StatusCode::FAILURE;
1644 bool emptyColl =
true;
1649 std::vector<float> sampleVecLo;
1650 std::vector<float> sampleVecHi;
1654 int fragId = digitsCollection->identify();
1657 drawerIndex = (*itr).second;
1662 if (drawerIndex < 0) {
1663 if ( !digitsCollection->empty() )
1664 ATH_MSG_DEBUG(
"FELIX frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing TRC!" );
1669 <<
" FELIX Frag id 0x" << MSG::hex << fragId << MSG::dec
1670 <<
" index " << drawerIndex);
1672 ATH_MSG_DEBUG(
" Size=" << digitsCollection->getFragSize());
1675 <<
" EvBCID=" << digitsCollection->getRODBCID()
1676 <<
" EvType=" << digitsCollection->getDetEvType() );
1677 ATH_MSG_DEBUG(
" Headers = "<< digitsCollection->getFragExtraWords() );
1697 std::vector<uint32_t> extraWords = digitsCollection->getFragExtraWords();
1700 std::reference_wrapper<std::array<int,MAX_MINIDRAWER>>
1707 auto it = extraWords.begin();
1708 for (
int i = 0;
i < 10; ++
i) {
1716 if(!digitsCollection->empty()) {
1721 m_sizeflxVec.at(drawerIndex) = digitsCollection->getFragSize();
1726 for (
const TileDigits* tile_digits : *digitsCollection) {
1732 int index = (
gain == 1) ? drawerIndexHi : drawerIndex;
1742 <<
" index " <<
index );
1746 sampleVecLo = tile_digits->samples();
1747 }
else if (
gain == 1) {
1748 sampleVecHi = tile_digits->samples();
1751 int sizLo = sampleVecLo.size();
1752 int sizHi = sampleVecHi.size();
1758 msg(
MSG::DEBUG) <<
"Low gain Digits(" << sizLo <<
")." << (dcnt++) <<
" {";
1759 for (
int i = 0;
i < sizLo;
i++) {
1763 if (sizLo > nSamplesInDrawer) {
1771 msg(
MSG::DEBUG) <<
"High gain Digits(" << sizHi <<
")." << (dcnt++) <<
" {";
1772 for (
int i = 0;
i < sizHi;
i++) {
1776 if (sizHi > nSamplesInDrawer) {
1785 if (sizLo > nSamplesInDrawer) sizLo = nSamplesInDrawer;
1786 if (sizHi > nSamplesInDrawer) sizHi = nSamplesInDrawer;
1789 sampleVecLo.clear();
1790 sampleVecHi.clear();
1798 return StatusCode::FAILURE;
1800 return StatusCode::SUCCESS;
1811 return StatusCode::FAILURE;
1823 for (
const TileHit& cinp : *hitVec) {
1831 int drawerIndex = ( itr !=
m_drawerMap.end() ) ? (*itr).second : -1;
1833 if (drawerIndex < 0) {
1834 ATH_MSG_WARNING(
"frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing HITS!" );
1842 if (hitVec->empty())
1843 return StatusCode::FAILURE;
1845 return StatusCode::SUCCESS;
1856 return StatusCode::FAILURE;
1865 bool emptyColl =
true;
1871 int fragId = hitCollection->identify();
1873 int drawerIndex = ( itr !=
m_drawerMap.end() ) ? (*itr).second : -1;
1875 if (drawerIndex < 0) {
1876 if ( !hitCollection->empty() )
1877 ATH_MSG_WARNING(
"frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing HITS!" );
1883 <<
" Frag id 0x" << MSG::hex << fragId << MSG::dec
1884 <<
" index " << drawerIndex );
1886 if (emptyColl) emptyColl = hitCollection->empty();
1888 for (
const TileHit* cinp : *hitCollection) {
1895 return StatusCode::FAILURE;
1897 return StatusCode::SUCCESS;
1901 std::array<float, MAX_CHAN>& ehitVec,
1902 std::array<float, MAX_CHAN>& thitVec,
1914 for (
int i = 0;
i <
size; ++
i)
1918 for (
int i = 0;
i <
size; ++
i)
1924 double ehit=0.0, thit=0.0;
1928 double t = cinp->
time(
i);
1930 if (-75.<
t &&
t<75.) {
1953 (
m_TBperiod==2017 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x203))) ||
1954 (
m_TBperiod==2018 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x402))) ||
1955 (
m_TBperiod==2019 && ((fragId&0xFF)<5 && !(fragId == 0x201 || fragId == 0x203 || fragId >= 0x402))) ||
1956 (
m_TBperiod==2022 && ((fragId&0xFF)<4 && !(fragId == 0x201 || (
m_run >= 2210456 && fragId == 0x402)))))
1966 <<
" index " <<
m_drawerMap.find(fragId)->second );
2015 return StatusCode::SUCCESS;
2092 auto tree = std::make_unique<TTree>(
m_ntupleID.value().c_str(),
"TileBEAM-Ntuple");
2126 return StatusCode::SUCCESS;
2132 return StatusCode::FAILURE;
2139 ATH_MSG_DEBUG(
"succeeded retrieving cellContainer from SG" );
2141 ATH_MSG_DEBUG(
"TileTBAANtuple : about to iterate over CaloCells" );
2183 return StatusCode::SUCCESS;
2204 return StatusCode::SUCCESS;
2213 std::vector<unsigned int> frags;
2216 if (!digitsCollection->empty()) {
2218 frags.push_back(digitsCollection->identify());
2221 size = frags.size();
2230 unsigned int rosOrder[5] = { 2, 1, 3, 4, 0 };
2231 unsigned int dr = 0;
2232 char frg[6] =
"0x000";
2238 msg(MSG::INFO) <<
"setting drawerList from data " << MSG::hex;
2239 for (
unsigned int ir = 0;
ir < 5; ++
ir) {
2240 for (
unsigned int i = 0;
i <
size; ++
i) {
2241 unsigned int frag = frags[
i];
2242 if (frag >> 8 == rosOrder[
ir]) {
2243 sprintf(frg,
"0x%3.3x", frag);
2247 msg(MSG::INFO) <<
" 0x" << frag;
2262 msg(MSG::INFO) << MSG::INFO <<
"drawerType ";
2290 if (!digitsCollection->empty()) {
2291 int siz = digitsCollection->front()->samples().size();
2301 return StatusCode::SUCCESS;
2321 return StatusCode::SUCCESS;
2330 std::vector<unsigned int> frags;
2333 if (!digitsCollection->empty()) {
2335 frags.push_back(digitsCollection->identify());
2339 unsigned int nFrags = frags.size();
2350 std::ostringstream
os;
2351 os <<
"setting FELIX drawers from data " << std::hex;
2352 unsigned int drawerIndex = 0;
2353 for (
unsigned int frag : frags) {
2355 os <<
" 0x" << frag;
2369 ATH_MSG_ERROR(
"can't find any FELIX TileDigits collections" );
2370 ATH_MSG_ERROR(
"can't set up FELIX fragment list for ntuple" );
2379 if (!digitsCollection->empty()) {
2380 int siz = digitsCollection->front()->samples().size();
2390 return StatusCode::SUCCESS;
2414 std::ifstream etafile;
2417 if (etafile.good()) {
2485 if (nDrawersAll > 0) {
2486 m_l1ID.resize(nDrawersAll + 1);
2558 for(
unsigned i=0;
i<33; ++
i){
m_qdc[
i]=0.0; }
2618 for(
unsigned i=0;
i<33; ++
i){
m_qdc[
i]=0.0; }
2767 for (
int j = 1; j < 16; j++) {
2859 m_btdc =
new std::vector<std::vector<int> >(16);
3003 for (
int i=0;
i<16;
i+=2) {
3008 for (
int i=0;
i<16;
i+=2) {
3013 for (
int i=0;
i<16;
i+=2) {
3019 for (std::vector<int>& btdc_amplitudes : *
m_btdc) {
3020 btdc_amplitudes.clear();
3174 std::ostringstream oss;
3176 std::string nSampStr=oss.str();
3182 std::string
digit[10] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9" };
3183 std::vector<std::string> suffixArr;
3190 suffixArr.resize(
length);
3192 for (
unsigned int i = 0;
i < listSize; ++
i) {
3199 }
else if (testbeam) {
3208 suff.replace(
suff.find(
"0x"), 2,
"");
3209 suffixArr[
i] =
suff +
"lo";
3219 suffixArr.resize(
length);
3221 for (
unsigned int i = 0;
i < listSize; ++
i) {
3228 }
else if (testbeam) {
3237 suff.replace(
suff.find(
"0x"), 2,
"");
3238 suffixArr[
i] =
suff;
3252 for (
unsigned int i = 0;
i <
length;
i++) {
3259 nSamplesInDrawer =
it->second;
3263 m_bcidVec.push_back(std::array<int, MAX_DMU>());
3275 m_gainVec.push_back(std::array<int, MAX_CHAN>());
3277 m_feCRCVec.push_back(std::array<int, MAX_DMU>());
3278 m_rodCRCVec.push_back(std::array<int, MAX_DMU>());
3280 m_eneVec.push_back(std::array<float, MAX_CHAN>());
3281 m_timeVec.push_back(std::array<float, MAX_CHAN>());
3285 m_efitVec.push_back(std::array<float, MAX_CHAN>());
3286 m_tfitVec.push_back(std::array<float, MAX_CHAN>());
3287 m_pedfitVec.push_back(std::array<float, MAX_CHAN>());
3288 m_chi2Vec.push_back(std::array<float, MAX_CHAN>());
3290 m_efitcVec.push_back(std::array<float, MAX_CHAN>());
3291 m_tfitcVec.push_back(std::array<float, MAX_CHAN>());
3293 m_chi2cVec.push_back(std::array<float, MAX_CHAN>());
3295 m_eOptVec.push_back(std::array<float, MAX_CHAN>());
3296 m_tOptVec.push_back(std::array<float, MAX_CHAN>());
3297 m_pedOptVec.push_back(std::array<float, MAX_CHAN>());
3300 m_eDspVec.push_back(std::array<float, MAX_CHAN>());
3301 m_tDspVec.push_back(std::array<float, MAX_CHAN>());
3317 m_ntuplePtr->Branch((
"Evt"+suffixArr[
i]).c_str(), &
m_evtVec.data()[
i], (
"Evt"+suffixArr[
i]+
"/I").c_str());
3320 m_ntuplePtr->Branch((
"BCID"+suffixArr[
i]).c_str(), &
m_bcidVec.back(), (
"bcid"+suffixArr[
i]+
"[16]/I").c_str());
3333 m_ntuplePtr->Branch((
"Gain"+suffixArr[
i]).c_str(),&
m_gainVec.back(), (
"gain"+suffixArr[
i]+
"[48]/I").c_str());
3335 if (nSamplesInDrawer > 0) {
3338 (
"sample" + suffixArr[
i] +
"[48]["+nSampStr+
"]/I").c_str());
3342 m_ntuplePtr->Branch((
"feCRC" + suffixArr[
i]).c_str(), &
m_feCRCVec.back(), (
"fe_crc" + suffixArr[
i] +
"[16]/I").c_str());
3343 m_ntuplePtr->Branch((
"rodCRC" + suffixArr[
i]).c_str(), &
m_rodCRCVec.back(), (
"rod_crc" + suffixArr[
i] +
"[16]/I").c_str());
3348 m_ntuplePtr->Branch((
"Ene" + suffixArr[
i]).c_str(), &
m_eneVec.back(), (
"ene" + suffixArr[
i] +
"[48]/F").c_str());
3349 m_ntuplePtr->Branch((
"Time" + suffixArr[
i]).c_str(), &
m_timeVec.back(), (
"time" + suffixArr[
i] +
"[48]/F").c_str());
3350 m_ntuplePtr->Branch((
"Ped" + suffixArr[
i]).c_str(), &
m_pedFlatVec.back(), (
"pedflat" + suffixArr[
i] +
"[48]/F").c_str());
3351 m_ntuplePtr->Branch((
"Chi2ene" + suffixArr[
i]).c_str(), &
m_chi2FlatVec.back(), (
"chiflat" + suffixArr[
i] +
"[48]/F").c_str());
3357 m_ntuplePtr->Branch((
"Efit" + suffixArr[
i]).c_str(), &
m_efitVec.back(), (
"efit" + suffixArr[
i] +
"[48]/F").c_str());
3358 m_ntuplePtr->Branch((
"Tfit" + suffixArr[
i]).c_str(), &
m_tfitVec.back(), (
"tfit" + suffixArr[
i] +
"[48]/F").c_str());
3359 m_ntuplePtr->Branch((
"Pedfit" + suffixArr[
i]).c_str(), &
m_pedfitVec.back(), (
"pedfit" + suffixArr[
i] +
"[48]/F").c_str());
3360 m_ntuplePtr->Branch((
"Chi2fit" + suffixArr[
i]).c_str(), &
m_chi2Vec.back(), (
"chifit" + suffixArr[
i] +
"[48]/F").c_str());
3366 m_ntuplePtr->Branch((
"Efitc" + suffixArr[
i]).c_str(), &
m_efitcVec.back(), (
"efitc" + suffixArr[
i] +
"[48]/F").c_str());
3367 m_ntuplePtr->Branch((
"Tfitc" + suffixArr[
i]).c_str(), &
m_tfitcVec.back(), (
"tfitc" + suffixArr[
i] +
"[48]/F").c_str());
3368 m_ntuplePtr->Branch((
"Pedfitc" + suffixArr[
i]).c_str(), &
m_pedfitcVec.back(), (
"pedfitc" + suffixArr[
i] +
"[48]/F").c_str());
3369 m_ntuplePtr->Branch((
"Chi2fitc" + suffixArr[
i]).c_str(), &
m_chi2cVec.back(), (
"chifitc" + suffixArr[
i] +
"[48]/F").c_str());
3375 m_ntuplePtr->Branch((
"Eopt"+suffixArr[
i]).c_str(), &
m_eOptVec.back(), (
"eOpt"+suffixArr[
i]+
"[48]/F").c_str());
3376 m_ntuplePtr->Branch((
"Topt"+suffixArr[
i]).c_str(), &
m_tOptVec.back(), (
"tOpt"+suffixArr[
i]+
"[48]/F").c_str());
3377 m_ntuplePtr->Branch((
"Pedopt"+suffixArr[
i]).c_str(), &
m_pedOptVec.back(), (
"pedOpt"+suffixArr[
i]+
"[48]/F").c_str());
3384 m_ntuplePtr->Branch((
"Edsp"+suffixArr[
i]).c_str(), &
m_eDspVec.back(), (
"eDsp"+suffixArr[
i]+
"[48]/F").c_str());
3385 m_ntuplePtr->Branch((
"Tdsp"+suffixArr[
i]).c_str(), &
m_tDspVec.back(), (
"tDsp"+suffixArr[
i]+
"[48]/F").c_str());
3497 std::vector<std::string> suffixArr(
length,
"");
3500 for (
const std::pair<const unsigned int, unsigned int>& fragAndDrawer :
m_drawerFlxMap) {
3501 unsigned int frag = fragAndDrawer.first;
3502 unsigned int ros = frag >> 8;
3503 unsigned int drawer = frag & 0x3F;
3504 unsigned int drawerIndex = fragAndDrawer.second;
3506 std::ostringstream drawerName;
3509 drawerName << (
drawer & 7);
3512 drawerName << std::setw(2) << std::setfill(
'0') <<
drawer;
3515 moduleNames.at(drawerIndex) = drawerName.str();
3516 suffixArr.at(drawerIndex) = drawerName.str() +
"lo";
3517 suffixArr.at(drawerIndex +
m_nDrawersFlx) = drawerName.str() +
"hi";
3533 for (
unsigned int i = 0;
i <
length; ++
i) {
3559 std::string
suffix = moduleNames[
i];
3589 if (nSamplesInDrawer > 0) {
3592 (
"Flxsample" + suffixArr[
i] +
"[48]["+nSampStrFlx+
"]/I").c_str());
3667 std::string
digit[10] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9" };
3668 std::vector<std::string> suffixArr;
3673 suffixArr.resize(
length);
3675 for (
unsigned int i = 0;
i < listSize; ++
i) {
3682 }
else if (testbeam) {
3691 suff.replace(
suff.find(
"0x"), 2,
"");
3692 suffixArr[
i] =
suff;
3698 for (
unsigned int i = 0;
i <
length;
i++) {
3703 m_ehitVec.push_back(std::array<float, MAX_CHAN>());
3704 m_thitVec.push_back(std::array<float, MAX_CHAN>());
3705 m_ehitCnt.push_back(std::array<float, MAX_CHAN>());
3706 m_thitCnt.push_back(std::array<float, MAX_CHAN>());
3715 m_ntuplePtr->Branch((
"EhitG4"+suffixArr[
i]).c_str(),&
m_ehitVec.back(),(
"eHitG4"+suffixArr[
i]+
"[48]/F").c_str());
3716 m_ntuplePtr->Branch((
"ThitG4"+suffixArr[
i]).c_str(),&
m_thitVec.back(),(
"tHitG4"+suffixArr[
i]+
"[48]/F").c_str());
3722 ATH_MSG_DEBUG(
"Adding G4 corrected hit info for " << suffixArr[
i] );
3724 m_ntuplePtr->Branch((
"EhitSim"+suffixArr[
i]).c_str(),&
m_ehitCnt.back(),(
"eHitSim"+suffixArr[
i]+
"[48]/F").c_str());
3725 m_ntuplePtr->Branch((
"ThitSim"+suffixArr[
i]).c_str(),&
m_thitCnt.back(),(
"tHitSim"+suffixArr[
i]+
"[48]/F").c_str());
3745 template<
typename T>
3750 template<
typename T,
size_t N>
3752 for (std::array<T,N>& arr :
vec) {
3753 std::fill(arr.begin(), arr.end(),
static_cast<T>(-1));
3757 template<
typename T,
size_t N>
3759 for (std::array<T,N>& arr :
vec) {
3760 std::fill(arr.begin(), arr.end(),
static_cast<T>(0));
3766 for (
unsigned int i = 0;
i <
vec.size(); ++
i) {