From c5d8c2fac0980d0a5fac8fa30f8932db71ac6067 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Wed, 16 Oct 2019 16:15:05 +0200 Subject: [PATCH] PixelCalibAlgs: Fix cppcheck warnings. Fix cppcheck warnings. --- .../Application/createDeadModuleList.C | 10 +- .../Application/hackNoiseMapsForStudyCP.C | 6 +- .../Application/makeInactiveModuleList.C | 12 +- .../Application/updateDeadMaps.C | 6 +- .../Application/updateNoiseMaps.C | 6 +- .../PixelCalibAlgs/Macro/PlotCs.C | 5 +- .../PixelCalibAlgs/Macro/PlotFits.C | 5 +- .../PixelCalibAlgs/Macro/PlotOmega.C | 5 +- .../NNClusteringCalibration_RunI/TJetNet.cxx | 585 +++++++++--------- .../NNClusteringCalibration_RunI/TJetNet.h | 68 +- .../TTrainedNetwork.cxx | 99 ++- .../TTrainedNetwork.h | 48 +- .../number/readOutput.h | 6 +- .../validation/RIOs.h | 6 +- .../validation/writeNtuple.C | 4 +- .../validation/writeNtuple.h | 12 +- .../DepletionDepthCalibration.h | 8 +- .../PixelCalibAlgs/LorentzAngleCalibration.h | 8 +- .../PixelCalibAlgs/OfflineCalibrationLoop.h | 14 +- .../PixelChargeInterpolationHistograms.h | 4 +- .../PixelChargeInterpolationPlot.h | 18 +- .../PixelChargeInterpolationValidation.h | 6 +- .../PixelClusterOnTrackErrorPlot.h | 18 +- .../PixelCalibAlgs/PixelConvert.h | 22 +- .../PixelCalibAlgs/PixelNtupleTracks.h | 6 +- .../PixelCalibAlgs/PixelCalibAlgs/PixelRIOs.h | 14 +- .../PixelCalibAlgs/PixelResidualHistograms.h | 16 +- .../HamburgModel/data_processing.cpp | 8 +- .../src/DepletionDepthCalibration.cxx | 6 +- .../src/LorentzAngleCalibration.cxx | 6 +- .../src/OfflineCalibrationLoop.cxx | 15 +- .../PixelChargeInterpolationHistograms.cxx | 4 +- .../src/PixelChargeInterpolationPlot.cxx | 17 +- .../PixelChargeInterpolationValidation.cxx | 6 +- .../src/PixelClusterOnTrackErrorPlot.cxx | 17 +- .../PixelCalibAlgs/src/PixelConvert.cxx | 18 +- .../PixelCalibAlgs/src/PixelRIOs.cxx | 20 +- .../src/PixelResidualHistograms.cxx | 16 +- 38 files changed, 584 insertions(+), 566 deletions(-) diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/createDeadModuleList.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/createDeadModuleList.C index db50c21da20..58c04eea646 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/createDeadModuleList.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/createDeadModuleList.C @@ -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 <vector> @@ -24,7 +24,7 @@ std::vector< std::pair< std::string, std::vector<int> > > pixelMapping; std::vector< std::pair< int, std::vector<int> > > hashMapping; std::string getDCSIDFromPosition (int barrel_ec, int layer, int module_phi, int module_eta); int getHashFromPosition (int barrel_ec, int layer, int module_phi, int module_eta); -std::vector<int> getPositionFromDCSID (std::string module_name); +std::vector<int> getPositionFromDCSID (const std::string& module_name); std::vector<std::string> &splitter(const std::string &s, char delim, std::vector<std::string> &elems) { std::stringstream ss(s); @@ -329,13 +329,13 @@ int main(int argc, char* argv[]){ pyFile << "badModulesList=[]" << std::endl; std::map<int, std::vector<std::string> >::const_iterator iter; - for(iter = deadModuleList.begin(); iter != deadModuleList.end(); iter++){ + for(iter = deadModuleList.begin(); iter != deadModuleList.end(); ++iter){ if( (iter->second).size() < 1) continue; int LB = iter->first; pyFile << "runLumiList.append([" << runNumber << ", " << LB << "])" << std::endl; pyFile << "badModulesList.append(["; std::vector<std::string>::const_iterator module_iter; - for(module_iter = (iter->second).begin(); module_iter != (iter->second).end(); module_iter++){ + for(module_iter = (iter->second).begin(); module_iter != (iter->second).end(); ++module_iter){ std::string moduleID = *module_iter; std::vector<int> position = getPositionFromDCSID(moduleID); int barrel = position[0]; @@ -549,7 +549,7 @@ int getHashFromPosition (int barrel_ec, int layer, int module_phi, int module_et return 0; } -std::vector<int> getPositionFromDCSID (std::string module_name){ +std::vector<int> getPositionFromDCSID (const std::string& module_name){ for(unsigned int ii = 0; ii < pixelMapping.size(); ii++) { if (pixelMapping[ii].first == module_name) return pixelMapping[ii].second; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/hackNoiseMapsForStudyCP.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/hackNoiseMapsForStudyCP.C index 0b21e69cae2..d62c85fbe89 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/hackNoiseMapsForStudyCP.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/hackNoiseMapsForStudyCP.C @@ -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<vector> @@ -26,7 +26,7 @@ std::vector< std::pair< std::string, std::vector<int> > > pixelMapping; std::string getDCSIDFromPosition (int barrel_ec, int layer, int module_phi, int module_eta); -std::vector<int> getPositionFromDCSID (std::string module_name); +std::vector<int> getPositionFromDCSID (const std::string& module_name); double ComputeMuChip(TH2D* modhisto, int chip) { @@ -999,7 +999,7 @@ std::string getDCSIDFromPosition (int barrel_ec, int layer, int module_phi, int return std::string("Error!"); } -std::vector<int> getPositionFromDCSID (std::string module_name){ +std::vector<int> getPositionFromDCSID (const std::string& module_name){ for(unsigned int ii = 0; ii < pixelMapping.size(); ii++) { if (pixelMapping[ii].first == module_name) return pixelMapping[ii].second; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/makeInactiveModuleList.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/makeInactiveModuleList.C index 44a6b879d2c..179bb46531b 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/makeInactiveModuleList.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/makeInactiveModuleList.C @@ -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<vector> @@ -347,7 +347,7 @@ int getHashFromPosition (int barrel_ec, int layer, int module_phi, int module_et return 0; } -std::vector<int> getPositionFromDCSID (std::string module_name){ +std::vector<int> getPositionFromDCSID (const std::string& module_name){ for(unsigned int ii = 0; ii < m_pixelMapping.size(); ii++) { if (m_pixelMapping[ii].first == module_name) return m_pixelMapping[ii].second; @@ -365,7 +365,7 @@ std::vector<int> getChannelFromHashID (int hashid){ return m_channelMapping[1].second; } -void make_pyfile(std::string srun, std::string stag_name, int npush_back, std::vector<std::string> vsmodule, std::vector<int> vLB_start, std::vector<int> vLB_end, bool flag_first){ +void make_pyfile(const std::string& srun, const std::string& stag_name, int npush_back, const std::vector<std::string>& vsmodule, const std::vector<int>& vLB_start, const std::vector<int>& vLB_end, bool flag_first){ std::string spyfilename = "./PixMapOverlay_run" + srun; spyfilename += ".py"; std::ofstream pyFile; @@ -455,9 +455,9 @@ void make_pyfile(std::string srun, std::string stag_name, int npush_back, std::v }else{ pyFile << " [" << srun << ", " << *it_LBstart << ", " << (*it_LBend + 1)<< ", " << channel << "]]" << std::endl; }//(i != (npush_back-1)) - it_smodule++; - it_LBstart++; - it_LBend++; + ++it_smodule; + ++it_LBstart; + ++it_LBend; }//for(int i=0; i<npush_back; i++) pyFile << "nIOVs = len(badModulesList)" << std::endl; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateDeadMaps.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateDeadMaps.C index c91ca07b729..b82461fb9ac 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateDeadMaps.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateDeadMaps.C @@ -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<vector> @@ -22,7 +22,7 @@ std::vector< std::pair< std::string, std::vector<int> > > pixelMapping; std::string getDCSIDFromPosition (int barrel_ec, int layer, int module_phi, int module_eta); -std::vector<int> getPositionFromDCSID (std::string module_name); +std::vector<int> getPositionFromDCSID (const std::string& module_name); std::vector<std::string> &splitter(const std::string &s, char delim, std::vector<std::string> &elems) { std::stringstream ss(s); @@ -808,7 +808,7 @@ std::string getDCSIDFromPosition (int barrel_ec, int layer, int module_phi, int return std::string("Error!"); } -std::vector<int> getPositionFromDCSID (std::string module_name){ +std::vector<int> getPositionFromDCSID (const std::string& module_name){ for(unsigned int ii = 0; ii < pixelMapping.size(); ii++) { if (pixelMapping[ii].first == module_name) return pixelMapping[ii].second; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateNoiseMaps.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateNoiseMaps.C index a85f8801e74..2ae8e6e2966 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateNoiseMaps.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Application/updateNoiseMaps.C @@ -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<vector> @@ -24,7 +24,7 @@ std::vector< std::pair< std::string, std::vector<int> > > pixelMapping; std::string getDCSIDFromPosition (int barrel_ec, int layer, int module_phi, int module_eta); -std::vector<int> getPositionFromDCSID (std::string module_name); +std::vector<int> getPositionFromDCSID (const std::string& module_name); std::vector<std::string> &splitter(const std::string &s, char delim, std::vector<std::string> &elems) { std::stringstream ss(s); @@ -892,7 +892,7 @@ std::string getDCSIDFromPosition (int barrel_ec, int layer, int module_phi, int return std::string("Error!"); } -std::vector<int> getPositionFromDCSID (std::string module_name){ +std::vector<int> getPositionFromDCSID (const std::string& module_name){ for(unsigned int ii = 0; ii < pixelMapping.size(); ii++) { if (pixelMapping[ii].first == module_name) return pixelMapping[ii].second; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotCs.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotCs.C index 74c0d2285f5..e32af0a91e4 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotCs.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotCs.C @@ -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 */ { @@ -75,7 +75,8 @@ TCanvas *c1 = new TCanvas(parameter.c_str(),"",5); c1->SetLeftMargin(0.14); int iglobal = 0; -for(int ifile = 0; ifile < filenames.size(); ifile++){ +size_t nfilenames = filenames.size(); +for(int ifile = 0; ifile < nfilenames; ++ifile){ for(int iCS = 0; iCS < maxcs; iCS++){ iglobal++; TFile *file = TFile::Open((filenames[ifile] + ".root").c_str()); diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotFits.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotFits.C index cf049b4353e..c44bd42a670 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotFits.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotFits.C @@ -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 */ { @@ -87,7 +87,8 @@ if(G4){ } -for(int ics = 0; ics < clustersizes.size(); ics++){ +size_t nclustersizes = clustersizes.size(); +for(int ics = 0; ics < nclustersizes; ics++){ for(int ibin = 0; ibin < bins.size(); ibin++){ iglobal++; TFile *file = TFile::Open((filenames[0] + ".root").c_str()); diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotOmega.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotOmega.C index cf8889a7940..4195810af46 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotOmega.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/Macro/PlotOmega.C @@ -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 */ { @@ -60,7 +60,8 @@ std::ostringstream histoname; TCanvas *c1 = new TCanvas(parameter.c_str(),"",5); c1->SetLeftMargin(0.14); -for(int ifile = 0; ifile < filenames.size(); ifile++){ +size_t nfilenames = filenames.size(); +for(int ifile = 0; ifile < nfilenames; ifile++){ TFile *file = TFile::Open((filenames[ifile] + ".root").c_str()); file->cd(); TDirectory *pippo = (TDirectory *)gDirectory->Get("ChargeInterpolation"); diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TJetNet.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TJetNet.cxx index a097c096a48..e97c90e1066 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TJetNet.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TJetNet.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 "TJetNet.h" @@ -19,30 +19,29 @@ ClassImp( TJetNet ) //Constructors //______________________________________________________________________________ TJetNet::TJetNet() + : m_LayerCount(0), + m_pLayers(0), + m_pInputTrainSet(nullptr), + m_pOutputTrainSet(nullptr), + m_pInputTestSet(nullptr), + m_pOutputTestSet(nullptr), + m_TrainSetCnt(0), + m_TestSetCnt(0), + m_Epochs(0), + m_CurrentEpoch(0), + m_IsInitialized(kFalse), + m_InitLocked(kFALSE), + m_NormalizeOutput(false) { - // Default Constructor - mTestSetCnt = 0; - mTrainSetCnt = 0; - mLayerCount = 0; - - mNormalizeOutput=false; - - mpLayers = 0; - - mIsInitialized = kFALSE; - mInitLocked = kFALSE; - - mpInputTrainSet = 0; - mpInputTestSet = 0; - mpOutputTrainSet = 0; - mpOutputTestSet = 0; - - mEpochs = 0; - mCurrentEpoch = 0; } //______________________________________________________________________________ TJetNet::TJetNet( Int_t aTestCount, Int_t aTrainCount, const Int_t aLayersCnt, const Int_t* aLayers ) +#ifdef _DEBUG + : m_Debug (kTRUE) +#else + : m_Debug (kFALSE) +#endif { // Creates neural network with aLayersCnt number of layers, // aTestCount number of patterns for the test set, @@ -50,59 +49,55 @@ TJetNet::TJetNet( Int_t aTestCount, Int_t aTrainCount, // aLayers contains the information for number of the units in the different layers int i; - mDebug = kFALSE; -#ifdef _DEBUG - mDebug = kTRUE; -#endif - if( mDebug ){ std::cout << "=====> Entering TJetNet::TJetNet(...)" << std::endl; } + if( m_Debug ){ std::cout << "=====> Entering TJetNet::TJetNet(...)" << std::endl; } - mTestSetCnt = aTestCount; - mTrainSetCnt = aTrainCount; - mLayerCount = aLayersCnt; // Get the number of layers + m_TestSetCnt = aTestCount; + m_TrainSetCnt = aTrainCount; + m_LayerCount = aLayersCnt; // Get the number of layers - if( mLayerCount > 0 ) + if( m_LayerCount > 0 ) { - //Perform deep copy of the array holding Layers count - mpLayers = new Int_t[ mLayerCount ]; - for( i = 0; i < mLayerCount; ++i ) + //Perform deep copy of the array holding Layers count + m_pLayers = new Int_t[ m_LayerCount ]; + for( i = 0; i < m_LayerCount; ++i ) { - mpLayers[ i ] = aLayers[ i ]; + m_pLayers[ i ] = aLayers[ i ]; } } - mInputDim = mpLayers[ 0 ]; - mOutputDim = mpLayers[ mLayerCount - 1 ]; - mHiddenLayerDim = mLayerCount-2; + m_InputDim = m_pLayers[ 0 ]; + m_OutputDim = m_pLayers[ m_LayerCount - 1 ]; + m_HiddenLayerDim = m_LayerCount-2; - mIsInitialized = kFALSE; - mInitLocked = kFALSE; + m_IsInitialized = kFALSE; + m_InitLocked = kFALSE; - mpInputTrainSet = new TNeuralDataSet( mTrainSetCnt, GetInputDim() ); - mpInputTestSet = new TNeuralDataSet( mTestSetCnt, GetInputDim() ); - mpOutputTrainSet = new TNeuralDataSet( mTrainSetCnt, GetOutputDim() ); - mpOutputTestSet = new TNeuralDataSet( mTestSetCnt, GetOutputDim() ); + m_pInputTrainSet = new TNeuralDataSet( m_TrainSetCnt, GetInputDim() ); + m_pInputTestSet = new TNeuralDataSet( m_TestSetCnt, GetInputDim() ); + m_pOutputTrainSet = new TNeuralDataSet( m_TrainSetCnt, GetOutputDim() ); + m_pOutputTestSet = new TNeuralDataSet( m_TestSetCnt, GetOutputDim() ); - mNormalizeOutput=false; + m_NormalizeOutput=false; - menActFunction=afSigmoid; + m_enActFunction=afSigmoid; SetEpochs( -1 ); - if( mDebug ){ std::cout << "=====> Leaving TJetNet::TJetNet(...)" << std::endl; } + if( m_Debug ){ std::cout << "=====> Leaving TJetNet::TJetNet(...)" << std::endl; } } //______________________________________________________________________________ TJetNet::~TJetNet( void ) { // Default destructor - if( mDebug ){ std::cout << "=====> Entering TJetNet::~TJetNet(...)" << std::endl; } - delete [] mpLayers; - delete mpInputTestSet; - delete mpInputTrainSet; - delete mpOutputTestSet; - delete mpOutputTrainSet; - if( mDebug ){ std::cout << "=====> Leaving TJetNet::~TJetNet(...)" << std::endl; } + if( m_Debug ){ std::cout << "=====> Entering TJetNet::~TJetNet(...)" << std::endl; } + delete [] m_pLayers; + delete m_pInputTestSet; + delete m_pInputTrainSet; + delete m_pOutputTestSet; + delete m_pOutputTrainSet; + if( m_Debug ){ std::cout << "=====> Leaving TJetNet::~TJetNet(...)" << std::endl; } } //______________________________________________________________________________ //by Giacinto Piacquadio (18-02-2008) @@ -125,24 +120,24 @@ TTrainedNetwork* TJetNet::createTrainedNetwork() const for (Int_t o=0;o<nHidden+1;++o) { - int sizeActualLayer=(o<nHidden)?nHiddenLayerSize[o]:nOutput; - int sizePreviousLayer=(o==0)?nInput:nHiddenLayerSize[o-1]; - thresholdVectors.push_back(new TVectorD(sizeActualLayer)); - weightMatrices.push_back(new TMatrixD(sizePreviousLayer,sizeActualLayer)); + int sizeActualLayer=(o<nHidden)?nHiddenLayerSize[o]:nOutput; + int sizePreviousLayer=(o==0)?nInput:nHiddenLayerSize[o-1]; + thresholdVectors.push_back(new TVectorD(sizeActualLayer)); + weightMatrices.push_back(new TMatrixD(sizePreviousLayer,sizeActualLayer)); } for (Int_t o=0;o<nHidden+1;++o) { - if (mDebug) - if (o<nHidden) - { - cout << " Iterating on hidden layer n.: " << o << endl; - } - else - { - cout << " Considering output layer " << endl; - } + if (m_Debug) + if (o<nHidden) + { + cout << " Iterating on hidden layer n.: " << o << endl; + } + else + { + cout << " Considering output layer " << endl; + } int sizeActualLayer=(o<nHidden)?nHiddenLayerSize[o]:nOutput; @@ -150,21 +145,21 @@ TTrainedNetwork* TJetNet::createTrainedNetwork() const { if (o<nHidden) { - if (mDebug) - cout << " To hidden node: " << s << endl; + if (m_Debug) + cout << " To hidden node: " << s << endl; } else { - if (mDebug) - cout << " To output node: " << s << endl; + if (m_Debug) + cout << " To output node: " << s << endl; } if (o==0) { for (Int_t p=0;p<nInput;++p) { - if (mDebug) - cout << " W from inp nod: " << p << "weight: " << - GetWeight(o+1,s+1,p+1) << endl; + if (m_Debug) + cout << " W from inp nod: " << p << "weight: " << + GetWeight(o+1,s+1,p+1) << endl; weightMatrices[o]->operator() (p,s) = GetWeight(o+1,s+1,p+1); } } @@ -172,16 +167,16 @@ TTrainedNetwork* TJetNet::createTrainedNetwork() const { for (Int_t p=0;p<nHiddenLayerSize[o-1];++p) { - if (mDebug) - cout << " W from lay : " << o-1 << " nd: " << - p << " weight: " << - GetWeight(o+1,s+1,p+1) << endl; + if (m_Debug) + cout << " W from lay : " << o-1 << " nd: " << + p << " weight: " << + GetWeight(o+1,s+1,p+1) << endl; weightMatrices[o]->operator() (p,s)=GetWeight(o+1,s+1,p+1); } } - if (mDebug) - cout << " Threshold for node " << s << " : " << - GetThreshold(o+1,s+1) << endl; + if (m_Debug) + cout << " Threshold for node " << s << " : " << + GetThreshold(o+1,s+1) << endl; thresholdVectors[o]->operator() (s) = GetThreshold(o+1,s+1); } } @@ -189,7 +184,7 @@ TTrainedNetwork* TJetNet::createTrainedNetwork() const bool linearOutput=false; if (this->GetActivationFunction(nHidden)==4) { -// cout << " Creating TTrainedNetwork with linear output function" << endl; + // cout << " Creating TTrainedNetwork with linear output function" << endl; linearOutput=true; } @@ -200,9 +195,9 @@ TTrainedNetwork* TJetNet::createTrainedNetwork() const nHiddenLayerSize, thresholdVectors, weightMatrices, - menActFunction, + m_enActFunction, linearOutput, - mNormalizeOutput); + m_NormalizeOutput); return trainedNetwork; @@ -303,11 +298,11 @@ void TJetNet::Print( void ) Int_t i; std::cout << "TJetNet" << std::endl; - std::cout << "Number of layers: " << mLayerCount << std::endl; + std::cout << "Number of layers: " << m_LayerCount << std::endl; - for( i = 0; i < mLayerCount; i++ ) + for( i = 0; i < m_LayerCount; i++ ) { - std::cout << "\t\tNumber of units in layer " << i << " : " << mpLayers[ i ] << std::endl; + std::cout << "\t\tNumber of units in layer " << i << " : " << m_pLayers[ i ] << std::endl; } std::cout << "Epochs: " << GetEpochs() << std::endl; @@ -334,32 +329,32 @@ Double_t TJetNet::Test( void ) for( Int_t iPattern = 0; iPattern < NPatterns; iPattern++ ) { - for( Int_t i = 0; i < GetInputDim(); i++ ) - { - JNDAT1.OIN[ i ] = float ( GetInputTestSet( iPattern, i ) ); - } + for( Int_t i = 0; i < GetInputDim(); i++ ) + { + JNDAT1.OIN[ i ] = float ( GetInputTestSet( iPattern, i ) ); + } - NWJNWGT.OWGT = GetEventWeightTestSet( iPattern ); + NWJNWGT.OWGT = GetEventWeightTestSet( iPattern ); - JNTEST(); + JNTEST(); - for( Int_t j = 0; j < GetOutputDim(); j++ ) - { - fMeanError+= NWJNWGT.OWGT * - std::pow(JNDAT1.OUT[ j ]-float( GetOutputTestSet( iPattern, j )),2)/(float)GetOutputDim(); - } + for( Int_t j = 0; j < GetOutputDim(); j++ ) + { + fMeanError+= NWJNWGT.OWGT * + std::pow(JNDAT1.OUT[ j ]-float( GetOutputTestSet( iPattern, j )),2)/(float)GetOutputDim(); + } - if( mDebug ) std::cout << "Testing [ " << iPattern << " ] - " << JNDAT1.OIN[ 0 ] - << " => " << JNDAT1.OUT[ 0 ] << std::endl; + if( m_Debug ) std::cout << "Testing [ " << iPattern << " ] - " << JNDAT1.OIN[ 0 ] + << " => " << JNDAT1.OUT[ 0 ] << std::endl; - } + } fMeanError/=2.*NPatterns; - if (mDebug) - std::cout << " Test error: " << fMeanError << endl; + if (m_Debug) + std::cout << " Test error: " << fMeanError << endl; return fMeanError; } @@ -410,98 +405,98 @@ Double_t TJetNet::TestBTAG( void ) for( Int_t iPattern = 0; iPattern < NPatterns; iPattern++ ) { - for( Int_t i = 0; i < GetInputDim(); i++ ) + for( Int_t i = 0; i < GetInputDim(); i++ ) + { + if (!test) { - if (!test) - { - JNDAT1.OIN[ i ] = float ( GetInputTestSet( iPattern, i ) ); - NWJNWGT.OWGT = GetEventWeightTestSet( iPattern ); - } - else - { - JNDAT1.OIN[ i ] = float (GetInputTrainSet( iPattern, i ) ); - NWJNWGT.OWGT = GetEventWeightTrainSet( iPattern ); - } - + JNDAT1.OIN[ i ] = float ( GetInputTestSet( iPattern, i ) ); + NWJNWGT.OWGT = GetEventWeightTestSet( iPattern ); } + else + { + JNDAT1.OIN[ i ] = float (GetInputTrainSet( iPattern, i ) ); + NWJNWGT.OWGT = GetEventWeightTrainSet( iPattern ); + } + + } - JNTEST(); + JNTEST(); - int active=0; - for( Int_t j = 0; j < GetOutputDim(); j++ ) + int active=0; + for( Int_t j = 0; j < GetOutputDim(); j++ ) + { + if (!test) { - if (!test) - { - fMeanError+= NWJNWGT.OWGT * - std::pow(JNDAT1.OUT[ j ]-float( GetOutputTestSet( iPattern, j )),2)/(float)GetOutputDim(); - } - else - { - fMeanError+= NWJNWGT.OWGT * - std::pow(JNDAT1.OUT[ j ]-float( GetOutputTrainSet( iPattern, j )),2)/(float)GetOutputDim(); - } + fMeanError+= NWJNWGT.OWGT * + std::pow(JNDAT1.OUT[ j ]-float( GetOutputTestSet( iPattern, j )),2)/(float)GetOutputDim(); + } + else + { + fMeanError+= NWJNWGT.OWGT * + std::pow(JNDAT1.OUT[ j ]-float( GetOutputTrainSet( iPattern, j )),2)/(float)GetOutputDim(); + } -// std::cout << " j " << j << " is " << GetOutputTestSet( iPattern, j) << std::endl; + // std::cout << " j " << j << " is " << GetOutputTestSet( iPattern, j) << std::endl; - if (!test) + if (!test) + { + if (fabs(float( GetOutputTestSet( iPattern, j)) - 1) < 1e-4) { - if (fabs(float( GetOutputTestSet( iPattern, j)) - 1) < 1e-4) - { - active = j; - } + active = j; } - else + } + else + { + if (fabs(float( GetOutputTrainSet( iPattern, j)) - 1) < 1e-4) { - if (fabs(float( GetOutputTrainSet( iPattern, j)) - 1) < 1e-4) - { - active = j; - } + active = j; } } + } -// if (mDebug) std::cout << " active is: " << active << std::endl; + // if (m_Debug) std::cout << " active is: " << active << std::endl; -// if (mDebug) std::cout << " filling histograms " << std::endl; + // if (m_Debug) std::cout << " filling histograms " << std::endl; - if (JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 1 ] >= 0) - { - histoEfficienciesC[active]->Fill( JNDAT1.OUT[ 0 ] / - ( JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 1 ]), - NWJNWGT.OWGT); + if (JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 1 ] >= 0) + { + histoEfficienciesC[active]->Fill( JNDAT1.OUT[ 0 ] / + ( JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 1 ]), + NWJNWGT.OWGT); -// if( mDebug ) std::cout << "Filled: " << JNDAT1.OUT[ 0 ] / -// ( JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 2 ]) << std::endl; + // if( m_Debug ) std::cout << "Filled: " << JNDAT1.OUT[ 0 ] / + // ( JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 2 ]) << std::endl; - } - else - { - std::cout << " Filled 0 " << std::endl; - histoEfficienciesC[active]->Fill( 0 ); - } + } + else + { + std::cout << " Filled 0 " << std::endl; + histoEfficienciesC[active]->Fill( 0 ); + } - if (JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 2 ] >= 0) - { - histoEfficienciesL[active]->Fill( JNDAT1.OUT[ 0 ] / - ( JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 2 ]), - NWJNWGT.OWGT); -// if( mDebug ) std::cout << "Filled: " << JNDAT1.OUT[ 0 ] / -// ( JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 1 ]) << std::endl; + if (JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 2 ] >= 0) + { + histoEfficienciesL[active]->Fill( JNDAT1.OUT[ 0 ] / + ( JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 2 ]), + NWJNWGT.OWGT); + // if( m_Debug ) std::cout << "Filled: " << JNDAT1.OUT[ 0 ] / + // ( JNDAT1.OUT[ 0 ] + JNDAT1.OUT[ 1 ]) << std::endl; - } - else - { - std::cout << " Filled 0 " << std::endl; - histoEfficienciesL[active]->Fill( 0 ); - } + } + else + { + std::cout << " Filled 0 " << std::endl; + histoEfficienciesL[active]->Fill( 0 ); + } - if( mDebug ) std::cout << "Testing [ " << iPattern << " ] - " << JNDAT1.OIN[ 0 ] - << " => " << JNDAT1.OUT[ 0 ] << std::endl; + if( m_Debug ) std::cout << "Testing [ " << iPattern << " ] - " << JNDAT1.OIN[ 0 ] + << " => " << JNDAT1.OUT[ 0 ] << std::endl; }// finish patterns - if (mDebug) std::cout << " Finished patterns... " << std::endl; + if (m_Debug) std::cout << " Finished patterns... " << std::endl; TFile* newFile=new TFile("test.root","recreate"); histoEfficienciesL[0]->Write(); @@ -530,13 +525,13 @@ Double_t TJetNet::TestBTAG( void ) } - if (mDebug) std::cout << " 1 " << std::endl; + if (m_Debug) std::cout << " 1 " << std::endl; Double_t allb=(*myVectorHistos)[0]->GetEntries(); Double_t allc=(*myVectorHistos)[1]->GetEntries(); Double_t allu=(*myVectorHistos)[2]->GetEntries(); - if (mDebug) std::cout << " allb " << allb << std::endl; + if (m_Debug) std::cout << " allb " << allb << std::endl; Double_t allbsofar=0; @@ -556,14 +551,14 @@ Double_t TJetNet::TestBTAG( void ) for (int r=0;r<eff.size();r++) { - if (mDebug) std::cout << " actual eff: " << allbsofar / allb << std::endl; + if (m_Debug) std::cout << " actual eff: " << allbsofar / allb << std::endl; if ((!ok_eff[r]) && allbsofar / allb > eff[r]) { binN_Eff[r]=s; ok_eff[r]=true; - if (mDebug) std::cout << " bin: " << s << " eff: " << allbsofar / allb << std::endl; -// std::cout << " Cut value: " << (*myVectorHistos)[0]->GetBinCenter(s) << std::endl; + if (m_Debug) std::cout << " bin: " << s << " eff: " << allbsofar / allb << std::endl; + // std::cout << " Cut value: " << (*myVectorHistos)[0]->GetBinCenter(s) << std::endl; } else if (allbsofar / allb <= eff[r]) { @@ -581,7 +576,7 @@ Double_t TJetNet::TestBTAG( void ) std::cout << " check: " << (double)(*myVectorHistos)[0]->Integral((*myVectorHistos)[0]->GetNbinsX()-binN_Eff[r], (*myVectorHistos)[1]->GetNbinsX()+1) - / (double)allb; + / (double)allb; double effc=(*myVectorHistos)[1]->Integral((*myVectorHistos)[0]->GetNbinsX()-binN_Eff[r], (*myVectorHistos)[1]->GetNbinsX()+1); @@ -603,20 +598,20 @@ Double_t TJetNet::TestBTAG( void ) std::cout << std::endl; } - for( Int_t j = 0; j < GetOutputDim(); j++ ) - { - delete histoEfficienciesC[j]; - delete histoEfficienciesL[j]; - } + for( Int_t j = 0; j < GetOutputDim(); j++ ) + { + delete histoEfficienciesC[j]; + delete histoEfficienciesL[j]; + } fMeanError/=2.*NPatterns; - if (mDebug) - std::cout << " Test error: " << fMeanError << endl; + if (m_Debug) + std::cout << " Test error: " << fMeanError << endl; return fMeanError; - } +} //______________________________________________________________________________ @@ -637,11 +632,11 @@ Double_t TJetNet::Train( void ) if (updatesPerEpoch*patternsPerUpdate<1./2.*NPatterns) { cout << "Using only: " << updatesPerEpoch*patternsPerUpdate << - " patterns on available: " << NPatterns << endl; + " patterns on available: " << NPatterns << endl; } else if (updatesPerEpoch*patternsPerUpdate>NPatterns) { cout << " Trying to use " << updatesPerEpoch*patternsPerUpdate << - " patterns, but available: " << NPatterns << endl; + " patterns, but available: " << NPatterns << endl; return -100; } @@ -676,26 +671,26 @@ void TJetNet::Init( void ) { // Initializes the neuaral network Int_t i; - JNDAT1.MSTJN[ 0 ] = mLayerCount; // Set the number of layers + JNDAT1.MSTJN[ 0 ] = m_LayerCount; // Set the number of layers // Set the number of nodes for each layer - for( i = 0; i < mLayerCount; i++ ) + for( i = 0; i < m_LayerCount; i++ ) { - if ( mDebug ) std::cout << "Layer " << i + 1 << " has " << mpLayers[ i ] << " units." << std::endl; - JNDAT1.MSTJN[ 9 + i ] = mpLayers[ i ]; + if ( m_Debug ) std::cout << "Layer " << i + 1 << " has " << m_pLayers[ i ] << " units." << std::endl; + JNDAT1.MSTJN[ 9 + i ] = m_pLayers[ i ]; } cout << " calling JNINIT " << endl; JNINIT(); - if (mNormalizeOutput) + if (m_NormalizeOutput) { std::cout << " Setting to normalize output nodes: POTT nodes " << std::endl; - SetPottsUnits(mpLayers[mLayerCount-1]); + SetPottsUnits(m_pLayers[m_LayerCount-1]); } cout << " finishing calling JNINIT " << endl; - mIsInitialized = kTRUE; + m_IsInitialized = kTRUE; } //______________________________________________________________________________ Int_t TJetNet::Epoch( void ) @@ -703,78 +698,78 @@ Int_t TJetNet::Epoch( void ) // Initiate one train/test step the network. Double_t aTrain, aTest; - if ( mCurrentEpoch < mEpochs ) + if ( m_CurrentEpoch < m_Epochs ) { - mCurrentEpoch++; - aTrain = Train(); + m_CurrentEpoch++; + aTrain = Train(); - // if (mCurrentEpoch%2) + // if (m_CurrentEpoch%2) - // std::cout << " Calls to MSTJN: " << GetMSTJN(6) << - // std::endl; + // std::cout << " Calls to MSTJN: " << GetMSTJN(6) << + // std::endl; - if ( mDebug ) - { + if ( m_Debug ) + { - std::cout << "[ " << mCurrentEpoch << " ] Train: " << aTrain << std::endl; - } - if ( ( mCurrentEpoch % 2 ) == 0 ) - { - aTest = Test(); - // if ( mDebug ) - std::cout << "[" << mCurrentEpoch << "]: " << GetPARJN(8) << " "; - std::cout << "Test: " << aTest << std::endl; - } + std::cout << "[ " << m_CurrentEpoch << " ] Train: " << aTrain << std::endl; + } + if ( ( m_CurrentEpoch % 2 ) == 0 ) + { + aTest = Test(); + // if ( m_Debug ) + std::cout << "[" << m_CurrentEpoch << "]: " << GetPARJN(8) << " "; + std::cout << "Test: " << aTest << std::endl; + } } - return mCurrentEpoch; + return m_CurrentEpoch; } //______________________________________________________________________________ void TJetNet::SetInputTrainSet( Int_t aPatternInd, Int_t aInputInd, Double_t aValue ) { // Changes the value of the cell corresponding to unit aInputInd in pattern aPatternInd into INPUT TRAIN set - mpInputTrainSet->SetData( aPatternInd, aInputInd, aValue ); + m_pInputTrainSet->SetData( aPatternInd, aInputInd, aValue ); } //______________________________________________________________________________ void TJetNet::SetOutputTrainSet( Int_t aPatternInd, Int_t aOutputInd, Double_t aValue ) { // Changes the value of the cell corresponding to unit aInputInd in pattern aPatternInd into OUTPUT TRAIN set - mpOutputTrainSet->SetData( aPatternInd, aOutputInd, aValue ); + m_pOutputTrainSet->SetData( aPatternInd, aOutputInd, aValue ); } //______________________________________________________________________________ void TJetNet::SetInputTestSet( Int_t aPatternInd, Int_t aInputInd, Double_t aValue ) { // Changes the value of the cell corresponding to unit aInputInd in pattern aPatternInd into INPUT TEST set - mpInputTestSet->SetData( aPatternInd, aInputInd, aValue ); + m_pInputTestSet->SetData( aPatternInd, aInputInd, aValue ); } //______________________________________________________________________________ Double_t TJetNet::GetOutputTrainSet( Int_t aPatternInd, Int_t aOutputInd ) { // Returns the value of the cell corresponding to unit aInputInd in pattern aPatternInd into OUTPUT TRAIN set - return mpOutputTrainSet->GetData( aPatternInd, aOutputInd ); + return m_pOutputTrainSet->GetData( aPatternInd, aOutputInd ); } //______________________________________________________________________________ void TJetNet::SetEventWeightTrainSet( Int_t aPatternInd, Double_t aValue ) { - mpInputTrainSet->SetEventWeight(aPatternInd,aValue); + m_pInputTrainSet->SetEventWeight(aPatternInd,aValue); } //______________________________________________________________________________ void TJetNet::SetEventWeightTestSet( Int_t aPatternInd, Double_t aValue ) { - mpInputTestSet->SetEventWeight(aPatternInd,aValue); + m_pInputTestSet->SetEventWeight(aPatternInd,aValue); } //______________________________________________________________________________ Double_t TJetNet::GetInputTestSet( Int_t aPatternInd, Int_t aInputInd ) { // Returns the value of the cell corresponding to unit aInputInd in pattern aPatternInd into INPUT TEST set - return mpInputTestSet->GetData( aPatternInd, aInputInd ); + return m_pInputTestSet->GetData( aPatternInd, aInputInd ); } //______________________________________________________________________________ Double_t TJetNet::GetOutputTestSet( Int_t aPatternInd, Int_t aOutputInd ) { // Returns the value of the cell corresponding to unit aInputInd in pattern aPatternInd into OUTPUT TEST set - return mpOutputTestSet->GetData( aPatternInd, aOutputInd ); + return m_pOutputTestSet->GetData( aPatternInd, aOutputInd ); } //______________________________________________________________________________ void TJetNet::SaveDataAscii( TString aFileName ) @@ -787,30 +782,30 @@ void TJetNet::SaveDataAscii( TString aFileName ) out.open( aFileName ); //Write the number of layers, including the input and output - out << mLayerCount << std::endl; + out << m_LayerCount << std::endl; // Write into the file the number of units in input, hidden and output layers - for ( i = 0; i < mLayerCount; i++ ) out << mpLayers[ i ] << " "; + for ( i = 0; i < m_LayerCount; i++ ) out << m_pLayers[ i ] << " "; out << std::endl; // Write the size of Train and Test sets - out << mTrainSetCnt << " " << mTestSetCnt << std::endl; + out << m_TrainSetCnt << " " << m_TestSetCnt << std::endl; // Dump the Train set : Input1 Input2 ... InputN Output1 Output2 ... OutputN - for ( i = 0; i < mTrainSetCnt; i++ ) + for ( i = 0; i < m_TrainSetCnt; i++ ) { out << GetInputTrainSet( i, 0 ); - for( j = 1; j < mpLayers[ 0 ]; j++ ) out << " " << GetInputTrainSet( i, j ); - for( j = 0; j < mpLayers[ mLayerCount - 1 ]; j++ ) out << " " << GetOutputTrainSet( i, j ); + for( j = 1; j < m_pLayers[ 0 ]; j++ ) out << " " << GetInputTrainSet( i, j ); + for( j = 0; j < m_pLayers[ m_LayerCount - 1 ]; j++ ) out << " " << GetOutputTrainSet( i, j ); out << std::endl; } // Dump the Test set : Input1 Input2 ... InputN Output1 Output2 ... OutputN - for ( i = 0; i < mTestSetCnt; i++ ) + for ( i = 0; i < m_TestSetCnt; i++ ) { out << GetInputTestSet( i, 0 ); - for( j = 1; j < mpLayers[ 0 ]; j++ ) out << " " << GetInputTestSet( i, j ); - for( j = 0; j < mpLayers[ mLayerCount - 1 ]; j++ ) out << " " << GetOutputTestSet( i, j ); + for( j = 1; j < m_pLayers[ 0 ]; j++ ) out << " " << GetInputTestSet( i, j ); + for( j = 0; j < m_pLayers[ m_LayerCount - 1 ]; j++ ) out << " " << GetOutputTestSet( i, j ); out << std::endl; } // Close the file @@ -831,54 +826,54 @@ void TJetNet::LoadDataAscii( TString aFileName ) bFlag = Bool_t( in.is_open() ); if ( in ) { - in >> mLayerCount; - if( mDebug ){ std::cout << "Layers Count Set to " << mLayerCount << std::endl;} + in >> m_LayerCount; + if( m_Debug ){ std::cout << "Layers Count Set to " << m_LayerCount << std::endl;} i = 0; - delete [] mpLayers; - mpLayers = new Int_t[ mLayerCount ]; + delete [] m_pLayers; + m_pLayers = new Int_t[ m_LayerCount ]; - if( mDebug ){ std::cout << "Updating the Layers Nodes Counters..." << std::endl; } - while( ( i < mLayerCount ) && ( !in.eof() ) ) + if( m_Debug ){ std::cout << "Updating the Layers Nodes Counters..." << std::endl; } + while( ( i < m_LayerCount ) && ( !in.eof() ) ) { - in >> mpLayers[ i ]; - if( mDebug ){ std::cout << "Layer [ " << i + 1 << " ] has " << mpLayers[ i ] << " units" << std::endl; } + in >> m_pLayers[ i ]; + if( m_Debug ){ std::cout << "Layer [ " << i + 1 << " ] has " << m_pLayers[ i ] << " units" << std::endl; } i++; } - mInputDim = mpLayers[ 0 ]; - mOutputDim = mpLayers[ mLayerCount - 1 ]; - mHiddenLayerDim = mLayerCount-2; + m_InputDim = m_pLayers[ 0 ]; + m_OutputDim = m_pLayers[ m_LayerCount - 1 ]; + m_HiddenLayerDim = m_LayerCount-2; //Get the patterns count per line - iPatternLength = mInputDim + mOutputDim; - if( mDebug ){ std::cout << "Patterns per line = " << iPatternLength << std::endl; } - in >> mTrainSetCnt; - if( mDebug ){ std::cout << "Train Set has " << mTrainSetCnt << " patterns." << std::endl; } - in >> mTestSetCnt; - if( mDebug ){ std::cout << "Test Set has " << mTestSetCnt << " patterns." << std::endl; } + iPatternLength = m_InputDim + m_OutputDim; + if( m_Debug ){ std::cout << "Patterns per line = " << iPatternLength << std::endl; } + in >> m_TrainSetCnt; + if( m_Debug ){ std::cout << "Train Set has " << m_TrainSetCnt << " patterns." << std::endl; } + in >> m_TestSetCnt; + if( m_Debug ){ std::cout << "Test Set has " << m_TestSetCnt << " patterns." << std::endl; } - delete mpInputTestSet; - delete mpInputTrainSet; - delete mpOutputTestSet; - delete mpOutputTrainSet; + delete m_pInputTestSet; + delete m_pInputTrainSet; + delete m_pOutputTestSet; + delete m_pOutputTrainSet; - mpInputTrainSet = new TNeuralDataSet( mTrainSetCnt, GetInputDim() ); - mpInputTestSet = new TNeuralDataSet( mTestSetCnt, GetInputDim() ); - mpOutputTrainSet = new TNeuralDataSet( mTrainSetCnt, GetOutputDim() ); - mpOutputTestSet = new TNeuralDataSet( mTestSetCnt, GetOutputDim() ); + m_pInputTrainSet = new TNeuralDataSet( m_TrainSetCnt, GetInputDim() ); + m_pInputTestSet = new TNeuralDataSet( m_TestSetCnt, GetInputDim() ); + m_pOutputTrainSet = new TNeuralDataSet( m_TrainSetCnt, GetOutputDim() ); + m_pOutputTestSet = new TNeuralDataSet( m_TestSetCnt, GetOutputDim() ); i = 0; j = 0; - while( ( i < ( mTrainSetCnt + mTestSetCnt ) ) && ( !in.eof() ) ) + while( ( i < ( m_TrainSetCnt + m_TestSetCnt ) ) && ( !in.eof() ) ) { j = 0; while( ( j < iPatternLength ) && ( !in.eof() ) ) { - if( i < mTrainSetCnt ) + if( i < m_TrainSetCnt ) { - if( j < mInputDim ) + if( j < m_InputDim ) { //Train Input Set in >> tmp; @@ -887,15 +882,15 @@ void TJetNet::LoadDataAscii( TString aFileName ) else { //Train Output Set - m = j - mInputDim; + m = j - m_InputDim; in >> tmp; SetOutputTrainSet( i, m, tmp ); } } else { - l = i - mTrainSetCnt; - if( j < mInputDim ) + l = i - m_TrainSetCnt; + if( j < m_InputDim ) { //Test Input Set in >> tmp; @@ -904,7 +899,7 @@ void TJetNet::LoadDataAscii( TString aFileName ) else { //Test Output Set - m = j - mInputDim; + m = j - m_InputDim; in >> tmp; SetOutputTestSet( l, m, tmp ); } @@ -993,7 +988,7 @@ void TJetNet::SelectiveFields( Int_t aLayerA, Int_t aNodeA1, Int_t aNodeA2, Int_ // JetNet Selective Fields Int_t tmp, i1, i2, j1, j2; - if( ( aLayerA > 0 ) && ( aLayerA < mLayerCount ) ) + if( ( aLayerA > 0 ) && ( aLayerA < m_LayerCount ) ) { i1 = TMath::Abs( aNodeA1 ); i2 = TMath::Abs( aNodeA2 ); @@ -1014,8 +1009,8 @@ void TJetNet::SelectiveFields( Int_t aLayerA, Int_t aNodeA1, Int_t aNodeA2, Int_ i2 = i1; }//if - if( ( i1 < mpLayers[ aLayerA ] ) && ( i2 < mpLayers[ aLayerA ] ) && - ( j1 < mpLayers[ aLayerA - 1 ] ) && ( j2 < mpLayers[ aLayerA - 1 ] ) ) + if( ( i1 < m_pLayers[ aLayerA ] ) && ( i2 < m_pLayers[ aLayerA ] ) && + ( j1 < m_pLayers[ aLayerA - 1 ] ) && ( j2 < m_pLayers[ aLayerA - 1 ] ) ) { JNSEFI( aLayerA, i1, i2, j1, j2, aSwitch ); }//if @@ -1027,25 +1022,25 @@ void TJetNet::Reinitialize( void ) //Initializes the settings of the network Int_t i; - mLayerCount = JNDAT1.MSTJN[ 0 ]; // Set the number of layers + m_LayerCount = JNDAT1.MSTJN[ 0 ]; // Set the number of layers - delete [] mpLayers; - mpLayers = new Int_t[ mLayerCount ]; + delete [] m_pLayers; + m_pLayers = new Int_t[ m_LayerCount ]; // Set the number of nodes for each layer - for( i = 0; i < mLayerCount; i++ ) + for( i = 0; i < m_LayerCount; i++ ) { - mpLayers[ i ] = JNDAT1.MSTJN[ 9 + i ]; + m_pLayers[ i ] = JNDAT1.MSTJN[ 9 + i ]; } - mpInputTrainSet = new TNeuralDataSet( mTrainSetCnt, GetInputDim() ); - mpInputTestSet = new TNeuralDataSet( mTestSetCnt, GetInputDim() ); - mpOutputTrainSet = new TNeuralDataSet( mTrainSetCnt, GetOutputDim() ); - mpOutputTestSet = new TNeuralDataSet( mTestSetCnt, GetOutputDim() ); + m_pInputTrainSet = new TNeuralDataSet( m_TrainSetCnt, GetInputDim() ); + m_pInputTestSet = new TNeuralDataSet( m_TestSetCnt, GetInputDim() ); + m_pOutputTrainSet = new TNeuralDataSet( m_TrainSetCnt, GetOutputDim() ); + m_pOutputTestSet = new TNeuralDataSet( m_TestSetCnt, GetOutputDim() ); - mInputDim = mpLayers[ 0 ]; - mOutputDim = mpLayers[ mLayerCount - 1 ]; - mHiddenLayerDim = mLayerCount-2; + m_InputDim = m_pLayers[ 0 ]; + m_OutputDim = m_pLayers[ m_LayerCount - 1 ]; + m_HiddenLayerDim = m_LayerCount-2; } @@ -1053,23 +1048,23 @@ void TJetNet::Reinitialize( void ) void TJetNet::Normalize( void ) { // Normilizes Inputs (both test and train) - mpInputTrainSet->Normalize(); - mpInputTestSet->Normalize(); + m_pInputTrainSet->Normalize(); + m_pInputTestSet->Normalize(); } //______________________________________________________________________________ void TJetNet::Randomize( void ) { // Randomizes Inputs and Outputs of both train and test sets - mpInputTrainSet->Randomize(); - mpInputTestSet->Randomize(); - mpOutputTrainSet->Randomize(); - mpOutputTestSet->Randomize(); + m_pInputTrainSet->Randomize(); + m_pInputTestSet->Randomize(); + m_pOutputTrainSet->Randomize(); + m_pOutputTestSet->Randomize(); } //______________________________________________________________________________ Int_t TJetNet::GetUnitCount( Int_t aLayer ) { // Returns the number of the units in specfic layer - if( ( aLayer > -1 ) && ( aLayer < mLayerCount ) ) + if( ( aLayer > -1 ) && ( aLayer < m_LayerCount ) ) return JNDAT1.MSTJN[ 9 + aLayer ]; } //______________________________________________________________________________ @@ -1077,65 +1072,65 @@ void TJetNet::SetUpdatesPerEpoch( Int_t aValue ) { // Sets the number of the updates per epoch JNDAT1.MSTJN[ 8 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetUpdatingProcedure( Int_t aValue ) { // Set specific weights update function JNDAT1.MSTJN[ 4 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetErrorMeasure( Int_t aValue ) { JNDAT1.MSTJN[ 3 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetActivationFunction( Int_t aValue ) { // Set the kind of activation function used JNDAT1.MSTJN[ 2 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetActivationFunction( Int_t aValue, Int_t layerN )//layer 0 is first hidden layer { // Set the kind of activation function used JNDAT2.IGFN[ layerN ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetPatternsPerUpdate( Int_t aValue ) { JNDAT1.MSTJN[ 1 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetLearningRate( Double_t aValue ) { // Change the Learning Rate JNDAT1.PARJN[ 0 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetMomentum( Double_t aValue ) { JNDAT1.PARJN[ 1 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetInitialWeightsWidth( Double_t aValue ) { JNDAT1.PARJN[ 3 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetLearningRateDecrease( Double_t aValue ) { JNDAT1.PARJN[ 10 ] = aValue; - if( !mInitLocked ) this->Init(); + if( !m_InitLocked ) this->Init(); } //______________________________________________________________________________ void TJetNet::SetPottsUnits(Int_t aValue) @@ -1145,7 +1140,7 @@ void TJetNet::SetPottsUnits(Int_t aValue) //_____________________________________________________________________________ void TJetNet::NormalizeOutput(bool isTrue) { - mNormalizeOutput=isTrue; + m_NormalizeOutput=isTrue; } //______________________________________________________________________________ Int_t TJetNet::GetUpdatesPerEpoch( void ) @@ -1232,15 +1227,15 @@ void TJetNet::Shuffle( Bool_t aShuffleTrainSet, Bool_t aShuffleTestSet ) if ( aShuffleTrainSet ) { - mpInputTrainSet->Shuffle( Seed ); - mpOutputTrainSet->Shuffle( Seed ); + m_pInputTrainSet->Shuffle( Seed ); + m_pOutputTrainSet->Shuffle( Seed ); } //Shuffle Test Set if ( aShuffleTestSet ) { Seed = ts.GetSec(); - mpInputTestSet->Shuffle( Seed ); - mpOutputTestSet->Shuffle( Seed ); + m_pInputTestSet->Shuffle( Seed ); + m_pOutputTestSet->Shuffle( Seed ); } return; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TJetNet.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TJetNet.h index 1fae718e19e..b68b839ce36 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TJetNet.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TJetNet.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 */ /* @@ -12,8 +12,8 @@ -#ifndef __TJETNET_ -#define __TJETNET_ +#ifndef PIXELCALIBALGS_TJETNET_H +#define PIXELCALIBALGS_TJETNET_H //______________________________________________________________________________ // @@ -49,12 +49,12 @@ class TJetNet : public TObject void Print( void ); - Int_t GetTrainSetCnt( void ) const { return mTrainSetCnt; }; - Int_t GetTestSetCnt( void ) const { return mTestSetCnt; }; - Int_t GetInputDim( void ) const { return mpLayers[ 0 ]; }; + Int_t GetTrainSetCnt( void ) const { return m_TrainSetCnt; }; + Int_t GetTestSetCnt( void ) const { return m_TestSetCnt; }; + Int_t GetInputDim( void ) const { return m_pLayers[ 0 ]; }; Int_t GetHiddenLayerDim( void ) const { return mHiddenLayerDim; }; - Int_t GetHiddenLayerSize(Int_t number) const { return mpLayers[ number ]; }; - Int_t GetOutputDim( void ) const { return mpLayers[ mLayerCount - 1 ]; }; + Int_t GetHiddenLayerSize(Int_t number) const { return m_pLayers[ number ]; }; + Int_t GetOutputDim( void ) const { return m_pLayers[ m_LayerCount - 1 ]; }; void SetInputTrainSet( Int_t aPatternInd, Int_t aInputInd, Double_t aValue ); void SetOutputTrainSet( Int_t aPatternInd, Int_t aOutputInd, Double_t aValue ); @@ -75,8 +75,8 @@ class TJetNet : public TObject Double_t GetWeight( Int_t aLayerInd, Int_t aNodeInd, Int_t aConnectedNodeInd ) const; Double_t GetThreshold( Int_t aLayerInd, Int_t aNodeInd) const; - Int_t GetEpochs( void ) { return mEpochs; }; - void SetEpochs( const Int_t aEpochs ) { mEpochs = aEpochs; mCurrentEpoch = 0; }; + Int_t GetEpochs( void ) { return m_Epochs; }; + void SetEpochs( const Int_t aEpochs ) { m_Epochs = aEpochs; m_CurrentEpoch = 0; }; void Init( void ); Double_t Train( void ); @@ -102,7 +102,7 @@ class TJetNet : public TObject void writeNetworkInfo(Int_t typeOfInfo = 0); - Int_t GetLayerCount( void ){ return mLayerCount; }; + Int_t GetLayerCount( void ){ return m_LayerCount; }; //Number of layers in NN Int_t GetUnitCount( Int_t aLayer ); //Number of units in NN @@ -134,8 +134,8 @@ class TJetNet : public TObject Double_t GetLearningRateDecrease( void ); Int_t GetPottsUnits(); - void LockInit( void ){ mInitLocked = kTRUE; }; - void UnlockInit( void ){ mInitLocked = kFALSE; }; + void LockInit( void ){ m_InitLocked = kTRUE; }; + void UnlockInit( void ){ m_InitLocked = kFALSE; }; Int_t GetMSTJN( Int_t aIndex ); Double_t GetPARJN( Int_t aIndex ); void SetMSTJN( Int_t aIndex, Int_t aValue ); @@ -167,27 +167,27 @@ private: - TActivationFunction menActFunction; + TActivationFunction m_enActFunction; - Int_t mLayerCount; // Number of Layers (including the input and output) - Int_t* mpLayers; //! Array which contains the number of units in each layer + Int_t m_LayerCount; // Number of Layers (including the input and output) + Int_t* m_pLayers; //! Array which contains the number of units in each layer - TNeuralDataSet* mpInputTrainSet; - TNeuralDataSet* mpOutputTrainSet; - TNeuralDataSet* mpInputTestSet; - TNeuralDataSet* mpOutputTestSet; + TNeuralDataSet* m_pInputTrainSet; + TNeuralDataSet* m_pOutputTrainSet; + TNeuralDataSet* m_pInputTestSet; + TNeuralDataSet* m_pOutputTestSet; - Int_t mTrainSetCnt, mTestSetCnt; // Size of Train and Test set + Int_t m_TrainSetCnt, m_TestSetCnt; // Size of Train and Test set - Int_t mInputDim; // Number of the elements in intput layer - Int_t mHiddenLayerDim; // Number of Hidden Layers - Int_t mOutputDim; // Number of outputs - Int_t mEpochs; // Epochs - Int_t mCurrentEpoch; // Current epoch - Bool_t mDebug; // Debug Flag - Bool_t mIsInitialized; - Bool_t mInitLocked; - Bool_t mNormalizeOutput; + Int_t m_InputDim; // Number of the elements in intput layer + Int_t m_HiddenLayerDim; // Number of Hidden Layers + Int_t m_OutputDim; // Number of outputs + Int_t m_Epochs; // Epochs + Int_t m_CurrentEpoch; // Current epoch + Bool_t m_Debug; // Debug Flag + Bool_t m_IsInitialized; + Bool_t m_InitLocked; + Bool_t m_NormalizeOutput; ClassDef( TJetNet, 1 ) @@ -196,23 +196,23 @@ private: inline void TJetNet::SetOutputTestSet( Int_t aPatternInd, Int_t aOutputInd, Double_t aValue ) { // Changes the value of the cell corresponding to unit aInputInd in pattern aPatternInd into OUTPUT TEST set - mpOutputTestSet->SetData( aPatternInd, aOutputInd, aValue ); + m_pOutputTestSet->SetData( aPatternInd, aOutputInd, aValue ); } //______________________________________________________________________________ inline Double_t TJetNet::GetInputTrainSet( Int_t aPatternInd, Int_t aInputInd ) { // Returns the value of the cell corresponding to unit aInputInd in pattern aPatternInd into INPUT TRAIN set - return mpInputTrainSet->GetData( aPatternInd, aInputInd ); + return m_pInputTrainSet->GetData( aPatternInd, aInputInd ); } //______________________________________________________________________________ inline Double_t TJetNet::GetEventWeightTrainSet( Int_t aPatternInd ) { - return mpInputTrainSet->GetEventWeight( aPatternInd); + return m_pInputTrainSet->GetEventWeight( aPatternInd); } //______________________________________________________________________________ inline Double_t TJetNet::GetEventWeightTestSet( Int_t aPatternInd ) { - return mpInputTestSet->GetEventWeight( aPatternInd); + return m_pInputTestSet->GetEventWeight( aPatternInd); } #endif diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx index bc1390dcf30..ab3922e10fe 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.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 "TTrainedNetwork.h" @@ -11,13 +11,13 @@ using namespace std; TTrainedNetwork::TTrainedNetwork() + : m_nInput(0), + m_nHidden(0), + m_nOutput(0), + m_ActivationFunction(1), + m_LinearOutput(false), + m_NormalizeOutput (false) { - mnInput=0; - mnHidden=0; - mnOutput=0; - mActivationFunction=1; - mLinearOutput=false; - mNormalizeOutput=false; } TTrainedNetwork::TTrainedNetwork(Int_t nInput, @@ -29,23 +29,22 @@ TTrainedNetwork::TTrainedNetwork(Int_t nInput, Int_t activationFunction, bool linearOutput, bool normalizeOutput) + : m_nInput (nInput), + m_nHidden (nHidden), + m_nOutput (nOutput), + m_nHiddenLayerSize (nHiddenLayerSize), + m_ThresholdVectors (thresholdVectors), + m_WeightMatrices (weightMatrices), + m_ActivationFunction (activationFunction), + m_LinearOutput (linearOutput), + m_NormalizeOutput (normalizeOutput) { - - mnInput=nInput; - mnHidden=nHidden; - mnOutput=nOutput; - mnHiddenLayerSize=nHiddenLayerSize; - mThresholdVectors=thresholdVectors; - mWeightMatrices=weightMatrices; - mActivationFunction=activationFunction; - mLinearOutput=linearOutput; - mNormalizeOutput=normalizeOutput; } TTrainedNetwork::~TTrainedNetwork() { - std::vector<TVectorD*>::const_iterator vectBegin=mThresholdVectors.begin(); - std::vector<TVectorD*>::const_iterator vectEnd=mThresholdVectors.end(); + std::vector<TVectorD*>::const_iterator vectBegin=m_ThresholdVectors.begin(); + std::vector<TVectorD*>::const_iterator vectEnd=m_ThresholdVectors.end(); for (std::vector<TVectorD*>::const_iterator vectIter=vectBegin; vectIter!=vectEnd; @@ -54,8 +53,8 @@ TTrainedNetwork::~TTrainedNetwork() delete *vectIter; } - std::vector<TMatrixD*>::const_iterator matrixBegin=mWeightMatrices.begin(); - std::vector<TMatrixD*>::const_iterator matrixEnd=mWeightMatrices.end(); + std::vector<TMatrixD*>::const_iterator matrixBegin=m_WeightMatrices.begin(); + std::vector<TMatrixD*>::const_iterator matrixEnd=m_WeightMatrices.end(); for (std::vector<TMatrixD*>::const_iterator matrixIter=matrixBegin; matrixIter!=matrixEnd; @@ -70,8 +69,8 @@ void TTrainedNetwork::setNewWeights(std::vector<TVectorD*> & thresholdVectors, std::vector<TMatrixD*> & weightMatrices) { - std::vector<TVectorD*>::const_iterator vectBegin=mThresholdVectors.begin(); - std::vector<TVectorD*>::const_iterator vectEnd=mThresholdVectors.end(); + std::vector<TVectorD*>::const_iterator vectBegin=m_ThresholdVectors.begin(); + std::vector<TVectorD*>::const_iterator vectEnd=m_ThresholdVectors.end(); for (std::vector<TVectorD*>::const_iterator vectIter=vectBegin; vectIter!=vectEnd; @@ -80,8 +79,8 @@ void TTrainedNetwork::setNewWeights(std::vector<TVectorD*> & thresholdVectors, delete *vectIter; } - std::vector<TMatrixD*>::const_iterator matrixBegin=mWeightMatrices.begin(); - std::vector<TMatrixD*>::const_iterator matrixEnd=mWeightMatrices.end(); + std::vector<TMatrixD*>::const_iterator matrixBegin=m_WeightMatrices.begin(); + std::vector<TMatrixD*>::const_iterator matrixEnd=m_WeightMatrices.end(); for (std::vector<TMatrixD*>::const_iterator matrixIter=matrixBegin; matrixIter!=matrixEnd; @@ -90,11 +89,11 @@ void TTrainedNetwork::setNewWeights(std::vector<TVectorD*> & thresholdVectors, delete *matrixIter; } - mThresholdVectors.clear(); - mWeightMatrices.clear(); + m_ThresholdVectors.clear(); + m_WeightMatrices.clear(); - mThresholdVectors=thresholdVectors; - mWeightMatrices=weightMatrices; + m_ThresholdVectors=thresholdVectors; + m_WeightMatrices=weightMatrices; } @@ -104,21 +103,21 @@ std::vector<Double_t> TTrainedNetwork::calculateOutputValues(std::vector<Double std::vector<Double_t> result; //now calculate the value using: - TVectorD** resultVector=new TVectorD*[mnHidden+1]; + TVectorD** resultVector=new TVectorD*[m_nHidden+1]; - if ((int)input.size()!=mnInput) + if ((int)input.size()!=m_nInput) { - std::cout << " Input size: " << input.size() << " doesn't match with network: " << mnInput << std::endl; + std::cout << " Input size: " << input.size() << " doesn't match with network: " << m_nInput << std::endl; delete[] resultVector; return result; } - for (Int_t o=0;o<mnHidden+1;++o) + for (Int_t o=0;o<m_nHidden+1;++o) { - int sizeActualLayer=(o<mnHidden)?mnHiddenLayerSize[o]:mnOutput; -// int sizePreviousLayer=(o==0)?mnInput:mnHiddenLayerSize[o-1]; + int sizeActualLayer=(o<m_nHidden)?m_nHiddenLayerSize[o]:m_nOutput; +// int sizePreviousLayer=(o==0)?m_nInput:m_nHiddenLayerSize[o-1]; resultVector[o]=new TVectorD(sizeActualLayer); @@ -127,20 +126,20 @@ std::vector<Double_t> TTrainedNetwork::calculateOutputValues(std::vector<Double Double_t nodeValue=0.; if (o==0) { - for (Int_t p=0;p<mnInput;++p) + for (Int_t p=0;p<m_nInput;++p) { - nodeValue+=mWeightMatrices[o]->operator() (p,s)*input[p]; + nodeValue+=m_WeightMatrices[o]->operator() (p,s)*input[p]; } } else { - for (Int_t p=0;p<mnHiddenLayerSize[o-1];++p) + for (Int_t p=0;p<m_nHiddenLayerSize[o-1];++p) { - nodeValue+=mWeightMatrices[o]->operator() (p,s)*resultVector[o-1]->operator()(p); + nodeValue+=m_WeightMatrices[o]->operator() (p,s)*resultVector[o-1]->operator()(p); } } - nodeValue+=mThresholdVectors[o]->operator() (s); - if (o!=mnHidden || (!mLinearOutput)) + nodeValue+=m_ThresholdVectors[o]->operator() (s); + if (o!=m_nHidden || (!m_LinearOutput)) { resultVector[o]->operator()(s) = sigmoid(nodeValue); } @@ -153,30 +152,30 @@ std::vector<Double_t> TTrainedNetwork::calculateOutputValues(std::vector<Double double sumLastLayer=0; - if (mNormalizeOutput) + if (m_NormalizeOutput) { - for (Int_t i=0;i<mnOutput;i++) + for (Int_t i=0;i<m_nOutput;i++) { - sumLastLayer+=resultVector[mnHidden]->operator()(i); + sumLastLayer+=resultVector[m_nHidden]->operator()(i); } } - for (Int_t i=0;i<mnOutput;i++) + for (Int_t i=0;i<m_nOutput;i++) { - if (!mNormalizeOutput) + if (!m_NormalizeOutput) { - result.push_back(resultVector[mnHidden]->operator()(i)); + result.push_back(resultVector[m_nHidden]->operator()(i)); } else { - result.push_back(resultVector[mnHidden]->operator()(i)/sumLastLayer); + result.push_back(resultVector[m_nHidden]->operator()(i)/sumLastLayer); } } - for (Int_t o=0;o<mnHidden+1;++o) + for (Int_t o=0;o<m_nHidden+1;++o) { - //int sizeActualLayer=(o<mnHidden)?mnHiddenLayerSize[o]:mnOutput; + //int sizeActualLayer=(o<m_nHidden)?m_nHiddenLayerSize[o]:m_nOutput; delete resultVector[o]; } delete[] resultVector; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.h index 7f41505357b..5a128bcf4e6 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/TTrainedNetwork.h @@ -1,9 +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 */ -#ifndef __TTrainedNetwork_ -#define __TTrainedNetwork_ +#ifndef PIXELCALIBALGS_TTRAINEDNETWORK_H +#define PIXELCALIBALGS_TTRAINEDNETWORK_H #include "TObject.h" #include "TMatrixD.h" @@ -39,44 +39,44 @@ class TTrainedNetwork : public TObject void setNewWeights(std::vector<TVectorD*> & thresholdVectors, std::vector<TMatrixD*> & weightMatrices); - Int_t getnInput() const {return mnInput;}; + Int_t getnInput() const {return m_nInput;}; - Int_t getnHidden() const {return mnHidden;}; + Int_t getnHidden() const {return m_nHidden;}; - Int_t getnOutput() const {return mnOutput;}; + Int_t getnOutput() const {return m_nOutput;}; - const std::vector<Int_t> & getnHiddenLayerSize() const {return mnHiddenLayerSize;}; + const std::vector<Int_t> & getnHiddenLayerSize() const {return m_nHiddenLayerSize;}; - Int_t getActivationFunction() const {return mActivationFunction;}; + Int_t getActivationFunction() const {return m_ActivationFunction;}; - const std::vector<TVectorD*> & getThresholdVectors() const {return mThresholdVectors;}; + const std::vector<TVectorD*> & getThresholdVectors() const {return m_ThresholdVectors;}; - const std::vector<TMatrixD*> & weightMatrices() const {return mWeightMatrices;}; + const std::vector<TMatrixD*> & weightMatrices() const {return m_WeightMatrices;}; std::vector<Double_t> calculateOutputValues(std::vector<Double_t> & input) const; - bool getIfLinearOutput() const { return mLinearOutput; }; + bool getIfLinearOutput() const { return m_LinearOutput; }; - bool getIfNormalizeOutput() const { return mNormalizeOutput; }; + bool getIfNormalizeOutput() const { return m_NormalizeOutput; }; private: - Int_t mnInput; - Int_t mnHidden; - Int_t mnOutput; + Int_t m_nInput; + Int_t m_nHidden; + Int_t m_nOutput; - std::vector<Int_t> mnHiddenLayerSize; - //Int_t* mnHiddenLayerSize; + std::vector<Int_t> m_nHiddenLayerSize; + //Int_t* m_nHiddenLayerSize; - std::vector<TVectorD*> mThresholdVectors; - std::vector<TMatrixD*> mWeightMatrices; - // TVectorD** mThresholdVectors; - // TMatrixD** mWeightMatrices; - Int_t mActivationFunction; + std::vector<TVectorD*> m_ThresholdVectors; + std::vector<TMatrixD*> m_WeightMatrices; + // TVectorD** m_ThresholdVectors; + // TMatrixD** m_WeightMatrices; + Int_t m_ActivationFunction; - bool mLinearOutput; + bool m_LinearOutput; - bool mNormalizeOutput; + bool m_NormalizeOutput; Double_t sigmoid(Double_t x) const { return 1./(1.+exp(-2*x)); }; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/number/readOutput.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/number/readOutput.h index 79bbc3de8b4..2fb1b4a90c2 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/number/readOutput.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/number/readOutput.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 */ ////////////////////////////////////////////////////////// @@ -62,9 +62,9 @@ public : virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); - virtual void Init(TTree *tree); + void Init(TTree *tree); virtual void Loop(); - virtual Bool_t Notify(); + Bool_t Notify(); virtual void Show(Long64_t entry = -1); }; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/RIOs.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/RIOs.h index ae3ebdc3073..ad2eae07a61 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/RIOs.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/RIOs.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 */ ////////////////////////////////////////////////////////// @@ -142,9 +142,9 @@ public : virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); - virtual void Init(TTree *tree); + void Init(TTree *tree); virtual void Loop(); - virtual Bool_t Notify(); + Bool_t Notify(); virtual void Show(Long64_t entry = -1); }; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.C b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.C index 724dc0e713f..893b9c7cbfe 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.C +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.C @@ -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 */ #define writeNtuple_cxx @@ -806,7 +806,7 @@ void writeNtuple::Loop( int nParticlesTraining, bool useTrackEstimate, TString float PixTrkThetaI = theta ; - double eta; + double eta = 0; if( ClusterPixBarrelEC == 0 ){ if(theta > M_PI / 2 ) theta -= M_PI; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.h index 0027d895e6a..4d7c2151cd4 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/NNClusteringCalibration_RunI/validation/writeNtuple.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 */ ////////////////////////////////////////////////////////// @@ -140,13 +140,15 @@ public : TString m_pathWeightsWithoutTracks; writeNtuple(TTree *tree=0); + writeNtuple (const writeNtuple&) = delete; + writeNtuple& operator= (const writeNtuple&) = delete; virtual ~writeNtuple(); virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); - virtual void Init(TTree *tree); + void Init(TTree *tree); virtual void Loop(int nParticlesTraining, bool useTrackEstimate, TString outFileName); - virtual Bool_t Notify(); + Bool_t Notify(); virtual void Show(Long64_t entry = -1); virtual void FillClusterInfo(int clus); virtual void InitializeVectors(); @@ -208,6 +210,10 @@ writeNtuple::writeNtuple(TTree *tree) */ writeNtuple::writeNtuple(TTree *tree) + : m_PixChargeList(nullptr), + m_nPixelHits(0), + m_nTRTHits(0), + m_nSCTHits(0) { // if parameter tree is not specified (or zero), connect the file // used to generate this class and read the Tree. diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/DepletionDepthCalibration.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/DepletionDepthCalibration.h index b2af81c6284..7bbf5e308d2 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/DepletionDepthCalibration.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/DepletionDepthCalibration.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 DepletionDepthCalibration_h @@ -15,14 +15,16 @@ namespace PixelCalib{ class DepletionDepthCalibration{ public : - DepletionDepthCalibration(int layer = 0, std::string cosmicORbeam = "beam"); + DepletionDepthCalibration(int layer = 0, const std::string& cosmicORbeam = "beam"); virtual ~DepletionDepthCalibration(){}; + DepletionDepthCalibration (const DepletionDepthCalibration&) = delete; + DepletionDepthCalibration& operator= (const DepletionDepthCalibration&) = delete; bool Fill(Int_t Layer,Int_t EtaModule, Int_t PhiModule, Double_t ClusterSize, Double_t Eta); int Analyze(std::ofstream &logfile); int Write(); int Read(); - void PlotValidation(TCanvas *c1, std::string outname); + void PlotValidation(TCanvas *c1, const std::string& outname); private: diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/LorentzAngleCalibration.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/LorentzAngleCalibration.h index eac4da1b8b8..e1cf22b40a5 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/LorentzAngleCalibration.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/LorentzAngleCalibration.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 LorentzAngleCalibration_h @@ -15,14 +15,16 @@ namespace PixelCalib{ class LorentzAngleCalibration{ public : - LorentzAngleCalibration(int layer = 0, std::string cosmicORbeam="beam"); + LorentzAngleCalibration(int layer = 0, const std::string& cosmicORbeam="beam"); virtual ~LorentzAngleCalibration(){}; + LorentzAngleCalibration (const LorentzAngleCalibration&) = delete; + LorentzAngleCalibration& operator= (const LorentzAngleCalibration&) = delete; bool Fill(Int_t Layer, Int_t EtaModule, Int_t PhiModule, Double_t ClusterSize, Double_t Angle); int Analyze(std::ofstream &logfile); int Write(); int Read(); - void PlotValidation(TCanvas *c1, std::string outname); + void PlotValidation(TCanvas *c1, const std::string& outname); private: int m_curLayer; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/OfflineCalibrationLoop.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/OfflineCalibrationLoop.h index 15bde0789c3..9778dd0bb81 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/OfflineCalibrationLoop.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/OfflineCalibrationLoop.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 OfflineCalibrationLoop_h @@ -22,14 +22,14 @@ class OfflineCalibrationLoop: public PixelNtupleTracks { public : // Modified stuff - OfflineCalibrationLoop(std::string starting_tag, - std::string input, - std::string final_tag, - std::string collection = "Validation/CombinedInDetTracks"); + OfflineCalibrationLoop(const std::string& starting_tag, + const std::string& input, + const std::string& final_tag, + const std::string& collection = "Validation/CombinedInDetTracks"); virtual ~OfflineCalibrationLoop(); void Iterate(long maxentries); - void ReadHistoFile(std::string input); - void Analyze(std::string reference, std::string reference_tag); + void ReadHistoFile(const std::string& input); + void Analyze(const std::string& reference, const std::string& reference_tag); private: diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationHistograms.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationHistograms.h index b3f42d7c8b5..b593b980989 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationHistograms.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationHistograms.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 PixelChargeInterpolationHistograms_h @@ -20,7 +20,7 @@ class PixelChargeInterpolationParameters; class PixelChargeInterpolationHistograms{ public : - PixelChargeInterpolationHistograms(std::string tag, + PixelChargeInterpolationHistograms(const std::string& tag, const PixelChargeInterpolationParameters &model); virtual ~PixelChargeInterpolationHistograms(); diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationPlot.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationPlot.h index d50b3f53c41..c2be7d096b1 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationPlot.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationPlot.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 PixelChargeInterpolationPlot_h @@ -23,9 +23,9 @@ public : PixelChargeInterpolationPlot(const PixelChargeInterpolationParameters ¶meters, bool oneconst = false); virtual ~PixelChargeInterpolationPlot(); void AddReference(const PixelChargeInterpolationParameters ¶meters, - std::string title = "Reference", int color = 0, - std::string drawopt = "HIST"); - void Plot(const std::string output); + const std::string& title = "Reference", int color = 0, + const std::string& drawopt = "HIST"); + void Plot(const std::string& output); void Write(); private: @@ -50,16 +50,16 @@ private: bool m_oneconst; // utility methods! - void PlotDirection(std::string filename, std::string direction = "phi"); + void PlotDirection(const std::string& filename, const std::string& direction = "phi"); - void DrawOneHisto(TH1F *histo, std::string direction = "phi",float maximum = 0); - void DrawHistoMarkers(TH1F* histo, std::string options = "P0same", int goodj = 0); + void DrawOneHisto(TH1F *histo, const std::string& direction = "phi",float maximum = 0); + void DrawHistoMarkers(TH1F* histo, const std::string& options = "P0same", int goodj = 0); void DrawLayerLegend(float xlegend, float ylegend); - void DrawAxis(float y1, float y2, float x1, float x2, std::string direction = "phi"); + void DrawAxis(float y1, float y2, float x1, float x2, const std::string& direction = "phi"); std::vector < TH1F*> *HistogramsFromConstants( const PixelChargeInterpolationParameters ¶meters, - std::string direction = "phi", int color = 1, std::string title = ""); + const std::string& direction = "phi", int color = 1, const std::string& title = ""); }; } diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationValidation.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationValidation.h index 90cbea9d877..8aa25673a41 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationValidation.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelChargeInterpolationValidation.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 PixelChargeInterpolationValidation_h @@ -21,7 +21,7 @@ class PixelChargeInterpolationValidation{ public: - PixelChargeInterpolationValidation(std::string tag, + PixelChargeInterpolationValidation(const std::string& tag, const PixelChargeInterpolationParameters &model); virtual ~PixelChargeInterpolationValidation(); @@ -35,7 +35,7 @@ public: int Write(TDirectory *file = 0); int Read(TDirectory *file = 0); - void WriteErrorsFile(std::string name); + void WriteErrorsFile(const std::string& name); private: diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelClusterOnTrackErrorPlot.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelClusterOnTrackErrorPlot.h index 0613d1136cd..a72bf111e48 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelClusterOnTrackErrorPlot.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelClusterOnTrackErrorPlot.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 PixelClusterOnTrackErrorPlot_h @@ -24,9 +24,9 @@ public : bool oneconst = false); virtual ~PixelClusterOnTrackErrorPlot(); void AddReference(PixelClusterOnTrackErrorData ¶meters, - std::string title = "Reference", int color = 0, - std::string drawopt = "HIST"); - void Plot(const std::string output); + const std::string& title = "Reference", int color = 0, + const std::string& drawopt = "HIST"); + void Plot(const std::string& output); void Write(); private: @@ -50,16 +50,16 @@ private: bool m_oneconst; // utility methods! - void PlotDirection(std::string filename, std::string direction = "phi"); + void PlotDirection(const std::string& filename, const std::string& direction = "phi"); - void DrawOneHisto(TH1F *histo, std::string direction = "phi",float maximum = 0); - void DrawHistoMarkers(TH1F* histo, int divider, std::string options = "Psame", int goodj = 0); + void DrawOneHisto(TH1F *histo, const std::string& direction = "phi",float maximum = 0); + void DrawHistoMarkers(TH1F* histo, int divider, const std::string& options = "Psame", int goodj = 0); void DrawLayerLegend(float xlegend, float ylegend); - void DrawAxis(float y1, float y2, float x1, float x2, std::string direction = "phi"); + void DrawAxis(float y1, float y2, float x1, float x2, const std::string& direction = "phi"); std::vector < TH1F*> *HistogramsFromConstants( PixelClusterOnTrackErrorData ¶meters, - std::string direction = "phi", int color = 1, std::string title = ""); + const std::string& direction = "phi", int color = 1, const std::string& title = ""); }; } diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelConvert.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelConvert.h index dac1fa0cd41..a13764e001e 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelConvert.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelConvert.h @@ -1,9 +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 */ -#ifndef __PIXEL_CONVERT_H__ -#define __PIXEL_CONVERT_H__ +#ifndef PIXELCALIBALGS_PIXELCONVERT_H +#define PIXELCALIBALGS_PIXELCONVERT_H #include <string> #include <sstream> @@ -57,7 +57,7 @@ namespace PixelConvert { int phi, int eta); - int UnpackOfflineID(std::string offlineID, + int UnpackOfflineID(const std::string& offlineID, int& system, int& subSystem, int& endcap, @@ -86,11 +86,11 @@ namespace PixelConvert { int phi, int eta); - std::string OnlineID(std::string offlineID); + std::string OnlineID(const std::string& offlineID); std::string OnlineID(int hashID); - std::string OnlineIDfromDCSID(std::string DCSID); + std::string OnlineIDfromDCSID(const std::string& DCSID); /* OFFLINE ID @@ -113,7 +113,7 @@ namespace PixelConvert { hash ID. */ - int OfflineID(std::string onlineID, + int OfflineID(const std::string& onlineID, int& system, int& subSystem, int& endcap, @@ -121,7 +121,7 @@ namespace PixelConvert { int& phi, int& eta); - std::string OfflineID(std::string onlineID); + std::string OfflineID(const std::string& onlineID); int OfflineID(int hashID, int& system, @@ -151,7 +151,7 @@ namespace PixelConvert { check is performed. */ - int HashID(std::string ID); + int HashID(const std::string& ID); int HashID(int system, int subSystem, @@ -182,9 +182,9 @@ namespace PixelConvert { case the range cheching fails. */ - std::string DCSID(std::string OnlineID); + std::string DCSID(const std::string& OnlineID); - int ReadMap(const std::string filename); + int ReadMap(const std::string& filename); unsigned int GetID(const unsigned int moduleID); } diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelNtupleTracks.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelNtupleTracks.h index a6a835cb00b..cbe7255b0ff 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelNtupleTracks.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelNtupleTracks.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 */ ////////////////////////////////////////////////////////// @@ -275,9 +275,9 @@ class PixelNtupleTracks { virtual ~PixelNtupleTracks(); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); - virtual void Init(TTree *tree); + void Init(TTree *tree); virtual void Loop(); - virtual Bool_t Notify(); + Bool_t Notify(); virtual void Show(Long64_t entry = -1); // inline Functions to access variables: Maybe should be moved to PixelNtupleTracks?? diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelRIOs.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelRIOs.h index 4726cda1b28..bd5e0d151ee 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelRIOs.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelRIOs.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 PixelRIOs_h @@ -195,14 +195,14 @@ public : TBranch *b_NotAssociated_ParticlePt; //! TBranch *b_NotAssociated_Flag; //! - PixelRIOs(std::string starting_tag, - std::string input, - std::string final_tag, - std::string collection = "Validation/PixelRIOs"); + PixelRIOs(const std::string& starting_tag, + const std::string& input, + const std::string& final_tag, + const std::string& collection = "Validation/PixelRIOs"); virtual ~PixelRIOs(); virtual void Iterate(long nentries); - void ReadHistoFile(std::string input); - void Analyze(std::string reference, std::string reference_tag); + void ReadHistoFile(const std::string& input); + void Analyze(const std::string& reference, const std::string& reference_tag); private: diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelResidualHistograms.h b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelResidualHistograms.h index 7fd64214645..74467bed545 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelResidualHistograms.h +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/PixelResidualHistograms.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 PixelResidualHistograms_h @@ -21,8 +21,8 @@ class PixelResidualHistograms; class PixelResidualHistograms{ public: - PixelResidualHistograms(const std::string name, - const std::string title, + PixelResidualHistograms(const std::string& name, + const std::string& title, double limits, int nbins, const std::vector< std::vector < float > > &binnage, @@ -30,16 +30,16 @@ public: virtual ~PixelResidualHistograms(); - void SetAxisTitle(std::string title); + void SetAxisTitle(const std::string& title); - void Fill(float residual, std::vector< float > parameters); + void Fill(float residual, const std::vector< float >& parameters); int Write(bool writebins = false); int Read(); TH1D* GetHisto(const int i) const; - TProfile* GetMeanProfile(const std::string binname); - TProfile* GetRMSProfile(const std::string binname); + TProfile* GetMeanProfile(const std::string& binname); + TProfile* GetRMSProfile(const std::string& binname); TProfile* GetProfile(const int binnumber, bool RMS = false, bool savebins = false); TH1D *GetGlobalHisto(); @@ -48,7 +48,7 @@ public: int marker, float labely = 0, std::vector <TCanvas *> *canvasvector = 0, - std::string name = ""); + const std::string& name = ""); //const std::vector< std::string > *GetBinsNames() const; //const std::vector < float > *GetBins(const std::string binname) const; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/RadDamage/HamburgModel/data_processing.cpp b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/RadDamage/HamburgModel/data_processing.cpp index 2a414138dc9..a9bd2e3f101 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/RadDamage/HamburgModel/data_processing.cpp +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/RadDamage/HamburgModel/data_processing.cpp @@ -262,6 +262,12 @@ Sensor::Sensor( double a, double b, int c, double d, double e) //Constructordefi Temperature=c; Nacceptor_reversible=d; Nneutral_reversible=e; + + volume= 0.135; + Ndonor_stable_donorremoval=donorremovalfraction*fabs(Nacceptor-Ndonor); + Ndonor_const=Ndonor-Ndonor_stable_donorremoval; + Nacceptor_stable_reverseannealing=0; + Nacceptor_stable_constdamage=0; } Sensor::Sensor() //Constructordefinition @@ -337,7 +343,7 @@ vector<double> Sensor::get_powerconsumption() const return powerconsumption; } -void Sensor::irradiate(leakage_current_consts leconsts, Annealing_constants constants,long int phi, float t, long double totalDose) +void Sensor::irradiate(leakage_current_consts leconsts, const Annealing_constants& constants,long int phi, float t, long double totalDose) { //t=t*3600; //conversion from hours to seconds double a=1e-30; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/DepletionDepthCalibration.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/DepletionDepthCalibration.cxx index 0ba9265c8df..d7e5849161e 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/DepletionDepthCalibration.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/DepletionDepthCalibration.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 */ #ifndef DepletionDepthCalibration_C @@ -20,7 +20,7 @@ namespace PixelCalib{ -DepletionDepthCalibration::DepletionDepthCalibration(int layer,std::string cosmicORbeam): +DepletionDepthCalibration::DepletionDepthCalibration(int layer,const std::string& cosmicORbeam): m_curLayer(layer),m_curType(cosmicORbeam){ m_EtaModule = 0; @@ -213,7 +213,7 @@ int DepletionDepthCalibration::Analyze(std::ofstream &logfile){ ////////////////////////////////////////////////////////////////////////////////////////// -void DepletionDepthCalibration::PlotValidation(TCanvas *c1, std::string outname){ +void DepletionDepthCalibration::PlotValidation(TCanvas *c1, const std::string& outname){ int nmodules = m_DepletionDepth0->GetNrows(); TH1D *graph0 = new TH1D( (m_layername + "DepletionDepth0Histo").c_str(), diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/LorentzAngleCalibration.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/LorentzAngleCalibration.cxx index 4a172b8bf67..2511b86d0f0 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/LorentzAngleCalibration.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/LorentzAngleCalibration.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 */ #ifndef LorentzAngleCalibration_C @@ -21,7 +21,7 @@ namespace PixelCalib{ -LorentzAngleCalibration::LorentzAngleCalibration(int layer,std::string cosmicORbeam): +LorentzAngleCalibration::LorentzAngleCalibration(int layer,const std::string& cosmicORbeam): m_curLayer(layer),m_curType(cosmicORbeam){ if(m_curType != "cosmic") m_curType = "beam"; @@ -193,7 +193,7 @@ int LorentzAngleCalibration::Analyze(std::ofstream &logfile){ ////////////////////////////////////////////////////////////////////////////////////////// -void LorentzAngleCalibration::PlotValidation(TCanvas *c1, std::string outname){ +void LorentzAngleCalibration::PlotValidation(TCanvas *c1, const std::string& outname){ int nmodules = m_LorentzAngle0->GetNrows(); TH1D *graph0 = new TH1D( (m_layername + "LorentzAngle0Histo").c_str(), diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/OfflineCalibrationLoop.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/OfflineCalibrationLoop.cxx index cf39fb62e43..7274a46b879 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/OfflineCalibrationLoop.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/OfflineCalibrationLoop.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 */ #ifndef OfflineCalibrationLoop_cxx @@ -22,10 +22,10 @@ namespace PixelCalib{ -OfflineCalibrationLoop::OfflineCalibrationLoop(std::string starting_tag, - std::string input, - std::string final_tag, - std::string collection): +OfflineCalibrationLoop::OfflineCalibrationLoop(const std::string& starting_tag, + const std::string& input, + const std::string& final_tag, + const std::string& collection): PixelNtupleTracks(input,collection), m_timer(0), m_Calibration(0), m_Validation(0), m_StartingTag(starting_tag), m_FinalTag(final_tag){ @@ -83,7 +83,7 @@ OfflineCalibrationLoop::~OfflineCalibrationLoop(){ ////////////////////////////////////////////////////////////////////////////////////////// -void OfflineCalibrationLoop::ReadHistoFile(std::string input){ +void OfflineCalibrationLoop::ReadHistoFile(const std::string& input){ m_timer->Start(); @@ -234,7 +234,8 @@ void OfflineCalibrationLoop::Iterate(long maxentries){ ////////////////////////////////////////////////////////////////////////////////////////// -void OfflineCalibrationLoop::Analyze(std::string reference,std::string reference_tag){ +void OfflineCalibrationLoop::Analyze(const std::string& reference, + const std::string& reference_tag){ m_timer->Start(); diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx index 769818b3aa0..52afd84b0d9 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationHistograms.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 */ #ifndef PixelChargeInterpolationHistograms_C @@ -27,7 +27,7 @@ namespace PixelCalib{ -PixelChargeInterpolationHistograms::PixelChargeInterpolationHistograms(std::string tag, +PixelChargeInterpolationHistograms::PixelChargeInterpolationHistograms(const std::string& tag, const PixelChargeInterpolationParameters &model): m_tag(tag), m_parameters(0), diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationPlot.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationPlot.cxx index 2839d55975d..6f35c00e79b 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationPlot.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationPlot.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 */ #ifndef PixelChargeInterpolationPlot_cxx @@ -79,7 +79,7 @@ PixelChargeInterpolationPlot::~PixelChargeInterpolationPlot(){ void PixelChargeInterpolationPlot::AddReference( const PixelChargeInterpolationParameters ¶meters, - std::string title, int color, std::string drawopt){ + const std::string& title, int color, const std::string& drawopt){ std::vector < TH1F* > *histoX = HistogramsFromConstants(parameters,"phi",color,title); std::vector < TH1F* > *histoY = HistogramsFromConstants(parameters,"eta",color,title); @@ -95,7 +95,7 @@ void PixelChargeInterpolationPlot::AddReference( ////////////////////////////////////////////////////////////////////////////////////////// -void PixelChargeInterpolationPlot::Plot(const std::string output){ +void PixelChargeInterpolationPlot::Plot(const std::string& output){ PlotDirection(output, "phi"); @@ -107,7 +107,7 @@ void PixelChargeInterpolationPlot::Plot(const std::string output){ std::vector < TH1F* > *PixelChargeInterpolationPlot::HistogramsFromConstants( const PixelChargeInterpolationParameters ¶meters, - std::string direction, int color, std::string title){ + const std::string& direction, int color, const std::string& title){ std::vector <TH1F*> *histo = new std::vector <TH1F*>(); std::vector<float> anglebins; @@ -207,7 +207,8 @@ std::vector < TH1F* > *PixelChargeInterpolationPlot::HistogramsFromConstants( ////////////////////////////////////////////////////////////////////////////////////////// -void PixelChargeInterpolationPlot::PlotDirection( std::string filename, std::string direction){ +void PixelChargeInterpolationPlot::PlotDirection( const std::string& filename, + const std::string& direction){ std::vector < std::vector < TH1F* > > *RefHistos = 0; std::vector < TH1F* > *histograms = 0; @@ -289,7 +290,7 @@ void PixelChargeInterpolationPlot::PlotDirection( std::string filename, std::str ////////////////////////////////////////////////////////////////////////////////////////// -void PixelChargeInterpolationPlot::DrawOneHisto(TH1F* histo, std::string direction, float maximum){ +void PixelChargeInterpolationPlot::DrawOneHisto(TH1F* histo, const std::string& direction, float maximum){ // play with the histo @@ -335,7 +336,7 @@ void PixelChargeInterpolationPlot::DrawOneHisto(TH1F* histo, std::string directi ////////////////////////////////////////////////////////////////////////////////////////// -void PixelChargeInterpolationPlot::DrawHistoMarkers(TH1F* histo, std::string options, int goodj){ +void PixelChargeInterpolationPlot::DrawHistoMarkers(TH1F* histo, const std::string& options, int goodj){ int startmarker = 21; TH1F *markers = (TH1F *)histo->Clone(); @@ -390,7 +391,7 @@ void PixelChargeInterpolationPlot::DrawLayerLegend(float xlegend,float ylegend){ ////////////////////////////////////////////////////////////////////////////////////////// -void PixelChargeInterpolationPlot::DrawAxis(float y1, float y2, float x1, float x2, std::string direction){ +void PixelChargeInterpolationPlot::DrawAxis(float y1, float y2, float x1, float x2, const std::string& direction){ float stdtextsize = 0.05; int stdfont = 42; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationValidation.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationValidation.cxx index e367ce9048b..3ce344e4057 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationValidation.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelChargeInterpolationValidation.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 */ #ifndef PixelChargeInterpolationValidation_C @@ -27,7 +27,7 @@ static const int NCLUSSIZES = 10; namespace PixelCalib{ -PixelChargeInterpolationValidation::PixelChargeInterpolationValidation(std::string tag, +PixelChargeInterpolationValidation::PixelChargeInterpolationValidation(const std::string& tag, const PixelChargeInterpolationParameters &model): m_eta(0), m_phi(0), @@ -535,7 +535,7 @@ int PixelChargeInterpolationValidation::Write(TDirectory *writedir){ ////////////////////////////////////////////////////////////////////////////////////////// -void PixelChargeInterpolationValidation::WriteErrorsFile(std::string name){ +void PixelChargeInterpolationValidation::WriteErrorsFile(const std::string& name){ // Let's write resolutions into text file (see: // void PixelClusterOnTrackErrorData::Print(std::string file) const diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelClusterOnTrackErrorPlot.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelClusterOnTrackErrorPlot.cxx index 26b5244cd2f..aa587653862 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelClusterOnTrackErrorPlot.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelClusterOnTrackErrorPlot.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 */ #ifndef PixelClusterOnTrackErrorPlot_cxx @@ -76,7 +76,7 @@ PixelClusterOnTrackErrorPlot::~PixelClusterOnTrackErrorPlot(){ void PixelClusterOnTrackErrorPlot::AddReference( PixelClusterOnTrackErrorData ¶meters, - std::string title, int color, std::string drawopt){ + const std::string& title, int color, const std::string& drawopt){ std::vector < TH1F* > *histoX = HistogramsFromConstants(parameters,"phi",color,title); std::vector < TH1F* > *histoY = HistogramsFromConstants(parameters,"eta",color,title); @@ -91,7 +91,7 @@ void PixelClusterOnTrackErrorPlot::AddReference( ////////////////////////////////////////////////////////////////////////////////////////// -void PixelClusterOnTrackErrorPlot::Plot(const std::string output){ +void PixelClusterOnTrackErrorPlot::Plot(const std::string& output){ PlotDirection(output, "phi"); @@ -103,7 +103,7 @@ void PixelClusterOnTrackErrorPlot::Plot(const std::string output){ std::vector < TH1F* > *PixelClusterOnTrackErrorPlot::HistogramsFromConstants( PixelClusterOnTrackErrorData ¶meters, - std::string direction, int color, std::string title){ + const std::string& direction, int color, const std::string& title){ std::vector <TH1F*> *histo = new std::vector <TH1F*>(); std::vector<float> anglebins; @@ -209,7 +209,8 @@ std::vector < TH1F* > *PixelClusterOnTrackErrorPlot::HistogramsFromConstants( ////////////////////////////////////////////////////////////////////////////////////////// -void PixelClusterOnTrackErrorPlot::PlotDirection( std::string filename, std::string direction){ +void PixelClusterOnTrackErrorPlot::PlotDirection( const std::string& filename, + const std::string& direction){ std::vector < std::vector < TH1F* > > *RefHistos = 0; std::vector < TH1F* > *histograms = 0; @@ -281,7 +282,7 @@ void PixelClusterOnTrackErrorPlot::PlotDirection( std::string filename, std::str ////////////////////////////////////////////////////////////////////////////////////////// -void PixelClusterOnTrackErrorPlot::DrawOneHisto(TH1F* histo, std::string direction, float maximum){ +void PixelClusterOnTrackErrorPlot::DrawOneHisto(TH1F* histo, const std::string& direction, float maximum){ // play with the histo @@ -328,7 +329,7 @@ void PixelClusterOnTrackErrorPlot::DrawOneHisto(TH1F* histo, std::string directi ////////////////////////////////////////////////////////////////////////////////////////// -void PixelClusterOnTrackErrorPlot::DrawHistoMarkers(TH1F* histo, int divider, std::string options, int goodj){ +void PixelClusterOnTrackErrorPlot::DrawHistoMarkers(TH1F* histo, int divider, const std::string& options, int goodj){ int startmarker = 21; TH1F *markers = (TH1F *)histo->Clone(); @@ -369,7 +370,7 @@ void PixelClusterOnTrackErrorPlot::DrawLayerLegend(float xlegend,float ylegend){ ////////////////////////////////////////////////////////////////////////////////////////// -void PixelClusterOnTrackErrorPlot::DrawAxis(float y1, float y2, float x1, float x2, std::string direction){ +void PixelClusterOnTrackErrorPlot::DrawAxis(float y1, float y2, float x1, float x2, const std::string& direction){ std::string axtitle = ""; double* axbins = 0; diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelConvert.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelConvert.cxx index 687579850ff..a204a1dc9fa 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelConvert.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelConvert.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 "PixelCalibAlgs/PixelConvert.h" @@ -26,7 +26,7 @@ namespace PixelConvert { return s.str(); } - int UnpackOfflineID(std::string offlineID, + int UnpackOfflineID(const std::string& offlineID, int& system, int& subSystem, int& endcap, @@ -121,7 +121,7 @@ namespace PixelConvert { return s.str(); } - std::string OnlineID(std::string offlineID) { + std::string OnlineID(const std::string& offlineID) { int system; int subSystem; int endcap; @@ -143,7 +143,7 @@ namespace PixelConvert { } - int OfflineID(std::string onlineID, + int OfflineID(const std::string& onlineID, int& system, int& subSystem, int& endcap, @@ -246,7 +246,7 @@ namespace PixelConvert { else return 1; } - std::string OfflineID(std::string onlineID) { + std::string OfflineID(const std::string& onlineID) { int system, subSystem, endcap, layer, phi, eta; if ( OfflineID(onlineID,system,subSystem,endcap,layer,phi,eta) ) return PackOfflineID(system,subSystem,endcap,layer,phi,eta); @@ -278,7 +278,7 @@ namespace PixelConvert { return PackOfflineID(system,subSystem,endcap,layer,phi,eta); } - int HashID(std::string ID) { + int HashID(const std::string& ID) { int system, subSystem, endcap, layer, phi, eta; int success; if ( ID.at(0)=='[' ) // already offline ID @@ -310,7 +310,7 @@ namespace PixelConvert { + (( eta& 0xf)<<13); } - std::string DCSID(std::string OnlineID) { + std::string DCSID(const std::string& OnlineID) { std::string ID=OnlineID, newID(Error); size_t pos=0; char ch; @@ -358,7 +358,7 @@ namespace PixelConvert { return ID; } - std::string OnlineIDfromDCSID(std::string DCSID) { + std::string OnlineIDfromDCSID(const std::string& DCSID) { std::string ID=DCSID, newID(Error); size_t pos=0; while ( (pos=ID.find('_',pos))!=std::string::npos ) ID.replace(pos,1,"-"); @@ -399,7 +399,7 @@ namespace PixelConvert { * file named as in the string datafile initialized above. */ - int ReadMap(const std::string filename ) { + int ReadMap(const std::string& filename ) { std::cerr << "INFO: Opening data file " << filename << std::endl; std::ifstream f(filename.c_str()); if ( !f.good() ) { diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelRIOs.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelRIOs.cxx index b22cec24aaa..5e20e278cb2 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelRIOs.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelRIOs.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 */ #ifndef PixelRIOs_cxx @@ -21,10 +21,10 @@ namespace PixelCalib{ -PixelRIOs::PixelRIOs(std::string starting_tag, - std::string input, - std::string final_tag, - std::string collection): +PixelRIOs::PixelRIOs(const std::string& starting_tag, + const std::string& input, + const std::string& final_tag, + const std::string& collection): b_event_number(nullptr), b_number_cluster_per_event(nullptr), b_type_of_trigger(nullptr), @@ -150,9 +150,10 @@ PixelRIOs::PixelRIOs(std::string starting_tag, std::ifstream myfile(input.c_str()); if (myfile.is_open()){ for(;;){ - getline(myfile,input); + std::string line; + getline(myfile,line); if(myfile.eof()) break; - clusters_tree->AddFile(input.c_str()); + clusters_tree->AddFile(line.c_str()); } myfile.close(); }else{ @@ -387,7 +388,7 @@ PixelRIOs::~PixelRIOs(){ ///////////////////////////////////////////////////////////////////////////////////////////// -void PixelRIOs::ReadHistoFile(std::string input){ +void PixelRIOs::ReadHistoFile(const std::string& input){ m_timer->Start(); @@ -505,7 +506,8 @@ void PixelRIOs::Iterate(long maxentries){ ////////////////////////////////////////////////////////////////////////////////////////// -void PixelRIOs::Analyze(std::string reference,std::string reference_tag){ +void PixelRIOs::Analyze(const std::string& reference, + const std::string& reference_tag){ m_timer->Start(); diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelResidualHistograms.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelResidualHistograms.cxx index 3c94ef13690..c6acce9b1af 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelResidualHistograms.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixelResidualHistograms.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 */ #ifndef PixelResidualHistograms_C @@ -22,8 +22,8 @@ namespace PixelCalib{ -PixelResidualHistograms::PixelResidualHistograms(std::string name, - std::string title, +PixelResidualHistograms::PixelResidualHistograms(const std::string& name, + const std::string& title, double limits, int nbins, const std::vector< std::vector < float > > &binnage, @@ -65,13 +65,13 @@ PixelResidualHistograms::~PixelResidualHistograms(){ ////////////////////////////////////////////////////////////////////////////////////////// -void PixelResidualHistograms::Fill(float residual, std::vector< float > parameters){ +void PixelResidualHistograms::Fill(float residual, const std::vector< float >& parameters){ m_HistogramsVector->Fill(residual,1,parameters); } ////////////////////////////////////////////////////////////////////////////////////////// -void PixelResidualHistograms::SetAxisTitle(std::string title){ +void PixelResidualHistograms::SetAxisTitle(const std::string& title){ m_axisName = title; for(unsigned int i = 0 ; i < m_HistogramsVector->GetNhistos() ; i++) @@ -134,7 +134,7 @@ TH1D* PixelResidualHistograms::GetHisto(int i) const{ ////////////////////////////////////////////////////////////////////////////////////////// -TProfile* PixelResidualHistograms::GetMeanProfile(const std::string binname){ +TProfile* PixelResidualHistograms::GetMeanProfile(const std::string& binname){ for(unsigned int i = 0; i < m_binnames.size(); i++) if(m_binnames[i] == binname) return GetProfile(i,false); @@ -144,7 +144,7 @@ TProfile* PixelResidualHistograms::GetMeanProfile(const std::string binname){ ////////////////////////////////////////////////////////////////////////////////////////// -TProfile* PixelResidualHistograms::GetRMSProfile(const std::string binname){ +TProfile* PixelResidualHistograms::GetRMSProfile(const std::string& binname){ for(unsigned int i = 0; i < m_binnames.size(); i++) if(m_binnames[i] == binname) return GetProfile(i,true); @@ -282,7 +282,7 @@ TProfile* PixelResidualHistograms::GetProfile(const int binnumber, bool RMS, boo ////////////////////////////////////////////////////////////////////////////////////////// std::vector <TCanvas*> *PixelResidualHistograms::DrawProfiles(int color, int marker, float labely, - std::vector <TCanvas*> *canvasvector, std::string name ){ + std::vector <TCanvas*> *canvasvector, const std::string& name ){ SetAtlasStyle(); std::string drawoptions = "Psame"; -- GitLab