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

Merge branch 'overlay/csc' into 'master'

CSC digitization MT memory handling improvements

See merge request !35383
parents 1f92c0c0 a380875d
......@@ -63,15 +63,6 @@ Double_t dualbipfunc(const Double_t *x, const Double_t *par){
return ( bipfunc(x,par) + bipfunc(x,&par[5]) );
}
StatusCode CscCalibTool::finalize() {
delete m_addedfunc;
delete m_bipolarFunc;
m_addedfunc = nullptr;
m_bipolarFunc = nullptr;
return StatusCode::SUCCESS;
}
StatusCode CscCalibTool::initialize() {
ATH_MSG_DEBUG ( "Initializing Initializing CscCalibTool");
......@@ -100,8 +91,12 @@ StatusCode CscCalibTool::initialize() {
m_messageCnt_t0phase=0;
std::lock_guard<std::mutex> lock(m_mutex);
m_addedfunc =new TF1("addedfunc", dualbipfunc, 0,500,10);
m_bipolarFunc =new TF1("bipolarFunc", bipfunc, -500,500,5);
if (m_addedfunc == nullptr) {
m_addedfunc = std::make_unique<TF1>("addedfunc", dualbipfunc, 0, 500, 10, 1, TF1::EAddToList::kNo);
}
if (m_bipolarFunc == nullptr) {
m_bipolarFunc = std::make_unique<TF1>("bipolarFunc", bipfunc, -500, 500, 5, 1, TF1::EAddToList::kNo);
}
return StatusCode::SUCCESS;
}
......
......@@ -27,6 +27,7 @@
#include <atomic>
#include <inttypes.h>
#include <memory>
#include <mutex>
#include <vector>
......@@ -39,7 +40,6 @@ public:
virtual ~CscCalibTool () = default;
virtual StatusCode initialize() override final;
virtual StatusCode finalize() override final;
/** given a charge on the CSC strip, convert that to ADC counts
this is needed in the digitization for example where it is the charges
......@@ -168,8 +168,8 @@ protected:
float m_latencyInDigitization; // new in 12/2010 for New Digitization package...
unsigned int m_nSamples;
mutable TF1* m_addedfunc ATLAS_THREAD_SAFE; // Guarded by m_mutex
mutable TF1* m_bipolarFunc ATLAS_THREAD_SAFE; // Guarded by m_mutex
mutable std::unique_ptr<TF1> m_addedfunc ATLAS_THREAD_SAFE = nullptr; // Guarded by m_mutex
mutable std::unique_ptr<TF1> m_bipolarFunc ATLAS_THREAD_SAFE = nullptr; // Guarded by m_mutex
mutable std::mutex m_mutex;
bool m_onlineHLT;
......
......@@ -5,6 +5,8 @@
#ifndef MUONDIGITIZATION_CSCDIGITIZATIONTOOL_H
#define MUONDIGITIZATION_CSCDIGITIZATIONTOOL_H
#include <memory>
#include "PileUpTools/PileUpToolBase.h"
#include "GaudiKernel/ServiceHandle.h"
......@@ -22,6 +24,8 @@
#include "MuonSimData/CscSimDataCollection.h"
#include "PileUpTools/PileUpMergeSvc.h"
#include "CSC_Digitizer.h"
// Author: Ketevi A. Assamagan
// BNL, October 27, 2003
......@@ -43,7 +47,7 @@ public:
CscDigitizationTool(const std::string& type, const std::string& name, const IInterface* pIID);
~CscDigitizationTool();
~CscDigitizationTool() = default;
virtual StatusCode initialize() override final;
......@@ -89,7 +93,7 @@ private:
SG::WriteHandleKey<CscDigitContainer> m_cscDigitContainerKey{this,"OutputObjectName","CSC_DIGITS","CSC digit container object"};
const MuonGM::MuonDetectorManager* m_geoMgr{nullptr};
CSC_Digitizer* m_cscDigitizer{nullptr};
std::unique_ptr<CSC_Digitizer> m_cscDigitizer{nullptr};
ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
......
......@@ -19,10 +19,6 @@ CscDigitizationTool::CscDigitizationTool(const std::string& type,const std::stri
PileUpToolBase(type, name, pIID) {
}
CscDigitizationTool::~CscDigitizationTool() {
delete m_cscDigitizer;
}
StatusCode CscDigitizationTool::initialize() {
ATH_MSG_DEBUG ( "Initialized Properties :" );
......@@ -57,11 +53,8 @@ StatusCode CscDigitizationTool::initialize() {
/** CSC calibratin tool for the Condtiions Data base access */
ATH_CHECK(m_pcalib.retrieve());
ICscCalibTool* cscCalibTool = &*(m_pcalib);
//initialize the CSC digitizer
CscHitIdHelper * cscHitHelper = CscHitIdHelper::GetHelper();
m_cscDigitizer = new CSC_Digitizer(cscHitHelper, m_geoMgr, cscCalibTool);
m_cscDigitizer = std::make_unique<CSC_Digitizer>(CscHitIdHelper::GetHelper(), m_geoMgr, &*(m_pcalib));
m_cscDigitizer->setAmplification(m_amplification);
m_cscDigitizer->setDebug ( msgLvl(MSG::DEBUG) );
m_cscDigitizer->setDriftVelocity(m_driftVelocity);
......@@ -69,13 +62,11 @@ StatusCode CscDigitizationTool::initialize() {
if (m_NInterFixed) {
m_cscDigitizer->setNInterFixed();
}
m_cscDigitizer->setWindow(m_timeWindowLowerOffset, m_timeWindowUpperOffset);
ATH_CHECK(m_cscDigitizer->initialize());
ATH_CHECK(m_idHelperSvc.retrieve());
m_cscDigitizer->setWindow(m_timeWindowLowerOffset, m_timeWindowUpperOffset);
// check the input object name
if (m_hitsContainerKey.key().empty()) {
ATH_MSG_FATAL("Property InputObjectName not set !");
......
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