Commit b0f92485 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'LArPhysWaveToolsPrivate' into 'master'

LAr Calib: Make tools private, use unique_ptr

See merge request atlas/athena!46749
parents 186c44ca d3dc6080
......@@ -23,7 +23,7 @@
#include "LArRawConditions/LArOFCComplete.h"
#include "LArRawConditions/LArOFCBinComplete.h"
#include "LArRawConditions/LArShapeComplete.h"
#include "LArCOOLConditions/LArDSPConfig.h"
#include "LArCabling/LArOnOffIdMapping.h"
#include "StoreGate/ReadCondHandleKey.h"
......@@ -32,10 +32,11 @@
#include <Eigen/Dense>
#include "tbb/blocked_range.h"
#include <memory>
class LArOnlineID_Base;
class CaloDetDescrManager_Base;
class LArDSPConfig;
class LArOFCAlg:public AthAlgorithm {
......@@ -122,8 +123,8 @@ private:
unsigned int m_nPoints;
float m_addOffset;
ToolHandle<ILArAutoCorrDecoderTool> m_AutoCorrDecoder;
ToolHandle<ILArAutoCorrDecoderTool> m_AutoCorrDecoderV2;
ToolHandle<ILArAutoCorrDecoderTool> m_AutoCorrDecoder{this,"DecoderTool",{} };
ToolHandle<ILArAutoCorrDecoderTool> m_AutoCorrDecoderV2{this,"DecoderToolV2", {} };
const CaloDetDescrManager_Base* m_calo_dd_man;
const LArOnlineID_Base* m_onlineID;
......@@ -151,7 +152,7 @@ private:
bool m_readDSPConfig;
std::string m_DSPConfigFolder;
LArDSPConfig* m_DSPConfig;
std::unique_ptr<LArDSPConfig> m_DSPConfig;
bool m_forceShift;
......
......@@ -24,9 +24,11 @@
#include <atomic>
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "LArCabling/LArOnOffIdMapping.h"
#include "tbb/blocked_range.h"
#include "LArRawConditions/LArWFParams.h"
#include "LArCalibUtils/LArWFParamTool.h"
#include "LArRawConditions/LArCaliWave.h"
#include <memory>
......@@ -49,7 +51,7 @@ class LArRTMParamExtractor : public AthAlgorithm
private:
SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"};
ToolHandle<LArWFParamTool> m_larWFParamTool{this,"LArWFParamTool","LArWFParamTool"};
std::vector<std::string> m_keylist;
bool m_isSC;
bool m_testmode, m_dumpOmegaScan, m_dumpResOscill;
......
......@@ -13,7 +13,6 @@
#include "LArRawConditions/LArOFCComplete.h"
#include "LArRawConditions/LArOFCBinComplete.h"
#include "LArRawConditions/LArPhysCaliTdiffComplete.h"
#include "LArCOOLConditions/LArDSPConfig.h"
#include "CoralBase/Blob.h"
#include "AthenaPoolUtilities/AthenaAttributeList.h"
......@@ -36,8 +35,7 @@ LArOFCAlg::LArOFCAlg(const std::string& name, ISvcLocator* pSvcLocator)
m_calo_dd_man(nullptr),
m_onlineID(nullptr),
m_larPhysWaveBin(nullptr),
m_groupingType("SubDetector"), // SubDetector, Single, FeedThrough
m_DSPConfig(nullptr)
m_groupingType("SubDetector") // SubDetector, Single, FeedThrough
{
declareProperty("Nsample",m_nSamples = 5);
......@@ -76,9 +74,6 @@ LArOFCAlg::LArOFCAlg(const std::string& name, ISvcLocator* pSvcLocator)
declareProperty("UseDelta", m_useDelta=0); // 0= not use Delta, 1=only EMECIW/HEC/FCAL, 2=all , 3 = only EMECIW/HEC/FCAL1+high eta FCAL2-3
declareProperty("UseDeltaV2", m_useDeltaV2=0); // 0= not use Delta, 1=only EMECIW/HEC/FCAL, 2=all , 3 = only EMECIW/HEC/FCAL1+high eta FCAL2-3
declareProperty("DecoderTool", m_AutoCorrDecoder);
declareProperty("DecoderToolV2", m_AutoCorrDecoderV2);
declareProperty("RunThreaded", m_runThreaded=false);
declareProperty("ReadDSPConfig", m_readDSPConfig=false);
......@@ -253,7 +248,7 @@ StatusCode LArOFCAlg::stop()
if (blob.size()<3) {
ATH_MSG_INFO( "Found empty blob, nothing to do");
} else {
m_DSPConfig = new LArDSPConfig(attrList);
m_DSPConfig = std::make_unique<LArDSPConfig>(attrList);
}
}
......@@ -302,7 +297,7 @@ StatusCode LArOFCAlg::stop()
/////////////
// OFC persistent object
LArOFCComplete *larOFCComplete=new LArOFCComplete();
std::unique_ptr<LArOFCComplete> larOFCComplete=std::make_unique<LArOFCComplete>();
sc = larOFCComplete->setGroupingType(m_groupingType,msg());
if (sc.isFailure()) {
ATH_MSG_ERROR( "Failed to set groupingType for LArOFCComplete object" );
......@@ -315,7 +310,7 @@ StatusCode LArOFCAlg::stop()
}
LArOFCComplete *larOFCCompleteV2=new LArOFCComplete();
std::unique_ptr<LArOFCComplete> larOFCCompleteV2=std::make_unique<LArOFCComplete>();
sc = larOFCComplete->setGroupingType(m_groupingType,msg());
if (sc.isFailure()) {
ATH_MSG_ERROR( "Failed to set groupingType for LArOFCComplete object" );
......@@ -328,9 +323,9 @@ StatusCode LArOFCAlg::stop()
}
LArOFCBinComplete *larOFCBinComplete=NULL;
std::unique_ptr<LArOFCBinComplete> larOFCBinComplete;
if (m_storeMaxPhase) {
larOFCBinComplete=new LArOFCBinComplete();
larOFCBinComplete=std::make_unique<LArOFCBinComplete>();
sc=larOFCBinComplete->setGroupingType(m_groupingType,msg());
if (sc.isFailure()) {
ATH_MSG_ERROR( "Failed to set groupingType for LArOFCBinComplete object" );
......@@ -344,9 +339,9 @@ StatusCode LArOFCAlg::stop()
}
// LArShape persistent object
LArShapeComplete *larShapeComplete=NULL;
std::unique_ptr<LArShapeComplete> larShapeComplete;
if (m_fillShape) {
larShapeComplete = new LArShapeComplete();
larShapeComplete = std::make_unique<LArShapeComplete>();
sc=larShapeComplete->setGroupingType(m_groupingType,msg());
if (sc.isFailure()) {
ATH_MSG_ERROR( "Failed to set groupingType for LArShapeComplete object" );
......@@ -393,14 +388,15 @@ StatusCode LArOFCAlg::stop()
ATH_MSG_ERROR( "Number of channels * gains with failed OFC verification: " << nFailed );
// record and symlink LArOFCComplete object
sc = detStore()->record(larOFCComplete,m_ofcKey);
LArOFCComplete* larOFCCompletePtr=larOFCComplete.get();
sc = detStore()->record(std::move(larOFCComplete),m_ofcKey);
if (sc.isFailure()) {
ATH_MSG_ERROR( "Could not record LArOFCComplete to DetStore with key " << m_ofcKey );
return StatusCode::FAILURE;
}
ATH_MSG_INFO( "LArOFCComplete object recorded with key " << m_ofcKey ) ;
sc = detStore()->symLink(larOFCComplete,(ILArOFC*)larOFCComplete);
sc = detStore()->symLink(larOFCCompletePtr,(ILArOFC*)larOFCCompletePtr);
if (sc.isFailure()) {
ATH_MSG_ERROR( "Could not symlink ILArOFC with LArOFCComplete." );
return StatusCode::FAILURE;
......@@ -410,14 +406,15 @@ StatusCode LArOFCAlg::stop()
// record and symlink second version of LArOFCComplete object
if (m_computeV2) {
sc = detStore()->record(larOFCCompleteV2,m_ofcKeyV2);
LArOFCComplete* larOFCCompletePtrV2=larOFCCompleteV2.get();
sc = detStore()->record(std::move(larOFCCompleteV2),m_ofcKeyV2);
if (sc.isFailure()) {
ATH_MSG_ERROR( "Could not record LArOFCComplete to DetStore with key " << m_ofcKeyV2 );
return StatusCode::FAILURE;
}
ATH_MSG_INFO( "LArOFCComplete object recorded with key " << m_ofcKeyV2 ) ;
sc = detStore()->symLink(larOFCCompleteV2,(ILArOFC*)larOFCCompleteV2);
sc = detStore()->symLink(larOFCCompletePtrV2,(ILArOFC*)larOFCCompletePtrV2);
if (sc.isFailure()) {
ATH_MSG_ERROR( "Could not symlink ILArOFC with LArOFCComplete." );
return StatusCode::FAILURE;
......@@ -431,7 +428,7 @@ StatusCode LArOFCAlg::stop()
}
if (larOFCBinComplete) {
sc = detStore()->record(larOFCBinComplete,m_ofcBinKey);
sc = detStore()->record(std::move(larOFCBinComplete),m_ofcBinKey);
if (sc.isFailure()) {
ATH_MSG_ERROR( "Could not record LArOFCBinCompete object" );
return StatusCode::FAILURE;
......@@ -441,15 +438,15 @@ StatusCode LArOFCAlg::stop()
// record and symlink LArShapeComplete object
if ( m_fillShape ) {
ATH_MSG_DEBUG( "Trying to record LArShapeComplete object to detector store, key = " << m_shapeKey);
sc = detStore()->record(larShapeComplete,m_shapeKey);
sc = detStore()->record(std::move(larShapeComplete),m_shapeKey);
if (sc.isFailure()) {
ATH_MSG_ERROR( "Could not record LArShapeComplete to DetStore with key " << m_shapeKey );
return StatusCode::FAILURE;
}
ATH_MSG_INFO( "LArShapeComplete object recorded to DetStore successfully with key " << m_shapeKey ) ;
ATH_MSG_DEBUG( "Trying to symlink ILArShape with LArShapeComplete");
ILArShape* larShape = 0;
sc = detStore()->symLink(larShapeComplete,larShape);
LArShapeComplete* shapePtr=larShapeComplete.get();
sc = detStore()->symLink(shapePtr,(ILArShape*)shapePtr);
if (sc.isFailure()) {
ATH_MSG_ERROR( "Could not symlink ILArShape with LArShapeComplete." );
return StatusCode::FAILURE;
......
......@@ -153,6 +153,9 @@ StatusCode LArRTMParamExtractor::initialize() {
ATH_CHECK( m_cablingKey.initialize() );
// Retrieve LArWFParamTool
ATH_CHECK(m_larWFParamTool.retrieve());
return StatusCode::SUCCESS ;
}
......@@ -192,13 +195,7 @@ StatusCode LArRTMParamExtractor::stop()
}
}
// Retrieve LArWFParamTool
ToolHandle<LArWFParamTool> larWFParamTool("LArWFParamTool");
sc=larWFParamTool.retrieve();
if (sc!=StatusCode::SUCCESS) {
ATH_MSG_ERROR( " Can't get LArWFParamTool" );
return sc;
}
SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey};
const LArOnOffIdMapping* cabling{*cablingHdl};
......@@ -557,7 +554,7 @@ StatusCode LArRTMParamExtractor::stop()
if (!m_useTBB) { //traditional, serial processing:
Looper looper(&inputParams,cabling,larWFParamTool.operator->(),msg(),m_counter);
Looper looper(&inputParams,cabling,m_larWFParamTool.operator->(),msg(),m_counter);
tbb::blocked_range<size_t> r(0,inputParams.size());
looper(r);
}
......@@ -565,7 +562,7 @@ StatusCode LArRTMParamExtractor::stop()
ATH_MSG_INFO("Now calling TBB parallel_for");
// NOW CALL TBB PARALLEL FOR
tbb::parallel_for(tbb::blocked_range<size_t>(0, inputParams.size()),Looper(&inputParams,cabling,
larWFParamTool.operator->(),
m_larWFParamTool.operator->(),
msg(),m_counter));
ATH_MSG_INFO("Done with parallel_for");
......
......@@ -66,8 +66,6 @@ def LArDelay_OFCCaliCfg(flags):
result.addPublicTool(CompFactory.LArAutoCorrDecoderTool(isSC=flags.LArCalib.isSC))
LArCaliOFCAlg = CompFactory.LArOFCAlg("LArCaliOFCAlg")
LArCaliOFCAlg.ReadCaliWave = True
LArCaliOFCAlg.KeyList = [ "LArCaliWave" ]
......@@ -83,7 +81,7 @@ def LArDelay_OFCCaliCfg(flags):
#LArCaliOFCAlg.DumpOFCfile = "LArOFCCali.dat"
LArCaliOFCAlg.GroupingType = flags.LArCalib.GroupingType
LArCaliOFCAlg.isSC = flags.LArCalib.isSC
LArCaliOFCAlg.DecoderTool='LArAutoCorrDecoderTool/LArAutoCorrDecoderTool'
LArCaliOFCAlg.DecoderTool=CompFactory.LArAutoCorrDecoderTool(isSC=flags.LArCalib.isSC)
result.addEventAlgo(LArCaliOFCAlg)
......
......@@ -60,7 +60,7 @@ def LArRTMParamsCfg(flags):
theLArWFParamTool.NpointScan = [ 800 , 900 , 310 , 120 ]
theLArWFParamTool.StoreResOscill = [True * 4] if flags.LArCalib.RTM.DumpResOscill else [False *4]
result.addPublicTool(theLArWFParamTool)
LArRTMParamExtractor.LArWFParamTool=theLArWFParamTool
result.addEventAlgo(LArRTMParamExtractor)
......
......@@ -848,7 +848,6 @@ if doOFC:
from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
theLArAutoCorrDecoderTool.isSC = SuperCells
ToolSvc += theLArAutoCorrDecoderTool
from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
LArCaliOFCAlg = LArOFCAlg("LArCaliOFCAlg")
......
......@@ -360,8 +360,8 @@ if ( ReadPhysCaliTdiffFromCOOL ):
if 'InputPhysCaliTdiffSQLiteFile' in dir():
InputDBConnectionPhysCaliTdiff = DBConnectionFile(InputPhysCaliTdiffSQLiteFile)
else:
InputDBConnectionPhysCaliTdiff = DBConnectionCOOL
InputDBConnectionPhysCaliTdiff = "COOLOFL_LAR/COMP200"
xxx
## Bad Channel
if not 'ReadBadChannelFromCOOL' in dir():
......@@ -620,6 +620,12 @@ else:
# OFC computation
###########################################################################
from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
theLArAutoCorrDecoderTool.UseAlwaysHighGain=True
if NColl > 0:
theLArAutoCorrDecoderTool.DecodeMode=1
from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
LArPhysOFCAlg = LArOFCAlg("LArPhysOFCAlg")
......@@ -643,7 +649,7 @@ LArPhysOFCAlg.LArPhysWaveBinKey = ShiftKey
LArPhysOFCAlg.UseDelta = UseDelta
LArPhysOFCAlg.KeyOFC = OFCKey
LArPhysOFCAlg.KeyShape = ShapeKey
LArPhysOFCAlg.DecoderTool = theLArAutoCorrDecoderTool
topSequence+=LArPhysOFCAlg
......@@ -668,15 +674,10 @@ LArPhysOFCAlg2.UseDelta = UseDelta
LArPhysOFCAlg2.KeyOFC = OFCKey2
LArPhysOFCAlg2.KeyShape = ShapeKey2
LArPhysOFCAlg2.DecoderTool = theLArAutoCorrDecoderTool
topSequence+=LArPhysOFCAlg2
from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
theLArAutoCorrDecoderTool.UseAlwaysHighGain=True
if NColl > 0:
theLArAutoCorrDecoderTool.DecodeMode=1
ToolSvc += theLArAutoCorrDecoderTool
###########################################################################
......
......@@ -390,7 +390,7 @@ if ( ReadPhysCaliTdiffFromCOOL ):
if 'InputPhysCaliTdiffSQLiteFile' in dir():
InputDBConnectionPhysCaliTdiff = DBConnectionFile(InputPhysCaliTdiffSQLiteFile)
else:
InputDBConnectionPhysCaliTdiff = "COOLOFL_LAR/CONDBR2"
InputDBConnectionPhysCaliTdiff = "COOLOFL_LAR/COMP200"
## Bad Channel
......@@ -636,7 +636,6 @@ from LArCalibUtils.LArCalibUtilsConf import LArAutoCorrDecoderTool
theLArAutoCorrDecoderTool = LArAutoCorrDecoderTool()
theLArAutoCorrDecoderTool.UseAlwaysHighGain=True
theLArAutoCorrDecoderTool.isSC = SuperCells
ToolSvc += theLArAutoCorrDecoderTool
if NColl > 0:
theLArPhysAutoCorrDecoderTool = LArAutoCorrDecoderTool("LArPhysAutoCorrDecoderTool")
......@@ -644,7 +643,6 @@ if NColl > 0:
theLArPhysAutoCorrDecoderTool.UseAlwaysHighGain=True
theLArPhysAutoCorrDecoderTool.isSC = SuperCells
theLArPhysAutoCorrDecoderTool.KeyAutoCorr="LArPhysAutoCorr"
ToolSvc += theLArPhysAutoCorrDecoderTool
from LArCalibUtils.LArCalibUtilsConf import LArOFCAlg
......
......@@ -440,7 +440,7 @@ condSeq = AthSequencer("AthCondSeq")
## get a handle to the ApplicationManager, to the ServiceManager and to the ToolSvc
from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr,ToolSvc)
from AthenaCommon.AppMgr import (theApp, ServiceMgr as svcMgr)
include("LArCalibProcessing/LArCalib_MinimalSetup.py")
if SuperCells:
......@@ -672,9 +672,8 @@ if 'NpointScan' in dir():
if 'StoreResOscill' in dir():
theLArWFParamTool.StoreResOscill = StoreResOscill
ToolSvc += theLArWFParamTool
LArRTMParamExtractor.LArWFParamTool=theLArWFParamTool
topSequence += LArRTMParamExtractor
###########################################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment