diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7fce76e65696296a2d115ea8d4cd839ae2d401aa --- /dev/null +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt @@ -0,0 +1,88 @@ +################################################################################ +# Package: PixelCalibAlgs +################################################################################ + +# Declare the package name: +atlas_subdir( PixelCalibAlgs ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaBaseComps + GaudiKernel + InnerDetector/InDetRecEvent/InDetPrepRawData + PRIVATE + Database/AthenaPOOL/AthenaPoolUtilities + Database/CoralDB + DetectorDescription/DetDescrCond/DetDescrConditions + DetectorDescription/Identifier + Event/EventInfo + InnerDetector/InDetConditions/InDetConditionsSummaryService + InnerDetector/InDetConditions/PixelConditionsData + InnerDetector/InDetConditions/PixelConditionsServices + InnerDetector/InDetDetDescr/InDetIdentifier + InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelGeoModel + InnerDetector/InDetRawEvent/InDetRawData + Tools/PathResolver ) + +# External dependencies: +find_package( CLHEP ) +find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) +find_package( ROOT COMPONENTS Matrix Gpad Graf Core Tree MathCore Hist RIO pthread GenVector MathMore Minuit Minuit2 Physics HistPainter Rint Graf3d Html Postscript Gui GX11TTF GX11 ) + +# tag ROOTCintexLibs was not recognized in automatic conversion in cmt2cmake + +# tag ROOTSTLDictLibs was not recognized in automatic conversion in cmt2cmake + +# tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake + +# Component(s) in the package: +atlas_add_library( PixelOfflineCalib + src/*.cxx + PUBLIC_HEADERS PixelCalibAlgs + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData + PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier InDetReadoutGeometry InDetRawData PathResolver ) + +atlas_add_component( PixelCalibAlgs + src/*.cxx + src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier InDetReadoutGeometry InDetRawData PathResolver PixelOfflineCalib ) + +atlas_add_executable( doPixelOfflineCalib + Application/doPixelOfflineCalib.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier InDetReadoutGeometry InDetRawData PathResolver PixelOfflineCalib ) + +atlas_add_executable( doPixelOfflineCalibG4 + Application/doPixelOfflineCalibG4.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier InDetReadoutGeometry InDetRawData PathResolver PixelOfflineCalib ) + +atlas_add_executable( PlotChargeSharingConstants + Application/PlotChargeSharingConstants.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier InDetReadoutGeometry InDetRawData PathResolver PixelOfflineCalib ) + +atlas_add_executable( PlotPixelClusterOnTrackErrors + Application/PlotPixelClusterOnTrackErrors.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier InDetReadoutGeometry InDetRawData PathResolver PixelOfflineCalib ) + +atlas_add_executable( updateNoiseMaps + Application/updateNoiseMaps.C + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier InDetReadoutGeometry InDetRawData PathResolver PixelOfflineCalib ) + +atlas_add_executable( updateDeadMaps + Application/updateDeadMaps.C + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier InDetReadoutGeometry InDetRawData PathResolver PixelOfflineCalib ) + +# Install files from the package: +atlas_install_joboptions( share/*.py ) +atlas_install_runtime( share/*.txt share/*.sh ) + diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/NoiseMapBuilder.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/NoiseMapBuilder.h index 75cc47927a9622bade47a2a885e48151d7462908..2ff2fc2c3da9404c7c7ce64153655426ad3f7d18 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/NoiseMapBuilder.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/NoiseMapBuilder.h @@ -53,13 +53,10 @@ class NoiseMapBuilder: public AthAlgorithm{ double m_nEvents; - TH1D* m_nEventsHist; std::vector<TH2D*> m_hitMaps; std::vector<TH2C*> m_noiseMaps; std::vector<TH1D*> m_LBdependence; - TH1D* m_disabledModules; - const PixelID* m_pixelID; double m_disk1ACut; @@ -85,6 +82,8 @@ class NoiseMapBuilder: public AthAlgorithm{ int m_lbMax; bool m_calculateNoiseMaps; + TH1D* m_nEventsHist; + TH1D* m_disabledModules; }; #endif diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h index b7c81ca71a5bb4e966763c6288385bc9bd2e7371..b50926350aeff442ca513c03366e246ca76880d6 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h @@ -16,6 +16,8 @@ #include<vector> class IPixelCalibSvc; +class IPixelOfflineCalibSvc; +class IBLParameterSvc; class PixelChargeToTConversion: public AthAlgorithm{ @@ -29,6 +31,9 @@ class PixelChargeToTConversion: public AthAlgorithm{ private: ServiceHandle<IPixelCalibSvc> m_calibsvc; + ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; + int m_overflowIBLToT; + ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; //std::vector<unsigned int> m_modules; std::string m_PixelsClustersName; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/cmt/requirements b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/cmt/requirements index 85103eb4f480759074351484090da382c6a903c3..97c4b792b9a11b26d9a89d1cd50c772d152c7305 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/cmt/requirements +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/cmt/requirements @@ -28,6 +28,7 @@ use InDetRawData InDetRawData-* InnerDetector/InDetRawEv use EventInfo EventInfo-* Event use InDetConditionsSummaryService InDetConditionsSummaryService-* InnerDetector/InDetConditions use AtlasCLHEP AtlasCLHEP-* External +use PixelGeoModel PixelGeoModel-* InnerDetector/InDetDetDescr public diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapOverlayWriter.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapOverlayWriter.cxx index 879b2ebf779e591767294632a73ea10bddc44849..208e2d4f635e39ae072489fe1597068ace3c3df9 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapOverlayWriter.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapOverlayWriter.cxx @@ -7,6 +7,7 @@ #include "PixelConditionsData/SpecialPixelMap.h" #include "PixelConditionsServices/ISpecialPixelMapSvc.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "PixelConditionsServices/ISpecialPixelMapSvc.h" // geometry #include "InDetIdentifier/PixelID.h" @@ -213,38 +214,35 @@ StatusCode PixMapOverlayWriter::execute(){ for(std::map<std::string, std::vector<int> >::const_iterator module = m_frontends.begin(); module != m_frontends.end(); ++module){ + + unsigned int modid_parsed= std::atoi((module->first).c_str()); + + IdentifierHash moduleHash = m_pixelID->wafer_hash(Identifier(modid_parsed)); try{ - if(db->objectType(module->first) == "MODULE"){ - IdentifierHash moduleHash = - m_pixelID->wafer_hash(Identifier(std::atoi(db->findAlias(module->first, "HASHID").c_str()))); - - if( moduleHash < m_pixelID->wafer_hash_max() ){ + if( moduleHash < m_pixelID->wafer_hash_max() ){ for( std::vector<int>::const_iterator frontend = module->second.begin(); frontend != module->second.end(); ++frontend ){ if( (*frontend) >= 0 && (*frontend) < 16 ){ + (*spm)[moduleHash]->setchipsPerModule( m_specialPixelMapSvc->getChips(moduleHash) ); (*spm)[moduleHash]->setChipStatus( (*frontend), m_moduleStatus); + } else{ ATH_MSG_ERROR( "Frontend index out of range: " << module->second << ", ignoring this frontend index" ); } - } - } + } //for + } //if 2 else{ ATH_MSG_ERROR( "Module hash out of range: " << moduleHash << ", ignoring this module hash" ); } - } - else{ - ATH_MSG_ERROR( module->first << " is of type " << db->objectType(module->first) - << " (expected MODULE), ignoring this object ID" ); - } - } + }//try catch(...){ ATH_MSG_ERROR( "Unable to look up type of object " << module->first << ", ignoring this object ID" ); diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx index e60395330ce7623e62580175f3a7ec5f396aa66e..8c648aa0a97c1baf8ab8b8b5b7d3fc1d50f5f0c1 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx @@ -7,11 +7,20 @@ #include "PixelConditionsServices/IPixelCalibSvc.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" #define private public + +#include "PixelGeoModel/IBLParameterSvc.h" +#include "InDetIdentifier/PixelID.h" #include "InDetPrepRawData/PixelCluster.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" + +#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" PixelChargeToTConversion::PixelChargeToTConversion(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), - m_calibsvc("PixelCalibSvc", name) + m_calibsvc("PixelCalibSvc", name), + m_IBLParameterSvc("IBLParameterSvc",name), + m_overflowIBLToT(0), + m_offlineCalibSvc("PixelOfflineCalibSvc", name) { declareProperty("PixelCalibSvc", m_calibsvc); } @@ -32,6 +41,25 @@ StatusCode PixelChargeToTConversion::initialize(){ } msg(MSG::INFO) << " PixelCalibSvc found " << endreq; + if ( !m_offlineCalibSvc.empty() ) { + StatusCode sc = m_offlineCalibSvc.retrieve(); + if (sc.isFailure() || !m_offlineCalibSvc ) { + ATH_MSG_ERROR( m_offlineCalibSvc.type() << " not found! "); + return StatusCode::RECOVERABLE; + } + else{ + ATH_MSG_INFO ( "Retrieved tool " << m_offlineCalibSvc.type() ); + } + } + + if (m_IBLParameterSvc.retrieve().isFailure()) { + ATH_MSG_FATAL("Could not retrieve IBLParameterSvc"); + return StatusCode::FAILURE; + } else + ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); + + m_overflowIBLToT = m_offlineCalibSvc->getIBLToToverflow(); + return StatusCode::SUCCESS; } @@ -61,6 +89,20 @@ StatusCode PixelChargeToTConversion::execute(){ auto theNonConstCluster = const_cast<InDet::PixelCluster*> (theCluster); ATH_MSG_DEBUG( "cluster RDOs , size, ToTs, size, Charges, size "<< RDOs <<" "<<RDOs.size()<<" "<< ToTs<<" " <<ToTs.size()<<" "<<Charges<<" "<<Charges.size()); + const InDetDD::SiDetectorElement* element=theCluster->detectorElement(); + if (element==0) { + ATH_MSG_ERROR("Could not get detector element"); + } + const AtlasDetectorID* aid = element->getIdHelper(); + if (aid==0){ + ATH_MSG_ERROR("Could not get ATLASDetectorID"); + } + const PixelID* pixelIDp=dynamic_cast<const PixelID*>(aid); + if (!pixelIDp){ + ATH_MSG_ERROR("Could not get PixelID pointer"); + } + const PixelID& pixelID = *pixelIDp; + int nRDO=RDOs.size(); // convert from Charge -> ToT if(ToTs.size()==0 && Charges.size()!=0){ @@ -81,10 +123,20 @@ StatusCode PixelChargeToTConversion::execute(){ if ( A>0. && (Charge+C)!=0 ) { tot = A*(Charge+E)/(Charge+C); } else tot=0.; + ATH_MSG_DEBUG( "A E C tot " << A <<" "<<E <<" "<<C<<" "<<tot); - totList.push_back( (int) (tot + 0.1)) ; // Fudge to make sure we round to the correct number - ATH_MSG_DEBUG( "from Charge --> ToT " << Charge <<" "<<(int) (tot + 0.1) ); - sumToT += (int) (tot + 0.1); + + int totInt = (int) (tot + 0.1); + + if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(pixid) == 0 && pixelID.layer_disk(pixid) == 0 ) { + int tot0 = totInt; + if ( totInt >= m_overflowIBLToT ) totInt = m_overflowIBLToT; + msg(MSG::DEBUG) << "barrel_ec = " << pixelID.barrel_ec(pixid) << " layer_disque = " << pixelID.layer_disk(pixid) << " ToT = " << tot0 << " Real ToT = " << totInt << endreq; + } + + totList.push_back( totInt ) ; // Fudge to make sure we round to the correct number + ATH_MSG_DEBUG( "from Charge --> ToT " << Charge <<" "<< totInt); + sumToT += totInt; } ATH_MSG_DEBUG( "sumToT " << sumToT); theNonConstCluster->m_totList = totList; @@ -95,8 +147,7 @@ StatusCode PixelChargeToTConversion::execute(){ }//loop over collections - - + return StatusCode::SUCCESS; }