diff --git a/AtlasTest/TestTools/CMakeLists.txt b/AtlasTest/TestTools/CMakeLists.txt index 7ba3c5ef6e4c9d5adadd87644cc1387faea7bb26..6e5009a34b284100a7d2858ce6e3e91023e539f1 100644 --- a/AtlasTest/TestTools/CMakeLists.txt +++ b/AtlasTest/TestTools/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 744649 2016-05-03 19:33:39Z krasznaa $ ################################################################################ # Package: TestTools ################################################################################ @@ -24,7 +23,7 @@ else() atlas_add_library( TestTools TestTools/*.h src/*.cxx PUBLIC_HEADERS TestTools - PRIVATE_LINK_LIBRARIES GaudiKernel ) + PRIVATE_LINK_LIBRARIES ${CMAKE_DL_LIBS} GaudiKernel ) endif() # Install files from the package: diff --git a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py index ab0d046475b1912ac7f35a31e9749252362a71c4..6d6c00be6f4dc0c0adb57aa39ef03fa230e50005 100755 --- a/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py +++ b/Calorimeter/CaloClusterCorrection/python/CaloTopoEMmoments.py @@ -16,10 +16,8 @@ from CaloRec import CaloRecConf from CaloClusterCorrection.common import * from AthenaCommon.SystemOfUnits import deg -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() # # This table lists all available versions of this correction. @@ -73,8 +71,6 @@ def make_CaloTopoEMmoments (name = None, class CaloTopoEMmoments_parms: MaxAxisAngle = 20*deg - CaloNoiseTool = theCaloNoiseTool - UsePileUpNoise = True MinBadLArQuality = 4000 MomentsNames = [ "FIRST_PHI" diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx index df5f27b2c68e6bf1e9e0322009b084b9cd58a407..a3ce4540f53d53c2d91d21f247d58bd63ad8f899 100755 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx +++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx @@ -57,7 +57,7 @@ StatusCode CaloClusterLocalCalib::initialize() { return StatusCode::SUCCESS; } -StatusCode CaloClusterLocalCalib::execute(const EventContext& /*ctx*/, +StatusCode CaloClusterLocalCalib::execute(const EventContext& ctx, CaloCluster* theCluster) const { CaloRecoStatus& recoStatus=theCluster->recoStatus(); @@ -135,7 +135,7 @@ StatusCode CaloClusterLocalCalib::execute(const EventContext& /*ctx*/, // Weight the new cluster for (const ToolHandle<IClusterCellWeightTool>& tool : m_calibTools) { - if (tool->weight(myCluster).isFailure()) + if (tool->weight(myCluster,ctx).isFailure()) msg(MSG::ERROR) << " failed to weight cluster " << endmsg; } @@ -187,7 +187,7 @@ StatusCode CaloClusterLocalCalib::execute(const EventContext& /*ctx*/, else{ for (const ToolHandle<IClusterCellWeightTool>& tool : m_calibTools) { - if (tool->weight(theCluster).isFailure()) + if (tool->weight(theCluster,ctx).isFailure()) msg(MSG::ERROR) << " failed to weight cluster " << endmsg; } diff --git a/Calorimeter/CaloConditions/CaloConditions/CaloNoise.h b/Calorimeter/CaloConditions/CaloConditions/CaloNoise.h index 846c0331f4874501fe1812754306afa9b7a57131..3bbe947bff51a36282a9cb3a9311378e280b055e 100644 --- a/Calorimeter/CaloConditions/CaloConditions/CaloNoise.h +++ b/Calorimeter/CaloConditions/CaloConditions/CaloNoise.h @@ -15,6 +15,10 @@ class CaloNoise { ///Conditions Data Object holding the calorimeter noise per cell and per gain public: + + enum NOISETYPE{ELEC=0, + PILEUP, + TOTAL}; CaloNoise() =delete; @@ -22,7 +26,7 @@ class CaloNoise { /// Explicit constructor with number of cells and gains and ptr to CaloCell_ID obj CaloNoise(const size_t nLArCells, const size_t nLArGains, const size_t nTileCells, const size_t nTileGains, - const CaloCell_Base_ID* caloCellId); + const CaloCell_Base_ID* caloCellId, const NOISETYPE noisetype); /// Accessor by IdentifierHash and gain. float getNoise(const IdentifierHash h, const int gain) const { @@ -41,17 +45,16 @@ class CaloNoise { return getNoise(h,gain); } - float getEffectiveSigma(const Identifier id, const int gain, const float energy) { - IdentifierHash h=m_caloCellId->calo_cell_hash(id); - if (h<m_tileHashOffset) { - return m_larNoise[gain][h]; - } - else - return calcSig(h-m_tileHashOffset,gain,energy); + float getEffectiveSigma(const Identifier id, const int gain, const float energy) const { + IdentifierHash h=m_caloCellId->calo_cell_hash(id); + if (h<m_tileHashOffset) { + return m_larNoise[gain][h]; + } + else { + return getTileEffSigma(h-m_tileHashOffset,gain,energy); + } } - float calcSig(const IdentifierHash tilehash, const int gain, const float energy) const; - /// Non-const accessor to underlying storage for filling: boost::multi_array<float, 2>& larStorage() {return m_larNoise;} boost::multi_array<float, 2>& tileStorage() {return m_tileNoise;} @@ -59,6 +62,9 @@ class CaloNoise { void setTileBlob(const CaloCondBlobFlt* flt, const float lumi); private: + float calcSig(const IdentifierHash tilehash, const int gain, const float energy) const; + float getTileEffSigma(const IdentifierHash subHash, const int gain, const float e) const; + const CaloCell_Base_ID* m_caloCellId; //Flat structure, choosen based on profiling done by Scott in Nov 2013 @@ -70,7 +76,7 @@ class CaloNoise { //For double-gaussian noise: const CaloCondBlobFlt* m_tileBlob=nullptr; float m_lumi=0; - + NOISETYPE m_noiseType=TOTAL; }; #include "AthenaKernel/CLASS_DEF.h" diff --git a/Calorimeter/CaloConditions/src/CaloNoise.cxx b/Calorimeter/CaloConditions/src/CaloNoise.cxx index ce5727349f9a7e79c9df5bc3f260cbc652c9403e..e6b21288dac2743b8aaf7a82ccd8b35f8b227fea 100644 --- a/Calorimeter/CaloConditions/src/CaloNoise.cxx +++ b/Calorimeter/CaloConditions/src/CaloNoise.cxx @@ -6,8 +6,8 @@ #include "TMath.h" CaloNoise::CaloNoise(const size_t nLArCells, const size_t nLArGains, const size_t nTileCells, const size_t nTileGains, - const CaloCell_Base_ID* caloCellId) : - m_caloCellId(caloCellId) { + const CaloCell_Base_ID* caloCellId,const NOISETYPE noisetype) : + m_caloCellId(caloCellId),m_noiseType(noisetype) { m_larNoise.resize(boost::extents[nLArGains][nLArCells]); m_tileNoise.resize(boost::extents[nTileGains][nTileCells]); IdentifierHash h1,h2; @@ -25,23 +25,17 @@ CaloNoise::~CaloNoise() { } -//The following method is copied (amost unchagned) from CaloNoiseToolDB +//The following method is copied (amost unchanged) from CaloNoiseToolDB #define sqrt2 1.4142135623730950 #define invsqrt2 0.707106781186547524 -float CaloNoise::calcSig(const IdentifierHash subHash, const int gain, const float e) const { - const unsigned int dbGain = CaloCondUtils::getDbCaloGain(gain); - if (!m_tileBlob) { - //No data (like pileup-noise only): return cached noise - return m_tileNoise[dbGain][subHash]; - } +float CaloNoise::calcSig(const IdentifierHash subHash, const int dbGain, const float e) const { const double sigma1 = m_tileBlob->getData(subHash,dbGain,2); const double sigma2 = m_tileBlob->getData(subHash,dbGain,3); const double ratio = m_tileBlob->getData(subHash,dbGain,4); - if((sigma1 == 0. && sigma2 == 0.) || e == 0.) return 0.; if(sigma1 == 0.) return e/sigma2; if((ratio == 0.) || sigma2 == 0.) return e/sigma1; @@ -66,15 +60,40 @@ float CaloNoise::calcSig(const IdentifierHash subHash, const int gain, const flo // if instead you want to return the sigma-equivalent C.L. // (with sign!) use the following line - const double sigma= sqrt2*TMath::ErfInverse(z); + return sqrt2*TMath::ErfInverse(z); +} + + +float CaloNoise::getTileEffSigma(const IdentifierHash subHash, const int gain, const float e) const { - const float elecNoise= (sigma != 0.) ? fabs(e/sigma) : 0.0; + const unsigned int dbGain = CaloCondUtils::getDbCaloGain(gain); + if (!m_tileBlob) { + //No data (pilup-noise only): return cached noise + return m_tileNoise[dbGain][subHash]; + } - if (m_lumi>0) { - const float b= m_tileBlob->getData(subHash,dbGain,1); - return std::sqrt(elecNoise*elecNoise+b*b*m_lumi); + const float sigma=calcSig(subHash,dbGain,e); + const float a= (sigma != 0.) ? fabs(e/sigma) : 0.0; + + if (m_noiseType==CaloNoise::ELEC) { + return a; + } + + //Case: Total Noise + const float b= m_tileBlob->getData(subHash,dbGain,1); + const int objver = m_tileBlob->getObjVersion(); + float x=0; + if(objver==1){ + //=== Total noise parameterized as + //=== Sigma**2 = a**2 + b**2 * Lumi + x = std::sqrt( a*a + b*b*m_lumi ); + } + else if (objver==2) { + //== parameterization for pedestal = a + b*Lumi + x = a+b*m_lumi; } - else { - return elecNoise; + else{ + throw CaloCond::VersionConflict("CaloNoise::get2dEffSigma ",objver); } + return x; } diff --git a/Calorimeter/CaloInterface/CaloInterface/IClusterCellWeightTool.h b/Calorimeter/CaloInterface/CaloInterface/IClusterCellWeightTool.h index 0a15b2a9a3b3cfe11da7a2374a2a4bfa0fe4993f..da266ef1429b8714f053581fd2d6a2d40512294f 100755 --- a/Calorimeter/CaloInterface/CaloInterface/IClusterCellWeightTool.h +++ b/Calorimeter/CaloInterface/CaloInterface/IClusterCellWeightTool.h @@ -17,9 +17,10 @@ * constituents and weight them. */ #include "GaudiKernel/IAlgTool.h" -#include "AthenaKernel/IOVSvcDefs.h" #include "xAODCaloEvent/CaloClusterFwd.h" +class EventContext; + class IClusterCellWeightTool : virtual public IAlgTool { public: @@ -36,11 +37,7 @@ class IClusterCellWeightTool : virtual public IAlgTool * * this method is purely virtual because every derived class needs * to implement it. */ - virtual StatusCode weight(xAOD::CaloCluster* thisCluster) const = 0; - - // Now obsolete. - virtual StatusCode LoadConditionsData(IOVSVC_CALLBACK_ARGS) - { return StatusCode::SUCCESS; } + virtual StatusCode weight(xAOD::CaloCluster* thisCluster, const EventContext& ctx) const = 0; }; #endif diff --git a/Calorimeter/CaloRec/python/CaloClusterTopoEMGetters.py b/Calorimeter/CaloRec/python/CaloClusterTopoEMGetters.py index 89ebb519c074bacef7d838a50cbf6d312a42aa52..94435cba6502fd3405da803f9c2262b5735e3142 100644 --- a/Calorimeter/CaloRec/python/CaloClusterTopoEMGetters.py +++ b/Calorimeter/CaloRec/python/CaloClusterTopoEMGetters.py @@ -22,9 +22,6 @@ from CaloRec.CaloRecConf import CaloTopoClusterMaker, CaloTopoClusterSplitter from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool - class CaloClusterTopoEMGetterBase (CaloClusterGetterBase): _inputGetter = jp.CaloRecFlags.clusterCellGetterName() @@ -53,9 +50,6 @@ class CaloClusterTopoEMGetterBase (CaloClusterGetterBase): SeedSamplingNames = [ "PreSamplerB", "EMB1", "EMB2", "EMB3", "PreSamplerE", "EME1", "EME2", "EME3"], - CaloNoiseTool=theCaloNoiseTool, - UseCaloNoiseTool=True, - UsePileUpNoise=True, NeighborOption = "all3D", # note E or AbsE CellThresholdOnEorAbsEinSigma = self._cellThreshold, diff --git a/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py b/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py index 7846eb2ae07ad81f5775ccee7cab2227887a3667..431ece67c754945316c58822807277c26fc9697b 100644 --- a/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py +++ b/Calorimeter/CaloRec/python/CaloClusterTopoGetter.py @@ -34,11 +34,19 @@ from RecExConfig.RecFlags import rec from LArCellRec.LArCellRecConf import LArHVFraction +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() +#For LCWeightsTool needs electronic noise +CaloNoiseCondAlg(noisetype="electronicNoise") + from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloNoiseTool + + + def addSnapshot(corrName,contName): from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() @@ -137,7 +145,6 @@ class CaloClusterTopoGetter ( Configured ) : LCWeight = CaloLCWeightTool("LCWeight") LCWeight.CorrectionKey = "H1ClusterCellWeights" LCWeight.SignalOverNoiseCut = 2.0 - LCWeight.CaloNoiseTool = theCaloNoiseTool LCWeight.UseHadProbability = True LCOut = CaloLCOutOfClusterTool("LCOut") @@ -155,7 +162,6 @@ class CaloClusterTopoGetter ( Configured ) : #DMTool.SignalOverNoiseCut = 1.0 #DMTool.ClusterRecoStatus = 0 #DMTool.WeightModeDM = 2 - #DMTool.CaloNoiseTool = theCaloNoiseTool LCDeadMaterial = CaloLCDeadMaterialTool("LCDeadMaterial") LCDeadMaterial.HadDMCoeffKey = "HadDMCoeff2" @@ -205,8 +211,6 @@ class CaloClusterTopoGetter ( Configured ) : TopoMoments = CaloClusterMomentsMaker ("TopoMoments") TopoMoments.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute() TopoMoments.MaxAxisAngle = 20*deg - TopoMoments.CaloNoiseTool = theCaloNoiseTool - TopoMoments.UsePileUpNoise = True TopoMoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() TopoMoments.MinBadLArQuality = 4000 TopoMoments.MomentsNames = ["FIRST_PHI" @@ -366,9 +370,6 @@ class CaloClusterTopoGetter ( Configured ) : "TileExt0", "TileExt1", "TileExt2", "TileGap1", "TileGap2", "TileGap3", "FCAL0", "FCAL1", "FCAL2"] - TopoMaker.CaloNoiseTool=theCaloNoiseTool - TopoMaker.UseCaloNoiseTool=True - TopoMaker.UsePileUpNoise=True TopoMaker.NeighborOption = "super3D" TopoMaker.RestrictHECIWandFCalNeighbors = False TopoMaker.RestrictPSNeighbors = True diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx index 7ebcf71ff79d4fda079bf6f0215ab61d3954c28d..d97e53c389c8901441c701335663aa56bc3f9b2c 100644 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx @@ -23,7 +23,6 @@ #include "CaloGeoHelpers/proxim.h" #include "CaloEvent/CaloPrefetch.h" #include "CaloDetDescr/CaloDetDescrManager.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "CaloInterface/ILArHVFraction.h" #include "CaloGeoHelpers/CaloPhiRange.h" #include "CaloIdentifier/CaloCell_ID.h" @@ -129,10 +128,8 @@ CaloClusterMomentsMaker::CaloClusterMomentsMaker(const std::string& type, m_calculateSignificance(false), m_calculateIsolation(false), m_calculateLArHVFraction(false), - m_usePileUpNoise(true), m_twoGaussianNoise(false), m_caloDepthTool("CaloDepthTool",this), - m_noiseTool("CaloNoiseTool"), m_larHVFraction("LArHVFraction",this), m_absOpt(false) { @@ -159,10 +156,8 @@ CaloClusterMomentsMaker::CaloClusterMomentsMaker(const std::string& type, declareProperty("MinRLateral",m_minRLateral); declareProperty("MinLLongitudinal",m_minLLongitudinal); declareProperty("MinBadLArQuality",m_minBadLArQuality); - declareProperty("UsePileUpNoise",m_usePileUpNoise); // use 2-gaussian noise for Tile declareProperty("TwoGaussianNoise",m_twoGaussianNoise); - declareProperty("CaloNoiseTool",m_noiseTool,"Tool Handle for noise tool"); declareProperty("LArHVFraction",m_larHVFraction,"Tool Handle for LArHVFraction"); /// Not used anymore (with xAOD), but required to when configured from @@ -249,16 +244,7 @@ StatusCode CaloClusterMomentsMaker::initialize() CHECK(m_caloDepthTool.retrieve()); if (m_calculateSignificance) { - if(m_noiseTool.retrieve().isFailure()){ - msg(MSG::WARNING) - << "Unable to find Noise Tool" << endmsg; - } - else { - msg(MSG::INFO) << "Noise Tool retrieved" << endmsg; - } - } - else { - m_noiseTool.disable(); + ATH_CHECK(m_noiseCDOKey.initialize()); } if (m_calculateLArHVFraction) { @@ -309,6 +295,13 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, std::vector<clusterPair_t> clusterIdx; const clusterIdx_t noCluster = std::numeric_limits<clusterIdx_t>::max(); + const CaloNoise* noise=nullptr; + if (m_calculateSignificance) { + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey,ctx}; + noise=*noiseHdl; + } + + // Counters for number of empty and non-empty neighbor cells per sampling layer // Only used when cluster isolation moment is calculated. int nbEmpty[CaloCell_ID::Unknown]; @@ -445,23 +438,10 @@ CaloClusterMomentsMaker::execute(const EventContext& ctx, } if ( m_calculateSignificance ) { - double sigma = 0; - if ( m_usePileUpNoise ) { - if(m_twoGaussianNoise) { - sigma = m_noiseTool->getEffectiveSigma(pCell,ICalorimeterNoiseTool::MAXSYMMETRYHANDLING,ICalorimeterNoiseTool::TOTALNOISE); - } - else { - sigma = m_noiseTool->getNoise(pCell,ICalorimeterNoiseTool::TOTALNOISE); - } - } - else { - if(m_twoGaussianNoise) { - sigma = m_noiseTool->getEffectiveSigma(pCell,ICalorimeterNoiseTool::MAXSYMMETRYHANDLING,ICalorimeterNoiseTool::ELECTRONICNOISE); - } - else { - sigma = m_noiseTool->getNoise(pCell,ICalorimeterNoiseTool::ELECTRONICNOISE); - } - } + const float sigma = m_twoGaussianNoise ?\ + noise->getEffectiveSigma(pCell->ID(),pCell->gain(),pCell->energy()) : \ + noise->getNoise(pCell->ID(),pCell->gain()); + sumSig2 += sigma*sigma; // use geomtery weighted energy of cell for leading cell significance double Sig = (sigma>0?ene*weight/sigma:0); diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h index 650bffeeb304643041202ef7bc0a28fce97ca291..a5b7f37bd162b588ece6403e0e76a0a6236ec48d 100644 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.h @@ -30,17 +30,16 @@ #include "GaudiKernel/ToolHandle.h" -class StoreGateSvc; -class ICalorimeterNoiseTool; class CaloDetDescrManager; class CaloDetDescrElement; class CaloCell_ID; -#include "StoreGate/DataHandle.h" -#include "AthenaKernel/IOVSvcDefs.h" #include "CaloRec/CaloClusterCollectionProcessor.h" #include "CaloDetDescr/CaloDepthTool.h" #include "CaloInterface/ILArHVFraction.h" +#include "CaloConditions/CaloNoise.h" +#include "StoreGate/ReadCondHandleKey.h" + #include <string> #include <vector> @@ -115,24 +114,16 @@ class CaloClusterMomentsMaker: public AthAlgTool, virtual public CaloClusterColl /// Set to true to calculate E and N of cells affected by LAr HV corrections bool m_calculateLArHVFraction; - /** - * @brief switch to use the pile-up noise CaloNoiseTool - * - * if usePileUpNoise is set to true the relevant sigma for each cell - * will be the quadratic sum of the electronics noise at current - * cell gain and its pile-up noise at the current - * luminosity. Otherwise it will be just the electronics noise. */ - bool m_usePileUpNoise; - /** * @brief if set to true use 2-gaussian noise description for * TileCal */ bool m_twoGaussianNoise; ToolHandle<CaloDepthTool> m_caloDepthTool; - // FIXME: mutable - mutable ToolHandle<ICalorimeterNoiseTool> m_noiseTool; - //ToolHandle<ILArHVCorrTool> m_larHVScaleRetriever; + + /** @brief Key of the CaloNoise Conditions data object. Typical values + are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) */ + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","totalNoise","SG Key of CaloNoise data object"}; ToolHandle<ILArHVFraction> m_larHVFraction; diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx index d51d1b3d7a11de732d2bd882e29d32daed1e4896..fa627c12b0190286b7410278cbea4621e49260cb 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx +++ b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.cxx @@ -31,7 +31,6 @@ #include "CaloEvent/CaloCellContainer.h" #include "CaloEvent/CaloPrefetch.h" #include "CaloDetDescr/CaloDetDescrManager.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "AthAllocators/ArenaPoolAllocator.h" #include "AthAllocators/ArenaHandle.h" #include "GaudiKernel/StatusCode.h" @@ -47,24 +46,6 @@ using CLHEP::MeV; -namespace { - - /* -struct CaloClusterSort -{ - CaloClusterSort (xAOD::CaloCluster* cl, float et) - : m_et (et), m_cl (cl) {} - bool operator< (const CaloClusterSort& other) const - { return m_et < other.m_et; } - operator xAOD::CaloCluster* () const { return m_cl; } - - float m_et; - xAOD::CaloCluster* m_cl; -}; - */ - -} // anonymous namespace - //############################################################################# CaloTopoClusterMaker::CaloTopoClusterMaker(const std::string& type, @@ -78,13 +59,6 @@ CaloTopoClusterMaker::CaloTopoClusterMaker(const std::string& type, m_cellThresholdOnEorAbsEinSigma ( 0.), m_neighborThresholdOnEorAbsEinSigma( 3.), m_seedThresholdOnEorAbsEinSigma ( 6.), - m_cellThresholdOnEtorAbsEt ( 0.*MeV), - m_neighborThresholdOnEtorAbsEt ( 100.*MeV), - m_seedThresholdOnEtorAbsEt ( 200.*MeV), - m_useNoiseTool (false), - m_usePileUpNoise (false), - m_noiseTool ("CaloNoiseTool"), - m_noiseSigma ( 100.*MeV), m_neighborOption ("super3D"), m_nOption (LArNeighbours::super3D), m_restrictHECIWandFCalNeighbors (false), @@ -118,13 +92,6 @@ CaloTopoClusterMaker::CaloTopoClusterMaker(const std::string& type, m_neighborThresholdOnEorAbsEinSigma); declareProperty("CellThresholdOnEorAbsEinSigma", m_cellThresholdOnEorAbsEinSigma); - // Additional E_t cuts in MeV in case usePileUpNoise is set to false - declareProperty("SeedThresholdOnEtorAbsEt", - m_seedThresholdOnEtorAbsEt); - declareProperty("NeighborThresholdOnEtorAbsEt", - m_neighborThresholdOnEtorAbsEt); - declareProperty("CellThresholdOnEtorAbsEt", - m_cellThresholdOnEtorAbsEt); // Seed and cluster cuts are in E or Abs E declareProperty("SeedCutsInAbsE",m_seedCutsInAbsE); @@ -135,16 +102,6 @@ CaloTopoClusterMaker::CaloTopoClusterMaker(const std::string& type, // Cell cuts are in E or Abs E declareProperty("CellCutsInAbsE",m_cellCutsInAbsE); - // Noise Sigma - declareProperty("NoiseSigma",m_noiseSigma); - - // NoiseTool - declareProperty("UseCaloNoiseTool",m_useNoiseTool); - declareProperty("CaloNoiseTool",m_noiseTool,"Tool Handle for noise tool"); - - // PileUpNoise - declareProperty("UsePileUpNoise",m_usePileUpNoise); - // Neighbor Option declareProperty("NeighborOption",m_neighborOption); @@ -311,44 +268,9 @@ StatusCode CaloTopoClusterMaker::initialize() msg() << " " << caloName; msg() << endmsg; - //---- retrieve the noise tool ---------------- + //---- retrieve the noise CDO ---------------- - if (m_useNoiseTool) { - - if(m_noiseTool.retrieve().isFailure()){ - ATH_MSG_WARNING( "Unable to find Noise Tool" ); - } - else { - ATH_MSG_INFO( "Noise Tool retrieved" ); - } - } - else { - ATH_MSG_INFO( "Noise Sigma " - << m_noiseSigma << " MeV is selected!" - << (!m_usePileUpNoise? - " The noise sigma will just be the electronics noise!":"") - ); - } - - if ( m_useNoiseTool && m_usePileUpNoise ) { - ATH_MSG_INFO( "Pile-Up Noise from Noise Tool" - << " is selected! The noise sigma will be the" - << " quadratic sum of the electronics noise and the pile up!" ); - } - else { - ATH_MSG_INFO( "Additional E_t cuts (instead of Pile-Up Noise):" - << (m_seedCutsInAbsE?" SeedThresholdOnAbsEt=":" SeedThresholdOnEt=") - << m_seedThresholdOnEtorAbsEt - << " MeV, " - << (m_neighborCutsInAbsE?"NeighborThresholdOnAbsEt=": - "NeighborThresholdOnEt=") - << m_neighborThresholdOnEtorAbsEt - << " MeV, " - << (m_cellCutsInAbsE?"CellThresholdOnAbsEt=": - "CellThresholdOnEt=") - << m_cellThresholdOnEtorAbsEt - << " MeV" ); - } + ATH_CHECK(m_noiseCDOKey.initialize()); ATH_MSG_INFO( (m_seedCutsInAbsE?"ClusterAbsEtCut= ":"ClusterEtCut= ") << m_clusterEtorAbsEtCut << " MeV" ); @@ -365,7 +287,7 @@ StatusCode CaloTopoClusterMaker::initialize() } } - ATH_CHECK( m_cablingKey.initialize() ); + //ATH_CHECK( m_cablingKey.initialize() ); return StatusCode::SUCCESS; @@ -401,6 +323,10 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, std::vector<HashCell> cellVector (m_hashMax - m_hashMin); HashCell* hashCells = cellVector.data() - m_hashMin; + + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey,ctx}; + const CaloNoise* noiseCDO=*noiseHdl; + //---- Get the CellContainers ---------------- // for (const std::string& cellsName : m_cellsNames) { @@ -426,36 +352,19 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, ++iCell, ++cellIter) { CaloPrefetch::nextDDE(cellIter, cellIterEnd, 2); - // noise() member does not exist for CaloCell - need to use noise tool const CaloCell* pCell = *cellIter; - // take the noise for the current gain of the cell - // the highest gain would be nice to use, but this is not possible - // in runs with fixed gain because it might not be defined ... - float noiseSigma; - if ( m_useNoiseTool ) { - if ( m_usePileUpNoise ) { - if(m_twogaussiannoise) noiseSigma = m_noiseTool->getEffectiveSigma(pCell,ICalorimeterNoiseTool::MAXSYMMETRYHANDLING,ICalorimeterNoiseTool::TOTALNOISE); - else noiseSigma = m_noiseTool->getNoise(pCell,ICalorimeterNoiseTool::TOTALNOISE); - } - else - if(m_twogaussiannoise) noiseSigma = m_noiseTool->getEffectiveSigma(pCell,ICalorimeterNoiseTool::MAXSYMMETRYHANDLING,ICalorimeterNoiseTool::ELECTRONICNOISE); - else noiseSigma = m_noiseTool->getNoise(pCell,ICalorimeterNoiseTool::ELECTRONICNOISE); - } - else - noiseSigma = m_noiseSigma; + const float noiseSigma = m_twogaussiannoise ? \ + noiseCDO->getEffectiveSigma(pCell->ID(),pCell->gain(),pCell->energy()) : \ + noiseCDO->getNoise(pCell->ID(),pCell->gain()); + float signedE = pCell->energy(); float signedEt = pCell->et(); float signedRatio = epsilon; // not 0 in order to keep bad cells if ( finite(noiseSigma) && noiseSigma > 0 && !CaloBadCellHelper::isBad(pCell,m_treatL1PredictedCellsAsGood) ) signedRatio = signedE/noiseSigma; - bool passedCellCut = (m_cellCutsInAbsE?std::abs(signedRatio):signedRatio) - > m_cellThresholdOnEorAbsEinSigma - && (m_usePileUpNoise || ((m_cellCutsInAbsE?std::abs(signedEt):signedEt) - > m_cellThresholdOnEtorAbsEt)); - bool passedNeighborCut = (m_neighborCutsInAbsE?std::abs(signedRatio):signedRatio) > m_neighborThresholdOnEorAbsEinSigma - && ( m_usePileUpNoise || ((m_neighborCutsInAbsE?std::abs(signedEt):signedEt) > m_neighborThresholdOnEtorAbsEt )); - bool passedSeedCut = (m_seedCutsInAbsE?std::abs(signedRatio):signedRatio) > m_seedThresholdOnEorAbsEinSigma - && ( m_usePileUpNoise || ((m_seedCutsInAbsE?std::abs(signedEt):signedEt) > m_seedThresholdOnEtorAbsEt )); + bool passedCellCut = (m_cellCutsInAbsE?std::abs(signedRatio):signedRatio) > m_cellThresholdOnEorAbsEinSigma; + bool passedNeighborCut = (m_neighborCutsInAbsE?std::abs(signedRatio):signedRatio) > m_neighborThresholdOnEorAbsEinSigma; + bool passedSeedCut = (m_seedCutsInAbsE?std::abs(signedRatio):signedRatio) > m_seedThresholdOnEorAbsEinSigma; if ( passedCellCut || passedNeighborCut || passedSeedCut ) { const CaloDetDescrElement* dde = pCell->caloDDE(); @@ -619,8 +528,7 @@ CaloTopoClusterMaker::execute(const EventContext& ctx, // check neighbor threshold only since seed cells are already in // the original list bool isAboveNeighborThreshold = - (m_neighborCutsInAbsE?std::abs(pNCell->getSignedRatio()):pNCell->getSignedRatio()) > m_neighborThresholdOnEorAbsEinSigma - && ( m_usePileUpNoise || ((m_neighborCutsInAbsE?std::abs(pNCell->getSignedEt()):pNCell->getSignedEt()) > m_neighborThresholdOnEtorAbsEt )); + (m_neighborCutsInAbsE?std::abs(pNCell->getSignedRatio()):pNCell->getSignedRatio()) > m_neighborThresholdOnEorAbsEinSigma; // checking the neighbors if ( isAboveNeighborThreshold && !pNCell->getUsed() ) { pNCell->setUsed(); diff --git a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h index 47d34826142c4608e61928914a31fb586f712b9b..366b892adcf647a6f6ee45245f4504eebf0423dc 100644 --- a/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h +++ b/Calorimeter/CaloRec/src/CaloTopoClusterMaker.h @@ -1,8 +1,8 @@ +//Dear emacs, this is -*-c++-*- /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -//Dear emacs, this is -*-c++-*- #ifndef CALOTOPOCLUSTERMAKER_H #define CALOTOPOCLUSTERMAKER_H /** @@ -41,6 +41,7 @@ #include "CaloRec/CaloClusterCollectionProcessor.h" #include "CaloInterface/ICalorimeterNoiseTool.h" #include "LArCabling/LArOnOffIdMapping.h" +#include "CaloConditions/CaloNoise.h" #include "StoreGate/ReadCondHandleKey.h" class Identifier; @@ -48,9 +49,8 @@ class CaloDetDescrManager; class CaloDetDescrElement; -class CaloTopoClusterMaker: public AthAlgTool, virtual public CaloClusterCollectionProcessor -{ - public: +class CaloTopoClusterMaker: public AthAlgTool, virtual public CaloClusterCollectionProcessor { +public: CaloTopoClusterMaker(const std::string& type, const std::string& name, const IInterface* parent); @@ -62,7 +62,7 @@ class CaloTopoClusterMaker: public AthAlgTool, virtual public CaloClusterCollect void getClusterSize(); - private: +private: const CaloCell_ID* m_calo_id; @@ -128,66 +128,13 @@ class CaloTopoClusterMaker: public AthAlgTool, virtual public CaloClusterCollect * would be included in both clusters. */ float m_seedThresholdOnEorAbsEinSigma; - /** - * @brief optional cut on \f$E_\perp\f$ or \f$|E|_\perp\f$ on the - * cell level - * - * This and the following 2 variables define on cell, neighbor and - * seed level additional thresholds on \f$E_\perp\f$ or - * \f$|E|_\perp\f$. They are treated like the noise cuts above on - * each level and used only in case m_usePileUpNoise is set to - * false. Usually m_usePileUpNoise should be set to true and using - * these cuts is not recommended. */ - float m_cellThresholdOnEtorAbsEt; - - /** @brief optional cut on \f$E_\perp\f$ or \f$|E|_\perp\f$ on the - neighbor level */ - float m_neighborThresholdOnEtorAbsEt; - - /** @brief optional cut on \f$E_\perp\f$ or \f$|E|_\perp\f$ on the - seed level */ - float m_seedThresholdOnEtorAbsEt; - - /** - * @brief switch to use the CaloNoiseTool - * - * the CaloNoiseTool should be used whenever possible in order to - * get the electronics noise and the pile-up noise for each cell - * according to the current conditions. In case this switch is set - * to false a constant noise value for all cells will be used. */ - bool m_useNoiseTool; + /** @brief Key of the CaloNoise Conditions data object. Typical values + are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) */ - /** - * @brief switch to use the pile-up noise CaloNoiseTool - * - * if usePileUpNoise is set to true the relevant sigma for each cell - * will be the quadratic sum of the electronics noise at current - * cell gain and its pile-up noise at the current - * luminosity. Otherwise it will be just the electronics noise. This - * switch can be set to true only if m_useNoiseTool is set to true - * as well. It is recommended to set usePileUpNoise to true even - * for situations (like single particle MC) where no pile-up noise - * is expected since the CaloNoiseTool most likely will be - * configured in a way that it reflects that situation. If this - * switch is set to false the additional \f$E_\perp\f$ thresholds - * declared above will be used. */ - bool m_usePileUpNoise; - // FIXME: mutable - mutable ToolHandle<ICalorimeterNoiseTool> m_noiseTool; + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","totalNoise","SG Key of CaloNoise data object"}; - // FIXME: Conditions dependencies required by CaloNoiseTool. - // These can be removed once we change to using - // the conditions algorithm instead of CaloNoiseTool. - SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; - - /** - * @brief constant noise value in case the CaloNoiseTool is not used - * - * this value should only be used for testing purposes. It will be - * used if the CaloNoiseTool is switched off as the electronics - * noise for each cell. */ - float m_noiseSigma; + //SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; /** * @brief type of neighbor relations to use. diff --git a/Calorimeter/CaloRec/src/CaloTopoTowerAlg.cxx b/Calorimeter/CaloRec/src/CaloTopoTowerAlg.cxx index 55afed800e3f0aa001438dafcbf846ce34bd6061..8addf7d51b5acaec408ffa36303bd8f2d576df0c 100644 --- a/Calorimeter/CaloRec/src/CaloTopoTowerAlg.cxx +++ b/Calorimeter/CaloRec/src/CaloTopoTowerAlg.cxx @@ -25,7 +25,6 @@ #include "CaloEvent/CaloTowerContainer.h" #include "CaloEvent/CaloCell2ClusterMap.h" #include "CaloEvent/CaloCellContainer.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "CaloTopoTowerAlg.h" #include "CxxUtils/make_unique.h" #include <string> @@ -39,7 +38,6 @@ CaloTopoTowerAlg::CaloTopoTowerAlg(const std::string& name,ISvcLocator* pSvcLoca m_cellContainerKey("AllCalo"), m_towerContainerKey("CmbTower"), m_newTowerContainerKey("TopoTower"), - m_noiseTool("CaloNoiseToolDefault"), m_caloSelection(false) { @@ -53,11 +51,6 @@ CaloTopoTowerAlg::CaloTopoTowerAlg(const std::string& name,ISvcLocator* pSvcLoca declareProperty("MinimumCellEnergy", m_minimumCellEnergy = -1000000000.0); declareProperty("MinimumClusterEnergy", m_minimumClusterEnergy = -1000000000.0); - // Noise Tool stuff - declareProperty("CaloNoiseTool", m_noiseTool ,"Tool Handle for noise tool"); - declareProperty("DefaultNoiseSigma", m_noiseSigma = 10.0); - declareProperty("UseCaloNoiseTool", m_useNoiseTool = true); - declareProperty("UsePileUpNoise", m_usePileUpNoise = true); declareProperty("CellEnergySignificance", m_cellESignificanceThreshold = -1); // Calo from which to use cells @@ -90,29 +83,13 @@ StatusCode CaloTopoTowerAlg::initialize() // services ATH_MSG_INFO( "Initializing CaloTopoTowerAlg" ); - CHECK(m_cellToClusterMapKey.initialize()); - CHECK(m_cellContainerKey.initialize()); - CHECK(m_towerContainerKey.initialize()); - CHECK(m_newTowerContainerKey.initialize()); + ATH_CHECK(m_cellToClusterMapKey.initialize()); + ATH_CHECK(m_cellContainerKey.initialize()); + ATH_CHECK(m_towerContainerKey.initialize()); + ATH_CHECK(m_newTowerContainerKey.initialize()); + ATH_CHECK(m_noiseCDOKey.initialize()); - - // retrieve noise tool from the tool svc - if (m_useNoiseTool) { - ATH_CHECK( m_noiseTool.retrieve() ); - ATH_MSG_INFO( "Noise Tool retrieved" ); - } - else { - m_noiseTool.disable(); - } - - // Report some information regarding the noise tool - if ( m_useNoiseTool && m_usePileUpNoise) { - ATH_MSG_DEBUG( "Pile-Up Noise from Noise Tool " - << " is selected! The noise sigma will be the" - << " quadratic sum of the electronics noise and the pile up!" ); - } - m_caloIndices.clear(); for ( unsigned int iCalos=0; iCalos< m_includedCalos.size(); iCalos++ ) { @@ -194,6 +171,11 @@ StatusCode CaloTopoTowerAlg::execute (const EventContext& ctx) const } ATH_MSG_DEBUG( "Successfully retrieved CaloCell2ClusterMap <"<< cellToClusterMap.name() << ">" ); + /// Get CaloNoise CDO + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey,ctx}; + const CaloNoise* noise=*noiseHdl; + + ///+++ consistency: pick up CaloClusterContainer pointer from map CaloCell2ClusterMap::const_iterator fClusMap(cellToClusterMap->begin()); CaloCell2ClusterMap::const_iterator lClusMap(cellToClusterMap->end()); @@ -290,11 +272,7 @@ StatusCode CaloTopoTowerAlg::execute (const EventContext& ctx) const float noiseSigma = 1.0; if (m_cellESignificanceThreshold>=0.) { // Noise tool to calculate cell energy significance - if ( m_useNoiseTool ) { - if ( m_usePileUpNoise ) noiseSigma = m_noiseTool->getNoise(cell,ICalorimeterNoiseTool::TOTALNOISE); - else noiseSigma = m_noiseTool->getNoise(cell,ICalorimeterNoiseTool::ELECTRONICNOISE); - } - else noiseSigma = m_noiseSigma; + noiseSigma=noise->getNoise(cell->ID(),cell->gain()); if ( noiseSigma > 0. ) signedRatio = signedE/noiseSigma; } diff --git a/Calorimeter/CaloRec/src/CaloTopoTowerAlg.h b/Calorimeter/CaloRec/src/CaloTopoTowerAlg.h index fb65ce621da926b93d8ef05d3c634aa6a2807041..dfd76bb282c0526b25b0c1e555ea95c36b612e81 100644 --- a/Calorimeter/CaloRec/src/CaloTopoTowerAlg.h +++ b/Calorimeter/CaloRec/src/CaloTopoTowerAlg.h @@ -41,8 +41,9 @@ #include "CaloEvent/CaloClusterContainer.h" #include "CaloEvent/CaloCell2ClusterMap.h" -class ICalorimeterNoiseTool; -class StoreGateSvc; +#include "CaloConditions/CaloNoise.h" +#include "StoreGate/ReadCondHandleKey.h" + class CaloTopoTowerAlg : public AthReentrantAlgorithm { @@ -75,12 +76,10 @@ private: double m_minimumClusterEnergy; bool m_useCellWeights; - // Noise tool stuff - bool m_useNoiseTool; - bool m_usePileUpNoise; - // FIXME: mutable - mutable ToolHandle<ICalorimeterNoiseTool> m_noiseTool; - float m_noiseSigma; + /** @brief Key of the CaloNoise Conditions data object. Typical values + are '"electronicNoise', 'pileupNoise', or '"totalNoise' (default) */ + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","totalNoise","SG Key of CaloNoise data object"}; + float m_cellESignificanceThreshold; // Type definitions diff --git a/Calorimeter/CaloTools/python/CaloNoiseCondAlg.py b/Calorimeter/CaloTools/python/CaloNoiseCondAlg.py index 9f0022877272da883835cd887ace1528e517f0eb..3a4fc9a9ef7e862113be9d1261ee8b1b2d2691ce 100644 --- a/Calorimeter/CaloTools/python/CaloNoiseCondAlg.py +++ b/Calorimeter/CaloTools/python/CaloNoiseCondAlg.py @@ -95,7 +95,7 @@ def _CaloNoiseCondAlgData(noiseAlgName,noisetype): if jobproperties.CaloCellFlags.doLArHVCorr(): mlog.info("Run2 & doLArHVCorr=True: Will rescale noise automatically for HV trips") theCaloNoiseAlg.useHVCorr=True - #... schedule HV corr cond alg + from LArConditionsCommon import LArHVDB pass pass else: #COMP200 case: diff --git a/Calorimeter/CaloTools/python/CaloNoiseCondAlgConfig.py b/Calorimeter/CaloTools/python/CaloNoiseCondAlgConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..dd03b4b850db887c86b9a936e12e44bd2a9e22f9 --- /dev/null +++ b/Calorimeter/CaloTools/python/CaloNoiseCondAlgConfig.py @@ -0,0 +1,146 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from IOVDbSvc.IOVDbSvcConfig import addFolders +from CaloTools.CaloToolsConf import CaloNoiseCondAlg +from AthenaCommon.Logging import logging + +def CaloNoiseCondAlgCfg(configFlags,noisetype="totalNoise"): + if noisetype not in ("electronicNoise","pileupNoise","totalNoise"): + raise RunTimeError("Requested noise of unknown type %s" % noisetype) + + noiseAlgName="Calo_"+noisetype+"Alg" + + + log = logging.getLogger("CaloNoiseToolCfg") + result=ComponentAccumulator() + + isMC=configFlags.Input.isMC + fixedLumi=configFlags.Calo.Noise.fixedLumiForNoise + useCaloLumi=configFlags.Calo.Noise.useCaloNoiseLumi + + #CaloNoiseCondAlg needs Identifiers ... + from AtlasGeoModel.GeoModelConfig import GeoModelCfg + gms=GeoModelCfg(configFlags) + result.merge(gms[0]) + + #... and cabling: + from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg + result.merge(LArOnOffIdMappingCfg(configFlags)) + + theCaloNoiseAlg=CaloNoiseCondAlg(noiseAlgName,OutputKey=noisetype) + + if configFlags.Common.isOnline: + log.info("Configuring CaloNoiseCondAlg for online case") + #online mode: + result.merge(addFolders(configFlags,"/CALO/Noise/CellNoise",'CALO_ONL')) + theCaloNoiseAlg.CaloNoiseFolder="/CALO/Noise/CellNoise" + theCaloNoiseAlg.LArNoiseFolder="" + theCaloNoiseAlg.TileNoiseFolder="" + if fixedLumi >= 0 : + theCaloNoiseAlg.Luminosity = fixedLumi + log.info("online mode: use fixed luminosity for scaling pileup noise: %f", fixedLumi) + else: + if useCaloLumi: + lumiFolder='/CALO/Noise/PileUpNoiseLumi' + result.merge(addFolders(configFlags,lumiFolder,'CALO')) + theCaloNoiseAlg.LumiFolder = lumiFolder + theCaloNoiseAlg.Luminosity = -1. + log.info("online mode: use luminosity from /CALO/Noise/PileUpNoiseLumi to scale pileup noise") + else: + theCaloNoiseAlg.Luminosity = 0. + log.info("online mode: ignore pileup noise") + pass + result.addCondAlgo(theCaloNoiseAlg) + return result + + #The not-online case: + if isMC: + log.info("Configuring CaloNoiseCondAlg for MC data processing") + if fixedLumi >= 0 : + theCaloNoiseAlg.Luminosity=fixedLumi + log.info("Luminosity (in 10**33) units used for pileup noise from CaloNoiseFlags : %f", fixedLumi) + else: + if useCaloLumi: + lumiFolder='/CALO/Ofl/Noise/PileUpNoiseLumi' + result.merge(addFolders(configFlags,lumiFolder,'CALO_OFL')) + log.info("offline mode: use luminosity from /CALO/Ofl/Noise/PileuUpNoiseLumi to scale pileup noise") + theCaloNoiseAlg.LumiFolder = lumiFolder + theCaloNoiseAlg.Luminosity=-1. + else: + estimatedLumi=configFlags.Beam.estimatedLuminosity + theCaloNoiseAlg.Luminosity=estimatedLumi/1e+33 + log.info(" Luminosity (in 10**33) units used for pileup noise from Beam flags: %f", theCaloNoiseAlg.Luminosity) + + theCaloNoiseAlg.LArNoiseFolder="/LAR/NoiseOfl/CellNoise" + result.merge(addFolders(configFlags,"/LAR/NoiseOfl/CellNoise","LAR_OFL",className="CondAttrListCollection")) + theCaloNoiseAlg.TileNoiseFolder="/TILE/OFL02/NOISE/CELL" + result.merge(addFolders(configFlags,"/TILE/OFL02/NOISE/CELL","TILE_OFL",className="CondAttrListCollection")) + theCaloNoiseAlg.CaloNoiseFolder="/CALO/Ofl/Noise/CellNoise" + result.merge(addFolders(configFlags,"/CALO/Ofl/Noise/CellNoise","CALO_OFL",className="CondAttrListCollection")) + + pass + else: # Real data case: + # for luminosity + if fixedLumi >= 0 : + theCaloNoiseAlg.Luminosity = fixedLumi + log.info("offline mode: use fixed luminosity for scaling pileup noise: %f", fixedLumi) + else : + theCaloNoiseAlg.Luminosity = -1 + if useCaloLumi: + lumiFolder='/CALO/Ofl/Noise/PileUpNoiseLumi' + result.merge(addFolders(configFlags,lumiFolder,'CALO_OFL')) + log.info("offline mode: use luminosity from /CALO/Ofl/Noise/PileUpNoiseLumi to scale pileup noise") + else: + lumiFolder = '/TRIGGER/LUMI/LBLESTONL' + result.merge(addFolders(configFlags,lumiFolder,'TRIGGER_ONL')) + log.info("offline mode: use luminosity = f(Lumiblock) to scale pileup noise") + theCaloNoiseAlg.LumiFolder = lumiFolder + + if configFlags.IOVDb.DatabaseInstance=="CONDBR2": # Run2 case: + log.info("Configuring CaloNoiseCondAlg for Run2 real data processing") + theCaloNoiseAlg.CaloNoiseFolder="" + theCaloNoiseAlg.LArNoiseFolder="/LAR/NoiseOfl/CellNoise" + theCaloNoiseAlg.TileNoiseFolder="/TILE/OFL02/NOISE/CELL" + result.merge(addFolders(configFlags,"/LAR/NoiseOfl/CellNoise","LAR_OFL",className="CondAttrListCollection")) + result.merge(addFolders(configFlags,"/TILE/OFL02/NOISE/CELL","TILE_OFL",className="CondAttrListCollection")) + + + if configFlags.Calo.Cell.doLArHVCorr: + mlog.info("Run2 & doLArHVCorr=True: Will rescale noise automatically for HV trips") + theCaloNoiseAlg.useHVCorr=True + from LArCalibUtils.LArHVScaleCorrConfig import LArHVScaleCorrCfg + result.merge(LArHVScaleCorr(configFlags)) + pass + pass + else: #COMP200 case: + log.info("Configuring CaloNoiseCondAlg for Run1 real data processing") + #The noise for runs before 2012 is a different folder: + theCaloNoiseAlg.CaloNoiseFolder="/CALO/Ofl/Noise/CellNoise" + theCaloNoiseAlg.LArNoiseFolder="" + theCaloNoiseAlg.TileNoiseFolder="" + result.merge(addFolders(configFlags,"/CALO/Ofl/Noise/CellNoise","CALO_OFL",className="CondAttrListCollection")) + + pass #end of real data case + + result.addCondAlgo(theCaloNoiseAlg) + return result + +if __name__ == "__main__": + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.TestDefaults import defaultTestFiles + + ConfigFlags.Input.Files = defaultTestFiles.ESD + ConfigFlags.lock() + + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + acc=PoolReadCfg(ConfigFlags) + + acc.merge(CaloNoiseCondAlgCfg(ConfigFlags)) + + f=open('test.pkl','w') + acc.store(f) + f.close() diff --git a/Calorimeter/CaloTools/src/CaloNoiseCondAlg.cxx b/Calorimeter/CaloTools/src/CaloNoiseCondAlg.cxx index cdd06309ff818112ca70f6607abce2b7e029467e..d03b4a54de775910500cd12a9c4b0f7d197362ac 100644 --- a/Calorimeter/CaloTools/src/CaloNoiseCondAlg.cxx +++ b/Calorimeter/CaloTools/src/CaloNoiseCondAlg.cxx @@ -51,14 +51,14 @@ StatusCode CaloNoiseCondAlg::initialize() { const std::string& noiseKey=m_outputKey.key(); if(noiseKey=="electronicNoise") { ATH_MSG_INFO("Will compute electronic noise"); - m_noisetype=ELEC; + m_noiseType=CaloNoise::ELEC; } else if (noiseKey=="pileupNoise") { ATH_MSG_INFO("Will compute pileup noise"); - m_noisetype=PILEUP; + m_noiseType=CaloNoise::PILEUP; } else if (noiseKey=="totalNoise") { - m_noisetype=TOTAL; + m_noiseType=CaloNoise::TOTAL; ATH_MSG_INFO("Will compute total (electronic + pileup) noise"); } else { @@ -131,16 +131,23 @@ StatusCode CaloNoiseCondAlg::execute() { return StatusCode::SUCCESS; } + //Start with a range covering 0 - inf, then narrow down + const EventIDBase start{0,EventIDBase::UNDEFEVT,0,0,0,0}; + const EventIDBase stop{EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFEVT-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1,0}; + // Run Event time time_ns LB BCID + EventIDRange rangeOut{start, stop}; + EventIDRange rangeIn; + + SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey}; const LArOnOffIdMapping* cabling{*cablingHdl}; - - //To determine the output range, start with cabling: - EventIDRange rangeIn,rangeOut; - if (!cablingHdl.range(rangeOut)){ + if (!cablingHdl.range(rangeIn)){ ATH_MSG_ERROR("Failed to retrieve validity range of LArCabling CDO with key " << m_larNoiseKey.key()); return StatusCode::FAILURE; } - + //std::cout << "rangeIn lar cabling " << rangeIn << std::endl; + rangeOut=EventIDRange::intersect(rangeOut,rangeIn); + //std::cout << "rangeOut lar cabling " << rangeOut << std::endl; //Obtain AttrListsCollections for all possible folders (LAr,Tile,Calo) std::vector<const CondAttrListCollection*> attrListNoise; @@ -239,7 +246,8 @@ StatusCode CaloNoiseCondAlg::execute() { const size_t maxCells=m_caloCellID->calo_cell_hash_max(); //Create the CaloNoise CDO: std::unique_ptr<CaloNoise> caloNoiseObj=std::make_unique<CaloNoise>(m_maxLArCells,3, - m_maxTileCells,4,m_caloCellID); + m_maxTileCells,4, + m_caloCellID,m_noiseType); //Counters for crosschecks std::array<unsigned,4> cellsPerGain{0,0,0,0}; @@ -275,14 +283,14 @@ StatusCode CaloNoiseCondAlg::execute() { const float b=blob->getData(i,igain,1); ++(cellsPerGain[igain]); const size_t hash = (sys==TILE) ? i : i+offset; - switch (m_noisetype){ - case ELEC: + switch (m_noiseType){ + case CaloNoise::ELEC: noise[igain][hash]=a; break; - case PILEUP: + case CaloNoise::PILEUP: noise[igain][hash]=b*std::sqrt(lumi); break; - case TOTAL: + case CaloNoise::TOTAL: noise[igain][hash]=std::sqrt(a*a + b*b*lumi); break; default: @@ -292,8 +300,9 @@ StatusCode CaloNoiseCondAlg::execute() { }//end loop over gains - // Cache data to calculate effective sigma for tile double-gaussian noise - if (sys==TILE && m_noisetype!=PILEUP) { + // Cache data to calculate effective sigma for tile double-gaussian noise + // Matters for Electronic and total noise + if (sys==TILE && m_noiseType!=CaloNoise::PILEUP) { caloNoiseObj->setTileBlob(blob.release(),lumi); } diff --git a/Calorimeter/CaloTools/src/CaloNoiseCondAlg.h b/Calorimeter/CaloTools/src/CaloNoiseCondAlg.h index 81e4d59dba3dc3c751db676f471c4098951a8916..5b5e5352a104e2439b978db4fd8630413aa2e8c1 100644 --- a/Calorimeter/CaloTools/src/CaloNoiseCondAlg.h +++ b/Calorimeter/CaloTools/src/CaloNoiseCondAlg.h @@ -68,14 +68,7 @@ class CaloNoiseCondAlg: public AthAlgorithm { std::size_t m_maxTileCells=0; void buildHashRanges(); - - enum NOISETYPE{ELEC=0, - PILEUP, - TOTAL}; - - - - NOISETYPE m_noisetype=TOTAL; + CaloNoise::NOISETYPE m_noiseType=CaloNoise::TOTAL; }; diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloLCDeadMaterialTool.h b/Calorimeter/CaloUtils/CaloUtils/CaloLCDeadMaterialTool.h index 039721ac393ae725aa43b11359dcd9f3af97e986..1f13bea4f17790b49cd51ef4772126b5f34d1130 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloLCDeadMaterialTool.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloLCDeadMaterialTool.h @@ -25,9 +25,9 @@ #include "CaloConditions/CaloLocalHadCoeff.h" #include "StoreGate/DataHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "AthenaKernel/IOVSvcDefs.h" #include "CaloGeoHelpers/CaloSampling.h" #include "StoreGate/ReadCondHandleKey.h" +#include "GaudiKernel/EventContext.h" #include <map> #include <vector> @@ -61,7 +61,7 @@ class CaloLCDeadMaterialTool : public AthAlgTool, virtual public IClusterCellWei virtual ~CaloLCDeadMaterialTool() override; - virtual StatusCode weight(xAOD::CaloCluster* theCluster) const override; + virtual StatusCode weight(xAOD::CaloCluster* theCluster, const EventContext& ctx) const override; virtual StatusCode initialize() override; CaloLCDeadMaterialTool(const std::string& type, diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloLCOutOfClusterTool.h b/Calorimeter/CaloUtils/CaloUtils/CaloLCOutOfClusterTool.h index f49e0d3ab234e5a4808b661d678d1f2f92cd06f3..3311d6c693f057ed10fce78c5e8d60ce6868ec77 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloLCOutOfClusterTool.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloLCOutOfClusterTool.h @@ -22,6 +22,7 @@ #include "CaloConditions/CaloLocalHadCoeff.h" #include "StoreGate/ReadCondHandleKey.h" #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/EventContext.h" class CaloLCOutOfClusterTool : public AthAlgTool, virtual public IClusterCellWeightTool { @@ -29,7 +30,7 @@ class CaloLCOutOfClusterTool : public AthAlgTool, virtual public IClusterCellWei virtual ~CaloLCOutOfClusterTool(); - virtual StatusCode weight(xAOD::CaloCluster* theCluster) const override; + virtual StatusCode weight(xAOD::CaloCluster* theCluster, const EventContext& ctx) const override; virtual StatusCode initialize() override; CaloLCOutOfClusterTool(const std::string& type, diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloLCWeightTool.h b/Calorimeter/CaloUtils/CaloUtils/CaloLCWeightTool.h index 37d4113848791e54f3cb40f41beaed465b5eb9e8..e55b7c9427f4209e8da3d7d7291d1fae6b028363 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloLCWeightTool.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloLCWeightTool.h @@ -25,6 +25,8 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "AthenaKernel/IOVSvcDefs.h" #include "StoreGate/ReadCondHandleKey.h" +#include "CaloConditions/CaloNoise.h" +#include "GaudiKernel/EventContext.h" class CaloCell_ID; class CaloDetDescrManager; @@ -38,7 +40,7 @@ class CaloLCWeightTool : public AthAlgTool, virtual public IClusterCellWeightToo virtual ~CaloLCWeightTool(); - virtual StatusCode weight(xAOD::CaloCluster* theCluster) const override; + virtual StatusCode weight(xAOD::CaloCluster* theCluster, const EventContext& ctx) const override; virtual StatusCode initialize() override; CaloLCWeightTool(const std::string& type, @@ -95,7 +97,7 @@ class CaloLCWeightTool : public AthAlgTool, virtual public IClusterCellWeightToo const CaloCell_ID* m_calo_id; const CaloDetDescrManager* m_calo_dd_man; - mutable ToolHandle<ICalorimeterNoiseTool> m_noiseTool; + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","electronicNoise","SG Key of CaloNoise data object"}; }; #endif diff --git a/Calorimeter/CaloUtils/src/CaloLCDeadMaterialTool.cxx b/Calorimeter/CaloUtils/src/CaloLCDeadMaterialTool.cxx index e2b5833a43ee5cc02772d3f01469a02c5b85740d..0351d5e3d06660001f9984a489bfdcc2d95e8573 100644 --- a/Calorimeter/CaloUtils/src/CaloLCDeadMaterialTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloLCDeadMaterialTool.cxx @@ -138,7 +138,7 @@ StatusCode CaloLCDeadMaterialTool::initialize() /* **************************************************************************** - DeadMaterialCorrectionTool2::execute **************************************************************************** */ -StatusCode CaloLCDeadMaterialTool::weight(CaloCluster* theCluster) const +StatusCode CaloLCDeadMaterialTool::weight(CaloCluster* theCluster, const EventContext& ctx) const { CaloLCCoeffHelper hp; CaloLocalHadCoeff::LocalHadCoeff parint; @@ -204,7 +204,7 @@ StatusCode CaloLCDeadMaterialTool::weight(CaloCluster* theCluster) const } const CaloLocalHadCoeff* data(0); - SG::ReadCondHandle<CaloLocalHadCoeff> rch(m_key); + SG::ReadCondHandle<CaloLocalHadCoeff> rch(m_key,ctx); data = *rch; if(data==0) { ATH_MSG_ERROR("Unable to access conditions object"); diff --git a/Calorimeter/CaloUtils/src/CaloLCOutOfClusterTool.cxx b/Calorimeter/CaloUtils/src/CaloLCOutOfClusterTool.cxx index 95753e59b77c87a6a3aaa07623f3046845145acb..ba5816aca4000d1b85693167f24ef19d74c7909f 100644 --- a/Calorimeter/CaloUtils/src/CaloLCOutOfClusterTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloLCOutOfClusterTool.cxx @@ -132,7 +132,7 @@ StatusCode CaloLCOutOfClusterTool::initialize() return StatusCode::SUCCESS; } -StatusCode CaloLCOutOfClusterTool::weight(CaloCluster *theCluster) const +StatusCode CaloLCOutOfClusterTool::weight(CaloCluster *theCluster, const EventContext& ctx) const { double eWeightedOrig = theCluster->e(); double eWeighted = theCluster->e(); @@ -198,7 +198,7 @@ StatusCode CaloLCOutOfClusterTool::weight(CaloCluster *theCluster) const double log10cluse = log10(eEM); - SG::ReadCondHandle<CaloLocalHadCoeff> h (m_key); + SG::ReadCondHandle<CaloLocalHadCoeff> h (m_key,ctx); const CaloLocalHadCoeff* data = *h; if (!data) { ATH_MSG_ERROR("Unable to access conditions object"); diff --git a/Calorimeter/CaloUtils/src/CaloLCWeightTool.cxx b/Calorimeter/CaloUtils/src/CaloLCWeightTool.cxx index 00414661d88ecc5fa39394d46c1b767c733c6477..4254a3230295e33c41585b6571fcec0f61559790 100644 --- a/Calorimeter/CaloUtils/src/CaloLCWeightTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloLCWeightTool.cxx @@ -28,11 +28,6 @@ #include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloIdentifier/CaloCell_ID.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" -//#include "GaudiKernel/ISvcLocator.h" -//#include "GaudiKernel/ListItem.h" -//#include "StoreGate/StoreGateSvc.h" - #include "xAODCaloEvent/CaloClusterKineHelper.h" CaloLCWeightTool::CaloLCWeightTool(const std::string& type, @@ -44,8 +39,7 @@ CaloLCWeightTool::CaloLCWeightTool(const std::string& type, m_useHadProbability(false), m_interpolate(false), m_calo_id(nullptr), - m_calo_dd_man(nullptr), - m_noiseTool("CaloNoiseTool/CaloNoiseToolDefault") + m_calo_dd_man(nullptr) { declareInterface<IClusterCellWeightTool>(this); @@ -54,7 +48,6 @@ CaloLCWeightTool::CaloLCWeightTool(const std::string& type, declareProperty("SignalOverNoiseCut",m_signalOverNoiseCut); // Use EM_PROBABILITY Moment to apply relative weights declareProperty("UseHadProbability",m_useHadProbability); - declareProperty("CaloNoiseTool", m_noiseTool); // Use Interpolation or not declareProperty("Interpolate",m_interpolate); m_interpolateDimensionNames.resize(3); @@ -91,26 +84,24 @@ StatusCode CaloLCWeightTool::initialize() ATH_CHECK( detStore()->retrieve (m_calo_dd_man, "CaloMgr") ); m_calo_id = m_calo_dd_man->getCaloCell_ID(); - //---- retrieve the noisetool ---------------- - - if(m_noiseTool.retrieve().isFailure()){ - ATH_MSG_INFO( "Unable to find tool for CaloNoiseTool"); - } else { - ATH_MSG_INFO( "Noise Tool retrieved" ); - } - m_sampnames.reserve(CaloSampling::Unknown); for (int iSamp=0;iSamp<CaloSampling::Unknown;iSamp++) { m_sampnames.push_back(CaloSamplingHelper::getSamplingName((CaloSampling::CaloSample)iSamp)); } + ATH_CHECK(m_noiseCDOKey.initialize()); + return StatusCode::SUCCESS; } -StatusCode CaloLCWeightTool::weight(xAOD::CaloCluster *theCluster) const +StatusCode CaloLCWeightTool::weight(xAOD::CaloCluster *theCluster, const EventContext& ctx) const { const CaloLocalHadCoeff* data(0); SG::ReadCondHandle<CaloLocalHadCoeff> rch(m_key); + + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey,ctx}; + const CaloNoise* noiseCDO=*noiseHdl; + data = *rch; if(data==0) { ATH_MSG_ERROR("Unable to access conditions object"); @@ -160,7 +151,7 @@ StatusCode CaloLCWeightTool::weight(xAOD::CaloCluster *theCluster) const Identifier myId = itrCell->ID(); CaloCell_ID::CaloSample theSample = CaloCell_ID::CaloSample(m_calo_id->calo_sample(myId)); if ( isAmpMap[theSample] >= 0 ) { - double sigma = m_noiseTool->getNoise(*itrCell,ICalorimeterNoiseTool::ELECTRONICNOISE); + double sigma = noiseCDO->getNoise(itrCell->ID(),itrCell->gain()); double energy = fabs(itrCell->e()); double ratio = 0; if ( std::isfinite(sigma) && sigma > 0 ) diff --git a/Control/AthViews/src/RoiCollectionToViews.cxx b/Control/AthViews/src/RoiCollectionToViews.cxx index acd8071d81aff2ec506dd1f54ca4166a23e8a4db..7950dbb7b5fdfc8f08fadb3adeb2e8483ca3dc11 100644 --- a/Control/AthViews/src/RoiCollectionToViews.cxx +++ b/Control/AthViews/src/RoiCollectionToViews.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "RoiCollectionToViews.h" @@ -36,7 +36,7 @@ RoiCollectionToViews::~RoiCollectionToViews() //////////////////////////// StatusCode RoiCollectionToViews::initialize() { - ATH_MSG_INFO ("Initializing " << name() << "..."); + ATH_MSG_DEBUG ("Initializing " << name() << "..."); CHECK( m_trigRoIs.initialize() ); CHECK( m_viewRoIs.initialize() ); @@ -46,13 +46,6 @@ StatusCode RoiCollectionToViews::initialize() return StatusCode::SUCCESS; } -StatusCode RoiCollectionToViews::finalize() -{ - ATH_MSG_INFO ("Finalizing " << name() << "..."); - - return StatusCode::SUCCESS; -} - StatusCode RoiCollectionToViews::execute() { ATH_MSG_DEBUG ("Executing " << name() << "..."); diff --git a/Control/AthViews/src/RoiCollectionToViews.h b/Control/AthViews/src/RoiCollectionToViews.h index add1f1bb9f0f7e35fe11289c7c4c699d914bdae9..961b197c10a1c7b5dcb8c34539bfcfaebecb1576 100644 --- a/Control/AthViews/src/RoiCollectionToViews.h +++ b/Control/AthViews/src/RoiCollectionToViews.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef ATHVIEWS_ATHVIEWS_ROICOLLECTIONTOVIEWS_H @@ -38,9 +38,8 @@ class RoiCollectionToViews virtual ~RoiCollectionToViews(); // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode execute() override; private: diff --git a/Control/AthViews/src/ViewDataVerifier.cxx b/Control/AthViews/src/ViewDataVerifier.cxx index 3c87fda21b11b55a0b98189d15504d0d27a538d9..3f479bc02550f3ed58036a26970d2d2b4d846f9e 100644 --- a/Control/AthViews/src/ViewDataVerifier.cxx +++ b/Control/AthViews/src/ViewDataVerifier.cxx @@ -1,7 +1,5 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // ViewDataVerifier.cxx @@ -16,31 +14,20 @@ // FrameWork includes #include "AthenaKernel/ExtendedEventContext.h" #include "AthViews/View.h" -namespace AthViews { -/////////////////////////////////////////////////////////////////// -// Public methods: -/////////////////////////////////////////////////////////////////// +namespace AthViews { -// Constructors -//////////////// -ViewDataVerifier::ViewDataVerifier( const std::string& name, +ViewDataVerifier::ViewDataVerifier( const std::string& name, ISvcLocator* pSvcLocator ) : ::AthAlgorithm( name, pSvcLocator ) { } -// Destructor -/////////////// ViewDataVerifier::~ViewDataVerifier() {} -// Athena Algorithm's Hooks -//////////////////////////// StatusCode ViewDataVerifier::initialize() { - ATH_MSG_INFO ("Initializing " << name() << "..."); - StatusCode sc = StatusCode::SUCCESS; // Debug message indicating what containers will be loaded @@ -66,21 +53,12 @@ StatusCode ViewDataVerifier::initialize() return sc; } -StatusCode ViewDataVerifier::finalize() -{ - ATH_MSG_INFO ("Finalizing " << name() << "..."); - - return StatusCode::SUCCESS; -} - StatusCode ViewDataVerifier::execute() { - ATH_MSG_DEBUG ("Executing " << name() << "..."); - // Retrieve the current view from the EventContext auto viewProxy = getContext().getExtension<Atlas::ExtendedEventContext>().proxy(); - ATH_MSG_INFO( name() << " running with store " << viewProxy->name() ); + ATH_MSG_DEBUG( "Executing " << name() << " running with store " << viewProxy->name() ); // Test each container for ( auto &obj : m_load.value() ) { @@ -93,14 +71,14 @@ StatusCode ViewDataVerifier::execute() // Test if the proxy is valid if ( dp ) { - ATH_MSG_INFO( "Found " << obj.key() << " in " << viewProxy->name() ); + ATH_MSG_DEBUG( "Found " << obj.key() << " in " << viewProxy->name() ); } else { ATH_MSG_ERROR( "Did not find " << obj.key() << " in " << viewProxy->name() ); const SG::View* view = dynamic_cast<const SG::View*>( viewProxy ); if ( view != 0 ) { - ATH_MSG_ERROR( "Available content is: " << view->dump() ); + ATH_MSG_ERROR( "Available content is: " << view->dump() ); } else { - ATH_MSG_ERROR( "Not a View" ); + ATH_MSG_ERROR( "Not a View" ); } return StatusCode::FAILURE; } @@ -109,24 +87,4 @@ StatusCode ViewDataVerifier::execute() return StatusCode::SUCCESS; } -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Protected methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Const methods: -/////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - } //> end namespace AthViews diff --git a/Control/AthViews/src/ViewDataVerifier.h b/Control/AthViews/src/ViewDataVerifier.h index 5d98a722420aba59ffff0bfa7679e4405ceb7bf2..4fb6d63329f06c41113fd2283de743a9ab1c7ea5 100644 --- a/Control/AthViews/src/ViewDataVerifier.h +++ b/Control/AthViews/src/ViewDataVerifier.h @@ -1,7 +1,5 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // ViewDataVerifier.h @@ -41,22 +39,10 @@ class ViewDataVerifier //ViewDataVerifier &operator=(const ViewDataVerifier &alg); // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// + virtual StatusCode initialize() override; + virtual StatusCode execute() override; - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: + private: /// Default constructor: ViewDataVerifier(); @@ -67,12 +53,5 @@ class ViewDataVerifier // vars }; -// I/O operators -////////////////////// - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - } //> end namespace AthViews #endif //> !ATHVIEWS_VIEWDATAVERIFIER_H diff --git a/Control/AthenaAuditors/CMakeLists.txt b/Control/AthenaAuditors/CMakeLists.txt index 39398ec295bc88fa3e2eb2c30151c252a973c173..3e6d8247e616083f6b3880b7b33ec752c6f2cdaf 100644 --- a/Control/AthenaAuditors/CMakeLists.txt +++ b/Control/AthenaAuditors/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 732183 2016-03-24 13:52:44Z krasznaa $ ################################################################################ # Package: AthenaAuditors ################################################################################ @@ -29,5 +28,5 @@ atlas_add_component( AthenaAuditors INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${GDB_INCLUDE_DIRS} ${LIBUNWIND_INCLUDE_DIRS} ${GPERFTOOLS_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${GDB_LIBRARIES} - ${LIBUNWIND_LIBRARIES} ${ZLIB_LIBRARIES} + ${LIBUNWIND_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS} AthenaBaseComps CoWTools GaudiKernel xAODEventInfo) diff --git a/Control/AthenaConfiguration/python/AthConfigFlags.py b/Control/AthenaConfiguration/python/AthConfigFlags.py index 5a88f12536e64a6054af6d55209d3249a943f7e1..ae65814bee15a9d1dfdbd7a100402d2345496149 100644 --- a/Control/AthenaConfiguration/python/AthConfigFlags.py +++ b/Control/AthenaConfiguration/python/AthConfigFlags.py @@ -24,7 +24,6 @@ class CfgFlag(object): def get(self,flagdict=None): if self._value is None: #Have to call the method to obtain the default value - #print "AutoConfiguring a config flag" self._value=self._setDef(flagdict) return deepcopy(self._value) @@ -100,7 +99,7 @@ class AthConfigFlags(object): def _loadDynaFlags(self, name): flagBaseName = name.split('.')[0] if flagBaseName in self._dynaflags: - print "dynamically loading the flag", flagBaseName + self._msg.debug("dynamically loading the flag %s", flagBaseName) isLocked = self._locked self._locked = False self.join( self._dynaflags[flagBaseName]() ) @@ -200,8 +199,8 @@ class AthConfigFlags(object): #Last sanity check: Make sure that teh replaced section still contains teh same names: if (replacedNames!=replacementNames): - print replacedNames - print replacementNames + self._msg.error(replacedNames) + self._msg.error(replacementNames) raise RuntimeError("Attempt to replace incompatible subsets: None matching flag names are " + repr(replacedNames ^ replacementNames )) @@ -210,25 +209,26 @@ class AthConfigFlags(object): def join(self,other): - if (self._locked): + if (self._locked): raise RuntimeError("Attempt to join with and already-locked container") - for (name,flag) in other._flagdict.iteritems(): - if name in self._flagdict: - raise KeyError("Duplicated flag name: %s" % name) - self._flagdict[name]=flag - return + for (name,flag) in other._flagdict.iteritems(): + if name in self._flagdict: + raise KeyError("Duplicated flag name: %s" % name) + self._flagdict[name]=flag + return def dump(self): - print "%-40.40s : %s" % ("Flag Name","Value") + print("%-40.40s : %s" % ("Flag Name","Value")) for name in sorted(self._flagdict): - print "%-40.40s : %s" % (name,repr(self._flagdict[name])) + print("%-40.40s : %s" % (name,repr(self._flagdict[name]))) if len(self._dynaflags) == 0: return - print "Flag categories that can be loaded dynamically" - print "%-15.15s : %30s : %s" % ("Category","Generator name", "Defined in" ) + print("Flag categories that can be loaded dynamically") + print("%-15.15s : %30s : %s" % ("Category","Generator name", "Defined in" )) for name,gen in sorted(self._dynaflags.iteritems()): - print "%-15.15s : %30s : %s" % (name, gen.func_name, '/'.join(gen.func_code.co_filename.split('/')[-2:])) + print("%-15.15s : %30s : %s" % + (name, gen.func_name, '/'.join(gen.func_code.co_filename.split('/')[-2:]))) def initAll(self): #Mostly a self-test method @@ -284,16 +284,16 @@ class TestAccess(TestFlagsSetup): class TestWrongAccess(TestFlagsSetup): def runTest(self): - """ access to the flags below should give an exception""" + """access to the flags below should give an exception""" with self.assertRaises(RuntimeError): - print self.flags.A is True - print self.flags.A.B == 6 + print(self.flags.A is True) + print(self.flags.A.B == 6) class TestDependentFlag(TestFlagsSetup): def runTest(self): - """ The dependent flags will use another flag value to establish its own value""" + """The dependent flags will use another flag value to establish its own value""" self.flags.A.B.C= True self.flags.lock() self.assertEqual(self.flags.A.dependentFlag, "TRUE VALUE", " dependent flag setting does not work") @@ -313,13 +313,13 @@ class TestFlagsSetupDynamic(TestFlagsSetup): class TestDynamicFlagsRead(TestFlagsSetupDynamic): def runTest(self): - """ Check if dynaic flags loading works """ + """Check if dynaic flags loading works""" self.assertEqual( self.flags.Z.A, 7, "dynamically loaded flags have wrong value") self.flags.dump() class TestDynamicFlagsSet(TestFlagsSetupDynamic): def runTest(self): - """ Check if dynaic flags loading works """ + """Check if dynaic flags loading works""" self.flags.Z.A = 15 self.assertEqual( self.flags.Z.A, 15, "dynamically loaded flags have wrong value") self.flags.dump() diff --git a/Control/AthenaConfiguration/python/AutoConfigFlags.py b/Control/AthenaConfiguration/python/AutoConfigFlags.py index 4ee3fba570c94be1fb752819b411875909e6a9ba..a2af75d18ec3f7ae5fafd6f6779a04468c4b36f7 100644 --- a/Control/AthenaConfiguration/python/AutoConfigFlags.py +++ b/Control/AthenaConfiguration/python/AutoConfigFlags.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import log from FilePeeker.FilePeeker import PeekFiles @@ -12,7 +12,7 @@ def GetFileMD(filenames): if filename not in _fileMetaData: if len(filenames)>1: log.info("Multiple input files. Use the first one for auto-configuration") - log.info("Obtaining metadata of auto-configuration by peeking into %s" % filename) + log.info("Obtaining metadata of auto-configuration by peeking into %s", filename) thisFileMD=PeekFiles([filename,]) _fileMetaData.update(thisFileMD) diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index 9a0a80c809d21df5693a830c6beb37d572bc957c..b132fb4a96339dc0b56330553f0f6d39f7ff9815 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -93,7 +93,8 @@ class ComponentAccumulator(object): return seq.getValuedProperties()[name] return seq.getDefaultProperties()[name] - self._msg.info( " "*nestLevel +"\\__ "+ seq.name() +" (seq: %s %s)" %( "SEQ" if __prop("Sequential") else "PAR", "OR" if __prop("ModeOR") else "AND" ) ) + self._msg.info( " "*nestLevel +"\\__ "+ seq.name() +" (seq: %s %s)", + "SEQ" if __prop("Sequential") else "PAR", "OR" if __prop("ModeOR") else "AND" ) nestLevel += 3 for c in seq.getChildren(): if isSequence(c): @@ -220,8 +221,8 @@ class ComponentAccumulator(object): if len(algorithms)>1: self._msg.warning("Called addEvenAlgo with a list of algorithms and primary==True. Designating the first algorithm as primary component") if self._primaryComp: - self._msg.warning("Overwriting primary component of this CA. Was %s/%s, now %s/%s" % \ - (self._primaryComp.getType(),self._primaryComp.getName(),algorithms[0].getType(),algorithms[0].getName())) + self._msg.warning("Overwriting primary component of this CA. Was %s/%s, now %s/%s", + self._primaryComp.getType(), self._primaryComp.getName(), algorithms[0].getType(), algorithms[0].getName()) #keep a ref of the algorithm as primary component self._primaryComp=algorithms[0] return None @@ -259,8 +260,8 @@ class ComponentAccumulator(object): deduplicate(algo,self._conditionsAlgs) #will raise on conflict if primary: if self._primaryComp: - self._msg.warning("Overwriting primary component of this CA. Was %s/%s, now %s/%s" % \ - (self._primaryComp.getType(),self._primaryComp.getName(),algo.getType(),algo.getName())) + self._msg.warning("Overwriting primary component of this CA. Was %s/%s, now %s/%s", + self._primaryComp.getType(),self._primaryComp.getName(),algo.getType(),algo.getName()) #keep a ref of the de-duplicated conditions algorithm as primary component self._primaryComp=self.__getOne( self._conditionsAlgs, algo.getName(), "ConditionsAlgos") return algo @@ -279,8 +280,8 @@ class ComponentAccumulator(object): deduplicate(newSvc,self._services) #will raise on conflict if primary: if self._primaryComp: - self._msg.warning("Overwriting primary component of this CA. Was %s/%s, now %s/%s" % \ - (self._primaryComp.getType(),self._primaryComp.getName(),newSvc.getType(),newSvc.getName())) + self._msg.warning("Overwriting primary component of this CA. Was %s/%s, now %s/%s", + self._primaryComp.getType(),self._primaryComp.getName(),newSvc.getType(),newSvc.getName()) #keep a ref of the de-duplicated public tool as primary component self._primaryComp=self.__getOne( self._services, newSvc.getName(), "Services") return @@ -294,8 +295,8 @@ class ComponentAccumulator(object): deduplicate(newTool,self._publicTools) if primary: if self._primaryComp: - self._msg.warning("Overwriting primary component of this CA. Was %s/%s, now %s/%s" % \ - (self._primaryComp.getType(),self._primaryComp.getName(),newTool.getType(),newTool.getName())) + self._msg.warning("Overwriting primary component of this CA. Was %s/%s, now %s/%s", + self._primaryComp.getType(),self._primaryComp.getName(),newTool.getType(),newTool.getName()) #keep a ref of the de-duplicated service as primary component self._primaryComp=self.__getOne( self._publicTools, newTool.getName(), "Public Tool") return @@ -320,14 +321,14 @@ class ComponentAccumulator(object): return self._publicTools def getPublicTool(self, name=None): - """ Returns single public tool, exception if either not found or to many found""" + """Returns single public tool, exception if either not found or to many found""" return self.__getOne( self._publicTools, name, "PublicTools") def getServices(self): return self._services def getService(self, name=None): - """ Returns single service, exception if either not found or to many found""" + """Returns single service, exception if either not found or to many found""" if name is None: return self._primarySvc else: @@ -364,7 +365,7 @@ class ComponentAccumulator(object): pass def merge(self,other, sequenceName=None): - """ Merging in the other accumulator """ + """Merging in the other accumulator""" if other is None: raise RuntimeError("merge called on object of type None: did you forget to return a CA from a config function?") @@ -373,8 +374,8 @@ class ComponentAccumulator(object): if (other._privateTools is not None): if isinstance(other._privateTools,ConfigurableAlgTool): - raise RuntimeError("merge called with a ComponentAccumulator a dangling private tool %s/%s" % \ - (other._privateTools.getType(),other._privateTools.getName())) + raise RuntimeError("merge called with a ComponentAccumulator a dangling private tool %s/%s", + other._privateTools.getType(),other._privateTools.getName()) else: raise RuntimeError("merge called with a ComponentAccumulator a dangling (array of) private tools") @@ -586,8 +587,6 @@ class ComponentAccumulator(object): self.appendConfigurable( alg ) evtalgseq.append( alg.getFullName() ) - - print self._sequence for seqName, algoList in flatSequencers( self._sequence ).iteritems(): # part of the sequence may come from the bootstrap, we need to retain the content, that is done here for prop in self._jocat[seqName]: @@ -661,7 +660,6 @@ class ComponentAccumulator(object): svcToCreate=[] extSvc=[] for svc in self._services: - print svc.getFullName() extSvc+=[svc.getFullName(),] if svc.getJobOptName() in _servicesToCreate: svcToCreate+=[svc.getFullName(),] @@ -672,7 +670,6 @@ class ComponentAccumulator(object): app.setProperty("ExtSvc",str(extSvc)) app.setProperty("CreateSvc",str(svcToCreate)) - print "CONFIGURE STEP" app.configure() msp=app.getService("MessageSvc") @@ -706,7 +703,7 @@ class ComponentAccumulator(object): #Add tree of algorithm sequences: for seqName, algoList in flatSequencers( self._sequence ).iteritems(): - self._msg.debug("Members of %s : %s" % (seqName,str([alg.getFullName() for alg in algoList]))) + self._msg.debug("Members of %s : %s", seqName, str([alg.getFullName() for alg in algoList])) bsh.addPropertyToCatalogue(jos,seqName,"Members",str( [alg.getFullName() for alg in algoList])) for alg in algoList: addCompToJos(alg) @@ -789,9 +786,9 @@ class ComponentAccumulator(object): def CAtoGlobalWrapper(cfgmethod,flags): - Configurable.configurableRun3Behavior+=1 - result=cfgmethod(flags) - Configurable.configurableRun3Behavior-=1 + Configurable.configurableRun3Behavior+=1 + result=cfgmethod(flags) + Configurable.configurableRun3Behavior-=1 - result.appendToGlobals() - return + result.appendToGlobals() + return diff --git a/Control/AthenaConfiguration/python/ComponentAccumulatorTest.py b/Control/AthenaConfiguration/python/ComponentAccumulatorTest.py index 9bacdeac32010dc7fadf8cc51c0d4fdb2ac59a9d..2cdc54e51ebf20ce486a9633bd302f63d39cb310 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulatorTest.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulatorTest.py @@ -41,7 +41,7 @@ class TestComponentAccumulator( unittest.TestCase ): result,algs=AlgsConf1( flags ) acc.merge(result) a = Algo("Algo3") - print "algo3 when created", id(a) + print("algo3 when created %s" % id(a)) algs.append(a) return acc,algs @@ -175,9 +175,9 @@ class MultipleParentsInSequences( unittest.TestCase ): # check if the recording did not harm the sequences with open("dummy.pkl") as f: s = pickle.load( f ) - self.assertEquals( s['seq1']["Members"], "['AthSequencer/seqReco']", "After pickling recoSeq missing in seq1 " + s['seq1']["Members"]) - self.assertEquals( s['seq2']["Members"], "['AthSequencer/seqReco']", "After pickling recoSeq missing in seq2 " + s['seq2']["Members"]) - self.assertEquals( s['seqReco']["Members"], "['ConfigurablePyAlgorithm/recoAlg']", "After pickling seqReco is corrupt " + s['seqReco']["Members"] ) + self.assertEqual( s['seq1']["Members"], "['AthSequencer/seqReco']", "After pickling recoSeq missing in seq1 " + s['seq1']["Members"]) + self.assertEqual( s['seq2']["Members"], "['AthSequencer/seqReco']", "After pickling recoSeq missing in seq2 " + s['seq2']["Members"]) + self.assertEqual( s['seqReco']["Members"], "['ConfigurablePyAlgorithm/recoAlg']", "After pickling seqReco is corrupt " + s['seqReco']["Members"] ) class ForbidRecursiveSequences( unittest.TestCase ): def runTest( self ): @@ -293,14 +293,14 @@ class TestComponentAccumulatorAccessors( unittest.TestCase ): ca.addEventAlgo(ConfigurablePyAlgorithm("alg1")) self.assertIsNotNone( ca.getEventAlgo(), "Found single alg") - self.assertEquals( len(ca.getEventAlgos()), 1 , "Found single alg") -# no idea why this assersts do not recognise exceptions -# self.assertRaises(ConfigurationError, ca.getEventAlgo("alg2")) - + self.assertEqual( len(ca.getEventAlgos()), 1 , "Found single alg") +# no idea why this assersts do not recognise exceptions +# self.assertRaises(ConfigurationError, ca.getEventAlgo("alg2")) + ca.addEventAlgo(ConfigurablePyAlgorithm("alg2")) self.assertIsNotNone( ca.getEventAlgo("alg2"), "Found single alg") - self.assertEquals( len(ca.getEventAlgos()), 2 , "Found single alg") + self.assertEqual( len(ca.getEventAlgos()), 2 , "Found single alg") # self.assertRaises(ConfigurationError, ca.getEventAlgo(), "Single Alg API ambiguity") class Tool(ConfigurableAlgTool): diff --git a/Control/AthenaConfiguration/python/Deduplication.py b/Control/AthenaConfiguration/python/Deduplication.py index 1d60d35752a6581406c4397d4e240d04b8519619..5fb69e434772e8ade7489bd83bc16a6ddfb069b9 100644 --- a/Control/AthenaConfiguration/python/Deduplication.py +++ b/Control/AthenaConfiguration/python/Deduplication.py @@ -91,14 +91,14 @@ def deduplicateComponent(newComp,comp): # Case 3: A private AlgTool: elif isinstance(oldprop,ConfigurableAlgTool): #Recursive de-duplication of that AlgTool - _msg.debug("Recursivly deduplicating ToolHandle %s" % oldprop) + _msg.debug("Recursivly deduplicating ToolHandle %s", oldprop) mergedTool=deduplicateComponent(oldprop,newprop) setattr(newComp,prop,mergedTool) continue #Case 4: A privateToolHandleArray elif isinstance(oldprop,GaudiHandleArray): - _msg.debug("Recursivly deduplicating ToolHandleArray %s" % oldprop) + _msg.debug("Recursivly deduplicating ToolHandleArray %s", oldprop) #Unnecessary by now? #if matchProperty(propid): # mergeprop = unifyProperty(propid, oldprop, newprop) diff --git a/Control/AthenaConfiguration/python/PropSetterProxy.py b/Control/AthenaConfiguration/python/PropSetterProxy.py index e55e6e32fa2b15c2c6517c5c0f2c36a0f60d5676..97f3abd993878576a531b99209651ff465ab72ab 100644 --- a/Control/AthenaConfiguration/python/PropSetterProxy.py +++ b/Control/AthenaConfiguration/python/PropSetterProxy.py @@ -3,6 +3,9 @@ from AthenaCommon.Logging import logging from AthenaCommon.CFElements import isSequence from AthenaCommon.Configurable import ConfigurableAlgTool from GaudiKernel.GaudiHandles import PrivateToolHandle, PrivateToolHandleArray + +msg = logging.getLogger('PropSetterProxy') + class PropSetterProxy(object): __compPaths = {} __scannedCA = None @@ -15,7 +18,6 @@ class PropSetterProxy(object): if name.startswith("_PropSetterProxy"): return super(PropSetterProxy, self).__setattr__(name, value) - msg = logging.getLogger('foreach_component') if name != "OutputLevel": msg.warning( "Only OutputLevel is allowed to be changed with the foreach_component at the moment" ) return @@ -27,12 +29,15 @@ class PropSetterProxy(object): if name in component.getProperties(): try: setattr( component, name, value ) - msg.info( "Set property: %s to value %s of component %s because it matched %s " % ( name, str(value), component_path, self.__path ) ) - except Exception, ex: - msg.warning( "Failed to set property: %s to value %s of component %s because it matched %s, reason: %s" % ( name, str(value), component_path, self.__path, str(ex) ) ) + msg.info( "Set property: %s to value %s of component %s because it matched %s ", + name, str(value), component_path, self.__path ) + except Exception as ex: + msg.warning( "Failed to set property: %s to value %s of component %s because it matched %s, reason: %s", + name, str(value), component_path, self.__path, str(ex) ) pass else: - msg.warning( "No such a property: %s in component %s, tried to set it because it matched %s" % ( name, component_path, self.__path ) ) + msg.warning( "No such a property: %s in component %s, tried to set it because it matched %s", + name, component_path, self.__path ) def __findComponents(self, ca): diff --git a/Control/AthenaConfiguration/python/TestDefaults.py b/Control/AthenaConfiguration/python/TestDefaults.py index ec5ce38d6f15042b1670cf995e1729cf1bb71bd4..420e737b651694591dcf0b6873dcd8e4d44b5705 100644 --- a/Control/AthenaConfiguration/python/TestDefaults.py +++ b/Control/AthenaConfiguration/python/TestDefaults.py @@ -1,9 +1,9 @@ #Files for use in configuration unit tests -class defaultTestFiles(): +class defaultTestFiles(object): import os d = os.environ.get ("ATLAS_REFERENCE_DATA", - "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art") + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art") EVNT= [d + "/SimCoreTests/mcatnlojimmy_ttbar_leptonfilter.19.2.5.37.EVNT.pool.root"] #find an official file. HITS= [d + "/Tier0ChainTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000425.pool.root.1"] HITS_SPECIAL = [d + "/DigitizationTests/mc16_13TeV.HITS.16965029._000024.pool.root.1"] diff --git a/Control/AthenaConfiguration/python/testAllConfigFlags.py b/Control/AthenaConfiguration/python/testAllConfigFlags.py index d5360d3cc94a00c3d4a2ffe2b40fc8d706882e02..d89f80a242d74573750c83c8d83ed0eb91126b86 100644 --- a/Control/AthenaConfiguration/python/testAllConfigFlags.py +++ b/Control/AthenaConfiguration/python/testAllConfigFlags.py @@ -5,8 +5,8 @@ acf.addFlag("flag2",2) acf.addFlag("flag3", lambda prev: prev.get("flag2")*2 ) acf.addFlag("flag7", lambda prev: prev.get("flag1")+27) -print acf.flag1 -print acf.flag3 +print(acf.flag1) +print(acf.flag3) #acf.addFlag("flag4", lambda prev: prev.get("flag5")*2 ) #acf.addFlag("flag5", lambda prev: prev.get("flag4")*2 ) @@ -21,23 +21,23 @@ acf.addFlag("domain2.flag2","xyz") acf.lock() -print "Initial flag container" +print("Initial flag container") acf.dump() acfPrime=acf.clone() acfPrime.flag3 = 42 -print "Cloned flag container" +print("Cloned flag container") acfPrime.dump() acfMod=acf.cloneAndReplace("domain1","domain2") -print "After cloneAndReplace" +print("After cloneAndReplace") acfMod.dump() ff=acf.initAll() -print "Frozen dict:" +print("Frozen dict:") acf.dump() diff --git a/Control/AthenaConfiguration/python/testEmpty.py b/Control/AthenaConfiguration/python/testEmpty.py index e3a40667340f4a08d0f9edfe4c59137fce521a5e..2e509f78ce34aa56bd64048aa79be54d88afe571 100644 --- a/Control/AthenaConfiguration/python/testEmpty.py +++ b/Control/AthenaConfiguration/python/testEmpty.py @@ -3,12 +3,12 @@ from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=1 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator acc = ComponentAccumulator() -print "bootstrap_test.pkl" +print("bootstrap_test.pkl") with file("bootstrap_test.pkl", "w") as p: acc.store( p, nEvents=10, useBootStrapFile=True, threaded=False ) p.close() -print "bootstrap_CA_test.pkl" +print("bootstrap_CA_test.pkl") with file("bootstrap_CA_test.pkl", "w") as p: acc.store( p, nEvents=10, useBootStrapFile=False, threaded=False ) p.close() diff --git a/Control/AthenaInterprocess/CMakeLists.txt b/Control/AthenaInterprocess/CMakeLists.txt index ad25efbefc1567a1c17b1f81c1f26ca3aee2ac8f..96bae6c96ce529ec3d3b30a62e0e2d6fbeef78ea 100644 --- a/Control/AthenaInterprocess/CMakeLists.txt +++ b/Control/AthenaInterprocess/CMakeLists.txt @@ -7,17 +7,17 @@ atlas_subdir( AthenaInterprocess ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC - Control/AthenaKernel - GaudiKernel ) + Control/AthenaKernel + GaudiKernel ) # External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) +find_package( Boost ) find_package( UUID ) # Component(s) in the package: atlas_add_library( AthenaInterprocess - src/*.cxx - PUBLIC_HEADERS AthenaInterprocess - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${UUID_LIBRARIES} AthenaKernel GaudiKernel rt ) - + AthenaInterprocess/*.h src/*.cxx + PUBLIC_HEADERS AthenaInterprocess + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${UUID_LIBRARIES} AthenaKernel GaudiKernel + PRIVATE_LINK_LIBRARIES ${CMAKE_DL_LIBS} ) diff --git a/Control/AthenaKernel/CMakeLists.txt b/Control/AthenaKernel/CMakeLists.txt index 99a1e35c6db90cba27c40d20f9bb73328d802535..d7e640b77ce244c750d840e7848ae42d7e668bfc 100644 --- a/Control/AthenaKernel/CMakeLists.txt +++ b/Control/AthenaKernel/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 787829 2016-12-02 10:10:58Z krasznaa $ ################################################################################ # Package: AthenaKernel ################################################################################ @@ -22,10 +21,10 @@ find_package( ROOT COMPONENTS Core ) find_package( UUID ) find_package(CLHEP) find_package( TBB ) -# Only link agains the RT library on Linux: -set( rt_library ) -if( UNIX AND NOT APPLE ) - set( rt_library rt ) +# Only link agains the RT library if it's available. +find_library( RT_LIBRARY rt ) +if( NOT RT_LIBRARY ) + unset( RT_LIBRARY ) endif() # Libraries in the package: @@ -35,8 +34,9 @@ atlas_add_library( AthenaKernel INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${UUID_LIBRARIES} CxxUtils DataModelRoot - GaudiKernel ${rt_library} - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES}) + GaudiKernel ${RT_LIBRARY} + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} + ${CMAKE_DL_LIBS} ) atlas_add_dictionary( AthenaKernelDict AthenaKernel/AthenaKernelDict.h diff --git a/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h b/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h index ea1558430d3f03623cc6a9c70e17843a49f3a8a7..81be9b98a5ab2d77306503a2ea5ca14df03fe0de 100644 --- a/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/GenericMonitoringTool.h @@ -19,6 +19,9 @@ #include "AthenaBaseComps/AthAlgTool.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODEventInfo/EventInfo.h" + #include "AthenaMonitoring/IMonitoredVariable.h" #include "AthenaMonitoring/HistogramDef.h" #include "AthenaMonitoring/HistogramFiller.h" @@ -44,17 +47,24 @@ * The following histogram types are supported: * - TH1[F,D,I] * - TH2[F,D,I] - * - TProfile[2D] + * - TProfile + * - TProfile2D + * - TEfficiency * * The following top-level paths are supported: * - EXPERT, SHIFT, DEBUG, RUNSTAT, EXPRESS * * The following options are suppored: - * - `kCanRebin` enables ROOT's internal functionality of autobinning the histogram - * - `kCumulative` does fill of all bins left to the bin into which the value falls - * - `kLBN` makes the histogram lumiblock aware - * - `kVec` adds the content of the monitored variable to the histogram bins - * - `kVecUO` same as kVec but treat 0th(last) element as underflow(overflow) + * - ROOT histogram settings group: + * - `kCanRebin` enables ROOT's internal functionality of autobinning the histogram + * - `Sumw2` activate the storage of the sum of squares of errors + * - Lumiblock awareness group: + * - `kLBNHistoryDepth=value` makes the histogram lumiblock aware and groups incoming data based on lumiblock number,\n + * 'value' should be defined as positive integer + * - Data collection group (only for TH1): + * - `kCumulative` does fill of all bins left to the bin into which the value falls + * - `kVec` adds the content of the monitored variable to the histogram bins + * - `kVecUO` same as kVec but treat 0th(last) element as underflow(overflow) * * Optionally, a colon-separated list of bin labels ("bin1:bin2:bin3:") can be provided (at least one * colon is required). In case of a 2D histogram the labels are assigned consecutively to the x-axis @@ -63,30 +73,30 @@ * @author Tomasz Bold * @author Piotr Sarna */ - class GenericMonitoringTool : public AthAlgTool { public: - GenericMonitoringTool(const std::string & type, const std::string & name, const IInterface* parent); + virtual ~GenericMonitoringTool() override; virtual StatusCode initialize() override; /// Retrieve the histogram fillers - std::vector<Monitored::HistogramFiller*> getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) const; + std::vector<std::shared_ptr<Monitored::HistogramFiller>> getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) const; /// Book histograms StatusCode book(); /// Overrride configured booking path - void setPath( const std::string& newPath ); + void setPath( const std::string& newPath ) { m_histoPath = newPath; } -private: - ServiceHandle<ITHistSvc> m_histSvc { this, "THistSvc", "THistSvc", "Histogramming svc" }; + virtual const ServiceHandle<ITHistSvc>& histogramService() { return m_histSvc; } + virtual uint32_t lumiBlock(); +private: + ServiceHandle<ITHistSvc> m_histSvc { this, "THistSvc", "THistSvc/THistSvc", "Histogramming svc" }; Gaudi::Property<std::string> m_histoPath { this, "HistPath", {}, "Directory for histograms [name of parent if not set]" }; - Gaudi::Property<std::vector<std::string> > m_histograms { this, "Histograms", {}, "Definitions of histograms"}; - Gaudi::Property<bool> m_explicitBooking { this, "ExplicitBooking", false, "Do not create histograms automatically in initialize but wait until the method book is called." }; + Gaudi::Property<std::vector<std::string> > m_histograms { this, "Histograms", {}, "Definitions of histograms"}; + Gaudi::Property<bool> m_explicitBooking { this, "ExplicitBooking", false, "Do not create histograms automatically in initialize but wait until the method book is called." }; - std::vector<Monitored::HistogramFiller*> m_fillers; //!< list of fillers + std::vector<std::shared_ptr<Monitored::HistogramFiller>> m_fillers; //!< list of fillers }; - /** * Helper class to declare an empty monitoring ToolHandle * diff --git a/Control/AthenaMonitoring/AthenaMonitoring/HistogramFiller.h b/Control/AthenaMonitoring/AthenaMonitoring/HistogramFiller.h index 36c99dd370ba896d4612e31db5a706bd9891a909..255fe37833c0a398ed424fefa6c103ed9ea04f3e 100644 --- a/Control/AthenaMonitoring/AthenaMonitoring/HistogramFiller.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/HistogramFiller.h @@ -10,11 +10,9 @@ #include <memory> #include <vector> -#include "TNamed.h" -#include "TEfficiency.h" - -#include "AthenaMonitoring/IMonitoredVariable.h" #include "AthenaMonitoring/HistogramDef.h" +#include "AthenaMonitoring/IHistogramProvider.h" +#include "AthenaMonitoring/IMonitoredVariable.h" namespace Monitored { /** @@ -25,22 +23,21 @@ namespace Monitored { /** * @brief Default constructor * - * @param hist ROOT object to fill * @param histDef Histogram definition of ROOT object */ - HistogramFiller(TNamed* hist, const HistogramDef& histDef) - : m_hist(hist), - m_mutex(std::make_shared<std::mutex>()), - m_histDef(new HistogramDef(histDef)) {} + HistogramFiller(const HistogramDef& histDef, std::shared_ptr<IHistogramProvider> histogramProvider) + : m_mutex(std::make_shared<std::mutex>()), + m_histDef(new HistogramDef(histDef)), + m_histogramProvider(histogramProvider) {} /** * @brief Copy constructor * * @param hf Other HistogramFiller */ HistogramFiller(const HistogramFiller& hf) - : m_hist(hf.m_hist) - , m_mutex(hf.m_mutex) - , m_histDef(hf.m_histDef) {} + : m_mutex(hf.m_mutex), + m_histDef(hf.m_histDef), + m_histogramProvider(hf.m_histogramProvider) {} /** * @brief Move constructor */ @@ -70,20 +67,18 @@ namespace Monitored { } protected: - /** - * @brief Getter for associated ROOT object - * - * @return Instance of ROOT object - */ - virtual TNamed* histogram() = 0; - - TNamed* m_hist; + template <class H> + H* histogram() { + return static_cast<H*>(m_histogramProvider->histogram()); + } + std::shared_ptr<std::mutex> m_mutex; std::shared_ptr<HistogramDef> m_histDef; + std::shared_ptr<IHistogramProvider> m_histogramProvider; std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> m_monVariables; private: HistogramFiller& operator=(HistogramFiller const&) = delete; }; } -#endif /* AthenaMonitoring_HistogramFiller_h */ +#endif /* AthenaMonitoring_HistogramFiller_HistogramFiller_h */ diff --git a/Control/AthenaMonitoring/AthenaMonitoring/IHistogramProvider.h b/Control/AthenaMonitoring/AthenaMonitoring/IHistogramProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..7ae7529c6742329b2d9a674b6c13c20b0aa6ba70 --- /dev/null +++ b/Control/AthenaMonitoring/AthenaMonitoring/IHistogramProvider.h @@ -0,0 +1,25 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef AthenaMonitoring_HistogramFiller_IHistogramProvider_h +#define AthenaMonitoring_HistogramFiller_IHistogramProvider_h + +#include "TNamed.h" + +namespace Monitored { + /** + * @brief Interface of the source of ROOT objects for HistogramFillers + */ + class IHistogramProvider { + public: + /** + * @brief Getter of ROOT object + * + * @return ROOT object + */ + virtual TNamed* histogram() = 0; + }; +} + +#endif /* AthenaMonitoring_HistogramFiller_IHistogramProvider_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/AthenaMonitoring/MonitoredGroup.h b/Control/AthenaMonitoring/AthenaMonitoring/MonitoredGroup.h index 282e1883bde09e7d30475dc7e6fc7eda388e2684..05a29823a2d468c9734dd07c44818b3a0b7ed36f 100644 --- a/Control/AthenaMonitoring/AthenaMonitoring/MonitoredGroup.h +++ b/Control/AthenaMonitoring/AthenaMonitoring/MonitoredGroup.h @@ -16,7 +16,6 @@ #include "AthenaMonitoring/IMonitoredVariable.h" namespace Monitored { - /** * @brief Group local monitoring quantities and retain correlation when filling histograms * @@ -41,22 +40,16 @@ namespace Monitored { * @param monitoredGroup list of variables to be monitored **/ template <typename... T> - Group(const ToolHandle<GenericMonitoringTool>& tool, T&&... monitoredGroup) : - m_tool(tool), + Group(const ToolHandle<GenericMonitoringTool>& tool, T&&... monitoredGroup) + : m_tool(tool), m_autoFill(true), m_monitoredGroup{monitoredGroup...}, - m_histogramsFillers(!m_tool.empty() ? m_tool->getHistogramsFillers(m_monitoredGroup) - : std::vector<HistogramFiller*>()) - {} + m_histogramsFillers(!m_tool.empty() ? m_tool->getHistogramsFillers(m_monitoredGroup) : std::vector<std::shared_ptr<Monitored::HistogramFiller>>()) { } - virtual ~Group() - { + virtual ~Group() { if (m_autoFill) { fill(); } - for (auto filler : m_histogramsFillers) { - delete filler; - } } /** @@ -77,9 +70,9 @@ namespace Monitored { * \endcode * **/ - virtual void fill() - { + virtual void fill() { setAutoFill(false); + for (auto filler : m_histogramsFillers) { filler->fill(); } @@ -98,12 +91,11 @@ namespace Monitored { ToolHandle<GenericMonitoringTool> m_tool; bool m_autoFill; const std::vector<std::reference_wrapper<IMonitoredVariable>> m_monitoredGroup; - const std::vector<HistogramFiller*> m_histogramsFillers; + const std::vector<std::shared_ptr<Monitored::HistogramFiller>> m_histogramsFillers; }; template <typename... T> - void fill(const ToolHandle<GenericMonitoringTool>& tool, T&&... variables) - { + void fill(const ToolHandle<GenericMonitoringTool>& tool, T&&... variables) { if (!tool.empty()) { for (auto filler : tool->getHistogramsFillers({std::forward<T>(variables)...})) { filler->fill(); diff --git a/Control/AthenaMonitoring/CMakeLists.txt b/Control/AthenaMonitoring/CMakeLists.txt index ec248b281c60beadebc1ceec85189d0b6f1903e7..416f80c1cd98dadaba38928523f4ebb17829e235 100644 --- a/Control/AthenaMonitoring/CMakeLists.txt +++ b/Control/AthenaMonitoring/CMakeLists.txt @@ -19,7 +19,7 @@ atlas_depends_on_subdirs( PUBLIC Event/EventInfo Tools/LWHists Trigger/TrigAnalysis/TrigAnalysisInterfaces - AtlasTest/TestTools) + AtlasTest/TestTools) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) @@ -46,18 +46,34 @@ atlas_add_component( AthenaMonitoring atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -# Units tests: -foreach ( name GenericMonParsing_test GenericMonFilling_test ) - atlas_add_test( ${name} - SOURCES test/${name}.cxx - LINK_LIBRARIES AthenaMonitoringLib GaudiKernel TestTools AthenaKernel - ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" - POST_EXEC_SCRIPT "true" - PROPERTIES TIMEOUT 300 - ) +# Units tests C++: +file( GLOB CXX_TEST_FILES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cxx ) +foreach ( test_file ${CXX_TEST_FILES} ) + get_filename_component( name ${test_file} NAME_WE) + set( rundir ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_cxx_${name} ) + file( REMOVE_RECURSE ${rundir} ) + file( MAKE_DIRECTORY ${rundir} ) + atlas_add_test( ${name} + SOURCES ${test_file} + LINK_LIBRARIES AthenaMonitoringLib GaudiKernel TestTools AthenaKernel + ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" + POST_EXEC_SCRIPT "true" + PROPERTIES TIMEOUT 300 + PROPERTIES WORKING_DIRECTORY ${rundir} + ) endforeach() -atlas_add_test( defineHistogram - SCRIPT python ${CMAKE_CURRENT_SOURCE_DIR}/test/test_defineHistogram.py - POST_EXEC_SCRIPT "true" -) +# Units tests Python: + +file( GLOB PYTHON_TEST_FILES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/*.py ) +foreach ( test_file ${PYTHON_TEST_FILES} ) + get_filename_component( name ${test_file} NAME_WE) + set( rundir ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_py_${name} ) + file( REMOVE_RECURSE ${rundir} ) + file( MAKE_DIRECTORY ${rundir} ) + atlas_add_test( ${name} + SCRIPT python ${test_file} + POST_EXEC_SCRIPT "true" + PROPERTIES WORKING_DIRECTORY ${rundir} + ) +endforeach() diff --git a/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py b/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py index 0be4a8a71a5fb710c22ccbc5e07949863edd1458..d525ad2db8fa0dc9673b18ef3064bc39537c56b3 100644 --- a/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py +++ b/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py @@ -85,7 +85,7 @@ def ExampleMonitoringConfig(inputFlags): myGroup.defineHistogram('lb', title='Luminosity Block;lb;Events', path='ToFindThem',xbins=1000,xmin=-0.5,xmax=999.5) myGroup.defineHistogram('random', title='LB;x;Events', - path='ToBringThemAll',xbins=30,xmin=0,xmax=1) + path='ToBringThemAll',xbins=30,xmin=0,xmax=1,opt='kLBNHistoryDepth=10') myGroup.defineHistogram('pT_passed,pT',type='TEfficiency',title='Test TEfficiency;x;Eff', path='AndInTheDarkness',xbins=100,xmin=0.0,xmax=50.0) diff --git a/Control/AthenaMonitoring/python/__init__.py b/Control/AthenaMonitoring/python/__init__.py index 93e6266cb2b2a27b3876ab193bd31a34b1edc9af..70198ce84c5291c4970f12cf779605f0af874948 100644 --- a/Control/AthenaMonitoring/python/__init__.py +++ b/Control/AthenaMonitoring/python/__init__.py @@ -2,5 +2,5 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # -from AthMonitorCfgHelper import AthMonitorCfgHelper, AthMonitorCfgHelperOld -from AtlasReadyFilterTool import GetAtlasReadyFilterTool +from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper, AthMonitorCfgHelperOld +from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool diff --git a/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx index 397187e6d57e0c26b6dba3d1aa25319aa116791f..6b80c4d38ca21a50411d2f8a82d3a6ecfdfde184 100644 --- a/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx +++ b/Control/AthenaMonitoring/src/GenericMonitoringTool.cxx @@ -5,11 +5,15 @@ #include <map> #include <mutex> #include <algorithm> + #include <TH1.h> #include <TH2.h> #include <TProfile.h> #include <TProfile2D.h> +#include "EventInfo/EventID.h" +#include "EventInfo/EventInfo.h" + #include "AthenaMonitoring/GenericMonitoringTool.h" #include "AthenaMonitoring/HistogramDef.h" @@ -18,11 +22,13 @@ using namespace Monitored; GenericMonitoringTool::GenericMonitoringTool(const std::string & type, const std::string & name, const IInterface* parent) - : AthAlgTool(type, name, parent) { -} + : AthAlgTool(type, name, parent) { } + +GenericMonitoringTool::~GenericMonitoringTool() { } StatusCode GenericMonitoringTool::initialize() { ATH_CHECK(m_histSvc.retrieve()); + if ( not m_explicitBooking ) { ATH_MSG_DEBUG("Proceeding to histogram booking"); return book(); @@ -30,7 +36,6 @@ StatusCode GenericMonitoringTool::initialize() { return StatusCode::SUCCESS; } - StatusCode GenericMonitoringTool::book() { // If no histogram path given use parent or our own name @@ -44,7 +49,7 @@ StatusCode GenericMonitoringTool::book() { ATH_MSG_DEBUG("Booking histograms in path: " << m_histoPath.value()); - HistogramFillerFactory factory(m_histSvc, m_histoPath); + HistogramFillerFactory factory(this, m_histoPath); m_fillers.reserve(m_histograms.size()); for (const std::string& item : m_histograms) { @@ -52,9 +57,9 @@ StatusCode GenericMonitoringTool::book() { HistogramDef def = HistogramDef::parse(item); if (def.ok) { - HistogramFiller* filler = factory.create(def); + std::shared_ptr<HistogramFiller> filler(factory.create(def)); - if (filler != nullptr) { + if (filler) { m_fillers.push_back(filler); } else { ATH_MSG_WARNING( "The histogram filler cannot be instantiated for: " << def.name ); @@ -77,12 +82,12 @@ StatusCode GenericMonitoringTool::book() { return StatusCode::SUCCESS; } -std::vector<HistogramFiller*> GenericMonitoringTool::getHistogramsFillers(std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> monitoredVariables) const { - std::vector<HistogramFiller*> result; +std::vector<std::shared_ptr<HistogramFiller>> GenericMonitoringTool::getHistogramsFillers(std::vector<std::reference_wrapper<IMonitoredVariable>> monitoredVariables) const { + std::vector<std::shared_ptr<HistogramFiller>> result; for (auto filler : m_fillers) { auto fillerVariables = filler->histogramVariablesNames(); - std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> variables; + std::vector<std::reference_wrapper<IMonitoredVariable>> variables; for (auto fillerVariable : fillerVariables) { for (auto monValue : monitoredVariables) { @@ -98,7 +103,7 @@ std::vector<HistogramFiller*> GenericMonitoringTool::getHistogramsFillers(std::v continue; } - HistogramFiller* fillerCopy = filler->clone(); + std::shared_ptr<HistogramFiller> fillerCopy(filler->clone()); fillerCopy->setMonitoredVariables(variables); result.push_back(fillerCopy); } @@ -106,6 +111,6 @@ std::vector<HistogramFiller*> GenericMonitoringTool::getHistogramsFillers(std::v return result; } -void GenericMonitoringTool::setPath( const std::string& newPath ) { - m_histoPath = newPath; -} +uint32_t GenericMonitoringTool::lumiBlock() { + return Gaudi::Hive::currentContext().eventID().lumi_block(); +} \ No newline at end of file diff --git a/Control/AthenaMonitoring/src/HistogramDef.cxx b/Control/AthenaMonitoring/src/HistogramDef.cxx index 35d39643da49ef7a0ff59e25fa0ff80bc54766dc..37a35e888ad51cad289a5e06a3a9cec7b6c95fa5 100644 --- a/Control/AthenaMonitoring/src/HistogramDef.cxx +++ b/Control/AthenaMonitoring/src/HistogramDef.cxx @@ -8,17 +8,16 @@ #include "AthenaMonitoring/HistogramDef.h" -using namespace std; using namespace Monitored; typedef boost::tokenizer<boost::char_separator<char>> tokenizer_t; -const HistogramDef HistogramDef::parse(const string &histogramDefinition) { +const HistogramDef HistogramDef::parse(const std::string &histogramDefinition) { HistogramDef result; try { - vector<string> properties = splitWithSeparator(histogramDefinition, ","); - vector<string>::iterator propertiesIterator = properties.begin(); + std::vector<std::string> properties = splitWithSeparator(histogramDefinition, ","); + std::vector<std::string>::iterator propertiesIterator = properties.begin(); if (properties.size() < 5) { return result; @@ -42,8 +41,8 @@ const HistogramDef HistogramDef::parse(const string &histogramDefinition) { resolveAxies(result, properties, propertiesIterator); // check if there are bin labels (e.g. str1:str2:str3:str4) - if (propertiesIterator != properties.end() && propertiesIterator->find(":") != string::npos) { - vector<string> splitResult = splitWithSeparator(nextProperty(propertiesIterator), ":"); + if (propertiesIterator != properties.end() && propertiesIterator->find(":") != std::string::npos) { + std::vector<std::string> splitResult = splitWithSeparator(nextProperty(propertiesIterator), ":"); result.labels.insert(result.labels.end(), splitResult.begin(), splitResult.end()); } @@ -60,13 +59,13 @@ const HistogramDef HistogramDef::parse(const string &histogramDefinition) { } } -vector<string> HistogramDef::splitWithSeparator(const string &input, const char *separator) { +std::vector<std::string> HistogramDef::splitWithSeparator(const std::string &input, const char *separator) { boost::char_separator<char> sep(separator); tokenizer_t tokens(input, sep); - vector<string> result; + std::vector<std::string> result; for (tokenizer_t::iterator itr = tokens.begin(); itr != tokens.end(); ++itr) { - string word = *itr; + std::string word = *itr; boost::trim(word); result.push_back(word); } @@ -74,12 +73,12 @@ vector<string> HistogramDef::splitWithSeparator(const string &input, const char return result; } -string HistogramDef::nextProperty(vector<string>::iterator &propertiesIterator) { +std::string HistogramDef::nextProperty(std::vector<std::string>::iterator &propertiesIterator) { return *(propertiesIterator++); } template<typename T> -T HistogramDef::parseToken(const string &token, const string &errorDescription) { +T HistogramDef::parseToken(const std::string &token, const std::string &errorDescription) { try { return boost::lexical_cast<T>(token); } catch (boost::bad_lexical_cast &) { @@ -88,10 +87,10 @@ T HistogramDef::parseToken(const string &token, const string &errorDescription) } void HistogramDef::resolveAlias(HistogramDef &histogramDefinition) { - string::size_type semicolon_pos = histogramDefinition.name.back().find(';'); + std::string::size_type semicolon_pos = histogramDefinition.name.back().find(';'); - if (semicolon_pos != string::npos) { - string actual_name = histogramDefinition.name.back().substr(0, semicolon_pos); + if (semicolon_pos != std::string::npos) { + std::string actual_name = histogramDefinition.name.back().substr(0, semicolon_pos); histogramDefinition.alias = histogramDefinition.name.back().substr(semicolon_pos + 1); histogramDefinition.name.back() = actual_name; } else { @@ -107,7 +106,7 @@ void HistogramDef::resolveAlias(HistogramDef &histogramDefinition) { } } -void HistogramDef::resolveAxies(HistogramDef &histogramDefinition, vector<string> &properties, vector<string>::iterator &propertiesIterator) { +void HistogramDef::resolveAxies(HistogramDef &histogramDefinition, std::vector<std::string> &properties, std::vector<std::string>::iterator &propertiesIterator) { if (distance(propertiesIterator, properties.end()) < 3) { throw TokenException("NOT enough parameters for defining 1-D histogram"); } diff --git a/Control/AthenaMonitoring/src/HistogramFiller/CumulativeHistogramFiller1D.h b/Control/AthenaMonitoring/src/HistogramFiller/CumulativeHistogramFiller1D.h index 57111d831ee070a30c0b2df9afb9e24838c7e5f9..811a9f06c66bfdd634b33a8a17231313c3766912 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/CumulativeHistogramFiller1D.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/CumulativeHistogramFiller1D.h @@ -13,28 +13,26 @@ namespace Monitored { */ class CumulativeHistogramFiller1D : public HistogramFiller1D { public: - CumulativeHistogramFiller1D(TH1* hist, const HistogramDef& histDef) - : HistogramFiller1D(hist, histDef) {} + CumulativeHistogramFiller1D(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider) + : HistogramFiller1D(definition, provider) {} virtual CumulativeHistogramFiller1D* clone() override { return new CumulativeHistogramFiller1D(*this); }; virtual unsigned fill() override { - using namespace std; - if (m_monVariables.size() != 1) { return 0; } unsigned i(0); - auto hist = histogram(); + auto histogram = this->histogram<TH1>(); auto valuesVector = m_monVariables[0].get().getVectorRepresentation(); - lock_guard<mutex> lock(*(this->m_mutex)); + std::lock_guard<std::mutex> lock(*(this->m_mutex)); for (auto value : valuesVector) { - unsigned bin = hist->FindBin(value); + unsigned bin = histogram->FindBin(value); for (unsigned j = bin; j > 0; --j) { - hist->AddBinContent(j); + histogram->AddBinContent(j); } ++i; diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFactory.cxx b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFactory.cxx index e03175d35def10191a348eabb34be35b8b37f1e4..35f5d0ffafc4b5fd89c20fc3b04031c849047b55 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFactory.cxx +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFactory.cxx @@ -130,15 +130,12 @@ HBASE* HistogramFactory::create(const HistogramDef& def, Types&&... hargs) { void HistogramFactory::setOpts(TH1* hist, const std::string& opt) { // try to apply an option - if ( opt.find("kCanRebin") != std::string::npos ) { - hist->SetCanExtend(TH1::kAllAxes); - } else { - hist->SetCanExtend(TH1::kNoAxis); - } + const unsigned canExtendPolicy = opt.find("kCanRebin") != std::string::npos ? TH1::kAllAxes : TH1::kNoAxis; + hist->SetCanExtend(canExtendPolicy); + // try to apply option to make Sumw2 in histogram - if ( opt.find("Sumw2") != std::string::npos ) { - hist->Sumw2(); - } + const bool shouldActivateSumw2 = opt.find("Sumw2") != std::string::npos; + hist->Sumw2(shouldActivateSumw2); } void HistogramFactory::setLabels(TH1* hist, const std::vector<std::string>& labels) { diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFactory.h b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFactory.h index ac7f23cf5216b077df5723d478d4c04df8279d6f..3f7a2fdea64a38dfc318585f4e5e9a27423d0105 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFactory.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFactory.h @@ -13,6 +13,8 @@ #include "AthenaMonitoring/HistogramDef.h" +#include "HistogramException.h" + namespace Monitored { /** * @brief Bridge between ROOT framework and monitoring code @@ -41,7 +43,7 @@ namespace Monitored { * @param def Histogram definition * @return ROOT object handler */ - TNamed* create(const HistogramDef& def); + virtual TNamed* create(const HistogramDef& def); private: /** * @brief Create and register histogram diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller1D.h b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller1D.h index 346188c09b81708f258c6826ba951d4e7150860e..c89e94dec5f2dc8b036b189afe14db24502bcdbb 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller1D.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller1D.h @@ -15,31 +15,26 @@ namespace Monitored { */ class HistogramFiller1D : public HistogramFiller { public: - HistogramFiller1D(TH1* hist, const HistogramDef& histDef) - : HistogramFiller(hist, histDef) {} - + HistogramFiller1D(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider) + : HistogramFiller(definition, provider) {} + HistogramFiller1D* clone() override { return new HistogramFiller1D(*this); }; virtual unsigned fill() override { - using namespace std; - if (m_monVariables.size() != 1) { return 0; } - unsigned i(0); + auto histogram = this->histogram<TH1>(); auto valuesVector = m_monVariables[0].get().getVectorRepresentation(); - lock_guard<mutex> lock(*(this->m_mutex)); + std::lock_guard<std::mutex> lock(*(this->m_mutex)); for (auto value : valuesVector) { - histogram()->Fill(value); - ++i; + histogram->Fill(value); } - return i; + return std::size(valuesVector); } - protected: - virtual TH1* histogram() override { return static_cast<TH1*>(m_hist); } }; } diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller2D.h b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller2D.h index da9bee40a09bfaa24d4f3d9a2e23624c6d300bab..0bc820ab58852c69854a2f4e32f7c2ec59ad6163 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller2D.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller2D.h @@ -15,48 +15,55 @@ namespace Monitored { */ class HistogramFiller2D : public HistogramFiller { public: - HistogramFiller2D(TH2* hist, const HistogramDef& histDef) - : HistogramFiller(hist, histDef) {}; - + HistogramFiller2D(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider) + : HistogramFiller(definition, provider) {} + virtual HistogramFiller2D* clone() override { return new HistogramFiller2D(*this); }; virtual unsigned fill() override { - using namespace std; - if (m_monVariables.size() != 2) { return 0; } - unsigned i(0); - auto hist = histogram(); - auto valuesVector1 = m_monVariables[0].get().getVectorRepresentation(); - auto valuesVector2 = m_monVariables[1].get().getVectorRepresentation(); - lock_guard<mutex> lock(*(this->m_mutex)); - - if (valuesVector1.size() != valuesVector2.size()) { - if (valuesVector1.size() == 1) { - // first variable is scalar -- loop over second - for (auto value2 : valuesVector2) { - hist->Fill(valuesVector1[0], value2); - ++i; - } - } else if (valuesVector2.size() == 1) { - // second varaible is scalar -- loop over first - for (auto value1 : valuesVector1) { - hist->Fill(value1, valuesVector2[0]); - ++i; - } + unsigned result = 0; + const auto vector1 = m_monVariables[0].get().getVectorRepresentation(); + const auto vector2 = m_monVariables[1].get().getVectorRepresentation(); + const unsigned size1 = std::size(vector1); + const unsigned size2 = std::size(vector2); + const bool isAnyVectorEmpty = size1 == 0 || size2 == 0; + const bool isAnyVectorScalar = size1 == 1 || size2 == 1; + const bool areVectorsSameSize = size1 == size2; + const bool areVectorsValid = !isAnyVectorEmpty && (areVectorsSameSize || isAnyVectorScalar); + + if (!areVectorsValid) { + return 0; + } + + auto histogram = this->histogram<TH2>(); + std::lock_guard<std::mutex> lock(*(this->m_mutex)); + + if (areVectorsSameSize) { + for (unsigned i = 0; i < size1; ++i) { + histogram->Fill(vector1[i], vector2[i]); + } + + result = size1; + } else if (size1 == 1) { + for (auto value : vector2) { + histogram->Fill(vector1[0], value); } + + result = size2; } else { - for (i = 0; i < valuesVector1.size(); ++i) { - hist->Fill(valuesVector1[i], valuesVector2[i]); + for (auto value : vector1) { + histogram->Fill(value, vector2[0]); } + + result = size1; } - - return i; + + return result; } - protected: - virtual TH2* histogram() override { return static_cast<TH2*>(m_hist); } }; } diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller2DProfile.h b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller2DProfile.h index f1c34df97fd46619dcb473b024adf9083bee5214..71e607072961c14781e42799c38bae8669f17e30 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller2DProfile.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFiller2DProfile.h @@ -15,24 +15,21 @@ namespace Monitored { */ class HistogramFiller2DProfile : public HistogramFiller { public: - HistogramFiller2DProfile(TProfile2D* hist, const HistogramDef& histDef) - : HistogramFiller(hist, histDef) {}; + HistogramFiller2DProfile(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider) + : HistogramFiller(definition, provider) {} virtual HistogramFiller2DProfile* clone() override { return new HistogramFiller2DProfile(*this); }; virtual unsigned fill() override { - using namespace std; - if (m_monVariables.size() != 3) { return 0; } - unsigned i(0); - auto hist = histogram(); + auto histogram = this->histogram<TProfile2D>(); auto valuesVector1 = m_monVariables[0].get().getVectorRepresentation(); auto valuesVector2 = m_monVariables[1].get().getVectorRepresentation(); auto valuesVector3 = m_monVariables[2].get().getVectorRepresentation(); - lock_guard<mutex> lock(*(this->m_mutex)); + std::lock_guard<std::mutex> lock(*(this->m_mutex)); /*HERE NEED TO INCLUDE CASE IN WHICH SOME VARIABLES ARE SCALAR AND SOME VARIABLES ARE VECTORS unsigned i(0); if (m_variable1->size() != m_variable2->size() || m_variable1->size() != m_variable3->size() || m_variable2->size() != m_variable3->size() ) { @@ -40,14 +37,12 @@ namespace Monitored { }*/ //For now lets just consider the case in which all variables are of the same length - for (i = 0; i < valuesVector1.size(); ++i) { - hist->Fill(valuesVector1[i], valuesVector2[i], valuesVector3[i]); + for (unsigned i = 0; i < std::size(valuesVector1); ++i) { + histogram->Fill(valuesVector1[i], valuesVector2[i], valuesVector3[i]); } - return i; + return std::size(valuesVector1); } - protected: - virtual TProfile2D* histogram() override { return static_cast<TProfile2D*>(m_hist); } }; } diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerEfficiency.h b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerEfficiency.h index 3e7e8ae9c12c4d6c90023a08681e2b2d2bcd21a3..7a0bdf8b68246ce8263ebfde8cd805243c06acca 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerEfficiency.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerEfficiency.h @@ -15,8 +15,8 @@ namespace Monitored { */ class HistogramFillerEfficiency : public HistogramFiller { public: - HistogramFillerEfficiency(TEfficiency* eff, const HistogramDef& histDef) - : HistogramFiller(eff, histDef) {}; + HistogramFillerEfficiency(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider) + : HistogramFiller(definition, provider) {} virtual HistogramFillerEfficiency* clone() override { return new HistogramFillerEfficiency(*this); }; @@ -25,20 +25,17 @@ namespace Monitored { return 0; } - unsigned i(0); - auto hist = histogram(); + auto histogram = this->histogram<TEfficiency>(); auto valuesVector1 = m_monVariables[0].get().getVectorRepresentation(); auto valuesVector2 = m_monVariables[1].get().getVectorRepresentation(); std::lock_guard<std::mutex> lock(*(this->m_mutex)); - for (i = 0; i < valuesVector1.size(); ++i) { - hist->Fill(valuesVector1[i],valuesVector2[i]); + for (unsigned i = 0; i < std::size(valuesVector1); ++i) { + histogram->Fill(valuesVector1[i],valuesVector2[i]); } - return i; + return std::size(valuesVector1); } - protected: - virtual TEfficiency* histogram() override { return static_cast<TEfficiency*>(m_hist); } }; } diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerFactory.cxx b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerFactory.cxx index d8107ee1e77c6f769156ae1bc8829bd31647598d..bf062cdefee8b986bbb30d8b3e3b22fbb52555c6 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerFactory.cxx +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerFactory.cxx @@ -4,6 +4,9 @@ #include <boost/algorithm/string.hpp> +#include "StaticHistogramProvider.h" +#include "LumiblockHistogramProvider.h" + #include "HistogramFiller1D.h" #include "HistogramFillerEfficiency.h" #include "CumulativeHistogramFiller1D.h" @@ -18,27 +21,39 @@ using namespace Monitored; HistogramFiller* HistogramFillerFactory::create(const HistogramDef& def) { - TNamed* const histogram = m_factory->create(def); - + std::shared_ptr<IHistogramProvider> histogramProvider = createHistogramProvider(def); + if (boost::starts_with(def.type, "TH1")) { if (def.opt.find("kCumulative") != std::string::npos) { - return new CumulativeHistogramFiller1D(dynamic_cast<TH1*>(histogram), def); + return new CumulativeHistogramFiller1D(def, histogramProvider); } else if (def.opt.find("kVecUO") != std::string::npos) { - return new VecHistogramFiller1DWithOverflows(dynamic_cast<TH1*>(histogram), def); + return new VecHistogramFiller1DWithOverflows(def, histogramProvider); } else if (def.opt.find("kVec") != std::string::npos) { - return new VecHistogramFiller1D(dynamic_cast<TH1*>(histogram), def); + return new VecHistogramFiller1D(def, histogramProvider); } else { - return new HistogramFiller1D(dynamic_cast<TH1*>(histogram), def); + return new HistogramFiller1D(def, histogramProvider); } } else if (boost::starts_with(def.type, "TH2")) { - return new HistogramFiller2D(dynamic_cast<TH2*>(histogram), def); + return new HistogramFiller2D(def, histogramProvider); } else if (def.type == "TProfile") { - return new HistogramFillerProfile(dynamic_cast<TProfile*>(histogram), def); + return new HistogramFillerProfile(def, histogramProvider); } else if (def.type == "TProfile2D") { - return new HistogramFiller2DProfile(dynamic_cast<TProfile2D*>(histogram), def); + return new HistogramFiller2DProfile(def, histogramProvider); } else if (def.type == "TEfficiency") { - return new HistogramFillerEfficiency(dynamic_cast<TEfficiency*>(histogram), def); + return new HistogramFillerEfficiency(def, histogramProvider); } return nullptr; +} + +std::shared_ptr<IHistogramProvider> HistogramFillerFactory::createHistogramProvider(const HistogramDef& def) { + std::shared_ptr<IHistogramProvider> result; + + if (def.opt.find("kLBNHistoryDepth") != std::string::npos) { + result.reset(new LumiblockHistogramProvider(m_gmTool, m_factory, def)); + } else { + result.reset(new StaticHistogramProvider(m_factory, def)); + } + + return result; } \ No newline at end of file diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerFactory.h b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerFactory.h index 7443e128701d26df1fe18c950437bdc5e8329bd8..5361cd9ca54c3f7d2aab66896c47d04ec5560f85 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerFactory.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerFactory.h @@ -8,8 +8,10 @@ #include <memory> #include <vector> +#include "AthenaMonitoring/GenericMonitoringTool.h" #include "AthenaMonitoring/HistogramDef.h" #include "AthenaMonitoring/HistogramFiller.h" +#include "AthenaMonitoring/IHistogramProvider.h" #include "HistogramFactory.h" @@ -22,11 +24,12 @@ namespace Monitored { /** * @brief Default constructor * - * @param histSvc ROOT framework histogramming service + * @param gmTool An instance of GenericMonitoringTool * @param groupName Name of the group to which produced histograms will belong */ - HistogramFillerFactory(const ServiceHandle<ITHistSvc>& histSvc, std::string groupName) - : m_factory(new HistogramFactory(histSvc, std::move(groupName))) {} + HistogramFillerFactory(GenericMonitoringTool * const gmTool, std::string groupName) + : m_gmTool(std::move(gmTool)), + m_factory(new HistogramFactory(gmTool->histogramService(), std::move(groupName))) {} /** * @brief Virtual destructor @@ -43,6 +46,9 @@ namespace Monitored { */ HistogramFiller* create(const HistogramDef& def); private: + std::shared_ptr<IHistogramProvider> createHistogramProvider(const HistogramDef& def); + + GenericMonitoringTool *m_gmTool; std::shared_ptr<HistogramFactory> m_factory; }; } diff --git a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerProfile.h b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerProfile.h index 5af4e93c4fd9669b0bc998d88fcf0ad3dc3ce98e..d171db2efa790b194b02d88a338961cee3ed6978 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerProfile.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/HistogramFillerProfile.h @@ -15,48 +15,44 @@ namespace Monitored { */ class HistogramFillerProfile : public HistogramFiller { public: - HistogramFillerProfile(TProfile* hist, const HistogramDef& histDef) - : HistogramFiller(hist, histDef) {}; + HistogramFillerProfile(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider) + : HistogramFiller(definition, provider) {} virtual HistogramFillerProfile* clone() override { return new HistogramFillerProfile(*this); }; virtual unsigned fill() override { - using namespace std; - if (m_monVariables.size() != 2) { return 0; } unsigned i(0); - auto hist = histogram(); + auto histogram = this->histogram<TProfile>(); auto valuesVector1 = m_monVariables[0].get().getVectorRepresentation(); auto valuesVector2 = m_monVariables[1].get().getVectorRepresentation(); - lock_guard<mutex> lock(*(this->m_mutex)); + std::lock_guard<std::mutex> lock(*(this->m_mutex)); if (valuesVector1.size() != valuesVector2.size()) { if (valuesVector1.size() == 1) { // first variable is scalar -- loop over second for (auto value2 : valuesVector2) { - hist->Fill(valuesVector1[0], value2); + histogram->Fill(valuesVector1[0], value2); ++i; } } else if (valuesVector2.size() == 1) { // second variable is scalar -- loop over first for (auto value1 : valuesVector1) { - hist->Fill(value1, valuesVector2[0]); + histogram->Fill(value1, valuesVector2[0]); ++i; } } } else { - for (i = 0; i < valuesVector1.size(); ++i) { - hist->Fill(valuesVector1[i], valuesVector2[i]); + for (i = 0; i < std::size(valuesVector1); ++i) { + histogram->Fill(valuesVector1[i], valuesVector2[i]); } } return i; } - protected: - virtual TProfile* histogram() override { return static_cast<TProfile*>(m_hist); } }; } diff --git a/Control/AthenaMonitoring/src/HistogramFiller/LumiblockHistogramProvider.h b/Control/AthenaMonitoring/src/HistogramFiller/LumiblockHistogramProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..8bf4328573efd38af30865b6a37c90d7f5e527b9 --- /dev/null +++ b/Control/AthenaMonitoring/src/HistogramFiller/LumiblockHistogramProvider.h @@ -0,0 +1,94 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef AthenaMonitoring_HistogramFiller_LumiblockHistogramProvider_h +#define AthenaMonitoring_HistogramFiller_LumiblockHistogramProvider_h + +#include <memory> + +#include "AthenaMonitoring/GenericMonitoringTool.h" +#include "AthenaMonitoring/HistogramDef.h" +#include "AthenaMonitoring/IHistogramProvider.h" + +#include "HistogramFactory.h" + +namespace Monitored { + /** + * @brief Implementation of IHistogramProvider for lumi block based histograms + * + * This provider produces histograms that groups data based on current lumi block and defined histogry depth. + * Note: kLBNHistoryDepth must be defined in histogram definition options + */ + class LumiblockHistogramProvider : public IHistogramProvider { + public: + /** + * @brief Constructor + * + * @param gmTool Source of the lumi block info + * @param factory ROOT object factory + * @param def General definition of a histogram + */ + LumiblockHistogramProvider(GenericMonitoringTool* const gmTool, + std::shared_ptr<HistogramFactory> factory, + const HistogramDef& histDef) + : IHistogramProvider(), m_gmTool(gmTool), m_factory(factory), m_histDef(new HistogramDef(histDef)), m_historyDepth(parseHistoryDepth(histDef)) {} + + /** + * @brief Getter of ROOT object + * + * Each time the method is called, factory produces ROOT object based on the current lumi block. + * Note: ROOT objects are cached at the factory. Nevertheless, it is recommended to call this method as rarely as possible. + * + * @return ROOT object + */ + TNamed* histogram() override { + const unsigned lumiBlock = m_gmTool->lumiBlock(); + const unsigned lumiPage = lumiBlock/m_historyDepth; + const unsigned minLumi = lumiPage * m_historyDepth; + const unsigned maxLumi = minLumi + m_historyDepth - 1; + + HistogramDef def = *m_histDef; + + def.alias = def.alias + "(" + std::to_string(minLumi) + "-" + std::to_string(maxLumi) + ")"; + + return m_factory->create(def); + } + private: + /** + * @brief Parser for kLBNHistoryDepth option + * + * kLBNHistoryDepth should be defined as unsigned integer eg. kLBNHistoryDepth=10 + * + * @return User defined LBN history depth + * @throws HistogramException if kLBNHistoryDepth cannot be properly parsed + */ + static unsigned parseHistoryDepth(const HistogramDef& histDef) { + const std::string sizeKey = "kLBNHistoryDepth="; + const std::size_t sizeKeyPosition = histDef.opt.find(sizeKey); + + if (sizeKeyPosition == std::string::npos) { + throw HistogramException("Lumiblock histogram >"+ histDef.path + "< NOT define kLBNHistoryDepth"); + } + + const std::size_t sizeStartPosition = sizeKeyPosition + sizeKey.length(); + const std::size_t sizeStopPosition = histDef.opt.find_first_not_of("1234567890", sizeStartPosition); + const std::size_t sizeLength = sizeStopPosition - sizeStartPosition; + + if (sizeLength == 0) { + throw HistogramException("Lumiblock histogram >"+ histDef.path + "< NOT define valid kLBNHistoryDepth"); + } + + const std::string sizeStrValue = histDef.opt.substr(sizeStartPosition, sizeLength); + + return std::stoul(sizeStrValue); + } + + GenericMonitoringTool* const m_gmTool; + std::shared_ptr<HistogramFactory> m_factory; + std::shared_ptr<HistogramDef> m_histDef; + unsigned m_historyDepth; + }; +} + +#endif /* AthenaMonitoring_HistogramFiller_LumiblockHistogramProvider_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/src/HistogramFiller/StaticHistogramProvider.h b/Control/AthenaMonitoring/src/HistogramFiller/StaticHistogramProvider.h new file mode 100644 index 0000000000000000000000000000000000000000..5a9fc3fabcea91aad30395cdfe3db7be87d534f1 --- /dev/null +++ b/Control/AthenaMonitoring/src/HistogramFiller/StaticHistogramProvider.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef AthenaMonitoring_HistogramFiller_StaticHistogramProvider_h +#define AthenaMonitoring_HistogramFiller_StaticHistogramProvider_h + +#include <memory> + +#include "AthenaMonitoring/HistogramDef.h" +#include "AthenaMonitoring/IHistogramProvider.h" + +#include "HistogramFactory.h" + +namespace Monitored { + /** + * @brief Default implementation of IHistogramProvider interface + * + * This provider implements standard way of handling ROOT objects in the code: + * 1. Create and store ROOT object during provider initialization + * 2. Return stored ROOT object if needed + */ + class StaticHistogramProvider : public IHistogramProvider { + public: + /** + * @brief Constructor + * + * @param factory ROOT objects factory + * @param def Definition of a histogram to create + */ + StaticHistogramProvider(std::shared_ptr<HistogramFactory> factory, const HistogramDef& def) + : m_histogram(factory->create(def)) {} + + /** + * @brief Getter of ROOT object + * + * @return ROOT object + */ + TNamed* histogram() override { + return m_histogram; + } + private: + TNamed* m_histogram; + }; +} + +#endif /* AthenaMonitoring_HistogramFiller_IHistogramProvider_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/src/HistogramFiller/VecHistogramFiller1D.h b/Control/AthenaMonitoring/src/HistogramFiller/VecHistogramFiller1D.h index 9404aca12e05b02c8503b8fce5d9c3cea7287711..aa489e54c63d84084495422a17287df49914815c 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/VecHistogramFiller1D.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/VecHistogramFiller1D.h @@ -10,31 +10,27 @@ namespace Monitored { class VecHistogramFiller1D : public HistogramFiller1D { public: - VecHistogramFiller1D(TH1* hist, const HistogramDef& histDef) - : HistogramFiller1D(hist, histDef) {} + VecHistogramFiller1D(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider) + : HistogramFiller1D(definition, provider) {} virtual VecHistogramFiller1D* clone() override { return new VecHistogramFiller1D(*this); }; virtual unsigned fill() override { - using namespace std; - if (m_monVariables.size() != 1) { return 0; } - unsigned i(0); - auto hist = histogram(); + auto histogram = this->histogram<TH1>(); auto valuesVector = m_monVariables[0].get().getVectorRepresentation(); - lock_guard<mutex> lock(*(this->m_mutex)); - - for (auto value : valuesVector) { - hist->AddBinContent(i+1, value); - hist->SetEntries(hist->GetEntries() + value); + std::lock_guard<std::mutex> lock(*(this->m_mutex)); - ++i; + for (unsigned i = 0; i < std::size(valuesVector); ++i) { + auto value = valuesVector[i]; + histogram->AddBinContent(i+1, value); + histogram->SetEntries(histogram->GetEntries() + value); } - return i; + return std::size(valuesVector); } }; } diff --git a/Control/AthenaMonitoring/src/HistogramFiller/VecHistogramFiller1DWithOverflows.h b/Control/AthenaMonitoring/src/HistogramFiller/VecHistogramFiller1DWithOverflows.h index 17efb9ebb3ee45a79855dbcc3535cc1c8823fe91..1b33e8436235ffbe9b2ec90c6eb904eba23f538e 100644 --- a/Control/AthenaMonitoring/src/HistogramFiller/VecHistogramFiller1DWithOverflows.h +++ b/Control/AthenaMonitoring/src/HistogramFiller/VecHistogramFiller1DWithOverflows.h @@ -10,31 +10,27 @@ namespace Monitored { class VecHistogramFiller1DWithOverflows : public HistogramFiller1D { public: - VecHistogramFiller1DWithOverflows(TH1* hist, const HistogramDef& histDef) - : HistogramFiller1D(hist, histDef) {} + VecHistogramFiller1DWithOverflows(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider) + : HistogramFiller1D(definition, provider) {} virtual VecHistogramFiller1DWithOverflows* clone() override { return new VecHistogramFiller1DWithOverflows(*this); }; virtual unsigned fill() override { - using namespace std; - if (m_monVariables.size() != 1) { return 0; } - unsigned i(0); - auto hist = histogram(); + auto histogram = this->histogram<TH1>(); auto valuesVector = m_monVariables[0].get().getVectorRepresentation(); - lock_guard<mutex> lock(*(this->m_mutex)); - - for (auto value : valuesVector) { - hist->AddBinContent(i, value); - hist->SetEntries(hist->GetEntries() + value); + std::lock_guard<std::mutex> lock(*(this->m_mutex)); - ++i; + for (unsigned i = 0; i < std::size(valuesVector); ++i) { + auto value = valuesVector[i]; + histogram->AddBinContent(i, value); + histogram->SetEntries(histogram->GetEntries() + value); } - return i; + return std::size(valuesVector); } }; } diff --git a/Control/AthenaMonitoring/test/GenericMonFilling_test.cxx b/Control/AthenaMonitoring/test/GenericMonFilling_test.cxx index 1d49367f1061ce8b618cde312f4e6b2d7bd8181f..94200d25d4b225076a7a4bd7779aba6080e79c54 100644 --- a/Control/AthenaMonitoring/test/GenericMonFilling_test.cxx +++ b/Control/AthenaMonitoring/test/GenericMonFilling_test.cxx @@ -352,7 +352,7 @@ int main() { log << MSG::ERROR << "Failed to acquire the MonTool tools via the ToolHandle" << endmsg; return -1; } - + assert( fillFromScalarWorked( validMon, histSvc ) ); assert( noToolBehaviourCorrect( emptyMon ) ); assert( fillFromScalarIndependentScopesWorked( validMon, histSvc ) ); diff --git a/Control/AthenaMonitoring/test/HistogramFactoryTestSuite.cxx b/Control/AthenaMonitoring/test/HistogramFactoryTestSuite.cxx new file mode 100644 index 0000000000000000000000000000000000000000..89ec3db175f3fdb2c97845d8df75337cd1a8e190 --- /dev/null +++ b/Control/AthenaMonitoring/test/HistogramFactoryTestSuite.cxx @@ -0,0 +1,321 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#undef NDEBUG +#include <cassert> +#include <iostream> +#include <list> +#include <functional> +#include <memory> + +#include "TestTools/initGaudi.h" +#include "TestTools/expect.h" +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ITHistSvc.h" +#include "AthenaKernel/getMessageSvc.h" + +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TProfile2D.h" + +#include "AthenaMonitoring/HistogramDef.h" + +#include "../src/HistogramFiller/HistogramFactory.h" + +using namespace std; +using namespace Monitored; + +#define REGISTER_TEST_CASE(TEST_CASE_NAME) registerTestCase(&HistogramFactoryTestSuite::TEST_CASE_NAME, #TEST_CASE_NAME) + +class HistogramFactoryTestSuite { + // ==================== All registered test cases ==================== + private: + list<function<void(void)>> registeredTestCases() { + return { + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTH1FHistogram), + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTH1DHistogram), + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTH1IHistogram), + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTH2FHistogram), + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTH2DHistogram), + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTH2IHistogram), + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTProfileHistogram), + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTProfile2DHistogram), + REGISTER_TEST_CASE(test_shouldRegisterAndReturnTEfficiencyHistogram), + REGISTER_TEST_CASE(test_shouldThrowExceptionForUnknownHistogramType), + REGISTER_TEST_CASE(test_shouldProperlyFormatPathForOnlineHistograms), + REGISTER_TEST_CASE(test_shouldProperlyFormatPathForDefaultHistograms), + REGISTER_TEST_CASE(test_shouldProperlyFormatPathForCustomHistograms), + REGISTER_TEST_CASE(test_shouldSetXAxisLabelsFor1DHistogram), + REGISTER_TEST_CASE(test_shouldSetXAndYAxisLabelsFor2DHistogram), + REGISTER_TEST_CASE(test_shouldSetExtendAxesWhenkCanRebinIsSet), + REGISTER_TEST_CASE(test_shouldNotSetExtendAxesWhenkCanRebinIsNotSet), + REGISTER_TEST_CASE(test_shouldSetSumw2WhenSumw2IsSet), + REGISTER_TEST_CASE(test_shouldNotSetSumw2WhenSumw2IsNotSet), + }; + } + + // ==================== Test code ==================== + private: + void beforeEach() { + m_testObj.reset(new HistogramFactory(m_histSvc, "HistogramFactoryTestSuite")); + } + + void afterEach() { + clearHistogramService(); + } + + void test_shouldRegisterAndReturnTH1FHistogram() { + TH1F* const histogram = createHistogram<TH1F>("TH1F"); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TH1F")) EXPECTED(true); + VALUE(histogram) NOT_EXPECTED(nullptr); + } + + void test_shouldRegisterAndReturnTH1DHistogram() { + TH1D* const histogram = createHistogram<TH1D>("TH1D"); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TH1D")) EXPECTED(true); + VALUE(histogram) NOT_EXPECTED(nullptr); + } + + void test_shouldRegisterAndReturnTH1IHistogram() { + TH1I* const histogram = createHistogram<TH1I>("TH1I"); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TH1I")) EXPECTED(true); + VALUE(histogram) NOT_EXPECTED(nullptr); + } + + void test_shouldRegisterAndReturnTH2FHistogram() { + TH2F* const histogram = createHistogram<TH2F>("TH2F"); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TH2F")) EXPECTED(true); + VALUE(histogram) NOT_EXPECTED(nullptr); + } + + void test_shouldRegisterAndReturnTH2DHistogram() { + TH2D* const histogram = createHistogram<TH2D>("TH2D"); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TH2D")) EXPECTED(true); + VALUE(histogram) NOT_EXPECTED(nullptr); + } + + void test_shouldRegisterAndReturnTH2IHistogram() { + TH2I* const histogram = createHistogram<TH2I>("TH2I"); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TH2I")) EXPECTED(true); + VALUE(histogram) NOT_EXPECTED(nullptr); + } + + void test_shouldRegisterAndReturnTProfileHistogram() { + TProfile* const histogram = createHistogram<TProfile>("TProfile"); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TProfile")) EXPECTED(true); + VALUE(histogram) NOT_EXPECTED(nullptr); + } + + void test_shouldRegisterAndReturnTProfile2DHistogram() { + TProfile2D* const histogram = createHistogram<TProfile2D>("TProfile2D"); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TProfile2D")) EXPECTED(true); + VALUE(histogram) NOT_EXPECTED(nullptr); + } + + void test_shouldRegisterAndReturnTEfficiencyHistogram() { + TEfficiency* const graph = createHistogram<TEfficiency>("TEfficiency"); + // VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/TEfficiency")) EXPECTED(true); + VALUE(graph) NOT_EXPECTED(nullptr); + } + + void test_shouldThrowExceptionForUnknownHistogramType() { + try { + createHistogram<TH1F>("UnknownType"); + } catch (const HistogramException&) { + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/UnknownType")) EXPECTED(false); + return; + } + + assert(false); + } + + void test_shouldProperlyFormatPathForOnlineHistograms() { + auto possibleCases = { + make_tuple("EXPERT", "/EXPERT/HistogramFactoryTestSuite/onlineHistAlias"), + make_tuple("SHIFT", "/SHIFT/HistogramFactoryTestSuite/onlineHistAlias"), + make_tuple("DEBUG", "/DEBUG/HistogramFactoryTestSuite/onlineHistAlias"), + make_tuple("RUNSTAT", "/RUNSTAT/HistogramFactoryTestSuite/onlineHistAlias"), + make_tuple("EXPRES", "/EXPRES/HistogramFactoryTestSuite/onlineHistAlias"), + }; + + for (auto possibleCase : possibleCases) { + const string onlinePath = get<0>(possibleCase); + const string expectedPath = get<1>(possibleCase); + + HistogramDef histogramDef = defaultHistogramDef("TH1F"); + histogramDef.path = onlinePath; + histogramDef.alias = "onlineHistAlias"; + m_testObj->create(histogramDef); + VALUE(m_histSvc->exists(expectedPath)) EXPECTED(true); + } + } + + void test_shouldProperlyFormatPathForDefaultHistograms() { + HistogramDef histogramDef = defaultHistogramDef("TH1F"); + histogramDef.path = "DEFAULT"; + histogramDef.alias = "/defaultAlias"; + m_testObj->create(histogramDef); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/defaultAlias")) EXPECTED(true); + } + + void test_shouldProperlyFormatPathForCustomHistograms() { + HistogramDef histogramDef = defaultHistogramDef("TH1F"); + histogramDef.path = "/custom/path/for/histogram"; + histogramDef.alias = "customAlias"; + m_testObj->create(histogramDef); + VALUE(m_histSvc->exists("/HistogramFactoryTestSuite/custom/path/for/histogram/customAlias")) EXPECTED(true); + } + + void test_shouldSetXAxisLabelsFor1DHistogram() { + HistogramDef histogramDef = defaultHistogramDef("TH1F"); + histogramDef.alias = "labels1DTestAlias"; + histogramDef.xbins = 3; + histogramDef.ybins = 0; + histogramDef.labels = { "label1", "label2", "label3", "label4" }; + TH1F* const histogram = dynamic_cast<TH1F*>(m_testObj->create(histogramDef)); + + VALUE(histogram->GetXaxis()->GetNbins()) EXPECTED(3); + VALUE(string(histogram->GetXaxis()->GetBinLabel(1))) EXPECTED("label1"); + VALUE(string(histogram->GetXaxis()->GetBinLabel(2))) EXPECTED("label2"); + VALUE(string(histogram->GetXaxis()->GetBinLabel(3))) EXPECTED("label3"); + VALUE(histogram->GetYaxis()->GetNbins()) EXPECTED(1); + VALUE(string(histogram->GetYaxis()->GetBinLabel(1))) EXPECTED("label4"); + } + + void test_shouldSetXAndYAxisLabelsFor2DHistogram() { + HistogramDef histogramDef = defaultHistogramDef("TH2F"); + histogramDef.alias = "labels2DTestAlias"; + histogramDef.xbins = 3; + histogramDef.ybins = 3; + histogramDef.labels = { "label1", "label2", "label3", "label4", "label5", "label6" }; + TH2F* const histogram = dynamic_cast<TH2F*>(m_testObj->create(histogramDef)); + + VALUE(histogram->GetXaxis()->GetNbins()) EXPECTED(3); + VALUE(string(histogram->GetXaxis()->GetBinLabel(1))) EXPECTED("label1"); + VALUE(string(histogram->GetXaxis()->GetBinLabel(2))) EXPECTED("label2"); + VALUE(string(histogram->GetXaxis()->GetBinLabel(3))) EXPECTED("label3"); + VALUE(histogram->GetYaxis()->GetNbins()) EXPECTED(3); + VALUE(string(histogram->GetYaxis()->GetBinLabel(1))) EXPECTED("label4"); + VALUE(string(histogram->GetYaxis()->GetBinLabel(2))) EXPECTED("label5"); + VALUE(string(histogram->GetYaxis()->GetBinLabel(3))) EXPECTED("label6"); + } + + void test_shouldSetExtendAxesWhenkCanRebinIsSet() { + HistogramDef histogramDef = defaultHistogramDef("TH1F"); + histogramDef.alias = "allAxesRebinAlias"; + histogramDef.opt = "kCanRebin"; + TH1F* const histogram = dynamic_cast<TH1F*>(m_testObj->create(histogramDef)); + + VALUE(histogram->CanExtendAllAxes()) EXPECTED(true); + } + + void test_shouldNotSetExtendAxesWhenkCanRebinIsNotSet() { + HistogramDef histogramDef = defaultHistogramDef("TH1F"); + histogramDef.alias = "noAxesRebinAlias"; + histogramDef.opt = ""; + TH1F* const histogram = dynamic_cast<TH1F*>(m_testObj->create(histogramDef)); + + VALUE(histogram->CanExtendAllAxes()) EXPECTED(false); + } + + void test_shouldSetSumw2WhenSumw2IsSet() { + HistogramDef histogramDef = defaultHistogramDef("TH1F"); + histogramDef.alias = "Sumw2ActiveAlias"; + histogramDef.opt = "Sumw2"; + TH1F* const histogram = dynamic_cast<TH1F*>(m_testObj->create(histogramDef)); + + VALUE(histogram->GetSumw2N()) EXPECTED(3); + } + + void test_shouldNotSetSumw2WhenSumw2IsNotSet() { + HistogramDef histogramDef = defaultHistogramDef("TH1F"); + histogramDef.alias = "Sumw2InactiveAlias"; + histogramDef.opt = ""; + TH1F* const histogram = dynamic_cast<TH1F*>(m_testObj->create(histogramDef)); + + VALUE(histogram->GetSumw2N()) EXPECTED(0); + } + + // ==================== Helper methods ==================== + private: + HistogramDef defaultHistogramDef(const string& histogramType) { + HistogramDef result; + + result.path = "DEFAULT"; + result.type = histogramType; + result.alias = histogramType; + result.title = histogramType; + result.xbins = 1; + result.ybins = 1; + + return result; + } + + template <class HistogramType> + HistogramType* createHistogram(const string& histogramType) { + HistogramDef histogramDef = defaultHistogramDef(histogramType); + return dynamic_cast<HistogramType*>(m_testObj->create(histogramDef)); + } + + void clearHistogramService() { + for (string histName : m_histSvc->getHists()) { + m_histSvc->deReg(histName); + } + + for (string treeName : m_histSvc->getTrees()) { + m_histSvc->deReg(treeName); + } + + for (string graphName : m_histSvc->getGraphs()) { + m_histSvc->deReg(graphName); + } + } + + // ==================== Initialization & run ==================== + public: + HistogramFactoryTestSuite() + : m_histSvc("THistSvc", "HistogramFactoryTestSuite"), + m_log(Athena::getMessageSvc(), "HistogramFactoryTestSuite") { + VALUE(m_histSvc.retrieve()) EXPECTED(StatusCode::SUCCESS); + } + + void run() { + for (function<void(void)> testCase : registeredTestCases()) { + testCase(); + } + } + + // ==================== Test case registration ==================== + private: + typedef void (HistogramFactoryTestSuite::*TestCase)(void); + + function<void(void)> registerTestCase(TestCase testCase, string testCaseName) { + return [this, testCase, testCaseName]() { + m_log << MSG::INFO << "Current test case: " << testCaseName << endmsg; + beforeEach(); + invoke(testCase, this); + afterEach(); + }; + } + + // ==================== Properties ==================== + private: + ServiceHandle<ITHistSvc> m_histSvc; + MsgStream m_log; + + shared_ptr<HistogramFactory> m_testObj; +}; + +int main() { + ISvcLocator* pSvcLoc; + + if (!Athena_test::initGaudi("GenericMon.txt", pSvcLoc)) { + throw runtime_error("This test can not be run: GenericMon.txt is missing"); + } + + HistogramFactoryTestSuite().run(); + + return 0; +} diff --git a/Control/AthenaMonitoring/test/HistogramFillerFactoryTestSuite.cxx b/Control/AthenaMonitoring/test/HistogramFillerFactoryTestSuite.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1633ffd0f14b46d0c6f92f1a067e1003ceaa058c --- /dev/null +++ b/Control/AthenaMonitoring/test/HistogramFillerFactoryTestSuite.cxx @@ -0,0 +1,216 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#undef NDEBUG +#include <cassert> +#include <iostream> +#include <list> +#include <functional> +#include <memory> + +#include "TestTools/initGaudi.h" +#include "TestTools/expect.h" +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ITHistSvc.h" +#include "AthenaKernel/getMessageSvc.h" + +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TProfile2D.h" + +#include "AthenaMonitoring/HistogramDef.h" + +#include "../src/HistogramFiller/StaticHistogramProvider.h" +#include "../src/HistogramFiller/LumiblockHistogramProvider.h" +#include "../src/HistogramFiller/HistogramFiller1D.h" +#include "../src/HistogramFiller/HistogramFillerEfficiency.h" +#include "../src/HistogramFiller/CumulativeHistogramFiller1D.h" +#include "../src/HistogramFiller/VecHistogramFiller1D.h" +#include "../src/HistogramFiller/VecHistogramFiller1DWithOverflows.h" +#include "../src/HistogramFiller/HistogramFillerProfile.h" +#include "../src/HistogramFiller/HistogramFiller2D.h" +#include "../src/HistogramFiller/HistogramFiller2DProfile.h" + +#include "../src/HistogramFiller/HistogramFillerFactory.h" + +#include "mocks/MockGenericMonitoringTool.h" +#include "mocks/MockITHistSvc.h" + +using namespace std; +using namespace Monitored; + +class HistogramProviderGetter : public HistogramFiller { + public: + HistogramProviderGetter(const HistogramFiller& hf) + : HistogramFiller(hf) {} + + virtual unsigned fill() { return 0; } + virtual HistogramFiller* clone() { return nullptr; } + + std::shared_ptr<IHistogramProvider> histogramProvider() { return m_histogramProvider; } +}; + +#define REGISTER_TEST_CASE(TEST_CASE_NAME) registerTestCase(&HistogramFillerFactoryTestSuite::TEST_CASE_NAME, #TEST_CASE_NAME) + +class HistogramFillerFactoryTestSuite { + // ==================== All registered test cases ==================== + private: + list<function<void(void)>> registeredTestCases() { + return { + REGISTER_TEST_CASE(test_shouldCreateStaticHistogramFiller1D), + REGISTER_TEST_CASE(test_shouldCreateStaticCumulativeHistogramFiller1D), + REGISTER_TEST_CASE(test_shouldCreateStaticVecHistogramFiller1DWithOverflows), + REGISTER_TEST_CASE(test_shouldCreateStaticVecHistogramFiller1D), + REGISTER_TEST_CASE(test_shouldCreateStaticHistogramFiller2D), + REGISTER_TEST_CASE(test_shouldCreateStaticHistogramFillerProfile), + REGISTER_TEST_CASE(test_shouldCreateStaticHistogramFiller2DProfile), + REGISTER_TEST_CASE(test_shouldCreateStaticHistogramFillerEfficiency), + REGISTER_TEST_CASE(test_shouldCreateLumiblockHistogramFiller1D), + REGISTER_TEST_CASE(test_shouldCreateLumiblockCumulativeHistogramFiller1D), + REGISTER_TEST_CASE(test_shouldCreateLumiblockVecHistogramFiller1DWithOverflows), + REGISTER_TEST_CASE(test_shouldCreateLumiblockVecHistogramFiller1D), + REGISTER_TEST_CASE(test_shouldCreateLumiblockHistogramFiller2D), + REGISTER_TEST_CASE(test_shouldCreateLumiblockHistogramFillerProfile), + REGISTER_TEST_CASE(test_shouldCreateLumiblockHistogramFiller2DProfile), + REGISTER_TEST_CASE(test_shouldCreateLumiblockHistogramFillerEfficiency), + }; + } + + // ==================== Test code ==================== + private: + void beforeEach() { + m_gmTool.reset(new MockGenericMonitoringTool()); + } + + void afterEach() { + } + + void test_shouldCreateStaticHistogramFiller1D() { + performCreateFillerAndVerify<HistogramFiller1D, StaticHistogramProvider>("TH1F", ""); + } + + void test_shouldCreateStaticCumulativeHistogramFiller1D() { + performCreateFillerAndVerify<CumulativeHistogramFiller1D, StaticHistogramProvider>("TH1F", "kCumulative"); + } + + void test_shouldCreateStaticVecHistogramFiller1DWithOverflows() { + performCreateFillerAndVerify<VecHistogramFiller1DWithOverflows, StaticHistogramProvider>("TH1F", "kVecUO"); + } + + void test_shouldCreateStaticVecHistogramFiller1D() { + performCreateFillerAndVerify<VecHistogramFiller1D, StaticHistogramProvider>("TH1F", "kVec"); + } + + void test_shouldCreateStaticHistogramFiller2D() { + performCreateFillerAndVerify<HistogramFiller2D, StaticHistogramProvider>("TH2D", ""); + } + + void test_shouldCreateStaticHistogramFillerProfile() { + performCreateFillerAndVerify<HistogramFillerProfile, StaticHistogramProvider>("TProfile", ""); + } + + void test_shouldCreateStaticHistogramFiller2DProfile() { + performCreateFillerAndVerify<HistogramFiller2DProfile, StaticHistogramProvider>("TProfile2D", ""); + } + + void test_shouldCreateStaticHistogramFillerEfficiency() { + performCreateFillerAndVerify<HistogramFillerEfficiency, StaticHistogramProvider>("TEfficiency", ""); + } + + void test_shouldCreateLumiblockHistogramFiller1D() { + performCreateFillerAndVerify<HistogramFiller1D, LumiblockHistogramProvider>("TH1F", "kLBNHistoryDepth=10"); + } + + void test_shouldCreateLumiblockCumulativeHistogramFiller1D() { + performCreateFillerAndVerify<CumulativeHistogramFiller1D, LumiblockHistogramProvider>("TH1F", "kCumulative, kLBNHistoryDepth=10"); + } + + void test_shouldCreateLumiblockVecHistogramFiller1DWithOverflows() { + performCreateFillerAndVerify<VecHistogramFiller1DWithOverflows, LumiblockHistogramProvider>("TH1F", "kVecUO, kLBNHistoryDepth=10"); + } + + void test_shouldCreateLumiblockVecHistogramFiller1D() { + performCreateFillerAndVerify<VecHistogramFiller1D, LumiblockHistogramProvider>("TH1F", "kVec, kLBNHistoryDepth=10"); + } + + void test_shouldCreateLumiblockHistogramFiller2D() { + performCreateFillerAndVerify<HistogramFiller2D, LumiblockHistogramProvider>("TH2D", "kLBNHistoryDepth=10"); + } + + void test_shouldCreateLumiblockHistogramFillerProfile() { + performCreateFillerAndVerify<HistogramFillerProfile, LumiblockHistogramProvider>("TProfile", "kLBNHistoryDepth=10"); + } + + void test_shouldCreateLumiblockHistogramFiller2DProfile() { + performCreateFillerAndVerify<HistogramFiller2DProfile, LumiblockHistogramProvider>("TProfile2D", "kLBNHistoryDepth=10"); + } + + void test_shouldCreateLumiblockHistogramFillerEfficiency() { + performCreateFillerAndVerify<HistogramFillerEfficiency, LumiblockHistogramProvider>("TEfficiency", "kLBNHistoryDepth=10"); + } + + + // ==================== Helper methods ==================== + private: + template<class FillerType, class ProviderType> + void performCreateFillerAndVerify(string histogramType, string options) { + HistogramDef histogramDef; + histogramDef.type = histogramType; + histogramDef.opt = options; + histogramDef.xbins = 1; + histogramDef.ybins = 1; + + HistogramFillerFactory testObj(m_gmTool.get(), "HistogramFillerFactoryTestSuite"); + + HistogramFiller* const result = testObj.create(histogramDef); + VALUE(dynamic_cast<FillerType*>(result)) NOT_EXPECTED(nullptr); + HistogramProviderGetter providerGetter(*result); + IHistogramProvider* const provider = providerGetter.histogramProvider().get(); + VALUE(dynamic_cast<ProviderType*>(provider)) NOT_EXPECTED(nullptr); + } + + // ==================== Initialization & run ==================== + public: + HistogramFillerFactoryTestSuite() + : m_log(Athena::getMessageSvc(), "HistogramFillerFactoryTestSuite") { + } + + void run() { + for (function<void(void)> testCase : registeredTestCases()) { + testCase(); + } + } + + // ==================== Test case registration ==================== + private: + typedef void (HistogramFillerFactoryTestSuite::*TestCase)(void); + + function<void(void)> registerTestCase(TestCase testCase, string testCaseName) { + return [this, testCase, testCaseName]() { + m_log << MSG::INFO << "Current test case: " << testCaseName << endmsg; + beforeEach(); + invoke(testCase, this); + afterEach(); + }; + } + + // ==================== Properties ==================== + private: + MsgStream m_log; + + shared_ptr<MockGenericMonitoringTool> m_gmTool; +}; + +int main() { + ISvcLocator* pSvcLoc; + + if (!Athena_test::initGaudi("GenericMon.txt", pSvcLoc)) { + throw runtime_error("This test can not be run: GenericMon.txt is missing"); + } + + HistogramFillerFactoryTestSuite().run(); + + return 0; +} diff --git a/Control/AthenaMonitoring/test/LumiblockHistogramProviderTestSuite.cxx b/Control/AthenaMonitoring/test/LumiblockHistogramProviderTestSuite.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e1b47506e0a896bb0474730246457d04658c1d90 --- /dev/null +++ b/Control/AthenaMonitoring/test/LumiblockHistogramProviderTestSuite.cxx @@ -0,0 +1,166 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#undef NDEBUG +#include <cassert> +#include <iostream> +#include <list> +#include <functional> +#include <memory> + +#include "TestTools/initGaudi.h" +#include "TestTools/expect.h" +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ITHistSvc.h" +#include "AthenaKernel/getMessageSvc.h" + +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TProfile2D.h" + +#include "AthenaMonitoring/HistogramDef.h" + +#include "mocks/MockGenericMonitoringTool.h" +#include "mocks/MockHistogramFactory.h" + +#include "../src/HistogramFiller/LumiblockHistogramProvider.h" + +using namespace std; +using namespace Monitored; + +#define REGISTER_TEST_CASE(TEST_CASE_NAME) registerTestCase(&LumiblockHistogramProviderTestSuite::TEST_CASE_NAME, #TEST_CASE_NAME) + +class LumiblockHistogramProviderTestSuite { + // ==================== All registered test cases ==================== + private: + list<function<void(void)>> registeredTestCases() { + return { + REGISTER_TEST_CASE(test_shouldThrowExceptionWhen_kLBNHistoryDepth_isNotDefined), + REGISTER_TEST_CASE(test_shouldThrowExceptionWhen_kLBNHistoryDepth_isDefinedAs_NaN), + REGISTER_TEST_CASE(test_shouldNotThrowExceptionWhen_kLBNHistoryDepth_isDefinedAsNumber), + REGISTER_TEST_CASE(test_shouldCreateNewHistogramWithUpdatedAlias), + }; + } + + // ==================== Test code ==================== + private: + void beforeEach() { + m_gmTool.reset(new MockGenericMonitoringTool()); + m_histogramFactory.reset(new MockHistogramFactory()); + } + + void afterEach() { + } + + void test_shouldThrowExceptionWhen_kLBNHistoryDepth_isNotDefined() { + try { + HistogramDef histogramDef; + LumiblockHistogramProvider testObj(m_gmTool.get(), m_histogramFactory, histogramDef); + } catch (HistogramException&) { + return; + } + assert(false); + } + + void test_shouldThrowExceptionWhen_kLBNHistoryDepth_isDefinedAs_NaN() { + try { + HistogramDef histogramDef; + histogramDef.opt = "kLBNHistoryDepth=abc"; + LumiblockHistogramProvider testObj(m_gmTool.get(), m_histogramFactory, histogramDef); + } catch (HistogramException&) { + return; + } + assert(false); + } + + void test_shouldNotThrowExceptionWhen_kLBNHistoryDepth_isDefinedAsNumber() { + HistogramDef histogramDef; + histogramDef.opt = "kLBNHistoryDepth=12345"; + LumiblockHistogramProvider testObj(m_gmTool.get(), m_histogramFactory, histogramDef); + } + + void test_shouldCreateNewHistogramWithUpdatedAlias() { + auto expectedFlow = { + make_tuple(0, "test alias(0-2)"), + make_tuple(1, "test alias(0-2)"), + make_tuple(2, "test alias(0-2)"), + make_tuple(3, "test alias(3-5)"), + make_tuple(4, "test alias(3-5)"), + make_tuple(5, "test alias(3-5)"), + make_tuple(6, "test alias(6-8)"), + make_tuple(7, "test alias(6-8)"), + make_tuple(8, "test alias(6-8)"), + make_tuple(9, "test alias(9-11)"), + }; + + TNamed histogram; + HistogramDef histogramDef; + histogramDef.alias = "test alias"; + histogramDef.opt = "kLBNHistoryDepth=3"; + + LumiblockHistogramProvider testObj(m_gmTool.get(), m_histogramFactory, histogramDef); + + for (auto input : expectedFlow) { + const unsigned lumiBlock = get<0>(input); + const string expectedAlias = get<1>(input); + + m_gmTool->mock_lumiBlock = [lumiBlock]() { return lumiBlock; }; + m_histogramFactory->mock_create = [&histogram, expectedAlias](const HistogramDef& def) mutable { + VALUE(def.alias) EXPECTED(expectedAlias); + return &histogram; + }; + + TNamed* const result = testObj.histogram(); + VALUE(result) EXPECTED(&histogram); + } + } + + // ==================== Helper methods ==================== + private: + + // ==================== Initialization & run ==================== + public: + LumiblockHistogramProviderTestSuite() + : m_log(Athena::getMessageSvc(), "LumiblockHistogramProviderTestSuite") { + } + + void run() { + for (function<void(void)> testCase : registeredTestCases()) { + testCase(); + } + } + + // ==================== Test case registration ==================== + private: + typedef void (LumiblockHistogramProviderTestSuite::*TestCase)(void); + + function<void(void)> registerTestCase(TestCase testCase, string testCaseName) { + return [this, testCase, testCaseName]() { + m_log << MSG::INFO << "Current test case: " << testCaseName << endmsg; + beforeEach(); + invoke(testCase, this); + afterEach(); + }; + } + + // ==================== Properties ==================== + private: + MsgStream m_log; + + shared_ptr<MockGenericMonitoringTool> m_gmTool; + shared_ptr<MockHistogramFactory> m_histogramFactory; +}; + +int main() { + ISvcLocator* pSvcLoc; + + if (!Athena_test::initGaudi("GenericMon.txt", pSvcLoc)) { + throw runtime_error("This test can not be run: GenericMon.txt is missing"); + } + + LumiblockHistogramProviderTestSuite().run(); + + return 0; +} diff --git a/Control/AthenaMonitoring/test/StaticHistogramProviderTestSuite.cxx b/Control/AthenaMonitoring/test/StaticHistogramProviderTestSuite.cxx new file mode 100644 index 0000000000000000000000000000000000000000..52169d9e873c918f9eb57a964ca99c6d6e5227cd --- /dev/null +++ b/Control/AthenaMonitoring/test/StaticHistogramProviderTestSuite.cxx @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#undef NDEBUG +#include <cassert> +#include <iostream> +#include <list> +#include <functional> +#include <memory> + +#include "TestTools/initGaudi.h" +#include "TestTools/expect.h" +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ITHistSvc.h" +#include "AthenaKernel/getMessageSvc.h" + +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TProfile2D.h" + +#include "AthenaMonitoring/HistogramDef.h" + +#include "mocks/MockHistogramFactory.h" + +#include "../src/HistogramFiller/StaticHistogramProvider.h" + +using namespace std; +using namespace Monitored; + +#define REGISTER_TEST_CASE(TEST_CASE_NAME) registerTestCase(&StaticHistogramProviderTestSuite::TEST_CASE_NAME, #TEST_CASE_NAME) + +class StaticHistogramProviderTestSuite { + // ==================== All registered test cases ==================== + private: + list<function<void(void)>> registeredTestCases() { + return { + REGISTER_TEST_CASE(test_shouldCreateAndReturnJustOneHistogram), + }; + } + + // ==================== Test code ==================== + private: + void beforeEach() { + m_histogramFactory.reset(new MockHistogramFactory()); + } + + void afterEach() { + } + + void test_shouldCreateAndReturnJustOneHistogram() { + TNamed histogram; + HistogramDef histogramDef; + m_histogramFactory->mock_create = [&histogram, &histogramDef](const HistogramDef& def) mutable { + VALUE(&def) EXPECTED(&histogramDef); + return &histogram; + }; + + StaticHistogramProvider testObj(m_histogramFactory, histogramDef); + TNamed* firstResult = testObj.histogram(); + TNamed* secondResult = testObj.histogram(); + + VALUE(firstResult) EXPECTED(&histogram); + VALUE(secondResult) EXPECTED(&histogram); + } + + // ==================== Helper methods ==================== + private: + + // ==================== Initialization & run ==================== + public: + StaticHistogramProviderTestSuite() + : m_log(Athena::getMessageSvc(), "StaticHistogramProviderTestSuite") { + } + + void run() { + for (function<void(void)> testCase : registeredTestCases()) { + testCase(); + } + } + + // ==================== Test case registration ==================== + private: + typedef void (StaticHistogramProviderTestSuite::*TestCase)(void); + + function<void(void)> registerTestCase(TestCase testCase, string testCaseName) { + return [this, testCase, testCaseName]() { + m_log << MSG::INFO << "Current test case: " << testCaseName << endmsg; + beforeEach(); + invoke(testCase, this); + afterEach(); + }; + } + + // ==================== Properties ==================== + private: + MsgStream m_log; + + shared_ptr<MockHistogramFactory> m_histogramFactory; +}; + +int main() { + ISvcLocator* pSvcLoc; + + if (!Athena_test::initGaudi("GenericMon.txt", pSvcLoc)) { + throw runtime_error("This test can not be run: GenericMon.txt is missing"); + } + + StaticHistogramProviderTestSuite().run(); + + return 0; +} diff --git a/Control/AthenaMonitoring/test/mocks/MockAlgorithm.h b/Control/AthenaMonitoring/test/mocks/MockAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..420065b3d2fe45d6f520c61a11381754c5efadcb --- /dev/null +++ b/Control/AthenaMonitoring/test/mocks/MockAlgorithm.h @@ -0,0 +1,14 @@ +#ifndef AthenaMonitoring_test_mocks_MockAlgorithm_h +#define AthenaMonitoring_test_mocks_MockAlgorithm_h + +#include "AthenaBaseComps/AthAlgorithm.h" + +#include "MockSvcLocator.h" + +class MockAlgorithm : public AthAlgorithm { + public: + MockAlgorithm() : AthAlgorithm("MockAlgorithm", new MockSvcLocator(), "0.0.1") {} + StatusCode execute() override { return StatusCode::SUCCESS; } +}; + +#endif /* AthenaMonitoring_test_mocks_MockAlgorithm_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/test/mocks/MockGenericMonitoringTool.h b/Control/AthenaMonitoring/test/mocks/MockGenericMonitoringTool.h new file mode 100644 index 0000000000000000000000000000000000000000..a4a751e8d56dca7a2e779c43668144114e7a3f87 --- /dev/null +++ b/Control/AthenaMonitoring/test/mocks/MockGenericMonitoringTool.h @@ -0,0 +1,34 @@ +#ifndef AthenaMonitoring_test_mocks_MockGenericMonitoringTool_h +#define AthenaMonitoring_test_mocks_MockGenericMonitoringTool_h + +#include <functional> + +#include "AthenaMonitoring/GenericMonitoringTool.h" + +#include "MockAlgorithm.h" +#include "MockTHistServiceHandle.h" + +class MockGenericMonitoringTool : public GenericMonitoringTool { + public: + MockGenericMonitoringTool() + : GenericMonitoringTool("MockGenericMonitoringTool", "ToolSvc.MonTool", new MockAlgorithm()) {} + + std::function<uint32_t()> mock_lumiBlock; + uint32_t lumiBlock() override { + return mock_lumiBlock ? mock_lumiBlock() : 0; + } + + const ServiceHandle<ITHistSvc>& histogramService() override { + m_serviceHandle.retrieve(); + + return m_serviceHandle; + } + + MockITHistSvc& histSvc() { + return m_serviceHandle.histSvc(); + } + private: + MockTHistServiceHandle m_serviceHandle; +}; + +#endif /* AthenaMonitoring_test_mocks_MockGenericMonitoringTool_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/test/mocks/MockHistogramFactory.h b/Control/AthenaMonitoring/test/mocks/MockHistogramFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..3b373cd51f0536d3d029d97e3edbd4cf087df59c --- /dev/null +++ b/Control/AthenaMonitoring/test/mocks/MockHistogramFactory.h @@ -0,0 +1,19 @@ +#ifndef AthenaMonitoring_test_mocks_MockHistogramFactory_h +#define AthenaMonitoring_test_mocks_MockHistogramFactory_h + +#include <functional> + +#include "../../src/HistogramFiller/HistogramFactory.h" + +class MockHistogramFactory : public Monitored::HistogramFactory { + public: + MockHistogramFactory() + : Monitored::HistogramFactory(ServiceHandle<ITHistSvc>("", "") ,"") {} + + std::function<TNamed*(const Monitored::HistogramDef& def)> mock_create; + TNamed* create(const Monitored::HistogramDef& def) override { + return mock_create ? mock_create(def) : nullptr; + } +}; + +#endif /* AthenaMonitoring_test_mocks_MockHistogramFactory_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/test/mocks/MockITHistSvc.h b/Control/AthenaMonitoring/test/mocks/MockITHistSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..4588d6ebbccb579207df4c7657471269d99ef4d0 --- /dev/null +++ b/Control/AthenaMonitoring/test/mocks/MockITHistSvc.h @@ -0,0 +1,72 @@ +#ifndef AthenaMonitoring_test_mocks_MockITHistSvc_h +#define AthenaMonitoring_test_mocks_MockITHistSvc_h + +#include "GaudiKernel/ITHistSvc.h" + +class MockITHistSvc : public ITHistSvc { + private: + const std::string m_name = "MockITHistSvc"; + public: + virtual const std::string& name() const { return m_name; }; + Gaudi::StateMachine::State FSMState() const override { return Gaudi::StateMachine::OFFLINE; } + Gaudi::StateMachine::State targetFSMState() const override { return Gaudi::StateMachine::OFFLINE; } + StatusCode queryInterface(const InterfaceID&, void**) override { return StatusCode::SUCCESS; } + StatusCode sysFinalize() override { return StatusCode::SUCCESS; } + StatusCode sysInitialize() override { return StatusCode::SUCCESS; } + StatusCode sysReinitialize() override { return StatusCode::SUCCESS; } + StatusCode sysRestart() override { return StatusCode::SUCCESS; } + StatusCode sysStart() override { return StatusCode::SUCCESS; } + StatusCode sysStop() override { return StatusCode::SUCCESS; } + StatusCode configure() override { return StatusCode::SUCCESS; } + StatusCode finalize() override { return StatusCode::SUCCESS; } + StatusCode initialize() override { return StatusCode::SUCCESS; } + StatusCode reinitialize() override { return StatusCode::SUCCESS; } + StatusCode restart() override { return StatusCode::SUCCESS; } + StatusCode start() override { return StatusCode::SUCCESS; } + StatusCode stop() override { return StatusCode::SUCCESS; } + StatusCode terminate() override { return StatusCode::SUCCESS; } + StatusCode deReg(TObject*) override { return StatusCode::SUCCESS; } + StatusCode deReg(const std::string&) override { return StatusCode::SUCCESS; } + StatusCode getGraph(const std::string&, TGraph*&) const override { return StatusCode::SUCCESS; } + StatusCode getHist(const std::string&, TH1*&, size_t) const override { return StatusCode::SUCCESS; } + StatusCode getHist(const std::string&, TH2*&, size_t) const override { return StatusCode::SUCCESS; } + StatusCode getHist(const std::string&, TH3*&, size_t) const override { return StatusCode::SUCCESS; } + StatusCode getShared(const std::string&, LockedHandle<TGraph>&) const override { return StatusCode::SUCCESS; } + StatusCode getShared(const std::string&, LockedHandle<TH1>&) const override { return StatusCode::SUCCESS; } + StatusCode getShared(const std::string&, LockedHandle<TH2>&) const override { return StatusCode::SUCCESS; } + StatusCode getShared(const std::string&, LockedHandle<TH3>&) const override { return StatusCode::SUCCESS; } + StatusCode getTHists(TDirectory*, TList&, bool) const override { return StatusCode::SUCCESS; } + StatusCode getTHists(TDirectory*, TList&, bool, bool) override { return StatusCode::SUCCESS; } + StatusCode getTHists(const std::string&, TList&, bool) const override { return StatusCode::SUCCESS; } + StatusCode getTHists(const std::string&, TList&, bool, bool) override { return StatusCode::SUCCESS; } + StatusCode getTTrees(TDirectory*, TList&, bool) const override { return StatusCode::SUCCESS; } + StatusCode getTTrees(TDirectory*, TList&, bool, bool) override { return StatusCode::SUCCESS; } + StatusCode getTTrees(const std::string&, TList&, bool) const override { return StatusCode::SUCCESS; } + StatusCode getTTrees(const std::string&, TList&, bool, bool) { return StatusCode::SUCCESS; } + StatusCode getTree(const std::string&, TTree*&) const override { return StatusCode::SUCCESS; } + StatusCode merge(TObject*) override { return StatusCode::SUCCESS; } + StatusCode merge(const std::string&) override { return StatusCode::SUCCESS; } + StatusCode regGraph(const std::string&) override { return StatusCode::SUCCESS; } + StatusCode regGraph(const std::string&, TGraph*) override { return StatusCode::SUCCESS; } + StatusCode regGraph(const std::string&, std::unique_ptr<TGraph>) override { return StatusCode::SUCCESS; } + StatusCode regHist(const std::string&) override { return StatusCode::SUCCESS; } + StatusCode regHist(const std::string&, TH1*) override { return StatusCode::SUCCESS; } + StatusCode regHist(const std::string&, std::unique_ptr<TH1>) override { return StatusCode::SUCCESS; } + StatusCode regHist(const std::string&, std::unique_ptr<TH1>, TH1*) override { return StatusCode::SUCCESS; } + StatusCode regShared(const std::string&, std::unique_ptr<TGraph>, LockedHandle<TGraph>&) override { return StatusCode::SUCCESS; } + StatusCode regShared(const std::string&, std::unique_ptr<TH1>, LockedHandle<TH1>&) override { return StatusCode::SUCCESS; } + StatusCode regShared(const std::string&, std::unique_ptr<TH2>, LockedHandle<TH2>&) override { return StatusCode::SUCCESS; } + StatusCode regShared(const std::string&, std::unique_ptr<TH3>, LockedHandle<TH3>&) override { return StatusCode::SUCCESS; } + StatusCode regTree(const std::string&) override { return StatusCode::SUCCESS; } + StatusCode regTree(const std::string&, TTree*) override { return StatusCode::SUCCESS; } + StatusCode regTree(const std::string&, std::unique_ptr<TTree>) override { return StatusCode::SUCCESS; } + bool exists(const std::string&) const override { return false; } + long unsigned int addRef() override { return 0; } + long unsigned int release() override { return 0; } + std::vector<std::string> getGraphs() const override { return {}; } + std::vector<std::string> getHists() const override { return {}; } + std::vector<std::string> getTrees() const override { return {}; } + void setServiceManager(ISvcManager*) override {} +}; + +#endif /* AthenaMonitoring_test_mocks_MockITHistSvc_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/test/mocks/MockSvcLocator.h b/Control/AthenaMonitoring/test/mocks/MockSvcLocator.h new file mode 100644 index 0000000000000000000000000000000000000000..39c4b311e8de68248da04cd31ad856eca2d5a3f8 --- /dev/null +++ b/Control/AthenaMonitoring/test/mocks/MockSvcLocator.h @@ -0,0 +1,19 @@ +#ifndef AthenaMonitoring_test_mocks_MockSvcLocator_h +#define AthenaMonitoring_test_mocks_MockSvcLocator_h + +#include "GaudiKernel/ISvcLocator.h" + +class MockSvcLocator : public ISvcLocator { + public: + unsigned long addRef() override { return 0; } + unsigned long release() override { return 0; } + StatusCode queryInterface(const InterfaceID&, void**) override { return StatusCode::SUCCESS; } + const std::list<IService*>& getServices() const override { return m_services; } + bool existsService(const std::string&) const override { return true; } + SmartIF<IService>& service( const Gaudi::Utils::TypeNameString&, const bool) override { return m_service; } + private: + std::list<IService*> m_services; + SmartIF<IService> m_service; +}; + +#endif /* AthenaMonitoring_test_mocks_MockSvcLocator_h */ \ No newline at end of file diff --git a/Control/AthenaMonitoring/test/mocks/MockTHistServiceHandle.h b/Control/AthenaMonitoring/test/mocks/MockTHistServiceHandle.h new file mode 100644 index 0000000000000000000000000000000000000000..f78243651c37f6300911fe970087252953800797 --- /dev/null +++ b/Control/AthenaMonitoring/test/mocks/MockTHistServiceHandle.h @@ -0,0 +1,34 @@ +#ifndef AthenaMonitoring_test_mocks_MockTHistServiceHandle_h +#define AthenaMonitoring_test_mocks_MockTHistServiceHandle_h + +#include "GaudiKernel/ServiceHandle.h" + +#include "MockITHistSvc.h" + +class MockTHistServiceHandle : public ServiceHandle<ITHistSvc> { + public: + MockTHistServiceHandle() + : ServiceHandle<ITHistSvc>("THistSvc/THistSvc", "MockTHistServiceHandle"), + m_histSvc(new MockITHistSvc()) {} + + ~MockTHistServiceHandle() { + delete m_histSvc; + } + + StatusCode retrieve() const { + return ServiceHandle<ITHistSvc>::retrieve(); + } + + MockITHistSvc& histSvc() { + return *m_histSvc; + } + protected: + StatusCode retrieve(ITHistSvc*& service) const override { + service = m_histSvc; + return StatusCode::SUCCESS; + } + private: + MockITHistSvc* m_histSvc; +}; + +#endif /* AthenaMonitoring_test_mocks_MockTHistServiceHandle_h */ \ No newline at end of file diff --git a/Control/CxxUtils/CMakeLists.txt b/Control/CxxUtils/CMakeLists.txt index a6607bec17365ec01e70de1a94d10918aeb9b1f0..54e987ad7fc0cf60b42de78e52931a93087f5da7 100644 --- a/Control/CxxUtils/CMakeLists.txt +++ b/Control/CxxUtils/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 797343 2017-02-15 15:13:34Z ssnyder $ ################################################################################ # Package: CxxUtils ################################################################################ @@ -20,18 +19,20 @@ atlas_add_library( CxxUtils PUBLIC_HEADERS CxxUtils INCLUDE_DIRS ${Boost_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} - PRIVATE_LINK_LIBRARIES TestTools ) + PRIVATE_LINK_LIBRARIES ${CMAKE_DL_LIBS} TestTools ) # Additional libraries in the package: atlas_add_library( exctrace_collector src/exctrace/exctrace_collector.cxx - PUBLIC_HEADERS CxxUtils ) + PUBLIC_HEADERS CxxUtils + PRIVATE_LINK_LIBRARIES ${CMAKE_DL_LIBS} ) atlas_add_library( calg src/libcalg/*.c PUBLIC_HEADERS CxxUtils ) atlas_add_library( AthDSoCallBacks src/AthDsoCbk.c PUBLIC_HEADERS CxxUtils - LINK_LIBRARIES calg ) + LINK_LIBRARIES calg + PRIVATE_LINK_LIBRARIES ${CMAKE_DL_LIBS} ) # Unit tests in the package: atlas_add_test( read_athena_statm_test @@ -65,7 +66,7 @@ atlas_add_test( BitPackerUnpacker_test atlas_add_test( stacktrace_test SOURCES test/stacktrace_test.cxx - LINK_LIBRARIES CxxUtils dl ) + LINK_LIBRARIES CxxUtils ${CMAKE_DL_LIBS} ) atlas_add_test( MD5_test SOURCES test/MD5_test.cxx diff --git a/Control/Hephaestus/CMakeLists.txt b/Control/Hephaestus/CMakeLists.txt index a70a27fcb3bec39f4efd1de19fa1393aeb17c7c8..1cdb77c28c2cf3fc77e212febb84bea060123d59 100644 --- a/Control/Hephaestus/CMakeLists.txt +++ b/Control/Hephaestus/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 785819 2016-11-22 17:50:02Z krasznaa $ ################################################################################ # Package: Hephaestus ################################################################################ @@ -16,7 +15,7 @@ atlas_add_library( Hephaestus Hephaestus/*.h src/hlib/*.c PUBLIC_HEADERS Hephaestus INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} - LINK_LIBRARIES ${PYTHON_LIBRARIES} ) + LINK_LIBRARIES ${PYTHON_LIBRARIES} ${CMAKE_DL_LIBS} ) atlas_add_library( MemoryTracker src/*.c diff --git a/Control/IOVSvc/src/IOVSvcTool.cxx b/Control/IOVSvc/src/IOVSvcTool.cxx index 7d75d88d560bba0d19b76e0592d50914d489a79a..5f95552766987aeb8bd510e034c0fc1745f34e3e 100644 --- a/Control/IOVSvc/src/IOVSvcTool.cxx +++ b/Control/IOVSvc/src/IOVSvcTool.cxx @@ -486,6 +486,9 @@ IOVSvcTool::handle(const Incident &inc) { m_log << MSG::FATAL << "Cannot update Conditions via callback functions in MT after the first event" << endmsg; + for (const auto* prox : proxiesToReset) { + m_log << MSG::FATAL << "CLID=" << prox->clID() << ", name=" << prox->name() << endmsg; + } throw GaudiException("Cannot update Conditions via callback functions in MT after the first event",name(),StatusCode::FAILURE); } diff --git a/Control/PerformanceMonitoring/PerfMonComps/CMakeLists.txt b/Control/PerformanceMonitoring/PerfMonComps/CMakeLists.txt index e74ac66e4bf10562e9c0d550bf72cc1d6b81c512..1e271d4231385e54011b24e1f4beeb810e97b330 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/CMakeLists.txt +++ b/Control/PerformanceMonitoring/PerfMonComps/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 725991 2016-02-24 18:16:09Z krasznaa $ ################################################################################ # Package: PerfMonComps ################################################################################ @@ -33,8 +32,9 @@ atlas_add_component( PerfMonComps INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${PYTHON_LIBRARIES} - AthenaBaseComps AthenaKernel RootUtils CxxUtils PerfMonEvent PerfMonKernel SGTools - StoreGateLib SGtests GaudiKernel AthDSoCallBacks ) + ${CMAKE_DL_LIBS} AthenaBaseComps AthenaKernel RootUtils CxxUtils + PerfMonEvent PerfMonKernel SGTools StoreGateLib GaudiKernel + AthDSoCallBacks ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/DataQuality/DataQualityConfigurations/CMakeLists.txt b/DataQuality/DataQualityConfigurations/CMakeLists.txt index 598aa7a774af496e46503908672754117d68f6f4..dcae0a350cdbe48b2a0184e61aaa170de03bc7cc 100644 --- a/DataQuality/DataQualityConfigurations/CMakeLists.txt +++ b/DataQuality/DataQualityConfigurations/CMakeLists.txt @@ -53,8 +53,8 @@ foreach( hanfile collisions_run collisions_minutes10 ${CMAKE_CURRENT_SOURCE_DIR}/scripts/MergeConfigs.py ${hanfile}.config ${CMAKE_CURRENT_SOURCE_DIR}/config ${configOutputFile} # Build binary config - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh han-config-gen - ${configOutputFile} + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh + han-config-gen ${configOutputFile} # Deploy binary config COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${hanfile}.hcfg diff --git a/Event/EventInfoMgt/python/EventInfoMgtInit.py b/Event/EventInfoMgt/python/EventInfoMgtInit.py index 59560cf43309fd5ce6e79282f72b7b70bfefd62d..ff98c9af35b521672cf15450f7e3aa2c67264a5a 100755 --- a/Event/EventInfoMgt/python/EventInfoMgtInit.py +++ b/Event/EventInfoMgt/python/EventInfoMgtInit.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration ## @file EventInfoMgtInit.py ## @brief Configurable for TagInfoMgr service initialization @@ -12,6 +12,8 @@ # # Required libs: +from __future__ import print_function + def _loadBasicEventInfoMgt(): """Loads the basic services for EventInfoMgt""" @@ -28,11 +30,11 @@ def _loadBasicEventInfoMgt(): # Executing a shell command # def execute (self, cmd): - #print '> ' + cmd + #print ('> ' + cmd) r = os.popen(cmd) lines = [] for line in r.readlines(): - #print line + #print (line) line = string.rstrip (line) lines.append (line) r.close() @@ -42,17 +44,17 @@ def _loadBasicEventInfoMgt(): # project, AtlasOffline, has the release number def getRelease (self): try: - #print "EventInfoMgtInit.getRelease: get project, version" + #print ("EventInfoMgtInit.getRelease: get project, version") project = os.environ ['AtlasProject'] version = os.environ ['AtlasVersion'] - #print "EventInfoMgtInit.getRelease: project, version",project, version + #print ("EventInfoMgtInit.getRelease: project, version",project, version) return project + '-' + version except: # These variables can be missing during CI builds, # so don't complain if they're not there. - #print "EventInfoMgtInit getRelease: except caught" - #print sys.exc_info()[0] - #print sys.exc_info()[1] + #print ("EventInfoMgtInit getRelease: except caught") + #print (sys.exc_info()[0]) + #print (sys.exc_info()[1]) pass return "Unknown-Unknown" @@ -67,13 +69,13 @@ def _loadBasicEventInfoMgt(): msg.debug( "Loading basic services for EventInfoMgt..." ) #from EventInfoMgt.EventInfoMgtConf import TagInfoMgr - from EventInfoMgtConf import TagInfoMgr + from EventInfoMgt.EventInfoMgtConf import TagInfoMgr svcMgr += TagInfoMgr() # Add in extra tag for the release number: evtMgt = EventInfoMgtInit() release = evtMgt.release - print "EventInfoMgtInit: Got release version ",release + print ("EventInfoMgtInit: Got release version ",release) svcMgr.TagInfoMgr.ExtraTagValuePairs = ["AtlasRelease", release ] # Add TagInfoMgr as cnv svc diff --git a/Event/xAOD/xAODJet/xAODJet/JetAccessors.h b/Event/xAOD/xAODJet/xAODJet/JetAccessors.h index 9818ed66641f6080ce691fa9781b12a9471d52f8..d838724f0d0cc486deed8f423cc92a1d9cb21148 100644 --- a/Event/xAOD/xAODJet/xAODJet/JetAccessors.h +++ b/Event/xAOD/xAODJet/xAODJet/JetAccessors.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODJET_JETACCESSORS_H diff --git a/Event/xAOD/xAODTracking/Root/NeutralParticle_v1.cxx b/Event/xAOD/xAODTracking/Root/NeutralParticle_v1.cxx index 1037148794a307e996c616b99e856442a408cf99..a1e966310951471acfac32ef0bdd07e79c65fd26 100644 --- a/Event/xAOD/xAODTracking/Root/NeutralParticle_v1.cxx +++ b/Event/xAOD/xAODTracking/Root/NeutralParticle_v1.cxx @@ -30,9 +30,9 @@ namespace xAOD { if(!hasStore() ) makePrivateStore(); this->IParticle::operator=( tp ); - #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE m_perigeeParameters.reset(); - #endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE return *this; } @@ -107,11 +107,11 @@ namespace xAOD { } void NeutralParticle_v1::setDefiningParameters(float d0, float z0, float phi0, float theta, float oneOverP) { - #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE if(m_perigeeParameters.isValid()) { m_perigeeParameters.reset(); } - #endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE static const Accessor< float > acc1( "d0" ); acc1( *this ) = d0; @@ -131,11 +131,11 @@ namespace xAOD { } void NeutralParticle_v1::setDefiningParametersCovMatrix(const xAOD::ParametersCovMatrix_t& cov){ - #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) - if(m_perigeeParameters.isValid()) { - m_perigeeParameters.reset(); - } - #endif // not XAOD_STANDALONE and not XAOD_MANACORE +#ifndef XAOD_STANDALONE + if(m_perigeeParameters.isValid()) { + m_perigeeParameters.reset(); + } +#endif // not XAOD_STANDALONE static const Accessor< std::vector<float> > acc( "definingParametersCovMatrix" ); std::vector<float>& v = acc(*this); @@ -184,7 +184,7 @@ namespace xAOD { acc3( *this ) = z; } -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE const Trk::NeutralPerigee& NeutralParticle_v1::perigeeParameters() const { // Require the cache to be valid and check if the cached pointer has been set @@ -210,11 +210,12 @@ namespace xAOD { m_perigeeParameters.set(tmpPerigeeParameters); return *(m_perigeeParameters.ptr()); } -#endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE + + void NeutralParticle_v1::resetCache() { +#ifndef XAOD_STANDALONE + m_perigeeParameters.reset(); +#endif // not XAOD_STANDALONE + } - void NeutralParticle_v1::resetCache(){ - #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) - m_perigeeParameters.reset(); - #endif // not XAOD_STANDALONE and not XAOD_MANACORE - } } // namespace xAOD diff --git a/Event/xAOD/xAODTracking/Root/TrackParticle_v1.cxx b/Event/xAOD/xAODTracking/Root/TrackParticle_v1.cxx index 12f16f4e677fea11ba5c1401ffc8842d8e984768..e804b53e8012583ce78d8002c718595ed5917282 100644 --- a/Event/xAOD/xAODTracking/Root/TrackParticle_v1.cxx +++ b/Event/xAOD/xAODTracking/Root/TrackParticle_v1.cxx @@ -2,8 +2,6 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -// $Id: TrackParticle_v1.cxx 576255 2013-12-19 12:54:41Z emoyse $ - // Misc includes #include <bitset> #include <vector> @@ -40,10 +38,10 @@ namespace xAOD { makePrivateStore(); } this->IParticle::operator=( tp ); - #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE // assume that this copy will create new cache as needed m_perigeeParameters.reset(); - #endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE return *this; } @@ -128,12 +126,12 @@ namespace xAOD { } void TrackParticle_v1::setDefiningParameters(float d0, float z0, float phi0, float theta, float qOverP) { -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE // reset perigee cache if existing if(m_perigeeParameters.isValid()) { m_perigeeParameters.reset(); } -#endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE static const Accessor< float > acc1( "d0" ); acc1( *this ) = d0; @@ -153,12 +151,12 @@ namespace xAOD { } void TrackParticle_v1::setDefiningParametersCovMatrix(const xAOD::ParametersCovMatrix_t& cov){ -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE // reset perigee cache if existing if(m_perigeeParameters.isValid()) { m_perigeeParameters.reset(); } -#endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE static const Accessor< std::vector<float> > acc( "definingParametersCovMatrix" ); Amg::compress(cov,acc(*this)); @@ -199,7 +197,7 @@ namespace xAOD { acc3( *this ) = z; } -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE const Trk::Perigee& TrackParticle_v1::perigeeParameters() const { // Require the cache to be valid and check if the cached pointer has been set @@ -232,7 +230,7 @@ namespace xAOD { m_perigeeParameters.set(tmpPerigeeParameters); return *(m_perigeeParameters.ptr()); } -#endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE AUXSTORE_PRIMITIVE_GETTER(TrackParticle_v1, float, chiSquared) AUXSTORE_PRIMITIVE_GETTER(TrackParticle_v1, float, numberDoF) @@ -379,8 +377,8 @@ namespace xAOD { acc( *this ).at(index) = static_cast<uint8_t>(pos); } -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) - const Trk::CurvilinearParameters TrackParticle_v1::curvilinearParameters(unsigned int index) const { +#ifndef XAOD_STANDALONE + const Trk::CurvilinearParameters TrackParticle_v1::curvilinearParameters(unsigned int index) const { static const Accessor< std::vector<float> > acc( "trackParameterCovarianceMatrices" ); unsigned int offset = index*15; @@ -395,7 +393,7 @@ namespace xAOD { return param; } -#endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(TrackParticle_v1, uint8_t, xAOD::TrackProperties,trackProperties) AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(TrackParticle_v1, uint8_t, xAOD::TrackProperties,trackProperties, setTrackProperties) @@ -461,7 +459,7 @@ namespace xAOD { } -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE /// The function will return an invalid ElementLink in case nothing was set /// for it yet. This is to avoid users having to always check both for /// the decoration being available, and the link being valid. @@ -507,15 +505,13 @@ namespace xAOD { } return *( acc( *this ) ); - } -#endif // not XAOD_STANDALONE and not XAOD_MANACORE - + } +#endif // not XAOD_STANDALONE + void TrackParticle_v1::resetCache(){ - #if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) - m_perigeeParameters.reset(); - #endif // not XAOD_STANDALONE and not XAOD_MANACORE - +#ifndef XAOD_STANDALONE + m_perigeeParameters.reset(); +#endif // not XAOD_STANDALONE } - } // namespace xAOD diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/NeutralParticle_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/NeutralParticle_v1.h index 900c86f6f6fd87dcd6968bf1f568401aabb7a96c..7f7002a8573c0c78893244a4f56c2991eb8bade5 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/versions/NeutralParticle_v1.h +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/NeutralParticle_v1.h @@ -22,9 +22,7 @@ #include <stdint.h> #ifndef XAOD_STANDALONE -#ifndef XAOD_MANACORE #include "TrkNeutralParameters/NeutralParameters.h" -#endif // not XAOD_MANACORE #endif // not XAOD_STANDALONE // ROOT include(s): @@ -125,24 +123,24 @@ namespace xAOD { /// Set the origin for the parameters. void setParametersOrigin(float x, float y, float z); -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE /// @brief Returns the Trk::NeutralPerigee track parameters. /// /// These are defined as: /// \f$\left(\begin{array}{c}d_0\\z_0\\\phi_0\\\theta\\1/p\\\end{array}\right)\f$ /// @note This is only available in Athena. const Trk::NeutralPerigee& perigeeParameters() const; -#endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE /// Reset the internal cache of the object void resetCache(); private: -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) && ( ! defined(__GCCXML__) ) && !defined(__CLING__) +#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(__CLING__) ) /// @brief Cached NeutralPerigee, built from this object. /// @note This is only available in Athena. CxxUtils::CachedValue<Trk::NeutralPerigee> m_perigeeParameters; -#endif // not XAOD_STANDALONE and not XAOD_MANACORE and not __GCCXML__ +#endif // not XAOD_STANDALONE and not __CLING__ }; // class NeutralParticle_v1 diff --git a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackParticle_v1.h b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackParticle_v1.h index f333c26ec7c463fcee5c9beb5a968bb4d7f9a030..6497c8e8b01e986783bc0e94cd123efe9314288e 100644 --- a/Event/xAOD/xAODTracking/xAODTracking/versions/TrackParticle_v1.h +++ b/Event/xAOD/xAODTracking/xAODTracking/versions/TrackParticle_v1.h @@ -23,11 +23,9 @@ extern "C" { #include "xAODTracking/TrackingPrimitives.h" #ifndef XAOD_STANDALONE -#ifndef XAOD_MANACORE // Athena includes #include "TrkParameters/TrackParameters.h" #include "TrkTrack/TrackCollection.h" -#endif // not XAOD_MANACORE #endif // not XAOD_STANDALONE // ROOT include(s): @@ -128,14 +126,14 @@ namespace xAOD { /// Set the origin for the parameters. void setParametersOrigin(float x, float y, float z); -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE /// @brief Returns the Trk::MeasuredPerigee track parameters. /// /// These are defined as: /// \f$\left(\begin{array}{c}d_0\\z_0\\\phi_0\\\theta\\q/p\\\end{array}\right)\f$ /// @note This is only available in Athena. const Trk::Perigee& perigeeParameters() const; -#endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE /// @} /// @name Curvilinear functions @@ -187,11 +185,11 @@ namespace xAOD { bool indexOfParameterAtPosition(unsigned int& index, ParameterPosition position) const; /// Set the 'position' (i.e. where it is in ATLAS) of the parameter at 'index', using the ParameterPosition enum. void setParameterPosition(unsigned int index, ParameterPosition pos); -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE /// @brief Returns a curvilinear representation of the parameters at 'index'. /// @note This is only available in Athena. const Trk::CurvilinearParameters curvilinearParameters(unsigned int index) const; -#endif // not XAOD_STANDALONE and not XAOD_MANACORE +#endif // not XAOD_STANDALONE /// Returns the radius of the first hit. float radiusOfFirstHit() const; @@ -303,7 +301,7 @@ namespace xAOD { /// @name Links /// @{ -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) +#ifndef XAOD_STANDALONE /// @brief Returns a link (which can be invalid) to the Trk::Track which was used to make this TrackParticle. /// @note This is only available in Athena. const ElementLink< TrackCollection >& trackLink() const; @@ -313,8 +311,8 @@ namespace xAOD { /// @brief Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle. /// @note This is only available in Athena. const Trk::Track* track() const; -#endif // not XAOD_STANDALONE and not XAOD_MANACORE - +#endif // not XAOD_STANDALONE + /// @} /// Reset the internal cache of the object @@ -322,11 +320,11 @@ namespace xAOD { private: -#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(XAOD_MANACORE) ) && ( ! defined(__GCCXML__) ) && !defined(__CLING__) +#if ( ! defined(XAOD_STANDALONE) ) && ( ! defined(__CLING__) ) /// @brief Cached MeasuredPerigee, built from this object. /// @note This is only available in Athena. CxxUtils::CachedValue<Trk::Perigee> m_perigeeParameters; -#endif // not XAOD_STANDALONE and not XAOD_MANACORE and not __GCCXML__ +#endif // not XAOD_STANDALONE and not __CLING__ }; // class Track Particle diff --git a/Event/xAOD/xAODTrigger/CMakeLists.txt b/Event/xAOD/xAODTrigger/CMakeLists.txt index 0ae963738ba474e1f2c5b7f654500d16baa58cda..2c9061a8c7fd7f7c1a247555ac9c89b0910b9814 100644 --- a/Event/xAOD/xAODTrigger/CMakeLists.txt +++ b/Event/xAOD/xAODTrigger/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 793760 2017-01-25 02:02:33Z ssnyder $ ################################################################################ # Package: xAODTrigger ################################################################################ @@ -40,11 +39,8 @@ atlas_add_test( ut_xaodtrigger_bytestreamauxcontainer_v1_test SOURCES test/ut_xaodtrigger_bytestreamauxcontainer_v1_test.cxx LINK_LIBRARIES AthContainers xAODTrigger ) -# The tests do not compile in 'master' so far, because some operators are mnissing from AthLinksSA/ElementLinkVector. -# FIXME: add the missing operators -if ( NOT BUILDVP1LIGHT ) -atlas_add_test( ut_xaodtrigger_trigcomposite_test - SOURCES test/ut_xaodtrigger_trigcomposite_test.cxx - LINK_LIBRARIES AthContainers xAODTrigger ) +if( NOT XAOD_STANDALONE ) + atlas_add_test( ut_xaodtrigger_trigcomposite_test + SOURCES test/ut_xaodtrigger_trigcomposite_test.cxx + LINK_LIBRARIES AthContainers xAODTrigger ) endif() - diff --git a/External/AtlasPyFwdBwdPorts/CMakeLists.txt b/External/AtlasPyFwdBwdPorts/CMakeLists.txt index 0419f2337f4bc3589e1fadac064ce72862ec5c68..790692b77f0d9b1e2db61a7de7092b4dff559d52 100644 --- a/External/AtlasPyFwdBwdPorts/CMakeLists.txt +++ b/External/AtlasPyFwdBwdPorts/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 790212 2016-12-16 17:43:15Z ssnyder $ # The name of the package: atlas_subdir( AtlasPyFwdBwdPorts ) @@ -39,13 +38,14 @@ function( _setup_python_package name file md5 ) CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Configuring the build of ${name}" ${_patchCmd} - BUILD_COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + BUILD_COMMAND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh python setup.py ${ARG_EXTRA_ARGS} build INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_PYTHON_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh python setup.py ${ARG_EXTRA_ARGS} install --prefix ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM} --exec-prefix ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM} diff --git a/External/AtlasPyFwdBwdPorts/pkgbuildInstall.cmake.in b/External/AtlasPyFwdBwdPorts/pkgbuildInstall.cmake.in index f8f6b9090094d2840f442418748e4274b577007e..0a12e61f0c1f77c5d794caf471d909c3cf3258e4 100644 --- a/External/AtlasPyFwdBwdPorts/pkgbuildInstall.cmake.in +++ b/External/AtlasPyFwdBwdPorts/pkgbuildInstall.cmake.in @@ -1,4 +1,3 @@ -# $Id: pkgbuildInstall.cmake.in 720559 2016-01-29 09:13:32Z krasznaa $ # # Script installing a setuptools / distutils based Python package # during the release installation, under $CMAKE_INSTALL_PREFIX. @@ -11,7 +10,8 @@ if( NOT "$ENV{DESTDIR}" STREQUAL "" ) endif() # Install the package: -execute_process( COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh +execute_process( + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh python setup.py @ARG_EXTRA_ARGS@ install --prefix ${_destdir}${CMAKE_INSTALL_PREFIX} --exec-prefix ${_destdir}${CMAKE_INSTALL_PREFIX} diff --git a/External/pyAMI/CMakeLists.txt b/External/pyAMI/CMakeLists.txt index 55fe29d1b7576a3e7746fa85c5ea35b10c48501d..244195db8e5c1f92d291ce1b69ba532688705dd7 100644 --- a/External/pyAMI/CMakeLists.txt +++ b/External/pyAMI/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 769198 2016-08-22 13:52:03Z ssnyder $ # The name of the package: atlas_subdir( pyAMI ) @@ -26,13 +25,14 @@ function( _setup_python_package name file md5 ) BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Configuring the build of ${name}" - BUILD_COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + BUILD_COMMAND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh python setup.py build INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_PYTHON_OUTPUT_DIRECTORY} COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh python setup.py install --prefix ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM} --exec-prefix ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM} --root / diff --git a/External/pyAMI/pkgbuildInstall.cmake.in b/External/pyAMI/pkgbuildInstall.cmake.in index 2d170154db3f67cdaf093773d63d36edd8f78aa0..535c1866c9e7b8eeb901e31fc74be3d4ae861092 100644 --- a/External/pyAMI/pkgbuildInstall.cmake.in +++ b/External/pyAMI/pkgbuildInstall.cmake.in @@ -1,4 +1,3 @@ -# $Id: pkgbuildInstall.cmake.in 720561 2016-01-29 09:14:32Z krasznaa $ # # Script installing a setuptools / distutils based Python package # during the release installation, under $CMAKE_INSTALL_PREFIX. @@ -11,7 +10,8 @@ if( NOT "$ENV{DESTDIR}" STREQUAL "" ) endif() # Install the package: -execute_process( COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh +execute_process( + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh python setup.py install --prefix ${_destdir}${CMAKE_INSTALL_PREFIX} --exec-prefix ${_destdir}${CMAKE_INSTALL_PREFIX} diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt index 498ec7c1c63a2388b3adbb45ef8300ad68b6a499..30009fc3e3cf116371e047791fa359b476e32db5 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt @@ -19,6 +19,7 @@ atlas_depends_on_subdirs( Event/EventInfo InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetConditions/PixelConditionsData + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h index 3f5f25eede7010136c511e3aba2952515038e4fb..c99abf056c673f2d1208d81058e9ca9de6a8a6dd 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeToTConversion.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELCALIBALGS_PIXELCHARGETOTCONVERSION_H @@ -12,13 +12,14 @@ #include "InDetPrepRawData/PixelCluster.h" #include "InDetPrepRawData/PixelClusterContainer.h" +#include "PixelCabling/IPixelCablingSvc.h" #include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "StoreGate/ReadCondHandleKey.h" #include<string> #include<vector> -class IPixelCalibSvc; class IBLParameterSvc; class PixelChargeToTConversion: public AthAlgorithm{ @@ -32,14 +33,20 @@ class PixelChargeToTConversion: public AthAlgorithm{ StatusCode finalize(); private: - ServiceHandle<IPixelCalibSvc> m_calibsvc; ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; //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"}; + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service" }; + + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Charge calibration"}; }; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx index 6710782b737680e8403054974ad2fd689b3f9596..cebaecd82bcbbcdc1f883a710c9659a73cddb5fc 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeToTConversion.cxx @@ -1,10 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // conditions #include "PixelCalibAlgs/PixelChargeToTConversion.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" #define private public @@ -15,11 +14,9 @@ PixelChargeToTConversion::PixelChargeToTConversion(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), - m_calibsvc("PixelCalibSvc", name), m_IBLParameterSvc("IBLParameterSvc",name), m_Pixel_clcontainer(0) { - declareProperty("PixelCalibSvc", m_calibsvc); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -32,19 +29,15 @@ StatusCode PixelChargeToTConversion::initialize(){ ATH_MSG_INFO( "Initializing PixelChargeToTConversion" ); - if (StatusCode::SUCCESS!=m_calibsvc.retrieve() ) { - msg(MSG::FATAL) << "PixelCalibSvc not found" << endmsg; - return StatusCode::FAILURE; - } - msg(MSG::INFO) << " PixelCalibSvc found " << endmsg; - if (m_IBLParameterSvc.retrieve().isFailure()) { ATH_MSG_FATAL("Could not retrieve IBLParameterSvc"); return StatusCode::FAILURE; } else ATH_MSG_INFO("Retrieved service " << m_IBLParameterSvc); - + + ATH_CHECK(m_pixelCabling.retrieve()); ATH_CHECK(m_moduleDataKey.initialize()); + ATH_CHECK(m_chargeDataKey.initialize()); return StatusCode::SUCCESS; } @@ -62,9 +55,11 @@ StatusCode PixelChargeToTConversion::execute(){ int overflowIBLToT=0; if( m_IBLParameterSvc->containsIBL()) { - overflowIBLToT = SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getIBLOverflowToT(); + overflowIBLToT = SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getFEI4OverflowToT(0,0); } + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + typedef InDet::PixelClusterContainer::const_iterator ClusterIter; ClusterIter itrCluster; ClusterIter itrClubeg=m_Pixel_clcontainer->begin(); @@ -108,17 +103,12 @@ StatusCode PixelChargeToTConversion::execute(){ for (int i=0; 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); + Identifier moduleID = pixelID.wafer_id(pixid); + IdentifierHash moduleHash = pixelID.wafer_hash(moduleID); + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + int totInt = (int)calibData->getToT((int)moduleHash, circ, type, Charges[i]); if( m_IBLParameterSvc->containsIBL() && pixelID.barrel_ec(pixid) == 0 && pixelID.layer_disk(pixid) == 0 ) { int tot0 = totInt; diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt index 99c4567fd6586aeca55bb980e335781d6b3d0815..17cd376f6394fec6fda574f6f3ebeeb501d57e57 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt @@ -8,6 +8,7 @@ atlas_subdir( PixelConditionsAlgorithms ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + Commission/CommissionEvent Control/AthenaBaseComps Control/AthenaKernel Database/AthenaPOOL/AthenaPoolUtilities @@ -49,7 +50,7 @@ atlas_add_component( PixelConditionsAlgorithms INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${COOL_LIBRARIES} - ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaPoolUtilities + ${CLHEP_LIBRARIES} CommissionEvent AthenaBaseComps AthenaKernel AthenaPoolUtilities GaudiKernel PixelConditionsData SGTools StoreGateLib CoralDB GeoModelUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelCablingLib PixelConditionsAlgorithmsLib PathResolver ) diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4039eb2993fd930a9c220d3b6fe24d34328ca868 --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx @@ -0,0 +1,207 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelChargeCalibCondAlg.h" +#include "Identifier/IdentifierHash.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "GaudiKernel/EventIDRange.h" +#include <memory> +#include <sstream> + +PixelChargeCalibCondAlg::PixelChargeCalibCondAlg(const std::string& name, ISvcLocator* pSvcLocator): + ::AthAlgorithm(name, pSvcLocator), + m_pixelID(nullptr), + m_detManager(nullptr), + m_condSvc("CondSvc", name) +{ +} + +StatusCode PixelChargeCalibCondAlg::initialize() { + ATH_MSG_DEBUG("PixelChargeCalibCondAlg::initialize()"); + + ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID")); + ATH_CHECK(detStore()->retrieve(m_detManager,"Pixel")); + + ATH_CHECK(m_condSvc.retrieve()); + + ATH_CHECK(m_configKey.initialize()); + ATH_CHECK(m_readKey.initialize()); + + ATH_CHECK(m_writeKey.initialize()); + if (m_condSvc->regHandle(this,m_writeKey).isFailure()) { + ATH_MSG_FATAL("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc"); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; +} + +StatusCode PixelChargeCalibCondAlg::execute() { + ATH_MSG_DEBUG("PixelChargeCalibCondAlg::execute()"); + + SG::WriteCondHandle<PixelChargeCalibCondData> 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<PixelModuleData> configData(m_configKey); + + // Construct the output Cond Object and fill it in + std::unique_ptr<PixelChargeCalibCondData> writeCdo(std::make_unique<PixelChargeCalibCondData>()); + + const EventIDBase start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM}; + const EventIDBase stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM}; + + EventIDRange rangeW{start, stop}; + if (configData->getUseCalibConditions()) { + SG::ReadCondHandle<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 + if (not readHandle.range(rangeW)) { + ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandle.key()); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Size of CondAttrListCollection " << readHandle.fullKey() << " readCdo->size()= " << readCdo->size()); + ATH_MSG_INFO("Range of input is " << rangeW); + + for (CondAttrListCollection::const_iterator attrList=readCdo->begin(); attrList!=readCdo->end(); ++attrList) { + CondAttrListCollection::ChanNum channelNumber = attrList->first; + CondAttrListCollection::AttributeList payload = attrList->second; + + if (payload.exists("data") and not payload["data"].isNull()) { + std::string stringStatus = payload["data"].data<std::string>(); + + std::stringstream ss(stringStatus); + std::vector<std::string> component; + std::string buffer; + while (std::getline(ss,buffer,'\n')) { component.push_back(buffer); } + + for (int i=1; i<(int)component.size(); i++) { + std::stringstream checkFE(component[i]); + std::vector<std::string> FEString; + while (std::getline(checkFE,buffer,' ')) { FEString.push_back(buffer); } + + // Normal pixel + writeCdo -> setAnalogThreshold((int)channelNumber, std::atoi(FEString[1].c_str())); + writeCdo -> setAnalogThresholdSigma((int)channelNumber, std::atoi(FEString[2].c_str())); + writeCdo -> setAnalogThresholdNoise((int)channelNumber, std::atoi(FEString[3].c_str())); + writeCdo -> setInTimeThreshold((int)channelNumber, std::atoi(FEString[4].c_str())); + + writeCdo -> setQ2TotA((int)channelNumber, std::atof(FEString[13].c_str())); + writeCdo -> setQ2TotE((int)channelNumber, std::atof(FEString[14].c_str())); + writeCdo -> setQ2TotC((int)channelNumber, std::atof(FEString[15].c_str())); + + writeCdo -> setTotRes1((int)channelNumber, std::atof(FEString[19].c_str())); + writeCdo -> setTotRes2((int)channelNumber, std::atof(FEString[20].c_str())); + + // Long pixel + writeCdo -> setAnalogThresholdLong((int)channelNumber, std::atoi(FEString[5].c_str())); + writeCdo -> setAnalogThresholdSigmaLong((int)channelNumber, std::atoi(FEString[6].c_str())); + writeCdo -> setAnalogThresholdNoiseLong((int)channelNumber, std::atoi(FEString[7].c_str())); + writeCdo -> setInTimeThresholdLong((int)channelNumber, std::atoi(FEString[8].c_str())); + + writeCdo -> setQ2TotALong((int)channelNumber, std::atof(FEString[16].c_str())); + writeCdo -> setQ2TotELong((int)channelNumber, std::atof(FEString[17].c_str())); + writeCdo -> setQ2TotCLong((int)channelNumber, std::atof(FEString[18].c_str())); + + // Ganged pixel + writeCdo -> setAnalogThresholdGanged((int)channelNumber, std::atoi(FEString[9].c_str())); + writeCdo -> setAnalogThresholdSigmaGanged((int)channelNumber, std::atoi(FEString[10].c_str())); + writeCdo -> setAnalogThresholdNoiseGanged((int)channelNumber, std::atoi(FEString[11].c_str())); + writeCdo -> setInTimeThresholdGanged((int)channelNumber, std::atoi(FEString[12].c_str())); + } + } + else { + ATH_MSG_WARNING("payload[\"data\"] does not exist for ChanNum " << channelNumber); + Identifier wafer_id = m_pixelID->wafer_id(IdentifierHash(channelNumber)); + int bec = m_pixelID->barrel_ec(wafer_id); + int layer = m_pixelID->layer_disk(wafer_id); + const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + for (int j=0; j<p_design->numberOfCircuits(); j++) { + writeCdo -> setAnalogThreshold((int)channelNumber, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigma((int)channelNumber,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoise((int)channelNumber,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThreshold((int)channelNumber, configData->getDefaultInTimeThreshold(bec,layer)); + writeCdo -> setQ2TotA((int)channelNumber, configData->getDefaultQ2TotA()); + writeCdo -> setQ2TotE((int)channelNumber, configData->getDefaultQ2TotE()); + writeCdo -> setQ2TotC((int)channelNumber, configData->getDefaultQ2TotC()); + writeCdo -> setTotRes1((int)channelNumber, 0.0); + writeCdo -> setTotRes2((int)channelNumber, 0.0); + + // Long pixel + writeCdo -> setAnalogThresholdLong((int)channelNumber, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigmaLong((int)channelNumber,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoiseLong((int)channelNumber,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThresholdLong((int)channelNumber, configData->getDefaultInTimeThreshold(bec,layer)); + + writeCdo -> setQ2TotALong((int)channelNumber, configData->getDefaultQ2TotA()); + writeCdo -> setQ2TotELong((int)channelNumber, configData->getDefaultQ2TotE()); + writeCdo -> setQ2TotCLong((int)channelNumber, configData->getDefaultQ2TotC()); + + // Ganged pixel + writeCdo -> setAnalogThresholdGanged((int)channelNumber, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigmaGanged((int)channelNumber,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoiseGanged((int)channelNumber,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThresholdGanged((int)channelNumber, configData->getDefaultInTimeThreshold(bec,layer)); + } + } + } + } + else { + for (int i=0; i<(int)m_pixelID->wafer_hash_max(); i++) { + Identifier wafer_id = m_pixelID->wafer_id(IdentifierHash(i)); + int bec = m_pixelID->barrel_ec(wafer_id); + int layer = m_pixelID->layer_disk(wafer_id); + const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); + const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); + for (int j=0; j<p_design->numberOfCircuits(); j++) { + writeCdo -> setAnalogThreshold(i, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigma(i,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoise(i,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThreshold(i, configData->getDefaultInTimeThreshold(bec,layer)); + writeCdo -> setQ2TotA(i, configData->getDefaultQ2TotA()); + writeCdo -> setQ2TotE(i, configData->getDefaultQ2TotE()); + writeCdo -> setQ2TotC(i, configData->getDefaultQ2TotC()); + writeCdo -> setTotRes1(i, 0.0); + writeCdo -> setTotRes2(i, 0.0); + + // Long pixel + writeCdo -> setAnalogThresholdLong(i, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigmaLong(i,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoiseLong(i,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThresholdLong(i, configData->getDefaultInTimeThreshold(bec,layer)); + + writeCdo -> setQ2TotALong(i, configData->getDefaultQ2TotA()); + writeCdo -> setQ2TotELong(i, configData->getDefaultQ2TotE()); + writeCdo -> setQ2TotCLong(i, configData->getDefaultQ2TotC()); + + // Ganged pixel + writeCdo -> setAnalogThresholdGanged(i, configData->getDefaultAnalogThreshold(bec,layer)); + writeCdo -> setAnalogThresholdSigmaGanged(i,configData->getDefaultAnalogThresholdSigma(bec,layer)); + writeCdo -> setAnalogThresholdNoiseGanged(i,configData->getDefaultAnalogThresholdNoise(bec,layer)); + writeCdo -> setInTimeThresholdGanged(i, configData->getDefaultInTimeThreshold(bec,layer)); + } + } + } + + if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) { + ATH_MSG_FATAL("Could not record PixelChargeCalibCondData " << writeHandle.key() << " with EventRange " << rangeW << " into Conditions Store"); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("recorded new CDO " << writeHandle.key() << " with range " << rangeW << " into Conditions Store"); + + return StatusCode::SUCCESS; +} + +StatusCode PixelChargeCalibCondAlg::finalize() { + ATH_MSG_DEBUG("PixelChargeCalibCondAlg::finalize()"); + return StatusCode::SUCCESS; +} + diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..2b94c0f860a0ff92dc445ee891dfe72b7854b5dd --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELCHARGECALIBCONDALG +#define PIXELCHARGECALIBCONDALG + +#include "AthenaBaseComps/AthAlgorithm.h" + +#include "StoreGate/ReadCondHandleKey.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" + +#include "StoreGate/WriteCondHandleKey.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" + +#include "InDetIdentifier/PixelID.h" +#include "InDetReadoutGeometry/PixelDetectorManager.h" + +#include "GaudiKernel/ICondSvc.h" +#include "GaudiKernel/Property.h" + +class PixelChargeCalibCondAlg : public AthAlgorithm { + public: + PixelChargeCalibCondAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~PixelChargeCalibCondAlg() = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; + + private: + const PixelID* m_pixelID; + const InDetDD::PixelDetectorManager * m_detManager; + + SG::ReadCondHandleKey<PixelModuleData> m_configKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey + {this, "ReadKey", "/PIXEL/PixCalib", "Iput charge calibration folder"}; + + SG::WriteCondHandleKey<PixelChargeCalibCondData> m_writeKey + {this, "WriteKey", "PixelChargeCalibCondData", "Output charge caliblation data"}; + + ServiceHandle<ICondSvc> m_condSvc; +}; + +#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx index 68bb88de45ac9ccfb2150f33fbcc463a08e7cfb0..1690b00e161072dfd3f8850b945def740c7e9d46 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx @@ -10,59 +10,138 @@ PixelConfigCondAlg::PixelConfigCondAlg(const std::string& name, ISvcLocator* pSvcLocator): ::AthReentrantAlgorithm(name, pSvcLocator), - m_BarrelAnalogThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_EndcapAnalogThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_DBMAnalogThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_BarrelToTThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_EndcapToTThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_DBMToTThreshold({-1,-1,-1,-1,-1,-1,-1}), - m_BarrelLatency({256,256,256,256,256,256,256}), - m_EndcapLatency({256,256,256,256,256,256,256}), - m_DBMLatency({256,256,256,256,256,256,256}), - m_BarrelCrossTalk({0.06,0.06,0.06,0.06,0.06,0.06,0.06}), - m_EndcapCrossTalk({0.06,0.06,0.06,0.06,0.06,0.06,0.06}), - m_DBMCrossTalk({0.06,0.06,0.06,0.06,0.06,0.06,0.06}), - m_BarrelThermalNoise({160.0,160.0,160.0,160.0,160.0,160.0,160.0}), - m_EndcapThermalNoise({160.0,160.0,160.0,160.0,160.0,160.0,160.0}), - m_DBMThermalNoise({160.0,160.0,160.0,160.0,160.0,160.0,160.0}), - m_BarrelHitDuplication({false,false,false,false,false,false,false}), - m_EndcapHitDuplication({false,false,false,false,false,false,false}), - m_DBMHitDuplication({false,false,false,false,false,false,false}), - m_BarrelSmallHitToT({-1,-1,-1,-1,-1,-1,-1}), - m_EndcapSmallHitToT({-1,-1,-1,-1,-1,-1,-1}), - m_DBMSmallHitToT({-1,-1,-1,-1,-1,-1,-1}), - m_IBLHitDisConfig(2), + m_bunchSpace(25.0), + m_UseComTime(false), + m_ComTime(0.0), + m_BarrelNumberOfBCID({1,1,1,1}), + m_EndcapNumberOfBCID({1,1,1}), + m_DBMNumberOfBCID({1,1,1}), + m_BarrelTimeOffset({5.0,5.0,5.0,5.0}), + m_EndcapTimeOffset({5.0,5.0,5.0}), + m_DBMTimeOffset({5.0,5.0,5.0}), + m_BarrelTimeJitter({0.0,0.0,0.0,0.0}), + m_EndcapTimeJitter({0.0,0.0,0.0}), + m_DBMTimeJitter({0.0,0.0,0.0}), + m_useCalibConditions(true), + m_BarrelAnalogThreshold({2000,4300,3500,3500}), + m_EndcapAnalogThreshold({3500,3500,3500}), + m_DBMAnalogThreshold({2000,2000,2000}), + m_BarrelAnalogThresholdSigma({45,35,30,30}), + m_EndcapAnalogThresholdSigma({30,30,30}), + m_DBMAnalogThresholdSigma({70,70,70}), + m_BarrelAnalogThresholdNoise({130,150,160,160}), + m_EndcapAnalogThresholdNoise({150,150,150}), + m_DBMAnalogThresholdNoise({190,190,190}), + m_BarrelInTimeThreshold({2000,5000,5000,5000}), + m_EndcapInTimeThreshold({5000,5000,5000}), + m_DBMInTimeThreshold({1200,1200,1200}), + m_CalibrationParameterA(70.2), + m_CalibrationParameterE(-3561.25), + m_CalibrationParameterC(26000), + m_BarrelToTThreshold({-1, 3, 5, 5}), + m_EndcapToTThreshold({ 5, 5, 5}), + m_DBMToTThreshold({-1,-1,-1}), + m_BarrelCrossTalk({0.06,0.06,0.06,0.06}), + m_EndcapCrossTalk({0.06,0.06,0.06}), + m_DBMCrossTalk({0.06,0.06,0.06}), + m_BarrelThermalNoise({160.0,160.0,160.0,160.0}), + m_EndcapThermalNoise({160.0,160.0,160.0}), + m_DBMThermalNoise({160.0,160.0,160.0}), + m_BarrelNoiseOccupancy({5e-8,5e-8,5e-8,5e-8}), + m_EndcapNoiseOccupancy({5e-8,5e-8,5e-8}), + m_DBMNoiseOccupancy({5e-8,5e-8,5e-8}), + m_BarrelDisableProbability({9e-3,9e-3,9e-3,9e-3}), + m_EndcapDisableProbability({9e-3,9e-3,9e-3}), + m_DBMDisableProbability({9e-3,9e-3,9e-3}), + m_BarrelNoiseShape({{0.0,1.0},{0.0,1.0},{0.0,1.0},{0.0,1.0}}), + m_EndcapNoiseShape({{0.0,1.0},{0.0,1.0},{0.0,1.0}}), + m_DBMNoiseShape({{0.0,1.0},{0.0,1.0},{0.0,1.0}}), + m_IBLNoiseShape({0.0,1.0}), + m_BLayerNoiseShape({0.0,1.0}), + m_PixelNoiseShape({0.0,1.0}), + m_FEI3BarrelLatency({ 0,151,256,256}), + m_FEI3EndcapLatency({256,256,256}), + m_FEI3BarrelHitDuplication({false,false,false,false}), + m_FEI3EndcapHitDuplication({false,false,false}), + m_FEI3BarrelSmallHitToT({-1,-1,-1,-1}), + m_FEI3EndcapSmallHitToT({-1,-1,-1}), + m_FEI3BarrelTimingSimTune({2015,2015,2015,2015}), + m_FEI3EndcapTimingSimTune({2015,2015,2015}), + m_FEI4BarrelHitDiscConfig({2}), + m_FEI4EndcapHitDiscConfig({2}), m_useDeadMap(true), m_condSvc("CondSvc", name) { - declareProperty("BarrelAnalogThreshold", m_BarrelAnalogThreshold); - declareProperty("EndcapAnalogThreshold", m_EndcapAnalogThreshold); - declareProperty("DBMAnalogThreshold", m_DBMAnalogThreshold); + declareProperty("BunchSpace", m_bunchSpace); + declareProperty("UseComTime", m_UseComTime); + declareProperty("BarrelNumberOfBCID", m_BarrelNumberOfBCID); + declareProperty("EndcapNumberOfBCID", m_EndcapNumberOfBCID); + declareProperty("DBMNumberOfBCID", m_DBMNumberOfBCID); + declareProperty("BarrelTimeOffset", m_BarrelTimeOffset); + declareProperty("EndcapTimeOffset", m_EndcapTimeOffset); + declareProperty("DBMTimeOffset", m_DBMTimeOffset); + declareProperty("BarrelTimeJitter", m_BarrelTimeJitter); + declareProperty("EndcapTimeJitter", m_EndcapTimeJitter); + declareProperty("DBMTimeJitter", m_DBMTimeJitter); + declareProperty("UseCalibConditions", m_useCalibConditions); + declareProperty("DefaultBarrelAnalogThreshold", m_BarrelAnalogThreshold); + declareProperty("DefaultEndcapAnalogThreshold", m_EndcapAnalogThreshold); + declareProperty("DefaultDBMAnalogThreshold", m_DBMAnalogThreshold); + declareProperty("DefaultBarrelAnalogThresholdSigma", m_BarrelAnalogThresholdSigma); + declareProperty("DefaultEndcapAnalogThresholdSigma", m_EndcapAnalogThresholdSigma); + declareProperty("DefaultDBMAnalogThresholdSigma", m_DBMAnalogThresholdSigma); + declareProperty("DefaultBarrelAnalogThresholdNoise", m_BarrelAnalogThresholdNoise); + declareProperty("DefaultEndcapAnalogThresholdNoise", m_EndcapAnalogThresholdNoise); + declareProperty("DefaultDBMAnalogThresholdNoise", m_DBMAnalogThresholdNoise); + declareProperty("DefaultBarrelInTimeThreshold", m_BarrelInTimeThreshold); + declareProperty("DefaultEndcapInTimeThreshold", m_EndcapInTimeThreshold); + declareProperty("DefaultDBMInTimeThreshold", m_DBMInTimeThreshold); + declareProperty("DefaultCalibrationParameterA", m_CalibrationParameterA); + declareProperty("DefaultCalibrationParameterE", m_CalibrationParameterE); + declareProperty("DefaultCalibrationParameterC", m_CalibrationParameterC); declareProperty("BarrelToTThreshold", m_BarrelToTThreshold); declareProperty("EndcapToTThreshold", m_EndcapToTThreshold); declareProperty("DBMToTThreshold", m_DBMToTThreshold); - declareProperty("BarrelLatency", m_BarrelLatency); - declareProperty("EndcapLatency", m_EndcapLatency); - declareProperty("DBMLatency", m_DBMLatency); declareProperty("BarrelCrossTalk", m_BarrelCrossTalk); declareProperty("EndcapCrossTalk", m_EndcapCrossTalk); declareProperty("DBMCrossTalk", m_DBMCrossTalk); declareProperty("BarrelThermalNoise", m_BarrelThermalNoise); declareProperty("EndcapThermalNoise", m_EndcapThermalNoise); declareProperty("DBMThermalNoise", m_DBMThermalNoise); - declareProperty("BarrelHitDuplication", m_BarrelHitDuplication); - declareProperty("EndcapHitDuplication", m_EndcapHitDuplication); - declareProperty("DBMHitDuplication", m_DBMHitDuplication); - declareProperty("BarrelSmallHitToT", m_BarrelSmallHitToT); - declareProperty("EndcapSmallHitToT", m_EndcapSmallHitToT); - declareProperty("DBMSmallHitToT", m_DBMSmallHitToT); - declareProperty("FEI4HitDiscConfig", m_IBLHitDisConfig); +// declareProperty("BarrelNoiseShape", m_BarrelNoiseShape); // So far deaclareProperty does not accept 2D vector. +// declareProperty("EndcapNoiseShape", m_EndcapNoiseShape); +// declareProperty("DBMNoiseShape", m_DBMNoiseShape); + declareProperty("IBLNoiseShape", m_IBLNoiseShape); // This is ad-hoc solution. + declareProperty("BLayerNoiseShape", m_BLayerNoiseShape); + declareProperty("PixelNoiseShape", m_PixelNoiseShape); + declareProperty("FEI3BarrelLatency", m_FEI3BarrelLatency); + declareProperty("FEI3EndcapLatency", m_FEI3EndcapLatency); + declareProperty("FEI3BarrelHitDuplication", m_FEI3BarrelHitDuplication); + declareProperty("FEI3EndcapHitDuplication", m_FEI3EndcapHitDuplication); + declareProperty("FEI3BarrelSmallHitToT", m_FEI3BarrelSmallHitToT); + declareProperty("FEI3EndcapSmallHitToT", m_FEI3EndcapSmallHitToT); + declareProperty("FEI3BarrelTimingSimTune", m_FEI3BarrelTimingSimTune); + declareProperty("FEI3EndcapTimingSimTune", m_FEI3EndcapTimingSimTune); + declareProperty("FEI4BarrelHitDiscConfig", m_FEI4BarrelHitDiscConfig); + declareProperty("FEI4EndcapHitDiscConfig", m_FEI4EndcapHitDiscConfig); declareProperty("UseDeadMap", m_useDeadMap, "Switch for usage of dead map"); } StatusCode PixelConfigCondAlg::initialize() { ATH_MSG_DEBUG("PixelConfigCondAlg::initialize()"); + ATH_CHECK(m_ComTimeKey.initialize(m_UseComTime)); + if (m_UseComTime) { + SG::ReadHandle<ComTime> comTime(m_ComTimeKey); + if (comTime.isValid()) { + m_ComTime = comTime->getTime(); + ATH_MSG_DEBUG("Found tool for cosmic/commissioning timing: ComTime"); + } + else { + ATH_MSG_WARNING("Did not find tool needed for cosmic/commissioning timing: ComTime"); + } + } + ATH_CHECK(m_condSvc.retrieve()); if (m_useDeadMap) { ATH_CHECK(m_readDeadMapKey.initialize()); } @@ -73,11 +152,6 @@ StatusCode PixelConfigCondAlg::initialize() { return StatusCode::FAILURE; } - if (m_IBLHitDisConfig<0 || m_IBLHitDisConfig>3) { - ATH_MSG_FATAL("HitDiscConfig should be set [0-3]. (FEI4HitDiscConfig=" << m_IBLHitDisConfig << ")"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; } @@ -192,28 +266,91 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { // Set threshold //=============== EventIDRange rangeThreshold{start, stop}; - writeCdo -> setBarrelAnalogThreshold(m_BarrelAnalogThreshold); - writeCdo -> setEndcapAnalogThreshold(m_EndcapAnalogThreshold); - writeCdo -> setDBMAnalogThreshold(m_DBMAnalogThreshold); + writeCdo -> setBunchSpace(m_bunchSpace); + writeCdo -> setUseComTime(m_UseComTime); + writeCdo -> setComTime(m_ComTime); + writeCdo -> setBarrelNumberOfBCID(m_BarrelNumberOfBCID); + writeCdo -> setEndcapNumberOfBCID(m_EndcapNumberOfBCID); + writeCdo -> setDBMNumberOfBCID(m_DBMNumberOfBCID); + writeCdo -> setBarrelTimeOffset(m_BarrelTimeOffset); + writeCdo -> setEndcapTimeOffset(m_EndcapTimeOffset); + writeCdo -> setDBMTimeOffset(m_DBMTimeOffset); + writeCdo -> setBarrelTimeJitter(m_BarrelTimeJitter); + writeCdo -> setEndcapTimeJitter(m_EndcapTimeJitter); + writeCdo -> setDBMTimeJitter(m_DBMTimeJitter); + writeCdo -> setUseCalibConditions(m_useCalibConditions); + writeCdo -> setDefaultBarrelAnalogThreshold(m_BarrelAnalogThreshold); + writeCdo -> setDefaultEndcapAnalogThreshold(m_EndcapAnalogThreshold); + writeCdo -> setDefaultDBMAnalogThreshold(m_DBMAnalogThreshold); + writeCdo -> setDefaultBarrelAnalogThresholdSigma(m_BarrelAnalogThresholdSigma); + writeCdo -> setDefaultEndcapAnalogThresholdSigma(m_EndcapAnalogThresholdSigma); + writeCdo -> setDefaultDBMAnalogThresholdSigma(m_DBMAnalogThresholdSigma); + writeCdo -> setDefaultBarrelAnalogThresholdNoise(m_BarrelAnalogThresholdNoise); + writeCdo -> setDefaultEndcapAnalogThresholdNoise(m_EndcapAnalogThresholdNoise); + writeCdo -> setDefaultDBMAnalogThresholdNoise(m_DBMAnalogThresholdNoise); + writeCdo -> setDefaultBarrelInTimeThreshold(m_BarrelInTimeThreshold); + writeCdo -> setDefaultEndcapInTimeThreshold(m_EndcapInTimeThreshold); + writeCdo -> setDefaultDBMInTimeThreshold(m_DBMInTimeThreshold); + writeCdo -> setDefaultQ2TotA(m_CalibrationParameterA); + writeCdo -> setDefaultQ2TotE(m_CalibrationParameterE); + writeCdo -> setDefaultQ2TotC(m_CalibrationParameterC); writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold); writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold); writeCdo -> setDBMToTThreshold(m_DBMToTThreshold); - writeCdo -> setBarrelLatency(m_BarrelLatency); - writeCdo -> setEndcapLatency(m_EndcapLatency); - writeCdo -> setDBMLatency(m_DBMLatency); writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk); writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk); writeCdo -> setDBMCrossTalk(m_DBMCrossTalk); writeCdo -> setBarrelThermalNoise(m_BarrelThermalNoise); writeCdo -> setEndcapThermalNoise(m_EndcapThermalNoise); writeCdo -> setDBMThermalNoise(m_DBMThermalNoise); - writeCdo -> setBarrelHitDuplication(m_BarrelHitDuplication); - writeCdo -> setEndcapHitDuplication(m_EndcapHitDuplication); - writeCdo -> setDBMHitDuplication(m_DBMHitDuplication); - writeCdo -> setBarrelSmallHitToT(m_BarrelSmallHitToT); - writeCdo -> setEndcapSmallHitToT(m_EndcapSmallHitToT); - writeCdo -> setDBMSmallHitToT(m_DBMSmallHitToT); - writeCdo -> setIBLHitDiscConfig(m_IBLHitDisConfig); + writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy); + writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy); + writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy); + writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability); + writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability); + writeCdo -> setDBMDisableProbability(m_DBMDisableProbability); + + for (size_t i=0; i<m_IBLNoiseShape.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape.at(i)); } + for (size_t i=0; i<m_BLayerNoiseShape.size(); i++) { writeCdo->setBarrelNoiseShape(1,m_BLayerNoiseShape.at(i)); } + for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setBarrelNoiseShape(2,m_PixelNoiseShape.at(i)); } + for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setBarrelNoiseShape(3,m_PixelNoiseShape.at(i)); } + + for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setEndcapNoiseShape(0,m_PixelNoiseShape.at(i)); } + for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setEndcapNoiseShape(1,m_PixelNoiseShape.at(i)); } + for (size_t i=0; i<m_PixelNoiseShape.size(); i++) { writeCdo->setEndcapNoiseShape(2,m_PixelNoiseShape.at(i)); } + + for (size_t i=0; i<m_IBLNoiseShape.size(); i++) { writeCdo->setDBMNoiseShape(0,m_IBLNoiseShape.at(i)); } + for (size_t i=0; i<m_IBLNoiseShape.size(); i++) { writeCdo->setDBMNoiseShape(1,m_IBLNoiseShape.at(i)); } + for (size_t i=0; i<m_IBLNoiseShape.size(); i++) { writeCdo->setDBMNoiseShape(2,m_IBLNoiseShape.at(i)); } + +/* + for (size_t i=0; i<m_BarrelNoiseShape.size(); i++) { + for (size_t j=0; j<m_BarrelNoiseShape[i].size(); j++) { + writeCdo -> setBarrelNoiseShape(i,m_BarrelNoiseShape[i][j]); + } + } + for (size_t i=0; i<m_EndcapNoiseShape.size(); i++) { + for (size_t j=0; j<m_EndcapNoiseShape[i].size(); j++) { + writeCdo -> setEndcapNoiseShape(i,m_EndcapNoiseShape[i][j]); + } + } + for (size_t i=0; i<m_DBMNoiseShape.size(); i++) { + for (size_t j=0; j<m_DBMNoiseShape[i].size(); j++) { + writeCdo -> setDBMNoiseShape(i,m_DBMNoiseShape[i][j]); + } + } +*/ + + writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency); + writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency); + writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication); + writeCdo -> setFEI3EndcapHitDuplication(m_FEI3EndcapHitDuplication); + writeCdo -> setFEI3BarrelSmallHitToT(m_FEI3BarrelSmallHitToT); + writeCdo -> setFEI3EndcapSmallHitToT(m_FEI3EndcapSmallHitToT); + writeCdo -> setFEI3BarrelTimingSimTune(m_FEI3BarrelTimingSimTune); + writeCdo -> setFEI3EndcapTimingSimTune(m_FEI3EndcapTimingSimTune); + writeCdo -> setFEI4BarrelHitDiscConfig(m_FEI4BarrelHitDiscConfig); + writeCdo -> setFEI4EndcapHitDiscConfig(m_FEI4EndcapHitDiscConfig); //======================= // Combine time interval diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h index 1893d81a21dd72367ccaaa9719b47077aff3a678..6be5362640e3d6e4e15d44512ed08da9d5da7125 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELCONFIGCONDALG @@ -9,6 +9,7 @@ #include "StoreGate/ReadCondHandleKey.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "CommissionEvent/ComTime.h" #include "StoreGate/WriteCondHandleKey.h" #include "PixelConditionsData/PixelModuleData.h" @@ -25,31 +26,71 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { virtual StatusCode finalize() override; private: + double m_bunchSpace; + bool m_UseComTime; + double m_ComTime; + std::vector<int> m_BarrelNumberOfBCID; + std::vector<int> m_EndcapNumberOfBCID; + std::vector<int> m_DBMNumberOfBCID; + std::vector<double> m_BarrelTimeOffset; + std::vector<double> m_EndcapTimeOffset; + std::vector<double> m_DBMTimeOffset; + std::vector<double> m_BarrelTimeJitter; + std::vector<double> m_EndcapTimeJitter; + std::vector<double> m_DBMTimeJitter; + bool m_useCalibConditions; std::vector<int> m_BarrelAnalogThreshold; std::vector<int> m_EndcapAnalogThreshold; std::vector<int> m_DBMAnalogThreshold; + std::vector<int> m_BarrelAnalogThresholdSigma; + std::vector<int> m_EndcapAnalogThresholdSigma; + std::vector<int> m_DBMAnalogThresholdSigma; + std::vector<int> m_BarrelAnalogThresholdNoise; + std::vector<int> m_EndcapAnalogThresholdNoise; + std::vector<int> m_DBMAnalogThresholdNoise; + std::vector<int> m_BarrelInTimeThreshold; + std::vector<int> m_EndcapInTimeThreshold; + std::vector<int> m_DBMInTimeThreshold; + float m_CalibrationParameterA; + float m_CalibrationParameterE; + float m_CalibrationParameterC; 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; + std::vector<double> m_BarrelNoiseOccupancy; + std::vector<double> m_EndcapNoiseOccupancy; + std::vector<double> m_DBMNoiseOccupancy; + std::vector<double> m_BarrelDisableProbability; + std::vector<double> m_EndcapDisableProbability; + std::vector<double> m_DBMDisableProbability; + std::vector<std::vector<float>> m_BarrelNoiseShape; + std::vector<std::vector<float>> m_EndcapNoiseShape; + std::vector<std::vector<float>> m_DBMNoiseShape; + std::vector<float> m_IBLNoiseShape; // This is ad-hoc solution. + std::vector<float> m_BLayerNoiseShape; + std::vector<float> m_PixelNoiseShape; + std::vector<int> m_FEI3BarrelLatency; + std::vector<int> m_FEI3EndcapLatency; + std::vector<bool> m_FEI3BarrelHitDuplication; + std::vector<bool> m_FEI3EndcapHitDuplication; + std::vector<int> m_FEI3BarrelSmallHitToT; + std::vector<int> m_FEI3EndcapSmallHitToT; + std::vector<int> m_FEI3BarrelTimingSimTune; + std::vector<int> m_FEI3EndcapTimingSimTune; + std::vector<int> m_FEI4BarrelHitDiscConfig; + std::vector<int> m_FEI4EndcapHitDiscConfig; bool m_useDeadMap; + SG::ReadHandleKey<ComTime> m_ComTimeKey + {this, "ComTimeKey", "ComTime", "Commissioning time for cosmic"}; + SG::ReadCondHandleKey<CondAttrListCollection> m_readDeadMapKey {this, "ReadDeadMapKey", "/PIXEL/PixMapOverlay", "Input key of deadmap conditions folder"}; diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx index 3477d414a0dd14f7252fdb3f56a29ccac2de43de..710adbe4857ef51152f689384f04b3a76531f5e1 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.cxx @@ -16,36 +16,38 @@ StatusCode PixelSiliconConditionsTestAlg::initialize() { ATH_MSG_INFO("Calling initialize"); -// OLD ATH_CHECK(m_siliconTool.retrieve()); + ATH_CHECK(m_moduleDataKey.initialize()); ATH_CHECK(m_readKeyTemp.initialize()); ATH_CHECK(m_readKeyHV.initialize()); ATH_CHECK(m_moduleDataKey.initialize()); ATH_CHECK(m_lorentzAngleTool.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); return StatusCode::SUCCESS; } StatusCode PixelSiliconConditionsTestAlg::execute(){ - //This method is only used to test the summary service, and only used within this package, - // so the INFO level messages have no impact on performance of these services when used by clients SG::ReadCondHandle<PixelModuleData> hv(m_readKeyHV); SG::ReadCondHandle<PixelModuleData> temp(m_readKeyTemp); SG::ReadCondHandle<PixelModuleData> deadmap(m_moduleDataKey); - - // Check HV - for (int i=0; i<2048; i++) { std::cout << "PIXEL HV : " << i << " " << hv->getBiasVoltage(i) << std::endl; } -// OLD for (int i=0; i<2048; i++) { std::cout << "PIXEL HV : " << i << " " << m_siliconTool->biasVoltage(IdentifierHash(i)) << std::endl; } - - // Check temperature - for (int i=0; i<2048; i++) { std::cout << "PIXEL Temperature : " << i << " " << temp->getTemperature(i) << std::endl; } -// OLD for (int i=0; i<2048; i++) { std::cout << "PIXEL Temperature : " << i << " " << m_siliconTool->temperature(IdentifierHash(i)) << std::endl; } - - // Check deadmap - for (int i=0; i<2048; i++) { std::cout << "PIXEL Deadmap : " << i << " " << deadmap->getModuleStatus(i) << std::endl; } -// OLD for (int i=0; i<2048; i++) { std::cout << "PIXEL Deadmap : " << i << " " << deadmap->getModuleStatus(IdentifierHash(i)) << std::endl; } - - for (int i=0; i<2048; i++) { std::cout << "PIXEL LorentzAngle : " << i << " " << m_lorentzAngleTool->getLorentzShift(IdentifierHash(i)) << std::endl; } + SG::ReadCondHandle<PixelChargeCalibCondData> calib(m_chargeDataKey); + + for (int i=0; i<2048; i++) { + ATH_MSG_DEBUG("PIXEL Module hash=" << i + << " HV=" << hv->getBiasVoltage(i) + << " Temperature=" << temp->getTemperature(i) + << " Status=" << deadmap->getModuleStatus(i) + << " LorentzShift=" << m_lorentzAngleTool->getLorentzShift(IdentifierHash(i))); + ATH_MSG_DEBUG("Charge:"); + for (int j=0; j<16; j++) { + ATH_MSG_DEBUG(" FE=" << j + << " Threshold=" << calib->getAnalogThreshold(i,j,0) + << " Parameter A=" << calib->getQ2TotA(i,j,0) + << " Parameter E=" << calib->getQ2TotE(i,j,0) + << " Parameter C=" << calib->getQ2TotC(i,j,0)); + } + } return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h index 2d53262b3743c37ef377ae2ec96efffdd3c392e1..4b1ca945edb4788829bd5ce3a8abb1dd939dcc18 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelSiliconConditionsTestAlg.h @@ -10,11 +10,10 @@ #include "GaudiKernel/ToolHandle.h" #include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "StoreGate/ReadCondHandleKey.h" #include "InDetCondTools/ISiLorentzAngleTool.h" -// OLD #include "PixelConditionsTools/IPixelDCSConditionsTool.h" - class PixelSiliconConditionsTestAlg : public AthAlgorithm { public: PixelSiliconConditionsTestAlg(const std::string &name,ISvcLocator *pSvcLocator) ; @@ -25,11 +24,21 @@ class PixelSiliconConditionsTestAlg : public AthAlgorithm { virtual StatusCode finalize() override; private: -// OLD ToolHandle<IPixelDCSConditionsTool> m_siliconTool{this, "PixelDCSConditionsTool", "PixelDCSConditionsTool", "Tool to retrieve Pixel information"}; - SG::ReadCondHandleKey<PixelModuleData> m_readKeyTemp{this, "ReadKeyeTemp", "PixelDCSTempCondData", "Key of input sensor temperature conditions folder"}; - SG::ReadCondHandleKey<PixelModuleData> m_readKeyHV {this, "ReadKeyHV", "PixelDCSHVCondData", "Key of input bias voltage conditions folder"}; - SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey{this, "PixelModuleData", "PixelModuleData", "Output key"}; - ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{this, "LorentzAngleTool", "PixelLorentzAngleTool", "Tool to retreive Lorentz angle"}; + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Output key"}; + + SG::ReadCondHandleKey<PixelModuleData> m_readKeyTemp + {this, "ReadKeyeTemp", "PixelDCSTempCondData", "Key of input sensor temperature conditions folder"}; + + SG::ReadCondHandleKey<PixelModuleData> m_readKeyHV + {this, "ReadKeyHV", "PixelDCSHVCondData", "Key of input bias voltage conditions folder"}; + + ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool + {this, "LorentzAngleTool", "PixelLorentzAngleTool", "Tool to retreive Lorentz angle"}; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Output key"}; + }; #endif diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx index 1cd3338be77174ac62935b31d9290823df1d8d47..a47d6ed87022d6fe7d5541fd73e2bfa7f2386794 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/components/PixelConditionsAlgorithms_entries.cxx @@ -2,6 +2,7 @@ #include "../PixelDCSCondTempAlg.h" #include "../PixelDCSCondStateAlg.h" #include "../PixelConfigCondAlg.h" +#include "../PixelChargeCalibCondAlg.h" #include "../PixelTDAQCondAlg.h" #include "../PixelSiliconConditionsTestAlg.h" #include "../SpecialPixelMapCondAlg.h" @@ -11,6 +12,7 @@ DECLARE_COMPONENT( PixelDCSCondHVAlg ) DECLARE_COMPONENT( PixelDCSCondTempAlg ) DECLARE_COMPONENT( PixelDCSCondStateAlg ) DECLARE_COMPONENT( PixelConfigCondAlg ) +DECLARE_COMPONENT( PixelChargeCalibCondAlg ) DECLARE_COMPONENT( PixelTDAQCondAlg ) DECLARE_COMPONENT( PixelSiliconConditionsTestAlg ) DECLARE_COMPONENT( SpecialPixelMapCondAlg ) diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeCalibCondData.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeCalibCondData.h new file mode 100644 index 0000000000000000000000000000000000000000..927f3e582d4c3abc686bbe96a97991f42942c8c9 --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelChargeCalibCondData.h @@ -0,0 +1,104 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELCHARGECALIBCONDDATA_H +#define PIXELCHARGECALIBCONDDATA_H + +#include "AthenaKernel/CLASS_DEF.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" +#include <map> + +class PixelChargeCalibCondData { + public: + PixelChargeCalibCondData(); + virtual ~PixelChargeCalibCondData(); + + enum PixelType{NORMAL,LONG,GANGED}; + + // Normal pixel + void setAnalogThreshold(const int chanNum, const int value); + void setAnalogThresholdSigma(const int chanNum, const int value); + void setAnalogThresholdNoise(const int chanNum, const int value); + void setInTimeThreshold(const int chanNum, const int value); + + void setQ2TotA(const int chanNum, const float value); + void setQ2TotE(const int chanNum, const float value); + void setQ2TotC(const int chanNum, const float value); + + void setTotRes1(const int chanNum, const float value); + void setTotRes2(const int chanNum, const float value); + + int getAnalogThreshold(const int chanNum, const int FE, const int type) const; + int getAnalogThresholdSigma(const int chanNum, const int FE, const int type) const; + int getAnalogThresholdNoise(const int chanNum, const int FE, const int type) const; + int getInTimeThreshold(const int chanNum, const int FE, const int type) const; + + float getQ2TotA(const int chanNum, const int FE, const int type) const; + float getQ2TotE(const int chanNum, const int FE, const int type) const; + float getQ2TotC(const int chanNum, const int FE, const int type) const; + + float getTotRes(const int chanNum, const int FE, float Q) const; + + // Long pixel + void setAnalogThresholdLong(const int chanNum, const int value); + void setAnalogThresholdSigmaLong(const int chanNum, const int value); + void setAnalogThresholdNoiseLong(const int chanNum, const int value); + void setInTimeThresholdLong(const int chanNum, const int value); + + void setQ2TotALong(const int chanNum, const float value); + void setQ2TotELong(const int chanNum, const float value); + void setQ2TotCLong(const int chanNum, const float value); + + // Ganged pixel + void setAnalogThresholdGanged(const int chanNum, const int value); + void setAnalogThresholdSigmaGanged(const int chanNum, const int value); + void setAnalogThresholdNoiseGanged(const int chanNum, const int value); + void setInTimeThresholdGanged(const int chanNum, const int value); + + float getToT(const int chanNum, const int FE, const int type, float Q) const; + float getCharge(const int chanNum, const int FE, const int type, float ToT) const; + + void clear(); + + private: + typedef std::map<int, std::vector<int>> chipThreshold; + typedef std::map<int, std::vector<float>> chipCharge; + + // Normal pixel + chipThreshold m_analogThreshold; + chipThreshold m_analogThresholdSigma; + chipThreshold m_analogThresholdNoise; + chipThreshold m_intimethreshold; + + chipCharge m_totA; + chipCharge m_totE; + chipCharge m_totC; + + chipCharge m_totRes1; + chipCharge m_totRes2; + + // Long pixel + chipThreshold m_analogThresholdLong; + chipThreshold m_analogThresholdSigmaLong; + chipThreshold m_analogThresholdNoiseLong; + chipThreshold m_intimethresholdLong; + + chipCharge m_totALong; + chipCharge m_totELong; + chipCharge m_totCLong; + + // Ganged pixel + chipThreshold m_analogThresholdGanged; + chipThreshold m_analogThresholdSigmaGanged; + chipThreshold m_analogThresholdNoiseGanged; + chipThreshold m_intimethresholdGanged; + +}; + +CLASS_DEF( PixelChargeCalibCondData , 345532779 , 1 ) + +#include "AthenaKernel/CondCont.h" +CONDCONT_DEF( PixelChargeCalibCondData, 578786399 ); + +#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h index 1ace713919d3a82e4f01fa144b4016792333d8f9..baa3470c6e2b3e6d8110bb0de0517d39dd8df25e 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h @@ -28,21 +28,66 @@ class PixelModuleData { enum DCSModuleStatus{OK,WARNING,ERROR,FATAL,NOSTATUS}; enum DCSModuleState{READY,ON,UNKNOWN,TRANSITION,UNDEFINED,NOSTATE}; - void setBarrelAnalogThreshold(std::vector<int> BarrelAnalogThreshold); - void setEndcapAnalogThreshold(std::vector<int> EndcapAnalogThreshold); - void setDBMAnalogThreshold(std::vector<int> DBMAnalogThreshold); - int getAnalogThreshold(int bec, int layer) const; + // set via job option + void setBunchSpace(double bunchSpace); + double getBunchSpace() const; + + void setUseComTime(bool UseComTime); + bool getUseComTime() const; + + void setComTime(double ComTime); + double getComTime() const; + + void setBarrelNumberOfBCID(std::vector<int> BarrelNumberOfBCID); + void setEndcapNumberOfBCID(std::vector<int> EndcapNumberOfBCID); + void setDBMNumberOfBCID(std::vector<int> DBMNumberOfBCID); + int getNumberOfBCID(int bec, int layer) const; + + void setBarrelTimeOffset(std::vector<double> BarrelTimeOffset); + void setEndcapTimeOffset(std::vector<double> EndcapTimeOffset); + void setDBMTimeOffset(std::vector<double> DBMTimeOffset); + double getTimeOffset(int bec, int layer) const; + + void setBarrelTimeJitter(std::vector<double> BarrelTimeJitter); + void setEndcapTimeJitter(std::vector<double> EndcapTimeJitter); + void setDBMTimeJitter(std::vector<double> DBMTimeJitter); + double getTimeJitter(int bec, int layer) const; + + void setUseCalibConditions(bool UseCalibConditions); + bool getUseCalibConditions() const; + + void setDefaultBarrelAnalogThreshold(std::vector<int> BarrelAnalogThreshold); + void setDefaultEndcapAnalogThreshold(std::vector<int> EndcapAnalogThreshold); + void setDefaultDBMAnalogThreshold(std::vector<int> DBMAnalogThreshold); + int getDefaultAnalogThreshold(int bec, int layer) const; + + void setDefaultBarrelAnalogThresholdSigma(std::vector<int> BarrelAnalogThresholdSigma); + void setDefaultEndcapAnalogThresholdSigma(std::vector<int> EndcapAnalogThresholdSigma); + void setDefaultDBMAnalogThresholdSigma(std::vector<int> DBMAnalogThresholdSigma); + int getDefaultAnalogThresholdSigma(int bec, int layer) const; + + void setDefaultBarrelAnalogThresholdNoise(std::vector<int> BarrelAnalogThresholdNoise); + void setDefaultEndcapAnalogThresholdNoise(std::vector<int> EndcapAnalogThresholdNoise); + void setDefaultDBMAnalogThresholdNoise(std::vector<int> DBMAnalogThresholdNoise); + int getDefaultAnalogThresholdNoise(int bec, int layer) const; + + void setDefaultBarrelInTimeThreshold(std::vector<int> BarrelInTimeThreshold); + void setDefaultEndcapInTimeThreshold(std::vector<int> EndcapInTimeThreshold); + void setDefaultDBMInTimeThreshold(std::vector<int> DBMInTimeThreshold); + int getDefaultInTimeThreshold(int bec, int layer) const; + + void setDefaultQ2TotA(float paramA); + void setDefaultQ2TotE(float paramE); + void setDefaultQ2TotC(float paramC); + float getDefaultQ2TotA() const; + float getDefaultQ2TotE() const; + float getDefaultQ2TotC() const; void setBarrelToTThreshold(std::vector<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); @@ -53,19 +98,41 @@ class PixelModuleData { 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 setBarrelNoiseOccupancy(std::vector<double> BarrelNoiseOccupancy); + void setEndcapNoiseOccupancy(std::vector<double> EndcapNoiseOccupancy); + void setDBMNoiseOccupancy(std::vector<double> DBMNoiseOccupancy); + double getNoiseOccupancy(int bec, int layer) const; + + void setBarrelDisableProbability(std::vector<double> BarrelDisableProbability); + void setEndcapDisableProbability(std::vector<double> EndcapDisableProbability); + void setDBMDisableProbability(std::vector<double> DBMDisableProbability); + double getDisableProbability(int bec, int layer) const; + + void setBarrelNoiseShape(const int layer, const float BarrelNoiseShape); + void setEndcapNoiseShape(const int layer, const float EndcapNoiseShape); + void setDBMNoiseShape(const int layer, const float DBMNoiseShape); + std::vector<float> getNoiseShape(const int bec, const int layer) const; + + void setFEI3BarrelLatency(std::vector<int> FEI3BarrelLatency); + void setFEI3EndcapLatency(std::vector<int> FEI3EndcapLatency); + int getFEI3Latency(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 setFEI3BarrelHitDuplication(std::vector<bool> FEI3BarrelHitDuplication); + void setFEI3EndcapHitDuplication(std::vector<bool> FEI3EndcapHitDuplication); + bool getFEI3HitDuplication(int bec, int layer) const; - void setIBLHitDiscConfig(const int hitDiscConfig); - int getIBLHitDiscConfig() const; - int getIBLOverflowToT() const; + void setFEI3BarrelSmallHitToT(std::vector<int> FEI3BarrelSmallHitToT); + void setFEI3EndcapSmallHitToT(std::vector<int> FEI3EndcapSmallHitToT); + int getFEI3SmallHitToT(int bec, int layer) const; + + void setFEI3BarrelTimingSimTune(std::vector<int> FEI3BarrelTimingSimTune); + void setFEI3EndcapTimingSimTune(std::vector<int> FEI3EndcapTimingSimTune); + int getFEI3TimingSimTune(int bec, int layer) const; + + void setFEI4BarrelHitDiscConfig(std::vector<int> FEI4BarrelHitDiscConfig); + void setFEI4EndcapHitDiscConfig(std::vector<int> FEI4EndcapHitDiscConfig); + int getFEI4HitDiscConfig(int bec, int layer) const; + int getFEI4OverflowToT(int bec, int layer) const; void clear(); @@ -77,28 +144,71 @@ class PixelModuleData { IntConditions m_moduleStatus; IntConditions m_chipStatus; - std::vector<int> m_BarrelAnalogThreshold; - std::vector<int> m_EndcapAnalogThreshold; - std::vector<int> m_DBMAnalogThreshold; + typedef std::map<int, std::vector<float>> chipCharge; + + double m_bunchSpace; + bool m_UseComTime; + double m_ComTime; + + std::vector<int> m_BarrelNumberOfBCID; + std::vector<int> m_EndcapNumberOfBCID; + std::vector<int> m_DBMNumberOfBCID; + std::vector<double> m_BarrelTimeOffset; + std::vector<double> m_EndcapTimeOffset; + std::vector<double> m_DBMTimeOffset; + std::vector<double> m_BarrelTimeJitter; + std::vector<double> m_EndcapTimeJitter; + std::vector<double> m_DBMTimeJitter; + + bool m_useCalibConditions; + + std::vector<int> m_defaultBarrelAnalogThreshold; + std::vector<int> m_defaultEndcapAnalogThreshold; + std::vector<int> m_defaultDBMAnalogThreshold; + std::vector<int> m_defaultBarrelAnalogThresholdSigma; + std::vector<int> m_defaultEndcapAnalogThresholdSigma; + std::vector<int> m_defaultDBMAnalogThresholdSigma; + std::vector<int> m_defaultBarrelAnalogThresholdNoise; + std::vector<int> m_defaultEndcapAnalogThresholdNoise; + std::vector<int> m_defaultDBMAnalogThresholdNoise; + std::vector<int> m_defaultBarrelInTimeThreshold; + std::vector<int> m_defaultEndcapInTimeThreshold; + std::vector<int> m_defaultDBMInTimeThreshold; + + float m_paramA; + float m_paramE; + float m_paramC; + 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; + std::vector<double> m_BarrelNoiseOccupancy; + std::vector<double> m_EndcapNoiseOccupancy; + std::vector<double> m_DBMNoiseOccupancy; + std::vector<double> m_BarrelDisableProbability; + std::vector<double> m_EndcapDisableProbability; + std::vector<double> m_DBMDisableProbability; + + chipCharge m_BarrelNoiseShape; + chipCharge m_EndcapNoiseShape; + chipCharge m_DBMNoiseShape; + + std::vector<int> m_FEI3BarrelLatency; + std::vector<int> m_FEI3EndcapLatency; + std::vector<bool> m_FEI3BarrelHitDuplication; + std::vector<bool> m_FEI3EndcapHitDuplication; + std::vector<int> m_FEI3BarrelSmallHitToT; + std::vector<int> m_FEI3EndcapSmallHitToT; + std::vector<int> m_FEI3BarrelTimingSimTune; + std::vector<int> m_FEI3EndcapTimingSimTune; + std::vector<int> m_FEI4BarrelHitDiscConfig; + std::vector<int> m_FEI4EndcapHitDiscConfig; }; diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeCalibCondData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeCalibCondData.cxx new file mode 100644 index 0000000000000000000000000000000000000000..32b734c3267568e207089b74ef01dfebba8aad3f --- /dev/null +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelChargeCalibCondData.cxx @@ -0,0 +1,366 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelConditionsData/PixelChargeCalibCondData.h" + +PixelChargeCalibCondData::PixelChargeCalibCondData(): + m_analogThreshold(), + m_analogThresholdSigma(), + m_analogThresholdNoise(), + m_intimethreshold(), + m_totA(), + m_totE(), + m_totC(), + m_totRes1(), + m_totRes2(), + m_analogThresholdLong(), + m_analogThresholdSigmaLong(), + m_analogThresholdNoiseLong(), + m_intimethresholdLong(), + m_totALong(), + m_totELong(), + m_totCLong(), + m_analogThresholdGanged(), + m_analogThresholdSigmaGanged(), + m_analogThresholdNoiseGanged(), + m_intimethresholdGanged() +{ +} + +PixelChargeCalibCondData::~PixelChargeCalibCondData() { } + +// Normal pixels +void PixelChargeCalibCondData::setAnalogThreshold(const int chanNum, const int value) { + m_analogThreshold[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdSigma(const int chanNum, const int value) { + m_analogThresholdSigma[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdNoise(const int chanNum, const int value) { + m_analogThresholdNoise[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setInTimeThreshold(const int chanNum, const int value) { + m_intimethreshold[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotA(const int chanNum, const float value) { + m_totA[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotE(const int chanNum, const float value) { + m_totE[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotC(const int chanNum, const float value) { + m_totC[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setTotRes1(const int chanNum, const float value) { + m_totRes1[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setTotRes2(const int chanNum, const float value) { + m_totRes2[chanNum].push_back(value); +} + +int PixelChargeCalibCondData::getAnalogThreshold(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL) { + auto itr = m_analogThreshold.find(chanNum); + if (itr!=m_analogThreshold.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::LONG) { + auto itr = m_analogThresholdLong.find(chanNum); + if (itr!=m_analogThresholdLong.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_analogThresholdGanged.find(chanNum); + if (itr!=m_analogThresholdGanged.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0; +} + +int PixelChargeCalibCondData::getAnalogThresholdSigma(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL) { + auto itr = m_analogThresholdSigma.find(chanNum); + if (itr!=m_analogThresholdSigma.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::LONG) { + auto itr = m_analogThresholdSigmaLong.find(chanNum); + if (itr!=m_analogThresholdSigmaLong.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_analogThresholdSigmaGanged.find(chanNum); + if (itr!=m_analogThresholdSigmaGanged.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0; +} + +int PixelChargeCalibCondData::getAnalogThresholdNoise(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL) { + auto itr = m_analogThresholdNoise.find(chanNum); + if (itr!=m_analogThresholdNoise.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::LONG) { + auto itr = m_analogThresholdNoiseLong.find(chanNum); + if (itr!=m_analogThresholdNoiseLong.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_analogThresholdNoiseGanged.find(chanNum); + if (itr!=m_analogThresholdNoiseGanged.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0; +} + +int PixelChargeCalibCondData::getInTimeThreshold(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL) { + auto itr = m_intimethreshold.find(chanNum); + if (itr!=m_intimethreshold.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::LONG) { + auto itr = m_intimethresholdLong.find(chanNum); + if (itr!=m_intimethresholdLong.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_intimethresholdGanged.find(chanNum); + if (itr!=m_intimethresholdGanged.end()) { + const std::vector<int> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0; +} + +float PixelChargeCalibCondData::getQ2TotA(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL || type==PixelType::LONG) { + auto itr = m_totA.find(chanNum); + if (itr!=m_totA.end()) { + const std::vector<float> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_totALong.find(chanNum); + if (itr!=m_totALong.end()) { + const std::vector<float> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0.0; +} + +float PixelChargeCalibCondData::getQ2TotE(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL || type==PixelType::LONG) { + auto itr = m_totE.find(chanNum); + if (itr!=m_totE.end()) { + const std::vector<float> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_totELong.find(chanNum); + if (itr!=m_totELong.end()) { + const std::vector<float> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0.0; +} + +float PixelChargeCalibCondData::getQ2TotC(const int chanNum, const int FE, const int type) const { + if (type==PixelType::NORMAL || type==PixelType::LONG) { + auto itr = m_totC.find(chanNum); + if (itr!=m_totC.end()) { + const std::vector<float> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + else if (type==PixelType::GANGED) { + auto itr = m_totCLong.find(chanNum); + if (itr!=m_totCLong.end()) { + const std::vector<float> chip = itr->second; + if (FE<(int)chip.size()) { + return chip.at(FE); + } + } + } + return 0.0; +} + +float PixelChargeCalibCondData::getTotRes(const int chanNum, const int FE, float Q) const { + float res1 = 0.0; + auto itr1 = m_totRes1.find(chanNum); + if (itr1!=m_totRes1.end()) { + const std::vector<float> chip = itr1->second; + if (FE<(int)chip.size()) { + res1 = chip.at(FE); + } + } + float res2 = 0.0; + auto itr2 = m_totRes2.find(chanNum); + if (itr2!=m_totRes2.end()) { + const std::vector<float> chip = itr2->second; + if (FE<(int)chip.size()) { + res2 = chip.at(FE); + } + } + return res1+res2*Q; +} + +// Long pixel +void PixelChargeCalibCondData::setAnalogThresholdLong(const int chanNum, const int value) { + m_analogThresholdLong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdSigmaLong(const int chanNum, const int value) { + m_analogThresholdSigmaLong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdNoiseLong(const int chanNum, const int value) { + m_analogThresholdNoiseLong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setInTimeThresholdLong(const int chanNum, const int value) { + m_intimethresholdLong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotALong(const int chanNum, const float value) { + m_totALong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotELong(const int chanNum, const float value) { + m_totELong[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setQ2TotCLong(const int chanNum, const float value) { + m_totCLong[chanNum].push_back(value); +} + +// Ganged pixel +void PixelChargeCalibCondData::setAnalogThresholdGanged(const int chanNum, const int value) { + m_analogThresholdGanged[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdSigmaGanged(const int chanNum, const int value) { + m_analogThresholdSigmaGanged[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setAnalogThresholdNoiseGanged(const int chanNum, const int value) { + m_analogThresholdNoiseGanged[chanNum].push_back(value); +} + +void PixelChargeCalibCondData::setInTimeThresholdGanged(const int chanNum, const int value) { + m_intimethresholdGanged[chanNum].push_back(value); +} + +float PixelChargeCalibCondData::getToT(const int chanNum, const int FE, const int type, float Q) const { + float paramA = getQ2TotA(chanNum,FE,type); + float paramE = getQ2TotE(chanNum,FE,type); + float paramC = getQ2TotC(chanNum,FE,type); + return paramA*(paramE+Q)/(paramC+Q); +} + +float PixelChargeCalibCondData::getCharge(const int chanNum, const int FE, const int type, float ToT) const { + float paramA = getQ2TotA(chanNum,FE,type); + float paramE = getQ2TotE(chanNum,FE,type); + float paramC = getQ2TotC(chanNum,FE,type); + float charge = 0.0; + if (std::fabs(paramA)>0.0 && std::fabs(ToT/paramA-1.0)>0.0) { + charge = (paramC*ToT/paramA-paramE)/(1.0-ToT/paramA); + } + return charge; +} + +void PixelChargeCalibCondData::clear() { + m_analogThreshold.clear(); + m_analogThresholdSigma.clear(); + m_analogThresholdNoise.clear(); + m_intimethreshold.clear(); + m_totA.clear(); + m_totE.clear(); + m_totC.clear(); + m_totRes1.clear(); + m_totRes2.clear(); + m_analogThresholdLong.clear(); + m_analogThresholdSigmaLong.clear(); + m_analogThresholdNoiseLong.clear(); + m_intimethresholdLong.clear(); + m_totALong.clear(); + m_totELong.clear(); + m_totCLong.clear(); + m_analogThresholdGanged.clear(); + m_analogThresholdSigmaGanged.clear(); + m_analogThresholdNoiseGanged.clear(); + m_intimethresholdGanged.clear(); +} + diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx index 57d8e7a77e2e5f0b724262fcf25f772681aadf21..b542c7aac5b5fdc501d7b2d568d0c00e368df458 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx @@ -56,18 +56,107 @@ int PixelModuleData::getChipStatus(const int chanNum) const { return 0; } -void PixelModuleData::setBarrelAnalogThreshold(std::vector<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; } +// set via job option +void PixelModuleData::setBunchSpace(double bunchSpace) { m_bunchSpace = bunchSpace; } +double PixelModuleData::getBunchSpace() const { return m_bunchSpace; } -int PixelModuleData::getAnalogThreshold(int bec, int layer) const { +void PixelModuleData::setUseComTime(bool UseComTime) { m_UseComTime = UseComTime; } +bool PixelModuleData::getUseComTime() const { return m_UseComTime; } + +void PixelModuleData::setComTime(double ComTime) { m_ComTime = ComTime; } +double PixelModuleData::getComTime() const { return m_ComTime; } + +void PixelModuleData::setBarrelNumberOfBCID(std::vector<int> BarrelNumberOfBCID) { m_BarrelNumberOfBCID = BarrelNumberOfBCID; } +void PixelModuleData::setEndcapNumberOfBCID(std::vector<int> EndcapNumberOfBCID) { m_EndcapNumberOfBCID = EndcapNumberOfBCID; } +void PixelModuleData::setDBMNumberOfBCID(std::vector<int> DBMNumberOfBCID) { m_DBMNumberOfBCID = DBMNumberOfBCID; } +int PixelModuleData::getNumberOfBCID(int bec, int layer) const { + int nBCID = 1; + if (std::abs(bec)==0 && layer<(int)m_BarrelNumberOfBCID.size()) { nBCID=m_BarrelNumberOfBCID.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapNumberOfBCID.size()) { nBCID=m_EndcapNumberOfBCID.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMNumberOfBCID.size()) { nBCID=m_DBMNumberOfBCID.at(layer); } + return nBCID; +} + +void PixelModuleData::setBarrelTimeOffset(std::vector<double> BarrelTimeOffset) { m_BarrelTimeOffset = BarrelTimeOffset; } +void PixelModuleData::setEndcapTimeOffset(std::vector<double> EndcapTimeOffset) { m_EndcapTimeOffset = EndcapTimeOffset; } +void PixelModuleData::setDBMTimeOffset(std::vector<double> DBMTimeOffset) { m_DBMTimeOffset = DBMTimeOffset; } +double PixelModuleData::getTimeOffset(int bec, int layer) const { + double timeOffset = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelTimeOffset.size()) { timeOffset=m_BarrelTimeOffset.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapTimeOffset.size()) { timeOffset=m_EndcapTimeOffset.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMTimeOffset.size()) { timeOffset=m_DBMTimeOffset.at(layer); } + return timeOffset; +} + +void PixelModuleData::setBarrelTimeJitter(std::vector<double> BarrelTimeJitter) { m_BarrelTimeJitter = BarrelTimeJitter; } +void PixelModuleData::setEndcapTimeJitter(std::vector<double> EndcapTimeJitter) { m_EndcapTimeJitter = EndcapTimeJitter; } +void PixelModuleData::setDBMTimeJitter(std::vector<double> DBMTimeJitter) { m_DBMTimeJitter = DBMTimeJitter; } +double PixelModuleData::getTimeJitter(int bec, int layer) const { + double timeJitter = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelTimeJitter.size()) { timeJitter=m_BarrelTimeJitter.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapTimeJitter.size()) { timeJitter=m_EndcapTimeJitter.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMTimeJitter.size()) { timeJitter=m_DBMTimeJitter.at(layer); } + return timeJitter; +} + +void PixelModuleData::setUseCalibConditions(bool UseCalibConditions) { m_useCalibConditions = UseCalibConditions; } +bool PixelModuleData::getUseCalibConditions() const { return m_useCalibConditions; } + +void PixelModuleData::setDefaultBarrelAnalogThreshold(std::vector<int> BarrelAnalogThreshold) { m_defaultBarrelAnalogThreshold = BarrelAnalogThreshold; } +void PixelModuleData::setDefaultEndcapAnalogThreshold(std::vector<int> EndcapAnalogThreshold) { m_defaultEndcapAnalogThreshold = EndcapAnalogThreshold; } +void PixelModuleData::setDefaultDBMAnalogThreshold(std::vector<int> DBMAnalogThreshold) { m_defaultDBMAnalogThreshold = DBMAnalogThreshold; } + +int PixelModuleData::getDefaultAnalogThreshold(int bec, int layer) const { int analogThreshold = -1; - if (std::abs(bec)==0 && layer<(int)m_BarrelAnalogThreshold.size()) { analogThreshold=m_BarrelAnalogThreshold.at(layer); } - if (std::abs(bec)==2 && layer<(int)m_EndcapAnalogThreshold.size()) { analogThreshold=m_EndcapAnalogThreshold.at(layer); } - if (std::abs(bec)==4 && layer<(int)m_DBMAnalogThreshold.size()) { analogThreshold=m_DBMAnalogThreshold.at(layer); } + if (std::abs(bec)==0 && layer<(int)m_defaultBarrelAnalogThreshold.size()) { analogThreshold=m_defaultBarrelAnalogThreshold.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_defaultEndcapAnalogThreshold.size()) { analogThreshold=m_defaultEndcapAnalogThreshold.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_defaultDBMAnalogThreshold.size()) { analogThreshold=m_defaultDBMAnalogThreshold.at(layer); } return analogThreshold; } +void PixelModuleData::setDefaultBarrelAnalogThresholdSigma(std::vector<int> BarrelAnalogThresholdSigma) { m_defaultBarrelAnalogThresholdSigma = BarrelAnalogThresholdSigma; } +void PixelModuleData::setDefaultEndcapAnalogThresholdSigma(std::vector<int> EndcapAnalogThresholdSigma) { m_defaultEndcapAnalogThresholdSigma = EndcapAnalogThresholdSigma; } +void PixelModuleData::setDefaultDBMAnalogThresholdSigma(std::vector<int> DBMAnalogThresholdSigma) { m_defaultDBMAnalogThresholdSigma = DBMAnalogThresholdSigma; } + +int PixelModuleData::getDefaultAnalogThresholdSigma(int bec, int layer) const { + int analogThresholdSigma = -1; + if (std::abs(bec)==0 && layer<(int)m_defaultBarrelAnalogThresholdSigma.size()) { analogThresholdSigma=m_defaultBarrelAnalogThresholdSigma.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_defaultEndcapAnalogThresholdSigma.size()) { analogThresholdSigma=m_defaultEndcapAnalogThresholdSigma.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_defaultDBMAnalogThresholdSigma.size()) { analogThresholdSigma=m_defaultDBMAnalogThresholdSigma.at(layer); } + return analogThresholdSigma; +} + +void PixelModuleData::setDefaultBarrelAnalogThresholdNoise(std::vector<int> BarrelAnalogThresholdNoise) { m_defaultBarrelAnalogThresholdNoise = BarrelAnalogThresholdNoise; } +void PixelModuleData::setDefaultEndcapAnalogThresholdNoise(std::vector<int> EndcapAnalogThresholdNoise) { m_defaultEndcapAnalogThresholdNoise = EndcapAnalogThresholdNoise; } +void PixelModuleData::setDefaultDBMAnalogThresholdNoise(std::vector<int> DBMAnalogThresholdNoise) { m_defaultDBMAnalogThresholdNoise = DBMAnalogThresholdNoise; } + +int PixelModuleData::getDefaultAnalogThresholdNoise(int bec, int layer) const { + int analogThresholdNoise = -1; + if (std::abs(bec)==0 && layer<(int)m_defaultBarrelAnalogThresholdNoise.size()) { analogThresholdNoise=m_defaultBarrelAnalogThresholdNoise.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_defaultEndcapAnalogThresholdNoise.size()) { analogThresholdNoise=m_defaultEndcapAnalogThresholdNoise.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_defaultDBMAnalogThresholdNoise.size()) { analogThresholdNoise=m_defaultDBMAnalogThresholdNoise.at(layer); } + return analogThresholdNoise; +} + +void PixelModuleData::setDefaultBarrelInTimeThreshold(std::vector<int> BarrelInTimeThreshold) { m_defaultBarrelInTimeThreshold = BarrelInTimeThreshold; } +void PixelModuleData::setDefaultEndcapInTimeThreshold(std::vector<int> EndcapInTimeThreshold) { m_defaultEndcapInTimeThreshold = EndcapInTimeThreshold; } +void PixelModuleData::setDefaultDBMInTimeThreshold(std::vector<int> DBMInTimeThreshold) { m_defaultDBMInTimeThreshold = DBMInTimeThreshold; } + +int PixelModuleData::getDefaultInTimeThreshold(int bec, int layer) const { + int analogInTimeThreshold = -1; + if (std::abs(bec)==0 && layer<(int)m_defaultBarrelInTimeThreshold.size()) { analogInTimeThreshold=m_defaultBarrelInTimeThreshold.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_defaultEndcapInTimeThreshold.size()) { analogInTimeThreshold=m_defaultEndcapInTimeThreshold.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_defaultDBMInTimeThreshold.size()) { analogInTimeThreshold=m_defaultDBMInTimeThreshold.at(layer); } + return analogInTimeThreshold; +} + +void PixelModuleData::setDefaultQ2TotA(float paramA) { m_paramA=paramA; } +void PixelModuleData::setDefaultQ2TotE(float paramE) { m_paramE=paramE; } +void PixelModuleData::setDefaultQ2TotC(float paramC) { m_paramC=paramC; } +float PixelModuleData::getDefaultQ2TotA() const { return m_paramA; } +float PixelModuleData::getDefaultQ2TotE() const { return m_paramE; } +float PixelModuleData::getDefaultQ2TotC() const { return m_paramC; } + void PixelModuleData::setBarrelToTThreshold(std::vector<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; } @@ -80,18 +169,6 @@ int PixelModuleData::getToTThreshold(int bec, int layer) const { 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; } @@ -106,7 +183,7 @@ double PixelModuleData::getCrossTalk(int bec, int layer) const { 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; } +void PixelModuleData::setDBMThermalNoise(std::vector<double> DBMThermalNoise) { m_DBMThermalNoise = DBMThermalNoise; } double PixelModuleData::getThermalNoise(int bec, int layer) const { double noise = -1.0; @@ -116,36 +193,109 @@ double PixelModuleData::getThermalNoise(int bec, int layer) const { return noise; } -void PixelModuleData::setBarrelHitDuplication(std::vector<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; } +void PixelModuleData::setBarrelNoiseOccupancy(std::vector<double> BarrelNoiseOccupancy) { m_BarrelNoiseOccupancy = BarrelNoiseOccupancy; } +void PixelModuleData::setEndcapNoiseOccupancy(std::vector<double> EndcapNoiseOccupancy) { m_EndcapNoiseOccupancy = EndcapNoiseOccupancy; } +void PixelModuleData::setDBMNoiseOccupancy(std::vector<double> DBMNoiseOccupancy) { m_DBMNoiseOccupancy = DBMNoiseOccupancy; } +double PixelModuleData::getNoiseOccupancy(int bec, int layer) const { + double noiseOccupancy = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelNoiseOccupancy.size()) { noiseOccupancy=m_BarrelNoiseOccupancy.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapNoiseOccupancy.size()) { noiseOccupancy=m_EndcapNoiseOccupancy.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMNoiseOccupancy.size()) { noiseOccupancy=m_DBMNoiseOccupancy.at(layer); } + return noiseOccupancy; +} + +void PixelModuleData::setBarrelDisableProbability(std::vector<double> BarrelDisableProbability) { m_BarrelDisableProbability= BarrelDisableProbability; } +void PixelModuleData::setEndcapDisableProbability(std::vector<double> EndcapDisableProbability) { m_EndcapDisableProbability= EndcapDisableProbability; } +void PixelModuleData::setDBMDisableProbability(std::vector<double> DBMDisableProbability) { m_DBMDisableProbability = DBMDisableProbability; } +double PixelModuleData::getDisableProbability(int bec, int layer) const { + double disableProb = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelDisableProbability.size()) { disableProb=m_BarrelDisableProbability.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapDisableProbability.size()) { disableProb=m_EndcapDisableProbability.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMDisableProbability.size()) { disableProb=m_DBMDisableProbability.at(layer); } + return disableProb; +} + +void PixelModuleData::setBarrelNoiseShape(const int layer, const float BarrelNoiseShape) { + m_BarrelNoiseShape[layer].push_back(BarrelNoiseShape); +} + +void PixelModuleData::setEndcapNoiseShape(const int layer, const float EndcapNoiseShape) { + m_EndcapNoiseShape[layer].push_back(EndcapNoiseShape); +} + +void PixelModuleData::setDBMNoiseShape(const int layer, const float DBMNoiseShape) { + m_DBMNoiseShape[layer].push_back(DBMNoiseShape); +} + +std::vector<float> PixelModuleData::getNoiseShape(const int bec, const int layer) const { + std::vector<float> chip; + if (bec==0) { + auto itr = m_BarrelNoiseShape.find(layer); + if (itr!=m_BarrelNoiseShape.end()) { chip = itr->second; } + } + else if (std::abs(bec)==2) { + auto itr = m_EndcapNoiseShape.find(layer); + if (itr!=m_EndcapNoiseShape.end()) { chip = itr->second; } + } + else if (std::abs(bec)==4) { + auto itr = m_DBMNoiseShape.find(layer); + if (itr!=m_DBMNoiseShape.end()) { chip = itr->second; } + } + return chip; +} + +void PixelModuleData::setFEI3BarrelLatency(std::vector<int> FEI3BarrelLatency) { m_FEI3BarrelLatency = FEI3BarrelLatency; } +void PixelModuleData::setFEI3EndcapLatency(std::vector<int> FEI3EndcapLatency) { m_FEI3EndcapLatency = FEI3EndcapLatency; } -bool PixelModuleData::getHitDuplication(int bec, int layer) const { +int PixelModuleData::getFEI3Latency(int bec, int layer) const { + int latency = -1; + if (std::abs(bec)==0 && layer<(int)m_FEI3BarrelLatency.size()) { latency=m_FEI3BarrelLatency.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI3EndcapLatency.size()) { latency=m_FEI3EndcapLatency.at(layer); } + return latency; +} + +void PixelModuleData::setFEI3BarrelHitDuplication(std::vector<bool> FEI3BarrelHitDuplication) { m_FEI3BarrelHitDuplication = FEI3BarrelHitDuplication; } +void PixelModuleData::setFEI3EndcapHitDuplication(std::vector<bool> FEI3EndcapHitDuplication) { m_FEI3EndcapHitDuplication = FEI3EndcapHitDuplication; } + +bool PixelModuleData::getFEI3HitDuplication(int bec, int layer) const { bool hitdupli = false; - if (std::abs(bec)==0 && layer<(int)m_BarrelHitDuplication.size()) { hitdupli=m_BarrelHitDuplication.at(layer); } - if (std::abs(bec)==2 && layer<(int)m_EndcapHitDuplication.size()) { hitdupli=m_EndcapHitDuplication.at(layer); } - if (std::abs(bec)==4 && layer<(int)m_DBMHitDuplication.size()) { hitdupli=m_DBMHitDuplication.at(layer); } + if (std::abs(bec)==0 && layer<(int)m_FEI3BarrelHitDuplication.size()) { hitdupli=m_FEI3BarrelHitDuplication.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI3EndcapHitDuplication.size()) { hitdupli=m_FEI3EndcapHitDuplication.at(layer); } return hitdupli; } -void PixelModuleData::setBarrelSmallHitToT(std::vector<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; } +void PixelModuleData::setFEI3BarrelSmallHitToT(std::vector<int> FEI3BarrelSmallHitToT) { m_FEI3BarrelSmallHitToT = FEI3BarrelSmallHitToT; } +void PixelModuleData::setFEI3EndcapSmallHitToT(std::vector<int> FEI3EndcapSmallHitToT) { m_FEI3EndcapSmallHitToT = FEI3EndcapSmallHitToT; } -int PixelModuleData::getSmallHitToT(int bec, int layer) const { +int PixelModuleData::getFEI3SmallHitToT(int bec, int layer) const { int smallToT = -1; - if (std::abs(bec)==0 && layer<(int)m_BarrelSmallHitToT.size()) { smallToT=m_BarrelSmallHitToT.at(layer); } - if (std::abs(bec)==2 && layer<(int)m_EndcapSmallHitToT.size()) { smallToT=m_EndcapSmallHitToT.at(layer); } - if (std::abs(bec)==4 && layer<(int)m_DBMSmallHitToT.size()) { smallToT=m_DBMSmallHitToT.at(layer); } + if (std::abs(bec)==0 && layer<(int)m_FEI3BarrelSmallHitToT.size()) { smallToT=m_FEI3BarrelSmallHitToT.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI3EndcapSmallHitToT.size()) { smallToT=m_FEI3EndcapSmallHitToT.at(layer); } return smallToT; } -void PixelModuleData::setIBLHitDiscConfig(const int hitDiscConfig) { m_hitDiscConfig = hitDiscConfig; } -int PixelModuleData::getIBLHitDiscConfig() const { return m_hitDiscConfig; } +void PixelModuleData::setFEI3BarrelTimingSimTune(std::vector<int> FEI3BarrelTimingSimTune) { m_FEI3BarrelTimingSimTune = FEI3BarrelTimingSimTune; } +void PixelModuleData::setFEI3EndcapTimingSimTune(std::vector<int> FEI3EndcapTimingSimTune) { m_FEI3EndcapTimingSimTune = FEI3EndcapTimingSimTune; } +int PixelModuleData::getFEI3TimingSimTune(int bec, int layer) const { + int timesim = 0; + if (std::abs(bec)==0 && layer<(int)m_FEI3BarrelTimingSimTune.size()) { timesim=m_FEI3BarrelTimingSimTune.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI3EndcapTimingSimTune.size()) { timesim=m_FEI3EndcapTimingSimTune.at(layer); } + return timesim; +} + +void PixelModuleData::setFEI4BarrelHitDiscConfig(std::vector<int> FEI4BarrelHitDiscConfig) { m_FEI4BarrelHitDiscConfig = FEI4BarrelHitDiscConfig; } +void PixelModuleData::setFEI4EndcapHitDiscConfig(std::vector<int> FEI4EndcapHitDiscConfig) { m_FEI4EndcapHitDiscConfig = FEI4EndcapHitDiscConfig; } +int PixelModuleData::getFEI4HitDiscConfig(int bec, int layer) const { + int hitDiscConfig = 2; + if (std::abs(bec)==0 && layer<(int)m_FEI4BarrelHitDiscConfig.size()) { hitDiscConfig=m_FEI4BarrelHitDiscConfig.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_FEI4EndcapHitDiscConfig.size()) { hitDiscConfig=m_FEI4EndcapHitDiscConfig.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_FEI4EndcapHitDiscConfig.size()) { hitDiscConfig=m_FEI4EndcapHitDiscConfig.at(layer); } + return hitDiscConfig; +} -int PixelModuleData::getIBLOverflowToT() const { +int PixelModuleData::getFEI4OverflowToT(int bec, int layer) const { static const int overflow[]={14,15,16,14,16}; - unsigned int idx=static_cast<unsigned int>(m_hitDiscConfig) < 4 ? m_hitDiscConfig : 4; + unsigned int idx=static_cast<unsigned int>(getFEI4HitDiscConfig(bec,layer)) < 4 ? getFEI4HitDiscConfig(bec,layer) : 4; return overflow[idx]; } diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelCalibSvc.h b/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelCalibSvc.h deleted file mode 100755 index 73c6850f23a29b7363da4c911a2e6b0ea9c4f8cc..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/PixelConditionsServices/IPixelCalibSvc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelCalibSvc.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef PIXELCALIBSVC_IPIXELCALIBSVC_H -#define PIXELCALIBSVC_IPIXELCALIBSVC_H - -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/IInterface.h" -#include "PixelConditionsData/PixelCalibDataColl.h" - -#include "Identifier/Identifier.h" - -static const InterfaceID IID_IPixelCalibSvc("IPixelCalibSvc",1,0); - -class IPixelCalibSvc : virtual public IInterface { - public: - virtual ~IPixelCalibSvc (){}; - static const InterfaceID & interfaceID(); - - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF)=0; - - virtual bool hasCalibData(const Identifier& wafer_id) const =0; //<! true for wafer_id contains the calibration data - - virtual int getThreshold(Identifier pix_id) const =0; - virtual int getThresholdSigma(Identifier pix_id) const =0; - virtual int getNoise(Identifier pix_id) const =0; - virtual int getTimeWalk(Identifier pix_id) const =0; - virtual float getQ2TotA(Identifier pix_id) const =0; - virtual float getQ2TotE(Identifier pix_id) const =0; - virtual float getQ2TotC(Identifier pix_id) const =0; - virtual float getTotRes(Identifier pix_id, float Q) const =0; - virtual float getTotMean(Identifier pix_id, float Q) const =0; - virtual float getCharge(Identifier pix_id, float ToT) const =0; - - virtual void disableDb() =0; -}; - -inline const InterfaceID& IPixelCalibSvc::interfaceID() { - return IID_IPixelCalibSvc; -} - -#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/share/PixelCalibSvc_jobOptions.py b/InnerDetector/InDetConditions/PixelConditionsServices/share/PixelCalibSvc_jobOptions.py deleted file mode 100755 index 522b94be44ca5cb926bf6974bb3f95ae1fc46fa9..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/share/PixelCalibSvc_jobOptions.py +++ /dev/null @@ -1,39 +0,0 @@ -include.block("PixelConditionsServices/PixelCalibSvc_jobOptions.py") -# load library -#theApp.Dlls += [ "PixelConditionsServices" ] - -#from AthenaCommon.AppMgr import ToolSvc - -# configure PixelCalibSvc -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc -ServiceMgr +=PixelCalibSvc() -PixelCalibSvc = ServiceMgr.PixelCalibSvc - -# configure PixelCalibDbTool -#from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool -#ToolSvc +=PixelCalibDbTool() - -#theApp.ExtSvc += [ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - -#theApp.Dlls += [ "PixelConditionsTools" ] -#theApp.Dlls +=["DetDescrCondTools","DetDescrCondExample"] -#if 'InDetCabling' not in theApp.Dlls: -# theApp.Dlls += [ "InDetCabling" ] - -# setup for ToolSvc -#ToolSvc = Service( "ToolSvc" ) -#ToolSvc.ConditionsAlgStream.OutputFile="dummy.root" -# this example is for a local SQlite file mysqlfile.db, COOL DB named COOLTEST -#IOVDbSvc.dbConnection="impl=cool;techno=oracle;ATLAS_COOLPROD:COMP130:ATLAS_COOL_READER:COOLRED4PRD" -#IOVDbSvc.Folders+=[CondDBCool.PIXEL + "/PIXEL/PixCalib" + "<tag>PixCalib-Assembly-01</tag>"] -#IOVDbSvc.GlobalTag ="PixCalib-Assembly-00" -#IOVDbSvc.OutputLevel = DEBUG -from IOVDbSvc.CondDB import conddb -conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") - -# setup PixelCalibDbTool in ToolSvc -#PixelCalibDbTool = Service("ToolSvc.PixelCalibDbTool") -#ToolSvc.PixelCalibDbTool.CalibFolder ="/PIXEL/PixCalib" -#ToolSvc.PixelCalibDbTool.CalibLocation ="PixCalibKey" -#ToolSvc.PixelCalibDbTool.WriteDB =False diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx deleted file mode 100755 index 223782d7ddfbdea4b47c05ad260ea85c391979af..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelCalibSvc.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#include "PixelCalibSvc.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" - -PixelCalibSvc::PixelCalibSvc(const std::string& name, ISvcLocator* sl):AthService(name, sl), - m_detStore("DetectorStore",name), - m_dbTool("PixelCalibDbTool"), - m_pixelCabling("PixelCablingSvc",name), - m_pixid(0), - m_wafer_id(0), - m_detManager(0), - m_totparA(70.2), - m_totparE(-3561.25), - m_totparC(26000), - m_totparP1(-0.68), - m_totparP2(0.17), - m_discrThresh(3500), - m_discrThreshSigma(300), - m_intimeThresh(5000), - m_noiseThresh(200), - m_disableDb(false) -{ - declareProperty("CalibrationDbTool",m_dbTool); - declareProperty("ToTParA", m_totparA, "TOT parameter A"); - declareProperty("ToTParE", m_totparE, "TOT parameter E"); - declareProperty("ToTParC", m_totparC, "TOT parameter C"); - declareProperty("ToTParP1", m_totparP1, "TOT smearing parameter p1"); - declareProperty("ToTParP2", m_totparP2, "TOT smearing parameter p2"); - declareProperty("DiscrThresh", m_discrThresh, "Discriminator threshold"); - declareProperty("DiscrThreshVar", m_discrThreshSigma, "Discriminator threshold sigma"); - declareProperty("IntimeThresh", m_intimeThresh, "Discriminator in-time threshold"); - declareProperty("NoiseThresh", m_noiseThresh, "Discriminator noise"); - declareProperty("DisableDB", m_disableDb, "Disable DB"); -} - -PixelCalibSvc::~PixelCalibSvc() {} - -StatusCode PixelCalibSvc::queryInterface(const InterfaceID& riid, void** ppvIF) { - if (IID_IPixelCalibSvc==riid) { - *ppvIF = dynamic_cast<IPixelCalibSvc*>(this); - } - else { - return AthService::queryInterface(riid,ppvIF); - } - addRef(); - return StatusCode::SUCCESS; -} - -StatusCode PixelCalibSvc::initialize() { - ATH_MSG_INFO("PixelCalibSvc::initialize()"); - - CHECK(m_detStore.retrieve()); - - CHECK(m_detStore->retrieve(m_detManager,"Pixel")); - - CHECK(m_detStore->retrieve(m_pixid,"PixelID")); - - CHECK(m_pixelCabling.retrieve()); - - if (!m_disableDb) { CHECK(m_dbTool.retrieve()); } - - return StatusCode::SUCCESS; -} - -StatusCode PixelCalibSvc::finalize() { - ATH_MSG_INFO("PixelCalibSvc::finalize()"); - return StatusCode::SUCCESS; -} - -bool PixelCalibSvc::hasCalibData(const Identifier& wafer_id) const { - if (m_disableDb) { return false; } - if (wafer_id!=m_wafer_id) { - m_wafer_id = wafer_id; - } - return true; -} - -int PixelCalibSvc::getThreshold(Identifier pix_id) const { - Identifier wafer_id = m_pixid->wafer_id(pix_id); - if (m_disableDb) { return m_discrThresh; } - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getThreshold(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_discrThresh; - } -} - -int PixelCalibSvc::getThresholdSigma(Identifier pix_id) const { - if (m_disableDb) { return m_discrThreshSigma; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getThresholdSigma(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_discrThreshSigma; - } -} - -int PixelCalibSvc::getNoise(Identifier pix_id) const { - if (m_disableDb) { return m_noiseThresh; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getNoise(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_noiseThresh; - } -} - -int PixelCalibSvc::getTimeWalk(Identifier pix_id) const { - Identifier wafer_id = m_pixid->wafer_id(pix_id); - if (m_disableDb) { return m_intimeThresh; } - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getTimeWalk(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_intimeThresh; - } -} - -float PixelCalibSvc::getQ2TotA(Identifier pix_id) const { - if (m_disableDb) { return m_totparA; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotA(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparA; - } -} - -float PixelCalibSvc::getQ2TotE(Identifier pix_id) const { - if (m_disableDb) { return m_totparE; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotE(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparE; - } -} - -float PixelCalibSvc::getQ2TotC(Identifier pix_id) const { - if (m_disableDb) { return m_totparE; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2TotC(type); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparC; - } -} - -float PixelCalibSvc::getTotRes(Identifier pix_id, float Q) const { - if (m_disableDb) { return m_totparP1+m_totparP2*Q; } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getTotRes(Q); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparP1+m_totparP2*Q; - } -} - -float PixelCalibSvc::getTotMean(Identifier pix_id, float Q) const { - if (m_disableDb) { return m_totparA*(m_totparE+Q)/(m_totparC+Q); } - Identifier wafer_id = m_pixid->wafer_id(pix_id); - int circ = m_pixelCabling->getFE(&pix_id,wafer_id); - int type = m_pixelCabling->getPixelType(pix_id); - if (m_dbTool->getCalibPtr(wafer_id) && circ>-1) { - return m_dbTool->getCalibPtr(wafer_id)->getPixelChipSummaryData(circ)->getQ2Tot(type,Q); - } - else { - ATH_MSG_WARNING("Condition DB is not available. Use hardcoded value."); - return m_totparA*(m_totparE+Q)/(m_totparC+Q); - } -} - -float PixelCalibSvc::getCharge(Identifier pix_id, float ToT) const { - Identifier wafer_id = m_pixid->wafer_id(pix_id); - const InDetDD::SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id); - const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design()); - float charge = 0.0; - if (m_pixid->is_dbm(wafer_id)) { - charge = ToT/8.0*(8000.0-1200.0)+1200.0; - } - else { - if (p_design->getReadoutTechnology()==InDetDD::PixelModuleDesign::FEI4) { - if (ToT>=m_pixelCabling->getIBLOverflowToT(&pix_id)) { ToT=m_pixelCabling->getIBLOverflowToT(&pix_id); } - } - float termA = getQ2TotA(pix_id); - float termE = getQ2TotE(pix_id); - float termC = getQ2TotC(pix_id); - if (fabs(termA)>0.0 && fabs(ToT/termA-1.0)>0.0) { - charge = (termC*ToT/termA-termE)/(1.0-ToT/termA); - } - } - return charge; -} - diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.h b/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.h deleted file mode 100755 index 57c3b941b26e90dd94e21dff84db0eb3e1ccd3fc..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/PixelCalibSvc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelCalibSvc.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef PIXELCALIBSVC_PIXELCALIBSVC_H -#define PIXELCALIBSVC_PIXELCALIBSVC_H - -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" -#include "PixelConditionsTools/IPixelCalibDbTool.h" -#include "PixelCabling/IPixelCablingSvc.h" -#include "InDetIdentifier/PixelID.h" - -namespace InDetDD { - class PixelDetectorManager; -} - -class PixelCalibSvc : public AthService, virtual public IPixelCalibSvc { - public: - PixelCalibSvc(const std::string& name, ISvcLocator* sl); - - virtual ~PixelCalibSvc (); - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF); - - virtual StatusCode initialize(); - virtual StatusCode finalize (); - - virtual bool hasCalibData(const Identifier& wafer_id) const; //<! true for wafer_id contains the calibration data - - virtual int getThreshold(Identifier pix_id) const; - virtual int getThresholdSigma(Identifier pix_id) const; - virtual int getNoise(Identifier pix_id) const; - virtual int getTimeWalk(Identifier pix_id) const; - virtual float getQ2TotA(Identifier pix_id) const; - virtual float getQ2TotE(Identifier pix_id) const; - virtual float getQ2TotC(Identifier pix_id) const; - virtual float getTotRes(Identifier pix_id, float Q) const; - virtual float getTotMean(Identifier pix_id, float Q) const; - virtual void disableDb() {m_disableDb = true;} - virtual float getCharge(Identifier pix_id, float ToT) const; - - private: - ServiceHandle<StoreGateSvc> m_detStore; - ToolHandle<IPixelCalibDbTool> m_dbTool; - ServiceHandle<IPixelCablingSvc> m_pixelCabling; - const PixelID* m_pixid; - mutable Identifier m_wafer_id; //<! wafer_id - - const InDetDD::PixelDetectorManager * m_detManager; - - double m_totparA; - double m_totparE; - double m_totparC; - double m_totparP1; /**< Correction for dispersion */ - double m_totparP2; - int m_discrThresh; /**< discriminator threshold value */ - int m_discrThreshSigma; /**< discriminator threshold sigma value */ - int m_intimeThresh; /**< intime threshold */ - int m_noiseThresh; /**< threshold noise*/ - bool m_disableDb; -}; - -#endif diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/src/components/PixelConditionsServices_entries.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/src/components/PixelConditionsServices_entries.cxx index fd34bcd9819b58b0b80fed0465747833db222ef4..f2d00d23ac666df86f225012c71d727acc2c3619 100644 --- a/InnerDetector/InDetConditions/PixelConditionsServices/src/components/PixelConditionsServices_entries.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsServices/src/components/PixelConditionsServices_entries.cxx @@ -1,6 +1,4 @@ -#include "../PixelCalibSvc.h" #include "../PixelByteStreamErrorsSvc.h" -DECLARE_COMPONENT( PixelCalibSvc ) DECLARE_COMPONENT( PixelByteStreamErrorsSvc ) diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.cxx b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.cxx deleted file mode 100755 index 853ed874e01a5e7ec1e5ed5963daf9f9f931b826..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.cxx +++ /dev/null @@ -1,385 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////// -// PixelCalibServiceTest.cxx -// Algorithm to create Pixel Calib objects and place them in Condition DB -// Author Weiming Yao <wmyao@lbl.gov> -///////////////////////////////////////////////////////////////////////// - -#include <fstream> -#include <iomanip> -#include <iostream> -#include <string> -#include "StoreGate/StoreGateSvc.h" -#include "Identifier/Identifier.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" - -#include "PixelConditionsData/PixelCalibDataColl.h" -#include "InDetIdentifier/PixelID.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" -#include "PixelCalibServiceTest.h" -#include "GaudiKernel/IToolSvc.h" - -static unsigned int rowsFGangedFEI3 =153; // first ganged pixel row for FEI3 -static unsigned int rowsFGangedFEI52 =661; // first ganged pixel row for FEI52 -static unsigned int rowsFGangedFEI51 =331; // first ganged pixel row for FEI51 - -static bool isIBL(false); -static bool isITK(false); - -PixelCalibServiceTest::PixelCalibServiceTest(const std::string& name, ISvcLocator* pSvcLocator) - :AthAlgorithm (name, pSvcLocator), - // m_log (msgSvc(), name), - // m_sgSvc (0), - //m_detStore (0), - m_calibsvc("PixelCalibSvc",name), - m_pixman(0), - m_pixid(0), - m_setup(0), - m_par_rfile(""), - m_dummy(false), - m_par_histf(0) -{ - - // declare algorithm parameters - declareProperty("OutputTextFile",m_par_rfile); - declareProperty("MakeDummy",m_dummy); - for(int i =0; i<14; ++i)m_myhf[i] =0; -} - - -PixelCalibServiceTest::~PixelCalibServiceTest(void) -{} - -StatusCode PixelCalibServiceTest::initialize() { - - msg(MSG::INFO) << "PixelCalibServiceTest::initialize() called" << endmsg; - - //get storegate pointers (not need for AthAlgorithm classes) - //if ((StatusCode::SUCCESS!=service("StoreGateSvc",m_sgSvc)) || - // (StatusCode::SUCCESS!=service("DetectorStore",m_detStore))) { - // msg(MSG::INFO) << "StoreGate services not found" << endmsg; - // return StatusCode::FAILURE; - // } - - // Get Pixel manager and ID helper - if (StatusCode::SUCCESS!= detStore()->retrieve(m_pixman,"Pixel") || - m_pixman==0) { - msg(MSG::FATAL) << "Could not find Pixel manager " << endmsg; - return StatusCode::FAILURE; - } - - if (StatusCode::SUCCESS!= detStore()->retrieve(m_pixid,"PixelID") ){ - ATH_MSG_FATAL( "Unable to retrieve pixel ID helper" ); - return StatusCode::FAILURE; - } - ATH_MSG_INFO( "Pixel manager and helper found "); - // check pixel geometry here: - - if(m_pixid->wafer_hash_max()>1744)isIBL = true; - if(m_pixid->wafer_hash_max()>3000)isITK = true; - - InDetDD::SiDetectorElementCollection::const_iterator iter, itermin, itermax; - itermin = m_pixman->getDetectorElementBegin(); - itermax = m_pixman->getDetectorElementEnd(); - int totpixmodule(0); - std::ofstream* outfile=0; - if(msgLvl(MSG::INFO)) msg() << " read PixelCalibData to text file: " - << m_par_rfile << endmsg; - outfile = new std::ofstream(m_par_rfile.c_str()); - - for( iter=itermin; iter !=itermax; ++iter){ - const InDetDD::SiDetectorElement* element = *iter; - if(element !=0){ - const Identifier ident = element->identify(); - if(m_pixid->is_pixel(ident)){ // OK this Element is included - // making dump calib file for SLHC - if(m_dummy&isIBL){ - const InDetDD::PixelModuleDesign* design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); - if(design){ - unsigned int mchips = design->numberOfCircuits(); - // std::cout<<"I am here "<<m_pixid->barrel_ec(ident)<<","<<m_pixid->layer_disk(ident)<<","<<m_pixid->phi_module(ident)<<","<<m_pixid->eta_module(ident)<<" mchips="<<mchips<<" dio="<<design->numberOfDiodes()<<" columnsrdo="<<design->columnsPerCircuit()<<" rowsrdo="<<design->rowsPerCircuit()<<" columns="<<design->columns()<<" rows="<<design->rows()<<std::endl; - if(mchips==8||abs(m_pixid->barrel_ec(ident))==2||(m_pixid->barrel_ec(ident)==0&&m_pixid->layer_disk(ident)>0))mchips *=2; // guess numberOfCircuits() - *outfile<<m_pixid->barrel_ec(ident)<<","<<m_pixid->layer_disk(ident)<<","<<m_pixid->phi_module(ident)<<","<<m_pixid->eta_module(ident)<<std::endl; - for(int ichip=0; ichip<static_cast<int>(mchips); ++ichip){ - *outfile<<"I"<<ichip<<" "<<"4160 69 192 5090 4160 69 192 5090 4160 69 192 5090 499 -1501 294329 499 -1501 294329 0.03 0.025"<<std::endl; - } - } - } - ++totpixmodule; - } - } - } - if(msgLvl(MSG::INFO) ) msg() <<" total Pixel module "<<totpixmodule<<endmsg; - // end of checking pixel modules - - //get Database manager tool - if (StatusCode::SUCCESS!=m_calibsvc.retrieve() ) { - msg(MSG::FATAL) << "PixelCalibSvc not found" << endmsg; - return StatusCode::FAILURE; - } - msg(MSG::INFO) << " PixelCalibSvc found " << endmsg; - - //print the options - msg(MSG::INFO) << " Read from Pixel Conditions database into a text file: " << m_par_rfile<<endmsg; - if(m_par_rfile ==""){ - msg(MSG::ERROR) << " It's reading, Output text file is required "<<endmsg; - return StatusCode::FAILURE; - } - // - // create a root file - - m_par_histf = new TFile("myoutput.root","RECREATE"); - m_myhf[0] = new TH1F("thres","thres",200,3000.,8000.); - m_myhf[1] = new TH1F("sigmath","sigmath",100,0.,500.); - m_myhf[2] = new TH1F("noise","noise",100,0.,500.); - m_myhf[3] = new TH1F("thresin","thresin",200,3000.,8000.); - m_myhf[4] = new TH1F("thres-long","thres-long",200,3000.,8000.); - m_myhf[5] = new TH1F("sigmath-long","sigmath-long",100,0.,500.); - m_myhf[6] = new TH1F("noise-long","noise-long",100,0.,500.); - m_myhf[7] = new TH1F("thresin-long","thresin-long",200,3000.,8000.); - m_myhf[8] = new TH1F("thres-ganged","thres-ganged",200,3000.,8000.); - m_myhf[9] = new TH1F("sigmath-ganged","sigmath-ganged",100,0.,500.); - m_myhf[10] = new TH1F("noise-ganged","noise-ganged",100,0.,500.); - m_myhf[11] = new TH1F("thresin-ganged","thresin-ganged",200,3000.,8000.); - m_myhf[12] = new TH1F("tot-p1","tot-p1",100, -1.,1.); - m_myhf[13] = new TH1F("tot-p2","tot-p2",100, -1.,1.); - - // - return StatusCode::SUCCESS; -} - - -StatusCode PixelCalibServiceTest::execute() { - - //StatusCode sc; - // - // at first event: - // create Conditions objects in the detectorstore - if(!m_setup){ - m_setup = true; - std::ofstream* outfile=0; - if(msgLvl(MSG::INFO)) msg() << " read PixelCalibData to text file: " - << m_par_rfile << endmsg; - outfile = new std::ofstream(m_par_rfile.c_str()); - - InDetDD::SiDetectorElementCollection::const_iterator iter, itermin, itermax; - if(StatusCode::SUCCESS != detStore()->retrieve(m_pixman, "Pixel") || m_pixman==0){ - if(msgLvl(MSG::FATAL)) msg() << "Could not find Pixel manager "<<endmsg; - return StatusCode::FAILURE; - } - else{ - itermin = m_pixman->getDetectorElementBegin(); - itermax = m_pixman->getDetectorElementEnd(); - - if (StatusCode::SUCCESS!= detStore()->retrieve(m_pixid,"PixelID") ){ - ATH_MSG_FATAL( "Unable to retrieve pixel ID helper" ); - return StatusCode::FAILURE; - } - - } - int nchips = 0; - int nobj = 0; - bool lfst = true; - bool lfstA = true; - bool lfstC = true; - for( iter=itermin; iter !=itermax; ++iter){ - const InDetDD::SiDetectorElement* element = *iter; - if(element !=0){ - const Identifier ident = element->identify(); - if(m_pixid->is_pixel(ident)){ // OK this Element is included - const InDetDD::PixelModuleDesign* design = dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()); - if(!design)continue; - unsigned int mchips = design->numberOfCircuits(); - if(mchips==8||abs(m_pixid->barrel_ec(ident))==2||(m_pixid->barrel_ec(ident)==0&&m_pixid->layer_disk(ident)>0))mchips *=2; // guess numberOfCircuits() - // - // - unsigned int hashID = isIBL?static_cast<unsigned int>(m_pixid->wafer_hash(ident)):( (((m_pixid->barrel_ec(ident) + 2) / 2) << 25 ) + ( m_pixid->layer_disk(ident) << 23) + ( m_pixid->phi_module(ident) << 17) + ((m_pixid->eta_module(ident) + 6) << 13)); - if(m_dummy){ - unsigned int dl = 0; - if(!isIBL){ - if(m_pixid->barrel_ec(ident)==-2&&lfstA){ // making DBM dummy -4 - lfstA = false; - for(int i = 0; i<3; ++i){ - for(int j = 0; j<4; ++j){ - *outfile<<-4<<","<<i<<","<<j<<","<<0<<std::endl; - *outfile<<"I"<<0<<" "<<"1200 69 192 1200 1200 69 192 1200 0 0 0 0 941 -1200 800000 941 -1200 800000 0.03 0.025"<<std::endl; - } - } - } - if(m_pixid->barrel_ec(ident)==2&&lfstC){// making DBM dummy 4 - lfstC =false; - for(int i = 0; i<3; ++i){ - for(int j = 0; j<4; ++j){ - *outfile<<4<<","<<i<<","<<j<<","<<0<<std::endl; - *outfile<<"I"<<0<<" "<<"1200 69 192 1200 1200 69 192 1200 0 0 0 0 941 -1200 800000 941 -1200 800000 0.03 0.025"<<std::endl; - } - } - } - if(m_pixid->barrel_ec(ident)==0)dl =1; - if(m_pixid->barrel_ec(ident)==0&&m_pixid->layer_disk(ident)==0&&lfst){ // making dummy of IBL - lfst = false; - for(int i = 0; i<14; ++i){ - for(int j =-10; j<10; ++j){ - //unsigned int dummyID = (2 << 26) +(i << 18) +((j + 10) << 13); - int mx = 2; - if(j<-6||j>5)mx = 1; - *outfile<<m_pixid->barrel_ec(ident)<<","<<0<<","<<i<<","<<j<<std::endl; - for(int ichip=0; ichip<mx; ++ichip){ - //*outfile<<"I"<<ichip<<" "<<"4160 69 192 5090 4310 165 300 5330 0 0 0 0 499 -1501 294329 499 -1501 294329 0.03 0.025"<<std::endl; - //*outfile<<"I"<<ichip<<" "<<"1500 69 192 1500 1500 69 192 1500 0 0 0 0 883 -1500 1600000 883 -1500 1600000 0.03 0.025"<<std::endl; - *outfile<<"I"<<ichip<<" "<<"2550 75 120 2550 2550 75 135 2550 0 0 0 0 18 -1445 10000 18 -1445 10000 0.25 0.000025"<<std::endl; // turned from M7 cosmic - } - } - } - } - if(m_calibsvc->hasCalibData(ident)){ - if(nobj%100==0 && msgLvl(MSG::INFO) ) msg() <<"ith Module:"<<nobj<<"with Identifier:"<<hashID<<endmsg; - ++nobj; - *outfile<<m_pixid->barrel_ec(ident)<<","<<m_pixid->layer_disk(ident)+dl<<","<<m_pixid->phi_module(ident)<<","<<m_pixid->eta_module(ident)<<std::endl; - for(int ichip=0; ichip<static_cast<int>(mchips); ++ichip){ - ++nchips; - *outfile<<"I"<<ichip<<" "<<m_calibsvc->getThreshold(ident,0,1,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,1,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,1,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,1,ichip)<<" "<< - m_calibsvc->getThreshold(ident,0,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,0,ichip)<<" "<< - m_calibsvc->getThreshold(ident,153,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,153,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,153,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,153,0,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,153,0,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,153,0,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,153,0,ichip)<<" "<< - m_calibsvc->getTotP1(ident,ichip)<<" "<< - m_calibsvc->getTotP2(ident,ichip)<<" "<<std::endl; - } - } - } - } - else{ // normal dump - if(m_calibsvc->hasCalibData(ident)){ - if(nobj%100==0 && msgLvl(MSG::INFO) ) msg() <<"ith Module:"<<nobj<<"with Identifier:"<<hashID<<endmsg; - ++nobj; - int rowsFGangedFE = rowsFGangedFEI3; - if(isITK){ - rowsFGangedFE = rowsFGangedFEI51; - if(m_pixid->barrel_ec(ident)==0&&m_pixid->layer_disk(ident)==1)rowsFGangedFE = rowsFGangedFEI52; - } - *outfile<<hashID<<std::endl; - int mchipx = m_calibsvc->getNFE(ident); - if(mchipx>2){ - for(int ichip=0; ichip<mchipx; ++ichip){ - ++nchips; - m_myhf[0]->Fill(m_calibsvc->getThreshold(ident,0,1,ichip)); - m_myhf[1]->Fill(m_calibsvc->getThresholdSigma(ident,0,1,ichip)); - m_myhf[2]->Fill(m_calibsvc->getNoise(ident,0,1,ichip)); - m_myhf[3]->Fill(m_calibsvc->getTimeWalk(ident,0,1,ichip)); - m_myhf[4]->Fill(m_calibsvc->getThreshold(ident,0,0,ichip)); - m_myhf[5]->Fill(m_calibsvc->getThresholdSigma(ident,0,0,ichip)); - m_myhf[6]->Fill(m_calibsvc->getNoise(ident,0,0,ichip)); - m_myhf[7]->Fill(m_calibsvc->getTimeWalk(ident,0,0,ichip)); - m_myhf[8]->Fill(m_calibsvc->getThreshold(ident,rowsFGangedFE,0,ichip)); - m_myhf[9]->Fill(m_calibsvc->getThresholdSigma(ident,rowsFGangedFE,0,ichip)); - m_myhf[10]->Fill(m_calibsvc->getNoise(ident,rowsFGangedFE,0,ichip)); - m_myhf[11]->Fill(m_calibsvc->getTimeWalk(ident,rowsFGangedFE,0,ichip)); - m_myhf[12]->Fill(m_calibsvc->getTotP1(ident,ichip)); - m_myhf[13]->Fill(m_calibsvc->getTotP2(ident,ichip)); - // need to be prcise about the type of pixel: - *outfile<<"I"<<ichip<<" "<<m_calibsvc->getThreshold(ident,0,1,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,1,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,1,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,1,ichip)<<" "<< - m_calibsvc->getThreshold(ident,0,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,0,ichip)<<" "<< - m_calibsvc->getThreshold(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,0,1,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,rowsFGangedFE,0,ichip)<<" "<< - m_calibsvc->getTotP1(ident,ichip)<<" "<< - m_calibsvc->getTotP2(ident,ichip)<<" "<<std::endl; - } - } - else{ // FEI4 chips - for(int ichip=0; ichip<mchipx; ++ichip){ - ++nchips; - if(mchipx>1){ - *outfile<<"I"<<ichip<<" "<<m_calibsvc->getThreshold(ident,1,1,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,1,1,ichip)<<" "<< - m_calibsvc->getNoise(ident,1,1,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,1,1,ichip)<<" "<< - m_calibsvc->getThreshold(ident,0,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,0,ichip)<<" "<< - 0<<" "<<0<<" "<<0<<" "<<0<<" "<< - m_calibsvc->getQ2TotA(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotA(ident,0,0,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,0,0,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,0,0,ichip)<<" "<< - m_calibsvc->getTotP1(ident,ichip)<<" "<< - m_calibsvc->getTotP2(ident,ichip)<<" "<<std::endl; - } - else{ - *outfile<<"I"<<ichip<<" "<<m_calibsvc->getThreshold(ident,1,1,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,1,1,ichip)<<" "<< - m_calibsvc->getNoise(ident,1,1,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,1,1,ichip)<<" "<< - m_calibsvc->getThreshold(ident,0,0,ichip)<<" "<< - m_calibsvc->getThresholdSigma(ident,0,0,ichip)<<" "<< - m_calibsvc->getNoise(ident,0,0,ichip)<<" "<< - m_calibsvc->getTimeWalk(ident,0,0,ichip)<<" "<< - 0<<" "<<0<<" "<<0<<" "<<0<<" "<< - m_calibsvc->getQ2TotA(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotE(ident,1,1,ichip)<<" "<< - m_calibsvc->getQ2TotC(ident,1,1,ichip)<<" "<< - 0<<" "<<0<<" "<<0<<" "<< - m_calibsvc->getTotP1(ident,ichip)<<" "<< - m_calibsvc->getTotP2(ident,ichip)<<" "<<std::endl; - } - } - } - } - } - } - } - } - outfile->close(); - delete outfile; - if( msgLvl(MSG::INFO) ) msg() << "Written "<< nobj <<" PixelCalibData objects" << - " with " << nchips << " chips to text file "<<endmsg; - } - if( msgLvl(MSG::INFO) ) msg() <<" Event execute "<<endmsg; - // - for(int i = 0; i<14; ++i)m_myhf[i]->Write(); - m_par_histf->Close(); - // - return StatusCode::SUCCESS; -} - -StatusCode PixelCalibServiceTest::finalize() -{ - msg(MSG::INFO)<<" PixelCalibServiceTest: finishing "<<endmsg; - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.h b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.h deleted file mode 100755 index c8e920ed5798579575948daa1ef5cc59f1853f7d..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -///////////////////////////////////////////////////////////////// -// PixelCalibServiceTest.cxx -// Algorithm to create Pixel CalibDb in the Conditions Database -// Author Weiming Yao <wmyao@lbl.gov> -///////////////////////////////////////////////////////////////// - -#ifndef PIXELCALIBSERVICETEST_H -#define PIXELCALIBSERVICETEST_H - -#include <vector> -#include <string> -//#include "GaudiKernel/Algorithm.h" -#include "AthenaBaseComps/AthAlgorithm.h" -//#include "GaudiKernel/MsgStream.h" -#include "StoreGate/DataHandle.h" -#include "GaudiKernel/ServiceHandle.h" - -#include "TFile.h" -#include "TH1.h" - - -class Identifier; -//class StoreGateSvc; -class PixelID; - -namespace InDetDD{ - class PixelDetectorManager; -} - -class IPixelCalibSvc; - -/** @class PixelCalibSerciceTest - The PixelCalibServiceTest is an algorithm to illustrate the usage of the PixelCalibSvc. - The algorithm can also allow to dump the pixel calibration data into a text file. - - @author Weiming Yao <WMYAO@LBL.GOV> -*/ - -class PixelCalibServiceTest:public AthAlgorithm { - public: - PixelCalibServiceTest(const std::string& name, ISvcLocator* pSvcLocator); - ~PixelCalibServiceTest(void); - - StatusCode initialize(void); - StatusCode execute(void); - StatusCode finalize(void); - - private: - // MsgStream m_log; - // StoreGateSvc* m_sgSvc; - // StoreGateSvc* m_detStore; - - const ServiceHandle<IPixelCalibSvc> m_calibsvc; - const InDetDD::PixelDetectorManager* m_pixman; - const PixelID* m_pixid; - bool m_setup; //true for first event - - // algorithm parameters to be set in the jobOptions - std::string m_par_rfile; //<! text file to read calibration data from - bool m_dummy; - - TFile* m_par_histf; - TH1F* m_myhf[14]; - -}; - -#endif // PIXELCALIBSERVICETEST_H - - - - - diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.py b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.py deleted file mode 100755 index 003a992098a11a3c8b1998ec49c3506154247189..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTest.py +++ /dev/null @@ -1,81 +0,0 @@ -import AthenaCommon.AtlasUnixStandardJob -# Use auditors -from AthenaCommon.AppMgr import ServiceMgr - -from GaudiSvc.GaudiSvcConf import AuditorSvc - -ServiceMgr += AuditorSvc() -theAuditorSvc = ServiceMgr.AuditorSvc -theAuditorSvc.Auditors += [ "ChronoAuditor"] -#ChronoStatSvc = Service ( "ChronoStatSvc") -theAuditorSvc.Auditors += [ "MemStatAuditor" ] -#MemStatAuditor = theAuditorSvc.auditor( "MemStatAuditor" ) -theApp.AuditAlgorithms=True - -from AthenaCommon.GlobalFlags import GlobalFlags -# --- default is atlas geometry -GlobalFlags.DetGeo.set_atlas() -# --- set defaults -GlobalFlags.DataSource.set_geant4() -GlobalFlags.InputFormat.set_pool() -# --- default is zero luminosity -GlobalFlags.Luminosity.set_zero() -GlobalFlags.Print() -#-------------------------------------------------------------- -# Get Configuration flags -#-------------------------------------------------------------- -include( "AthenaCommon/AthenaCommonFlags.py" ) - -#-------------------------------------------------------------- -# Set Detector setup -#-------------------------------------------------------------- -# --- switch on InnerDetector -from AthenaCommon.DetFlags import DetFlags -DetFlags.ID_setOn() -DetFlags.Calo_setOff() -DetFlags.Muon_setOff() -DetFlags.Truth_setOff() -DetFlags.LVL1_setOff() -DetFlags.SCT_setOff() -DetFlags.TRT_setOff() - -# ---- switch parts of ID off/on as follows -#switch off tasks -DetFlags.pileup.all_setOff() -DetFlags.simulate.all_setOff() -DetFlags.makeRIO.all_setOff() -DetFlags.writeBS.all_setOff() -DetFlags.readRDOBS.all_setOff() -DetFlags.readRIOBS.all_setOff() -DetFlags.readRIOPool.all_setOff() -DetFlags.writeRIOPool.all_setOff() - -#DetDescrVersion = "ATLAS-DC3-05" - -#include ("AtlasGeoModel/SetGeometryVersion.py") -import AtlasGeoModel.SetGeometryVersion -#include ("AtlasGeoModel/GeoModelInit.py") -import AtlasGeoModel.GeoModelInit - -from AthenaCommon.AlgSequence import AlgSequence -job = AlgSequence() - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibServiceTest - -include("PixelConditionsServices/PixelCalibSvc_jobOptions.py") - - -job +=PixelCalibServiceTest(OutputTextFile ="pixelcalibsvc_dump.txt") - -from IOVDbSvc.IOVDbSvcConf import IOVDbSvc -IOVDbSvc.GlobalTag = "DEFAULTCOND" - -theApp.EvtMax = 5 - -#-------------------------------------------------------------- -# Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -#-------------------------------------------------------------- -MessageSvc.OutputLevel = DEBUG -# --- change output format -MessageSvc.Format = "% F%30W%S%7W%R%T %0W%M" -MessageSvc.defaultLimit = 9999999 diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestIBL.py b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestIBL.py deleted file mode 100755 index 27bd4a24571ea99d7d63421e612adc3c776113c9..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestIBL.py +++ /dev/null @@ -1,112 +0,0 @@ -isIBL = 1 -mySQ = 0 -if isIBL: - myOutput= "pixelcalibsvcIBL3D_dumpdb.txt" -else: - myOutput= "pixelcalibsvc_dump.txt" - -import AthenaCommon.AtlasUnixGeneratorJob - -## GlobalFlags - -from AthenaCommon.GlobalFlags import globalflags - -#globalflags.DetGeo = 'atlas' -globalflags.DataSource = 'geant4' -if isIBL: - globalflags.DetDescrVersion = 'ATLAS-R2-2015-03-01-00' -else: - globalflags.DetDescrVersion = 'ATLAS-GEO-08-00-00' - -globalflags.InputFormat = 'pool' -globalflags.print_JobProperties() - -### set up conddb - -from AthenaCommon.DetFlags import DetFlags -DetFlags.all_setOff() -DetFlags.pixel_setOn() -DetFlags.Print() - -from AtlasGeoModel import SetGeometryVersion -from AtlasGeoModel import GeoModelInit - -# --- setup version -###from InDetIBL_Example.SLHC_JobProperties import SLHC_Flags -## Leave commented out unless overriding with text file. -## Default is to use Geom DB only -#SLHC_Flags.SLHC_Version = "IBL-01" - -###print SLHC_Flags - -## SLHC setup -####from InDetIBL_Example.SLHC_Setup import SLHC_Setup -####SLHC_Setup = SLHC_Setup() - -from IOVDbSvc.CondDB import conddb -#conddb.setGlobalTag('OFLCOND-CSC-00-00-00') -#conddb.setGlobalTag('OFLCOND-MC12-SIM-00') -#conddb.setGlobalTag('OFLCOND-RUN1-SDR-06') -conddb.setGlobalTag('OFLCOND-RUN12-SDR-22') -#conddb.setGlobalTag('OFLCOND-MC16-SDR-04') -#conddb.iovdbsvc.dbConnection = "sqlite://;schema=pixmapibl.db;dbname=OFLP200" - -#conddb.addFolder("PIXEL_OFL","/PIXEL/PixMapShort") -#conddb.addFolder("PIXEL_OFL","/PIXEL/PixMapLong") -#conddb.addFolder("PIXEL_OFL","/PIXEL/PixMapOverlay") -#conddb.addOverride('/PIXEL/PixMapShort','PixMapShort-Test-00') -#conddb.addOverride('/PIXEL/PixMapLong','PixMapLong-Test-00') - -if mySQ: - if isIBL: - conddb.iovdbsvc.Folders = [ "<dbConnection>sqlite://;schema=pixmapdb_ibl3ddbm_IBL3D25DBM-04-01.db;dbname=OFLP200</dbConnection> /PIXEL/PixCalib <tag>PixCalib-IBL3D25DBM-04-01</tag>" ] - else: - conddb.iovdbsvc.Folders = [ "<dbConnection>sqlite://;schema=pixmapdb.db;dbname=OFLP200</dbConnection> /PIXEL/PixCalib <tag>PixCalib-IBL3D25DBM-04-01</tag>" ] -else: - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") - -### configure the special pixel map service - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc -PixelCalibSvc = PixelCalibSvc() - -ServiceMgr.EventSelector.RunNumber = 282222 -#ServiceMgr.EventSelector.RunNumber = 222222 -#ServiceMgr.EventSelector.RunNumber = 200805 - -### define the job - -from AthenaCommon.AlgSequence import AlgSequence - -job = AlgSequence() - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibServiceTest - -job +=PixelCalibServiceTest(OutputTextFile =myOutput, MakeDummy = TRUE ) - -ServiceMgr += PixelCalibSvc - - -theApp.EvtMax = 1 - - -### set up auditors - -from AthenaCommon.AppMgr import ServiceMgr - -from GaudiSvc.GaudiSvcConf import AuditorSvc - -ServiceMgr += AuditorSvc() -theAuditorSvc = ServiceMgr.AuditorSvc - -theAuditorSvc.Auditors += [ "ChronoAuditor"] -theAuditorSvc.Auditors += [ "MemStatAuditor" ] -theApp.AuditAlgorithms=True - - -### configure the message service -# Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) - -MessageSvc.OutputLevel = 3 -MessageSvc.debugLimit = 100000 -MessageSvc.infoLimit = 10000 diff --git a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestSLHC.py b/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestSLHC.py deleted file mode 100755 index eb44aadec8b2873e2a6d45c1b042df8c5b185f88..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/PixelConditionsServices/test/PixelCalibServiceTestSLHC.py +++ /dev/null @@ -1,115 +0,0 @@ -isSLHC = 1 -mySQ = 1 - -if isSLHC: - myOutput= "pixelcalibsvcSLHC_dump.txt" -else: - myOutput= "pixelcalibsvc_dump.txt" - -#import AthenaCommon.AtlasUnixStandardJob - -#MyOutPut = INFO -#from AthenaCommon.AppMgr import theApp -#from AthenaCommon.AppMgr import ServiceMgr - -from AthenaCommon.DetFlags import DetFlags -from AthenaCommon.GlobalFlags import globalflags - -# --- set defaults -globalflags.DataSource='geant4' - -if isSLHC: - include("InDetSLHC_Example/preInclude.NoTRT.py") -else: - DetFlags.detdescr.ID_setOn() - -# Select the geometry version. -from AthenaCommon.GlobalFlags import globalflags -if isSLHC: - globalflags.DetDescrVersion = 'ATLAS-SLHC-02-00-00' -else: - globalflags.DetDescrVersion = 'ATLAS-GEO-08-00-00' - -#globalflags.DetDescrVersion = 'ATLAS-SLHC-02-00-00' -#globalflags.DetGeo.set_Value_and_Lock('atlas') - -# import the # the conditions setup -#from IOVDbSvc.CondDB import conddb -#conddb.setGlobalTag('OFLCOND-SIM-00-00-00') -#conddb.setGlobalTag('OFLCOND-SDR-BS14T-SLHC-04') - -# Initialize geometry -from AtlasGeoModel import GeoModelInit -from AtlasGeoModel import SetGeometryVersion - -# --- setup version -from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags -## Leave commented out unless overriding with text file. -## Default is to use Geom DB only -#SLHC_Flags.SLHC_Version = "SLHC-01" - -print SLHC_Flags - -## SLHC setup -from InDetSLHC_Example.SLHC_Setup import SLHC_Setup -SLHC_Setup = SLHC_Setup() - -from AthenaCommon.AlgSequence import AlgSequence - -topSequence = AlgSequence() - -#include("PixelConditionsServices/PixelCalibSvc_jobOptions.py") - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc -ServiceMgr +=PixelCalibSvc() -PixelCalibSvc = ServiceMgr.PixelCalibSvc - -#if not (globalflags.DataSource() == 'geant4'): -# PixelCablingSvc.MappingFile = "PixelCabling/Pixels_Atlas_IdMapping_May08.dat" -# conddb.addFolder("PIXEL","/PIXEL/ReadoutSpeed") -#else: -# conddb.addFolderSplitMC("PIXEL","/PIXEL/ReadoutSpeed","/PIXEL/ReadoutSpeed") -# ServiceMgr += PixelCablingSvc - -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibServiceTest - -topSequence +=PixelCalibServiceTest(OutputTextFile =myOutput, MakeDummy = TRUE) - -from IOVDbSvc.IOVDbSvcConf import IOVDbSvc -if isSLHC: - IOVDbSvc.GlobalTag = "OFLCOND-ATLAS-HL-LHC-00" -else: - IOVDbSvc.GlobalTag = "OFLCOND-MC12-SIM-00" - -#"DEFAULTCOND" - -if mySQ: - from AthenaCommon.AppMgr import ServiceMgr as svcMgr - # Setup Db stuff - import AthenaPoolCnvSvc.AthenaPool - import IOVDbSvc.IOVDb - if isSLHC: - connStr = "<dbConnection>sqlite://X;schema=pixcalibdb_slhc.db;dbname=OFLP200</dbConnection>" - tag = "<tag>PixCalib-SLHC-00</tag>" - else: - connStr = "<dbConnection>sqlite://X;schema=pixcalibdb.db;dbname=OFLP200</dbConnection>" - tag = "<tag>PixCalib-Test-00</tag>" - - folder = "/PIXEL/PixCalib" - svcMgr.IOVDbSvc.Folders += [ folder + tag + connStr ] -else: - from IOVDbSvc.CondDB import conddb - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") - - -theApp.EvtMax = 1 - -#-------------------------------------------------------------- -# Set output level threshold (1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -#-------------------------------------------------------------- -MessageSvc.OutputLevel = DEBUG -#INFO -#DEBUG -# --- change output format -MessageSvc.Format = "% F%30W%S%7W%R%T %0W%M" -MessageSvc.defaultLimit = 9999999 diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py b/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py index b3fbbe5e864d5f47a9b01b57de3d8f5d1917dca7..096e1d4b7740fe2a7c328234d6d0f9e6e108f2b7 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryToolSetup.py @@ -87,7 +87,8 @@ class PixelConditionsSummaryToolSetup: from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadMap=self.useDeadMap, - ReadDeadMapKey=PixelDeadMapFolder) + ReadDeadMapKey=PixelDeadMapFolder, + UseCalibConditions=True) if not hasattr(ToolSvc, self.toolName): from PixelConditionsTools.PixelConditionsToolsConf import PixelConditionsSummaryTool diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py index d6856b680591bc2d9bd694788a6e03f461ebb14d..d64c1f34d0f01efc8e75740e3d568b1d2c35e6fd 100755 --- a/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/ReadPixelCalibDB.py @@ -78,15 +78,6 @@ include ("AtlasGeoModel/GeoModelInit.py") #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- -#theApp.Dlls +=[ "PixelConditionsServices" ] - -#configure PixelCalibDbSvc -#theApp.ExtSvc +=[ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - -#PixelCalibSvc.DBToolType = "PixelCalib::PixelCalibDbTool" -#PixelCalibSvc.DBToolName = "PixelCalib_PixelCalibDbTool" - theApp.Dlls += [ "PixelConditionsTools" ] # PixelCalibDbTestWrite.py diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py index 53edef679088c5741f5d32bfc4002aab7e906dbb..315bf510b30d7e97ef38e751fe02812f56bbb751 100755 --- a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDB.py @@ -78,12 +78,6 @@ include ("AtlasGeoModel/GeoModelInit.py") #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- -#theApp.Dlls +=[ "PixelConditionsServices" ] - -#configure PixelCalibDbSvc -#theApp.ExtSvc +=[ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - theApp.Dlls += [ "PixelConditionsTools" ] # PixelCalibDbTestWrite.py diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBCool_200.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBCool_200.py index 34597069a48df8450ad340533ad8273e1e0516d4..d936a78c8609143d08f5ea6be1f34ddbb5d1c116 100755 --- a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBCool_200.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBCool_200.py @@ -100,12 +100,6 @@ from AthenaCommon.AppMgr import ToolSvc #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- -#theApp.Dlls +=[ "PixelConditionsServices" ] - -#configure PixelCalibDbSvc -#theApp.ExtSvc +=[ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc +=PixelCalibDbTool() diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBsqlit.py b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBsqlit.py index 0f51cc2ad3b3851a9ac716b455b4dc9854d9a761..bfca26a887118e60d66955acc55a378c4fc6ac17 100755 --- a/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBsqlit.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/share/WritePixelCalibDBsqlit.py @@ -100,12 +100,6 @@ from AthenaCommon.AppMgr import ToolSvc #-------------------------------------------------------------- # Private Application Configuration options #-------------------------------------------------------------- -#theApp.Dlls +=[ "PixelConditionsServices" ] - -#configure PixelCalibDbSvc -#theApp.ExtSvc +=[ "PixelCalibSvc" ] -#PixelCalibSvc = Service( "PixelCalibSvc" ) - from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc +=PixelCalibDbTool() diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt index 08ccba132b72eb438e8e8b19eaa4fbd295967129..33375a73faacd6cd1a47286b2da588d536f3fab1 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/CMakeLists.txt @@ -37,67 +37,67 @@ atlas_add_component( SCT_ConditionsAlgorithms atlas_add_test( TestCalibChipRead SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testCalibChipRead.py - PROPERTIES TIMEOUT 500 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestCalibRead SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testCalibRead.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestConfig SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testConfig.py - PROPERTIES TIMEOUT 500 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestDCSConditions SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testDCSConditions.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestLinkMasking SCRIPT share/TestLinkMasking.sh - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestMajority SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testMajority.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestModuleVeto SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testModuleVeto.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestMonRead SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testMonRead.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestParameters SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testParameters.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestReadout SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testReadout.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestRodVeto SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testRodVeto.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestSensors SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testSensors.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestSilicon SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testSilicon.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestStripVeto SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testStripVeto.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestSummary SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testSummary.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) atlas_add_test( TestTdaqEnabled SCRIPT athena.py --threads=5 SCT_ConditionsAlgorithms/testTdaqEnabled.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) # Install files from the package: diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h index 649788c604a094602ef7a1335cb894dc5cddbf4b..c9fe48584d07e290fef08fc5271fd36b4061143a 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/PixelGeoModel/IBLParameterSvc.h @@ -47,7 +47,6 @@ public: std::string setStringParameters(const std::string param,std::string paramName) { if (m_IBLpresent) { if (m_disableAllClusterSplitting && paramName=="clusterSplitter") return ""; - if (m_disableCalibCondDB && paramName=="PixelCalibSvc") return ""; } return param; } @@ -74,11 +73,9 @@ public: if (m_IBLpresent) { if (m_disablePixMapCondDB && paramName=="UsePixMapCondDB") param=false; if (m_disableSpecialPixels && paramName=="EnableSpecialPixels") param=false; - if (m_disableCalibCondDB && paramName=="UseCalibCondDB") param=false; if (m_disableAlignable && paramName=="alignable") param=false; if (m_disableAllClusterSplitting && paramName=="applyNNcorrection") param = false; if (m_disableAllClusterSplitting && paramName=="doPixelClusterSplitting") param = false; - if (m_disableCalibCondDB && paramName=="UsePixelCalibCondDB") param = false; if (m_disableDCS && paramName=="useDCS") param=false; if (paramName=="IBLAbsent") param=false; } @@ -94,7 +91,6 @@ private: ServiceHandle< IRDBAccessSvc > m_rdbAccessSvc; bool m_disablePixMapCondDB; bool m_disableSpecialPixels; - bool m_disableCalibCondDB; bool m_disableAlignable; bool m_disableAllClusterSplitting; bool m_disableDCS; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx index ed70c971db141cd403ea7e0c52a829cb8030693a..d7bb9a66ca25443a38de027e678445c62f76f66b 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/IBLParameterSvc.cxx @@ -30,7 +30,6 @@ IBLParameterSvc::IBLParameterSvc(const std::string& name,ISvcLocator* svc) m_rdbAccessSvc("RDBAccessSvc",name), m_disablePixMapCondDB(false), m_disableSpecialPixels(false), - m_disableCalibCondDB(false), m_disableAlignable(false), m_disableAllClusterSplitting(false), m_disableDCS(true) @@ -39,7 +38,6 @@ IBLParameterSvc::IBLParameterSvc(const std::string& name,ISvcLocator* svc) declareProperty("RDBAccessSvc",m_rdbAccessSvc); declareProperty("DisablePixMapCondDB",m_disablePixMapCondDB); declareProperty("DisableSpecialPixels",m_disableSpecialPixels); - declareProperty("DisableCalibCondDB",m_disableCalibCondDB); declareProperty("DisableAlignable",m_disableAlignable); declareProperty("DisableAllClusterSplitting",m_disableAllClusterSplitting); declareProperty("DisableDCS",m_disableDCS); diff --git a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/CMakeLists.txt b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/CMakeLists.txt index 60c22296c5fb0a17e43a90cf95fa0584dabc8bf4..a9ea09ee3f556660117dc687a5a996572263f347 100644 --- a/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/SCT_ModuleDistortions/CMakeLists.txt @@ -34,7 +34,7 @@ atlas_add_component( SCT_ModuleDistortions atlas_add_test( TestSCT_DistortionsTool SCRIPT athena.py --threads=5 SCT_ModuleDistortions/TestSCT_DistortionsTool.py - PROPERTIES TIMEOUT 300 + PROPERTIES TIMEOUT 600 ENVIRONMENT THREADS=5 ) # Install files from the package: diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/FastSiDigitization/PixelFastDigitizationTool.h b/InnerDetector/InDetDigitization/FastSiDigitization/FastSiDigitization/PixelFastDigitizationTool.h index 323f354fb297f6e55fa807bc6a3011f552955b89..28ab66b382308743d3f5702403fd23c82fc43645 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/FastSiDigitization/PixelFastDigitizationTool.h +++ b/InnerDetector/InDetDigitization/FastSiDigitization/FastSiDigitization/PixelFastDigitizationTool.h @@ -21,10 +21,11 @@ #include "InDetPrepRawData/PixelClusterContainer.h" //typedef, cannot fwd declare #include "SiClusterizationTool/PixelGangedAmbiguitiesFinder.h" #include "InDetPrepRawData/PixelGangedClusterAmbiguities.h" //typedef, cannot fwd declare -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "SiClusterizationTool/ClusterMakerTool.h" #include "PileUpTools/PileUpMergeSvc.h" - +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadCondHandleKey.h" //New digi #include "TrkDigEvent/DigitizationModule.h" @@ -146,7 +147,11 @@ private: bool m_acceptDiagonalClusters; //!< merging parameter used to define two clusters as neighbour > std::string m_pixelClusterAmbiguitiesMapName; InDet::PixelGangedClusterAmbiguities* m_ambiguitiesMap; - ServiceHandle<IPixelCalibSvc> m_pixelCalibSvc; + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service" }; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; // bool isActiveAndGood(const ServiceHandle<IInDetConditionsSvc> &svc, const IdentifierHash &idHash, const Identifier &id, bool querySingleChannel, const char *elementName, const char *failureMessage = "") const; bool areNeighbours(const std::vector<Identifier>& group, const Identifier& rdoID, const InDetDD::SiDetectorElement* /*element*/, const PixelID& pixelID) const; diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py b/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py index 216d0071c5757764c57c56ced89ad70231cb36e7..5ac847f532c397c06b35916a8e5cbd95df505ef0 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/python/FastSiDigitizationConfig.py @@ -30,10 +30,22 @@ def FastSCT_LastXing(): def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): from Digitization.DigitizationFlags import digitizationFlags + + ################################# + # Config pixel conditions setup # + ################################# + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, 'PixelConfigCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", + UseDeadMap=False, + ReadDeadMapKey="/PIXEL/PixMapOverlay", + UseCalibConditions=True) + #FIXME: at some point we should move away from being dependent on the experimentalDigi flags. if 'doFastSCT_Digi' in digitizationFlags.experimentalDigi() and not 'doFastPixelDigi' in digitizationFlags.experimentalDigi(): - kwargs.setdefault("UsePixelCalibCondDB", False) - kwargs.setdefault("PixelCalibSvc",""); + PixelConfigCondAlg.UseCalibConditions=False else: from AthenaCommon.Include import include include( "PixelConditionsServices/PixelDCSSvc_jobOptions.py" ) @@ -44,21 +56,25 @@ def FastClusterMakerTool(name="FastClusterMakerTool", **kwargs): ToolSvc += PixelRecoDbTool() ToolSvc.PixelRecoDbTool.InputSource = 1 + ##################### + # Calibration setup # + ##################### + from IOVDbSvc.CondDB import conddb + if not conddb.folderRequested("/PIXEL/PixCalib"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") + + if not hasattr(condSeq, 'PixelChargeCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") + + # setup PixelCalibDbTool in ToolSvc if not hasattr(ToolSvc, "PixelCalibDbTool"): from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc += PixelCalibDbTool() - from IOVDbSvc.CondDB import conddb - if not conddb.folderRequested('/PIXEL/PixCalib'): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") if not conddb.folderRequested('/PIXEL/ReadoutSpeed'): conddb.addFolder("PIXEL_OFL","/PIXEL/ReadoutSpeed") - from AthenaCommon.AppMgr import ServiceMgr - if not hasattr(ServiceMgr, "PixelCalibSvc"): - from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc - InDetPixelCalibSvc = PixelCalibSvc() - ServiceMgr += InDetPixelCalibSvc from AthenaCommon import CfgMgr return CfgMgr.InDet__ClusterMakerTool(name,**kwargs) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/PixelDigitization_jobOptions.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/PixelDigitization_jobOptions.py index 30870ea61e8a6a247264d67c19d5311984aa081c..a724806f02f7222ff4aaf23644d42ab585771c0f 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/PixelDigitization_jobOptions.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/PixelDigitization_jobOptions.py @@ -21,8 +21,28 @@ if not "ToolSvc" in theApp.ExtSvc and \ theApp.ExtSvc += [ "ToolSvc/ToolSvc"] pass +################################# +# Config pixel conditions setup # +################################# +from AthenaCommon.AlgSequence import AthSequencer +condSeq = AthSequencer("AthCondSeq") +if not hasattr(condSeq, 'PixelConfigCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", + UseDeadMap=False, + ReadDeadMapKey="/PIXEL/PixMapOverlay", + UseCalibConditions=True) + +##################### +# Calibration setup # +##################### from IOVDbSvc.CondDB import conddb +if not conddb.folderRequested("/PIXEL/PixCalib"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") +if not hasattr(condSeq, 'PixelChargeCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool ToolSvc += PixelRecoDbTool() @@ -31,14 +51,8 @@ ToolSvc.PixelRecoDbTool.InputSource = 1 from PixelConditionsTools.PixelConditionsToolsConf import PixelCalibDbTool ToolSvc += PixelCalibDbTool() -if not conddb.folderRequested('/PIXEL/PixCalib'): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") if not conddb.folderRequested('/PIXEL/ReadoutSpeed'): conddb.addFolder("PIXEL_OFL","/PIXEL/ReadoutSpeed") -from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc -InDetPixelCalibSvc = PixelCalibSvc() -ServiceMgr += InDetPixelCalibSvc - from FastSiDigitization.FastSiDigitizationConf import PixelFastDigitization diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py index 2207bddb943853fcf5c40b9129dba5f68c8c8d8a..0377d2864a147d7496745db7834790afea264817 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/pixRTT.py @@ -73,9 +73,8 @@ include("SimulationJobOptions/preInclude.PileUpBunchTrains2011Config8_DigitConfi include("Digitization/Digitization.py") from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool -InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", - PixelCalibSvc = None, - UsePixelCalibCondDB = FALSE) +InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") + ToolSvc += InDetClusterMakerTool from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py index 2028b3ec97e72144986fd8246bcf185693e39b36..7d379aa65921c53855a3b09f3ce0eabbef5cdc9b 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py +++ b/InnerDetector/InDetDigitization/FastSiDigitization/share/sctRTT.py @@ -82,9 +82,7 @@ StoreGateSvc = Service("StoreGateSvc") StoreGateSvc.Dump = True #from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool -#InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", -# PixelCalibSvc = None, -# UsePixelCalibCondDB = FALSE) +#InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") #ToolSvc += InDetClusterMakerTool from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx index 1c60247e15a575144631aad3f420d5efaebd4d5e..db4fa1f06cebbd9edb29a8da5067589b000ccd3e 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx @@ -117,7 +117,6 @@ PixelFastDigitizationTool::PixelFastDigitizationTool(const std::string &type, co m_acceptDiagonalClusters(true), m_pixelClusterAmbiguitiesMapName("PixelClusterAmbiguitiesMap"), m_ambiguitiesMap(nullptr), - m_pixelCalibSvc("PixelCalibSvc", name), m_digitizationStepper("Trk::PlanarModuleStepper") { declareInterface<IPixelFastDigitizationTool>(this); @@ -164,7 +163,8 @@ StatusCode PixelFastDigitizationTool::initialize() ATH_MSG_DEBUG ( "PixelDigitizationTool::initialize()" ); - CHECK(m_pixelCalibSvc.retrieve()); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); //locate the AtRndmGenSvc and initialize our local ptr if (!m_rndmSvc.retrieve().isSuccess()) @@ -514,6 +514,8 @@ StatusCode PixelFastDigitizationTool::digitize() if(!m_pixelClusterMap) { m_pixelClusterMap = new Pixel_detElement_RIO_map; } else { m_pixelClusterMap->clear(); } + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + while (m_thpcsi->nextDetectorElement(i, e)) { Pixel_detElement_RIO_map PixelDetElClusterMap; @@ -546,6 +548,7 @@ StatusCode PixelFastDigitizationTool::digitize() const IdentifierHash waferID = m_pixel_ID->wafer_hash(hitSiDetElement->identify()); + Identifier moduleID = m_pixel_ID->wafer_id(hitSiDetElement->identify()); const int trkn = hit->trackNumber(); @@ -608,7 +611,13 @@ StatusCode PixelFastDigitizationTool::digitize() bool ExitValid(exitCellId.isValid()); double pixMinimalPathCut= 1. / m_pixPathLengthTotConv; - double th0 = double(m_pixelCalibSvc->getThreshold(hitId))/m_ThrConverted; //test? + + Identifier diodeID = hitId; + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + + double th0 = calibData->getAnalogThreshold((int)waferID,circ,type)/m_ThrConverted; + // if (old_th != th0) std::cout<<"converted threshold "<<th0<<std::endl, old_th= th0; //Avoid to store pixels with 0 ToT diff --git a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt index 0e5c9d2ed6df1d13495088e4e9e8d40a71b56113..144705dfd91a03da196197a6aae44f84438ebd2a 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt @@ -9,7 +9,6 @@ atlas_subdir( PixelDigitization ) atlas_depends_on_subdirs( PUBLIC GaudiKernel PRIVATE - Commission/CommissionEvent Control/AthenaBaseComps Control/AthenaKernel Control/CxxUtils @@ -25,6 +24,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/SiPropertiesTool InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDigitization/SiDigitization InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetRawEvent/InDetSimData diff --git a/InnerDetector/InDetDigitization/PixelDigitization/python/JobOptCfg.py b/InnerDetector/InDetDigitization/PixelDigitization/python/JobOptCfg.py index 484868f8c57f524d3bcd272145a704c30e71731a..69a9a1ee4862f18a8376a3217fc478ef2c8d2f9d 100755 --- a/InnerDetector/InDetDigitization/PixelDigitization/python/JobOptCfg.py +++ b/InnerDetector/InDetDigitization/PixelDigitization/python/JobOptCfg.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration """ PixelDigitization/python/JobOptCfg.py Wrapper class to PixelDigitizaion generated by genconf. @@ -116,9 +116,6 @@ class CustomPixelDigitization( PixelDigitization ): # return index -# def setUseCalibCondDB( self ): -# """Set calib db folder""" - # # The following handle the random number seed list in the rnd service. # They will most likely be obsolete in the near future. @@ -284,9 +281,6 @@ class CustomPixelDigitizationTool( PixelDigitizationTool ): # return index -# def setUseCalibCondDB( self ): -# """Set calib db folder""" - # # The following handle the random number seed list in the rnd service. # They will most likely be obsolete in the near future. diff --git a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py index 9769385fe2cc5141ad795b2036b24e3df9c6fdbc..5f2df716d94f76f11fe4a11028a63ab8aec6d41b 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py @@ -42,26 +42,13 @@ def EnergyDepositionTool(name="EnergyDepositionTool", **kwargs): def SensorSimPlanarTool(name="SensorSimPlanarTool", **kwargs): from AthenaCommon.AppMgr import ToolSvc - if not hasattr(ToolSvc, "PixelSiPropertiesTool"): - from SiPropertiesTool.PixelSiPropertiesToolSetup import PixelSiPropertiesToolSetup - pixelSiPropertiesToolSetup = PixelSiPropertiesToolSetup() - pixelSiPropertiesToolSetup.setup() - if not hasattr(ToolSvc, "PixelLorentzAngleTool"): - from SiLorentzAngleTool.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup - pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() kwargs.setdefault("SiPropertiesTool", ToolSvc.PixelSiPropertiesTool) kwargs.setdefault("LorentzAngleTool", ToolSvc.PixelLorentzAngleTool) +# kwargs.setdefault("LorentzAngleTool", pixelLorentzAngleToolSetup.PixelLorentzAngleTool) return CfgMgr.SensorSimPlanarTool(name, **kwargs) def SensorSim3DTool(name="SensorSim3DTool", **kwargs): from AthenaCommon.AppMgr import ToolSvc - if not hasattr(ToolSvc, "PixelSiPropertiesTool"): - from SiPropertiesTool.PixelSiPropertiesToolSetup import PixelSiPropertiesToolSetup - pixelSiPropertiesToolSetup = PixelSiPropertiesToolSetup() - pixelSiPropertiesToolSetup.setup() - if not hasattr(ToolSvc, "PixelLorentzAngleTool"): - from SiLorentzAngleTool.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup - pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() kwargs.setdefault("SiPropertiesTool", ToolSvc.PixelSiPropertiesTool) return CfgMgr.SensorSim3DTool(name, **kwargs) @@ -71,134 +58,156 @@ def SensorSimTool(name="SensorSimTool", **kwargs): def FrontEndSimTool(name="FrontEndSimTool", **kwargs): from AthenaCommon.AppMgr import ToolSvc kwargs.setdefault("PixelConditionsSummaryTool", ToolSvc.PixelConditionsSummaryTool) - from AthenaCommon.BeamFlags import jobproperties - if jobproperties.Beam.beamType == "cosmics" : - kwargs.setdefault("UseComTime", True) - kwargs.setdefault("TimeJitter", 25.0) - kwargs.setdefault("TimeBCN",8.0) - kwargs.setdefault("TimeZero", 100.0) - else: - kwargs.setdefault("TimeBCN",1.0) - kwargs.setdefault("TimeZero", 5.0) - kwargs.setdefault("TimePerBCO", 25.0) return CfgMgr.FrontEndSimTool(name, **kwargs) def BarrelRD53SimTool(name="BarrelRD53SimTool", **kwargs): kwargs.setdefault("BarrelEC", 0) - kwargs.setdefault("Analogthreshold", [-1, -1, -1, -1, -1]) - kwargs.setdefault("ToTthreshold", [-1, -1, -1, -1, -1]) - kwargs.setdefault("ThermalNoise", [160.0,160.0,160.0,160.0,160.0]) - kwargs.setdefault("NoiseShape", [0.0, 1.0]) - kwargs.setdefault("NoiseOccupancy", 5e-8) - kwargs.setdefault("DisableProbability", 9e-3) return CfgMgr.RD53SimTool(name, **kwargs) def EndcapRD53SimTool(name="EndcapRD53SimTool", **kwargs): kwargs.setdefault("BarrelEC", 2) - kwargs.setdefault("Analogthreshold", [-1, -1, -1, -1, -1]) - kwargs.setdefault("ToTthreshold", [-1, -1, -1, -1, -1]) - kwargs.setdefault("ThermalNoise", [160.0,160.0,160.0,160.0,160.0]) - kwargs.setdefault("NoiseShape", [0.0, 1.0]) - kwargs.setdefault("NoiseOccupancy", 5e-8) - kwargs.setdefault("DisableProbability", 9e-3) return CfgMgr.RD53SimTool(name, **kwargs) def BarrelFEI4SimTool(name="BarrelFEI4SimTool", **kwargs): kwargs.setdefault("BarrelEC", 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) return CfgMgr.FEI4SimTool(name, **kwargs) def DBMFEI4SimTool(name="DBMFEI4SimTool", **kwargs): kwargs.setdefault("BarrelEC", 4) - - 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) return CfgMgr.FEI4SimTool(name, **kwargs) def BarrelFEI3SimTool(name="BarrelFEI3SimTool", **kwargs): kwargs.setdefault("BarrelEC", 0) + return CfgMgr.FEI3SimTool(name, **kwargs) +def EndcapFEI3SimTool(name="EndcapFEI3SimTool", **kwargs): + kwargs.setdefault("BarrelEC", 2) + return CfgMgr.FEI3SimTool(name, **kwargs) + +def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs): + from AthenaCommon import CfgGetter + from AthenaCommon.AppMgr import ServiceMgr + from AthenaCommon.AppMgr import ToolSvc + from AthenaCommon.CfgGetter import getService + from IOVDbSvc.CondDB import conddb + +############################################################################################ +# Set up Pixel Module data +############################################################################################ + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixMapOverlay", className="CondAttrListCollection") from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + + from AthenaCommon.BeamFlags import jobproperties + if jobproperties.Beam.beamType == "cosmics" : + PixelConfigCondAlg.UseComTime=True + PixelConfigCondAlg.BarrelTimeJitter=[25.0,25.0,25.0,25.0] + PixelConfigCondAlg.EndcapTimeJitter=[25.0,25.0,25.0] + PixelConfigCondAlg.DBMTimeJitter=[25.0,25.0,25.0] + PixelConfigCondAlg.BarrelNumberOfBCID=[8,8,8,8] + PixelConfigCondAlg.EndcapNumberOfBCID=[8,8,8] + PixelConfigCondAlg.DBMNumberOfBCID=[8,8,8] + PixelConfigCondAlg.BarrelTimeOffset=[100.0,100.0,100.0,100.0] + PixelConfigCondAlg.EndcapTimeOffset=[100.0,100.0,100.0] + PixelConfigCondAlg.DBMTimeOffset=[100.0,100.0,100.0] + else: + PixelConfigCondAlg.UseComTime=False + PixelConfigCondAlg.BarrelTimeJitter=[0.0,0.0,0.0,0.0] + PixelConfigCondAlg.EndcapTimeJitter=[0.0,0.0,0.0] + PixelConfigCondAlg.DBMTimeJitter=[0.0,0.0,0.0] + PixelConfigCondAlg.BarrelNumberOfBCID=[1,1,1,1] + PixelConfigCondAlg.EndcapNumberOfBCID=[1,1,1] + PixelConfigCondAlg.DBMNumberOfBCID=[1,1,1] + PixelConfigCondAlg.BarrelTimeOffset=[5.0,5.0,5.0,5.0] + PixelConfigCondAlg.EndcapTimeOffset=[5.0,5.0,5.0] + PixelConfigCondAlg.DBMTimeOffset=[5.0,5.0,5.0] + + PixelConfigCondAlg.BunchSpace=25.0 + + PixelConfigCondAlg.UseCalibConditions=True + 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] + PixelConfigCondAlg.BarrelNoiseOccupancy=[5e-8,5e-8,5e-8,5e-8] + PixelConfigCondAlg.BarrelDisableProbability=[9e-3,9e-3,9e-3,9e-3] - 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) + PixelConfigCondAlg.IBLNoiseShape=[0.0,1.0] + PixelConfigCondAlg.BLayerNoiseShape=[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] + PixelConfigCondAlg.PixelNoiseShape=[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] -def EndcapFEI3SimTool(name="EndcapFEI3SimTool", **kwargs): - kwargs.setdefault("BarrelEC", 2) + PixelConfigCondAlg.FEI3BarrelLatency=[ -1, 151, 256, 256] + PixelConfigCondAlg.FEI3BarrelHitDuplication=[False, False, False, False] + PixelConfigCondAlg.FEI3BarrelSmallHitToT=[-1, -1, -1, -1] + PixelConfigCondAlg.FEI3BarrelTimingSimTune=[2015,2015,2015,2015] + + PixelConfigCondAlg.FEI4BarrelHitDiscConfig=[2] - 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] + PixelConfigCondAlg.EndcapNoiseOccupancy=[5e-8,5e-8,5e-8] + PixelConfigCondAlg.EndcapDisableProbability=[9e-3,9e-3,9e-3] + PixelConfigCondAlg.EndcapNoiseShape=[[0.0,1.0],[0.0,1.0],[0.0,1.0]] - 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) + PixelConfigCondAlg.FEI3EndcapLatency=[256, 256, 256] + PixelConfigCondAlg.FEI3EndcapHitDuplication=[False, False, False] + PixelConfigCondAlg.FEI3EndcapSmallHitToT=[-1, -1, -1] + PixelConfigCondAlg.FEI3EndcapTimingSimTune=[2015,2015,2015] -def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs): - from AthenaCommon import CfgGetter - from AthenaCommon.Resilience import protectedInclude - from AthenaCommon.Include import include - from AthenaCommon.AppMgr import ServiceMgr - from AthenaCommon.AppMgr import ToolSvc - from AthenaCommon.CfgGetter import getService - if not hasattr(ToolSvc, "PixelConditionsSummaryTool"): - from PixelConditionsTools.PixelConditionsSummaryToolSetup import PixelConditionsSummaryToolSetup - pixelConditionsSummaryToolSetup = PixelConditionsSummaryToolSetup() - pixelConditionsSummaryToolSetup.setUseConditions(True) - pixelConditionsSummaryToolSetup.setUseDCSState(False) - pixelConditionsSummaryToolSetup.setUseByteStream(False) - pixelConditionsSummaryToolSetup.setUseTDAQ(False) - pixelConditionsSummaryToolSetup.setUseDeadMap(True) - pixelConditionsSummaryToolSetup.setup() - protectedInclude("PixelConditionsServices/PixelCalibSvc_jobOptions.py") - from IOVDbSvc.CondDB import conddb - conddb.addFolderSplitMC("PIXEL","/PIXEL/ReadoutSpeed","/PIXEL/ReadoutSpeed") + 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.DBMNoiseOccupancy=[5e-8,5e-8,5e-8] + PixelConfigCondAlg.DBMDisableProbability=[9e-3,9e-3,9e-3] + PixelConfigCondAlg.DBMNoiseShape=[[0.0,1.0],[0.0,1.0],[0.0,1.0]] + PixelConfigCondAlg.FEI4EndcapHitDiscConfig=[2,2,2] + + condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg") +############################################################################################ + + ############################ + # Setup charge calibration # + ############################ + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") + + ################# + # Setup deadmap # + ################# + from PixelConditionsTools.PixelConditionsSummaryToolSetup import PixelConditionsSummaryToolSetup + pixelConditionsSummaryToolSetup = PixelConditionsSummaryToolSetup() + pixelConditionsSummaryToolSetup.setUseConditions(True) + pixelConditionsSummaryToolSetup.setUseDCSState(False) + pixelConditionsSummaryToolSetup.setUseByteStream(False) + pixelConditionsSummaryToolSetup.setUseTDAQ(False) + pixelConditionsSummaryToolSetup.setUseDeadMap(True) + pixelConditionsSummaryToolSetup.setup() + + ####################### + # Setup Lorentz angle # + ####################### + from SiPropertiesTool.PixelSiPropertiesToolSetup import PixelSiPropertiesToolSetup + pixelSiPropertiesToolSetup = PixelSiPropertiesToolSetup() + pixelSiPropertiesToolSetup.setup() + + from SiLorentzAngleTool.PixelLorentzAngleToolSetup import PixelLorentzAngleToolSetup + pixelLorentzAngleToolSetup = PixelLorentzAngleToolSetup() + + ##################### + # Setup Cabling Svc # + ##################### PixelCablingSvc = getService("PixelCablingSvc") ServiceMgr += PixelCablingSvc print PixelCablingSvc kwargs.setdefault("InputObjectName", "PixelHits") - 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") diff --git a/InnerDetector/InDetDigitization/PixelDigitization/share/DigitizationTst.py b/InnerDetector/InDetDigitization/PixelDigitization/share/DigitizationTst.py deleted file mode 100644 index 6febe18a398f6968a656cac236d4ae5d66476505..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDigitization/PixelDigitization/share/DigitizationTst.py +++ /dev/null @@ -1,112 +0,0 @@ -########################################### -# A short script to test PixelDigitization -########################################### -# -# Set auditors to use. -# Chrono: time used by algos -# Name: print info upon entry/exit of init/exec/fina routines of the algo -# MemStat: memory usage -# -theApp.Dlls += [ "GaudiAud" ] -theAuditorSvc.Auditors += [ "ChronoAuditor"] -theAuditorSvc.Auditors += [ "NameAuditor" ] -theAuditorSvc.Auditors += [ "MemStatAuditor" ] -MemStatAuditor = theAuditorSvc.auditor( "MemStatAuditor" ) -theApp.AuditAlgorithms=True -MemStatAuditor.OutputLevel = INFO -# -# Pixel digitization using a configurable class. -# -from AthenaCommon.Logging import logging -logger = logging.getLogger("PixelDigitization") - -# -# Get flags -# -from AthenaCommon.AthenaCommonFlags import jobproperties -jobproperties.AthenaCommonFlags.EvtMax=5 -# -# define input hits and output digits -# -#jobproperties.AthenaCommonFlags.PoolHitsInput=["rfio:/castor/cern.ch/user/s/svahsen/digitization/RTT/calib1_csc11.005200.T1_McAtNlo_Jimmy.simul.HITS.v12003104_tid004131._00069.pool.root.10"] -jobproperties.AthenaCommonFlags.PoolHitsInput=["/afs/cern.ch/user/t/tegen/scratch0/calib1_csc11.005200.T1_McAtNlo_Jimmy.simul.HITS.v12003104_tid004131._00069.pool.root.10"] -jobproperties.AthenaCommonFlags.PoolRDOOutput="DigitizationOutput.pool.root" - -# -# Flags that are defined in python are best set here -# switch off ID and muons -# -from AthenaCommon.DetFlags import DetFlags -DetFlags.ID_setOn() -DetFlags.SCT_setOn() -DetFlags.TRT_setOff() -DetFlags.Calo_setOff() -DetFlags.Muon_setOff() -DetFlags.Truth_setOn() -DetFlags.LVL1_setOff() - - -from AthenaCommon.GlobalFlags import jobproperties -jobproperties.Global.DetDescrVersion='ATLAS-CSC-01-02-00' -#GeoModelSvc = Service( "GeoModelSvc" ) -#GeoModelSvc.IgnoreTagDifference = True - -include("Digitization/Digitization.py") -# -# PixelDigitization configurable is added to the job sequence in -# PixelDigitization_jobOptions.py. -# It can be accessed by job.PixelDigitization as below. -# -from AthenaCommon.AlgSequence import AlgSequence -job = AlgSequence() -if 'PixelDigitization' in dir(job): - # - # set audit flags - # - job.PixelDigitization.AuditInitialize = True - job.PixelDigitization.AuditExecute = True - job.PixelDigitization.AuditFinalize = True - # - # set whether or not to use cond DB. - # - job.PixelDigitization.UseCalibCondDB = True - job.PixelDigitization.UsePixMapCondDB = True - job.PixelDigitization.UsePixCondSum = True - # - # set various enable flags - # - job.PixelDigitization.EnableHits = True - job.PixelDigitization.EnableNoise = True - - # - # create RDOs for special pixel map monitoring - # - job.PixelDigitization.RDOforSPM = True - - # - # simulate special pixels - only used if UsePixMapCondDB = False - # - job.PixelDigitization.SpmNoiseProb = 0.00001 - job.PixelDigitization.SpmDisableProb = 0.00002 - job.PixelDigitization.SpmNoBumpProb = 0.00050 - job.PixelDigitization.SpmBadTOTProb = 0.00050 - - # simulated IOV - setIOV[once,all,step,rnd] - job.PixelDigitization.setIOVonce() - - # - # Probabilities for random noise/in-efficiency. - # The below probabilities are independent of special pixels. - # They simulate random 'unknown' effects. - # - job.PixelDigitization.RndNoiseProb = 5e-8 - job.PixelDigitization.RndDisableProb = 0.0 - -else: - logger.warning("PixelDigitization configurable not found in AlgSequence() - assuming oldstyle setup is used.") - -# -MessageSvc.OutputLevel = INFO -# - - diff --git a/InnerDetector/InDetDigitization/PixelDigitization/share/postOptions.IBL_Digitization.py b/InnerDetector/InDetDigitization/PixelDigitization/share/postOptions.IBL_Digitization.py deleted file mode 100644 index 7d3130b945023f224aae2c8d8cf16544b467ef2f..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDigitization/PixelDigitization/share/postOptions.IBL_Digitization.py +++ /dev/null @@ -1,66 +0,0 @@ -########################################## -# Comments -# Requested for IBL Digitization studies -########################################## - -from AthenaCommon.AlgSequence import AlgSequence -job = AlgSequence() - -########################################################### -## Add Pixel and SCT SiHitCollections to outputStream, if required -outStreams = AlgSequence( "Streams" ) -if hasattr(outStreams, 'StreamRDO'): - outStream = outStreams.StreamRDO -elif hasattr(outStreams, 'Stream1'): - # Legacy only - # this option will be removed after 15.6.X - outStream = outStreams.Stream1 -if 'outStream' in dir(): - outStream.ItemList+=["SiHitCollection#PixelHits"] - outStream.ItemList+=["SiHitCollection#SCT_Hits"] - -########################################################### -## Disable some Pixel stuff -from PixelGeoModel.PixelGeoModelConf import PixelDetectorTool -pixelTool = PixelDetectorTool() -pixelTool.Alignable = False - -from Digitization.DigitizationFlags import digitizationFlags -if not digitizationFlags.doXingByXingPileUp(): - ## Check PixelDigitization is defined in the AlgSequence - if hasattr(job,'PixelDigitization'): - pix = job.PixelDigitization - else: - ## return an error here? - print "PixelDigitization not found in AlgSequence" -else: - ## Check for PixelDigitizationTool in list of PileUpTools - try: - print "trying to setup PixelDigitizationTool..." - pix = job.PileUpToolsAlg.PileUpTools[ "PixelDigitizationTool" ] - except: - ## return an error here? - print "PixelDigitizationTool not found in list of PileUpTools" - -from AthenaCommon import CfgGetter -pix=CfgGetter.getPublicTool("PixelDigitizationTool",checkType=True) -CalibSvc = CfgGetter.getService("CalibSvc") - -CalibSvc.UseCalibCondDB = False -CalibSvc.UsePixMapCondDB = False -pix.EnableSpecialPixels = False -#pix.DisableDistortions = True - -########################################################### -## SLHC Flags -## Leave commented out unless overriding with text file. -## Default is to use Geom DB only -#from InDetIBL_Example.SLHC_JobProperties import SLHC_Flags -#SLHC_Flags.SLHC_Version = "IBL-01" - - -########################################################### -## SLHC setup -## Set the path variables consistently -from InDetIBL_Example.SLHC_Setup import SLHC_Setup -SLHC_Setup = SLHC_Setup() diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx index d7adbe43ef1d30055cd317d8030cdf6f0a6c0077..8d6da081e46f6760add8ce6d67cf6e92d2ccceb7 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.cxx @@ -5,10 +5,8 @@ #include "FEI3SimTool.h" FEI3SimTool::FEI3SimTool( const std::string& type, const std::string& name,const IInterface* parent): - FrontEndSimTool(type,name,parent), - m_timingTune(2015) + FrontEndSimTool(type,name,parent) { - declareProperty("TimingTune", m_timingTune, "Version of the timing calibration"); } FEI3SimTool::~FEI3SimTool() { } @@ -31,6 +29,7 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast<const PixelID *>(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); @@ -38,13 +37,14 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (abs(barrel_ec)!=m_BarrelEC) { return; } - SG::ReadCondHandle<PixelModuleData> module_data(m_moduleDataKey); + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); // Add cross-talk - CrossTalk(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); + CrossTalk(moduleData->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes, rndmEngine); + ThermalNoise(moduleData->getThermalNoise(barrel_ec,layerIndex),chargedDiodes, rndmEngine); // Add random noise RandomNoise(chargedDiodes, rndmEngine); @@ -82,48 +82,48 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } } - for (SiChargedDiodeIterator i_chargedDiode=chargedDiodes.begin(); i_chargedDiode!=chargedDiodes.end(); ++i_chargedDiode) { Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analog threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); - double ith0 = m_pixelCalibSvc->getTimeWalk(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); + double ith0 = calibData->getInTimeThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); double intimethreshold = (ith0/th0)*threshold; if (charge>threshold) { - int bunchSim; + int bunchSim = 0; if ((*i_chargedDiode).second.totalCharge().fromTrack()) { - if (m_timingTune==2015) { bunchSim = relativeBunch2015((*i_chargedDiode).second.totalCharge(),barrel_ec,layerIndex,moduleIndex, rndmEngine); } - else { bunchSim = relativeBunch2009(threshold,intimethreshold,(*i_chargedDiode).second.totalCharge(), rndmEngine); } + if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)==2015) { bunchSim = relativeBunch2015((*i_chargedDiode).second.totalCharge(),barrel_ec,layerIndex,moduleIndex, rndmEngine); } + else if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)==2009) { bunchSim = relativeBunch2009(threshold,intimethreshold,(*i_chargedDiode).second.totalCharge(), rndmEngine); } } else { - bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,m_timeBCN); + if (moduleData->getFEI3TimingSimTune(barrel_ec,layerIndex)>0) { bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,moduleData->getNumberOfBCID(barrel_ec,layerIndex)); } } - if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + if (bunchSim<0 || bunchSim>moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (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); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine,tot,totsig)); if (nToT<1) { nToT=1; } - if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=moduleData->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (nToT>=module_data->getLatency(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT>=moduleData->getFEI3Latency(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } @@ -141,22 +141,21 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const Identifier id_readout = chargedDiodes.element()->identifierFromCellId(cellId); // Front-End simulation - if (bunch>=0 && bunch<m_timeBCN) { + if (bunch>=0 && bunch<moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch,0,bunch); rdoCollection.push_back(p_rdo); + p_rdo = nullptr; } // Duplication mechanism for FEI3 small hits : - bool hitDupli = false; - if (module_data->getHitDuplication(barrel_ec,layerIndex)) { hitDupli=true; } - - if (hitDupli) { + if (moduleData->getFEI3HitDuplication(barrel_ec,layerIndex)) { bool smallHitChk = false; - if (nToT<=module_data->getSmallHitToT(barrel_ec,layerIndex)) { smallHitChk=true; } + if (nToT<=moduleData->getFEI3SmallHitToT(barrel_ec,layerIndex)) { smallHitChk=true; } - if (smallHitChk && bunch>0 && bunch<=m_timeBCN) { + if (smallHitChk && bunch>0 && bunch<=moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch-1,0,bunch-1); rdoCollection.push_back(p_rdo); + p_rdo = nullptr; } } } @@ -169,6 +168,8 @@ int FEI3SimTool::relativeBunch2009(const double threshold, const double intimeth double myTimeWalkEff = 0.; double overdrive = intimethreshold - threshold ; + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); + //my TimeWalk computation through PARAMETRIZATION (by Francesco De Lorenzi - Milan) //double curvature = 7.6e7*overdrive-2.64e10; //double divergence = -1.6*overdrive+942 ; @@ -182,13 +183,13 @@ int FEI3SimTool::relativeBunch2009(const double threshold, const double intimeth myTimeWalkEff = myTimeWalk+myTimeWalk*0.2*CLHEP::RandGaussZiggurat::shoot(rndmEngine); - double randomjitter = CLHEP::RandFlat::shoot(rndmEngine,(-m_timeJitter/2.0),(m_timeJitter/2.0)); + double randomjitter = CLHEP::RandFlat::shoot(rndmEngine,(-moduleData->getTimeJitter(0,1)/2.0),(moduleData->getTimeJitter(0,1)/2.0)); //double G4Time = totalCharge.time(); double G4Time = getG4Time(totalCharge); - double timing = m_timeZero+myTimeWalkEff+(randomjitter)+G4Time-m_comTime; - BCID = static_cast<int>(floor(timing/m_timePerBCO)); + double timing = moduleData->getTimeOffset(0,1)+myTimeWalkEff+(randomjitter)+G4Time-moduleData->getComTime(); + BCID = static_cast<int>(floor(timing/moduleData->getBunchSpace())); //ATH_MSG_DEBUG ( CTW << " , " << myTimeWalkEff << " , " << G4Time << " , " << timing << " , " << BCID ); return BCID; @@ -217,6 +218,7 @@ int FEI3SimTool::relativeBunch2015(const SiTotalCharge &totalCharge, int barrel_ * 60% working point tune-2 */ + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); double prob = 0.0; if (barrel_ec==0 && layer_disk==1) { if (abs(moduleID)==0) { @@ -399,7 +401,7 @@ int FEI3SimTool::relativeBunch2015(const SiTotalCharge &totalCharge, int barrel_ double timeWalk = 0.0; if (rnd<prob) { timeWalk = 25.0; } - int BCID = static_cast<int>(floor((G4Time+m_timeZero+timeWalk)/m_timePerBCO)); + int BCID = static_cast<int>(floor((G4Time+moduleData->getTimeOffset(barrel_ec,layer_disk)+timeWalk)/moduleData->getBunchSpace())); return BCID; } diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h index f0a243bbf21f429193113ac6f6ac464212a41671..a0c978a15ca2afe2865a1f50e784cf26b0a15cba 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI3SimTool.h @@ -21,10 +21,7 @@ class FEI3SimTool:public FrontEndSimTool { private: FEI3SimTool(); - int m_timingTune; - int relativeBunch2009(const double threshold, const double intimethreshold, const SiTotalCharge &totalCharge, CLHEP::HepRandomEngine *rndmEngine) const; - int relativeBunch2015(const SiTotalCharge &totalCharge, int barrel_ec, int layer_disk, int moduleID, CLHEP::HepRandomEngine *rndmEngine) const; }; diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx index 147ee43bb419564de6804d1346dbc173ada1cc7c..1a32968b36308406403882ca782eba2c0e50eead 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FEI4SimTool.cxx @@ -30,16 +30,18 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast<const PixelID *>(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); if (abs(barrel_ec)!=m_BarrelEC) { return; } - SG::ReadCondHandle<PixelModuleData> module_data(m_moduleDataKey); + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); int maxFEI4SmallHit = 2; - int overflowToT = module_data->getIBLOverflowToT(); + int overflowToT = moduleData->getFEI4OverflowToT(barrel_ec,layerIndex); std::vector<Pixel1RawData*> p_rdo_small_fei4; int nSmallHitsFEI4 = 0; @@ -49,10 +51,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(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); + CrossTalk(moduleData->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes,rndmEngine); + ThermalNoise(moduleData->getThermalNoise(barrel_ec,layerIndex),chargedDiodes,rndmEngine); // Add random noise RandomNoise(chargedDiodes,rndmEngine); @@ -65,46 +67,42 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); if (charge>threshold) { int bunchSim; if ((*i_chargedDiode).second.totalCharge().fromTrack()) { - bunchSim = static_cast<int>(floor((getG4Time((*i_chargedDiode).second.totalCharge())+m_timeZero)/m_timePerBCO)); + bunchSim = static_cast<int>(floor((getG4Time((*i_chargedDiode).second.totalCharge())+moduleData->getTimeOffset(barrel_ec,layerIndex))/moduleData->getBunchSpace())); } else { - bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,m_timeBCN); + bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,moduleData->getNumberOfBCID(barrel_ec,layerIndex)); } - if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + if (bunchSim<0 || bunchSim>moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (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); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine,tot,totsig)); - const PixelID* pixelId = static_cast<const PixelID*>(chargedDiodes.element()->getIdHelper()); - if (pixelId->is_dbm(chargedDiodes.element()->identify())) { - nToT = 8*(charge - 1200. )/(8000. - 1200.); - } - if (nToT<1) { nToT=1; } // FEI4 HitDiscConfig if (nToT==2 && maxFEI4SmallHit==2) { nToT=1; } if (nToT>=overflowToT) { nToT=overflowToT; } - if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=moduleData->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } @@ -126,7 +124,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (iicol>=maxCol) { iicol=iicol-maxCol; } // FEI4 copy mechanism works per FE. // Front-End simulation - if (bunch>=0 && bunch<m_timeBCN) { + if (bunch>=0 && bunch<moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch,0,bunch); if (nToT>maxFEI4SmallHit) { rdoCollection.push_back(p_rdo); @@ -139,6 +137,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle FEI4Map[iirow][iicol] = 1; //Flag for low hits nSmallHitsFEI4++; } + p_rdo = nullptr; } } @@ -175,7 +174,6 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } } } - return; } diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h index 54e8e936d8445fd18e5e9ac1b753a615760b6243..37612a73994261a4e6a6d4c8dad3aa05c22bdd8c 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h @@ -16,17 +16,16 @@ #include "SiDigitization/SiChargedDiodeCollection.h" #include "InDetRawData/InDetRawDataCLASS_DEF.h" +#include "PixelCabling/IPixelCablingSvc.h" #include "InDetConditionsSummaryService/IInDetConditionsTool.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "InDetSimEvent/SiTotalCharge.h" #include "SiDigitization/SiHelper.h" #include "InDetReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SiCellId.h" -#include "CommissionEvent/ComTime.h" - #include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "StoreGate/ReadHandle.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/ReadCondHandleKey.h" @@ -38,31 +37,10 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { public: FrontEndSimTool( const std::string& type, const std::string& name,const IInterface* parent): AthAlgTool(type,name,parent), - m_pixelCalibSvc("PixelCalibSvc",name), - m_timeBCN(1), - m_timeZero(5.0), - m_timePerBCO(25.0), - m_comTime(0.0), - m_useComTime(false), - m_timeJitter(0.0), - m_ComTimeKey("ComTime"), - m_eventStore("StoreGateSvc", name), - m_BarrelEC(0), - m_noiseShape({0.0,1.0}), - m_noiseOccupancy(1e-8), - m_disableProbability(9e-3) + m_BarrelEC(0) { declareInterface<FrontEndSimTool>(this); - declareProperty("PixelCalibSvc", m_pixelCalibSvc); - declareProperty("TimeBCN", m_timeBCN, "Number of BCID"); - declareProperty("TimeZero", m_timeZero, "Time zero...?"); - declareProperty("TimePerBCO", m_timePerBCO, "Time per BCO - should be 25ns"); - declareProperty("UseComTime", m_useComTime, "Use ComTime for timing"); - declareProperty("TimeJitter", m_timeJitter, "Time jitter"); declareProperty("BarrelEC", m_BarrelEC, "Index of barrel or endcap"); - declareProperty("NoiseShape", m_noiseShape, "Vector containing noise ToT shape"); - declareProperty("NoiseOccupancy", m_noiseOccupancy); - declareProperty("DisableProbability", m_disableProbability); } static const InterfaceID& interfaceID() { return IID_IFrontEndSimTool; } @@ -70,21 +48,10 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { virtual StatusCode initialize() { ATH_CHECK(m_pixelConditionsTool.retrieve()); - ATH_CHECK(m_pixelCalibSvc.retrieve()); - + ATH_CHECK(m_pixelCabling.retrieve()); ATH_CHECK(m_moduleDataKey.initialize()); + ATH_CHECK(m_chargeDataKey.initialize()); - ATH_CHECK(m_ComTimeKey.initialize(m_useComTime)); - if (m_useComTime) { - SG::ReadHandle<ComTime> comTime(m_ComTimeKey); - if (comTime.isValid()) { - m_comTime = comTime->getTime(); - ATH_MSG_DEBUG("Found tool for cosmic/commissioning timing: ComTime"); - } - else { - ATH_MSG_WARNING("Did not find tool needed for cosmic/commissioning timing: ComTime"); - } - } return StatusCode::SUCCESS; } @@ -131,8 +98,16 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { } void RandomNoise(SiChargedDiodeCollection &chargedDiodes, CLHEP::HepRandomEngine *rndmEngine) const { + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&(chargedDiodes.element())->design()); - int nNoise = CLHEP::RandPoisson::shoot(rndmEngine, p_design->numberOfCircuits()*p_design->columnsPerCircuit()*p_design->rowsPerCircuit()*m_noiseOccupancy*static_cast<double>(m_timeBCN)); + + const PixelID* pixelId = static_cast<const PixelID *>(chargedDiodes.element()->getIdHelper()); + const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); + int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); + int nNoise = CLHEP::RandPoisson::shoot(rndmEngine, p_design->numberOfCircuits()*p_design->columnsPerCircuit()*p_design->rowsPerCircuit()*moduleData->getNoiseOccupancy(barrel_ec,layerIndex)*static_cast<double>(moduleData->getNumberOfBCID(barrel_ec,layerIndex))); + for (int i=0; i<nNoise; i++) { int circuit = CLHEP::RandFlat::shootInt(rndmEngine,p_design->numberOfCircuits()); int column = CLHEP::RandFlat::shootInt(rndmEngine,p_design->columnsPerCircuit()); @@ -147,13 +122,16 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { double x = CLHEP::RandFlat::shoot(rndmEngine,0.,1.); int bin=0; - for (size_t j=1; j<m_noiseShape.size(); j++) { - if (x>m_noiseShape[j-1] && x<=m_noiseShape[j]) { bin=j-1; continue; } + std::vector<float> noiseShape = moduleData->getNoiseShape(barrel_ec,layerIndex); + for (size_t j=1; j<noiseShape.size(); j++) { + if (x>noiseShape[j-1] && x<=noiseShape[j]) { bin=j-1; continue; } } double noiseToTm = bin+1.5; double noiseToT = CLHEP::RandGaussZiggurat::shoot(rndmEngine,noiseToTm,1.); - double chargeShape = m_pixelCalibSvc->getCharge(noisyID,noiseToT); + int type = m_pixelCabling->getPixelType(noisyID); + double chargeShape = calibData->getCharge((int)moduleHash, circuit, type, noiseToT); + chargedDiodes.add(diodeNoise,SiCharge(chargeShape,0,SiCharge::noise)); } } @@ -161,36 +139,35 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { } void RandomDisable(SiChargedDiodeCollection &chargedDiodes, CLHEP::HepRandomEngine *rndmEngine) const { + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); + const PixelID* pixelId = static_cast<const PixelID *>(chargedDiodes.element()->getIdHelper()); + int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); + int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); for (SiChargedDiodeIterator i_chargedDiode=chargedDiodes.begin(); i_chargedDiode!=chargedDiodes.end(); ++i_chargedDiode) { - if (CLHEP::RandFlat::shoot(rndmEngine)<m_disableProbability) { + if (CLHEP::RandFlat::shoot(rndmEngine)<moduleData->getDisableProbability(barrel_ec,layerIndex)) { SiHelper::disabled((*i_chargedDiode).second,true,false); } } return; } - private: FrontEndSimTool(); protected: - 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; - double m_comTime; /**< cosmics timing ofs */ - bool m_useComTime; /**< use ComTime for timing */ - double m_timeJitter; - SG::ReadHandleKey<ComTime> m_ComTimeKey; - ServiceHandle<StoreGateSvc> m_eventStore; + ToolHandle<IInDetConditionsTool> m_pixelConditionsTool + {this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; + + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; + int m_BarrelEC; - std::vector<double> m_noiseShape; - double m_noiseOccupancy; - double m_disableProbability; double getG4Time(const SiTotalCharge &totalCharge) const { // If there is one single charge, return its time: diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx index d3cd5b8b431d7cd8425ba810f28658c1eca6fb27..4808a7924c208331b1252d60a91bf851445b31a0 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx @@ -37,16 +37,18 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast<const PixelID *>(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); if (abs(barrel_ec)!=m_BarrelEC) { return; } - SG::ReadCondHandle<PixelModuleData> module_data(m_moduleDataKey); + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); //int maxRD53SmallHit = 0; unused - int overflowToT = 256; + int overflowToT = moduleData->getFEI4OverflowToT(barrel_ec,layerIndex); std::vector<Pixel1RawData*> p_rdo_small_fei4; //int nSmallHitsRD53 = 0; unused @@ -56,10 +58,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(module_data->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); + CrossTalk(moduleData->getCrossTalk(barrel_ec,layerIndex),chargedDiodes); // Add thermal noise - ThermalNoise(module_data->getThermalNoise(barrel_ec,layerIndex),chargedDiodes,rndmEngine); + ThermalNoise(moduleData->getThermalNoise(barrel_ec,layerIndex),chargedDiodes,rndmEngine); // Add random noise RandomNoise(chargedDiodes,rndmEngine); @@ -72,33 +74,34 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(rndmEngine); if (charge>threshold) { int bunchSim = 0; if ((*i_chargedDiode).second.totalCharge().fromTrack()) { - bunchSim = static_cast<int>(floor((getG4Time((*i_chargedDiode).second.totalCharge())+m_timeZero)/m_timePerBCO)); + bunchSim = static_cast<int>(floor((getG4Time((*i_chargedDiode).second.totalCharge())+moduleData->getTimeOffset(barrel_ec,layerIndex))/moduleData->getBunchSpace())); } else { - bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,m_timeBCN); + bunchSim = CLHEP::RandFlat::shootInt(rndmEngine,moduleData->getNumberOfBCID(barrel_ec,layerIndex)); } - if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + if (bunchSim<0 || bunchSim>moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - if (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); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(rndmEngine,tot,totsig)); if (nToT<1) { nToT=1; } @@ -106,7 +109,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle // RD53 HitDiscConfig if (nToT>=overflowToT) { nToT=overflowToT; } - if (nToT<=module_data->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } + if (nToT<=moduleData->getToTThreshold(barrel_ec,layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // Filter events if (SiHelper::isMaskOut((*i_chargedDiode).second)) { continue; } @@ -128,7 +131,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (iicol>=maxCol) { iicol=iicol-maxCol; } // RD53 copy mechanism works per FE. // Front-End simulation - if (bunch>=0 && bunch<m_timeBCN) { + if (bunch>=0 && bunch<moduleData->getNumberOfBCID(barrel_ec,layerIndex)) { Pixel1RawData *p_rdo = new Pixel1RawData(id_readout,nToT,bunch,0,bunch); //see commented code below for clarification why this is always executed rdoCollection.push_back(p_rdo); @@ -150,6 +153,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle RD53Map[iirow][iicol] = 1; //Flag for low hits nSmallHitsRD53++; } **/ + p_rdo = nullptr; } } // again, the following code is never reached but left here for the developer to comment diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/PixelRadDamDigitization/CMakeLists.txt index 171b4db8364263c9c91adf2557f96911126d399a..90d2b8df0fbdcd1386d8e4df0ad5a62c4f9a5c28 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/CMakeLists.txt @@ -24,6 +24,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/SiPropertiesTool InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDigitization/SiDigitization InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetRawEvent/InDetSimData diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI3SimTool.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI3SimTool.cxx index 49e008842b83be16b6d083cb6cffcc790261d64d..bc0ee3bf6c1926e1804f8ce58b146511fd7f4ecb 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI3SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI3SimTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "FEI3SimTool.h" @@ -48,11 +48,14 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast<const PixelID *>(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); int moduleIndex = pixelId->eta_module(chargedDiodes.element()->identify()); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + // Merge ganged pixel for (SiChargedDiodeIterator i_chargedDiode=chargedDiodes.begin(); i_chargedDiode!=chargedDiodes.end(); ++i_chargedDiode) { InDetDD::SiCellId cellID = chargedDiodes.element()->cellIdFromIdentifier(chargedDiodes.getId((*i_chargedDiode).first)); @@ -88,11 +91,14 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); - double ith0 = m_pixelCalibSvc->getTimeWalk(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); + double ith0 = calibData->getInTimeThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); double intimethreshold = (ith0/th0)*threshold; if (charge>threshold) { @@ -106,7 +112,7 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); @@ -116,8 +122,8 @@ void FEI3SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (barrel_ec!=0 && charge<m_EndcapAnalogthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // charge to ToT conversion - double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(m_rndmEngine,tot,totsig)); if (nToT<1) { nToT=1; } diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI4SimTool.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI4SimTool.cxx index dbbe2dbe423b2adc57e251d7224ea579182c51f4..edebd4e1b8af73e741de0e4848153bd7b9785a2b 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI4SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FEI4SimTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "FEI4SimTool.h" @@ -45,6 +45,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast<const PixelID *>(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); int maxFEI4SmallHit = 2; int overflowToT = 16; @@ -55,6 +56,8 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + std::vector<Pixel1RawData*> p_rdo_small_fei4; int nSmallHitsFEI4 = 0; std::vector<int> row, col; @@ -67,10 +70,13 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); if (charge>threshold) { int bunchSim; @@ -82,7 +88,7 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); @@ -92,8 +98,8 @@ void FEI4SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (barrel_ec!=0 && charge<m_EndcapAnalogthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // charge to ToT conversion - double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(m_rndmEngine,tot,totsig)); const PixelID* pixelId = static_cast<const PixelID*>(chargedDiodes.element()->getIdHelper()); diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FrontEndSimTool.h b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FrontEndSimTool.h index 75ce3be9df72eb582d82685385a328de194c4be3..d938c6a2be29aad50a36883e0162a8b6c280c4a5 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FrontEndSimTool.h +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/FrontEndSimTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef PIXELDIGITIZATION_FrontEndSimTool_H @@ -16,9 +16,13 @@ #include "InDetRawData/InDetRawDataCLASS_DEF.h" #include "InDetConditionsSummaryService/IInDetConditionsSvc.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "InDetSimEvent/SiTotalCharge.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" + #include "CommissionEvent/ComTime.h" static const InterfaceID IID_IFrontEndSimTool("FrontEndSimTool", 1, 0); @@ -32,7 +36,6 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { m_rndmEngineName("PixelDigitization"), m_rndmEngine(nullptr), m_pixelConditionsSvc("PixelConditionsSummarySvc",name), - m_pixelCalibSvc("PixelCalibSvc",name), m_timeBCN(1), m_timeZero(5.0), m_timePerBCO(25.0), @@ -52,7 +55,6 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { declareProperty("RndmSvc", m_rndmSvc, "Random number service used in FE simulation"); declareProperty("RndmEngine", m_rndmEngineName, "Random engine name"); declareProperty("PixelConditionsSummarySvc", m_pixelConditionsSvc); - declareProperty("PixelCalibSvc", m_pixelCalibSvc); declareProperty("TimeBCN", m_timeBCN, "Number of BCID"); declareProperty("TimeZero", m_timeZero, "Time zero...?"); declareProperty("TimePerBCO", m_timePerBCO, "Time per BCO - should be 25ns"); @@ -75,7 +77,9 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { CHECK(m_pixelConditionsSvc.retrieve()); - CHECK(m_pixelCalibSvc.retrieve()); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); + m_rndmEngine = m_rndmSvc->GetEngine(m_rndmEngineName); if (!m_rndmEngine) { @@ -113,7 +117,10 @@ class FrontEndSimTool:public AthAlgTool,virtual public IAlgTool { CLHEP::HepRandomEngine *m_rndmEngine; ServiceHandle<IInDetConditionsSvc> m_pixelConditionsSvc; - ServiceHandle<IPixelCalibSvc> m_pixelCalibSvc; + ServiceHandle<IPixelCablingSvc> m_pixelCabling{this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; double m_timeBCN; double m_timeZero; diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.cxx index c3c2d5d7b5efde5ccdecd9ec8a69226a50fba003..3a443e7732bbc631bbe0a60c7fe8904233ab5654 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.cxx +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -29,7 +29,6 @@ using namespace RadDam; PixelNoisyCellGenerator::PixelNoisyCellGenerator(const std::string& type, const std::string& name,const IInterface* parent): PixelProcessorTool(type,name,parent), - m_pixelCalibSvc("PixelCalibSvc", name), m_timeBCN(1), m_mergeCharge(false), m_pixelID{}, @@ -47,8 +46,8 @@ PixelNoisyCellGenerator::~PixelNoisyCellGenerator() {} StatusCode PixelNoisyCellGenerator::initialize() { CHECK(PixelProcessorTool::initialize()); - CHECK(m_pixelCalibSvc.retrieve()); - ATH_MSG_DEBUG("Retrieved PixelCalibSvc"); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); CHECK(detStore()->retrieve(m_pixelID,"PixelID")); @@ -100,6 +99,12 @@ void PixelNoisyCellGenerator::addRandomNoise(SiChargedDiodeCollection &collectio } void PixelNoisyCellGenerator::addCell(SiChargedDiodeCollection &collection,const InDetDD::PixelModuleDesign *design, int circuit, int column, int row) const { + + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + + const PixelID* pixelId = static_cast<const PixelID *>(collection.element()->getIdHelper()); + const IdentifierHash moduleHash = pixelId->wafer_hash(collection.identify()); // wafer hash + ATH_MSG_DEBUG("addCell 1 circuit = " << circuit << ", column = " << column << ", row = " << row); #ifdef __PIXEL_DEBUG__ ATH_MSG_DEBUG("addCell: circuit,column,row=" << circuit << "," << column << "," << row); @@ -137,7 +142,10 @@ void PixelNoisyCellGenerator::addCell(SiChargedDiodeCollection &collection,const ATH_MSG_DEBUG ( "addCell 7b circuit = " << circuit << ", column = " << column << ", row = " << row); ATH_MSG_DEBUG ( "addCell 7c circuit = " << circuit << ", column = " << column << ", row = " << row); - double chargeShape = m_pixelCalibSvc->getCharge(noisyID,ToT); + + int type = m_pixelCabling->getPixelType(noisyID); + double chargeShape = calibData->getCharge((int)moduleHash, circuit, type, ToT); + ATH_MSG_DEBUG ( "addCell 7d circuit = " << circuit << ", column = " << column << ", row = " << row); // const double chargeGauss = chargeOfs + chargeVar*CLHEP::RandGaussZiggurat::shoot( m_rndmEngine ); diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.h b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.h index 676b7e4f5c99cd08a4e67047745225cc2fec814d..cdaaafb16a187e9db765e26c977c68f0b4e6fd58 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.h +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/PixelNoisyCellGenerator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -13,7 +13,12 @@ #include "PixelProcessorTool.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/ReadCondHandleKey.h" + #include "InDetReadoutGeometry/SiDetectorElement.h" @@ -39,7 +44,15 @@ class PixelNoisyCellGenerator:public PixelProcessorTool { private: PixelNoisyCellGenerator(); - ServiceHandle<IPixelCalibSvc> m_pixelCalibSvc; + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; + double m_timeBCN; bool m_mergeCharge; std::vector<double> m_noiseShape; diff --git a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/RD53SimTool.cxx b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/RD53SimTool.cxx index 25e2810593c813ef0be000fe3a4f0f01a0663abe..bffd2672433b899f3e692af5c7eddf6de176ef37 100644 --- a/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/RD53SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelRadDamDigitization/src/RD53SimTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "RD53SimTool.h" @@ -39,6 +39,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle const PixelID* pixelId = static_cast<const PixelID *>(chargedDiodes.element()->getIdHelper()); const IdentifierHash moduleHash = pixelId->wafer_hash(chargedDiodes.identify()); // wafer hash + Identifier moduleID = pixelId->wafer_id(chargedDiodes.element()->identify()); //int maxRD53SmallHit = 0; int overflowToT = 256; @@ -46,6 +47,8 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle int barrel_ec = pixelId->barrel_ec(chargedDiodes.element()->identify()); int layerIndex = pixelId->layer_disk(chargedDiodes.element()->identify()); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + std::vector<Pixel1RawData*> p_rdo_small_fei4; //int nSmallHitsRD53 = 0; std::vector<int> row, col; @@ -58,10 +61,13 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle Identifier diodeID = chargedDiodes.getId((*i_chargedDiode).first); double charge = (*i_chargedDiode).second.charge(); + int circ = m_pixelCabling->getFE(&diodeID,moduleID); + int type = m_pixelCabling->getPixelType(diodeID); + // Apply analogu threshold, timing simulation - double th0 = m_pixelCalibSvc->getThreshold(diodeID); + double th0 = calibData->getAnalogThreshold((int)moduleHash, circ, type); - double threshold = th0+m_pixelCalibSvc->getThresholdSigma(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+m_pixelCalibSvc->getNoise(diodeID)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); + double threshold = th0+calibData->getAnalogThresholdSigma((int)moduleHash,circ,type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine)+calibData->getAnalogThresholdNoise((int)moduleHash, circ, type)*CLHEP::RandGaussZiggurat::shoot(m_rndmEngine); if (charge>threshold) { @@ -74,7 +80,7 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle } if (bunchSim<0 || bunchSim>m_timeBCN) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } - else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim, &msg()); } + else { SiHelper::SetBunch((*i_chargedDiode).second,bunchSim); } } else { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); @@ -84,8 +90,8 @@ void RD53SimTool::process(SiChargedDiodeCollection &chargedDiodes,PixelRDO_Colle if (barrel_ec!=0 && charge<m_EndcapAnalogthreshold.at(layerIndex)) { SiHelper::belowThreshold((*i_chargedDiode).second,true,true); } // charge to ToT conversion - double tot = m_pixelCalibSvc->getTotMean(diodeID,charge); - double totsig = m_pixelCalibSvc->getTotRes(diodeID,tot); + double tot = calibData->getToT((int)moduleHash, circ, type, charge); + double totsig = calibData->getTotRes((int)moduleHash, circ, tot); int nToT = static_cast<int>(CLHEP::RandGaussZiggurat::shoot(m_rndmEngine,tot,totsig)); if (nToT<1) { nToT=1; } diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfig.py b/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfig.py index a753c90b1b327a9b6e1026ab88f90d0b693e7675..b56c96499e79b3dc0fe285c099ad644119affa3c 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfig.py +++ b/InnerDetector/InDetDigitization/SCT_Digitization/python/SCT_DigitizationConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaCommon import CfgMgr # The earliest bunch crossing time for which interactions will be sent @@ -50,9 +50,6 @@ def getSCT_SurfaceChargesGenerator(name="SCT_SurfaceChargesGenerator", **kwargs) sct_SiPropertiesToolSetup.setup() ## Charge trapping tool - used by SCT_SurfaceChargesGenerator from AthenaCommon.AppMgr import ToolSvc - if not hasattr(ToolSvc, "InDetSCT_RadDamageSummaryTool"): - from SCT_ConditionsTools.SCT_ConditionsToolsConf import SCT_RadDamageSummaryTool - ToolSvc += SCT_RadDamageSummaryTool(name = "InDetSCT_RadDamageSummaryTool") ## SiLorentzAngleTool for SCT_SurfaceChargesGenerator from SiLorentzAngleTool.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() @@ -82,8 +79,9 @@ def getSCT_SurfaceChargesGenerator(name="SCT_SurfaceChargesGenerator", **kwargs) from SCT_Digitization.SCT_DigitizationConf import SCT_DetailedSurfaceChargesGenerator return SCT_DetailedSurfaceChargesGenerator(name, **kwargs) else: + from SCT_ConditionsTools.SCT_ConditionsToolsConf import SCT_RadDamageSummaryTool + kwargs.setdefault("RadDamageSummaryTool", SCT_RadDamageSummaryTool(name = "InDetSCT_RadDamageSummaryTool")) from SCT_Digitization.SCT_DigitizationConf import SCT_SurfaceChargesGenerator - kwargs.setdefault("RadDamageSummaryTool", getattr(ToolSvc, "InDetSCT_RadDamageSummaryTool")) return SCT_SurfaceChargesGenerator(name, **kwargs) ###################################################################################### diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt index 11419eab58419eed332597de7c392551c40b44e4..4caf24ad7ac4c70b6c48aab995aa1bf6f9defc56 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/TRT_ConditionsServices InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetRawEvent/InDetSimData InnerDetector/InDetRecEvent/InDetPrepRawData @@ -38,7 +39,7 @@ atlas_add_component( InDetPrepRawDataToxAOD src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps StoreGateLib SGtests Identifier xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRawData InDetSimData InDetPrepRawData PixelConditionsData InDetSimEvent TrkSurfaces TrkTruthData ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps StoreGateLib SGtests Identifier PixelConditionsData xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRawData InDetSimData InDetPrepRawData InDetSimEvent TrkSurfaces TrkTruthData ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx index e1f30a647b4fe76928e6958115d16b426b76ff3b..fa032ce2b817bcdaac4c8e7854f0616e2579bd6b 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx @@ -30,7 +30,6 @@ #include "TMath.h" #include "CLHEP/Geometry/Point3D.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" #include "PixelConditionsServices/IPixelByteStreamErrorsSvc.h" #define AUXDATA(OBJ, TYP, NAME) \ @@ -45,8 +44,6 @@ PixelPrepDataToxAOD::PixelPrepDataToxAOD(const std::string &name, ISvcLocator *p AthAlgorithm(name,pSvcLocator), m_PixelHelper(0), m_useSiHitsGeometryMatching(true), - m_calibSvc("PixelCalibSvc", name), - m_pixelBSErrorsSvc("PixelByteStreamErrorsSvc", name), m_firstEventWarnings(true), m_need_sihits{false} { @@ -86,14 +83,15 @@ StatusCode PixelPrepDataToxAOD::initialize() m_writeSiHits = false; } - CHECK(m_calibSvc.retrieve()); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); ATH_CHECK(m_condDCSStateKey.initialize()); ATH_CHECK(m_condDCSStatusKey.initialize()); ATH_CHECK(m_readKeyTemp.initialize()); ATH_CHECK(m_readKeyHV.initialize()); - CHECK(m_pixelBSErrorsSvc.retrieve()); + ATH_CHECK(m_pixelBSErrorsSvc.retrieve()); ATH_CHECK(m_lorentzAngleTool.retrieve()); @@ -176,7 +174,11 @@ StatusCode PixelPrepDataToxAOD::execute() // Loop over the container unsigned int counter(0); - + + SG::ReadCondHandle<PixelModuleData> dcsState(m_condDCSStateKey); + SG::ReadCondHandle<PixelModuleData> dcsHV(m_readKeyHV); + SG::ReadCondHandle<PixelModuleData> dcsTemp(m_readKeyTemp); + for( const auto& clusterCollection : * PixelClusterContainer ){ //Fill Offset container @@ -266,11 +268,11 @@ StatusCode PixelPrepDataToxAOD::execute() if(m_writeRDOinformation) { IdentifierHash moduleHash = clusterCollection->identifyHash(); AUXDATA(xprd,int,isBSError) = (int)m_pixelBSErrorsSvc->isActive(moduleHash); - AUXDATA(xprd,int,DCSState) = SG::ReadCondHandle<PixelModuleData>(m_condDCSStateKey)->getModuleStatus(moduleHash); + AUXDATA(xprd,int,DCSState) = dcsState->getModuleStatus(moduleHash); float deplVoltage = 0.0; - AUXDATA(xprd,float,BiasVoltage) = SG::ReadCondHandle<PixelModuleData>(m_readKeyHV)->getBiasVoltage(moduleHash); - AUXDATA(xprd,float,Temperature) = SG::ReadCondHandle<PixelModuleData>(m_readKeyTemp)->getTemperature(moduleHash); + AUXDATA(xprd,float,BiasVoltage) = dcsHV->getBiasVoltage(moduleHash); + AUXDATA(xprd,float,Temperature) = dcsTemp->getTemperature(moduleHash); AUXDATA(xprd,float,DepletionVoltage) = deplVoltage; AUXDATA(xprd,float,LorentzShift) = (float)m_lorentzAngleTool->getLorentzShift(moduleHash); @@ -648,6 +650,7 @@ void PixelPrepDataToxAOD::addRdoInformation(xAOD::TrackMeasurementValidation* xp std::vector<float> ATerm; std::vector<float> ETerm; + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); ATH_MSG_VERBOSE( "Number of RDOs: " << rdos.size() ); @@ -666,9 +669,14 @@ void PixelPrepDataToxAOD::addRdoInformation(xAOD::TrackMeasurementValidation* xp etaIndexList.push_back( m_PixelHelper->eta_index(rId) ); // charge calibration parameters - CTerm.push_back( m_calibSvc->getQ2TotC(rId) ); - ATerm.push_back( m_calibSvc->getQ2TotA(rId) ); - ETerm.push_back( m_calibSvc->getQ2TotE(rId) ); + Identifier moduleID = m_PixelHelper->wafer_id(rId); + IdentifierHash moduleHash = m_PixelHelper->wafer_hash(moduleID); // wafer hash + int circ = m_pixelCabling->getFE(&rId,moduleID); + int type = m_pixelCabling->getPixelType(rId); + + CTerm.push_back(calibData->getQ2TotC((int)moduleHash, circ, type)); + ATerm.push_back(calibData->getQ2TotA((int)moduleHash, circ, type)); + ETerm.push_back(calibData->getQ2TotE((int)moduleHash, circ, type)); }//end iteration on rdos diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.h b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.h index 626e8af46bb4f6e165fb2fe9235196cd8eb3aa94..a0da00920713589beb75331bf49c30d84b1d855f 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.h +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.h @@ -21,9 +21,12 @@ #include "xAODTracking/TrackMeasurementValidationContainer.h" #include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "InDetCondTools/ISiLorentzAngleTool.h" #include "PixelConditionsServices/IPixelByteStreamErrorsSvc.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "StoreGate/ReadCondHandleKey.h" + #include <string> @@ -102,16 +105,29 @@ private: bool m_writeRDOinformation; bool m_useSiHitsGeometryMatching; - ServiceHandle<IPixelCalibSvc> m_calibSvc; + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; + + SG::ReadCondHandleKey<PixelModuleData> m_condDCSStateKey + {this, "PixelDCSStateCondData", "PixelDCSStateCondData", "Pixel FSM state key"}; + + SG::ReadCondHandleKey<PixelModuleData> m_condDCSStatusKey + {this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"}; + + SG::ReadCondHandleKey<PixelModuleData> m_readKeyTemp + {this, "ReadKeyeTemp", "PixelDCSTempCondData", "Key of input sensor temperature conditions folder"}; - SG::ReadCondHandleKey<PixelModuleData> m_condDCSStateKey{this, "PixelDCSStateCondData", "PixelDCSStateCondData", "Pixel FSM state key"}; - SG::ReadCondHandleKey<PixelModuleData> m_condDCSStatusKey{this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"}; + SG::ReadCondHandleKey<PixelModuleData> m_readKeyHV + {this, "ReadKeyHV", "PixelDCSHVCondData", "Key of input bias voltage conditions folder"}; - SG::ReadCondHandleKey<PixelModuleData> m_readKeyTemp{this, "ReadKeyeTemp", "PixelDCSTempCondData", "Key of input sensor temperature conditions folder"}; - SG::ReadCondHandleKey<PixelModuleData> m_readKeyHV {this, "ReadKeyHV", "PixelDCSHVCondData", "Key of input bias voltage conditions folder"}; + ServiceHandle<IPixelByteStreamErrorsSvc> m_pixelBSErrorsSvc + {this, "PixelByteStreamErrorsSvc", "PixelByteStreamErrorsSvc", "Pixel byte stream error service"}; - ServiceHandle<IPixelByteStreamErrorsSvc> m_pixelBSErrorsSvc; - ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{this, "LorentzAngleTool", "SiLorentzAngleTool", "Tool to retreive Lorentz angle"}; + ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool + {this, "LorentzAngleTool", "SiLorentzAngleTool", "Tool to retreive Lorentz angle"}; // -- Private members bool m_firstEventWarnings; diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTEventFlagWriter.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTEventFlagWriter.h index 7320a725ce36c8b4fa0616eb90414efca73d3625..aea4ec9152f19b1cca4c929741f11edb544d518d 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTEventFlagWriter.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTEventFlagWriter.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.cxx index bfcd264409f50ac63bd88ab88a75cdd03a2ed928..6ef10c974474b2dbda25c7e651a21b124219660c 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.cxx @@ -18,7 +18,7 @@ // Constructor SCTRawContByteStreamCnv::SCTRawContByteStreamCnv(ISvcLocator* svcLoc) : - Converter(storageType(), classID(),svcLoc), + Converter(storageType(), classID(), svcLoc), m_rawContByteStreamTool{"SCTRawContByteStreamTool"}, m_byteStreamEventAccess{"ByteStreamCnvSvc", "SCTRawContByteStreamCnv"}, m_log{msgSvc(), "SCTRawContByteStreamCnv"} diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.h index 647193cfb1ea25dc32b95958c65feaf9739861b0..8c0f1ad675b224d5500dfe8dcc5c42420b22234f 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamCnv.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.cxx index 0e779ff564f5b648e18ac46b3361b3264c56bd77..ed2a6fcbf713326d505d426e3935b741bd6b2061 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.cxx @@ -6,23 +6,19 @@ #include "ByteStreamData/RawEvent.h" #include "ByteStreamCnvSvcBase/SrcIdMap.h" +#include "eformat/SourceIdentifier.h" #include "InDetIdentifier/SCT_ID.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "SCT_RawDataByteStreamCnv/ISCT_RodEncoder.h" #include "SCT_Cabling/ISCT_CablingTool.h" - #include "StoreGate/ReadCondHandle.h" -#include "eformat/SourceIdentifier.h" // Constructor SCTRawContByteStreamTool::SCTRawContByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent) : - base_class(type, name, parent), - m_sctIDHelper{nullptr}, - m_mutex{} + base_class(type, name, parent) { - declareProperty("RodBlockVersion", m_rodBlockVersion=0); } // Initialize @@ -51,7 +47,7 @@ StatusCode SCTRawContByteStreamTool::finalize() StatusCode SCTRawContByteStreamTool::convert(const SCT_RDO_Container* sctRDOCont, RawEventWrite* rawEvtWrite, MsgStream& log) const { - std::lock_guard<std::mutex> lock(m_mutex); + std::lock_guard<std::mutex> lock{m_mutex}; m_fullEventAssembler.clear(); FullEventAssembler<SrcIdMap>::RODDATA* rod; @@ -61,7 +57,7 @@ StatusCode SCTRawContByteStreamTool::convert(const SCT_RDO_Container* sctRDOCont ATH_MSG_DEBUG(" Setting Minor Version Number to " << m_rodBlockVersion); // Mapping between ROD IDs and the hits in that ROD - std::map<uint32_t, std::vector<const SCT_RDORawData*> > rdoMap; + std::map<uint32_t, std::vector<const SCT_RDORawData*>> rdoMap; // The following few lines are to make sure there is an entry in the rdoMap for // every ROD, even if there are no hits in it for a particular event diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.h index b667e3b37b9414b2ba298399645f659eabdf503f..b9326e268ff6f3b394ae123e72024fa0f2d4d143 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawContByteStreamTool.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -70,15 +72,15 @@ class SCTRawContByteStreamTool : public extends<AthAlgTool, ISCTRawContByteStrea /** Identifier helper class for the SCT subdetector that creates compact Identifier objects and IdentifierHash or hash IDs. Also allows decoding of these IDs. */ - const SCT_ID* m_sctIDHelper; + const SCT_ID* m_sctIDHelper{nullptr}; - unsigned short m_rodBlockVersion; + UnsignedShortProperty m_rodBlockVersion{this, "RodBlockVersion", 0}; /** Conversion between Lower level Source ID to higher level source ID, used to assemble fragments from ROD fragments to assemble full ATLAS raw events. */ mutable FullEventAssembler<SrcIdMap> m_fullEventAssembler ATLAS_THREAD_SAFE; - mutable std::mutex m_mutex; + mutable std::mutex m_mutex{}; }; #endif // SCT_RAWDATABYTESTREAMCNV_SCTRAWCONTBYTESTREAMTOOL_H diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx index d1967ada521facbed9a4010cc0e34e5b8ad585f1..d538342fe2bb0769ddfab874231ef103c6de7472 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx @@ -17,13 +17,9 @@ using OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment; // Constructor SCTRawDataProvider::SCTRawDataProvider(const std::string& name, ISvcLocator* pSvcLocator) : - AthReentrantAlgorithm(name, pSvcLocator), - m_regionSelector{"RegSelSvc", name}, - m_robDataProvider{"ROBDataProviderSvc", name}, - m_sctID{nullptr}, - m_rdoContainerCacheKey{""} + AthReentrantAlgorithm(name, pSvcLocator) { - declareProperty("RDOCacheKey", m_rdoContainerCacheKey); + declareProperty("RDOCacheKey", m_rdoContainerCacheKey=""); } // Initialize diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h index 214026b52d8818d5c3bf3602d811796852c79fdb..dd1b7bac6f59dbe4e72a7fa1028cf22c11287275 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -61,10 +63,14 @@ class SCTRawDataProvider : public AthReentrantAlgorithm private: /** Region Selector service for Athena. */ - ServiceHandle<IRegSelSvc> m_regionSelector; + ServiceHandle<IRegSelSvc> m_regionSelector{this, + "RegSelSvc", + "RegSelSvc"}; /** ROB Data Provider for accessing ROB data. */ - ServiceHandle<IROBDataProviderSvc> m_robDataProvider; + ServiceHandle<IROBDataProviderSvc> m_robDataProvider{this, + "ROBDataProviderSvc", + "ROBDataProviderSvc"}; /** Tool to fill Collections of SCT RDO Containers. */ ToolHandle<ISCTRawDataProviderTool> m_rawDataTool{this, @@ -80,7 +86,7 @@ class SCTRawDataProvider : public AthReentrantAlgorithm /** Identifier helper class for the SCT subdetector that creates compact Identifier objects and IdentifierHash or hash IDs. Also allows decoding of these IDs. */ - const SCT_ID* m_sctID; + const SCT_ID* m_sctID{nullptr}; /** Boolean to determine if SCT Raw Data Provider should be run in RoI seeded mode. */ BooleanProperty m_roiSeeded{this, "isRoI_Seeded", false, "Use RoI"}; diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProviderTool.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProviderTool.cxx index 0037d7fde3989f88c151e9b4e3cc66187cf35f47..9db3d9bc1985f9eb1817b9c5d0cd72aaf2e21efa 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProviderTool.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProviderTool.cxx @@ -13,10 +13,7 @@ using OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment; SCTRawDataProviderTool::SCTRawDataProviderTool(const std::string& type, const std::string& name, const IInterface* parent) : - base_class(type, name, parent), - m_robIDSet{}, - m_decodeErrCount{0}, - m_mutex{} + base_class(type, name, parent) { } @@ -24,12 +21,6 @@ SCTRawDataProviderTool::SCTRawDataProviderTool(const std::string& type, const st StatusCode SCTRawDataProviderTool::initialize() { - StatusCode sc{AlgTool::initialize()}; - if (sc.isFailure()) { - ATH_MSG_FATAL("Failed to init baseclass"); - return StatusCode::FAILURE; - } - ATH_CHECK(m_decoder.retrieve()); return StatusCode::SUCCESS; diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProviderTool.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProviderTool.h index 55e4dfd0179f11574fec58c323a3be9b5b2bd077..59e07e18ac70364b27c14c28666a3879c7aa0f02 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProviderTool.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProviderTool.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -65,13 +67,13 @@ class SCTRawDataProviderTool : public extends<AthAlgTool, ISCTRawDataProviderToo ToolHandle<ISCT_RodDecoder> m_decoder{this, "Decoder", "SCT_RodDecoder", "Decoder"}; /** For bookkeeping of decoded ROBs */ - mutable std::set<uint32_t> m_robIDSet ATLAS_THREAD_SAFE; + mutable std::set<uint32_t> m_robIDSet ATLAS_THREAD_SAFE {}; /** Number of decode errors encountered in decoding. Turning off error message after 100 errors are counted */ - mutable std::atomic_int m_decodeErrCount; + mutable std::atomic_int m_decodeErrCount{0}; - mutable std::mutex m_mutex; + mutable std::mutex m_mutex{}; }; #endif // SCT_RAWDATABYTESTREAMCNV_SCTRAWDATAPROVIDERTOOL_H diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx index 82cf6390393cb8f186a5d24d4907bf93ae0bff46..d3d679cb10eb6fc4f2a40ab5e6ed710a84e6b11c 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx @@ -25,38 +25,7 @@ union RawWord { SCT_RodDecoder::SCT_RodDecoder(const std::string& type, const std::string& name, const IInterface* parent) : - base_class(type, name, parent), - m_sctID{nullptr}, - m_singleCondHitNumber{0}, - m_pairedCondHitNumber{0}, - m_firstExpHitNumber{0}, - m_evenExpHitNumber{0}, - m_lastExpHitNumber{0}, - m_headNumber{0}, - m_trailerNumber{0}, - m_headErrorBCID{0}, - m_headErrorLvl1ID{0}, - m_headErrorTimeout{0}, - m_headErrorFormatter{0}, - m_headErrorPreamble{0}, - m_trailerErrorOverflow{0}, - m_trailerErrorLimit{0}, - m_trailerErrorBit{0}, - m_configDataBit{0}, - m_flagErrorBit{0}, - m_condHit1Error{0}, - m_condHit2Error{0}, - m_chipNumberError{0}, - m_unknownDataFormat{0}, - m_nHits{0}, - m_nRDOs{0}, - m_maskedLinkNumber{0}, - m_maskedRODNumber{0}, - m_rodClockErrorNumber{0}, - m_truncatedRODNumber{0}, - m_numMissingLinkHeader{0}, - m_numUnknownOfflineID{0}, - m_swapPhiReadoutDirection{} + base_class(type, name, parent) { } @@ -339,7 +308,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // Chip number == (data16[n]>>11)&0x7 // Chip side == (data16[n]>>14)&0x1 // For example if data16[n]>>11)0xF = 0101 => chip5 or chip5 on side0, data16[n]>>11)0xF = 1101 => chip13 or chip5 on side1 - chip = ((data16[n]>>11)&0x7); + chip = ((data16[n]>>11)&0x7); side = ((data16[n]>>14)&0x1); strip = chip*128 + ((data16[n]>>4)&0x7F); timeBin = 0x2; // Assuming timeBin is 010 in super-condensed mode @@ -363,7 +332,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[oldSide*768+oldStrip] = rdoMade; + saved[oldSide*768+oldStrip] = rdoMade; } oldStrip = strip; oldSide = side; @@ -380,7 +349,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[oldSide*768+oldStrip] = rdoMade; + saved[oldSide*768+oldStrip] = rdoMade; } oldStrip = strip; oldSide = side; @@ -403,7 +372,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[oldSide*768+oldStrip] = rdoMade; + saved[oldSide*768+oldStrip] = rdoMade; } oldStrip = strip; oldSide = side; @@ -418,7 +387,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // Chip number == (data16[n]>>11)&0x7 // Chip side == (data16[n]>>14)&0x1 // For example if data16[n]>>11)0xF = 0101 => chip5 or chip5 on side0, data16[n]>>11)0xF = 1101 => chip13 or chip5 on side1 - chip = ((data16[n]>>11)&0x7); + chip = ((data16[n]>>11)&0x7); side = ((data16[n]>>14)&0x1); strip = chip*128 + ((data16[n]>>4)&0x7F); timeBin = 0x2; // Assuming timeBin is 010 in condensed mode @@ -441,7 +410,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[oldSide*768+oldStrip] = rdoMade; + saved[oldSide*768+oldStrip] = rdoMade; } oldStrip = strip; oldSide = side; @@ -458,7 +427,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[oldSide*768+oldStrip] = rdoMade; + saved[oldSide*768+oldStrip] = rdoMade; } oldStrip = strip; oldSide = side; @@ -481,7 +450,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[oldSide*768+oldStrip] = rdoMade; + saved[oldSide*768+oldStrip] = rdoMade; } oldStrip = strip; oldSide = side; @@ -515,7 +484,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[oldSide*768+oldStrip] = rdoMade; + saved[oldSide*768+oldStrip] = rdoMade; } oldStrip = strip; oldSide = side; @@ -546,13 +515,13 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // For example if data16[n]>>11)0xF = 0101 => chip5 or chip5 on side0, data16[n]>>11)0xF = 1101 => chip13 or chip5 on side1 if (not (data16[n]&0x8)) { // 1st hit cluster expanded m_firstExpHitNumber++; - chip = ((data16[n]>>11)&0x7); + chip = ((data16[n]>>11)&0x7); side = ((data16[n]>>14)&0x1); strip = chip*128 + ((data16[n]>>4)&0x7F); timeBin = data16[n]&0x7; // Real way for obtaining timeBin info if (chip>5) { - ATH_MSG_DEBUG("Expanded hit: First hit xxx ERROR chip Nb = " << chip << " > 5"); + ATH_MSG_DEBUG("Expanded hit: First hit xxx ERROR chip Nb = " << chip << " > 5"); m_chipNumberError++; addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); continue; @@ -566,7 +535,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB if ((side==0) and ((linkNumber%2)!=0)) { linkNumber--; } - onlineID = ((robID & 0xFFFFFF) | (linkNumber << 24)); + onlineID = ((robID & 0xFFFFFF) | (linkNumber << 24)); groupSize = 1; const int rdoMade{makeRDO(strip, groupSize, timeBin, onlineID, errors, rdoIDCont, cache, errorHit)}; if (rdoMade == -1) { @@ -574,7 +543,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[side*768+strip] = rdoMade; + saved[side*768+strip] = rdoMade; } groupSize = 0; } @@ -588,7 +557,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB } m_evenExpHitNumber++; if (chip>5) { - ATH_MSG_DEBUG("Expanded Hit: paired hits xxx ERROR chip Nb = " << chip << " > 5"); + ATH_MSG_DEBUG("Expanded Hit: paired hits xxx ERROR chip Nb = " << chip << " > 5"); m_chipNumberError++; addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); continue; @@ -621,7 +590,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB else { // Last hit of the cluster m_lastExpHitNumber++; if (chip>5) { - ATH_MSG_DEBUG("Expanded Hit: last hit xxx ERROR chip Nb = " << chip << " > 5"); + ATH_MSG_DEBUG("Expanded Hit: last hit xxx ERROR chip Nb = " << chip << " > 5"); m_chipNumberError++; addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); continue; @@ -635,9 +604,9 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[side*768+strip] = rdoMade; + saved[side*768+strip] = rdoMade; } - groupSize = 0; + groupSize = 0; } } } // End expanded mode @@ -650,13 +619,13 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB m_headNumber++; if (saved[side*768+strip]==false and oldStrip>=0) { - const int rdoMade{makeRDO(strip, groupSize, timeBin, onlineID, errors, rdoIDCont, cache, errorHit)}; + const int rdoMade{makeRDO(strip, groupSize, timeBin, onlineID, errors, rdoIDCont, cache, errorHit)}; if (rdoMade == -1) { sc=StatusCode::RECOVERABLE; addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[side*768+strip] = rdoMade; + saved[side*768+strip] = rdoMade; } } @@ -674,7 +643,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // This is the real calculation for the offline linkNumber = (((rodlinkNumber >>4)&0x7)*12+(rodlinkNumber &0xF)); - onlineID = ((robID & 0xFFFFFF)|(linkNumber << 24)); + onlineID = ((robID & 0xFFFFFF)|(linkNumber << 24)); if ((onlineID ==0) or (linkNumber > 95)) { addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); sc=StatusCode::RECOVERABLE; @@ -689,7 +658,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB if (data16[n] >> 7 & 0x1) { ATH_MSG_DEBUG("Masked link " << onlineID << " " << currentLinkIDHash); addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::MaskedLink, errs); - sc=StatusCode::RECOVERABLE; + sc=StatusCode::RECOVERABLE; } if (data16[n]&0x800) { ATH_MSG_DEBUG(" Header: xxx TimeOut Error " << currentLinkIDHash); @@ -785,7 +754,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // 12 means chips 11, 0-5 are temporarily masked. setFirstTempMaskedChip(currentLinkIDHash, (data16[n] & 0xF), errs); } - continue; + continue; } // FlaggedABCD error @@ -793,7 +762,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB // 000: FlaggedABCD error: xxxxxxx not used, FFFF: chip, EEE: error code else if (((data16[n]>>13)&0x7) == 0x0) { chip = ((data16[n]>>3)&0xF); - abcError = data16[n]&0x7; + abcError = data16[n]&0x7; // No data should appear for that chip but how do we want to transmit this information? IdentifierHash flagIDHash{0}; if (onlineID == 0) { @@ -883,7 +852,7 @@ StatusCode SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROB addSingleError(currentLinkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs); } else { - saved[side*768+strip] = rdoMade; + saved[side*768+strip] = rdoMade; } } diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h index 4d9b6b1ce53e06439866592a6ad6b41e2635ebcd..b2bb1de23d0901a582d4ad22e95f6654102b9990 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h @@ -1,5 +1,7 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETRAWDATABYTESTREAM_SCT_RODDECODER_H @@ -131,7 +133,7 @@ class SCT_RodDecoder : public extends<AthAlgTool, ISCT_RodDecoder> /** Identifier helper class for the SCT subdetector that creates compact Identifier objects and IdentifierHash or hash IDs. Also allows decoding of these IDs. */ - const SCT_ID* m_sctID; + const SCT_ID* m_sctID{nullptr}; /** "Context" of an expanded identifier (ExpandedIdentifier) for compact or hash versions (Identifier32 or IdentifierHash) */ @@ -150,94 +152,94 @@ class SCT_RodDecoder : public extends<AthAlgTool, ISCT_RodDecoder> "Tool to retrieve SCT Configuration Tool"}; /** Total number of single strips with hit decoded in condensed mode */ - mutable std::atomic_uint m_singleCondHitNumber; + mutable std::atomic_uint m_singleCondHitNumber{0}; /** Total number of paired strips with hit decoded in condensed mode */ - mutable std::atomic_uint m_pairedCondHitNumber; + mutable std::atomic_uint m_pairedCondHitNumber{0}; /** Total number of first strips with hit decoded in expanded mode */ - mutable std::atomic_uint m_firstExpHitNumber; + mutable std::atomic_uint m_firstExpHitNumber{0}; /** Total number of consecutive paired strips with hit decoded in expanded mode */ - mutable std::atomic_uint m_evenExpHitNumber; + mutable std::atomic_uint m_evenExpHitNumber{0}; /** Total number of last consecutive strips with hit decoded in expanded mode */ - mutable std::atomic_uint m_lastExpHitNumber; + mutable std::atomic_uint m_lastExpHitNumber{0}; /** Total number of decoded header data */ - mutable std::atomic_uint m_headNumber; + mutable std::atomic_uint m_headNumber{0}; /** Total number of decoded trailer data */ - mutable std::atomic_uint m_trailerNumber; + mutable std::atomic_uint m_trailerNumber{0}; /** Total number of BCID errors in the header data */ - mutable std::atomic_uint m_headErrorBCID; + mutable std::atomic_uint m_headErrorBCID{0}; /** Total number of Lvl1ID errors in the header data */ - mutable std::atomic_uint m_headErrorLvl1ID; + mutable std::atomic_uint m_headErrorLvl1ID{0}; /** Total number of timeout errors in the header data */ - mutable std::atomic_uint m_headErrorTimeout; + mutable std::atomic_uint m_headErrorTimeout{0}; /** Total number of formatter errors in the header data */ - mutable std::atomic_uint m_headErrorFormatter; + mutable std::atomic_uint m_headErrorFormatter{0}; /** Total number of preamble errors in the header data */ - mutable std::atomic_uint m_headErrorPreamble; + mutable std::atomic_uint m_headErrorPreamble{0}; /** Total number of overflow errors in the trailer data */ - mutable std::atomic_uint m_trailerErrorOverflow; + mutable std::atomic_uint m_trailerErrorOverflow{0}; /** Total number of header trailer limit errors in the trailer data */ - mutable std::atomic_uint m_trailerErrorLimit; + mutable std::atomic_uint m_trailerErrorLimit{0}; /** Total number of trailer bit errors */ - mutable std::atomic_uint m_trailerErrorBit; + mutable std::atomic_uint m_trailerErrorBit{0}; /** Total number of configuration data for raw data */ - mutable std::atomic_uint m_configDataBit; + mutable std::atomic_uint m_configDataBit{0}; /** Total number of flag error data */ - mutable std::atomic_uint m_flagErrorBit; + mutable std::atomic_uint m_flagErrorBit{0}; /** Total number of first hit data errors */ - mutable std::atomic_uint m_condHit1Error; + mutable std::atomic_uint m_condHit1Error{0}; /** Total number second hit data errors */ - mutable std::atomic_uint m_condHit2Error; + mutable std::atomic_uint m_condHit2Error{0}; /** Total number of chip number errors */ - mutable std::atomic_uint m_chipNumberError; + mutable std::atomic_uint m_chipNumberError{0}; /** Total number of unknown data formats */ - mutable std::atomic_uint m_unknownDataFormat; + mutable std::atomic_uint m_unknownDataFormat{0}; /** Total number of SCT hits in ByteStream */ - mutable std::atomic_uint m_nHits; + mutable std::atomic_uint m_nHits{0}; /** Total number of SCT RDOs created */ - mutable std::atomic_uint m_nRDOs; + mutable std::atomic_uint m_nRDOs{0}; /** Total number of masked links in the header data */ - mutable std::atomic_uint m_maskedLinkNumber; + mutable std::atomic_uint m_maskedLinkNumber{0}; /** Total number of masked RDOs */ - mutable std::atomic_uint m_maskedRODNumber; + mutable std::atomic_uint m_maskedRODNumber{0}; /** Total number of ROD clock errors */ - mutable std::atomic_uint m_rodClockErrorNumber; + mutable std::atomic_uint m_rodClockErrorNumber{0}; /** Total number of truncated ROBFragments */ - mutable std::atomic_uint m_truncatedRODNumber; + mutable std::atomic_uint m_truncatedRODNumber{0}; /** Total number of missing link headers */ - mutable std::atomic_uint m_numMissingLinkHeader; + mutable std::atomic_uint m_numMissingLinkHeader{0}; /** Total number of SCT unknown online IDs */ - mutable std::atomic_uint m_numUnknownOfflineID; + mutable std::atomic_uint m_numUnknownOfflineID{0}; /** Swap phi readout direction */ - std::vector<bool> m_swapPhiReadoutDirection; + std::vector<bool> m_swapPhiReadoutDirection{}; }; #endif //SCT_RAWDATABYTESTREAM_SCT_RODDECODER_H diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx index 88b7b11051486bead34a6e4f37ef59a8ebd3ce55..522d50f12cc65a1843dc871c2c45dc2ab9ca9259 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "SCT_RodEncoder.h" @@ -44,9 +44,7 @@ namespace { // Anonymous namespace SCT_RodEncoder::SCT_RodEncoder(const std::string& type, const std::string& name, const IInterface* parent) : - base_class(type, name, parent), - m_sctID{nullptr}, - m_swapModuleID{} + base_class(type, name, parent) { } @@ -72,7 +70,7 @@ StatusCode SCT_RodEncoder::initialize() ATH_CHECK(detStore()->retrieve(sctDetManager, "SCT")); const InDetDD::SiDetectorElementCollection* sctDetElementColl{sctDetManager->getDetectorElementCollection()}; - for (auto sctDetElement : *sctDetElementColl) { + for (const InDetDD::SiDetectorElement* sctDetElement : *sctDetElementColl) { if (sctDetElement->swapPhiReadoutDirection()) { m_swapModuleID.insert(sctDetElement->identify()); } @@ -286,7 +284,7 @@ void SCT_RodEncoder::encodeData(const std::vector<int>& vecTimeBins, std::vector vec16Words.push_back(hitExpFirst); // Even consecutive strips to the first one 1DDD 1st consec strip 1DDD 2nd consec strip - for (int i=1; i<=numEven; i++) { + for (int i{1}; i<=numEven; i++) { const uint16_t hitExpEven{static_cast<uint16_t>(0x8088 | ((vecTimeBins[(2*i-1)] & 0xF) << 4) | (vecTimeBins[2*i] & 0xF))}; vec16Words.push_back(hitExpEven); } diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.h index 1d9896fb44b2f2806e849cbbd6557d87d063fbd3..cc20bff654223f21b22c0b4b47380004f5037287 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.h @@ -1,5 +1,7 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef SCT_RAWDATABYTESTREAMCNV_SCT_RODENCODER_H @@ -79,7 +81,7 @@ class SCT_RodEncoder : public extends<AthAlgTool, ISCT_RodEncoder> TRAILER_OVFLW_ERR=(1<<10), ABCD_ERR=0, RAWDATA_ERR=(3<<13), - NULL_TRAILER_ERR=0}; + NULL_TRAILER_ERR=0}; /** * @brief Method to encode RDO data to vector of 16 bin words. @@ -171,7 +173,7 @@ class SCT_RodEncoder : public extends<AthAlgTool, ISCT_RodEncoder> /** Identifier helper class for the SCT subdetector that creates compact Identifier objects and IdentifierHash or hash IDs. Also allows decoding of these IDs. */ - const SCT_ID* m_sctID; + const SCT_ID* m_sctID{nullptr}; /** Boolean used to determine if fillROD(...) should use Condensed or Expanded mode when decoding. */ BooleanProperty m_condensed{this, @@ -180,7 +182,7 @@ class SCT_RodEncoder : public extends<AthAlgTool, ISCT_RodEncoder> "Condensed mode (true) or Expanded mode (false)"}; /** Swap Module identifier, set by SCTRawContByteStreamTool. */ - std::set<Identifier> m_swapModuleID; + std::set<Identifier> m_swapModuleID{}; }; #endif // SCT_RAWDATABYTESTREAMCNV_SCT_RODENCODER_H diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py index d52995d5cbe45f5c46274ce74488ea4e663dd2d0..bb077e52dcfc8174360aa2140882356b8720bd6b 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py @@ -60,15 +60,15 @@ if DetFlags.haveRIO.pixel_on(): print InDetPixelConditionsSummaryTool - # Load pixel calibration service - if not athenaCommonFlags.isOnline(): - if not conddb.folderRequested('/PIXEL/PixCalib'): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") - from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc - InDetPixelCalibSvc = PixelCalibSvc() - ServiceMgr += InDetPixelCalibSvc - if InDetFlags.doPrintConfigurables(): - print InDetPixelCalibSvc + ##################### + # Calibration Setup # + ##################### + if not conddb.folderRequested("/PIXEL/PixCalib"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") + + if not hasattr(condSeq, 'PixelChargeCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") # Load Pixel BS errors service if not (globalflags.DataSource=='geant4'): diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py index 3eba016b1616abee8cd22b58a96be55e1407a804..ddd39e08a2f7c029377e22ce0e19cae3704f90ef 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPreProcessingSilicon.py @@ -39,15 +39,9 @@ if InDetFlags.doPRDFormation(): # from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", - PixelCalibSvc = None, - UsePixelCalibCondDB = False, PixelLorentzAngleTool = ToolSvc.PixelLorentzAngleTool, SCTLorentzAngleTool = sctLorentzAngleToolSetup.SCTLorentzAngleTool) - if DetFlags.makeRIO.pixel_on() and not (athenaCommonFlags.isOnline() or InDetFlags.doSLHC()): - InDetClusterMakerTool.PixelCalibSvc = InDetPixelCalibSvc - InDetClusterMakerTool.UsePixelCalibCondDB = True - ToolSvc += InDetClusterMakerTool if (InDetFlags.doPrintConfigurables()): print InDetClusterMakerTool diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Rec.py b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Rec.py index b49fcfaadc3fe00302cbf55c67085d7edc65adf2..76c15bf2cad2b9531a0199ac57ae498d1147c254 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Rec.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/share/postInclude.SLHC_Rec.py @@ -38,7 +38,8 @@ if rec.doWriteESD() or rec.doWriteAOD() or ('doWriteESD' in dir() and doWriteESD print '===> OVERWRITTEN TOOL SETTINGS ................' # --- turn off cluster calibration from DB, does not exist for IBL - ToolSvc.InDetClusterMakerTool.UsePixelCalibCondDB = False + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.UseCalibConditions = False # --- switch alignment for IBL geometry off (gives WARNING) from PixelGeoModel.PixelGeoModelConf import PixelDetectorTool diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index 195901186832f0d24ef17451fa4a3708464bb08c..1eae0aa93ac92f21de4cd9c2a6b1cb7529aa9155 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -110,8 +110,8 @@ class PixelConditionsServicesSetup: ############################ # DeadMap Conditions Setup # ############################ + PixelDeadMapFolder = "/PIXEL/PixMapOverlay" if self.usePixMap: - PixelDeadMapFolder = "/PIXEL/PixMapOverlay" if not (conddb.folderRequested(PixelDeadMapFolder) or conddb.folderRequested("/PIXEL/Onl/PixMapOverlay")): conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixMapOverlay",PixelDeadMapFolder, className='CondAttrListCollection') @@ -123,7 +123,8 @@ class PixelConditionsServicesSetup: from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg condSeq += PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadMap=self.usePixMap, - ReadDeadMapKey=PixelDeadMapFolder) + ReadDeadMapKey=PixelDeadMapFolder, + UseCalibConditions=(not self.onlineMode)) from PixelConditionsTools.PixelConditionsToolsConf import PixelConditionsSummaryTool TrigPixelConditionsSummaryTool = PixelConditionsSummaryTool(name=self.instanceName('PixelConditionsSummaryTool'), @@ -143,18 +144,12 @@ class PixelConditionsServicesSetup: ##################### # Calibration Setup # ##################### - from AthenaCommon.AppMgr import ServiceMgr,theApp - from IOVDbSvc.CondDB import conddb - if not self.onlineMode: - from PixelConditionsServices.PixelConditionsServicesConf import PixelCalibSvc - PixelCalibSvc = PixelCalibSvc(name=self.instanceName('PixelCalibSvc')) - - if not conddb.folderRequested("/PIXEL/PixCalib"): - conddb.addFolder("PIXEL_OFL","/PIXEL/PixCalib") + if not conddb.folderRequested("/PIXEL/PixCalib"): + conddb.addFolder("PIXEL_OFL", "/PIXEL/PixCalib", className="CondAttrListCollection") - if self._print: print PixelCalibSvc - - svcMgr += PixelCalibSvc + if not hasattr(condSeq, 'PixelChargeCalibCondAlg'): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + condSeq += PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib") if not conddb.folderRequested("/PIXEL/PixReco"): conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixReco","/PIXEL/PixReco",className="DetCondCFloat") @@ -201,7 +196,6 @@ class PixelConditionsServicesSetup: ToolSvc += TrigPixelLorentzAngleTool - def instanceName(self, toolname): return self.prefix+toolname diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py index 70416536a47ef0a313fcb9f339bf685b4184d14d..4954c6a1a0185fe3affac8aef9952ee3ad88e2f0 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecLoadTools.py @@ -31,10 +31,6 @@ sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetTrigClusterMakerTool = \ InDet__ClusterMakerTool( name = "InDetTrigClusterMakerTool", - UsePixelCalibCondDB = False, #simpler setup for EFID - #UsePixelCalibCondDB = True, #simpler setup for EFID - #pixLorentzAnleSvc = "InDetTrigPixLorentzAngleSvc", - #UseLorentzAngleCorrections = False PixelLorentzAngleTool = TrigPixelLorentzAngleTool, SCTLorentzAngleTool = TrigSCTLorentzAngleTool ) diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/share/strippedDown.py b/InnerDetector/InDetMonitoring/SCT_Monitoring/share/strippedDown.py index 34377877145f7454d4999b449c2b9404fafe2e83..1fc5469676b6e76587882c1a3ce62ca22137a1be 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/share/strippedDown.py +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/share/strippedDown.py @@ -62,8 +62,11 @@ elif globalflags.InputFormat() == 'bytestream': #-------------------------------------------------------------- # include SCT Clusterization #-------------------------------------------------------------- +from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg +PixelConfigCondAlg.UseCalibConditions = False + from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool -InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", UsePixelCalibCondDB = FALSE) +InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") ToolSvc += InDetClusterMakerTool print InDetClusterMakerTool # diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/CMakeLists.txt index 73d2d45b9b18019677e1155a6f1bf1f7d995c377..e5d0234fd5031953fa7a614a38fdc7d0adb5d31a 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/CMakeLists.txt @@ -11,8 +11,6 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODTracking GaudiKernel InnerDetector/InDetRecTools/InDetRecToolInterfaces - Reconstruction/Particle - Tracking/TrkVertexFitter/TrkVKalVrtFitter PRIVATE Tools/PathResolver DetectorDescription/GeoPrimitives @@ -23,7 +21,10 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkEvent/VxSecVertex Tracking/TrkEvent/VxVertex Tracking/TrkTools/TrkToolInterfaces - Tracking/TrkVertexFitter/TrkVertexFitterInterfaces ) + Tracking/TrkVertexFitter/TrkVertexFitterInterfaces + Tracking/TrkVertexFitter/TrkVKalVrtFitter + Reconstruction/Particle + Reconstruction/MVAUtils ) #InnerDetector/InDetRecTools/InDetMaterialRejTool # External dependencies: @@ -37,7 +38,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread TMVA ) # PUBLIC_HEADERS InDetVKalVxInJetTool InDetTrkInJetType # INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} # LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel -# InDetRecToolInterfaces Particle TrkVKalVrtFitterLib GeoPrimitives AnalysisUtilsLib TrkNeutralParameters +# InDetRecToolInterfaces Particle TrkVKalVrtFitterLib GeoPrimitives AnalysisUtilsLib TrkNeutralParameters MVAUtils # TrkParticleBase TrkTrackSummary VxSecVertex VxVertex TrkToolInterfaces TrkVertexFitterInterfaces PathResolver ) # Component(s) in the package: @@ -45,7 +46,7 @@ atlas_add_component( InDetVKalVxInJetTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking PathResolver GaudiKernel - InDetRecToolInterfaces Particle TrkVKalVrtFitterLib GeoPrimitives AnalysisUtilsLib TrkNeutralParameters + InDetRecToolInterfaces Particle TrkVKalVrtFitterLib GeoPrimitives AnalysisUtilsLib TrkNeutralParameters MVAUtils TrkParticleBase TrkTrackSummary VxSecVertex VxVertex TrkToolInterfaces TrkVertexFitterInterfaces PathResolver ) # Install files from the package: diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetTrkInJetType.h b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetTrkInJetType.h index 3f947855d42c3b2c49b761dcbb504b8026c9aca7..51ad19ff5063d6e05df5c026751e5375ca282a86 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetTrkInJetType.h +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetTrkInJetType.h @@ -28,13 +28,10 @@ // class TLorentzVector; -namespace Rec{ - class TrackParticle; -} - -namespace Trk{ - class TrkVKalVrtFitter; -} +class IChronoStatSvc; +namespace Rec{ class TrackParticle; } +namespace MVAUtils { class BDT; } +namespace Trk { class TrkVKalVrtFitter; } namespace TMVA { class Reader; } namespace InDet { @@ -78,11 +75,16 @@ namespace InDet { private: - TMVA::Reader* m_tmvaReader; + TMVA::Reader* m_tmvaReader{}; + MVAUtils::BDT* m_localBDT{}; + IChronoStatSvc * m_timingProfile{}; + int m_trkSctHitsCut{}; int m_trkPixelHitsCut{}; float m_trkChi2Cut{}; float m_trkMinPtCut{}; + float m_jetMaxPtCut{}; + float m_jetMinPtCut{}; float m_d0_limLow{}; float m_d0_limUpp{}; float m_Z0_limLow{}; @@ -103,8 +105,9 @@ namespace InDet { float m_SigR{}; float m_ptjet{}; float m_etajet{}; - float m_ibl{}; - float m_bl{}; + float m_etatrk{}; + float m_ibl{}; + float m_bl{}; }; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h index e6da7b7d5b417d5653faf99813c4d0a46da699f4..896aa2b9a8c0453ef50d0ca7ff3c761b4fd4cd8a 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/InDetVKalVxInJetTool/InDetVKalVxInJetTool.h @@ -60,6 +60,7 @@ class TH2D; class TH1F; class TProfile; class TTree; +class IChronoStatSvc; namespace Trk{ class TrkVKalVrtFitter; @@ -238,6 +239,7 @@ namespace InDet { ToolHandle < Trk::IVertexFitter > m_fitterSvc; Trk::TrkVKalVrtFitter* m_fitSvc{}; + IChronoStatSvc * m_timingProfile{}; ToolHandle < IInDetTrkInJetType > m_trackClassificator; @@ -270,6 +272,7 @@ namespace InDet { float ptjet; float etajet; float phijet; + float etatrk[maxNTrk]; float p_prob[maxNTrk]; float s_prob[maxNTrk]; int idMC[maxNTrk]; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx index 104fb338a7223343bd1d62803a82f80142df04a5..9221419f12e526a666a554df9dcd77e1cc301a7a 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/BTagVrtSec.cxx @@ -706,7 +706,6 @@ namespace InDet{ std::vector<double> Chi2PerTrk,VKPerigee,CovPerigee,closeVrtSig(0),closeVrtCh2(0); //TLorentzVector Momentum; std::vector<double> Impact,ImpactError; - double ImpactSignif=0; double Chi2, Signif3D, Dist2D, JetVrtDir; long int Charge; int i,j; @@ -745,10 +744,11 @@ namespace InDet{ m_hb_impactR->Fill( SignifR, m_w_1); m_hb_impactZ->Fill( SignifZ, m_w_1); m_hb_impactRZ->Fill(SignifR, SignifZ, m_w_1); - m_hb_impact->Fill( ImpactSignif, m_w_1); + m_hb_impact->Fill( TrkSig3D[i], m_w_1); if(i<DevTuple::maxNTrk && m_curTup){ + m_curTup->etatrk[i]=SelectedTracks[i]->eta(); m_curTup->p_prob[i]=RankBTrk(SelectedTracks[i]->pt(),JetDir.Pt(),0.); - m_curTup->s_prob[i]=RankBTrk(0.,0.,ImpactSignif); + m_curTup->s_prob[i]=RankBTrk(0.,0.,TrkSig3D[i]); m_curTup->SigR[i]=SignifR; m_curTup->SigZ[i]=SignifZ; m_curTup->d0[i]=Impact[0]; m_curTup->Z0[i]=Impact[1]; m_curTup->idMC[i]=getG4Inter(SelectedTracks[i]); @@ -768,7 +768,7 @@ namespace InDet{ } } } - if(m_fillHist){ m_curTup->ptjet=JetDir.Perp(); m_curTup->etajet=fabs(JetDir.Eta()); m_curTup->phijet=JetDir.Phi(); + if(m_fillHist){ m_curTup->ptjet=JetDir.Perp(); m_curTup->etajet=JetDir.Eta(); m_curTup->phijet=JetDir.Phi(); m_curTup->nTrkInJet=std::min(NTracks,DevTuple::maxNTrk); }; ListSecondTracks.reserve(2*NTracks); // Reserve memory for single vertex @@ -782,6 +782,8 @@ namespace InDet{ for (j=i+1; j<NTracks; j++) { if(trkScore[i][0]==0.)continue; if(trkScore[j][0]==0.)continue; + if(trkScore[i][2] > m_antiGarbageCut)continue; //---- Use classificator to remove Pileup+Interactions + if(trkScore[j][2] > m_antiGarbageCut)continue; //---- Use classificator to remove Pileup+Interactions if(!m_multiWithPrimary) { // Not used for multi-vertex with primary one search if( std::max(trkScore[i][1],trkScore[j][1]) > m_antiFragmentCut ) continue; // Remove definite fragmentation tracks bool goodPair=false; diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx index 935a4abc3710720144ff3abd6252f09ab771d79c..7ee1f993d40eca9074622ec13153c8421a49b162 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/CutTrk.cxx @@ -183,12 +183,15 @@ namespace InDet{ //if( !((*i_ntrk)->summaryValue(InmOutlier,xAOD::numberOfInnermostOutliers)) ) InmOutlier=-1; //std::cout<<"NwInnerM="<<(long int)InmHits<<", "<<(long int)InmSharedH<<", "<<(long int)InmSplitH<<", "<<(long int)InmOutlier<<'\n'; - - m_fitSvc->VKalGetImpact((*i_ntrk), PrimVrt.position(), 1, Impact, ImpactError); - //double ImpactA0=VectPerig[0]; // Temporary - //double ImpactZ=VectPerig[1]-PrimVrt.position().z(); // Temporary - double ImpactA0=Impact[0]; - double ImpactZ=Impact[1]; + Amg::Vector3D perigeePos=mPer.position(); + double ImpactA0=sqrt( (perigeePos.x()-PrimVrt.x())*(perigeePos.x()-PrimVrt.x()) + +(perigeePos.y()-PrimVrt.y())*(perigeePos.y()-PrimVrt.y()) ); + double ImpactZ=perigeePos.z()-PrimVrt.z(); + double ImpactSignif=sqrt(ImpactA0*ImpactA0/CovTrkMtx11+ImpactZ*ImpactZ/CovTrkMtx22); + + //double ImpactSignif = m_fitSvc->VKalGetImpact((*i_ntrk), PrimVrt.position(), 1, Impact, ImpactError); + //double ImpactA0=Impact[0]; + //double ImpactZ=Impact[1]; if(m_fillHist){ m_hb_trkD0->Fill( ImpactA0, m_w_1); } //---- Improved cleaning ///// if(PixelHits<=2 && ( outPixHits || splPixHits )) continue; //VK Bad idea at high Pt! @@ -198,24 +201,21 @@ namespace InDet{ else {if(PixelHits)PixelHits -=1;} // 3-layer pixel detector } if(fabs((*i_ntrk)->eta())>1.65) if(SctHits)SctHits -=1; -//----Anti-pileup cut +//----Anti-pileup cut (in Sel2TrVrt now) // double SignifR = Impact[0]/ sqrt(ImpactError[0]); // if(fabs(SignifR) < m_AntiPileupSigRCut) { // cut against tracks from pileup vertices // double SignifZ = Impact[1]/ sqrt(ImpactError[2]); // if(SignifZ > 1.+m_AntiPileupSigZCut ) continue; // if(SignifZ < 1.-m_AntiPileupSigZCut ) continue; // } -//---- Use classificator to remove Pileup+Interactions - std::vector<float> trkRank=m_trackClassificator->trkTypeWgts(*i_ntrk, PrimVrt, JetDir); - if(trkRank[2] > m_antiGarbageCut)continue; //---- StatusCode sc = CutTrk( VectPerig[4] , VectPerig[3], ImpactA0 , ImpactZ, trkChi2, PixelHits, SctHits, SharedHits, BLayHits); if( sc.isFailure() ) continue; - //double rankBTrk=RankBTrk((*i_ntrk)->pt(),JetDir.Perp(),ImpactSignif); - if(trkRank[1]>0.5)NPrimTrk += 1; - orderedTrk.emplace(trkRank[0],*i_ntrk); + double rankBTrk=RankBTrk(0.,0.,ImpactSignif); + if(rankBTrk<0.7)NPrimTrk += 1; + orderedTrk.emplace(rankBTrk,*i_ntrk); } //---- Order tracks according to ranks std::map<double,const xAOD::TrackParticle*>::reverse_iterator rt=orderedTrk.rbegin(); diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetTrkInJetType.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetTrkInJetType.cxx index 3da8d5e80ab0c21570b7ea84ed1c6b15c0aa0c29..963807762c8c6dfe74977b7b07e7e192bcd48455 100644 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetTrkInJetType.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetTrkInJetType.cxx @@ -3,13 +3,15 @@ */ #include "InDetVKalVxInJetTool/InDetTrkInJetType.h" -#include "TMVA/MethodBase.h" +#include "TMVA/MethodBDT.h" #include "TMVA/Reader.h" #include "PathResolver/PathResolver.h" #include "TLorentzVector.h" #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" -#include "Particle/TrackParticle.h" +#include "Particle/TrackParticle.h" +#include "MVAUtils/BDT.h" +#include "GaudiKernel/IChronoStatSvc.h" // //------------------------------------------------- namespace InDet { @@ -19,16 +21,19 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, const std::string& name, const IInterface* parent): AthAlgTool(type,name,parent), - m_tmvaReader(0), + m_tmvaReader(nullptr), + m_localBDT(nullptr), m_trkSctHitsCut(4), m_trkPixelHitsCut(1), m_trkChi2Cut(5.), m_trkMinPtCut(700.), + m_jetMaxPtCut(7000000.), + m_jetMinPtCut( 35000.), m_d0_limLow(-3.), m_d0_limUpp( 5.), m_Z0_limLow(-8.), m_Z0_limUpp(12.), - m_calibFileName("TrackClassif_3cl.v01.xml"), + m_calibFileName("TrackClassif_3cl.v02.xml"), m_fitterSvc("Trk::TrkVKalVrtFitter/VertexFitterTool",this) { declareInterface<IInDetTrkInJetType>(this); @@ -36,16 +41,20 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, declareProperty("trkPixelHits", m_trkPixelHitsCut , "Cut on track Pixel hits number" ); declareProperty("trkChi2", m_trkChi2Cut , "Cut on track Chi2/Ndf" ); declareProperty("trkMinPt", m_trkMinPtCut , "Minimal track Pt cut" ); + declareProperty("jetMaxPt", m_jetMaxPtCut , "Maximal jet Pt cut" ); + declareProperty("jetMinPt", m_jetMinPtCut , "Minimal jet Pt cut from training" ); declareProperty("d0_limLow", m_d0_limLow , "Low d0 impact cut" ); declareProperty("d0_limUpp", m_d0_limUpp , "Upper d0 impact cut" ); declareProperty("Z0_limLow", m_Z0_limLow , "Low Z0 impact cut" ); declareProperty("Z0_limUpp", m_Z0_limUpp , "Upper Z0 impact cut" ); + m_timingProfile=nullptr; } //Destructor--------------------------------------------------------------- InDetTrkInJetType::~InDetTrkInJetType(){ - delete m_tmvaReader; - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "InDetTrkInJetType destructor called" << endmsg; + if(m_tmvaReader)delete m_tmvaReader; + if(m_localBDT)delete m_localBDT; + ATH_MSG_DEBUG("InDetTrkInJetType destructor called"); } //Initialize--------------------------------------------------------------- @@ -53,48 +62,61 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, m_initialised = 0; m_tmvaReader = new TMVA::Reader(); //m_tmvaReader->AddVariable( "prbS", &m_prbS ); - m_tmvaReader->AddVariable( "Sig3D", &m_Sig3D ); - m_tmvaReader->AddVariable( "prbP", &m_prbP ); - m_tmvaReader->AddVariable( "pTvsJet", &m_pTvsJet ); + m_tmvaReader->AddVariable( "Sig3D", &m_Sig3D ); + m_tmvaReader->AddVariable( "prbP", &m_prbP ); + m_tmvaReader->AddVariable( "pTvsJet",&m_pTvsJet ); //m_tmvaReader->AddVariable( "prodTJ", &m_prodTJ ); - m_tmvaReader->AddVariable( "d0", &m_d0 ); - m_tmvaReader->AddVariable( "SigR", &m_SigR ); - m_tmvaReader->AddVariable( "SigZ", &m_SigZ ); - m_tmvaReader->AddVariable( "ptjet", &m_ptjet ); + m_tmvaReader->AddVariable( "d0", &m_d0 ); + m_tmvaReader->AddVariable( "SigR", &m_SigR ); + m_tmvaReader->AddVariable( "SigZ", &m_SigZ ); + m_tmvaReader->AddVariable( "ptjet", &m_ptjet ); m_tmvaReader->AddVariable( "ibl" , &m_ibl ); m_tmvaReader->AddVariable( "bl" , &m_bl ); - m_tmvaReader->AddVariable( "etajet", &m_etajet ); + m_tmvaReader->AddVariable( "etatrk", &m_etatrk ); // //-- Calibration file // -// std::string fullPathToFile = PathResolverFindCalibFile("InDetVKalVxInJetTool/TrackClassif_3cl.v01.xml"); std::string fullPathToFile = PathResolverFindCalibFile("InDetVKalVxInJetTool/"+m_calibFileName); if(fullPathToFile != ""){ if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<"TrackClassification calibration file" << fullPathToFile << endmsg; m_tmvaReader->BookMVA("BDTG", fullPathToFile); + TMVA::MethodBDT* method_bdt = dynamic_cast<TMVA::MethodBDT*> (m_tmvaReader->FindMVA("BDTG")); + if(!method_bdt){ ATH_MSG_DEBUG("Error! No method_BDT for TrackClassification!"); + return StatusCode::SUCCESS; } + bool useYesNoLeaf = false; + bool isGrad = false; + if(method_bdt->GetOptions().Contains("UseYesNoLeaf=True")) useYesNoLeaf = true; + if(method_bdt->GetOptions().Contains("BoostType=Grad")) isGrad = true; + m_localBDT = new MVAUtils::BDT( method_bdt, isGrad, useYesNoLeaf); + if(!m_localBDT){ ATH_MSG_DEBUG("Error! No_BDT from MVAUtils created"); + return StatusCode::SUCCESS; } }else{ - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<"Error! No calibration for TrackClassification found." << endmsg; + ATH_MSG_DEBUG("Error! No calibration for TrackClassification found."); return StatusCode::SUCCESS; } //------- if (m_fitterSvc.retrieve().isFailure()) { - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "Could not find Trk::TrkVKalVrtFitter" << endmsg; + ATH_MSG_DEBUG("Could not find Trk::TrkVKalVrtFitter"); return StatusCode::SUCCESS; } else { - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "InDetTrkInJetTool TrkVKalVrtFitter found" << endmsg; + ATH_MSG_DEBUG("InDetTrkInJetTool TrkVKalVrtFitter found"); } m_fitSvc = dynamic_cast<Trk::TrkVKalVrtFitter*>(&(*m_fitterSvc)); if(!m_fitSvc){ - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<" No implemented Trk::ITrkVKalVrtFitter interface" << endmsg; + ATH_MSG_DEBUG(" No implemented Trk::ITrkVKalVrtFitter interface"); return StatusCode::SUCCESS; } m_initialised = 1; // Tool is initialised successfully. +//----- + if(msgLvl(MSG::DEBUG)) ATH_CHECK(service("ChronoStatSvc", m_timingProfile)); +//----- return StatusCode::SUCCESS; } StatusCode InDetTrkInJetType::finalize() { - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<"InDetTrkInJetType finalize()" << endmsg; + if(m_timingProfile)m_timingProfile->chronoPrint("InDet_TrkInJetType"); + ATH_MSG_DEBUG("InDetTrkInJetType finalize()"); return StatusCode::SUCCESS; } @@ -106,7 +128,7 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, //-- Track quality checks std::vector<float> safeReturn(3,0.); if( !m_initialised ) return safeReturn; - if(Jet.Perp() > 2500000.) return safeReturn; + if(Jet.Perp() > m_jetMaxPtCut)return safeReturn; if(Trk->pt() < m_trkMinPtCut) return safeReturn; if(Trk->pt() > Jet.Pt()) return safeReturn; if(Trk->numberDoF() == 0) return safeReturn; //Safety @@ -117,7 +139,6 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, if( PixelHits < m_trkPixelHitsCut ) return safeReturn; if( SctHits < m_trkSctHitsCut ) return safeReturn; - std::vector<double> Impact,ImpactError; m_Sig3D=m_fitSvc->VKalGetImpact(Trk, PV.position(), 1, Impact, ImpactError); AmgVector(5) tmpPerigee = Trk->perigeeParameters().parameters(); @@ -162,6 +183,7 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, double coeffPt=10.; double pfrac=(Trk->pt()-m_trkMinPtCut)/sqrt(Jet.Perp()); m_prbP= pfrac/(coeffPt+pfrac); + m_etatrk=Trk->eta(); //--- double coeffSig=1.0; if(trkSignif<coeffSig) return safeReturn; @@ -173,6 +195,7 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, m_SigR=SignifR; //--- m_ptjet=Jet.Perp(); + if(m_ptjet<m_jetMinPtCut)m_ptjet=m_jetMinPtCut; //Very low jet pt is replaced by Pt=35GeV m_etajet=fabs(Jet.Eta()); //--- m_ibl = (float)hitIBL; @@ -184,8 +207,15 @@ InDetTrkInJetType::InDetTrkInJetType(const std::string& type, //--- TLorentzVector normJ; normJ.SetPtEtaPhiM(1.,Jet.Eta(),Jet.Phi(),0.); m_prodTJ=sqrt(TLV.Dot(normJ)); - return m_tmvaReader->EvaluateMulticlass("BDTG"); - +//--- + if(m_timingProfile)m_timingProfile->chronoStart("InDet_TrkInJetType"); + //std::vector<float> weights=m_tmvaReader->EvaluateMulticlass("BDTG"); + //-----Use MVAUtils to save CPU + std::vector<float> bdt_vars={m_Sig3D, m_prbP, m_pTvsJet, m_d0, m_SigR, m_SigZ, m_ptjet, m_ibl, m_bl, m_etatrk}; + std::vector<float> weights=m_localBDT->GetMultiResponse(bdt_vars,3); + //----- + if(m_timingProfile)m_timingProfile->chronoStop("InDet_TrkInJetType"); + return weights; } }// close namespace diff --git a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx index 4fd96f2179c2338dc6b008409aed5fc4ff822431..fa6a1452f1bc62e6c9b76ff4b0a80921e74987b7 100755 --- a/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx +++ b/InnerDetector/InDetRecTools/InDetVKalVxInJetTool/src/InDetVKalVxInJetTool.cxx @@ -9,6 +9,7 @@ #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" #include "GaudiKernel/ITHistSvc.h" +#include "GaudiKernel/IChronoStatSvc.h" #include "TH1D.h" #include "TH2D.h" #include "TTree.h" @@ -50,9 +51,9 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, m_trkSigCut(2.0), m_a0TrkErrorCut(1.0), m_zTrkErrorCut(5.0), - m_cutHFClass(0.1), - m_antiGarbageCut(0.80), - m_antiFragmentCut(0.80), + m_cutHFClass(0.15), + m_antiGarbageCut(0.75), + m_antiFragmentCut(0.70), m_Vrt2TrMassLimit(4000.), m_fillHist(false), m_existIBL(true), @@ -145,6 +146,7 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, declareProperty("TrackDetachCut", m_trackDetachCut, "To allow track from vertex detachment for MultiVertex Finder" ); declareProperty("VertexFitterTool", m_fitterSvc); + declareProperty("TrackClassTool", m_trackClassificator); // declareProperty("MaterialMap", m_materialMap); // declareProperty("TrkVKalVrtFitter", m_fitSvc); // @@ -164,18 +166,14 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, //Destructor--------------------------------------------------------------- InDetVKalVxInJetTool::~InDetVKalVxInJetTool(){ - //MsgStream log( msgSvc(), name() ) ; - //log << MSG::DEBUG << "InDetVKalVxInJetTool destructor called" << endmsg; if(m_WorkArray) delete m_WorkArray; if(m_compatibilityGraph)delete m_compatibilityGraph; - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "InDetVKalVxInJetTool destructor called" << endmsg; + ATH_MSG_DEBUG("InDetVKalVxInJetTool destructor called"); } //Initialize--------------------------------------------------------------- StatusCode InDetVKalVxInJetTool::initialize(){ - //MsgStream log( msgSvc(), name() ) ; - //log << MSG::DEBUG << "InDetVKalVxInJetTool initialize() called" << endmsg; - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "InDetVKalVxInJetTool initialize() called" << endmsg; + ATH_MSG_DEBUG("InDetVKalVxInJetTool initialize() called"); m_WorkArray = new VKalVxInJetTemp; m_compatibilityGraph = new boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS>(); @@ -214,6 +212,8 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, // if(!m_fitSvc)log<<MSG::DEBUG<<" No Trk::TrkVKalVrtFitter" << endmsg; // } +//------------------------------------------ + if(msgLvl(MSG::DEBUG)) ATH_CHECK(service("ChronoStatSvc", m_timingProfile)); //------------------------------------------ // Chose whether IBL is installed if(m_existIBL){ // 4-layer pixel detector @@ -352,6 +352,7 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, m_tuple->Branch("etajet", &m_curTup->etajet, "etajet/F"); m_tuple->Branch("phijet", &m_curTup->phijet, "phijet/F"); m_tuple->Branch("ntrk", &m_curTup->nTrkInJet, "ntrk/I"); + m_tuple->Branch("etatrk", &m_curTup->etatrk, "etatrk[ntrk]/F"); m_tuple->Branch("prbS", &m_curTup->s_prob, "prbS[ntrk]/F"); m_tuple->Branch("prbP", &m_curTup->p_prob, "prbP[ntrk]/F"); m_tuple->Branch("wgtB", &m_curTup->wgtB, "wgtB[ntrk]/F"); @@ -424,7 +425,8 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, StatusCode InDetVKalVxInJetTool::finalize() { //MsgStream log( msgSvc(), name() ); - if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<"InDetVKalVxInJetTool finalize()" << endmsg; + if(m_timingProfile)m_timingProfile->chronoPrint("InDetVKalVxInJetTool"); + ATH_MSG_DEBUG("InDetVKalVxInJetTool finalize()"); return StatusCode::SUCCESS; } @@ -435,6 +437,7 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, const TLorentzVector & JetDir, const std::vector<const xAOD::IParticle*> & IInpTrk) const { + if(m_timingProfile)m_timingProfile->chronoStart("InDetVKalVxInJetTool"); std::vector<double> Results; std::vector<const xAOD::TrackParticle*> InpTrk; std::vector<const xAOD::TrackParticle*> SelSecTrk; @@ -500,6 +503,7 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, m_compatibilityGraph->clear(); std::vector<int> zytmp(1000); m_WorkArray->m_Incomp.swap(zytmp); // Deallocate memory std::vector<int> zwtmp(0); m_WorkArray->m_Prmtrack.swap(zwtmp); // + if(m_timingProfile)m_timingProfile->chronoStop("InDetVKalVxInJetTool"); return res; } @@ -509,6 +513,7 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, const TLorentzVector & JetDir, const std::vector<const Trk::TrackParticleBase*> & InpTrkBase) const { + if(m_timingProfile)m_timingProfile->chronoStart("InDetVKalVxInJetTool"); std::vector<double> Results; std::vector<const Rec::TrackParticle*> SelSecTrk; std::vector< std::vector<const Rec::TrackParticle*> > SelSecTrkPerVrt; @@ -557,6 +562,7 @@ InDetVKalVxInJetTool::InDetVKalVxInJetTool(const std::string& type, m_compatibilityGraph->clear(); std::vector<int> zytmp(1000); m_WorkArray->m_Incomp.swap(zytmp); // Deallocate memory std::vector<int> zwtmp(0); m_WorkArray->m_Prmtrack.swap(zwtmp); // + if(m_timingProfile)m_timingProfile->chronoStop("InDetVKalVxInJetTool"); return res; // return new Trk::VxSecVertexInfo(listVrtSec); diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h index 597b3b81c97bc39e4f629167d404594f2a96d78c..a495b0ae3e153f44876373959301565dec5ac378 100644 --- a/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h +++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/PixelToTPIDTool/PixelToTPIDTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx index b53182f1441d3841ad860c185c6ea61d604865bb..ae13e42a5b081b1629993b1d41fe35fda3775243 100644 --- a/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx +++ b/InnerDetector/InDetRecTools/PixelToTPIDTool/src/PixelToTPIDTool.cxx @@ -220,7 +220,7 @@ float InDet::PixelToTPIDTool::dEdx(const Trk::Track& track, if ( (m_IBLParameterSvc->containsIBL()) and (bec==0) and (layer==0) ){ // check if IBL //loop over ToT and check if anyone is overflow (ToT==14) check for IBL cluster overflow - m_overflowIBLToT = SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getIBLOverflowToT(); + m_overflowIBLToT = SG::ReadCondHandle<PixelModuleData>(m_moduleDataKey)->getFEI4OverflowToT(0,0); const std::vector<int>& ToTs = pixclus->prepRawData()->totList(); for (int pixToT : ToTs) { diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt index d21cd07c945dcc073d33b5cd30c9c80f53508e14..1166c8a05b008b5a683fbdd8fa8c4e844464cdaf 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt @@ -19,6 +19,7 @@ atlas_depends_on_subdirs( InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetConditions/InDetCondTools InnerDetector/InDetConditions/PixelConditionsData + InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetRawEvent/InDetRawData @@ -33,7 +34,6 @@ atlas_depends_on_subdirs( Database/APR/FileCatalog DetectorDescription/AtlasDetDescr DetectorDescription/DetDescrCond/DetDescrCondTools - InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetDetDescr/PixelGeoModel Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkEventPrimitives diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h index 4e0505a0bcc07b3d3f073159e67eac36fa678372..62be2ac3880d88915c1f153efc413b8ed12a6d4b 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/ClusterMakerTool.h @@ -26,12 +26,14 @@ #include "GeoPrimitives/GeoPrimitives.h" #include "InDetCondTools/ISiLorentzAngleTool.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" #include "PixelConditionsData/PixelOfflineCalibData.h" #include "StoreGate/ReadCondHandleKey.h" #include <atomic> -class IPixelCalibSvc; template <class T> class ServiceHandle; class Identifier; class StatusCode; @@ -142,15 +144,26 @@ public: private: + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service"}; + + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; + + 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"}; + // mutable MsgStream m_log; - bool m_calibrateCharge; mutable std::atomic_bool m_issueErrorA; mutable std::atomic_bool m_forceErrorStrategy1A; mutable std::atomic_bool m_issueErrorB; mutable std::atomic_bool m_forceErrorStrategy1B; - ServiceHandle<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 diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h index c1a1bfcef9b15165c83a342dd5e8f82b3b4004e7..822652a85ede62b5cd45007a8b86f83f4758f878 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnClusterizationFactory.h @@ -37,7 +37,10 @@ #include "EventPrimitives/EventPrimitives.h" #include "InDetCondTools/ISiLorentzAngleTool.h" #include "SiClusterizationTool/TTrainedNetworkCollection.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadCondHandleKey.h" #include "CxxUtils/checker_macros.h" ATLAS_NO_CHECK_FILE_THREAD_SAFETY; @@ -45,7 +48,6 @@ ATLAS_NO_CHECK_FILE_THREAD_SAFETY; class TTrainedNetwork; class TH1; class ICoolHistSvc; - class IPixelCalibSvc; namespace Trk { class NeuralNetworkToHistoTool; @@ -209,8 +211,11 @@ namespace InDet { ToolHandle<ISiLorentzAngleTool> m_pixelLorentzAngleTool {this, "PixelLorentzAngleTool", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retreive Lorentz angle of Pixel"}; - ServiceHandle<IPixelCalibSvc> m_calibSvc - {this, "PixelCalibSvc", "PixelCalibSvc", "Pixel calibration service" }; + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service" }; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Output key"}; SG::ReadCondHandleKey<TTrainedNetworkCollection> m_readKeyWithoutTrack {this, "NnCollectionReadKey", "PixelClusterNN", "The conditions statore key for the pixel cluster NNs"}; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h index 0b73de1d964573db57027dcfb046eda7e8b1f527..e321406d5cc56ae20d85b3d82e9a9c6b30f66f79 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TotPixelClusterSplitter.h @@ -15,8 +15,10 @@ #include "InDetPrepRawData/PixelClusterParts.h" #include "InDetPrepRawData/PixelClusterSplitProb.h" #include "InDetIdentifier/PixelID.h" +#include "PixelCabling/IPixelCablingSvc.h" +#include "PixelConditionsData/PixelChargeCalibCondData.h" +#include "StoreGate/ReadCondHandleKey.h" -class IPixelCalibSvc; template <class T> class ServiceHandle; namespace InDet @@ -79,7 +81,11 @@ namespace InDet enum SplitType { PhiSplit = 0, EtaSplit = 1, NoSplit = 2 }; - ServiceHandle<IPixelCalibSvc> m_calibSvc; + ServiceHandle<IPixelCablingSvc> m_pixelCabling + {this, "PixelCablingSvc", "PixelCablingSvc", "Pixel cabling service" }; + + SG::ReadCondHandleKey<PixelChargeCalibCondData> m_chargeDataKey + {this, "PixelChargeCalibCondData", "PixelChargeCalibCondData", "Pixel charge calibration data"}; /** Minimum number of pixels in cluster to consider splitting. */ unsigned int m_minPixels; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx index 2d135491b0b81439778e594425928a09e543bca6..48ca2ce627e2605a0333a87763ebd56d9909ab33 100755 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx @@ -23,11 +23,8 @@ #include "InDetIdentifier/PixelID.h" #include "AtlasDetDescr/AtlasDetectorID.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" - #include "EventPrimitives/EventPrimitives.h" - using CLHEP::micrometer; namespace { @@ -50,12 +47,9 @@ ClusterMakerTool::ClusterMakerTool(const std::string& t, m_issueErrorA(true), m_forceErrorStrategy1A(false), m_issueErrorB(true), - m_forceErrorStrategy1B(false), - m_calibSvc("PixelCalibSvc", n) + m_forceErrorStrategy1B(false) { declareInterface<ClusterMakerTool>(this); - declareProperty("UsePixelCalibCondDB",m_calibrateCharge=true,"Compute deposited charge in Pixels"); - declareProperty("PixelCalibSvc",m_calibSvc); } //=============== Destructor ================================================= @@ -68,28 +62,9 @@ StatusCode ClusterMakerTool::initialize(){ ATH_MSG_INFO ( name() << " initialize()" ); - // Protect from the situation in which the PixelCalibSvc is not configured: - // that should be the case if no PixelRDO are read in. - // AA 01/10/2009 - if ( m_calibSvc.empty() ) { - if ( m_calibrateCharge ) { - ATH_MSG_WARNING("Requesting charge calibration, but ServiceHandle is not configured"); - ATH_MSG_WARNING("No charge calibration applied"); - } - m_calibrateCharge = false; - } - - if ( m_calibrateCharge ) { - StatusCode sc = m_calibSvc.retrieve(); - if (sc.isFailure() || !m_calibSvc) { - ATH_MSG_WARNING ( m_calibSvc.type() << " not found! " ); - ATH_MSG_WARNING ( "Continuing without calibrating charge" ); - m_calibrateCharge = false; - } - else{ - ATH_MSG_INFO ( "Retrieved tool " << m_calibSvc.type() ) ; - } - } + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_moduleDataKey.initialize()); + ATH_CHECK(m_chargeDataKey.initialize()); if (not m_pixelLorentzAngleTool.empty()) { ATH_CHECK(m_pixelLorentzAngleTool.retrieve()); @@ -105,7 +80,6 @@ StatusCode ClusterMakerTool::initialize(){ ATH_CHECK(m_clusterErrorKey.initialize()); return StatusCode::SUCCESS; - } @@ -161,17 +135,24 @@ PixelCluster* ClusterMakerTool::pixelCluster( return nullptr; } + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + if ( errorStrategy==2 && m_forceErrorStrategy1A ) errorStrategy=1; // Fill vector of charges std::vector<float> chargeList; - if (m_calibrateCharge) { + if (moduleData->getUseCalibConditions()) { int nRDO=rdoList.size(); chargeList.reserve(nRDO); for (int i=0; i<nRDO; i++) { Identifier pixid=rdoList[i]; int ToT=totList[i]; - float charge = m_calibSvc->getCharge(pixid,ToT); + Identifier moduleID = pid->wafer_id(pixid); + IdentifierHash moduleHash = pid->wafer_hash(moduleID); + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + float charge = calibData->getCharge((int)moduleHash, circ, type, 1.0*ToT); chargeList.push_back(charge); } @@ -301,6 +282,9 @@ PixelCluster* ClusterMakerTool::pixelCluster( } if ( errorStrategy==2 && m_forceErrorStrategy1B ) errorStrategy=1; + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + // Fill vector of charges and compute charge balance const InDetDD::PixelModuleDesign* design = (dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design())); if (not design){ @@ -315,15 +299,22 @@ PixelCluster* ClusterMakerTool::pixelCluster( float qColMin = 0; float qColMax = 0; std::vector<float> chargeList; int nRDO=rdoList.size(); - if (m_calibrateCharge) chargeList.reserve(nRDO); + if (moduleData->getUseCalibConditions()) { chargeList.reserve(nRDO); } for (int i=0; i<nRDO; i++) { Identifier pixid=rdoList[i]; int ToT=totList[i]; float charge = ToT; - if (m_calibrateCharge){ - - charge = m_calibSvc->getCharge(pixid,ToT); + if (moduleData->getUseCalibConditions()) { + + Identifier moduleID = pixelID.wafer_id(pixid); + IdentifierHash moduleHash = pixelID.wafer_hash(moduleID); // wafer hash + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + charge = calibData->getCharge((int)moduleHash, circ, type, 1.0*ToT); + if (moduleHash<12 || moduleHash>2035) { + charge = ToT/8.0*(8000.0-1200.0)+1200.0; + } chargeList.push_back(charge); } diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx index 1de39a533d90e91e11849c23127ca6b6aaac36e5..2e09935978de206d4448d731515f799ecfbc239e 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx @@ -90,10 +90,8 @@ namespace InDet { StatusCode NnClusterizationFactory::initialize() { - - if (!m_calibSvc.name().empty()) { - ATH_CHECK( m_calibSvc.retrieve() ); - } + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); ATH_CHECK(m_pixelLorentzAngleTool.retrieve()); @@ -789,6 +787,8 @@ namespace InDet { return input; } + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + // const InDet::PixelCluster* pCluster = pcot->prepRawData(); const std::vector<Identifier>& rdos = pCluster.rdoList(); @@ -816,8 +816,12 @@ namespace InDet { // recreate the charge: should be a method of the calibSvc int tot0 = *tot; - float ch = m_calibSvc->getCharge(*rdosBegin,tot0); - + Identifier pixid = *rdosBegin; + Identifier moduleID = pixelID.wafer_id(pixid); + IdentifierHash moduleHash = pixelID.wafer_hash(moduleID); // wafer hash + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + float ch = calibData->getCharge((int)moduleHash, circ, type, 1.0*tot0); chListRecreated.push_back(ch); totListRecreated.push_back(tot0); } diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx index a183e8631a027243dbccb6ba70958ea64bdaf800..b6bd6ea564cee4fa0ef395bfb33d045f6f697514 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TotPixelClusterSplitter.cxx @@ -12,17 +12,13 @@ #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "PixelConditionsServices/IPixelCalibSvc.h" - InDet::TotPixelClusterSplitter::TotPixelClusterSplitter(const std::string & type, const std::string & name, const IInterface * parent) : AthAlgTool(type, name, parent), - m_calibSvc("PixelCalibSvc", name), m_minPixels(3), m_maxPixels(25), m_doLongPixels(true) { declareInterface<IPixelClusterSplitter>(this); - declareProperty("PixelCalibSvc", m_calibSvc); } InDet::TotPixelClusterSplitter::~TotPixelClusterSplitter() @@ -30,7 +26,8 @@ InDet::TotPixelClusterSplitter::~TotPixelClusterSplitter() StatusCode InDet::TotPixelClusterSplitter::initialize() { - CHECK(m_calibSvc.retrieve()); + ATH_CHECK(m_pixelCabling.retrieve()); + ATH_CHECK(m_chargeDataKey.initialize()); return StatusCode::SUCCESS; } @@ -53,6 +50,8 @@ std::vector<InDet::PixelClusterParts> InDet::TotPixelClusterSplitter::splitClust InDetDD::SiCellId * CellIds = new InDetDD::SiCellId[NumPixels]; + SG::ReadCondHandle<PixelChargeCalibCondData> calibData(m_chargeDataKey); + // Detect special pixels and exclude them if necessary. // Veto removed on 28-7-2011 by K. Barry - residual-level // studies show RMS improvement when ganged-pixel containing @@ -213,7 +212,7 @@ std::vector<InDet::PixelClusterParts> InDet::TotPixelClusterSplitter::splitClust if (!pixelIDp){ ATH_MSG_ERROR("Could not get PixelID pointer"); } - // const PixelID& pixelID = *pixelIDp; + const PixelID& pixelID = *pixelIDp; for (unsigned int i = 0; i < NumPixels; i++) @@ -235,8 +234,15 @@ std::vector<InDet::PixelClusterParts> InDet::TotPixelClusterSplitter::splitClust { for (int j = 0; j < 2; j++) { + + Identifier pixid = Rdos[i]; + Identifier moduleID = pixelID.wafer_id(pixid); + IdentifierHash moduleHash = pixelID.wafer_hash(moduleID); // wafer hash + int circ = m_pixelCabling->getFE(&pixid,moduleID); + int type = m_pixelCabling->getPixelType(pixid); + SplitRdos[j].push_back(Rdos[i]); - Totgroups[j].push_back(static_cast<int>(m_calibSvc->getTotMean(Rdos[i],Charges[i]/2.))); + Totgroups[j].push_back(static_cast<int>(calibData->getToT((int)moduleHash,circ,type,Charges[i]/2.0))); Lvl1groups[j].push_back(Lvl1a); } } diff --git a/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py b/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py index 74951c2704b5408c137f1d2e9c0617c88f593389..c2904ff3416618772a2636f2fabff91248d0a020 100644 --- a/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py +++ b/InnerDetector/InDetValidation/InDetGeometryValidation/share/ReadSiDetectorElements_jobOptions.py @@ -60,11 +60,8 @@ from AthenaCommon.AppMgr import ServiceMgr # Pixel # # Load DCS service -from PixelConditionsTools.PixelDCSConditionsToolSetup import PixelDCSConditionsToolSetup -pixelDCSConditionsToolSetup = PixelDCSConditionsToolSetup() -pixelDCSConditionsToolSetup.setup() -pixelDCSConditionsTool = pixelDCSConditionsToolSetup.getTool() from SiPropertiesTool.PixelSiPropertiesToolSetup import PixelSiPropertiesToolSetup + pixelSiPropertiesToolSetup = PixelSiPropertiesToolSetup() pixelSiPropertiesToolSetup.setup() pixelSiPropertiesTool = pixelSiPropertiesToolSetup.getTool() @@ -75,7 +72,7 @@ pixelLorentzAngleTool = pixelLorentzAngleToolSetup.PixelLorentzAngleTool ReadPixelElements.UseConditionsTools = True ReadPixelElements.SiLorentzAngleTool = pixelLorentzAngleTool ReadPixelElements.SiPropertiesTool = pixelSiPropertiesTool -ReadPixelElements.SiConditionsTool = pixelDCSConditionsTool +ReadPixelElements.SiConditionsTool = None # # SCT @@ -101,7 +98,6 @@ ReadSCTElements.DetEleCollKey = "SCT_DetectorElementCollection" print ReadPixelElements print pixelLorentzAngleTool -print pixelDCSConditionsTool print pixelSiPropertiesTool print ReadSCTElements diff --git a/InnerDetector/InDetValidation/InDetTruthVertexValidation/CMakeLists.txt b/InnerDetector/InDetValidation/InDetTruthVertexValidation/CMakeLists.txt index 8d9c36b25eb9ee4a98b3a2879e58a503b7d2fcee..14eebba8b7d4c4a54b9b287a1aea11ff261d1954 100644 --- a/InnerDetector/InDetValidation/InDetTruthVertexValidation/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetTruthVertexValidation/CMakeLists.txt @@ -33,8 +33,9 @@ find_package( ROOT COMPONENTS Core Geometry Tree MathCore Hist RIO pthread TBB ) # Generate a CINT dictionary source file: atlas_add_root_dictionary( InDetTruthVertexValidationLib _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS InDetTruthVertexValidation/InDetVertexTruthMatchUtils.h + InDetTruthVertexValidation/InDetVertexTruthMatchTool.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Component(s) in the package: atlas_add_library( InDetTruthVertexValidationLib diff --git a/LArCalorimeter/LArBadChannelTool/LArBadChannelTool/LArBadFebMasker.h b/LArCalorimeter/LArBadChannelTool/LArBadChannelTool/LArBadFebMasker.h index 2b8a636b6ce5e5a4a27b0609826861292a750879..411677123d04c207630500aab8dd3aae4cb7da68 100644 --- a/LArCalorimeter/LArBadChannelTool/LArBadChannelTool/LArBadFebMasker.h +++ b/LArCalorimeter/LArBadChannelTool/LArBadChannelTool/LArBadFebMasker.h @@ -15,7 +15,7 @@ #include "StoreGate/ReadCondHandleKey.h" -class LArBadFebMasker : virtual public ILArBadFebMasker, public AthAlgTool +class LArBadFebMasker : public extends<AthAlgTool, ILArBadFebMasker> { public: @@ -31,9 +31,6 @@ public: virtual bool isMaskingOn() const override final//allow the client code to check in order to optimize {return m_doMasking;} - StatusCode queryInterface(const InterfaceID& riid, void** ppvIf); - static const InterfaceID& interfaceID(); - private: typedef LArBadFebEnum::BitWord BitWord; diff --git a/LArCalorimeter/LArBadChannelTool/src/LArBadFebMasker.cxx b/LArCalorimeter/LArBadChannelTool/src/LArBadFebMasker.cxx index d34e8d40af06d01d9b496f4b4266de6c97664ed9..688b430ece86c8fc46364fc427134911611fb738 100644 --- a/LArCalorimeter/LArBadChannelTool/src/LArBadFebMasker.cxx +++ b/LArCalorimeter/LArBadChannelTool/src/LArBadFebMasker.cxx @@ -9,13 +9,12 @@ LArBadFebMasker::LArBadFebMasker(const std::string& type, const std::string& name, const IInterface* parent) : - AthAlgTool(type, name, parent), + base_class(type, name, parent), m_bfContKey("LArBadFeb"), m_bitMask(0), m_problemWords(defaultProblems()), m_doMasking(false) { - declareInterface<ILArBadFebMasker>(this); declareProperty("BFKey",m_bfContKey,"Key of the BadFebContainer in the conditions store"); declareProperty("ProblemsToMask", m_problemWords, "List of FEB problems to be masked."); declareProperty("DoMasking", m_doMasking, "Flag to turn FEB masking on or off."); @@ -93,26 +92,3 @@ const std::vector<std::string>& LArBadFebMasker::defaultProblems() return defaults; } -StatusCode LArBadFebMasker::queryInterface(const InterfaceID& riid, void** ppvIf ) -{ - if(riid == ILArBadFebMasker::interfaceID()) - { - *ppvIf = static_cast<ILArBadFebMasker*>(this); - addRef(); - return StatusCode::SUCCESS; - } - else if(riid == interfaceID()) - { - *ppvIf = this; - addRef(); - return StatusCode::SUCCESS; - } - else return AthAlgTool::queryInterface( riid, ppvIf ); -} - -const InterfaceID& LArBadFebMasker::interfaceID() -{ - static const InterfaceID id("LArBadFebMasker", 1 , 0); - return id; -} - diff --git a/LArCalorimeter/LArCellRec/python/LArCollisionTimeGetter.py b/LArCalorimeter/LArCellRec/python/LArCollisionTimeGetter.py index 5f8df036673a6d95e5ebb80d096018931d09a1d9..fdaaa599c67a4b133b6d3c76b1f20818b790b021 100644 --- a/LArCalorimeter/LArCellRec/python/LArCollisionTimeGetter.py +++ b/LArCalorimeter/LArCellRec/python/LArCollisionTimeGetter.py @@ -32,16 +32,13 @@ class LArCollisionTimeGetter ( Configured ) : import traceback try: - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - from AthenaCommon.AppMgr import ToolSvc - theCaloNoiseTool = CaloNoiseToolDefault() - ToolSvc+=theCaloNoiseTool + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + CaloNoiseCondAlg() from LArCellRec.LArCellRecConf import LArCollisionTimeAlg from AthenaCommon.GlobalFlags import globalflags self._handle = \ LArCollisionTimeAlg("LArCollisionTimeAlg", - NoiseTool = theCaloNoiseTool, isMC = globalflags.DataSource != 'data', cutIteration=False) diff --git a/LArCalorimeter/LArCellRec/share/LArCollisionTime_jobOptions.py b/LArCalorimeter/LArCellRec/share/LArCollisionTime_jobOptions.py index 798165410bf7088dffb2e6e0a8ae60de1b596f58..b952885ebc6a62224810fbb30a3880651236c4b8 100644 --- a/LArCalorimeter/LArCellRec/share/LArCollisionTime_jobOptions.py +++ b/LArCalorimeter/LArCellRec/share/LArCollisionTime_jobOptions.py @@ -3,13 +3,10 @@ #David Cote: added include block to avoid duplication ERROR when TAG_COMM and DESDs are executed in the same job (both including this fragment). include.block("LArCellRec/LArCollisionTime_jobOptions.py") -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -ToolSvc+=theCaloNoiseTool - +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() from LArCellRec.LArCellRecConf import LArCollisionTimeAlg theLArCollisionTimeAlg = LArCollisionTimeAlg("LArCollisionTimeAlg") -theLArCollisionTimeAlg.NoiseTool = theCaloNoiseTool from AthenaCommon.GlobalFlags import globalflags if globalflags.DataSource()=='data' : diff --git a/LArCalorimeter/LArCellRec/src/LArCollisionTimeAlg.cxx b/LArCalorimeter/LArCellRec/src/LArCollisionTimeAlg.cxx index 2f79a4dbb9cb94c9d16249eb1ebc83de61e32177..3862e82739f7f5cd3b5f75bf39f2a904bfb47cd9 100644 --- a/LArCalorimeter/LArCellRec/src/LArCollisionTimeAlg.cxx +++ b/LArCalorimeter/LArCellRec/src/LArCollisionTimeAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "LArCollisionTimeAlg.h" @@ -10,10 +10,8 @@ //Constructor LArCollisionTimeAlg:: LArCollisionTimeAlg(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name,pSvcLocator), - m_nevt(0), - m_calo_id(nullptr),m_noiseTool("CaloNoiseTool/calonoise") + m_calo_id(nullptr) { - declareProperty("NoiseTool", m_noiseTool); declareProperty("cellContainerName", m_cellsContName="AllCalo" ); declareProperty("collisionTime", m_collTimeName="LArCollisionTime" ); } @@ -31,15 +29,10 @@ StatusCode LArCollisionTimeAlg::initialize() ATH_MSG_DEBUG ("LArCollisionTimeAlg initialize()"); //retrieve ID helpers - ATH_CHECK( detStore()->retrieve( m_caloIdMgr ) ); - m_calo_id = m_caloIdMgr->getCaloCell_ID(); - - - // get calonoise tool - if (m_noiseTool) { - ATH_CHECK( m_noiseTool.retrieve() ); - } + ATH_CHECK(detStore()->retrieve(m_calo_id,"CaloCell_ID")); + //Initialize VarHandles + ATH_CHECK( m_noiseCDOKey.initialize() ); ATH_CHECK( m_cellsContName.initialize() ); ATH_CHECK( m_collTimeName.initialize() ); @@ -59,22 +52,25 @@ StatusCode LArCollisionTimeAlg::execute() { //............................................. - ATH_MSG_DEBUG ("LArCollisionTimeAlg execute()"); - - m_nevt++; + ATH_MSG_DEBUG ("LArCollisionTimeAlg execute()"); // Get the CaloCellContainer SG::ReadHandle<CaloCellContainer> cell_container (m_cellsContName); if(!cell_container.isValid()) { ATH_MSG_INFO (" Could not get pointer to Cell Container "); - // Construct the output object + // Construct a dummy output object SG::WriteHandle<LArCollisionTime> larTime (m_collTimeName); ATH_CHECK( larTime.record (std::make_unique<LArCollisionTime>()) ); return StatusCode::SUCCESS; } + + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey}; + const CaloNoise* noiseCDO=*noiseHdl; + + // Loop over the CaloCellContainer int ncellA=0; int ncellC=0; @@ -108,12 +104,9 @@ StatusCode LArCollisionTimeAlg::execute() if ( (provenance & mask1) != cut1 && (provenance & 0x3C00) != 0x3000 && !m_isMC) continue; if ( (provenance & 0x2C00) != 0x2000 && m_isMC) continue; - - double energy= (*first_cell)->energy(); - double noise = -1; - if (!m_noiseTool.empty()) { - noise = m_noiseTool->totalNoiseRMS((*first_cell)); - } + + const double energy= (*first_cell)->energy(); + const double noise=noiseCDO->getNoise(cellID,(*first_cell)->gain()); double signif=9999.; if (noise>0.) signif = energy/noise; if (signif < 5.) continue; diff --git a/LArCalorimeter/LArCellRec/src/LArCollisionTimeAlg.h b/LArCalorimeter/LArCellRec/src/LArCollisionTimeAlg.h index 9d383ca5ca427de697127ec6c7c2c8824d295e7f..b6210ae4539a1826165bab447d933426676ee4fd 100644 --- a/LArCalorimeter/LArCellRec/src/LArCollisionTimeAlg.h +++ b/LArCalorimeter/LArCellRec/src/LArCollisionTimeAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // TheLArCollisionsAlg.h @@ -8,25 +8,20 @@ #ifndef LARCELLREC_LARCOLLISIONTIMEALG_H #define LARCELLREC_LARCOLLISIONTIMEALG_H -#include <string> - -// Gaudi includes - #include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Property.h" -#include "StoreGate/StoreGateSvc.h" -#include "CaloInterface/ICaloNoiseTool.h" -#include "CaloIdentifier/CaloIdManager.h" #include "CaloEvent/CaloCellContainer.h" #include "LArRecEvent/LArCollisionTime.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" +#include "CaloConditions/CaloNoise.h" +#include "StoreGate/ReadCondHandleKey.h" + +class CaloCell_ID; class LArCollisionTimeAlg : public AthAlgorithm { - public: + public: //Gaudi style constructor and execution methods /** Standard Athena-Algorithm Constructor */ LArCollisionTimeAlg(const std::string& name, ISvcLocator* pSvcLocator); @@ -40,15 +35,12 @@ class LArCollisionTimeAlg : public AthAlgorithm { /** standard Athena-Algorithm method */ virtual StatusCode finalize() override final; - private: + private: //--------------------------------------------------- // Member variables //--------------------------------------------------- - - int m_nevt; const CaloCell_ID* m_calo_id; - const DataHandle<CaloIdManager> m_caloIdMgr; //--------------------------------------------------- // Properties @@ -58,10 +50,10 @@ class LArCollisionTimeAlg : public AthAlgorithm { Gaudi::Property<float> m_timeCut { this, "timeDiffCut", 5., "|A-C| time < timeDiffCut to pass the filter" }; Gaudi::Property<int> m_minCells { this, "nCells", 2, "min. number of cells per endcap to pass the filter" }; - ToolHandle<ICaloNoiseTool> m_noiseTool; SG::ReadHandleKey<CaloCellContainer> m_cellsContName; SG::WriteHandleKey<LArCollisionTime> m_collTimeName; + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","totalNoise","SG Key of CaloNoise data object"}; }; #endif diff --git a/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py b/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py index aa70e8b6ef31008d697e63da8f017832f3a9882b..0740bca07c2d038814dc85a9f7806154f4556b54 100644 --- a/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py +++ b/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py @@ -1,5 +1,6 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from __future__ import print_function from AthenaConfiguration.AthConfigFlags import AthConfigFlags @@ -29,7 +30,7 @@ def _getLArRunInfo(prevFlags): runnbr=prevFlags.Input.RunNumber[0] #If more than one run, assume config for first run is valid for all runs dbStr="COOLONL_LAR/"+prevFlags.IOVDb.DatabaseInstance _lArRunInfo=getLArFormatForRun(run=runnbr,connstring=dbStr) - print "Got LArRunInfo for run ",runnbr + print ("Got LArRunInfo for run ",runnbr) return _lArRunInfo diff --git a/LArCalorimeter/LArMonTools/share/LArCoverage_jobOptions.py b/LArCalorimeter/LArMonTools/share/LArCoverage_jobOptions.py index 26539badd6804ada9a2f32fd2c4b2bc8fa3c7567..988ef6ed877407ad2bfc381684db8ac3a6f4f819 100755 --- a/LArCalorimeter/LArMonTools/share/LArCoverage_jobOptions.py +++ b/LArCalorimeter/LArMonTools/share/LArCoverage_jobOptions.py @@ -2,20 +2,19 @@ if 'EventBlockSize' not in dir(): EventBlockSize=0 + +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg(noisetype="electronicNoise") + ###### LAr Coverage Tool Configuration ############### from LArMonTools.LArMonToolsConf import LArCoverage theLArCoverage = LArCoverage(name="LArCoverage", ProcessNEvents = EventBlockSize, - LArDigitContainerKey = LArMonFlags.LArDigitKey(), LArBadChannelMask = theLArBadChannelsMasker, Nevents = 40 ) -#ToolSvc += theLArCoverage LArMon.AthenaMonTools+=[ theLArCoverage ] -# CaloNoiseTool configuration -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theLArCoverageCaloNoiseTool=CaloNoiseToolDefault() -ToolSvc+=theLArCoverageCaloNoiseTool -LArCoverage.LArCaloNoiseTool=theLArCoverageCaloNoiseTool + + diff --git a/LArCalorimeter/LArMonTools/src/LArCoverage.cxx b/LArCalorimeter/LArMonTools/src/LArCoverage.cxx index 2b382e9fac381dc9a91895fde930af7d485a72b9..ec3557509fd00c53e8de16721a6471727210f9ae 100644 --- a/LArCalorimeter/LArMonTools/src/LArCoverage.cxx +++ b/LArCalorimeter/LArMonTools/src/LArCoverage.cxx @@ -35,6 +35,8 @@ #include <map> #include <utility> +#include "StoreGate/ReadHandle.h" + using namespace std; /*---------------------------------------------------------*/ @@ -64,15 +66,11 @@ LArCoverage::LArCoverage(const std::string& type, m_hCaloNoiseToolHEC(), m_hCaloNoiseToolFCAL() { - declareProperty("LArDigitContainerKey",m_LArDigitContainerKey = "FREE"); - declareProperty("LArRawChannelKey",m_channelKey="LArRawChannels"); + declareProperty("LArRawChannelKey",m_rawChannelsKey="LArRawChannels"); declareProperty("LArBadChannelMask",m_badChannelMask); - declareProperty("LArCaloNoiseTool",m_caloNoiseTool); declareProperty("Nevents",m_nevents = 50); - declareProperty("Nsigma",m_nsigma = 3); m_eventsCounter = 0; - m_noisycells.clear(); m_LArOnlineIDHelper = NULL; m_LArEM_IDHelper = NULL; @@ -143,15 +141,9 @@ LArCoverage::initialize() // LArOnlineIDStrHelper m_strHelper = new LArOnlineIDStrHelper(m_LArOnlineIDHelper); m_strHelper->setDefaultNameType(LArOnlineIDStrHelper::LARONLINEID); - - // Get CaloNoiseTool - if ( m_caloNoiseTool.retrieve().isFailure() ) { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_caloNoiseTool ); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG( "Retrieved tool " << m_caloNoiseTool ); - } - + + ATH_CHECK( m_noiseCDOKey.initialize() ); + ATH_CHECK( m_rawChannelsKey.initialize() ); // End Initialize ManagedMonitorToolBase::initialize().ignore(); ATH_MSG_DEBUG( "Successful Initialize LArCoverage " ); @@ -590,20 +582,21 @@ LArCoverage::fillHistograms() if(m_eventsCounter > m_nevents ) return StatusCode::SUCCESS; // Retrieve Raw Channels Container - const LArRawChannelContainer* pRawChannelsContainer; - StatusCode sc = evtStore()->retrieve(pRawChannelsContainer, m_channelKey); - if(sc.isFailure()) { - ATH_MSG_WARNING( "Can\'t retrieve LArRawChannelContainer with key " << m_channelKey ); - return StatusCode::SUCCESS; - } + + SG::ReadHandle<LArRawChannelContainer> pRawChannelsContainer(m_rawChannelsKey); + if(!pRawChannelsContainer.isValid()) { + ATH_MSG_ERROR( " Can not retrieve LArRawChannelContainer: " + << m_rawChannelsKey.key() ); + return StatusCode::FAILURE; + } + + SG::ReadCondHandle<CaloNoise> noiseHdl{m_noiseCDOKey}; + const CaloNoise* noiseCDO=*noiseHdl; - // Loop over LArRawChannels - SelectAllLArRawChannels AllRaw(pRawChannelsContainer); - for (SelectAllLArRawChannels::const_iterator itRaw = AllRaw.begin(); itRaw != AllRaw.end(); ++itRaw) { - const LArRawChannel* pRawChannel = (*itRaw) ; - int provenanceChan = pRawChannel->provenance(); - float energyChan = pRawChannel->energy(); - HWIdentifier id = pRawChannel->hardwareID(); + for (const LArRawChannel& pRawChannel : *pRawChannelsContainer) { + int provenanceChan = pRawChannel.provenance(); + float energyChan = pRawChannel.energy(); + HWIdentifier id = pRawChannel.hardwareID(); //CaloGain::CaloGain gain = pRawChannel->gain(); Identifier offlineID = m_larCablingService->cnvToIdentifier(id); @@ -632,7 +625,8 @@ LArCoverage::fillHistograms() if (m_LArOnlineIDHelper->isHECchannel(id)) phiChan = CaloPhiRange::fix(phiChan); // Retrieve expected noise - float noise = m_caloNoiseTool->getNoise(caloDetElement,ICalorimeterNoiseTool::ELECTRONICNOISE); + float noise = noiseCDO->getNoise(offlineID,m_highestGain[caloDetElement->getSubCalo()]); + //->getNoise(caloDetElement,ICalorimeterNoiseTool::ELECTRONICNOISE); if(m_eventsCounter == 1){ diff --git a/LArCalorimeter/LArMonTools/src/LArCoverage.h b/LArCalorimeter/LArMonTools/src/LArCoverage.h index 2c613e5b31032bc58d8d173e4fe76173e5246b99..ada669d77e3dbf5edcc34b90de39fccbcc2e0da8 100644 --- a/LArCalorimeter/LArMonTools/src/LArCoverage.h +++ b/LArCalorimeter/LArMonTools/src/LArCoverage.h @@ -1,3 +1,4 @@ +//Dear emacs, this is -*-c++-*- /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -11,7 +12,6 @@ #ifndef LARMONTOOLS_LARCOVERAGE_H #define LARMONTOOLS_LARCOVERAGE_H -#include "SelectAllLArRawChannels.h" #include "LArOnlineIDStrHelper.h" #include "AthenaMonitoring/ManagedMonitorToolBase.h" @@ -22,19 +22,15 @@ #include "CaloDetDescr/CaloDetDescriptor.h" #include "CaloDetDescr/CaloDetDescrElement.h" #include "CaloGeoHelpers/CaloPhiRange.h" -#include "CaloInterface/ICaloNoiseTool.h" -#include "CaloInterface/ICalorimeterNoiseTool.h" #include "Identifier/HWIdentifier.h" #include "LArIdentifier/LArOnlineID.h" -#include "LArRawEvent/LArRawChannel.h" #include "LArRawEvent/LArRawChannelContainer.h" -#include "EventContainers/SelectAllObject.h" #include "LArCabling/LArCablingLegacyService.h" #include "LArRecConditions/ILArBadChannelMasker.h" #include "StoreGate/ReadCondHandleKey.h" #include "LArRecConditions/LArBadChannelCont.h" - +#include "CaloConditions/CaloNoise.h" #include <string> #include <map> @@ -74,7 +70,7 @@ class LArCoverage: public ManagedMonitorToolBase * Overwrite dummy method from MonitorToolBase */ StatusCode procHistograms(); - protected: +private: // services const LArOnlineID* m_LArOnlineIDHelper; @@ -90,14 +86,11 @@ class LArCoverage: public ManagedMonitorToolBase ToolHandle<LArCablingLegacyService> m_larCablingService; /** Handle to bad-channel tools */ ToolHandle<ILArBadChannelMasker> m_badChannelMask; - /** Handle to caloNoiseTool */ - ToolHandle < ICaloNoiseTool > m_caloNoiseTool ; + SG::ReadHandleKey<LArRawChannelContainer> m_rawChannelsKey; SG::ReadCondHandleKey<LArBadChannelCont> m_BCKey{this, "BadChanKey", "LArBadChannel", "SG bad channels key"}; SG::ReadCondHandleKey<LArBadFebCont> m_BFKey{this, "MFKey", "LArBadFeb", "SG missing FEBs key"}; - - - private: + SG::ReadCondHandleKey<CaloNoise> m_noiseCDOKey{this,"CaloNoiseKey","electronicNoise","SG Key of CaloNoise data object"}; // To retrieve bad channel DB keywords int DBflag(HWIdentifier onID); @@ -114,14 +107,10 @@ class LArCoverage: public ManagedMonitorToolBase void FixEmptyBins(); // Properties - std::string m_LArDigitContainerKey; - std::string m_channelKey; - int m_nsigma; int m_nevents; // Other things int m_eventsCounter; - std::map<HWIdentifier,int> m_noisycells; // Coverage Maps TH2I_LW* m_hCoverageEMBA[4]; TH2I_LW* m_hCoverageEMBC[4]; @@ -145,6 +134,16 @@ class LArCoverage: public ManagedMonitorToolBase TH2I_LW* m_hBadChannelsEndcapA; TH2I_LW* m_hBadChannelsEndcapC; + + const std::array<CaloGain::CaloGain,CaloCell_Base_ID::NSUBCALO> m_highestGain{ + CaloGain::LARHIGHGAIN, //LAREM + CaloGain::LARMEDIUMGAIN, //LARHEC + CaloGain::LARHIGHGAIN, //LARFCAL + CaloGain::TILEHIGHHIGH, //TILE + CaloGain::LARHIGHGAIN //LARMINIFCAL + }; + + }; #endif diff --git a/LArCalorimeter/LArRecConditions/LArRecConditions/ILArBadFebMasker.h b/LArCalorimeter/LArRecConditions/LArRecConditions/ILArBadFebMasker.h index 97e83851954b735210e76303f10dcc3658589401..782ea0789aceaf0df55b73600381876062e2dc2f 100644 --- a/LArCalorimeter/LArRecConditions/LArRecConditions/ILArBadFebMasker.h +++ b/LArCalorimeter/LArRecConditions/LArRecConditions/ILArBadFebMasker.h @@ -14,11 +14,7 @@ class LArBadFeb; class ILArBadFebMasker : public virtual IAlgTool { public: - static const InterfaceID& interfaceID() - { - static const InterfaceID IID_ILArBadFebMasker("ILArBadFebMasker", 1, 0); - return IID_ILArBadFebMasker; - } + DeclareInterfaceID (ILArBadFebMasker, 1, 0); virtual ~ILArBadFebMasker() {} diff --git a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/CMakeLists.txt b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/CMakeLists.txt index 006d0fda5b55af5a8e348294bfeb9419ac281c68..9d568ba0a74c2e88e9e25df5b91ca1753f3ac1fb 100644 --- a/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/TopPhysUtils/TopDataPreparation/CMakeLists.txt @@ -1,15 +1,15 @@ -# Auto-generated on: 2017-03-09 17:44:33.125987 # Declare the name of this package: -atlas_subdir( TopDataPreparation None ) +atlas_subdir( TopDataPreparation ) # This package uses ROOT: find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) # Generate a CINT dictionary source file: atlas_add_root_dictionary( TopDataPreparation _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS TopDataPreparation/SampleXsection.h + TopDataPreparation/SampleXsectionSvc.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopDataPreparation Root/*.cxx Root/*.h Root/*.icc diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt index 5369d691651856262f1ef83b0be93336640dfec1..61452def1bec7ab6ff6f7365f86a98851dd2ee47 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt @@ -1,7 +1,6 @@ -# Auto-generated on: 2017-03-08 14:47:33.629640 # Declare the name of this package: -atlas_subdir( TopAnalysis None ) +atlas_subdir( TopAnalysis ) # This package depends on other packages: atlas_depends_on_subdirs( PUBLIC @@ -31,13 +30,12 @@ atlas_depends_on_subdirs( PUBLIC # This package uses ROOT: find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) -# Custom definitions needed for this package: -add_definitions( -g ) - # Generate a CINT dictionary source file: atlas_add_root_dictionary( TopAnalysis _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS TopAnalysis/ObjectLoaderStandardCuts.h + TopAnalysis/EventSaverFlatNtuple.h TopAnalysis/EventSaverxAOD.h + TopAnalysis/EventSaverxAODNext.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopAnalysis Root/*.cxx Root/*.h Root/*.icc diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt index 40fc8c714216072ae14018e554fb08773b4fb5de..4f7b254566bd7319e75728b627dd987045181dcb 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt @@ -1,7 +1,6 @@ -# Auto-generated on: 2017-03-08 14:47:35.608258 # Declare the name of this package: -atlas_subdir( TopConfiguration None ) +atlas_subdir( TopConfiguration ) # This package depends on other packages: atlas_depends_on_subdirs( PUBLIC @@ -11,12 +10,10 @@ atlas_depends_on_subdirs( PUBLIC find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) find_package( Boost REQUIRED COMPONENTS iostreams ) -message( STATUS "${Boost_LIBRARIES}" ) - # Generate a CINT dictionary source file: atlas_add_root_dictionary( TopConfiguration _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS TopConfiguration/TopPersistentSettings.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopConfiguration Root/*.cxx Root/*.h Root/*.icc diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/CMakeLists.txt index 867e742c8c54e5d74640ced11785ace31ce8419e..ef2ff4ab1debfb6b4f2f9c78d2806048afa0c2b2 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopEvent/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEvent/CMakeLists.txt @@ -1,7 +1,6 @@ -# Auto-generated on: 2017-03-08 14:47:36.020351 # Declare the name of this package: -atlas_subdir( TopEvent None ) +atlas_subdir( TopEvent ) # This package depends on other packages: atlas_depends_on_subdirs( PUBLIC @@ -26,8 +25,9 @@ find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) # Generate a CINT dictionary source file: atlas_add_root_dictionary( TopEvent _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS TopEvent/SystematicEvent.h TopEvent/KLFitterResult.h + TopEvent/PseudoTopResult.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopEvent Root/*.cxx Root/*.h Root/*.icc diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt index b5c4a637ac3a2aea92449d201de47d004774ba2e..c3017dfafd18d6d416f218ceb7866598f4c05b81 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt @@ -1,7 +1,6 @@ -# Auto-generated on: 2017-03-08 14:47:36.489231 # Declare the name of this package: -atlas_subdir( TopEventReconstructionTools None ) +atlas_subdir( TopEventReconstructionTools ) # This package depends on other packages: atlas_depends_on_subdirs( PUBLIC @@ -21,8 +20,9 @@ find_package( KLFitter ) # Generate a CINT dictionary source file: atlas_add_root_dictionary( TopEventReconstructionTools _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS TopEventReconstructionTools/TopEventReconstructionToolsLoader.h + Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopEventReconstructionTools Root/*.cxx Root/*.h Root/*.icc diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt index 7fb43493d7fba746a1ea1761ab31ee16a7e21fe7..3413593ed74b58b021ca87770a9512e41aca9207 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt @@ -1,7 +1,6 @@ -# Auto-generated on: 2017-03-08 14:47:36.708684 # Declare the name of this package: -atlas_subdir( TopEventSelectionTools None ) +atlas_subdir( TopEventSelectionTools ) # This package depends on other packages: atlas_depends_on_subdirs( PUBLIC @@ -16,13 +15,11 @@ atlas_depends_on_subdirs( PUBLIC # This package uses ROOT: find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) -# Custom definitions needed for this package: -add_definitions( -g ) - # Generate a CINT dictionary source file: atlas_add_root_dictionary( TopEventSelectionTools _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS TopEventSelectionTools/ToolLoaderBase.h + TopEventSelectionTools/TopEventSelectionToolsLoader.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopEventSelectionTools Root/*.cxx Root/*.h Root/*.icc diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/CMakeLists.txt index bf87cf3d7c5417042e15eb18f38040220f581ef4..18c2a2477a833ea557f1df47af41e1834ce1bb00 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopFakes/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopFakes/CMakeLists.txt @@ -1,7 +1,6 @@ -# Auto-generated on: 2017-03-08 14:47:37.318937 # Declare the name of this package: -atlas_subdir( TopFakes None ) +atlas_subdir( TopFakes ) # This package depends on other packages: atlas_depends_on_subdirs( PUBLIC @@ -12,9 +11,14 @@ atlas_depends_on_subdirs( PUBLIC find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO Math MathCore MathMore Graf Matrix ) # Generate a CINT dictionary source file: +set( _extraHeader ) +if( XAOD_STANDALONE ) + set( _extraHeader TopFakes/TopFakesMMWeightCalculator.h ) +endif() atlas_add_root_dictionary( TopFakes _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS ${_extraHeader} TopFakes/FakesWeights.h TopFakes/MMEffSet.h + TopFakes/MMEfficiency.h TopFakes/MatrixUtils.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopFakes Root/*.cxx Root/*.h Root/*.icc diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt index 444d0abb932443cb6c8485273f1de870b40fe275..421048d9bed4a809e74359fd5e77c4154d8fbf36 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt @@ -1,7 +1,6 @@ -# Auto-generated on: 2017-03-08 14:47:37.990954 # Declare the name of this package: -atlas_subdir( TopObjectSelectionTools None ) +atlas_subdir( TopObjectSelectionTools ) # This package depends on other packages: atlas_depends_on_subdirs( PUBLIC @@ -31,13 +30,10 @@ atlas_depends_on_subdirs( PUBLIC # This package uses ROOT: find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf ) -# Custom definitions needed for this package: -add_definitions( -g ) - # Generate a CINT dictionary source file: atlas_add_root_dictionary( TopObjectSelectionTools _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS TopObjectSelectionTools/RCJetMC15.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopObjectSelectionTools Root/*.cxx Root/*.h Root/*.icc diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt index 6ca87a65978478f07d23628e63367244600cdc62..e39ada9b15a41f896215f4c8c6cd9e3d783c23cf 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt +++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt @@ -1,7 +1,6 @@ -# Auto-generated on: 2017-03-08 14:47:38.930377 # Declare the name of this package: -atlas_subdir( TopPartons None ) +atlas_subdir( TopPartons ) # This package depends on other packages: atlas_depends_on_subdirs( PUBLIC @@ -15,13 +14,10 @@ atlas_depends_on_subdirs( PUBLIC # This package uses ROOT: find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore TMVA Graf ) -# Custom definitions needed for this package: -add_definitions( -g ) - # Generate a CINT dictionary source file: atlas_add_root_dictionary( TopPartons _cintDictSource - ROOT_HEADERS Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) + ROOT_HEADERS TopPartons/PartonHistory.h Root/LinkDef.h + EXTERNAL_PACKAGES ROOT ) # Build a library that other components can link against: atlas_add_library( TopPartons Root/*.cxx Root/*.h Root/*.icc diff --git a/Projects/AnalysisBase/CMakeLists.txt b/Projects/AnalysisBase/CMakeLists.txt index 1a91179210d702d31cb432836c78322ab553cda4..d93a5f72f53e0ba92d9020c026dd6483f9077fa3 100644 --- a/Projects/AnalysisBase/CMakeLists.txt +++ b/Projects/AnalysisBase/CMakeLists.txt @@ -17,18 +17,13 @@ unset( _version ) # This project is built on top of AnalysisBaseExternals: find_package( AnalysisBaseExternals REQUIRED ) -# Find Python. This is needed because AnalysisBaseExternals sets up -# a wrong value for PYTHONHOME. And nothing in AnalysisBase builds -# against Python to correct it. -find_package( PythonInterp ) - # Set up the build/runtime environment: -set( AnalysisBaseReleaseEnvironment_DIR ${CMAKE_SOURCE_DIR} ) +set( AnalysisBaseReleaseEnvironment_DIR ${CMAKE_SOURCE_DIR}/cmake CACHE PATH + "Path to AnalysisBaseReleaseEnvironmentConfig.cmake" ) find_package( AnalysisBaseReleaseEnvironment REQUIRED ) -# Add the directory to the global include path, where the project -# will create the RootCore/Packages.h header: -include_directories( ${CMAKE_BINARY_DIR}/RootCore/include ) +# Make the local CMake files visible to AtlasCMake. +list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake ) # Set up CTest: atlas_ctest_setup() @@ -39,9 +34,9 @@ atlas_project( AnalysisBase ${ANALYSISBASE_PROJECT_VERSION} PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ ) # Configure and install the post-configuration file: -configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in - ${CMAKE_BINARY_DIR}/PostConfig.cmake @ONLY ) -install( FILES ${CMAKE_BINARY_DIR}/PostConfig.cmake +configure_file( ${CMAKE_SOURCE_DIR}/cmake/PostConfig.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake @ONLY ) +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) # Generate replacement rules for the installed paths: @@ -59,9 +54,9 @@ endif() lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh ) lcg_generate_env( - SH_FILE ${CMAKE_BINARY_DIR}/env_setup_install.sh + SH_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh REPLACE ${_replacements} ) -install( FILES ${CMAKE_BINARY_DIR}/env_setup_install.sh +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh DESTINATION . RENAME env_setup.sh ) # Set up the release packaging: diff --git a/Projects/AnalysisBase/AnalysisBaseReleaseEnvironmentConfig.cmake b/Projects/AnalysisBase/cmake/AnalysisBaseReleaseEnvironmentConfig.cmake similarity index 94% rename from Projects/AnalysisBase/AnalysisBaseReleaseEnvironmentConfig.cmake rename to Projects/AnalysisBase/cmake/AnalysisBaseReleaseEnvironmentConfig.cmake index f858eefcb8d1304adc657ba1bd7e60983d611276..60f3e58de651af561e45048e6ae13d5fb1351ca2 100644 --- a/Projects/AnalysisBase/AnalysisBaseReleaseEnvironmentConfig.cmake +++ b/Projects/AnalysisBase/cmake/AnalysisBaseReleaseEnvironmentConfig.cmake @@ -7,7 +7,6 @@ add_definitions( -DROOTCORE ) add_definitions( -DXAOD_STANDALONE ) add_definitions( -DXAOD_ANALYSIS ) -add_definitions( -DROOTCORE_RELEASE_SERIES=25 ) # And the same variables for CMake as well: set( ROOTCORE TRUE CACHE BOOL diff --git a/Projects/AnalysisBase/PostConfig.cmake.in b/Projects/AnalysisBase/cmake/PostConfig.cmake.in similarity index 74% rename from Projects/AnalysisBase/PostConfig.cmake.in rename to Projects/AnalysisBase/cmake/PostConfig.cmake.in index 4fbd01fb38383e0a2024de61bbb8dac21be938e5..2a44274587653cef2dab9bad4db9ffc0fd9e3e6d 100644 --- a/Projects/AnalysisBase/PostConfig.cmake.in +++ b/Projects/AnalysisBase/cmake/PostConfig.cmake.in @@ -2,14 +2,10 @@ # File setting up some basic properties for the installed analysis releases. # -# Make all compilation see the RootCore/Packages.h file: -include_directories( $ENV{AnalysisBase_DIR}/RootCore/include ) - # This is a standalone project, so set the appropriate compile flags: add_definitions( -DROOTCORE ) add_definitions( -DXAOD_STANDALONE ) add_definitions( -DXAOD_ANALYSIS ) -add_definitions( -DROOTCORE_RELEASE_SERIES=$ENV{ROOTCORE_RELEASE_SERIES} ) # And some variables for CMake as well: set( ROOTCORE TRUE CACHE BOOL diff --git a/Projects/AnalysisBase/cmake/README.txt.in b/Projects/AnalysisBase/cmake/README.txt.in new file mode 100644 index 0000000000000000000000000000000000000000..6ae603b4f13ab009f11a1b78e6c9f220766638a1 --- /dev/null +++ b/Projects/AnalysisBase/cmake/README.txt.in @@ -0,0 +1,5 @@ + + AnalysisBase - @CMAKE_PROJECT_VERSION@ + +This package provides version @CMAKE_PROJECT_VERSION@ of the ATLAS +standalone analysis software. diff --git a/Projects/AnalysisBase/externals.txt b/Projects/AnalysisBase/externals.txt index 661d4c57f0dc590ad23329c9672668b81b5c1507..8f8aa0218f965c8f050e6917204907293a04e6e4 100644 --- a/Projects/AnalysisBase/externals.txt +++ b/Projects/AnalysisBase/externals.txt @@ -6,4 +6,4 @@ # forbidden. # The version of atlas/atlasexternals to use: -AnalysisBaseExternalsVersion = 2.0.27 +AnalysisBaseExternalsVersion = 2.0.28 diff --git a/Projects/AnalysisTop/externals.txt b/Projects/AnalysisTop/externals.txt index 0e374e90d8f5bb429d05693032c0fd739bcfaa36..25a315ed3f3fb1d3eb84ec6e28f857160f9e83d9 100644 --- a/Projects/AnalysisTop/externals.txt +++ b/Projects/AnalysisTop/externals.txt @@ -1,4 +1,4 @@ # Versions of the various externals to build before starting the build of # this project, when doing a full stack nightly build. -AnalysisBaseExternalsVersion = 2.0.27 +AnalysisBaseExternalsVersion = 2.0.28 diff --git a/Projects/AthDataQuality/CMakeLists.txt b/Projects/AthDataQuality/CMakeLists.txt index 29f8dbf089caf40e128999b87999c0c8ad148f75..e4e8a222c17c737bf99640067194e81c3915c36a 100644 --- a/Projects/AthDataQuality/CMakeLists.txt +++ b/Projects/AthDataQuality/CMakeLists.txt @@ -27,20 +27,22 @@ set( LCG_VERSION_NUMBER 94 CACHE STRING "Version number for the LCG release to use" ) find_package( LCG ${LCG_VERSION_NUMBER} EXACT REQUIRED ) -# External(s) needed at runtime: +# External(s) needed at build/runtime: find_package( Xrootd ) find_package( GSL ) find_package( PNG ) +find_package( TBB ) # Make CMake find the project specific code we have here: -list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/modules ) +list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake ) # Set up CTest: atlas_ctest_setup() # Set up a work directory project: atlas_project( AthDataQuality ${ATHDATAQUALITY_PROJECT_VERSION} - PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ ) + PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ + LANGUAGES CXX ) # Generate the environment setup for the externals, to be used during the build: lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh ) @@ -73,9 +75,13 @@ string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" TDAQ-COMMON_ATROOT "${TDAQ-COMMON_ATROOT}" ) string( REPLACE "${TDAQ-COMMON_VERSION}" "\${TDAQ-COMMON_VERSION}" TDAQ-COMMON_ATROOT "${TDAQ-COMMON_ATROOT}" ) -configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in +configure_file( ${CMAKE_SOURCE_DIR}/cmake/PreConfig.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PreConfig.cmake @ONLY ) +configure_file( ${CMAKE_SOURCE_DIR}/cmake/PostConfig.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake @ONLY ) -install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake +install( FILES + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PreConfig.cmake + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) # Set up CPack: diff --git a/Projects/AthDataQuality/README.md b/Projects/AthDataQuality/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f06940819181cb13fb82ac0c3ec07509aa0ca055 --- /dev/null +++ b/Projects/AthDataQuality/README.md @@ -0,0 +1,40 @@ +The ATLAS Data Quality Mini-Project +=================================== + +This is the configuration for building the AthDataQuality project that is +used in ATLAS's data quality monitoring. + +Build Instructions +------------------ + +The build procedure for this project is the same as for all the other ones. +You first execute the + + build_externals.sh + +script with its "usual arguments", followed by the + + build.sh + +script. As in the other cases the scripts will create a `build` directory +with the same layout as the scripts in the Athena project do. + +The main difference is that AthDataQuality, unlike any of the other projects +in the repository, is built as a single project. There is no +`AthDataQualityExternals` project for it. So the `build_externals.sh` script +actually just downloads the correct version of +[atlas/atlasexternals](https://gitlab.cern.ch/atlas/atlasexternals), as it is +still needed for the build, but doesn't build a project out of it. That +repository is instead used directly while building this project using +`build.sh`. + +Project Versioning Scheme +------------------------- + +When in production, the version number of this project goes hand in hand with +the version number of the Athena project. The scheme used in the 21.0 branch +is/was: + - Whenever PROC builds a new Athena 21.0.X release, AthDataQuality is also + updated by PROC to 21.0.X.1; + - Whenever the DQ team builds a new AthDataQuality 21.0.X.Y release, the + AthDataQuality version is updated to 21.0.X.(Y+1). diff --git a/Projects/AthDataQuality/Readme.txt b/Projects/AthDataQuality/Readme.txt deleted file mode 100644 index 0f23122a37920a71d4204aba0316136b24fef638..0000000000000000000000000000000000000000 --- a/Projects/AthDataQuality/Readme.txt +++ /dev/null @@ -1,5 +0,0 @@ - -Project build versioning scheme to be updated in AthDataQuality/version.txt - -Whenever PROC builds new Athena 21.0.X, the AthDataQuality is also updated by PROC to 21.0.X.1 -Whenever DQ team builds new AthDataQuality 21.0.X.Y, the AthDataQuality is updated to 21.0.X.(Y+1) diff --git a/Projects/AthDataQuality/build.sh b/Projects/AthDataQuality/build.sh index 55fb9805d6fee16576a556fe4c16b1e938272e50..8f3eb2039b041a8963ac904e354350b6af9f1c8e 100755 --- a/Projects/AthDataQuality/build.sh +++ b/Projects/AthDataQuality/build.sh @@ -98,7 +98,7 @@ if [ -z "$BUILDDIR" ]; then fi mkdir -p ${BUILDDIR} BUILDDIR=$(cd ${BUILDDIR} && pwd) -source $AthDataQualitySrcDir/build_env.sh -b $BUILDDIR +source $AthDataQualitySrcDir/build_env.sh -b $BUILDDIR >& ${BUILDDIR}/build_env.log cat ${BUILDDIR}/build_env.log # create the actual build directory diff --git a/Projects/AthDataQuality/PostConfig.cmake.in b/Projects/AthDataQuality/cmake/PostConfig.cmake.in similarity index 100% rename from Projects/AthDataQuality/PostConfig.cmake.in rename to Projects/AthDataQuality/cmake/PostConfig.cmake.in diff --git a/Projects/AthDataQuality/cmake/PreConfig.cmake.in b/Projects/AthDataQuality/cmake/PreConfig.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..cbc689c04da978a3d89503bebc1e08e000279440 --- /dev/null +++ b/Projects/AthDataQuality/cmake/PreConfig.cmake.in @@ -0,0 +1,17 @@ +# +# File taking care of pointing the downstream projects at the right +# version of LCG. +# + +# Set the version of LCG to use. +set( LCG_VERSION_POSTFIX "@LCG_VERSION_POSTFIX@" CACHE STRING + "Version postfix for the LCG release to use" ) +set( LCG_VERSION_NUMBER @LCG_VERSION_NUMBER@ CACHE STRING + "Version number for the LCG release to use" ) + +# Find LCG. +if( AthDataQuality_FIND_QUIETLY ) + find_package( LCG ${LCG_VERSION_NUMBER} REQUIRED EXACT QUIET ) +else() + find_package( LCG ${LCG_VERSION_NUMBER} REQUIRED EXACT ) +endif() diff --git a/Projects/AthDataQuality/cmake/README.txt.in b/Projects/AthDataQuality/cmake/README.txt.in new file mode 100644 index 0000000000000000000000000000000000000000..a9bc65213cec15816fd00cdce65d041b82182dd3 --- /dev/null +++ b/Projects/AthDataQuality/cmake/README.txt.in @@ -0,0 +1,5 @@ + + AthDataQuality - @CMAKE_PROJECT_VERSION@ + +This package provides version @CMAKE_PROJECT_VERSION@ of the ATLAS +offline data quality software. diff --git a/Projects/AthDataQuality/modules/skeletons/atlas_export_sanitizer.cmake.in b/Projects/AthDataQuality/cmake/skeletons/atlas_export_sanitizer.cmake.in similarity index 100% rename from Projects/AthDataQuality/modules/skeletons/atlas_export_sanitizer.cmake.in rename to Projects/AthDataQuality/cmake/skeletons/atlas_export_sanitizer.cmake.in diff --git a/Projects/AthDataQuality/externals.txt b/Projects/AthDataQuality/externals.txt index 8e00784facd1412407cba50f34186e6151be06a7..213291871d90621535f007c08aac0210d507f5cd 100644 --- a/Projects/AthDataQuality/externals.txt +++ b/Projects/AthDataQuality/externals.txt @@ -5,4 +5,4 @@ # an "origin/" prefix before it. For tags however this is explicitly # forbidden. -AtlasExternalsVersion = 2.0.27 +AtlasExternalsVersion = 2.0.28 diff --git a/Projects/AthSimulation/CMakeLists.txt b/Projects/AthSimulation/CMakeLists.txt index fc01c1d8aa7d82a093e38b60aa6f304d8701a046..509c59176ee5056b935667d8e618d64ec8c6c624 100644 --- a/Projects/AthSimulation/CMakeLists.txt +++ b/Projects/AthSimulation/CMakeLists.txt @@ -17,15 +17,17 @@ find_package( AtlasCMake QUIET ) find_package( AthSimulationExternals REQUIRED ) find_package( Gaudi REQUIRED ) -# External(s) needed at runtime: +# External(s) needed at build and runtime: find_package( Frontier_Client ) find_package( PNG ) +find_package( VDT ) -# Temporarily setting additional compile flags here: -add_definitions( -DSIMULATIONBASE ) - +# Set the project into "SIMULATIONBASE mode". set( SIMULATIONBASE TRUE CACHE BOOL "Flag specifying that this is a simulation release build" ) +if( SIMULATIONBASE ) + add_definitions( -DSIMULATIONBASE ) +endif() # Load all the files from the externals/ subdirectory: file( GLOB _externals "${CMAKE_CURRENT_SOURCE_DIR}/externals/*.cmake" ) @@ -40,6 +42,9 @@ endforeach() unset( _external ) unset( _externals ) +# Make the local CMake files visible to AtlasCMake. +list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake ) + # Set up CTest: atlas_ctest_setup() @@ -47,7 +52,7 @@ atlas_ctest_setup() atlas_project( AthSimulation ${ATHSIMULATION_PROJECT_VERSION} USE AthSimulationExternals ${AthSimulationExternals_VERSION} PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ - FORTRAN ) + LANGUAGES C CXX Fortran ) # Install the external configurations: install( DIRECTORY ${CMAKE_SOURCE_DIR}/externals @@ -68,15 +73,16 @@ if( NOT "$ENV{NICOS_PROJECT_RELNAME}" STREQUAL "" ) endif() # Now generate and install the installed setup files: -lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/env_setup_install.sh +lcg_generate_env( + SH_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh REPLACE ${_replacements} ) -install( FILES ${CMAKE_BINARY_DIR}/env_setup_install.sh +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh DESTINATION . RENAME env_setup.sh ) # Configure and install the post-configuration file: -configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in - ${CMAKE_BINARY_DIR}/PostConfig.cmake @ONLY ) -install( FILES ${CMAKE_BINARY_DIR}/PostConfig.cmake +configure_file( ${CMAKE_SOURCE_DIR}/cmake/PostConfig.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake @ONLY ) +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) # Package up the release using CPack: diff --git a/Projects/AthSimulation/PostConfig.cmake.in b/Projects/AthSimulation/cmake/PostConfig.cmake.in similarity index 89% rename from Projects/AthSimulation/PostConfig.cmake.in rename to Projects/AthSimulation/cmake/PostConfig.cmake.in index f6a306b369d5a676079d409a6646c71fb2b03e0e..44a30ccfeafd3031c26c5d46003fe10464518715 100644 --- a/Projects/AthSimulation/PostConfig.cmake.in +++ b/Projects/AthSimulation/cmake/PostConfig.cmake.in @@ -10,11 +10,12 @@ else() find_package( Gaudi REQUIRED ) endif() -# Temporarily setting additional compile flags here: -add_definitions( -DSIMULATIONBASE ) - +# Set the project into "SIMULATIONBASE mode". set( SIMULATIONBASE TRUE CACHE BOOL "Flag specifying that this is a simulation release build" ) +if( SIMULATIONBASE ) + add_definitions( -DSIMULATIONBASE ) +endif() # Load all the files from the externals/ subdirectory: get_filename_component( _thisdir ${CMAKE_CURRENT_LIST_FILE} PATH ) diff --git a/Projects/AthSimulation/cmake/README.txt.in b/Projects/AthSimulation/cmake/README.txt.in new file mode 100644 index 0000000000000000000000000000000000000000..d0c53e27bc1aaa01f17ce1af3bbd338b98412086 --- /dev/null +++ b/Projects/AthSimulation/cmake/README.txt.in @@ -0,0 +1,5 @@ + + AthSimulation - @CMAKE_PROJECT_VERSION@ + +This package provides version @CMAKE_PROJECT_VERSION@ of the ATLAS +simulation software. diff --git a/Projects/AthSimulation/externals.txt b/Projects/AthSimulation/externals.txt index 2064ba522f810f7eec36305132977457f1659cfb..d8b89abe8f5ff0be644d2d5f74a906e0b4e5f1a1 100644 --- a/Projects/AthSimulation/externals.txt +++ b/Projects/AthSimulation/externals.txt @@ -6,7 +6,7 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthSimulationExternalsVersion = 2.0.27 +AthSimulationExternalsVersion = 2.0.28 # The version of atlas/Gaudi to use: GaudiVersion = v31r0.003 diff --git a/Projects/AthSimulation/externals/HEPUtils.cmake b/Projects/AthSimulation/externals/HEPUtils.cmake index 27acb546c018a84bbefb77daf190b94a47cde026..8344158ac506661512518cc490a53e012719bfd0 100644 --- a/Projects/AthSimulation/externals/HEPUtils.cmake +++ b/Projects/AthSimulation/externals/HEPUtils.cmake @@ -2,6 +2,6 @@ # File specifying the location of HEPUtils to use. # -set( HEPUTILS_LCGVERSION 1.1.0 ) +set( HEPUTILS_LCGVERSION 1.3.2 ) set( HEPUTILS_LCGROOT ${LCG_RELEASE_DIR}/MCGenerators/heputils/${HEPUTILS_LCGVERSION}/${LCG_PLATFORM} ) diff --git a/Projects/AthSimulation/externals/YODA.cmake b/Projects/AthSimulation/externals/YODA.cmake index 9aae31a0fe1633ec3d5e971a1bfeddea96d93c42..bc0106b3654d6ef953b5f663ad28def43ae8e8d7 100644 --- a/Projects/AthSimulation/externals/YODA.cmake +++ b/Projects/AthSimulation/externals/YODA.cmake @@ -2,6 +2,6 @@ # File specifying the location of YODA to use. # -set( YODA_LCGVERSION 1.6.6 ) +set( YODA_LCGVERSION 1.7.0 ) set( YODA_LCGROOT ${LCG_RELEASE_DIR}/MCGenerators/yoda/${YODA_LCGVERSION}/${LCG_PLATFORM} ) diff --git a/Projects/Athena/CMakeLists.txt b/Projects/Athena/CMakeLists.txt index 68fdebbc05333ecf357493017aba8456d7acd178..917c843e126e4e266d06c8270dff5a7fe5a366f1 100644 --- a/Projects/Athena/CMakeLists.txt +++ b/Projects/Athena/CMakeLists.txt @@ -67,6 +67,9 @@ endforeach() unset( _external ) unset( _externals ) +# Make the local CMake files visible to AtlasCMake. +list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake ) + # Set up CTest: atlas_ctest_setup() @@ -74,7 +77,7 @@ atlas_ctest_setup() atlas_project( Athena ${ATHENA_PROJECT_VERSION} USE AthenaExternals ${AthenaExternals_VERSION} PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ - FORTRAN ) + LANGUAGES C CXX Fortran ) # Install the external configurations: install( DIRECTORY ${CMAKE_SOURCE_DIR}/externals @@ -95,9 +98,10 @@ if( NOT "$ENV{NICOS_PROJECT_RELNAME}" STREQUAL "" ) endif() # Now generate and install the installed setup files: -lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/env_setup_install.sh +lcg_generate_env( + SH_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh REPLACE ${_replacements} ) -install( FILES ${CMAKE_BINARY_DIR}/env_setup_install.sh +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh DESTINATION . RENAME env_setup.sh ) # Configure and install the post-configuration file: @@ -112,9 +116,9 @@ string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" string( REPLACE "${TDAQ_VERSION}" "\${TDAQ_VERSION}" TDAQ_ATROOT "${TDAQ_ATROOT}" ) -configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in - ${CMAKE_BINARY_DIR}/PostConfig.cmake @ONLY ) -install( FILES ${CMAKE_BINARY_DIR}/PostConfig.cmake +configure_file( ${CMAKE_SOURCE_DIR}/cmake/PostConfig.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake @ONLY ) +install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) # Package up the release using CPack: diff --git a/Projects/Athena/build_externals.sh b/Projects/Athena/build_externals.sh index bdd649acd15e1a9f0b1313245f5bfebeade178de..260703c7112970626cea39ec3bb743025bf8076b 100755 --- a/Projects/Athena/build_externals.sh +++ b/Projects/Athena/build_externals.sh @@ -22,7 +22,7 @@ BUILDDIR="" BUILDTYPE="RelWithDebInfo" FORCE="" CI="" -EXTRACMAKE=(-DLCG_VERSION_NUMBER=95 -DLCG_VERSION_POSTFIX="") +EXTRACMAKE=() while getopts ":t:b:x:fch" opt; do case $opt in t) diff --git a/Projects/Athena/PostConfig.cmake.in b/Projects/Athena/cmake/PostConfig.cmake.in similarity index 100% rename from Projects/Athena/PostConfig.cmake.in rename to Projects/Athena/cmake/PostConfig.cmake.in diff --git a/Projects/Athena/cmake/README.txt.in b/Projects/Athena/cmake/README.txt.in new file mode 100644 index 0000000000000000000000000000000000000000..d43eefb5d577f1ea87acdcf50ed2e12526be565d --- /dev/null +++ b/Projects/Athena/cmake/README.txt.in @@ -0,0 +1,5 @@ + + Athena - @CMAKE_PROJECT_VERSION@ + +This package provides version @CMAKE_PROJECT_VERSION@ of the ATLAS +offline software. diff --git a/Projects/Athena/externals.txt b/Projects/Athena/externals.txt index 1195b836e1c18d63e15df6c5e6130a5fca6d67d7..80c04e50e589dd40768597872d206a2cf846f6f6 100644 --- a/Projects/Athena/externals.txt +++ b/Projects/Athena/externals.txt @@ -6,7 +6,7 @@ # forbidden. # The version of atlas/atlasexternals to use: -AthenaExternalsVersion = 2.0.27 +AthenaExternalsVersion = 2.0.28 # The version of atlas/Gaudi to use: GaudiVersion = v31r0.003 diff --git a/Projects/WorkDir/CMakeLists.txt b/Projects/WorkDir/CMakeLists.txt index bfd93eb1cdfbfd70ff8bc1edc00687b798a5133e..177514f09a8393c166d2ca0dbd46740ef95c0f1d 100644 --- a/Projects/WorkDir/CMakeLists.txt +++ b/Projects/WorkDir/CMakeLists.txt @@ -4,7 +4,7 @@ # # Set the minimum required CMake version: -cmake_minimum_required( VERSION 3.2 FATAL_ERROR ) +cmake_minimum_required( VERSION 3.6 FATAL_ERROR ) # Let the user pick up updated AtlasCMake/AtlasLCG versions for testing. # Remember that it's not a problem if AtlasCMake is not found, that's why @@ -15,7 +15,7 @@ find_package( AtlasCMake QUIET ) # of possible project names. Basically the names of all the other # sub-directories inside the Projects/ directory in the repository. set( _parentProjectNames Athena AthenaP1 AnalysisBase AthAnalysisBase - AthSimulation AthDerivation ) + AthSimulation AthDerivation AthDataQuality ) set( _defaultParentProject Athena ) set( _defaultUseFortran TRUE ) foreach( _pp ${_parentProjectNames} ) diff --git a/Reconstruction/eflowRec/python/PFLocalHadCal.py b/Reconstruction/eflowRec/python/PFLocalHadCal.py index b5e6c2d34c288c17dff8a47260e679a0d5f62329..2c6d61f8d8a309ae713221aa02dbbfe0b66a337b 100644 --- a/Reconstruction/eflowRec/python/PFLocalHadCal.py +++ b/Reconstruction/eflowRec/python/PFLocalHadCal.py @@ -66,36 +66,13 @@ class PFLocalHadCal: print traceback.format_exc() return False - - try: - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool = CaloNoiseToolDefault() - except: - mlog.error("could not import CaloTools.CaloNoiseToolDefault") - print traceback.format_exc() - return False - - - try: + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + #For LCWeightsTool needs electronic noise + CaloNoiseCondAlg(noisetype="electronicNoise") from AthenaCommon.AppMgr import ServiceMgr as svcMgr - except: - mlog.error("coud not import svcMgr") - print traceback.format_ec() - return False - - if (False == hasattr(svcMgr.ToolSvc, "CaloNoiseToolDefault") ): - try: - from AthenaCommon.AppMgr import ToolSvc - except: - mlog.error("could not import ToolSvc") - print traceback.format_ec() - return False - - ToolSvc += theCaloNoiseTool LCWeight.CorrectionKey = "H1ClusterCellWeights" LCWeight.SignalOverNoiseCut = 2.0 - LCWeight.CaloNoiseTool = theCaloNoiseTool LCWeight.UseHadProbability = True return LCWeight diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py index 950f5b5fe6da32ba884ad0d16e0111485b4efdc2..3570418c6ef582d90b65b7e70aa4a01df91de9d0 100644 --- a/Reconstruction/eflowRec/share/PFlowMTConfig.py +++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py @@ -16,6 +16,9 @@ TrackSelectionTool = InDet__InDetTrackSelectionTool() from AthenaCommon.AppMgr import ToolSvc ToolSvc += TrackSelectionTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() + TrackSelectionTool.CutLevel = "TightPrimary" TrackSelectionTool.minPt = 500.0 @@ -103,16 +106,9 @@ PFClusterMomentsMaker = CaloClusterMomentsMaker("PFClusterMomentsMaker") from CaloRec.CaloTopoClusterFlags import jobproperties -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool - PFClusterMomentsMaker.MaxAxisAngle = 20*deg PFClusterMomentsMaker.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute() PFClusterMomentsMaker.MinBadLArQuality = 4000 -PFClusterMomentsMaker.CaloNoiseTool = theCaloNoiseTool -PFClusterMomentsMaker.UsePileUpNoise = True PFClusterMomentsMaker.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() PFClusterMomentsMaker.OutputLevel = INFO PFClusterMomentsMaker.MomentsNames = [ diff --git a/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py b/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py index e2876a1ab9074385172cf6e8e1b49d70132ee835..1b97e0974cb774656b7d1b4bb63eb8719a95d337 100644 --- a/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py +++ b/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py @@ -29,10 +29,10 @@ from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.GlobalFlags import globalflags from RecExConfig.RecFlags import rec -from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault -theCaloNoiseTool = CaloNoiseToolDefault() -from AthenaCommon.AppMgr import ToolSvc -ToolSvc += theCaloNoiseTool +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() +#For LCWeightsTool needs electronic noise +CaloNoiseCondAlg(noisetype="electronicNoise") # configure cell weight calibration if jobproperties.CaloTopoClusterFlags.doCellWeightCalib(): @@ -66,7 +66,6 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): # H1Weight = H1ClusterCellWeightTool("H1Weight") # H1Weight.CorrectionKey = "H1ClusterCellWeights" # H1Weight.SignalOverNoiseCut = 2.0 - # H1Weight.CaloNoiseTool = theCaloNoiseTool # # OOCC = OutOfClusterCorrectionTool("OOCC") # OOCC.CorrectionKey = "OOCCorrection" @@ -86,7 +85,6 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): LCWeight = CaloLCWeightTool("LCWeight") LCWeight.CorrectionKey = "H1ClusterCellWeights" LCWeight.SignalOverNoiseCut = 2.0 - LCWeight.CaloNoiseTool = theCaloNoiseTool LCWeight.UseHadProbability = True LCOut = CaloLCOutOfClusterTool("LCOut") @@ -101,7 +99,6 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): #DMTool = DeadMaterialCorrectionTool2("DMTool") #DMTool.HadDMCoeffKey = "HadDMCoeff2" - #DMTool.SignalOverNoiseCut = 1.0 #DMTool.ClusterRecoStatus = 0 #DMTool.WeightModeDM = 2 #DMTool.CaloNoiseTool = theCaloNoiseTool @@ -154,8 +151,6 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): TopoMomentsForTaus = CaloClusterMomentsMaker ("TauPi0TopoMoments") TopoMomentsForTaus.WeightingOfNegClusters = jobproperties.CaloTopoClusterFlags.doTreatEnergyCutAsAbsolute() TopoMomentsForTaus.MaxAxisAngle = 20*deg -TopoMomentsForTaus.CaloNoiseTool = theCaloNoiseTool -TopoMomentsForTaus.UsePileUpNoise = True TopoMomentsForTaus.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() TopoMomentsForTaus.MinBadLArQuality = 4000 TopoMomentsForTaus.MomentsNames = ["FIRST_PHI" @@ -228,9 +223,6 @@ TopoClusterForTaus.SeedSamplingNames = [ "PreSamplerB", "EMB1", "EMB2", # Do we want to use EMB3? "PreSamplerE", "EME1", "EME2" # Do we want to use EME3? ] -TopoClusterForTaus.CaloNoiseTool = theCaloNoiseTool -TopoClusterForTaus.UseCaloNoiseTool = True -TopoClusterForTaus.UsePileUpNoise = True TopoClusterForTaus.NeighborOption = "super3D" TopoClusterForTaus.RestrictHECIWandFCalNeighbors = False TopoClusterForTaus.RestrictPSNeighbors = True diff --git a/TileCalorimeter/TileMonitoring/share/TileMonTopoCluster_jobOptions.py b/TileCalorimeter/TileMonitoring/share/TileMonTopoCluster_jobOptions.py index 7c62296a5894645b4106285db0566a5a9557660e..ccaac7458aef2f5adf5116d39456764aeca9a416 100644 --- a/TileCalorimeter/TileMonitoring/share/TileMonTopoCluster_jobOptions.py +++ b/TileCalorimeter/TileMonitoring/share/TileMonTopoCluster_jobOptions.py @@ -30,9 +30,11 @@ from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault theCaloNoiseTool = CaloNoiseToolDefault() from CaloRec.CaloTopoClusterFlags import jobproperties +from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg +CaloNoiseCondAlg() + from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloNoiseTool -print theCaloNoiseTool doTopoClusterLocalCalib=False @@ -104,10 +106,7 @@ TileTopoMaker.CalorimeterNames=["TILE"] TileTopoMaker.SeedSamplingNames = ["TileBar0", "TileBar1", "TileBar2", "TileExt0", "TileExt1", "TileExt2", "TileGap1", "TileGap2", "TileGap3"] -TileTopoMaker.CaloNoiseTool=theCaloNoiseTool #TileTopoMaker.NoiseSigma= 1.68 / 1023 / 64 * 800 * 1.414214 * GeV -TileTopoMaker.UseCaloNoiseTool=True -TileTopoMaker.UsePileUpNoise=True TileTopoMaker.NeighborOption = "super3D" TileTopoMaker.RestrictHECIWandFCalNeighbors = False TileTopoMaker.CellThresholdOnEorAbsEinSigma = 0.0 diff --git a/Tools/PROCTools/python/RunTier0TestsTools.py b/Tools/PROCTools/python/RunTier0TestsTools.py index adcac6a301e7a13334e4b91c1796edce05df6d70..652b7c96276be79d37ca165c6893f6d8fef296e8 100644 --- a/Tools/PROCTools/python/RunTier0TestsTools.py +++ b/Tools/PROCTools/python/RunTier0TestsTools.py @@ -24,7 +24,7 @@ ciRefFileMap = { 's3126-22.0' : 'v4', # OverlayTier0Test_required-test 'overlay-d1498-21.0' : 'v2', - 'overlay-d1498-22.0' : 'v13', + 'overlay-d1498-22.0' : 'v14', 'overlay-bkg-21.0' : 'v1', 'overlay-bkg-22.0' : 'v1', } diff --git a/Tools/PyUtils/CMakeLists.txt b/Tools/PyUtils/CMakeLists.txt index cdeb97162f24e768bd38d5d82bd509a0cdc96b29..48f93dfc0068f0755a0c989f6b1fb60232e740a7 100644 --- a/Tools/PyUtils/CMakeLists.txt +++ b/Tools/PyUtils/CMakeLists.txt @@ -60,5 +60,9 @@ atlas_add_test( RootUtils EXTRA_PATTERNS "Ran 1 test in |CheckABICompatibility|standard library" ) atlas_add_test( flake8_OutputLevel - SCRIPT flake8 --enable-extensions=ATL100 --ignore=E,F,W --stdin-display-name=flake8_OutputLevel.py - --exit-zero --isolated - < ${CMAKE_CURRENT_SOURCE_DIR}/test/flake8_OutputLevel.py ) + SCRIPT flake8 --enable-extensions=ATL900 --select=ATL --stdin-display-name=flake8_OutputLevel.py + --exit-zero --isolated - < ${CMAKE_CURRENT_SOURCE_DIR}/python/flake8_atlas/test/flake8_OutputLevel.py ) + +atlas_add_test( flake8_logging + SCRIPT flake8 --enable-extensions=ATL901 --select=ATL --stdin-display-name=flake8_logging.py + --exit-zero --isolated - < ${CMAKE_CURRENT_SOURCE_DIR}/python/flake8_atlas/test/flake8_logging.py ) diff --git a/Tools/PyUtils/python/MetaReaderPeeker.py b/Tools/PyUtils/python/MetaReaderPeeker.py index a2034b5005824f8030ffc3ba699424a172f4fbe4..787c56854289afaca7a20b227f9fbdbea0dcc626 100644 --- a/Tools/PyUtils/python/MetaReaderPeeker.py +++ b/Tools/PyUtils/python/MetaReaderPeeker.py @@ -23,7 +23,7 @@ def _setup(): inFiles = InputFileNames() if len(inFiles) < 1: - msg.error("No input files specified yet! Cannot do anything.") + msg.warning("No input files specified yet! Cannot do anything.") return metadata_all_files = read_metadata(inFiles, mode='peeker', promote=True) diff --git a/Tools/PyUtils/python/MetaReaderPeekerFull.py b/Tools/PyUtils/python/MetaReaderPeekerFull.py index 344c1756f253dd46564afc38de17fc44fccf8541..301169b527010c2c7fbfde8d867b1254d551f64c 100644 --- a/Tools/PyUtils/python/MetaReaderPeekerFull.py +++ b/Tools/PyUtils/python/MetaReaderPeekerFull.py @@ -23,7 +23,7 @@ def _setup(): inFiles = InputFileNames() if len(inFiles) < 1: - msg.error("No input files specified yet! Cannot do anything.") + msg.warning("No input files specified yet! Cannot do anything.") metadata_all_files = read_metadata(inFiles, mode='full') @@ -33,4 +33,4 @@ def _setup(): metadata['file_name'] = first_filename -_setup() \ No newline at end of file +_setup() diff --git a/Tools/PyUtils/python/flake8_atlas/README.md b/Tools/PyUtils/python/flake8_atlas/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1baf12ccce746328e6493063687581ec86e7f36a --- /dev/null +++ b/Tools/PyUtils/python/flake8_atlas/README.md @@ -0,0 +1,17 @@ +# ATLAS plugins for flake8 + +This module contains ATLAS-specific `flake8_atlas` plugins. It is built by default in the +athena release and available after running `asetup`. To verify if the plugin is found +run: +``` +> flake8 --version +3.6.0 (flake8_atlas: 1.0, mccabe: 0.6.1, pycodestyle: 2.4.0, pyflakes: 2.0.0) CPython 2.7.15 on Linux +``` + +Plugins with codes `>=ATL900` are disabled by default. To enable them use +``` +flake8 --enable-extension=ATL901 +``` +In addition to ATLAS specific plugins most of the `python23.py` plugins from +the [hacking](https://github.com/openstack-dev/hacking) plugin by OpenStack +were imported (and some modified). \ No newline at end of file diff --git a/Tools/PyUtils/python/flake8_atlas/checks.py b/Tools/PyUtils/python/flake8_atlas/checks.py index 6d5a7a0df6f808cdc17937c9efffd28bf60cfdfb..49a26cd83c60903d6703964e78ffccc1f9654a14 100644 --- a/Tools/PyUtils/python/flake8_atlas/checks.py +++ b/Tools/PyUtils/python/flake8_atlas/checks.py @@ -4,15 +4,38 @@ Documentation: http://flake8.pycqa.org/en/latest/plugin-development """ -from utils import flake8_atlas, off_by_default +from PyUtils.flake8_atlas import utils import ast +import re -@flake8_atlas -@off_by_default -class OutputLevel(object): - """Check if an explicit OutputLevel is set""" +# Inspired by: https://github.com/openstack-dev/hacking/blob/master/hacking/checks/other.py +RE_LOGGING = re.compile(r".*\.(?:error|warn|warning|info|debug)" + r"\([^,]*(%)[^,]*[,)]") +@utils.flake8_atlas +def delayed_string_interpolation(logical_line): + r"""String interpolation should be delayed at logging calls. + ATL101: log.debug('Example: %s' % 'bad') + Okay: log.debug('Example: %s', 'good') + """ + msg = ("ATL100: use lazy string formatting in logging calls (',' instead of '%')") + + m = RE_LOGGING.match(logical_line) + if m is not None: + col = m.start(1) + yield (col-1, msg) + + +###################################################################### +# ATL9xy: Specialized plugins (disabled by default) +###################################################################### - code = ('ATL100: Do not assign an explicit OutputLevel', 'ATL100') +@utils.flake8_atlas +@utils.off_by_default +class OutputLevel(object): + """Check if an explicit OutputLevel is set + ATL900: myalg.OutputLevel = DEBUG + """ + msg = ('ATL900: Do not assign an explicit OutputLevel', 'ATL900') def __init__(self, tree): self.tree = tree @@ -24,10 +47,21 @@ class OutputLevel(object): if isinstance(node, ast.Assign): for t in node.targets: if isinstance(t,ast.Attribute) and t.attr=='OutputLevel': - yield (node.lineno, node.col_offset) + self.code + yield (node.lineno, node.col_offset) + self.msg # Find: setattr(c,'OutputLevel',DEBUG) if isinstance(node, ast.Call) and isinstance(node.func, ast.Name) and node.func.id=='setattr': a = node.args[1] if isinstance(a, ast.Str) and a.s=='OutputLevel': - yield (node.lineno, node.col_offset) + self.code + yield (node.lineno, node.col_offset) + self.msg + + +RE_PRINT = re.compile(r"\bprint") +@utils.flake8_atlas +@utils.off_by_default +def print_for_logging(logical_line): + """Check for occurences of plain 'print'""" + + for match in RE_PRINT.finditer(logical_line): + yield match.start(0), ( + "ATL901: use 'AthenaCommon.Logging' instead of 'print'") diff --git a/Tools/PyUtils/python/flake8_atlas/python23.py b/Tools/PyUtils/python/flake8_atlas/python23.py new file mode 100644 index 0000000000000000000000000000000000000000..42d804630816297fe90ea207fe363a85aa39156f --- /dev/null +++ b/Tools/PyUtils/python/flake8_atlas/python23.py @@ -0,0 +1,224 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# This is a modified version of the 'hacking' flake8 plugin: +# https://github.com/openstack-dev/hacking +# +# The unmodified original checks are kept with the "hacking_" prefix. +# For modified versions (including bugfixes) the prefix was removed. +# + +# Original licence: +# ----------------- +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from PyUtils.flake8_atlas import utils +import re +import tokenize + + +def import_normalize(line): + # convert "from x import y" to "import x.y" + # handle "from x import y as z" to "import x.y as z" + split_line = line.split() + if ("import" in line and line.startswith("from ") and "," not in line and + split_line[2] == "import" and split_line[3] != "*" and + split_line[1] != "__future__" and + (len(split_line) == 4 or + (len(split_line) == 6 and split_line[4] == "as"))): + return "import %s.%s" % (split_line[1], split_line[3]) + else: + return line + + +#def hacking_python3x_except_compatible(logical_line, noqa): +#Deleted as this is covered by pycodestyle E722 + +RE_OCTAL = re.compile(r"0+([1-9]\d*)") + +@utils.flake8_atlas +def hacking_python3x_octal_literals(logical_line, tokens, noqa): + r"""Check for octal literals in Python 3.x compatible form. + + As of Python 3.x, the construct "0755" has been removed. + Use "0o755" instead". + + Okay: f(0o755) + Okay: f(0755) + Okay: f(755) + Okay: f(0) + Okay: f(000) + Okay: MiB = 1.0415 + ATL232: f(0755) + Okay: f(0755) # noqa + """ + if noqa: + return + + for token_type, text, _, _, _ in tokens: + if token_type == tokenize.NUMBER: + match = RE_OCTAL.match(text) + if match: + yield 0, ("ATL232: Python 3.x incompatible octal %s should be " + "written as 0o%s " % + (match.group(0)[1:], match.group(1))) + + +RE_PRINT = re.compile(r"\bprint(?:$|\s+[^\(])") + +@utils.flake8_atlas +def hacking_python3x_print_function(logical_line, noqa): + r"""Check that all print occurrences look like print functions. + + Check that all occurrences of print look like functions, not + print operator. As of Python 3.x, the print operator has + been removed. + + Okay: print(msg) + Okay: print (msg) + Okay: print msg # noqa + Okay: print() + ATL233: print msg + ATL233: print >>sys.stderr, "hello" + ATL233: print msg, + ATL233: print + """ + if noqa: + return + for match in RE_PRINT.finditer(logical_line): + yield match.start(0), ( + "ATL233: Python 3.x incompatible use of print operator") + + +@utils.flake8_atlas +def hacking_no_assert_equals(logical_line, tokens, noqa): + r"""assert(Not)Equals() is deprecated, use assert(Not)Equal instead. + + Okay: self.assertEqual(0, 0) + Okay: self.assertNotEqual(0, 1) + ATL234: self.assertEquals(0, 0) + ATL234: self.assertNotEquals(0, 1) + Okay: self.assertEquals(0, 0) # noqa + Okay: self.assertNotEquals(0, 1) # noqa + """ + + if noqa: + return + for token_type, text, start_index, _, _ in tokens: + + if token_type == tokenize.NAME: + if text == "assertEquals" or text == "assertNotEquals": + yield (start_index[1], + "ATL234: %s is deprecated, use %s" % (text, text[:-1])) + + +@utils.flake8_atlas +def hacking_no_assert_underscore(logical_line, tokens, noqa): + r"""assert_() is deprecated, use assertTrue instead. + + Okay: self.assertTrue(foo) + ATL235: self.assert_(foo) + Okay: self.assert_(foo) # noqa + """ + if noqa: + return + for token_type, text, start_index, _, _ in tokens: + + if token_type == tokenize.NAME and text == "assert_": + yield ( + start_index[1], + "ATL235: assert_ is deprecated, use assertTrue") + + +@utils.flake8_atlas +def hacking_python3x_metaclass(logical_line, noqa): + r"""Check for metaclass to be Python 3.x compatible. + + Okay: @six.add_metaclass(Meta)\nclass Foo(object):\n pass + Okay: @six.with_metaclass(Meta)\nclass Foo(object):\n pass + Okay: class Foo(object):\n '''docstring\n\n __metaclass__ = Meta\n''' + ATL236: class Foo(object):\n __metaclass__ = Meta + ATL236: class Foo(object):\n foo=bar\n __metaclass__ = Meta + ATL236: class Foo(object):\n '''docstr.'''\n __metaclass__ = Meta + ATL236: class Foo(object):\n __metaclass__ = \\\n Meta + Okay: class Foo(object):\n __metaclass__ = Meta # noqa + """ + if noqa: + return + split_line = logical_line.split() + if(len(split_line) > 2 and split_line[0] == '__metaclass__' and + split_line[1] == '='): + yield (logical_line.find('__metaclass__'), + "ATL236: Python 3.x incompatible __metaclass__, " + "use six.add_metaclass()") + + +# NOTE(guochbo): This is removed module list: +# http://python3porting.com/stdlib.html#removed-modules +removed_modules = [ + 'audiodev', 'Bastion', 'bsddb185', 'bsddb3', + 'Canvas', 'cfmfile', 'cl', 'commands', 'compiler' + 'dircache', 'dl', 'exception', 'fpformat', + 'htmllib', 'ihooks', 'imageop', 'imputil' + 'linuxaudiodev', 'md5', 'mhlib', 'mimetools' + 'MimeWriter', 'mimify', 'multifile', 'mutex', + 'new', 'popen2', 'posixfile', 'pure', 'rexec' + 'rfc822', 'sha', 'sgmllib', 'sre', 'stat' + 'stringold', 'sunaudio' 'sv', 'test.testall', + 'thread', 'timing', 'toaiff', 'user' +] + + +@utils.flake8_atlas +def hacking_no_removed_module(logical_line, noqa): + r"""Check for removed modules in Python 3. + + Examples: + Okay: from os import path + Okay: from os import path as p + Okay: from os import (path as p) + Okay: import os.path + ATL237: import thread + Okay: import thread # noqa + ATL237: import commands + ATL237: import md5 as std_md5 + """ + if noqa: + return + line = import_normalize(logical_line.strip()) + if line and line.split()[0] == 'import': + module_name = line.split()[1].split('.')[0] + if module_name in removed_modules: + yield 0, ("ATL237: module %s is " + "removed in Python 3" % module_name) + + +RE_NEW_STYLE_CLASS = re.compile(r"^class[^(]+\(.+\):") + +@utils.flake8_atlas +def no_old_style_class(logical_line, noqa): + r"""Check for old style classes. + + Examples: + Okay: class Foo(object):\n pass + Okay: class Foo(Bar, Baz):\n pass + Okay: class Foo(object, Baz):\n pass + Okay: class Foo(somefunc()):\n pass + ATL238: class Bar:\n pass + ATL238: class Bar():\n pass + """ + if noqa: + return + line = logical_line.replace(' ','') + if line.startswith("class") and not RE_NEW_STYLE_CLASS.match(line): + yield (0, "ATL238: old style class declaration, " + "use new style (inherit from `object`)") diff --git a/Tools/PyUtils/python/flake8_atlas/setup.py b/Tools/PyUtils/python/flake8_atlas/setup.py index 51847beed3c4c879e84115a70cfa469c0515982d..ad4c4bb09b593d493c3ecf3ced55617e7cbe3feb 100644 --- a/Tools/PyUtils/python/flake8_atlas/setup.py +++ b/Tools/PyUtils/python/flake8_atlas/setup.py @@ -14,7 +14,16 @@ setuptools.setup( description="ATLAS plugins for flake8", entry_points={ 'flake8.extension': [ - 'ATL100 = PyUtils.flake8_atlas.checks:OutputLevel' + 'ATL100 = PyUtils.flake8_atlas.checks:delayed_string_interpolation', + 'ATL232 = PyUtils.flake8_atlas.python23:hacking_python3x_octal_literals', + 'ATL233 = PyUtils.flake8_atlas.python23:hacking_python3x_print_function', + 'ATL234 = PyUtils.flake8_atlas.python23:hacking_no_assert_equals', + 'ATL235 = PyUtils.flake8_atlas.python23:hacking_no_assert_underscore', + 'ATL236 = PyUtils.flake8_atlas.python23:hacking_python3x_metaclass', + 'ATL237 = PyUtils.flake8_atlas.python23:hacking_no_removed_module', + 'ATL238 = PyUtils.flake8_atlas.python23:no_old_style_class', + 'ATL900 = PyUtils.flake8_atlas.checks:OutputLevel', + 'ATL901 = PyUtils.flake8_atlas.checks:print_for_logging', ], } ) diff --git a/Tools/PyUtils/test/flake8_OutputLevel.py b/Tools/PyUtils/python/flake8_atlas/test/flake8_OutputLevel.py similarity index 100% rename from Tools/PyUtils/test/flake8_OutputLevel.py rename to Tools/PyUtils/python/flake8_atlas/test/flake8_OutputLevel.py diff --git a/Tools/PyUtils/python/flake8_atlas/test/flake8_logging.py b/Tools/PyUtils/python/flake8_atlas/test/flake8_logging.py new file mode 100644 index 0000000000000000000000000000000000000000..e4f5fe5d425d0be89b1f88c1aac94f72b20299c7 --- /dev/null +++ b/Tools/PyUtils/python/flake8_atlas/test/flake8_logging.py @@ -0,0 +1,24 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# +# Test for logging related plugins + +import logging +logging.basicConfig(level=logging.INFO) +log = logging.getLogger() +myfunnyloggername = log + +log.info('This is %s logging practice' % 'bad') +log.info('This is %s logging practice', 'good') +myfunnyloggername.warning('Hello %s' % 'world') + +log.info('This is %s logging practice: %d' % ('bad',42)) +log.info('This is %s logging practice: %d' % ('bad',42)) # noqa +log.info('This is %s logging practice: %d', 'good', 42) + +print("Hello world") +print("Hello world") # noqa +print "Hello world" + +def myprint(s): pass +myprint("Function that ends with print is OK") diff --git a/Tools/PyUtils/python/flake8_atlas/utils.py b/Tools/PyUtils/python/flake8_atlas/utils.py index 730c2a24edc93f4653122252bc25a13e10e3c9b0..a914d2a4669030dd27ab9a77ef9d4576489401e8 100644 --- a/Tools/PyUtils/python/flake8_atlas/utils.py +++ b/Tools/PyUtils/python/flake8_atlas/utils.py @@ -5,6 +5,8 @@ def flake8_atlas(f): """Default decorator for flake8 plugins""" f.name = 'flake8_atlas' f.version = '1.0' + if not hasattr(f, 'off_by_default'): + f.off_by_default = False return f def off_by_default(f): diff --git a/Tools/PyUtils/share/flake8_OutputLevel.ref b/Tools/PyUtils/share/flake8_OutputLevel.ref index b5aafa3f51436d8e2003dbc83d62be44a395e95c..e48d4980e4e4795ae1911a6ee313887ccc7d6366 100644 --- a/Tools/PyUtils/share/flake8_OutputLevel.ref +++ b/Tools/PyUtils/share/flake8_OutputLevel.ref @@ -1,3 +1,3 @@ -flake8_OutputLevel.py:10:7: ATL100: Do not assign an explicit OutputLevel -flake8_OutputLevel.py:14:1: ATL100: Do not assign an explicit OutputLevel -flake8_OutputLevel.py:16:1: ATL100: Do not assign an explicit OutputLevel +flake8_OutputLevel.py:10:7: ATL900: Do not assign an explicit OutputLevel +flake8_OutputLevel.py:14:1: ATL900: Do not assign an explicit OutputLevel +flake8_OutputLevel.py:16:1: ATL900: Do not assign an explicit OutputLevel diff --git a/Tools/PyUtils/share/flake8_logging.ref b/Tools/PyUtils/share/flake8_logging.ref new file mode 100644 index 0000000000000000000000000000000000000000..7cc15218e18c06ffb3d3f0bf101120b680ffa968 --- /dev/null +++ b/Tools/PyUtils/share/flake8_logging.ref @@ -0,0 +1,6 @@ +flake8_logging.py:11:39: ATL100: use lazy string formatting in logging calls (',' instead of '%') +flake8_logging.py:13:37: ATL100: use lazy string formatting in logging calls (',' instead of '%') +flake8_logging.py:15:43: ATL100: use lazy string formatting in logging calls (',' instead of '%') +flake8_logging.py:19:1: ATL901: use 'AthenaCommon.Logging' instead of 'print' +flake8_logging.py:21:1: ATL233: Python 3.x incompatible use of print operator +flake8_logging.py:21:1: ATL901: use 'AthenaCommon.Logging' instead of 'print' diff --git a/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/LinkToTrackParticleBase.h b/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/LinkToTrackParticleBase.h index fc8a6e730e17f8933baec035fee66d6d9497edcb..402d7b096302a78c088b4792803a158767a3556e 100644 --- a/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/LinkToTrackParticleBase.h +++ b/Tracking/TrkEvent/TrkParticleBase/TrkParticleBase/LinkToTrackParticleBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef TRKPARTICLEBASE_LINKTOTRACKPARTICLEBASE_H @@ -24,7 +24,7 @@ namespace Trk LinkToTrackParticleBase( ElementLink<TrackParticleBaseCollection>& link); /** default destructor */ - virtual ~LinkToTrackParticleBase(); + virtual ~LinkToTrackParticleBase() = default; /** return the track parameters of the track (to which the EL< TrackParticleBaseCollection > points) */ const TrackParameters * parameters() const; @@ -35,9 +35,6 @@ namespace Trk /** method to clone the LinkToTrack object */ LinkToTrackParticleBase * clone() const ; - /** assignment operator */ - LinkToTrackParticleBase& operator= ( const LinkToTrackParticleBase& rhs ); - };//end of class definitions }//end of namespace definitions diff --git a/Tracking/TrkEvent/TrkParticleBase/src/LinkToTrackParticleBase.cxx b/Tracking/TrkEvent/TrkParticleBase/src/LinkToTrackParticleBase.cxx index ebd91f4426a459653ced5a2328f1daaba3971fae..d99beb0edff52366614a25c0575ea4813d3db03f 100644 --- a/Tracking/TrkEvent/TrkParticleBase/src/LinkToTrackParticleBase.cxx +++ b/Tracking/TrkEvent/TrkParticleBase/src/LinkToTrackParticleBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -16,9 +16,6 @@ namespace Trk : ElementLink<TrackParticleBaseCollection> ( link ) {} - LinkToTrackParticleBase::~LinkToTrackParticleBase() - {} - const TrackParameters * LinkToTrackParticleBase::parameters() const { if ( isValid() ) @@ -35,13 +32,4 @@ namespace Trk return new LinkToTrackParticleBase ( *this ); } - Trk::LinkToTrackParticleBase& Trk::LinkToTrackParticleBase::operator= ( const Trk::LinkToTrackParticleBase& rhs ) - { - if ( this!=&rhs ) - { - ElementLink<TrackParticleBaseCollection>::operator= ( rhs ); - } - return *this; - } - }//end of namespace definitions diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py index d23d7ee71d95888eb5d4ec713326372bd26c953b..37f8e716cd1ecab668163af7ae96e980c14a41cd 100755 --- a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py @@ -171,6 +171,9 @@ class TrigCaloCellMaker_eGamma (TrigCaloCellMakerBase): from AthenaCommon.AppMgr import ToolSvc ToolSvc+=theCaloNoiseTool + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + CaloNoiseCondAlg() + roilaremcellcontmaker = RoILArEMCellContMaker() roilaremcellcontmaker.CaloNoiseTool = theCaloNoiseTool roilarhadcellcontmaker = RoILArHadCellContMaker() @@ -669,13 +672,15 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): print jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib() # tools used by tools - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool=CaloNoiseToolDefault() #flag='tool', name='myCaloNoiseToolDefault') - from AthenaCommon.AppMgr import ToolSvc - ToolSvc+=theCaloNoiseTool + #from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault + #theCaloNoiseTool=CaloNoiseToolDefault() #flag='tool', name='myCaloNoiseToolDefault') + #from AthenaCommon.AppMgr import ToolSvc + #ToolSvc+=theCaloNoiseTool if doLC: - + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + #For LCWeightsTool needs electronic noise + CaloNoiseCondAlg(noisetype="electronicNoise") TrigLCClassify = CaloLCClassificationTool("TrigLCClassify") TrigLCClassify.ClassificationKey = "EMFracClassify" TrigLCClassify.UseSpread = False @@ -685,7 +690,6 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): TrigLCWeight = CaloLCWeightTool("TrigLCWeight") TrigLCWeight.CorrectionKey = "H1ClusterCellWeights" TrigLCWeight.SignalOverNoiseCut = 2.0 - TrigLCWeight.CaloNoiseTool = theCaloNoiseTool TrigLCWeight.UseHadProbability = True TrigLCOut = CaloLCOutOfClusterTool("TrigLCOut") @@ -703,7 +707,6 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): #TrigLCDeadMaterial.SignalOverNoiseCut = 1.0 TrigLCDeadMaterial.ClusterRecoStatus = 0 TrigLCDeadMaterial.WeightModeDM = 2 - #TrigLCDeadMaterial.CaloNoiseTool = theCaloNoiseTool TrigLCDeadMaterial.UseHadProbability = True # correction tools using tools @@ -743,9 +746,7 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): # correction tools not using tools TrigTopoMoments = CaloClusterMomentsMaker ("TrigTopoMoments") TrigTopoMoments.MaxAxisAngle = 20*deg - TrigTopoMoments.CaloNoiseTool = theCaloNoiseTool TrigTopoMoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - TrigTopoMoments.UsePileUpNoise = True TrigTopoMoments.MinBadLArQuality = 4000 TrigTopoMoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA" @@ -808,9 +809,6 @@ class TrigCaloClusterMaker_topo (TrigCaloClusterMakerBase): "TileGap1", "TileGap2", "TileGap3", "FCAL0", "FCAL1", "FCAL2"] - TrigTopoMaker.CaloNoiseTool=theCaloNoiseTool - TrigTopoMaker.UseCaloNoiseTool=True - TrigTopoMaker.UsePileUpNoise=True TrigTopoMaker.NeighborOption = "super3D" TrigTopoMaker.RestrictHECIWandFCalNeighbors = False TrigTopoMaker.CellThresholdOnEorAbsEinSigma = 0.0 @@ -974,14 +972,6 @@ class TrigCaloClusterMaker_EMtopo (TrigCaloClusterMakerBase): emtopocluster.SeedSamplingNames = [ "PreSamplerB", "EMB1", "EMB2", "PreSamplerE", "EME1", "EME2" ] - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool=CaloNoiseToolDefault() - from AthenaCommon.AppMgr import ToolSvc - ToolSvc+=theCaloNoiseTool - emtopocluster.CaloNoiseTool=theCaloNoiseTool - - emtopocluster.UseCaloNoiseTool=True - emtopocluster.UsePileUpNoise=False emtopocluster.NeighborOption = "all3D" emtopocluster.CellThresholdOnEorAbsEinSigma = 0.0 @@ -1029,9 +1019,7 @@ class TrigCaloClusterMaker_EMtopo (TrigCaloClusterMakerBase): emtopomoments.OutputLevel = INFO emtopomoments.MaxAxisAngle = 20*deg - emtopomoments.CaloNoiseTool = theCaloNoiseTool emtopomoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - emtopomoments.UsePileUpNoise = True emtopomoments.MinBadLArQuality = 4000 emtopomoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA" @@ -1356,6 +1344,7 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib from CaloClusterCorrection.CaloClusterBadChannelListCorr import CaloClusterBadChannelListCorr from CaloRec.CaloRecConf import CaloTopoClusterMaker, CaloTopoClusterSplitter, CaloClusterMomentsMaker, CaloClusterMaker, CaloCell2ClusterMapper + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg from CaloRec.CaloTopoClusterFlags import jobproperties from AthenaCommon.SystemOfUnits import deg from AthenaCommon.AlgSequence import AlgSequence @@ -1367,13 +1356,10 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): print jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib() # tools used by tools - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool=CaloNoiseToolDefault() #flag='tool', name='myCaloNoiseToolDefault') - from AthenaCommon.AppMgr import ToolSvc - ToolSvc+=theCaloNoiseTool if doLC: - + #For LCWeightsTool needs electronic noise + CaloNoiseCondAlg(noisetype="electronicNoise") TrigLCClassify = CaloLCClassificationTool("TrigLCClassify") TrigLCClassify.ClassificationKey = "EMFracClassify" TrigLCClassify.UseSpread = False @@ -1383,7 +1369,6 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): TrigLCWeight = CaloLCWeightTool("TrigLCWeight") TrigLCWeight.CorrectionKey = "H1ClusterCellWeights" TrigLCWeight.SignalOverNoiseCut = 2.0 - TrigLCWeight.CaloNoiseTool = theCaloNoiseTool TrigLCWeight.UseHadProbability = True TrigLCOut = CaloLCOutOfClusterTool("TrigLCOut") @@ -1401,7 +1386,6 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): #TrigLCDeadMaterial.SignalOverNoiseCut = 1.0 TrigLCDeadMaterial.ClusterRecoStatus = 0 TrigLCDeadMaterial.WeightModeDM = 2 - #TrigLCDeadMaterial.CaloNoiseTool = theCaloNoiseTool TrigLCDeadMaterial.UseHadProbability = True # correction tools using tools @@ -1441,9 +1425,7 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): # correction tools not using tools TrigTopoMoments = CaloClusterMomentsMaker ("TrigTopoMoments") TrigTopoMoments.MaxAxisAngle = 20*deg - TrigTopoMoments.CaloNoiseTool = theCaloNoiseTool TrigTopoMoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - TrigTopoMoments.UsePileUpNoise = True TrigTopoMoments.MinBadLArQuality = 4000 TrigTopoMoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA" @@ -1489,6 +1471,7 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): # ] # maker tools + CaloNoiseCondAlg() TrigTopoMaker = CaloTopoClusterMaker("TrigTopoMaker") TrigTopoMaker.CellsName = cells @@ -1506,9 +1489,6 @@ class TrigCaloClusterMakerMT_topo (TrigCaloClusterMakerMTBase): "TileGap1", "TileGap2", "TileGap3", "FCAL0", "FCAL1", "FCAL2"] - TrigTopoMaker.CaloNoiseTool=theCaloNoiseTool - TrigTopoMaker.UseCaloNoiseTool=True - TrigTopoMaker.UsePileUpNoise=True TrigTopoMaker.NeighborOption = "super3D" TrigTopoMaker.RestrictHECIWandFCalNeighbors = False TrigTopoMaker.CellThresholdOnEorAbsEinSigma = 0.0 @@ -1641,14 +1621,6 @@ class TrigCaloClusterMakerMT_EMtopo (TrigCaloClusterMakerMTBase): emtopocluster.SeedSamplingNames = [ "PreSamplerB", "EMB1", "EMB2", "PreSamplerE", "EME1", "EME2" ] - from CaloTools.CaloNoiseToolDefault import CaloNoiseToolDefault - theCaloNoiseTool=CaloNoiseToolDefault() - from AthenaCommon.AppMgr import ToolSvc - ToolSvc+=theCaloNoiseTool - emtopocluster.CaloNoiseTool=theCaloNoiseTool - - emtopocluster.UseCaloNoiseTool=True - emtopocluster.UsePileUpNoise=False emtopocluster.NeighborOption = "all3D" emtopocluster.CellThresholdOnEorAbsEinSigma = 0.0 @@ -1696,9 +1668,7 @@ class TrigCaloClusterMakerMT_EMtopo (TrigCaloClusterMakerMTBase): emtopomoments.OutputLevel = INFO emtopomoments.MaxAxisAngle = 20*deg - emtopomoments.CaloNoiseTool = theCaloNoiseTool emtopomoments.TwoGaussianNoise = jobproperties.CaloTopoClusterFlags.doTwoGaussianNoise() - emtopomoments.UsePileUpNoise = True emtopomoments.MinBadLArQuality = 4000 emtopomoments.MomentsNames = ["FIRST_PHI" ,"FIRST_ETA" diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETAlgMT.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETAlgMT.cxx index 6b68dfa2cb2353bbdfffdfa0f1be4f5803e7bc33..dcbd34afddbac7f8f91430d483c6ad8474dc1ab4 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETAlgMT.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETAlgMT.cxx @@ -97,7 +97,7 @@ StatusCode EFMissingETAlgMT::execute( const EventContext& context ) const { auto EF_XS = Monitored::Scalar( "EF_XS", toLinGeV( std::hypot( met->ex(), met->ey() ) ) / toLinGeV( met->sumEt() ) ); auto EF_MET_phi = Monitored::Scalar( "EF_MET_phi", std::atan2( met->ey(), met->ex() ) ); - ATH_MSG_INFO("Event MET: " << std::hypot( met->ex(), met->ey() ) << " MeV"); + ATH_MSG_DEBUG("Event MET: " << std::hypot( met->ex(), met->ey() ) << " MeV"); auto monitorIt = Monitored::Group( m_monTool, totalTimer, loopTimer, diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromCellsMT.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromCellsMT.cxx index 8e747a82f7a7898ed0d07bb3cc878351d26562e7..d243f76e9540f8bea8f2d7dafd85c5288af1d8d3 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromCellsMT.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/EFMissingETFromCellsMT.cxx @@ -42,7 +42,6 @@ StatusCode EFMissingETFromCellsMT::update( xAOD::TrigMissingET */*met*/, auto countUsedCells = Monitored::Scalar<unsigned>( "UsedCells", 0 ); // now it is time to iterate over the cells - ATH_MSG_INFO("About to loop over cells from CellMET"); int nCells(0), nZeroCells(0); for ( const CaloCell* cell: *caloCellsHandle ) { nCells++; diff --git a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/TrigT2CaloEgamma/T2CaloEgammaFastAlgo.h b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/TrigT2CaloEgamma/T2CaloEgammaFastAlgo.h index 7bb358da567908cbc501d187ddb024d1d329004a..b2b9e37c5d21cfc5006beca277f5d37d1e577d0e 100755 --- a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/TrigT2CaloEgamma/T2CaloEgammaFastAlgo.h +++ b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/TrigT2CaloEgamma/T2CaloEgammaFastAlgo.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @@ -31,7 +31,6 @@ class IAlgToolCalo; class IEgammaCalibration; class ITrigDataAccess; -class MsgStream; /** Main LVL2 Algorithm. Processes LVL1 information, call FEX IAlgToolCalos and produces the TrigEMCluster output. */ @@ -39,24 +38,13 @@ class T2CaloEgammaFastAlgo: public AthAlgorithm { public: - /** Constructor */ T2CaloEgammaFastAlgo(const std::string & name, ISvcLocator* pSvcLocator); - /** Destructor */ - ~T2CaloEgammaFastAlgo(); - - /** main execute will call FEX IAlgToolCalo::execute() to process RoI. - called by the Steering per EMRoI. */ - StatusCode execute(); - /** initialize. Called by the Steering. */ - StatusCode initialize(); - /** hltFinalize. Called by the Steering. */ - StatusCode finalize(); - /** calculate zo mass */ - //float calculateZ0(const float etaLayer1, const float etaLayer2); + virtual ~T2CaloEgammaFastAlgo(); + + virtual StatusCode execute() override; + virtual StatusCode initialize() override; private: - /** log output cached to avoid fetching MsgStream once per RoI */ - MsgStream* m_log; /** To support new monitoring. Values must be copied to this monitored Cluster for each RoI. */ const xAOD::TrigEMCluster* m_monitoredCluster; diff --git a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaFastAlgo.cxx b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaFastAlgo.cxx index 415ec4a124d2f3a9fa30b280f0856fb1dc1cc1d0..669da637a3e2ef85ce4294eeee5f11675f0903b3 100755 --- a/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaFastAlgo.cxx +++ b/Trigger/TrigAlgorithms/TrigT2CaloEgamma/src/T2CaloEgammaFastAlgo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /* @@ -8,7 +8,6 @@ AUTHOR: Denis Oliveira Damazio Carlos Chavez Barajas - */ #include "GaudiKernel/MsgStream.h" @@ -16,7 +15,6 @@ #include "GaudiKernel/StatusCode.h" #include "AthLinks/ElementLink.h" - #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "xAODTrigCalo/TrigEMClusterAuxContainer.h" @@ -31,8 +29,7 @@ class ISvcLocator; T2CaloEgammaFastAlgo::T2CaloEgammaFastAlgo(const std::string & name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), - m_log(0), - m_calibsBarrel(this), + m_calibsBarrel(this), m_calibsEndcap(this), m_storeCells(false), m_roiCollection("OutputRoIs"), @@ -55,280 +52,185 @@ T2CaloEgammaFastAlgo::T2CaloEgammaFastAlgo(const std::string & name, ISvcLocator T2CaloEgammaFastAlgo::~T2CaloEgammaFastAlgo() { - delete m_log; } StatusCode T2CaloEgammaFastAlgo::initialize() { - if (!m_log) m_log = new MsgStream(msgSvc(), name()); - - m_emAlgTools.retrieve().ignore(); ATH_CHECK( m_regionSelector.retrieve()); ATH_CHECK( m_clusterContainerKey.initialize() ); ATH_CHECK( m_roiCollectionKey.initialize() ); CHECK( m_calibsBarrel.retrieve() ); CHECK( m_calibsEndcap.retrieve() ); - ATH_MSG_DEBUG( "Initialize done !" ); return StatusCode::SUCCESS; } StatusCode T2CaloEgammaFastAlgo::execute() { - // Time total T2CaloEgamma execution time. -// if ( m_timersvc ) m_timer[0]->start(); m_conversionError=0; m_algorithmError=0; m_monitoredCluster=0; -#ifndef NDEBUG - if ( (*m_log).level() <= MSG::DEBUG ) - (*m_log) << MSG::INFO << "in execute()" << endmsg; -#endif - m_trigEmClusterCollection = SG::WriteHandle<xAOD::TrigEMClusterContainer>( m_clusterContainerKey, getContext() ); - ATH_CHECK( m_trigEmClusterCollection.record( CxxUtils::make_unique<xAOD::TrigEMClusterContainer>(), CxxUtils::make_unique<xAOD::TrigEMClusterAuxContainer>() ) ); - ATH_MSG_DEBUG( "Made WriteHandle " << m_clusterContainerKey ); - ATH_MSG_INFO( name() << " running with store " << getContext().getExtension<Atlas::ExtendedEventContext>().proxy()->name() ); - + ATH_CHECK( m_trigEmClusterCollection.record( CxxUtils::make_unique<xAOD::TrigEMClusterContainer>(), + CxxUtils::make_unique<xAOD::TrigEMClusterAuxContainer>() ) ); + auto roisHandle = SG::makeHandle( m_roiCollectionKey ); CHECK( roisHandle.isValid() ); - ATH_MSG_DEBUG( "Made handle " << m_roiCollectionKey ); - const TrigRoiDescriptorCollection* roiCollection = roisHandle.cptr(); - // ATH_CHECK(m_roiCollectionKey.isValid()); - - ATH_MSG_DEBUG( "Made pointer " << m_roiCollectionKey << " with "<< roiCollection->size() <<" elements" ); - const TrigRoiDescriptor* roiDescriptor = 0; - //TrigRoiDescriptor* roiDescriptor = 0; // datahandle TrigRoiDescriptorCollection::const_iterator roiCollectionIt = roiCollection->begin(); for(; roiCollectionIt != roiCollection->end(); ++roiCollectionIt){ roiDescriptor = *roiCollectionIt; - float etaL1, phiL1; - // End LVL1 part - double etamin, etamax, phimin, phimax; - if ( (m_l1eta<-9.9)&&(m_l1phi<-9.9)){ - etamin = std::max( -2.5, roiDescriptor->eta() - m_etaWidth ); - etamax = std::min( 2.5, roiDescriptor->eta() + m_etaWidth ); - - phimin = HLT::wrap_phi( roiDescriptor->phi() - m_phiWidth ); - phimax = HLT::wrap_phi( roiDescriptor->phi() + m_phiWidth ); - - etaL1 = roiDescriptor->eta(); - phiL1 = roiDescriptor->phi(); - } - else { - etamin = std::max( -2.5, m_l1eta-m_etaWidth ); - etamax = std::min( 2.5, m_l1eta+m_etaWidth ); - - phimin = HLT::wrap_phi( m_l1phi-m_phiWidth ); - phimax = HLT::wrap_phi( m_l1phi+m_phiWidth ); - - etaL1 = m_l1eta; - phiL1 = m_l1phi; - } - - /// if we do ... - TrigRoiDescriptor newroi( roiDescriptor->eta(), etamin, etamax, - roiDescriptor->phi(), phimin, phimax); - -#ifndef NDEBUG - - if ( (*m_log).level() <= MSG::DEBUG ) { - (*m_log) << MSG::DEBUG << " etamin = "<< etamin << endmsg; - (*m_log) << MSG::DEBUG << " etamax = "<< etamax << endmsg; - (*m_log) << MSG::DEBUG << " phimin = "<< phimin << endmsg; - (*m_log) << MSG::DEBUG << " phimax = "<< phimax << endmsg; - } -#endif - - -#ifndef NDEBUG - if ( (*m_log).level() <= MSG::DEBUG ) - (*m_log) << MSG::DEBUG << " Making TrigEMCluster "<< endmsg; -#endif - - - xAOD::TrigEMCluster* ptrigEmCluster = new xAOD::TrigEMCluster(); - m_trigEmClusterCollection->push_back( ptrigEmCluster ); - ptrigEmCluster->setEnergy(0.0); - ptrigEmCluster->setEt(0.0); - ptrigEmCluster->setRawEnergy(0.0); - ptrigEmCluster->setRawEt(0.0); - ptrigEmCluster->setE277(0); - ptrigEmCluster->setEmaxs1(0); - ptrigEmCluster->setE2tsts1(0); - ptrigEmCluster->setEhad1(-999); - ptrigEmCluster->setWeta2(-999); - ptrigEmCluster->setFracs1(-999); - ptrigEmCluster->setE233(-999); - ptrigEmCluster->setE237(-999); - ptrigEmCluster->setWstot(-999); - ptrigEmCluster->setEta1(-999); - ptrigEmCluster->setNCells(0); - ptrigEmCluster->setRawEta(-999); - ptrigEmCluster->setRawPhi(-999); - m_monitoredCluster = ptrigEmCluster; - (*m_log) << MSG::INFO << " Values of Cluster defined default: "<< endmsg; - // It is a good idea to clear the energies - for(int i=0;i<CaloSampling::CaloSample::MINIFCAL0;i++){ - ptrigEmCluster->setEnergy((CaloSampling::CaloSample )i,0.); - ptrigEmCluster->setRawEnergy((CaloSampling::CaloSample )i,0.); - } - // Initial cluster position is the LVL1 position - ptrigEmCluster->setEta(etaL1); - ptrigEmCluster->setPhi(phiL1); - (*m_log) << MSG::INFO << " Initial cluster position is the LVL1 position : DONE "<< endmsg; - - // Add RoI word to TrigEMCluster - // Dangerous !!!! we need to define a *new* roiDescriptor if we want to - // change the size, so we should be careful about *which* roi descriptor - // we save, and *which* "roiWord" (if any) we store if we need to use it - // again - (*ptrigEmCluster).setRoIword(roiDescriptor->roiWord()); - const CaloDetDescrElement * caloDDE = 0; - - // zeros the container per RoI - //m_Container = 0; - (*m_log) << MSG::INFO << " m_emAlgTools.begin(): "<< endmsg; - - ToolHandleArray<IAlgToolCalo>::iterator it = m_emAlgTools.begin(); -//// if ( m_timersvc ) m_timer[1]->start(); - uint32_t error = 0; - for (; it < m_emAlgTools.end(); it++) { - if ((*it)->execute(*ptrigEmCluster, newroi, caloDDE ).isFailure() ) { - (*m_log) << MSG::WARNING << "T2Calo AlgToolEgamma returned Failure" << endmsg; - return StatusCode::FAILURE; - } -// uint32_t in_error = (*it)->report_error(); -// if ( 0x0FFFFFFF & in_error ) m_conversionError++; -// if ( 0xF0000000 & in_error ) m_algorithmError++; -// error|=in_error; - } -// // support to new monitoring - m_rCore=0; - m_eRatio=0; - m_stripRatio=0; - m_MonEta=ptrigEmCluster->eta(); - m_MonPhi=ptrigEmCluster->phi(); - if ( ptrigEmCluster->e277()!=0 ) - m_rCore = ptrigEmCluster->e237()/ptrigEmCluster->e277(); - if ( ptrigEmCluster->emaxs1()+ptrigEmCluster->e2tsts1() !=0){ - m_eRatio = ptrigEmCluster->emaxs1()-ptrigEmCluster->e2tsts1(); - m_eRatio /= ptrigEmCluster->emaxs1()+ptrigEmCluster->e2tsts1(); - } - (*m_log) << MSG::INFO << " set m_eRatio : DONE "<< endmsg; - // Cluster quality is a collection of possible errors - // No error quality=0 - ptrigEmCluster->setClusterQuality(error); -// if ( m_timersvc ) m_timer[1]->stop(); - (*m_log) << MSG::INFO << " ptrigEmCluster->setClusterQuality(error) : DONE "<< endmsg; - if ( ( error & 0xC0000000 ) || ptrigEmCluster->phi() < -M_PI || ptrigEmCluster->phi() > +M_PI - || fabsf ( ptrigEmCluster->eta() ) > 10.0 ) { - // Clustering failed. Transmit ahead L1 - ptrigEmCluster->setEta(etaL1); - ptrigEmCluster->setPhi(phiL1); - ptrigEmCluster->setEnergy(0.0); - ptrigEmCluster->setEt(0.0); - } - (*m_log) << MSG::INFO << " ptrigEmCluster->setxxx : DONE "<< endmsg; - if ( caloDDE != 0 ){ - if ( caloDDE->is_lar_em_barrel() ){ - for( ToolHandleArray<IEgammaCalibration>::iterator - ical=m_calibsBarrel.begin(); - ical != m_calibsBarrel.end(); ++ical ) - (*ical)->makeCorrection(ptrigEmCluster,caloDDE); - }else{ - for( ToolHandleArray<IEgammaCalibration>::iterator - ical=m_calibsEndcap.begin(); - ical != m_calibsEndcap.end(); ++ical ) - (*ical)->makeCorrection(ptrigEmCluster,caloDDE); + float etaL1, phiL1; + // End LVL1 part + double etamin, etamax, phimin, phimax; + if ( (m_l1eta<-9.9)&&(m_l1phi<-9.9)){ + etamin = std::max( -2.5, roiDescriptor->eta() - m_etaWidth ); + etamax = std::min( 2.5, roiDescriptor->eta() + m_etaWidth ); + + phimin = HLT::wrap_phi( roiDescriptor->phi() - m_phiWidth ); + phimax = HLT::wrap_phi( roiDescriptor->phi() + m_phiWidth ); + + etaL1 = roiDescriptor->eta(); + phiL1 = roiDescriptor->phi(); } - } - (*m_log) << MSG::INFO << " IEgammaCalibration : DONE "<< endmsg; - float calZ0 = 0; - - - // Print out Cluster produced - if ( (*m_log).level() <= MSG::DEBUG ) { - (*m_log) << MSG::DEBUG << " Values of Cluster produced: "<< endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: emEnergy = "<< (*ptrigEmCluster).energy() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: hadEnergy = "<< (*ptrigEmCluster).ehad1() << endmsg; - - //if ( ptrigEmCluster->e277()!=0. ) - (*m_log) << MSG::DEBUG << " REGTEST: e237= " - << (*ptrigEmCluster).e237() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: e277= " << (*ptrigEmCluster).e277() << endmsg; - //else (*m_log) << MSG::DEBUG << " REGTEST: e277 equals to 0" << endmsg; - -/* - (*m_log) << MSG::DEBUG << " REGTEST: energyRatio = " - << (((*ptrigEmCluster).emaxs1()-(*ptrigEmCluster).e2tsts1())/ - ((*ptrigEmCluster).emaxs1()+(*ptrigEmCluster).e2tsts1())) - << endmsg; -*/ + else { + etamin = std::max( -2.5, m_l1eta-m_etaWidth ); + etamax = std::min( 2.5, m_l1eta+m_etaWidth ); - (*m_log) << MSG::DEBUG << " REGTEST: clusterWidth = " << (*ptrigEmCluster).weta2() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: frac73 = " << (*ptrigEmCluster).fracs1() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: e233 = " << (*ptrigEmCluster).e233() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: wstot = " << (*ptrigEmCluster).wstot() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: eta = "<< (*ptrigEmCluster).eta() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: phi = "<< (*ptrigEmCluster).phi() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: Eta1 = "<< (*ptrigEmCluster).eta1() << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: calZ0 = "<< calZ0 << endmsg; - (*m_log) << MSG::DEBUG << " REGTEST: quality = "<< (*ptrigEmCluster).clusterQuality() << endmsg; - (*m_log) << MSG::DEBUG << std::hex << " REGTEST: roiWord = 0x" << (*ptrigEmCluster).RoIword() << std::dec <<endmsg; - } - std::string key = ""; - //hltStatus = recordAndAttachFeature(outputTE, ptrigEmCluster, key, m_trigEmClusterKey); - - -#ifdef DONTDO - // Create a new RoiDescriptor with updated eta and phi. - // Note that the steering will propagate l1Id and roiId automatically - // so no need to set them. (is this true?) - TrigRoiDescriptor* newRoiDescriptor = - new TrigRoiDescriptor(roiDescriptor->l1Id(), roiDescriptor->roiId(), - ptrigEmCluster->eta(), ptrigEmCluster->eta()-0.2, - ptrigEmCluster->eta()+0.2, - ptrigEmCluster->phi(), - HLT::wrap_phi(ptrigEmCluster->phi()-0.2), - HLT::wrap_phi(ptrigEmCluster->phi()+0.2) ); - (*m_log) << MSG::INFO << " HLT::wrap_phi(ptrigEmCluster->phi()-0.2) : DONE "<< endmsg; - - // hltStatus = attachFeature(outputTE,newRoiDescriptor,"TrigT2CaloEgamma"); - (*m_log) << MSG::INFO << " hltStatus = attachFeature : DONE "<< endmsg; - if ( hltStatus != HLT::OK ) { - (*m_log) << MSG::ERROR << "Write of update TrigRoiDescriptor into outputTE failed" - << endmsg; -// if ( m_timersvc ) m_timer[0]->stop(); - return hltStatus; - } + phimin = HLT::wrap_phi( m_l1phi-m_phiWidth ); + phimax = HLT::wrap_phi( m_l1phi+m_phiWidth ); -#endif + etaL1 = m_l1eta; + phiL1 = m_l1phi; + } + /// if we do ... + TrigRoiDescriptor newroi( roiDescriptor->eta(), etamin, etamax, + roiDescriptor->phi(), phimin, phimax); + ATH_MSG_DEBUG(" etamin = "<< etamin << " etamax = "<< etamax << + " phimin = "<< phimin << " phimax = "<< phimax); - } // end of roiCollection iterator - - return StatusCode::SUCCESS; -} + ATH_MSG_DEBUG(" Making TrigEMCluster"); + xAOD::TrigEMCluster* ptrigEmCluster = new xAOD::TrigEMCluster(); + m_trigEmClusterCollection->push_back( ptrigEmCluster ); + ptrigEmCluster->setEnergy(0.0); + ptrigEmCluster->setEt(0.0); + ptrigEmCluster->setRawEnergy(0.0); + ptrigEmCluster->setRawEt(0.0); + ptrigEmCluster->setE277(0); + ptrigEmCluster->setEmaxs1(0); + ptrigEmCluster->setE2tsts1(0); + ptrigEmCluster->setEhad1(-999); + ptrigEmCluster->setWeta2(-999); + ptrigEmCluster->setFracs1(-999); + ptrigEmCluster->setE233(-999); + ptrigEmCluster->setE237(-999); + ptrigEmCluster->setWstot(-999); + ptrigEmCluster->setEta1(-999); + ptrigEmCluster->setNCells(0); + ptrigEmCluster->setRawEta(-999); + ptrigEmCluster->setRawPhi(-999); + m_monitoredCluster = ptrigEmCluster; + // It is a good idea to clear the energies + for(int i=0;i<CaloSampling::CaloSample::MINIFCAL0;i++){ + ptrigEmCluster->setEnergy((CaloSampling::CaloSample )i,0.); + ptrigEmCluster->setRawEnergy((CaloSampling::CaloSample )i,0.); + } + // Initial cluster position is the LVL1 position + ptrigEmCluster->setEta(etaL1); + ptrigEmCluster->setPhi(phiL1); -StatusCode T2CaloEgammaFastAlgo::finalize(){ + // Add RoI word to TrigEMCluster + // Dangerous !!!! we need to define a *new* roiDescriptor if we want to + // change the size, so we should be careful about *which* roi descriptor + // we save, and *which* "roiWord" (if any) we store if we need to use it + // again + (*ptrigEmCluster).setRoIword(roiDescriptor->roiWord()); + const CaloDetDescrElement * caloDDE = 0; + + ToolHandleArray<IAlgToolCalo>::iterator it = m_emAlgTools.begin(); + uint32_t error = 0; + for (; it < m_emAlgTools.end(); it++) { + if ((*it)->execute(*ptrigEmCluster, newroi, caloDDE ).isFailure() ) { + ATH_MSG_WARNING("T2Calo AlgToolEgamma returned Failure"); + return StatusCode::FAILURE; + } + // uint32_t in_error = (*it)->report_error(); + // if ( 0x0FFFFFFF & in_error ) m_conversionError++; + // if ( 0xF0000000 & in_error ) m_algorithmError++; + // error|=in_error; + } + // support to new monitoring + m_rCore=0; + m_eRatio=0; + m_stripRatio=0; + m_MonEta=ptrigEmCluster->eta(); + m_MonPhi=ptrigEmCluster->phi(); + if ( ptrigEmCluster->e277()!=0 ) + m_rCore = ptrigEmCluster->e237()/ptrigEmCluster->e277(); + if ( ptrigEmCluster->emaxs1()+ptrigEmCluster->e2tsts1() !=0){ + m_eRatio = ptrigEmCluster->emaxs1()-ptrigEmCluster->e2tsts1(); + m_eRatio /= ptrigEmCluster->emaxs1()+ptrigEmCluster->e2tsts1(); + } -#ifndef NDEBUG - if ( (*m_log).level() <= MSG::DEBUG ) - (*m_log) << MSG::INFO << "in finalize()" << endmsg; -#endif + // Cluster quality is a collection of possible errors + // No error quality=0 + ptrigEmCluster->setClusterQuality(error); + + if ( ( error & 0xC0000000 ) || ptrigEmCluster->phi() < -M_PI || ptrigEmCluster->phi() > +M_PI + || fabsf ( ptrigEmCluster->eta() ) > 10.0 ) { + // Clustering failed. Transmit ahead L1 + ptrigEmCluster->setEta(etaL1); + ptrigEmCluster->setPhi(phiL1); + ptrigEmCluster->setEnergy(0.0); + ptrigEmCluster->setEt(0.0); + } + if ( caloDDE != 0 ){ + if ( caloDDE->is_lar_em_barrel() ){ + for( ToolHandleArray<IEgammaCalibration>::iterator + ical=m_calibsBarrel.begin(); + ical != m_calibsBarrel.end(); ++ical ) + (*ical)->makeCorrection(ptrigEmCluster,caloDDE); + }else{ + for( ToolHandleArray<IEgammaCalibration>::iterator + ical=m_calibsEndcap.begin(); + ical != m_calibsEndcap.end(); ++ical ) + (*ical)->makeCorrection(ptrigEmCluster,caloDDE); + } + } + float calZ0 = 0; + + // Print out Cluster produced + if ( msgLvl(MSG::DEBUG) ) { + ATH_MSG_DEBUG(" Values of Cluster produced: "); + ATH_MSG_DEBUG(" REGTEST: emEnergy = "<< (*ptrigEmCluster).energy()); + ATH_MSG_DEBUG(" REGTEST: hadEnergy = "<< (*ptrigEmCluster).ehad1()); + ATH_MSG_DEBUG(" REGTEST: e237= " << (*ptrigEmCluster).e237()); + ATH_MSG_DEBUG(" REGTEST: e277= " << (*ptrigEmCluster).e277()); + ATH_MSG_DEBUG(" REGTEST: clusterWidth = " << (*ptrigEmCluster).weta2()); + ATH_MSG_DEBUG(" REGTEST: frac73 = " << (*ptrigEmCluster).fracs1()); + ATH_MSG_DEBUG(" REGTEST: e233 = " << (*ptrigEmCluster).e233()); + ATH_MSG_DEBUG(" REGTEST: wstot = " << (*ptrigEmCluster).wstot()); + ATH_MSG_DEBUG(" REGTEST: eta = "<< (*ptrigEmCluster).eta()); + ATH_MSG_DEBUG(" REGTEST: phi = "<< (*ptrigEmCluster).phi()); + ATH_MSG_DEBUG(" REGTEST: Eta1 = "<< (*ptrigEmCluster).eta1()); + ATH_MSG_DEBUG(" REGTEST: calZ0 = "<< calZ0); + ATH_MSG_DEBUG(" REGTEST: quality = "<< (*ptrigEmCluster).clusterQuality()); + ATH_MSG_DEBUG(std::hex << " REGTEST: roiWord = 0x" << (*ptrigEmCluster).RoIword()); + } + + } // end of roiCollection iterator + return StatusCode::SUCCESS; } - diff --git a/Trigger/TrigConfiguration/TrigConfBase/CMakeLists.txt b/Trigger/TrigConfiguration/TrigConfBase/CMakeLists.txt index fe1bd7d05bfe3e824c2a42af625edac0639dc1df..b0fd08786ddf71dc5cc7f0c24c9a22ceb93f8363 100644 --- a/Trigger/TrigConfiguration/TrigConfBase/CMakeLists.txt +++ b/Trigger/TrigConfiguration/TrigConfBase/CMakeLists.txt @@ -24,14 +24,14 @@ atlas_install_joboptions( share/*.py ) # Tests: if( NOT XAOD_STANDALONE ) -atlas_add_component( TrigConfBaseTest - test/TrigConfMsgAlg.cxx - LINK_LIBRARIES TrigConfBase AthenaBaseComps ) + atlas_add_component( TrigConfBaseTest + test/TrigConfMsgAlg.cxx + LINK_LIBRARIES TrigConfBase AthenaBaseComps ) + + atlas_add_test( trigconf_msg_athena_test + SCRIPT athena.py TrigConfBase/test_TrigConfMsgAlg.py ) +endif() atlas_add_test( trigconf_msg_standalone_test SOURCES test/trigconf_msgsvc_test.cxx LINK_LIBRARIES TrigConfBase ) - -atlas_add_test( trigconf_msg_athena_test - SCRIPT athena.py TrigConfBase/test_TrigConfMsgAlg.py ) -endif() # NOT XAOD_STANDALONE diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx index c8643bc26282c0d50b8461bbd53ee846a636588f..91c6fcf7451e9125a851c71e63ce952b225d1420 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx @@ -1,6 +1,6 @@ // -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /************************************************************************** @@ -87,9 +87,7 @@ ATH_CHECK( m_outputElectronsKey.initialize() ); StatusCode TrigL2ElectronFexMT::finalize() { - ATH_MSG_INFO("in finalize()"); - - if (m_extrapolator_failed) + if (m_extrapolator_failed) ATH_MSG_INFO("track extrapolation failed " << m_extrapolator_failed << " times"); return StatusCode::SUCCESS; @@ -107,8 +105,6 @@ StatusCode TrigL2ElectronFexMT::execute() { std::make_unique<xAOD::TrigEMClusterAuxContainer>()) ); ATH_MSG_DEBUG( "Made WriteHandle " << m_outputElectronsKey ); - ATH_MSG_INFO( name() << " running with store " << getContext().getExtension<Atlas::ExtendedEventContext>().proxy()->name() ); - auto roiCollection = SG::makeHandle(m_roiCollectionKey, ctx); ATH_MSG_DEBUG( "Made handle " << m_roiCollectionKey ); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h index 4ccda710657776ecd0c119e1239e0fd5ca874fdf..e7e508e9eab48989f2b1539dad658e7697790691 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /************************************************************************** @@ -70,9 +70,9 @@ class TrigL2ElectronFexMT : public AthAlgorithm { TrigL2ElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator); ~TrigL2ElectronFexMT(); - StatusCode initialize(); - StatusCode finalize(); - StatusCode execute(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode execute() override; private: diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.cxx index 737099e4303d43722fadc91429a395c6e7d7169c..e79ee6c4bae4ce3a747219e0569350cc60d57914 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -36,19 +36,11 @@ StatusCode TrigL2PhotonFexMT::initialize() ATH_CHECK( m_roiCollectionKey.initialize() ); ATH_CHECK( m_TrigEMClusterContainerKey.initialize() ); ATH_CHECK(m_outputPhotonsKey.initialize()); - ATH_MSG_DEBUG("Initialization:"); return StatusCode::SUCCESS; } -StatusCode TrigL2PhotonFexMT::finalize() -{ - ATH_MSG_INFO("in finalize()"); - return StatusCode::SUCCESS; -} - - -StatusCode TrigL2PhotonFexMT::execute() +StatusCode TrigL2PhotonFexMT::execute() { using namespace xAOD; auto ctx = getContext(); @@ -60,8 +52,6 @@ StatusCode TrigL2PhotonFexMT::execute() std::make_unique<xAOD::TrigEMClusterAuxContainer>()) ); ATH_MSG_DEBUG( "Made WriteHandle " << m_outputPhotonsKey ); - ATH_MSG_INFO( name() << " running with store " << getContext().getExtension<Atlas::ExtendedEventContext>().proxy()->name() ); - auto roiCollection = SG::makeHandle(m_roiCollectionKey, ctx); if (roiCollection->size()==0) { diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.h index dc3cea8a3847586475fc7b1cefec134b69129530..8630e8caba1510e636bb39f19f001455afc89e6d 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -50,9 +50,8 @@ class TrigL2PhotonFexMT : public AthAlgorithm { TrigL2PhotonFexMT(const std::string & name, ISvcLocator* pSvcLocator); ~TrigL2PhotonFexMT(); - StatusCode initialize(); - StatusCode finalize(); - StatusCode execute(); + virtual StatusCode initialize() override; + virtual StatusCode execute() override; private: diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/AndHelperTool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/AndHelperTool.cxx index 64a7844c09a80df0c06be43f6b3601c6f157e9ad..3e5223e42d9c5468972a16bb6773534c06ac7526 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/AndHelperTool.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/AndHelperTool.cxx @@ -60,7 +60,5 @@ std::string AndHelperTool::toString() const{ StatusCode AndHelperTool::getDescription(ITrigJetHypoInfoCollector& c) const { c.collect(name(), toString()); - m_lhs->getDescription(c); - m_rhs->getDescription(c); - return StatusCode::SUCCESS; + return m_lhs->getDescription(c) & m_rhs->getDescription(c); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CombinationsHelperTool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CombinationsHelperTool.cxx index 37e9270e606e8a519104ec0e5c8d76176617f348..62710c951733d232586b9cd7750b3117a848f42a 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CombinationsHelperTool.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CombinationsHelperTool.cxx @@ -99,8 +99,9 @@ std::string CombinationsHelperTool::toString() const{ StatusCode CombinationsHelperTool::getDescription(ITrigJetHypoInfoCollector& c) const { c.collect(name(), toString()); + StatusCode sc; for(auto child : m_children){ - child->getDescription(c); + sc = sc & child->getDescription(c); } - return StatusCode::SUCCESS; + return sc; } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/NotHelperTool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/NotHelperTool.cxx index 64bfacbb1bbc6ea3d41520d1f155acc1bef953d8..32db6e7da78427a231e824b23082ec85fcdfc75c 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/NotHelperTool.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/NotHelperTool.cxx @@ -56,6 +56,5 @@ std::string NotHelperTool::toString() const{ StatusCode NotHelperTool::getDescription(ITrigJetHypoInfoCollector& c) const { c.collect(name(), toString()); - m_hypoTool->getDescription(c); - return StatusCode::SUCCESS; + return m_hypoTool->getDescription(c); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/OrHelperTool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/OrHelperTool.cxx index 1c2171618d0cfa99f92a25355504e677add5416f..7b1114acf67e21f552a5f83c65ed597d8cf6a1f1 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/OrHelperTool.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/OrHelperTool.cxx @@ -62,7 +62,5 @@ std::string OrHelperTool::toString() const{ StatusCode OrHelperTool::getDescription(ITrigJetHypoInfoCollector& c) const { c.collect(name(), toString()); - m_lhs->getDescription(c); - m_rhs->getDescription(c); - return StatusCode::SUCCESS; + return m_lhs->getDescription(c) & m_rhs->getDescription(c); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx index 2a69ef07a0ba76ef478fe0ffcc50952936be98c6..266550420939c30542a32eb591fb14d673e2150e 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigJetHypoToolMT.cxx @@ -42,7 +42,7 @@ TrigJetHypoToolMT::~TrigJetHypoToolMT(){ StatusCode TrigJetHypoToolMT::initialize(){ CHECK(m_evt.initialize()); HypoTreeInfoCollector collector; - m_helper->getDescription(collector); + CHECK(m_helper->getDescription(collector)); auto s = collector.toString(); for(const auto& l : lineSplitter(s)){ diff --git a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/InputMakerBase.h b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/InputMakerBase.h index a2192e62790335eefbf36b965003ce0c06790e84..5e035f2263ab864a2b44a6546068db6cff0e60df 100644 --- a/Trigger/TrigSteer/DecisionHandling/DecisionHandling/InputMakerBase.h +++ b/Trigger/TrigSteer/DecisionHandling/DecisionHandling/InputMakerBase.h @@ -39,7 +39,7 @@ This is a base class for HLT InputMakers to reduce boilerplate and enforce the c ///////////////////////////////////////////////////////////////////// /// provides debug printout of the output of the algorithm - StatusCode debugPrintOut(const EventContext& context, const std::vector< SG::WriteHandle<TrigCompositeUtils::DecisionContainer> >& outputHandles) const; + void debugPrintOut(const EventContext& context, const std::vector< SG::WriteHandle<TrigCompositeUtils::DecisionContainer> >& outputHandles) const; /// does the standard handling of input decisions: read from handles with all the checks, create corresponding output handles and link them, copies links and return outputHandles StatusCode decisionInputToOutput(const EventContext& context, std::vector< SG::WriteHandle<TrigCompositeUtils::DecisionContainer> > & outputHandles) const; diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerBase.cxx b/Trigger/TrigSteer/DecisionHandling/src/InputMakerBase.cxx index ae9f403eb8cf864fc9e352e4a2e7c6edc3a34be1..0657c2abf0bc8fb0aecec0bbaa3014d393d066c5 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerBase.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "DecisionHandling/InputMakerBase.h" @@ -132,7 +132,7 @@ StatusCode InputMakerBase::decisionInputToOutput(const EventContext& context, st -StatusCode InputMakerBase::debugPrintOut(const EventContext& context, const std::vector< SG::WriteHandle<TrigCompositeUtils::DecisionContainer> >& outputHandles) const{ +void InputMakerBase::debugPrintOut(const EventContext& context, const std::vector< SG::WriteHandle<TrigCompositeUtils::DecisionContainer> >& outputHandles) const{ size_t validInput=0; for ( auto inputKey: decisionInputs() ) { auto inputHandle = SG::makeHandle( inputKey, context ); @@ -169,7 +169,6 @@ StatusCode InputMakerBase::debugPrintOut(const EventContext& context, const std: } } } - return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx index e396a41734d7d451beda37ea95c45a0bbca81b4f..fed1441024260be9283c59c66f0553f282b5aaa2 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/InputMakerForRoI.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "InputMakerForRoI.h" @@ -90,8 +90,8 @@ StatusCode InputMakerForRoI::execute( const EventContext& context ) const { ATH_CHECK( roi_outputHandle.record(std::move(oneRoIColl)) ); // call base class helper method to print some debug messages summarising the content of the outputHandles. - ATH_CHECK( debugPrintOut(context, outputHandles) ); - + if (msgLvl(MSG::DEBUG)) debugPrintOut(context, outputHandles); + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/L1Decoder/share/testL1Decoder.py b/Trigger/TrigSteer/L1Decoder/share/testL1Decoder.py index 26ac84cad9d2968249c38f688afd6abb32a9fe44..4e5e2735811a6b76d0a9db0e023c98f78ae65384 100644 --- a/Trigger/TrigSteer/L1Decoder/share/testL1Decoder.py +++ b/Trigger/TrigSteer/L1Decoder/share/testL1Decoder.py @@ -5,8 +5,8 @@ from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() -topSequence.L1DecoderTest.ctpUnpacker.OutputLevel=DEBUG -for unpack in topSequence.L1DecoderTest.roiUnpackers: +topSequence.L1Decoder.ctpUnpacker.OutputLevel=DEBUG +for unpack in topSequence.L1Decoder.roiUnpackers: unpack.OutputLevel=DEBUG print unpack @@ -14,9 +14,9 @@ for unpack in topSequence.L1DecoderTest.roiUnpackers: CTPToChainMapping = {"HLT_j85": "L1_J20" } testChains =[x for x, y in CTPToChainMapping.items()] -topSequence.L1DecoderTest.ChainToCTPMapping = CTPToChainMapping +topSequence.L1Decoder.ChainToCTPMapping = CTPToChainMapping print testChains -print topSequence.L1DecoderTest +print topSequence.L1Decoder #from TrigUpgradeTest.jetDefs import jetRecoSequence #(recoSequence, sequenceOut) = jetRecoSequence("FSRoI") diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx index f952bea82082e2181e2d1cc13b2378b38eca0346..7a2fcc77d51ed4b1b3f30ed8df961e85cd4a01a8 100644 --- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx +++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithm.cxx @@ -1,7 +1,7 @@ /* General-purpose view creation algorithm <bwynne@cern.ch> - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "EventViewCreatorAlgorithm.h" @@ -115,7 +115,7 @@ StatusCode EventViewCreatorAlgorithm::execute( const EventContext& context ) con // ATH_CHECK( viewsHandle.record( std::move( viewVector ) ) ); ATH_MSG_DEBUG( "Store "<< viewsHandle->size() <<" Views"); - ATH_CHECK( debugPrintOut(context, outputHandles) ); + if (msgLvl(MSG::DEBUG)) debugPrintOut(context, outputHandles); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithmWithJets.cxx b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithmWithJets.cxx index 94f4acaa4efe4a7e48e6ea6cef7aa255631a791a..9277e968fe294d0ae388808c915dd40e6e4bed2b 100644 --- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithmWithJets.cxx +++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithmWithJets.cxx @@ -21,8 +21,8 @@ EventViewCreatorAlgorithmWithJets::EventViewCreatorAlgorithmWithJets( const std: EventViewCreatorAlgorithmWithJets::~EventViewCreatorAlgorithmWithJets() {} StatusCode EventViewCreatorAlgorithmWithJets::initialize() { - EventViewCreatorAlgorithm::initialize(); + ATH_CHECK( EventViewCreatorAlgorithm::initialize() ); ATH_CHECK( m_inViewJets.initialize() ); return StatusCode::SUCCESS; @@ -121,8 +121,8 @@ StatusCode EventViewCreatorAlgorithmWithJets::execute( const EventContext& conte // auto viewsHandle = SG::makeHandle( m_viewsKey ); // ATH_CHECK( viewsHandle.record( std::move( viewVector ) ) ); ATH_MSG_DEBUG( "Store "<< viewsHandle->size() <<" Views"); + if (msgLvl(MSG::DEBUG)) debugPrintOut(context, outputHandles); - ATH_CHECK( debugPrintOut(context, outputHandles) ); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithmWithMuons.cxx b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithmWithMuons.cxx index 8591294cc270f77e188d0763a68c81aa10d30b46..673e4a00c13942b5ba84994f179892915401bceb 100644 --- a/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithmWithMuons.cxx +++ b/Trigger/TrigSteer/ViewAlgs/src/EventViewCreatorAlgorithmWithMuons.cxx @@ -25,8 +25,8 @@ EventViewCreatorAlgorithmWithMuons::EventViewCreatorAlgorithmWithMuons( const st EventViewCreatorAlgorithmWithMuons::~EventViewCreatorAlgorithmWithMuons() {} StatusCode EventViewCreatorAlgorithmWithMuons::initialize() { - EventViewCreatorAlgorithm::initialize(); + ATH_CHECK( EventViewCreatorAlgorithm::initialize() ); ATH_CHECK( m_inViewMuons.initialize() ); return StatusCode::SUCCESS; @@ -103,9 +103,8 @@ StatusCode EventViewCreatorAlgorithmWithMuons::execute( const EventContext& cont m_viewNodeName, // CF node to attach views to context, // Source context m_scheduler.get() ) ); - - ATH_CHECK( debugPrintOut(context, outputHandles) ); + if (msgLvl(MSG::DEBUG)) debugPrintOut(context, outputHandles); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/CMakeLists.txt index f732df52dd4b1d12e4c3b8c1cbaa1b48cc5d673a..31831f4e01995f0a51ab502fba4092c7db59f5bf 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/CMakeLists.txt +++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 730711 2016-03-17 13:37:39Z krasznaa $ ################################################################################ # Package: L1TopoAlgorithms ################################################################################ @@ -53,7 +52,8 @@ add_custom_command( OUTPUT ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/L1TopoAlgorithms/L1TopoAlgConfig.py COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/L1TopoAlgorithms - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh TrigConfL1TopoGenPyAlg + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh + TrigConfL1TopoGenPyAlg ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/L1TopoAlgorithms/L1TopoAlgConfig.py DEPENDS TrigConfL1TopoGenPyAlg ) add_custom_target( L1TopoPyGenAlg ALL SOURCES diff --git a/Trigger/TrigT1/L1Topo/L1TopoHardware/CMakeLists.txt b/Trigger/TrigT1/L1Topo/L1TopoHardware/CMakeLists.txt index 193fa193ef051a6db9cd9150e2558ee40b360522..a0488eb5158fb67e22dd1ded8d4ec8083687333d 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoHardware/CMakeLists.txt +++ b/Trigger/TrigT1/L1Topo/L1TopoHardware/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 730705 2016-03-17 12:59:16Z krasznaa $ ################################################################################ # Package: L1TopoHardware ################################################################################ @@ -32,7 +31,8 @@ add_custom_command( OUTPUT ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/L1TopoHardware/L1TopoHardware.py COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/L1TopoHardware - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh TrigConfL1TopoGenPyHardware + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh + TrigConfL1TopoGenPyHardware ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/L1TopoHardware/L1TopoHardware.py DEPENDS TrigConfL1TopoGenPyHardware ) add_custom_target( L1TopoPyGenHardware ALL SOURCES diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py index 7d3225a1a0938f65f9e04dd2e6a764c69e5fbfde..831ebf05a8b3943f4067b8ab4ed339fb98a5b63d 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py @@ -27,9 +27,11 @@ class ConfiguredOnlineSpacePointProviderTool(OnlineSpacePointProviderTool) : # --- SiLorentzAngleTool from SiLorentzAngleTool.SCTLorentzAngleToolSetup import SCTLorentzAngleToolSetup sctLorentzAngleToolSetup = SCTLorentzAngleToolSetup() + + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.UseCalibConditions = False InDetL2TrigClusterMakerTool = InDet__ClusterMakerTool( name = "InDetL2TrigClusterMakerTool", - UsePixelCalibCondDB = False, PixelLorentzAngleTool = TrigPixelLorentzAngleTool, SCTLorentzAngleTool = TrigSCTLorentzAngleTool ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt index 29cfa7dc310414460d24337562c2a3b7e601b688..86efd641bf5099cbc53f3a76f070eebfed92a4c5 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt +++ b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt @@ -61,7 +61,7 @@ _add_test( decodeBS EXTRA_PATTERNS "-s FillMissingEDM.*(present|absent)" PROPERT _add_test( calo_only_data EXTRA_PATTERNS "-s .*ERROR.*|FastCaloL2EgammaAlg.*REGTEST*" ) _add_test( emu_step_processing EXTRA_PATTERNS "-s TrigSignatureMoniMT.*INFO HLT_.*" ) _add_test( emu_newjo EXTRA_PATTERNS "-s TrigSignatureMo.*INFO HLT_.*" ) -_add_test( runMenuTest EXTRA_PATTERNS "-s .*ERROR (?\!attempt to add a duplicate).*|.*FATAL.*|TrigSignatureMoniMT .*INFO.*" ) +_add_test( runMenuTest EXTRA_PATTERNS "-s .*ERROR (?\!attempt to add a duplicate).*|(?\!IOVSvcTool).*FATAL.*|TrigSignatureMoniMT .*INFO.*" ) _add_test( peb EXTRA_PATTERNS "-s obeysLB=.*robs=.*dets = |adds PEBInfo|TriggerSummary.*HLT_.*" ) _add_test( dataScouting EXTRA_PATTERNS "-s obeysLB=.*robs=.*dets = |adds PEBInfo|TriggerSummary.*HLT_.*|Serialiser.*Type|Serialiser.*ROBFragments with IDs|{module.*words}" ) _add_test( bjet_menuALLTE EXTRA_PATTERNS "-s TrigSignatureMoniMT.*HLT_.*" ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py index 9028462a9f3f939f13ed1d3b4a82b4eb30cd4d31..14ec3702f1a7ac41248ebac661a6203bacf26c84 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/InDetConfig.py @@ -124,18 +124,18 @@ def TrigInDetCondConfig( flags ): PixelTDAQInstance = "TDAQ_ONL" acc.merge(addFolders(flags, PixelTDAQFolder, PixelTDAQInstance, className="CondAttrListCollection")) - PixelHVFolder = "/PIXEL/DCS/HV" - PixelTempFolder = "/PIXEL/DCS/TEMPERATURE" - PixelDBInstance = "DCS_OFL" - - acc.merge(addFolders(flags, PixelHVFolder, PixelDBInstance, className="CondAttrListCollection")) - acc.merge(addFolders(flags, PixelTempFolder, PixelDBInstance, className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/PIXEL/DCS/HV", "DCS_OFL", className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/PIXEL/DCS/TEMPERATURE", "DCS_OFL", className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/PIXEL/PixCalib", "PIXEL_OFL", className="CondAttrListCollection")) from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondHVAlg - acc.addCondAlgo(PixelDCSCondHVAlg(name="PixelDCSCondHVAlg", ReadKey=PixelHVFolder)) + acc.addCondAlgo(PixelDCSCondHVAlg(name="PixelDCSCondHVAlg", ReadKey="/PIXEL/DCS/HV")) from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondTempAlg - acc.addCondAlgo(PixelDCSCondTempAlg(name="PixelDCSCondTempAlg", ReadKey=PixelTempFolder)) + acc.addCondAlgo(PixelDCSCondTempAlg(name="PixelDCSCondTempAlg", ReadKey="/PIXEL/DCS/TEMPERATURE")) + + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelChargeCalibCondAlg + acc.addCondAlgo(PixelChargeCalibCondAlg(name="PixelChargeCalibCondAlg", ReadKey="/PIXEL/PixCalib")) from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg acc.addCondAlgo(PixelTDAQCondAlg(name="PixelTDAQCondAlg", ReadKey=PixelTDAQFolder)) @@ -143,11 +143,11 @@ def TrigInDetCondConfig( flags ): PixelDeadMapFolder = "/PIXEL/PixMapOverlay" PixelDeadMapInstance = "PIXEL_OFL" - acc.merge(addFolders(flags, PixelTempFolder, PixelDBInstance, className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/PIXEL/DCS/TEMPERATURE", "DCS_OFL", className="CondAttrListCollection")) acc.merge(addFolders(flags, PixelDeadMapFolder, PixelDeadMapInstance, className="CondAttrListCollection")) from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg - acc.addCondAlgo(PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadMap=False, ReadDeadMapKey=PixelDeadMapFolder)) + acc.addCondAlgo(PixelConfigCondAlg(name="PixelConfigCondAlg", UseDeadMap=False, ReadDeadMapKey=PixelDeadMapFolder, UseCalibConditions=False)) from SiPropertiesTool.SiPropertiesToolConf import PixelSiPropertiesCondAlg acc.addCondAlgo(PixelSiPropertiesCondAlg(name="PixelSiPropertiesCondAlg")) @@ -273,10 +273,8 @@ def TrigInDetConfig( flags, roisKey="EMRoIs" ): #Pixel clusterisation - from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool - InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool", - UsePixelCalibCondDB = False) + InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool") acc.addPublicTool(InDetClusterMakerTool) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py b/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py index 665e74ee63a66f70eee369ed50c6b2a6fd94970b..c38d53fac813a6352db0634eafdc456348c32efa 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py @@ -41,7 +41,7 @@ def applyMenu(l1decoder ): # L1Decoder for bytestream from L1Decoder.L1DecoderConf import L1Decoder class L1DecoderTest(L1Decoder) : - def __init__(self, name='L1DecoderTest', *args, **kwargs): + def __init__(self, name='L1Decoder', *args, **kwargs): super(L1DecoderTest, self).__init__(name, *args, **kwargs) from TriggerJobOpts.TriggerFlags import TriggerFlags diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/Calo.py b/Trigger/TrigValidation/TrigUpgradeTest/share/Calo.py index 4766fe37da5269213cf1effb40fca1064bd6ffe1..6e4e216708775b9c7504429b5817c27c046887b9 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/Calo.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/Calo.py @@ -21,7 +21,7 @@ from DecisionHandling.DecisionHandlingConf import RoRSeqFilter steps = seqOR("HLTTop") topSequence += steps -steps += topSequence.L1DecoderTest +steps += topSequence.L1Decoder diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/bjet.menu.ALLTE.py b/Trigger/TrigValidation/TrigUpgradeTest/share/bjet.menu.ALLTE.py index 61edaeb16897adbf8850e9ae60ecb8431dd6a9ec..7b4ff11be671168264720e47946f5a1cdcb3480a 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/bjet.menu.ALLTE.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/bjet.menu.ALLTE.py @@ -22,14 +22,15 @@ testChains = [ Chain(name='HLT_j35_gsc45_boffperf_split' , Seed="L1_J20", ChainSteps=[step1,step2] ), Chain(name='HLT_j35_gsc45_bmv2c1070_split', Seed="L1_J20", ChainSteps=[step1,step2] ), Chain(name='HLT_j35_gsc45_bmv2c1070' , Seed="L1_J20", ChainSteps=[step1,step2] ) - ] + ] + ################################# # Configure L1Decoder ################################# -topSequence.L1DecoderTest.prescaler.Prescales = ["HLT_j35_gsc45_boffperf_split:1", - "HLT_j35_gsc45_bmv2c1070_split:1", - "HLT_j35_gsc45_bmv2c1070:1"] +topSequence.L1Decoder.prescaler.Prescales = ["HLT_j35_gsc45_boffperf_split:1", + "HLT_j35_gsc45_bmv2c1070_split:1", + "HLT_j35_gsc45_bmv2c1070:1"] ##### Make all HLT ####### diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/checklogTrigUpgradeTest.conf b/Trigger/TrigValidation/TrigUpgradeTest/share/checklogTrigUpgradeTest.conf index b6a6d061cbf1c8efbac853baf566239ec317d382..837406fd9c31591a703cf4456c7152e81fb70785 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/checklogTrigUpgradeTest.conf +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/checklogTrigUpgradeTest.conf @@ -4,6 +4,6 @@ ignore 'Failed to get SCT_FlaggedCondData_TRIG' ignore 'SCT_FlaggedCondData cannot be retrieved' ignore 'Cannot update Conditions via callback functions in MT after the first event' ignore 'Exception with tag=IOVSvc.StoreGateSvc is caught handling incidentBeginEvent' -ignore 'Cannot update Conditions via callback functions in MT after the first event' ignore 'attempt to add a duplicate.*dupe ignored' +ignore 'IOVSvcTool.*CLID=.*name=.*' diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/dataScoutingTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/dataScoutingTest.py index 3656d4ae4772c1838875ac23904cb13fa4697ea6..6918108ba436188e31cafe3345f61815b6c360cd 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/dataScoutingTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/dataScoutingTest.py @@ -65,7 +65,7 @@ if (doElectron): # this is a temporary hack to include new test chains EnabledChainNamesToCTP = dict([ (c.name, c.seed) for c in testChains]) -topSequence.L1DecoderTest.ChainToCTPMapping = EnabledChainNamesToCTP +topSequence.L1Decoder.ChainToCTPMapping = EnabledChainNamesToCTP ########################################## @@ -98,7 +98,7 @@ for chain, decisionKey in chainToDecisionKeyDict.iteritems(): ########################################## # EDM Maker ########################################## -l1decoder = getSequence("L1DecoderTest") +l1decoder = getSequence("L1Decoder") hltAllSteps = getSequence("HLTAllSteps") from TriggerJobOpts.TriggerConfig import collectHypos,collectFilters,collectViewMakers,collectDecisionObjects,triggerMergeViewsAndAddMissingEDMCfg hypos = collectHypos(hltAllSteps) @@ -106,7 +106,7 @@ filters = collectFilters(hltAllSteps) viewMakers = collectViewMakers(hltAllSteps) decisionObjects = collectDecisionObjects(hypos,filters,l1decoder) edmMakerAlg = triggerMergeViewsAndAddMissingEDMCfg( [], hypos, viewMakers, decisionObjects ) -topSequence.hltTop += edmMakerAlg +topSequence.HLTTop += edmMakerAlg # Add Electrons merger (somehow not created by triggerAddMissingEDMCfg above) from TrigOutputHandling.TrigOutputHandlingConf import HLTEDMCreator @@ -189,7 +189,7 @@ hltResultMakerTool.OutputLevel = DEBUG hltResultMakerAlg = HLTResultMTMakerAlg("HLTRMakerAlg") hltResultMakerAlg.ResultMaker = hltResultMakerTool -topSequence.hltTop += hltResultMakerAlg +topSequence.HLTTop += hltResultMakerAlg ########################################## # Some debug diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py index c3af7c1cee7172308547a03c36b665ccfc074ebd..48ad0a9183e2ff7ee70f5e8afafb288d128b85db 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/egamma.withViews.py @@ -17,11 +17,11 @@ CTPToChainMapping = {"HLT_e3_etcut": "L1_EM3", "HLT_2e3_etcut": "L1_2EM3", "HLT_e3_e5_etcut":"L1_2EM3"} -topSequence.L1DecoderTest.prescaler.Prescales = ["HLT_e3_etcut:2", "HLT_2e3_etcut:2.5"] +topSequence.L1Decoder.prescaler.Prescales = ["HLT_e3_etcut:2", "HLT_2e3_etcut:2.5"] # this is a temporary hack to include only new test chains testChains =[x for x, y in CTPToChainMapping.items()] -topSequence.L1DecoderTest.ChainToCTPMapping = CTPToChainMapping +topSequence.L1Decoder.ChainToCTPMapping = CTPToChainMapping @@ -250,7 +250,7 @@ steps = seqAND("HLTSteps", [ step0filter, step0, step1filter, step1, step2filter from TrigSteerMonitor.TrigSteerMonitorConf import TrigSignatureMoniMT, DecisionCollectorTool mon = TrigSignatureMoniMT() from TrigUpgradeTest.TestUtils import MenuTest -mon.ChainsList = list( set( topSequence.L1DecoderTest.ChainToCTPMapping.keys() ) ) +mon.ChainsList = list( set( topSequence.L1Decoder.ChainToCTPMapping.keys() ) ) #mon.ChainsList = list( set( MenuTest.CTPToChainMapping.keys() ) ) @@ -288,7 +288,6 @@ StreamESD.ItemList += [ "xAOD::TrigElectronAuxContainer#HLT_xAOD__TrigElectronCo "xAOD::TrigEMClusterAuxContainer#HLT_xAOD__TrigEMClusterContainer_L2CaloClustersAux."] StreamESD.ItemList += [ "EventInfo#ByteStreamEventInfo" ] - StreamESD.ItemList += [ "TrigRoiDescriptorCollection#EMRoIs" ] StreamESD.ItemList += [ "TrigRoiDescriptorCollection#JRoIs" ] StreamESD.ItemList += [ "TrigRoiDescriptorCollection#METRoI" ] @@ -413,7 +412,7 @@ ServiceMgr += AuditorSvc() # This triggers the L1 decoder to signal the start of processing, # and the HLT summary alg to signal end of processing and handle the writing of data. -topSequence.L1DecoderTest.EnableCostMonitoring = True +topSequence.L1Decoder.EnableCostMonitoring = True summMaker.EnableCostMonitoring = True # Write out the data at the end diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py index 0c000812b481d3af1552663ddd7966a433700a2d..0de1418a8bbb6bef166b3efaaade7e13211c4e0f 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py @@ -3,6 +3,10 @@ # # import flags +from RecExConfig.RecFlags import rec +rec.doESD=True +rec.doWriteESD=True + include("TrigUpgradeTest/testHLT_MT.py") #Currently only runs egamma and mu chains but expect to expand @@ -198,14 +202,48 @@ from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import makeHLTTree makeHLTTree(testChains) - ########################################## # Some debug ########################################## from AthenaCommon.AlgSequence import dumpSequence, AthSequencer dumpSequence(topSequence) + import DecisionHandling for a in AthSequencer("HLTAllSteps").getChildren(): if isinstance(a, DecisionHandling.DecisionHandlingConf.TriggerSummaryAlg): a.OutputLevel = DEBUG + + +# this part uses parts from the NewJO configuration, it is very hacky for the moment + +from TriggerJobOpts.TriggerConfig import collectHypos, collectFilters, collectDecisionObjects, triggerOutputStreamCfg +hypos = collectHypos(topSequence) +filters = collectFilters(topSequence) +from AthenaCommon.CFElements import findAlgorithm,findSubSequence +decObj = collectDecisionObjects( hypos, filters, findAlgorithm(topSequence, 'L1Decoder') ) +print decObj + +from TrigEDMConfig.TriggerEDMRun3 import TriggerHLTList +ItemList = [ 'xAOD::TrigCompositeContainer#{}'.format(d) for d in decObj ] +ItemList += [ 'xAOD::TrigCompositeAuxContainer#{}Aux.'.format(d) for d in decObj ] +ItemList += [ k[0] for k in TriggerHLTList if 'ESD' in k[1] and "TrigComposite" not in k[0] ] +ItemList += [ k[0] for k in TriggerHLTList if 'ESD' in k[1] and "TrigComposite" in k[0] ] +ItemList += [ 'xAOD::TrigCompositeAuxContainer#{}Aux.'.format(k[0].split("#")[1]) for k in TriggerHLTList if 'ESD' in k[1] and "TrigComposite" in k[0] ] +ItemList += [ "xAOD::EventInfo#EventInfo" ] + +ItemList = list(set(ItemList)) + + + +import AthenaPoolCnvSvc.WriteAthenaPool +from OutputStreamAthenaPool.OutputStreamAthenaPool import createOutputStream +StreamESD=createOutputStream("StreamESD","myESD.pool.root",True) +StreamESD.ItemList = ItemList + + +HLTTop = findSubSequence(topSequence, "HLTTop") + + + + diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py b/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py index 0830728372028a70af0436db02eab52424bc4cd1..3f41ee0dcdb47540f98378c55bbbcb2cc1c0e1da 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/mu.withViews.py @@ -44,7 +44,7 @@ CTPToChainMapping = { "HLT_mu6" : "L1_MU6", # this is a temporary hack to include only new test chains testChains =[x for x, y in CTPToChainMapping.items()] -topSequence.L1DecoderTest.ChainToCTPMapping = CTPToChainMapping +topSequence.L1Decoder.ChainToCTPMapping = CTPToChainMapping def __mon(finalCollName, stepColls=[]): from TrigOutputHandling.TrigOutputHandlingConf import DecisionSummaryMakerAlg diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/pebTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/pebTest.py index d05cb0ab9ea8fd4bd11f14c766a2c6ea8e040c78..a220c7635a21e8cf7b2d4a3016aa16f739ee96b3 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/pebTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/pebTest.py @@ -75,7 +75,7 @@ if (doMuon): # this is a temporary hack to include new test chains EnabledChainNamesToCTP = dict([ (c.name, c.seed) for c in testChains]) -topSequence.L1DecoderTest.ChainToCTPMapping = EnabledChainNamesToCTP +topSequence.L1Decoder.ChainToCTPMapping = EnabledChainNamesToCTP ########################################## # CF construction @@ -107,7 +107,7 @@ for chain, decisionKey in chainToDecisionKeyDict.iteritems(): ########################################## # EDM Maker ########################################## -l1decoder = getSequence("L1DecoderTest") +l1decoder = getSequence("L1Decoder") hltAllSteps = getSequence("HLTAllSteps") from TriggerJobOpts.TriggerConfig import collectHypos,collectFilters,collectViewMakers,collectDecisionObjects,triggerMergeViewsAndAddMissingEDMCfg hypos = collectHypos(hltAllSteps) @@ -115,7 +115,7 @@ filters = collectFilters(hltAllSteps) viewMakers = collectViewMakers(hltAllSteps) decisionObjects = collectDecisionObjects(hypos,filters,l1decoder) edmMakerAlg = triggerMergeViewsAndAddMissingEDMCfg( [], hypos, viewMakers, decisionObjects ) -topSequence.hltTop += edmMakerAlg +topSequence.HLTTop += edmMakerAlg # Add Electrons merger (somehow not created by triggerAddMissingEDMCfg above) from TrigOutputHandling.TrigOutputHandlingConf import HLTEDMCreator @@ -190,7 +190,7 @@ hltResultMakerTool.OutputLevel = DEBUG hltResultMakerAlg = HLTResultMTMakerAlg("HLTRMakerAlg") hltResultMakerAlg.ResultMaker = hltResultMakerTool -topSequence.hltTop += hltResultMakerAlg +topSequence.HLTTop += hltResultMakerAlg ########################################## # Some debug diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/runMenuTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/runMenuTest.py index 6409485602c085081cd9b54d8b90db5844edeed6..9cfce4b4d15aa20b0d66a5b1e6c778e4bab13a05 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/runMenuTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/runMenuTest.py @@ -23,7 +23,6 @@ menu.overwriteSignaturesWith(signaturesToGenerate) allChainConfigs = menu.generateMT() - ########################################## # Some debug ########################################## diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py b/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py index 95d2a9d29f6882a9a1783ef23c235571909ed164..5be475fc171e98ecf1076be23a214eeaff4eb45d 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/simpleJetJob.py @@ -25,11 +25,11 @@ if TriggerFlags.doCalo: "HLT_j45" : "L1_J20" } testChains =[x for x, y in CTPToChainMapping.items()] - topSequence.L1DecoderTest.ChainToCTPMapping = CTPToChainMapping + topSequence.L1Decoder.ChainToCTPMapping = CTPToChainMapping print testChains # get L1 decisions - for unpack in topSequence.L1DecoderTest.roiUnpackers: + for unpack in topSequence.L1Decoder.roiUnpackers: if unpack.name() is "JRoIsUnpackingTool": L1JetDecisions=unpack.Decisions diff --git a/Trigger/TrigValidation/TrigUpgradeTest/src/TestInputMaker.cxx b/Trigger/TrigValidation/TrigUpgradeTest/src/TestInputMaker.cxx index 226e7820b9ae739def0c571c41d0d28b0b38d194..69c0835d28e55737af0b190356146eebcf10a8bc 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/src/TestInputMaker.cxx +++ b/Trigger/TrigValidation/TrigUpgradeTest/src/TestInputMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // TrigUpgradeTest includes @@ -100,7 +100,7 @@ namespace HLTTest { CHECK( reco_outputHandle.record(std::move(reco_output), std::move(aux)) ); // call base class helper method to print some debug messages summarising the content of the outputHandles. - CHECK( debugPrintOut(context, outputHandles) ); + if (msgLvl(MSG::DEBUG)) debugPrintOut(context, outputHandles); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_athenaMT.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_athenaMT.sh index 4f50cdd01b9a9505123b94d5991b8d4745d3d057..f6c9952ed9800439ad1df119590b0e6dedb54204 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_athenaMT.sh +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_athenaMT.sh @@ -46,6 +46,8 @@ fi if [[ $INPUT == "run2data" ]]; then export DS="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1" +elif [[ $INPUT == "run2dataFTK" ]]; then + export DS="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data18_13TeV.00360026.physics_EnhancedBias.MissingTowers._lb0151._SFO-6._0001.1,/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data18_13TeV.00360026.physics_EnhancedBias.MissingTowers._lb0151._SFO-6._0002.1,/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data18_13TeV.00360026.physics_EnhancedBias.MissingTowers._lb0151._SFO-6._0003.1,/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data18_13TeV.00360026.physics_EnhancedBias.MissingTowers._lb0151._SFO-6._0004.1" elif [[ $INPUT == "run2mc_ttbar" ]]; then export DS="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TriggerTest/valid1.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.RDO.e3099_s2578_r7572_tid07644622_00/RDO.07644622._000001.pool.root.1,/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TriggerTest/valid1.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.RDO.e3099_s2578_r7572_tid07644622_00/RDO.07644622._000002.pool.root.1" else @@ -70,7 +72,7 @@ else ${MATHLIBOPT} \ --threads ${THREADS} \ --concurrent-events ${SLOTS} \ - --filesInput ${DS} \ + --filesInput "${DS}" \ --evtMax ${EVENTS} \ --skipEvents ${SKIPEVENTS} \ -c "${EXTRA}" \ diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh index b3dca51c066a95bdba5c3d88da4fc3c5571fd3da..e6bc7ed40cb9262a2b2d3802880d1a4bb6315290 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/exec_TrigUpgradeTest_art_post.sh @@ -100,6 +100,14 @@ else echo "art-result: 999 RootComp" fi +### CHAINDUMP + +# Using temporary workaround to dump HLTChain.txt +if [ -f expert-monitoring.root ]; then + echo "Running chainDumpWorkaround.sh" + chainDumpWorkaround.sh expert-monitoring.root +fi + ### SUMMARY echo $(date "+%FT%H:%M %Z")" Files in directory:" diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_emu_newjo.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_emu_newjo.sh index 4cdc315f570af3cd8320bb9f14d8308910deedb2..b7e616872764362a3819cf8e80d5ca3fe799014f 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_emu_newjo.sh +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_emu_newjo.sh @@ -2,19 +2,6 @@ # art-type: build # art-include: master/Athena -rm -rf EmuNewJOTest.py bootstrap.pkl bootstrap.py - -# this is a hack to pre-confgure scheduler and other MT services, -#will be taken away once NEW system has better means to influence the bootstrap content -cat <<EOF >> bootstrap.py -from AthenaCommon.AppMgr import theApp, ServiceMgr as svcMgr -svcMgr.AvalancheSchedulerSvc.ShowControlFlow=True -svcMgr.AvalancheSchedulerSvc.ShowDataDependencies=True -EOF - -athena --imf --threads=1 --config-only=bootstrap.pkl bootstrap.py - - get_files -jo TrigUpgradeTest/EmuNewJOTest.py python EmuNewJOTest.py # generate pickle status=$? diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_full_menu_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_full_menu_build.sh index 4e88d4e27d8708d7b2efc1c83436c91d49256d6a..539b1c7d6711c190975c367bd390b58781ed4e12 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_full_menu_build.sh +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_full_menu_build.sh @@ -3,8 +3,9 @@ # art-type: build # art-include: master/Athena # art-output: *.log +# art-output: *.new +# art-output: *.txt # art-output: *.root -# art-output: *.regtest.new export NAME="TrigUpgradeTest_full_menu_build" export SKIPEVENTS=10 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_full_menu_grid.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_full_menu_grid.sh new file mode 100755 index 0000000000000000000000000000000000000000..2111c44519e37c589454252d9fa2120be87c8c01 --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_full_menu_grid.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# art-description: athenaMT trigger test using the full menu from TrigUpgradeTest job options +# art-type: grid +# art-include: master/Athena +# art-output: *.log +# art-output: *.new +# art-output: *.txt +# art-output: *.root + +export NAME="TrigUpgradeTest_full_menu_grid" +export INPUT="run2dataFTK" # FTK doesn't matter here - using this dataset because of larger stats +export EVENTS=1000 +export THREADS=1 +export SLOTS=1 +export JOBOPTION="TrigUpgradeTest/full_menu.py" +export REGTESTEXP="TriggerSummaryStep.*HLT_.*|TriggerMonitorFinal.*HLT_.*|TrigSignatureMoniMT.*HLT_.*" + +source exec_TrigUpgradeTest_art_athenaMT.sh +source exec_TrigUpgradeTest_art_post.sh + diff --git a/Trigger/TrigValidation/TrigValTools/bin/chainDumpWorkaround.sh b/Trigger/TrigValidation/TrigValTools/bin/chainDumpWorkaround.sh new file mode 100755 index 0000000000000000000000000000000000000000..30fe93e26e91bd90a726f1165128b1a6bc230e4f --- /dev/null +++ b/Trigger/TrigValidation/TrigValTools/bin/chainDumpWorkaround.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +# +# This script is a temporary workaround to generate counts file HLTChain.txt from TrigUpgradeTest expert-monitoring.root +# It will be needed only as long as we don't implement the ChainAcceptance histogram in the HLT monitoring +# + +histFile=$1 +if [ -z "${histFile}" ] || [ ! -f ${histFile} ]; then + echo "Usage: $(basename -- $0) file.root" + exit 1 +fi + +rootScript="TFile f(\"$histFile\"); \ +TH2* h2d=(TH2*)f.Get(\"TrigSteer_HLT/SignatureAcceptance\"); \ +int biny=h2d->GetYaxis()->FindBin(\"Output\"); \ +TH1* h1d=(TH1*)h2d->ProjectionX(\"\",biny,biny); \ +for (int i=0; i<=h1d->GetNbinsX(); ++i) {int num=h1d->GetBinContent(i); printf(\"%s %d\\n\",h1d->GetXaxis()->GetBinLabel(i),num);}" + +root -b -l -q -e "${rootScript}" | grep 'HLT_' | sort > HLTChain.txt diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py index 4a8a39463a4c27b4a0e3338b7d572ea93bce9c2c..7b0b71ea61921e9c4b35fb2a10178a020ee2be5c 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py @@ -90,9 +90,12 @@ def collectDecisionObjects( hypos, filters, l1decoder ): for step, stepHypos in hypos.iteritems(): for hypoAlg in stepHypos: __log.debug( "Hypo %s with input %s and output %s " % (hypoAlg.getName(), str(hypoAlg.HypoInputDecisions), str(hypoAlg.HypoOutputDecisions) ) ) - __log.debug( "and hypo tools %s " % (str( [ t.getName() for t in hypoAlg.HypoTools ] ) ) ) - decisionObjects.add( hypoAlg.HypoInputDecisions ) - decisionObjects.add( hypoAlg.HypoOutputDecisions ) + if isinstance( hypoAlg.HypoInputDecisions, list): + [ decisionObjects.add( d ) for d in hypoAlg.HypoInputDecisions ] + [ decisionObjects.add( d ) for d in hypoAlg.HypoOutputDecisions ] + else: + decisionObjects.add( hypoAlg.HypoInputDecisions ) + decisionObjects.add( hypoAlg.HypoOutputDecisions ) __log.info("Collecting decision obejcts from filters") for step, stepFilters in filters.iteritems(): @@ -263,6 +266,7 @@ def triggerMergeViewsAndAddMissingEDMCfg( edmSet, hypos, viewMakers, decObj ): if pr != producer[0]: __log.error("Several View making algorithms produce the same output collection {}: {}".format( viewsColl, ' '.join([p.name() for p in producer ]) ) ) continue + producer = producer[0] tool.TrigCompositeContainer = producer.InputMakerOutputDecisions tool.FixLinks = True @@ -367,6 +371,7 @@ def triggerRunCfg( flags, menu=None ): if flags.Output.AODFileName != "": acc.merge( triggerOutputStreamCfg( flags, decObj, "AOD" ) ) edmSet.append('AOD') + if any( (flags.Output.ESDFileName != "" , flags.Output.AODFileName != "", flags.Trigger.writeBS) ): mergingAlg = triggerMergeViewsAndAddMissingEDMCfg( edmSet , hypos, viewMakers, decObj ) acc.addEventAlgo( mergingAlg, sequenceName="HLTTop" ) diff --git a/Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt index fa766915a7fe50f44166b430edc576d260afb2d2..6a41b5c3311fb994b7a7bedd797ed098191d973c 100644 --- a/Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt +++ b/Trigger/TriggerCommon/TriggerMenu/CMakeLists.txt @@ -53,8 +53,9 @@ function( atlas_run_lowestunprescaled ) ${CMAKE_CURRENT_BINARY_DIR}/unprescaled.attempted.stamp COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/LowestUnprescaledLists/unprescaled - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/generateUnprescaledLists.py ${CMAKE_CURRENT_BINARY_DIR}/LowestUnprescaledLists/unprescaled + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/generateUnprescaledLists.py + ${CMAKE_CURRENT_BINARY_DIR}/LowestUnprescaledLists/unprescaled COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/unprescaled.stamp DEPENDS "Package_$<JOIN:$<TARGET_PROPERTY:ATLAS_PACKAGES_TARGET,ATLAS_PACKAGES>,;Package_>" ) @@ -74,7 +75,7 @@ function( atlas_run_lowestunprescaled ) COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/LowestUnprescaledLists/unprescaled ) execute_process( - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/generateUnprescaledLists.py ${CMAKE_CURRENT_BINARY_DIR}/LowestUnprescaledLists/unprescaled ) endif()" ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt index ec834a4342ee2ec046d237c6700b89871f59ed42..acf3960eabeadf43229226b03fc6060d213af8c7 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt +++ b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt @@ -38,7 +38,7 @@ function( atlas_build_lvl1_trigger_menu menu ) ${CMAKE_CURRENT_BINARY_DIR}/${menu}.attempted.stamp COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Menus/${menu} - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/generateL1MenuMT.sh -r ${CMAKE_PROJECT_VERSION} ${menu} ${CMAKE_CURRENT_BINARY_DIR}/Menus/${menu} COMMAND ${CMAKE_COMMAND} -E make_directory @@ -69,7 +69,7 @@ function( atlas_build_lvl1_trigger_menu menu ) COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Menus/${menu} ) execute_process( - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/generateL1MenuMT.sh -r ${CMAKE_PROJECT_VERSION} ${menu} ${CMAKE_CURRENT_BINARY_DIR}/Menus/${menu} ) endif()" ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py index be9e210916f26a175fe6d01d438d5bf12dbc411c..3ed355be025045a18ef5b1b559e4fd74f41d3dca 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/InDetSetup.py @@ -123,10 +123,11 @@ def makeInDetAlgs( whichSignature='' ): #Pixel clusterisation from InDetTrigRecExample.InDetTrigConfigRecLoadTools import TrigPixelLorentzAngleTool, TrigSCTLorentzAngleTool + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelConfigCondAlg + PixelConfigCondAlg.UseCalibConditions = False + from SiClusterizationTool.SiClusterizationToolConf import InDet__ClusterMakerTool InDetClusterMakerTool = InDet__ClusterMakerTool(name = "InDetClusterMakerTool" + signature, - PixelCalibSvc = None, - UsePixelCalibCondDB = False, SCTLorentzAngleTool = TrigSCTLorentzAngleTool, PixelLorentzAngleTool = TrigPixelLorentzAngleTool) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py index 70daed36167667fb2a277b86d653d586957a3781..b5997b4804750268e090add8fc8cfe665c3aa121 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py @@ -130,7 +130,7 @@ def makeHLTTree(HLTChains, triggerConfigHLT = None): l1decoder[0].ChainToCTPMapping = EnabledChainNamesToCTP # main HLT top sequence - hltTop = seqOR("hltTop") + hltTop = seqOR("HLTTop") # add the HLT steps Node steps = seqAND("HLTAllSteps") @@ -146,17 +146,24 @@ def makeHLTTree(HLTChains, triggerConfigHLT = None): hltTop += summary # add signature monitor - from TriggerJobOpts.TriggerConfig import collectHypos, collectFilters, triggerMonitoringCfg, triggerSummaryCfg + from TriggerJobOpts.TriggerConfig import collectHypos, collectFilters, collectViewMakers, collectDecisionObjects,\ + triggerMonitoringCfg, triggerSummaryCfg, triggerMergeViewsAndAddMissingEDMCfg hypos = collectHypos(steps) filters = collectFilters(steps) + viewMakers = collectViewMakers(steps) + decObj = collectDecisionObjects( hypos, filters, l1decoder[0] ) summaryAcc, summaryAlg = triggerSummaryCfg( ConfigFlags, hypos ) hltTop += summaryAlg - summaryAcc.appendToGlobals() + summaryAcc.appendToGlobals() monAcc, monAlg = triggerMonitoringCfg( ConfigFlags, hypos, filters, l1decoder[0] ) - monAcc.appendToGlobals() + monAcc.appendToGlobals() hltTop += monAlg + # this is a shotcut for now, we always assume we may be writing ESD & AOD outputs, so all gaps will be filled + edmAlg = triggerMergeViewsAndAddMissingEDMCfg(['AOD', 'ESD'], hypos, viewMakers, decObj ) + hltTop += edmAlg + topSequence += hltTop diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py index 0ce7cdcf5c3eb9be19dfad9cf007d71cd618db98..fc67b6f9f3aaca5dbc883b9d951a094ca7ee10d0 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py @@ -423,7 +423,6 @@ def muEFSARecoSequence( RoIs, name ): ServiceMgr += Trk__TrackingVolumesSvc("TrackingVolumesSvc",BuildVolumesFromTagInfo = False) theSegmentFinder = CfgGetter.getPublicToolClone("MuonSegmentFinder","MooSegmentFinder") - theSegmentFinder.DoSummary=True CfgGetter.getPublicTool("MuonLayerHoughTool").DoTruth=False theSegmentFinderAlg=CfgMgr.MooSegmentFinderAlg( "MuonSegmentMaker_"+name, SegmentFinder=theSegmentFinder, @@ -462,8 +461,6 @@ def muEFSARecoSequence( RoIs, name ): # doTGCClust = False, # doRPCClust = False) - from MuonRecExample.MuonStandalone import MuonTrackSteering - MuonTrackSteering.DoSummary=True TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder" ) TrackBuilder.TrackSteering=CfgGetter.getPublicToolClone("TrigMuonTrackSteering", "MuonTrackSteering") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/share/generateMT.py b/Trigger/TriggerCommon/TriggerMenuMT/share/generateMT.py index 5c6ac07101f5e6adcf37008c9ed5f8c4289ecc4d..b732756a66c1bf0bda009bb4fa3e37574557e325 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/share/generateMT.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/share/generateMT.py @@ -7,23 +7,23 @@ include("TrigUpgradeTest/testHLT_MT.py") # provide a minimal menu information if globalflags.InputFormat.is_bytestream(): - topSequence.L1DecoderTest.ctpUnpacker.OutputLevel=DEBUG - topSequence.L1DecoderTest.roiUnpackers[0].OutputLevel=DEBUG + topSequence.L1Decoder.ctpUnpacker.OutputLevel=DEBUG + topSequence.L1Decoder.roiUnpackers[0].OutputLevel=DEBUG # map L1 decisions for menu -for unpack in topSequence.L1DecoderTest.roiUnpackers: +for unpack in topSequence.L1Decoder.roiUnpackers: if unpack.name() is "EMRoIsUnpackingTool": unpack.Decisions="L1EM" emUnpacker=unpack if unpack.name() is "MURoIsUnpackingTool": unpack.Decisions="L1MU" -for unpack in topSequence.L1DecoderTest.rerunRoiUnpackers: +for unpack in topSequence.L1Decoder.rerunRoiUnpackers: if unpack.name() is "EMRerunRoIsUnpackingTool": unpack.Decisions="RerunL1EM" unpack.SourceDecisions="L1EM" -for unpack in topSequence.L1DecoderTest.rerunRoiUnpackers: +for unpack in topSequence.L1Decoder.rerunRoiUnpackers: if unpack.name() is "EMRerunRoIsUnpackingTool": unpack.SourceDecisions="L1EM" if unpack.name() is "MURerunRoIsUnpackingTool": diff --git a/Trigger/TriggerCommon/TriggerMenuXML/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenuXML/CMakeLists.txt index e8205fbed423ed5c2061ce14ca24d28fbd00080e..d5fbba6c2368d67e67b5642219865ab23607f072 100644 --- a/Trigger/TriggerCommon/TriggerMenuXML/CMakeLists.txt +++ b/Trigger/TriggerCommon/TriggerMenuXML/CMakeLists.txt @@ -45,7 +45,7 @@ function( atlas_build_trigger_menu menu ) ${CMAKE_CURRENT_BINARY_DIR}/${menu}.attempted.stamp COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Menus/${menu} - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/XMLDumperFromAthena.sh -r ${CMAKE_PROJECT_VERSION} ${menu} ${CMAKE_CURRENT_BINARY_DIR}/Menus/${menu} COMMAND ${CMAKE_COMMAND} -E make_directory @@ -78,7 +78,7 @@ function( atlas_build_trigger_menu menu ) COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Menus/${menu} ) execute_process( - COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh + COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/XMLDumperFromAthena.sh -r ${CMAKE_PROJECT_VERSION} ${menu} ${CMAKE_CURRENT_BINARY_DIR}/Menus/${menu} ) endif()" ) diff --git a/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py b/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py index 6b583dd14a059d6ec936adb17dce870c0ab0ce3b..9715bfc329caba135f541060df869e4dd345bf00 100644 --- a/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py +++ b/Trigger/TriggerCommon/TriggerMenuXML/share/runHLT_forXMLgeneration.py @@ -7,14 +7,11 @@ log = logging.getLogger('runHLT_forXMLgeneration.py') from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -# We don't need input files -athenaCommonFlags.FilesInput=[] +# Input file is only needed so that TileCal picks up the correct cabling according to the year +athenaCommonFlags.FilesInput=["/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data18_13TeV.00349335.physics_EnhancedBias.merge.RAW._lb0200._SFO-1._0001.1"] athenaCommonFlags.BSRDOInput=[] athenaCommonFlags.PoolRDOInput=[] athenaCommonFlags.isOnline = True -# Pretend to use bytestream to avoid the inputFilePeeker to run -from AthenaCommon.GlobalFlags import globalflags -globalflags.InputFormat='bytestream' # in Standalone mode, don't allow any configuration errors athenaCommonFlags.AllowIgnoreConfigError = False