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)
85 , m_ntupleCreated(false)
105 , m_las_D1_Ped_RMS(0.0)
106 , m_las_D2_Ped_RMS(0.0)
107 , m_las_D3_Ped_RMS(0.0)
108 , m_las_D4_Ped_RMS(0.0)
109 , m_las_D1_Alpha(0.0)
110 , m_las_D2_Alpha(0.0)
111 , m_las_D3_Alpha(0.0)
112 , m_las_D4_Alpha(0.0)
113 , m_las_D1_Alpha_RMS(0.0)
114 , m_las_D2_Alpha_RMS(0.0)
115 , m_las_D3_Alpha_RMS(0.0)
116 , m_las_D4_Alpha_RMS(0.0)
117 , m_las_D1_AlphaPed(0.0)
118 , m_las_D2_AlphaPed(0.0)
119 , m_las_D3_AlphaPed(0.0)
120 , m_las_D4_AlphaPed(0.0)
121 , m_las_D1_AlphaPed_RMS(0.0)
122 , m_las_D2_AlphaPed_RMS(0.0)
123 , m_las_D3_AlphaPed_RMS(0.0)
124 , m_las_D4_AlphaPed_RMS(0.0)
129 , m_las_PMT1_Ped(0.0)
130 , m_las_PMT2_Ped(0.0)
131 , m_las_PMT1_Ped_RMS(0.0)
132 , m_las_PMT2_Ped_RMS(0.0)
133 , m_las_Temperature(0.0)
187 , m_calibrateEnergyThisEvent(false)
192 char frg[6] =
"0x000";
198 sprintf(frg,
"0x%3.3x",
i);
232 return StatusCode::SUCCESS;
347 if (
sc.isFailure()) {
349 return StatusCode::FAILURE;
359 ATH_MSG_INFO(
"Final offline units are not set, will use DSP units" );
365 ATH_MSG_INFO(
"calibrateEnergy is disabled, don't want to use DSP units" );
378 msg(MSG::INFO) <<
"drawerList " << MSG::hex;
385 msg(MSG::INFO) <<
" 0x" << frag;
399 msg(MSG::INFO) <<
" - negative number, will read frag IDs from the data" << MSG::dec <<
endmsg;
401 msg(MSG::INFO) <<
"is empty, no drawer fragments in ntuple" << MSG::dec <<
endmsg;
412 msg(MSG::INFO) << MSG::INFO <<
"drawerType ";
423 msg(MSG::INFO) << MSG::INFO <<
"Beam Frag List " << MSG::hex;
429 msg(MSG::INFO) <<
" 0x" << frag;
433 msg(MSG::INFO) <<
"is empty, no beam fragments in ntuple" << MSG::dec <<
endmsg;
465 return StatusCode::SUCCESS;
470 const EventContext& ctx = Gaudi::Hive::currentContext();
496 m_run = ctx.eventID().run_number();
497 m_evt = ctx.eventID().event_number();
500 if (ctx.eventID().time_stamp() > 0) {
501 m_evTime = ctx.eventID().time_stamp();
554 return StatusCode::SUCCESS;
565 return StatusCode::FAILURE;
629 return StatusCode::SUCCESS;
635 return StatusCode::SUCCESS;
647 if ( collItr!=lastColl ) {
648 m_l1ID.at(nDrawersAll) = (*collItr)->getLvl1Id();
649 m_l1Type.at(nDrawersAll) = (*collItr)->getLvl1Type();
650 m_evType.at(nDrawersAll) = (*collItr)->getDetEvType();
651 m_evBCID.at(nDrawersAll) = (*collItr)->getRODBCID();
653 m_l1ID.at(nDrawersAll) = 0xFFFFFFFF;
654 m_l1Type.at(nDrawersAll) = 0xFFFFFFFF;
655 m_evType.at(nDrawersAll) = 0xFFFFFFFF;
656 m_evBCID.at(nDrawersAll) = 0xFFFFFFFF;
663 for(; collItr != lastColl; ++collItr) {
670 for (; beamItr != lastBeam; ++beamItr) {
672 std::vector<uint32_t> digits = (*beamItr)->get_digits();
674 << MSG::hex <<
" frag: 0x" << (*collItr)->identify()
676 <<
" digits size " << digits.size() <<
endmsg;
678 for (
unsigned int k = 0;
k < digits.size();
k++)
683 beamItr = (*collItr)->begin();
686 int frag = (*collItr)->identify();
690 if (
m_trigType == 0 && (*collItr)->getLvl1Type() != 0 )
696 for (; beamItr != lastBeam; ++beamItr) {
699 std::vector<uint32_t> digits = (*beamItr)->get_digits();
701 int dsize = digits.size();
728 if(cha < 8)
m_btdc1[cha] = amplitude;
729 else if(cha < 16)
m_btdc2[cha-8] = amplitude;
738 case 0:
m_s1cou = amplitude;
break;
739 case 1:
m_s2cou = amplitude;
break;
740 case 2:
m_s3cou = amplitude;
break;
741 case 3:
m_cher1 = amplitude;
break;
742 case 4:
m_cher2 = amplitude;
break;
743 case 5:
m_muTag = amplitude;
break;
751 case 0:
m_s1cou = amplitude;
break;
752 case 1:
m_s2cou = amplitude;
break;
753 case 2:
m_s3cou = amplitude;
break;
754 case 3:
m_cher1 = amplitude;
break;
755 case 4:
m_muTag = amplitude;
break;
756 case 5:
m_cher2 = amplitude;
break;
760 case 8:
m_las0 = amplitude;
break;
761 case 9:
m_las1 = amplitude;
break;
762 case 10:
m_las2 = amplitude;
break;
763 case 11:
m_las3 = amplitude;
break;
773 case 0:
m_sc1 = amplitude;
break;
774 case 1:
m_sc2 = amplitude;
break;
789 if(cha < 14)
m_muBack[cha] = amplitude;
791 else if (cha < 16)
m_muCalib[cha - 14] = amplitude;
798 if(cha < 6)
m_muBack[cha + 8] = amplitude;
800 else if (cha < 8)
m_muCalib[cha - 6] = amplitude;
809 if (amplitude & 0xFF00)
m_trigType = amplitude >> 8;
819 case 0:
m_las0 = amplitude;
break;
820 case 1:
m_las1 = amplitude;
break;
821 case 2:
m_las2 = amplitude;
break;
822 case 3:
m_las3 = amplitude;
break;
835 for (
int k = 0;
k < dsize;
k++) {
854 m_qdc[cha] = amplitude;
856 }
else if (cha == 15) {
866 if(cha < 8)
m_ecal[cha] = amplitude;
874 if(cha < 16)
m_cispar[cha] = amplitude;
881 if (
m_run > 2211444) {
884 case 0:
m_s1cou = amplitude;
break;
885 case 1:
m_s2cou = amplitude;
break;
887 if (
m_run < 2310000) {
894 case 3:
m_cher1 = amplitude;
break;
895 case 4:
m_cher2 = amplitude;
break;
896 case 5:
m_cher3 = amplitude;
break;
897 default:
m_muBack[cha - 6] = amplitude;
902 case 0:
m_s1cou = amplitude;
break;
903 case 1:
m_s2cou = amplitude;
break;
904 case 2:
m_s3cou = amplitude;
break;
905 case 3:
m_cher1 = amplitude;
break;
906 case 4:
m_cher2 = amplitude;
break;
907 case 5:
m_cher3 = amplitude;
break;
916 case 0:
m_s1cou = amplitude;
break;
917 case 1:
m_s2cou = amplitude;
break;
918 case 2:
m_s3cou = amplitude;
break;
919 case 3:
m_muTag = amplitude;
break;
920 case 4:
m_cher1 = amplitude;
break;
921 case 5:
m_cher2 = amplitude;
break;
956 if (
m_run > 2310000 && cha < 16) {
958 }
else if (cha == 0) {
970 m_tof[cha] = amplitude;
982 m_tof[cha] = amplitude;
989 if(cha < 8)
m_tof[cha] = amplitude;
997 if ((cha > 11) && (cha < 16) && (
m_run > 2211136)) {
998 m_tof[cha] = amplitude;
1006 (*m_btdc)[cha].push_back(amplitude);
1014 if(cha < 16)
m_btdc2[cha] = amplitude;
1022 for (
int ibit = 0; ibit < 32; ++ibit){
1025 }
else if (cha == 3) {
1035 for (
int ibit=0; ibit < 32; ++ibit){
1038 }
else if (cha == 3) {
1048 for (
int ibit = 0; ibit < 32; ++ibit){
1051 }
else if (cha == 3) {
1061 for (
int ibit = 0; ibit < 32; ++ibit){
1064 }
else if (cha == 3) {
1074 for (
int ibit = 0; ibit < 32; ++ibit){
1077 }
else if (cha == 3) {
1087 for (
int ibit = 0; ibit < 32; ++ibit){
1090 }
else if (cha == 3) {
1100 for (
int ibit = 0; ibit < 32; ++ibit){
1103 }
else if (cha == 3) {
1113 for (
int ibit = 0; ibit < 32; ++ibit){
1116 }
else if (cha == 3) {
1130 for (
int i=0;
i<8; ++
i) {
1146 if (
m_run > 2211444) {
1162 if (
m_run > 2211444) {
1188 if (
m_run > 2211444) {
1253 ATH_MSG_ERROR(
"No EventInfo object found! Can't read run number!" );
1280 return StatusCode::SUCCESS;
1292 , std::vector<std::array<float, MAX_CHAN>>* eneVec
1293 , std::vector<std::array<float, MAX_CHAN>>* timeVec
1294 , std::vector<std::array<float, MAX_CHAN>>* chi2Vec
1295 , std::vector<std::array<float, MAX_CHAN>>* pedVec
1296 ,
bool saveDQstatus)
1300 if (containerKey.
empty()) {
1301 return StatusCode::FAILURE;
1304 bool isFELIX = containerKey.
key().find(
"Flx") != std::string::npos;
1323 ATH_MSG_ERROR(
"RawChannel units are not ADC counts, can't apply DSP-like calibration" );
1324 return StatusCode::FAILURE;
1340 int drawerIndex, fragType;
1345 int fragId = rawChannelCollection->identify();
1349 if ( itr != drawerMap.end() ) {
1350 drawerIndex = (*itr).second;
1355 if (drawerIndex < 0) {
1356 if ( !rawChannelCollection->empty() )
1357 ATH_MSG_DEBUG(
"frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing TRC!" );
1359 fragType = isFELIX ? fragId >> 8 :
m_drawerType[drawerIndex];
1362 <<
" Frag id 0x" << MSG::hex << fragId << MSG::dec
1363 <<
" index "<< drawerIndex );
1367 int index = drawerIndex;
1380 double energy = rch->amplitude();
1392 (
m_TBperiod==2017 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x203))) ||
1393 (
m_TBperiod==2018 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x402))) ||
1394 (
m_TBperiod==2019 && ((fragId&0xFF)<5 && !(fragId == 0x201 || fragId == 0x203 || fragId >= 0x402))) ||
1395 (
m_TBperiod==2022 && ((fragId&0xFF)<4 && !(fragId == 0x201 || (
m_run >= 2210456 && fragId == 0x402)))))
1409 <<
" time=" << rch->time()
1410 <<
" chi2=" << rch->quality()
1411 <<
" ped=" << rch->pedestal()
1413 <<
" index " <<
index );
1417 if (saveDQstatus && !isFELIX) {
1428 for (
unsigned int dmu = 0; dmu <
MAX_DMU; ++dmu) {
1442 return StatusCode::SUCCESS;
1453 if (containerKey.
empty()) {
1454 return StatusCode::FAILURE;
1460 bool emptyColl =
true;
1463 int drawerIndex, fragType,
channel;
1465 std::vector<float> sampleVec;
1466 std::vector<uint32_t> headerVec;
1467 std::vector<uint32_t> headerVecHi;
1475 int fragId = digitsCollection->identify();
1476 int ros = (fragId >> 8);
1477 int drawer = fragId & 0x3F;
1481 drawerIndex = (*itr).second;
1486 if (drawerIndex < 0) {
1487 if ( !digitsCollection->empty() )
1488 ATH_MSG_DEBUG(
"frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing TRC!" );
1494 <<
" Frag id 0x" << MSG::hex << fragId << MSG::dec
1495 <<
" index " << drawerIndex
1499 <<
" BCID=" << digitsCollection->getFragBCID()<<MSG::hex
1500 <<
" CRC=0x" << (digitsCollection->getFragCRC()&0xffff)
1501 <<
" DMUMask=0x" << (digitsCollection->getFragDMUMask()&0xffff)<<MSG::dec );
1504 <<
" Lvl1Type=" << digitsCollection->getLvl1Type()
1505 <<
" EvBCID=" << digitsCollection->getRODBCID()
1506 <<
" EvType=" << digitsCollection->getDetEvType() );
1508 ATH_MSG_DEBUG(
" Header=" << digitsCollection->getFragChipHeaderWords() );
1515 m_l1ID.at(drawerIndex) = digitsCollection->getLvl1Id();
1516 m_l1Type.at(drawerIndex) = digitsCollection->getLvl1Type();
1517 m_evType.at(drawerIndex) = digitsCollection->getDetEvType();
1518 m_evBCID.at(drawerIndex) = digitsCollection->getRODBCID();
1520 m_frBCID.at(drawerIndex) = digitsCollection->getFragBCID();
1528 int drawerIndexHi = drawerIndex +
m_nDrawers;
1530 if (!digitsCollection->empty()) {
1533 m_rodBCIDVec.at(drawerIndex) = digitsCollection->getRODBCID();
1534 m_sizeVec.at(drawerIndex) = digitsCollection->getFragSize();
1535 m_sizeVec.at(drawerIndexHi) = digitsCollection->getFragSize();
1539 headerVec = digitsCollection->getFragChipHeaderWords();
1540 headerVecHi = digitsCollection->getFragChipHeaderWordsHigh();
1541 CRCmask = digitsCollection->getFragDMUMask();
1542 fe_crc = CRCmask & 0xFFFF;
1543 rod_crc = CRCmask >> 16;
1545 unsigned int headsize =
std::min(16U,
static_cast<unsigned int>(headerVec.size()));
1546 unsigned int headsizehi =
std::min(16U,
static_cast<unsigned int>(headerVecHi.size()));
1548 for (
unsigned int ih = 0; ih < headsize; ++ih) {
1550 m_bcidVec.at(drawerIndex)[ih] = (headerVec[ih] & 0xFFF);
1557 m_feCRCVec.at(drawerIndex)[ih] = (fe_crc >> ih & 0x1);
1558 m_rodCRCVec.at(drawerIndex)[ih] = (rod_crc >> ih & 0x1);
1566 for (
unsigned int ihhi = 0; ihhi < headsizehi; ++ihhi) {
1567 m_bcidVec.at(drawerIndexHi)[ihhi] = (headerVecHi[ihhi] & 0xFFF);
1583 m_slinkCRCVec.at(drawerIndex)[0] = (digitsCollection->getFragCRC() >> 16) & 0xffff;
1584 m_dmuMaskVec.at(drawerIndex)[0] = (digitsCollection->getFragDMUMask() >> 16) & 0xffff;
1585 m_slinkCRCVec.at(drawerIndex)[1] = digitsCollection->getFragCRC() & 0xffff;
1586 m_dmuMaskVec.at(drawerIndex)[1] = digitsCollection->getFragDMUMask() & 0xffff;
1588 m_slinkCRCVec.at(drawerIndexHi)[0] = (digitsCollection->getFragCRC() >> 16) & 0xffff;
1589 m_dmuMaskVec.at(drawerIndexHi)[0] = (digitsCollection->getFragDMUMask() >> 16) & 0xffff;
1590 m_slinkCRCVec.at(drawerIndexHi)[1] = digitsCollection->getFragCRC() & 0xffff;
1591 m_dmuMaskVec.at(drawerIndexHi)[1] = digitsCollection->getFragDMUMask() & 0xffff;
1594 for (
const TileDigits* tile_digits : *digitsCollection) {
1602 int index = (
gain == 1) ? drawerIndexHi : drawerIndex;
1612 (
m_TBperiod==2017 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x203))) ||
1613 (
m_TBperiod==2018 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x402))) ||
1614 (
m_TBperiod==2019 && ((fragId&0xFF)<5 && !(fragId == 0x201 || fragId == 0x203 || fragId >= 0x402))) ||
1615 (
m_TBperiod==2022 && ((fragId&0xFF)<4 && !(fragId == 0x201 || (
m_run >= 2210456 && fragId == 0x402)))))
1625 <<
" index " <<
index );
1628 sampleVec = tile_digits->samples();
1629 int siz = sampleVec.size();
1632 msg(
MSG::DEBUG) <<
"Digits(" << siz <<
")." << (dcnt++) <<
" {";
1633 for (
int i = 0;
i < siz;
i++) {
1637 if (siz > nSamplesInDrawer) {
1644 if (siz > nSamplesInDrawer) siz = nSamplesInDrawer;
1651 m_rodBCIDVec.at(drawerIndex) = digitsCollection->getRODBCID();
1652 m_sizeVec.at(drawerIndex) = digitsCollection->getFragSize();
1655 headerVec = digitsCollection->getFragChipHeaderWords();
1656 CRCmask = digitsCollection->getFragDMUMask();
1657 fe_crc = CRCmask & 0xFFFF;
1658 rod_crc = CRCmask >> 16;
1660 int headsize = headerVec.size();
1662 for (
int ih = 0; ih < headsize; ++ih) {
1663 m_bcidVec.at(drawerIndex)[ih] = (headerVec[ih] & 0xFFF);
1670 m_feCRCVec.at(drawerIndex)[ih] = (fe_crc >> ih & 0x1);
1671 m_rodCRCVec.at(drawerIndex)[ih] = (rod_crc >> ih & 0x1);
1679 m_slinkCRCVec.at(drawerIndex)[0] = (digitsCollection->getFragCRC() >> 16) & 0xffff;
1680 m_dmuMaskVec.at(drawerIndex)[0] = (digitsCollection->getFragDMUMask() >> 16) & 0xffff;
1681 m_slinkCRCVec.at(drawerIndex)[1] = digitsCollection->getFragCRC() & 0xffff;
1682 m_dmuMaskVec.at(drawerIndex)[1] = digitsCollection->getFragDMUMask() & 0xffff;
1688 for (
const TileDigits* tile_digits : *digitsCollection) {
1698 (
m_TBperiod==2017 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x203))) ||
1699 (
m_TBperiod==2018 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x402))) ||
1700 (
m_TBperiod==2019 && ((fragId&0xFF)<5 && !(fragId == 0x201 || fragId == 0x203 || fragId >= 0x402))) ||
1701 (
m_TBperiod==2022 && ((fragId&0xFF)<4 && !(fragId == 0x201 || (
m_run >= 2210456 && fragId == 0x402)))))
1711 sampleVec = tile_digits->samples();
1712 int siz = sampleVec.size();
1714 msg(
MSG::DEBUG) <<
"Digits(" << siz <<
")." << (dcnt++) <<
" {";
1716 for (
int i = 0;
i < siz;
i++) {
1720 if (siz > nSamplesInDrawer) {
1727 if (siz > nSamplesInDrawer) siz = nSamplesInDrawer;
1728 std::transform(sampleVec.begin(), sampleVec.begin() + siz, &
m_sampleVec.at(drawerIndex).get()[0] + nSamplesInDrawer *
channel, [] (
float v) {return static_cast<int>(v);});
1736 return StatusCode::FAILURE;
1738 return StatusCode::SUCCESS;
1744 if (containerKey.
empty()) {
1745 return StatusCode::FAILURE;
1751 bool emptyColl =
true;
1756 std::vector<float> sampleVecLo;
1757 std::vector<float> sampleVecHi;
1761 int fragId = digitsCollection->identify();
1764 drawerIndex = (*itr).second;
1769 if (drawerIndex < 0) {
1770 if ( !digitsCollection->empty() )
1771 ATH_MSG_DEBUG(
"FELIX frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing TRC!" );
1776 <<
" FELIX Frag id 0x" << MSG::hex << fragId << MSG::dec
1777 <<
" index " << drawerIndex);
1779 ATH_MSG_DEBUG(
" Size=" << digitsCollection->getFragSize());
1782 <<
" EvBCID=" << digitsCollection->getRODBCID()
1783 <<
" EvType=" << digitsCollection->getDetEvType() );
1784 ATH_MSG_DEBUG(
" Headers = "<< digitsCollection->getFragExtraWords() );
1804 std::vector<uint32_t> extraWords = digitsCollection->getFragExtraWords();
1807 std::reference_wrapper<std::array<int,MAX_MINIDRAWER>>
1814 auto it = extraWords.begin();
1815 for (
int i = 0;
i < 10; ++
i) {
1823 if(!digitsCollection->empty()) {
1828 m_sizeflxVec.at(drawerIndex) = digitsCollection->getFragSize();
1833 for (
const TileDigits* tile_digits : *digitsCollection) {
1839 int index = (
gain == 1) ? drawerIndexHi : drawerIndex;
1849 <<
" index " <<
index );
1853 sampleVecLo = tile_digits->samples();
1854 }
else if (
gain == 1) {
1855 sampleVecHi = tile_digits->samples();
1858 int sizLo = sampleVecLo.size();
1859 int sizHi = sampleVecHi.size();
1865 msg(
MSG::DEBUG) <<
"Low gain Digits(" << sizLo <<
")." << (dcnt++) <<
" {";
1866 for (
int i = 0;
i < sizLo;
i++) {
1870 if (sizLo > nSamplesInDrawer) {
1878 msg(
MSG::DEBUG) <<
"High gain Digits(" << sizHi <<
")." << (dcnt++) <<
" {";
1879 for (
int i = 0;
i < sizHi;
i++) {
1883 if (sizHi > nSamplesInDrawer) {
1892 if (sizLo > nSamplesInDrawer) sizLo = nSamplesInDrawer;
1893 if (sizHi > nSamplesInDrawer) sizHi = nSamplesInDrawer;
1896 sampleVecLo.clear();
1897 sampleVecHi.clear();
1905 return StatusCode::FAILURE;
1907 return StatusCode::SUCCESS;
1918 return StatusCode::FAILURE;
1930 for (
const TileHit& cinp : *hitVec) {
1938 int drawerIndex = ( itr !=
m_drawerMap.end() ) ? (*itr).second : -1;
1940 if (drawerIndex < 0) {
1941 ATH_MSG_WARNING(
"frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing HITS!" );
1949 if (hitVec->empty())
1950 return StatusCode::FAILURE;
1952 return StatusCode::SUCCESS;
1963 return StatusCode::FAILURE;
1972 bool emptyColl =
true;
1978 int fragId = hitCollection->identify();
1980 int drawerIndex = ( itr !=
m_drawerMap.end() ) ? (*itr).second : -1;
1982 if (drawerIndex < 0) {
1983 if ( !hitCollection->empty() )
1984 ATH_MSG_WARNING(
"frag id 0x" << MSG::hex << fragId << MSG::dec <<
" was not found among valid frag IDs when storing HITS!" );
1990 <<
" Frag id 0x" << MSG::hex << fragId << MSG::dec
1991 <<
" index " << drawerIndex );
1993 if (emptyColl) emptyColl = hitCollection->empty();
1995 for (
const TileHit* cinp : *hitCollection) {
2002 return StatusCode::FAILURE;
2004 return StatusCode::SUCCESS;
2008 std::array<float, MAX_CHAN>& ehitVec,
2009 std::array<float, MAX_CHAN>& thitVec,
2021 for (
int i = 0;
i <
size; ++
i)
2025 for (
int i = 0;
i <
size; ++
i)
2031 double ehit=0.0, thit=0.0;
2035 double t = cinp->
time(
i);
2037 if (-75.<
t &&
t<75.) {
2060 (
m_TBperiod==2017 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x203))) ||
2061 (
m_TBperiod==2018 && ((fragId&0xFF)<4 && !(fragId == 0x201 || fragId == 0x402))) ||
2062 (
m_TBperiod==2019 && ((fragId&0xFF)<5 && !(fragId == 0x201 || fragId == 0x203 || fragId >= 0x402))) ||
2063 (
m_TBperiod==2022 && ((fragId&0xFF)<4 && !(fragId == 0x201 || (
m_run >= 2210456 && fragId == 0x402)))))
2073 <<
" index " <<
m_drawerMap.find(fragId)->second );
2122 return StatusCode::SUCCESS;
2199 auto tree = std::make_unique<TTree>(
m_ntupleID.value().c_str(),
"TileBEAM-Ntuple");
2233 return StatusCode::SUCCESS;
2239 return StatusCode::FAILURE;
2246 ATH_MSG_DEBUG(
"succeeded retrieving cellContainer from SG" );
2248 ATH_MSG_DEBUG(
"TileTBAANtuple : about to iterate over CaloCells" );
2290 return StatusCode::SUCCESS;
2311 return StatusCode::SUCCESS;
2320 std::vector<unsigned int> frags;
2323 if (!digitsCollection->empty()) {
2325 frags.push_back(digitsCollection->identify());
2328 size = frags.size();
2337 unsigned int rosOrder[5] = { 2, 1, 3, 4, 0 };
2338 unsigned int dr = 0;
2339 char frg[6] =
"0x000";
2345 msg(MSG::INFO) <<
"setting drawerList from data " << MSG::hex;
2346 for (
unsigned int ir = 0;
ir < 5; ++
ir) {
2347 for (
unsigned int i = 0;
i <
size; ++
i) {
2348 unsigned int frag = frags[
i];
2349 if (frag >> 8 == rosOrder[
ir]) {
2350 sprintf(frg,
"0x%3.3x", frag);
2354 msg(MSG::INFO) <<
" 0x" << frag;
2369 msg(MSG::INFO) << MSG::INFO <<
"drawerType ";
2397 if (!digitsCollection->empty()) {
2398 int siz = digitsCollection->front()->samples().size();
2408 return StatusCode::SUCCESS;
2428 return StatusCode::SUCCESS;
2437 std::vector<unsigned int> frags;
2440 if (!digitsCollection->empty()) {
2442 frags.push_back(digitsCollection->identify());
2446 unsigned int nFrags = frags.size();
2457 std::ostringstream
os;
2458 os <<
"setting FELIX drawers from data " << std::hex;
2459 unsigned int drawerIndex = 0;
2460 for (
unsigned int frag : frags) {
2462 os <<
" 0x" << frag;
2476 ATH_MSG_ERROR(
"can't find any FELIX TileDigits collections" );
2477 ATH_MSG_ERROR(
"can't set up FELIX fragment list for ntuple" );
2486 if (!digitsCollection->empty()) {
2487 int siz = digitsCollection->front()->samples().size();
2497 return StatusCode::SUCCESS;
2521 std::ifstream etafile;
2524 if (etafile.good()) {
2592 if (nDrawersAll > 0) {
2593 m_l1ID.resize(nDrawersAll + 1);
2665 for(
unsigned i=0;
i<33; ++
i){
m_qdc[
i]=0.0; }
2725 for(
unsigned i=0;
i<33; ++
i){
m_qdc[
i]=0.0; }
2874 for (
int j = 1; j < 16; j++) {
2966 m_btdc =
new std::vector<std::vector<int> >(16);
3110 for (
int i=0;
i<16;
i+=2) {
3115 for (
int i=0;
i<16;
i+=2) {
3120 for (
int i=0;
i<16;
i+=2) {
3126 for (std::vector<int>& btdc_amplitudes : *
m_btdc) {
3127 btdc_amplitudes.clear();
3281 std::ostringstream oss;
3283 std::string nSampStr=oss.str();
3289 std::string
digit[10] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9" };
3290 std::vector<std::string> suffixArr;
3297 suffixArr.resize(
length);
3299 for (
unsigned int i = 0;
i < listSize; ++
i) {
3306 }
else if (testbeam) {
3315 suff.replace(suff.find(
"0x"), 2,
"");
3316 suffixArr[
i] = suff +
"lo";
3326 suffixArr.resize(
length);
3328 for (
unsigned int i = 0;
i < listSize; ++
i) {
3335 }
else if (testbeam) {
3344 suff.replace(suff.find(
"0x"), 2,
"");
3345 suffixArr[
i] = suff;
3359 for (
unsigned int i = 0;
i <
length;
i++) {
3366 nSamplesInDrawer =
it->second;
3370 m_bcidVec.push_back(std::array<int, MAX_DMU>());
3382 m_gainVec.push_back(std::array<int, MAX_CHAN>());
3384 m_feCRCVec.push_back(std::array<int, MAX_DMU>());
3385 m_rodCRCVec.push_back(std::array<int, MAX_DMU>());
3387 m_eneVec.push_back(std::array<float, MAX_CHAN>());
3388 m_timeVec.push_back(std::array<float, MAX_CHAN>());
3392 m_efitVec.push_back(std::array<float, MAX_CHAN>());
3393 m_tfitVec.push_back(std::array<float, MAX_CHAN>());
3394 m_pedfitVec.push_back(std::array<float, MAX_CHAN>());
3395 m_chi2Vec.push_back(std::array<float, MAX_CHAN>());
3397 m_efitcVec.push_back(std::array<float, MAX_CHAN>());
3398 m_tfitcVec.push_back(std::array<float, MAX_CHAN>());
3400 m_chi2cVec.push_back(std::array<float, MAX_CHAN>());
3402 m_eOptVec.push_back(std::array<float, MAX_CHAN>());
3403 m_tOptVec.push_back(std::array<float, MAX_CHAN>());
3404 m_pedOptVec.push_back(std::array<float, MAX_CHAN>());
3407 m_eDspVec.push_back(std::array<float, MAX_CHAN>());
3408 m_tDspVec.push_back(std::array<float, MAX_CHAN>());
3424 m_ntuplePtr->Branch((
"Evt"+suffixArr[
i]).c_str(), &
m_evtVec.data()[
i], (
"Evt"+suffixArr[
i]+
"/I").c_str());
3427 m_ntuplePtr->Branch((
"BCID"+suffixArr[
i]).c_str(), &
m_bcidVec.back(), (
"bcid"+suffixArr[
i]+
"[16]/I").c_str());
3440 m_ntuplePtr->Branch((
"Gain"+suffixArr[
i]).c_str(),&
m_gainVec.back(), (
"gain"+suffixArr[
i]+
"[48]/I").c_str());
3442 if (nSamplesInDrawer > 0) {
3445 (
"sample" + suffixArr[
i] +
"[48]["+nSampStr+
"]/I").c_str());
3449 m_ntuplePtr->Branch((
"feCRC" + suffixArr[
i]).c_str(), &
m_feCRCVec.back(), (
"fe_crc" + suffixArr[
i] +
"[16]/I").c_str());
3450 m_ntuplePtr->Branch((
"rodCRC" + suffixArr[
i]).c_str(), &
m_rodCRCVec.back(), (
"rod_crc" + suffixArr[
i] +
"[16]/I").c_str());
3455 m_ntuplePtr->Branch((
"Ene" + suffixArr[
i]).c_str(), &
m_eneVec.back(), (
"ene" + suffixArr[
i] +
"[48]/F").c_str());
3456 m_ntuplePtr->Branch((
"Time" + suffixArr[
i]).c_str(), &
m_timeVec.back(), (
"time" + suffixArr[
i] +
"[48]/F").c_str());
3457 m_ntuplePtr->Branch((
"Ped" + suffixArr[
i]).c_str(), &
m_pedFlatVec.back(), (
"pedflat" + suffixArr[
i] +
"[48]/F").c_str());
3458 m_ntuplePtr->Branch((
"Chi2ene" + suffixArr[
i]).c_str(), &
m_chi2FlatVec.back(), (
"chiflat" + suffixArr[
i] +
"[48]/F").c_str());
3464 m_ntuplePtr->Branch((
"Efit" + suffixArr[
i]).c_str(), &
m_efitVec.back(), (
"efit" + suffixArr[
i] +
"[48]/F").c_str());
3465 m_ntuplePtr->Branch((
"Tfit" + suffixArr[
i]).c_str(), &
m_tfitVec.back(), (
"tfit" + suffixArr[
i] +
"[48]/F").c_str());
3466 m_ntuplePtr->Branch((
"Pedfit" + suffixArr[
i]).c_str(), &
m_pedfitVec.back(), (
"pedfit" + suffixArr[
i] +
"[48]/F").c_str());
3467 m_ntuplePtr->Branch((
"Chi2fit" + suffixArr[
i]).c_str(), &
m_chi2Vec.back(), (
"chifit" + suffixArr[
i] +
"[48]/F").c_str());
3473 m_ntuplePtr->Branch((
"Efitc" + suffixArr[
i]).c_str(), &
m_efitcVec.back(), (
"efitc" + suffixArr[
i] +
"[48]/F").c_str());
3474 m_ntuplePtr->Branch((
"Tfitc" + suffixArr[
i]).c_str(), &
m_tfitcVec.back(), (
"tfitc" + suffixArr[
i] +
"[48]/F").c_str());
3475 m_ntuplePtr->Branch((
"Pedfitc" + suffixArr[
i]).c_str(), &
m_pedfitcVec.back(), (
"pedfitc" + suffixArr[
i] +
"[48]/F").c_str());
3476 m_ntuplePtr->Branch((
"Chi2fitc" + suffixArr[
i]).c_str(), &
m_chi2cVec.back(), (
"chifitc" + suffixArr[
i] +
"[48]/F").c_str());
3482 m_ntuplePtr->Branch((
"Eopt"+suffixArr[
i]).c_str(), &
m_eOptVec.back(), (
"eOpt"+suffixArr[
i]+
"[48]/F").c_str());
3483 m_ntuplePtr->Branch((
"Topt"+suffixArr[
i]).c_str(), &
m_tOptVec.back(), (
"tOpt"+suffixArr[
i]+
"[48]/F").c_str());
3484 m_ntuplePtr->Branch((
"Pedopt"+suffixArr[
i]).c_str(), &
m_pedOptVec.back(), (
"pedOpt"+suffixArr[
i]+
"[48]/F").c_str());
3491 m_ntuplePtr->Branch((
"Edsp"+suffixArr[
i]).c_str(), &
m_eDspVec.back(), (
"eDsp"+suffixArr[
i]+
"[48]/F").c_str());
3492 m_ntuplePtr->Branch((
"Tdsp"+suffixArr[
i]).c_str(), &
m_tDspVec.back(), (
"tDsp"+suffixArr[
i]+
"[48]/F").c_str());
3604 std::vector<std::string> suffixArr(
length,
"");
3607 for (
const std::pair<const unsigned int, unsigned int>& fragAndDrawer :
m_drawerFlxMap) {
3608 unsigned int frag = fragAndDrawer.first;
3609 unsigned int ros = frag >> 8;
3610 unsigned int drawer = frag & 0x3F;
3611 unsigned int drawerIndex = fragAndDrawer.second;
3613 std::ostringstream drawerName;
3616 drawerName << (
drawer & 7);
3619 drawerName << std::setw(2) << std::setfill(
'0') <<
drawer;
3622 moduleNames.at(drawerIndex) = drawerName.str();
3623 suffixArr.at(drawerIndex) = drawerName.str() +
"lo";
3624 suffixArr.at(drawerIndex +
m_nDrawersFlx) = drawerName.str() +
"hi";
3640 for (
unsigned int i = 0;
i <
length; ++
i) {
3666 std::string
suffix = moduleNames[
i];
3696 if (nSamplesInDrawer > 0) {
3699 (
"Flxsample" + suffixArr[
i] +
"[48]["+nSampStrFlx+
"]/I").c_str());
3774 std::string
digit[10] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9" };
3775 std::vector<std::string> suffixArr;
3780 suffixArr.resize(
length);
3782 for (
unsigned int i = 0;
i < listSize; ++
i) {
3789 }
else if (testbeam) {
3798 suff.replace(suff.find(
"0x"), 2,
"");
3799 suffixArr[
i] = suff;
3805 for (
unsigned int i = 0;
i <
length;
i++) {
3810 m_ehitVec.push_back(std::array<float, MAX_CHAN>());
3811 m_thitVec.push_back(std::array<float, MAX_CHAN>());
3812 m_ehitCnt.push_back(std::array<float, MAX_CHAN>());
3813 m_thitCnt.push_back(std::array<float, MAX_CHAN>());
3822 m_ntuplePtr->Branch((
"EhitG4"+suffixArr[
i]).c_str(),&
m_ehitVec.back(),(
"eHitG4"+suffixArr[
i]+
"[48]/F").c_str());
3823 m_ntuplePtr->Branch((
"ThitG4"+suffixArr[
i]).c_str(),&
m_thitVec.back(),(
"tHitG4"+suffixArr[
i]+
"[48]/F").c_str());
3829 ATH_MSG_DEBUG(
"Adding G4 corrected hit info for " << suffixArr[
i] );
3831 m_ntuplePtr->Branch((
"EhitSim"+suffixArr[
i]).c_str(),&
m_ehitCnt.back(),(
"eHitSim"+suffixArr[
i]+
"[48]/F").c_str());
3832 m_ntuplePtr->Branch((
"ThitSim"+suffixArr[
i]).c_str(),&
m_thitCnt.back(),(
"tHitSim"+suffixArr[
i]+
"[48]/F").c_str());
3852 template<
typename T>
3857 template<
typename T,
size_t N>
3859 for (std::array<T,N>& arr :
vec) {
3860 std::fill(arr.begin(), arr.end(),
static_cast<T>(-1));
3864 template<
typename T,
size_t N>
3866 for (std::array<T,N>& arr :
vec) {
3867 std::fill(arr.begin(), arr.end(),
static_cast<T>(0));
3873 for (
unsigned int i = 0;
i <
vec.size(); ++
i) {