diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt index 498ec7c1c63a2388b3adbb45ef8300ad68b6a499..30009fc3e3cf116371e047791fa359b476e32db5 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt @@ -19,6 +19,7 @@ atlas_depends_on_subdirs( Event/EventInfo InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetConditions/PixelConditionsData + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h index 3f5f25eede7010136c511e3aba2952515038e4fb..c99abf056c673f2d1208d81058e9ca9de6a8a6dd 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELCALIBALGS_PIXELCHARGETOTCONVERSION_H @@ -12,13 +12,14 @@ #include "InDetPrepRawData/PixelCluster.h" #include "InDetPrepRawData/PixelClusterContainer.h" +#include "PixelCabling/IPixelCablingSvc.h" #include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "StoreGate/ReadCondHandleKey.h" #include #include -class IPixelCalibSvc; class IBLParameterSvc; class PixelChargeToTConversion: public AthAlgorithm{ @@ -32,14 +33,20 @@ class PixelChargeToTConversion: public AthAlgorithm{ StatusCode finalize(); private: - ServiceHandle m_calibsvc; ServiceHandle m_IBLParameterSvc; //std::vector m_modules; std::string m_PixelsClustersName; const InDet::PixelClusterContainer* m_Pixel_clcontainer; - SG::ReadCondHandleKey m_moduleDataKey{this, "PixelModuleData", "PixelModuleData", "Output key of pixel module"}; + ServiceHandle m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service" }; + + SG::ReadCondHandleKey m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Charge calibration"}; }; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx index 6710782b737680e8403054974ad2fd689b3f9596..cebaecd82bcbbcdc1f883a710c9659a73cddb5fc 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx @@ -1,10 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // conditions #include "PixelCalibAlgs/PixelChargeToTConversion.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" #define private public @@ -15,11 +14,9 @@ PixelChargeToTConversion::PixelChargeToTConversion(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), - m_calibsvc("PixelCalibSvc", name), m_IBLParameterSvc("IBLParameterSvc",name), m_Pixel_clcontainer(0) { - declareProperty("PixelCalibSvc", m_calibsvc); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -32,19 +29,15 @@ StatusCode PixelChargeToTConversion::initialize(){ ATH_MSG_INFO( "Initializing PixelChargeToTConversion" ); - if (StatusCode::SUCCESS!=m_calibsvc.retrieve() ) { - msg(MSG::FATAL) << "PixelCalibSvc not found" << endmsg; - return StatusCode::FAILURE; - } - msg(MSG::INFO) << " PixelCalibSvc found " << endmsg; - if (m_IBLParameterSvc.retrieve().isFailure()) { ATH_MSG_FATAL("Could not retrieve IBLParameterSvc"); return StatusCode::FAILURE; } else ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); - + + ATH_CHECK(m_pixelCabling.retrieve()); ATH_CHECK(m_moduleDataKey.initialize()); + ATH_CHECK(m_chargeDataKey.initialize()); return StatusCode::SUCCESS; } @@ -62,9 +55,11 @@ StatusCode PixelChargeToTConversion::execute(){ int overflowIBLToT=0; if( m_IBLParameterSvc->containsIBL()) { - overflowIBLToT = SG::ReadCondHandle(m_moduleDataKey)->getIBLOverflowToT(); + overflowIBLToT = SG::ReadCondHandle(m_moduleDataKey)->getFEI4OverflowToT(0,0); } + SG::ReadCondHandle calibData(m_chargeDataKey); + typedef InDet::PixelClusterContainer::const_iterator ClusterIter; ClusterIter itrCluster; ClusterIter itrClubeg=m_Pixel_clcontainer->begin(); @@ -108,17 +103,12 @@ StatusCode PixelChargeToTConversion::execute(){ for (int i=0; igetQ2TotA(pixid); - float E = m_calibsvc->getQ2TotE(pixid); - float C = m_calibsvc->getQ2TotC(pixid); - float tot; - if (fabs(Charge+C)>0) { - tot = A*(Charge+E)/(Charge+C); - } else tot=0.; - - ATH_MSG_DEBUG( "A E C tot " << A <<" "<getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + int totInt = (int)calibData->getToT((int)moduleHash, circ, type, Charges[i]); if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(pixid) == 0 && pixelID.layer_disk(pixid) == 0 ) { int tot0 = totInt; diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt index 99c4567fd6586aeca55bb980e335781d6b3d0815..17cd376f6394fec6fda574f6f3ebeeb501d57e57 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt @@ -8,6 +8,7 @@ atlas_subdir( PixelConditionsAlgorithms ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + Commission/CommissionEvent Control/AthenaBaseComps Control/AthenaKernel Database/AthenaPOOL/AthenaPoolUtilities @@ -49,7 +50,7 @@ atlas_add_component( PixelConditionsAlgorithms INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${COOL_LIBRARIES} - ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities + ${CLHEP_LIBRARIES} CommissionEvent AthenaBaseComps AthenaKernel AthenaPoolUtilities GaudiKernel PixelConditionsData SGTools StoreGateLib CoralDB GeoModelUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelCablingLib PixelConditionsAlgorithmsLib PathResolver ) diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4039eb2993fd930a9c220d3b6fe24d34328ca868 --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx @@ -0,0 +1,207 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelChargeCalibCondAlg.h" +#include "Identifier/IdentifierHash.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "GaudiKernel/EventIDRange.h" +#include +#include + +PixelChargeCalibCondAlg::PixelChargeCalibCondAlg(const std::string& name, ISvcLocator* pSvcLocator): + ::AthAlgorithm(name, pSvcLocator), + m_pixelID(nullptr), + m_detManager(nullptr), + m_condSvc("CondSvc", name) +{ +} + +StatusCode PixelChargeCalibCondAlg::initialize() { + ATH_MSG_DEBUG("PixelChargeCalibCondAlg::initialize()"); + + ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID")); + ATH_CHECK(detStore()->retrieve(m_detManager,"Pixel")); + + ATH_CHECK(m_condSvc.retrieve()); + + ATH_CHECK(m_configKey.initialize()); + ATH_CHECK(m_readKey.initialize()); + + ATH_CHECK(m_writeKey.initialize()); + if (m_condSvc->regHandle(this,m_writeKey).isFailure()) { + ATH_MSG_FATAL("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc"); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +StatusCode PixelChargeCalibCondAlg::execute() { + ATH_MSG_DEBUG("PixelChargeCalibCondAlg::execute()"); + + SG::WriteCondHandle writeHandle(m_writeKey); + if (writeHandle.isValid()) { + ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order."); + return StatusCode::SUCCESS; + } + + SG::ReadCondHandle configData(m_configKey); + + // Construct the output Cond Object and fill it in + std::unique_ptr writeCdo(std::make_unique()); + + const EventIDBase start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM}; + const EventIDBase stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM}; + + EventIDRange rangeW{start, stop}; + if (configData->getUseCalibConditions()) { + SG::ReadCondHandle readHandle(m_readKey); + const CondAttrListCollection* readCdo = *readHandle; + if (readCdo==nullptr) { + ATH_MSG_FATAL("Null pointer to the read conditions object"); + return StatusCode::FAILURE; + } + // Get the validitiy range + if (not readHandle.range(rangeW)) { + ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key()); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size()); + ATH_MSG_INFO("Range of input is " << rangeW); + + for (CondAttrListCollection::const_iterator attrList=readCdo->begin(); attrList!=readCdo->end(); ++attrList) { + CondAttrListCollection::ChanNum channelNumber = attrList->first; + CondAttrListCollection::AttributeList payload = attrList->second; + + if (payload.exists("data") and not payload["data"].isNull()) { + std::string stringStatus = payload["data"].data(); + + std::stringstream ss(stringStatus); + std::vector component; + std::string buffer; + while (std::getline(ss,buffer,'\n')) { component.push_back(buffer); } + + for (int i=1; i<(int)component.size(); i++) { + std::stringstream checkFE(component[i]); + std::vector FEString; + while (std::getline(checkFE,buffer,' ')) { FEString.push_back(buffer); } + + // Normal pixel + writeCdo -> setAnalogThreshold((int)channelNumber, std::atoi(FEString[1].c_str())); + writeCdo -> setAnalogThresholdSigma((int)channelNumber, std::atoi(FEString[2].c_str())); + writeCdo -> setAnalogThresholdNoise((int)channelNumber, std::atoi(FEString[3].c_str())); + writeCdo -> setInTimeThreshold((int)channelNumber, std::atoi(FEString[4].c_str())); + + writeCdo -> setQ2TotA((int)channelNumber, std::atof(FEString[13].c_str())); + writeCdo -> setQ2TotE((int)channelNumber, std::atof(FEString[14].c_str())); + writeCdo -> setQ2TotC((int)channelNumber, std::atof(FEString[15].c_str())); + + writeCdo -> setTotRes1((int)channelNumber, std::atof(FEString[19].c_str())); + writeCdo -> setTotRes2((int)channelNumber, std::atof(FEString[20].c_str())); + + // Long pixel + writeCdo -> setAnalogThresholdLong((int)channelNumber, std::atoi(FEString[5].c_str())); + writeCdo -> setAnalogThresholdSigmaLong((int)channelNumber, std::atoi(FEString[6].c_str())); + writeCdo -> setAnalogThresholdNoiseLong((int)channelNumber, std::atoi(FEString[7].c_str())); + writeCdo -> setInTimeThresholdLong((int)channelNumber, std::atoi(FEString[8].c_str())); + + writeCdo -> setQ2TotALong((int)channelNumber, std::atof(FEString[16].c_str())); + writeCdo -> setQ2TotELong((int)channelNumber, std::atof(FEString[17].c_str())); + writeCdo -> setQ2TotCLong((int)channelNumber, std::atof(FEString[18].c_str())); + + // Ganged pixel + writeCdo -> setAnalogThresholdGanged((int)channelNumber, std::atoi(FEString[9].c_str())); + writeCdo -> setAnalogThresholdSigmaGanged((int)channelNumber, std::atoi(FEString[10].c_str())); + writeCdo -> setAnalogThresholdNoiseGanged((int)channelNumber, std::atoi(FEString[11].c_str())); + writeCdo -> setInTimeThresholdGanged((int)channelNumber, std::atoi(FEString[12].c_str())); + } + } + else { + ATH_MSG_WARNING("payload[\"data\"] does not exist for ChanNum " << channelNumber); + Identifier wafer_id = m_pixelID->wafer_id(IdentifierHash(channelNumber)); + int bec = m_pixelID->barrel_ec(wafer_id); + int layer = m_pixelID->layer_disk(wafer_id); + const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); + const InDetDD::PixelModuleDesign *p_design = static_cast(&element->design()); + for (int j=0; jnumberOfCircuits(); j++) { + writeCdo -> setAnalogThreshold((int)channelNumber, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigma((int)channelNumber,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoise((int)channelNumber,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThreshold((int)channelNumber, configData->getDefaultInTimeThreshold(bec,layer)); + writeCdo -> setQ2TotA((int)channelNumber, configData->getDefaultQ2TotA()); + writeCdo -> setQ2TotE((int)channelNumber, configData->getDefaultQ2TotE()); + writeCdo -> setQ2TotC((int)channelNumber, configData->getDefaultQ2TotC()); + writeCdo -> setTotRes1((int)channelNumber, 0.0); + writeCdo -> setTotRes2((int)channelNumber, 0.0); + + // Long pixel + writeCdo -> setAnalogThresholdLong((int)channelNumber, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigmaLong((int)channelNumber,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoiseLong((int)channelNumber,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThresholdLong((int)channelNumber, configData->getDefaultInTimeThreshold(bec,layer)); + + writeCdo -> setQ2TotALong((int)channelNumber, configData->getDefaultQ2TotA()); + writeCdo -> setQ2TotELong((int)channelNumber, configData->getDefaultQ2TotE()); + writeCdo -> setQ2TotCLong((int)channelNumber, configData->getDefaultQ2TotC()); + + // Ganged pixel + writeCdo -> setAnalogThresholdGanged((int)channelNumber, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigmaGanged((int)channelNumber,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoiseGanged((int)channelNumber,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThresholdGanged((int)channelNumber, configData->getDefaultInTimeThreshold(bec,layer)); + } + } + } + } + else { + for (int i=0; i<(int)m_pixelID->wafer_hash_max(); i++) { + Identifier wafer_id = m_pixelID->wafer_id(IdentifierHash(i)); + int bec = m_pixelID->barrel_ec(wafer_id); + int layer = m_pixelID->layer_disk(wafer_id); + const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); + const InDetDD::PixelModuleDesign *p_design = static_cast(&element->design()); + for (int j=0; jnumberOfCircuits(); j++) { + writeCdo -> setAnalogThreshold(i, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigma(i,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoise(i,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThreshold(i, configData->getDefaultInTimeThreshold(bec,layer)); + writeCdo -> setQ2TotA(i, configData->getDefaultQ2TotA()); + writeCdo -> setQ2TotE(i, configData->getDefaultQ2TotE()); + writeCdo -> setQ2TotC(i, configData->getDefaultQ2TotC()); + writeCdo -> setTotRes1(i, 0.0); + writeCdo -> setTotRes2(i, 0.0); + + // Long pixel + writeCdo -> setAnalogThresholdLong(i, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigmaLong(i,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoiseLong(i,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThresholdLong(i, configData->getDefaultInTimeThreshold(bec,layer)); + + writeCdo -> setQ2TotALong(i, configData->getDefaultQ2TotA()); + writeCdo -> setQ2TotELong(i, configData->getDefaultQ2TotE()); + writeCdo -> setQ2TotCLong(i, configData->getDefaultQ2TotC()); + + // Ganged pixel + writeCdo -> setAnalogThresholdGanged(i, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigmaGanged(i,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoiseGanged(i,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThresholdGanged(i, configData->getDefaultInTimeThreshold(bec,layer)); + } + } + } + + if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { + ATH_MSG_FATAL("Could not record PixelChargeCalibCondData " << writeHandle.key() << " with EventRange " << rangeW << " into Conditions Store"); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store"); + + return StatusCode::SUCCESS; +} + +StatusCode PixelChargeCalibCondAlg::finalize() { + ATH_MSG_DEBUG("PixelChargeCalibCondAlg::finalize()"); + return StatusCode::SUCCESS; +} + diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..2b94c0f860a0ff92dc445ee891dfe72b7854b5dd --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELCHARGECALIBCONDALG +#define PIXELCHARGECALIBCONDALG + +#include "AthenaBaseComps/AthAlgorithm.h" + +#include "StoreGate/ReadCondHandleKey.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" + +#include "StoreGate/WriteCondHandleKey.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" + +#include "InDetIdentifier/PixelID.h" +#include "InDetReadoutGeometry/PixelDetectorManager.h" + +#include "GaudiKernel/ICondSvc.h" +#include "GaudiKernel/Property.h" + +class PixelChargeCalibCondAlg : public AthAlgorithm { + public: + PixelChargeCalibCondAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~PixelChargeCalibCondAlg() = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; + + private: + const PixelID* m_pixelID; + const InDetDD::PixelDetectorManager * m_detManager; + + SG::ReadCondHandleKey m_configKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey m_readKey + {this, "ReadKey", "/PIXEL/PixCalib", "Iput charge calibration folder"}; + + SG::WriteCondHandleKey m_writeKey + {this, "WriteKey", "PixelChargeCalibCondData", "Output charge caliblation data"}; + + ServiceHandle m_condSvc; +}; + +#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx index 68bb88de45ac9ccfb2150f33fbcc463a08e7cfb0..1690b00e161072dfd3f8850b945def740c7e9d46 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx @@ -10,59 +10,138 @@ PixelConfigCondAlg::PixelConfigCondAlg(const std::string& name, ISvcLocator* pSvcLocator): ::AthReentrantAlgorithm(name, pSvcLocator), - m_BarrelAnalogThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_EndcapAnalogThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_DBMAnalogThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_BarrelToTThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_EndcapToTThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_DBMToTThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_BarrelLatency({256,256,256,256,256,256,256}), - m_EndcapLatency({256,256,256,256,256,256,256}), - m_DBMLatency({256,256,256,256,256,256,256}), - m_BarrelCrossTalk({0.06,0.06,0.06,0.06,0.06,0.06,0.06}), - m_EndcapCrossTalk({0.06,0.06,0.06,0.06,0.06,0.06,0.06}), - m_DBMCrossTalk({0.06,0.06,0.06,0.06,0.06,0.06,0.06}), - m_BarrelThermalNoise({160.0,160.0,160.0,160.0,160.0,160.0,160.0}), - m_EndcapThermalNoise({160.0,160.0,160.0,160.0,160.0,160.0,160.0}), - m_DBMThermalNoise({160.0,160.0,160.0,160.0,160.0,160.0,160.0}), - m_BarrelHitDuplication({false,false,false,false,false,false,false}), - m_EndcapHitDuplication({false,false,false,false,false,false,false}), - m_DBMHitDuplication({false,false,false,false,false,false,false}), - m_BarrelSmallHitToT({-1,-1,-1,-1,-1,-1,-1}), - m_EndcapSmallHitToT({-1,-1,-1,-1,-1,-1,-1}), - m_DBMSmallHitToT({-1,-1,-1,-1,-1,-1,-1}), - m_IBLHitDisConfig(2), + m_bunchSpace(25.0), + m_UseComTime(false), + m_ComTime(0.0), + m_BarrelNumberOfBCID({1,1,1,1}), + m_EndcapNumberOfBCID({1,1,1}), + m_DBMNumberOfBCID({1,1,1}), + m_BarrelTimeOffset({5.0,5.0,5.0,5.0}), + m_EndcapTimeOffset({5.0,5.0,5.0}), + m_DBMTimeOffset({5.0,5.0,5.0}), + m_BarrelTimeJitter({0.0,0.0,0.0,0.0}), + m_EndcapTimeJitter({0.0,0.0,0.0}), + m_DBMTimeJitter({0.0,0.0,0.0}), + m_useCalibConditions(true), + m_BarrelAnalogThreshold({2000,4300,3500,3500}), + m_EndcapAnalogThreshold({3500,3500,3500}), + m_DBMAnalogThreshold({2000,2000,2000}), + m_BarrelAnalogThresholdSigma({45,35,30,30}), + m_EndcapAnalogThresholdSigma({30,30,30}), + m_DBMAnalogThresholdSigma({70,70,70}), + m_BarrelAnalogThresholdNoise({130,150,160,160}), + m_EndcapAnalogThresholdNoise({150,150,150}), + m_DBMAnalogThresholdNoise({190,190,190}), + m_BarrelInTimeThreshold({2000,5000,5000,5000}), + m_EndcapInTimeThreshold({5000,5000,5000}), + m_DBMInTimeThreshold({1200,1200,1200}), + m_CalibrationParameterA(70.2), + m_CalibrationParameterE(-3561.25), + m_CalibrationParameterC(26000), + m_BarrelToTThreshold({-1, 3, 5, 5}), + m_EndcapToTThreshold({ 5, 5, 5}), + m_DBMToTThreshold({-1,-1,-1}), + m_BarrelCrossTalk({0.06,0.06,0.06,0.06}), + m_EndcapCrossTalk({0.06,0.06,0.06}), + m_DBMCrossTalk({0.06,0.06,0.06}), + m_BarrelThermalNoise({160.0,160.0,160.0,160.0}), + m_EndcapThermalNoise({160.0,160.0,160.0}), + m_DBMThermalNoise({160.0,160.0,160.0}), + m_BarrelNoiseOccupancy({5e-8,5e-8,5e-8,5e-8}), + m_EndcapNoiseOccupancy({5e-8,5e-8,5e-8}), + m_DBMNoiseOccupancy({5e-8,5e-8,5e-8}), + m_BarrelDisableProbability({9e-3,9e-3,9e-3,9e-3}), + m_EndcapDisableProbability({9e-3,9e-3,9e-3}), + m_DBMDisableProbability({9e-3,9e-3,9e-3}), + m_BarrelNoiseShape({{0.0,1.0},{0.0,1.0},{0.0,1.0},{0.0,1.0}}), + m_EndcapNoiseShape({{0.0,1.0},{0.0,1.0},{0.0,1.0}}), + m_DBMNoiseShape({{0.0,1.0},{0.0,1.0},{0.0,1.0}}), + m_IBLNoiseShape({0.0,1.0}), + m_BLayerNoiseShape({0.0,1.0}), + m_PixelNoiseShape({0.0,1.0}), + m_FEI3BarrelLatency({ 0,151,256,256}), + m_FEI3EndcapLatency({256,256,256}), + m_FEI3BarrelHitDuplication({false,false,false,false}), + m_FEI3EndcapHitDuplication({false,false,false}), + m_FEI3BarrelSmallHitToT({-1,-1,-1,-1}), + m_FEI3EndcapSmallHitToT({-1,-1,-1}), + m_FEI3BarrelTimingSimTune({2015,2015,2015,2015}), + m_FEI3EndcapTimingSimTune({2015,2015,2015}), + m_FEI4BarrelHitDiscConfig({2}), + m_FEI4EndcapHitDiscConfig({2}), m_useDeadMap(true), m_condSvc("CondSvc", name) { - declareProperty("BarrelAnalogThreshold", m_BarrelAnalogThreshold); - declareProperty("EndcapAnalogThreshold", m_EndcapAnalogThreshold); - declareProperty("DBMAnalogThreshold", m_DBMAnalogThreshold); + declareProperty("BunchSpace", m_bunchSpace); + declareProperty("UseComTime", m_UseComTime); + declareProperty("BarrelNumberOfBCID", m_BarrelNumberOfBCID); + declareProperty("EndcapNumberOfBCID", m_EndcapNumberOfBCID); + declareProperty("DBMNumberOfBCID", m_DBMNumberOfBCID); + declareProperty("BarrelTimeOffset", m_BarrelTimeOffset); + declareProperty("EndcapTimeOffset", m_EndcapTimeOffset); + declareProperty("DBMTimeOffset", m_DBMTimeOffset); + declareProperty("BarrelTimeJitter", m_BarrelTimeJitter); + declareProperty("EndcapTimeJitter", m_EndcapTimeJitter); + declareProperty("DBMTimeJitter", m_DBMTimeJitter); + declareProperty("UseCalibConditions", m_useCalibConditions); + declareProperty("DefaultBarrelAnalogThreshold", m_BarrelAnalogThreshold); + declareProperty("DefaultEndcapAnalogThreshold", m_EndcapAnalogThreshold); + declareProperty("DefaultDBMAnalogThreshold", m_DBMAnalogThreshold); + declareProperty("DefaultBarrelAnalogThresholdSigma", m_BarrelAnalogThresholdSigma); + declareProperty("DefaultEndcapAnalogThresholdSigma", m_EndcapAnalogThresholdSigma); + declareProperty("DefaultDBMAnalogThresholdSigma", m_DBMAnalogThresholdSigma); + declareProperty("DefaultBarrelAnalogThresholdNoise", m_BarrelAnalogThresholdNoise); + declareProperty("DefaultEndcapAnalogThresholdNoise", m_EndcapAnalogThresholdNoise); + declareProperty("DefaultDBMAnalogThresholdNoise", m_DBMAnalogThresholdNoise); + declareProperty("DefaultBarrelInTimeThreshold", m_BarrelInTimeThreshold); + declareProperty("DefaultEndcapInTimeThreshold", m_EndcapInTimeThreshold); + declareProperty("DefaultDBMInTimeThreshold", m_DBMInTimeThreshold); + declareProperty("DefaultCalibrationParameterA", m_CalibrationParameterA); + declareProperty("DefaultCalibrationParameterE", m_CalibrationParameterE); + declareProperty("DefaultCalibrationParameterC", m_CalibrationParameterC); declareProperty("BarrelToTThreshold", m_BarrelToTThreshold); declareProperty("EndcapToTThreshold", m_EndcapToTThreshold); declareProperty("DBMToTThreshold", m_DBMToTThreshold); - declareProperty("BarrelLatency", m_BarrelLatency); - declareProperty("EndcapLatency", m_EndcapLatency); - declareProperty("DBMLatency", m_DBMLatency); declareProperty("BarrelCrossTalk", m_BarrelCrossTalk); declareProperty("EndcapCrossTalk", m_EndcapCrossTalk); declareProperty("DBMCrossTalk", m_DBMCrossTalk); declareProperty("BarrelThermalNoise", m_BarrelThermalNoise); declareProperty("EndcapThermalNoise", m_EndcapThermalNoise); declareProperty("DBMThermalNoise", m_DBMThermalNoise); - declareProperty("BarrelHitDuplication", m_BarrelHitDuplication); - declareProperty("EndcapHitDuplication", m_EndcapHitDuplication); - declareProperty("DBMHitDuplication", m_DBMHitDuplication); - declareProperty("BarrelSmallHitToT", m_BarrelSmallHitToT); - declareProperty("EndcapSmallHitToT", m_EndcapSmallHitToT); - declareProperty("DBMSmallHitToT", m_DBMSmallHitToT); - declareProperty("FEI4HitDiscConfig", m_IBLHitDisConfig); +// declareProperty("BarrelNoiseShape", m_BarrelNoiseShape); // So far deaclareProperty does not accept 2D vector. +// declareProperty("EndcapNoiseShape", m_EndcapNoiseShape); +// declareProperty("DBMNoiseShape", m_DBMNoiseShape); + declareProperty("IBLNoiseShape", m_IBLNoiseShape); // This is ad-hoc solution. + declareProperty("BLayerNoiseShape", m_BLayerNoiseShape); + declareProperty("PixelNoiseShape", m_PixelNoiseShape); + declareProperty("FEI3BarrelLatency", m_FEI3BarrelLatency); + declareProperty("FEI3EndcapLatency", m_FEI3EndcapLatency); + declareProperty("FEI3BarrelHitDuplication", m_FEI3BarrelHitDuplication); + declareProperty("FEI3EndcapHitDuplication", m_FEI3EndcapHitDuplication); + declareProperty("FEI3BarrelSmallHitToT", m_FEI3BarrelSmallHitToT); + declareProperty("FEI3EndcapSmallHitToT", m_FEI3EndcapSmallHitToT); + declareProperty("FEI3BarrelTimingSimTune", m_FEI3BarrelTimingSimTune); + declareProperty("FEI3EndcapTimingSimTune", m_FEI3EndcapTimingSimTune); + declareProperty("FEI4BarrelHitDiscConfig", m_FEI4BarrelHitDiscConfig); + declareProperty("FEI4EndcapHitDiscConfig", m_FEI4EndcapHitDiscConfig); declareProperty("UseDeadMap", m_useDeadMap, "Switch for usage of dead map"); } StatusCode PixelConfigCondAlg::initialize() { ATH_MSG_DEBUG("PixelConfigCondAlg::initialize()"); + ATH_CHECK(m_ComTimeKey.initialize(m_UseComTime)); + if (m_UseComTime) { + SG::ReadHandle comTime(m_ComTimeKey); + if (comTime.isValid()) { + m_ComTime = comTime->getTime(); + ATH_MSG_DEBUG("Found tool for cosmic/commissioning timing: ComTime"); + } + else { + ATH_MSG_WARNING("Did not find tool needed for cosmic/commissioning timing: ComTime"); + } + } + ATH_CHECK(m_condSvc.retrieve()); if (m_useDeadMap) { ATH_CHECK(m_readDeadMapKey.initialize()); } @@ -73,11 +152,6 @@ StatusCode PixelConfigCondAlg::initialize() { return StatusCode::FAILURE; } - if (m_IBLHitDisConfig<0 || m_IBLHitDisConfig>3) { - ATH_MSG_FATAL("HitDiscConfig should be set [0-3]. (FEI4HitDiscConfig=" << m_IBLHitDisConfig << ")"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; } @@ -192,28 +266,91 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { // Set threshold //=============== EventIDRange rangeThreshold{start, stop}; - writeCdo -> setBarrelAnalogThreshold(m_BarrelAnalogThreshold); - writeCdo -> setEndcapAnalogThreshold(m_EndcapAnalogThreshold); - writeCdo -> setDBMAnalogThreshold(m_DBMAnalogThreshold); + writeCdo -> setBunchSpace(m_bunchSpace); + writeCdo -> setUseComTime(m_UseComTime); + writeCdo -> setComTime(m_ComTime); + writeCdo -> setBarrelNumberOfBCID(m_BarrelNumberOfBCID); + writeCdo -> setEndcapNumberOfBCID(m_EndcapNumberOfBCID); + writeCdo -> setDBMNumberOfBCID(m_DBMNumberOfBCID); + writeCdo -> setBarrelTimeOffset(m_BarrelTimeOffset); + writeCdo -> setEndcapTimeOffset(m_EndcapTimeOffset); + writeCdo -> setDBMTimeOffset(m_DBMTimeOffset); + writeCdo -> setBarrelTimeJitter(m_BarrelTimeJitter); + writeCdo -> setEndcapTimeJitter(m_EndcapTimeJitter); + writeCdo -> setDBMTimeJitter(m_DBMTimeJitter); + writeCdo -> setUseCalibConditions(m_useCalibConditions); + writeCdo -> setDefaultBarrelAnalogThreshold(m_BarrelAnalogThreshold); + writeCdo -> setDefaultEndcapAnalogThreshold(m_EndcapAnalogThreshold); + writeCdo -> setDefaultDBMAnalogThreshold(m_DBMAnalogThreshold); + writeCdo -> setDefaultBarrelAnalogThresholdSigma(m_BarrelAnalogThresholdSigma); + writeCdo -> setDefaultEndcapAnalogThresholdSigma(m_EndcapAnalogThresholdSigma); + writeCdo -> setDefaultDBMAnalogThresholdSigma(m_DBMAnalogThresholdSigma); + writeCdo -> setDefaultBarrelAnalogThresholdNoise(m_BarrelAnalogThresholdNoise); + writeCdo -> setDefaultEndcapAnalogThresholdNoise(m_EndcapAnalogThresholdNoise); + writeCdo -> setDefaultDBMAnalogThresholdNoise(m_DBMAnalogThresholdNoise); + writeCdo -> setDefaultBarrelInTimeThreshold(m_BarrelInTimeThreshold); + writeCdo -> setDefaultEndcapInTimeThreshold(m_EndcapInTimeThreshold); + writeCdo -> setDefaultDBMInTimeThreshold(m_DBMInTimeThreshold); + writeCdo -> setDefaultQ2TotA(m_CalibrationParameterA); + writeCdo -> setDefaultQ2TotE(m_CalibrationParameterE); + writeCdo -> setDefaultQ2TotC(m_CalibrationParameterC); writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold); writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold); writeCdo -> setDBMToTThreshold(m_DBMToTThreshold); - writeCdo -> setBarrelLatency(m_BarrelLatency); - writeCdo -> setEndcapLatency(m_EndcapLatency); - writeCdo -> setDBMLatency(m_DBMLatency); writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk); writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk); writeCdo -> setDBMCrossTalk(m_DBMCrossTalk); writeCdo -> setBarrelThermalNoise(m_BarrelThermalNoise); writeCdo -> setEndcapThermalNoise(m_EndcapThermalNoise); writeCdo -> setDBMThermalNoise(m_DBMThermalNoise); - writeCdo -> setBarrelHitDuplication(m_BarrelHitDuplication); - writeCdo -> setEndcapHitDuplication(m_EndcapHitDuplication); - writeCdo -> setDBMHitDuplication(m_DBMHitDuplication); - writeCdo -> setBarrelSmallHitToT(m_BarrelSmallHitToT); - writeCdo -> setEndcapSmallHitToT(m_EndcapSmallHitToT); - writeCdo -> setDBMSmallHitToT(m_DBMSmallHitToT); - writeCdo -> setIBLHitDiscConfig(m_IBLHitDisConfig); + writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy); + writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy); + writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy); + writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability); + writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability); + writeCdo -> setDBMDisableProbability(m_DBMDisableProbability); + + for (size_t i=0; isetBarrelNoiseShape(0,m_IBLNoiseShape.at(i)); } + for (size_t i=0; isetBarrelNoiseShape(1,m_BLayerNoiseShape.at(i)); } + for (size_t i=0; isetBarrelNoiseShape(2,m_PixelNoiseShape.at(i)); } + for (size_t i=0; isetBarrelNoiseShape(3,m_PixelNoiseShape.at(i)); } + + for (size_t i=0; isetEndcapNoiseShape(0,m_PixelNoiseShape.at(i)); } + for (size_t i=0; isetEndcapNoiseShape(1,m_PixelNoiseShape.at(i)); } + for (size_t i=0; isetEndcapNoiseShape(2,m_PixelNoiseShape.at(i)); } + + for (size_t i=0; isetDBMNoiseShape(0,m_IBLNoiseShape.at(i)); } + for (size_t i=0; isetDBMNoiseShape(1,m_IBLNoiseShape.at(i)); } + for (size_t i=0; isetDBMNoiseShape(2,m_IBLNoiseShape.at(i)); } + +/* + for (size_t i=0; i setBarrelNoiseShape(i,m_BarrelNoiseShape[i][j]); + } + } + for (size_t i=0; i setEndcapNoiseShape(i,m_EndcapNoiseShape[i][j]); + } + } + for (size_t i=0; i setDBMNoiseShape(i,m_DBMNoiseShape[i][j]); + } + } +*/ + + writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency); + writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency); + writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication); + writeCdo -> setFEI3EndcapHitDuplication(m_FEI3EndcapHitDuplication); + writeCdo -> setFEI3BarrelSmallHitToT(m_FEI3BarrelSmallHitToT); + writeCdo -> setFEI3EndcapSmallHitToT(m_FEI3EndcapSmallHitToT); + writeCdo -> setFEI3BarrelTimingSimTune(m_FEI3BarrelTimingSimTune); + writeCdo -> setFEI3EndcapTimingSimTune(m_FEI3EndcapTimingSimTune); + writeCdo -> setFEI4BarrelHitDiscConfig(m_FEI4BarrelHitDiscConfig); + writeCdo -> setFEI4EndcapHitDiscConfig(m_FEI4EndcapHitDiscConfig); //======================= // Combine time interval diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h index 1893d81a21dd72367ccaaa9719b47077aff3a678..6be5362640e3d6e4e15d44512ed08da9d5da7125 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELCONFIGCONDALG @@ -9,6 +9,7 @@ #include "StoreGate/ReadCondHandleKey.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "CommissionEvent/ComTime.h" #include "StoreGate/WriteCondHandleKey.h" #include "PixelConditionsData/PixelModuleData.h" @@ -25,31 +26,71 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { virtual StatusCode finalize() override; private: + double m_bunchSpace; + bool m_UseComTime; + double m_ComTime; + std::vector m_BarrelNumberOfBCID; + std::vector m_EndcapNumberOfBCID; + std::vector m_DBMNumberOfBCID; + std::vector m_BarrelTimeOffset; + std::vector m_EndcapTimeOffset; + std::vector m_DBMTimeOffset; + std::vector m_BarrelTimeJitter; + std::vector m_EndcapTimeJitter; + std::vector m_DBMTimeJitter; + bool m_useCalibConditions; std::vector m_BarrelAnalogThreshold; std::vector m_EndcapAnalogThreshold; std::vector m_DBMAnalogThreshold; + std::vector m_BarrelAnalogThresholdSigma; + std::vector m_EndcapAnalogThresholdSigma; + std::vector m_DBMAnalogThresholdSigma; + std::vector m_BarrelAnalogThresholdNoise; + std::vector m_EndcapAnalogThresholdNoise; + std::vector m_DBMAnalogThresholdNoise; + std::vector m_BarrelInTimeThreshold; + std::vector m_EndcapInTimeThreshold; + std::vector m_DBMInTimeThreshold; + float m_CalibrationParameterA; + float m_CalibrationParameterE; + float m_CalibrationParameterC; std::vector m_BarrelToTThreshold; std::vector m_EndcapToTThreshold; std::vector m_DBMToTThreshold; - std::vector m_BarrelLatency; - std::vector m_EndcapLatency; - std::vector m_DBMLatency; std::vector m_BarrelCrossTalk; std::vector m_EndcapCrossTalk; std::vector m_DBMCrossTalk; std::vector m_BarrelThermalNoise; std::vector m_EndcapThermalNoise; std::vector m_DBMThermalNoise; - std::vector m_BarrelHitDuplication; - std::vector m_EndcapHitDuplication; - std::vector m_DBMHitDuplication; - std::vector m_BarrelSmallHitToT; - std::vector m_EndcapSmallHitToT; - std::vector m_DBMSmallHitToT; - int m_IBLHitDisConfig; + std::vector m_BarrelNoiseOccupancy; + std::vector m_EndcapNoiseOccupancy; + std::vector m_DBMNoiseOccupancy; + std::vector m_BarrelDisableProbability; + std::vector m_EndcapDisableProbability; + std::vector m_DBMDisableProbability; + std::vector> m_BarrelNoiseShape; + std::vector> m_EndcapNoiseShape; + std::vector> m_DBMNoiseShape; + std::vector m_IBLNoiseShape; // This is ad-hoc solution. + std::vector m_BLayerNoiseShape; + std::vector m_PixelNoiseShape; + std::vector m_FEI3BarrelLatency; + std::vector m_FEI3EndcapLatency; + std::vector m_FEI3BarrelHitDuplication; + std::vector m_FEI3EndcapHitDuplication; + std::vector m_FEI3BarrelSmallHitToT; + std::vector m_FEI3EndcapSmallHitToT; + std::vector m_FEI3BarrelTimingSimTune; + std::vector m_FEI3EndcapTimingSimTune; + std::vector m_FEI4BarrelHitDiscConfig; + std::vector m_FEI4EndcapHitDiscConfig; bool m_useDeadMap; + SG::ReadHandleKey m_ComTimeKey + {this, "ComTimeKey", "ComTime", "Commissioning time for cosmic"}; + SG::ReadCondHandleKey m_readDeadMapKey {this, "ReadDeadMapKey", "/PIXEL/PixMapOverlay", "Input key of deadmap conditions folder"}; diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx index 3477d414a0dd14f7252fdb3f56a29ccac2de43de..710adbe4857ef51152f689384f04b3a76531f5e1 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx @@ -16,36 +16,38 @@ StatusCode PixelSiliconConditionsTestAlg::initialize() { ATH_MSG_INFO("Calling initialize"); -// OLD ATH_CHECK(m_siliconTool.retrieve()); + ATH_CHECK(m_moduleDataKey.initialize()); ATH_CHECK(m_readKeyTemp.initialize()); ATH_CHECK(m_readKeyHV.initialize()); ATH_CHECK(m_moduleDataKey.initialize()); ATH_CHECK(m_lorentzAngleTool.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); return StatusCode::SUCCESS; } StatusCode PixelSiliconConditionsTestAlg::execute(){ - //This method is only used to test the summary service, and only used within this package, - // so the INFO level messages have no impact on performance of these services when used by clients SG::ReadCondHandle hv(m_readKeyHV); SG::ReadCondHandle temp(m_readKeyTemp); SG::ReadCondHandle deadmap(m_moduleDataKey); - - // Check HV - for (int i=0; i<2048; i++) { std::cout << "PIXEL HV : " << i << " " << hv->getBiasVoltage(i) << std::endl; } -// OLD for (int i=0; i<2048; i++) { std::cout << "PIXEL HV : " << i << " " << m_siliconTool->biasVoltage(IdentifierHash(i)) << std::endl; } - - // Check temperature - for (int i=0; i<2048; i++) { std::cout << "PIXEL Temperature : " << i << " " << temp->getTemperature(i) << std::endl; } -// OLD for (int i=0; i<2048; i++) { std::cout << "PIXEL Temperature : " << i << " " << m_siliconTool->temperature(IdentifierHash(i)) << std::endl; } - - // Check deadmap - for (int i=0; i<2048; i++) { std::cout << "PIXEL Deadmap : " << i << " " << deadmap->getModuleStatus(i) << std::endl; } -// OLD for (int i=0; i<2048; i++) { std::cout << "PIXEL Deadmap : " << i << " " << deadmap->getModuleStatus(IdentifierHash(i)) << std::endl; } - - for (int i=0; i<2048; i++) { std::cout << "PIXEL LorentzAngle : " << i << " " << m_lorentzAngleTool->getLorentzShift(IdentifierHash(i)) << std::endl; } + SG::ReadCondHandle calib(m_chargeDataKey); + + for (int i=0; i<2048; i++) { + ATH_MSG_DEBUG("PIXEL Module hash=" << i + << " HV=" << hv->getBiasVoltage(i) + << " Temperature=" << temp->getTemperature(i) + << " Status=" << deadmap->getModuleStatus(i) + << " LorentzShift=" << m_lorentzAngleTool->getLorentzShift(IdentifierHash(i))); + ATH_MSG_DEBUG("Charge:"); + for (int j=0; j<16; j++) { + ATH_MSG_DEBUG(" FE=" << j + << " Threshold=" << calib->getAnalogThreshold(i,j,0) + << " Parameter A=" << calib->getQ2TotA(i,j,0) + << " Parameter E=" << calib->getQ2TotE(i,j,0) + << " Parameter C=" << calib->getQ2TotC(i,j,0)); + } + } return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h index 2d53262b3743c37ef377ae2ec96efffdd3c392e1..4b1ca945edb4788829bd5ce3a8abb1dd939dcc18 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h @@ -10,11 +10,10 @@ #include "GaudiKernel/ToolHandle.h" #include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "StoreGate/ReadCondHandleKey.h" #include "InDetCondTools/ISiLorentzAngleTool.h" -// OLD #include "PixelConditionsTools/IPixelDCSConditionsTool.h" - class PixelSiliconConditionsTestAlg : public AthAlgorithm { public: PixelSiliconConditionsTestAlg(const std::string &name,ISvcLocator *pSvcLocator) ; @@ -25,11 +24,21 @@ class PixelSiliconConditionsTestAlg : public AthAlgorithm { virtual StatusCode finalize() override; private: -// OLD ToolHandle m_siliconTool{this, "PixelDCSConditionsTool", "PixelDCSConditionsTool", "Tool to retrieve Pixel information"}; - SG::ReadCondHandleKey m_readKeyTemp{this, "ReadKeyeTemp", "PixelDCSTempCondData", "Key of input sensor temperature conditions folder"}; - SG::ReadCondHandleKey m_readKeyHV {this, "ReadKeyHV", "PixelDCSHVCondData", "Key of input bias voltage conditions folder"}; - SG::ReadCondHandleKey m_moduleDataKey{this, "PixelModuleData", "PixelModuleData", "Output key"}; - ToolHandle m_lorentzAngleTool{this, "LorentzAngleTool", "PixelLorentzAngleTool", "Tool to retreive Lorentz angle"}; + SG::ReadCondHandleKey m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Output key"}; + + SG::ReadCondHandleKey m_readKeyTemp + {this, "ReadKeyeTemp", "PixelDCSTempCondData", "Key of input sensor temperature conditions folder"}; + + SG::ReadCondHandleKey m_readKeyHV + {this, "ReadKeyHV", "PixelDCSHVCondData", "Key of input bias voltage conditions folder"}; + + ToolHandle m_lorentzAngleTool + {this, "LorentzAngleTool", "PixelLorentzAngleTool", "Tool to retreive Lorentz angle"}; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Output key"}; + }; #endif diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx index 1cd3338be77174ac62935b31d9290823df1d8d47..a47d6ed87022d6fe7d5541fd73e2bfa7f2386794 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx @@ -2,6 +2,7 @@ #include "../PixelDCSCondTempAlg.h" #include "../PixelDCSCondStateAlg.h" #include "../PixelConfigCondAlg.h" +#include "../PixelChargeCalibCondAlg.h" #include "../PixelTDAQCondAlg.h" #include "../PixelSiliconConditionsTestAlg.h" #include "../SpecialPixelMapCondAlg.h" @@ -11,6 +12,7 @@ DECLARE_COMPONENT( PixelDCSCondHVAlg ) DECLARE_COMPONENT( PixelDCSCondTempAlg ) DECLARE_COMPONENT( PixelDCSCondStateAlg ) DECLARE_COMPONENT( PixelConfigCondAlg ) +DECLARE_COMPONENT( PixelChargeCalibCondAlg ) DECLARE_COMPONENT( PixelTDAQCondAlg ) DECLARE_COMPONENT( PixelSiliconConditionsTestAlg ) DECLARE_COMPONENT( SpecialPixelMapCondAlg ) diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeCalibCondData.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeCalibCondData.h new file mode 100644 index 0000000000000000000000000000000000000000..927f3e582d4c3abc686bbe96a97991f42942c8c9 --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeCalibCondData.h @@ -0,0 +1,104 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELCHARGECALIBCONDDATA_H +#define PIXELCHARGECALIBCONDDATA_H + +#include "AthenaKernel/CLASS_DEF.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" +#include + +class PixelChargeCalibCondData { + public: + PixelChargeCalibCondData(); + virtual ~PixelChargeCalibCondData(); + + enum PixelType{NORMAL,LONG,GANGED}; + + // Normal pixel + void setAnalogThreshold(const int chanNum, const int value); + void setAnalogThresholdSigma(const int chanNum, const int value); + void setAnalogThresholdNoise(const int chanNum, const int value); + void setInTimeThreshold(const int chanNum, const int value); + + void setQ2TotA(const int chanNum, const float value); + void setQ2TotE(const int chanNum, const float value); + void setQ2TotC(const int chanNum, const float value); + + void setTotRes1(const int chanNum, const float value); + void setTotRes2(const int chanNum, const float value); + + int getAnalogThreshold(const int chanNum, const int FE, const int type) const; + int getAnalogThresholdSigma(const int chanNum, const int FE, const int type) const; + int getAnalogThresholdNoise(const int chanNum, const int FE, const int type) const; + int getInTimeThreshold(const int chanNum, const int FE, const int type) const; + + float getQ2TotA(const int chanNum, const int FE, const int type) const; + float getQ2TotE(const int chanNum, const int FE, const int type) const; + float getQ2TotC(const int chanNum, const int FE, const int type) const; + + float getTotRes(const int chanNum, const int FE, float Q) const; + + // Long pixel + void setAnalogThresholdLong(const int chanNum, const int value); + void setAnalogThresholdSigmaLong(const int chanNum, const int value); + void setAnalogThresholdNoiseLong(const int chanNum, const int value); + void setInTimeThresholdLong(const int chanNum, const int value); + + void setQ2TotALong(const int chanNum, const float value); + void setQ2TotELong(const int chanNum, const float value); + void setQ2TotCLong(const int chanNum, const float value); + + // Ganged pixel + void setAnalogThresholdGanged(const int chanNum, const int value); + void setAnalogThresholdSigmaGanged(const int chanNum, const int value); + void setAnalogThresholdNoiseGanged(const int chanNum, const int value); + void setInTimeThresholdGanged(const int chanNum, const int value); + + float getToT(const int chanNum, const int FE, const int type, float Q) const; + float getCharge(const int chanNum, const int FE, const int type, float ToT) const; + + void clear(); + + private: + typedef std::map> chipThreshold; + typedef std::map> chipCharge; + + // Normal pixel + chipThreshold m_analogThreshold; + chipThreshold m_analogThresholdSigma; + chipThreshold m_analogThresholdNoise; + chipThreshold m_intimethreshold; + + chipCharge m_totA; + chipCharge m_totE; + chipCharge m_totC; + + chipCharge m_totRes1; + chipCharge m_totRes2; + + // Long pixel + chipThreshold m_analogThresholdLong; + chipThreshold m_analogThresholdSigmaLong; + chipThreshold m_analogThresholdNoiseLong; + chipThreshold m_intimethresholdLong; + + chipCharge m_totALong; + chipCharge m_totELong; + chipCharge m_totCLong; + + // Ganged pixel + chipThreshold m_analogThresholdGanged; + chipThreshold m_analogThresholdSigmaGanged; + chipThreshold m_analogThresholdNoiseGanged; + chipThreshold m_intimethresholdGanged; + +}; + +CLASS_DEF( PixelChargeCalibCondData , 345532779 , 1 ) + +#include "AthenaKernel/CondCont.h" +CONDCONT_DEF( PixelChargeCalibCondData, 578786399 ); + +#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h index 1ace713919d3a82e4f01fa144b4016792333d8f9..baa3470c6e2b3e6d8110bb0de0517d39dd8df25e 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h @@ -28,21 +28,66 @@ class PixelModuleData { enum DCSModuleStatus{OK,WARNING,ERROR,FATAL,NOSTATUS}; enum DCSModuleState{READY,ON,UNKNOWN,TRANSITION,UNDEFINED,NOSTATE}; - void setBarrelAnalogThreshold(std::vector BarrelAnalogThreshold); - void setEndcapAnalogThreshold(std::vector EndcapAnalogThreshold); - void setDBMAnalogThreshold(std::vector DBMAnalogThreshold); - int getAnalogThreshold(int bec, int layer) const; + // set via job option + void setBunchSpace(double bunchSpace); + double getBunchSpace() const; + + void setUseComTime(bool UseComTime); + bool getUseComTime() const; + + void setComTime(double ComTime); + double getComTime() const; + + void setBarrelNumberOfBCID(std::vector BarrelNumberOfBCID); + void setEndcapNumberOfBCID(std::vector EndcapNumberOfBCID); + void setDBMNumberOfBCID(std::vector DBMNumberOfBCID); + int getNumberOfBCID(int bec, int layer) const; + + void setBarrelTimeOffset(std::vector BarrelTimeOffset); + void setEndcapTimeOffset(std::vector EndcapTimeOffset); + void setDBMTimeOffset(std::vector DBMTimeOffset); + double getTimeOffset(int bec, int layer) const; + + void setBarrelTimeJitter(std::vector BarrelTimeJitter); + void setEndcapTimeJitter(std::vector EndcapTimeJitter); + void setDBMTimeJitter(std::vector DBMTimeJitter); + double getTimeJitter(int bec, int layer) const; + + void setUseCalibConditions(bool UseCalibConditions); + bool getUseCalibConditions() const; + + void setDefaultBarrelAnalogThreshold(std::vector BarrelAnalogThreshold); + void setDefaultEndcapAnalogThreshold(std::vector EndcapAnalogThreshold); + void setDefaultDBMAnalogThreshold(std::vector DBMAnalogThreshold); + int getDefaultAnalogThreshold(int bec, int layer) const; + + void setDefaultBarrelAnalogThresholdSigma(std::vector BarrelAnalogThresholdSigma); + void setDefaultEndcapAnalogThresholdSigma(std::vector EndcapAnalogThresholdSigma); + void setDefaultDBMAnalogThresholdSigma(std::vector DBMAnalogThresholdSigma); + int getDefaultAnalogThresholdSigma(int bec, int layer) const; + + void setDefaultBarrelAnalogThresholdNoise(std::vector BarrelAnalogThresholdNoise); + void setDefaultEndcapAnalogThresholdNoise(std::vector EndcapAnalogThresholdNoise); + void setDefaultDBMAnalogThresholdNoise(std::vector DBMAnalogThresholdNoise); + int getDefaultAnalogThresholdNoise(int bec, int layer) const; + + void setDefaultBarrelInTimeThreshold(std::vector BarrelInTimeThreshold); + void setDefaultEndcapInTimeThreshold(std::vector EndcapInTimeThreshold); + void setDefaultDBMInTimeThreshold(std::vector DBMInTimeThreshold); + int getDefaultInTimeThreshold(int bec, int layer) const; + + void setDefaultQ2TotA(float paramA); + void setDefaultQ2TotE(float paramE); + void setDefaultQ2TotC(float paramC); + float getDefaultQ2TotA() const; + float getDefaultQ2TotE() const; + float getDefaultQ2TotC() const; void setBarrelToTThreshold(std::vector BarrelToTThreshold); void setEndcapToTThreshold(std::vector EndcapToTThreshold); void setDBMToTThreshold(std::vector DBMToTThreshold); int getToTThreshold(int bec, int layer) const; - void setBarrelLatency(std::vector BarrelLatency); - void setEndcapLatency(std::vector EndcapLatency); - void setDBMLatency(std::vector DBMLatency); - int getLatency(int bec, int layer) const; - void setBarrelCrossTalk(std::vector BarrelCrossTalk); void setEndcapCrossTalk(std::vector EndcapCrossTalk); void setDBMCrossTalk(std::vector DBMCrossTalk); @@ -53,19 +98,41 @@ class PixelModuleData { void setDBMThermalNoise(std::vector DBMThermalNoise); double getThermalNoise(int bec, int layer) const; - void setBarrelHitDuplication(std::vector BarrelHitDuplication); - void setEndcapHitDuplication(std::vector EndcapHitDuplication); - void setDBMHitDuplication(std::vector DBMHitDuplication); - bool getHitDuplication(int bec, int layer) const; + void setBarrelNoiseOccupancy(std::vector BarrelNoiseOccupancy); + void setEndcapNoiseOccupancy(std::vector EndcapNoiseOccupancy); + void setDBMNoiseOccupancy(std::vector DBMNoiseOccupancy); + double getNoiseOccupancy(int bec, int layer) const; + + void setBarrelDisableProbability(std::vector BarrelDisableProbability); + void setEndcapDisableProbability(std::vector EndcapDisableProbability); + void setDBMDisableProbability(std::vector DBMDisableProbability); + double getDisableProbability(int bec, int layer) const; + + void setBarrelNoiseShape(const int layer, const float BarrelNoiseShape); + void setEndcapNoiseShape(const int layer, const float EndcapNoiseShape); + void setDBMNoiseShape(const int layer, const float DBMNoiseShape); + std::vector getNoiseShape(const int bec, const int layer) const; + + void setFEI3BarrelLatency(std::vector FEI3BarrelLatency); + void setFEI3EndcapLatency(std::vector FEI3EndcapLatency); + int getFEI3Latency(int bec, int layer) const; - void setBarrelSmallHitToT(std::vector BarrelSmallHitToT); - void setEndcapSmallHitToT(std::vector EndcapSmallHitToT); - void setDBMSmallHitToT(std::vector DBMSmallHitToT); - int getSmallHitToT(int bec, int layer) const; + void setFEI3BarrelHitDuplication(std::vector FEI3BarrelHitDuplication); + void setFEI3EndcapHitDuplication(std::vector FEI3EndcapHitDuplication); + bool getFEI3HitDuplication(int bec, int layer) const; - void setIBLHitDiscConfig(const int hitDiscConfig); - int getIBLHitDiscConfig() const; - int getIBLOverflowToT() const; + void setFEI3BarrelSmallHitToT(std::vector FEI3BarrelSmallHitToT); + void setFEI3EndcapSmallHitToT(std::vector FEI3EndcapSmallHitToT); + int getFEI3SmallHitToT(int bec, int layer) const; + + void setFEI3BarrelTimingSimTune(std::vector FEI3BarrelTimingSimTune); + void setFEI3EndcapTimingSimTune(std::vector FEI3EndcapTimingSimTune); + int getFEI3TimingSimTune(int bec, int layer) const; + + void setFEI4BarrelHitDiscConfig(std::vector FEI4BarrelHitDiscConfig); + void setFEI4EndcapHitDiscConfig(std::vector FEI4EndcapHitDiscConfig); + int getFEI4HitDiscConfig(int bec, int layer) const; + int getFEI4OverflowToT(int bec, int layer) const; void clear(); @@ -77,28 +144,71 @@ class PixelModuleData { IntConditions m_moduleStatus; IntConditions m_chipStatus; - std::vector m_BarrelAnalogThreshold; - std::vector m_EndcapAnalogThreshold; - std::vector m_DBMAnalogThreshold; + typedef std::map> chipCharge; + + double m_bunchSpace; + bool m_UseComTime; + double m_ComTime; + + std::vector m_BarrelNumberOfBCID; + std::vector m_EndcapNumberOfBCID; + std::vector m_DBMNumberOfBCID; + std::vector m_BarrelTimeOffset; + std::vector m_EndcapTimeOffset; + std::vector m_DBMTimeOffset; + std::vector m_BarrelTimeJitter; + std::vector m_EndcapTimeJitter; + std::vector m_DBMTimeJitter; + + bool m_useCalibConditions; + + std::vector m_defaultBarrelAnalogThreshold; + std::vector m_defaultEndcapAnalogThreshold; + std::vector m_defaultDBMAnalogThreshold; + std::vector m_defaultBarrelAnalogThresholdSigma; + std::vector m_defaultEndcapAnalogThresholdSigma; + std::vector m_defaultDBMAnalogThresholdSigma; + std::vector m_defaultBarrelAnalogThresholdNoise; + std::vector m_defaultEndcapAnalogThresholdNoise; + std::vector m_defaultDBMAnalogThresholdNoise; + std::vector m_defaultBarrelInTimeThreshold; + std::vector m_defaultEndcapInTimeThreshold; + std::vector m_defaultDBMInTimeThreshold; + + float m_paramA; + float m_paramE; + float m_paramC; + std::vector m_BarrelToTThreshold; std::vector m_EndcapToTThreshold; std::vector m_DBMToTThreshold; - std::vector m_BarrelLatency; - std::vector m_EndcapLatency; - std::vector m_DBMLatency; std::vector m_BarrelCrossTalk; std::vector m_EndcapCrossTalk; std::vector m_DBMCrossTalk; std::vector m_BarrelThermalNoise; std::vector m_EndcapThermalNoise; std::vector m_DBMThermalNoise; - std::vector m_BarrelHitDuplication; - std::vector m_EndcapHitDuplication; - std::vector m_DBMHitDuplication; - std::vector m_BarrelSmallHitToT; - std::vector m_EndcapSmallHitToT; - std::vector m_DBMSmallHitToT; - int m_hitDiscConfig; + std::vector m_BarrelNoiseOccupancy; + std::vector m_EndcapNoiseOccupancy; + std::vector m_DBMNoiseOccupancy; + std::vector m_BarrelDisableProbability; + std::vector m_EndcapDisableProbability; + std::vector m_DBMDisableProbability; + + chipCharge m_BarrelNoiseShape; + chipCharge m_EndcapNoiseShape; + chipCharge m_DBMNoiseShape; + + std::vector m_FEI3BarrelLatency; + std::vector m_FEI3EndcapLatency; + std::vector m_FEI3BarrelHitDuplication; + std::vector m_FEI3EndcapHitDuplication; + std::vector m_FEI3BarrelSmallHitToT; + std::vector m_FEI3EndcapSmallHitToT; + std::vector m_FEI3BarrelTimingSimTune; + std::vector m_FEI3EndcapTimingSimTune; + std::vector m_FEI4BarrelHitDiscConfig; + std::vector m_FEI4EndcapHitDiscConfig; }; diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeCalibCondData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeCalibCondData.cxx new file mode 100644 index 0000000000000000000000000000000000000000..32b734c3267568e207089b74ef01dfebba8aad3f --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeCalibCondData.cxx @@ -0,0 +1,366 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelConditionsData/PixelChargeCalibCondData.h" + +PixelChargeCalibCondData::PixelChargeCalibCondData(): + m_analogThreshold(), + m_analogThresholdSigma(), + m_analogThresholdNoise(), + m_intimethreshold(), + m_totA(), + m_totE(), + m_totC(), + m_totRes1(), + m_totRes2(), + m_analogThresholdLong(), + m_analogThresholdSigmaLong(), + m_analogThresholdNoiseLong(), + m_intimethresholdLong(), + m_totALong(), + m_totELong(), + m_totCLong(), + m_analogThresholdGanged(), + m_analogThresholdSigmaGanged(), + m_analogThresholdNoiseGanged(), + m_intimethresholdGanged() +{ +} + +PixelChargeCalibCondData::~PixelChargeCalibCondData() { } + +// Normal pixels +void PixelChargeCalibCondData::setAnalogThreshold(const int chanNum, const int value) { + m_analogThreshold[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdSigma(const int chanNum, const int value) { + m_analogThresholdSigma[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdNoise(const int chanNum, const int value) { + m_analogThresholdNoise[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setInTimeThreshold(const int chanNum, const int value) { + m_intimethreshold[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotA(const int chanNum, const float value) { + m_totA[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotE(const int chanNum, const float value) { + m_totE[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotC(const int chanNum, const float value) { + m_totC[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setTotRes1(const int chanNum, const float value) { + m_totRes1[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setTotRes2(const int chanNum, const float value) { + m_totRes2[chanNum].push_back(value); +} + +int PixelChargeCalibCondData::getAnalogThreshold(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL) { + auto itr = m_analogThreshold.find(chanNum); + if (itr!=m_analogThreshold.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::LONG) { + auto itr = m_analogThresholdLong.find(chanNum); + if (itr!=m_analogThresholdLong.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_analogThresholdGanged.find(chanNum); + if (itr!=m_analogThresholdGanged.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0; +} + +int PixelChargeCalibCondData::getAnalogThresholdSigma(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL) { + auto itr = m_analogThresholdSigma.find(chanNum); + if (itr!=m_analogThresholdSigma.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::LONG) { + auto itr = m_analogThresholdSigmaLong.find(chanNum); + if (itr!=m_analogThresholdSigmaLong.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_analogThresholdSigmaGanged.find(chanNum); + if (itr!=m_analogThresholdSigmaGanged.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0; +} + +int PixelChargeCalibCondData::getAnalogThresholdNoise(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL) { + auto itr = m_analogThresholdNoise.find(chanNum); + if (itr!=m_analogThresholdNoise.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::LONG) { + auto itr = m_analogThresholdNoiseLong.find(chanNum); + if (itr!=m_analogThresholdNoiseLong.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_analogThresholdNoiseGanged.find(chanNum); + if (itr!=m_analogThresholdNoiseGanged.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0; +} + +int PixelChargeCalibCondData::getInTimeThreshold(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL) { + auto itr = m_intimethreshold.find(chanNum); + if (itr!=m_intimethreshold.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::LONG) { + auto itr = m_intimethresholdLong.find(chanNum); + if (itr!=m_intimethresholdLong.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_intimethresholdGanged.find(chanNum); + if (itr!=m_intimethresholdGanged.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0; +} + +float PixelChargeCalibCondData::getQ2TotA(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL || type==PixelType::LONG) { + auto itr = m_totA.find(chanNum); + if (itr!=m_totA.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_totALong.find(chanNum); + if (itr!=m_totALong.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0.0; +} + +float PixelChargeCalibCondData::getQ2TotE(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL || type==PixelType::LONG) { + auto itr = m_totE.find(chanNum); + if (itr!=m_totE.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_totELong.find(chanNum); + if (itr!=m_totELong.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0.0; +} + +float PixelChargeCalibCondData::getQ2TotC(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL || type==PixelType::LONG) { + auto itr = m_totC.find(chanNum); + if (itr!=m_totC.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_totCLong.find(chanNum); + if (itr!=m_totCLong.end()) { + const std::vector chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0.0; +} + +float PixelChargeCalibCondData::getTotRes(const int chanNum, const int FE, float Q) const { + float res1 = 0.0; + auto itr1 = m_totRes1.find(chanNum); + if (itr1!=m_totRes1.end()) { + const std::vector chip = itr1->second; + if (FE<(int)chip.size()) { + res1 = chip.at(FE); + } + } + float res2 = 0.0; + auto itr2 = m_totRes2.find(chanNum); + if (itr2!=m_totRes2.end()) { + const std::vector chip = itr2->second; + if (FE<(int)chip.size()) { + res2 = chip.at(FE); + } + } + return res1+res2*Q; +} + +// Long pixel +void PixelChargeCalibCondData::setAnalogThresholdLong(const int chanNum, const int value) { + m_analogThresholdLong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdSigmaLong(const int chanNum, const int value) { + m_analogThresholdSigmaLong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdNoiseLong(const int chanNum, const int value) { + m_analogThresholdNoiseLong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setInTimeThresholdLong(const int chanNum, const int value) { + m_intimethresholdLong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotALong(const int chanNum, const float value) { + m_totALong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotELong(const int chanNum, const float value) { + m_totELong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotCLong(const int chanNum, const float value) { + m_totCLong[chanNum].push_back(value); +} + +// Ganged pixel +void PixelChargeCalibCondData::setAnalogThresholdGanged(const int chanNum, const int value) { + m_analogThresholdGanged[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdSigmaGanged(const int chanNum, const int value) { + m_analogThresholdSigmaGanged[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdNoiseGanged(const int chanNum, const int value) { + m_analogThresholdNoiseGanged[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setInTimeThresholdGanged(const int chanNum, const int value) { + m_intimethresholdGanged[chanNum].push_back(value); +} + +float PixelChargeCalibCondData::getToT(const int chanNum, const int FE, const int type, float Q) const { + float paramA = getQ2TotA(chanNum,FE,type); + float paramE = getQ2TotE(chanNum,FE,type); + float paramC = getQ2TotC(chanNum,FE,type); + return paramA*(paramE+Q)/(paramC+Q); +} + +float PixelChargeCalibCondData::getCharge(const int chanNum, const int FE, const int type, float ToT) const { + float paramA = getQ2TotA(chanNum,FE,type); + float paramE = getQ2TotE(chanNum,FE,type); + float paramC = getQ2TotC(chanNum,FE,type); + float charge = 0.0; + if (std::fabs(paramA)>0.0 && std::fabs(ToT/paramA-1.0)>0.0) { + charge = (paramC*ToT/paramA-paramE)/(1.0-ToT/paramA); + } + return charge; +} + +void PixelChargeCalibCondData::clear() { + m_analogThreshold.clear(); + m_analogThresholdSigma.clear(); + m_analogThresholdNoise.clear(); + m_intimethreshold.clear(); + m_totA.clear(); + m_totE.clear(); + m_totC.clear(); + m_totRes1.clear(); + m_totRes2.clear(); + m_analogThresholdLong.clear(); + m_analogThresholdSigmaLong.clear(); + m_analogThresholdNoiseLong.clear(); + m_intimethresholdLong.clear(); + m_totALong.clear(); + m_totELong.clear(); + m_totCLong.clear(); + m_analogThresholdGanged.clear(); + m_analogThresholdSigmaGanged.clear(); + m_analogThresholdNoiseGanged.clear(); + m_intimethresholdGanged.clear(); +} + diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx index 57d8e7a77e2e5f0b724262fcf25f772681aadf21..b542c7aac5b5fdc501d7b2d568d0c00e368df458 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx @@ -56,18 +56,107 @@ int PixelModuleData::getChipStatus(const int chanNum) const { return 0; } -void PixelModuleData::setBarrelAnalogThreshold(std::vector BarrelAnalogThreshold) { m_BarrelAnalogThreshold = BarrelAnalogThreshold; } -void PixelModuleData::setEndcapAnalogThreshold(std::vector EndcapAnalogThreshold) { m_EndcapAnalogThreshold = EndcapAnalogThreshold; } -void PixelModuleData::setDBMAnalogThreshold(std::vector DBMAnalogThreshold) { m_DBMAnalogThreshold = DBMAnalogThreshold; } +// set via job option +void PixelModuleData::setBunchSpace(double bunchSpace) { m_bunchSpace = bunchSpace; } +double PixelModuleData::getBunchSpace() const { return m_bunchSpace; } -int PixelModuleData::getAnalogThreshold(int bec, int layer) const { +void PixelModuleData::setUseComTime(bool UseComTime) { m_UseComTime = UseComTime; } +bool PixelModuleData::getUseComTime() const { return m_UseComTime; } + +void PixelModuleData::setComTime(double ComTime) { m_ComTime = ComTime; } +double PixelModuleData::getComTime() const { return m_ComTime; } + +void PixelModuleData::setBarrelNumberOfBCID(std::vector BarrelNumberOfBCID) { m_BarrelNumberOfBCID = BarrelNumberOfBCID; } +void PixelModuleData::setEndcapNumberOfBCID(std::vector EndcapNumberOfBCID) { m_EndcapNumberOfBCID = EndcapNumberOfBCID; } +void PixelModuleData::setDBMNumberOfBCID(std::vector DBMNumberOfBCID) { m_DBMNumberOfBCID = DBMNumberOfBCID; } +int PixelModuleData::getNumberOfBCID(int bec, int layer) const { + int nBCID = 1; + if (std::abs(bec)==0 && layer<(int)m_BarrelNumberOfBCID.size()) { nBCID=m_BarrelNumberOfBCID.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapNumberOfBCID.size()) { nBCID=m_EndcapNumberOfBCID.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMNumberOfBCID.size()) { nBCID=m_DBMNumberOfBCID.at(layer); } + return nBCID; +} + +void PixelModuleData::setBarrelTimeOffset(std::vector BarrelTimeOffset) { m_BarrelTimeOffset = BarrelTimeOffset; } +void PixelModuleData::setEndcapTimeOffset(std::vector EndcapTimeOffset) { m_EndcapTimeOffset = EndcapTimeOffset; } +void PixelModuleData::setDBMTimeOffset(std::vector DBMTimeOffset) { m_DBMTimeOffset = DBMTimeOffset; } +double PixelModuleData::getTimeOffset(int bec, int layer) const { + double timeOffset = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelTimeOffset.size()) { timeOffset=m_BarrelTimeOffset.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapTimeOffset.size()) { timeOffset=m_EndcapTimeOffset.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMTimeOffset.size()) { timeOffset=m_DBMTimeOffset.at(layer); } + return timeOffset; +} + +void PixelModuleData::setBarrelTimeJitter(std::vector BarrelTimeJitter) { m_BarrelTimeJitter = BarrelTimeJitter; } +void PixelModuleData::setEndcapTimeJitter(std::vector EndcapTimeJitter) { m_EndcapTimeJitter = EndcapTimeJitter; } +void PixelModuleData::setDBMTimeJitter(std::vector DBMTimeJitter) { m_DBMTimeJitter = DBMTimeJitter; } +double PixelModuleData::getTimeJitter(int bec, int layer) const { + double timeJitter = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelTimeJitter.size()) { timeJitter=m_BarrelTimeJitter.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapTimeJitter.size()) { timeJitter=m_EndcapTimeJitter.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMTimeJitter.size()) { timeJitter=m_DBMTimeJitter.at(layer); } + return timeJitter; +} + +void PixelModuleData::setUseCalibConditions(bool UseCalibConditions) { m_useCalibConditions = UseCalibConditions; } +bool PixelModuleData::getUseCalibConditions() const { return m_useCalibConditions; } + +void PixelModuleData::setDefaultBarrelAnalogThreshold(std::vector BarrelAnalogThreshold) { m_defaultBarrelAnalogThreshold = BarrelAnalogThreshold; } +void PixelModuleData::setDefaultEndcapAnalogThreshold(std::vector EndcapAnalogThreshold) { m_defaultEndcapAnalogThreshold = EndcapAnalogThreshold; } +void PixelModuleData::setDefaultDBMAnalogThreshold(std::vector DBMAnalogThreshold) { m_defaultDBMAnalogThreshold = DBMAnalogThreshold; } + +int PixelModuleData::getDefaultAnalogThreshold(int bec, int layer) const { int analogThreshold = -1; - if (std::abs(bec)==0 && layer<(int)m_BarrelAnalogThreshold.size()) { analogThreshold=m_BarrelAnalogThreshold.at(layer); } - if (std::abs(bec)==2 && layer<(int)m_EndcapAnalogThreshold.size()) { analogThreshold=m_EndcapAnalogThreshold.at(layer); } - if (std::abs(bec)==4 && layer<(int)m_DBMAnalogThreshold.size()) { analogThreshold=m_DBMAnalogThreshold.at(layer); } + if (std::abs(bec)==0 && layer<(int)m_defaultBarrelAnalogThreshold.size()) { analogThreshold=m_defaultBarrelAnalogThreshold.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_defaultEndcapAnalogThreshold.size()) { analogThreshold=m_defaultEndcapAnalogThreshold.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_defaultDBMAnalogThreshold.size()) { analogThreshold=m_defaultDBMAnalogThreshold.at(layer); } return analogThreshold; } +void PixelModuleData::setDefaultBarrelAnalogThresholdSigma(std::vector BarrelAnalogThresholdSigma) { m_defaultBarrelAnalogThresholdSigma = BarrelAnalogThresholdSigma; } +void PixelModuleData::setDefaultEndcapAnalogThresholdSigma(std::vector EndcapAnalogThresholdSigma) { m_defaultEndcapAnalogThresholdSigma = EndcapAnalogThresholdSigma; } +void PixelModuleData::setDefaultDBMAnalogThresholdSigma(std::vector DBMAnalogThresholdSigma) { m_defaultDBMAnalogThresholdSigma = DBMAnalogThresholdSigma; } + +int PixelModuleData::getDefaultAnalogThresholdSigma(int bec, int layer) const { + int analogThresholdSigma = -1; + if (std::abs(bec)==0 && layer<(int)m_defaultBarrelAnalogThresholdSigma.size()) { analogThresholdSigma=m_defaultBarrelAnalogThresholdSigma.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_defaultEndcapAnalogThresholdSigma.size()) { analogThresholdSigma=m_defaultEndcapAnalogThresholdSigma.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_defaultDBMAnalogThresholdSigma.size()) { analogThresholdSigma=m_defaultDBMAnalogThresholdSigma.at(layer); } + return analogThresholdSigma; +} + +void PixelModuleData::setDefaultBarrelAnalogThresholdNoise(std::vector BarrelAnalogThresholdNoise) { m_defaultBarrelAnalogThresholdNoise = BarrelAnalogThresholdNoise; } +void PixelModuleData::setDefaultEndcapAnalogThresholdNoise(std::vector EndcapAnalogThresholdNoise) { m_defaultEndcapAnalogThresholdNoise = EndcapAnalogThresholdNoise; } +void PixelModuleData::setDefaultDBMAnalogThresholdNoise(std::vector DBMAnalogThresholdNoise) { m_defaultDBMAnalogThresholdNoise = DBMAnalogThresholdNoise; } + +int PixelModuleData::getDefaultAnalogThresholdNoise(int bec, int layer) const { + int analogThresholdNoise = -1; + if (std::abs(bec)==0 && layer<(int)m_defaultBarrelAnalogThresholdNoise.size()) { analogThresholdNoise=m_defaultBarrelAnalogThresholdNoise.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_defaultEndcapAnalogThresholdNoise.size()) { analogThresholdNoise=m_defaultEndcapAnalogThresholdNoise.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_defaultDBMAnalogThresholdNoise.size()) { analogThresholdNoise=m_defaultDBMAnalogThresholdNoise.at(layer); } + return analogThresholdNoise; +} + +void PixelModuleData::setDefaultBarrelInTimeThreshold(std::vector BarrelInTimeThreshold) { m_defaultBarrelInTimeThreshold = BarrelInTimeThreshold; } +void PixelModuleData::setDefaultEndcapInTimeThreshold(std::vector EndcapInTimeThreshold) { m_defaultEndcapInTimeThreshold = EndcapInTimeThreshold; } +void PixelModuleData::setDefaultDBMInTimeThreshold(std::vector DBMInTimeThreshold) { m_defaultDBMInTimeThreshold = DBMInTimeThreshold; } + +int PixelModuleData::getDefaultInTimeThreshold(int bec, int layer) const { + int analogInTimeThreshold = -1; + if (std::abs(bec)==0 && layer<(int)m_defaultBarrelInTimeThreshold.size()) { analogInTimeThreshold=m_defaultBarrelInTimeThreshold.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_defaultEndcapInTimeThreshold.size()) { analogInTimeThreshold=m_defaultEndcapInTimeThreshold.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_defaultDBMInTimeThreshold.size()) { analogInTimeThreshold=m_defaultDBMInTimeThreshold.at(layer); } + return analogInTimeThreshold; +} + +void PixelModuleData::setDefaultQ2TotA(float paramA) { m_paramA=paramA; } +void PixelModuleData::setDefaultQ2TotE(float paramE) { m_paramE=paramE; } +void PixelModuleData::setDefaultQ2TotC(float paramC) { m_paramC=paramC; } +float PixelModuleData::getDefaultQ2TotA() const { return m_paramA; } +float PixelModuleData::getDefaultQ2TotE() const { return m_paramE; } +float PixelModuleData::getDefaultQ2TotC() const { return m_paramC; } + void PixelModuleData::setBarrelToTThreshold(std::vector BarrelToTThreshold) { m_BarrelToTThreshold = BarrelToTThreshold; } void PixelModuleData::setEndcapToTThreshold(std::vector EndcapToTThreshold) { m_EndcapToTThreshold = EndcapToTThreshold; } void PixelModuleData::setDBMToTThreshold(std::vector DBMToTThreshold) { m_DBMToTThreshold = DBMToTThreshold; } @@ -80,18 +169,6 @@ int PixelModuleData::getToTThreshold(int bec, int layer) const { return totThreshold; } -void PixelModuleData::setBarrelLatency(std::vector BarrelLatency) { m_BarrelLatency = BarrelLatency; } -void PixelModuleData::setEndcapLatency(std::vector EndcapLatency) { m_EndcapLatency = EndcapLatency; } -void PixelModuleData::setDBMLatency(std::vector DBMLatency) { m_DBMLatency = DBMLatency; } - -int PixelModuleData::getLatency(int bec, int layer) const { - int latency = -1; - if (std::abs(bec)==0 && layer<(int)m_BarrelLatency.size()) { latency=m_BarrelLatency.at(layer); } - if (std::abs(bec)==2 && layer<(int)m_EndcapLatency.size()) { latency=m_EndcapLatency.at(layer); } - if (std::abs(bec)==4 && layer<(int)m_DBMLatency.size()) { latency=m_DBMLatency.at(layer); } - return latency; -} - void PixelModuleData::setBarrelCrossTalk(std::vector BarrelCrossTalk) { m_BarrelCrossTalk = BarrelCrossTalk; } void PixelModuleData::setEndcapCrossTalk(std::vector EndcapCrossTalk) { m_EndcapCrossTalk = EndcapCrossTalk; } void PixelModuleData::setDBMCrossTalk(std::vector DBMCrossTalk) { m_DBMCrossTalk = DBMCrossTalk; } @@ -106,7 +183,7 @@ double PixelModuleData::getCrossTalk(int bec, int layer) const { void PixelModuleData::setBarrelThermalNoise(std::vector BarrelThermalNoise) { m_BarrelThermalNoise = BarrelThermalNoise; } void PixelModuleData::setEndcapThermalNoise(std::vector EndcapThermalNoise) { m_EndcapThermalNoise = EndcapThermalNoise; } -void PixelModuleData::setDBMThermalNoise(std::vector DBMThermalNoise) { m_DBMThermalNoise = DBMThermalNoise; } +void PixelModuleData::setDBMThermalNoise(std::vector DBMThermalNoise) { m_DBMThermalNoise = DBMThermalNoise; } double PixelModuleData::getThermalNoise(int bec, int layer) const { double noise = -1.0; @@ -116,36 +193,109 @@ double PixelModuleData::getThermalNoise(int bec, int layer) const { return noise; } -void PixelModuleData::setBarrelHitDuplication(std::vector BarrelHitDuplication) { m_BarrelHitDuplication = BarrelHitDuplication; } -void PixelModuleData::setEndcapHitDuplication(std::vector EndcapHitDuplication) { m_EndcapHitDuplication = EndcapHitDuplication; } -void PixelModuleData::setDBMHitDuplication(std::vector DBMHitDuplication) { m_DBMHitDuplication = DBMHitDuplication; } +void PixelModuleData::setBarrelNoiseOccupancy(std::vector BarrelNoiseOccupancy) { m_BarrelNoiseOccupancy = BarrelNoiseOccupancy; } +void PixelModuleData::setEndcapNoiseOccupancy(std::vector EndcapNoiseOccupancy) { m_EndcapNoiseOccupancy = EndcapNoiseOccupancy; } +void PixelModuleData::setDBMNoiseOccupancy(std::vector DBMNoiseOccupancy) { m_DBMNoiseOccupancy = DBMNoiseOccupancy; } +double PixelModuleData::getNoiseOccupancy(int bec, int layer) const { + double noiseOccupancy = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelNoiseOccupancy.size()) { noiseOccupancy=m_BarrelNoiseOccupancy.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapNoiseOccupancy.size()) { noiseOccupancy=m_EndcapNoiseOccupancy.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMNoiseOccupancy.size()) { noiseOccupancy=m_DBMNoiseOccupancy.at(layer); } + return noiseOccupancy; +} + +void PixelModuleData::setBarrelDisableProbability(std::vector BarrelDisableProbability) { m_BarrelDisableProbability= BarrelDisableProbability; } +void PixelModuleData::setEndcapDisableProbability(std::vector EndcapDisableProbability) { m_EndcapDisableProbability= EndcapDisableProbability; } +void PixelModuleData::setDBMDisableProbability(std::vector DBMDisableProbability) { m_DBMDisableProbability = DBMDisableProbability; } +double PixelModuleData::getDisableProbability(int bec, int layer) const { + double disableProb = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelDisableProbability.size()) { disableProb=m_BarrelDisableProbability.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapDisableProbability.size()) { disableProb=m_EndcapDisableProbability.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMDisableProbability.size()) { disableProb=m_DBMDisableProbability.at(layer); } + return disableProb; +} + +void PixelModuleData::setBarrelNoiseShape(const int layer, const float BarrelNoiseShape) { + m_BarrelNoiseShape[layer].push_back(BarrelNoiseShape); +} + +void PixelModuleData::setEndcapNoiseShape(const int layer, const float EndcapNoiseShape) { + m_EndcapNoiseShape[layer].push_back(EndcapNoiseShape); +} + +void PixelModuleData::setDBMNoiseShape(const int layer, const float DBMNoiseShape) { + m_DBMNoiseShape[layer].push_back(DBMNoiseShape); +} + +std::vector PixelModuleData::getNoiseShape(const int bec, const int layer) const { + std::vector chip; + if (bec==0) { + auto itr = m_BarrelNoiseShape.find(layer); + if (itr!=m_BarrelNoiseShape.end()) { chip = itr->second; } + } + else if (std::abs(bec)==2) { + auto itr = m_EndcapNoiseShape.find(layer); + if (itr!=m_EndcapNoiseShape.end()) { chip = itr->second; } + } + else if (std::abs(bec)==4) { + auto itr = m_DBMNoiseShape.find(layer); + if (itr!=m_DBMNoiseShape.end()) { chip = itr->second; } + } + return chip; +} + +void PixelModuleData::setFEI3BarrelLatency(std::vector FEI3BarrelLatency) { m_FEI3BarrelLatency = FEI3BarrelLatency; } +void PixelModuleData::setFEI3EndcapLatency(std::vector FEI3EndcapLatency) { m_FEI3EndcapLatency = FEI3EndcapLatency; } -bool PixelModuleData::getHitDuplication(int bec, int layer) const { +int PixelModuleData::getFEI3Latency(int bec, int layer) const { + int latency = -1; + if (std::abs(bec)==0 && layer<(int)m_FEI3BarrelLatency.size()) { latency=m_FEI3BarrelLatency.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI3EndcapLatency.size()) { latency=m_FEI3EndcapLatency.at(layer); } + return latency; +} + +void PixelModuleData::setFEI3BarrelHitDuplication(std::vector FEI3BarrelHitDuplication) { m_FEI3BarrelHitDuplication = FEI3BarrelHitDuplication; } +void PixelModuleData::setFEI3EndcapHitDuplication(std::vector FEI3EndcapHitDuplication) { m_FEI3EndcapHitDuplication = FEI3EndcapHitDuplication; } + +bool PixelModuleData::getFEI3HitDuplication(int bec, int layer) const { bool hitdupli = false; - if (std::abs(bec)==0 && layer<(int)m_BarrelHitDuplication.size()) { hitdupli=m_BarrelHitDuplication.at(layer); } - if (std::abs(bec)==2 && layer<(int)m_EndcapHitDuplication.size()) { hitdupli=m_EndcapHitDuplication.at(layer); } - if (std::abs(bec)==4 && layer<(int)m_DBMHitDuplication.size()) { hitdupli=m_DBMHitDuplication.at(layer); } + if (std::abs(bec)==0 && layer<(int)m_FEI3BarrelHitDuplication.size()) { hitdupli=m_FEI3BarrelHitDuplication.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI3EndcapHitDuplication.size()) { hitdupli=m_FEI3EndcapHitDuplication.at(layer); } return hitdupli; } -void PixelModuleData::setBarrelSmallHitToT(std::vector BarrelSmallHitToT) { m_BarrelSmallHitToT = BarrelSmallHitToT; } -void PixelModuleData::setEndcapSmallHitToT(std::vector EndcapSmallHitToT) { m_EndcapSmallHitToT = EndcapSmallHitToT; } -void PixelModuleData::setDBMSmallHitToT(std::vector DBMSmallHitToT) { m_DBMSmallHitToT = DBMSmallHitToT; } +void PixelModuleData::setFEI3BarrelSmallHitToT(std::vector FEI3BarrelSmallHitToT) { m_FEI3BarrelSmallHitToT = FEI3BarrelSmallHitToT; } +void PixelModuleData::setFEI3EndcapSmallHitToT(std::vector FEI3EndcapSmallHitToT) { m_FEI3EndcapSmallHitToT = FEI3EndcapSmallHitToT; } -int PixelModuleData::getSmallHitToT(int bec, int layer) const { +int PixelModuleData::getFEI3SmallHitToT(int bec, int layer) const { int smallToT = -1; - if (std::abs(bec)==0 && layer<(int)m_BarrelSmallHitToT.size()) { smallToT=m_BarrelSmallHitToT.at(layer); } - if (std::abs(bec)==2 && layer<(int)m_EndcapSmallHitToT.size()) { smallToT=m_EndcapSmallHitToT.at(layer); } - if (std::abs(bec)==4 && layer<(int)m_DBMSmallHitToT.size()) { smallToT=m_DBMSmallHitToT.at(layer); } + if (std::abs(bec)==0 && layer<(int)m_FEI3BarrelSmallHitToT.size()) { smallToT=m_FEI3BarrelSmallHitToT.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI3EndcapSmallHitToT.size()) { smallToT=m_FEI3EndcapSmallHitToT.at(layer); } return smallToT; } -void PixelModuleData::setIBLHitDiscConfig(const int hitDiscConfig) { m_hitDiscConfig = hitDiscConfig; } -int PixelModuleData::getIBLHitDiscConfig() const { return m_hitDiscConfig; } +void PixelModuleData::setFEI3BarrelTimingSimTune(std::vector FEI3BarrelTimingSimTune) { m_FEI3BarrelTimingSimTune = FEI3BarrelTimingSimTune; } +void PixelModuleData::setFEI3EndcapTimingSimTune(std::vector FEI3EndcapTimingSimTune) { m_FEI3EndcapTimingSimTune = FEI3EndcapTimingSimTune; } +int PixelModuleData::getFEI3TimingSimTune(int bec, int layer) const { + int timesim = 0; + if (std::abs(bec)==0 && layer<(int)m_FEI3BarrelTimingSimTune.size()) { timesim=m_FEI3BarrelTimingSimTune.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI3EndcapTimingSimTune.size()) { timesim=m_FEI3EndcapTimingSimTune.at(layer); } + return timesim; +} + +void PixelModuleData::setFEI4BarrelHitDiscConfig(std::vector FEI4BarrelHitDiscConfig) { m_FEI4BarrelHitDiscConfig = FEI4BarrelHitDiscConfig; } +void PixelModuleData::setFEI4EndcapHitDiscConfig(std::vector FEI4EndcapHitDiscConfig) { m_FEI4EndcapHitDiscConfig = FEI4EndcapHitDiscConfig; } +int PixelModuleData::getFEI4HitDiscConfig(int bec, int layer) const { + int hitDiscConfig = 2; + if (std::abs(bec)==0 && layer<(int)m_FEI4BarrelHitDiscConfig.size()) { hitDiscConfig=m_FEI4BarrelHitDiscConfig.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI4EndcapHitDiscConfig.size()) { hitDiscConfig=m_FEI4EndcapHitDiscConfig.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_FEI4EndcapHitDiscConfig.size()) { hitDiscConfig=m_FEI4EndcapHitDiscConfig.at(layer); } + return hitDiscConfig; +} -int PixelModuleData::getIBLOverflowToT() const { +int PixelModuleData::getFEI4OverflowToT(int bec, int layer) const { static const int overflow[]={14,15,16,14,16}; - unsigned int idx=static_cast(m_hitDiscConfig) < 4 ? m_hitDiscConfig : 4; + unsigned int idx=static_cast(getFEI4HitDiscConfig(bec,layer)) < 4 ? getFEI4HitDiscConfig(bec,layer) : 4; return overflow[idx]; } diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelCalibSvc.h b/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelCalibSvc.h deleted file mode 100755 index 73c6850f23a29b7363da4c911a2e6b0ea9c4f8cc..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelCalibSvc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelCalibSvc.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef PIXELCALIBSVC_IPIXELCALIBSVC_H -#define PIXELCALIBSVC_IPIXELCALIBSVC_H - -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/IInterface.h" -#include "PixelConditionsData/PixelCalibDataColl.h" - -#include "Identifier/Identifier.h" - -static const InterfaceID IID_IPixelCalibSvc("IPixelCalibSvc",1,0); - -class IPixelCalibSvc : virtual public IInterface { - public: - virtual ~IPixelCalibSvc (){}; - static const InterfaceID & interfaceID(); - - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF)=0; - - virtual bool hasCalibData(const Identifier& wafer_id) const =0; //PixCalib-Assembly-01"] -#IOVDbSvc.GlobalTag ="PixCalib-Assembly-00" -#IOVDbSvc.OutputLevel = DEBUG -from IOVDbSvc.CondDB import conddb -conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") - -# setup PixelCalibDbTool in ToolSvc -#PixelCalibDbTool = Service("ToolSvc.PixelCalibDbTool") -#ToolSvc.PixelCalibDbTool.CalibFolder ="/PIXEL/PixCalib" -#ToolSvc.PixelCalibDbTool.CalibLocation ="PixCalibKey" -#ToolSvc.PixelCalibDbTool.WriteDB =False diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx deleted file mode 100755 index 223782d7ddfbdea4b47c05ad260ea85c391979af..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelCalibSvc.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#include "PixelCalibSvc.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" - -PixelCalibSvc::PixelCalibSvc(const std::string& name, ISvcLocator* sl):AthService(name, sl), - m_detStore("DetectorStore",name), - m_dbTool("PixelCalibDbTool"), - m_pixelCabling("PixelCablingSvc",name), - m_pixid(0), - m_wafer_id(0), - m_detManager(0), - m_totparA(70.2), - m_totparE(-3561.25), - m_totparC(26000), - m_totparP1(-0.68), - m_totparP2(0.17), - m_discrThresh(3500), - m_discrThreshSigma(300), - m_intimeThresh(5000), - m_noiseThresh(200), - m_disableDb(false) -{ - declareProperty("CalibrationDbTool",m_dbTool); - declareProperty("ToTParA", m_totparA, "TOT parameter A"); - declareProperty("ToTParE", m_totparE, "TOT parameter E"); - declareProperty("ToTParC", m_totparC, "TOT parameter C"); - declareProperty("ToTParP1", m_totparP1, "TOT smearing parameter p1"); - declareProperty("ToTParP2", m_totparP2, "TOT smearing parameter p2"); - declareProperty("DiscrThresh", m_discrThresh, "Discriminator threshold"); - declareProperty("DiscrThreshVar", m_discrThreshSigma, "Discriminator threshold sigma"); - declareProperty("IntimeThresh", m_intimeThresh, "Discriminator in-time threshold"); - declareProperty("NoiseThresh", m_noiseThresh, "Discriminator noise"); - declareProperty("DisableDB", m_disableDb, "Disable DB"); -} - -PixelCalibSvc::~PixelCalibSvc() {} - -StatusCode PixelCalibSvc::queryInterface(const InterfaceID& riid, void** ppvIF) { - if (IID_IPixelCalibSvc==riid) { - *ppvIF = dynamic_cast(this); - } - else { - return AthService::queryInterface(riid,ppvIF); - } - addRef(); - return StatusCode::SUCCESS; -} - -StatusCode PixelCalibSvc::initialize() { - ATH_MSG_INFO("PixelCalibSvc::initialize()"); - - CHECK(m_detStore.retrieve()); - - CHECK(m_detStore->retrieve(m_detManager,"Pixel")); - - CHECK(m_detStore->retrieve(m_pixid,"PixelID")); - - CHECK(m_pixelCabling.retrieve()); - - if (!m_disableDb) { CHECK(m_dbTool.retrieve()); } - - return StatusCode::SUCCESS; -} - -StatusCode PixelCalibSvc::finalize() { - ATH_MSG_INFO("PixelCalibSvc::finalize()"); - return StatusCode::SUCCESS; -} - -bool PixelCalibSvc::hasCalibData(const Identifier& wafer_id) const { - if (m_disableDb) { return false; } - if (wafer_id!=m_wafer_id) { - m_wafer_id = wafer_id; - } - return true; -} - -int PixelCalibSvc::getThreshold(Identifier pix_id) const { - Identifier wafer_id = m_pixid->wafer_id(pix_id); - if (m_disableDb) { return m_discrThresh; } - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getThreshold(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_discrThresh; - } -} - -int PixelCalibSvc::getThresholdSigma(Identifier pix_id) const { - if (m_disableDb) { return m_discrThreshSigma; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getThresholdSigma(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_discrThreshSigma; - } -} - -int PixelCalibSvc::getNoise(Identifier pix_id) const { - if (m_disableDb) { return m_noiseThresh; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getNoise(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_noiseThresh; - } -} - -int PixelCalibSvc::getTimeWalk(Identifier pix_id) const { - Identifier wafer_id = m_pixid->wafer_id(pix_id); - if (m_disableDb) { return m_intimeThresh; } - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getTimeWalk(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_intimeThresh; - } -} - -float PixelCalibSvc::getQ2TotA(Identifier pix_id) const { - if (m_disableDb) { return m_totparA; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotA(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparA; - } -} - -float PixelCalibSvc::getQ2TotE(Identifier pix_id) const { - if (m_disableDb) { return m_totparE; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotE(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparE; - } -} - -float PixelCalibSvc::getQ2TotC(Identifier pix_id) const { - if (m_disableDb) { return m_totparE; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotC(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparC; - } -} - -float PixelCalibSvc::getTotRes(Identifier pix_id, float Q) const { - if (m_disableDb) { return m_totparP1+m_totparP2*Q; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getTotRes(Q); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparP1+m_totparP2*Q; - } -} - -float PixelCalibSvc::getTotMean(Identifier pix_id, float Q) const { - if (m_disableDb) { return m_totparA*(m_totparE+Q)/(m_totparC+Q); } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2Tot(type,Q); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparA*(m_totparE+Q)/(m_totparC+Q); - } -} - -float PixelCalibSvc::getCharge(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 = static_cast(&element->design()); - float charge = 0.0; - if (m_pixid->is_dbm(wafer_id)) { - charge = ToT/8.0*(8000.0-1200.0)+1200.0; - } - else { - if (p_design->getReadoutTechnology()==InDetDD::PixelModuleDesign::FEI4) { - if (ToT>=m_pixelCabling->getIBLOverflowToT(&pix_id)) { ToT=m_pixelCabling->getIBLOverflowToT(&pix_id); } - } - float termA = getQ2TotA(pix_id); - float termE = getQ2TotE(pix_id); - float termC = getQ2TotC(pix_id); - if (fabs(termA)>0.0 && fabs(ToT/termA-1.0)>0.0) { - charge = (termC*ToT/termA-termE)/(1.0-ToT/termA); - } - } - return charge; -} - diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.h b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.h deleted file mode 100755 index 57c3b941b26e90dd94e21dff84db0eb3e1ccd3fc..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelCalibSvc.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef PIXELCALIBSVC_PIXELCALIBSVC_H -#define PIXELCALIBSVC_PIXELCALIBSVC_H - -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" -#include "PixelConditionsTools/IPixelCalibDbTool.h" -#include "PixelCabling/IPixelCablingSvc.h" -#include "InDetIdentifier/PixelID.h" - -namespace InDetDD { - class PixelDetectorManager; -} - -class PixelCalibSvc : public AthService, virtual public IPixelCalibSvc { - public: - PixelCalibSvc(const std::string& name, ISvcLocator* sl); - - virtual ~PixelCalibSvc (); - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF); - - virtual StatusCode initialize(); - virtual StatusCode finalize (); - - virtual bool hasCalibData(const Identifier& wafer_id) const; // m_detStore; - ToolHandle m_dbTool; - ServiceHandle m_pixelCabling; - const PixelID* m_pixid; - mutable Identifier m_wafer_id; // -///////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include "StoreGate/StoreGateSvc.h" -#include "Identifier/Identifier.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" - -#include "PixelConditionsData/PixelCalibDataColl.h" -#include "InDetIdentifier/PixelID.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" -#include "PixelCalibServiceTest.h" -#include "GaudiKernel/IToolSvc.h" - -static unsigned int rowsFGangedFEI3 =153; // first ganged pixel row for FEI3 -static unsigned int rowsFGangedFEI52 =661; // first ganged pixel row for FEI52 -static unsigned int rowsFGangedFEI51 =331; // first ganged pixel row for FEI51 - -static bool isIBL(false); -static bool isITK(false); - -PixelCalibServiceTest::PixelCalibServiceTest(const std::string& name, ISvcLocator* pSvcLocator) - :AthAlgorithm (name, pSvcLocator), - // m_log (msgSvc(), name), - // m_sgSvc (0), - //m_detStore (0), - m_calibsvc("PixelCalibSvc",name), - m_pixman(0), - m_pixid(0), - m_setup(0), - m_par_rfile(""), - m_dummy(false), - m_par_histf(0) -{ - - // declare algorithm parameters - declareProperty("OutputTextFile",m_par_rfile); - declareProperty("MakeDummy",m_dummy); - for(int i =0; i<14; ++i)m_myhf[i] =0; -} - - -PixelCalibServiceTest::~PixelCalibServiceTest(void) -{} - -StatusCode PixelCalibServiceTest::initialize() { - - msg(MSG::INFO) << "PixelCalibServiceTest::initialize() called" << endmsg; - - //get storegate pointers (not need for AthAlgorithm classes) - //if ((StatusCode::SUCCESS!=service("StoreGateSvc",m_sgSvc)) || - // (StatusCode::SUCCESS!=service("DetectorStore",m_detStore))) { - // msg(MSG::INFO) << "StoreGate services not found" << endmsg; - // return StatusCode::FAILURE; - // } - - // Get Pixel manager and ID helper - if (StatusCode::SUCCESS!= detStore()->retrieve(m_pixman,"Pixel") || - m_pixman==0) { - msg(MSG::FATAL) << "Could not find Pixel manager " << endmsg; - return StatusCode::FAILURE; - } - - if (StatusCode::SUCCESS!= detStore()->retrieve(m_pixid,"PixelID") ){ - ATH_MSG_FATAL( "Unable to retrieve pixel ID helper" ); - return StatusCode::FAILURE; - } - ATH_MSG_INFO( "Pixel manager and helper found "); - // check pixel geometry here: - - if(m_pixid->wafer_hash_max()>1744)isIBL = true; - if(m_pixid->wafer_hash_max()>3000)isITK = true; - - InDetDD::SiDetectorElementCollection::const_iterator iter, itermin, itermax; - itermin = m_pixman->getDetectorElementBegin(); - itermax = m_pixman->getDetectorElementEnd(); - int totpixmodule(0); - std::ofstream* outfile=0; - if(msgLvl(MSG::INFO)) msg() << " read PixelCalibData to text file: " - << m_par_rfile << endmsg; - outfile = new std::ofstream(m_par_rfile.c_str()); - - for( iter=itermin; iter !=itermax; ++iter){ - const InDetDD::SiDetectorElement* element = *iter; - if(element !=0){ - const Identifier ident = element->identify(); - if(m_pixid->is_pixel(ident)){ // OK this Element is included - // making dump calib file for SLHC - if(m_dummy&isIBL){ - const InDetDD::PixelModuleDesign* design = dynamic_cast(&element->design()); - if(design){ - unsigned int mchips = design->numberOfCircuits(); - // std::cout<<"I am here "<barrel_ec(ident)<<","<layer_disk(ident)<<","<phi_module(ident)<<","<eta_module(ident)<<" mchips="<layer_disk(ident)<<","<phi_module(ident)<<","<eta_module(ident)<(mchips); ++ichip){ - *outfile<<"I"<retrieve(m_pixman, "Pixel") || m_pixman==0){ - if(msgLvl(MSG::FATAL)) msg() << "Could not find Pixel manager "<getDetectorElementBegin(); - itermax = m_pixman->getDetectorElementEnd(); - - if (StatusCode::SUCCESS!= detStore()->retrieve(m_pixid,"PixelID") ){ - ATH_MSG_FATAL( "Unable to retrieve pixel ID helper" ); - return StatusCode::FAILURE; - } - - } - int nchips = 0; - int nobj = 0; - bool lfst = true; - bool lfstA = true; - bool lfstC = true; - for( iter=itermin; iter !=itermax; ++iter){ - const InDetDD::SiDetectorElement* element = *iter; - if(element !=0){ - const Identifier ident = element->identify(); - if(m_pixid->is_pixel(ident)){ // OK this Element is included - const InDetDD::PixelModuleDesign* design = dynamic_cast(&element->design()); - if(!design)continue; - unsigned int mchips = design->numberOfCircuits(); - if(mchips==8||abs(m_pixid->barrel_ec(ident))==2||(m_pixid->barrel_ec(ident)==0&&m_pixid->layer_disk(ident)>0))mchips *=2; // guess numberOfCircuits() - // - // - unsigned int hashID = isIBL?static_cast(m_pixid->wafer_hash(ident)):( (((m_pixid->barrel_ec(ident) + 2) / 2) << 25 ) + ( m_pixid->layer_disk(ident) << 23) + ( m_pixid->phi_module(ident) << 17) + ((m_pixid->eta_module(ident) + 6) << 13)); - if(m_dummy){ - unsigned int dl = 0; - if(!isIBL){ - if(m_pixid->barrel_ec(ident)==-2&&lfstA){ // making DBM dummy -4 - lfstA = false; - for(int i = 0; i<3; ++i){ - for(int j = 0; j<4; ++j){ - *outfile<<-4<<","<barrel_ec(ident)==2&&lfstC){// making DBM dummy 4 - lfstC =false; - for(int i = 0; i<3; ++i){ - for(int j = 0; j<4; ++j){ - *outfile<<4<<","<barrel_ec(ident)==0)dl =1; - if(m_pixid->barrel_ec(ident)==0&&m_pixid->layer_disk(ident)==0&&lfst){ // making dummy of IBL - lfst = false; - for(int i = 0; i<14; ++i){ - for(int j =-10; j<10; ++j){ - //unsigned int dummyID = (2 << 26) +(i << 18) +((j + 10) << 13); - int mx = 2; - if(j<-6||j>5)mx = 1; - *outfile<barrel_ec(ident)<<","<<0<<","<hasCalibData(ident)){ - if(nobj%100==0 && msgLvl(MSG::INFO) ) msg() <<"ith Module:"<barrel_ec(ident)<<","<layer_disk(ident)+dl<<","<phi_module(ident)<<","<eta_module(ident)<(mchips); ++ichip){ - ++nchips; - *outfile<<"I"<getThreshold(ident,0,1,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,1,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,1,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,1,ichip)<<" "<< - m_calibsvc->getThreshold(ident,0,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,0,ichip)<<" "<< - m_calibsvc->getThreshold(ident,153,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,153,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,153,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,153,0,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,153,0,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,153,0,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,153,0,ichip)<<" "<< - m_calibsvc->getTotP1(ident,ichip)<<" "<< - m_calibsvc->getTotP2(ident,ichip)<<" "<hasCalibData(ident)){ - if(nobj%100==0 && msgLvl(MSG::INFO) ) msg() <<"ith Module:"<barrel_ec(ident)==0&&m_pixid->layer_disk(ident)==1)rowsFGangedFE = rowsFGangedFEI52; - } - *outfile<getNFE(ident); - if(mchipx>2){ - for(int ichip=0; ichipFill(m_calibsvc->getThreshold(ident,0,1,ichip)); - m_myhf[1]->Fill(m_calibsvc->getThresholdSigma(ident,0,1,ichip)); - m_myhf[2]->Fill(m_calibsvc->getNoise(ident,0,1,ichip)); - m_myhf[3]->Fill(m_calibsvc->getTimeWalk(ident,0,1,ichip)); - m_myhf[4]->Fill(m_calibsvc->getThreshold(ident,0,0,ichip)); - m_myhf[5]->Fill(m_calibsvc->getThresholdSigma(ident,0,0,ichip)); - m_myhf[6]->Fill(m_calibsvc->getNoise(ident,0,0,ichip)); - m_myhf[7]->Fill(m_calibsvc->getTimeWalk(ident,0,0,ichip)); - m_myhf[8]->Fill(m_calibsvc->getThreshold(ident,rowsFGangedFE,0,ichip)); - m_myhf[9]->Fill(m_calibsvc->getThresholdSigma(ident,rowsFGangedFE,0,ichip)); - m_myhf[10]->Fill(m_calibsvc->getNoise(ident,rowsFGangedFE,0,ichip)); - m_myhf[11]->Fill(m_calibsvc->getTimeWalk(ident,rowsFGangedFE,0,ichip)); - m_myhf[12]->Fill(m_calibsvc->getTotP1(ident,ichip)); - m_myhf[13]->Fill(m_calibsvc->getTotP2(ident,ichip)); - // need to be prcise about the type of pixel: - *outfile<<"I"<getThreshold(ident,0,1,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,1,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,1,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,1,ichip)<<" "<< - m_calibsvc->getThreshold(ident,0,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,0,ichip)<<" "<< - m_calibsvc->getThreshold(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getTotP1(ident,ichip)<<" "<< - m_calibsvc->getTotP2(ident,ichip)<<" "<1){ - *outfile<<"I"<getThreshold(ident,1,1,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,1,1,ichip)<<" "<< - m_calibsvc->getNoise(ident,1,1,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,1,1,ichip)<<" "<< - m_calibsvc->getThreshold(ident,0,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,0,ichip)<<" "<< - 0<<" "<<0<<" "<<0<<" "<<0<<" "<< - m_calibsvc->getQ2TotA(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,0,0,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,0,0,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,0,0,ichip)<<" "<< - m_calibsvc->getTotP1(ident,ichip)<<" "<< - m_calibsvc->getTotP2(ident,ichip)<<" "<getThreshold(ident,1,1,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,1,1,ichip)<<" "<< - m_calibsvc->getNoise(ident,1,1,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,1,1,ichip)<<" "<< - m_calibsvc->getThreshold(ident,0,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,0,ichip)<<" "<< - 0<<" "<<0<<" "<<0<<" "<<0<<" "<< - m_calibsvc->getQ2TotA(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,1,1,ichip)<<" "<< - 0<<" "<<0<<" "<<0<<" "<< - m_calibsvc->getTotP1(ident,ichip)<<" "<< - m_calibsvc->getTotP2(ident,ichip)<<" "<close(); - delete outfile; - if( msgLvl(MSG::INFO) ) msg() << "Written "<< nobj <<" PixelCalibData objects" << - " with " << nchips << " chips to text file "<Write(); - m_par_histf->Close(); - // - return StatusCode::SUCCESS; -} - -StatusCode PixelCalibServiceTest::finalize() -{ - msg(MSG::INFO)<<" PixelCalibServiceTest: finishing "< -///////////////////////////////////////////////////////////////// - -#ifndef PIXELCALIBSERVICETEST_H -#define PIXELCALIBSERVICETEST_H - -#include -#include -//#include "GaudiKernel/Algorithm.h" -#include "AthenaBaseComps/AthAlgorithm.h" -//#include "GaudiKernel/MsgStream.h" -#include "StoreGate/DataHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -#include "TFile.h" -#include "TH1.h" - - -class Identifier; -//class StoreGateSvc; -class PixelID; - -namespace InDetDD{ - class PixelDetectorManager; -} - -class IPixelCalibSvc; - -/** @class PixelCalibSerciceTest - The PixelCalibServiceTest is an algorithm to illustrate the usage of the PixelCalibSvc. - The algorithm can also allow to dump the pixel calibration data into a text file. - - @author Weiming Yao -*/ - -class PixelCalibServiceTest:public AthAlgorithm { - public: - PixelCalibServiceTest(const std::string& name, ISvcLocator* pSvcLocator); - ~PixelCalibServiceTest(void); - - StatusCode initialize(void); - StatusCode execute(void); - StatusCode finalize(void); - - private: - // MsgStream m_log; - // StoreGateSvc* m_sgSvc; - // StoreGateSvc* m_detStore; - - const ServiceHandle m_calibsvc; - const InDetDD::PixelDetectorManager* m_pixman; - const PixelID* m_pixid; - bool m_setup; //true for first event - - // algorithm parameters to be set in the jobOptions - std::string m_par_rfile; //sqlite://;schema=pixmapdb_ibl3ddbm_IBL3D25DBM-04-01.db;dbname=OFLP200 /PIXEL/PixCalib PixCalib-IBL3D25DBM-04-01" ] - else: - conddb.iovdbsvc.Folders = [ "sqlite://;schema=pixmapdb.db;dbname=OFLP200 /PIXEL/PixCalib PixCalib-IBL3D25DBM-04-01" ] -else: - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") - -### configure the special pixel map service - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc -PixelCalibSvc = PixelCalibSvc() - -ServiceMgr.EventSelector.RunNumber = 282222 -#ServiceMgr.EventSelector.RunNumber = 222222 -#ServiceMgr.EventSelector.RunNumber = 200805 - -### define the job - -from AthenaCommon.AlgSequence import AlgSequence - -job = AlgSequence() - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibServiceTest - -job +=PixelCalibServiceTest(OutputTextFile =myOutput, MakeDummy = TRUE ) - -ServiceMgr += PixelCalibSvc - - -theApp.EvtMax = 1 - - -### set up auditors - -from AthenaCommon.AppMgr import ServiceMgr - -from GaudiSvc.GaudiSvcConf import AuditorSvc - -ServiceMgr += AuditorSvc() -theAuditorSvc = ServiceMgr.AuditorSvc - -theAuditorSvc.Auditors += [ "ChronoAuditor"] -theAuditorSvc.Auditors += [ "MemStatAuditor" ] -theApp.AuditAlgorithms=True - - -### configure the message service -# Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) - -MessageSvc.OutputLevel = 3 -MessageSvc.debugLimit = 100000 -MessageSvc.infoLimit = 10000 diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestSLHC.py b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestSLHC.py deleted file mode 100755 index eb44aadec8b2873e2a6d45c1b042df8c5b185f88..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestSLHC.py +++ /dev/null @@ -1,115 +0,0 @@ -isSLHC = 1 -mySQ = 1 - -if isSLHC: - myOutput= "pixelcalibsvcSLHC_dump.txt" -else: - myOutput= "pixelcalibsvc_dump.txt" - -#import AthenaCommon.AtlasUnixStandardJob - -#MyOutPut = INFO -#from AthenaCommon.AppMgr import theApp -#from AthenaCommon.AppMgr import ServiceMgr - -from AthenaCommon.DetFlags import DetFlags -from AthenaCommon.GlobalFlags import globalflags - -# --- set defaults -globalflags.DataSource='geant4' - -if isSLHC: - include("InDetSLHC_Example/preInclude.NoTRT.py") -else: - DetFlags.detdescr.ID_setOn() - -# Select the geometry version. -from AthenaCommon.GlobalFlags import globalflags -if isSLHC: - globalflags.DetDescrVersion = 'ATLAS-SLHC-02-00-00' -else: - globalflags.DetDescrVersion = 'ATLAS-GEO-08-00-00' - -#globalflags.DetDescrVersion = 'ATLAS-SLHC-02-00-00' -#globalflags.DetGeo.set_Value_and_Lock('atlas') - -# import the # the conditions setup -#from IOVDbSvc.CondDB import conddb -#conddb.setGlobalTag('OFLCOND-SIM-00-00-00') -#conddb.setGlobalTag('OFLCOND-SDR-BS14T-SLHC-04') - -# Initialize geometry -from AtlasGeoModel import GeoModelInit -from AtlasGeoModel import SetGeometryVersion - -# --- setup version -from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags -## Leave commented out unless overriding with text file. -## Default is to use Geom DB only -#SLHC_Flags.SLHC_Version = "SLHC-01" - -print SLHC_Flags - -## SLHC setup -from InDetSLHC_Example.SLHC_Setup import SLHC_Setup -SLHC_Setup = SLHC_Setup() - -from AthenaCommon.AlgSequence import AlgSequence - -topSequence = AlgSequence() - -#include("PixelConditionsServices/PixelCalibSvc_jobOptions.py") - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc -ServiceMgr +=PixelCalibSvc() -PixelCalibSvc = ServiceMgr.PixelCalibSvc - -#if not (globalflags.DataSource() == 'geant4'): -# PixelCablingSvc.MappingFile = "PixelCabling/Pixels_Atlas_IdMapping_May08.dat" -# conddb.addFolder("PIXEL","/PIXEL/ReadoutSpeed") -#else: -# conddb.addFolderSplitMC("PIXEL","/PIXEL/ReadoutSpeed","/PIXEL/ReadoutSpeed") -# ServiceMgr += PixelCablingSvc - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibServiceTest - -topSequence +=PixelCalibServiceTest(OutputTextFile =myOutput, MakeDummy = TRUE) - -from IOVDbSvc.IOVDbSvcConf import IOVDbSvc -if isSLHC: - IOVDbSvc.GlobalTag = "OFLCOND-ATLAS-HL-LHC-00" -else: - IOVDbSvc.GlobalTag = "OFLCOND-MC12-SIM-00" - -#"DEFAULTCOND" - -if mySQ: - from AthenaCommon.AppMgr import ServiceMgr as svcMgr - # Setup Db stuff - import AthenaPoolCnvSvc.AthenaPool - import IOVDbSvc.IOVDb - if isSLHC: - connStr = "sqlite://X;schema=pixcalibdb_slhc.db;dbname=OFLP200" - tag = "PixCalib-SLHC-00" - else: - connStr = "sqlite://X;schema=pixcalibdb.db;dbname=OFLP200" - tag = "PixCalib-Test-00" - - folder = "/PIXEL/PixCalib" - svcMgr.IOVDbSvc.Folders += [ folder + tag + connStr ] -else: - from IOVDbSvc.CondDB import conddb - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") - - -theApp.EvtMax = 1 - -#-------------------------------------------------------------- -# Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -#-------------------------------------------------------------- -MessageSvc.OutputLevel = DEBUG -#INFO -#DEBUG -# --- change output format -MessageSvc.Format = "% F%30W%S%7W%R%T %0W%M" -MessageSvc.defaultLimit = 9999999 diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py b/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py index b3fbbe5e864d5f47a9b01b57de3d8f5d1917dca7..096e1d4b7740fe2a7c328234d6d0f9e6e108f2b7 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py @@ -87,7 +87,8 @@ class PixelConditionsSummaryToolSetup: from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadMap=self.useDeadMap, - ReadDeadMapKey=PixelDeadMapFolder) + ReadDeadMapKey=PixelDeadMapFolder, + UseCalibConditions=True) if not hasattr(ToolSvc, self.toolName): from PixelConditionsTools.PixelConditionsToolsConf import PixelConditionsSummaryTool diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py index d6856b680591bc2d9bd694788a6e03f461ebb14d..d64c1f34d0f01efc8e75740e3d568b1d2c35e6fd 100755 --- a/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py @@ -78,15 +78,6 @@ include ("AtlasGeoModel/GeoModelInit.py") #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- -#theApp.Dlls +=[ "PixelConditionsServices" ] - -#configure PixelCalibDbSvc -#theApp.ExtSvc +=[ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - -#PixelCalibSvc.DBToolType = "PixelCalib::PixelCalibDbTool" -#PixelCalibSvc.DBToolName = "PixelCalib_PixelCalibDbTool" - theApp.Dlls += [ "PixelConditionsTools" ] # PixelCalibDbTestWrite.py diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py index 53edef679088c5741f5d32bfc4002aab7e906dbb..315bf510b30d7e97ef38e751fe02812f56bbb751 100755 --- a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py @@ -78,12 +78,6 @@ include ("AtlasGeoModel/GeoModelInit.py") #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- -#theApp.Dlls +=[ "PixelConditionsServices" ] - -#configure PixelCalibDbSvc -#theApp.ExtSvc +=[ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - theApp.Dlls += [ "PixelConditionsTools" ] # PixelCalibDbTestWrite.py diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBCool_200.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBCool_200.py index 34597069a48df8450ad340533ad8273e1e0516d4..d936a78c8609143d08f5ea6be1f34ddbb5d1c116 100755 --- a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBCool_200.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBCool_200.py @@ -100,12 +100,6 @@ from AthenaCommon.AppMgr import ToolSvc #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- -#theApp.Dlls +=[ "PixelConditionsServices" ] - -#configure PixelCalibDbSvc -#theApp.ExtSvc +=[ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc +=PixelCalibDbTool() diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBsqlit.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBsqlit.py index 0f51cc2ad3b3851a9ac716b455b4dc9854d9a761..bfca26a887118e60d66955acc55a378c4fc6ac17 100755 --- a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBsqlit.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBsqlit.py @@ -100,12 +100,6 @@ from AthenaCommon.AppMgr import ToolSvc #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- -#theApp.Dlls +=[ "PixelConditionsServices" ] - -#configure PixelCalibDbSvc -#theApp.ExtSvc +=[ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc +=PixelCalibDbTool() diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h index 649788c604a094602ef7a1335cb894dc5cddbf4b..c9fe48584d07e290fef08fc5271fd36b4061143a 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h @@ -47,7 +47,6 @@ public: std::string setStringParameters(const std::string param,std::string paramName) { if (m_IBLpresent) { if (m_disableAllClusterSplitting && paramName=="clusterSplitter") return ""; - if (m_disableCalibCondDB && paramName=="PixelCalibSvc") return ""; } return param; } @@ -74,11 +73,9 @@ public: if (m_IBLpresent) { if (m_disablePixMapCondDB && paramName=="UsePixMapCondDB") param=false; if (m_disableSpecialPixels && paramName=="EnableSpecialPixels") param=false; - if (m_disableCalibCondDB && paramName=="UseCalibCondDB") param=false; if (m_disableAlignable && paramName=="alignable") param=false; if (m_disableAllClusterSplitting && paramName=="applyNNcorrection") param = false; if (m_disableAllClusterSplitting && paramName=="doPixelClusterSplitting") param = false; - if (m_disableCalibCondDB && paramName=="UsePixelCalibCondDB") param = false; if (m_disableDCS && paramName=="useDCS") param=false; if (paramName=="IBLAbsent") param=false; } @@ -94,7 +91,6 @@ private: ServiceHandle< IRDBAccessSvc > m_rdbAccessSvc; bool m_disablePixMapCondDB; bool m_disableSpecialPixels; - bool m_disableCalibCondDB; bool m_disableAlignable; bool m_disableAllClusterSplitting; bool m_disableDCS; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx index ed70c971db141cd403ea7e0c52a829cb8030693a..d7bb9a66ca25443a38de027e678445c62f76f66b 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx @@ -30,7 +30,6 @@ IBLParameterSvc::IBLParameterSvc(const std::string& name,ISvcLocator* svc) m_rdbAccessSvc("RDBAccessSvc",name), m_disablePixMapCondDB(false), m_disableSpecialPixels(false), - m_disableCalibCondDB(false), m_disableAlignable(false), m_disableAllClusterSplitting(false), m_disableDCS(true) @@ -39,7 +38,6 @@ IBLParameterSvc::IBLParameterSvc(const std::string& name,ISvcLocator* svc) declareProperty("RDBAccessSvc",m_rdbAccessSvc); declareProperty("DisablePixMapCondDB",m_disablePixMapCondDB); declareProperty("DisableSpecialPixels",m_disableSpecialPixels); - declareProperty("DisableCalibCondDB",m_disableCalibCondDB); declareProperty("DisableAlignable",m_disableAlignable); declareProperty("DisableAllClusterSplitting",m_disableAllClusterSplitting); declareProperty("DisableDCS",m_disableDCS); diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/FastSiDigitization/PixelFastDigitizationTool.h b/InnerDetector/InDetDigitization/FastSiDigitization/FastSiDigitization/PixelFastDigitizationTool.h index 323f354fb297f6e55fa807bc6a3011f552955b89..28ab66b382308743d3f5702403fd23c82fc43645 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/FastSiDigitization/PixelFastDigitizationTool.h +++ b/InnerDetector/InDetDigitization/FastSiDigitization/FastSiDigitization/PixelFastDigitizationTool.h @@ -21,10 +21,11 @@ #include "InDetPrepRawData/PixelClusterContainer.h" //typedef, cannot fwd declare #include "SiClusterizationTool/PixelGangedAmbiguitiesFinder.h" #include "InDetPrepRawData/PixelGangedClusterAmbiguities.h" //typedef, cannot fwd declare -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "SiClusterizationTool/ClusterMakerTool.h" #include "PileUpTools/PileUpMergeSvc.h" - +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadCondHandleKey.h" //New digi #include "TrkDigEvent/DigitizationModule.h" @@ -146,7 +147,11 @@ private: bool m_acceptDiagonalClusters; //!< merging parameter used to define two clusters as neighbour > std::string m_pixelClusterAmbiguitiesMapName; InDet::PixelGangedClusterAmbiguities* m_ambiguitiesMap; - ServiceHandle m_pixelCalibSvc; + ServiceHandle m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service" }; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; // bool isActiveAndGood(const ServiceHandle &svc, const IdentifierHash &idHash, const Identifier &id, bool querySingleChannel, const char *elementName, const char *failureMessage = "") const; bool areNeighbours(const std::vector& group, const Identifier& rdoID, const InDetDD::SiDetectorElement* /*element*/, const PixelID& pixelID) const; diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py b/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py index 216d0071c5757764c57c56ced89ad70231cb36e7..5ac847f532c397c06b35916a8e5cbd95df505ef0 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py @@ -30,10 +30,22 @@ def FastSCT_LastXing(): def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): from Digitization.DigitizationFlags import digitizationFlags + + ################################# + # Config pixel conditions setup # + ################################# + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, 'PixelConfigCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", + UseDeadMap=False, + ReadDeadMapKey="/PIXEL/PixMapOverlay", + UseCalibConditions=True) + #FIXME: at some point we should move away from being dependent on the experimentalDigi flags. if 'doFastSCT_Digi' in digitizationFlags.experimentalDigi() and not 'doFastPixelDigi' in digitizationFlags.experimentalDigi(): - kwargs.setdefault("UsePixelCalibCondDB", False) - kwargs.setdefault("PixelCalibSvc",""); + PixelConfigCondAlg.UseCalibConditions=False else: from AthenaCommon.Include import include include( "PixelConditionsServices/PixelDCSSvc_jobOptions.py" ) @@ -44,21 +56,25 @@ def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): ToolSvc += PixelRecoDbTool() ToolSvc.PixelRecoDbTool.InputSource = 1 + ##################### + # Calibration setup # + ##################### + from IOVDbSvc.CondDB import conddb + if not conddb.folderRequested("/PIXEL/PixCalib"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") + + if not hasattr(condSeq, 'PixelChargeCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") + + # setup PixelCalibDbTool in ToolSvc if not hasattr(ToolSvc, "PixelCalibDbTool"): from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc += PixelCalibDbTool() - from IOVDbSvc.CondDB import conddb - if not conddb.folderRequested('/PIXEL/PixCalib'): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") if not conddb.folderRequested('/PIXEL/ReadoutSpeed'): conddb.addFolder("PIXEL_OFL","/PIXEL/ReadoutSpeed") - from AthenaCommon.AppMgr import ServiceMgr - if not hasattr(ServiceMgr, "PixelCalibSvc"): - from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc - InDetPixelCalibSvc = PixelCalibSvc() - ServiceMgr += InDetPixelCalibSvc from AthenaCommon import CfgMgr return CfgMgr.InDet__ClusterMakerTool(name,**kwargs) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/PixelDigitization_jobOptions.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/PixelDigitization_jobOptions.py index 30870ea61e8a6a247264d67c19d5311984aa081c..a724806f02f7222ff4aaf23644d42ab585771c0f 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/PixelDigitization_jobOptions.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/PixelDigitization_jobOptions.py @@ -21,8 +21,28 @@ if not "ToolSvc" in theApp.ExtSvc and \ theApp.ExtSvc += [ "ToolSvc/ToolSvc"] pass +################################# +# Config pixel conditions setup # +################################# +from AthenaCommon.AlgSequence import AthSequencer +condSeq = AthSequencer("AthCondSeq") +if not hasattr(condSeq, 'PixelConfigCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", + UseDeadMap=False, + ReadDeadMapKey="/PIXEL/PixMapOverlay", + UseCalibConditions=True) + +##################### +# Calibration setup # +##################### from IOVDbSvc.CondDB import conddb +if not conddb.folderRequested("/PIXEL/PixCalib"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") +if not hasattr(condSeq, 'PixelChargeCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool ToolSvc += PixelRecoDbTool() @@ -31,14 +51,8 @@ ToolSvc.PixelRecoDbTool.InputSource = 1 from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc += PixelCalibDbTool() -if not conddb.folderRequested('/PIXEL/PixCalib'): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") if not conddb.folderRequested('/PIXEL/ReadoutSpeed'): conddb.addFolder("PIXEL_OFL","/PIXEL/ReadoutSpeed") -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc -InDetPixelCalibSvc = PixelCalibSvc() -ServiceMgr += InDetPixelCalibSvc - from FastSiDigitization.FastSiDigitizationConf import PixelFastDigitization diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py index 2207bddb943853fcf5c40b9129dba5f68c8c8d8a..0377d2864a147d7496745db7834790afea264817 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py @@ -73,9 +73,8 @@ include("SimulationJobOptions/preInclude.PileUpBunchTrains2011Config8_DigitConfi include("Digitization/Digitization.py") from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool -InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", - PixelCalibSvc = None, - UsePixelCalibCondDB = FALSE) +InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") + ToolSvc += InDetClusterMakerTool from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py index 2028b3ec97e72144986fd8246bcf185693e39b36..7d379aa65921c53855a3b09f3ce0eabbef5cdc9b 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py @@ -82,9 +82,7 @@ StoreGateSvc = Service("StoreGateSvc") StoreGateSvc.Dump = True #from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool -#InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", -# PixelCalibSvc = None, -# UsePixelCalibCondDB = FALSE) +#InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") #ToolSvc += InDetClusterMakerTool from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx index 1c60247e15a575144631aad3f420d5efaebd4d5e..db4fa1f06cebbd9edb29a8da5067589b000ccd3e 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx @@ -117,7 +117,6 @@ PixelFastDigitizationTool::PixelFastDigitizationTool(const std::string &type, co m_acceptDiagonalClusters(true), m_pixelClusterAmbiguitiesMapName("PixelClusterAmbiguitiesMap"), m_ambiguitiesMap(nullptr), - m_pixelCalibSvc("PixelCalibSvc", name), m_digitizationStepper("Trk::PlanarModuleStepper") { declareInterface(this); @@ -164,7 +163,8 @@ StatusCode PixelFastDigitizationTool::initialize() ATH_MSG_DEBUG ( "PixelDigitizationTool::initialize()" ); - CHECK(m_pixelCalibSvc.retrieve()); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); //locate the AtRndmGenSvc and initialize our local ptr if (!m_rndmSvc.retrieve().isSuccess()) @@ -514,6 +514,8 @@ StatusCode PixelFastDigitizationTool::digitize() if(!m_pixelClusterMap) { m_pixelClusterMap = new Pixel_detElement_RIO_map; } else { m_pixelClusterMap->clear(); } + SG::ReadCondHandle calibData(m_chargeDataKey); + while (m_thpcsi->nextDetectorElement(i, e)) { Pixel_detElement_RIO_map PixelDetElClusterMap; @@ -546,6 +548,7 @@ StatusCode PixelFastDigitizationTool::digitize() const IdentifierHash waferID = m_pixel_ID->wafer_hash(hitSiDetElement->identify()); + Identifier moduleID = m_pixel_ID->wafer_id(hitSiDetElement->identify()); const int trkn = hit->trackNumber(); @@ -608,7 +611,13 @@ StatusCode PixelFastDigitizationTool::digitize() bool ExitValid(exitCellId.isValid()); double pixMinimalPathCut= 1. / m_pixPathLengthTotConv; - double th0 = double(m_pixelCalibSvc->getThreshold(hitId))/m_ThrConverted; //test? + + Identifier diodeID = hitId; + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + + double th0 = calibData->getAnalogThreshold((int)waferID,circ,type)/m_ThrConverted; + // if (old_th != th0) std::cout<<"converted threshold "<(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); @@ -38,13 +37,14 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (abs(barrel_ec)!=m_BarrelEC) { return; } - SG::ReadCondHandle module_data(m_moduleDataKey); + SG::ReadCondHandle moduleData(m_moduleDataKey); + SG::ReadCondHandle calibData(m_chargeDataKey); // Add cross-talk - CrossTalk(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); + CrossTalk(moduleData->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes, rndmEngine); + ThermalNoise(moduleData->getThermalNoise(barrel_ec,layerIndex),chargedDiodes, rndmEngine); // Add random noise RandomNoise(chargedDiodes, rndmEngine); @@ -82,48 +82,48 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } } - for (SiChargedDiodeIterator i_chargedDiode=chargedDiodes.begin(); i_chargedDiode!=chargedDiodes.end(); ++i_chargedDiode) { Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analog threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); - double ith0 = m_pixelCalibSvc->getTimeWalk(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); + double ith0 = calibData->getInTimeThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); double intimethreshold = (ith0/th0)*threshold; if (charge>threshold) { - int bunchSim; + int bunchSim = 0; if ((*i_chargedDiode).second.totalCharge().fromTrack()) { - if (m_timingTune==2015) { bunchSim = relativeBunch2015((*i_chargedDiode).second.totalCharge(),barrel_ec,layerIndex,moduleIndex, rndmEngine); } - else { bunchSim = relativeBunch2009(threshold,intimethreshold,(*i_chargedDiode).second.totalCharge(), rndmEngine); } + if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)==2015) { bunchSim = relativeBunch2015((*i_chargedDiode).second.totalCharge(),barrel_ec,layerIndex,moduleIndex, rndmEngine); } + else if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)==2009) { bunchSim = relativeBunch2009(threshold,intimethreshold,(*i_chargedDiode).second.totalCharge(), rndmEngine); } } else { - bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,m_timeBCN); + if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)>0) { bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,moduleData->getNumberOfBCID(barrel_ec,layerIndex)); } } - if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + if (bunchSim<0 || bunchSim>moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (chargegetAnalogThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - // charge to ToT conversion - double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast(CLHEP::RandGaussZiggurat::shoot(rndmEngine,tot,totsig)); if (nToT<1) { nToT=1; } - if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=moduleData->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (nToT>=module_data->getLatency(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT>=moduleData->getFEI3Latency(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } @@ -141,22 +141,21 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const Identifier id_readout = chargedDiodes.element()->identifierFromCellId(cellId); // Front-End simulation - if (bunch>=0 && bunch=0 && bunchgetNumberOfBCID(barrel_ec,layerIndex)) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch,0,bunch); rdoCollection.push_back(p_rdo); + p_rdo = nullptr; } // Duplication mechanism for FEI3 small hits : - bool hitDupli = false; - if (module_data->getHitDuplication(barrel_ec,layerIndex)) { hitDupli=true; } - - if (hitDupli) { + if (moduleData->getFEI3HitDuplication(barrel_ec,layerIndex)) { bool smallHitChk = false; - if (nToT<=module_data->getSmallHitToT(barrel_ec,layerIndex)) { smallHitChk=true; } + if (nToT<=moduleData->getFEI3SmallHitToT(barrel_ec,layerIndex)) { smallHitChk=true; } - if (smallHitChk && bunch>0 && bunch<=m_timeBCN) { + if (smallHitChk && bunch>0 && bunch<=moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch-1,0,bunch-1); rdoCollection.push_back(p_rdo); + p_rdo = nullptr; } } } @@ -169,6 +168,8 @@ int FEI3SimTool::relativeBunch2009(const double threshold, const double intimeth double myTimeWalkEff = 0.; double overdrive = intimethreshold - threshold ; + SG::ReadCondHandle moduleData(m_moduleDataKey); + //my TimeWalk computation through PARAMETRIZATION (by Francesco De Lorenzi - Milan) //double curvature = 7.6e7*overdrive-2.64e10; //double divergence = -1.6*overdrive+942 ; @@ -182,13 +183,13 @@ int FEI3SimTool::relativeBunch2009(const double threshold, const double intimeth myTimeWalkEff = myTimeWalk+myTimeWalk*0.2*CLHEP::RandGaussZiggurat::shoot(rndmEngine); - double randomjitter = CLHEP::RandFlat::shoot(rndmEngine,(-m_timeJitter/2.0),(m_timeJitter/2.0)); + double randomjitter = CLHEP::RandFlat::shoot(rndmEngine,(-moduleData->getTimeJitter(0,1)/2.0),(moduleData->getTimeJitter(0,1)/2.0)); //double G4Time = totalCharge.time(); double G4Time = getG4Time(totalCharge); - double timing = m_timeZero+myTimeWalkEff+(randomjitter)+G4Time-m_comTime; - BCID = static_cast(floor(timing/m_timePerBCO)); + double timing = moduleData->getTimeOffset(0,1)+myTimeWalkEff+(randomjitter)+G4Time-moduleData->getComTime(); + BCID = static_cast(floor(timing/moduleData->getBunchSpace())); //ATH_MSG_DEBUG ( CTW << " , " << myTimeWalkEff << " , " << G4Time << " , " << timing << " , " << BCID ); return BCID; @@ -217,6 +218,7 @@ int FEI3SimTool::relativeBunch2015(const SiTotalCharge &totalCharge, int barrel_ * 60% working point tune-2 */ + SG::ReadCondHandle moduleData(m_moduleDataKey); double prob = 0.0; if (barrel_ec==0 && layer_disk==1) { if (abs(moduleID)==0) { @@ -399,7 +401,7 @@ int FEI3SimTool::relativeBunch2015(const SiTotalCharge &totalCharge, int barrel_ double timeWalk = 0.0; if (rnd(floor((G4Time+m_timeZero+timeWalk)/m_timePerBCO)); + int BCID = static_cast(floor((G4Time+moduleData->getTimeOffset(barrel_ec,layer_disk)+timeWalk)/moduleData->getBunchSpace())); return BCID; } diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h index f0a243bbf21f429193113ac6f6ac464212a41671..a0c978a15ca2afe2865a1f50e784cf26b0a15cba 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h @@ -21,10 +21,7 @@ class FEI3SimTool:public FrontEndSimTool { private: FEI3SimTool(); - int m_timingTune; - int relativeBunch2009(const double threshold, const double intimethreshold, const SiTotalCharge &totalCharge, CLHEP::HepRandomEngine *rndmEngine) const; - int relativeBunch2015(const SiTotalCharge &totalCharge, int barrel_ec, int layer_disk, int moduleID, CLHEP::HepRandomEngine *rndmEngine) const; }; diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx index 147ee43bb419564de6804d1346dbc173ada1cc7c..1a32968b36308406403882ca782eba2c0e50eead 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx @@ -30,16 +30,18 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); if (abs(barrel_ec)!=m_BarrelEC) { return; } - SG::ReadCondHandle module_data(m_moduleDataKey); + SG::ReadCondHandle moduleData(m_moduleDataKey); + SG::ReadCondHandle calibData(m_chargeDataKey); int maxFEI4SmallHit = 2; - int overflowToT = module_data->getIBLOverflowToT(); + int overflowToT = moduleData->getFEI4OverflowToT(barrel_ec,layerIndex); std::vector p_rdo_small_fei4; int nSmallHitsFEI4 = 0; @@ -49,10 +51,10 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle std::vector> FEI4Map(maxRow+16,std::vector(maxCol+16)); // Add cross-talk - CrossTalk(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); + CrossTalk(moduleData->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes,rndmEngine); + ThermalNoise(moduleData->getThermalNoise(barrel_ec,layerIndex),chargedDiodes,rndmEngine); // Add random noise RandomNoise(chargedDiodes,rndmEngine); @@ -65,46 +67,42 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); if (charge>threshold) { int bunchSim; if ((*i_chargedDiode).second.totalCharge().fromTrack()) { - bunchSim = static_cast(floor((getG4Time((*i_chargedDiode).second.totalCharge())+m_timeZero)/m_timePerBCO)); + bunchSim = static_cast(floor((getG4Time((*i_chargedDiode).second.totalCharge())+moduleData->getTimeOffset(barrel_ec,layerIndex))/moduleData->getBunchSpace())); } else { - bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,m_timeBCN); + bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,moduleData->getNumberOfBCID(barrel_ec,layerIndex)); } - if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + if (bunchSim<0 || bunchSim>moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (chargegetAnalogThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - // charge to ToT conversion - double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast(CLHEP::RandGaussZiggurat::shoot(rndmEngine,tot,totsig)); - const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); - if (pixelId->is_dbm(chargedDiodes.element()->identify())) { - nToT = 8*(charge - 1200. )/(8000. - 1200.); - } - if (nToT<1) { nToT=1; } // FEI4 HitDiscConfig if (nToT==2 && maxFEI4SmallHit==2) { nToT=1; } if (nToT>=overflowToT) { nToT=overflowToT; } - if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=moduleData->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } @@ -126,7 +124,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (iicol>=maxCol) { iicol=iicol-maxCol; } // FEI4 copy mechanism works per FE. // Front-End simulation - if (bunch>=0 && bunch=0 && bunchgetNumberOfBCID(barrel_ec,layerIndex)) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch,0,bunch); if (nToT>maxFEI4SmallHit) { rdoCollection.push_back(p_rdo); @@ -139,6 +137,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle FEI4Map[iirow][iicol] = 1; //Flag for low hits nSmallHitsFEI4++; } + p_rdo = nullptr; } } @@ -175,7 +174,6 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } } } - return; } diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h index 54e8e936d8445fd18e5e9ac1b753a615760b6243..37612a73994261a4e6a6d4c8dad3aa05c22bdd8c 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h @@ -16,17 +16,16 @@ #include "SiDigitization/SiChargedDiodeCollection.h" #include "InDetRawData/InDetRawDataCLASS_DEF.h" +#include "PixelCabling/IPixelCablingSvc.h" #include "InDetConditionsSummaryService/IInDetConditionsTool.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "InDetSimEvent/SiTotalCharge.h" #include "SiDigitization/SiHelper.h" #include "InDetReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SiCellId.h" -#include "CommissionEvent/ComTime.h" - #include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/ReadCondHandleKey.h" @@ -38,31 +37,10 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { public: FrontEndSimTool( const std::string& type, const std::string& name,const IInterface* parent): AthAlgTool(type,name,parent), - m_pixelCalibSvc("PixelCalibSvc",name), - m_timeBCN(1), - m_timeZero(5.0), - m_timePerBCO(25.0), - m_comTime(0.0), - m_useComTime(false), - m_timeJitter(0.0), - m_ComTimeKey("ComTime"), - m_eventStore("StoreGateSvc", name), - m_BarrelEC(0), - m_noiseShape({0.0,1.0}), - m_noiseOccupancy(1e-8), - m_disableProbability(9e-3) + m_BarrelEC(0) { declareInterface(this); - declareProperty("PixelCalibSvc", m_pixelCalibSvc); - declareProperty("TimeBCN", m_timeBCN, "Number of BCID"); - declareProperty("TimeZero", m_timeZero, "Time zero...?"); - declareProperty("TimePerBCO", m_timePerBCO, "Time per BCO - should be 25ns"); - declareProperty("UseComTime", m_useComTime, "Use ComTime for timing"); - declareProperty("TimeJitter", m_timeJitter, "Time jitter"); declareProperty("BarrelEC", m_BarrelEC, "Index of barrel or endcap"); - declareProperty("NoiseShape", m_noiseShape, "Vector containing noise ToT shape"); - declareProperty("NoiseOccupancy", m_noiseOccupancy); - declareProperty("DisableProbability", m_disableProbability); } static const InterfaceID& interfaceID() { return IID_IFrontEndSimTool; } @@ -70,21 +48,10 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { virtual StatusCode initialize() { ATH_CHECK(m_pixelConditionsTool.retrieve()); - ATH_CHECK(m_pixelCalibSvc.retrieve()); - + ATH_CHECK(m_pixelCabling.retrieve()); ATH_CHECK(m_moduleDataKey.initialize()); + ATH_CHECK(m_chargeDataKey.initialize()); - ATH_CHECK(m_ComTimeKey.initialize(m_useComTime)); - if (m_useComTime) { - SG::ReadHandle comTime(m_ComTimeKey); - if (comTime.isValid()) { - m_comTime = comTime->getTime(); - ATH_MSG_DEBUG("Found tool for cosmic/commissioning timing: ComTime"); - } - else { - ATH_MSG_WARNING("Did not find tool needed for cosmic/commissioning timing: ComTime"); - } - } return StatusCode::SUCCESS; } @@ -131,8 +98,16 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { } void RandomNoise(SiChargedDiodeCollection &chargedDiodes, CLHEP::HepRandomEngine *rndmEngine) const { + SG::ReadCondHandle moduleData(m_moduleDataKey); + SG::ReadCondHandle calibData(m_chargeDataKey); const InDetDD::PixelModuleDesign *p_design = static_cast(&(chargedDiodes.element())->design()); - int nNoise = CLHEP::RandPoisson::shoot(rndmEngine, p_design->numberOfCircuits()*p_design->columnsPerCircuit()*p_design->rowsPerCircuit()*m_noiseOccupancy*static_cast(m_timeBCN)); + + const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); + const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); + int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); + int nNoise = CLHEP::RandPoisson::shoot(rndmEngine, p_design->numberOfCircuits()*p_design->columnsPerCircuit()*p_design->rowsPerCircuit()*moduleData->getNoiseOccupancy(barrel_ec,layerIndex)*static_cast(moduleData->getNumberOfBCID(barrel_ec,layerIndex))); + for (int i=0; inumberOfCircuits()); int column = CLHEP::RandFlat::shootInt(rndmEngine,p_design->columnsPerCircuit()); @@ -147,13 +122,16 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { double x = CLHEP::RandFlat::shoot(rndmEngine,0.,1.); int bin=0; - for (size_t j=1; jm_noiseShape[j-1] && x<=m_noiseShape[j]) { bin=j-1; continue; } + std::vector noiseShape = moduleData->getNoiseShape(barrel_ec,layerIndex); + for (size_t j=1; jnoiseShape[j-1] && x<=noiseShape[j]) { bin=j-1; continue; } } double noiseToTm = bin+1.5; double noiseToT = CLHEP::RandGaussZiggurat::shoot(rndmEngine,noiseToTm,1.); - double chargeShape = m_pixelCalibSvc->getCharge(noisyID,noiseToT); + int type = m_pixelCabling->getPixelType(noisyID); + double chargeShape = calibData->getCharge((int)moduleHash, circuit, type, noiseToT); + chargedDiodes.add(diodeNoise,SiCharge(chargeShape,0,SiCharge::noise)); } } @@ -161,36 +139,35 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { } void RandomDisable(SiChargedDiodeCollection &chargedDiodes, CLHEP::HepRandomEngine *rndmEngine) const { + SG::ReadCondHandle moduleData(m_moduleDataKey); + const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); + int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); + int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); for (SiChargedDiodeIterator i_chargedDiode=chargedDiodes.begin(); i_chargedDiode!=chargedDiodes.end(); ++i_chargedDiode) { - if (CLHEP::RandFlat::shoot(rndmEngine)getDisableProbability(barrel_ec,layerIndex)) { SiHelper::disabled((*i_chargedDiode).second,true,false); } } return; } - private: FrontEndSimTool(); protected: - ToolHandle m_pixelConditionsTool{this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; - ServiceHandle m_pixelCalibSvc; - - SG::ReadCondHandleKey m_moduleDataKey{this, "PixelModuleData", "PixelModuleData", "Output key of pixel module"}; - - double m_timeBCN; - double m_timeZero; - double m_timePerBCO; - double m_comTime; /**< cosmics timing ofs */ - bool m_useComTime; /**< use ComTime for timing */ - double m_timeJitter; - SG::ReadHandleKey m_ComTimeKey; - ServiceHandle m_eventStore; + ToolHandle m_pixelConditionsTool + {this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; + + ServiceHandle m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; + int m_BarrelEC; - std::vector m_noiseShape; - double m_noiseOccupancy; - double m_disableProbability; double getG4Time(const SiTotalCharge &totalCharge) const { // If there is one single charge, return its time: diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx index d3cd5b8b431d7cd8425ba810f28658c1eca6fb27..4808a7924c208331b1252d60a91bf851445b31a0 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx @@ -37,16 +37,18 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); if (abs(barrel_ec)!=m_BarrelEC) { return; } - SG::ReadCondHandle module_data(m_moduleDataKey); + SG::ReadCondHandle moduleData(m_moduleDataKey); + SG::ReadCondHandle calibData(m_chargeDataKey); //int maxRD53SmallHit = 0; unused - int overflowToT = 256; + int overflowToT = moduleData->getFEI4OverflowToT(barrel_ec,layerIndex); std::vector p_rdo_small_fei4; //int nSmallHitsRD53 = 0; unused @@ -56,10 +58,10 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle std::vector> RD53Map(maxRow+16,std::vector(maxCol+16)); // Add cross-talk - CrossTalk(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); + CrossTalk(moduleData->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes,rndmEngine); + ThermalNoise(moduleData->getThermalNoise(barrel_ec,layerIndex),chargedDiodes,rndmEngine); // Add random noise RandomNoise(chargedDiodes,rndmEngine); @@ -72,33 +74,34 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); if (charge>threshold) { int bunchSim = 0; if ((*i_chargedDiode).second.totalCharge().fromTrack()) { - bunchSim = static_cast(floor((getG4Time((*i_chargedDiode).second.totalCharge())+m_timeZero)/m_timePerBCO)); + bunchSim = static_cast(floor((getG4Time((*i_chargedDiode).second.totalCharge())+moduleData->getTimeOffset(barrel_ec,layerIndex))/moduleData->getBunchSpace())); } else { - bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,m_timeBCN); + bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,moduleData->getNumberOfBCID(barrel_ec,layerIndex)); } - if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + if (bunchSim<0 || bunchSim>moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (chargegetAnalogThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - // charge to ToT conversion - double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast(CLHEP::RandGaussZiggurat::shoot(rndmEngine,tot,totsig)); if (nToT<1) { nToT=1; } @@ -106,7 +109,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle // RD53 HitDiscConfig if (nToT>=overflowToT) { nToT=overflowToT; } - if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=moduleData->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } @@ -128,7 +131,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (iicol>=maxCol) { iicol=iicol-maxCol; } // RD53 copy mechanism works per FE. // Front-End simulation - if (bunch>=0 && bunch=0 && bunchgetNumberOfBCID(barrel_ec,layerIndex)) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch,0,bunch); //see commented code below for clarification why this is always executed rdoCollection.push_back(p_rdo); @@ -150,6 +153,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle RD53Map[iirow][iicol] = 1; //Flag for low hits nSmallHitsRD53++; } **/ + p_rdo = nullptr; } } // again, the following code is never reached but left here for the developer to comment diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/PixelRadDamDigitization/CMakeLists.txt index 171b4db8364263c9c91adf2557f96911126d399a..90d2b8df0fbdcd1386d8e4df0ad5a62c4f9a5c28 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/CMakeLists.txt @@ -24,6 +24,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/SiPropertiesTool InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDigitization/SiDigitization InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetRawEvent/InDetSimData diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI3SimTool.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI3SimTool.cxx index 49e008842b83be16b6d083cb6cffcc790261d64d..bc0ee3bf6c1926e1804f8ce58b146511fd7f4ecb 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI3SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI3SimTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "FEI3SimTool.h" @@ -48,11 +48,14 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); int moduleIndex = pixelId->eta_module(chargedDiodes.element()->identify()); + SG::ReadCondHandle calibData(m_chargeDataKey); + // Merge ganged pixel for (SiChargedDiodeIterator i_chargedDiode=chargedDiodes.begin(); i_chargedDiode!=chargedDiodes.end(); ++i_chargedDiode) { InDetDD::SiCellId cellID = chargedDiodes.element()->cellIdFromIdentifier(chargedDiodes.getId((*i_chargedDiode).first)); @@ -88,11 +91,14 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); - double ith0 = m_pixelCalibSvc->getTimeWalk(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); + double ith0 = calibData->getInTimeThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); double intimethreshold = (ith0/th0)*threshold; if (charge>threshold) { @@ -106,7 +112,7 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); @@ -116,8 +122,8 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (barrel_ec!=0 && chargegetTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast(CLHEP::RandGaussZiggurat::shoot(m_rndmEngine,tot,totsig)); if (nToT<1) { nToT=1; } diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI4SimTool.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI4SimTool.cxx index dbbe2dbe423b2adc57e251d7224ea579182c51f4..edebd4e1b8af73e741de0e4848153bd7b9785a2b 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI4SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI4SimTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "FEI4SimTool.h" @@ -45,6 +45,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int maxFEI4SmallHit = 2; int overflowToT = 16; @@ -55,6 +56,8 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); + SG::ReadCondHandle calibData(m_chargeDataKey); + std::vector p_rdo_small_fei4; int nSmallHitsFEI4 = 0; std::vector row, col; @@ -67,10 +70,13 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); if (charge>threshold) { int bunchSim; @@ -82,7 +88,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); @@ -92,8 +98,8 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (barrel_ec!=0 && chargegetTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast(CLHEP::RandGaussZiggurat::shoot(m_rndmEngine,tot,totsig)); const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FrontEndSimTool.h b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FrontEndSimTool.h index 75ce3be9df72eb582d82685385a328de194c4be3..d938c6a2be29aad50a36883e0162a8b6c280c4a5 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FrontEndSimTool.h +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FrontEndSimTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELDIGITIZATION_FrontEndSimTool_H @@ -16,9 +16,13 @@ #include "InDetRawData/InDetRawDataCLASS_DEF.h" #include "InDetConditionsSummaryService/IInDetConditionsSvc.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "InDetSimEvent/SiTotalCharge.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" + #include "CommissionEvent/ComTime.h" static const InterfaceID IID_IFrontEndSimTool("FrontEndSimTool", 1, 0); @@ -32,7 +36,6 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { m_rndmEngineName("PixelDigitization"), m_rndmEngine(nullptr), m_pixelConditionsSvc("PixelConditionsSummarySvc",name), - m_pixelCalibSvc("PixelCalibSvc",name), m_timeBCN(1), m_timeZero(5.0), m_timePerBCO(25.0), @@ -52,7 +55,6 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { declareProperty("RndmSvc", m_rndmSvc, "Random number service used in FE simulation"); declareProperty("RndmEngine", m_rndmEngineName, "Random engine name"); declareProperty("PixelConditionsSummarySvc", m_pixelConditionsSvc); - declareProperty("PixelCalibSvc", m_pixelCalibSvc); declareProperty("TimeBCN", m_timeBCN, "Number of BCID"); declareProperty("TimeZero", m_timeZero, "Time zero...?"); declareProperty("TimePerBCO", m_timePerBCO, "Time per BCO - should be 25ns"); @@ -75,7 +77,9 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { CHECK(m_pixelConditionsSvc.retrieve()); - CHECK(m_pixelCalibSvc.retrieve()); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); + m_rndmEngine = m_rndmSvc->GetEngine(m_rndmEngineName); if (!m_rndmEngine) { @@ -113,7 +117,10 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { CLHEP::HepRandomEngine *m_rndmEngine; ServiceHandle m_pixelConditionsSvc; - ServiceHandle m_pixelCalibSvc; + ServiceHandle m_pixelCabling{this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; double m_timeBCN; double m_timeZero; diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.cxx index c3c2d5d7b5efde5ccdecd9ec8a69226a50fba003..3a443e7732bbc631bbe0a60c7fe8904233ab5654 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.cxx +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -29,7 +29,6 @@ using namespace RadDam; PixelNoisyCellGenerator::PixelNoisyCellGenerator(const std::string& type, const std::string& name,const IInterface* parent): PixelProcessorTool(type,name,parent), - m_pixelCalibSvc("PixelCalibSvc", name), m_timeBCN(1), m_mergeCharge(false), m_pixelID{}, @@ -47,8 +46,8 @@ PixelNoisyCellGenerator::~PixelNoisyCellGenerator() {} StatusCode PixelNoisyCellGenerator::initialize() { CHECK(PixelProcessorTool::initialize()); - CHECK(m_pixelCalibSvc.retrieve()); - ATH_MSG_DEBUG("Retrieved PixelCalibSvc"); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); CHECK(detStore()->retrieve(m_pixelID,"PixelID")); @@ -100,6 +99,12 @@ void PixelNoisyCellGenerator::addRandomNoise(SiChargedDiodeCollection &collectio } void PixelNoisyCellGenerator::addCell(SiChargedDiodeCollection &collection,const InDetDD::PixelModuleDesign *design, int circuit, int column, int row) const { + + SG::ReadCondHandle calibData(m_chargeDataKey); + + const PixelID* pixelId = static_cast(collection.element()->getIdHelper()); + const IdentifierHash moduleHash = pixelId->wafer_hash(collection.identify()); // wafer hash + ATH_MSG_DEBUG("addCell 1 circuit = " << circuit << ", column = " << column << ", row = " << row); #ifdef __PIXEL_DEBUG__ ATH_MSG_DEBUG("addCell: circuit,column,row=" << circuit << "," << column << "," << row); @@ -137,7 +142,10 @@ void PixelNoisyCellGenerator::addCell(SiChargedDiodeCollection &collection,const ATH_MSG_DEBUG ( "addCell 7b circuit = " << circuit << ", column = " << column << ", row = " << row); ATH_MSG_DEBUG ( "addCell 7c circuit = " << circuit << ", column = " << column << ", row = " << row); - double chargeShape = m_pixelCalibSvc->getCharge(noisyID,ToT); + + int type = m_pixelCabling->getPixelType(noisyID); + double chargeShape = calibData->getCharge((int)moduleHash, circuit, type, ToT); + ATH_MSG_DEBUG ( "addCell 7d circuit = " << circuit << ", column = " << column << ", row = " << row); // const double chargeGauss = chargeOfs + chargeVar*CLHEP::RandGaussZiggurat::shoot( m_rndmEngine ); diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.h b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.h index 676b7e4f5c99cd08a4e67047745225cc2fec814d..cdaaafb16a187e9db765e26c977c68f0b4e6fd58 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.h +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -13,7 +13,12 @@ #include "PixelProcessorTool.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" + #include "InDetReadoutGeometry/SiDetectorElement.h" @@ -39,7 +44,15 @@ class PixelNoisyCellGenerator:public PixelProcessorTool { private: PixelNoisyCellGenerator(); - ServiceHandle m_pixelCalibSvc; + ServiceHandle m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; + double m_timeBCN; bool m_mergeCharge; std::vector m_noiseShape; diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/RD53SimTool.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/RD53SimTool.cxx index 25e2810593c813ef0be000fe3a4f0f01a0663abe..bffd2672433b899f3e692af5c7eddf6de176ef37 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/RD53SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/RD53SimTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "RD53SimTool.h" @@ -39,6 +39,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); //int maxRD53SmallHit = 0; int overflowToT = 256; @@ -46,6 +47,8 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); + SG::ReadCondHandle calibData(m_chargeDataKey); + std::vector p_rdo_small_fei4; //int nSmallHitsRD53 = 0; std::vector row, col; @@ -58,10 +61,13 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); if (charge>threshold) { @@ -74,7 +80,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); @@ -84,8 +90,8 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (barrel_ec!=0 && chargegetTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast(CLHEP::RandGaussZiggurat::shoot(m_rndmEngine,tot,totsig)); if (nToT<1) { nToT=1; } diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt index 11419eab58419eed332597de7c392551c40b44e4..4caf24ad7ac4c70b6c48aab995aa1bf6f9defc56 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/TRT_ConditionsServices InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetRawEvent/InDetSimData InnerDetector/InDetRecEvent/InDetPrepRawData @@ -38,7 +39,7 @@ atlas_add_component( InDetPrepRawDataToxAOD src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps StoreGateLib SGtests Identifier xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRawData InDetSimData InDetPrepRawData PixelConditionsData InDetSimEvent TrkSurfaces TrkTruthData ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps StoreGateLib SGtests Identifier PixelConditionsData xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRawData InDetSimData InDetPrepRawData InDetSimEvent TrkSurfaces TrkTruthData ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx index e1f30a647b4fe76928e6958115d16b426b76ff3b..fa032ce2b817bcdaac4c8e7854f0616e2579bd6b 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx @@ -30,7 +30,6 @@ #include "TMath.h" #include "CLHEP/Geometry/Point3D.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "PixelConditionsServices/IPixelByteStreamErrorsSvc.h" #define AUXDATA(OBJ, TYP, NAME) \ @@ -45,8 +44,6 @@ PixelPrepDataToxAOD::PixelPrepDataToxAOD(const std::string &name, ISvcLocator *p AthAlgorithm(name,pSvcLocator), m_PixelHelper(0), m_useSiHitsGeometryMatching(true), - m_calibSvc("PixelCalibSvc", name), - m_pixelBSErrorsSvc("PixelByteStreamErrorsSvc", name), m_firstEventWarnings(true), m_need_sihits{false} { @@ -86,14 +83,15 @@ StatusCode PixelPrepDataToxAOD::initialize() m_writeSiHits = false; } - CHECK(m_calibSvc.retrieve()); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); ATH_CHECK(m_condDCSStateKey.initialize()); ATH_CHECK(m_condDCSStatusKey.initialize()); ATH_CHECK(m_readKeyTemp.initialize()); ATH_CHECK(m_readKeyHV.initialize()); - CHECK(m_pixelBSErrorsSvc.retrieve()); + ATH_CHECK(m_pixelBSErrorsSvc.retrieve()); ATH_CHECK(m_lorentzAngleTool.retrieve()); @@ -176,7 +174,11 @@ StatusCode PixelPrepDataToxAOD::execute() // Loop over the container unsigned int counter(0); - + + SG::ReadCondHandle dcsState(m_condDCSStateKey); + SG::ReadCondHandle dcsHV(m_readKeyHV); + SG::ReadCondHandle dcsTemp(m_readKeyTemp); + for( const auto& clusterCollection : * PixelClusterContainer ){ //Fill Offset container @@ -266,11 +268,11 @@ StatusCode PixelPrepDataToxAOD::execute() if(m_writeRDOinformation) { IdentifierHash moduleHash = clusterCollection->identifyHash(); AUXDATA(xprd,int,isBSError) = (int)m_pixelBSErrorsSvc->isActive(moduleHash); - AUXDATA(xprd,int,DCSState) = SG::ReadCondHandle(m_condDCSStateKey)->getModuleStatus(moduleHash); + AUXDATA(xprd,int,DCSState) = dcsState->getModuleStatus(moduleHash); float deplVoltage = 0.0; - AUXDATA(xprd,float,BiasVoltage) = SG::ReadCondHandle(m_readKeyHV)->getBiasVoltage(moduleHash); - AUXDATA(xprd,float,Temperature) = SG::ReadCondHandle(m_readKeyTemp)->getTemperature(moduleHash); + AUXDATA(xprd,float,BiasVoltage) = dcsHV->getBiasVoltage(moduleHash); + AUXDATA(xprd,float,Temperature) = dcsTemp->getTemperature(moduleHash); AUXDATA(xprd,float,DepletionVoltage) = deplVoltage; AUXDATA(xprd,float,LorentzShift) = (float)m_lorentzAngleTool->getLorentzShift(moduleHash); @@ -648,6 +650,7 @@ void PixelPrepDataToxAOD::addRdoInformation(xAOD::TrackMeasurementValidation* xp std::vector ATerm; std::vector ETerm; + SG::ReadCondHandle calibData(m_chargeDataKey); ATH_MSG_VERBOSE( "Number of RDOs: " << rdos.size() ); @@ -666,9 +669,14 @@ void PixelPrepDataToxAOD::addRdoInformation(xAOD::TrackMeasurementValidation* xp etaIndexList.push_back( m_PixelHelper->eta_index(rId) ); // charge calibration parameters - CTerm.push_back( m_calibSvc->getQ2TotC(rId) ); - ATerm.push_back( m_calibSvc->getQ2TotA(rId) ); - ETerm.push_back( m_calibSvc->getQ2TotE(rId) ); + Identifier moduleID = m_PixelHelper->wafer_id(rId); + IdentifierHash moduleHash = m_PixelHelper->wafer_hash(moduleID); // wafer hash + int circ = m_pixelCabling->getFE(&rId,moduleID); + int type = m_pixelCabling->getPixelType(rId); + + CTerm.push_back(calibData->getQ2TotC((int)moduleHash, circ, type)); + ATerm.push_back(calibData->getQ2TotA((int)moduleHash, circ, type)); + ETerm.push_back(calibData->getQ2TotE((int)moduleHash, circ, type)); }//end iteration on rdos diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.h b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.h index 626e8af46bb4f6e165fb2fe9235196cd8eb3aa94..a0da00920713589beb75331bf49c30d84b1d855f 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.h +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.h @@ -21,9 +21,12 @@ #include "xAODTracking/TrackMeasurementValidationContainer.h" #include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "InDetCondTools/ISiLorentzAngleTool.h" #include "PixelConditionsServices/IPixelByteStreamErrorsSvc.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "StoreGate/ReadCondHandleKey.h" + #include @@ -102,16 +105,29 @@ private: bool m_writeRDOinformation; bool m_useSiHitsGeometryMatching; - ServiceHandle m_calibSvc; + ServiceHandle m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; + + SG::ReadCondHandleKey m_condDCSStateKey + {this, "PixelDCSStateCondData", "PixelDCSStateCondData", "Pixel FSM state key"}; + + SG::ReadCondHandleKey m_condDCSStatusKey + {this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"}; + + SG::ReadCondHandleKey m_readKeyTemp + {this, "ReadKeyeTemp", "PixelDCSTempCondData", "Key of input sensor temperature conditions folder"}; - SG::ReadCondHandleKey m_condDCSStateKey{this, "PixelDCSStateCondData", "PixelDCSStateCondData", "Pixel FSM state key"}; - SG::ReadCondHandleKey m_condDCSStatusKey{this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"}; + SG::ReadCondHandleKey m_readKeyHV + {this, "ReadKeyHV", "PixelDCSHVCondData", "Key of input bias voltage conditions folder"}; - SG::ReadCondHandleKey m_readKeyTemp{this, "ReadKeyeTemp", "PixelDCSTempCondData", "Key of input sensor temperature conditions folder"}; - SG::ReadCondHandleKey m_readKeyHV {this, "ReadKeyHV", "PixelDCSHVCondData", "Key of input bias voltage conditions folder"}; + ServiceHandle m_pixelBSErrorsSvc + {this, "PixelByteStreamErrorsSvc", "PixelByteStreamErrorsSvc", "Pixel byte stream error service"}; - ServiceHandle m_pixelBSErrorsSvc; - ToolHandle m_lorentzAngleTool{this, "LorentzAngleTool", "SiLorentzAngleTool", "Tool to retreive Lorentz angle"}; + ToolHandle m_lorentzAngleTool + {this, "LorentzAngleTool", "SiLorentzAngleTool", "Tool to retreive Lorentz angle"}; // -- Private members bool m_firstEventWarnings; diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py index d52995d5cbe45f5c46274ce74488ea4e663dd2d0..bb077e52dcfc8174360aa2140882356b8720bd6b 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py @@ -60,15 +60,15 @@ if DetFlags.haveRIO.pixel_on(): print InDetPixelConditionsSummaryTool - # Load pixel calibration service - if not athenaCommonFlags.isOnline(): - if not conddb.folderRequested('/PIXEL/PixCalib'): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") - from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc - InDetPixelCalibSvc = PixelCalibSvc() - ServiceMgr += InDetPixelCalibSvc - if InDetFlags.doPrintConfigurables(): - print InDetPixelCalibSvc + ##################### + # Calibration Setup # + ##################### + if not conddb.folderRequested("/PIXEL/PixCalib"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") + + if not hasattr(condSeq, 'PixelChargeCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") # Load Pixel BS errors service if not (globalflags.DataSource=='geant4'): diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py index 3eba016b1616abee8cd22b58a96be55e1407a804..ddd39e08a2f7c029377e22ce0e19cae3704f90ef 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py @@ -39,15 +39,9 @@ if InDetFlags.doPRDFormation(): # from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", - PixelCalibSvc = None, - UsePixelCalibCondDB = False, PixelLorentzAngleTool = ToolSvc.PixelLorentzAngleTool, SCTLorentzAngleTool = sctLorentzAngleToolSetup.SCTLorentzAngleTool) - if DetFlags.makeRIO.pixel_on() and not (athenaCommonFlags.isOnline() or InDetFlags.doSLHC()): - InDetClusterMakerTool.PixelCalibSvc = InDetPixelCalibSvc - InDetClusterMakerTool.UsePixelCalibCondDB = True - ToolSvc += InDetClusterMakerTool if (InDetFlags.doPrintConfigurables()): print InDetClusterMakerTool diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Rec.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Rec.py index b49fcfaadc3fe00302cbf55c67085d7edc65adf2..76c15bf2cad2b9531a0199ac57ae498d1147c254 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Rec.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Rec.py @@ -38,7 +38,8 @@ if rec.doWriteESD() or rec.doWriteAOD() or ('doWriteESD' in dir() and doWriteESD print '===> OVERWRITTEN TOOL SETTINGS ................' # --- turn off cluster calibration from DB, does not exist for IBL - ToolSvc.InDetClusterMakerTool.UsePixelCalibCondDB = False + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.UseCalibConditions = False # --- switch alignment for IBL geometry off (gives WARNING) from PixelGeoModel.PixelGeoModelConf import PixelDetectorTool diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index 195901186832f0d24ef17451fa4a3708464bb08c..1eae0aa93ac92f21de4cd9c2a6b1cb7529aa9155 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -110,8 +110,8 @@ class PixelConditionsServicesSetup: ############################ # DeadMap Conditions Setup # ############################ + PixelDeadMapFolder = "/PIXEL/PixMapOverlay" if self.usePixMap: - PixelDeadMapFolder = "/PIXEL/PixMapOverlay" if not (conddb.folderRequested(PixelDeadMapFolder) or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")): conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixMapOverlay",PixelDeadMapFolder, className='CondAttrListCollection') @@ -123,7 +123,8 @@ class PixelConditionsServicesSetup: from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadMap=self.usePixMap, - ReadDeadMapKey=PixelDeadMapFolder) + ReadDeadMapKey=PixelDeadMapFolder, + UseCalibConditions=(not self.onlineMode)) from PixelConditionsTools.PixelConditionsToolsConf import PixelConditionsSummaryTool TrigPixelConditionsSummaryTool = PixelConditionsSummaryTool(name=self.instanceName('PixelConditionsSummaryTool'), @@ -143,18 +144,12 @@ class PixelConditionsServicesSetup: ##################### # Calibration Setup # ##################### - from AthenaCommon.AppMgr import ServiceMgr,theApp - from IOVDbSvc.CondDB import conddb - if not self.onlineMode: - from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc - PixelCalibSvc = PixelCalibSvc(name=self.instanceName('PixelCalibSvc')) - - if not conddb.folderRequested("/PIXEL/PixCalib"): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") + if not conddb.folderRequested("/PIXEL/PixCalib"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") - if self._print: print PixelCalibSvc - - svcMgr += PixelCalibSvc + if not hasattr(condSeq, 'PixelChargeCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") if not conddb.folderRequested("/PIXEL/PixReco"): conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixReco","/PIXEL/PixReco",className="DetCondCFloat") @@ -201,7 +196,6 @@ class PixelConditionsServicesSetup: ToolSvc += TrigPixelLorentzAngleTool - def instanceName(self, toolname): return self.prefix+toolname diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py index 70416536a47ef0a313fcb9f339bf685b4184d14d..4954c6a1a0185fe3affac8aef9952ee3ad88e2f0 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py @@ -31,10 +31,6 @@ sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetTrigClusterMakerTool = \ InDet__ClusterMakerTool( name = "InDetTrigClusterMakerTool", - UsePixelCalibCondDB = False, #simpler setup for EFID - #UsePixelCalibCondDB = True, #simpler setup for EFID - #pixLorentzAnleSvc = "InDetTrigPixLorentzAngleSvc", - #UseLorentzAngleCorrections = False PixelLorentzAngleTool = TrigPixelLorentzAngleTool, SCTLorentzAngleTool = TrigSCTLorentzAngleTool ) diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/share/strippedDown.py b/InnerDetector/InDetMonitoring/SCT_Monitoring/share/strippedDown.py index 34377877145f7454d4999b449c2b9404fafe2e83..1fc5469676b6e76587882c1a3ce62ca22137a1be 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/share/strippedDown.py +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/share/strippedDown.py @@ -62,8 +62,11 @@ elif globalflags.InputFormat() == 'bytestream': #-------------------------------------------------------------- # include SCT Clusterization #-------------------------------------------------------------- +from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg +PixelConfigCondAlg.UseCalibConditions = False + from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool -InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", UsePixelCalibCondDB = FALSE) +InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") ToolSvc += InDetClusterMakerTool print InDetClusterMakerTool # diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h index 597b3b81c97bc39e4f629167d404594f2a96d78c..a495b0ae3e153f44876373959301565dec5ac378 100644 --- a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h +++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx index b53182f1441d3841ad860c185c6ea61d604865bb..ae13e42a5b081b1629993b1d41fe35fda3775243 100644 --- a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx +++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx @@ -220,7 +220,7 @@ float InDet::PixelToTPIDTool::dEdx(const Trk::Track& track, if ( (m_IBLParameterSvc->containsIBL()) and (bec==0) and (layer==0) ){ // check if IBL //loop over ToT and check if anyone is overflow (ToT==14) check for IBL cluster overflow - m_overflowIBLToT = SG::ReadCondHandle(m_moduleDataKey)->getIBLOverflowToT(); + m_overflowIBLToT = SG::ReadCondHandle(m_moduleDataKey)->getFEI4OverflowToT(0,0); const std::vector& ToTs = pixclus->prepRawData()->totList(); for (int pixToT : ToTs) { diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt index d21cd07c945dcc073d33b5cd30c9c80f53508e14..1166c8a05b008b5a683fbdd8fa8c4e844464cdaf 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt @@ -19,6 +19,7 @@ atlas_depends_on_subdirs( InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetConditions/InDetCondTools InnerDetector/InDetConditions/PixelConditionsData + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetRawEvent/InDetRawData @@ -33,7 +34,6 @@ atlas_depends_on_subdirs( Database/APR/FileCatalog DetectorDescription/AtlasDetDescr DetectorDescription/DetDescrCond/DetDescrCondTools - InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetDetDescr/PixelGeoModel Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkEventPrimitives diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h index 4e0505a0bcc07b3d3f073159e67eac36fa678372..62be2ac3880d88915c1f153efc413b8ed12a6d4b 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h @@ -26,12 +26,14 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "InDetCondTools/ISiLorentzAngleTool.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "PixelConditionsData/PixelOfflineCalibData.h" #include "StoreGate/ReadCondHandleKey.h" #include -class IPixelCalibSvc; template class ServiceHandle; class Identifier; class StatusCode; @@ -142,15 +144,26 @@ public: private: + ServiceHandle m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; + + ToolHandle m_pixelLorentzAngleTool + {this, "PixelLorentzAngleTool", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retreive Lorentz angle of Pixel"}; + + ToolHandle m_sctLorentzAngleTool + {this, "SCTLorentzAngleTool", "SiLorentzAngleTool/SCTLorentzAngleTool", "Tool to retreive Lorentz angle of SCT"}; + // mutable MsgStream m_log; - bool m_calibrateCharge; mutable std::atomic_bool m_issueErrorA; mutable std::atomic_bool m_forceErrorStrategy1A; mutable std::atomic_bool m_issueErrorB; mutable std::atomic_bool m_forceErrorStrategy1B; - ServiceHandle m_calibSvc; - ToolHandle m_pixelLorentzAngleTool{this, "PixelLorentzAngleTool", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retreive Lorentz angle of Pixel"}; - ToolHandle m_sctLorentzAngleTool{this, "SCTLorentzAngleTool", "SiLorentzAngleTool/SCTLorentzAngleTool", "Tool to retreive Lorentz angle of SCT"}; // Parametrization of the Pixel errors // now moved in PixelConditionsData, except for CTB parametrization diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h index c1a1bfcef9b15165c83a342dd5e8f82b3b4004e7..822652a85ede62b5cd45007a8b86f83f4758f878 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h @@ -37,7 +37,10 @@ #include "EventPrimitives/EventPrimitives.h" #include "InDetCondTools/ISiLorentzAngleTool.h" #include "SiClusterizationTool/TTrainedNetworkCollection.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadCondHandleKey.h" #include "CxxUtils/checker_macros.h" ATLAS_NO_CHECK_FILE_THREAD_SAFETY; @@ -45,7 +48,6 @@ ATLAS_NO_CHECK_FILE_THREAD_SAFETY; class TTrainedNetwork; class TH1; class ICoolHistSvc; - class IPixelCalibSvc; namespace Trk { class NeuralNetworkToHistoTool; @@ -209,8 +211,11 @@ namespace InDet { ToolHandle m_pixelLorentzAngleTool {this, "PixelLorentzAngleTool", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retreive Lorentz angle of Pixel"}; - ServiceHandle m_calibSvc - {this, "PixelCalibSvc", "PixelCalibSvc", "Pixel calibration service" }; + ServiceHandle m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service" }; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Output key"}; SG::ReadCondHandleKey m_readKeyWithoutTrack {this, "NnCollectionReadKey", "PixelClusterNN", "The conditions statore key for the pixel cluster NNs"}; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h index 0b73de1d964573db57027dcfb046eda7e8b1f527..e321406d5cc56ae20d85b3d82e9a9c6b30f66f79 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h @@ -15,8 +15,10 @@ #include "InDetPrepRawData/PixelClusterParts.h" #include "InDetPrepRawData/PixelClusterSplitProb.h" #include "InDetIdentifier/PixelID.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadCondHandleKey.h" -class IPixelCalibSvc; template class ServiceHandle; namespace InDet @@ -79,7 +81,11 @@ namespace InDet enum SplitType { PhiSplit = 0, EtaSplit = 1, NoSplit = 2 }; - ServiceHandle m_calibSvc; + ServiceHandle m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service" }; + + SG::ReadCondHandleKey m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; /** Minimum number of pixels in cluster to consider splitting. */ unsigned int m_minPixels; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx index 2d135491b0b81439778e594425928a09e543bca6..48ca2ce627e2605a0333a87763ebd56d9909ab33 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx @@ -23,11 +23,8 @@ #include "InDetIdentifier/PixelID.h" #include "AtlasDetDescr/AtlasDetectorID.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" - #include "EventPrimitives/EventPrimitives.h" - using CLHEP::micrometer; namespace { @@ -50,12 +47,9 @@ ClusterMakerTool::ClusterMakerTool(const std::string& t, m_issueErrorA(true), m_forceErrorStrategy1A(false), m_issueErrorB(true), - m_forceErrorStrategy1B(false), - m_calibSvc("PixelCalibSvc", n) + m_forceErrorStrategy1B(false) { declareInterface(this); - declareProperty("UsePixelCalibCondDB",m_calibrateCharge=true,"Compute deposited charge in Pixels"); - declareProperty("PixelCalibSvc",m_calibSvc); } //=============== Destructor ================================================= @@ -68,28 +62,9 @@ StatusCode ClusterMakerTool::initialize(){ ATH_MSG_INFO ( name() << " initialize()" ); - // Protect from the situation in which the PixelCalibSvc is not configured: - // that should be the case if no PixelRDO are read in. - // AA 01/10/2009 - if ( m_calibSvc.empty() ) { - if ( m_calibrateCharge ) { - ATH_MSG_WARNING("Requesting charge calibration, but ServiceHandle is not configured"); - ATH_MSG_WARNING("No charge calibration applied"); - } - m_calibrateCharge = false; - } - - if ( m_calibrateCharge ) { - StatusCode sc = m_calibSvc.retrieve(); - if (sc.isFailure() || !m_calibSvc) { - ATH_MSG_WARNING ( m_calibSvc.type() << " not found! " ); - ATH_MSG_WARNING ( "Continuing without calibrating charge" ); - m_calibrateCharge = false; - } - else{ - ATH_MSG_INFO ( "Retrieved tool " << m_calibSvc.type() ) ; - } - } + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_moduleDataKey.initialize()); + ATH_CHECK(m_chargeDataKey.initialize()); if (not m_pixelLorentzAngleTool.empty()) { ATH_CHECK(m_pixelLorentzAngleTool.retrieve()); @@ -105,7 +80,6 @@ StatusCode ClusterMakerTool::initialize(){ ATH_CHECK(m_clusterErrorKey.initialize()); return StatusCode::SUCCESS; - } @@ -161,17 +135,24 @@ PixelCluster* ClusterMakerTool::pixelCluster( return nullptr; } + SG::ReadCondHandle moduleData(m_moduleDataKey); + SG::ReadCondHandle calibData(m_chargeDataKey); + if ( errorStrategy==2 && m_forceErrorStrategy1A ) errorStrategy=1; // Fill vector of charges std::vector chargeList; - if (m_calibrateCharge) { + if (moduleData->getUseCalibConditions()) { int nRDO=rdoList.size(); chargeList.reserve(nRDO); for (int i=0; igetCharge(pixid,ToT); + Identifier moduleID = pid->wafer_id(pixid); + IdentifierHash moduleHash = pid->wafer_hash(moduleID); + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + float charge = calibData->getCharge((int)moduleHash, circ, type, 1.0*ToT); chargeList.push_back(charge); } @@ -301,6 +282,9 @@ PixelCluster* ClusterMakerTool::pixelCluster( } if ( errorStrategy==2 && m_forceErrorStrategy1B ) errorStrategy=1; + SG::ReadCondHandle moduleData(m_moduleDataKey); + SG::ReadCondHandle calibData(m_chargeDataKey); + // Fill vector of charges and compute charge balance const InDetDD::PixelModuleDesign* design = (dynamic_cast(&element->design())); if (not design){ @@ -315,15 +299,22 @@ PixelCluster* ClusterMakerTool::pixelCluster( float qColMin = 0; float qColMax = 0; std::vector chargeList; int nRDO=rdoList.size(); - if (m_calibrateCharge) chargeList.reserve(nRDO); + if (moduleData->getUseCalibConditions()) { chargeList.reserve(nRDO); } for (int i=0; igetCharge(pixid,ToT); + if (moduleData->getUseCalibConditions()) { + + Identifier moduleID = pixelID.wafer_id(pixid); + IdentifierHash moduleHash = pixelID.wafer_hash(moduleID); // wafer hash + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + charge = calibData->getCharge((int)moduleHash, circ, type, 1.0*ToT); + if (moduleHash<12 || moduleHash>2035) { + charge = ToT/8.0*(8000.0-1200.0)+1200.0; + } chargeList.push_back(charge); } diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx index 1de39a533d90e91e11849c23127ca6b6aaac36e5..2e09935978de206d4448d731515f799ecfbc239e 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx @@ -90,10 +90,8 @@ namespace InDet { StatusCode NnClusterizationFactory::initialize() { - - if (!m_calibSvc.name().empty()) { - ATH_CHECK( m_calibSvc.retrieve() ); - } + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); ATH_CHECK(m_pixelLorentzAngleTool.retrieve()); @@ -789,6 +787,8 @@ namespace InDet { return input; } + SG::ReadCondHandle calibData(m_chargeDataKey); + // const InDet::PixelCluster* pCluster = pcot->prepRawData(); const std::vector& rdos = pCluster.rdoList(); @@ -816,8 +816,12 @@ namespace InDet { // recreate the charge: should be a method of the calibSvc int tot0 = *tot; - float ch = m_calibSvc->getCharge(*rdosBegin,tot0); - + Identifier pixid = *rdosBegin; + Identifier moduleID = pixelID.wafer_id(pixid); + IdentifierHash moduleHash = pixelID.wafer_hash(moduleID); // wafer hash + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + float ch = calibData->getCharge((int)moduleHash, circ, type, 1.0*tot0); chListRecreated.push_back(ch); totListRecreated.push_back(tot0); } diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx index a183e8631a027243dbccb6ba70958ea64bdaf800..b6bd6ea564cee4fa0ef395bfb33d045f6f697514 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx @@ -12,17 +12,13 @@ #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" - InDet::TotPixelClusterSplitter::TotPixelClusterSplitter(const std::string & type, const std::string & name, const IInterface * parent) : AthAlgTool(type, name, parent), - m_calibSvc("PixelCalibSvc", name), m_minPixels(3), m_maxPixels(25), m_doLongPixels(true) { declareInterface(this); - declareProperty("PixelCalibSvc", m_calibSvc); } InDet::TotPixelClusterSplitter::~TotPixelClusterSplitter() @@ -30,7 +26,8 @@ InDet::TotPixelClusterSplitter::~TotPixelClusterSplitter() StatusCode InDet::TotPixelClusterSplitter::initialize() { - CHECK(m_calibSvc.retrieve()); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); return StatusCode::SUCCESS; } @@ -53,6 +50,8 @@ std::vector InDet::TotPixelClusterSplitter::splitClust InDetDD::SiCellId * CellIds = new InDetDD::SiCellId[NumPixels]; + SG::ReadCondHandle calibData(m_chargeDataKey); + // Detect special pixels and exclude them if necessary. // Veto removed on 28-7-2011 by K. Barry - residual-level // studies show RMS improvement when ganged-pixel containing @@ -213,7 +212,7 @@ std::vector InDet::TotPixelClusterSplitter::splitClust if (!pixelIDp){ ATH_MSG_ERROR("Could not get PixelID pointer"); } - // const PixelID& pixelID = *pixelIDp; + const PixelID& pixelID = *pixelIDp; for (unsigned int i = 0; i < NumPixels; i++) @@ -235,8 +234,15 @@ std::vector InDet::TotPixelClusterSplitter::splitClust { for (int j = 0; j < 2; j++) { + + Identifier pixid = Rdos[i]; + Identifier moduleID = pixelID.wafer_id(pixid); + IdentifierHash moduleHash = pixelID.wafer_hash(moduleID); // wafer hash + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + SplitRdos[j].push_back(Rdos[i]); - Totgroups[j].push_back(static_cast(m_calibSvc->getTotMean(Rdos[i],Charges[i]/2.))); + Totgroups[j].push_back(static_cast(calibData->getToT((int)moduleHash,circ,type,Charges[i]/2.0))); Lvl1groups[j].push_back(Lvl1a); } } diff --git a/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py b/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py index 74951c2704b5408c137f1d2e9c0617c88f593389..c2904ff3416618772a2636f2fabff91248d0a020 100644 --- a/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py +++ b/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py @@ -60,11 +60,8 @@ from AthenaCommon.AppMgr import ServiceMgr # Pixel # # Load DCS service -from PixelConditionsTools.PixelDCSConditionsToolSetup import PixelDCSConditionsToolSetup -pixelDCSConditionsToolSetup = PixelDCSConditionsToolSetup() -pixelDCSConditionsToolSetup.setup() -pixelDCSConditionsTool = pixelDCSConditionsToolSetup.getTool() from SiPropertiesTool.PixelSiPropertiesToolSetup import PixelSiPropertiesToolSetup + pixelSiPropertiesToolSetup = PixelSiPropertiesToolSetup() pixelSiPropertiesToolSetup.setup() pixelSiPropertiesTool = pixelSiPropertiesToolSetup.getTool() @@ -75,7 +72,7 @@ pixelLorentzAngleTool = pixelLorentzAngleToolSetup.PixelLorentzAngleTool ReadPixelElements.UseConditionsTools = True ReadPixelElements.SiLorentzAngleTool = pixelLorentzAngleTool ReadPixelElements.SiPropertiesTool = pixelSiPropertiesTool -ReadPixelElements.SiConditionsTool = pixelDCSConditionsTool +ReadPixelElements.SiConditionsTool = None # # SCT @@ -101,7 +98,6 @@ ReadSCTElements.DetEleCollKey = "SCT_DetectorElementCollection" print ReadPixelElements print pixelLorentzAngleTool -print pixelDCSConditionsTool print pixelSiPropertiesTool print ReadSCTElements diff --git a/Tools/PROCTools/python/RunTier0TestsTools.py b/Tools/PROCTools/python/RunTier0TestsTools.py index adcac6a301e7a13334e4b91c1796edce05df6d70..652b7c96276be79d37ca165c6893f6d8fef296e8 100644 --- a/Tools/PROCTools/python/RunTier0TestsTools.py +++ b/Tools/PROCTools/python/RunTier0TestsTools.py @@ -24,7 +24,7 @@ ciRefFileMap = { 's3126-22.0' : 'v4', # OverlayTier0Test_required-test 'overlay-d1498-21.0' : 'v2', - 'overlay-d1498-22.0' : 'v13', + 'overlay-d1498-22.0' : 'v14', 'overlay-bkg-21.0' : 'v1', 'overlay-bkg-22.0' : 'v1', } diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py index 7d3225a1a0938f65f9e04dd2e6a764c69e5fbfde..831ebf05a8b3943f4067b8ab4ed339fb98a5b63d 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py @@ -27,9 +27,11 @@ class ConfiguredOnlineSpacePointProviderTool(OnlineSpacePointProviderTool) : # --- SiLorentzAngleTool from SiLorentzAngleTool.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() + + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.UseCalibConditions = False InDetL2TrigClusterMakerTool = InDet__ClusterMakerTool( name = "InDetL2TrigClusterMakerTool", - UsePixelCalibCondDB = False, PixelLorentzAngleTool = TrigPixelLorentzAngleTool, SCTLorentzAngleTool = TrigSCTLorentzAngleTool ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py index 9028462a9f3f939f13ed1d3b4a82b4eb30cd4d31..14ec3702f1a7ac41248ebac661a6203bacf26c84 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py @@ -124,18 +124,18 @@ def TrigInDetCondConfig( flags ): PixelTDAQInstance = "TDAQ_ONL" acc.merge(addFolders(flags, PixelTDAQFolder, PixelTDAQInstance, className="CondAttrListCollection")) - PixelHVFolder = "/PIXEL/DCS/HV" - PixelTempFolder = "/PIXEL/DCS/TEMPERATURE" - PixelDBInstance = "DCS_OFL" - - acc.merge(addFolders(flags, PixelHVFolder, PixelDBInstance, className="CondAttrListCollection")) - acc.merge(addFolders(flags, PixelTempFolder, PixelDBInstance, className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/PIXEL/DCS/HV", "DCS_OFL", className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/PIXEL/DCS/TEMPERATURE", "DCS_OFL", className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/PIXEL/PixCalib", "PIXEL_OFL", className="CondAttrListCollection")) from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondHVAlg - acc.addCondAlgo(PixelDCSCondHVAlg(name="PixelDCSCondHVAlg", ReadKey=PixelHVFolder)) + acc.addCondAlgo(PixelDCSCondHVAlg(name="PixelDCSCondHVAlg", ReadKey="/PIXEL/DCS/HV")) from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondTempAlg - acc.addCondAlgo(PixelDCSCondTempAlg(name="PixelDCSCondTempAlg", ReadKey=PixelTempFolder)) + acc.addCondAlgo(PixelDCSCondTempAlg(name="PixelDCSCondTempAlg", ReadKey="/PIXEL/DCS/TEMPERATURE")) + + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + acc.addCondAlgo(PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib")) from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg acc.addCondAlgo(PixelTDAQCondAlg(name="PixelTDAQCondAlg", ReadKey=PixelTDAQFolder)) @@ -143,11 +143,11 @@ def TrigInDetCondConfig( flags ): PixelDeadMapFolder = "/PIXEL/PixMapOverlay" PixelDeadMapInstance = "PIXEL_OFL" - acc.merge(addFolders(flags, PixelTempFolder, PixelDBInstance, className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/PIXEL/DCS/TEMPERATURE", "DCS_OFL", className="CondAttrListCollection")) acc.merge(addFolders(flags, PixelDeadMapFolder, PixelDeadMapInstance, className="CondAttrListCollection")) from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg - acc.addCondAlgo(PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadMap=False, ReadDeadMapKey=PixelDeadMapFolder)) + acc.addCondAlgo(PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadMap=False, ReadDeadMapKey=PixelDeadMapFolder, UseCalibConditions=False)) from SiPropertiesTool.SiPropertiesToolConf import PixelSiPropertiesCondAlg acc.addCondAlgo(PixelSiPropertiesCondAlg(name="PixelSiPropertiesCondAlg")) @@ -273,10 +273,8 @@ def TrigInDetConfig( flags, roisKey="EMRoIs" ): #Pixel clusterisation - from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool - InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", - UsePixelCalibCondDB = False) + InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") acc.addPublicTool(InDetClusterMakerTool) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py index be9e210916f26a175fe6d01d438d5bf12dbc411c..3ed355be025045a18ef5b1b559e4fd74f41d3dca 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py @@ -123,10 +123,11 @@ def makeInDetAlgs( whichSignature='' ): #Pixel clusterisation from InDetTrigRecExample.InDetTrigConfigRecLoadTools import TrigPixelLorentzAngleTool, TrigSCTLorentzAngleTool + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.UseCalibConditions = False + from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool" + signature, - PixelCalibSvc = None, - UsePixelCalibCondDB = False, SCTLorentzAngleTool = TrigSCTLorentzAngleTool, PixelLorentzAngleTool = TrigPixelLorentzAngleTool)