diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx index 731fb4f559dff7f0b347fc4cb4122acdb58036a8..7e4df370d109d3754fd68706651c8b2d407e5a54 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.cxx @@ -35,8 +35,6 @@ SCT_CalibEventInfo::SCT_CalibEventInfo(const std::string &name, ISvcLocator * sv m_LBBegin(INTMAX), m_LBEnd(INTMIN), m_numLB(0), - m_numUOFO(0), - m_numUOFOth(10), m_source("UNKNOWN"), m_runNumber(0), m_eventNumber(0), @@ -52,10 +50,7 @@ SCT_CalibEventInfo::initialize() { msg( MSG::INFO)<<"Initialize of evtInfo in "<<PACKAGE_VERSION<<endmsg; ATH_CHECK(m_eventInfoKey.initialize()); const int pri(500); - m_incidentSvc->addListener( this, "BeginRun", pri, true, true ); - m_incidentSvc->addListener( this, "UnknownOfflineId", pri, true ); m_incidentSvc->addListener( this, "BeginEvent", pri, true ); - m_incidentSvc->addListener( this, "EndEvent", pri, true ); return StatusCode::SUCCESS; } @@ -80,7 +75,7 @@ int SCT_CalibEventInfo::lumiBlock() const { } void -SCT_CalibEventInfo::handle(const Incident &inc) { +SCT_CalibEventInfo::handle(const Incident&) { if ( m_source == "BS" ) { SG::ReadHandle<EventInfo> evt(m_eventInfoKey); @@ -89,32 +84,6 @@ SCT_CalibEventInfo::handle(const Incident &inc) { return; } - //listening for the Unknown offlineId for OfflineId..." error. - //count number of instances/event - if (inc.type() == "UnknownOfflineId") { - incrementUOFO(); - } - - //at the beginning of each run do a print put - if (inc.type() == "BeginRun") { - msg(MSG:: INFO) << "BeginRun is HERE" << endmsg; - } - - //at the beginning of each event set the counter to 0 - if (inc.type() == "BeginEvent") { - resetUOFO(); - } - - //at the end end of each event, if there are more than m_numUOFOth instances - //(default is 10) of the error, skip the event - if (inc.type() == "EndEvent") { - int nUOFO = UOFO(); - if (nUOFO > m_numUOFOth) { - msg ( MSG::DEBUG ) << " More than " << m_numUOFOth <<" Id ROD failures, skipping event" << endmsg; - m_incidentSvc->fireIncident(Incident(name(), "SkipEvent")); - } - } - const EventInfo* evt_ptr = &(*evt); msg( MSG::VERBOSE ) << SCT_CalibAlgs::eventInfoAsString(evt_ptr) << endmsg; //--- TimeStamp/LB range analyzed @@ -213,22 +182,6 @@ SCT_CalibEventInfo::incrementCounter() { ++m_counter; } -int -SCT_CalibEventInfo::UOFO() const { - return m_numUOFO; -} - -void -SCT_CalibEventInfo::incrementUOFO() { - ++m_numUOFO; -} - -void -SCT_CalibEventInfo::resetUOFO() { - m_numUOFO=0; -} - - void SCT_CalibEventInfo::setCounter(const int counterVal) { m_counter=counterVal; diff --git a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h index 89c7526aef6065798b68fd7e60743cfef27efa4b..843066c3b855a77e82ba5aa429a02fdfb7dec4f0 100644 --- a/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h +++ b/InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo.h @@ -53,8 +53,6 @@ class SCT_CalibEventInfo: virtual public ISCT_CalibEvtInfo, public AthService { virtual void setBunchCrossing(const int bc); virtual void setCounter(const int counterVal); virtual void incrementCounter(); - virtual void incrementUOFO(); - virtual void resetUOFO(); virtual void getTimeStamps(int & begin, int & end) const; virtual void getTimeStamps(std::string & begin, std::string & end) const; @@ -63,7 +61,6 @@ class SCT_CalibEventInfo: virtual public ISCT_CalibEvtInfo, public AthService { virtual int lumiBlock() const; virtual int runNumber() const; virtual int counter() const; - virtual int UOFO() const; virtual int numLumiBlocks() const; //@} @@ -81,8 +78,6 @@ class SCT_CalibEventInfo: virtual public ISCT_CalibEvtInfo, public AthService { int m_LBBegin; int m_LBEnd; int m_numLB; - int m_numUOFO; - int m_numUOFOth; std::string m_source; // diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiDetectorElement.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiDetectorElement.h index 8f967fbfaae480960b8e3b68d0ebcc100772613c..4d4956e08a488c56859902fc08f81d21553c3b44 100755 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiDetectorElement.h +++ b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/SiDetectorElement.h @@ -944,6 +944,7 @@ namespace InDetDD { inline bool SiDetectorElement::swapPhiReadoutDirection() const { + if (m_firstTime) updateCache(); // In order to set m_phiDirection // equivalent to (m_design->swapHitPhiReadoutDirection() xor !m_phiDirection) return ((!m_design->swapHitPhiReadoutDirection() && !m_phiDirection) || (m_design->swapHitPhiReadoutDirection() && m_phiDirection)); @@ -951,6 +952,7 @@ namespace InDetDD { inline bool SiDetectorElement::swapEtaReadoutDirection() const { + if (m_firstTime) updateCache(); // In order to set m_etaDirection // equivalent to (m_design->swapHitEtaReadoutDirection() xor !m_etaDirection) return ((!m_design->swapHitEtaReadoutDirection() && !m_etaDirection) || (m_design->swapHitEtaReadoutDirection() && m_etaDirection)); diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCT_RodDecoder.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCT_RodDecoder.h index 93eda7f6dfe22bed0a2251951dc1ac54141caec0..0fd05400e0f5d9501f1da41738f0b668adc6247d 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCT_RodDecoder.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCT_RodDecoder.h @@ -42,7 +42,7 @@ class ISCT_RodDecoder : virtual public IAlgTool { ISCT_RDO_Container&, InDetBSErrContainer* errs, SCT_ByteStreamFractionContainer* bsFracCont, - std::vector<IdentifierHash>* vec=0) = 0; + const std::vector<IdentifierHash>* vec=nullptr) const = 0; }; #endif //SCT_RAWDATABYTESTREAM_ISCT_RODDECODER_H diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx index 8020f77925126b27c0c934c4721d222111f80c37..cfebfaf2f283534e0a030cc2c753c51d485af2f1 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx @@ -7,17 +7,14 @@ //Athena #include "ByteStreamData/RawEvent.h" #include "InDetIdentifier/SCT_ID.h" +#include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "StoreGate/ReadCondHandle.h" - -//Gaudi -#include "GaudiKernel/IIncidentSvc.h" +#include "InDetReadoutGeometry/SiDetectorElementCollection.h" //STL +#include <algorithm> #include <deque> -#include <vector> #include <utility> -#include <algorithm> union RawWord { uint32_t word32; @@ -29,8 +26,6 @@ SCT_RodDecoder::SCT_RodDecoder (const std::string& type, const std::string& name,const IInterface* parent) : base_class(type, name, parent), m_sct_id{nullptr}, - m_condensedMode{false}, - m_superCondensedMode{false}, m_singleCondHitNumber{0}, m_pairedCondHitNumber{0}, m_firstExpHitNumber{0}, @@ -60,16 +55,13 @@ SCT_RodDecoder::SCT_RodDecoder m_truncatedRODNumber{0}, m_numMissingLinkHeader{0}, m_numUnknownOfflineId{0}, - m_incidentSvc{"IncidentSvc", name} + m_swapPhiReadoutDirection{} { - declareProperty("TriggerMode", m_triggerMode=true); } StatusCode SCT_RodDecoder::initialize() { ATH_CHECK(AlgTool::initialize()); - ATH_CHECK(m_incidentSvc.retrieve()); - /** Retrieve cabling tool */ ATH_CHECK(m_cabling.retrieve()); ATH_MSG_DEBUG("Retrieved tool " << m_cabling); @@ -79,8 +71,19 @@ StatusCode SCT_RodDecoder::initialize() { ATH_CHECK(m_configTool.retrieve()); - // Initialize ReadCondHandleKey - ATH_CHECK(m_SCTDetEleCollKey.initialize()); + // See if strip numbers go from 0 to 767 or vice versa for all the wafers. + // swapPhiReadoutDirection will not change during a run. + // Since this is access to SiDetectorElement during initialization, + // condition object of SiDetectorElementCollection is not accessible. + // SCT_DetectorManager has to be used. + const InDetDD::SCT_DetectorManager* detManager{nullptr}; + ATH_CHECK(detStore()->retrieve(detManager, "SCT")); + const InDetDD::SiDetectorElementCollection* elements{detManager->getDetectorElementCollection()}; + for (const InDetDD::SiDetectorElement* element: *elements) { + if (element->swapPhiReadoutDirection()) { + m_swapPhiReadoutDirection.insert(element->identifyHash()); + } + } return StatusCode::SUCCESS; } @@ -90,14 +93,13 @@ SCT_RodDecoder::finalize() { /** print out summaries of data and errors decoded */ ATH_MSG_INFO("SCT BytestreamCnv summary: " << m_headnumber <<" link headers found"); - if (m_condensedMode) { - ATH_MSG_INFO("SCT decoding bytestream summary: " << m_singleCondHitNumber << " single strips with hit in condensed mode"); - ATH_MSG_INFO("SCT decoding bytestream summary: " << m_pairedCondHitNumber << " paired strips with hit in condensed mode"); - } else { - ATH_MSG_INFO("SCT decoding bytestream summary: " << m_firstExpHitNumber << " first strips with hit in expanded mode"); - ATH_MSG_INFO("SCT decoding bytestream summary: " << m_evenExpHitNumber << " consecutive paired strips with hit in expanded mode"); - ATH_MSG_INFO("SCT decoding bytestream summary: " << m_lastExpHitNumber << " last consecutive strip with hit in expanded mode"); - } + + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_singleCondHitNumber << " single strips with hit in condensed mode"); + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_pairedCondHitNumber << " paired strips with hit in condensed mode"); + + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_firstExpHitNumber << " first strips with hit in expanded mode"); + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_evenExpHitNumber << " consecutive paired strips with hit in expanded mode"); + ATH_MSG_INFO("SCT decoding bytestream summary: " << m_lastExpHitNumber << " last consecutive strip with hit in expanded mode"); ATH_MSG_INFO("SCT BytestreamCnv summary: " << m_trailnumber << " link trailers found"); if (m_head_error_bcid > 0) ATH_MSG_INFO("SCT BytestreamCnv summary: header-> " << m_head_error_lvl1id << " LVL1d errors found"); @@ -135,18 +137,20 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r ISCT_RDO_Container& rdoIdc, InDetBSErrContainer* errs, SCT_ByteStreamFractionContainer* bsFracCont, - std::vector<IdentifierHash>* vecHash) + const std::vector<IdentifierHash>* vecHash) const { - uint32_t robid{robFrag.rod_source_id()}; + const uint32_t robid{robFrag.rod_source_id()}; /**determine whether this data was generated using the ROD simulator */ - uint32_t rod_datatype{robFrag.rod_detev_type()}; + const uint32_t rod_datatype{robFrag.rod_detev_type()}; const bool rodSimulatedData{static_cast<bool>((rod_datatype >> 20) & 1)}; if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::SimulatedData, robid, rodSimulatedData); - if (rodSimulatedData) addRODError(robid,SCT_ByteStreamErrors::RODSimulatedData, errs); + if (rodSimulatedData) addRODError(robid, SCT_ByteStreamErrors::RODSimulatedData, errs); /** look for the bit that denotes "Super-condensed" mode.*/ - m_superCondensedMode = ((rod_datatype >> 21) & 1); - if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::SuperCondensedMode, robid, m_superCondensedMode); + const bool superCondensedMode{static_cast<bool>((rod_datatype >> 21) & 1)}; + if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::SuperCondensedMode, robid, superCondensedMode); + + bool condensedMode{true}; int strip{0}; int oldstrip{-1}; @@ -180,14 +184,6 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r StatusCode sc{StatusCode::SUCCESS}; - // Get SCT_DetectorElementCollection - SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> sctDetEle(m_SCTDetEleCollKey); - const InDetDD::SiDetectorElementCollection* elements(sctDetEle.retrieve()); - if (elements==nullptr) { - ATH_MSG_FATAL(m_SCTDetEleCollKey.fullKey() << " could not be retrieved"); - return StatusCode::FAILURE; - } - /// look at ROB status word //////////////////////// if (robFrag.nstatus()!=0) { @@ -196,18 +192,18 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r if ((*rob_status)!=0) { ATH_MSG_DEBUG("ROB status word for robid " << std::hex << robid << " is non-zero " << (*rob_status) << std::dec); /// first store generic "ROBFragmentError" error type.. - addRODError(robid,SCT_ByteStreamErrors::ROBFragmentError, errs); + addRODError(robid, SCT_ByteStreamErrors::ROBFragmentError, errs); sc = StatusCode::RECOVERABLE; /// now look for specific problems, e.g. truncated or masked-off RODs if (((*rob_status) >> 27) & 0x1) { ATH_MSG_DEBUG("ROB status word for robid " << std::hex << robid << std::dec << " indicates data truncation."); - addRODError(robid,SCT_ByteStreamErrors::TruncatedROD, errs); + addRODError(robid, SCT_ByteStreamErrors::TruncatedROD, errs); m_truncatedRODNumber++; return sc; } if ((((*rob_status) >> 29) & 0x1) or (((*rob_status) >> 31) & 0x1)) { ATH_MSG_DEBUG("ROB status word for robid " << std::hex << robid << std::dec << " indicates resource was masked off."); - addRODError(robid,SCT_ByteStreamErrors::MaskedROD, errs); + addRODError(robid, SCT_ByteStreamErrors::MaskedROD, errs); m_maskedRODNumber++; return sc; } @@ -217,23 +213,23 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r /// look at ROD status words ///////// OFFLINE_FRAGMENTS_NAMESPACE::PointerType vRodStatus; - long unsigned int vRodStatusSize{robFrag.rod_nstatus()}; + const long unsigned int vRodStatusSize{robFrag.rod_nstatus()}; robFrag.rod_status(vRodStatus); for (long unsigned int j{0}; j<vRodStatusSize; j++) { - uint32_t statusWord{vRodStatus[j]}; + const uint32_t statusWord{vRodStatus[j]}; /** check for clock errors in second ROD status word */ if (j==1) { - int timClockError{static_cast<int>((statusWord >> 16) & 0x1)}; - int bocClockError{static_cast<int>((statusWord >> 17) & 0x1)}; + const int timClockError{static_cast<int>((statusWord >> 16) & 0x1)}; + const int bocClockError{static_cast<int>((statusWord >> 17) & 0x1)}; if (timClockError or bocClockError) { ATH_MSG_DEBUG(" Clock error in ROD status word: " << timClockError << " " << bocClockError); - addRODError(robid,SCT_ByteStreamErrors::RODClockError, errs); + addRODError(robid, SCT_ByteStreamErrors::RODClockError, errs); m_RODClockErrorNumber++; sc=StatusCode::RECOVERABLE; } /** look at bits 20-23 for DCS HV */ - int hvBits{static_cast<int>((statusWord >> 20) & 0xf)}; + const int hvBits{static_cast<int>((statusWord >> 20) & 0xf)}; const bool hvOn{hvBits==0xf}; if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::HVOn, robid, hvOn); } @@ -244,7 +240,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r bool foundHeader{false}; OFFLINE_FRAGMENTS_NAMESPACE::PointerType vRobData; - unsigned long int vRobDataSize{robFrag.rod_ndata()}; + const unsigned long int vRobDataSize{robFrag.rod_ndata()}; robFrag.rod_data(vRobData); for (unsigned long int i{0}; i<vRobDataSize; i++) { @@ -260,23 +256,23 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r /// hit element ///--------------------------------------------------------------------- if (d[n]&0x8000) { - if (!foundHeader) { + if (not foundHeader) { ATH_MSG_INFO(" Missing link header in ROD " << std::hex << robid << std::dec); - addRODError(robid,SCT_ByteStreamErrors::MissingLinkHeaderError, errs); + addRODError(robid, SCT_ByteStreamErrors::MissingLinkHeaderError, errs); m_numMissingLinkHeader++; sc = StatusCode::RECOVERABLE; continue; } m_nHits++; - if (m_superCondensedMode) { + if (superCondensedMode) { /** super-condensed mode * chip info : 4 bits d[n]>>11)0xF * chip number == (d[n]>>11)&0x7 and chip side == (d[n]>>14)&0x1 * For example if d[n]>>11)0xF = 0101 => chip5 or chip5 on side0, d[n]>>11)0xF = 1101 => chip13 or chip5 on side1 */ - chip = ((d[n]>>11)&0x7); + chip = ((d[n]>>11)&0x7); side = ((d[n]>>14)&0x1); strip = chip*128 + ((d[n]>>4)&0x7F); tbin = 0x2; /** assuming tbin is 010 in super-condensed mode */ @@ -289,11 +285,11 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r continue; } - /**------------ Search for redundancy only for the master chip */ - if ((side == 1) and ((linkNb%2)==0)) { - if (((strip != oldstrip) or (side!=oldside)) and (groupSize>0)) { /** if it is a new cluster, - * make RDO with the previous cluster */ - int rdoMade{this->makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + /**------------ Search for redundancy only for the master chip */ + if ((side==1) and ((linkNb%2)==0)) { + if (((strip!=oldstrip) or (side!=oldside)) and (groupSize>0)) { /** if it is a new cluster, + * make RDO with the previous cluster */ + const int rdoMade{makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -306,10 +302,10 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r } linkNb++; } - if ((side == 0) and ((linkNb%2)!=0)) { - if (((strip != oldstrip) or (side!=oldside)) and (groupSize>0)) { /** if it is a new cluster, - * make RDO with the previous cluster */ - int rdoMade{this->makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + if ((side==0) and ((linkNb%2)!=0)) { + if (((strip!=oldstrip) or (side!=oldside)) and (groupSize>0)) { /** if it is a new cluster, + * make RDO with the previous cluster */ + const int rdoMade{makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -329,10 +325,10 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r oldside = side; } - if ((strip != oldstrip) or (side!=oldside)) { + if ((strip!=oldstrip) or (side!=oldside)) { /** if it is a new cluster, * make RDO with the previous cluster */ - int rdoMade{this->makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + const int rdoMade{makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -345,14 +341,14 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r } groupSize+=nStripsInWord; // Split clusters have the same strip number. - } else if (m_condensedMode) { + } else if (condensedMode) { /** condensed mode * chip info : 4 bits d[n]>>11)0xF * chip number == (d[n]>>11)&0x7 and chip side == (d[n]>>14)&0x1 * For example if d[n]>>11)0xF = 0101 => chip5 or chip5 on side0, d[n]>>11)0xF = 1101 => chip13 or chip5 on side1 */ - chip = ((d[n]>>11)&0x7); + chip = ((d[n]>>11)&0x7); side = ((d[n]>>14)&0x1); strip = chip*128 + ((d[n]>>4)&0x7F); tbin = 0x2; /** assuming tbin is 010 in condensed mode */ @@ -364,11 +360,11 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r continue; } - /**------------ Search for redundancy only for the master chip */ - if ((side == 1) and ((linkNb%2)==0)) { - if (((strip != oldstrip) or (side!=oldside)) and (groupSize>0)) { /** if it is a new cluster, - * make RDO with the previous cluster */ - int rdoMade{this->makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + /**------------ Search for redundancy only for the master chip */ + if ((side==1) and ((linkNb%2)==0)) { + if (((strip!=oldstrip) or (side!=oldside)) and (groupSize>0)) { /** if it is a new cluster, + * make RDO with the previous cluster */ + const int rdoMade{makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -381,10 +377,10 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r } linkNb++; } - if ((side == 0) and ((linkNb%2)!=0)) { - if (((strip != oldstrip) or (side!=oldside)) and (groupSize>0)) { /** if it is a new cluster, - * make RDO with the previous cluster */ - int rdoMade{this->makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + if ((side==0) and ((linkNb%2)!=0)) { + if (((strip!=oldstrip) or (side!=oldside)) and (groupSize>0)) { /** if it is a new cluster, + * make RDO with the previous cluster */ + const int rdoMade{makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -402,12 +398,12 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r oldstrip = strip; /** if it's the first condensed word */ oldside = side; } - if (!(d[n]&0x1)) { /** 1-hit */ + if (not (d[n]&0x1)) { /** 1-hit */ m_singleCondHitNumber++; - if ((strip != oldstrip) or (side!=oldside)) { + if ((strip!=oldstrip) or (side!=oldside)) { /** if it is a new cluster, * make RDO with the previous cluster */ - int rdoMade{this->makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + const int rdoMade{makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -437,10 +433,10 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r continue; } m_pairedCondHitNumber++; - if ((strip != oldstrip) or (side!=oldside)) { /** if it is a new cluster, - * make RDO with the previous cluster - */ - int rdoMade{this->makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + if ((strip!=oldstrip) or (side!=oldside)) { /** if it is a new cluster, + * make RDO with the previous cluster + */ + const int rdoMade{makeRDO(oldstrip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -461,7 +457,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r if (d[n]&0x8) { /** Error in the second hit */ ATH_MSG_DEBUG(" Hit condensed : xxx ERROR in 2nd hit" << std::hex << d[n]); errorHit.push_back(groupSize); - m_cond_hit1_error++; + m_cond_hit2_error++; ERRORS = (ERRORS | 0x20); sc=StatusCode::RECOVERABLE; } @@ -474,9 +470,9 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r * For example if d[n]>>11)0xF = 0101 => chip5 or chip5 on side0, d[n]>>11)0xF = 1101 => chip13 or chip5 on side1 */ - if (!(d[n]&0x8)) { /** 1st hit cluster expanded */ + if (not (d[n]&0x8)) { /** 1st hit cluster expanded */ m_firstExpHitNumber++; - chip = ((d[n]>>11)&0x7); + chip = ((d[n]>>11)&0x7); side = ((d[n]>>14)&0x1); strip = chip*128 + ((d[n]>>4)&0x7F); tbin = d[n]&0x7; /** Real way for obtaining tbin info */ @@ -489,16 +485,16 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r } - /** -------------- Search for redundancy only for the master chip */ - if ((side == 1) and ((linkNb%2)==0)) { + /** -------------- Search for redundancy only for the master chip */ + if ((side==1) and ((linkNb%2)==0)) { linkNb++; } - if ((side == 0) and ((linkNb%2)!=0)) { + if ((side==0) and ((linkNb%2)!=0)) { linkNb--; } - onlineId = ((robid & 0xFFFFFF)|(linkNb << 24)); + onlineId = ((robid & 0xFFFFFF) | (linkNb << 24)); groupSize = 1; - int rdoMade{this->makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + const int rdoMade{makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -506,7 +502,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r saved[side*768+strip] = rdoMade; } groupSize = 0; - } else { /** next hits cluster expanded */ + } else { /** next hits cluster expanded */ if (d[n]&0x80) { /** paired hits */ if (strip > 767) { addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -525,22 +521,22 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r strip++; tbin = d[n]&0x7; groupSize = 1; - int rdoMade{this->makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; - if (rdoMade == -1) { + const int rdoMade1{makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; + if (rdoMade1 == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[side*768+strip] = rdoMade; + saved[side*768+strip] = rdoMade1; } /** second hit from the pair */ strip++; - tbin = (d[n] >> 4) & 0x7; - rdoMade = this->makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements); - if (rdoMade == -1) { + tbin = ((d[n] >> 4) & 0x7); + const int rdoMade2{makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; + if (rdoMade2 == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[side*768+strip] = rdoMade; + saved[side*768+strip] = rdoMade2; } groupSize = 0; } else { /** Last hit of the cluster */ @@ -552,9 +548,9 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r continue; } strip++; - tbin = d[n]&0x7; + tbin = (d[n]&0x7); groupSize = 1; - int rdoMade{this->makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + const int rdoMade{makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -576,7 +572,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r m_headnumber++; if (saved[side*768+strip]==false and oldstrip>=0) { - int rdoMade{this->makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + const int rdoMade{makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -590,13 +586,12 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r oldstrip = -1; oldside = -1; groupSize = 0; - //ErrorHeader = false; ERRORS = 0; memset(saved,0,768*2); errorHit.clear(); /** Link Number (or stream) in the ROD fragment */ - int rodlinkNb{static_cast<int>(d[n] & 0x7F)}; + const int rodlinkNb{static_cast<int>(d[n] & 0x7F)}; /** This is the real calculation for the offline */ linkNb = (((rodlinkNb >>4)&0x7)*12+(rodlinkNb &0xF)); @@ -651,7 +646,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r sc=StatusCode::RECOVERABLE; } - m_condensedMode = static_cast<bool>(d[n]&0x100); + condensedMode = static_cast<bool>(d[n]&0x100); continue; @@ -744,7 +739,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r addSingleError(flagIdHash, SCT_ByteStreamErrors::ABCDError_Invalid, errs); } else { // Chip is 4 bits. The highest bit 3 represents side. Chip 0-5 on side 0 and chip 8-13 on side 1. - unsigned int side_ABCDError{static_cast<unsigned int>(chip/8)}; + const unsigned int side_ABCDError{static_cast<unsigned int>(chip/8)}; if (flagIdHash.value()%2!=side_ABCDError) { // If the sides from the ABCD error and online ID are different, // the module is expected to read side 0 via link 1 and side 1 and via link 0. @@ -804,7 +799,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r /** create RDO of the last ink or stream of the event */ if (saved[side*768+strip]==false and oldstrip>=0) { - int rdoMade{makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit, elements)}; + const int rdoMade{makeRDO(strip, groupSize, tbin, onlineId, ERRORS, rdoIdc, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIdHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); @@ -813,7 +808,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r } } - if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::CondensedMode, robid, m_condensedMode); + if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::CondensedMode, robid, condensedMode); if (sc.isFailure()) ATH_MSG_DEBUG("One or more ByteStream errors found "); return sc; @@ -825,25 +820,21 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r * on as StatusCode::RECOVERABLE by fillCollection(). */ -int SCT_RodDecoder::makeRDO(int strip, int groupSize, int tbin, uint32_t onlineId, int ERRORS, ISCT_RDO_Container& rdoIdc, +int SCT_RodDecoder::makeRDO(int strip, int groupSize, int tbin, uint32_t onlineId, int ERRORS, + ISCT_RDO_Container& rdoIdc, CacheHelper& cache, - const std::vector<int>& errorHit, - const InDetDD::SiDetectorElementCollection* elements) + const std::vector<int>& errorHit) const { - if (onlineId == 0x0) { ATH_MSG_WARNING("No link header found, possibly corrupt ByteStream. Will not try to make RDO"); return -1; } /** get offlineId from the link number and ROB number */ - IdentifierHash idCollHash{m_cabling->getHashFromOnlineId(onlineId)}; + const IdentifierHash idCollHash{m_cabling->getHashFromOnlineId(onlineId)}; if (not idCollHash.is_valid()) { m_numUnknownOfflineId++; ATH_MSG_ERROR("Unknown OfflineId for OnlineId -> cannot create RDO"); ATH_MSG_WARNING("Unknown OfflineId for OnlineId " << std::hex << onlineId << " -> cannot create RDO" << std::dec); - - //fire an incident whenever there is a "unknown offline id..." so they are listened by /InnerDetector/InDetCalibAlgs/SCT_CalibAlgs/src/SCT_CalibEventInfo - m_incidentSvc->fireIncident(Incident(name(), "UnknownOfflineId")); return -1; } @@ -860,7 +851,7 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int tbin, uint32_t onlineI } else if (idCollHash != cache.lastHash) { cache.lastHash = idCollHash; /** maybe the new hash is not in the list, so test it */ - std::vector<IdentifierHash>::iterator p{find(cache.vecHash->begin(), cache.vecHash->end(), idCollHash)}; + std::vector<IdentifierHash>::const_iterator p{find(cache.vecHash->begin(), cache.vecHash->end(), idCollHash)}; if (p == cache.vecHash->end()) { ATH_MSG_VERBOSE("Collection for Hash not to be decoded, skip"); /** remember this one, so that we do not find(...) forever */ @@ -870,29 +861,25 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int tbin, uint32_t onlineI } } - - if(rdoIdc.hasExternalCache() && rdoIdc.tryFetch(idCollHash)){ + if(rdoIdc.hasExternalCache() and rdoIdc.tryFetch(idCollHash)){ ATH_MSG_DEBUG("Hash already in collection - cache hit " << idCollHash); return 0; } - /** get identifier from the hash, this is not nice */ - Identifier idColl{m_sct_id->wafer_id(idCollHash)}; - - /** see if strips go from 0 to 767 or vice versa */ - const InDetDD::SiDetectorElement* p_element{elements->getDetectorElement(idCollHash)}; - if (p_element->swapPhiReadoutDirection()) { + if (m_swapPhiReadoutDirection.count(idCollHash)) { strip = 767 - strip; strip = strip-(groupSize-1); } - Identifier iddigit{m_sct_id->strip_id(idColl,strip)}; + /** get identifier from the hash, this is not nice */ + const Identifier idColl{m_sct_id->wafer_id(idCollHash)}; + const Identifier iddigit{m_sct_id->strip_id(idColl, strip)}; if (not m_sct_id->is_sct(iddigit)) { ATH_MSG_WARNING("Cluster with invalid Identifier. Will not make RDO"); return -1; } - unsigned int rawDataWord{static_cast<unsigned int>(groupSize | (strip << 11) | (tbin <<22) | (ERRORS << 25))}; + const unsigned int rawDataWord{static_cast<unsigned int>(groupSize | (strip << 11) | (tbin <<22) | (ERRORS << 25))}; ATH_MSG_DEBUG("Output Raw Data " << std::hex << " Coll " << idColl.getString() << ":-> " << m_sct_id->print_to_string(iddigit) << std::dec); @@ -904,12 +891,12 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int tbin, uint32_t onlineI if (col==nullptr) { ATH_MSG_DEBUG(" Collection ID = " << idCollHash << " does not exist, create it "); /** create new collection */ - col = new SCT_RDO_Collection(idCollHash); + col = new SCT_RDO_Collection(idCollHash); col->setIdentifier(idColl); - StatusCode sc = rdoIdc.addCollection(col, idCollHash); + StatusCode sc{rdoIdc.addCollection(col, idCollHash)}; ATH_MSG_DEBUG("Adding " << idCollHash); if (sc.isFailure()){ - ATH_MSG_ERROR("failed to add SCT RDO collection to container"); + ATH_MSG_ERROR("failed to add SCT RDO collection to container"); } } @@ -923,24 +910,22 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int tbin, uint32_t onlineI void SCT_RodDecoder::addRODError(uint32_t rodid, int errorType, - InDetBSErrContainer* errs) + InDetBSErrContainer* errs) const { std::vector<IdentifierHash> idHashes; m_cabling->getHashesForRod(idHashes, rodid); - std::vector<IdentifierHash>::iterator hashIt{idHashes.begin()}; - std::vector<IdentifierHash>::iterator hashEnd{idHashes.end()}; - for (; hashIt != hashEnd; ++hashIt) { - addSingleError(*hashIt, errorType, errs); + for (const IdentifierHash& hash: idHashes) { + addSingleError(hash, errorType, errs); } return; } bool -SCT_RodDecoder::addSingleError(const IdentifierHash idHash, - const int bsErrorType, - InDetBSErrContainer* errs) +SCT_RodDecoder::addSingleError(const IdentifierHash& idHash, + int bsErrorType, + InDetBSErrContainer* errs) const { - bool ok{idHash.is_valid() and errs!=nullptr}; + const bool ok{idHash.is_valid() and errs!=nullptr}; if (ok) { errs->push_back(std::make_unique<std::pair<IdentifierHash, int> >(idHash, bsErrorType)); } @@ -948,7 +933,7 @@ SCT_RodDecoder::addSingleError(const IdentifierHash idHash, } void -SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashId, const unsigned int firstTempMaskedChip, InDetBSErrContainer* errs) { +SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashId, unsigned int firstTempMaskedChip, InDetBSErrContainer* errs) const { if (not hashId.is_valid()) { ATH_MSG_INFO("setFirstTempMaskedChip hashId " << hashId << " is invalid."); return; @@ -976,7 +961,7 @@ SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashId, const unsig int type{0}; // Check if Rx redundancy is used or not in this module - std::pair<bool, bool> badLinks{m_configTool->badLinks(moduleId)}; + const std::pair<bool, bool> badLinks{m_configTool->badLinks(moduleId)}; if (badLinks.first xor badLinks.second) { // Rx redundancy is used in this module. if (badLinks.first and not badLinks.second) { @@ -1001,7 +986,7 @@ SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashId, const unsig // modified0 and modified1 functions of SCT_ReadoutTool.cxx and // Table 3.8 of CERN-THESIS-2008-001 https://cds.cern.ch/record/1078223 // However, there are two exceptions of the exceptions. - unsigned long long fullSerialNumber{m_cabling->getSerialNumberFromHash(hashId).to_ulonglong()}; + const unsigned long long fullSerialNumber{m_cabling->getSerialNumberFromHash(hashId).to_ulonglong()}; if (// Readout through link-0 fullSerialNumber==20220170200183 or // hash=4662 bec=0 layer=2 eta= 6 phi=39 fullSerialNumber==20220330200606 or // hash=5032 bec=0 layer=3 eta=-2 phi= 7 @@ -1060,7 +1045,7 @@ SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashId, const unsig // In that case, information is swapped. if ((6<firstTempMaskedChip_side0 and firstTempMaskedChip_side0<=12) or (0<firstTempMaskedChip_side1 and firstTempMaskedChip_side1<= 6)) { - unsigned int swapFirstTempMaskedChip_side0{firstTempMaskedChip_side0}; + const unsigned int swapFirstTempMaskedChip_side0{firstTempMaskedChip_side0}; firstTempMaskedChip_side0 = firstTempMaskedChip_side1; firstTempMaskedChip_side1 = swapFirstTempMaskedChip_side0; } diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h index 3cfb00a6f95e7c4114d7b613b9eec5c88319f2ad..065a0f93b6ac4d10514371c76afe8840ba6e26ba 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h @@ -16,19 +16,20 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "Identifier/IdContext.h" +#include "Identifier/IdentifierHash.h" #include "InDetByteStreamErrors/InDetBSErrContainer.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "SCT_Cabling/ISCT_CablingTool.h" #include "SCT_ConditionsData/SCT_ByteStreamErrors.h" #include "SCT_ConditionsTools/ISCT_ConfigurationConditionsTool.h" -#include "StoreGate/ReadCondHandleKey.h" -#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" //STL -#include <string> +#include <atomic> #include <cstdint> +#include <set> +#include <string> +#include <vector> class SCT_ID; @@ -43,14 +44,14 @@ class SCT_RodDecoder : public extends<AthAlgTool, ISCT_RodDecoder> struct CacheHelper{//temp object to help with trigger caching IdentifierHash skipHash, lastHash; - std::vector<IdentifierHash>* vecHash; + const std::vector<IdentifierHash>* vecHash; }; public: //@name Usual AlgTool methods //@{ /** constructor*/ - SCT_RodDecoder(const std::string& type, const std::string& name, const IInterface* parent ) ; + SCT_RodDecoder(const std::string& type, const std::string& name, const IInterface* parent); /** destructor */ virtual ~SCT_RodDecoder() = default; @@ -63,74 +64,70 @@ class SCT_RodDecoder : public extends<AthAlgTool, ISCT_RodDecoder> /** @brief Decode the rob data fragment and fill the collection SCT_RDO_Collection * with the RDO built by the makeRDO(..) method + * rdoIdc, errs, and bsFracCont are updated based on robFrag and vecHash. **/ virtual StatusCode fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& robFrag, ISCT_RDO_Container& rdoIdc, InDetBSErrContainer* errs, SCT_ByteStreamFractionContainer* bsFracCont, - std::vector<IdentifierHash>* vecHash = 0) override; + const std::vector<IdentifierHash>* vecHash = nullptr) const override; private: /// method that builds the RawData RDO and add it to the collection - int makeRDO(int strip, int groupSize, int tbin, + /// rdoIdc and cache are updated based on other arguments + int makeRDO(int strip, int groupSize, int tbin, uint32_t onlineId, int ERRORS, ISCT_RDO_Container& rdoIdc, - CacheHelper&, - const std::vector<int>& errorHit, - const InDetDD::SiDetectorElementCollection* elements); + CacheHelper& cache, + const std::vector<int>& errorHit) const; /// add an error for each wafer in a problematic ROD. void addRODError(uint32_t rodid, int errorType, - InDetBSErrContainer* errs); + InDetBSErrContainer* errs) const; + bool addSingleError(const IdentifierHash& idHash, + int bsErrorType, + InDetBSErrContainer* errs) const; - bool addSingleError(const IdentifierHash idHash, - const int bsErrorType, - InDetBSErrContainer* errs); /** Set first temporarily masked chip information from byte stream trailer */ - void setFirstTempMaskedChip(const IdentifierHash& hashId, const unsigned int firstTempMaskedChip, InDetBSErrContainer* errs); + void setFirstTempMaskedChip(const IdentifierHash& hashId, unsigned int firstTempMaskedChip, InDetBSErrContainer* errs) const; + const SCT_ID* m_sct_id; IdContext m_cntx_sct; ToolHandle<ISCT_CablingTool> m_cabling{this, "SCT_CablingTool", "SCT_CablingTool", "Tool to retrieve SCT Cabling"}; ToolHandle<ISCT_ConfigurationConditionsTool> m_configTool{this, "ConfigTool", "SCT_ConfigurationConditionsTool/InDetSCT_ConfigurationConditionsTool", "Tool to retrieve SCT Configuration Tool"}; - SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}; - bool m_condensedMode ; - bool m_superCondensedMode ; /** Summary of the decoding process */ - // unsigned int m_hitnumber; //!< Total number of decoded hits - unsigned int m_singleCondHitNumber; //!< Total number of single hit decoded in condensed mode - unsigned int m_pairedCondHitNumber; //!< Total number of paired hit decoded in condensed mode - unsigned int m_firstExpHitNumber; //!< Total number of first hit decoded in expanded mode - unsigned int m_evenExpHitNumber; //!< Total number of paired hit decoded in expanded mode - unsigned int m_lastExpHitNumber; //!< Total number of last hit decoded in expanded mode - unsigned int m_headnumber; //!< Total number of decoded header data - unsigned int m_trailnumber; //!< Total number of decoded trailer data - unsigned int m_head_error_bcid; //!< Total number of bcid error in the header data - unsigned int m_head_error_lvl1id; //!< Total number of lvl1id error in the header data - unsigned int m_head_error_timeout; //!< Total number of timeout error in the header data - unsigned int m_head_error_formatter; //!< Total number of formatter error in the header data - unsigned int m_head_error_preamb; //!< Total number of preamble error in the header data - unsigned int m_trail_error_overflow; //!< Total number of overflow error in the trailer data - unsigned int m_trail_error_limit; //!< Total number of header trailer limit error in the trailer data - unsigned int m_trail_error_bit; //!< Total number of trailer bit error - unsigned int m_config_data_bit; //!< Total number of configuration data - unsigned int m_flag_error_bit; //!< Total number of flag error data - unsigned int m_cond_hit1_error; //!< Total number of first hit data error - unsigned int m_cond_hit2_error; //!< Total number second hit data errors - unsigned int m_chip_number_error; //!< Total number of chip number error - unsigned int m_unknown_data_format; //!< Total number of unknown data format - unsigned int m_nHits; - unsigned int m_nRDOs; - unsigned int m_maskedLinkNumber; - unsigned int m_maskedRODNumber; - unsigned int m_RODClockErrorNumber; - unsigned int m_truncatedRODNumber; - unsigned int m_numMissingLinkHeader; - unsigned int m_numUnknownOfflineId; + mutable std::atomic_uint m_singleCondHitNumber; //!< Total number of single hit decoded in condensed mode + mutable std::atomic_uint m_pairedCondHitNumber; //!< Total number of paired hit decoded in condensed mode + mutable std::atomic_uint m_firstExpHitNumber; //!< Total number of first hit decoded in expanded mode + mutable std::atomic_uint m_evenExpHitNumber; //!< Total number of paired hit decoded in expanded mode + mutable std::atomic_uint m_lastExpHitNumber; //!< Total number of last hit decoded in expanded mode + mutable std::atomic_uint m_headnumber; //!< Total number of decoded header data + mutable std::atomic_uint m_trailnumber; //!< Total number of decoded trailer data + mutable std::atomic_uint m_head_error_bcid; //!< Total number of bcid error in the header data + mutable std::atomic_uint m_head_error_lvl1id; //!< Total number of lvl1id error in the header data + mutable std::atomic_uint m_head_error_timeout; //!< Total number of timeout error in the header data + mutable std::atomic_uint m_head_error_formatter; //!< Total number of formatter error in the header data + mutable std::atomic_uint m_head_error_preamb; //!< Total number of preamble error in the header data + mutable std::atomic_uint m_trail_error_overflow; //!< Total number of overflow error in the trailer data + mutable std::atomic_uint m_trail_error_limit; //!< Total number of header trailer limit error in the trailer data + mutable std::atomic_uint m_trail_error_bit; //!< Total number of trailer bit error + mutable std::atomic_uint m_config_data_bit; //!< Total number of configuration data + mutable std::atomic_uint m_flag_error_bit; //!< Total number of flag error data + mutable std::atomic_uint m_cond_hit1_error; //!< Total number of first hit data error + mutable std::atomic_uint m_cond_hit2_error; //!< Total number second hit data errors + mutable std::atomic_uint m_chip_number_error; //!< Total number of chip number error + mutable std::atomic_uint m_unknown_data_format; //!< Total number of unknown data format + mutable std::atomic_uint m_nHits; + mutable std::atomic_uint m_nRDOs; + mutable std::atomic_uint m_maskedLinkNumber; + mutable std::atomic_uint m_maskedRODNumber; + mutable std::atomic_uint m_RODClockErrorNumber; + mutable std::atomic_uint m_truncatedRODNumber; + mutable std::atomic_uint m_numMissingLinkHeader; + mutable std::atomic_uint m_numUnknownOfflineId; - bool m_triggerMode; - - ServiceHandle<IIncidentSvc> m_incidentSvc; + std::set<IdentifierHash> m_swapPhiReadoutDirection; }; #endif //SCT_RAWDATABYTESTREAM_SCT_RODDECODER_H diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetReadBS_jobOptions.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetReadBS_jobOptions.py index 34dc8dd195839f971e9b41a85ce740a0c251ae37..adcd3dcc4cd46800e08287b54b43839ff7a51eba 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetReadBS_jobOptions.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetReadBS_jobOptions.py @@ -33,8 +33,7 @@ if DetFlags.readRDOBS.pixel_on(): if DetFlags.readRDOBS.SCT_on(): from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCT_RodDecoder - InDetSCTRodDecoder = SCT_RodDecoder(name = "InDetSCTRodDecoder", - TriggerMode = False) + InDetSCTRodDecoder = SCT_RodDecoder(name = "InDetSCTRodDecoder") if (InDetFlags.doPrintConfigurables()): print InDetSCTRodDecoder #InDetSCTRodDecoder.OutputLevel = VERBOSE diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py index 98667c3fb6f7025ea03a4cb8ff9174078dbe3d04..f8e99a44e44a12c42cd2961b894a8ca978cccb2f 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py @@ -116,8 +116,7 @@ class SCTClustering_EF( InDet__SCT_TrgClusterization ): InDetTrigBSErrorTool = SCT_ByteStreamErrorsTool(name=SCT_ConditionsSetup.instanceName("InDetSCT_ByteStreamErrorsTool")) from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCT_RodDecoder - InDetTrigSCTRodDecoder = SCT_RodDecoder(name = "InDetTrigSCTRodDecoder", - TriggerMode = True) + InDetTrigSCTRodDecoder = SCT_RodDecoder(name = "InDetTrigSCTRodDecoder") ToolSvc += InDetTrigSCTRodDecoder if (InDetTrigFlags.doPrintConfigurables()): print InDetTrigSCTRodDecoder diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py index 0cc90a51a1651321b9ac7b579dcedaf09129de62..f880bda14516fd013827d52758889bae30fff179 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py @@ -58,8 +58,8 @@ def makeInDetAlgs(): #SCT from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCT_RodDecoder - InDetSCTRodDecoder = SCT_RodDecoder(name = "InDetSCTRodDecoder", - TriggerMode = False,)# OutputLevel = INFO) + InDetSCTRodDecoder = SCT_RodDecoder(name = "InDetSCTRodDecoder",) + # OutputLevel = INFO) ToolSvc += InDetSCTRodDecoder from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConf import SCTRawDataProviderTool