diff --git a/DetectorDescription/DetDescrCond/DetDescrConditions/DetDescrConditions/DetCondCFloat.h b/DetectorDescription/DetDescrCond/DetDescrConditions/DetDescrConditions/DetCondCFloat.h index 95f1b0f4b30af4048a13d93f50326d7763052909..ac0be2cdcf0913e31ae3a76e3d5039ec8f0468ce 100644 --- a/DetectorDescription/DetDescrCond/DetDescrConditions/DetDescrConditions/DetCondCFloat.h +++ b/DetectorDescription/DetDescrCond/DetDescrConditions/DetDescrConditions/DetCondCFloat.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #ifndef DETDESCRCOND_DETCONDCFLOAT_H @@ -55,6 +55,7 @@ class DetCondCFloat { void share(const Identifier& ident, const int index); const float* find(const Identifier& ident) const; int findindex(const Identifier& ident) const; + float get(const Identifier& ident, int k) const; void print() const; void print2() const; diff --git a/DetectorDescription/DetDescrCond/DetDescrConditions/src/DetCondCFloat.cxx b/DetectorDescription/DetDescrCond/DetDescrConditions/src/DetCondCFloat.cxx index 3f3ab98c1a91278e86c833afdb157f6264a474b0..fa1653983f1f6aecf7bed37fb78383ed75c924be 100755 --- a/DetectorDescription/DetDescrCond/DetDescrConditions/src/DetCondCFloat.cxx +++ b/DetectorDescription/DetDescrCond/DetDescrConditions/src/DetCondCFloat.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ // DetCondCFloat.cxx @@ -48,6 +48,10 @@ int DetCondCFloat::findindex(const Identifier& ident) const { } } +float DetCondCFloat::get(const Identifier& ident, int k) const { + return m_buf.at(findindex(ident)+k); +} + void DetCondCFloat::print() const { std::cout << "DetCondCFloat " << m_tag << " has granularity " << m_size << " with " << m_bufmap.size() << " entries and " << m_buf.size() << diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt index 521a8f0e3a82557cfc2994cf36f1c3ad9f2c160f..498ec7c1c63a2388b3adbb45ef8300ad68b6a499 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt @@ -47,7 +47,7 @@ atlas_add_library( PixelCalibAlgsLib atlas_add_component( PixelCalibAlgs src/components/*.cxx - LINK_LIBRARIES GaudiKernel PixelCalibAlgsLib ) + LINK_LIBRARIES GaudiKernel PixelConditionsData PixelCalibAlgsLib ) # Executables in the package: atlas_add_executable( doPixelOfflineCalib diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h index b50926350aeff442ca513c03366e246ca76880d6..3f5f25eede7010136c511e3aba2952515038e4fb 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h @@ -12,11 +12,13 @@ #include "InDetPrepRawData/PixelCluster.h" #include "InDetPrepRawData/PixelClusterContainer.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "StoreGate/ReadCondHandleKey.h" + #include<string> #include<vector> class IPixelCalibSvc; -class IPixelOfflineCalibSvc; class IBLParameterSvc; class PixelChargeToTConversion: public AthAlgorithm{ @@ -32,12 +34,12 @@ class PixelChargeToTConversion: public AthAlgorithm{ private: ServiceHandle<IPixelCalibSvc> m_calibsvc; ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; - int m_overflowIBLToT; - ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; //std::vector<unsigned int> m_modules; std::string m_PixelsClustersName; const InDet::PixelClusterContainer* m_Pixel_clcontainer; + + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey{this, "PixelModuleData", "PixelModuleData", "Output key of pixel module"}; }; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelCalibCondAlg.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelCalibCondAlg.cxx deleted file mode 100644 index 3763fb40a7bb83c6c55d4b656b8eb0a165e43992..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelCalibCondAlg.cxx +++ /dev/null @@ -1,213 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "PixelCalibCondAlg.h" -#include "Identifier/Identifier.h" - -PixelCalibCondAlg::PixelCalibCondAlg(const std::string& name - , ISvcLocator* pSvcLocator ) - : ::AthAlgorithm( name, pSvcLocator ) - , m_readKey("/PIXEL/PixReco") - , m_writeKey("PixelOfflineCalibData","PixelOfflineCalibData") - , m_condSvc("CondSvc",name) -{ - declareProperty("ReadKey",m_readKey); - declareProperty("WriteKey",m_writeKey); -} - -PixelCalibCondAlg::~PixelCalibCondAlg() -{ -} - -StatusCode PixelCalibCondAlg::initialize() -{ - ATH_MSG_DEBUG("initialize " << name()); - - // CondSvc - ATH_CHECK( m_condSvc.retrieve() ); - - // Read Handles - ATH_CHECK( m_readKey.initialize() ); - ATH_CHECK( m_writeKey.initialize() ); - - // Register write handle - if (m_condSvc->regHandle(this, m_writeKey).isFailure()) { - ATH_MSG_ERROR("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc"); - return StatusCode::FAILURE; - } - - return StatusCode::SUCCESS; -} - -StatusCode PixelCalibCondAlg::execute() -{ - ATH_MSG_DEBUG("execute " << name()); - - // Write Cond Handle - SG::WriteCondHandle<PixelCalib::PixelOfflineCalibData> writeHandle{m_writeKey}; - - // Do we have a valid Write Cond Handle for current time? - 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; - } - - // Construct the output Cond Object and fill it in - auto writeCdo = std::make_unique<PixelCalib::PixelOfflineCalibData>(); - - SG::ReadCondHandle<DetCondCFloat> readHandle{m_readKey}; - const DetCondCFloat* readCdo{*readHandle}; - if(readCdo==nullptr) { - ATH_MSG_ERROR("Null pointer to the read conditions object"); - return StatusCode::FAILURE; - } - - const float* constants = readCdo->find(Identifier(1)); - if(constants) { - ATH_MSG_INFO("Found constants with new-style Identifier key"); - writeCdo->SetConstants(constants); - } - else { - Identifier key; - key.set_literal(1); - const float* const2 = readCdo->find(key); - if (const2) { - ATH_MSG_INFO("Found constants with old-style Identifier key"); - writeCdo->SetConstants(const2); - } - else { - ATH_MSG_ERROR("Could not get the constants!"); - return StatusCode::FAILURE; - } - } - - // Define validity of the output cond obbject and record it - EventIDRange rangeW; - if(!readHandle.range(rangeW)) { - ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle.key()); - return StatusCode::FAILURE; - } - - if(writeHandle.record(rangeW,std::move(writeCdo)).isFailure()) { - ATH_MSG_ERROR("Could not record PixelCalib::PixelOfflineCalibData " << 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 PixelCalibCondAlg::finalize() -{ - ATH_MSG_DEBUG("finalize " << name()); - return StatusCode::SUCCESS; -} - -void PixelCalibCondAlg::PrintConstants(const float* constants) -{ - bool isoldformat = (constants[0] > 0); - int offset = 13; - if(constants[0]<-1||constants[1]<-1||constants[2]<-1)offset +=8; - if(!isoldformat){ - ATH_MSG_DEBUG(" version numbering: " << constants[0] << " " << constants[1] << " " << constants[2]); - ATH_MSG_DEBUG("Number of cluster error barrel bins for each view is " << constants[3]); - ATH_MSG_DEBUG("Number of cluster error endcap bins for each view is " << constants[4]); - ATH_MSG_DEBUG("Number of cluster on track error barrel bins of x cluster size is " << constants[5]); - ATH_MSG_DEBUG("Number of cluster on track error barrel bins of y cluster size is " << constants[6]); - ATH_MSG_DEBUG("Number of cluster on track error barrel bins of pseudorapidity is " << constants[7]); - ATH_MSG_DEBUG("Number of cluster on track error barrel bins of incidence angle is " << constants[8]); - ATH_MSG_DEBUG("Number of charge interpolation bins for x cluster size is" << constants[9]); - ATH_MSG_DEBUG("Number of charge interpolation bins for y cluster size is" << constants[10]); - ATH_MSG_DEBUG("Number of charge interpolation bins of pseudorapidity is " << constants[11]); - ATH_MSG_DEBUG("Number of charge interpolation bins of incidence angle is " << constants[12]); - if(offset>13){ - ATH_MSG_DEBUG("Number of cluster on track error IBL bins for x cluster size is " << constants[13]); - ATH_MSG_DEBUG("Number of cluster on track error IBL bins for y cluster size is " << constants[14]); - ATH_MSG_DEBUG("Number of cluster on track error IBL bins of pseudorapidity is " << constants[15]); - ATH_MSG_DEBUG("Number of cluster on track error IBL bins of incidence angle is " << constants[16]); - ATH_MSG_DEBUG("Number of charge interpolation IBL bins for x cluster size is " << constants[17]); - ATH_MSG_DEBUG("Number of charge interpolation IBL bins for y cluster size is " << constants[18]); - ATH_MSG_DEBUG("Number of charge interpolation IBL bins of pseudorapidity is " << constants[19]); - ATH_MSG_DEBUG("Number of charge interpolation IBL bins of incidence angle is " << constants[20]); - } - } - else { - ATH_MSG_DEBUG("old format constants"); - ATH_MSG_DEBUG("Number of cluster error barrel bins for each view is " << constants[0]); - ATH_MSG_DEBUG("Number of cluster error endcap bins for each view is " << constants[1]); - ATH_MSG_DEBUG("Number of cluster on track error barrel bins of x cluster size is " << constants[2]); - ATH_MSG_DEBUG("Number of cluster on track error barrel bins of y cluster size is " << constants[3]); - ATH_MSG_DEBUG("Number of cluster on track error barrel bins of incidence angle is " << constants[4]); - ATH_MSG_DEBUG("Number of cluster on track error barrel bins of pseudorapidity is " << constants[5]); - ATH_MSG_DEBUG("Number of charge interpolation constants (x-view) is " << constants[6]); - ATH_MSG_DEBUG("Number of charge interpolation constants (y-view) is " << constants[7]); - } - - if(!isoldformat){ - int n1 = lrint(constants[3]); - int n2 = lrint(constants[4]); - int n3a = lrint(constants[5]); - int n3b = lrint(constants[6]); - int n3c = lrint(constants[7]); - int n3d = lrint(constants[8]); - int n4a = lrint(constants[9]); - int n4b = lrint(constants[10]); - int n4c = lrint(constants[11]); - int n4d = lrint(constants[12]); - int ncxibl = offset>13 ? lrint(constants[13]) : 0; - int ncyibl = offset>13 ? lrint(constants[14]) : 0; - int n3e = offset>13 ? lrint(constants[15]) : 0; - int n3f = offset>13 ? lrint(constants[16]) : 0; - int ncxibl2 = offset>13 ? lrint(constants[17]) : 0; - int ncyibl2 = offset>13 ? lrint(constants[18]) : 0; - int n4e = offset>13 ? lrint(constants[19]) : 0; - int n4f = offset>13 ? lrint(constants[20]) : 0; - - const int N0 = 2*n1+2*n2; // number of cluster error values - const int N1a = n3a*n3d; // number of cluster on track error values (x direction) - const int N1b = n3a*n3b*n3c; // number of cluster on track error values (y direction) - const int N1c = n3a+n3b+n3c+n3d; // number of cluster on track bin values - const int N2a = 6*n4a*n4d+6*n4b*n4c; // number of charge interpolation values - const int N2b = n4a+n4b+n4c+n4d+4; // number of charge interpolation bin interval values - int datasize = N0+N1a+N1b+N1c+N2a+N2b; - if(offset>13) datasize += 2*n1 + n3e+1 + n3f+1 + ncyibl*n3e + ncxibl*n3f +n4e+1 + n4f+1 + ncyibl2*n4e + ncxibl2*n4f; - ATH_MSG_VERBOSE("Number of constants is " << N0 << " + " - << N1a << " + " - << N1b << " + " << N1c << " + " << N2a - << " + " << N2b); - if(offset>13) - ATH_MSG_VERBOSE(" + Number of IBL constants "<<2*n1<< " + "<< - (n3e + n3f+2)<<" + "<<(ncyibl*n3e + ncxibl*n3f)<<" + "<< - (n4e+1 + n4f+1)<<" + "<<ncyibl2*n4e + ncxibl2*n4f); - ATH_MSG_VERBOSE(" = " << datasize); - - for(int ibin=0; ibin<datasize; ibin++) { - ATH_MSG_VERBOSE("Value of costant for bin " << ibin << " equal to " << constants[ibin+offset]); - } - } // if(!isoldformat) - else { - int n1 = lrint(constants[0]); - int n2 = lrint(constants[1]); - int n3a = lrint(constants[2]); - int n3b = lrint(constants[3]); - int n3c = lrint(constants[4]); - int n3d = lrint(constants[5]); - int n4 = lrint(constants[6]); - int n5 = lrint(constants[7]); - const int N0 = 2*n1+2*n2; // number of cluster error values - const int N1a = n3a*n3d; // number of cluster on track error values (x direction) - const int N1b = n3a*n3b*n3d; // number of cluster on track error values (y direction) - const int N1c = n3a+n3b+n3c+n3d; // number of cluster on track bin values - const int N2 = n4+n5; // number of charge interpolation values - const int datasize = N0+N1a+N1b+N1c+N2; - - for(int ibin=0; ibin<datasize; ibin++){ - ATH_MSG_VERBOSE("Value of costant for bin " << ibin << " equal to " << constants[ibin+8]); - } - } -} diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelCalibCondAlg.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelCalibCondAlg.h deleted file mode 100644 index 4df3cb358923c610d59d87b1b4348b96969d260f..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelCalibCondAlg.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXEL_PIXELCALIBCONDALG -#define PIXEL_PIXELCALIBCONDALG 1 - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "StoreGate/ReadCondHandleKey.h" -#include "StoreGate/WriteCondHandleKey.h" - -#include "GaudiKernel/ICondSvc.h" - -#include "PixelConditionsData/PixelOfflineCalibData.h" -#include "DetDescrConditions/DetCondCFloat.h" - -class PixelCalibCondAlg : public AthAlgorithm -{ - public: - - PixelCalibCondAlg (const std::string& name, ISvcLocator* pSvcLocator); - ~PixelCalibCondAlg(); - - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - - private: - void PrintConstants(const float* constants); - - SG::ReadCondHandleKey<DetCondCFloat> m_readKey; - SG::WriteCondHandleKey<PixelCalib::PixelOfflineCalibData> m_writeKey; - - ServiceHandle<ICondSvc> m_condSvc; -}; - -#endif diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx index 08ed0be71db1a9e2b0fd35f2d71075422915d967..769818b3aa0172f389b0e20e2a7a8778649f17f0 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ #ifndef PixelChargeInterpolationHistograms_C @@ -50,19 +50,20 @@ PixelChargeInterpolationHistograms::PixelChargeInterpolationHistograms(std::stri unsigned int NCSphi = clustersizePhi.size()-1; unsigned int ntotbins = Nphi + NCSphi + Neta + NCSeta + 4; - float *bins = new float[ntotbins]; - unsigned int shift = 0; - for(unsigned int i = 0; i < clustersizePhi.size() && shift < ntotbins; i++, shift++){ - bins[shift] = clustersizePhi[i]; + + std::vector<float> bins; + bins.reserve(ntotbins); + for (unsigned int i=0; i<clustersizePhi.size(); i++) { + bins.push_back(clustersizePhi[i]); } - for(unsigned int i = 0; i < clustersizeEta.size() && shift < ntotbins; i++, shift++){ - bins[shift] = clustersizeEta[i]; + for (unsigned int i=0; i<clustersizeEta.size(); i++) { + bins.push_back(clustersizeEta[i]); } - for(unsigned int i = 0; i < etabins.size() && shift < ntotbins; i++, shift++){ - bins[shift] = etabins[i]; + for (unsigned int i=0; i<etabins.size(); i++) { + bins.push_back(etabins[i]); } - for(unsigned int i = 0; i < phibins.size() && shift < ntotbins; i++, shift++){ - bins[shift] = phibins[i]; + for (unsigned int i=0; i<phibins.size(); i++) { + bins.push_back(phibins[i]); } m_parameters = new PixelChargeInterpolationParameters(); @@ -115,12 +116,10 @@ PixelChargeInterpolationHistograms::PixelChargeInterpolationHistograms(std::stri delete Profmodel; delete THmodel; delete THmodel1; - delete[] bins; delete layers; Profmodel = 0; THmodel = 0; THmodel1 = 0; - bins = 0; } diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationValidation.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationValidation.cxx index 41524f15c0320cc46e2f8adddb6846dfbb6ff845..f938992e6dcf070d97d48f5acd5147bfdcbb50f0 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationValidation.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationValidation.cxx @@ -552,19 +552,24 @@ void PixelChargeInterpolationValidation::WriteErrorsFile(std::string name){ int neta = etaModel->GetNbinsX(); // number of eta values bins int nalpha = phiModel->GetNbinsX(); // number of incidence angle bins int ntotbins = ncsx + ncsy + neta + nalpha; - float *values = new float[ntotbins]; - int globalindex = 0; - for(int i = 0; i < ncsx && globalindex < ntotbins; i++, globalindex++) - values[globalindex] = i + 0.5; - for(int i = 0; i < ncsy && globalindex < ntotbins; i++, globalindex++) - values[globalindex] = i + 0.5; - values[globalindex++] = -2.5; - for(int i = 1; i < neta && globalindex < ntotbins; i++, globalindex++) - values[globalindex] = etaModel->GetBinLowEdge(i+1); - values[globalindex++] = -180; - for(int i = 1; i < nalpha && globalindex < ntotbins; i++, globalindex++) - values[globalindex] = phiModel->GetBinLowEdge(i+1); + std::vector<float> values; + values.reserve(ntotbins); + int globalindex = 0; + for (int i=0; i<ncsx && globalindex<ntotbins; i++, globalindex++) { + values.push_back(i+0.5); + } + for (int i=0; i<ncsy && globalindex<ntotbins; i++, globalindex++) { + values.push_back(i+0.5); + } + values.push_back(-2.5); + for (int i=1; i<neta && globalindex<ntotbins; i++, globalindex++) { + values.push_back(etaModel->GetBinLowEdge(i+1)); + } + values.push_back(-180); + for (int i=1; i<nalpha && globalindex<ntotbins; i++, globalindex++) { + values.push_back(phiModel->GetBinLowEdge(i+1)); + } parameters->setParameters(ncsx, ncsy, neta, nalpha,0,values); int ntotyconstnx = ncsx * nalpha; @@ -587,7 +592,6 @@ void PixelChargeInterpolationValidation::WriteErrorsFile(std::string name){ parameters->Print(name.c_str()); delete parameters; - delete[] values; } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx index 39fda23a3c7a081bb4fb639f50c212f32f4ee6a6..6710782b737680e8403054974ad2fd689b3f9596 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx @@ -13,14 +13,10 @@ #include "InDetPrepRawData/PixelCluster.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" - PixelChargeToTConversion::PixelChargeToTConversion(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_calibsvc("PixelCalibSvc", name), m_IBLParameterSvc("IBLParameterSvc",name), - m_overflowIBLToT(0), - m_offlineCalibSvc("PixelOfflineCalibSvc", name), m_Pixel_clcontainer(0) { declareProperty("PixelCalibSvc", m_calibsvc); @@ -42,24 +38,13 @@ StatusCode PixelChargeToTConversion::initialize(){ } msg(MSG::INFO) << " PixelCalibSvc found " << endmsg; - if ( !m_offlineCalibSvc.empty() ) { - StatusCode sc = m_offlineCalibSvc.retrieve(); - if (sc.isFailure() || !m_offlineCalibSvc ) { - ATH_MSG_ERROR( m_offlineCalibSvc.type() << " not found! "); - return StatusCode::RECOVERABLE; - } - else{ - ATH_MSG_INFO ( "Retrieved tool " << m_offlineCalibSvc.type() ); - } - } - if (m_IBLParameterSvc.retrieve().isFailure()) { ATH_MSG_FATAL("Could not retrieve IBLParameterSvc"); return StatusCode::FAILURE; } else ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); - m_overflowIBLToT = m_offlineCalibSvc->getIBLToToverflow(); + ATH_CHECK(m_moduleDataKey.initialize()); return StatusCode::SUCCESS; } @@ -75,6 +60,11 @@ StatusCode PixelChargeToTConversion::execute(){ } ATH_MSG_DEBUG( "Pixel Cluster container found: " << m_Pixel_clcontainer->size() << " collections" ); + int overflowIBLToT=0; + if( m_IBLParameterSvc->containsIBL()) { + overflowIBLToT = SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getIBLOverflowToT(); + } + typedef InDet::PixelClusterContainer::const_iterator ClusterIter; ClusterIter itrCluster; ClusterIter itrClubeg=m_Pixel_clcontainer->begin(); @@ -115,36 +105,36 @@ StatusCode PixelChargeToTConversion::execute(){ // int sumToT = 0; std::vector<int> totList; - for (int i=0; i<nRDO; i++) { - Identifier pixid=RDOs[i]; - int Charge=Charges[i]; - float A = m_calibsvc->getQ2TotA(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 <<" "<<E <<" "<<C<<" "<<tot); - - int totInt = (int) (tot + 0.1); - - if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(pixid) == 0 && pixelID.layer_disk(pixid) == 0 ) { - int tot0 = totInt; - if ( totInt >= m_overflowIBLToT ) totInt = m_overflowIBLToT; - msg(MSG::DEBUG) << "barrel_ec = " << pixelID.barrel_ec(pixid) << " layer_disque = " << pixelID.layer_disk(pixid) << " ToT = " << tot0 << " Real ToT = " << totInt << endmsg; - } - - totList.push_back( totInt ) ; // Fudge to make sure we round to the correct number - ATH_MSG_DEBUG( "from Charge --> ToT " << Charge <<" "<< totInt); - sumToT += totInt; - } - ATH_MSG_DEBUG( "sumToT " << sumToT); - theNonConstCluster->m_totList = totList; - theNonConstCluster->m_totalToT = sumToT; + for (int i=0; i<nRDO; i++) { + Identifier pixid=RDOs[i]; + int Charge=Charges[i]; + float A = m_calibsvc->getQ2TotA(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 <<" "<<E <<" "<<C<<" "<<tot); + + int totInt = (int) (tot + 0.1); + + if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(pixid) == 0 && pixelID.layer_disk(pixid) == 0 ) { + int tot0 = totInt; + if ( totInt >= overflowIBLToT ) totInt = overflowIBLToT; + msg(MSG::DEBUG) << "barrel_ec = " << pixelID.barrel_ec(pixid) << " layer_disque = " << pixelID.layer_disk(pixid) << " ToT = " << tot0 << " Real ToT = " << totInt << endmsg; + } + + totList.push_back( totInt ) ; // Fudge to make sure we round to the correct number + ATH_MSG_DEBUG( "from Charge --> ToT " << Charge <<" "<< totInt); + sumToT += totInt; + } + ATH_MSG_DEBUG( "sumToT " << sumToT); + theNonConstCluster->m_totList = totList; + theNonConstCluster->m_totalToT = sumToT; } - + }//loop over clusters }//loop over collections diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/components/PixelCalibAlgs_entries.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/components/PixelCalibAlgs_entries.cxx index 351d87e1dac1be63445a97136aea9baeb7fb554b..a4d5af47cf9406714a7f79fc17e1bba13a11bbf6 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/components/PixelCalibAlgs_entries.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/components/PixelCalibAlgs_entries.cxx @@ -4,7 +4,6 @@ #include "PixelCalibAlgs/PixMapOverlayWriter.h" #include "PixelCalibAlgs/PixelChargeToTConversion.h" #include "PixelCalibAlgs/CompareModulesTDAQandBytestream.h" -#include "../PixelCalibCondAlg.h" DECLARE_COMPONENT( PixelBarrelSurvey ) DECLARE_COMPONENT( NoiseMapBuilder ) @@ -12,5 +11,4 @@ DECLARE_COMPONENT( PixMapDBWriter ) DECLARE_COMPONENT( PixMapOverlayWriter ) DECLARE_COMPONENT( PixelChargeToTConversion ) DECLARE_COMPONENT( CompareModulesTDAQandBytestream ) -DECLARE_COMPONENT( PixelCalibCondAlg ) diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt index 1fefaf41b09207455de75dd2e8a8ea89229bdfbb..0eb8a5e0b91ad06bb04d6425f66d1c8f81e7a9fc 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt @@ -23,11 +23,13 @@ atlas_depends_on_subdirs( DetectorDescription/GeoModel/GeoModelInterfaces DetectorDescription/GeoModel/GeoModelUtilities DetectorDescription/Identifier + DetectorDescription/DetDescrCond/DetDescrConditions InnerDetector/InDetConditions/PixelConditionsTools InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetDetDescr/PixelCabling - InnerDetector/InDetDetDescr/PixelGeoModel ) + InnerDetector/InDetDetDescr/PixelGeoModel + Tools/PathResolver) # External dependencies: find_package( CLHEP ) @@ -40,8 +42,8 @@ atlas_add_library( PixelConditionsAlgorithmsLib PixelConditionsAlgorithms/*.h INTERFACE PUBLIC_HEADERS PixelConditionsAlgorithms - LINK_LIBRARIES GaudiKernel AthenaKernel AthenaBaseComps PixelConditionsData - AthenaPoolUtilities ) + LINK_LIBRARIES GaudiKernel AthenaKernel AthenaBaseComps PixelConditionsData DetDescrConditions + AthenaPoolUtilities PathResolver ) atlas_add_component( PixelConditionsAlgorithms src/*.h src/*.cxx src/components/*.cxx @@ -51,7 +53,7 @@ atlas_add_component( PixelConditionsAlgorithms ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities GaudiKernel PixelConditionsData SGTools StoreGateLib CoralDB GeoModelUtilities Identifier InDetIdentifier InDetReadoutGeometry - PixelGeoModelLib PixelCablingLib PixelConditionsAlgorithmsLib ) + PixelGeoModelLib PixelCablingLib PixelConditionsAlgorithmsLib PathResolver ) # Install files from the package: #atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5758bda30bed74e1e76caef9395dfb3ff689230b --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx @@ -0,0 +1,247 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelConfigCondAlg.h" +#include "Identifier/IdentifierHash.h" +#include "GaudiKernel/EventIDRange.h" +#include <memory> +#include <sstream> + +PixelConfigCondAlg::PixelConfigCondAlg(const std::string& name, ISvcLocator* pSvcLocator): + ::AthAlgorithm(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_useDeadMap(true), + m_condSvc("CondSvc", name) +{ + declareProperty("BarrelAnalogThreshold", m_BarrelAnalogThreshold); + declareProperty("EndcapAnalogThreshold", m_EndcapAnalogThreshold); + declareProperty("DBMAnalogThreshold", m_DBMAnalogThreshold); + 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("UseDeadMap", m_useDeadMap, "Switch for usage of dead map"); +} + +StatusCode PixelConfigCondAlg::initialize() { + ATH_MSG_DEBUG("PixelConfigCondAlg::initialize()"); + + ATH_CHECK(m_condSvc.retrieve()); + + if (m_useDeadMap) { ATH_CHECK(m_readDeadMapKey.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; + } + + 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; +} + +StatusCode PixelConfigCondAlg::execute() { + ATH_MSG_DEBUG("PixelConfigCondAlg::execute()"); + + SG::WriteCondHandle<PixelModuleData> 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; + } + + // Construct the output Cond Object and fill it in + std::unique_ptr<PixelModuleData> writeCdo(std::make_unique<PixelModuleData>()); + + 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}; + + //============== + // Set dead map + //============== + EventIDRange rangeDeadMap{start, stop}; + if (m_useDeadMap) { + SG::ReadCondHandle<CondAttrListCollection> readHandle(m_readDeadMapKey); + 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(rangeDeadMap)) { + 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 " << rangeDeadMap); + + // Read dead map info + for (CondAttrListCollection::const_iterator attrList=readCdo->begin(); attrList!=readCdo->end(); ++attrList) { + CondAttrListCollection::ChanNum channelNumber = attrList->first; + CondAttrListCollection::AttributeList payload = attrList->second; + + // RUN-3 format + if (payload.exists("data_array") and not payload["data_array"].isNull()) { + std::string stringStatus = payload["data_array"].data<std::string>(); + + std::stringstream ss(stringStatus); + std::vector<std::string> component; + std::string buffer; + while (std::getline(ss,buffer,',')) { component.push_back(buffer); } + + for (int i=0; i<(int)component.size(); i++) { + std::stringstream checkModule(component[i]); + std::vector<std::string> moduleString; + while (std::getline(checkModule,buffer,'"')) { moduleString.push_back(buffer); } + + if (moduleString.size()<4) { + ATH_MSG_FATAL("Not enough moduleString data " << moduleString.size() << " < 4 for " << component[i] + << " channel " << channelNumber << " read from " << readHandle.fullKey()); + return StatusCode::FAILURE; + } + + int moduleHash = std::atoi(moduleString[1].c_str()); + if (moduleHash!=i) { ATH_MSG_ERROR("Mismatch hash ID in DB array."); } + + std::stringstream checkStatus(moduleString[3]); + std::vector<std::string> moduleStringStatus; + while (std::getline(checkStatus,buffer,' ')) { moduleStringStatus.push_back(buffer); } + + if (moduleStringStatus.size()<2) { + ATH_MSG_FATAL("Not enough moduleStringStatus data " << moduleStringStatus.size() << " < 2 for " << component[i] + << " channel " << channelNumber << " read from " << readHandle.fullKey()); + return StatusCode::FAILURE; + } + + int moduleStatus = std::atoi(moduleStringStatus[0].c_str()); + int chipStatus = std::atoi(moduleStringStatus[1].c_str()); + + writeCdo -> setModuleStatus(moduleHash, moduleStatus); + writeCdo -> setChipStatus(moduleHash, chipStatus); + } + } + // RUN-1, RUN-2 format + else if (payload.exists("moduleID") and not payload["moduleID"].isNull() && payload.exists("ModuleSpecialPixelMap_Clob") and not payload["ModuleSpecialPixelMap_Clob"].isNull()) { + + int moduleHash = payload["moduleID"].data<int>(); + std::string stringStatus = payload["ModuleSpecialPixelMap_Clob"].data<std::string>(); + + std::stringstream ss(stringStatus); + std::vector<std::string> moduleStringStatus; + std::string buffer; + while (std::getline(ss,buffer,' ')) { moduleStringStatus.push_back(buffer); } + + if (moduleStringStatus.size()<2) { + ATH_MSG_FATAL("Not enough moduleStringStatus data " << moduleStringStatus.size() << " < 2 for channel " << channelNumber << " read from " << readHandle.fullKey()); + return StatusCode::FAILURE; + } + + int moduleStatus = std::atoi(moduleStringStatus[0].c_str()); + int chipStatus = std::atoi(moduleStringStatus[1].c_str()); + + writeCdo -> setModuleStatus(moduleHash, moduleStatus); + writeCdo -> setChipStatus(moduleHash, chipStatus); + } + else { + ATH_MSG_WARNING("Can not retrieve " << channelNumber); + for (int i=0; i<2048; i++) { + writeCdo -> setModuleStatus(i, 0); + writeCdo -> setChipStatus(i, 0); + } + } + } + } + + //=============== + // Set threshold + //=============== + EventIDRange rangeThreshold{start, stop}; + writeCdo -> setBarrelAnalogThreshold(m_BarrelAnalogThreshold); + writeCdo -> setEndcapAnalogThreshold(m_EndcapAnalogThreshold); + writeCdo -> setDBMAnalogThreshold(m_DBMAnalogThreshold); + 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); + + //======================= + // Combine time interval + //======================= + EventIDRange rangeW{start, stop}; +// rangeW = EventIDRange::intersect(rangeDeadMap, rangeThreshold); + rangeW = rangeDeadMap; + + if (rangeW.stop().isValid() and rangeW.start()>rangeW.stop()) { + ATH_MSG_FATAL("Invalid intersection rangeW: " << rangeW); + return StatusCode::FAILURE; + } + + if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { + ATH_MSG_FATAL("Could not record PixelModuleData " << 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 PixelConfigCondAlg::finalize() { + ATH_MSG_DEBUG("PixelConfigCondAlg::finalize()"); + return StatusCode::SUCCESS; +} + diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..80312f8b05b11a3b3928564bd22b6705d81cc0f3 --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELCONFIGCONDALG +#define PIXELCONFIGCONDALG + +#include "AthenaBaseComps/AthAlgorithm.h" + +#include "StoreGate/ReadCondHandleKey.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" + +#include "StoreGate/WriteCondHandleKey.h" +#include "PixelConditionsData/PixelModuleData.h" + +#include "GaudiKernel/ICondSvc.h" +#include "GaudiKernel/Property.h" + +class PixelConfigCondAlg : public AthAlgorithm { + public: + PixelConfigCondAlg(const std::string& name, ISvcLocator* pSvcLocator); + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; + + private: + std::vector<int> m_BarrelAnalogThreshold; + std::vector<int> m_EndcapAnalogThreshold; + std::vector<int> m_DBMAnalogThreshold; + std::vector<int> m_BarrelToTThreshold; + std::vector<int> m_EndcapToTThreshold; + std::vector<int> m_DBMToTThreshold; + std::vector<int> m_BarrelLatency; + std::vector<int> m_EndcapLatency; + std::vector<int> m_DBMLatency; + std::vector<double> m_BarrelCrossTalk; + std::vector<double> m_EndcapCrossTalk; + std::vector<double> m_DBMCrossTalk; + std::vector<double> m_BarrelThermalNoise; + std::vector<double> m_EndcapThermalNoise; + std::vector<double> m_DBMThermalNoise; + std::vector<bool> m_BarrelHitDuplication; + std::vector<bool> m_EndcapHitDuplication; + std::vector<bool> m_DBMHitDuplication; + std::vector<int> m_BarrelSmallHitToT; + std::vector<int> m_EndcapSmallHitToT; + std::vector<int> m_DBMSmallHitToT; + int m_IBLHitDisConfig; + + bool m_useDeadMap; + + SG::ReadCondHandleKey<CondAttrListCollection> m_readDeadMapKey + {this, "ReadDeadMapKey", "/PIXEL/PixMapOverlay", "Input key of deadmap conditions folder"}; + + SG::WriteCondHandleKey<PixelModuleData> m_writeKey + {this, "WriteKey", "PixelModuleData", "Output key of pixel module data"}; + + ServiceHandle<ICondSvc> m_condSvc; +}; + +#endif // PIXELCONFIGCONDALG diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDeadMapCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDeadMapCondAlg.cxx deleted file mode 100644 index 3a14181b2f908f7b020d4946046ca2b3bbf27ba7..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDeadMapCondAlg.cxx +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "PixelDeadMapCondAlg.h" -#include "Identifier/IdentifierHash.h" -#include "GaudiKernel/EventIDRange.h" -#include <memory> -#include <sstream> - -PixelDeadMapCondAlg::PixelDeadMapCondAlg(const std::string& name, ISvcLocator* pSvcLocator): - ::AthAlgorithm(name, pSvcLocator), - m_condSvc("CondSvc", name) -{ -} - -StatusCode PixelDeadMapCondAlg::initialize() { - ATH_MSG_INFO("PixelDeadMapCondAlg::initialize()"); - - ATH_CHECK(m_condSvc.retrieve()); - - 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 PixelDeadMapCondAlg::execute() { - ATH_MSG_INFO("PixelDeadMapCondAlg::execute()"); - - SG::WriteCondHandle<PixelModuleData> 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<CondAttrListCollection> 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 - EventIDRange rangeW; - 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); - - // Construct the output Cond Object and fill it in - std::unique_ptr<PixelModuleData> writeCdo(std::make_unique<PixelModuleData>()); - - // Read dead map info - for (CondAttrListCollection::const_iterator attrList=readCdo->begin(); attrList!=readCdo->end(); ++attrList) { - CondAttrListCollection::ChanNum channelNumber = attrList->first; - CondAttrListCollection::AttributeList payload = attrList->second; - - // RUN-3 format - if (payload.exists("data_array") and not payload["data_array"].isNull()) { - std::string stringStatus = payload["data_array"].data<std::string>(); - - std::stringstream ss(stringStatus); - std::vector<std::string> component; - std::string buffer; - while (std::getline(ss,buffer,',')) { component.push_back(buffer); } - - for (int i=0; i<(int)component.size(); i++) { - std::stringstream checkModule(component[i]); - std::vector<std::string> moduleString; - while (std::getline(checkModule,buffer,'"')) { moduleString.push_back(buffer); } - - int moduleHash = std::atoi(moduleString[1].c_str()); - if (moduleHash!=i) { ATH_MSG_ERROR("Mismatch hash ID in DB array."); } - - std::stringstream checkStatus(moduleString[3]); - std::vector<std::string> moduleStringStatus; - while (std::getline(checkStatus,buffer,' ')) { moduleStringStatus.push_back(buffer); } - - int moduleStatus = std::atoi(moduleStringStatus[0].c_str()); - int chipStatus = std::atoi(moduleStringStatus[1].c_str()); - - writeCdo -> setModuleStatus(moduleHash, moduleStatus); - writeCdo -> setChipStatus(moduleHash, chipStatus); - } - } - // RUN-1, RUN-2 format - else if (payload.exists("moduleID") and not payload["moduleID"].isNull() && payload.exists("ModuleSpecialPixelMap_Clob") and not payload["ModuleSpecialPixelMap_Clob"].isNull()) { - - int moduleHash = payload["moduleID"].data<int>(); - std::string stringStatus = payload["ModuleSpecialPixelMap_Clob"].data<std::string>(); - - std::stringstream ss(stringStatus); - std::vector<std::string> moduleStringStatus; - std::string buffer; - while (std::getline(ss,buffer,' ')) { moduleStringStatus.push_back(buffer); } - - int moduleStatus = std::atoi(moduleStringStatus[0].c_str()); - int chipStatus = std::atoi(moduleStringStatus[1].c_str()); - - writeCdo -> setModuleStatus(moduleHash, moduleStatus); - writeCdo -> setChipStatus(moduleHash, chipStatus); - } - else { - ATH_MSG_WARNING("Can not retrieve " << channelNumber); - for (int i=0; i<2048; i++) { - writeCdo -> setModuleStatus(i, 0); - writeCdo -> setChipStatus(i, 0); - } - } - } - - if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { - ATH_MSG_FATAL("Could not record PixelModuleData " << 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 PixelDeadMapCondAlg::finalize() { - ATH_MSG_INFO("PixelDeadMapCondAlg::finalize()"); - return StatusCode::SUCCESS; -} - diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDeadMapCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDeadMapCondAlg.h deleted file mode 100644 index 197b4264029ee6911b56124ab4da40b409c18e04..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDeadMapCondAlg.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXELDEADMAPCONDALG -#define PIXELDEADMAPCONDALG - -#include "AthenaBaseComps/AthAlgorithm.h" - -#include "StoreGate/ReadCondHandleKey.h" -#include "AthenaPoolUtilities/CondAttrListCollection.h" - -#include "StoreGate/WriteCondHandleKey.h" -#include "PixelConditionsData/PixelModuleData.h" - -#include "GaudiKernel/ICondSvc.h" -#include "GaudiKernel/Property.h" - -class PixelDeadMapCondAlg : public AthAlgorithm { - public: - PixelDeadMapCondAlg(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~PixelDeadMapCondAlg() = default; - - virtual StatusCode initialize() override; - virtual StatusCode execute() override; - virtual StatusCode finalize() override; - - private: - SG::ReadCondHandleKey<CondAttrListCollection> m_readKey{this, "ReadKey", "/PIXEL/PixMapOverlay", "Input key of deadmap conditions folder"}; - SG::WriteCondHandleKey<PixelModuleData> m_writeKey{this, "WriteKey", "PixelModuleData", "Output key of pixel module data"}; - - ServiceHandle<ICondSvc> m_condSvc; -}; - -#endif // PIXELDEADMAPCONDALG diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelOfflineCalibCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelOfflineCalibCondAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..51a31fbc3fbd87ee8c3e5d32fccc4be230eb622a --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelOfflineCalibCondAlg.cxx @@ -0,0 +1,163 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelOfflineCalibCondAlg.h" +#include "Identifier/Identifier.h" +#include "GaudiKernel/EventIDRange.h" +#include "PathResolver/PathResolver.h" +#include <memory> +#include <sstream> + +PixelOfflineCalibCondAlg::PixelOfflineCalibCondAlg(const std::string& name, ISvcLocator* pSvcLocator): + ::AthAlgorithm(name, pSvcLocator), + m_condSvc("CondSvc", name) +{ + declareProperty("InputSource",m_inputSource=2,"Source of data: 0 (none), 1 (text file), 2 (database)"); + declareProperty("PixelClusterErrorDataFile", m_textFileName1="PixelClusterErrorData.txt","Read constants from this file"); + declareProperty("PixelClusterOnTrackErrorDataFile", m_textFileName2="PixelClusterOnTrackErrorData.txt","Read constants from this file"); + declareProperty("PixelChargeInterpolationDataFile", m_textFileName3="PixelChargeInterpolationData.txt","Read constants from this file"); + declareProperty("DumpConstants", m_dump=0, "Dump constants to text file"); +} + +StatusCode PixelOfflineCalibCondAlg::initialize() { + ATH_MSG_DEBUG("PixelOfflineCalibCondAlg::initialize()"); + + ATH_CHECK(m_condSvc.retrieve()); + + 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 PixelOfflineCalibCondAlg::execute() { + ATH_MSG_DEBUG("PixelOfflineCalibCondAlg::execute()"); + + SG::WriteCondHandle<PixelCalib::PixelOfflineCalibData> 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; + } + + // Construct the output Cond Object and fill it in + std::unique_ptr<PixelCalib::PixelOfflineCalibData> writeCdo(std::make_unique<PixelCalib::PixelOfflineCalibData>()); + + if (m_inputSource==0) { + ATH_MSG_WARNING("So far do nithing!! return StatusCode::FAILURE"); + return StatusCode::FAILURE; + } + else if (m_inputSource==1) { + ATH_MSG_INFO("read from file"); + + PixelCalib::PixelOfflineCalibData* calibData = new PixelCalib::PixelOfflineCalibData; + + PixelCalib::PixelClusterErrorData* pced = calibData->getPixelClusterErrorData(); + PixelCalib::PixelChargeInterpolationParameters* pcip = calibData->getPixelChargeInterpolationParameters(); + PixelCalib::PixelClusterOnTrackErrorData* pcoted = calibData->getPixelClusterOnTrackErrorData(); + + // Find and open the text file + ATH_MSG_INFO("Load PixelErrorData constants from text file"); + std::string file_name1 = PathResolver::find_file(m_textFileName1, "DATAPATH"); + if (file_name1.size()==0) { ATH_MSG_WARNING("Input file " << file_name1 << " not found! Default (hardwired) values to be used!"); } + else { pced->Load(file_name1); } + + ATH_MSG_INFO("Load PixelClusterOnTrackErrorData constants from text file"); + std::string file_name2 = PathResolver::find_file(m_textFileName2, "DATAPATH"); + if (file_name2.size()==0) { ATH_MSG_WARNING("Input file " << file_name2 << " not found! Default (hardwired) values to be used!"); } + else { pcoted->Load(file_name2); } + + ATH_MSG_INFO("Load PixelChargeInterpolationData constants from text file"); + std::string file_name3 = PathResolver::find_file(m_textFileName3, "DATAPATH"); + if (file_name3.size()==0) { ATH_MSG_WARNING("Input file " << file_name3 << " not found! Default (hardwired) values to be used!"); } + else { pcip->Load(file_name3); } + + // First constants are info on the number of bins of parametrizations + ATH_MSG_DEBUG("Get error constants"); + std::vector<float> constants = calibData->GetConstants(); + if (constants.size()) { ATH_MSG_VERBOSE("constants are defined"); } + else { ATH_MSG_ERROR("constants size is NULL!!!"); } + + 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}; + const EventIDRange rangeW{start, stop}; + + ATH_MSG_DEBUG("Range of input is " << rangeW); + + if (constants.size()) { + ATH_MSG_DEBUG("Found constants with new-style Identifier key"); + writeCdo->SetConstants(constants); + } + + if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { + ATH_MSG_FATAL("Could not record PixelCalib::PixelOfflineCalibData " << writeHandle.key() << " with EventRange " << rangeW << " into Conditions Store"); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store"); + + if (m_dump!=0) { + ATH_MSG_DEBUG("Dump the constants to file"); + calibData->Dump(); + } + delete calibData; + + } + else if (m_inputSource==2) { + SG::ReadCondHandle<DetCondCFloat> readHandle{m_readKey}; + const DetCondCFloat* readCdo{*readHandle}; + if (readCdo==nullptr) { + ATH_MSG_FATAL("Null pointer to the read conditions object"); + return StatusCode::FAILURE; + } + // Get the validitiy range + EventIDRange rangeW; + if (not readHandle.range(rangeW)) { + ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Size of DetCondCFloat " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size()); + ATH_MSG_DEBUG("Range of input is " << rangeW); + + std::vector<float> constants; + for (int i=0; i<readCdo->size(); i++) { constants.push_back(readCdo->get(Identifier(1),i)); } + + if (constants.size()>0) { + ATH_MSG_DEBUG("Found constants with new-style Identifier key"); + writeCdo->SetConstants(constants); + } + else { + Identifier key; + key.set_literal(1); + + std::vector<float> const2; + for (int i=0; i<readCdo->size(); i++) { const2.push_back(readCdo->get(key.set_literal(i+1),i)); } + + if (const2.size()>0) { + ATH_MSG_DEBUG("Found constants with old-style Identifier key"); + writeCdo->SetConstants(const2); + } + else { + ATH_MSG_ERROR("Could not get the constants!"); + return StatusCode::FAILURE; + } + } + if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { + ATH_MSG_FATAL("Could not record PixelCalib::PixelOfflineCalibData " << writeHandle.key() << " with EventRange " << rangeW << " into Conditions Store"); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store"); + } + + return StatusCode::SUCCESS; +} + +StatusCode PixelOfflineCalibCondAlg::finalize() { + ATH_MSG_DEBUG("PixelOfflineCalibCondAlg::finalize()"); + return StatusCode::SUCCESS; +} + diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelOfflineCalibCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelOfflineCalibCondAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..9fc7f5fdc9d87cae840a3bca7bcb2375c34e420e --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelOfflineCalibCondAlg.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELOFFLINECALIBCONDALG +#define PIXELOFFLINECALIBCONDALG + +#include "AthenaBaseComps/AthAlgorithm.h" + +#include "StoreGate/ReadCondHandleKey.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" + +#include "StoreGate/WriteCondHandleKey.h" +#include "PixelConditionsData/PixelOfflineCalibData.h" +#include "DetDescrConditions/DetCondCFloat.h" + +#include "GaudiKernel/ICondSvc.h" +#include "GaudiKernel/Property.h" + +class PixelOfflineCalibCondAlg : public AthAlgorithm { + public: + PixelOfflineCalibCondAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~PixelOfflineCalibCondAlg() = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; + + private: + int m_inputSource; + std::string m_textFileName1; + std::string m_textFileName2; + std::string m_textFileName3; + int m_dump; + + SG::ReadCondHandleKey<DetCondCFloat> m_readKey{this, "ReadKey", "/PIXEL/PixReco", "Input key of pixreco conditions folder"}; + SG::WriteCondHandleKey<PixelCalib::PixelOfflineCalibData> m_writeKey{this, "WriteKey", "PixelOfflineCalibData", "Output key of pixel module data"}; + + ServiceHandle<ICondSvc> m_condSvc; +}; + +#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx index 5e6ebf69d0ba3542e6da9a25141b9139815f3a0c..9e1b97fc60697b395c250b94a29026d93102b946 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx @@ -17,7 +17,9 @@ StatusCode PixelSiliconConditionsTestAlg::initialize() ATH_MSG_INFO("Calling initialize"); ATH_CHECK(m_siliconTool.retrieve()); - ATH_CHECK(m_condKey.initialize()); + + ATH_CHECK(m_moduleDataKey.initialize()); + return StatusCode::SUCCESS; } @@ -25,18 +27,32 @@ 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 -// for (int i=0; i<2048; i++) { -// std::cout << "Hash ID=" << IdentifierHash(i) << " Bias Voltage=" << m_siliconTool->biasVoltage(IdentifierHash(i)) << " Temperature=" << m_siliconTool->temperature(IdentifierHash(i)) << " Depletion V=" << m_siliconTool->depletionVoltage(IdentifierHash(i)) << " FSM state=" << m_siliconTool->PixelFSMState(IdentifierHash(i)) << " FSM status=" << m_siliconTool->PixelFSMStatus(IdentifierHash(i)) << " ModuleStatus=" << m_deadmapTool->ModuleStatus(IdentifierHash(i)) << " ChipStatus=" << m_deadmapTool->ChipStatus(IdentifierHash(i)) << " TDAQModuleStatus=" << m_tdaqTool->ModuleStatus(IdentifierHash(i)) << std::endl; -// } + for (int i=0; i<2048; i++) { + std::cout << "STSTST Hash ID=" << IdentifierHash(i) << " Bias Voltage=" << m_siliconTool->biasVoltage(IdentifierHash(i)) << " Temperature=" << m_siliconTool->temperature(IdentifierHash(i)) << " Depletion V=" << m_siliconTool->depletionVoltage(IdentifierHash(i)) << " FSM state=" << m_siliconTool->PixelFSMState(IdentifierHash(i)) << " FSM status=" << m_siliconTool->PixelFSMStatus(IdentifierHash(i)) << std::endl; + } for (int i=0; i<2048; i++) { - std::cout << "Hash ID=" << IdentifierHash(i) - << " ModuleStatus=" << SG::ReadCondHandle<PixelModuleData>(m_condKey)->getModuleStatus(IdentifierHash(i)) - << " ChipStatus=" << SG::ReadCondHandle<PixelModuleData>(m_condKey)->getChipStatus(IdentifierHash(i)) - << " TDAQModuleStatus=" << SG::ReadCondHandle<PixelModuleData>(m_condKey)->getTDAQModuleStatus(IdentifierHash(i)) + std::cout << "STSTST Hash ID=" << IdentifierHash(i) + << " ModuleStatus=" << SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getModuleStatus(IdentifierHash(i)) + << " ChipStatus=" << SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getChipStatus(IdentifierHash(i)) << std::endl; } +// for (int i=0; i<2048; i++) { +// std::cout << "Hash ID=" << IdentifierHash(i) << " Bias Voltage=" << m_siliconTool->biasVoltage(IdentifierHash(i)) << " Temperature=" << m_siliconTool->temperature(IdentifierHash(i)) << " Depletion V=" << m_siliconTool->depletionVoltage(IdentifierHash(i)) << " FSM state=" << m_siliconTool->PixelFSMState(IdentifierHash(i)) << " FSM status=" << m_siliconTool->PixelFSMStatus(IdentifierHash(i)) << " ModuleStatus=" << m_deadmapTool->ModuleStatus(IdentifierHash(i)) << " ChipStatus=" << m_deadmapTool->ChipStatus(IdentifierHash(i)) << " TDAQModuleStatus=" << m_tdaqTool->ModuleStatus(IdentifierHash(i)) << std::endl; +// } + +// for (int i=0; i<2048; i++) { +// std::cout << "Hash ID=" << IdentifierHash(i) +// << " ModuleStatus=" << SG::ReadCondHandle<PixelModuleData>(m_condKey)->getModuleStatus(IdentifierHash(i)) +// << " ChipStatus=" << SG::ReadCondHandle<PixelModuleData>(m_condKey)->getChipStatus(IdentifierHash(i)) +// << " TDAQModuleStatus=" << SG::ReadCondHandle<PixelModuleData>(m_condKey)->getTDAQModuleStatus(IdentifierHash(i)) +// << std::endl; +// } + + + int hitDiscConfig = SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getIBLHitDiscConfig(); + std::cout << "STSTST PixelModuleData " << hitDiscConfig << std::endl; return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h index a5f58caf969012b985ce6120e8948861f8d7b4fb..e611035f889d5bf8983558c824ac4bce390d1033 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h @@ -24,9 +24,9 @@ class PixelSiliconConditionsTestAlg : public AthAlgorithm { virtual StatusCode finalize() override; private: - ToolHandle<IPixelDCSConditionsTool> m_siliconTool{this, "PixelDCSConditionsTool", "PixelDCSConditionsTool", "Tool to retrieve Pixel information"}; + ToolHandle<IPixelDCSConditionsTool> m_siliconTool{this, "PixelDCSConditionsTool", "PixelDCSConditionsTool", "Tool to retrieve Pixel information"}; + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey{this, "PixelModuleData", "PixelModuleData", "Output key"}; - SG::ReadCondHandleKey<PixelModuleData> m_condKey{this, "PixelModuleData", "PixelModuleData", "Pixel dead map"}; }; -#endif // PIXELSILICONcONDITIONSTESTALG_H +#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx index 02ad0ffaaab3993ae6c0df84598f528a1362a59b..1cd3338be77174ac62935b31d9290823df1d8d47 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx @@ -1,15 +1,17 @@ #include "../PixelDCSCondHVAlg.h" #include "../PixelDCSCondTempAlg.h" #include "../PixelDCSCondStateAlg.h" -#include "../PixelDeadMapCondAlg.h" +#include "../PixelConfigCondAlg.h" #include "../PixelTDAQCondAlg.h" #include "../PixelSiliconConditionsTestAlg.h" #include "../SpecialPixelMapCondAlg.h" +#include "../PixelOfflineCalibCondAlg.h" DECLARE_COMPONENT( PixelDCSCondHVAlg ) DECLARE_COMPONENT( PixelDCSCondTempAlg ) DECLARE_COMPONENT( PixelDCSCondStateAlg ) -DECLARE_COMPONENT( PixelDeadMapCondAlg ) +DECLARE_COMPONENT( PixelConfigCondAlg ) DECLARE_COMPONENT( PixelTDAQCondAlg ) DECLARE_COMPONENT( PixelSiliconConditionsTestAlg ) DECLARE_COMPONENT( SpecialPixelMapCondAlg ) +DECLARE_COMPONENT( PixelOfflineCalibCondAlg ) diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeInterpolationParameters.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeInterpolationParameters.h index 0a3153f583969201fbdec789ab7f8f02adb49a7a..a54dda2253b229926bea8f121b5693f69f30610d 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeInterpolationParameters.h +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeInterpolationParameters.h @@ -86,7 +86,7 @@ class PixelChargeInterpolationParameters { const std::vector<float> getClusterSizeYBins() const{return m_csy;} void setParameters(const int ncsx, const int ncsy, const int neta, - const int nalpha, int offset, const float* constants); + const int nalpha, int offset, std::vector<float> constants); void Print(std::string filename) const; void Load(std::string filename); diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelClusterOnTrackErrorData.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelClusterOnTrackErrorData.h index b7e23c279f1a6d544c2c9893428f47b8608dc111..f40cef7ad2d89f039e99bc704ddca7a3b04a519b 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelClusterOnTrackErrorData.h +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelClusterOnTrackErrorData.h @@ -63,9 +63,8 @@ class PixelClusterOnTrackErrorData { float getPixelIBLEtaError(int ibin); float getPixelIBLPhiError(int ibin); - void setParameters(const int ncsx, const int ncsy, const int neta, const int nalpha, - int offset, const float* constants); + int offset, std::vector<float> constants); void setPixelBarrelPhiError(int ibin, double error){ m_barrelphierror[ibin] = error; } void setPixelBarrelEtaError(int ibin, double error){ diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h index 4d05cc043aae396f9e5201486cb03f22e2872402..254b4c26df06957f67d3b2601f39d6d44a55f1d0 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h @@ -23,6 +23,45 @@ class PixelModuleData { void setTDAQModuleStatus(const CondAttrListCollection::ChanNum& chanNum, const int value); int getTDAQModuleStatus(const CondAttrListCollection::ChanNum& chanNum) const; + void setBarrelAnalogThreshold(std::vector<int> BarrelAnalogThreshold); + void setEndcapAnalogThreshold(std::vector<int> EndcapAnalogThreshold); + void setDBMAnalogThreshold(std::vector<int> DBMAnalogThreshold); + int getAnalogThreshold(int bec, int layer) const; + + void setBarrelToTThreshold(std::vector<int> BarrelToTThreshold); + void setEndcapToTThreshold(std::vector<int> EndcapToTThreshold); + void setDBMToTThreshold(std::vector<int> DBMToTThreshold); + int getToTThreshold(int bec, int layer) const; + + void setBarrelLatency(std::vector<int> BarrelLatency); + void setEndcapLatency(std::vector<int> EndcapLatency); + void setDBMLatency(std::vector<int> DBMLatency); + int getLatency(int bec, int layer) const; + + void setBarrelCrossTalk(std::vector<double> BarrelCrossTalk); + void setEndcapCrossTalk(std::vector<double> EndcapCrossTalk); + void setDBMCrossTalk(std::vector<double> DBMCrossTalk); + double getCrossTalk(int bec, int layer) const; + + void setBarrelThermalNoise(std::vector<double> BarrelThermalNoise); + void setEndcapThermalNoise(std::vector<double> EndcapThermalNoise); + void setDBMThermalNoise(std::vector<double> DBMThermalNoise); + double getThermalNoise(int bec, int layer) const; + + void setBarrelHitDuplication(std::vector<bool> BarrelHitDuplication); + void setEndcapHitDuplication(std::vector<bool> EndcapHitDuplication); + void setDBMHitDuplication(std::vector<bool> DBMHitDuplication); + bool getHitDuplication(int bec, int layer) const; + + void setBarrelSmallHitToT(std::vector<int> BarrelSmallHitToT); + void setEndcapSmallHitToT(std::vector<int> EndcapSmallHitToT); + void setDBMSmallHitToT(std::vector<int> DBMSmallHitToT); + int getSmallHitToT(int bec, int layer) const; + + void setIBLHitDiscConfig(const int hitDiscConfig); + int getIBLHitDiscConfig() const; + int getIBLOverflowToT() const; + void clear(); private: @@ -30,6 +69,30 @@ class PixelModuleData { IntConditions m_moduleStatus; IntConditions m_chipStatus; IntConditions m_tdaqStatus; + + std::vector<int> m_BarrelAnalogThreshold; + std::vector<int> m_EndcapAnalogThreshold; + std::vector<int> m_DBMAnalogThreshold; + std::vector<int> m_BarrelToTThreshold; + std::vector<int> m_EndcapToTThreshold; + std::vector<int> m_DBMToTThreshold; + std::vector<int> m_BarrelLatency; + std::vector<int> m_EndcapLatency; + std::vector<int> m_DBMLatency; + std::vector<double> m_BarrelCrossTalk; + std::vector<double> m_EndcapCrossTalk; + std::vector<double> m_DBMCrossTalk; + std::vector<double> m_BarrelThermalNoise; + std::vector<double> m_EndcapThermalNoise; + std::vector<double> m_DBMThermalNoise; + std::vector<bool> m_BarrelHitDuplication; + std::vector<bool> m_EndcapHitDuplication; + std::vector<bool> m_DBMHitDuplication; + std::vector<int> m_BarrelSmallHitToT; + std::vector<int> m_EndcapSmallHitToT; + std::vector<int> m_DBMSmallHitToT; + int m_hitDiscConfig; + }; CLASS_DEF( PixelModuleData , 345932873 , 1 ) diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelOfflineCalibData.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelOfflineCalibData.h index 4425407a8f1a9106c6e4ac8eb61f31053dd35e4e..f69d4f659d435794d1ed8a6beb1053ca2529a6b2 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelOfflineCalibData.h +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelOfflineCalibData.h @@ -57,8 +57,9 @@ class PixelOfflineCalibData{ // Get/Set the numerical constants int GetNumberOfConstants() const; - float* GetConstants() const; - void SetConstants(const float* constants); + + std::vector<float> GetConstants() const; + void SetConstants(std::vector<float> constants); void Dump(); diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeInterpolationParameters.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeInterpolationParameters.cxx index 30e507cf00f67c00697b0448ebb87ce8f3899cf1..6588057ebb460e472489175a59bf8ff7091e250d 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeInterpolationParameters.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeInterpolationParameters.cxx @@ -92,7 +92,7 @@ namespace PixelCalib{ const int n3, // number of eta bins const int n4, // number of incidence angle bins int offset, // start from c[offset] - const float* c){ // vector with bin values + std::vector<float> c){ // vector with bin values m_csx.clear(); m_csy.clear(); m_etabins.clear(); @@ -103,33 +103,33 @@ namespace PixelCalib{ m_etabins.reserve(n3+1); m_phibins.reserve(n4+1); for(int i=0; i<n1+1; i++){ - m_csx.push_back(c[i+offset]); + m_csx.push_back(c.at(i+offset)); } offset += n1+1; for(int i=0; i<n2+1; i++){ - m_csy.push_back(c[i+offset]); + m_csy.push_back(c.at(i+offset)); } offset += n2+1; if(m_etaibl>0){ // IBL eta m_ibletabins.reserve(m_etaibl+1); for(int i = 0; i<m_etaibl+1; i++){ - m_ibletabins.push_back(c[i+offset]); + m_ibletabins.push_back(c.at(i+offset)); } offset +=m_etaibl+1; } if(m_alphaibl>0){ // IBL phi m_iblphibins.reserve(m_alphaibl+1); for(int i = 0; i<m_alphaibl+1; i++){ - m_iblphibins.push_back(c[i+offset]); + m_iblphibins.push_back(c.at(i+offset)); } offset +=m_alphaibl+1; } for(int i=0; i<n3+1; i++){ - m_etabins.push_back(c[i+offset]); + m_etabins.push_back(c.at(i+offset)); } offset += n3+1; for(int i=0; i<n4+1; i++){ - m_phibins.push_back(c[i+offset]); + m_phibins.push_back(c.at(i+offset)); } offset +=n4+1; diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterErrorData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterErrorData.cxx index 91bb2fd77539d1f5e9efdb7e408cbd2b298e48c1..fa6fe1c92794fc1746828d3b63ae6085519deb1b 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterErrorData.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterErrorData.cxx @@ -20,9 +20,7 @@ namespace PixelCalib{ // Load defaults - real values to be loaded from database // the number of bins is still hardwired however -void PixelClusterErrorData::Initialize(){ - - std::cout << "PixelClusterErrorData Initialize " << std::endl; +void PixelClusterErrorData::Initialize() { m_version = 1; // number of bins of parametrizations @@ -64,9 +62,6 @@ void PixelClusterErrorData::Initialize(){ m_iblphierror.push_back(14.43*CLHEP::micrometer); m_ibletaerror.push_back(72.2*CLHEP::micrometer); } - - std::cout << "done" << std::endl; - return; } @@ -111,8 +106,6 @@ float PixelClusterErrorData::getPixelIBLEtaError(int ibin) const{ return m_ibletaerror[ibin]; } -// SET METHODS - int PixelClusterErrorData::setPixelEndcapPhiError(int ibin, float error){ if(ibin<0) return 0; if(static_cast<unsigned int>(ibin)>m_endcapphierror.size()) return 0; @@ -155,11 +148,7 @@ int PixelClusterErrorData::setPixelIBLEtaError(int ibin, float error){ return 1; } - -// get bin of pixel barrel error parametrization - -int PixelClusterErrorData::getBarrelBin(double eta, int etaClusterSize, - int phiClusterSize) const{ +int PixelClusterErrorData::getBarrelBin(double eta, int etaClusterSize, int phiClusterSize) const { int ieta=0; int neta = m_etaref.size(); @@ -174,7 +163,7 @@ int PixelClusterErrorData::getBarrelBin(double eta, int etaClusterSize, return m_nZ*m_nPhi*ieta+m_nZ*iphi+iz; } -int PixelClusterErrorData::getEndcapBin(int etaClusterSize, int phiClusterSize) const{ +int PixelClusterErrorData::getEndcapBin(int etaClusterSize, int phiClusterSize) const { // std::cout << "getting bin..." << std::endl; int iphi = phiClusterSize-1; @@ -185,7 +174,6 @@ int PixelClusterErrorData::getEndcapBin(int etaClusterSize, int phiClusterSize) return m_nZ*iphi+iz; } -// save all costants to file void PixelClusterErrorData::Print(std::string file) const { std::ofstream* outfile = new std::ofstream(file.c_str()); @@ -210,8 +198,7 @@ void PixelClusterErrorData::Print(std::string file) const { delete outfile; } -// Load costants from file -void PixelClusterErrorData::Load(std::string file){ +void PixelClusterErrorData::Load(std::string file) { std::ifstream infile(file.c_str()); // number of bins for barrel and endcap diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterOnTrackErrorData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterOnTrackErrorData.cxx index a739bf9f6bda749adbdaaaecf0db721c64addd33..569e6aa6886c4f554429addb84c65a7111e9327d 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterOnTrackErrorData.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelClusterOnTrackErrorData.cxx @@ -266,7 +266,7 @@ void PixelClusterOnTrackErrorData::setParameters(const int n1, // number of clus const int n3, // number of eta bins const int n4, // number of incidence angle bins int offset, // start from c[offset] - const float* c){ // vector with bin values + std::vector<float> c){ // vector with bin values m_csx.clear(); m_csy.clear(); @@ -277,33 +277,33 @@ void PixelClusterOnTrackErrorData::setParameters(const int n1, // number of clus m_etaref.reserve(n3); m_phibins.reserve(n4); for(int i=0; i<n1; i++){ - m_csx.push_back(c[i+offset]); + m_csx.push_back(c.at(i+offset)); } offset += n1; for(int i=0; i<n2; i++){ - m_csy.push_back(c[i+offset]); + m_csy.push_back(c.at(i+offset)); } offset += n2; if(m_etabinsibl>0){ // IBL eta m_ibletaref.reserve(m_etabinsibl+1); for(int i = 0; i<m_etabinsibl+1; i++){ - m_ibletaref.push_back(c[i+offset]); + m_ibletaref.push_back(c.at(i+offset)); } offset +=m_etabinsibl+1; } if(m_phibinsibl>0){ // IBL phi m_iblphibins.reserve(m_phibinsibl+1); for(int i = 0; i<m_phibinsibl+1; i++){ - m_iblphibins.push_back(c[i+offset]); + m_iblphibins.push_back(c.at(i+offset)); } offset +=m_phibinsibl+1; } for(int i=0; i<n3; i++){ - m_etaref.push_back(c[i+offset]); + m_etaref.push_back(c.at(i+offset)); } offset += n3; for(int i=0; i<n4; i++){ - m_phibins.push_back(c[i+offset]); + m_phibins.push_back(c.at(i+offset)); } offset +=n4; int nxbinsibl = m_csxbinsibl*m_phibinsibl; diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx index 39dac026f9b482ceab957f9436319433025885c5..ff19da7355369bea198c9dbdd1ead8d750c80d4e 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx @@ -46,6 +46,99 @@ int PixelModuleData::getTDAQModuleStatus(const CondAttrListCollection::ChanNum& return 1; } +void PixelModuleData::setBarrelAnalogThreshold(std::vector<int> BarrelAnalogThreshold) { m_BarrelAnalogThreshold = BarrelAnalogThreshold; } +void PixelModuleData::setEndcapAnalogThreshold(std::vector<int> EndcapAnalogThreshold) { m_EndcapAnalogThreshold = EndcapAnalogThreshold; } +void PixelModuleData::setDBMAnalogThreshold(std::vector<int> DBMAnalogThreshold) { m_DBMAnalogThreshold = DBMAnalogThreshold; } + +int PixelModuleData::getAnalogThreshold(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); } + return analogThreshold; +} + +void PixelModuleData::setBarrelToTThreshold(std::vector<int> BarrelToTThreshold) { m_BarrelToTThreshold = BarrelToTThreshold; } +void PixelModuleData::setEndcapToTThreshold(std::vector<int> EndcapToTThreshold) { m_EndcapToTThreshold = EndcapToTThreshold; } +void PixelModuleData::setDBMToTThreshold(std::vector<int> DBMToTThreshold) { m_DBMToTThreshold = DBMToTThreshold; } + +int PixelModuleData::getToTThreshold(int bec, int layer) const { + int totThreshold = -1; + if (std::abs(bec)==0 && layer<(int)m_BarrelToTThreshold.size()) { totThreshold=m_BarrelToTThreshold.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapToTThreshold.size()) { totThreshold=m_EndcapToTThreshold.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMToTThreshold.size()) { totThreshold=m_DBMToTThreshold.at(layer); } + return totThreshold; +} + +void PixelModuleData::setBarrelLatency(std::vector<int> BarrelLatency) { m_BarrelLatency = BarrelLatency; } +void PixelModuleData::setEndcapLatency(std::vector<int> EndcapLatency) { m_EndcapLatency = EndcapLatency; } +void PixelModuleData::setDBMLatency(std::vector<int> 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<double> BarrelCrossTalk) { m_BarrelCrossTalk = BarrelCrossTalk; } +void PixelModuleData::setEndcapCrossTalk(std::vector<double> EndcapCrossTalk) { m_EndcapCrossTalk = EndcapCrossTalk; } +void PixelModuleData::setDBMCrossTalk(std::vector<double> DBMCrossTalk) { m_DBMCrossTalk = DBMCrossTalk; } + +double PixelModuleData::getCrossTalk(int bec, int layer) const { + double crossTalk = -1.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelCrossTalk.size()) { crossTalk=m_BarrelCrossTalk.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapCrossTalk.size()) { crossTalk=m_EndcapCrossTalk.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMCrossTalk.size()) { crossTalk=m_DBMCrossTalk.at(layer); } + return crossTalk; +} + +void PixelModuleData::setBarrelThermalNoise(std::vector<double> BarrelThermalNoise) { m_BarrelThermalNoise = BarrelThermalNoise; } +void PixelModuleData::setEndcapThermalNoise(std::vector<double> EndcapThermalNoise) { m_EndcapThermalNoise = EndcapThermalNoise; } +void PixelModuleData::setDBMThermalNoise(std::vector<double> DBMThermalNoise) { m_DBMThermalNoise = DBMThermalNoise; } + +double PixelModuleData::getThermalNoise(int bec, int layer) const { + double noise = -1.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelThermalNoise.size()) { noise=m_BarrelThermalNoise.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapThermalNoise.size()) { noise=m_EndcapThermalNoise.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMThermalNoise.size()) { noise=m_DBMThermalNoise.at(layer); } + return noise; +} + +void PixelModuleData::setBarrelHitDuplication(std::vector<bool> BarrelHitDuplication) { m_BarrelHitDuplication = BarrelHitDuplication; } +void PixelModuleData::setEndcapHitDuplication(std::vector<bool> EndcapHitDuplication) { m_EndcapHitDuplication = EndcapHitDuplication; } +void PixelModuleData::setDBMHitDuplication(std::vector<bool> DBMHitDuplication) { m_DBMHitDuplication = DBMHitDuplication; } + +bool PixelModuleData::getHitDuplication(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); } + return hitdupli; +} + +void PixelModuleData::setBarrelSmallHitToT(std::vector<int> BarrelSmallHitToT) { m_BarrelSmallHitToT = BarrelSmallHitToT; } +void PixelModuleData::setEndcapSmallHitToT(std::vector<int> EndcapSmallHitToT) { m_EndcapSmallHitToT = EndcapSmallHitToT; } +void PixelModuleData::setDBMSmallHitToT(std::vector<int> DBMSmallHitToT) { m_DBMSmallHitToT = DBMSmallHitToT; } + +int PixelModuleData::getSmallHitToT(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); } + return smallToT; +} + +void PixelModuleData::setIBLHitDiscConfig(const int hitDiscConfig) { m_hitDiscConfig = hitDiscConfig; } +int PixelModuleData::getIBLHitDiscConfig() const { return m_hitDiscConfig; } + +int PixelModuleData::getIBLOverflowToT() const { + static const int overflow[]={14,15,16,14,16}; + unsigned int idx=static_cast<unsigned int>(m_hitDiscConfig) < 4 ? m_hitDiscConfig : 4; + return overflow[idx]; +} + void PixelModuleData::clear() { m_moduleStatus.clear(); m_chipStatus.clear(); diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelOfflineCalibData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelOfflineCalibData.cxx index fbecafa1aaf45d24f615ee0e70e651c6420c7d9d..832c545168ee78f27c87794b46a10fe803d79240 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelOfflineCalibData.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelOfflineCalibData.cxx @@ -12,7 +12,7 @@ namespace PixelCalib{ // PixelCalibData::~PixelCalibData(){} -float* PixelOfflineCalibData::GetConstants() const { +std::vector<float> PixelOfflineCalibData::GetConstants() const { // format version of parametrizations (note it is an increasing NEGATIVE number) int v1 = m_clustererrordata->getVersion(); @@ -76,141 +76,83 @@ float* PixelOfflineCalibData::GetConstants() const { +n3a+n3b // number of ClusterErrorOnTrack values +ncsx2+1+ncsy2+1+neta2+1+nalpha2+1 // number of ChargeInterpolation bin extremes values +n4+n5; // number of ChargeInterpolation values - //std::cout << "AAA bins cluster error on track: " << ncsx << " " << ncsy << " " << neta - // << " " << nalpha << std::endl; - //std::cout << "AAA bins charge interpolation: " << ncsx2 << " " << ncsy2 << " " << neta2 - // << " " << nalpha2 << std::endl; - //std::cout << "AAA clusterError: " << 2*n1 << " + " << 2*n2 << " + " - // << ncsx+ncsy+neta+nalpha << " bins" << std::endl; - //std::cout << "AAA clusterErrorOnTrack: " << n3a << " + " << n3b << "bins" << - // std::endl; - //std::cout << "AAA charge interpolation: " << n4 << " + " << n5 << " + " - // << ncsx2+1+ncsy2+1+neta2+1+nalpha2+1 << "bins" << std::endl; - //std::cout << "AAA datasize is " << datasize << " : create vector with " - // << datasize+13 << "floats " << std::endl; + int offset = 13; if(v1<-1||v2<-1||v3<-1) { // including IBL offset +=8; datasize +=2*n1 + netaibl+1 + nalphaibl+1 + n3c +n3d + netaibl2+1 + nalphaibl2+1 + n6 + n7; } - float* constants = new float[datasize+offset]; // 13 values needed for storing the number of bins - // and version numbering - constants[0] = v1; - constants[1] = v2; - constants[2] = v3; - constants[3] = n1; - constants[4] = n2; - constants[5] = ncsx; - constants[6] = ncsy; - constants[7] = neta; - constants[8] = nalpha; - constants[9] = ncsx2; - constants[10] = ncsy2; - constants[11] = neta2; - constants[12] = nalpha2; + + std::vector<float> constants; + constants.resize(datasize+offset); + + constants.push_back(v1); + constants.push_back(v2); + constants.push_back(v3); + constants.push_back(n1); + constants.push_back(n2); + constants.push_back(ncsx); + constants.push_back(ncsy); + constants.push_back(neta); + constants.push_back(nalpha); + constants.push_back(ncsx2); + constants.push_back(ncsy2); + constants.push_back(neta2); + constants.push_back(nalpha2); if(offset>13){ - constants[13] = ncsx_ibl; - constants[14] = ncsx_ibl; - constants[15] = netaibl; - constants[16] = nalphaibl; - constants[17] = ncsx2_ibl; - constants[18] = ncsy2_ibl; - constants[19] = netaibl2; - constants[20] = nalphaibl2; + constants.push_back(ncsx_ibl); + constants.push_back(ncsx_ibl); + constants.push_back(netaibl); + constants.push_back(nalphaibl); + constants.push_back(ncsx2_ibl); + constants.push_back(ncsy2_ibl); + constants.push_back(netaibl2); + constants.push_back(nalphaibl2); } + // set bins of cluster error on track parametrization (uppermost value implicit) - for(int i=0; i<ncsx; i++){ constants[offset+i] = csx[i]; } - offset += ncsx; - for(int i=0; i<ncsy; i++){ constants[offset+i] = csy[i]; } - offset += ncsy; + for(int i=0; i<ncsx; i++){ constants.push_back(csx[i]); } + for(int i=0; i<ncsy; i++){ constants.push_back(csy[i]); } if(netaibl>0){ - for(int i=0; i<netaibl+1; i++){ constants[offset+i] = etaibl[i]; } - offset += netaibl+1; + for(int i=0; i<netaibl+1; i++){ constants.push_back(etaibl[i]); } } if(nalphaibl>0){ - for(int i=0; i<nalphaibl+1; i++){ constants[offset+i] = alphaibl[i]; } - offset += nalphaibl+1; + for(int i=0; i<nalphaibl+1; i++){ constants.push_back(alphaibl[i]); } } - for(int i=0; i<neta; i++){ constants[offset+i] = eta[i]; } - offset += neta; - for(int i=0; i<nalpha; i++){ constants[offset+i] = alpha[i]; } - offset += nalpha; - // std::cout << "offset is " << offset << std::endl; + for(int i=0; i<neta; i++){ constants.push_back(eta[i]); } + for(int i=0; i<nalpha; i++){ constants.push_back(alpha[i]); } // set bins of charge interpolation parametrization (uppermost value stored) - for(int i=0; i<ncsx2+1; i++){ constants[offset+i] = csx2[i]; } - offset += ncsx2+1; - for(int i=0; i<ncsy2+1; i++){ constants[offset+i] = csy2[i]; } - offset += ncsy2+1; + for(int i=0; i<ncsx2+1; i++){ constants.push_back(csx2[i]); } + for(int i=0; i<ncsy2+1; i++){ constants.push_back(csy2[i]); } if(netaibl2>0){ - for(int i=0; i<netaibl2+1; i++){ constants[offset+i] = etaibl2[i]; } - offset += netaibl2+1; + for(int i=0; i<netaibl2+1; i++){ constants.push_back(etaibl2[i]); } } if(nalphaibl2>0){ - for(int i=0; i<nalphaibl2+1; i++){ constants[offset+i] = alphaibl2[i]; } - offset += nalphaibl2+1; + for(int i=0; i<nalphaibl2+1; i++){ constants.push_back(alphaibl2[i]); } } - for(int i=0; i<neta2+1; i++){ constants[offset+i] = eta2[i]; } - offset += neta2+1; - for(int i=0; i<nalpha2+1; i++){ constants[offset+i] = alpha2[i]; } - offset += nalpha2+1; - //std::cout << "offset is " << offset << std::endl; + for(int i=0; i<neta2+1; i++){ constants.push_back(eta2[i]); } + for(int i=0; i<nalpha2+1; i++){ constants.push_back(alpha2[i]); } // parametrization values - for(int i=0; i<n1; i++){ - constants[offset+i] = m_clustererrordata->getPixelBarrelPhiError(i); - constants[offset+n1+i] = m_clustererrordata->getPixelBarrelEtaError(i); - } - offset += 2*n1; - for(int i=0; i<n2; i++){ - constants[offset+i] = m_clustererrordata->getPixelEndcapPhiError(i); - constants[offset+n2+i] = m_clustererrordata->getPixelEndcapRError(i); - } - offset += 2*n2; + for(int i=0; i<n1; i++){ constants.push_back(m_clustererrordata->getPixelBarrelPhiError(i)); } + for(int i=0; i<n1; i++){ constants.push_back(m_clustererrordata->getPixelBarrelEtaError(i)); } + for(int i=0; i<n2; i++){ constants.push_back(m_clustererrordata->getPixelEndcapPhiError(i)); } + for(int i=0; i<n2; i++){ constants.push_back(m_clustererrordata->getPixelEndcapRError(i)); } // IBL if(v1<-1){ - for(int i=0; i<n1; i++){ - constants[offset+i] = m_clustererrordata->getPixelIBLPhiError(i); - constants[offset+n1+i] = m_clustererrordata->getPixelIBLEtaError(i); - } - offset += 2*n1; + for(int i=0; i<n1; i++){ constants.push_back(m_clustererrordata->getPixelIBLPhiError(i)); } + for(int i=0; i<n1; i++){ constants.push_back(m_clustererrordata->getPixelIBLEtaError(i)); } } - // - //std::cout << "offset is " << offset << std::endl; //IBL if(n3c>0){ - for(int i=0; i<n3c; i++){ - constants[offset+i] = m_clusterontrackerrordata->getPixelIBLPhiError(i); - } - offset += n3c; + for(int i=0; i<n3c; i++){ constants.push_back(m_clusterontrackerrordata->getPixelIBLPhiError(i)); } } - for(int i=0; i<n3a; i++){ - constants[offset+i] = m_clusterontrackerrordata->getPixelBarrelPhiError(i); - } - offset += n3a; + for(int i=0; i<n3a; i++){ constants.push_back(m_clusterontrackerrordata->getPixelBarrelPhiError(i)); } if(n3d>0){ - for(int i=0; i<n3d; i++){ - constants[offset+i] = m_clusterontrackerrordata->getPixelIBLEtaError(i); - } - offset += n3d; - } - for(int i=0; i<n3b; i++){ - constants[offset+i] = m_clusterontrackerrordata->getPixelBarrelEtaError(i); - } - offset += n3b; - - // - //std::cout << "offset is " << offset << std::endl; - - for(int i=0; i<n6+n4; i++){ - constants[offset+i] = m_chargeinterpolationparameters->getDeltaX(i); - } - offset += n6+n4; - //std::cout << "offset is " << offset << ", " << n5 << "values to go" << std::endl; - for(int i=0; i<n7+n5; i++){ - constants[offset+i] = m_chargeinterpolationparameters->getDeltaY(i); + for(int i=0; i<n3d; i++){ constants.push_back(m_clusterontrackerrordata->getPixelIBLEtaError(i)); } } - offset +=n7+n5; - // - //std::cout << "return constants" << std::endl; + for(int i=0; i<n3b; i++){ constants.push_back(m_clusterontrackerrordata->getPixelBarrelEtaError(i)); } + for(int i=0; i<n6+n4; i++){ constants.push_back(m_chargeinterpolationparameters->getDeltaX(i)); } + for(int i=0; i<n7+n5; i++){ constants.push_back(m_chargeinterpolationparameters->getDeltaY(i)); } return constants; } @@ -220,51 +162,51 @@ void PixelOfflineCalibData::Dump(){ m_chargeinterpolationparameters->Print("PixelChargeInterpolationParametersDump.txt"); } -void PixelOfflineCalibData::SetConstants(const float* constants){ +void PixelOfflineCalibData::SetConstants(std::vector<float> constants){ - if(constants[0] > 0){ // old format + if(constants.at(0) > 0){ // old format m_clustererrordata->setVersion(0); m_clusterontrackerrordata->setVersion(0); m_chargeinterpolationparameters->setVersion(0); - const int n1 = int(constants[0]); // number of PixelClusterError barrel bins (60) - const int n2 = int(constants[1]); // number of PixelClusterError endcap bins (12) - const int ncsx = int(constants[2]); // number of PixelClusterOnTrackError cluster size bins (x direction) - const int ncsy = int(constants[3]); // number of PixelClusterOnTrackError cluster size bins (y direction) - const int neta = int(constants[4]); // number of PixelClusterOnTrackError eta bins (x direction) - const int nalpha = int(constants[5]); // number of PixelClusterOnTrackError incidence angle bins (y direction) - const int n4 = int(constants[6]); // number of charge interpolation constants (x direction) - const int n5 = int(constants[7]); // number of charge interpolation constants (y direction) + const int n1 = int(constants.at(0)); // number of PixelClusterError barrel bins (60) + const int n2 = int(constants.at(1)); // number of PixelClusterError endcap bins (12) + const int ncsx = int(constants.at(2)); // number of PixelClusterOnTrackError cluster size bins (x direction) + const int ncsy = int(constants.at(3)); // number of PixelClusterOnTrackError cluster size bins (y direction) + const int neta = int(constants.at(4)); // number of PixelClusterOnTrackError eta bins (x direction) + const int nalpha = int(constants.at(5)); // number of PixelClusterOnTrackError incidence angle bins (y direction) + const int n4 = int(constants.at(6)); // number of charge interpolation constants (x direction) + const int n5 = int(constants.at(7)); // number of charge interpolation constants (y direction) int ierr = 1; // error code int offset = 8; m_clusterontrackerrordata->setParameters(ncsx,ncsy,neta,nalpha,offset,constants); offset += ncsx+ncsy+neta+nalpha; for(int i=0; i<n1; i++){ - ierr *= m_clustererrordata->setPixelBarrelPhiError(i,constants[i+offset]); - ierr *= m_clustererrordata->setPixelBarrelEtaError(i,constants[i+n1+offset]); + ierr *= m_clustererrordata->setPixelBarrelPhiError(i,constants.at(i+offset)); + ierr *= m_clustererrordata->setPixelBarrelEtaError(i,constants.at(i+n1+offset)); } offset += 2*n1; for(int i=0; i<n2; i++){ - ierr *= m_clustererrordata->setPixelEndcapPhiError(i,constants[offset+i]); - ierr *= m_clustererrordata->setPixelEndcapRError(i,constants[offset+n2+i]); + ierr *= m_clustererrordata->setPixelEndcapPhiError(i,constants.at(offset+i)); + ierr *= m_clustererrordata->setPixelEndcapRError(i,constants.at(offset+n2+i)); } offset += 2*n2; int n3a = ncsx*nalpha; // number of barrel phi bins int n3b = ncsx*ncsy*neta; // number of barrel eta bins for(int i=0; i<n3a; i++){ - m_clusterontrackerrordata->setPixelBarrelPhiError(i,constants[offset+i]); + m_clusterontrackerrordata->setPixelBarrelPhiError(i,constants.at(offset+i)); } offset += n3a; for(int i=0; i<n3b; i++){ - m_clusterontrackerrordata->setPixelBarrelEtaError(i,constants[offset+i]); + m_clusterontrackerrordata->setPixelBarrelEtaError(i,constants.at(offset+i)); } offset += n3b; for(int i=0; i<n4; i++){ - ierr *= m_chargeinterpolationparameters->setDeltaX(i,constants[offset+i]); + ierr *= m_chargeinterpolationparameters->setDeltaX(i,constants.at(offset+i)); } offset += n4; for(int i=0; i<n5; i++){ - ierr *= m_chargeinterpolationparameters->setDeltaY(i,constants[offset+i]); + ierr *= m_chargeinterpolationparameters->setDeltaY(i,constants.at(offset+i)); } m_chargeinterpolationparameters->setVersion(-1); if(ierr == 0) std::cout << "something went wrong!" << std::endl; @@ -273,34 +215,34 @@ void PixelOfflineCalibData::SetConstants(const float* constants){ } else{ - const int v1 = int(constants[0]); // format version number for PixelClusterError - const int v2 = int(constants[1]); // format version number for PixelClusterOnTrackError - const int v3 = int(constants[2]); // format version number for PixelChargeInterpolation + const int v1 = int(constants.at(0)); // format version number for PixelClusterError + const int v2 = int(constants.at(1)); // format version number for PixelClusterOnTrackError + const int v3 = int(constants.at(2)); // format version number for PixelChargeInterpolation m_clustererrordata->setVersion(v1); m_clusterontrackerrordata->setVersion(v2); m_chargeinterpolationparameters->setVersion(v3); - const int n1 = int(constants[3]); // number of PixelClusterError barrel bins (60) - const int n2 = int(constants[4]); // number of PixelClusterError endcap bins (12) - const int ncsx = int(constants[5]); // number of PixelClusterOnTrackError cluster size bins (x direction) - const int ncsy = int(constants[6]); // number of PixelClusterOnTrackError cluster size bins (y direction) - const int neta = int(constants[7]); // number of PixelClusterOnTrackError eta bins (x direction) - const int nalpha = int(constants[8]); // number of PixelClusterOnTrackError incidence angle bins (y direction) - const int ncsx2 = int(constants[9]); // number of PixelClusterOnTrackError cluster size bins (x direction) - const int ncsy2 = int(constants[10]); // number of PixelClusterOnTrackError cluster size bins (y direction) - const int neta2 = int(constants[11]); // number of PixelClusterOnTrackError eta bins (x direction) - const int nalpha2 = int(constants[12]); // number of PixelClusterOnTrackError incidence angle bins (y direction) + const int n1 = int(constants.at(3)); // number of PixelClusterError barrel bins (60) + const int n2 = int(constants.at(4)); // number of PixelClusterError endcap bins (12) + const int ncsx = int(constants.at(5)); // number of PixelClusterOnTrackError cluster size bins (x direction) + const int ncsy = int(constants.at(6)); // number of PixelClusterOnTrackError cluster size bins (y direction) + const int neta = int(constants.at(7)); // number of PixelClusterOnTrackError eta bins (x direction) + const int nalpha = int(constants.at(8)); // number of PixelClusterOnTrackError incidence angle bins (y direction) + const int ncsx2 = int(constants.at(9)); // number of PixelClusterOnTrackError cluster size bins (x direction) + const int ncsy2 = int(constants.at(10)); // number of PixelClusterOnTrackError cluster size bins (y direction) + const int neta2 = int(constants.at(11)); // number of PixelClusterOnTrackError eta bins (x direction) + const int nalpha2 = int(constants.at(12)); // number of PixelClusterOnTrackError incidence angle bins (y direction) int ierr = 1; // error code int offset = 13; if(v1<-1||v2<-1||v3<-1)offset +=8; - const int ncsx_ibl = offset>13 ? int(constants[13]) : 0; - const int ncsy_ibl = offset>13 ? int(constants[14]) : 0; - const int netaibl = offset>13 ? int(constants[15]) : 0; - const int nalphaibl = offset>13 ? int(constants[16]) : 0; - const int ncsx2_ibl = offset>13 ? int(constants[17]) : 0; - const int ncsy2_ibl = offset>13 ? int(constants[18]) : 0; - const int netaibl2 = offset>13 ? int(constants[19]) : 0; - const int nalphaibl2 = offset>13 ? int(constants[20]) : 0; + const int ncsx_ibl = offset>13 ? int(constants.at(13)) : 0; + const int ncsy_ibl = offset>13 ? int(constants.at(14)) : 0; + const int netaibl = offset>13 ? int(constants.at(15)) : 0; + const int nalphaibl = offset>13 ? int(constants.at(16)) : 0; + const int ncsx2_ibl = offset>13 ? int(constants.at(17)) : 0; + const int ncsy2_ibl = offset>13 ? int(constants.at(18)) : 0; + const int netaibl2 = offset>13 ? int(constants.at(19)) : 0; + const int nalphaibl2 = offset>13 ? int(constants.at(20)) : 0; if(v2<-1){ m_clusterontrackerrordata->setIBLcsxbins(ncsx_ibl); m_clusterontrackerrordata->setIBLcsybins(ncsy_ibl); @@ -321,19 +263,19 @@ void PixelOfflineCalibData::SetConstants(const float* constants){ offset += (ncsx2+1)+(ncsy2+1)+(neta2+1)+(nalpha2+1); if(v3<-1) offset += (netaibl2+1) + (nalphaibl2+1); for(int i=0; i<n1; i++){ - ierr *= m_clustererrordata->setPixelBarrelPhiError(i,constants[i+offset]); - ierr *= m_clustererrordata->setPixelBarrelEtaError(i,constants[i+n1+offset]); + ierr *= m_clustererrordata->setPixelBarrelPhiError(i,constants.at(i+offset)); + ierr *= m_clustererrordata->setPixelBarrelEtaError(i,constants.at(i+n1+offset)); } offset += 2*n1; for(int i=0; i<n2; i++){ - ierr *= m_clustererrordata->setPixelEndcapPhiError(i,constants[offset+i]); - ierr *= m_clustererrordata->setPixelEndcapRError(i,constants[offset+n2+i]); + ierr *= m_clustererrordata->setPixelEndcapPhiError(i,constants.at(offset+i)); + ierr *= m_clustererrordata->setPixelEndcapRError(i,constants.at(offset+n2+i)); } offset += 2*n2; if(v1<-1){ for(int i=0; i<n1; i++){ - ierr *= m_clustererrordata->setPixelIBLPhiError(i,constants[i+offset]); - ierr *= m_clustererrordata->setPixelIBLEtaError(i,constants[i+n1+offset]); + ierr *= m_clustererrordata->setPixelIBLPhiError(i,constants.at(i+offset)); + ierr *= m_clustererrordata->setPixelIBLEtaError(i,constants.at(i+n1+offset)); } offset +=2*n1; } @@ -343,24 +285,24 @@ void PixelOfflineCalibData::SetConstants(const float* constants){ int n3d = ncsy_ibl*netaibl; if(n3c>0){ for(int i=0; i<n3c; i++){ - m_clusterontrackerrordata->setPixelIBLPhiError(i,constants[offset+i]); + m_clusterontrackerrordata->setPixelIBLPhiError(i,constants.at(offset+i)); } offset += n3c; } for(int i=0; i<n3a; i++){ - m_clusterontrackerrordata->setPixelBarrelPhiError(i,constants[offset+i]); + m_clusterontrackerrordata->setPixelBarrelPhiError(i,constants.at(offset+i)); } offset += n3a; if(n3d>0){ for(int i=0; i<n3d; i++){ - m_clusterontrackerrordata->setPixelIBLEtaError(i,constants[offset+i]); + m_clusterontrackerrordata->setPixelIBLEtaError(i,constants.at(offset+i)); } offset += n3d; } for(int i=0; i<n3b; i++){ - m_clusterontrackerrordata->setPixelBarrelEtaError(i,constants[offset+i]); + m_clusterontrackerrordata->setPixelBarrelEtaError(i,constants.at(offset+i)); } offset += n3b; const int n4 = 6*ncsx2*nalpha2; // number of charge interpolation constants (x direction) @@ -369,14 +311,14 @@ void PixelOfflineCalibData::SetConstants(const float* constants){ const int n7 = ncsy2_ibl*netaibl2; for(int i=0; i<n6+n4; i++){ - ierr *= m_chargeinterpolationparameters->setDeltaX(i,constants[offset+i]); + ierr *= m_chargeinterpolationparameters->setDeltaX(i,constants.at(offset+i)); } offset += n6+n4; for(int i=0; i<n7+n5; i++){ - ierr *= m_chargeinterpolationparameters->setDeltaY(i,constants[offset+i]); + ierr *= m_chargeinterpolationparameters->setDeltaY(i,constants.at(offset+i)); } offset += n7+n5; - + if(ierr == 0) std::cout << "something went wrong!" << std::endl; return; } diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelOfflineCalibSvc.h b/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelOfflineCalibSvc.h deleted file mode 100644 index 6ac17fc802708ff9a1f15c94decaad280265c50d..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelOfflineCalibSvc.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelCalibSvc.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef PIXELOFFLINECALIBSVC_IPIXELCALIBSVC_H -#define PIXELOFFLINECALIBSVC_IPIXELCALIBSVC_H - -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/IInterface.h" -#include "GaudiKernel/ToolHandle.h" - -class StoreGateSvc; -class Identifier; - -namespace PixelCalib{ - class PixelOfflineCalibData; -} -class PixelRecoDbTool; - -const InterfaceID IID_IPixelOfflineCalibSvc("IPixelOfflineCalibSvc", 1, 0); - - - /** @class PixelOfflineCalibSvc - - The PixelOfflineCalibSvc provides a set of services to access pixel - calibration data objects in the detector store. - The creation of pixel calibration data is handled by PixelOfflineCalibDbTool - via a callback function from the cool database. - - @author Tommaso Lari <TLARI@MI.INFN.IT> - */ - -class IPixelOfflineCalibSvc : virtual public IInterface -{ - public: - - /** default destructor */ - virtual ~IPixelOfflineCalibSvc (){}; - - static const InterfaceID& interfaceID() { - return IID_IPixelOfflineCalibSvc;} - virtual StatusCode queryInterface(const InterfaceID& riid, - void** ppvIF)=0; - - //virtual StatusCode readPixelCalibDBtoTextFile(std::string file) const =0; - - /** Pixel errors as a function of pseudorapidity and cluster sizes */ - virtual double getBarrelErrorPhi(double eta, int etasize, int phisize) const =0; - //<! get barrel error along phi - virtual double getBarrelErrorEta(double eta, int etasize, int phisize) const =0; - //<<! get barrel error along eta - virtual double getEndCapErrorPhi(int etasize, int phisize) const =0; - //<! get endcap error along phi - virtual double getEndCapErrorEta(int etasize, int phisize) const =0; - //<! get endcap error along R - - virtual bool includesIBLParams() const =0; - /** IBL errors as a function of pseudorapidity and cluster sizes */ - virtual double getIBLErrorPhi(double eta, int etasize, int phisize) const =0; - //<! get barrel error along phi - virtual double getIBLErrorEta(double eta, int etasize, int phisize) const =0; - //<<! get barrel error along eta - - /** Pixel errors as a function of track angle and cluster size */ - virtual double getBarrelNewErrorPhi(double ang, int phisize)=0; - virtual double getBarrelNewErrorEta(double eta, int phisize, int etasize)=0; - /** IBL errors as a function of track angle and cluster size */ - virtual double getIBLNewErrorPhi(double ang, int phisize)=0; - virtual double getIBLNewErrorEta(double eta, int etasize)=0; - - /** Normalization of the charge interpolation correction */ - virtual double getBarrelDeltaX(int nrows, float angle) const =0; - virtual double getBarrelDeltaY(int ncol, float eta) const =0; - /** IBL Normalization of the charge interpolation correction */ - virtual double getIBLDeltaX(int nrows, float angle) const =0; - virtual double getIBLDeltaY(int ncol, float eta) const =0; - - virtual double getEndcapDeltaX() const =0; - virtual double getEndcapDeltaY() const =0; - - virtual int getIBLToToverflow(Identifier*) const = 0; - virtual int getIBLToToverflow() const = 0; - - virtual StatusCode IOVCallBack_HDC(IOVSVC_CALLBACK_ARGS_P(I, keys)) = 0; - - }; - -#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.cxx deleted file mode 100644 index 41a6080ac5f5c05792b84918f0fc62538657a173..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.cxx +++ /dev/null @@ -1,501 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelOfflineCalibSvc.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#include "PixelOfflineCalibSvc.h" -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/Bootstrap.h" -#include "GaudiKernel/IMessageSvc.h" -#include <iostream> -#include <iomanip> -#include <sstream> -#include <algorithm> -#include "StoreGate/StoreGateSvc.h" -#include "SGTools/TransientAddress.h" -#include "StoreGate/StoreGate.h" -#include "Identifier/Identifier.h" - -#include "CLHEP/Units/SystemOfUnits.h" -#include "PixelConditionsData/PixelOfflineCalibData.h" -#include "PixelConditionsTools/IPixelRecoDbTool.h" - -#include "InDetIdentifier/PixelID.h" -#include "PixelCabling/IPixelCablingSvc.h" -#include "PixelGeoModel/IBLParameterSvc.h" - -// for callback -#include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "AthenaPoolUtilities/AthenaAttributeList.h" - - -//================ Constructor ================================================= - -PixelOfflineCalibSvc::PixelOfflineCalibSvc(const std::string& name, ISvcLocator* sl) - : - AthService(name, sl), - m_dbTool("PixelRecoDbTool"), - m_pat(0), - m_detStore("DetectorStore", name), - m_pixelCabling("PixelCablingSvc",name), - m_sgSvc("StoreGateSvc",name), - m_IBLParameterSvc("IBLParameterSvc",name), - m_HitDiscCnfg(2), - m_HDCfromCOOL(true), - m_pixid(0) -{ - // template for property declaration - declareProperty("StoreGateSvc" , m_sgSvc); - declareProperty("PixelRecoDbTool", m_dbTool); - declareProperty("HDCFromCOOL", m_HDCfromCOOL); - declareProperty("FEI4HitDiscConfig", m_HitDiscCnfg); -} - -//================ Destructor ================================================= - -PixelOfflineCalibSvc::~PixelOfflineCalibSvc() -{} - -//=============== queryInterface ================================================== -StatusCode PixelOfflineCalibSvc::queryInterface(const InterfaceID& riid, void** ppvIF) -{ - if( IID_IPixelOfflineCalibSvc == riid ) - { - *ppvIF = dynamic_cast < IPixelOfflineCalibSvc* > (this); - } else{ - return AthService::queryInterface(riid, ppvIF); - } - addRef(); - return StatusCode::SUCCESS; -} - -//================ Initialisation ================================================= - -StatusCode PixelOfflineCalibSvc::initialize() { - - ATH_MSG_INFO("initialize()"); - - CHECK(m_detStore.retrieve()); - - CHECK(m_sgSvc.retrieve()); - ATH_MSG_INFO("StoreGateSvc retrieved!"); - - CHECK(m_dbTool.retrieve()); - ATH_MSG_INFO("Retrieved tool " << m_dbTool.type()); - - // IBL Overflow: - if(m_HDCfromCOOL){ - CHECK(m_pixelCabling.retrieve()); - ATH_MSG_INFO("Retrieved service " << m_pixelCabling); - - CHECK(m_detStore->retrieve(m_pixid,"PixelID")); - ATH_MSG_INFO("Retrieved Pixel ID helper"); - - CHECK(m_IBLParameterSvc.retrieve()); - ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); - - // Read HitDiscCnfg from COOL: - // Need to do a callback to get updated values from PixelCabling - if (m_IBLParameterSvc->containsIBL()) { // Run-1 protection - std::string keyHDC = "/PIXEL/HitDiscCnfg"; - const DataHandle<AthenaAttributeList> attrlist_hdc; - if (m_detStore->contains<AthenaAttributeList>(keyHDC)) { - CHECK(m_detStore->regFcn(&IPixelOfflineCalibSvc::IOVCallBack_HDC,dynamic_cast<IPixelOfflineCalibSvc*>(this),attrlist_hdc,keyHDC)); - } - } - } - - return StatusCode::SUCCESS; -} - -//================ Finalisation ================================================= - -StatusCode PixelOfflineCalibSvc::finalize() { - ATH_MSG_INFO(" PixelOfflineCalibSvc Finalizing "); - return StatusCode::SUCCESS; -} - - -// getBarrelPhiError -double PixelOfflineCalibSvc::getBarrelErrorPhi(double eta, int etasize, int phisize) const { - if(msgLvl(MSG::VERBOSE)) msg() << "get barrel error phi" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - int ibin = m_pat->getPixelClusterErrorData()->getBarrelBin(eta, etasize, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "for bin " << ibin << endmsg; - return m_pat->getPixelClusterErrorData()->getPixelBarrelPhiError(ibin); -} - -// getBarrelEtaError -double PixelOfflineCalibSvc::getBarrelErrorEta(double eta, int etasize, int phisize) const { - if(msgLvl(MSG::VERBOSE)) msg() << "get barrel error eta" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - if(msgLvl(MSG::ERROR)) msg() << "PixelOfflineCalib pointer undefined!" - << endmsg; - if(msgLvl(MSG::ERROR)) msg() << "returning 400 um/sqrt(12.)" << endmsg; - return 115.5*CLHEP::micrometer; - } - if(!m_pat->getPixelClusterErrorData()){ - if(msgLvl(MSG::ERROR)){ - msg() << "PixelClusterErrorData pointer undefined!" << endmsg; - msg() << "returning 400 um/sqrt(12.)" << endmsg; - } - return 115.5*CLHEP::micrometer; - } - int ibin = m_pat->getPixelClusterErrorData()->getBarrelBin(eta, etasize, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "for bin " << ibin << endmsg; - return m_pat->getPixelClusterErrorData()->getPixelBarrelEtaError(ibin); -} - -// IBL -// getIBLPhiError -double PixelOfflineCalibSvc::getIBLErrorPhi(double eta, int etasize, int phisize) const { - if(msgLvl(MSG::VERBOSE)) msg() << "get IBL error phi" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - if(msgLvl(MSG::ERROR)) msg() << "PixelOfflineCalib pointer undefined!" - << endmsg; - if(msgLvl(MSG::ERROR)) msg() << "returning 50 um/sqrt(12.)" << endmsg; - return 14.43*CLHEP::micrometer; - } - int v1 = m_pat->getPixelClusterErrorData()->getVersion(); - if(v1<-1){ - int ibin = m_pat->getPixelClusterErrorData()->getBarrelBin(eta, etasize, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "for bin " << ibin << endmsg; - return m_pat->getPixelClusterErrorData()->getPixelIBLPhiError(ibin); - } - else{ - if(msgLvl(MSG::ERROR)) msg() << "PixelOfflineCalib getPixelClusterErrorData() getPixelIBLPhiError undefined for IBL! " << v1<< endmsg; - if(msgLvl(MSG::ERROR)) msg() << "returning 50 um/sqrt(12.)" << endmsg; - return 14.43*CLHEP::micrometer; - } -} - -// getIBLEtaError -double PixelOfflineCalibSvc::getIBLErrorEta(double eta, int etasize, int phisize) const { - if(msgLvl(MSG::VERBOSE)) msg() << "get IBL error eta" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - if(msgLvl(MSG::ERROR)) msg() << "PixelOfflineCalib pointer undefined!" - << endmsg; - if(msgLvl(MSG::ERROR)) msg() << "returning 250 um/sqrt(12.)" << endmsg; - return 72.2*CLHEP::micrometer; - } - if(!m_pat->getPixelClusterErrorData()){ - if(msgLvl(MSG::ERROR)){ - msg() << "PixelClusterErrorData pointer undefined!" << endmsg; - msg() << "returning 250 um/sqrt(12.)" << endmsg; - } - return 72.2*CLHEP::micrometer; - } - int v1 = m_pat->getPixelClusterErrorData()->getVersion(); - if(v1<-1){ - int ibin = m_pat->getPixelClusterErrorData()->getBarrelBin(fabs(eta), etasize, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "for bin " << ibin << endmsg; - return m_pat->getPixelClusterErrorData()->getPixelIBLEtaError(ibin); - } - else{ - if(msgLvl(MSG::ERROR)) msg() << "PixelOfflineCalib getPixelClusterErrorData() getPixelIBLEtaError undefined for IBL! " <<v1<< endmsg; - if(msgLvl(MSG::ERROR)) msg() << "returning 250 um/sqrt(12.)" << endmsg; - return 72.2*CLHEP::micrometer; - } -} -// - -// getEndcapPhiError -double PixelOfflineCalibSvc::getEndCapErrorPhi(int etasize, int phisize) const { - if(msgLvl(MSG::VERBOSE)) msg() << "get endcap error phi" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - if(msgLvl(MSG::ERROR)){ - msg() << "PixelOfflineCalib pointer undefined!" << endmsg; - msg() << "returning 50 um/sqrt(12.)" << endmsg; - } - return 14.43*CLHEP::micrometer; - } - if(!m_pat->getPixelClusterErrorData()){ - if(msgLvl(MSG::ERROR)){ - msg() << "PixelClusterErrorData pointer undefined!" << endmsg; - msg() << "returning 50 um/sqrt(12.)" << endmsg; - } - return 14.43*CLHEP::micrometer; - } - int ibin = m_pat->getPixelClusterErrorData()->getEndcapBin(etasize, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "for bin " << ibin << endmsg; - return m_pat->getPixelClusterErrorData()->getPixelEndcapPhiError(ibin); -} - -// getEndcapEtaError -double PixelOfflineCalibSvc::getEndCapErrorEta(int etasize, int phisize) const { - if(msgLvl(MSG::VERBOSE)) msg() << "get endcap error eta" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - int ibin = m_pat->getPixelClusterErrorData()->getEndcapBin(etasize, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "for bin " << ibin << endmsg; - return m_pat->getPixelClusterErrorData()->getPixelEndcapRError(ibin); -} - -// getBarrelPhiError -double PixelOfflineCalibSvc::getBarrelNewErrorPhi(double ang, int phisize) { - if(msgLvl(MSG::VERBOSE)) msg() << "get barrel new error phi" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - int ibin = m_pat->getPixelClusterOnTrackErrorData()->getBarrelBinPhi(ang, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "bin value is" << ibin << endmsg; - double error = m_pat->getPixelClusterOnTrackErrorData()->getPixelBarrelPhiError(ibin); - if(error < 0){ - if(msgLvl(MSG::ERROR)){ - msg() << "Something wrong, error is" << error << endmsg; - msg() << "returning 50 um/sqrt(12.)" << endmsg; - } - return 14.4*CLHEP::micrometer; - } - else{ - if(msgLvl(MSG::VERBOSE)) msg() << "error is" << error << endmsg; - } - return error; -} - -// getBarrelEtaError -double PixelOfflineCalibSvc::getBarrelNewErrorEta(double eta, int phisize, int etasize) { - if(msgLvl(MSG::VERBOSE)) msg() << "get barrel new error eta " << endmsg; - m_pat = m_dbTool->getCalibPtr(); - int ibin = m_pat->getPixelClusterOnTrackErrorData()->getBarrelBinEta(eta, etasize, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "for bin " << ibin << endmsg; - double error = m_pat->getPixelClusterOnTrackErrorData()->getPixelBarrelEtaError(ibin); - if(error < 0){ - if(msgLvl(MSG::ERROR)){ - msg() << "Something wrong, error is" << error << endmsg; - msg() << "returning 400 um/sqrt(12.)" << endmsg; - } - return 115.5*CLHEP::micrometer; - } - else{ - if(msgLvl(MSG::VERBOSE)) msg() << "error is" << error << endmsg; - } - return error; -} -// IBL -// getIBLPhiError -double PixelOfflineCalibSvc::getIBLNewErrorPhi(double ang, int phisize) { - if(msgLvl(MSG::VERBOSE)) msg() << "get IBL new error phi" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - int v2 = m_pat->getPixelClusterOnTrackErrorData()->getVersion(); - if(v2<-1){ - int ibin = m_pat->getPixelClusterOnTrackErrorData()->getIBLBinPhi(ang, phisize); - if(msgLvl(MSG::VERBOSE)) msg() << "bin value is" << ibin << endmsg; - double error = m_pat->getPixelClusterOnTrackErrorData()->getPixelIBLPhiError(ibin); - if(error < 0){ - if(msgLvl(MSG::ERROR)){ - msg() << "Something wrong, error is" << error << endmsg; - msg() << "returning 50 um/sqrt(12.)" << endmsg; - } - return 14.4*CLHEP::micrometer; - } - else{ - if(msgLvl(MSG::VERBOSE)) msg() << "error is" << error << endmsg; - return error; - } - } - else{ - if(msgLvl(MSG::ERROR)) msg() << "PixelOfflineCalib getPixelClusterOnTrackErrorData() getPixelIBLPhiError undefined !" << endmsg; - if(msgLvl(MSG::ERROR)) msg() << "returning 50 um/sqrt(12.)" << endmsg; - return 14.4*CLHEP::micrometer; - } -} - -// getIBLEtaError -double PixelOfflineCalibSvc::getIBLNewErrorEta(double eta, int etasize) { - if(msgLvl(MSG::VERBOSE)) msg() << "get barrel new error eta " << endmsg; - m_pat = m_dbTool->getCalibPtr(); - int v2 = m_pat->getPixelClusterOnTrackErrorData()->getVersion(); - if(v2<-1){ - int ibin = m_pat->getPixelClusterOnTrackErrorData()->getIBLBinEta(fabs(eta), etasize); - if(msgLvl(MSG::VERBOSE)) msg() << "for bin " << ibin << endmsg; - double error = m_pat->getPixelClusterOnTrackErrorData()->getPixelIBLEtaError(ibin); - if(error < 0){ - if(msgLvl(MSG::ERROR)){ - msg() << "Something wrong, error is" << error << endmsg; - msg() << "returning 250 um/sqrt(12.)" << endmsg; - } - return 72.2*CLHEP::micrometer; - } - else{ - if(msgLvl(MSG::VERBOSE)) msg() << "error is" << error << endmsg; - return error; - } - } - else{ - if(msgLvl(MSG::ERROR)) msg() << "PixelOfflineCalib getPixelClusterOnTrackErrorData() getPixelIBLEtaError undefined !" << v2<<endmsg; - if(msgLvl(MSG::ERROR)) msg() << "returning 250 um/sqrt(12.)" << endmsg; - return 72.2*CLHEP::micrometer; - } -} - -// -// getBarrel charge interpolation normalization -double PixelOfflineCalibSvc::getBarrelDeltaX(int nrows, float angle) const { - ATH_MSG_VERBOSE ( "get barrel deltax" ); - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - ATH_MSG_WARNING ( "No tool!" ); - return 0; - } - if(m_pat->getPixelChargeInterpolationParameters() == 0){ - ATH_MSG_WARNING ( "No charge interpolation!" ); - return 0; - } - ATH_MSG_VERBOSE ( "Barrel deltax = " << m_pat->getPixelChargeInterpolationParameters()->getDeltaXbarrel(nrows, angle, 1) ); - return m_pat->getPixelChargeInterpolationParameters()->getDeltaXbarrel( - nrows, angle, 1); -} - -double PixelOfflineCalibSvc::getBarrelDeltaY(int ncol, float eta) const { - if(msgLvl(MSG::VERBOSE)) msg() << "get barrel deltay" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - if(msgLvl(MSG::WARNING)) msg() << "No tool!" << std::endl; - return 0; - } - if(m_pat->getPixelChargeInterpolationParameters() == 0){ - if(msgLvl(MSG::WARNING)) msg() << "No charge interpolation!" << endmsg; - return 0; - } - return m_pat->getPixelChargeInterpolationParameters()->getDeltaYbarrel( - ncol, eta, 1); -} - -bool PixelOfflineCalibSvc::includesIBLParams() const { - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - ATH_MSG_WARNING ( "No tool!" ); - return false; - } - if(m_pat->getPixelChargeInterpolationParameters() == 0){ - ATH_MSG_WARNING ( "No charge interpolation!" ); - return false; - } - return m_pat->getPixelChargeInterpolationParameters()->getVersion()<-1; -} - -// -// getIBL charge interpolation normalization -double PixelOfflineCalibSvc::getIBLDeltaX(int nrows, float angle) const { - ATH_MSG_VERBOSE ( "get barrel deltax" ); - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - ATH_MSG_WARNING ( "No tool!" ); - return 0; - } - if(m_pat->getPixelChargeInterpolationParameters() == 0){ - ATH_MSG_WARNING ( "No charge interpolation!" ); - return 0; - } - ATH_MSG_VERBOSE ( "Barrel deltax = " << m_pat->getPixelChargeInterpolationParameters()->getDeltaXbarrel(nrows, angle, 0) ); - return m_pat->getPixelChargeInterpolationParameters()->getDeltaXbarrel( - nrows, angle, 0); -} - -double PixelOfflineCalibSvc::getIBLDeltaY(int ncol, float eta) const { - if(msgLvl(MSG::VERBOSE)) msg() << "get barrel deltay" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - if(msgLvl(MSG::WARNING)) msg() << "No tool!" << std::endl; - return 0; - } - if(m_pat->getPixelChargeInterpolationParameters() == 0){ - if(msgLvl(MSG::WARNING)) msg() << "No charge interpolation!" << endmsg; - return 0; - } - return m_pat->getPixelChargeInterpolationParameters()->getDeltaYbarrel( - ncol, fabs(eta), 0); -} - - -double PixelOfflineCalibSvc::getEndcapDeltaX() const { - if(msgLvl(MSG::VERBOSE)) msg() << "get endcap deltax" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - if(msgLvl(MSG::WARNING)) msg() << "No tool!" << std::endl; - return 0; - } - if(m_pat->getPixelChargeInterpolationParameters() == 0){ - if(msgLvl(MSG::WARNING)) msg() << "No charge interpolation!" << endmsg; - return 0; - } - return m_pat->getPixelChargeInterpolationParameters()->getDeltaXendcap(); -} - -double PixelOfflineCalibSvc::getEndcapDeltaY() const { - if(msgLvl(MSG::VERBOSE)) msg() << "get endcap deltay" << endmsg; - m_pat = m_dbTool->getCalibPtr(); - if(!m_pat){ - if(msgLvl(MSG::WARNING)) msg() << "No tool!" << std::endl; - return 0; - } - if(m_pat->getPixelChargeInterpolationParameters() == 0){ - if(msgLvl(MSG::WARNING)) msg() << "No charge interpolation!" << endmsg; - return 0; - } - return m_pat->getPixelChargeInterpolationParameters()->getDeltaYendcap(); -} - -int PixelOfflineCalibSvc::getIBLToToverflow() const { - int overflow = 16; - if( m_HitDiscCnfg == 0 ) overflow = 14; - if( m_HitDiscCnfg == 1 ) overflow = 15; - if( m_HitDiscCnfg == 2 ) overflow = 16; - if( m_HitDiscCnfg == 3 ) overflow = 14; - if( m_HitDiscCnfg > 3 )msg(MSG::FATAL) << " IBL FE-I4 chips have non physical values for HitDiscCnfg" << endmsg; - return overflow; -} - -int PixelOfflineCalibSvc::getIBLToToverflow(Identifier*) const -{ - // The version with pixel identifier is the same as without identifier. In case it is needed in the future, it should be recoded. - - int overflow = 16; - if( m_HitDiscCnfg == 0 ) overflow = 14; - if( m_HitDiscCnfg == 1 ) overflow = 15; - if( m_HitDiscCnfg == 2 ) overflow = 16; - if( m_HitDiscCnfg == 3 ) overflow = 14; - if( m_HitDiscCnfg > 3 )msg(MSG::FATAL) << " IBL FE-I4 chips have non physical values for HitDiscCnfg" << endmsg; - return overflow; -} - -void PixelOfflineCalibSvc::readHDC() { - - int nchip = 0; - std::vector<int> HDCOccurence(5,0); - for( int phi_index = 0; phi_index < 14; phi_index++ ){ - for( int eta_index = -10; eta_index < 10; eta_index++ ){ - Identifier thiswafer = m_pixid->wafer_id(0,0,phi_index,eta_index); - uint32_t maxFE = 2; - if( eta_index < -6 || eta_index > 5 )maxFE = 1; - for( uint32_t FE_index = 0; FE_index < maxFE; FE_index++ ){ - Identifier FirstPix = m_pixelCabling->getPixelId(thiswafer,FE_index,1,1); - int HitDiscCnfg = m_pixelCabling->getHitDiscCnfg(&FirstPix); - nchip++; - if ( HitDiscCnfg > 3 ) HitDiscCnfg = 4; - HDCOccurence[HitDiscCnfg]++; - } - } - } - - // If there is no common HDC value (i.e. less than 4 ouf of 5 elements in HDCOccurence are 0), issue a warning - if (std::count(HDCOccurence.begin(), HDCOccurence.end(), 0) < 4) ATH_MSG_WARNING(" IBL FE-I4 chips have different values of HitDiscCnfg"); - - // Now get the index for the the most frequent value - m_HitDiscCnfg = std::distance(HDCOccurence.begin(), std::max_element(HDCOccurence.begin(),HDCOccurence.end())); - - msg(MSG::INFO) << " m_HitDiscCnfg = " << m_HitDiscCnfg << endmsg; - -} - -// Callback to get HitDiscCnfg values from COOL -StatusCode PixelOfflineCalibSvc::IOVCallBack_HDC(IOVSVC_CALLBACK_ARGS_P(I, keys)) { - ATH_MSG_INFO("Callback for key " << keys << " (number " << I << ")"); - readHDC(); - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.h b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.h deleted file mode 100644 index 8687463431ca6d66c743761af67a6d74c21f7b9d..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelOfflineCalibSvc.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelCalibSvc.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef PIXELOFFLINECALIBSVC_PIXELCALIBSVC_H -#define PIXELOFFLINECALIBSVC_PIXELCALIBSVC_H - -#include "GaudiKernel/ServiceHandle.h" -#include "AthenaBaseComps/AthService.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" -#include "GaudiKernel/ToolHandle.h" - -class StoreGateSvc; -class Identifier; -class IPixelCablingSvc; -class PixelID; -class IBLParameterSvc; - -namespace PixelCalib{ - class PixelOfflineCalibData; -} -class IPixelRecoDbTool; - -// const InterfaceID IID_PixelOfflineCalibSvc("PixelOfflineCalibSvc", 1, 0); - - - /** @class PixelOfflineCalibSvc - - The PixelOfflineCalibSvc provides a set of services to access pixel - calibration data objects in the detector store. - The creation of pixel calibration data is handled by PixelOfflineCalibDbTool - via a callback function from the cool database. - - @author Tommaso Lari <TLARI@MI.INFN.IT> - */ - -class PixelOfflineCalibSvc : public AthService, virtual public IPixelOfflineCalibSvc -{ - public: - PixelOfflineCalibSvc(const std::string& name, ISvcLocator* sl); - - /** default destructor */ - virtual ~PixelOfflineCalibSvc (); - - //static const InterfaceID& interfaceID() { - // return IID_PixelOfflineCalibSvc;} - virtual StatusCode queryInterface(const InterfaceID& riid, - void** ppvIF); - - /** standard Athena-Algorithm method */ - virtual StatusCode initialize(); - /** standard Athena-Algorithm method */ - virtual StatusCode finalize (); - - //virtual StatusCode readPixelCalibDBtoTextFile(std::string file) const; - - /** Pixel errors as a function of pseudorapidity and cluster sizes */ - virtual double getBarrelErrorPhi(double eta, int etasize, int phisize) const; - //<! get barrel error along phi - virtual double getBarrelErrorEta(double eta, int etasize, int phisize) const; - //<<! get barrel error along eta - virtual double getEndCapErrorPhi(int etasize, int phisize) const; - //<! get endcap error along phi - virtual double getEndCapErrorEta(int etasize, int phisize) const; - //<! get endcap error along R - virtual double getIBLErrorPhi(double eta, int etasize, int phisize) const; - //<! get IBL error along phi - virtual double getIBLErrorEta(double eta, int etasize, int phisize) const; - //<<! get IBL error along eta - /** Pixel errors as a function of track angle and cluster size */ - virtual double getBarrelNewErrorPhi(double ang, int phisize); - virtual double getBarrelNewErrorEta(double eta, int phisize, int etasize); - virtual double getIBLNewErrorPhi(double ang, int phisize); - virtual double getIBLNewErrorEta(double eta, int etasize); - /** Normalization of the charge interpolation correction */ - virtual double getBarrelDeltaX(int nrows, float angle) const; // Pixel = 1 - virtual double getBarrelDeltaY(int ncol, float eta) const; - virtual bool includesIBLParams() const; - virtual double getIBLDeltaX(int nrows, float angle) const; // IBL =0 - virtual double getIBLDeltaY(int ncol, float eta) const; - virtual double getEndcapDeltaX() const; - virtual double getEndcapDeltaY() const; - - virtual int getIBLToToverflow(Identifier* PixID) const; //{return -99; /* dummy return value */} - virtual int getIBLToToverflow() const; //{return -99; /* dummy return value */} - virtual void readHDC(); - - virtual StatusCode IOVCallBack_HDC(IOVSVC_CALLBACK_ARGS_P(I, keys)); - - - private: - - ToolHandle<IPixelRecoDbTool > m_dbTool; - mutable PixelCalib::PixelOfflineCalibData* m_pat; - ServiceHandle< StoreGateSvc > m_detStore; - ServiceHandle<IPixelCablingSvc> m_pixelCabling; - ServiceHandle<StoreGateSvc> m_sgSvc; - ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; - int m_HitDiscCnfg; - bool m_HDCfromCOOL; - - const PixelID* m_pixid; - }; - -#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/components/PixelConditionsServices_entries.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/components/PixelConditionsServices_entries.cxx index 604431c7b5caa91915b3bb2b28e11e34f02b21ff..fd34bcd9819b58b0b80fed0465747833db222ef4 100644 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/components/PixelConditionsServices_entries.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/components/PixelConditionsServices_entries.cxx @@ -1,8 +1,6 @@ -#include "../PixelOfflineCalibSvc.h" #include "../PixelCalibSvc.h" #include "../PixelByteStreamErrorsSvc.h" -DECLARE_COMPONENT( PixelOfflineCalibSvc ) DECLARE_COMPONENT( PixelCalibSvc ) DECLARE_COMPONENT( PixelByteStreamErrorsSvc ) diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/PixelConditionsTools/IPixelRecoDbTool.h b/InnerDetector/InDetConditions/PixelConditionsTools/PixelConditionsTools/IPixelRecoDbTool.h deleted file mode 100644 index 4596cc05cd42347855ab39d037f1e74e877848e8..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsTools/PixelConditionsTools/IPixelRecoDbTool.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXELRECODBTOOL_IPIXELRECODBTOOL_H -#define PIXELRECODBTOOL_IPIXELRECODBTOOL_H - -// Includes for Gaudi -#include "GaudiKernel/IAlgTool.h" -#include "AthenaKernel/IOVSvcDefs.h" -#include "AthenaKernel/IAddressProvider.h" - -namespace PixelCalib -{ - class PixelOfflineCalibData; -} - -// No NameSpace selected - -/** @class IPixelRecoDbTool - - The IPixelRecoDbTool is used to create and manage the data objects holding -the calibration data required for the Pixel Offline reconstruction. - It will read the calibration data from the offline COOL database via a -callback and converts to PixelOfflineCalibData objects stored in the detector -store in Athena. It will also provide a tool to read/write a text file from/to -the COOL database. - - @author Tommaso Lari <TOMMASO.LARI@MI.INFN.IT> -*/ - -static const InterfaceID IID_IPixelRecoDbTool("IPixelRecoDbTool", 1, 0); - - -class IPixelRecoDbTool: virtual public IAlgTool, - virtual public IAddressProvider { - -public: - - - - - /** required by the IAddressProvider interface **/ - virtual StatusCode updateAddress(StoreID::type storeID, - SG::TransientAddress* tad, - const EventContext& ctx)=0; - - /** Default Destructor */ - virtual ~IPixelRecoDbTool(){}; - - /** standard Athena-Algorithm method */ - virtual StatusCode initialize()=0; - /** standard Athena-Algorithm method */ - virtual StatusCode finalize()=0; - /** access to interfaceID */ - static const InterfaceID& interfaceID(){return IID_IPixelRecoDbTool;}; - //virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvIf )=0 ; - - /** Call back function for Calibration folders from COOL database */ - virtual StatusCode IOVCallBack(IOVSVC_CALLBACK_ARGS)=0; - - //<! create PixelOfflineCalibData Objects from scratch - virtual StatusCode createPixelCalibObjects() const=0; - //<! write PixelOfflineCalibData from a text file to db - virtual StatusCode writePixelCalibTextFiletoDB() const=0; - //<! read PixelOfflineCalibData from db to a text file - virtual StatusCode readPixelCalibDBtoTextFile() const=0; - //<! print all PixelOfflineCalibData objects - virtual void printPixelOfflineCalibObjects() const=0; - - //<! get Pixel Offline Calibration Data - virtual PixelCalib::PixelOfflineCalibData* getCalibPtr() const=0; - - virtual const PixelCalib::PixelOfflineCalibData* cgetCalibPtr() const=0; - -}; - -#endif - diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py b/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py index c34787034cc730da1917e02ff6fbb623f16d78fd..f32b14808fe1b7dec097342aa2534bbafba8f725 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py @@ -84,9 +84,11 @@ class PixelConditionsSummaryToolSetup: if not (conddb.folderRequested("/PIXEL/PixMapOverlay") or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")): conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixMapOverlay","/PIXEL/PixMapOverlay", className='CondAttrListCollection') - if not hasattr(condSeq, "PixelDeadMapCondAlg"): - from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDeadMapCondAlg - condSeq += PixelDeadMapCondAlg(name="PixelDeadMapCondAlg", ReadKey=PixelDeadMapFolder) + if not hasattr(condSeq, "PixelConfigCondAlg"): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", + UseDeadMap=self.useDeadMap, + ReadDeadMapKey=PixelDeadMapFolder) if not hasattr(ToolSvc, self.toolName): from PixelConditionsTools.PixelConditionsToolsConf import PixelConditionsSummaryTool diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelRecoDbTool.cxx b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelRecoDbTool.cxx deleted file mode 100755 index b70f437a63e230843d0aa4f7ec40a8d1e3f14965..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelRecoDbTool.cxx +++ /dev/null @@ -1,342 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelRecoDbTool.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#include "PixelRecoDbTool.h" -#include "PixelConditionsData/PixelClusterErrorData.h" -#include "PixelConditionsData/PixelClusterOnTrackErrorData.h" -#include "PixelConditionsData/PixelChargeInterpolationParameters.h" -#include <iostream> -#include <iomanip> -#include <sstream> -#include "RegistrationServices/IIOVRegistrationSvc.h" -//#include "StoreGate/StoreGateSvc.h" -#include "SGTools/TransientAddress.h" -#include "CoralBase/Attribute.h" -#include "CoralBase/AttributeListSpecification.h" -#include "AthenaPoolUtilities/AthenaAttributeList.h" -#include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "AthenaKernel/IIOVDbSvc.h" -#include "DetDescrConditions/DetCondCFloat.h" -#include "PathResolver/PathResolver.h" - -// Athena includes -//#include "StoreGate/StoreGate.h" -#include "Identifier/Identifier.h" - -//#include "InDetReadoutGeometry/SiDetectorElement.h" -//#include "InDetReadoutGeometry/SiDetectorElementCollection.h" - -#include <fstream> -#include <string> - -//namespace PixelCalib -//{ - -//================ Constructor ================================================= - -PixelRecoDbTool::PixelRecoDbTool(const std::string& type, - const std::string& name, const IInterface* parent) : - AthAlgTool(type, name, parent), - m_toolsvc(nullptr), - m_IOVSvc(nullptr), - m_par_caliblocation("PixRecoKey"), - m_calibData(0), - m_calibDataKey("PixelOfflineCalibData") -{ - declareInterface< IPixelRecoDbTool >(this); - - declareProperty("InputSource",m_inputSource=2,"Source of data: 0 (none), 1 (text file), 2 (database)"); - declareProperty("PixelClusterErrorDataFile", - m_textFileName1="PixelClusterErrorData.txt","Read constants from this file"); - declareProperty("PixelClusterOnTrackErrorDataFile", - m_textFileName2="PixelClusterOnTrackErrorData.txt","Read constants from this file"); - declareProperty("PixelChargeInterpolationDataFile", - m_textFileName3="PixelChargeInterpolationData.txt","Read constants from this file"); - // declareProperty("PixelClusterErrorDataVersion", - // m_PixelClusterErrorDataVersion=1,"format version of pixel cluster error data"); - //declareProperty("PixelClusterOnTrackErrorDataVersion", - // m_PixelClusterOnTrackErrorDataVersion=1,"format version of pixel cluster on track error data"); - //declareProperty("PixelChargeInterpolationDataVersion", - // m_PixelClusterOnTrackErrorDataVersion=1,"PixelChargeInterpolationData.txt","Read constants from this file"); - - declareProperty("CalibFolder", m_par_calibfolder="/PIXEL/PixReco","Folder name. Should not be changed."); - declareProperty("CalibLocation", m_par_caliblocation); - declareProperty("DumpConstants", m_dump=0, "Dump constants to text file"); - declareProperty("CalibDataKey", m_calibDataKey); -} - -//================ Address update ============================================= -// What is this stuff ??? -StatusCode PixelRecoDbTool::updateAddress(StoreID::type, SG::TransientAddress* tad, - const EventContext& /*ctx*/) -{ - CLID clid = tad->clID(); - std::string key = tad->name(); - if(146316417 == clid && m_par_caliblocation == key) - { - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<" OK with PixelRecoDataColl "<<endmsg; - return StatusCode::SUCCESS; - } - return StatusCode::FAILURE; -} - -//================ Destructor ================================================= - -PixelRecoDbTool::~PixelRecoDbTool() -{ - delete m_calibData; -} - -//================ Initialisation ============================================= - -StatusCode PixelRecoDbTool::initialize() -{ - // Code entered here will be executed once at program start. - - //m_log.setLevel(outputLevel()); - if(msgLvl(MSG::INFO))msg(MSG::INFO) << name() << " initialize()" << endmsg; - - CHECK(service("ToolSvc",m_toolsvc)); - - // Get interface to IOVSvc - m_IOVSvc = 0; - bool CREATEIF(true); - CHECK(service("IOVSvc",m_IOVSvc,CREATEIF)); - - StatusCode sc; - switch (m_inputSource) { - case 0: // just the hardwired constants - sc = createPixelCalibObjects(); - if(sc.isFailure()&&msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Create pixel calib objects failed " << endmsg; - return StatusCode::SUCCESS; - case 1: // read the constants from text file - sc = writePixelCalibTextFiletoDB(); - if(sc.isFailure()&&msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Reading constant from text file failed " << endmsg; - return StatusCode::SUCCESS; - case 2: // read from DB - sc = m_calibDataKey.initialize(); - if(sc.isSuccess()) - ATH_MSG_DEBUG("Successfully initialized Conditions Handle Key " << m_calibDataKey.fullKey()); - else - ATH_MSG_DEBUG("Failed to initialize Conditions Handle Key " << m_calibDataKey.fullKey()); - /* - sc = registerCallBack(); - // text file fall back - if(sc.isFailure()){ - ATH_MSG_FATAL( name() << " is configured to use COOL database, but no data found."); - ATH_MSG_FATAL( "This point to a serious configuration error" ); - ATH_MSG_FATAL( "Please modify your configuration script according to the following:" ); - ATH_MSG_FATAL( "1) If you do not want to acces the conditions information, set" ); - ATH_MSG_FATAL( name() << ".InputSource = 1" ); - ATH_MSG_FATAL( "2) If you want to get proper condition information, add to the IOVDbSvc the pixel reconstruction folder:"); - ATH_MSG_FATAL( "from IOVDbSvc.CondDB import conddb" ); - ATH_MSG_FATAL( "if not conddb.folderRequested('PIXEL/PixReco'):"); - ATH_MSG_FATAL( " conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco')" ); - ATH_MSG_FATAL( "and check the conditions tag you are using." ); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - */ - } - - return sc; -} - -//================ Finalisation =============================================== - -StatusCode PixelRecoDbTool::finalize() -{ - if(msgLvl(MSG::INFO))msg(MSG::INFO) << "PixelRecoDbTool finalize method called" << endmsg; - return StatusCode::SUCCESS; -} - -//------------------------------------------------------------------------- -StatusCode PixelRecoDbTool::createPixelCalibObjects() const -{ - // Create PixelCalib objects when constants are read in from textfile - // Make sure that the objects are not read in by IOV before - - if(msgLvl(MSG::INFO))msg(MSG::INFO)<< "createPixelCalibObjects method called " <<endmsg; - // remove the existing PixelCalibDataColl objects - if(m_calibData) delete m_calibData; - m_calibData = new PixelCalib::PixelOfflineCalibData; - - if(m_calibData){ - return StatusCode::SUCCESS; - } - else{ - return StatusCode::FAILURE; - } -} - - - -//=========================================================================== - -StatusCode PixelRecoDbTool::readPixelCalibDBtoTextFile() const{ - - if(msgLvl(MSG::INFO))msg(MSG::INFO) << " read PixelCalibData to text file " << endmsg; - - // std::ofstream* outfile = new std::ofstream(file.c_str()); - - const PixelCalib::PixelOfflineCalibData* pat = cgetCalibPtr(); - PixelCalib::PixelClusterErrorData* pced = pat->getPixelClusterErrorData(); - PixelCalib::PixelChargeInterpolationParameters* pcip = pat->getPixelChargeInterpolationParameters(); - PixelCalib::PixelClusterOnTrackErrorData* pcoted = pat->getPixelClusterOnTrackErrorData(); - - pced->Print(m_textFileName1); - pcoted->Print(m_textFileName2); - pcip->Print(m_textFileName3); - - if(msgLvl(MSG::INFO))msg(MSG::INFO)<< "Written numbers to text files "<<endmsg; - return StatusCode::SUCCESS; -} - -//=========================================================================== -StatusCode PixelRecoDbTool::writePixelCalibTextFiletoDB() const{ - - // create the calib objects; if all went well, they will be filled with the constants read from text file - StatusCode sc = createPixelCalibObjects(); - if(sc.isFailure()&&msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Creation of Pixel Calib objects failed"<<endmsg; - - PixelCalib::PixelClusterErrorData* pced = m_calibData->getPixelClusterErrorData(); - PixelCalib::PixelChargeInterpolationParameters* pcip = m_calibData->getPixelChargeInterpolationParameters(); - PixelCalib::PixelClusterOnTrackErrorData* pcoted = m_calibData->getPixelClusterOnTrackErrorData(); - - // Find and open the text file - if(msgLvl(MSG::INFO))msg(MSG::INFO)<< "Load PixelErrorData constants from text file" <<endmsg; - std::string file_name1 = PathResolver::find_file (m_textFileName1, "DATAPATH"); - if (file_name1.size()==0) { - if(msgLvl(MSG::WARNING))msg(MSG::WARNING) << "Input file " << file_name1 - << " not found! Default (hardwired) values to be used!" - << endmsg; - } - else{ - pced->Load(file_name1); - } - - if(msgLvl(MSG::INFO))msg(MSG::INFO)<< "Load PixelClusterOnTrackErrorData constants from text file" <<endmsg; - std::string file_name2 = PathResolver::find_file (m_textFileName2, "DATAPATH"); - if (file_name2.size()==0) { - if(msgLvl(MSG::WARNING))msg(MSG::WARNING) << "Input file " << file_name2 - << " not found! Default (hardwired) values to be used!" - << endmsg; - } - else{ - pcoted->Load(file_name2); - } - - if(msgLvl(MSG::INFO))msg(MSG::INFO)<< "Load PixelChargeInterpolationData constants from text file" <<endmsg; - std::string file_name3 = PathResolver::find_file (m_textFileName3, "DATAPATH"); - if (file_name3.size()==0) { - if(msgLvl(MSG::WARNING))msg(MSG::WARNING) << "Input file " << file_name3 - << " not found! Default (hardwired) values to be used!" - << endmsg; - } - else{ - pcip->Load(file_name3); - } - - if(m_dump != 0){ - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "Dump the constants to file" <<endmsg; - m_calibData->Dump(); - } - // First constants are info on the number of bins of parametrizations - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "Get error constants" <<endmsg; - float* constants = m_calibData->GetConstants(); - if(constants){ - if(msgLvl(MSG::VERBOSE))msg(MSG::VERBOSE) << "constants pointer is defined" <<endmsg; - } - else{ - if(msgLvl(MSG::ERROR))msg(MSG::ERROR) << "constants pointer is NULL!!!" <<endmsg; - } - // compute the number of constants - const int v1 = lrintf(constants[0]); // format version number (pixel cluster error) - const int v2 = lrintf(constants[1]); // format version number (pixel cluster on track error) - const int v3 = lrintf(constants[2]); // format version number (pixel charge interpolation) - const int n1 = lrintf(constants[3]); // pixel cluster errors for barrel - const int n2 = lrintf(constants[4]); // pixel cluster errors for endcap - const int n3a = lrintf(constants[5]); // PixelClusterOnTrackError barrel: x cluster size bins - const int n3b = lrint(constants[6]); // PixelClusterOnTrackError barrel: y cluster size bins - const int n3c = lrint(constants[7]); // PixelClusterOnTrackError barrel: eta bins - const int n3d = lrint(constants[8]); // PixelClusterOnTrackError barrel: incidence angle bins - const int n4a = lrintf(constants[9]); // PixelClusterOnTrackError x cluster size bins - const int n4b = lrint(constants[10]); // PixelChargeInterpolation y cluster size bins - const int n4c = lrint(constants[11]); // PixelChargeInterpolation eta bins - const int n4d = lrint(constants[12]); // PixelChargeInterpolation incidence angle bins - int offset = 13; - if(v1<-1||v2<-1||v3<-1)offset +=8; - const int ncxibl = offset>13 ? lrint(constants[13]): 0; // PixelClusterOnTrackError IBL row size - const int ncyibl = offset>13 ? lrint(constants[14]): 0; // PixelClusterOnTrackError IBL column size - const int n3e = offset>13 ? lrint(constants[15]): 0; // PixelClusterOnTrackError IBL eta bins - const int n3f = offset>13 ? lrint(constants[16]): 0; // PixelClusterOnTrackError IBL phi bins - const int ncxibl2 = offset>13 ? lrint(constants[17]): 0; // PixelChargeInterpolation IBL row bins - const int ncyibl2 = offset>13 ? lrint(constants[18]): 0; // PixelChargeInterpolation IBL column bins - const int n4e = offset>13 ? lrint(constants[19]): 0; // PixelChargeInterpolation IBL eta bins - const int n4f = offset>13 ? lrint(constants[20]): 0; // PixelChargeInterpolation IBL phi bins - - if(msgLvl(MSG::VERBOSE)){ - msg(MSG::VERBOSE) << " version numbering: " - << v1 << " " << v2 << " " << v3 << endmsg; - msg(MSG::VERBOSE) - << " number of pixel cluster errors for barrel and endcap is " - << constants[3] << " " << constants[4] << endmsg; - msg(MSG::VERBOSE) - << " PixelClusterOnTrack numbers of barrel bins is " - << constants[5] << " " << constants[6] << " " - << constants[7] << " " << constants[8] << endmsg; - if(offset>13)msg(MSG::VERBOSE) - << " PixelClusterOnTrack numbers of IBL bins is " - << constants[13] << " " << constants[14] <<" " - <<constants[15]<<" "<<constants[16]<<endmsg; - msg(MSG::VERBOSE) - << " number of charge interpolation bins is " - << constants[9] << " " << constants[10] << " " - << constants[11] << " " << constants[12] << endmsg; - if(offset>13) msg(MSG::VERBOSE) << " number of charge interpolation IBL bins is " - << constants[17] << " " << constants[18] <<" " - << constants[19] << " " << constants[20] << endmsg; - } - const int N0 = 2*n1+2*n2; // number of cluster error values - const int N1a = n3a*n3d; // number of cluster on track error values (x direction) - const int N1b = n3a*n3b*n3c; // number of cluster on track error values (y direction) - const int N1c = n3a+n3b+n3c+n3d; // number of cluster on track bin values - const int N2a = 6*n4a*n4d+6*n4b*n4c; // number of charge interpolation values - const int N2b = n4a+n4b+n4c+n4d+4; // number of charge interpolation bin interval values - int datasize = N0+N1a+N1b+N1c+N2a+N2b+offset; - if(offset>13) datasize +=2*n1 + n3e+1 + n3f+1 + ncyibl*n3e + ncxibl*n3f +n4e+1 + n4f+1 + ncxibl2*n4e + ncyibl2*n4f; - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "Number of offline constants: " << datasize <<endmsg; - - // check if collection already exits - if(!detStore()->contains<DetCondCFloat>(m_par_calibfolder)) { - DetCondCFloat *const1 = new DetCondCFloat(datasize,m_par_calibfolder); - if(msgLvl(MSG::VERBOSE))msg(MSG::VERBOSE) << "Adding constants to the DetCondCFloat object " - <<endmsg; - const1->add(Identifier(1),constants); - if(msgLvl(MSG::VERBOSE))msg(MSG::VERBOSE) << "That's it. " <<endmsg; - - // check if collection already exits - //if(!detStore()->contains<DetCondCFloat>(m_par_calibfolder)) { - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< " Creating new DetCondCFloat for folder "<<m_par_calibfolder <<endmsg; - if(StatusCode::SUCCESS !=detStore()->record(const1,m_par_calibfolder)){ - if(msgLvl(MSG::ERROR))msg(MSG::ERROR) <<" Could not create DetCondCFloat "<<m_par_calibfolder - << "with offline parameters" << endmsg; - delete const1; - } - else{ - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << " Created DetCondCFloat "<<m_par_calibfolder - << " with offline parameters" << endmsg; - } - } - delete [] constants; - return StatusCode::SUCCESS; -} - -void PixelRecoDbTool::printPixelOfflineCalibObjects() const -{ } - diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelRecoDbTool.h b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelRecoDbTool.h deleted file mode 100644 index 5bf504af26bf9d339d994f0d9837e87b26204583..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelRecoDbTool.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelRecoDbTool.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef PIXELCALIBTOOL_PIXELRECODBTOOL_H -#define PIXELCALIBTOOL_PIXELRECODBTOOL_H - -// Gaudi includes -#include <vector> -#include <string> -//#include "GaudiKernel/AlgTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -//#include "GaudiKernel/MsgStream.h" -#include "AthenaBaseComps/AthAlgorithm.h" -#include "AthenaKernel/IOVSvcDefs.h" -#include "PixelConditionsData/PixelOfflineCalibData.h" -//#include "StoreGate/DataHandle.h" -#include "AthenaKernel/IAddressProvider.h" -#include "PixelConditionsTools/IPixelRecoDbTool.h" // ???? - -#include "StoreGate/ReadCondHandleKey.h" - - -class Identifier; -//class StoreGateSvc; -class IIOVRegistrationSvc; -class IAthenaOutputStreamTool; - -class IToolSvcl; -class IIOVSvc; - -static const InterfaceID IID_PixelRecoDbTool("IPixelRecoDbTool", 1, 0); - -// No NameSpace selected - -/** @class PixelRecoDbTool - - The PixelRecoDbTool is used to create and manage the data objects holding -the calibration data required for the Pixel Offline reconstruction. - It will read the calibration data from the offline COOL database via a -callback and converts to PixelOfflineCalibData objects stored in the detector -store in Athena. It will also provide a tool to read/write a text file from/to -the COOL database. - - @author Tommaso Lari <TOMMASO.LARI@MI.INFN.IT> -*/ - -//namespace PixelCalib -//{ - -class PixelRecoDbTool: public AthAlgTool, - virtual public IPixelRecoDbTool{ - -public: - - /** Standard Athena-Algorithm Constructor */ - PixelRecoDbTool(const std::string& type, const std::string& name, - const IInterface* parent); - - /** required by the IAddressProvider interface **/ - virtual StatusCode updateAddress(StoreID::type storeID,SG::TransientAddress* tad, - const EventContext& ctx); - - /** Default Destructor */ - virtual ~PixelRecoDbTool(); - - /** standard Athena-Algorithm method */ - virtual StatusCode initialize(); - /** standard Athena-Algorithm method */ - virtual StatusCode finalize(); - /** access to interfaceID */ - static const InterfaceID& interfaceID(){return IID_IPixelRecoDbTool;}; - //virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvIf ) ; - - /** Call back function for Calibration folders from COOL database */ - virtual StatusCode IOVCallBack(IOVSVC_CALLBACK_ARGS) { return StatusCode::SUCCESS; } - - //<! create PixelOfflineCalibData Objects from scratch - StatusCode createPixelCalibObjects() const; - //<! write PixelOfflineCalibData from a text file to db - StatusCode writePixelCalibTextFiletoDB() const; - //<! read PixelOfflineCalibData from db to a text file - StatusCode readPixelCalibDBtoTextFile() const; - //<! print all PixelOfflineCalibData objects - void printPixelOfflineCalibObjects() const; - - // get Pixel Offline Calibration Data - PixelCalib::PixelOfflineCalibData* getCalibPtr() const; - - const PixelCalib::PixelOfflineCalibData* cgetCalibPtr() const; - -private: - - //mutable MsgStream m_log; - //StoreGateSvc* m_sgSvc; - //StoreGateSvc* m_detStore; - IToolSvc* m_toolsvc; - IIOVSvc* m_IOVSvc; - int m_inputSource; - std::string m_par_calibfolder; - std::string m_par_caliblocation; - std::string m_textFileName1; - std::string m_textFileName2; - std::string m_textFileName3; - int m_dump; - mutable PixelCalib::PixelOfflineCalibData* m_calibData; - SG::ReadCondHandleKey<PixelCalib::PixelOfflineCalibData> m_calibDataKey; - -}; -/* inline StatusCode PixelRecoDbTool::queryInterface( */ -/* const InterfaceID& riid, void** ppvIf ) */ -/* { */ -/* if ( riid == interfaceID() ) { */ -/* *ppvIf = this; */ -/* addRef(); */ -/* return StatusCode::SUCCESS; */ -/* } */ -/* return AthAlgTool::queryInterface( riid, ppvIf ); */ -/* } */ - -inline PixelCalib::PixelOfflineCalibData* PixelRecoDbTool::getCalibPtr() const { - if(m_inputSource==2) { - // Conditions data access through Conditions Handles - SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> readHandle{m_calibDataKey}; - const PixelCalib::PixelOfflineCalibData* calibData{nullptr}; - calibData = *readHandle; - return const_cast<PixelCalib::PixelOfflineCalibData*>(calibData); - } - else { - // Old style conditions data access - if(!m_calibData) ATH_MSG_WARNING("No calibrations!"); - return m_calibData; - } -} - -inline const PixelCalib::PixelOfflineCalibData* PixelRecoDbTool::cgetCalibPtr() const { - if(m_inputSource==2) { - // Conditions data access through Conditions Handles - SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> readHandle{m_calibDataKey}; - const PixelCalib::PixelOfflineCalibData* calibData{nullptr}; - calibData = *readHandle; - return calibData; - } - else { - // Old style conditions data access - return m_calibData; - } -} - - -//} -#endif - - - - - - - diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/components/PixelConditionsTools_entries.cxx b/InnerDetector/InDetConditions/PixelConditionsTools/src/components/PixelConditionsTools_entries.cxx index 8679b3ad5ee67c9dc641b01dcf2524d7e2918441..3f6dfc62ac2d8eafeee433442e2e551a6aaff0a4 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/components/PixelConditionsTools_entries.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsTools/src/components/PixelConditionsTools_entries.cxx @@ -1,4 +1,3 @@ -#include "src/PixelRecoDbTool.h" #include "src/PixelCalibDbTool.h" #include "src/PixelDistortionsTool.h" #ifndef SIMULATIONBASE @@ -8,7 +7,6 @@ // STSTST #include "src/PixelTDAQConditionsTool.h" #endif -DECLARE_COMPONENT( PixelRecoDbTool ) DECLARE_COMPONENT( PixelCalibDbTool ) DECLARE_COMPONENT( PixelDistortionsTool ) #ifndef SIMULATIONBASE diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h index c8c767da9acfc38ab4737f945fc0d41f8391b586..649788c604a094602ef7a1335cb894dc5cddbf4b 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_disableClusterMakerOfflineCalib && paramName=="PixelOfflineCalibSvc") return ""; if (m_disableCalibCondDB && paramName=="PixelCalibSvc") return ""; } return param; @@ -98,7 +97,6 @@ private: bool m_disableCalibCondDB; bool m_disableAlignable; bool m_disableAllClusterSplitting; - bool m_disableClusterMakerOfflineCalib; bool m_disableDCS; StatusCode setIblParameters(); diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx index bbbdb51322c7e323d577aec06de1ada27ca14dce..ed70c971db141cd403ea7e0c52a829cb8030693a 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx @@ -33,7 +33,6 @@ IBLParameterSvc::IBLParameterSvc(const std::string& name,ISvcLocator* svc) m_disableCalibCondDB(false), m_disableAlignable(false), m_disableAllClusterSplitting(false), - m_disableClusterMakerOfflineCalib(false), m_disableDCS(true) { declareProperty("GeoDbTagSvc",m_geoDbTagSvc); @@ -43,7 +42,6 @@ IBLParameterSvc::IBLParameterSvc(const std::string& name,ISvcLocator* svc) declareProperty("DisableCalibCondDB",m_disableCalibCondDB); declareProperty("DisableAlignable",m_disableAlignable); declareProperty("DisableAllClusterSplitting",m_disableAllClusterSplitting); - declareProperty("DisableClusterMakerOfflineCalib",m_disableClusterMakerOfflineCalib); declareProperty("DisableDCS",m_disableDCS); } diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py b/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py index f02dad60f2551e6471f973c66c0da062417ef25a..32a4caa4f365246a192008e58f8f8d85e7c66337 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py @@ -34,7 +34,6 @@ def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): if 'doFastSCT_Digi' in digitizationFlags.experimentalDigi() and not 'doFastPixelDigi' in digitizationFlags.experimentalDigi(): kwargs.setdefault("UsePixelCalibCondDB", False) kwargs.setdefault("PixelCalibSvc",""); - kwargs.setdefault("PixelOfflineCalibSvc",""); else: from AthenaCommon.Include import include include( "PixelConditionsServices/PixelDCSSvc_jobOptions.py" ) @@ -65,10 +64,6 @@ def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): from SiPropertiesSvc.SiPropertiesSvcConf import SiPropertiesSvc; PixelSiPropertiesSvc = SiPropertiesSvc(name = "PixelSiPropertiesSvc",DetectorName="Pixel",SiConditionsServices = lorentzAngleSvc.pixelSiliconConditionsSvc) ServiceMgr += PixelSiPropertiesSvc - if not hasattr(ServiceMgr, "PixelOfflineCalibSvc"): - from PixelConditionsServices.PixelConditionsServicesConf import PixelOfflineCalibSvc - ServiceMgr +=PixelOfflineCalibSvc() - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False from AthenaCommon import CfgMgr return CfgMgr.InDet__ClusterMakerTool(name,**kwargs) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py index 867df3ace5d0b256d2e909665e8a6262a18f5c17..2207bddb943853fcf5c40b9129dba5f68c8c8d8a 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py @@ -75,7 +75,6 @@ include("Digitization/Digitization.py") from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", PixelCalibSvc = None, - PixelOfflineCalibSvc = None, UsePixelCalibCondDB = FALSE) ToolSvc += InDetClusterMakerTool diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/preInclude.FastPixelDigi_ITK.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/preInclude.FastPixelDigi_ITK.py index 5711861e7de610c66ca0fc758d0de51f6e017de1..c7d84548270e362827e7f37c2c6e67b0187a2226 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/preInclude.FastPixelDigi_ITK.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/preInclude.FastPixelDigi_ITK.py @@ -1,5 +1 @@ from AthenaCommon.AppMgr import ServiceMgr -if not hasattr(ServiceMgr, "PixelOfflineCalibSvc"): - from PixelConditionsServices.PixelConditionsServicesConf import PixelOfflineCalibSvc - ServiceMgr +=PixelOfflineCalibSvc() - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py index 1a9067738ac65069a614cf0cefc070e4bcf3d368..2028b3ec97e72144986fd8246bcf185693e39b36 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py @@ -84,7 +84,6 @@ StoreGateSvc.Dump = True #from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool #InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", # PixelCalibSvc = None, -# PixelOfflineCalibSvc = None, # UsePixelCalibCondDB = FALSE) #ToolSvc += InDetClusterMakerTool diff --git a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt index 3ad53f04fa0569b42b2a6d600e87744299c5f4b0..89114291239d7145fc35e3419036f3431563961b 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetConditions/PixelConditionsTools + InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetConditions/SiPropertiesSvc InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry diff --git a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py index 2d1abee72b0a6b61e30dc2db2c3194ec7c856be0..90cd8473c1d7cfca9fdf9f8864d12bcca385cb4a 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py @@ -103,7 +103,6 @@ def BarrelRD53SimTool(name="BarrelRD53SimTool", **kwargs): kwargs.setdefault("NoiseShape", [0.0, 1.0]) kwargs.setdefault("NoiseOccupancy", 5e-8) kwargs.setdefault("DisableProbability", 9e-3) - kwargs.setdefault("HitDiscConfig", 2) return CfgMgr.RD53SimTool(name, **kwargs) def EndcapRD53SimTool(name="EndcapRD53SimTool", **kwargs): @@ -116,48 +115,56 @@ def EndcapRD53SimTool(name="EndcapRD53SimTool", **kwargs): kwargs.setdefault("NoiseShape", [0.0, 1.0]) kwargs.setdefault("NoiseOccupancy", 5e-8) kwargs.setdefault("DisableProbability", 9e-3) - kwargs.setdefault("HitDiscConfig", 2) return CfgMgr.RD53SimTool(name, **kwargs) def BarrelFEI4SimTool(name="BarrelFEI4SimTool", **kwargs): kwargs.setdefault("BarrelEC", 0) kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc()) kwargs.setdefault("RndmEngine", "PixelDigitization") - kwargs.setdefault("Analogthreshold", [-1]) - kwargs.setdefault("ToTthreshold", [-1]) - kwargs.setdefault("CrossTalk", [0.06]) - kwargs.setdefault("ThermalNoise", [160.0]) + + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.BarrelAnalogThreshold=[-1] + PixelConfigCondAlg.BarrelToTThreshold=[-1] + PixelConfigCondAlg.BarrelCrossTalk=[0.06] + PixelConfigCondAlg.BarrelThermalNoise=[160.0] + PixelConfigCondAlg.FEI4HitDiscConfig=2 + kwargs.setdefault("NoiseShape", [0.0, 1.0]) kwargs.setdefault("NoiseOccupancy", 5e-8) kwargs.setdefault("DisableProbability", 9e-3) - kwargs.setdefault("HitDiscConfig", 2) return CfgMgr.FEI4SimTool(name, **kwargs) def DBMFEI4SimTool(name="DBMFEI4SimTool", **kwargs): kwargs.setdefault("BarrelEC", 4) kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc()) kwargs.setdefault("RndmEngine", "PixelDigitization") - kwargs.setdefault("Analogthreshold", [-1,-1,-1]) - kwargs.setdefault("ToTthreshold", [-1,-1,-1]) - kwargs.setdefault("CrossTalk", [0.06,0.06,0.06]) - kwargs.setdefault("ThermalNoise", [160.0,160.0,160.0]) + + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.DBMAnalogThreshold=[-1,-1,-1] + PixelConfigCondAlg.DBMToTThreshold=[-1,-1,-1] + PixelConfigCondAlg.DBMCrossTalk=[0.06,0.06,0.06] + PixelConfigCondAlg.DBMThermalNoise=[160.0,160.0,160.0] + PixelConfigCondAlg.FEI4HitDiscConfig=2 + kwargs.setdefault("NoiseShape", [0.0, 1.0]) kwargs.setdefault("NoiseOccupancy", 5e-8) kwargs.setdefault("DisableProbability", 9e-3) - kwargs.setdefault("HitDiscConfig", 2) return CfgMgr.FEI4SimTool(name, **kwargs) def BarrelFEI3SimTool(name="BarrelFEI3SimTool", **kwargs): kwargs.setdefault("BarrelEC", 0) kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc()) kwargs.setdefault("RndmEngine", "PixelDigitization") - kwargs.setdefault("Analogthreshold", [-1, -1, -1, -1]) # first argument is dummy - kwargs.setdefault("ToTthreshold", [-1, 5, 5, 5]) # first argument is dummy - kwargs.setdefault("Latency", [ -1, 151, 256, 256]) - kwargs.setdefault("HitDuplication", [False, False, False, False]) - kwargs.setdefault("SmallHitToT", [-1, -1, -1, -1]) - kwargs.setdefault("CrossTalk", [0.06,0.06,0.06,0.06]) - kwargs.setdefault("ThermalNoise", [160.0,160.0,160.0,160.0]) + + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.BarrelAnalogThreshold=[-1,-1,-1,-1] + PixelConfigCondAlg.BarrelToTThreshold=[-1, 5, 5, 5] + PixelConfigCondAlg.BarrelLatency=[ -1, 151, 256, 256] + PixelConfigCondAlg.BarrelCrossTalk=[0.06,0.06,0.06,0.06] + PixelConfigCondAlg.BarrelThermalNoise=[160.0,160.0,160.0,160.0] + PixelConfigCondAlg.BarrelHitDuplication=[False, False, False, False] + PixelConfigCondAlg.BarrelSmallHitToT=[-1, -1, -1, -1] + kwargs.setdefault("NoiseShape", [0.00000, 0.00596, 0.03491, 0.07058, 0.11991, 0.17971, 0.24105, 0.29884, 0.35167, 0.39912, 0.44188, 0.48016, 0.51471, 0.54587, 0.57405, 0.59958, 0.62288, 0.64411, 0.66360, 0.68159, 0.69823, 0.71362, 0.72781, 0.74096, 0.75304, 0.76415, 0.77438, 0.78383, 0.79256, 0.80066, 0.80821, 0.81547, 0.82246, 0.82918, 0.83501, 0.84054, 0.84576, 0.85078, 0.85558, 0.86018, 0.86455, 0.86875, 0.87273, 0.87653, 0.88020, 0.88369, 0.88705, 0.89027, 0.89336, 0.89633, 0.89921, 0.90195, 0.90460, 0.90714, 0.90961, 0.91198, 0.91426, 0.91644, 0.91853, 0.92055, 0.92250, 0.92435, 0.92611, 0.92782, 0.92947, 0.93105, 0.93257, 0.93404, 0.93547, 0.93688, 0.93822, 0.93953, 0.94079, 0.94201, 0.94318, 0.94432, 0.94542, 0.94649, 0.94751, 0.94851, 0.94949, 0.95045, 0.95137, 0.95227, 0.95314, 0.95399, 0.95483, 0.95563, 0.95646, 0.95729, 0.95812, 0.95896, 0.95980, 0.96063, 0.96144, 0.96224, 0.96301, 0.96377, 0.96451, 0.96521, 0.96590, 0.96657, 0.96722, 0.96787, 0.96849, 0.96911, 0.96971, 0.97031, 0.97090, 0.97148, 0.97204, 0.97260, 0.97314, 0.97367, 0.97421, 0.97474, 0.97525, 0.97576, 0.97627, 0.97676, 0.97722, 0.97769, 0.97815, 0.97861, 0.97906, 0.97950, 0.97992, 0.98033, 0.98073, 0.98111, 0.98147, 0.98182, 0.98216, 0.98249, 0.98281, 0.98312, 0.98343, 0.98374, 0.98402, 0.98430, 0.98456, 0.98482, 0.98507, 0.98532, 0.98555, 0.98579, 0.98602, 0.98624, 0.98646, 0.98668, 0.98690, 0.98711, 0.98732, 0.98753, 0.98773, 0.98793, 0.98813, 0.98832, 0.98851, 0.98870, 0.98888, 0.98907, 0.98925, 0.98943, 0.98961, 0.98979, 0.98996, 0.99014, 0.99031, 0.99048, 0.99064, 0.99081, 0.99098, 0.99114, 0.99131, 0.99147, 0.99163, 0.99179, 0.99194, 0.99210, 0.99225, 0.99240, 0.99256, 0.99271, 0.99286, 0.99300, 0.99315, 0.99329, 0.99344, 0.99358, 0.99372, 0.99386, 0.99400, 0.99414, 0.99427, 0.99440, 0.99453, 0.99466, 0.99479, 0.99491, 0.99503, 0.99515, 0.99527, 0.99538, 0.99549, 0.99560, 0.99571, 0.99582, 0.99592, 0.99602, 0.99613, 0.99623, 0.99633, 0.99643, 0.99653, 0.99662, 0.99672, 0.99682, 0.99691, 0.99701, 0.99710, 0.99719, 0.99728, 0.99737, 0.99746, 0.99755, 0.99764, 0.99772, 0.99781, 0.99790, 0.99798, 0.99806, 0.99814, 0.99823, 0.99831, 0.99839, 0.99847, 0.99855, 0.99863, 0.99871, 0.99879, 0.99887, 0.99895, 0.99902, 0.99910, 0.99918, 0.99925, 0.99933, 0.99940, 0.99948, 0.99955, 0.99963, 0.99971, 0.99978, 0.99985, 0.99993, 1.00000]) kwargs.setdefault("NoiseOccupancy", 5e-8) kwargs.setdefault("DisableProbability", 9e-3) @@ -168,20 +175,22 @@ def EndcapFEI3SimTool(name="EndcapFEI3SimTool", **kwargs): kwargs.setdefault("BarrelEC", 2) kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc()) kwargs.setdefault("RndmEngine", "PixelDigitization") - kwargs.setdefault("Analogthreshold", [-1, -1, -1]) - kwargs.setdefault("ToTthreshold", [ 5, 5, 5]) - kwargs.setdefault("Latency", [256, 256, 256]) - kwargs.setdefault("HitDuplication", [False, False, False]) - kwargs.setdefault("SmallHitToT", [-1, -1, -1]) - kwargs.setdefault("CrossTalk", [0.06,0.06,0.06]) - kwargs.setdefault("ThermalNoise", [160.0,160.0,160.0]) + + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.EndcapAnalogThreshold=[-1,-1,-1,] + PixelConfigCondAlg.EndcapToTThreshold=[ 5, 5, 5] + PixelConfigCondAlg.EndcapLatency=[256, 256, 256] + PixelConfigCondAlg.EndcapCrossTalk=[0.06,0.06,0.06] + PixelConfigCondAlg.EndcapThermalNoise=[160.0,160.0,160.0] + PixelConfigCondAlg.EndcapHitDuplication=[False, False, False] + PixelConfigCondAlg.EndcapSmallHitToT=[-1, -1, -1] + kwargs.setdefault("NoiseShape", [0.00000, 0.00596, 0.03491, 0.07058, 0.11991, 0.17971, 0.24105, 0.29884, 0.35167, 0.39912, 0.44188, 0.48016, 0.51471, 0.54587, 0.57405, 0.59958, 0.62288, 0.64411, 0.66360, 0.68159, 0.69823, 0.71362, 0.72781, 0.74096, 0.75304, 0.76415, 0.77438, 0.78383, 0.79256, 0.80066, 0.80821, 0.81547, 0.82246, 0.82918, 0.83501, 0.84054, 0.84576, 0.85078, 0.85558, 0.86018, 0.86455, 0.86875, 0.87273, 0.87653, 0.88020, 0.88369, 0.88705, 0.89027, 0.89336, 0.89633, 0.89921, 0.90195, 0.90460, 0.90714, 0.90961, 0.91198, 0.91426, 0.91644, 0.91853, 0.92055, 0.92250, 0.92435, 0.92611, 0.92782, 0.92947, 0.93105, 0.93257, 0.93404, 0.93547, 0.93688, 0.93822, 0.93953, 0.94079, 0.94201, 0.94318, 0.94432, 0.94542, 0.94649, 0.94751, 0.94851, 0.94949, 0.95045, 0.95137, 0.95227, 0.95314, 0.95399, 0.95483, 0.95563, 0.95646, 0.95729, 0.95812, 0.95896, 0.95980, 0.96063, 0.96144, 0.96224, 0.96301, 0.96377, 0.96451, 0.96521, 0.96590, 0.96657, 0.96722, 0.96787, 0.96849, 0.96911, 0.96971, 0.97031, 0.97090, 0.97148, 0.97204, 0.97260, 0.97314, 0.97367, 0.97421, 0.97474, 0.97525, 0.97576, 0.97627, 0.97676, 0.97722, 0.97769, 0.97815, 0.97861, 0.97906, 0.97950, 0.97992, 0.98033, 0.98073, 0.98111, 0.98147, 0.98182, 0.98216, 0.98249, 0.98281, 0.98312, 0.98343, 0.98374, 0.98402, 0.98430, 0.98456, 0.98482, 0.98507, 0.98532, 0.98555, 0.98579, 0.98602, 0.98624, 0.98646, 0.98668, 0.98690, 0.98711, 0.98732, 0.98753, 0.98773, 0.98793, 0.98813, 0.98832, 0.98851, 0.98870, 0.98888, 0.98907, 0.98925, 0.98943, 0.98961, 0.98979, 0.98996, 0.99014, 0.99031, 0.99048, 0.99064, 0.99081, 0.99098, 0.99114, 0.99131, 0.99147, 0.99163, 0.99179, 0.99194, 0.99210, 0.99225, 0.99240, 0.99256, 0.99271, 0.99286, 0.99300, 0.99315, 0.99329, 0.99344, 0.99358, 0.99372, 0.99386, 0.99400, 0.99414, 0.99427, 0.99440, 0.99453, 0.99466, 0.99479, 0.99491, 0.99503, 0.99515, 0.99527, 0.99538, 0.99549, 0.99560, 0.99571, 0.99582, 0.99592, 0.99602, 0.99613, 0.99623, 0.99633, 0.99643, 0.99653, 0.99662, 0.99672, 0.99682, 0.99691, 0.99701, 0.99710, 0.99719, 0.99728, 0.99737, 0.99746, 0.99755, 0.99764, 0.99772, 0.99781, 0.99790, 0.99798, 0.99806, 0.99814, 0.99823, 0.99831, 0.99839, 0.99847, 0.99855, 0.99863, 0.99871, 0.99879, 0.99887, 0.99895, 0.99902, 0.99910, 0.99918, 0.99925, 0.99933, 0.99940, 0.99948, 0.99955, 0.99963, 0.99971, 0.99978, 0.99985, 0.99993, 1.00000]) kwargs.setdefault("NoiseOccupancy", 5e-8) kwargs.setdefault("DisableProbability", 9e-3) kwargs.setdefault("TimingTune", 2015) return CfgMgr.FEI3SimTool(name, **kwargs) - def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs): from AthenaCommon import CfgGetter kwargs.setdefault("RndmSvc", digitizationFlags.rndmSvc()) @@ -209,7 +218,22 @@ def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs): ServiceMgr += PixelCablingSvc print PixelCablingSvc kwargs.setdefault("InputObjectName", "PixelHits") - chargeTools = [] #Tools in array for flexibility + + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, 'PixelConfigCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg") + + if not conddb.folderRequested("/PIXEL/PixReco"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixReco", className="DetCondCFloat") + + if not hasattr(condSeq, 'PixelOfflineCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelOfflineCalibCondAlg + condSeq += PixelOfflineCalibCondAlg(name="PixelOfflineCalibCondAlg", ReadKey="/PIXEL/PixReco") + PixelOfflineCalibCondAlg.InputSource = 2 + + chargeTools = [] feSimTools = [] if InDetGeometryFlags.isSLHC(): chargeTools += ['SensorSimPlanarTool'] diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx index a98c5ba48c533a547b6efbd73dffbc6a9abb06c1..5a9b27cc03129b4b9affcbdd26749de40278f521 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx @@ -6,12 +6,8 @@ FEI3SimTool::FEI3SimTool( const std::string& type, const std::string& name,const IInterface* parent): FrontEndSimTool(type,name,parent), - m_HitDuplication({false,false,false,false,false,false,false}), - m_SmallHitToT({7,7,7,7,7,7,7}), m_timingTune(2015) { - declareProperty("HitDuplication", m_HitDuplication); - declareProperty("SmallHitToT", m_SmallHitToT); declareProperty("TimingTune", m_timingTune, "Version of the timing calibration"); } @@ -42,11 +38,13 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (abs(barrel_ec)!=m_BarrelEC) { return; } + SG::ReadCondHandle<PixelModuleData> module_data(m_moduleDataKey); + // Add cross-talk - CrossTalk(m_CrossTalk.at(layerIndex), chargedDiodes); + CrossTalk(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(m_ThermalNoise.at(layerIndex), chargedDiodes); + ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes); // Add random noise RandomNoise(chargedDiodes); @@ -114,7 +112,7 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (charge<m_Analogthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (charge<module_data->getAnalogThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // charge to ToT conversion double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); @@ -123,9 +121,9 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (nToT<1) { nToT=1; } - if (nToT<=m_ToTthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (nToT>=m_Latency.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT>=module_data->getLatency(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } @@ -149,14 +147,19 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } // Duplication mechanism for FEI3 small hits : - if (m_HitDuplication.at(layerIndex)) { - if (nToT<=m_SmallHitToT.at(layerIndex) && bunch>0 && bunch<=m_timeBCN) { + bool hitDupli = false; + if (module_data->getHitDuplication(barrel_ec,layerIndex)) { hitDupli=true; } + + if (hitDupli) { + bool smallHitChk = false; + if (nToT<=module_data->getSmallHitToT(barrel_ec,layerIndex)) { smallHitChk=true; } + + if (smallHitChk && bunch>0 && bunch<=m_timeBCN) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch-1,0,bunch-1); rdoCollection.push_back(p_rdo); } } } - return; } diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h index b971608a1fb3d844e79f00312d3cb24f41b23333..bb9ee5f15fbc7fa4177620873cffd5d869edca09 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h @@ -21,9 +21,6 @@ class FEI3SimTool:public FrontEndSimTool { private: FEI3SimTool(); - std::vector<bool> m_HitDuplication; - std::vector<int> m_SmallHitToT; - int m_timingTune; int relativeBunch2009(const double threshold, const double intimethreshold, const SiTotalCharge &totalCharge) const; diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx index 9f2eeabab0975c76d98ab9668441a9097aec3627..5c60ef49c0b36c26e55028719d9e864ae5ba35c9 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx @@ -5,10 +5,8 @@ #include "FEI4SimTool.h" FEI4SimTool::FEI4SimTool( const std::string& type, const std::string& name,const IInterface* parent): - FrontEndSimTool(type,name,parent), - m_HitDiscConfig(2) + FrontEndSimTool(type,name,parent) { - declareProperty("HitDiscConfig", m_HitDiscConfig); } FEI4SimTool::~FEI4SimTool() { } @@ -17,10 +15,6 @@ StatusCode FEI4SimTool::initialize() { CHECK(FrontEndSimTool::initialize()); ATH_MSG_DEBUG("FEI4SimTool::initialize()"); - if (m_HitDiscConfig<0 || m_HitDiscConfig>2) { - ATH_MSG_FATAL("HitDisConfig must be [0-2], but not " << m_HitDiscConfig); - return StatusCode::FAILURE; - } return StatusCode::SUCCESS; } @@ -42,11 +36,10 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (abs(barrel_ec)!=m_BarrelEC) { return; } + SG::ReadCondHandle<PixelModuleData> module_data(m_moduleDataKey); + int maxFEI4SmallHit = 2; - int overflowToT = 16; - if (m_HitDiscConfig==0) { maxFEI4SmallHit=0; overflowToT=14; } - if (m_HitDiscConfig==1) { maxFEI4SmallHit=1; overflowToT=15; } - if (m_HitDiscConfig==2) { maxFEI4SmallHit=2; overflowToT=16; } + int overflowToT = module_data->getIBLOverflowToT(); std::vector<Pixel1RawData*> p_rdo_small_fei4; int nSmallHitsFEI4 = 0; @@ -56,10 +49,10 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle std::vector<std::vector<int>> FEI4Map(maxRow+16,std::vector<int>(maxCol+16)); // Add cross-talk - CrossTalk(m_CrossTalk.at(layerIndex), chargedDiodes); + CrossTalk(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(m_ThermalNoise.at(layerIndex), chargedDiodes); + ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes); // Add random noise RandomNoise(chargedDiodes); @@ -93,7 +86,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (charge<m_Analogthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (charge<module_data->getAnalogThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // charge to ToT conversion double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); @@ -111,7 +104,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (nToT==2 && maxFEI4SmallHit==2) { nToT=1; } if (nToT>=overflowToT) { nToT=overflowToT; } - if (nToT<=m_ToTthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.h index 0bc97c27888e5e4edccc0a30a1a3df69a3c92f45..0fb43666b816dcb898dcf7b24f3e1954e98ac603 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.h @@ -21,7 +21,6 @@ class FEI4SimTool:public FrontEndSimTool { private: FEI4SimTool(); - int m_HitDiscConfig; }; #endif // PIXELDIGITIZATION_FEI4SimTool_H diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h index b0bdff0d5103af41f55f07053b7aba9544356e36..febdeab91d8df71ede548a9c79a45cb0282097a6 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h @@ -27,8 +27,10 @@ #include "CommissionEvent/ComTime.h" +#include "PixelConditionsData/PixelModuleData.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" static const InterfaceID IID_IFrontEndSimTool("FrontEndSimTool", 1, 0); @@ -50,11 +52,6 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { m_ComTimeKey("ComTime"), m_eventStore("StoreGateSvc", name), m_BarrelEC(0), - m_Analogthreshold({-1,-1,-1,-1,-1,-1,-1}), - m_ToTthreshold({-1,-1,-1,-1,-1,-1,-1}), - m_Latency({256,256,256,256,256,256,256}), - m_CrossTalk({0.06,0.06,0.06,0.06,0.06,0.06,0.06}), - m_ThermalNoise({160.0,160.0,160.0,160.0,160.0,160.0,160.0}), m_noiseShape({0.0,1.0}), m_noiseOccupancy(1e-8), m_disableProbability(9e-3) @@ -69,11 +66,6 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { declareProperty("UseComTime", m_useComTime, "Use ComTime for timing"); declareProperty("TimeJitter", m_timeJitter, "Time jitter"); declareProperty("BarrelEC", m_BarrelEC, "Index of barrel or endcap"); - declareProperty("Analogthreshold", m_Analogthreshold); - declareProperty("ToTthreshold", m_ToTthreshold); - declareProperty("Latency", m_Latency); - declareProperty("CrossTalk", m_CrossTalk); - declareProperty("ThermalNoise", m_ThermalNoise); declareProperty("NoiseShape", m_noiseShape, "Vector containing noise ToT shape"); declareProperty("NoiseOccupancy", m_noiseOccupancy); declareProperty("DisableProbability", m_disableProbability); @@ -90,6 +82,8 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { ATH_CHECK(m_pixelCalibSvc.retrieve()); + ATH_CHECK(m_moduleDataKey.initialize()); + m_rndmEngine = m_rndmSvc->GetEngine(m_rndmEngineName); if (!m_rndmEngine) { ATH_MSG_ERROR("Could not find RndmEngine : " << m_rndmEngineName); @@ -206,6 +200,8 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { ToolHandle<IInDetConditionsTool> m_pixelConditionsTool{this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; ServiceHandle<IPixelCalibSvc> m_pixelCalibSvc; + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey{this, "PixelModuleData", "PixelModuleData", "Output key of pixel module"}; + double m_timeBCN; double m_timeZero; double m_timePerBCO; @@ -215,11 +211,6 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { SG::ReadHandleKey<ComTime> m_ComTimeKey; ServiceHandle<StoreGateSvc> m_eventStore; int m_BarrelEC; - std::vector<int> m_Analogthreshold; - std::vector<int> m_ToTthreshold; - std::vector<int> m_Latency; - std::vector<double> m_CrossTalk; - std::vector<double> m_ThermalNoise; std::vector<double> m_noiseShape; double m_noiseOccupancy; double m_disableProbability; @@ -250,7 +241,6 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { return first.time(); } - }; #endif // PIXELDIGITIZATION_FrontEndSimTool_H diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx index 62a53156cdf466860eb397f4375046d90ab1f7f8..ce1db9c65c177679ab66315d2c3c058b48e97345 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx @@ -43,6 +43,8 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (abs(barrel_ec)!=m_BarrelEC) { return; } + SG::ReadCondHandle<PixelModuleData> module_data(m_moduleDataKey); + //int maxRD53SmallHit = 0; unused int overflowToT = 256; @@ -54,10 +56,10 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle std::vector<std::vector<int>> RD53Map(maxRow+16,std::vector<int>(maxCol+16)); // Add cross-talk - CrossTalk(m_CrossTalk.at(layerIndex), chargedDiodes); + CrossTalk(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(m_ThermalNoise.at(layerIndex), chargedDiodes); + ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes); // Add random noise RandomNoise(chargedDiodes); @@ -92,7 +94,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (charge<m_Analogthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (charge<module_data->getAnalogThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // charge to ToT conversion double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); @@ -104,7 +106,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle // RD53 HitDiscConfig if (nToT>=overflowToT) { nToT=overflowToT; } - if (nToT<=m_ToTthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py index 854d16936cc0b47c7ea35cf76de046fd8b8a3d14..9e5e0421e11cf563da384558fdcc1cbd2a046ea5 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py @@ -90,19 +90,6 @@ if DetFlags.haveRIO.pixel_on(): if (InDetFlags.doPrintConfigurables()): print InDetPixelByteStreamErrorsSvc - # Load Pixel reconstruction parameters - from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool - ToolSvc += PixelRecoDbTool(name = "PixelRecoDbTool") - - if athenaCommonFlags.isOnline() : - ToolSvc.PixelRecoDbTool.InputSource = 1 - else : - if not conddb.folderRequested('/PIXEL/Pixreco'): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixReco",className='DetCondCFloat') - from PixelCalibAlgs.PixelCalibAlgsConf import PixelCalibCondAlg - condSeq += PixelCalibCondAlg( "PixelCalibCondAlg" ) - ToolSvc.PixelRecoDbTool.InputSource = 2 - if not athenaCommonFlags.isOnline(): if not conddb.folderRequested('/PIXEL/PixdEdx'): if (globalflags.DataSource() == 'data'): @@ -110,11 +97,20 @@ if DetFlags.haveRIO.pixel_on(): else: conddb.addFolder("PIXEL_OFL","/PIXEL/PixdEdx") - from PixelConditionsServices.PixelConditionsServicesConf import PixelOfflineCalibSvc - InDetPixelOfflineCalibSvc = PixelOfflineCalibSvc( PixelRecoDbTool = ToolSvc.PixelRecoDbTool) - ServiceMgr += InDetPixelOfflineCalibSvc - if (InDetFlags.doPrintConfigurables()): - print InDetPixelOfflineCalibSvc + if not conddb.folderRequested("/PIXEL/PixReco"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixReco", className="DetCondCFloat") + + if not hasattr(condSeq, 'PixelOfflineCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelOfflineCalibCondAlg + condSeq += PixelOfflineCalibCondAlg(name="PixelOfflineCalibCondAlg", ReadKey="/PIXEL/PixReco") + if athenaCommonFlags.isOnline() : + PixelOfflineCalibCondAlg.InputSource = 1 + else : + PixelOfflineCalibCondAlg.InputSource = 2 + + if not hasattr(condSeq, 'PixelConfigCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg") if not hasattr(ToolSvc, "PixelLorentzAngleTool"): from SiLorentzAngleSvc.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py index 1da815b854cf1fc7f3ac7ac334577ea60e71dddc..57a5bf0ee8aeccebd52942f84f6919c9bf214675 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py @@ -40,14 +40,12 @@ if InDetFlags.doPRDFormation(): from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", PixelCalibSvc = None, - PixelOfflineCalibSvc = 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.PixelOfflineCalibSvc = InDetPixelOfflineCalibSvc InDetClusterMakerTool.UsePixelCalibCondDB = True ToolSvc += InDetClusterMakerTool diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup.py index ed4e36790b7d9fc380062fced13d1a27053998ec..5082b1f627c4835fd54f30c5055c6d88d5d3e948 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup.py @@ -5,9 +5,6 @@ from InDetSLHC_Example.SLHC_Setup import SLHC_Setup SLHC_Setup = SLHC_Setup() -if rec.OutputFileNameForRecoStep() == 'RAWtoESD' or rec.OutputFileNameForRecoStep() == 'ESDtoDPD': - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False - # If /Indet/IBLDist is available, InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/InDetDetectorManager.cxx will try to perform alignment and lead to crash # InnerDetector/InDetConditions/InDetCondFolders/python/InDetAlignFolders.py configures /Indet/IBLDist from IOVDbSvc.CondDB import conddb diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_Alpine.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_Alpine.py index 10bef66a6764f058440e3e0a36ac114aafa03fa4..1dcd65d0216d1d347046cde48f9fb4d3f2da690a 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_Alpine.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_Alpine.py @@ -6,5 +6,3 @@ from InDetSLHC_Example.SLHC_Setup_Alpine import SLHC_Setup SLHC_Setup = SLHC_Setup() -if rec.OutputFileNameForRecoStep() == 'RAWtoESD' or rec.OutputFileNameForRecoStep() == 'ESDtoDPD': - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_Alpine_VF.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_Alpine_VF.py index fbf5d80b64e33136b1aa25ae8d949163caca07e0..9f16c4ec0f5d80de4fe56e02e1a379d6a3af6c44 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_Alpine_VF.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_Alpine_VF.py @@ -6,5 +6,3 @@ from InDetSLHC_Example.SLHC_Setup_Alpine_VF import SLHC_Setup SLHC_Setup = SLHC_Setup() -if rec.OutputFileNameForRecoStep() == 'RAWtoESD' or rec.OutputFileNameForRecoStep() == 'ESDtoDPD': - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_ExtBrl_32.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_ExtBrl_32.py index 5fa6615802edc0a0cac06d13b22c688db2238748..da88d59ec9d6329e6b6cb65941d5af958f3c25c8 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_ExtBrl_32.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_ExtBrl_32.py @@ -6,5 +6,3 @@ from InDetSLHC_Example.SLHC_Setup_ExtBrl_32 import SLHC_Setup SLHC_Setup = SLHC_Setup() -if rec.OutputFileNameForRecoStep() == 'RAWtoESD' or rec.OutputFileNameForRecoStep() == 'ESDtoDPD': - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_ExtBrl_4.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_ExtBrl_4.py index d205135e9f8dcaf3d5ded1b2aa7ff480594bf17d..710e4e91b34bcfe9b7716694b1a81dad4e590a86 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_ExtBrl_4.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_ExtBrl_4.py @@ -6,5 +6,3 @@ from InDetSLHC_Example.SLHC_Setup_ExtBrl_4 import SLHC_Setup SLHC_Setup = SLHC_Setup() -if rec.OutputFileNameForRecoStep() == 'RAWtoESD' or rec.OutputFileNameForRecoStep() == 'ESDtoDPD': - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI.py index 6332324379bca0edbcf5492b33137fe61aacbabf..f26d659cc0485bf6e787be134a20ba28c5db8d52 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI.py @@ -5,5 +5,3 @@ from InDetSLHC_Example.SLHC_Setup_LoI import SLHC_Setup SLHC_Setup = SLHC_Setup() -if rec.OutputFileNameForRecoStep() == 'RAWtoESD' or rec.OutputFileNameForRecoStep() == 'ESDtoDPD': - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI_ECRing.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI_ECRing.py index ef849988ef873bd1a72428d9289f2d47ca321780..05d540912d6ba3c276d2ac3ae4f2c002768a6cf5 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI_ECRing.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI_ECRing.py @@ -5,5 +5,3 @@ from InDetSLHC_Example.SLHC_Setup_LoI_ECRing import SLHC_Setup SLHC_Setup = SLHC_Setup() -if rec.OutputFileNameForRecoStep() == 'RAWtoESD' or rec.OutputFileNameForRecoStep() == 'ESDtoDPD': - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI_VF.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI_VF.py index 792e40213394e5dc67de290129156bab6b67dd9a..821559bad5aceb047f0009d80b73b23eec735e2d 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI_VF.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Setup_LoI_VF.py @@ -5,5 +5,3 @@ from InDetSLHC_Example.SLHC_Setup_LoI_VF import SLHC_Setup SLHC_Setup = SLHC_Setup() -if rec.OutputFileNameForRecoStep() == 'RAWtoESD' or rec.OutputFileNameForRecoStep() == 'ESDtoDPD': - ServiceMgr.PixelOfflineCalibSvc.HDCFromCOOL = False diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index 429bd6a7b5982c31ad165f9a3d059dfee8d90110..d26e6d05b2bd2bfc56a9d310d7a83397a379387f 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -121,13 +121,15 @@ class PixelConditionsServicesSetup: if not (conddb.folderRequested(PixelDeadMapFolder) or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")): conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixMapOverlay",PixelDeadMapFolder, className='CondAttrListCollection') - if not hasattr(condSeq, "PixelDeadMapCondAlg"): - from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDeadMapCondAlg - condSeq += PixelDeadMapCondAlg(name="PixelDeadMapCondAlg", ReadKey=PixelDeadMapFolder) - ############################ # Conditions Summary Setup # ############################ + # This is future replacement of the PixelConditionsSummaryTool... + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", + UseDeadMap=self.usePixMap, + ReadDeadMapKey=PixelDeadMapFolder) + from PixelConditionsTools.PixelConditionsToolsConf import PixelConditionsSummaryTool TrigPixelConditionsSummaryTool = PixelConditionsSummaryTool(name=self.instanceName('PixelConditionsSummaryTool'), PixelDCSConditionsTool=TrigPixelDCSConditionsTool, @@ -143,7 +145,7 @@ class PixelConditionsServicesSetup: self.summaryTool = TrigPixelConditionsSummaryTool if self._print: print TrigPixelConditionsSummaryTool - + ##################### # Calibration Setup # ##################### @@ -160,33 +162,27 @@ class PixelConditionsServicesSetup: svcMgr += PixelCalibSvc - #only when inputsource=1 - #if not conddb.folderRequested("/PIXEL/PixReco"): - # conddb.addFolder("PIXEL_OFL","/PIXEL/PixReco") - if not conddb.folderRequested("/PIXEL/PixReco"): - conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixReco","/PIXEL/PixReco") - - #Configure PixelRecoDbTool - from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool - PixelRecoDbTool = PixelRecoDbTool(name=self.instanceName('PixelRecoDbTool')) - ToolSvc += PixelRecoDbTool - PixelRecoDbTool.InputSource = 2 - # if self.onlineMode: - # PixelRecoDbTool.InputSource = 1 #after change of run1 conditions - # else: - # PixelRecoDbTool.InputSource = 2 - - if self._print: print PixelRecoDbTool - - #use corresponding PixelRecoDBTool - from PixelConditionsServices.PixelConditionsServicesConf import PixelOfflineCalibSvc - PixelOfflineCalibSvc = PixelOfflineCalibSvc(self.instanceName('PixelOfflineCalibSvc')) - PixelOfflineCalibSvc.PixelRecoDbTool = PixelRecoDbTool - ServiceMgr += PixelOfflineCalibSvc - - if self._print: print PixelOfflineCalibSvc - + conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixReco","/PIXEL/PixReco",className="DetCondCFloat") + + if not hasattr(condSeq, 'PixelOfflineCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelOfflineCalibCondAlg + condSeq += PixelOfflineCalibCondAlg(name="PixelOfflineCalibCondAlg", ReadKey="/PIXEL/PixReco") + PixelOfflineCalibCondAlg.InputSource = 2 + + + ### configure the special pixel map service + if not (conddb.folderRequested("/PIXEL/PixMapShort") or conddb.folderRequested("/PIXEL/Onl/PixMapShort")): + conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixMapShort","/PIXEL/PixMapShort", className='CondAttrListCollection') + if not (conddb.folderRequested("/PIXEL/PixMapLong") or conddb.folderRequested("/PIXEL/Onl/PixMapLong")): + conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixMapLong","/PIXEL/PixMapLong", className='CondAttrListCollection') + if not (conddb.folderRequested("/PIXEL/NoiseMapShort") or conddb.folderRequested("/PIXEL/Onl/NoiseMapShort")): + conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/NoiseMapShort","/PIXEL/NoiseMapShort", className='CondAttrListCollection') + if not (conddb.folderRequested("/PIXEL/NoiseMapLong") or conddb.folderRequested("/PIXEL/Onl/NoiseMapLong")): + conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/NoiseMapLong","/PIXEL/NoiseMapLong", className='CondAttrListCollection') + if not (conddb.folderRequested("/PIXEL/PixMapOverlay") or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")): + conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixMapOverlay","/PIXEL/PixMapOverlay", className='CondAttrListCollection') + ####################### # Lorentz Angle Setup # ####################### diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py index fd7027a488ba2195e9ad126a48b76383f2a1304d..bfc77bbc0089b24498f9910954fef2d5e5ebff4d 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py @@ -33,7 +33,6 @@ InDetTrigClusterMakerTool = \ InDet__ClusterMakerTool( name = "InDetTrigClusterMakerTool", UsePixelCalibCondDB = False, #simpler setup for EFID #UsePixelCalibCondDB = True, #simpler setup for EFID - PixelOfflineCalibSvc = PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), #pixLorentzAnleSvc = "InDetTrigPixLorentzAngleSvc", #UseLorentzAngleCorrections = False PixelLorentzAngleTool = TrigPixelLorentzAngleTool, @@ -128,7 +127,6 @@ if InDetTrigFlags.loadRotCreator(): print TrigNnClusterizationFactory InDetTrigPixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("InDetTrigPixelClusterOnTrackTool", - PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), ErrorStrategy = 2, LorentzAngleTool = TrigPixelLorentzAngleTool, NnClusterizationFactory= TrigNnClusterizationFactory, @@ -152,7 +150,6 @@ if InDetTrigFlags.loadRotCreator(): #-- from InDetTrigRecExample.InDetTrigConditionsAccess import PixelConditionsSetup InDetTrigBroadPixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("InDetTrigBroadPixelClusterOnTrackTool", - PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), ErrorStrategy = 0, LorentzAngleTool = TrigPixelLorentzAngleTool, NnClusterizationFactory= TrigNnClusterizationFactory diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/CMakeLists.txt b/InnerDetector/InDetRecTools/PixelToTPIDTool/CMakeLists.txt index 08ce43b18adf4f0c914a4e0d3e9dcae154bb0bb3..104cd37c7d3296a826f1fc62fc32297c5e6f6ead 100644 --- a/InnerDetector/InDetRecTools/PixelToTPIDTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/CMakeLists.txt @@ -18,6 +18,7 @@ atlas_depends_on_subdirs( Database/RegistrationServices DetectorDescription/Identifier Event/EventInfo + InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/PixelGeoModel @@ -45,7 +46,7 @@ atlas_add_component( PixelToTPIDTool AthenaBaseComps AthenaKernel StoreGateLib GaudiKernel TrkEventPrimitives AthenaPoolUtilities Identifier EventInfo InDetIdentifier InDetRIO_OnTrack Particle PathResolver TrkSurfaces TrkMeasurementBase TrkParameters - TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkToolInterfaces PixelGeoModelLib ) + TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkToolInterfaces PixelGeoModelLib PixelConditionsData ) # Install files from the package: atlas_install_runtime( share/*.txt ) diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h index dfc3bb9795ecde99fd040bcef7d8a0493c0490d6..597b3b81c97bc39e4f629167d404594f2a96d78c 100644 --- a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h +++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h @@ -16,10 +16,12 @@ #include "TrkEventPrimitives/ParticleHypothesis.h" #include "PixelToTPIDTool/dEdxID.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "StoreGate/ReadCondHandleKey.h" + class AtlasDetectorID; class Identifier; class PixelID; -class IPixelOfflineCalibSvc; class IBLParameterSvc; namespace Trk { @@ -60,7 +62,6 @@ namespace InDet private: ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; mutable int m_overflowIBLToT; - ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; StatusCode update( IOVSVC_CALLBACK_ARGS ); dEdxID *m_mydedx; std::string m_filename; @@ -68,6 +69,8 @@ namespace InDet double m_conversionfactor; bool m_readfromcool; double m_mindedxformass; + + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey{this, "PixelModuleData", "PixelModuleData", "Output key of pixel module"}; }; } // end of namespace diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx index f027dbd98c26d5ca6cc8a68a62d1a8c8c2fd7704..b53182f1441d3841ad860c185c6ea61d604865bb 100644 --- a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx +++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx @@ -25,7 +25,6 @@ #include "InDetRIO_OnTrack/PixelClusterOnTrack.h" #include "InDetIdentifier/PixelID.h" #include "PixelGeoModel/IBLParameterSvc.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" // CLHEP: #include "CLHEP/Matrix/Vector.h" @@ -46,7 +45,6 @@ InDet::PixelToTPIDTool::PixelToTPIDTool(const std::string& t, AthAlgTool(t,n,p), m_IBLParameterSvc("IBLParameterSvc",n), m_overflowIBLToT(0), - m_offlineCalibSvc("PixelOfflineCalibSvc", n), m_pixelid(nullptr) { declareInterface<IPixelToTPIDTool>(this); @@ -110,25 +108,13 @@ StatusCode InDet::PixelToTPIDTool::initialize() m_mydedx=new dEdxID(file_name.c_str()); } - if ( !m_offlineCalibSvc.empty() ) { - StatusCode sc = m_offlineCalibSvc.retrieve(); - if (sc.isFailure() || !m_offlineCalibSvc ) { - ATH_MSG_ERROR( m_offlineCalibSvc.type() << " not found! "); - return StatusCode::RECOVERABLE; - } - else{ - ATH_MSG_INFO ( "Retrieved tool " << m_offlineCalibSvc.type() ); - } - } - if (m_IBLParameterSvc.retrieve().isFailure()) { ATH_MSG_FATAL("Could not retrieve IBLParameterSvc"); return StatusCode::FAILURE; } else ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); - - //m_overflowIBLToT = m_offlineCalibSvc->getIBLToToverflow(); + ATH_CHECK(m_moduleDataKey.initialize()); ATH_MSG_INFO ("initialize() successful in " << name()); return StatusCode::SUCCESS; @@ -234,18 +220,17 @@ 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 = m_offlineCalibSvc->getIBLToToverflow(); + m_overflowIBLToT = SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getIBLOverflowToT(); const std::vector<int>& ToTs = pixclus->prepRawData()->totList(); - for (int pixToT : ToTs) { - if (pixToT >= m_overflowIBLToT) { - //overflow pixel hit -- flag cluster - iblOverflow = 1; - break; //no need to check other hits of this cluster - } - }// end - + for (int pixToT : ToTs) { + if (pixToT >= m_overflowIBLToT) { + //overflow pixel hit -- flag cluster + iblOverflow = 1; + break; //no need to check other hits of this cluster + } + }// end + //this is IBL layer -- @todo: check using proper service (safe against geometries) if(((eta_module>=-10 && eta_module<=-7)||(eta_module>=6 && eta_module<=9)) && (fabs(locy)<10. && (locx>-8.33 && locx <8.3)) ){//check if IBL 3D and good cluster selection diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt index a6ec92073a6a955047ec4217a2b38516f1ca2ff5..18b41d7e77625d425fcd3e7794ac9e580f23726f 100644 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt @@ -24,6 +24,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventPrimitives InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetConditions/PixelConditionsTools + InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetDetDescr/PixelGeoModel @@ -38,7 +39,7 @@ atlas_add_component( SiClusterOnTrackTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces TrkRIO_OnTrack) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces TrkRIO_OnTrack PixelConditionsData) # Install files from the package: atlas_install_headers( SiClusterOnTrackTool ) diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h index 4c7428820d436045654cd48d103306a439ddc714..6ff0a6bce3dc3d9cdd3f3b093dcef9264a671ae4 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/SiClusterOnTrackTool/PixelClusterOnTrackTool.h @@ -17,12 +17,12 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "TrkAmbiguityProcessor/dRMap.h" +#include "PixelConditionsData/PixelOfflineCalibData.h" #include "InDetCondServices/ISiLorentzAngleTool.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" #include "StoreGate/ReadCondHandleKey.h" class PixelID; -class IPixelOfflineCalibSvc; class IModuleDistortionsTool; class StoreGateSvc; @@ -121,13 +121,13 @@ public: /////////////////////////////////////////////////////////////////// ToolHandle<IModuleDistortionsTool> m_pixDistoTool ; - ServiceHandle<IPixelOfflineCalibSvc> m_calibSvc ; StoreGateSvc* m_detStore ; ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{this, "LorentzAngleTool", "SiLorentzAngleTool", "Tool to retreive Lorentz angle"}; // SG::ReadCondHandleKey<PixelRIO_OnTrackErrorScaling> m_pixelErrorScalingKey // {this,"PixelErrorScalingKey", "/Indet/TrkErrorScalingPixel", "Key for pixel error scaling conditions data."}; + SG::ReadCondHandleKey<PixelCalib::PixelOfflineCalibData> m_clusterErrorKey{this, "PixelOfflineCalibData", "PixelOfflineCalibData", "Output key of pixel cluster"}; SG::ReadCondHandleKey<RIO_OnTrackErrorScaling> m_pixelErrorScalingKey {this,"PixelErrorScalingKey", "/Indet/TrkErrorScalingPixel", "Key for pixel error scaling conditions data."}; diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx index 85c4ef9886419e0e275e10abe6118abdcc7b9d22..b179d7b1fa5d755e5304292706d939580ae40943 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx @@ -15,7 +15,6 @@ #include "SiClusterOnTrackTool/PixelClusterOnTrackTool.h" #include "InDetReadoutGeometry/PixelModuleDesign.h" #include "InDetIdentifier/PixelID.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" #include "PixelConditionsTools/IModuleDistortionsTool.h" #include "TrkSurfaces/PlaneSurface.h" #include "StoreGate/StoreGateSvc.h" @@ -75,7 +74,6 @@ InDet::PixelClusterOnTrackTool::PixelClusterOnTrackTool (const std::string &t, const std::string &n, const IInterface *p) : ::AthAlgTool(t, n, p), m_pixDistoTool("PixelDistortionsTool", this), - m_calibSvc("PixelOfflineCalibSvc", n), m_detStore(nullptr), m_disableDistortions(false), m_rel13like(false), @@ -100,7 +98,6 @@ InDet::PixelClusterOnTrackTool::PixelClusterOnTrackTool declareProperty("ErrorStrategy", m_errorStrategy = 2, "Which calibration of cluster position errors"); declareProperty("DisableDistortions", m_disableDistortions, "Disable simulation of module distortions"); declareProperty("Release13like", m_rel13like, "Activate release-13 like settigs"); - declareProperty("PixelOfflineCalibSvc", m_calibSvc, "Offline calibration svc"); declareProperty("applyNNcorrection", m_applyNNcorrection); declareProperty("applydRcorrection", m_applydRcorrection); declareProperty("NNIBLcorrection", m_NNIBLcorrection); @@ -138,10 +135,7 @@ InDet::PixelClusterOnTrackTool::initialize() { m_IBLParameterSvc->setBoolParameters(m_IBLAbsent, "IBLAbsent"); } - // get the offline calibration service - ATH_CHECK( m_calibSvc.retrieve()); - ATH_MSG_DEBUG("Retrieved tool " << m_calibSvc.type()); - + ATH_CHECK(m_clusterErrorKey.initialize()); // get the error scaling tool if (!m_pixelErrorScalingKey.key().empty()) { @@ -446,6 +440,7 @@ InDet::PixelClusterOnTrackTool::correctDefault // TOT interpolation for collision data // Force IBL to use digital clustering and broad errors. + SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> offlineCalibData(m_clusterErrorKey); if (m_positionStrategy > 0 && omegaphi > -0.5 && omegaeta > -0.5) { localphi = centroid.xPhi() + shift; localeta = centroid.xEta(); @@ -454,7 +449,7 @@ InDet::PixelClusterOnTrackTool::correctDefault ang = 180 * angle * M_1_PI; //M_1_PI in cmath, = 1/pi double delta = 0.; if (m_IBLAbsent || !blayer) { - delta = m_calibSvc->getBarrelDeltaX(nrows, ang); + delta = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaXbarrel(nrows, ang, 1); } else { // special calibration for IBL if (angle < m_phix[0] || angle > m_phix[s_nbinphi] || nrows != 2) { delta = 0.; @@ -469,8 +464,9 @@ InDet::PixelClusterOnTrackTool::correctDefault ATH_MSG_ERROR("bin out of range in line " << __LINE__ << " of PixelClusterOnTrackTool.cxx."); } } - if (m_calibSvc->includesIBLParams()) { - delta = m_calibSvc->getIBLDeltaX(nrows, ang); + + if (offlineCalibData->getPixelChargeInterpolationParameters()->getVersion()<-1) { + delta = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaXbarrel(nrows, ang, 0); } } localphi += delta * (omegaphi - 0.5); @@ -485,7 +481,7 @@ InDet::PixelClusterOnTrackTool::correctDefault } double etaloc = -1 * log(tan(thetaloc * 0.5)); if (m_IBLAbsent || !blayer) { - delta = m_calibSvc->getBarrelDeltaY(ncol, etaloc); + delta = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaYbarrel(ncol, etaloc, 1); } else { // special calibration for IBL etaloc = std::fabs(etaloc); if (etaloc < m_etax[0] || etaloc > m_etax[s_nbineta]) { @@ -509,16 +505,16 @@ InDet::PixelClusterOnTrackTool::correctDefault ATH_MSG_ERROR("bin out of range in line " << __LINE__ << " of PixelClusterOnTrackTool.cxx."); } } - if (m_calibSvc->includesIBLParams()) { - delta = m_calibSvc->getIBLDeltaY(ncol, etaloc); + if (offlineCalibData->getPixelChargeInterpolationParameters()->getVersion()<-1) { + delta = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaYbarrel(ncol, std::fabs(etaloc), 0); } } localeta += delta * (omegaeta - 0.5); }else { // collision endcap data if (m_positionStrategy == 1) { - double deltax = m_calibSvc->getEndcapDeltaX(); - double deltay = m_calibSvc->getEndcapDeltaY(); + double deltax = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaXendcap(); + double deltay = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaYendcap(); localphi += deltax * (omegaphi - 0.5); localeta += deltay * (omegaeta - 0.5); } @@ -564,7 +560,8 @@ InDet::PixelClusterOnTrackTool::correctDefault }else if (m_errorStrategy == 2) { if (element->isBarrel()) { if (m_IBLAbsent || !blayer) { - errphi = m_calibSvc->getBarrelNewErrorPhi(ang, nrows); + int ibin = offlineCalibData->getPixelClusterOnTrackErrorData()->getBarrelBinPhi(ang, nrows); + errphi = offlineCalibData->getPixelClusterOnTrackErrorData()->getPixelBarrelPhiError(ibin); } else { // special calibration for IBL if (angle < m_phix[0] || angle > m_phix[s_nbinphi]) { errphi = width.phiR() * TOPHAT_SIGMA; @@ -588,9 +585,11 @@ InDet::PixelClusterOnTrackTool::correctDefault } if (m_rel13like) { - erreta = m_calibSvc->getBarrelErrorEta(eta, ncol, nrows); + int ibin = offlineCalibData->getPixelClusterErrorData()->getBarrelBin(eta, ncol, nrows); + erreta = offlineCalibData->getPixelClusterErrorData()->getPixelBarrelEtaError(ibin); }else if (m_IBLAbsent || !blayer) { - erreta = m_calibSvc->getBarrelNewErrorEta(std::fabs(etatrack), nrows, ncol); + int ibin = offlineCalibData->getPixelClusterOnTrackErrorData()->getBarrelBinEta(std::fabs(etatrack), ncol, nrows); + erreta = offlineCalibData->getPixelClusterOnTrackErrorData()->getPixelBarrelEtaError(ibin); } else { // special calibration for IBL double etaloc = std::fabs(etatrack); if (etaloc < m_etax[0] || etaloc > m_etax[s_nbineta]) { @@ -616,8 +615,9 @@ InDet::PixelClusterOnTrackTool::correctDefault } } }else { - errphi = m_calibSvc->getEndCapErrorPhi(ncol, nrows); - erreta = m_calibSvc->getEndCapErrorEta(ncol, nrows); + int ibin = offlineCalibData->getPixelClusterErrorData()->getEndcapBin(ncol, nrows); + errphi = offlineCalibData->getPixelClusterErrorData()->getPixelEndcapPhiError(ibin); + erreta = offlineCalibData->getPixelClusterErrorData()->getPixelEndcapRError(ibin); } if (errphi > erreta) { erreta = width.z() * TOPHAT_SIGMA; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt index a539e16a30fe29d0e29e66e1ba4e289588a51805..84cb7720940380969691e1ca894b66cd474f146a 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( InnerDetector/InDetRawEvent/InDetSimData InnerDetector/InDetConditions/BeamSpotConditionsData InnerDetector/InDetConditions/InDetConditionsSummaryService + InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetRawEvent/InDetRawData @@ -50,13 +51,13 @@ atlas_add_library( SiClusterizationToolLib LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier EventPrimitives GaudiKernel InDetSimData InDetIdentifier InDetReadoutGeometry InDetRawData InDetPrepRawData InDetRecToolInterfaces - TrkParameters TrkNeuralNetworkUtilsLib + TrkParameters TrkNeuralNetworkUtilsLib PixelConditionsData PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaPoolUtilities FileCatalog AtlasDetDescr TrkSurfaces TrkEventPrimitives VxVertex PixelGeoModelLib ) atlas_add_component( SiClusterizationTool src/components/*.cxx - LINK_LIBRARIES GaudiKernel SiClusterizationToolLib ) + LINK_LIBRARIES GaudiKernel PixelConditionsData SiClusterizationToolLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h index 12bdcede03a1c998f7383a4ea6e4c374797525bb..89eff3f69075dc9ff37061edb2f64609139a68b7 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h @@ -2,157 +2,159 @@ Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -//ClusterMaker.h -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Fill the global position fields of the PrepRawData -/////////////////////////////////////////////////////////////////// -// -///////////////////////////////////////////////////////////////////////// -// First version 04/08/2003 Tommaso Lari -// -/////////////////////////////////////////////////////////////////// - -#ifndef INDETRIOMAKER_CLUSTERMAKERTOOL_H -#define INDETRIOMAKER_CLUSTERMAKERTOOL_H - -//#include "GaudiKernel/AlgTool.h" -#include "AthenaBaseComps/AthAlgTool.h" -//#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ToolHandle.h" -#include <vector> -#include "GeoPrimitives/GeoPrimitives.h" -#include "InDetCondServices/ISiLorentzAngleTool.h" - -class IPixelOfflineCalibSvc; -class IPixelCalibSvc; -template <class T> class ServiceHandle; -class Identifier; -class StatusCode; - -namespace InDetDD { - class SiDetectorElement; -} - -class PixelID; - -namespace InDet { - -static const InterfaceID IID_ClusterMakerTool("InDet::ClusterMakerTool", 1, 0); - -class PixelCluster; -class SCT_Cluster; -class SiWidth; - -class ClusterMakerTool : public AthAlgTool { - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// -public: - - ClusterMakerTool(const std::string &type, - const std::string &name, - const IInterface *parent); - ~ClusterMakerTool(); - - static const InterfaceID& interfaceID() { return IID_ClusterMakerTool; }; - - StatusCode initialize(); - - // void SetErrorStrategy(int strategy); - - // Compute the pixel cluster global position, and the error associated - // to the position. - // Called by the pixel clustering tools - // - // Input parameters - // - the cluster Identifier - // - the position in local reference frame - // - the list of identifiers of the Raw Data Objects belonging to the cluster - // - the width of the cluster - // - the module the cluster belongs to - // - wheter the cluster contains ganged pixels - // - the error strategy, currently - // 0: cluster width/sqrt(12.) - // 1: pixel pitch/sqrt(12.) - // 2: parametrized as a function ofpseudorapidity and cluster size - // (default) - // - TOT interpolation variable in local x and y directions - // [ Omegax = TOT1/(TOT1+TOT2), where TOT1 and TOT2 are the sum of the - // charges of the first and last row of the cluster respectively - // Omegay: similar definition with columns rather than rows ] - - PixelCluster* pixelCluster(const Identifier& clusterID, - const Amg::Vector2D& localPos, - const std::vector<Identifier>& rdoList, - const int lvl1a, - const std::vector<int>& totList, - const SiWidth& width, - const InDetDD::SiDetectorElement* element, - bool ganged, - int errorStrategy, - const float omegax, - const float omegay, - bool split = false, - double splitProb1 = 0., - double splitProb2 = 0.) const; - - PixelCluster* pixelCluster(const Identifier& clusterID, - const Amg::Vector2D& localPos, - const std::vector<Identifier>& rdoList, - const int lvl1a, - const std::vector<int>& totList, - const SiWidth& width, - const InDetDD::SiDetectorElement* element, - bool ganged, - int errorStrategy, - const PixelID& pixelID, - bool split = false, - double splitProb1 = 0., - double splitProb2 = 0.) const; - - - - // Computes global position and errors for SCT cluster. - // Called by SCT Clustering tools - // - // Input parameters - // - the cluster Identifier - // - the position in local reference frame - // - the list of identifiers of the Raw Data Objects belonging to the cluster - // - the width of the cluster - // - the module the cluster belongs to - // - the error strategy, currently - // 0: Cluster Width/sqrt(12.) - // 1: Set to a different values for one and two-strip clusters (def.) - - SCT_Cluster* sctCluster(const Identifier& clusterID, - const Amg::Vector2D& localPos, - const std::vector<Identifier>& rdoList, - const SiWidth& width, - const InDetDD::SiDetectorElement* element, - int errorStrategy) const; - -private: - - // mutable MsgStream m_log; - bool m_calibrateCharge; - ServiceHandle<IPixelCalibSvc> m_calibSvc; - ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; - ToolHandle<ISiLorentzAngleTool> m_pixelLorentzAngleTool{this, "PixelLorentzAngleTool", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retreive Lorentz angle of Pixel"}; - ToolHandle<ISiLorentzAngleTool> 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 - - double getPixelCTBPhiError(int layer, int phi, int PhiClusterSize) const; - - -}; - -} - -#endif // INDETRIOMAKER_CLUSTERMAKERTOOL_H +/////////////////////////////////////////////////////////////////// +//ClusterMaker.h +/////////////////////////////////////////////////////////////////// +// (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// +// Fill the global position fields of the PrepRawData +/////////////////////////////////////////////////////////////////// +// +///////////////////////////////////////////////////////////////////////// +// First version 04/08/2003 Tommaso Lari +// +/////////////////////////////////////////////////////////////////// + +#ifndef INDETRIOMAKER_CLUSTERMAKERTOOL_H +#define INDETRIOMAKER_CLUSTERMAKERTOOL_H + +//#include "GaudiKernel/AlgTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +//#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ToolHandle.h" +#include <vector> +#include "GeoPrimitives/GeoPrimitives.h" +#include "InDetCondServices/ISiLorentzAngleTool.h" + +#include "PixelConditionsData/PixelOfflineCalibData.h" +#include "StoreGate/ReadCondHandleKey.h" + +class IPixelCalibSvc; +template <class T> class ServiceHandle; +class Identifier; +class StatusCode; + +namespace InDetDD { + class SiDetectorElement; +} + +class PixelID; + +namespace InDet { + +static const InterfaceID IID_ClusterMakerTool("InDet::ClusterMakerTool", 1, 0); + +class PixelCluster; +class SCT_Cluster; +class SiWidth; + +class ClusterMakerTool : public AthAlgTool { + + /////////////////////////////////////////////////////////////////// + // Public methods: + /////////////////////////////////////////////////////////////////// +public: + + ClusterMakerTool(const std::string &type, + const std::string &name, + const IInterface *parent); + ~ClusterMakerTool(); + + static const InterfaceID& interfaceID() { return IID_ClusterMakerTool; }; + + StatusCode initialize(); + + // void SetErrorStrategy(int strategy); + + // Compute the pixel cluster global position, and the error associated + // to the position. + // Called by the pixel clustering tools + // + // Input parameters + // - the cluster Identifier + // - the position in local reference frame + // - the list of identifiers of the Raw Data Objects belonging to the cluster + // - the width of the cluster + // - the module the cluster belongs to + // - wheter the cluster contains ganged pixels + // - the error strategy, currently + // 0: cluster width/sqrt(12.) + // 1: pixel pitch/sqrt(12.) + // 2: parametrized as a function ofpseudorapidity and cluster size + // (default) + // - TOT interpolation variable in local x and y directions + // [ Omegax = TOT1/(TOT1+TOT2), where TOT1 and TOT2 are the sum of the + // charges of the first and last row of the cluster respectively + // Omegay: similar definition with columns rather than rows ] + + PixelCluster* pixelCluster(const Identifier& clusterID, + const Amg::Vector2D& localPos, + const std::vector<Identifier>& rdoList, + const int lvl1a, + const std::vector<int>& totList, + const SiWidth& width, + const InDetDD::SiDetectorElement* element, + bool ganged, + int errorStrategy, + const float omegax, + const float omegay, + bool split = false, + double splitProb1 = 0., + double splitProb2 = 0.) const; + + PixelCluster* pixelCluster(const Identifier& clusterID, + const Amg::Vector2D& localPos, + const std::vector<Identifier>& rdoList, + const int lvl1a, + const std::vector<int>& totList, + const SiWidth& width, + const InDetDD::SiDetectorElement* element, + bool ganged, + int errorStrategy, + const PixelID& pixelID, + bool split = false, + double splitProb1 = 0., + double splitProb2 = 0.) const; + + + + // Computes global position and errors for SCT cluster. + // Called by SCT Clustering tools + // + // Input parameters + // - the cluster Identifier + // - the position in local reference frame + // - the list of identifiers of the Raw Data Objects belonging to the cluster + // - the width of the cluster + // - the module the cluster belongs to + // - the error strategy, currently + // 0: Cluster Width/sqrt(12.) + // 1: Set to a different values for one and two-strip clusters (def.) + + SCT_Cluster* sctCluster(const Identifier& clusterID, + const Amg::Vector2D& localPos, + const std::vector<Identifier>& rdoList, + const SiWidth& width, + const InDetDD::SiDetectorElement* element, + int errorStrategy) const; + +private: + + // mutable MsgStream m_log; + bool m_calibrateCharge; + ServiceHandle<IPixelCalibSvc> m_calibSvc; + ToolHandle<ISiLorentzAngleTool> m_pixelLorentzAngleTool{this, "PixelLorentzAngleTool", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retreive Lorentz angle of Pixel"}; + ToolHandle<ISiLorentzAngleTool> 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 + + double getPixelCTBPhiError(int layer, int phi, int PhiClusterSize) const; + + SG::ReadCondHandleKey<PixelCalib::PixelOfflineCalibData> m_clusterErrorKey{this, "PixelOfflineCalibData", "PixelOfflineCalibData", "Output key of pixel cluster"}; + +}; + +} + +#endif // INDETRIOMAKER_CLUSTERMAKERTOOL_H diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h index 89a30308d80a335030acf07aff3832f294d5d428..a5f18590501b2a77f1f2600874f69c7e71632504 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h @@ -32,7 +32,6 @@ class IIncidentSvc; class PixelID; //class StoreGateSvc; class IBLParameterSvc; -class IPixelOfflineCalibSvc; namespace InDetDD { class SiDetectorElement; @@ -179,9 +178,7 @@ namespace InDet { mutable unsigned int m_splitOrigClusters; //!< statistics output mutable unsigned int m_splitProdClusters; //!< statistics output mutable unsigned int m_largeClusters; //!< statistics output - mutable int m_overflowIBLToT; std::vector<int> m_minToT; /**< ToT cut */ - ServiceHandle<IPixelOfflineCalibSvc> m_pixofflinecalibSvc; //ServiceHandle< StoreGateSvc > m_detStore; //const PixelID* m_idHelper; }; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx index 8e028f75895751d163022730e6751b0be0646769..bdd77ef758af1e67f99a9a5ef4d11689a1077330 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx @@ -23,7 +23,6 @@ #include "InDetIdentifier/PixelID.h" #include "AtlasDetDescr/AtlasDetectorID.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" #include "PixelConditionsServices/IPixelCalibSvc.h" #include "EventPrimitives/EventPrimitives.h" @@ -48,13 +47,11 @@ ClusterMakerTool::ClusterMakerTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_calibSvc("PixelCalibSvc", n), - m_offlineCalibSvc("PixelOfflineCalibSvc", n) + m_calibSvc("PixelCalibSvc", n) { declareInterface<ClusterMakerTool>(this); declareProperty("UsePixelCalibCondDB",m_calibrateCharge=true,"Compute deposited charge in Pixels"); declareProperty("PixelCalibSvc",m_calibSvc); - declareProperty("PixelOfflineCalibSvc",m_offlineCalibSvc); } //=============== Destructor ================================================= @@ -67,20 +64,6 @@ StatusCode ClusterMakerTool::initialize(){ ATH_MSG_INFO ( name() << " initialize()" ); - // Protect from the situation in which the PixelOfflineCalibSvc is not - // configured: that should be the case if no PixelRDO are read in. - // AA 01/10/2009 - if ( !m_offlineCalibSvc.empty() ) { - StatusCode sc = m_offlineCalibSvc.retrieve(); - if (sc.isFailure() || !m_offlineCalibSvc ) { - ATH_MSG_ERROR( m_offlineCalibSvc.type() << " not found! "); - return StatusCode::RECOVERABLE; - } - else{ - ATH_MSG_INFO ( "Retrieved tool " << m_offlineCalibSvc.type() ); - } - } - // 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 @@ -107,6 +90,8 @@ StatusCode ClusterMakerTool::initialize(){ ATH_CHECK(m_pixelLorentzAngleTool.retrieve()); ATH_CHECK(m_sctLorentzAngleTool.retrieve()); + ATH_CHECK(m_clusterErrorKey.initialize()); + return StatusCode::SUCCESS; } @@ -153,20 +138,9 @@ PixelCluster* ClusterMakerTool::pixelCluster( bool split, double splitProb1, double splitProb2) const{ - // Add protection in case m_offlineCalibSvc is not configured - // but errorStrategy==2 is requested. - // That should never happen, since the m_offlineCalibSvc should be switched - // off only if no pixel data are processed, and therefore no pixel cluster - // should be created. - // AA 01/10/2009 static bool issueError = true; static bool forceErrorStrategy1 = false; if ( errorStrategy==2 && issueError ) { - if ( m_offlineCalibSvc.empty() ) { - ATH_MSG_ERROR ( "Asking for pixel error parameterization, without configuring PixelOfflineCalibSvc" ); - ATH_MSG_ERROR ( "Reverting to error strategy=1" ); - forceErrorStrategy1=true; - } issueError=false; } @@ -232,15 +206,21 @@ PixelCluster* ClusterMakerTool::pixelCluster( // use parameterization only if the cluster does not // contain long pixels or ganged pixels // Also require calibration service is available.... - if(!ganged && zPitch > 399*micrometer && zPitch < 401*micrometer && m_offlineCalibSvc != 0){ + if (!ganged && zPitch>399*micrometer && zPitch<401*micrometer) { + SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> offlineCalibData(m_clusterErrorKey); if(element->isBarrel()){ - errorMatrix->fillSymmetric(0,0,square(m_offlineCalibSvc->getBarrelErrorPhi(eta,int(colRow.y()), - int(colRow.x()))) ); - errorMatrix->fillSymmetric(1,1,square(m_offlineCalibSvc->getBarrelErrorEta(eta, - int(colRow.y()),int(colRow.x()))) ); - }else{ - errorMatrix->fillSymmetric(0,0,square(m_offlineCalibSvc->getEndCapErrorPhi(int(colRow.y()),int(colRow.x())))); - errorMatrix->fillSymmetric(1,1,square(m_offlineCalibSvc->getEndCapErrorEta(int(colRow.y()),int(colRow.x())))); + int ibin = offlineCalibData->getPixelClusterErrorData()->getBarrelBin(eta,int(colRow.y()),int(colRow.x())); + double phiError = offlineCalibData->getPixelClusterErrorData()->getPixelBarrelPhiError(ibin); + double etaError = offlineCalibData->getPixelClusterErrorData()->getPixelBarrelEtaError(ibin); + errorMatrix->fillSymmetric(0,0,square(phiError)); + errorMatrix->fillSymmetric(1,1,square(etaError)); + } + else { + int ibin = offlineCalibData->getPixelClusterErrorData()->getEndcapBin(int(colRow.y()),int(colRow.x())); + double phiError = offlineCalibData->getPixelClusterErrorData()->getPixelEndcapPhiError(ibin); + double etaError = offlineCalibData->getPixelClusterErrorData()->getPixelEndcapRError(ibin); + errorMatrix->fillSymmetric(0,0,square(phiError)); + errorMatrix->fillSymmetric(1,1,square(etaError)); } }else{// cluster with ganged and/or long pixels errorMatrix->fillSymmetric(0,0,square(width.phiR()/colRow.x())*ONE_TWELFTH); @@ -306,20 +286,9 @@ PixelCluster* ClusterMakerTool::pixelCluster( if (msgLvl(MSG::VERBOSE)) msg() << "ClusterMakerTool called, number " << endmsg; - // Add protection in case m_offlineCalibSvc is not configured - // but errorStrategy==2 is requested. - // That should never happen, since the m_offlineCalibSvc should be switched - // off only if no pixel data are processed, and therefore no pixel cluster - // should be created. - // AA 01/10/2009 static bool issueError = true; static bool forceErrorStrategy1 = false; if ( errorStrategy==2 && issueError ) { - if ( m_offlineCalibSvc.empty() ) { - ATH_MSG_ERROR ( "Asking for pixel error parameterization, without configuring PixelOfflineCalibSvc" ); - ATH_MSG_ERROR ( "Reverting to error strategy=1" ); - forceErrorStrategy1=true; - } issueError=false; } if ( errorStrategy==2 && forceErrorStrategy1 ) errorStrategy=1; @@ -429,16 +398,22 @@ PixelCluster* ClusterMakerTool::pixelCluster( // use parameterization only if the cluster does not // contain long pixels or ganged pixels // Also require calibration service is available.... - if(!ganged && zPitch > 399*micrometer && zPitch < 401*micrometer && m_offlineCalibSvc != 0){ + if (!ganged && zPitch>399*micrometer && zPitch<401*micrometer) { - if(element->isBarrel()){ - errorMatrix->fillSymmetric(0,0,pow(m_offlineCalibSvc->getBarrelErrorPhi(eta,int(colRow.y()), - int(colRow.x())),2) ); - errorMatrix->fillSymmetric(1,1,pow(m_offlineCalibSvc->getBarrelErrorEta(eta, - int(colRow.y()),int(colRow.x())),2) ); - }else{ - errorMatrix->fillSymmetric(0,0,square(m_offlineCalibSvc->getEndCapErrorPhi(int(colRow.y()),int(colRow.x())))); - errorMatrix->fillSymmetric(1,1,square(m_offlineCalibSvc->getEndCapErrorEta(int(colRow.y()),int(colRow.x())))); + SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> offlineCalibData(m_clusterErrorKey); + if (element->isBarrel()) { + int ibin = offlineCalibData->getPixelClusterErrorData()->getBarrelBin(eta,int(colRow.y()),int(colRow.x())); + double phiError = offlineCalibData->getPixelClusterErrorData()->getPixelBarrelPhiError(ibin); + double etaError = offlineCalibData->getPixelClusterErrorData()->getPixelBarrelEtaError(ibin); + errorMatrix->fillSymmetric(0,0,pow(phiError,2)); + errorMatrix->fillSymmetric(1,1,pow(etaError,2)); + } + else { + int ibin = offlineCalibData->getPixelClusterErrorData()->getEndcapBin(int(colRow.y()),int(colRow.x())); + double phiError = offlineCalibData->getPixelClusterErrorData()->getPixelEndcapPhiError(ibin); + double etaError = offlineCalibData->getPixelClusterErrorData()->getPixelEndcapRError(ibin); + errorMatrix->fillSymmetric(0,0,square(phiError)); + errorMatrix->fillSymmetric(1,1,square(etaError)); } }else{// cluster with ganged and/or long pixels errorMatrix->fillSymmetric(0,0,square(width.phiR()/colRow.x())*ONE_TWELFTH); diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx index 68db28d94e8bf48e1f2a6f2f5ff4f9976814183a..0715350d03a0ad8a6a57959969ef2f0390f7b859 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx @@ -37,7 +37,6 @@ #include "InDetConditionsSummaryService/IInDetConditionsTool.h" #include "TrkSurfaces/RectangleBounds.h" #include "PixelGeoModel/IBLParameterSvc.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" #include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" @@ -75,9 +74,7 @@ namespace InDet { m_splitOrigClusters(0), m_splitProdClusters(0), m_largeClusters(0), - m_overflowIBLToT(0), - m_minToT({0,0,0,0,0,0,0}), - m_pixofflinecalibSvc("PixelOfflineCalibSvc", name) + m_minToT({0,0,0,0,0,0,0}) //m_detStore("DetectorStore", name), //m_idHelper(0) { @@ -118,7 +115,6 @@ namespace InDet { // for the cluster splitting ATH_CHECK(m_splitProbTool.retrieve( EnableTool{not m_splitProbTool.empty()})); ATH_CHECK(m_clusterSplitter.retrieve( EnableTool{not m_clusterSplitter.empty()} )); - ATH_CHECK(m_pixofflinecalibSvc.retrieve()); if (m_minToT.size() != 7){ ATH_MSG_ERROR("Number of entries for ToT Cut is:" << m_minToT.size() << " . 7 Values are needed, so fix jO."); @@ -684,8 +680,6 @@ PixelCluster* MergedPixelsTool::makeCluster std::vector<int>::const_iterator tot = totgroup.begin(); std::vector<int>::const_iterator lvl1= lvl1group.begin(); - if(m_IBLParameterSvc->containsIBL()) m_overflowIBLToT = m_pixofflinecalibSvc->getIBLToToverflow(); - // Flag to tag clusters with any ganged pixel bool hasGanged = false; for (; rdosBegin!= rdosEnd; ++rdosBegin) @@ -708,10 +702,6 @@ PixelCluster* MergedPixelsTool::makeCluster // check overflow for IBL int realtot = *tot; - if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(rId) == 0 && pixelID.layer_disk(rId) == 0 ) { - if (*tot >= m_overflowIBLToT ) realtot = m_overflowIBLToT; - msg(MSG::DEBUG) << "barrel_ec = " << pixelID.barrel_ec(rId) << " layer_disque = " << pixelID.layer_disk(rId) << " ToT = " << *tot << " Real ToT = " << realtot << endmsg; - } if (row == rowMin) qRowMin += realtot; if (row < rowMin){ diff --git a/Trigger/TrigFTK/FTK_DataProviderSvc/CMakeLists.txt b/Trigger/TrigFTK/FTK_DataProviderSvc/CMakeLists.txt index a9af307651ba540bf4529092fc0c82cd8373c115..d70894825a1f2bf74555457705b41b4015a300d5 100644 --- a/Trigger/TrigFTK/FTK_DataProviderSvc/CMakeLists.txt +++ b/Trigger/TrigFTK/FTK_DataProviderSvc/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC # Event/xAOD/xAODViews GaudiKernel InnerDetector/InDetConditions/InDetCondServices + InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetRecEvent/InDetPrepRawData InnerDetector/InDetRecEvent/InDetRIO_OnTrack Tools/PyJobTransforms @@ -58,12 +59,12 @@ atlas_add_library( FTK_DataProviderSvcLib PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkTrack FTK_DataProviderInterfaces TrigFTK_RawData StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AtlasDetDescr GeoPrimitives IRegionSelector RoiDescriptor EventInfo GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkVertexFitterInterfaces TrkFitterUtils TrkToolInterfaces ) + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AtlasDetDescr GeoPrimitives IRegionSelector RoiDescriptor EventInfo GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkVertexFitterInterfaces TrkFitterUtils TrkToolInterfaces PixelConditionsData) atlas_add_component( FTK_DataProviderSvc src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps StoreGateLib SGtests xAODTracking GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkTrack FTK_DataProviderInterfaces TrigFTK_RawData AtlasDetDescr GeoPrimitives IRegionSelector RoiDescriptor EventInfo GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkVertexFitterInterfaces TrkFitterUtils TrkToolInterfaces FTK_DataProviderSvcLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps StoreGateLib SGtests xAODTracking GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkTrack FTK_DataProviderInterfaces TrigFTK_RawData AtlasDetDescr GeoPrimitives IRegionSelector RoiDescriptor EventInfo GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkVertexFitterInterfaces TrkFitterUtils TrkToolInterfaces FTK_DataProviderSvcLib PixelConditionsData) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigFTK/FTK_DataProviderSvc/FTK_DataProviderSvc/FTK_DataProviderSvc.h b/Trigger/TrigFTK/FTK_DataProviderSvc/FTK_DataProviderSvc/FTK_DataProviderSvc.h index 9ab889e79f7744847d946dfdc5b5273970a6474f..93ba02c47ca61b99b0c29945960a70745a0ad350 100644 --- a/Trigger/TrigFTK/FTK_DataProviderSvc/FTK_DataProviderSvc/FTK_DataProviderSvc.h +++ b/Trigger/TrigFTK/FTK_DataProviderSvc/FTK_DataProviderSvc/FTK_DataProviderSvc.h @@ -37,6 +37,7 @@ #include "xAODTracking/TrackParticleContainer.h" #include "FTK_DataProviderInterfaces/IFTK_UncertaintyTool.h" #include "FTK_RecToolInterfaces/IFTK_DuplicateTrackRemovalTool.h" +#include "PixelConditionsData/PixelOfflineCalibData.h" #include "InDetCondServices/ISiLorentzAngleTool.h" #include <mutex> @@ -48,7 +49,6 @@ class PixelID; class SCT_ID; class Identifier; class IdentifierHash; -class IPixelOfflineCalibSvc; class IRoiDescriptor; //class IFTK_UncertaintyTool; class PRD_MultiTruthCollection; @@ -164,7 +164,6 @@ class FTK_DataProviderSvc : public virtual IFTK_DataProviderSvc, virtual public std::string m_RDO_key; StoreGateSvc* m_storeGate; - ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; const PixelID* m_pixelId; const SCT_ID* m_sctId; @@ -172,6 +171,7 @@ class FTK_DataProviderSvc : public virtual IFTK_DataProviderSvc, virtual public const AtlasDetectorID* m_id_helper; + SG::ReadCondHandleKey<PixelCalib::PixelOfflineCalibData> m_clusterErrorKey{this, "PixelOfflineCalibData", "PixelOfflineCalibData", "Output key of pixel cluster"}; SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}; ToolHandle<IFTK_UncertaintyTool> m_uncertaintyTool; diff --git a/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx b/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx index d7ca082d3ef47fcf6b40059733e7647908063621..83f3ebdf22a7b659cee80b907106c2fc4cf14a90 100644 --- a/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx +++ b/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx @@ -49,7 +49,6 @@ #include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/ServiceHandle.h" #include "TrkFitterInterfaces/ITrackFitter.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" #include "TrkToolInterfaces/ITrackSummaryTool.h" #include "TrkTrackSummary/TrackSummary.h" #include "FTK_RecToolInterfaces/IFTK_DuplicateTrackRemovalTool.h" @@ -95,7 +94,6 @@ FTK_DataProviderSvc::FTK_DataProviderSvc(const std::string& name, ISvcLocator* s AthService(name, svc), m_RDO_key("FTK_RDO_Tracks"), m_storeGate(0), - m_offlineCalibSvc("PixelOfflineCalibSvc", name), m_pixelId(0), m_sctId(0), m_pixelManager(0), @@ -247,7 +245,7 @@ StatusCode FTK_DataProviderSvc::initialize() { ATH_CHECK(service( "StoreGateSvc", m_storeGate )); StoreGateSvc* detStore; ATH_CHECK(service("DetectorStore", detStore)); - ATH_CHECK(m_offlineCalibSvc.retrieve()); + ATH_CHECK(m_clusterErrorKey.initialize()); ATH_CHECK(detStore->retrieve(m_pixelId, "PixelID")); ATH_CHECK(detStore->retrieve(m_sctId, "SCT_ID")); ATH_CHECK(detStore->retrieve(m_pixelManager)); @@ -1944,46 +1942,42 @@ const Trk::RIO_OnTrack* FTK_DataProviderSvc::createPixelCluster(const FTK_RawPi ATH_MSG_VERBOSE("Setting defaulterrors (*cov)(0,0) " << (*cov)(0,0) << " (*cov)(1,1)" << (*cov)(1,1) ); - if(m_offlineCalibSvc != 0) { - ATH_MSG_VERBOSE("Using offlineCalibSvc" ); - const Amg::Vector2D& colRow = siWidth.colRow(); - double averageZPitch = siWidth.z()/colRow.y(); - ATH_MSG_VERBOSE(" siWidth.colRow() " << siWidth.colRow()); - ATH_MSG_VERBOSE(" siWidth.z() " << siWidth.z() << " colRow.y() " << colRow.y() << " averageZpitch " << averageZPitch ); - - - // use parameterization only if the cluster does not - // contain long pixels or ganged pixels - // Also require calibration service is available.... - - double eta = -std::log(std::tan(trkPerigee.parameters()[Trk::theta]/2.)); - - - if(averageZPitch > 399*micrometer && averageZPitch < 401*micrometer){ - if(pixelDetectorElement->isBarrel()){ - // Barrel corrections // - (*cov)(0,0) = square(m_offlineCalibSvc->getBarrelErrorPhi(eta,int(colRow.y()),int(colRow.x()))); - (*cov)(1,1) = square(m_offlineCalibSvc->getBarrelErrorEta(eta,int(colRow.y()),int(colRow.x()))); - ATH_MSG_VERBOSE("Barrel Corrections " << (*cov)(0,0)<< " " << (*cov)(1,1) ); - } else{ - // End-cap corrections // - (*cov)(0,0) = square(m_offlineCalibSvc->getEndCapErrorPhi(int(colRow.y()),int(colRow.x()))); - (*cov)(1,1) = square(m_offlineCalibSvc->getEndCapErrorEta(int(colRow.y()),int(colRow.x()))); - ATH_MSG_VERBOSE("Endcap Corrections " << (*cov)(0,0)<< " " << (*cov)(1,1) ); - } - } else { - ATH_MSG_VERBOSE(" Corrections for pixel with length!=400um " << averageZPitch); - (*cov)(0,0) = square(siWidth.phiR()/colRow.x()) * ONE_TWELFTH ; - (*cov)(1,1) = square(averageZPitch)* ONE_TWELFTH ; + ATH_MSG_VERBOSE("Using offlineCalibSvc" ); + const Amg::Vector2D& colRow = siWidth.colRow(); + double averageZPitch = siWidth.z()/colRow.y(); + ATH_MSG_VERBOSE(" siWidth.colRow() " << siWidth.colRow()); + ATH_MSG_VERBOSE(" siWidth.z() " << siWidth.z() << " colRow.y() " << colRow.y() << " averageZpitch " << averageZPitch ); + + // use parameterization only if the cluster does not + // contain long pixels or ganged pixels + // Also require calibration service is available.... + + double eta = -std::log(std::tan(trkPerigee.parameters()[Trk::theta]/2.)); + + if(averageZPitch > 399*micrometer && averageZPitch < 401*micrometer){ + SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> offlineCalibData(m_clusterErrorKey); + if(pixelDetectorElement->isBarrel()){ + // Barrel corrections // + int ibin = offlineCalibData->getPixelClusterErrorData()->getBarrelBin(eta,int(colRow.y()),int(colRow.x())); + (*cov)(0,0) = square(offlineCalibData->getPixelClusterErrorData()->getPixelBarrelPhiError(ibin)); + (*cov)(1,1) = square(offlineCalibData->getPixelClusterErrorData()->getPixelBarrelEtaError(ibin)); + ATH_MSG_VERBOSE("Barrel Corrections " << (*cov)(0,0)<< " " << (*cov)(1,1) ); + } else{ + // End-cap corrections // + int ibin = offlineCalibData->getPixelClusterErrorData()->getEndcapBin(int(colRow.y()),int(colRow.x())); + (*cov)(0,0) = square(offlineCalibData->getPixelClusterErrorData()->getPixelEndcapPhiError(ibin)); + (*cov)(1,1) = square(offlineCalibData->getPixelClusterErrorData()->getPixelEndcapRError(ibin)); + ATH_MSG_VERBOSE("Endcap Corrections " << (*cov)(0,0)<< " " << (*cov)(1,1) ); } + } else { + ATH_MSG_VERBOSE(" Corrections for pixel with length!=400um " << averageZPitch); + (*cov)(0,0) = square(siWidth.phiR()/colRow.x()) * ONE_TWELFTH ; + (*cov)(1,1) = square(averageZPitch)* ONE_TWELFTH ; } - InDet::PixelCluster* pixel_cluster = new InDet::PixelCluster(pixel_id, position, rdoList, siWidth, - pixelDetectorElement, cov); + InDet::PixelCluster* pixel_cluster = new InDet::PixelCluster(pixel_id, position, rdoList, siWidth, pixelDetectorElement, cov); ATH_MSG_VERBOSE("covariance " << (*cov)(0,0) << ", " << (*cov)(0,1)); ATH_MSG_VERBOSE(" " << (*cov)(1,0) << ", " << (*cov)(1,1)) ; - - const IdentifierHash idHash = m_pixelId->wafer_hash(m_pixelId->wafer_id(pixel_cluster->identify())); ATH_MSG_VERBOSE(" hash " << hash << " wafer hash " << idHash); diff --git a/Trigger/TrigFTK/FTK_RecTools/CMakeLists.txt b/Trigger/TrigFTK/FTK_RecTools/CMakeLists.txt index 3ebb84df0d70d8fcc16e40c458f42844c48f1358..d7f5090807e90a7e7471eb7b14f6787f4533a494 100644 --- a/Trigger/TrigFTK/FTK_RecTools/CMakeLists.txt +++ b/Trigger/TrigFTK/FTK_RecTools/CMakeLists.txt @@ -31,6 +31,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventPrimitives InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetConditions/PixelConditionsTools + InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetDetDescr/PixelGeoModel @@ -46,10 +47,10 @@ atlas_add_library( FTK_RecToolsLib src/*.cxx PUBLIC_HEADERS FTK_RecTools INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GeoPrimitives xAODTracking TrkTrack VxVertex FTK_DataProviderInterfaces TrigFTK_RawData TrkVxEdmCnvLib InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkRIO_OnTrack TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GeoPrimitives xAODTracking TrkTrack VxVertex FTK_DataProviderInterfaces TrigFTK_RawData TrkVxEdmCnvLib InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkRIO_OnTrack TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces PixelConditionsData) atlas_add_component( FTK_RecTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GeoPrimitives xAODTracking TrkTrack VxVertex TrkVxEdmCnvLib FTK_DataProviderInterfaces TrigFTK_RawData TrkParameters FTK_RecToolsLib InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GeoPrimitives xAODTracking TrkTrack VxVertex TrkVxEdmCnvLib FTK_DataProviderInterfaces TrigFTK_RawData TrkParameters FTK_RecToolsLib InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces PixelConditionsData) diff --git a/Trigger/TrigFTK/FTK_RecTools/FTK_RecTools/FTK_PixelClusterOnTrackTool.h b/Trigger/TrigFTK/FTK_RecTools/FTK_RecTools/FTK_PixelClusterOnTrackTool.h index 52e7264be7a7678f49c615c96a72611b7d69e5e1..fa49834ec70436131fd982e99b0017c2a4060029 100644 --- a/Trigger/TrigFTK/FTK_RecTools/FTK_RecTools/FTK_PixelClusterOnTrackTool.h +++ b/Trigger/TrigFTK/FTK_RecTools/FTK_RecTools/FTK_PixelClusterOnTrackTool.h @@ -24,13 +24,12 @@ #include "TrkAmbiguityProcessor/dRMap.h" #include "SiClusterizationTool/NnClusterizationFactory.h" -//#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" //#include "PixelConditionsTools/IModuleDistortionsTool.h" +#include "PixelConditionsData/PixelOfflineCalibData.h" #include "InDetCondServices/ISiLorentzAngleTool.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" class PixelID; -class IPixelOfflineCalibSvc; class IModuleDistortionsTool; class StoreGateSvc; @@ -132,7 +131,6 @@ public: ToolHandle<IModuleDistortionsTool> m_pixDistoTool ; ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{this, "LorentzAngleTool", "SiLorentzAngleTool", "Tool to retreive Lorentz angle"}; - ServiceHandle<IPixelOfflineCalibSvc> m_calibSvc ; StoreGateSvc* m_detStore ; /* ME: Test histos have nothing to do with production code, use a flag IHistogram1D* m_h_Resx; @@ -147,6 +145,7 @@ public: //! toolhandle for central error scaling //! flag storing if errors need scaling or should be kept nominal + SG::ReadCondHandleKey<PixelCalib::PixelOfflineCalibData> m_clusterErrorKey{this, "PixelOfflineCalibData", "PixelOfflineCalibData", "Output key of pixel cluster"}; SG::ReadCondHandleKey<RIO_OnTrackErrorScaling> m_pixelErrorScalingKey {this,"PixelErrorScalingKey", "" /* "/Indet/TrkErrorScalingPixel" */, "Key for pixel error scaling conditions data. No error scaling if empty"}; diff --git a/Trigger/TrigFTK/FTK_RecTools/src/FTK_PixelClusterOnTrackTool.cxx b/Trigger/TrigFTK/FTK_RecTools/src/FTK_PixelClusterOnTrackTool.cxx index 1feeca9b5dfc65595b915ef9f0362cc96e4b7028..73059acead54d8191fae3809feb940d528fb4512 100644 --- a/Trigger/TrigFTK/FTK_RecTools/src/FTK_PixelClusterOnTrackTool.cxx +++ b/Trigger/TrigFTK/FTK_RecTools/src/FTK_PixelClusterOnTrackTool.cxx @@ -14,7 +14,6 @@ #include "FTK_RecTools/FTK_PixelClusterOnTrackTool.h" #include "InDetReadoutGeometry/PixelModuleDesign.h" #include "InDetIdentifier/PixelID.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" #include "PixelConditionsTools/IModuleDistortionsTool.h" #include "TrkSurfaces/PlaneSurface.h" #include "StoreGate/StoreGateSvc.h" @@ -70,7 +69,6 @@ FTK_PixelClusterOnTrackTool::FTK_PixelClusterOnTrackTool (const std::string &t, const std::string &n, const IInterface *p) : ::AthAlgTool(t, n, p), m_pixDistoTool("PixelDistortionsTool", this), - m_calibSvc("PixelOfflineCalibSvc", n), m_detStore(nullptr), m_disableDistortions(false), m_rel13like(false), @@ -95,7 +93,6 @@ FTK_PixelClusterOnTrackTool::FTK_PixelClusterOnTrackTool declareProperty("ErrorStrategy", m_errorStrategy = 2, "Which calibration of cluster position errors"); declareProperty("DisableDistortions", m_disableDistortions, "Disable simulation of module distortions"); declareProperty("Release13like", m_rel13like, "Activate release-13 like settigs"); - declareProperty("PixelOfflineCalibSvc", m_calibSvc, "Offline calibration svc"); declareProperty("applyNNcorrection", m_applyNNcorrection); declareProperty("applydRcorrection", m_applydRcorrection); declareProperty("NNIBLcorrection", m_NNIBLcorrection); @@ -134,13 +131,7 @@ FTK_PixelClusterOnTrackTool::initialize() { m_IBLParameterSvc->setBoolParameters(m_IBLAbsent, "IBLAbsent"); } - // get the offline calibration service - sc = m_calibSvc.retrieve(); - if (sc.isFailure() || !m_calibSvc) { - ATH_MSG_ERROR(m_calibSvc.type() << " not found! "); - } else { - ATH_MSG_INFO("Retrieved tool " << m_calibSvc.type()); - } + ATH_CHECK(m_clusterErrorKey.initialize()); // get the error scaling tool if (!m_pixelErrorScalingKey.key().empty()) { @@ -422,7 +413,9 @@ FTK_PixelClusterOnTrackTool::correctDefault double eta = 999.; ATH_MSG_VERBOSE(" row " << row << " col " << col << " nrows " << nrows << " ncol " << ncol << " locX " << centroid.xPhi() << " locY " << centroid.xEta()); - + + SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> offlineCalibData(m_clusterErrorKey); + // ATH_MSG_VERBOSE ( << "Position strategy = " // << m_positionStrategy << "omegaphi = " << omegaphi ) @@ -436,7 +429,7 @@ FTK_PixelClusterOnTrackTool::correctDefault ang = 180 * angle * M_1_PI; //M_1_PI in cmath, = 1/pi double delta = 0.; if (m_IBLAbsent || !blayer) { - delta = m_calibSvc->getBarrelDeltaX(nrows, ang); + delta = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaXbarrel(nrows, ang, 1); } else { // special calibration for IBL if (angle < m_phix[0] || angle > m_phix[NBINPHI] || nrows != 2) { delta = 0.; @@ -451,8 +444,8 @@ FTK_PixelClusterOnTrackTool::correctDefault ATH_MSG_ERROR("bin out of range in line " << __LINE__ << " of FTK_PixelClusterOnTrackTool.cxx."); } } - if (m_calibSvc->includesIBLParams()) { - delta = m_calibSvc->getIBLDeltaX(nrows, ang); + if (offlineCalibData->getPixelChargeInterpolationParameters()->getVersion()<-1) { + delta = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaXbarrel(nrows, ang, 0); } } localphi += delta * (omegaphi - 0.5); @@ -468,8 +461,8 @@ FTK_PixelClusterOnTrackTool::correctDefault } double etaloc = -1 * log(tan(thetaloc * 0.5)); if (m_IBLAbsent || !blayer) { - delta = m_calibSvc->getBarrelDeltaY(ncol, etaloc); - ATH_MSG_VERBOSE(" Barrel Pixel: shifting localeta by delta * (omegaeta - 0.5) = " << delta << " * " << (omegaeta - 0.5)); + delta = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaYbarrel(ncol, etaloc, 1); + ATH_MSG_VERBOSE(" Barrel Pixel: shifting localeta by delta * (omegaeta - 0.5) = " << delta << " * " << (omegaeta - 0.5)); } else { // special calibration for IBL etaloc = fabs(etaloc); if (etaloc < m_etax[0] || etaloc > m_etax[NBINETA]) { @@ -494,8 +487,8 @@ FTK_PixelClusterOnTrackTool::correctDefault } } - if (m_calibSvc->includesIBLParams()) { - delta = m_calibSvc->getIBLDeltaY(ncol, etaloc); + if (offlineCalibData->getPixelChargeInterpolationParameters()->getVersion()<-1) { + delta = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaYbarrel(ncol, std::fabs(etaloc), 0); } ATH_MSG_VERBOSE(" IBL: shifting localeta by delta * (omegaeta - 0.5) = " << delta << " * " << (omegaeta - 0.5)); } @@ -503,8 +496,8 @@ FTK_PixelClusterOnTrackTool::correctDefault }else { // collision endcap data if (m_positionStrategy == 1) { - double deltax = m_calibSvc->getEndcapDeltaX(); - double deltay = m_calibSvc->getEndcapDeltaY(); + double deltax = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaXendcap(); + double deltay = offlineCalibData->getPixelChargeInterpolationParameters()->getDeltaYendcap(); localphi += deltax * (omegaphi - 0.5); localeta += deltay * (omegaeta - 0.5); ATH_MSG_VERBOSE(" endcap pixel shifting localphi by deltax * (omegaphi - 0.5) = " << deltax << " * " << (omegaphi - 0.5)); @@ -552,7 +545,8 @@ FTK_PixelClusterOnTrackTool::correctDefault }else if (m_errorStrategy == 2) { if (element->isBarrel()) { if (m_IBLAbsent || !blayer) { - errphi = m_calibSvc->getBarrelNewErrorPhi(ang, nrows); + int ibin = offlineCalibData->getPixelClusterOnTrackErrorData()->getBarrelBinPhi(ang, nrows); + errphi = offlineCalibData->getPixelClusterOnTrackErrorData()->getPixelBarrelPhiError(ibin); } else { // special calibration for IBL if (angle < m_phix[0] || angle > m_phix[NBINPHI]) { errphi = width.phiR() * TOPHAT_SIGMA; @@ -576,9 +570,11 @@ FTK_PixelClusterOnTrackTool::correctDefault } if (m_rel13like) { - erreta = m_calibSvc->getBarrelErrorEta(eta, ncol, nrows); + int ibin = offlineCalibData->getPixelClusterErrorData()->getBarrelBin(eta, ncol, nrows); + erreta = offlineCalibData->getPixelClusterErrorData()->getPixelBarrelEtaError(ibin); }else if (m_IBLAbsent || !blayer) { - erreta = m_calibSvc->getBarrelNewErrorEta(fabs(etatrack), nrows, ncol); + int ibin = offlineCalibData->getPixelClusterOnTrackErrorData()->getBarrelBinEta(std::fabs(etatrack), ncol, nrows); + erreta = offlineCalibData->getPixelClusterOnTrackErrorData()->getPixelBarrelEtaError(ibin); } else { // special calibration for IBL double etaloc = fabs(etatrack); if (etaloc < m_etax[0] || etaloc > m_etax[NBINETA]) { @@ -604,8 +600,9 @@ FTK_PixelClusterOnTrackTool::correctDefault } } }else { - errphi = m_calibSvc->getEndCapErrorPhi(ncol, nrows); - erreta = m_calibSvc->getEndCapErrorEta(ncol, nrows); + int ibin = offlineCalibData->getPixelClusterErrorData()->getEndcapBin(ncol, nrows); + errphi = offlineCalibData->getPixelClusterErrorData()->getPixelEndcapPhiError(ibin); + erreta = offlineCalibData->getPixelClusterErrorData()->getPixelEndcapRError(ibin); } if (errphi > erreta) { erreta = width.z() * TOPHAT_SIGMA; diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/CMakeLists.txt b/Trigger/TrigTools/TrigFTKTrackConverter/CMakeLists.txt index e18120c0eb33ca0f1e8152c1ef738823885fde65..5088367e987ec13fd2e355d98a0d2d3279a475e3 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/CMakeLists.txt +++ b/Trigger/TrigTools/TrigFTKTrackConverter/CMakeLists.txt @@ -10,6 +10,7 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps GaudiKernel InnerDetector/InDetConditions/InDetCondServices + InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetConditions/PixelConditionsServices Tracking/TrkFitter/TrkFitterInterfaces Tracking/TrkFitter/TrkFitterUtils @@ -37,7 +38,7 @@ atlas_add_component( TrigFTKTrackConverter src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel TrkFitterInterfaces TrkFitterUtils TrigFTKSimLib StoreGateLib SGtests AtlasDetDescr GeoPrimitives GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRIO_OnTrack TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTruthData ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel TrkFitterInterfaces TrkFitterUtils TrigFTKSimLib StoreGateLib SGtests AtlasDetDescr GeoPrimitives GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRIO_OnTrack TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTruthData PixelConditionsData) # Install files from the package: atlas_install_headers( TrigFTKTrackConverter ) diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/TrigFTKTrackConverter/TrigFTKClusterConverterTool.h b/Trigger/TrigTools/TrigFTKTrackConverter/TrigFTKTrackConverter/TrigFTKClusterConverterTool.h index 0bf0a5e524c5e0a251624acb5ae778d526b21bf0..90ca00657d758e4fe1741ee8dd63c0eb19f02183 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/TrigFTKTrackConverter/TrigFTKClusterConverterTool.h +++ b/Trigger/TrigTools/TrigFTKTrackConverter/TrigFTKTrackConverter/TrigFTKClusterConverterTool.h @@ -12,7 +12,7 @@ #include "InDetCondServices/ISiLorentzAngleTool.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" +#include "PixelConditionsData/PixelOfflineCalibData.h" #include "StoreGate/ReadCondHandleKey.h" #include "TrigFTKSim/FTKTrack.h" #include "TrkFitterInterfaces/ITrackFitter.h" @@ -69,8 +69,6 @@ class TrigFTKClusterConverterTool : public AthAlgTool, virtual public ITrigFTKCl private: - ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; - bool m_usePixelCalibSvc; StoreGateSvc* m_evtStore; @@ -84,6 +82,7 @@ private: ToolHandle<ISiLorentzAngleTool> m_sctLorentzAngleTool{this, "SCTLorentzAngleTool", "SiLorentzAngleTool/SCTLorentzAngleTool", "Tool to retreive Lorentz angle of SCT"}; ToolHandle<Trk::ITrackFitter> m_trackFitter; + SG::ReadCondHandleKey<PixelCalib::PixelOfflineCalibData> m_clusterErrorKey{this, "PixelOfflineCalibData", "PixelOfflineCalibData", "Output key of pixel cluster"}; SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_SCTDetEleCollKey{this, "SCTDetEleCollKey", "SCT_DetectorElementCollection", "Key of SiDetectorElementCollection for SCT"}; bool m_doFit; diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/TrigFTKTrackConverter/TrigFTKTrackConverter.h b/Trigger/TrigTools/TrigFTKTrackConverter/TrigFTKTrackConverter/TrigFTKTrackConverter.h index a76b12b3867bdb2164fa88a9784a827bda7f634f..47666cc7edeb8fe9121bb78e0ab7568e5cbb4640 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/TrigFTKTrackConverter/TrigFTKTrackConverter.h +++ b/Trigger/TrigTools/TrigFTKTrackConverter/TrigFTKTrackConverter/TrigFTKTrackConverter.h @@ -17,7 +17,6 @@ #include "TrkFitterInterfaces/ITrackFitter.h" #include "TrkFitterUtils/FitterTypes.h" -#include "PixelConditionsServices/IPixelOfflineCalibSvc.h" class StoreGateSvc; @@ -66,10 +65,6 @@ class TrigFTKTrackConverter : public AthAlgTool, virtual public ITrigFTKTrackCon private: - ServiceHandle<IPixelOfflineCalibSvc> m_offlineCalibSvc; - - bool m_usePixelCalibSvc; - StoreGateSvc* m_evtStore; const PixelID* m_pixelId; diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/python/TrigFTKTrackConverter_Config.py b/Trigger/TrigTools/TrigFTKTrackConverter/python/TrigFTKTrackConverter_Config.py index 0f856242010eabb41297fbff6c2259ce03a1cccd..0030fd1b73887eda8cb5e53f996f969399b9b92e 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/python/TrigFTKTrackConverter_Config.py +++ b/Trigger/TrigTools/TrigFTKTrackConverter/python/TrigFTKTrackConverter_Config.py @@ -16,8 +16,6 @@ class ConfiguredTrigFTKTrackConverter(TrigFTKTrackConverter) : self.TrackFitter = myTrackFitter self.UsePixelCalibSvc = UsePixelCalibSvc - self.PixelOfflineCalibSvc = PixelConditionsSetup.instanceName('PixelOfflineCalibSvc') - class ConfiguredTrigFTKTrackConverterWithGX2(TrigFTKTrackConverter) : def __init__(self, name = "ConfiguredTrigFTKTrackConverter", DoTrackFit = False, DoTruth = False, TrackFitter = None, UsePixelCalibSvc = True): @@ -56,7 +54,6 @@ class ConfiguredTrigFTKTrackConverterWithGX2(TrigFTKTrackConverter) : self.TrackFitter = TrigFTKTrackFitter self.UsePixelCalibSvc = UsePixelCalibSvc - self.PixelOfflineCalibSvc = PixelConditionsSetup.instanceName('PixelOfflineCalibSvc') from TrigFTKTrackConverter.TrigFTKTrackConverterConf import TrigFTKUncertiantyTool diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKClusterConverterTool.cxx b/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKClusterConverterTool.cxx index e09af4749f6ee0979984fc69155449a8b478ee9d..d8c3587461c91ab1fd448ff9889cfab8119da64d 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKClusterConverterTool.cxx +++ b/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKClusterConverterTool.cxx @@ -55,7 +55,6 @@ TrigFTKClusterConverterTool::TrigFTKClusterConverterTool(const std::string& t, const std::string& n, const IInterface* p ): AthAlgTool(t,n,p), - m_offlineCalibSvc("PixelOfflineCalibSvc", n), m_usePixelCalibSvc(true), m_trackFitter("Trk::DistributedKalmanFilter/InDetTrackFitter"), m_doFit(false), @@ -67,7 +66,6 @@ TrigFTKClusterConverterTool::TrigFTKClusterConverterTool(const std::string& t, m_cacheSCTElements{} { declareInterface< ITrigFTKClusterConverterTool >( this ); - declareProperty( "PixelOfflineCalibSvc",m_offlineCalibSvc); declareProperty( "UsePixelCalibSvc",m_usePixelCalibSvc); declareProperty( "TrackFitter",m_trackFitter); declareProperty( "DoFit",m_doFit); @@ -81,17 +79,7 @@ StatusCode TrigFTKClusterConverterTool::initialize() { StatusCode sc = AlgTool::initialize(); if(m_usePixelCalibSvc) { - - if ( !m_offlineCalibSvc.empty() ) { - StatusCode sc = m_offlineCalibSvc.retrieve(); - if (sc.isFailure() || !m_offlineCalibSvc ) { - ATH_MSG_ERROR(m_offlineCalibSvc.type() << " not found! "); - return sc; - } - else{ - ATH_MSG_INFO("Retrieved tool " << m_offlineCalibSvc.type()); - } - } + ATH_CHECK(m_clusterErrorKey.initialize()); } if(m_doTruth) { sc = service( "StoreGateSvc", m_evtStore ); @@ -312,15 +300,18 @@ InDet::PixelCluster* TrigFTKClusterConverterTool::createPixelCluster(IdentifierH const Amg::Vector2D& colRow = siWidth.colRow(); double averageZPitch = siWidth.z()/colRow.y(); - if(averageZPitch > 399*micrometer && averageZPitch < 401*micrometer && m_offlineCalibSvc != 0){ + if(averageZPitch > 399*micrometer && averageZPitch < 401*micrometer){ + SG::ReadCondHandle<PixelCalib::PixelOfflineCalibData> offlineCalibData(m_clusterErrorKey); if(pDE->isBarrel()){ - (*cov)(0,0) = pow(m_offlineCalibSvc->getBarrelErrorPhi(eta,int(colRow.y()),int(colRow.x())),2); - (*cov)(1,1) = pow(m_offlineCalibSvc->getBarrelErrorEta(eta,int(colRow.y()),int(colRow.x())),2); + int ibin = offlineCalibData->getPixelClusterErrorData()->getBarrelBin(eta,int(colRow.y()),int(colRow.x())); + (*cov)(0,0) = pow(offlineCalibData->getPixelClusterErrorData()->getPixelBarrelPhiError(ibin),2); + (*cov)(1,1) = pow(offlineCalibData->getPixelClusterErrorData()->getPixelBarrelEtaError(ibin),2); } else{ - (*cov)(0,0) = pow(m_offlineCalibSvc->getEndCapErrorPhi(int(colRow.y()),int(colRow.x())),2); - (*cov)(1,1) = pow(m_offlineCalibSvc->getEndCapErrorEta(int(colRow.y()),int(colRow.x())),2); + int ibin = offlineCalibData->getPixelClusterErrorData()->getEndcapBin(int(colRow.y()),int(colRow.x())); + (*cov)(0,0) = pow(offlineCalibData->getPixelClusterErrorData()->getPixelEndcapPhiError(ibin),2); + (*cov)(1,1) = pow(offlineCalibData->getPixelClusterErrorData()->getPixelEndcapRError(ibin),2); } } else { (*cov)(0,0) = pow(siWidth.phiR()/colRow.x(),2)/12; diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKTrackConverter.cxx b/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKTrackConverter.cxx index 3c9ae79bfc2fc95b4de61589629b6456694c8b5a..379bb1eee15610d2794db84d73ef0f8061d02ec0 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKTrackConverter.cxx +++ b/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKTrackConverter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration */ //////////////////////////////////////////////////////////////////////////////// @@ -56,8 +56,6 @@ TrigFTKTrackConverter::TrigFTKTrackConverter(const std::string& t, const std::string& n, const IInterface* p ): AthAlgTool(t,n,p), - m_offlineCalibSvc("PixelOfflineCalibSvc", n), - m_usePixelCalibSvc(true), m_trackFitter("Trk::DistributedKalmanFilter/InDetTrackFitter"), m_clusterConverterTool("TrigFTKClusterConverterTool"), m_doFit(false), @@ -67,8 +65,6 @@ TrigFTKTrackConverter::TrigFTKTrackConverter(const std::string& t, m_mcTruthName("TruthEvent") { declareInterface< ITrigFTKTrackConverter >( this ); - declareProperty( "PixelOfflineCalibSvc",m_offlineCalibSvc); - declareProperty( "UsePixelCalibSvc",m_usePixelCalibSvc); declareProperty( "TrackFitter",m_trackFitter); declareProperty( "DoFit",m_doFit); declareProperty( "DoTruth",m_doTruth); @@ -80,19 +76,6 @@ StatusCode TrigFTKTrackConverter::initialize() { StatusCode sc = AlgTool::initialize(); - if(m_usePixelCalibSvc) { - - if ( !m_offlineCalibSvc.empty() ) { - StatusCode sc = m_offlineCalibSvc.retrieve(); - if (sc.isFailure() || !m_offlineCalibSvc ) { - ATH_MSG_ERROR(m_offlineCalibSvc.type() << " not found! "); - return sc; - } - else{ - ATH_MSG_INFO("Retrieved tool " << m_offlineCalibSvc.type()); - } - } - } if(m_doTruth) { sc = service( "StoreGateSvc", m_evtStore ); if (sc.isFailure()) { diff --git a/Trigger/TrigTools/TrigInDetConf/python/TrigInDetRecToolsFTK.py b/Trigger/TrigTools/TrigInDetConf/python/TrigInDetRecToolsFTK.py index efc2f0e3d741cfe58f9b002afb0457ff06462f36..448bbcc7313f896a55c981b5804eeed1ba639b89 100644 --- a/Trigger/TrigTools/TrigInDetConf/python/TrigInDetRecToolsFTK.py +++ b/Trigger/TrigTools/TrigInDetConf/python/TrigInDetRecToolsFTK.py @@ -46,7 +46,6 @@ from InDetTrigRecExample.InDetTrigConditionsAccess import PixelConditionsSetup InDetTrigBroadPixelClusterOnTrackToolFTK = \ FTK_PixelClusterOnTrackTool("InDetTrigBroadPixelClusterOnTrackToolFTK", - PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), ErrorStrategy = 0) # use broad errors diff --git a/Trigger/TrigTools/TrigInDetTrackFitter/python/TrigInDetTrackFitter_Config.py b/Trigger/TrigTools/TrigInDetTrackFitter/python/TrigInDetTrackFitter_Config.py index 45cef74e8d0acd0beb5b285cb13f605ede61e746..0af00a77642ee1a8c6fa2258f940a986bcdb9058 100644 --- a/Trigger/TrigTools/TrigInDetTrackFitter/python/TrigInDetTrackFitter_Config.py +++ b/Trigger/TrigTools/TrigInDetTrackFitter/python/TrigInDetTrackFitter_Config.py @@ -77,7 +77,6 @@ class ConfiguredTrigL2_InDetRotCreator(Trk__RIO_OnTrackCreator) : ErrorStrategy = 0, LorentzAngleTool = sctLorentzAngleToolSetup.SCTLorentzAngleTool) myL2_PixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("TrigL2_PixelClusterOnTrackTool", - PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), ErrorStrategy = 0, LorentzAngleTool = ToolSvc.InDetTrigPixelLorentzAngleTool) @@ -87,7 +86,6 @@ class ConfiguredTrigL2_InDetRotCreator(Trk__RIO_OnTrackCreator) : ErrorStrategy = 2, LorentzAngleTool = sctLorentzAngleToolSetup.SCTLorentzAngleTool) myL2_PixelClusterOnTrackTool = InDet__PixelClusterOnTrackTool("TrigL2_PixelClusterOnTrackTool", - PixelOfflineCalibSvc=PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), ErrorStrategy = 1, LorentzAngleTool = ToolSvc.InDetTrigPixelLorentzAngleTool) diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py index dd019447099f7b3709d470e43883061810310d5c..b55388c2af0bf1ea6a5ebc13014f8b15be85c3bc 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py @@ -30,7 +30,6 @@ class ConfiguredOnlineSpacePointProviderTool(OnlineSpacePointProviderTool) : InDetL2TrigClusterMakerTool = InDet__ClusterMakerTool( name = "InDetL2TrigClusterMakerTool", UsePixelCalibCondDB = False, - PixelOfflineCalibSvc = PixelConditionsSetup.instanceName('PixelOfflineCalibSvc'), PixelLorentzAngleTool = TrigPixelLorentzAngleTool, SCTLorentzAngleTool = TrigSCTLorentzAngleTool ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py index f880bda14516fd013827d52758889bae30fff179..30c1091e46c9481cdfc1ab234d52f3d3f880a9fc 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetSetup.py @@ -125,7 +125,6 @@ def makeInDetAlgs(): from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", PixelCalibSvc = None, - PixelOfflineCalibSvc = None, UsePixelCalibCondDB = False, SCTLorentzAngleTool = TrigSCTLorentzAngleTool, PixelLorentzAngleTool = TrigPixelLorentzAngleTool)