diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileHid2RESrcID.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileHid2RESrcID.h index e56b3165d90af499e378eb99f1cf597f473d852d..4866c9c427485260e850378783c72a7c9adf9291 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileHid2RESrcID.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileHid2RESrcID.h @@ -1,9 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -#ifndef __TILEHID2RESRCID__ -#define __TILEHID2RESRCID__ +#ifndef TILEBYTESTREAM_TILEHID2RESRCID_H +#define TILEBYTESTREAM_TILEHID2RESRCID_H #include "eformat/FullEventFragment.h" @@ -44,6 +44,7 @@ public: MsgStream & log); void setROD2ROBmap (const eformat::FullEventFragment<const uint32_t*> * event, + bool& of2Default, MsgStream & log); /** make a ROB SrcID for a fragment ID diff --git a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileROD_Decoder.h b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileROD_Decoder.h index 80c0af4e63ff67e6535712833e01b276b9c57ebb..fc282b654ac63b1a47c0817ec4f3fe9c0165139b 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileROD_Decoder.h +++ b/TileCalorimeter/TileSvc/TileByteStream/TileByteStream/TileROD_Decoder.h @@ -398,14 +398,25 @@ class TileROD_Decoder: public AthAlgTool { /**/ - inline void make_copy(const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, + inline void make_copy(uint32_t bsflags, + TileFragHash::TYPE rChType, + TileRawChannelUnit::UNIT rChUnit, + const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, TileBeamElemCollection& v) const; - inline void make_copy(const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, + inline void make_copy(uint32_t bsflags, + TileFragHash::TYPE rChType, + TileRawChannelUnit::UNIT rChUnit, + const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, TileDigitsCollection& v) const; - inline void make_copy(const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, + inline void make_copy(uint32_t bsflags, + TileFragHash::TYPE rChType, + TileRawChannelUnit::UNIT rChUnit, + const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, TileRawChannelCollection& v) const; - uint32_t make_copyHLT(pFRwChVec & pChannel, TileCellCollection& v, const uint16_t DQuality, + uint32_t make_copyHLT(bool of2, + TileRawChannelUnit::UNIT rChUnit, + pFRwChVec & pChannel, TileCellCollection& v, const uint16_t DQuality, D0CellsHLT& d0cells); inline void make_copy(const ROBData * rob, pBeamVec & pBeam, TileBeamElemCollection& v) const; @@ -485,11 +496,7 @@ class TileROD_Decoder: public AthAlgTool { TileFragHash m_hashFunc; - // RawChannels units and type (taken from BS frag type - TileFragHash::TYPE m_rChType; - TileRawChannelUnit::UNIT m_rChUnit; - uint32_t m_bsflags; - bool m_of2; + bool m_of2Default; // TileRawChannelContainer TileRawChannelContainer * m_container; @@ -620,7 +627,10 @@ inline void TileROD_Decoder::copy_vec(std::vector<ELEMENT *> & v, COLLECTION & c } inline -void TileROD_Decoder::make_copy(const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, +void TileROD_Decoder::make_copy(uint32_t /*bsflags*/, + TileFragHash::TYPE /*rChType*/, + TileRawChannelUnit::UNIT /*rChUnit*/, + const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, TileDigitsCollection & v) const { copy_vec(pDigits, v); // Digits stored @@ -665,18 +675,21 @@ void TileROD_Decoder::make_copy(const ROBData * rob, pDigiVec & pDigits, pRwChVe } inline -void TileROD_Decoder::make_copy(const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, +void TileROD_Decoder::make_copy(uint32_t bsflags, + TileFragHash::TYPE rChType, + TileRawChannelUnit::UNIT rChUnit, + const ROBData * rob, pDigiVec & pDigits, pRwChVec & pChannel, TileRawChannelCollection & v) const { if (pChannel.size() > 0) { // take available raw channels // and store in collection if (m_container) { - ATH_MSG_VERBOSE( "RawChannel unit is " << m_rChUnit + ATH_MSG_VERBOSE( "RawChannel unit is " << rChUnit << " - setting unit in TileRawChannelContainer " ); - m_container->set_unit(m_rChUnit); - m_container->set_type(m_rChType); - m_container->set_bsflags(m_bsflags); + m_container->set_unit(rChUnit); + m_container->set_type(rChType); + m_container->set_bsflags(bsflags); } else { - ATH_MSG_ERROR( "Can't set unit=" << m_rChUnit << " in TileRawChannelContainer" ); + ATH_MSG_ERROR( "Can't set unit=" << rChUnit << " in TileRawChannelContainer" ); } copy_vec(pChannel, v); @@ -709,7 +722,7 @@ void TileROD_Decoder::make_copy(const ROBData * rob, pDigiVec & pDigits, pRwChVe v.setDetEvType(rob->rod_detev_type()); v.setRODBCID(rob->rod_bc_id()); - if (m_rChUnit < TileRawChannelUnit::OnlineOffset && m_rChType > TileFragHash::OptFilterDsp) { // set good status for BS from MC + if (rChUnit < TileRawChannelUnit::OnlineOffset && rChType > TileFragHash::OptFilterDsp) { // set good status for BS from MC m_rawchannelMetaData[0]->push_back(0); m_rawchannelMetaData[0]->push_back(0xDEAD); m_rawchannelMetaData[5]->push_back(0xFFFF); @@ -744,7 +757,10 @@ void TileROD_Decoder::make_copy(const ROBData * rob, pDigiVec & pDigits, pRwChVe } inline -void TileROD_Decoder::make_copy(const ROBData * /* rob */, pDigiVec & pDigits +void TileROD_Decoder::make_copy(uint32_t /*bsflags*/, + TileFragHash::TYPE /*rChType*/, + TileRawChannelUnit::UNIT /*rChUnit*/, + const ROBData * /* rob */, pDigiVec & pDigits , pRwChVec & pChannel, TileBeamElemCollection &) const { // do nothing delete_vec(pDigits); @@ -952,6 +968,10 @@ void TileROD_Decoder::fillCollection(const ROBData * rob, COLLECTION & v) { std::vector<const uint32_t *>::const_iterator it = pFrag.begin(); std::vector<const uint32_t *>::const_iterator itEnd = pFrag.end(); + uint32_t bsflags = 0; + TileFragHash::TYPE rChType = TileFragHash::Digitizer; + TileRawChannelUnit::UNIT rChUnit = TileRawChannelUnit::ADCcounts; + for (; it != itEnd; ++it) { p = (*it); @@ -981,7 +1001,7 @@ void TileROD_Decoder::fillCollection(const ROBData * rob, COLLECTION & v) { break; case 4: if (m_useFrag4) { - m_bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest + bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest int unit = (idAndType & 0xC0000000) >> 30; int DataType = (idAndType & 0x30000000) >> 28; @@ -990,23 +1010,22 @@ void TileROD_Decoder::fillCollection(const ROBData * rob, COLLECTION & v) { // only one bit for type and next 2 bits for number of iterations //int AlgoType = (idAndType & 0x4000000) >> 26; - //if (AlgoType == 0) m_rChType = TileFragHash::OF1Filter; - //else m_rChType = TileFragHash::OF2Filter; + //if (AlgoType == 0) rChType = TileFragHash::OF1Filter; + //else rChType = TileFragHash::OF2Filter; // always set special type, which means now that OF is done inside DSP - m_rChType = TileFragHash::OptFilterDsp; - m_of2 = ((idAndType & 0x4000000) != 0); + rChType = TileFragHash::OptFilterDsp; // Attention! Switching to Online Units for release 14.2.0 - m_rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); // Online units in real data - // m_rChUnit = (TileRawChannelUnit::UNIT) ( unit ); + rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); // Online units in real data + // rChUnit = (TileRawChannelUnit::UNIT) ( unit ); } else { // simulated data // all 3 bits for type int AlgoType = (idAndType & 0x7000000) >> 24; - m_rChType = (TileFragHash::TYPE) AlgoType; + rChType = (TileFragHash::TYPE) AlgoType; - m_rChUnit = (TileRawChannelUnit::UNIT) (unit); // Offline units in simulated data + rChUnit = (TileRawChannelUnit::UNIT) (unit); // Offline units in simulated data } unpack_frag4(version, unit, p, pChannel); @@ -1015,14 +1034,13 @@ void TileROD_Decoder::fillCollection(const ROBData * rob, COLLECTION & v) { case 5: if (m_useFrag5Raw || m_useFrag5Reco) { - m_bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest + bsflags = idAndType & 0xFFFF0000; // ignore frag num, keep all the rest int unit = (idAndType & 0xC0000000) >> 30; // always set special type, which means now that OF is done inside DSP - m_rChType = TileFragHash::OptFilterDspCompressed; - m_of2 = ((idAndType & 0x4000000) != 0); + rChType = TileFragHash::OptFilterDspCompressed; - m_rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); + rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); unpack_frag5(version, unit, p, pDigits, pChannel); } break; @@ -1043,7 +1061,7 @@ void TileROD_Decoder::fillCollection(const ROBData * rob, COLLECTION & v) { } } // end of all frags - make_copy(rob, pDigits, pChannel, v); + make_copy(bsflags, rChType, rChUnit, rob, pDigits, pChannel, v); } return; diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileHid2RESrcID.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileHid2RESrcID.cxx index 7913dfdbf379a87f06020a9094105f48c56cab29..0a255c81f76d1e8636ec577cec5e618ad7930679 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileHid2RESrcID.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileHid2RESrcID.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #include <iostream> @@ -192,6 +192,7 @@ void TileHid2RESrcID::setROD2ROBmap(const std::vector<std::string> & ROD2ROB, } void TileHid2RESrcID::setROD2ROBmap (const eformat::FullEventFragment<const uint32_t*> * event, + bool& of2Default, MsgStream & log) { MSG::Level logLevel = log.level(); @@ -590,10 +591,10 @@ void TileHid2RESrcID::setROD2ROBmap (const eformat::FullEventFragment<const uint << " instead of " << rodDecoder->m_timeMaxThresh << endmsg; rodDecoder->m_timeMaxThresh = cellBuilder->m_timeMaxThresh; } - if (of2 != rodDecoder->m_of2) { + if (of2 != of2Default) { log << MSG::INFO << "Setting OF2 flag in in TileROD_Decoder to " << ((of2)?"True":"False") - << " instead of " << ((rodDecoder->m_of2)?"True":"False") << endmsg; - rodDecoder->m_of2 = of2; + << " instead of " << ((of2Default)?"True":"False") << endmsg; + of2Default = of2; } } diff --git a/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx b/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx index 5fc16e6a7a75b246a1793376e5ef5a9743636867..12e67b4acb965134369ca76fb256ca9c3f604447 100644 --- a/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx +++ b/TileCalorimeter/TileSvc/TileByteStream/src/TileROD_Decoder.cxx @@ -93,10 +93,7 @@ TileROD_Decoder::TileROD_Decoder(const std::string& type, const std::string& nam m_sizeOverhead = 2; // 2 extra words in every frag by default (frag id + frag size) // but for all data after 2005 it is set to 3 later in the code - m_of2 = true; - m_rChType = TileFragHash::Digitizer; - m_rChUnit = TileRawChannelUnit::ADCcounts; - m_bsflags = 0; + m_of2Default = true; m_container = 0; m_MBTS = NULL; m_cell2Double.reserve(23); // Maximum number of cells in a drawer @@ -2914,16 +2911,19 @@ void TileROD_Decoder::fillCollectionL2(const ROBData * rob, TileL2Container & v) m_sizeOverhead = 2; } } - + + int DataType = 0; while (wc < size) { // iterator over all words in a ROD // first word is frag size uint32_t count = *(p); // second word is frag ID and frag type - int frag = *(p + 1) & 0xFFFF; + uint32_t idAndType = *(p + 1); + int frag = idAndType & 0xFFFF; if (frag < fragmin) fragmin = frag; if (frag > fragmax) fragmax = frag; - + DataType = (idAndType & 0x30000000) >> 28; + int type = (*(p + 1) >> 16) & 0xFF; if (count < m_sizeOverhead || count > size - wc) { @@ -3006,7 +3006,7 @@ void TileROD_Decoder::fillCollectionL2(const ROBData * rob, TileL2Container & v) // return; } - if (m_rChUnit < TileRawChannelUnit::OnlineOffset && counter == 0 && m_L2Builder) { + if (DataType >= 3 && counter == 0 && m_L2Builder) { if (m_L2Builder->process(fragmin, fragmax, &v).isFailure()) { ATH_MSG_ERROR( "Failure in " << m_L2Builder ); return; @@ -3237,6 +3237,8 @@ uint32_t TileROD_Decoder::fillCollectionHLT(const ROBData * rob, TileCellCollect m_sizeOverhead = 2; } } + bool of2 = m_of2Default; + TileRawChannelUnit::UNIT rChUnit = TileRawChannelUnit::ADCcounts; uint16_t DQuality = 0x0; bool fragFound = false; bool DQfragMissing = true; @@ -3304,16 +3306,16 @@ uint32_t TileROD_Decoder::fillCollectionHLT(const ROBData * rob, TileCellCollect if (DataType < 3) { // real data - m_of2 = ((idAndType & 0x4000000) != 0); + of2 = ((idAndType & 0x4000000) != 0); int nIter = (idAndType & 0x3000000) >> 24; m_correctAmplitude = (!nIter); // automatic detection of nIter - m_rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); // Online units in real data + rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); // Online units in real data } else { // simulated data DQfragMissing = false; m_correctAmplitude = false; - m_rChUnit = (TileRawChannelUnit::UNIT) (unit); // Offline units in simulated data + rChUnit = (TileRawChannelUnit::UNIT) (unit); // Offline units in simulated data } unpack_frag4HLT(version, unit, p, m_pRwChVec); @@ -3325,9 +3327,9 @@ uint32_t TileROD_Decoder::fillCollectionHLT(const ROBData * rob, TileCellCollect fragFound = true; int unit = (idAndType & 0xC0000000) >> 30; - m_of2 = ((idAndType & 0x4000000) != 0); + of2 = ((idAndType & 0x4000000) != 0); m_correctAmplitude = true; // fragment 5 will appear only if there is no iterations, so correction required - m_rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); + rChUnit = (TileRawChannelUnit::UNIT) (unit + TileRawChannelUnit::OnlineOffset); unpack_frag5HLT(version, unit, p, m_pRwChVec); } @@ -3351,13 +3353,15 @@ uint32_t TileROD_Decoder::fillCollectionHLT(const ROBData * rob, TileCellCollect if (fragFound) { if (masked_drawer) DQuality = 0x0; - error |= make_copyHLT(m_pRwChVec, v, DQuality, d0cells); + error |= make_copyHLT(of2, rChUnit, m_pRwChVec, v, DQuality, d0cells); } else if (!masked_drawer) error |= 0x20000; return error; } -uint32_t TileROD_Decoder::make_copyHLT(pFRwChVec & pChannel, TileCellCollection & v, +uint32_t TileROD_Decoder::make_copyHLT(bool of2, + TileRawChannelUnit::UNIT rChUnit, + pFRwChVec & pChannel, TileCellCollection & v, const uint16_t DQuality, D0CellsHLT& d0cells) { typedef pFRwChVec::iterator ITERATOR; @@ -3376,7 +3380,7 @@ uint32_t TileROD_Decoder::make_copyHLT(pFRwChVec & pChannel, TileCellCollection int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer); unsigned int channelIdx; unsigned int adcIdx; - bool recalibrate = (m_rChUnit != TileRawChannelUnit::OnlineMegaElectronVolts && m_rChUnit != TileRawChannelUnit::MegaElectronVolts); + bool recalibrate = (rChUnit != TileRawChannelUnit::OnlineMegaElectronVolts && rChUnit != TileRawChannelUnit::MegaElectronVolts); int sec = ros - 1; // 0-3 for barrel +/- and EB +/- @@ -3422,7 +3426,7 @@ uint32_t TileROD_Decoder::make_copyHLT(pFRwChVec & pChannel, TileCellCollection // FIXME:: To speed up HLT processing we keep OnlineMegaElectronVolts // but this means that we can end up with different units (online or offline) if (recalibrate && ener!=0.0F) { - ener = m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, ener, m_rChUnit, + ener = m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, ener, rChUnit, TileRawChannelUnit::MegaElectronVolts); } // parabolic correction for good but slightly out-of-time signals @@ -3433,7 +3437,7 @@ uint32_t TileROD_Decoder::make_copyHLT(pFRwChVec & pChannel, TileCellCollection } else if (ener > m_ampMinThresh_MeV && time > m_timeMinThresh && time < m_timeMaxThresh) { - ener *= TileRawChannelBuilder::correctAmp(time,m_of2); + ener *= TileRawChannelBuilder::correctAmp(time,of2); } } } else { @@ -3479,7 +3483,7 @@ uint32_t TileROD_Decoder::make_copyHLT(pFRwChVec & pChannel, TileCellCollection // FIXME:: To speed up HLT processing we keep OnlineMegaElectronVolts // but this means that we can end up with different units (online or offline) if (recalibrate && ener!=0.0F) { - ener = m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, ener, m_rChUnit, + ener = m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, ener, rChUnit, TileRawChannelUnit::MegaElectronVolts); } // parabolic correction for good but slightly out-of-time signals @@ -3490,7 +3494,7 @@ uint32_t TileROD_Decoder::make_copyHLT(pFRwChVec & pChannel, TileCellCollection } else if (ener > m_ampMinThresh_MeV && time > m_timeMinThresh && time < m_timeMaxThresh) { - ener *= TileRawChannelBuilder::correctAmp(time,m_of2); + ener *= TileRawChannelBuilder::correctAmp(time,of2); } } if (pCell->time() != -100.0F) pCell->setTime(time, m_Rw2Pmt[sec][idxraw]); @@ -3532,12 +3536,12 @@ uint32_t TileROD_Decoder::make_copyHLT(pFRwChVec & pChannel, TileCellCollection float time = rawPtr->time(); float qual = rawPtr->quality(); if (qual < QUALITY_THRESHOLD) { - if (m_rChUnit==TileRawChannelUnit::MegaElectronVolts) { // go back to pC - not standard configuration + if (rChUnit==TileRawChannelUnit::MegaElectronVolts) { // go back to pC - not standard configuration ener /= m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, 1.0, // calibrate to PicoCoulombs - TileRawChannelUnit::PicoCoulombs, m_rChUnit); + TileRawChannelUnit::PicoCoulombs, rChUnit); } else { ener = m_tileToolEmscale->channelCalib(drawerIdx, channelIdx, adcIdx, ener, // calibrate to PicoCoulombs - m_rChUnit, TileRawChannelUnit::PicoCoulombs); + rChUnit, TileRawChannelUnit::PicoCoulombs); } // parabolic correction for good but slightly out-of-time signals if (m_correctAmplitude) { @@ -3547,7 +3551,7 @@ uint32_t TileROD_Decoder::make_copyHLT(pFRwChVec & pChannel, TileCellCollection } else if (ener > m_ampMinThresh_pC && time > m_timeMinThresh && time < m_timeMaxThresh) { - ener *= TileRawChannelBuilder::correctAmp(time,m_of2); + ener *= TileRawChannelBuilder::correctAmp(time,of2); } } } else { @@ -3995,11 +3999,11 @@ void TileROD_Decoder::initHid2re() { const eformat::FullEventFragment<const uint32_t*> * event = robSvc->getEvent(); try { event->check_tree(); - m_hid2re->setROD2ROBmap(event, msg()); + m_hid2re->setROD2ROBmap(event, m_of2Default, msg()); } catch (...) { ATH_MSG_DEBUG( "Bad event, mapping might be incomplete! " ); // bad event, but process anyhow (well, till next bug report ) - m_hid2re->setROD2ROBmap(event, msg()); + m_hid2re->setROD2ROBmap(event, m_of2Default, msg()); } } } else if (vecProperty.value().size() == 0) {