diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelByteStreamErrorsSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelByteStreamErrorsSvc.cxx index 1313cbdf956331d390f13c5ca8edc6de9c420f2d..a7f66602ecca04f452e11ef723aaa9735d6c769e 100644 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelByteStreamErrorsSvc.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelByteStreamErrorsSvc.cxx @@ -21,48 +21,38 @@ using namespace std; // Constructor PixelByteStreamErrorsSvc::PixelByteStreamErrorsSvc( const std::string& name, - ISvcLocator* pSvcLocator ) : AthService(name, pSvcLocator), - m_pixel_id(0), - m_storeGate("StoreGateSvc",name), - m_detStore("DetectorStore",name), - m_IBLParameterSvc("IBLParameterSvc",name), - m_module_errors(0), - m_moduleROD_errors(0), - m_event_read(0), - m_FE_errors(0), - m_module_isread(0), - m_ServiceRecords(), - m_readESD(false) + ISvcLocator* pSvcLocator ) : AthService(name, pSvcLocator), + m_pixel_id(0), + m_storeGate("StoreGateSvc",name), + m_detStore("DetectorStore",name), + m_IBLParameterSvc("IBLParameterSvc",name), + m_module_errors(0), + m_moduleROD_errors(0), + m_event_read(0), + m_FE_errors(0), + m_module_isread(0), + m_ServiceRecords(), + m_readESD(false), + m_ibl_is_present(true), + m_dbm_is_present(true), + m_max_hashes(0) { declareProperty("ReadingESD",m_readESD,"Get summary of BS errors from StoreGate, if available"); + resetCounts(); } //Initialize -StatusCode PixelByteStreamErrorsSvc::initialize(){ - StatusCode sc(StatusCode::FAILURE); - //m_log.setLevel(outputLevel()); - if (AthService::initialize() == sc) return msg(MSG::ERROR)<<"Service failed to initialize"<<endmsg, sc; +StatusCode PixelByteStreamErrorsSvc::initialize() { + CHECK(AthService::initialize()); // Get a StoreGateSvc - if (m_storeGate.retrieve().isFailure()) { - msg(MSG::FATAL) << "Failed to retrieve service " << m_storeGate << endmsg; - return StatusCode::FAILURE; - } - else - msg(MSG::INFO) << "Retrieved service " << m_storeGate << endmsg; + CHECK(m_storeGate.retrieve()); + // Get a detector store - if (m_detStore.retrieve().isFailure()) { - msg(MSG::FATAL) << "Failed to retrieve service " << m_detStore << endmsg; - return StatusCode::FAILURE; - } - else - msg(MSG::INFO) << "Retrieved service " << m_detStore << endmsg ; + CHECK(m_detStore.retrieve()); - sc = m_detStore->retrieve( m_pixel_id, "PixelID" ); - if( !sc.isSuccess() ){ - ATH_MSG_FATAL( "Unable to retrieve pixel ID helper" ); - return StatusCode::FAILURE; - } + // Pixel ID + CHECK(m_detStore->retrieve(m_pixel_id,"PixelID")); m_max_hashes = m_pixel_id->wafer_hash_max(); @@ -72,41 +62,28 @@ StatusCode PixelByteStreamErrorsSvc::initialize(){ m_FE_errors = (unsigned int*) calloc(m_max_hashes, sizeof(unsigned int)); m_module_isread = (bool*) calloc(m_max_hashes, sizeof(bool)); // before reading first event, set all modules as active - for (unsigned int i=0; i<m_max_hashes; i++) m_module_isread[i]=true; + for (unsigned int i=0; i<m_max_hashes; i++) { m_module_isread[i]=true; } IIncidentSvc* incsvc; - sc = service("IncidentSvc", incsvc); int priority = 100; - if( sc.isSuccess() ) { + if (service("IncidentSvc",incsvc).isSuccess()) { incsvc->addListener( this, "BeginEvent", priority); } - - - // Get IBLParameterSvc - if (m_IBLParameterSvc.retrieve().isFailure()) { - msg(MSG::FATAL) << "Could not retrieve IBLParameterSvc" << endmsg; - return StatusCode::FAILURE; - } + CHECK(m_IBLParameterSvc.retrieve()); // Check if IBL is present or not m_ibl_is_present = m_IBLParameterSvc->containsIBL(); m_dbm_is_present = m_IBLParameterSvc->containsDBM(); - resetCounts(); resetPixelCounts(); reset(); - if (sc == StatusCode::SUCCESS) - msg(MSG::INFO) << "PixelByteStreamErrorsSvc successfully initialized" << endmsg; - return sc; + return StatusCode::SUCCESS; } //Finalize -StatusCode -PixelByteStreamErrorsSvc::finalize(){ - StatusCode sc(StatusCode::SUCCESS); - +StatusCode PixelByteStreamErrorsSvc::finalize() { if (m_module_errors != NULL){ free(m_module_errors); m_module_errors = NULL; @@ -122,30 +99,25 @@ PixelByteStreamErrorsSvc::finalize(){ unsigned int mbadfe=0; for (unsigned int i=0; i<m_max_hashes; i++) { if (m_event_read[i]==0) { - msg(MSG::DEBUG) << "Disabled module HashId " << i << endmsg; - continue; + ATH_MSG_DEBUG("Disabled module HashId " << i); + continue; } if (m_FE_errors[i]!=0) { - msg(MSG::DEBUG) << "Disabled FEs module HashId " << i - << " FE mask=" << std::hex << m_FE_errors[i] << std::dec << endmsg; - mbadfe++; + ATH_MSG_DEBUG("Disabled FEs module HashId " << i << " FE mask=" << std::hex << m_FE_errors[i] << std::dec); + mbadfe++; } if (m_event_read[i]>mxevent) { - missing += ( (m_event_read[i]-mxevent)*mdread ); - mxevent = m_event_read[i]; + missing += ( (m_event_read[i]-mxevent)*mdread ); + mxevent = m_event_read[i]; } else if ( m_event_read[i]<mxevent ) { - missing += mxevent-m_event_read[i]; + missing += mxevent-m_event_read[i]; } mdread++; } - msg(MSG::INFO) << "Found in data " << mdread - << " modules out of " << m_max_hashes << endmsg; - msg(MSG::INFO) << "Found " << mxevent - << " events with pixel data and " << missing - << " missing module fragments" << endmsg; - msg(MSG::INFO) << "Found " - << mbadfe - << " modules with disabled FE" << endmsg; + ATH_MSG_INFO("Found in data " << mdread << " modules out of " << m_max_hashes); + ATH_MSG_INFO("Found " << mxevent << " events with pixel data and " << missing << " missing module fragments"); + ATH_MSG_INFO("Found " << mbadfe << " modules with disabled FE"); + if (m_event_read != NULL){ free(m_event_read); m_event_read = NULL; @@ -158,38 +130,33 @@ PixelByteStreamErrorsSvc::finalize(){ free(m_FE_errors); m_FE_errors = NULL; } - msg(MSG::INFO) << " --------------------------------------------- " << endmsg; + ATH_MSG_INFO(" --------------------------------------------- "); } - msg(MSG::INFO) << " --- Summary from PixelByteStreamErrorsSvc --- " << endmsg; - msg(MSG::INFO) << " - Number of invalid Identifiers Errors: " << m_numInvalidIdentifiers << endmsg; - msg(MSG::INFO) << " - Number of Preamble Errors: " << m_numPreambleErrors << endmsg; - msg(MSG::INFO) << " - Number of TimeOut Errors: " << m_numTimeOutErrors << endmsg; - msg(MSG::INFO) << " - Number of LVL1ID Errors: " << m_numLVL1IDErrors << endmsg; - msg(MSG::INFO) << " - Number of BCID Errors: " << m_numBCIDErrors << endmsg; - msg(MSG::INFO) << " - Number of Flagged Errors: " << m_numFlaggedErrors << endmsg; - msg(MSG::INFO) << " - Number of Trailer Errors: " << m_numTrailerErrors << endmsg; - msg(MSG::INFO) << " - Number of Disabled FE Errors: " << m_numDisabledFEErrors << endmsg; - msg(MSG::INFO) << " - Number of ROD Errors: " << m_numRODErrors << endmsg; - msg(MSG::INFO) << " - Number of links masked by PPC: " << m_numLinkMaskedByPPC << endmsg; - msg(MSG::INFO) << " - Number of header/trailer limit errors: " << m_numLimitError << endmsg; - msg(MSG::INFO) << " - Number of Unknown word Errors: " << m_numDecodingErrors << endmsg; - msg(MSG::INFO) << " --------------------------------------------- " << endmsg; - - - return sc; + ATH_MSG_INFO(" --- Summary from PixelByteStreamErrorsSvc --- "); + ATH_MSG_INFO(" - Number of invalid Identifiers Errors: " << m_numInvalidIdentifiers); + ATH_MSG_INFO(" - Number of Preamble Errors: " << m_numPreambleErrors); + ATH_MSG_INFO(" - Number of TimeOut Errors: " << m_numTimeOutErrors); + ATH_MSG_INFO(" - Number of LVL1ID Errors: " << m_numLVL1IDErrors); + ATH_MSG_INFO(" - Number of BCID Errors: " << m_numBCIDErrors); + ATH_MSG_INFO(" - Number of Flagged Errors: " << m_numFlaggedErrors); + ATH_MSG_INFO(" - Number of Trailer Errors: " << m_numTrailerErrors); + ATH_MSG_INFO(" - Number of Disabled FE Errors: " << m_numDisabledFEErrors); + ATH_MSG_INFO(" - Number of ROD Errors: " << m_numRODErrors); + ATH_MSG_INFO(" - Number of links masked by PPC: " << m_numLinkMaskedByPPC); + ATH_MSG_INFO(" - Number of header/trailer limit errors: " << m_numLimitError); + ATH_MSG_INFO(" - Number of Unknown word Errors: " << m_numDecodingErrors); + ATH_MSG_INFO(" --------------------------------------------- "); + + return StatusCode::SUCCESS; } -void -PixelByteStreamErrorsSvc::handle(const Incident&) { +void PixelByteStreamErrorsSvc::handle(const Incident&) { reset(); if ( m_readESD && m_storeGate->contains<InDetBSErrContainer>("PixelByteStreamErrs") ) { - StatusCode sc = readData(); - if ( sc.isFailure() ) { - msg(MSG::ERROR) - << "PixelByteStreamErrs container is registered in SG, but cannot be retrieved" - << endmsg; + if (readData().isFailure()) { + ATH_MSG_ERROR("PixelByteStreamErrs container is registered in SG, but cannot be retrieved"); } } else if ( !m_readESD ) { recordData(); @@ -197,10 +164,7 @@ PixelByteStreamErrorsSvc::handle(const Incident&) { return; } - -StatusCode -PixelByteStreamErrorsSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) -{ +StatusCode PixelByteStreamErrorsSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) { if ( IID_IPixelByteStreamErrorsSvc == riid ) { *ppvInterface = dynamic_cast<IPixelByteStreamErrorsSvc*>(this); } else { @@ -227,24 +191,24 @@ PixelByteStreamErrorsSvc::isGood(const Identifier & elementId, InDetConditions:: } */ -bool -PixelByteStreamErrorsSvc::isGood(const IdentifierHash & elementIdHash) { - - Identifier dehashedId = m_pixel_id->wafer_id(elementIdHash); +bool PixelByteStreamErrorsSvc::isGood(const IdentifierHash & elementIdHash) { + Identifier dehashedId = m_pixel_id->wafer_id(elementIdHash); - if (m_ibl_is_present || m_dbm_is_present) { - // If module is IBL of DBM, return isActive - if ((m_pixel_id->barrel_ec(dehashedId) == 0 && m_pixel_id->layer_disk(dehashedId) == 0) - || m_pixel_id->is_dbm(dehashedId)) { - return isActive(elementIdHash); - } + if (m_ibl_is_present || m_dbm_is_present) { + // If module is IBL of DBM, return isActive + if ((m_pixel_id->barrel_ec(dehashedId) == 0 && m_pixel_id->layer_disk(dehashedId) == 0) + || m_pixel_id->is_dbm(dehashedId)) { + return isActive(elementIdHash); } + } - int errorcode = m_module_errors[elementIdHash]; - if ((errorcode & 0xFFF1F00F) == 0) // Mask FE errors - return isActive(elementIdHash); - else - return false; + int errorcode = m_module_errors[elementIdHash]; + if ((errorcode & 0xFFF1F00F) == 0) { // Mask FE errors + return isActive(elementIdHash); + } + else { + return false; + } } @@ -263,10 +227,7 @@ PixelByteStreamErrorsSvc::filled() const{ } */ - - -void -PixelByteStreamErrorsSvc::resetCounts() { +void PixelByteStreamErrorsSvc::resetCounts() { m_numTimeOutErrors=0; m_numBCIDErrors=0; m_numLVL1IDErrors=0; @@ -281,23 +242,19 @@ PixelByteStreamErrorsSvc::resetCounts() { m_numLimitError=0; // Also reset FE-I4B service records - for (int i = 0; i < 32; ++i) m_ServiceRecords[i] = 0; - + for (int i = 0; i < 32; ++i) { m_ServiceRecords[i]=0; } } -void -PixelByteStreamErrorsSvc::resetPixelCounts() { +void PixelByteStreamErrorsSvc::resetPixelCounts() { for (unsigned int i=0; i<m_max_hashes; i++) { m_event_read[i]=0; m_FE_errors[i]=0; } } -int -PixelByteStreamErrorsSvc::getNumberOfErrors(int errorType) { - switch(errorType) - { +int PixelByteStreamErrorsSvc::getNumberOfErrors(int errorType) { + switch(errorType) { case TimeOut: return m_numTimeOutErrors; case BCID: @@ -326,7 +283,6 @@ PixelByteStreamErrorsSvc::getNumberOfErrors(int errorType) { return 0; } - void PixelByteStreamErrorsSvc::reset(){ for (unsigned int i=0; i<m_max_hashes; i++) { m_module_errors[i]=0; @@ -341,7 +297,7 @@ StatusCode PixelByteStreamErrorsSvc::readData() { const InDetBSErrContainer* errCont; sc = m_storeGate->retrieve(errCont,"PixelByteStreamErrs"); if (sc.isFailure() ){ - msg(MSG::ERROR) << "Failed to retrieve BS error container from SG"<<endmsg; + ATH_MSG_ERROR("Failed to retrieve BS error container from SG"); return sc; } for (const auto* elt : *errCont) { @@ -365,14 +321,12 @@ StatusCode PixelByteStreamErrorsSvc::readData() { // record the data to Storegate: for one event, one entry per module with errors StatusCode PixelByteStreamErrorsSvc::recordData() { - InDetBSErrContainer* cont = new InDetBSErrContainer(); StatusCode sc = m_storeGate->overwrite(cont,"PixelByteStreamErrs"); if (sc.isFailure() ){ - msg(MSG::ERROR) <<"Failed to record/overwrite BSErrors to SG"<<endmsg; + ATH_MSG_ERROR("Failed to record/overwrite BSErrors to SG"); return sc; } - for (unsigned int i=0; i<m_max_hashes; i++) { if (m_module_errors[i] != 0){ std::pair<IdentifierHash, int>* err = new std::pair<IdentifierHash, int>(std::make_pair((IdentifierHash)i, m_module_errors[i])); diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx index 8d12d97936880365c2f9071401ac8ab219d2216f..8ad6936ce4aa2947b790afbf2e6a3bc56895a49e 100755 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx @@ -31,7 +31,7 @@ #include "GeoModelInterfaces/IGeoModelSvc.h" #include "GeoModelUtilities/DecodeVersionKey.h" -static unsigned int columnsPerFEI3 = 18; // number of columns per FEI3 (18x160) +//static unsigned int columnsPerFEI3 = 18; // number of columns per FEI3 (18x160) /* static unsigned int rowsPerFEI3 = 164; // number of rows per FEI3 @@ -44,15 +44,15 @@ static unsigned int rowsPerFEI4 = 336; // number of rows per FEI4 */ static unsigned int columnsPerFEI50 = 132; // number of columns per FEI5-type 0 (132x672) for barrel layer 0 -static unsigned int rowsPerFEI50 = 672; // number of rows per FEI50 +//static unsigned int rowsPerFEI50 = 672; // number of rows per FEI50 static unsigned int columnsPerFEI52 = 132; // number of columns per FEI5-type 2 (132x672) for barrel layer 1 -static unsigned int rowsPerFEI52 = 678; // number of rows per FEI52 +//static unsigned int rowsPerFEI52 = 678; // number of rows per FEI52 static unsigned int rowsFGangedFEI52 =661; // first ganged pixel row for FEI52 static unsigned int rowsLGangedFEI52 =671; // last ganged pixel row for FEI52 static unsigned int columnsPerFEI51 = 80; // number of columns per FEI5-type 1 (80x336) for the rest -static unsigned int rowsPerFEI51 = 339; // number of rows per FEI51 +//static unsigned int rowsPerFEI51 = 339; // number of rows per FEI51 static unsigned int rowsFGangedFEI51 =331; // first ganged pixel row for FEI51 static unsigned int rowsLGangedFEI51 =335; // last ganged pixel row for FEI51 @@ -169,7 +169,7 @@ StatusCode PixelCalibSvc::finalize() int PixelCalibSvc::PixelType(const Identifier wafer_id, int row, int col) const { const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); // local row and col of ith circuit(0-15) // each circuit contains 160 rows and 18 columns @@ -206,15 +206,15 @@ int PixelCalibSvc::PixelType(const Identifier wafer_id, int row, int col) const int PixelCalibSvc::PixelType(const Identifier pix_id, const Identifier wafer_id, int &circ) const { const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int phi_index = m_pixid->phi_index(pix_id); int eta_index = m_pixid->eta_index(pix_id); int barrel_ec = m_pixid->barrel_ec(wafer_id); - int layer_disk = m_pixid->layer_disk(wafer_id); + //int layer_disk = m_pixid->layer_disk(wafer_id); int phi_module = m_pixid->phi_module(wafer_id); - int FEIXsPerHalfModule = getNFE(wafer_id)/2; + //int FEIXsPerHalfModule = getNFE(wafer_id)/2; // int FEIXsPerHalfModule = p_design->numberOfCircuits(); // can be... int col; int row; @@ -293,14 +293,14 @@ int PixelCalibSvc::PixelType(const Identifier pix_id, const Identifier wafer_id, int PixelCalibSvc::PixelCirc(const Identifier& pix_id, const Identifier& wafer_id) const { const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int phi_index = m_pixid->phi_index(pix_id); int eta_index = m_pixid->eta_index(pix_id); int barrel_ec = m_pixid->barrel_ec(wafer_id); - int layer_disk = m_pixid->layer_disk(wafer_id); + //int layer_disk = m_pixid->layer_disk(wafer_id); int phi_module = m_pixid->phi_module(wafer_id); - int FEIXsPerHalfModule = getNFE(wafer_id)/2; + //int FEIXsPerHalfModule = getNFE(wafer_id)/2; // int FEIXsPerHalfModule = p_design->numberOfCircuits(); // can be... int circ(-1); if (isITK) { @@ -401,7 +401,7 @@ int PixelCalibSvc::gangedType(int row, int col, int columnsPerFE, int rowsFGange int PixelCalibSvc::getThreshold(const Identifier& wafer_id, int irow, int icol, int circ) const { if (m_disableDb) { return m_IBLabsent || m_pixid->layer_disk(wafer_id)>0 ? m_discrThresh : m_discrThreshIBL; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int type = PixelType(wafer_id,irow,icol); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getThreshold(type); @@ -431,7 +431,7 @@ int PixelCalibSvc::getThreshold(const Identifier& pix_id) const { int PixelCalibSvc::getThresholdSigma(const Identifier& wafer_id, int irow, int icol, int circ) const { if (m_disableDb) { return m_discrThreshSigma; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int type = PixelType(wafer_id,irow,icol); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getThresholdSigma(type); @@ -462,7 +462,7 @@ int PixelCalibSvc::getThresholdSigma(const Identifier& pix_id) const { int PixelCalibSvc::getNoise(const Identifier& wafer_id, int irow, int icol, int circ) const { if (m_disableDb) { return m_noiseThresh; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int type = PixelType(wafer_id,irow,icol); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getNoise(type); @@ -492,7 +492,7 @@ int PixelCalibSvc::getNoise(const Identifier& pix_id) const { int PixelCalibSvc::getTimeWalk(const Identifier& wafer_id, int irow, int icol, int circ) const { if (m_disableDb) { return m_IBLabsent || m_pixid->layer_disk(wafer_id)>0 ? m_intimeThresh : m_intimeThreshIBL; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int type = PixelType(wafer_id,irow,icol); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getTimeWalk(type); @@ -522,7 +522,7 @@ int PixelCalibSvc::getTimeWalk(const Identifier& pix_id) const { float PixelCalibSvc::getQ2TotA(const Identifier& wafer_id, int irow, int icol, int circ) const { if (m_disableDb) { return m_totparA; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int type = PixelType(wafer_id,irow,icol); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotA(type); @@ -552,7 +552,7 @@ float PixelCalibSvc::getQ2TotA(const Identifier& pix_id) const { float PixelCalibSvc::getQ2TotE(const Identifier& wafer_id, int irow, int icol, int circ) const { if (m_disableDb) { return m_totparE; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int type = PixelType(wafer_id,irow,icol); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotE(type); @@ -582,7 +582,7 @@ float PixelCalibSvc::getQ2TotE(const Identifier& pix_id) const { float PixelCalibSvc::getQ2TotC(const Identifier& wafer_id, int irow, int icol, int circ) const { if (m_disableDb) { return m_totparC; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); int type = PixelType(wafer_id,irow,icol); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotC(type); @@ -612,7 +612,7 @@ float PixelCalibSvc::getQ2TotC(const Identifier& pix_id) const { float PixelCalibSvc::getTotP1(const Identifier& wafer_id, int circ) const { if (m_disableDb) { return m_totparP1; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getTotP1(); } @@ -640,7 +640,7 @@ float PixelCalibSvc::getTotP1(const Identifier& pix_id) const { float PixelCalibSvc::getTotP2(const Identifier& wafer_id, int circ) const { if (m_disableDb) { return m_totparP2; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getTotP2(); } @@ -668,7 +668,7 @@ float PixelCalibSvc::getTotP2(const Identifier& pix_id) const { float PixelCalibSvc::getTotRes(const Identifier& wafer_id, int circ, float Q) const { if (m_disableDb) { return m_totparP1+m_totparP2*Q; } const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); if (m_dbTool->getCalibPtr(wafer_id) && circ<p_design->numberOfCircuits()) { return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getTotRes(Q); } @@ -730,7 +730,7 @@ float PixelCalibSvc::getCharge(const Identifier& pix_id, float ToT) const { Identifier wafer_id = m_pixid->wafer_id(pix_id); const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); float charge = 0.0; if (m_pixid->is_dbm(wafer_id)) { charge = ToT/8.0*(8000.0-1200.0)+1200.0; @@ -742,7 +742,7 @@ float PixelCalibSvc::getCharge(const Identifier& pix_id, float ToT) const { float termA = getQ2TotA(pix_id); float termE = getQ2TotE(pix_id); float termC = getQ2TotC(pix_id); - if (termA!=0.0 && ToT/termA!=1.0) { + if (fabs(termA)>0.0 && fabs(ToT/termA-1.0)>0.0) { charge = (termC*ToT/termA-termE)/(1.0-ToT/termA); } } diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.cxx index c4252f286128f95464c34dac56274cebc09ccffe..41a6080ac5f5c05792b84918f0fc62538657a173 100644 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.cxx @@ -44,7 +44,8 @@ PixelOfflineCalibSvc::PixelOfflineCalibSvc(const std::string& name, ISvcLocator* m_sgSvc("StoreGateSvc",name), m_IBLParameterSvc("IBLParameterSvc",name), m_HitDiscCnfg(2), - m_HDCfromCOOL(true) + m_HDCfromCOOL(true), + m_pixid(0) { // template for property declaration declareProperty("StoreGateSvc" , m_sgSvc); @@ -90,7 +91,7 @@ StatusCode PixelOfflineCalibSvc::initialize() { CHECK(m_pixelCabling.retrieve()); ATH_MSG_INFO("Retrieved service " << m_pixelCabling); - CHECK(m_detStore->retrieve(m_pixel_id,"PixelID")); + CHECK(m_detStore->retrieve(m_pixid,"PixelID")); ATH_MSG_INFO("Retrieved Pixel ID helper"); CHECK(m_IBLParameterSvc.retrieve()); @@ -441,7 +442,7 @@ double PixelOfflineCalibSvc::getEndcapDeltaY() const { } int PixelOfflineCalibSvc::getIBLToToverflow() const { - int overflow; + int overflow = 16; if( m_HitDiscCnfg == 0 ) overflow = 14; if( m_HitDiscCnfg == 1 ) overflow = 15; if( m_HitDiscCnfg == 2 ) overflow = 16; @@ -454,7 +455,7 @@ int PixelOfflineCalibSvc::getIBLToToverflow(Identifier*) const { // The version with pixel identifier is the same as without identifier. In case it is needed in the future, it should be recoded. - int overflow; + int overflow = 16; if( m_HitDiscCnfg == 0 ) overflow = 14; if( m_HitDiscCnfg == 1 ) overflow = 15; if( m_HitDiscCnfg == 2 ) overflow = 16; @@ -469,7 +470,7 @@ void PixelOfflineCalibSvc::readHDC() { std::vector<int> HDCOccurence(5,0); for( int phi_index = 0; phi_index < 14; phi_index++ ){ for( int eta_index = -10; eta_index < 10; eta_index++ ){ - Identifier thiswafer = m_pixel_id->wafer_id(0,0,phi_index,eta_index); + Identifier thiswafer = m_pixid->wafer_id(0,0,phi_index,eta_index); uint32_t maxFE = 2; if( eta_index < -6 || eta_index > 5 )maxFE = 1; for( uint32_t FE_index = 0; FE_index < maxFE; FE_index++ ){ diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.h b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.h index 45fcd0e94883845705e7a7fb736182661a81d03c..8687463431ca6d66c743761af67a6d74c21f7b9d 100644 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.h +++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.h @@ -103,7 +103,7 @@ class PixelOfflineCalibSvc : public AthService, virtual public IPixelOfflineCali int m_HitDiscCnfg; bool m_HDCfromCOOL; - const PixelID* m_pixel_id; + const PixelID* m_pixid; }; #endif diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelTDAQSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelTDAQSvc.cxx index e84c3a8bdbfd99d07c3cbb7f8b52744824110a79..a3e0f448aacd2e7db4176168cbc3dfb15659c67d 100644 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelTDAQSvc.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelTDAQSvc.cxx @@ -25,10 +25,11 @@ PixelTDAQSvc::PixelTDAQSvc(const std::string& name, ISvcLocator* sl): m_print(0), m_modulelistkey("/TDAQ/EnabledResources/ATLAS/PIXEL/Modules"), m_atrlistcol(0), + m_pixelID(0), m_first_lumiblock_filled(false), m_print_disabled(true), m_always_disabled_module_name("L2_B11_S1_A6_M4A") - { +{ m_all_modules.clear(); m_disabled_modules.clear(); @@ -62,42 +63,22 @@ StatusCode PixelTDAQSvc::initialize(){ ATH_MSG_INFO("Initializing PixelTDAQSvc"); - StatusCode sc = m_detStore.retrieve(); - if(!sc.isSuccess()){ - ATH_MSG_FATAL("Unable to retrieve detector store"); - return StatusCode::FAILURE; - } - sc = m_pc.retrieve(); - if(!sc.isSuccess()){ - ATH_MSG_FATAL("Unable to retrieve pc"); - return StatusCode::FAILURE; - } + CHECK(m_detStore.retrieve()); + CHECK(m_pc.retrieve()); + //Register callback to update the list of modules //whenever the CondAttrListCollection is updated from the Database const DataHandle<CondAttrListCollection> attrListColl; - sc = m_detStore->regFcn(&IPixelTDAQSvc::IOVCallBack, - dynamic_cast<IPixelTDAQSvc*>(this), - attrListColl, m_modulelistkey); + CHECK(m_detStore->regFcn(&IPixelTDAQSvc::IOVCallBack,dynamic_cast<IPixelTDAQSvc*>(this),attrListColl,m_modulelistkey)); - if(!sc.isSuccess()){ - ATH_MSG_FATAL("Unable to register callback"); - return StatusCode::FAILURE; - } - - sc = m_detStore->retrieve( m_pixelID, "PixelID" ); - if( !sc.isSuccess() ){ - ATH_MSG_FATAL( "Unable to retrieve pixel ID helper" ); - return StatusCode::FAILURE; - } + CHECK(m_detStore->retrieve(m_pixelID,"PixelID")); return StatusCode::SUCCESS; } -StatusCode PixelTDAQSvc::finalize(){ - +StatusCode PixelTDAQSvc::finalize() { ATH_MSG_INFO("Finalizing PixelTDAQSvc"); - if(m_print_disabled) - print_disabled_modules(); + if (m_print_disabled) { print_disabled_modules(); } return StatusCode::SUCCESS; } @@ -109,13 +90,8 @@ StatusCode PixelTDAQSvc::IOVCallBack(IOVSVC_CALLBACK_ARGS_P(I, keys)){ for(std::list<std::string>::const_iterator key=keys.begin(); key != keys.end(); ++key) ATH_MSG_DEBUG("IOVCALLBACK for key " << *key << " number " << I<<"\n\t\t\t\t\t-----mtst-----\n"); - //usig TDAQ - StatusCode sc = m_detStore->retrieve(m_atrlistcol, m_modulelistkey); - if(!sc.isSuccess()){ - ATH_MSG_FATAL("Unable to retrieve CondAttrListCollection"); - return StatusCode::FAILURE; - } + CHECK(m_detStore->retrieve(m_atrlistcol,m_modulelistkey)); //update m_disabled_modules m_disabled_modules.clear(); diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/SpecialPixelMapSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/SpecialPixelMapSvc.cxx index 8c306273f1b922108c9853f9fe53db3513fcd32f..eb86e3eb26d70218f47facdbe2b32f3f077038e7 100755 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/SpecialPixelMapSvc.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/SpecialPixelMapSvc.cxx @@ -904,7 +904,7 @@ StatusCode SpecialPixelMapSvc::createFromDetectorStore(const std::string condAtt unsigned int idhash; if (m_forceNewDBContent) idhash = IdentifierHash(moduleID); else if(isIBL){ - if(m_dummy || IdentifierHash(moduleID)>2048){ + if(m_dummy || IdentifierHash(moduleID)>m_pixelID->wafer_hash_max()){ // continue (useful to transport the old DB to new DB with IBL!; int component = static_cast<int>((moduleID & (3 << 25)) / 33554432) * 2 - 2; unsigned int layer = (moduleID & (3 << 23)) / 8388608 ;