diff --git a/InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/HTcalculator.h b/InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/HTcalculator.h index 0df1195eca650314db7048475fc9b3ca605eee9c..f04fb8a807f69b010496ce245ba7c6b84fa7bcd6 100644 --- a/InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/HTcalculator.h +++ b/InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/HTcalculator.h @@ -28,11 +28,11 @@ class HTcalculator { public: - HTcalculator(); - virtual ~HTcalculator(); + HTcalculator()=default; + virtual ~HTcalculator()=default; void checkInitialization(); - float Limit( float prob); + float Limit( float prob) const; // set constants to hard coded defaults void setDefaultCalibrationConstants(); @@ -46,7 +46,6 @@ class HTcalculator { private: - bool m_HasBeenInitialized; static const int N_GAS = 3; static const int N_DET = 3; @@ -73,7 +72,6 @@ class HTcalculator { static const int SIZE_OF_HEADER = sizeof(float) * 4; static const int SIZE_OF_BLOB = sizeof(float) *( (N_PAR2*N_DET)); - bool m_datainplace; }; diff --git a/InnerDetector/InDetConditions/TRT_ConditionsData/src/HTcalculator.cxx b/InnerDetector/InDetConditions/TRT_ConditionsData/src/HTcalculator.cxx index 2c17caf63842de094d628c775d38bd27a4a706df..0dcafd48b9249602882673e3dc6e0f04d0c84c22 100644 --- a/InnerDetector/InDetConditions/TRT_ConditionsData/src/HTcalculator.cxx +++ b/InnerDetector/InDetConditions/TRT_ConditionsData/src/HTcalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TRT_ConditionsData/HTcalculator.h" #include "AthenaKernel/getMessageSvc.h" @@ -7,34 +7,11 @@ #include <iostream> -/*****************************************************************************\ -|*%%% Default Constructor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| -\*****************************************************************************/ - -HTcalculator::HTcalculator() -{ - m_datainplace = false; - m_HasBeenInitialized=0; -} - -/*****************************************************************************\ -|*%%% Default Destructor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| -\*****************************************************************************/ - -HTcalculator::~HTcalculator(){ - //Nothing here yet -} - void HTcalculator::checkInitialization(){ - if( not m_HasBeenInitialized ) { - MsgStream log(Athena::getMessageSvc(),"HTcalculator"); - log << MSG::WARNING << "The HTcalculator is about to be used uninitialized - Loading default" << endmsg; - setDefaultCalibrationConstants(); - m_HasBeenInitialized=1; - } +//No op } -float HTcalculator::Limit(float prob){ +float HTcalculator::Limit(float prob) const{ if( prob > 1.0 ){ return 1.0; } @@ -55,7 +32,6 @@ float HTcalculator::getProbHT( int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy, bool hasTrackPars = true ) const { - //FIXME: This setup the Troels constants. THIS OVERRIDES CURRENT DB!!! // setDefaultCalibrationConstants(); @@ -158,10 +134,12 @@ float HTcalculator::pHTvsPGOG(int TrtPart, int GasType, float p, float mass, flo StatusCode HTcalculator::ReadVectorDB( const CondAttrListVec* channel_values){ - MsgStream log(Athena::getMessageSvc(),"HTcalculator"); if ( channel_values->size() < 1){ - log << MSG::ERROR << " There are no Pid channels available!!" << endmsg; - return StatusCode::FAILURE; + MsgStream log(Athena::getMessageSvc(),"HTcalculator"); + log << MSG::WARNING << " There are no Pid channels available!!" << endmsg; + log << MSG::WARNING << "The HTcalculator is about to be used uninitialized - Loading default" << endmsg; + setDefaultCalibrationConstants(); + return StatusCode::SUCCESS; } CondAttrListVec::const_iterator first_channel = channel_values->begin(); @@ -519,7 +497,6 @@ StatusCode HTcalculator::ReadVectorDB( const CondAttrListVec* channel_values){ } } - m_HasBeenInitialized=1; return StatusCode::SUCCESS; } @@ -541,12 +518,9 @@ void HTcalculator::setDefaultCalibrationConstants(){ the addresses of the various arrays inside the HTBlob, and NEVER otherwise! \*****************************************************************************/ - //FIXME - if (m_datainplace) return; // Just to load 1 time MsgStream log(Athena::getMessageSvc(),"HTcalculator"); log << MSG::WARNING << " HT PID DB is NOT available. Set hard-coded PID calibration constants. Derived from Run1 Data Zee and Zmumu 50 ns." << endmsg; - m_HasBeenInitialized=1; // Expanding to a 2D fit (gamma,occupancy) for three types of gases: Xenon, Argon, Krypton: // ---------------------------------------------------------------------------------------- @@ -651,6 +625,5 @@ void HTcalculator::setDefaultCalibrationConstants(){ } - m_datainplace = true; } diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..52eae7bcd56706d5e7b4f519e229b6873787a5ab --- /dev/null +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +InnerDetector/InDetRecTools/TRT_ElectronPidTools diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/BaseTRTPIDCalculator.h b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/BaseTRTPIDCalculator.h index 498b87bf5a14e388e7b7031f28f351fcd0cc697a..4caa3fd4f9d23b72085e49d85f8862cd36cf11d0 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/BaseTRTPIDCalculator.h +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/BaseTRTPIDCalculator.h @@ -66,23 +66,15 @@ namespace InDet // set constants to hard coded defaults virtual void setDefaultCalibrationConstants()=0; - MsgStream& msg (MSG::Level lvl) const { return m_msg << lvl; } - bool msgLvl (MSG::Level lvl) { return m_msg.get().level() <= lvl; } - public: void checkInitialization(); // Fill the data blob from a given pointer bool FillBlob(const unsigned char*); - - //print the blob of data to the screen very verbosely. - void PrintBlob(); // Limit the allowed PID value to lie between a lower and an upper limt float Limit(float prob); - private: - mutable Athena::MsgStreamMember m_msg; }; } diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/BaseTRTPIDCalculator.cxx b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/BaseTRTPIDCalculator.cxx index 34d0e0def5ead33804e930d71c3730b2bebee980..83852efd06bacb738a0766dd407674f48f2a2dc5 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/BaseTRTPIDCalculator.cxx +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/BaseTRTPIDCalculator.cxx @@ -19,12 +19,6 @@ // Math functions: #include <cmath> -//STL includes -#include <sstream> - - - - /**************************************************************************** \ |*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| |*%%% BaseTRTPIDCalculator class %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| @@ -32,35 +26,19 @@ |*%%% is implemented here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| |*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| \*****************************************************************************/ - -void InDet::BaseTRTPIDCalculator::PrintBlob(){ - //Print out the array values that should be entered into the database - ATH_MSG_DEBUG("Now printing the contents of the "<<my_name<<" Calibration Blob, "<<BLOB_SIZE<<" chars"); - ATH_MSG_DEBUG("[ "); - for(int i=0; i < BLOB_SIZE; i++) - ATH_MSG_DEBUG(int(Blob[i])<<", "); - ATH_MSG_DEBUG(" ]"); -} - bool InDet::BaseTRTPIDCalculator::FillBlob(const unsigned char* source){ //Copy the Coral Blob into a local array for(int i=0; i < BLOB_SIZE; i++){ Blob[i]=source[i]; } HasBeenInitialized=1; - return 1; } void InDet::BaseTRTPIDCalculator::checkInitialization(){ if( not HasBeenInitialized ) { - ATH_MSG_DEBUG("The "<<my_name<<"calculator is about to be used uninitialized"); - ATH_MSG_DEBUG("Loading default calibration into memory."); setDefaultCalibrationConstants(); HasBeenInitialized=1; - if (parent.msgLvl(MSG::DEBUG)) { - PrintBlob(); - } } } diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx index e859139b26b57be2f25799ef3469145de2ffe632..6a48d80715c1517e6b3a5d673ef977166be99282 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx @@ -146,11 +146,11 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con // Get the probability calculator SG::ReadCondHandle<HTcalculator> readHandle{m_HTReadKey}; - HTcalculator* HTcalc = const_cast<HTcalculator*>(*readHandle); + const HTcalculator* HTcalc = (*readHandle); // make sure some calibration is available - if(HTcalc==nullptr) ATH_MSG_WARNING (" No Pid calibration from the DB."); - HTcalc->checkInitialization(); - + if(HTcalc==nullptr) { + ATH_MSG_WARNING (" No Pid calibration from the DB."); + } //Initialize the return vector std::vector<float> PIDvalues(5);