From 32ac65c473904d015fc978269ae7afd8bc95ea61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= <nicolas.koehler@cern.ch> Date: Wed, 15 Apr 2020 14:39:52 +0200 Subject: [PATCH 1/2] remove unneeded using namespace std --- .../CscCalib/CscCalibAlgs/src/CscCalcPed.cxx | 136 +++------ .../CscCalib/CscCalibAlgs/src/CscCalcPed.h | 3 +- .../CscCalibData/src/CscCalibReportBase.cxx | 14 +- .../MdtCalibData/src/BFieldCorFunc.cxx | 29 +- .../MdtCalib/MdtCalibData/src/RtChebyshev.cxx | 27 +- .../MdtCalibData/src/RtFromPoints.cxx | 36 +-- .../src/RtResolutionChebyshev.cxx | 32 +- .../src/RtResolutionFromPoints.cxx | 29 +- .../MdtCalib/MdtCalibData/src/TrRelation.cxx | 32 +- .../src/StationT0FromFile.cxx | 28 +- .../MdtCalibFitters/CurvedPatRec.h | 6 +- .../QuasianalyticLineReconstruction.h | 6 +- .../MdtCalibFitters/StraightPatRec.h | 6 +- .../src/CurvedCandidateFinder.cxx | 29 +- .../MdtCalibFitters/src/CurvedLine.cxx | 34 +-- .../MdtCalibFitters/src/CurvedPatRec.cxx | 68 ++--- .../MdtCalib/MdtCalibFitters/src/IndexSet.cxx | 32 +- .../MdtCalibFitters/src/MTStraightLine.cxx | 19 +- .../src/QuasianalyticLineReconstruction.cxx | 98 ++---- .../MdtCalibFitters/src/StraightPatRec.cxx | 79 +---- .../MdtCalibRt/RtCalibrationAnalytic.h | 6 +- .../src/AdaptiveResidualSmoothing.cxx | 101 ++----- .../MdtCalibRt/src/RtCalibrationAnalytic.cxx | 200 +++--------- .../MdtCalibRt/src/RtCalibrationCurved.cxx | 242 ++------------- .../src/RtCalibrationIntegration.cxx | 57 +--- .../src/RtParabolicExtrapolation.cxx | 49 +-- .../MdtCalib/MdtCalibT0/exe/T0Fit.cxx | 6 +- .../MdtCalib/MdtCalibT0/src/ADCMTHistos.cxx | 32 +- .../MdtCalibT0/src/MTT0PatternRecognition.cxx | 39 ++- .../src/MTTmaxPatternRecognition.cxx | 53 ++-- .../src/VariableBinwidthHistogram.cxx | 69 ++--- .../QuasianalyticLineReconstructionTool.cxx | 17 +- .../src/MuonCalibTriggerInfoBranch.cxx | 7 +- .../src/BFielCorrectionUpdateTool.cxx | 32 +- .../BarrelSecondCoordinatePreparationTool.cxx | 45 +-- .../src/MdtStationT0Container.cxx | 57 +--- .../src/T0Refinement.cxx | 21 +- .../MDTDeadElementsAnalysis.h | 3 +- .../MDTDqaDeadElements.h | 6 +- .../MuonCalibStandAloneExtraTools/MDTName.h | 4 +- .../MdtDqaTrackAnalysis.h | 18 +- .../SegmentAnalysis.h | 5 +- .../src/MDTDqaDeadElements.cxx | 284 ++++-------------- .../src/MdtDqaTrackAnalysis.cxx | 121 +------- .../src/NtupleControlHistogramsTool.cxx | 31 +- .../src/NtupleSimpleResolutionTool.cxx | 26 +- .../src/ConstantContentBinMaker.cxx | 14 +- .../MuonCalibMath/src/DataBin.cxx | 15 +- .../MuonCalibMath/src/DataPoint.cxx | 11 +- .../MuonCalibMath/src/PolygonBase.cxx | 15 +- 50 files changed, 502 insertions(+), 1827 deletions(-) diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx index 956370b60813..ca093f36115b 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.cxx @@ -29,15 +29,12 @@ #include <fstream> #include <bitset> #include <inttypes.h> -//#include <math> #include "CscCalcPed.h" -using namespace std; - namespace MuonCalib { - CscCalcPed::CscCalcPed(const string& name, ISvcLocator* pSvcLocator) : + CscCalcPed::CscCalcPed(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name,pSvcLocator), m_chronoSvc(0), m_cscRdoDecoderTool ("Muon::CscRDO_Decoder"), @@ -65,9 +62,6 @@ namespace MuonCalib { declareProperty("PedAmpHighBound", m_ampHistHighBound = 2600); declareProperty("PedAmpLowBound", m_ampHistLowBound = 1800); declareProperty("PedAmpNumBins", m_ampHistNumBins = 800); - //declareProperty("PedAmpHighBound", m_ampHistHighBound = 2300); - //declareProperty("PedAmpLowBound", m_ampHistLowBound = 1900); - //declareProperty("PedAmpNumBins", m_ampHistNumBins = 400); declareProperty("ExpectedChamberLayer", m_expectedChamberLayer = 2); declareProperty("ThresholdMultiplier", m_thresholdMultiplier = 3.1); declareProperty("DoBitHists", m_doBitHists = false); @@ -85,15 +79,9 @@ namespace MuonCalib { //Can't do correlation without bitHists if(!m_doBitHists){ m_doCorrelation = false; - //MsgStream mLog( msgSvc(), name() ); - // mLog << MSG::WARNING - // << "Tried to do correlation without bitHists. This isn't possible." << endmsg; } - } - CscCalcPed::~CscCalcPed() {} - StatusCode CscCalcPed::initialize() { MsgStream mLog( msgSvc(), name() ); @@ -116,31 +104,12 @@ namespace MuonCalib { ATH_CHECK(m_readKey.initialize()); - StatusCode sc = service("ChronoStatSvc",m_chronoSvc); - if(sc.isFailure()) - { - mLog << MSG::FATAL << "Cannot retrieve ChronoStatSvc!" << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK(service("ChronoStatSvc",m_chronoSvc)); - if (m_cscRdoDecoderTool.retrieve().isFailure()){ - mLog << MSG::FATAL << "Cannot retrieve Csc_Rdo_Decoder Tool!" << endmsg; - return StatusCode::FAILURE; - } - /*sc = service("THistSvc", m_thistSvc); - if(sc.isFailure()) - { - mLog << MSG::FATAL << "Cannot retrieve THistSvc!" << endmsg; - return StatusCode::FAILURE; - }*/ + ATH_CHECK(m_cscRdoDecoderTool.retrieve()); - IToolSvc* toolSvc; - sc = service("ToolSvc",toolSvc); - if(sc.isFailure()) - { - mLog << MSG::ERROR << "Unable to retrieve ToolSvc" << endmsg; - return StatusCode::FAILURE; - } + IToolSvc* toolSvc=nullptr; + ATH_CHECK(service("ToolSvc",toolSvc)); //Set to SG::VIEW_ELEMENTS, since we want root to do its own memory //management. @@ -150,18 +119,18 @@ namespace MuonCalib { //Loop through ids to find out what hash range we're working on (in case we're using some //unusual geometry) - vector<Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); - vector<Identifier>::const_iterator chamItr = ids.begin(); - vector<Identifier>::const_iterator chamEnd = ids.end(); + std::vector<Identifier> ids = m_idHelperSvc->cscIdHelper().idVector(); + std::vector<Identifier>::const_iterator chamItr = ids.begin(); + std::vector<Identifier>::const_iterator chamEnd = ids.end(); m_maxStripHash = 0; for(; chamItr != chamEnd; chamItr++) { - vector<Identifier> stripVect; + std::vector<Identifier> stripVect; m_idHelperSvc->cscIdHelper().idChannels(*chamItr,stripVect); - vector<Identifier>::const_iterator stripItr = stripVect.begin(); - vector<Identifier>::const_iterator stripEnd = stripVect.end(); + std::vector<Identifier>::const_iterator stripItr = stripVect.begin(); + std::vector<Identifier>::const_iterator stripEnd = stripVect.end(); for(;stripItr != stripEnd; stripItr++) { IdentifierHash stripHash; @@ -203,7 +172,7 @@ namespace MuonCalib { sprintf(name, "ampHist%u",stripItr); sprintf(titleSeed, "Amplitude Histogram for eta %d, sector %d, layer %d%c, strip %d", stationEta,(2*stationPhi+50 - stationName),wireLayer,orientation,stripNumber); - string title = m_titlePrefix + titleSeed + m_titlePostfix; + std::string title = m_titlePrefix + titleSeed + m_titlePostfix; hist = new TH1I(name,title.c_str(),m_ampHistNumBins,m_ampHistLowBound, m_ampHistHighBound); @@ -274,7 +243,7 @@ namespace MuonCalib { //Retrieve current online thresholds m_onlineThresholds.resize(m_maxStripHash+1); - ifstream ifile; ifile.open(m_onlineDbFile.c_str()); + std::ifstream ifile; ifile.open(m_onlineDbFile.c_str()); if(!ifile.is_open()){ mLog << MSG::FATAL << "Failed to open online database file " << m_onlineDbFile << endmsg; return StatusCode::FAILURE; @@ -295,28 +264,28 @@ namespace MuonCalib { if(m_debug) mLog << MSG::DEBUG << "Reading in online thresholds from file " << m_onlineDbFile << endmsg; if(m_debug) mLog << MSG::DEBUG << "First (junk) word: " << buf << endmsg; int chanCnt = 0; - while(ifile >> hex >> onlineId >> dec) { + while(ifile >> std::hex >> onlineId >> std::dec) { chanCnt++; onlineToOfflineHashId(onlineId,hashId); ifile >> buf >> buf >> buf >> buf >> rms >> buf >> f001; double thold = f001 + 2*rms; if(m_verbose) mLog << MSG::VERBOSE - << "onlid: " << hex << onlineId << dec << " hash: " << hashId << " rms: " << rms << " f001: " << f001 << " thold: " << thold + << "onlid: " << std::hex << onlineId << std::dec << " hash: " << hashId << " rms: " << rms << " f001: " << f001 << " thold: " << thold << endmsg; m_onlineThresholds.at(hashId) = thold; if(m_verbose){ if(!ifile) - mLog << MSG::VERBOSE << "input file is done, ready to close!"<< std::endl; + mLog << MSG::VERBOSE << "input file is done, ready to close!"<< endmsg; } else - mLog << MSG::VERBOSE << "Input file still good!" <<std::endl; + mLog << MSG::VERBOSE << "Input file still good!" <<endmsg; } if(chanCnt != 30720){ mLog << MSG::FATAL << "Did not retrieve expected 30720 channels from online database! Retrieved: " << chanCnt << endmsg; - mLog << MSG::FATAL << "Last onlineId read: " << hex << onlineId << dec << endmsg; + mLog << MSG::FATAL << "Last onlineId read: " << std::hex << onlineId << std::dec << endmsg; return StatusCode::FAILURE; } @@ -335,7 +304,7 @@ namespace MuonCalib { - cout << "m_prods value: " << m_bitProds << "\ndoCorrelation" << m_doCorrelation << endl; + mLog << MSG::INFO << "m_prods value: " << m_bitProds << "\ndoCorrelation" << m_doCorrelation << endmsg; return StatusCode::SUCCESS; } @@ -464,7 +433,7 @@ namespace MuonCalib { int numStrips = cluster->width(); int samplesPerStrip = (cluster->samples()).size()/numStrips; - if(m_verbose) mLog << MSG::VERBOSE << "About to collect info from " << numStrips << " strips" << endl; + if(m_verbose) mLog << MSG::VERBOSE << "About to collect info from " << numStrips << " strips" << endmsg; for(int stripItr = 0; stripItr <numStrips; stripItr++) { @@ -485,7 +454,6 @@ namespace MuonCalib { if( m_idHelperSvc->cscIdHelper().chamberLayer(channelId) != m_expectedChamberLayer) { - // cout << "Wrong chamber layer" << endl; mLog << MSG::WARNING << "Wrong chamber layer a hash (" << stripHash << ") from the wrong multilayer has appeared in the data. Its string id is " << m_idHelperSvc->cscIdHelper().show_to_string(stripId) << " " << m_idHelperSvc->cscIdHelper().show_to_string(channelId) @@ -501,13 +469,6 @@ namespace MuonCalib { << stripId << " " << channelId << endmsg; - - - // if(m_idHelperSvc->cscIdHelper().measuresPhi(stripId)) - // mLog << MSG::DEBUG <<" bad id Measures Phi" << endmsg; - // else - // mLog << MSG::DEBUG <<" bad id is eta" << endmsg; - //continue; stripId = m_idHelperSvc->cscIdHelper().channelID( m_idHelperSvc->cscIdHelper().stationName(stripId), m_idHelperSvc->cscIdHelper().stationEta(stripId), @@ -533,24 +494,18 @@ namespace MuonCalib { //Get samples. Each shows amplitude of pulse at different //time slice. - vector<uint16_t> samples; + std::vector<uint16_t> samples; cluster->samples(stripItr,samplesPerStrip,samples); //Test for threshold breach... - - //int minMax = GetMinMax(samples); - //if(minMax < (m_idHelperSvc->cscIdHelper().measuresPhi(stripId) ? 50 :30)) { size_t sampCnt = 0; std::vector<uint16_t>::const_iterator sampItr = samples.begin(); std::vector<uint16_t>::const_iterator sampEnd = samples.end(); for(;sampItr != sampEnd; sampItr++) { - //if(m_debug) mLog << MSG::DEBUG << "Filling amplitude histogram" << endmsg; (*m_ampHists)[stripHash]->Fill(*sampItr); - //cerr << "Filling sample hist " << sampCnt << endl; if(m_doSampleHists) (*((*m_sampHists)[stripHash]))[sampCnt]->Fill(*sampItr); - //cerr << "Filled" << sampCnt << endl; if(m_bitHists && sampCnt==1) { TH2F* prodHist = NULL; @@ -571,10 +526,6 @@ namespace MuonCalib { } sampCnt++; }//end Sample loop - // }//end if GetMinMax - // else{ - // mLog << MSG::DEBUG << "Didn't pass GetMinMax() on hash " << stripHash << std::endl; - // } }//end strip loop }//end cluster loop } @@ -709,7 +660,7 @@ namespace MuonCalib { StatusCode CscCalcPed::calOutput0() { MsgStream mLog( msgSvc(), name() ); - ofstream out; + std::ofstream out; out.open(m_outputFileName.c_str()); if(!out.is_open()) { @@ -721,8 +672,7 @@ namespace MuonCalib { out << m_peds->size() << " "; out << "ped "; out << "noise "; - cout << "rms "; - //out << "thold "; + out << "rms "; out << "END_HEADER\n"; if(m_debug) mLog << MSG::DEBUG << "Begining loop over all " << m_peds->size() @@ -780,8 +730,8 @@ namespace MuonCalib { StatusCode CscCalcPed::calOutput1() { MsgStream mLog( msgSvc(), name() ); - ofstream out; - string onlineFileName = m_outputFileName + "_online"; + std::ofstream out; + std::string onlineFileName = m_outputFileName + "_online"; out.open(onlineFileName.c_str()); if(!out.is_open()) @@ -813,7 +763,7 @@ namespace MuonCalib { double f001 = (*f001Itr)->value(); //double thold = (*tholdItr)->value(); - string onlineHexId; + std::string onlineHexId; //Online ids are same as "string ids" used internally in COOL db. readCdo->indexToStringId(&m_idHelperSvc->cscIdHelper(), hashId, "CHANNEL", onlineHexId).ignore(); @@ -840,17 +790,17 @@ namespace MuonCalib { m_idHelperSvc->cscIdHelper().get_module_hash(id,chamberHash); //print out values. - out.setf(ios::right);//right aligned columns - out << setfill('0') << setw(8) << onlineHexId; + out.setf(std::ios::right);//right aligned columns + out << std::setfill('0') << std::setw(8) << onlineHexId; out <<" " - << setw(2) << chamberHash << orientationChar << (m_idHelperSvc->cscIdHelper().wireLayer(id)-1) + << std::setw(2) << chamberHash << orientationChar << (m_idHelperSvc->cscIdHelper().wireLayer(id)-1) <<" " - << setw(3) << m_idHelperSvc->cscIdHelper().strip(id) -1 << " " ; - out.setf(ios::fixed); + << std::setw(3) << m_idHelperSvc->cscIdHelper().strip(id) -1 << " " ; + out.setf(std::ios::fixed); - out << " " << setprecision(3) << setw(8) << ped << " 0000.00"; - out << " " << setprecision(3) << setw(8) << noise << " 0000.000"; + out << " " << std::setprecision(3) << std::setw(8) << ped << " 0000.00"; + out << " " << std::setprecision(3) << std::setw(8) << noise << " 0000.000"; out << " " << f001; out << "\n" ; } //end loop over hash Ids @@ -865,7 +815,7 @@ namespace MuonCalib { StatusCode CscCalcPed::calOutput3() { MsgStream mLog( msgSvc(), name() ); - ofstream out; + std::ofstream out; out.open(m_outputFileName.c_str()); if(!out.is_open()) { @@ -887,7 +837,7 @@ namespace MuonCalib { //Outputs a single parameter in version 03-00 - void CscCalcPed::outputParameter3(const CscCalibResultCollection & results, ofstream & out){ + void CscCalcPed::outputParameter3(const CscCalibResultCollection & results, std::ofstream & out){ SG::ReadCondHandle<CscCondDbData> readHandle{m_readKey}; const CscCondDbData* readCdo{*readHandle}; @@ -923,7 +873,7 @@ namespace MuonCalib { bool thereIsAnError = false; - string histKey = "cscPedCalibReport"; + std::string histKey = "cscPedCalibReport"; if(m_debug) mLog << MSG::DEBUG << "Recording pedestal amplitude histograms to TDS with key " << histKey << endmsg; @@ -952,7 +902,7 @@ namespace MuonCalib { //CscCalibResult contains the actual parameters that we recorded, mostly things that should be entered //into cool - string key = "CscCalibResultPed"; + std::string key = "CscCalibResultPed"; if(m_debug) mLog << MSG::DEBUG << "Recording calibration results to TDS with key " << key << endmsg; CscCalibResultContainer * calibResults @@ -1005,12 +955,12 @@ namespace MuonCalib { int sector = 2*stationPhi + 50 - stationName; - stringstream name; - name << "h_bitCorr_sector_" << setfill('0') << setw(2) << sector << - "_lay_" << wireLayer << orientation << "_strip_" << setw(3) << stripNumber; - stringstream title; - title << "h_bitCorr_sector_" << setfill('0') << setw(2) << sector << - "_lay_" << wireLayer << orientation << "_strip_" << setw(3) << stripNumber; + std::stringstream name; + name << "h_bitCorr_sector_" << std::setfill('0') << std::setw(2) << sector << + "_lay_" << wireLayer << orientation << "_strip_" << std::setw(3) << stripNumber; + std::stringstream title; + title << "h_bitCorr_sector_" << std::setfill('0') << std::setw(2) << sector << + "_lay_" << wireLayer << orientation << "_strip_" << std::setw(3) << stripNumber; TH2F* correlationHist = new TH2F( name.str().c_str(), diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h index 36cf97db0316..60e56a66460d 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibAlgs/src/CscCalcPed.h @@ -31,7 +31,6 @@ class cscIdHelper; class TFile; class IdentifierHash; class CscCondDbData; -//class ICscCalibTool; namespace Muon { class ICSC_RDO_Decoder; @@ -54,7 +53,7 @@ namespace MuonCalib{ { public: CscCalcPed(const std::string& name, ISvcLocator* pSvcLocator); - ~CscCalcPed(void); + ~CscCalcPed()=default; /**basic required functions*/ StatusCode initialize(void); diff --git a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibData/src/CscCalibReportBase.cxx b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibData/src/CscCalibReportBase.cxx index fb760d953d5b..7ab422d6b1a1 100644 --- a/MuonSpectrometer/MuonCalib/CscCalib/CscCalibData/src/CscCalibReportBase.cxx +++ b/MuonSpectrometer/MuonCalib/CscCalib/CscCalibData/src/CscCalibReportBase.cxx @@ -1,12 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CscCalibData/CscCalibReportBase.h" #include <string> -using namespace std; - CscCalibReportBase::CscCalibReportBase() {} @@ -14,18 +12,14 @@ CscCalibReportBase::CscCalibReportBase(std::string aLabel) : m_label(aLabel) {} -CscCalibReportBase::~CscCalibReportBase() -{} +CscCalibReportBase::~CscCalibReportBase()=default; -void CscCalibReportBase::setLabel( const string & aLabel) +void CscCalibReportBase::setLabel(const std::string & aLabel) { m_label = aLabel; } -string CscCalibReportBase::getLabel() const +std::string CscCalibReportBase::getLabel() const { return m_label; } - - - diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/BFieldCorFunc.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/BFieldCorFunc.cxx index 1ab8ddd253b0..73078d2f7a6e 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/BFieldCorFunc.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/BFieldCorFunc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -9,30 +9,16 @@ // be requested; bug fix in integral calculation. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MuonCalibMath/BaseFunctionFitter.h" #include "MuonCalibMath/LegendrePolynomial.h" #include "MdtCalibData/BFieldCorFunc.h" #include "MdtCalibData/IRtRelation.h" #include "AthenaKernel/getMessageSvc.h" -#include "GaudiKernel/IMessageSvc.h" #include "GaudiKernel/MsgStream.h" #include "cmath" -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: - -using namespace std; using namespace MuonCalib; -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS BFieldCorFunc :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - //***************************************************************************** //::::::::::::::::: @@ -43,8 +29,6 @@ void BFieldCorFunc::init(const std::string &quality, const CalibFunc::ParVec &pa //////////////// // PARAMETERS // //////////////// - MsgStream log(Athena::getMessageSvc(), "BFieldCorFunc"); - m_quality = quality; m_param = params; @@ -52,6 +36,7 @@ void BFieldCorFunc::init(const std::string &quality, const CalibFunc::ParVec &pa // CONSISTENCY CHECK // /////////////////////// if (m_param.size()!=2) { + MsgStream log(Athena::getMessageSvc(), "BFieldCorFunc"); log<<MSG::ERROR<< "Wrong number of parameters!"<<endmsg; m_Legendre=NULL; return; @@ -87,7 +72,7 @@ void BFieldCorFunc::init(const std::string &quality, const CalibFunc::ParVec &pa m_step_size = 0.12; } // sample points for the integral factor in the correction function - vector<SamplePoint> sample_points(nb_points); + std::vector<SamplePoint> sample_points(nb_points); //////////////////////////////////////////////////////////// // CALCULATE THE INTEGRAL PART OF THE CORRECTION FUNCTION // @@ -99,6 +84,7 @@ void BFieldCorFunc::init(const std::string &quality, const CalibFunc::ParVec &pa m_r_min = 0.025*CLHEP::mm; // minimum radius m_r_max = rt->radius(m_t_max); // maximum radius if (m_r_max>17.0 || m_r_max <m_r_min) { + MsgStream log(Athena::getMessageSvc(), "BFieldCorFunc"); log<<MSG::INFO<< "UNPHYSICAL MAXIMUM DRIFT RADIUS OF " << m_r_max << ", WILL BE SET TO 17.0!"<<endmsg; m_r_max = 17.0; @@ -121,6 +107,7 @@ void BFieldCorFunc::init(const std::string &quality, const CalibFunc::ParVec &pa // perform the fit // if (fitter.fit_parameters(sample_points, 1, nb_points, &legendre)) { + MsgStream log(Athena::getMessageSvc(), "BFieldCorFunc"); log<<MSG::WARNING<<"Unable to fit the integral in the correction!"<<endmsg; m_Legendre=NULL; return; @@ -183,7 +170,7 @@ double BFieldCorFunc::integral(const double &r_min, const double &r_max, const I /////////////// // VARIABLES // /////////////// - double E0(m_param[0]/log(m_r_max/m_r_min)); // E(r)=E0/r + double E0(m_param[0]/std::log(m_r_max/m_r_min)); // E(r)=E0/r double radius(r_max), rp(r_min); // auxiliary radius variables double integ(0.0); // current value of the integral // double step(0.010); // integration step size [mm] @@ -250,8 +237,8 @@ void BFieldCorFunc::setRtRelationship(const IRtRelation &rt) { //::::::::::::::::: //:: METHOD name :: //::::::::::::::::: -string BFieldCorFunc::name() const { - return string("BFieldCorFunc"); +std::string BFieldCorFunc::name() const { + return std::string("BFieldCorFunc"); } //***************************************************************************** diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtChebyshev.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtChebyshev.cxx index 700ac3b99716..6ecb145eeca0 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtChebyshev.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtChebyshev.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -11,16 +11,9 @@ // 04.06.2006 by O. Kortner: bug in constructor fixed. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -/////////////////////////////////////////////////////////////////////////// -// IMPLEMENTATION OF NON-INLINE METHODS DEFINED IN THE CLASS RtChebyshev // -/////////////////////////////////////////////////////////////////////////// - #include "MdtCalibData/RtChebyshev.h" -#include "AthenaKernel/getMessageSvc.h" -#include "GaudiKernel/IMessageSvc.h" -#include "GaudiKernel/MsgStream.h" +#include <TString.h> // for Form -using namespace std; using namespace MuonCalib; //***************************************************************************** @@ -30,20 +23,16 @@ using namespace MuonCalib; ////////////////// void RtChebyshev::_init(void) { - MsgStream log(Athena::getMessageSvc(), "RtChebyshev"); // check for consistency // - if (nPar()<3) { - log<<MSG::ERROR<< "Not enough parameters!"<<endmsg; - exit(1); + if (nPar()<3) { + throw std::runtime_error(Form("File: %s, Line: %d\nRtChebyshev::_init() - Not enough parameters!", __FILE__, __LINE__)); } if (parameters()[0]>=parameters()[1]) { - log<<MSG::ERROR - << "Lower time boundary >= upper time boundary!"<<endmsg; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtChebyshev::_init() - Lower time boundary >= upper time boundary!", __FILE__, __LINE__)); } -// pointer to the chebyshev service // + // pointer to the chebyshev service // m_Chebyshev = Tschebyscheff_polynomial::get_Tschebyscheff_polynomial(); return; @@ -55,7 +44,7 @@ void RtChebyshev::_init(void) { // METHOD name // ///////////////// std::string RtChebyshev::name(void) const { - return string("RtChebyshev"); + return std::string("RtChebyshev"); } //***************************************************************************** @@ -136,7 +125,7 @@ unsigned int RtChebyshev::numberOfRtParameters(void) const { // METHOD rtParameters // ///////////////////////// std::vector<double> RtChebyshev::rtParameters(void) const { - vector<double> alpha(nPar()-2); + std::vector<double> alpha(nPar()-2); for (unsigned int k=0; k<alpha.size(); k++) { alpha[k] = parameters()[k+2]; } diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtFromPoints.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtFromPoints.cxx index 3d9649bc062b..bca495516a51 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtFromPoints.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtFromPoints.cxx @@ -1,30 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 30.06.2006, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibData/RtFromPoints.h" #include "MuonCalibMath/BaseFunctionFitter.h" #include "MuonCalibMath/ChebyshevPolynomial.h" #include "MuonCalibMath/PolygonBase.h" #include "MdtCalibData/RtSpline.h" -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" using namespace MuonCalib; -using namespace std; - -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS RtFromPoints :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //***************************************************************************** @@ -56,16 +42,16 @@ void RtFromPoints::get_min_max(const std::vector<SamplePoint> &sample_points, //:: METHOD getRtChebyshev :: //::::::::::::::::::::::::::: RtChebyshev RtFromPoints::getRtChebyshev( - const vector<SamplePoint> &sample_points, + const std::vector<SamplePoint> &sample_points, const unsigned int &order) { /////////////// // VARIABLES // /////////////// - vector<double> rt_param(order+3); // input parameters of RtChebyshev + std::vector<double> rt_param(order+3); // input parameters of RtChebyshev BaseFunctionFitter fitter(order+1); // Chebyshev fitter ChebyshevPolynomial chebyshev; // Chebyshev polynomial - vector<SamplePoint> my_points(sample_points); // copy of the sample to add reduced times + std::vector<SamplePoint> my_points(sample_points); // copy of the sample to add reduced times /////////////////////////////////////////////////////////////////// // GET THE MINIMUM AND MAXIMUM TIMES AND CALCULATE REDUCED TIMES // @@ -82,10 +68,8 @@ RtChebyshev RtFromPoints::getRtChebyshev( // PERFORM A CHEBYSHEV FIT TO THE SAMPLE POINTS // ////////////////////////////////////////////////// if (fitter.fit_parameters(my_points, 1, sample_points.size(), &chebyshev)) { - cerr << "\n" - << "Class RtFromPoints, method getRtChebyshev: " - << "WARNING!\n" - << "Could not determine Chebyshev coefficients.\n"; + MsgStream log(Athena::getMessageSvc(), "RtFromPoints"); + log<< MSG::WARNING << "Class RtFromPoints, method getRtChebyshev: Could not determine Chebyshev coefficients."<<endmsg; } for (unsigned int k=0; k<order+1; k++) { rt_param[k+2] = fitter.coefficients()[k]; @@ -103,7 +87,7 @@ RtChebyshev RtFromPoints::getRtChebyshev( //:::::::::::::::::::::::::::::::: //:: METHOD getRtRelationLookUp :: //:::::::::::::::::::::::::::::::: -RtRelationLookUp RtFromPoints::getRtRelationLookUp(const vector<SamplePoint> & sample_points) { +RtRelationLookUp RtFromPoints::getRtRelationLookUp(const std::vector<SamplePoint> & sample_points) { // create spline rt relation CalibFunc :: ParVec pars(2 * sample_points.size()); @@ -117,7 +101,7 @@ RtRelationLookUp RtFromPoints::getRtRelationLookUp(const vector<SamplePoint> & s unsigned int nb_points(100); // number of (r, t) points double bin_width((rt.tUpper()-rt.tLower())/ static_cast<double>(nb_points-1)); // step size - vector<double> rt_param(nb_points+2); // r-t parameters + std::vector<double> rt_param(nb_points+2); // r-t parameters /////////////////////////////////////////////////////////////////// // CREATE AN RtRelationLookUp OBJECT WITH THE CORRECT PARAMETERS // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtResolutionChebyshev.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtResolutionChebyshev.cxx index 8e05101728a8..f999dba4df3e 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtResolutionChebyshev.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtResolutionChebyshev.cxx @@ -1,22 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 05.06.2006, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -/////////////////////////////////////////////////////////////// -// IMPLEMENTATION OF NON-INLINE METHODS DEFINED IN THE CLASS // -// RtResolutionChebyshev // -/////////////////////////////////////////////////////////////// - #include "MdtCalibData/RtResolutionChebyshev.h" -#include "AthenaKernel/getMessageSvc.h" -#include "GaudiKernel/IMessageSvc.h" -#include "GaudiKernel/MsgStream.h" +#include <TString.h> // for Form -using namespace std; using namespace MuonCalib; //***************************************************************************** @@ -25,19 +13,16 @@ using namespace MuonCalib; // METHOD _init // ////////////////// void RtResolutionChebyshev::_init(void) { - MsgStream log(Athena::getMessageSvc(), "RtResolutionChebyshev"); -// check for consistency // + // check for consistency // if (nPar()<3) { - log<<MSG::ERROR << "Not enough parameters!"<<endmsg; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtResolutionChebyshev::_init() - Not enough parameters!", __FILE__, __LINE__)); } if (parameters()[0]>=parameters()[1]) { - log<<MSG::ERROR << "Lower time boundary >= upper time boundary!"<<endmsg; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtResolutionChebyshev::_init() - Lower time boundary >= upper time boundary!", __FILE__, __LINE__)); } -// pointer to the chebyshev service // + // pointer to the chebyshev service // m_Chebyshev = Tschebyscheff_polynomial::get_Tschebyscheff_polynomial(); return; @@ -49,7 +34,7 @@ void RtResolutionChebyshev::_init(void) { // METHOD name // ///////////////// std::string RtResolutionChebyshev::name(void) const { - return string("RtResolutionChebyshev"); + return std::string("RtResolutionChebyshev"); } //***************************************************************************** @@ -76,7 +61,6 @@ double RtResolutionChebyshev::resolution(double t, double /*bgRate*/) const { if(t!=tLower() && t!=tUpper()) { //get resolution for tmin and tmax to get reasonable boundary conditrions double res_min(resolution(tLower())), res_max(resolution(tUpper())); - // cout<<res_min<<" "<<res_max<<endl; // if x is out of bounds, return 99999 // if (t<parameters()[0]) @@ -136,7 +120,7 @@ unsigned int RtResolutionChebyshev::numberOfResParameters(void) const { // METHOD resParameters // ////////////////////////// std::vector<double> RtResolutionChebyshev::resParameters(void) const { - vector<double> alpha(nPar()-2); + std::vector<double> alpha(nPar()-2); for (unsigned int k=0; k<alpha.size(); k++) { alpha[k] = parameters()[k+2]; } diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtResolutionFromPoints.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtResolutionFromPoints.cxx index 961135f7d109..f7a97f513781 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtResolutionFromPoints.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/RtResolutionFromPoints.cxx @@ -1,34 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 11.04.2007, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATIONS OF THE METHODS DEFINED IN THE CLASS :: -//:: RtResolutionFromPoints :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibData/RtResolutionFromPoints.h" #include "MuonCalibMath/BaseFunctionFitter.h" #include "MuonCalibMath/ChebyshevPolynomial.h" #include "MuonCalibMath/PolygonBase.h" #include "AthenaKernel/getMessageSvc.h" -#include "GaudiKernel/IMessageSvc.h" #include "GaudiKernel/MsgStream.h" -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: - using namespace MuonCalib; -using namespace std; //***************************************************************************** @@ -68,10 +49,10 @@ RtResolutionChebyshev RtResolutionFromPoints::getRtResolutionChebyshev( /////////////// MsgStream log(Athena::getMessageSvc(), "RtResolutionChebyshev"); - vector<double> res_param(order+3); // input parameters of RtChebyshev + std::vector<double> res_param(order+3); // input parameters of RtChebyshev BaseFunctionFitter fitter(order+1); // Chebyshev fitter ChebyshevPolynomial chebyshev; // Chebyshev polynomial - vector<SamplePoint> my_points(sample_points); // copy of the sample to add reduced times + std::vector<SamplePoint> my_points(sample_points); // copy of the sample to add reduced times /////////////////////////////////////////////////////////////////// // GET THE MINIMUM AND MAXIMUM TIMES AND CALCULATE REDUCED TIMES // @@ -108,7 +89,7 @@ RtResolutionChebyshev RtResolutionFromPoints::getRtResolutionChebyshev( //:: METHOD getRtResolutionLookUp :: //:::::::::::::::::::::::::::::::::: RtResolutionLookUp RtResolutionFromPoints::getRtResolutionLookUp( - const vector<SamplePoint> &sample_points) { + const std::vector<SamplePoint> &sample_points) { /////////////// // VARIABLES // @@ -116,7 +97,7 @@ RtResolutionLookUp RtResolutionFromPoints::getRtResolutionLookUp( RtResolutionChebyshev res(getRtResolutionChebyshev(sample_points, 8)); // auxiliary resolution-t unsigned int nb_points(100); // number of (r, t) points double bin_width((res.tUpper()-res.tLower())/static_cast<double>(nb_points)); // step size - vector<double> res_param(nb_points+2); // r-t parameters + std::vector<double> res_param(nb_points+2); // r-t parameters /////////////////////////////////////////////////////////////////// // CREATE AN RtRelationLookUp OBJECT WITH THE CORRECT PARAMETERS // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/TrRelation.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/TrRelation.cxx index b3ddab37be52..007a5a80cc5f 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/TrRelation.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/TrRelation.cxx @@ -1,35 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 21.08.2009, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF CONSTRUCTORS AND METHODS DEFINED IN THE :: -//:: CLASS TrRelation :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// standard C++ // #include <cmath> #include <iostream> -// MuonCalib // #include "MdtCalibData/TrRelation.h" #include "AthenaKernel/getMessageSvc.h" -#include "GaudiKernel/IMessageSvc.h" #include "GaudiKernel/MsgStream.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - -using namespace std; using namespace MuonCalib; //***************************************************************************** @@ -46,8 +25,8 @@ TrRelation::TrRelation(const IRtRelation &input_rt) { // step size in r double step_size(input_rt.radius(input_rt.tUpper())/ static_cast<double>(nb_points-1)); - m_r = vector<double>(nb_points); - m_t = vector<double>(nb_points); + m_r = std::vector<double>(nb_points); + m_t = std::vector<double>(nb_points); /////////////////////////// // FILL THE (r, t) PAIRS // @@ -103,7 +82,6 @@ double TrRelation::tFromR(const double &r, bool &out_of_bound_flag) const { } } MsgStream log(Athena::getMessageSvc(), "TrRelation"); - log<< MSG::ERROR << "Class TrRelation, method tFromR: ERROR!"<<endmsg; return 0.0; } //end TrRelation::tFromR @@ -139,8 +117,8 @@ double TrRelation::rFromT(const double &t, bool &out_of_bound_flag) const { return m_r[k]+(t-m_t[k])*(m_r[k+1]-m_r[k])/(m_t[k+1]-m_t[k]); } } - - cerr << "Class TrRelation, method rFromT: ERROR!\n"; + MsgStream log(Athena::getMessageSvc(), "TrRelation"); + log<< MSG::ERROR << "Class TrRelation, method rFromT: ERROR!"<<endmsg; return 0.0; } //end TrRelation::rFromT diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/StationT0FromFile.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/StationT0FromFile.cxx index de5f706c0bfb..67a7912f7a73 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/StationT0FromFile.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibDbAsciiTool/src/StationT0FromFile.cxx @@ -1,31 +1,13 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 01.02.2007, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS StationT0FromFile :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include <iostream> #include <fstream> #include "MdtCalibDbAsciiTool/StationT0FromFile.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - -using namespace std; using namespace MuonCalib; - //***************************************************************************** //::::::::::::::::: @@ -34,12 +16,12 @@ using namespace MuonCalib; void StationT0FromFile::init(void) { - m_t0 = vector< vector< vector<double> > >(2); // two multilayers + m_t0 = std::vector< std::vector< std::vector<double> > >(2); // two multilayers for (unsigned int k=0; k<m_t0.size(); k++) { - m_t0[k] = vector< vector<double> >(4); // up to four layers in + m_t0[k] = std::vector< std::vector<double> >(4); // up to four layers in // a multilayer for (unsigned l=0; l<m_t0[k].size(); l++) { - m_t0[k][l] = vector<double>(72, 0); + m_t0[k][l] = std::vector<double>(72, 0); // up to 72 tubes per layer } } @@ -74,7 +56,7 @@ void StationT0FromFile::readT0File(std::istream &infile) { // VARIABLES // /////////////// - string sdummy; // auxiliary string for file reading + std::string sdummy; // auxiliary string for file reading int idummy; // auxiliary integer for file reading double dummy; // auxiliary double for file reading int ml, ly, tb; // multilayer, layer, tube diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/CurvedPatRec.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/CurvedPatRec.h index 3f0b056d6db7..dd8d3bf91bd2 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/CurvedPatRec.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/CurvedPatRec.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -119,9 +119,7 @@ public: ///< track reconstruction; ///< warning: the errors of the track ///< radii are only approximate - void printLevel(int level); - ///< set the print level, this call - ///< has no effect + void printLevel(int /*level*/){}; private: // internal co-ordinate definition // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/QuasianalyticLineReconstruction.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/QuasianalyticLineReconstruction.h index 03daadaa6f45..30562bcca4df 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/QuasianalyticLineReconstruction.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/QuasianalyticLineReconstruction.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -145,9 +145,7 @@ public: ///< track reconstruction; ///< warning : the errors of the track ///< radii are only approximate - void printLevel(int level); - ///< set the print level, this call - ///< has no effect + void printLevel(int /*level*/){}; private: // internal co-ordinate definition // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/StraightPatRec.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/StraightPatRec.h index 5c71cb012735..fe3c9631c08f 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/StraightPatRec.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/MdtCalibFitters/StraightPatRec.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -137,9 +137,7 @@ public: bool fitCallByReference(MuonCalibSegment & r_segment, HitSelection &r_selection) const; - void printLevel(int level); - ///< set the print level, this call - ///< has no effect +void printLevel(int /*level*/){}; private: // internal co-ordinate definition // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedCandidateFinder.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedCandidateFinder.cxx index d1102d8809f8..cab52ef035ca 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedCandidateFinder.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedCandidateFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -9,22 +9,11 @@ // 07.08.2008 by O. Kortner, bug fig in the pattern recognition. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS CurvedCandidateFinder :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibFitters/CurvedCandidateFinder.h" - -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" using namespace MuonCalib; -using namespace std; //***************************************************************************** @@ -68,10 +57,8 @@ const std::vector<CurvedLine> & CurvedCandidateFinder::getCandidates( ///////////////////////////////////////// if (m_hits.size()<3) { - cerr << endl - << "Class CurvedCandidateFinder, method getCandidates: " - << "WARNING!\n" - << "Not enough hits to determine a parabola!\n"; + MsgStream log(Athena::getMessageSvc(), "CurvedCandidateFinder"); + log<< MSG::WARNING << "Class CurvedCandidateFinder, method getCandidates: Not enough hits to determine a parabola!"<<endmsg; } /////////////// @@ -80,7 +67,7 @@ const std::vector<CurvedLine> & CurvedCandidateFinder::getCandidates( const MdtCalibHitBase *hit[3]; // three hits defining the candidate line double min_z, max_z, dist(0.0); // auxialiary variables to define the points - vector<Amg::Vector3D> points(3); // points defining the curved candidate line + std::vector<Amg::Vector3D> points(3); // points defining the curved candidate line int sign[3]; // auxiliary sign array Amg::Vector3D null(0.0, 0.0, 0.0); // auxiliary 0 vector Amg::Vector3D xhat(1.0, 0.0, 0.0); // auxiliary unit vector @@ -147,10 +134,6 @@ const std::vector<CurvedLine> & CurvedCandidateFinder::getCandidates( // get a candidate // unsigned int nb_hits(0); for (unsigned int l=0; l<3; l++) { -// points[l] = Amg::Vector3D(hit[l]->localPosition().x(), -// hit[l]->localPosition().y()+ -// sign[l]*hit[l]->driftRadius(), -// hit[l]->localPosition().z()); points[l] = hit[l]->localPosition()+ sign[l]*hit[l]->driftRadius()*shift_vec; } diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedLine.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedLine.cxx index 915f33c6f4cd..42f33fdf806e 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedLine.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedLine.cxx @@ -1,29 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 05.04.2008, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS CurvedLine :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibFitters/CurvedLine.h" #include "MuonCalibMath/BaseFunctionFitter.h" #include "MuonCalibMath/LegendrePolynomial.h" - -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" using namespace MuonCalib; -using namespace std; //***************************************************************************** @@ -37,8 +22,8 @@ CurvedLine::CurvedLine(void) { // VARIABLES // /////////////// - vector<Amg::Vector3D> points(3); - vector<Amg::Vector3D> errors(3); + std::vector<Amg::Vector3D> points(3); + std::vector<Amg::Vector3D> errors(3); //////////////////// // FILL VARIABLES // @@ -68,7 +53,7 @@ CurvedLine::CurvedLine(std::vector<Amg::Vector3D> & points) { // VARIABLES // /////////////// - vector<Amg::Vector3D> errors(points.size()); + std::vector<Amg::Vector3D> errors(points.size()); //////////////////// // FILL VARIABLES // @@ -173,9 +158,8 @@ void CurvedLine::init(std::vector<Amg::Vector3D> & points, //////////////////////////////// if (points.size()<3) { - cerr << endl - << "Class CurvedLine, method init: ERROR!\n" - << "Not enough points given, must be at least 3 points!\n"; + MsgStream log(Athena::getMessageSvc(), "CurvedLine"); + log<< MSG::ERROR << "Class CurvedLine, method init: Not enough points given, must be at least 3 points!"<<endmsg; } /////////////// @@ -185,7 +169,7 @@ void CurvedLine::init(std::vector<Amg::Vector3D> & points, BaseFunctionFitter fitter; LegendrePolynomial legendre; // Legendre polynomial needed by the base // function fitter - vector<SamplePoint> sample_points(points.size()); // sample points needed + std::vector<SamplePoint> sample_points(points.size()); // sample points needed // by the base function // fitter ///////////////////////////////////////////// diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedPatRec.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedPatRec.cxx index 0d8cf9eed85f..651d0def11f4 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedPatRec.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/CurvedPatRec.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -13,26 +13,16 @@ // and direction added. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS CurvedPatRec :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibFitters/CurvedPatRec.h" #include "MdtCalibFitters/CurvedCandidateFinder.h" #include "MuonCalibMath/Combination.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" +#include <TString.h> // for Form #include "time.h" #include "cmath" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - using namespace MuonCalib; -using namespace std; //***************************************************************************** @@ -193,16 +183,16 @@ bool CurvedPatRec::fit(MuonCalibSegment & r_segment, time_t start, end; // start and end times (needed for time-out) double diff; // difference of start and end time (needed for time-out) Combination combination; - vector<unsigned int> hit_index; // hit indices for a given combination + std::vector<unsigned int> hit_index; // hit indices for a given combination unsigned int try_nb_hits; // try to find a segment with try_nb_hits hits bool segment_found(false); // flag indicating the a segment has been found - vector<const MdtCalibHitBase *> cand_track_hits; // vector of the track hits + std::vector<const MdtCalibHitBase *> cand_track_hits; // vector of the track hits // found so far CurvedLine aux_line; // memory for reconstructed curved lines Amg::Vector3D null(0.0, 0.0, 0.0); Amg::Vector3D xhat(1.0, 0.0, 0.0); - vector<Amg::Vector3D> points; // hit points for the track fit - vector<const MdtCalibHitBase*> loc_track_hits; // track hit store + std::vector<Amg::Vector3D> points; // hit points for the track fit + std::vector<const MdtCalibHitBase*> loc_track_hits; // track hit store //////////// // RESETS // @@ -217,11 +207,7 @@ bool CurvedPatRec::fit(MuonCalibSegment & r_segment, //////////////////////////////////////// if (r_selection.size()!=r_segment.mdtHitsOnTrack()) { - cerr << endl - << "Class CurvedPatRec, method fit: ERROR!\n" - << "Size of selection vector does not match the number of hits on" - << "track!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nCurvedPatRec::fit - Size of selection vector does not match the number of hits on track!", __FILE__, __LINE__)); } ////////////////////// @@ -267,11 +253,8 @@ bool CurvedPatRec::fit(MuonCalibSegment & r_segment, time (&end); diff = difftime (end,start); if (diff>m_time_out) { - cerr << endl - << "Class CurvedPatRec: " - << "time-out for track finding after " - << m_time_out - << " seconds!\n"; + MsgStream log(Athena::getMessageSvc(), "CurvedPatRec"); + log<< MSG::WARNING << "Class CurvedPatRec, method fit: time-out for track finding after "<<m_time_out<<" seconds!"<<endmsg; return false; } @@ -281,14 +264,14 @@ bool CurvedPatRec::fit(MuonCalibSegment & r_segment, } else { combination.nextCombination(hit_index); } - vector<const MdtCalibHitBase *> track_hits; + std::vector<const MdtCalibHitBase *> track_hits; for (unsigned int k=0; k<try_nb_hits; k++) { track_hits.push_back(loc_track_hits[hit_index[k]-1]); } // find candidates // CurvedCandidateFinder finder(track_hits); - const vector<CurvedLine> &candidates(finder.getCandidates( + const std::vector<CurvedLine> &candidates(finder.getCandidates( m_road_width, est_dir)); if (candidates.size()==0) { continue; @@ -300,7 +283,7 @@ bool CurvedPatRec::fit(MuonCalibSegment & r_segment, // m_track_hits = track_hits; for (unsigned int cand=0; cand<candidates.size(); cand++) { - vector<Amg::Vector3D> errors(track_hits.size()); + std::vector<Amg::Vector3D> errors(track_hits.size()); for (unsigned int k=0; k<errors.size(); k++) { if (track_hits[k]->sigmaDriftRadius()>0.0) { errors[k] = Amg::Vector3D(1.0, @@ -368,7 +351,7 @@ bool CurvedPatRec::fit(MuonCalibSegment & r_segment, // get hit points // points = getHitPoints(m_track_hits, m_curved_track); - vector<Amg::Vector3D> errors(m_track_hits.size()); + std::vector<Amg::Vector3D> errors(m_track_hits.size()); for (unsigned int k=0; k<errors.size(); k++) { if (m_track_hits[k]->sigmaDriftRadius()>0.0) { errors[k] = Amg::Vector3D(1.0, @@ -445,21 +428,6 @@ bool CurvedPatRec::fit(MuonCalibSegment & r_segment, //***************************************************************************** -//::::::::::::::::::::::: -//:: METHOD printLevel :: -//::::::::::::::::::::::: - -void CurvedPatRec::printLevel(int level) { - - cerr << "Class CurvedPatRec: method printLevel: " << level - << " has no effect!\n"; - - return; - -} - -//***************************************************************************** - //::::::::::::::::::::::::: //:: METHOD getHitPoint :: //::::::::::::::::::::::::: @@ -501,7 +469,7 @@ Amg::Vector3D CurvedPatRec::getHitPoint(const MdtCalibHitBase * hit, Amg::Vector3D point = straight_track.positionVector() + (straight_track.directionVector().unit().dot(hit->localPosition() - straight_track.positionVector() ) ) * straight_track.directionVector().unit(); - Amg::Vector3D point_2 = hit->localPosition() + hit->driftRadius() * (point - hit->localPosition()).unit() ; + Amg::Vector3D point_2 = hit->localPosition() + hit->driftRadius() * (point - hit->localPosition()).unit(); return point_2; @@ -521,7 +489,7 @@ std::vector<Amg::Vector3D> CurvedPatRec::getHitPoints( // VARIABLES // /////////////// - vector<Amg::Vector3D> hit_vec; + std::vector<Amg::Vector3D> hit_vec; ///////////////////// // FILL HIT VECTOR // @@ -552,7 +520,7 @@ std::vector<Amg::Vector3D> CurvedPatRec::getHitPoints( // VARIABLES // /////////////// - vector<Amg::Vector3D> hit_vec; + std::vector<Amg::Vector3D> hit_vec; ///////////////////// // FILL HIT VECTOR // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/IndexSet.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/IndexSet.cxx index 97a464303304..c4f840c8b2e4 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/IndexSet.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/IndexSet.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -9,25 +9,12 @@ // != operator corrected. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATIONS OF METHODS DEFINED IN THE CLASS IndexSet :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibFitters/IndexSet.h" +#include <TString.h> // for Form #include <algorithm> #include <cstdlib> -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: - using namespace MuonCalib; -using namespace std; //***************************************************************************** @@ -51,7 +38,7 @@ void IndexSet::init(void) { void IndexSet::init(const unsigned int & r_nb_indices) { m_nb_indices = r_nb_indices; - m_index = vector<int>(m_nb_indices); + m_index = std::vector<int>(m_nb_indices); return; } @@ -63,17 +50,14 @@ void IndexSet::init(const unsigned int & r_nb_indices) { //:::::::::::::::::::::::: void IndexSet::init(const unsigned int & r_nb_indices, - const vector<int> r_index) { + const std::vector<int> r_index) { /////////////////////// // CHECK VECTOR SIZE // /////////////////////// if (r_index.size()<r_nb_indices) { - cerr << endl - << "Class IndexSet, method init: ERROR!\n" - << "Index vector too short!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nIndexSet::init() - Index vector too short!", __FILE__, __LINE__)); } //////////////////// @@ -81,7 +65,7 @@ void IndexSet::init(const unsigned int & r_nb_indices, //////////////////// m_nb_indices = r_nb_indices; - m_index = vector<int>(m_nb_indices); + m_index = std::vector<int>(m_nb_indices); for (unsigned int k=0; k<m_nb_indices; k++) { if (k<r_index.size()) { m_index[k] = r_index[k]; @@ -118,14 +102,14 @@ void IndexSet::resize(const unsigned int & r_size) { //:: VARIABLES :: //::::::::::::::: - vector<int> aux_index = m_index; // vector for temporary storage of + std::vector<int> aux_index = m_index; // vector for temporary storage of // the indices //::::::::::::::::::::::::::::::::::::: //:: RESIZE AND COPY THE OLD INDICES :: //::::::::::::::::::::::::::::::::::::: - m_index = vector<int>(r_size); + m_index = std::vector<int>(r_size); for (unsigned int k=0; k<r_size; k++) { if (k<m_nb_indices) { m_index[k] = aux_index[k]; diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/MTStraightLine.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/MTStraightLine.cxx index 091c89910bee..44dd8fbd9db7 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/MTStraightLine.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/MTStraightLine.cxx @@ -1,30 +1,13 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 01.03.2006, AUTHORS: OLIVER KORTNER, FELIX RAUSCHER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibFitters/MTStraightLine.h" #include "cmath" #include <iostream> -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: using namespace MuonCalib; -//using namespace std; - -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS MTStraightLine :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - //***************************************************************************** //::::::::::::::::: diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/QuasianalyticLineReconstruction.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/QuasianalyticLineReconstruction.cxx index 5af032975361..8bdee5020568 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/QuasianalyticLineReconstruction.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/QuasianalyticLineReconstruction.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -24,25 +24,19 @@ // 13.12.2007 by O. Kortner, time-out added. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -#include <iostream> -#include <fstream> #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Units/PhysicalConstants.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" #include "time.h" +#include <iostream> +#include <fstream> #include <cmath> - -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: +#include <TString.h> // for Form using namespace MuonCalib; -using namespace std; //:::::::::::::::::::::::::::::::::::::::::::::::::::: //:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS :: @@ -142,12 +136,7 @@ MTStraightLine QuasianalyticLineReconstruction::tangent( //:::::::::::::::::::::::::::::::::::::::::::: if (r_case<1 || r_case>4) { - cerr << endl - << "Class QuasianalyticLineReconstruction, " - << "method tangent: ERROR!\n" - << "Illegal case " << r_case << ", must be 1,2,3, or 4." - << endl; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nQuasianalyticLineReconstruction::tangent() - Illegal case %i, must be 1,2,3, or 4.", __FILE__, __LINE__, r_case)); } //::::::::::::::::::::::::::::::::::::: @@ -238,9 +227,9 @@ MTStraightLine QuasianalyticLineReconstruction::track_candidate( const int & r_k_cand, const int & r_l_cand, const int & r_cand_case, - vector<Amg::Vector3D> r_w, - vector<double> r_r, - vector<double> r_sigma2, + std::vector<Amg::Vector3D> r_w, + std::vector<double> r_r, + std::vector<double> r_sigma2, double & r_chi2) const { //::::::::::::::: @@ -251,9 +240,9 @@ MTStraightLine QuasianalyticLineReconstruction::track_candidate( // reconstruction int nb_tangents(0); // number of tangents used in the track // reconstruction - vector<double> mx1, bx1, mx2, bx2; // slopes and intercepts of the + std::vector<double> mx1, bx1, mx2, bx2; // slopes and intercepts of the // tangents building the track - vector<double> mx1_err, bx1_err, mx2_err, bx2_err; // their errors + std::vector<double> mx1_err, bx1_err, mx2_err, bx2_err; // their errors MTStraightLine aux_track; // auxiliary straight line MTStraightLine tang; // tangent to drift circles of a hit pair Amg::Vector3D d1(0.0, 0.0, 0.0), d2(0.0, 0.0, 0.0); // auxiliary distance vectors @@ -483,7 +472,7 @@ unsigned int QuasianalyticLineReconstruction::numberOfTrackHits(void) const { //:: METHOD trackHits :: //:::::::::::::::::::::: -const vector<const MdtCalibHitBase*> & QuasianalyticLineReconstruction::trackHits(void) const { +const std::vector<const MdtCalibHitBase*> & QuasianalyticLineReconstruction::trackHits(void) const { return m_track_hits; @@ -602,29 +591,29 @@ bool QuasianalyticLineReconstruction::fit(MuonCalibSegment & r_segment, time(&start); double diff; // difference of start and end time (needed for time-out) unsigned int nb_selected_hits(0); // number of selected hits - vector<const MdtCalibHitBase*> selected_hits; // vector of pointers to the + std::vector<const MdtCalibHitBase*> selected_hits; // vector of pointers to the // selected hits - vector<unsigned> selected_hits_index(r_selection.size()); + std::vector<unsigned> selected_hits_index(r_selection.size()); // vector containing the indices // of the selected hits (needed // a requested refit) - vector<Amg::Vector3D> w; // wire coordinates - vector<double> r; // drift CLHEP::radii of the selected hits - vector<double> sigma2; // sigma(r)^2 (spatial resolution in r) + std::vector<Amg::Vector3D> w; // wire coordinates + std::vector<double> r; // drift CLHEP::radii of the selected hits + std::vector<double> sigma2; // sigma(r)^2 (spatial resolution in r) int counter1, counter2, counter3; // auxiliary counters int max_cand_hits; // the maximum number of hits on a track candidate // found so far int max_cand_HOTs; // the maximum number of hit tubes on a track // candidate found so far int nb_candidates; // number of candidate tracks - vector<int> k_cand, l_cand; // candidate track index - vector<int> cand_case; // tangent case for the candidate - vector<int> nb_HOTs; // number of hits on a candidate + std::vector<int> k_cand, l_cand; // candidate track index + std::vector<int> cand_case; // tangent case for the candidate + std::vector<int> nb_HOTs; // number of hits on a candidate int candidate; // index of the candidate which becomes the track IndexSet aux_set; // auxiliary index set - vector<IndexSet> index_set; // index set for the storage of the hits + std::vector<IndexSet> index_set; // index set for the storage of the hits // forming a track - vector<double> intercept; // intercepts of track candidates + std::vector<double> intercept; // intercepts of track candidates MTStraightLine tangents[4]; // the four tangents to the drift circles of a // hit pair MTStraightLine aux_track; // auxiliary track @@ -640,12 +629,8 @@ bool QuasianalyticLineReconstruction::fit(MuonCalibSegment & r_segment, // GET THE NUMBER OF SELECTED HITS // ///////////////////////////////////// if (r_segment.mdtHitsOnTrack() != r_selection.size()) { - cerr << "\n" - << "Class QuasianalyticLineReconstruction, " - << "METHOD fit(., .): WARNING!\n" - << "Vector with selected hits unequal to the number " - << "of hits on the segment!\n" - << "The user selection will be ignored!\n"; + MsgStream log(Athena::getMessageSvc(), "QuasianalyticLineReconstruction"); + log<< MSG::WARNING << "Class QuasianalyticLineReconstruction, method fit: Vector with selected hits unequal to the number of hits on the segment! The user selection will be ignored!"<<endmsg; r_selection.clear(); r_selection.assign(r_segment.hitsOnTrack(), 0); } else { @@ -674,10 +659,8 @@ bool QuasianalyticLineReconstruction::fit(MuonCalibSegment & r_segment, /////////////////////////////////////////////////////////////////////////// if (nb_selected_hits<3) { - cerr << "\n" - << "Class QuasianalyticLineReconstruction, " - << "METHOD fit(., .): WARNING!\n" - << "Too few hits for the track reconstructions!\n"; + MsgStream log(Athena::getMessageSvc(), "QuasianalyticLineReconstruction"); + log<< MSG::WARNING << "Class QuasianalyticLineReconstruction, method fit: Too few hits for the track reconstructions!"<<endmsg; return false; } @@ -734,11 +717,8 @@ bool QuasianalyticLineReconstruction::fit(MuonCalibSegment & r_segment, time (&end); diff = difftime (end,start); if (diff>m_time_out) { - cerr << endl - << "Class QuasianalyticLineReconstruction: " - << "time-out for track finding after " - << m_time_out - << " seconds!\n"; + MsgStream log(Athena::getMessageSvc(), "QuasianalyticLineReconstruction"); + log<< MSG::WARNING << "Class QuasianalyticLineReconstruction, method fit: time-out for track finding after "<<m_time_out<<" seconds!"<<endmsg; return false; } @@ -754,7 +734,7 @@ bool QuasianalyticLineReconstruction::fit(MuonCalibSegment & r_segment, bool same(false); counter1 = 0; counter3 = 0; - vector<int> indices; // indices of the hits forming a + std::vector<int> indices; // indices of the hits forming a // track for (unsigned int n=0; n<nb_selected_hits; n++) { MTStraightLine aux_line(w[n], xhat, null, null); @@ -846,7 +826,7 @@ bool QuasianalyticLineReconstruction::fit(MuonCalibSegment & r_segment, m_track.positionVector(), m_track.directionVector()); - vector<unsigned int> refit_hit_selection(r_selection.size(), 1); + std::vector<unsigned int> refit_hit_selection(r_selection.size(), 1); for (int k=0; k<m_nb_track_hits; k++) { refit_hit_selection[selected_hits_index[ index_set[candidate][k]]] = 0; @@ -929,19 +909,3 @@ bool QuasianalyticLineReconstruction::fit(MuonCalibSegment & r_segment, return true; } - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD printLevel :: -//::::::::::::::::::::::: - -void QuasianalyticLineReconstruction::printLevel(int level) { - - cerr << "\n" - << "Class QuasianalyticLineReconstruction, " - << "method printLevel: WARNING!\n" - << "Print level " << level << " is ignored.\n"; - return; - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/StraightPatRec.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/StraightPatRec.cxx index 553fb620ad1a..4954e1ac2cea 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/StraightPatRec.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibFitters/src/StraightPatRec.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -13,34 +13,21 @@ // 01.12.2008 by I. Potrap, track() method and segment position are fixed //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//:::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS :: -//:: StraightPatRec :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibFitters/StraightPatRec.h" -#include <iostream> -#include <fstream> +#include "EventPrimitives/EventPrimitives.h" +#include "GeoPrimitives/GeoPrimitivesHelpers.h" #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Units/PhysicalConstants.h" - #include "MuonCalibMath/Combination.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" +#include <TString.h> // for Form #include "time.h" - -#include "EventPrimitives/EventPrimitives.h" -#include "GeoPrimitives/GeoPrimitivesHelpers.h" - -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: +#include <iostream> +#include <fstream> using namespace MuonCalib; -using namespace std; //***************************************************************************** @@ -147,12 +134,7 @@ MTStraightLine StraightPatRec::tangent( //:::::::::::::::::::::::::::::::::::::::::::: if (r_case<1 || r_case>4) { - cerr << endl - << "Class StraightPatRec, " - << "method tangent: ERROR!\n" - << "Illegal case " << r_case << ", must be 1,2,3, or 4." - << endl; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nStraightPatRec::tangent - Illegal case %i, must be 1,2,3, or 4.!", __FILE__, __LINE__, r_case)); } //::::::::::::::::::::::::::::::::::::: @@ -302,7 +284,7 @@ MTStraightLine StraightPatRec::fitCandidate(MuonCalibSegment & r_segment, Amg::MatrixX Gamma = Amg::MatrixX(NLC,NLC); Gamma.setZero(); // vector to store hit positions - vector<Amg::Vector3D > hit_position_track; + std::vector<Amg::Vector3D > hit_position_track; for(unsigned int l=0;l<r_segment.mdtHitsOnTrack();l++) { // Transformation to track reference frame @@ -403,7 +385,7 @@ unsigned int StraightPatRec::numberOfTrackHits(void) const { //:: METHOD trackHits :: //:::::::::::::::::::::: -const vector<const MdtCalibHitBase*> & StraightPatRec::trackHits( +const std::vector<const MdtCalibHitBase*> & StraightPatRec::trackHits( void) const { return m_track_hits; @@ -528,12 +510,12 @@ bool StraightPatRec::fitCallByReference(MuonCalibSegment & r_segment, double diff; // difference of start and end time (needed for time-out) Combination combination; - vector<unsigned int> hit_index; // hit indices for given selection + std::vector<unsigned int> hit_index; // hit indices for given selection unsigned int try_nb_hits; // try this given number of hits for the // segment reconstruction - vector<const MdtCalibHitBase*> selected_hits; - vector<unsigned int> selected_hits_index; + std::vector<const MdtCalibHitBase*> selected_hits; + std::vector<unsigned int> selected_hits_index; Amg::Vector3D w_min, w_max; // wire with the minimum local z coordinate, // wire with the maximum local z coordinate @@ -562,12 +544,8 @@ bool StraightPatRec::fitCallByReference(MuonCalibSegment & r_segment, m_chi2 = -1.0; if (r_segment.mdtHitsOnTrack() != r_selection.size()) { - cerr << "\n" - << "Class StraightPatRec, " - << "METHOD fit(., .): WARNING!\n" - << "Vector with selected hits unequal to the number " - << "of hits on the segment!\n" - << "The user selection will be ignored!\n"; + MsgStream log(Athena::getMessageSvc(), "StraightPatRec"); + log<<MSG::WARNING<< "fitCallByReference() - Vector with selected hits unequal to the number of hits on the segment! The user selection will be ignored!"<<endmsg; r_selection.clear(); r_selection.assign(r_segment.hitsOnTrack(), 0); } @@ -586,10 +564,6 @@ bool StraightPatRec::fitCallByReference(MuonCalibSegment & r_segment, /////////////////////////////////////////////////////////////////////////// if (selected_hits.size()<3) { -// cerr << "\n" -// << "Class StraightPatRec, " -// << "METHOD fit(., .): WARNING!\n" -// << "Too few hits for the track reconstructions!\n"; return false; } @@ -633,11 +607,6 @@ if(try_nb_hits<5 && (selected_hits.size()-try_nb_hits)>2) return false; time (&end); diff = difftime (end,start); if (diff>m_time_out) { -// cerr << endl -// << "Class StraightPatRec: " -// << "time-out for track finding after " -// << m_time_out -// << " seconds!\n"; return false; } @@ -779,19 +748,3 @@ if(try_nb_hits<5 && (selected_hits.size()-try_nb_hits)>2) return false; return true; } - -//***************************************************************************** - -//::::::::::::::::::::::: -//:: METHOD printLevel :: -//::::::::::::::::::::::: - -void StraightPatRec::printLevel(int level) { - - cerr << "\n" - << "Class StraightPatRec, " - << "method printLevel: WARNING!\n" - << "Print level " << level << " is ignored.\n"; - return; - -} diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/MdtCalibRt/RtCalibrationAnalytic.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/MdtCalibRt/RtCalibrationAnalytic.h index 83d4ac66fa30..709de228b094 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/MdtCalibRt/RtCalibrationAnalytic.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/MdtCalibRt/RtCalibrationAnalytic.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -373,8 +373,8 @@ private: // it will disappear when the t(r) will be // available in the MuonCalib framework - void display_segment(MuonCalibSegment * segment, - std::ofstream & outfile); + void display_segment(MuonCalibSegment* segment, + std::ofstream& outfile); RtRelationLookUp * performParabolicExtrapolation(const bool & min, const bool & max, diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/AdaptiveResidualSmoothing.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/AdaptiveResidualSmoothing.cxx index 5427fb0c8971..8d53d8eeeeb8 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/AdaptiveResidualSmoothing.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/AdaptiveResidualSmoothing.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -9,19 +9,6 @@ // - new way to determine the binning according to satatistics //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// standard C++ // -#include <algorithm> -#include <iostream> -#include <fstream> - -// ROOT // -#include "TSpline.h" - -// MuonCalib // #include "MuonCalibMath/BaseFunctionFitter.h" #include "MuonCalibMath/PolygonBase.h" #include "MuonCalibMath/ConstantContentBinMaker.h" @@ -29,26 +16,18 @@ #include "MdtCalibData/IRtRelation.h" #include "MuonCalibMath/DataPoint.h" #include "CLHEP/Matrix/Vector.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: +#include <TString.h> // for Form +#include <algorithm> +#include <iostream> +#include <fstream> +#include "TSpline.h" -using namespace std; using namespace CLHEP; using namespace MuonCalib; -//:::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS :: -//:: AdaptiveResidualSmoothing :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::: - -//***************************************************************************** - -//::::::::::::::::: -//:: CONSTRUCTOR :: -//::::::::::::::::: - AdaptiveResidualSmoothing::AdaptiveResidualSmoothing(void) { } @@ -128,13 +107,8 @@ bool AdaptiveResidualSmoothing::addResidualsFromSegment( fitter->SetRefineSegmentFlag(false); - // prepare hit selection to exclude the first hit from the fit // -// vector<unsigned int> hit_selection(seg.mdtHitsOnTrack(), 0); -// hit_selection[0] = 1; - // perform the track fit; return in case of failure // if (!fitter->fit(seg)) { -// cout << seg.mdtHitsOnTrack() << endl; return false; } @@ -180,26 +154,18 @@ RtRelationLookUp AdaptiveResidualSmoothing::performSmoothing( /////////////// ConstantContentBinMaker bin_maker(m_residual_point, 0.001); - vector<unsigned int> ref_coord(1); + std::vector<unsigned int> ref_coord(1); //////////// // CHECKS // //////////// if (m_residual_point.size()==0) { - cerr << endl - << "Class AdaptiveResidualSmoothing, method performSmoothing: " - << "ERROR!\n" - << "No residuals stored.\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nAdaptiveResidualSmoothing::performSmoothing - No residuals stored.", __FILE__, __LINE__)); } if (m_residual_point.size()<nb_entries_per_bin) { - cerr << endl - << "Class AdaptiveResidualSmoothing, method performSmoothing: " - << "ERROR!\n" - << "Not enough residuals stored.\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nAdaptiveResidualSmoothing::performSmoothing - Not enough residuals stored.", __FILE__, __LINE__)); } ///////////////////// @@ -214,20 +180,17 @@ RtRelationLookUp AdaptiveResidualSmoothing::performSmoothing( ////////////////////////////// // get a polygon through the bin centres // -// cout << "bin_maker.getBins().size()=" -// << bin_maker.getBins().size() << endl; - vector<double> rad(bin_maker.getBins().size()); - vector<SamplePoint> corr(bin_maker.getBins().size()); + std::vector<double> rad(bin_maker.getBins().size()); + std::vector<SamplePoint> corr(bin_maker.getBins().size()); for (unsigned int k=0; k<bin_maker.getBins().size(); k++) { rad[k] = (bin_maker.getBins()[k])->centreOfGravity()[0]; -// cout << "rad[" << k << "] = " << rad[k] << endl; corr[k].set_x1(rad[k]); corr[k].set_x2((bin_maker.getBins()[k])->centreOfGravity()[1]); corr[k].set_error(1.0); } sort(rad.begin(), rad.end()); - vector<double> radi; + std::vector<double> radi; radi.push_back(rad[0]); unsigned int counter(0); for (unsigned int k=1; k<rad.size(); k++) { @@ -242,25 +205,7 @@ RtRelationLookUp AdaptiveResidualSmoothing::performSmoothing( fitter.fit_parameters(corr, 1, corr.size(), &polygon); // create an improved r-t relationship // -// vector<double> rt_point; -// unsigned int nb_rt_points(60); -// double step_size((rt_rel.radius(rt_rel.tUpper())- -// rt_rel.radius(rt_rel.tLower()))/ -// static_cast<double>(nb_rt_points)); -// for (double r=rt_rel.radius(rt_rel.tLower()); -// r<=rt_rel.radius(rt_rel.tUpper()); r=r+step_size) { -// double t(t_from_r(rt_rel, r)); -// rt_point.push_back(t); -// double delta_r(0.0); -// for (unsigned int l=0; l<radi.size(); l++) { -// delta_r = delta_r+fitter.coefficients()[l]*polygon.value(l, -// rt_rel.radius(t)); -// } -// rt_point.push_back(rt_rel.radius(t)-delta_r); -// -// } -// RtSpline improved_rt(rt_point); - vector<double> rt_params; + std::vector<double> rt_params; rt_params.push_back(rt_rel.tLower()); rt_params.push_back(0.01*(rt_rel.tUpper()-rt_rel.tLower())); // ofstream outfile("out2.txt"); @@ -328,18 +273,14 @@ RtRelationLookUp AdaptiveResidualSmoothing::performSmoothing( //calculate min_nb_per_bin min_nb_entries_per_bin = m_residual_point.size() / nb_bins; - //cout << "min number of entries/bin: " << min_nb_entries_per_bin << endl; ////////////////////////////////////// // RETURN IF THERE ARE NO RESIDUALS // ////////////////////////////////////// if (m_residual_point.size()==0) { - cerr << endl - << "Class AdaptiveResidualSmoothing, " - << "performSmoothing(., ., .): WARNING!\n" - << "No residuals are stored. no correction applied to r(t)!\n" - << endl; + MsgStream log(Athena::getMessageSvc(), "AdaptiveResidualSmoothing"); + log<<MSG::WARNING<< "performSmoothing() - No residuals are stored. no correction applied to r(t)!"<<endmsg; } if (nb_bins==0) { @@ -352,8 +293,8 @@ RtRelationLookUp AdaptiveResidualSmoothing::performSmoothing( ////////////////////////////////////////////////////////////// // vector for the correction function // - vector<SamplePoint> corr(nb_bins); - vector<double> radii(nb_bins); + std::vector<SamplePoint> corr(nb_bins); + std::vector<double> radii(nb_bins); // sort the residuals point in the residual value for a simple outlyer // // rejection performed later // @@ -363,7 +304,7 @@ RtRelationLookUp AdaptiveResidualSmoothing::performSmoothing( sort(m_residual_point.begin(), m_residual_point.end()); // auxiliary data point arrays // - vector< vector<const DataPoint *> > sample_points_per_r_bin(nb_bins); + std::vector< std::vector<const DataPoint *> > sample_points_per_r_bin(nb_bins); // group data points in r bins // for (unsigned int k=0; k<m_residual_point.size(); k++) { @@ -415,7 +356,7 @@ RtRelationLookUp AdaptiveResidualSmoothing::performSmoothing( fitter.fit_parameters(corr, 1, corr.size(), &polygon); // create output r-t relationship // - vector<double> rt_params; + std::vector<double> rt_params; rt_params.push_back(rt_rel.tLower()); rt_params.push_back(0.01*(rt_rel.tUpper()-rt_rel.tLower())); // ofstream outfile("out2.txt"); diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationAnalytic.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationAnalytic.cxx index 34c065353e28..caab228a765f 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationAnalytic.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationAnalytic.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -24,12 +24,6 @@ // is now done after convergence/smoothing //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -#include "cmath" - #include "MdtCalibRt/RtCalibrationAnalytic.h" #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" #include "MdtCalibRt/RtCalibrationOutput.h" @@ -42,28 +36,21 @@ #include "MdtCalibRt/AdaptiveResidualSmoothing.h" #include "MdtCalibRt/RtParabolicExtrapolation.h" #include "MdtCalibData/RtFromPoints.h" - #include "MdtCalibData/IRtRelation.h" #include "MdtCalibData/RtRelationLookUp.h" #include "MdtCalibRt/RtCalibrationOutput.h" #include "MdtCalibInterfaces/IMdtCalibrationOutput.h" #include "MuonCalibEventBase/MuonCalibSegment.h" #include "MuonCalibMath/BaseFunction.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" - -//root +#include <TString.h> // for Form #include "TGraphErrors.h" - -//std #include "sstream" #include "cmath" -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: - using namespace MuonCalib; -using namespace std; //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS RtCalibrationAnalytic :: @@ -71,9 +58,7 @@ using namespace std; //***************************************************************************** - - -RtCalibrationAnalytic :: RtCalibrationAnalytic(std::string name, +RtCalibrationAnalytic::RtCalibrationAnalytic(std::string name, const double & rt_accuracy, const unsigned int & func_type, const unsigned int & ord, @@ -88,7 +73,7 @@ RtCalibrationAnalytic :: RtCalibrationAnalytic(std::string name, fix_min, fix_max, max_it, do_smoothing, do_parabolic_extrapolation); } -RtCalibrationAnalytic :: ~RtCalibrationAnalytic(void) { +RtCalibrationAnalytic::~RtCalibrationAnalytic(void) { if (m_base_function!=0) { delete m_base_function; } @@ -139,10 +124,7 @@ void RtCalibrationAnalytic::init(const double & rt_accuracy, m_max_it = abs(max_it); if (m_order==0) { - cerr << "\n" - << "Class RtCalibrationAnalytic, method init: ERROR!" - << "\nOrder of the correction polynomial must be >0!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationAnalytic::init - Order of the correction polynomial must be >0!", __FILE__, __LINE__)); } m_t_length = 1000.0; @@ -153,7 +135,7 @@ void RtCalibrationAnalytic::init(const double & rt_accuracy, m_rt_new = 0; m_output = 0; - m_U = vector<CLHEP::HepVector>(m_order); + m_U = std::vector<CLHEP::HepVector>(m_order); m_A = CLHEP::HepSymMatrix(m_order, 0); m_b = CLHEP::HepVector(m_order, 0); m_alpha = CLHEP::HepVector(m_order, 0); @@ -161,11 +143,7 @@ void RtCalibrationAnalytic::init(const double & rt_accuracy, // correction function if (func_type<1 || func_type>3) { m_base_function = 0; - cerr << "\n" - << "Class RtCalibrationAnalytic, method init: " - << "ERROR!\n" - << "Illegal correction function type!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationAnalytic::init - Illegal correction function type!", __FILE__, __LINE__)); } switch(func_type) { case 1: @@ -175,16 +153,10 @@ void RtCalibrationAnalytic::init(const double & rt_accuracy, m_base_function = new ChebyshevPolynomial; break; case 3: - if (m_order<2) { - cerr << "\n" - << "Class RtCalibrationAnalytic, " - << "method init: ERROR!\n" - << "Order must be >2 for polygons! " - << "It is set to " << m_order - << "by the user.\n"; - exit(1); + if (m_order<2) {\ + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationAnalytic::init - Order must be >2 for polygons! It is set to %i by the user.", __FILE__, __LINE__, m_order)); } - vector<double> x(m_order); + std::vector<double> x(m_order); double bin_width=2.0/static_cast<double>(m_order-1); for (unsigned int k=0; k<m_order; k++) { x[k] = -1+k*bin_width; @@ -242,7 +214,7 @@ double RtCalibrationAnalytic::t_from_r(const double & r) { //////////////////////////// // METHOD display_segment // //////////////////////////// -void RtCalibrationAnalytic::display_segment(MuonCalibSegment * segment, ofstream & outfile) { +void RtCalibrationAnalytic::display_segment(MuonCalibSegment* segment, std::ofstream& outfile) { /////////////// // VARIABLES // @@ -428,7 +400,7 @@ bool RtCalibrationAnalytic::smoothing(void) const { //::::::::::::::::::::::::::::::::::::::::: //:: METHOD switch_on_control_histograms :: //::::::::::::::::::::::::::::::::::::::::: -void RtCalibrationAnalytic::switch_on_control_histograms(const string & file_name) { +void RtCalibrationAnalytic::switch_on_control_histograms(const std::string& file_name) { ///////////////////////////////////////////// // CREATE THE ROOT FILE AND THE HISTOGRAMS // @@ -581,8 +553,10 @@ const IMdtCalibrationOutput * RtCalibrationAnalytic::analyseSegments( handleSegment(*seg[k]); } if(!analyse()) { + MsgStream log(Athena::getMessageSvc(), "RtCalibrationAnalytic"); + log<<MSG::WARNING<< "analyseSegments() - analyse failed, segments:"<<endmsg; for(unsigned int i=0; i<seg.size(); i++) { - std::cout<<i<<" "<<seg[i]->direction()<<" "<<seg[i]->position()<<std::endl; + log<<MSG::WARNING<<i<<" "<<seg[i]->direction()<<" "<<seg[i]->position()<<endmsg; } if(conv_rt) delete conv_rt; return NULL; @@ -595,7 +569,7 @@ const IMdtCalibrationOutput * RtCalibrationAnalytic::analyseSegments( } tmp_rt = rtOut->rt(); - vector<double> params; + std::vector<double> params; params.push_back(tmp_rt->tLower()); params.push_back(0.01*(tmp_rt->tUpper()-tmp_rt->tLower())); for (double t=tmp_rt->tLower(); t<=tmp_rt->tUpper(); t=t+params[1]) { @@ -681,40 +655,11 @@ const IMdtCalibrationOutput * RtCalibrationAnalytic::analyseSegments( // break, do no smoothing if there are not enough segments // if (counter<1000) { - cerr << "Class RtCalibrationAnalytic, no smoothing applied due to " - << "too small number of reconstructed segments!\n"; + MsgStream log(Athena::getMessageSvc(), "RtCalibrationAnalytic"); + log<<MSG::WARNING<< "analyseSegments() - no smoothing applied due to too small number of reconstructed segments"<<endmsg; return getResults(); } -// // break, do no smoothing if there are not enough segments // -// if (counter<250) { -// cerr << "Class RtCalibrationAnalytic, no smoothing applied due to " -// << "too small number of reconstructed segments!\n"; -// return getResults(); -// } -// -// // set bin content for residual bins // -// unsigned int bin_content(100); -// if (counter<500) { -// bin_content = 50; -// } -// if (counter>3000) { -// bin_content = 200; -// } -// if (counter>6000) { -// bin_content = 400; -// } -// if (counter>12000) { -// bin_content = 800; -// } -// if (counter>24000) { -// bin_content = seg.size()/60; -// } -// -// // smoothing // -// RtRelationLookUp smooth_rt(smoothing.performSmoothing(*tmp_rt, bin_content, -// m_fix_min, m_fix_max)); - // smoothing // RtRelationLookUp smooth_rt(smoothing.performSmoothing(*tmp_rt, m_fix_min, m_fix_max)); @@ -731,38 +676,14 @@ const IMdtCalibrationOutput * RtCalibrationAnalytic::analyseSegments( it++; // delete tmp_rt and update it // -// if (it>1) { -// delete tmp_rt; -// } delete tmp_rt; tmp_rt = new RtRelationLookUp(smooth_rt); -// cout << "1: " << tmp_rt << endl; //---------------------------------------------------------------------------// } //---------------------------------------------------------------------------// //---------------------------------------------------------------------------// -// // r-t format conversion // -// vector<double> rt_params; -// rt_params.push_back(tmp_rt->tLower()); -// rt_params.push_back(0.01*(tmp_rt->tUpper()-tmp_rt->tLower())); -// for (double t=tmp_rt->tLower(); t<=tmp_rt->tUpper(); t=t+rt_params[1]) { -// rt_params.push_back(tmp_rt->radius(t)); -// } -// RtRelationLookUp *improved_rt = new RtRelationLookUp(rt_params); - -// ofstream out1("out1.txt"); -// for (double t=conv_rt->tLower(); t<=conv_rt->tUpper(); t=t+5.0) { -// out1 << t << "\t" << tmp_rt->radius(t) << "\t" -// << conv_rt->radius(t) -// << endl; -// } - -// -// // m_output = new RtCalibrationOutput(smooth_rt, -// // new RtFullInfo("RtCalibrationAnalytic", m_iteration, -// // m_nb_segments_used, 0.0, 0.0, 0.0, 0.0)); delete m_output; m_output = new RtCalibrationOutput(tmp_rt, new RtFullInfo("RtCalibrationAnalytic", m_iteration, m_nb_segments_used, 0.0, 0.0, 0.0, 0.0)); @@ -816,15 +737,15 @@ bool RtCalibrationAnalytic::handleSegment(MuonCalibSegment & seg) { unsigned int nb_hits_in_ml[2]; // number of hits in the multilayers double x; // reduced time = (r(t)-0.5*m_r_max)/(0.5*m_r_max) MTStraightLine track; // refitted straight line - vector<double> d_track; // signed distances of the track from the anode wires of the tubes - vector<double> residual_value; // residuals - vector<MTStraightLine> w; // anode wires + std::vector<double> d_track; // signed distances of the track from the anode wires of the tubes + std::vector<double> residual_value; // residuals + std::vector<MTStraightLine> w; // anode wires Amg::Vector3D null(0.0, 0.0, 0.0); // auxiliary 0 vector Amg::Vector3D xhat(1.0, 0.0, 0.0); // auxiliary unit vector // objects needed to calculate the autocalibration matrix and vector // CLHEP::HepVector G; // vector used in the calculation of the autocalibration matrix - vector<double> zeta; // vector used in the calculation of G + std::vector<double> zeta; // vector used in the calculation of G /////////////////////////////////////// // PREPARATION FOR THE SEGMENT REFIT // @@ -952,18 +873,14 @@ bool RtCalibrationAnalytic::handleSegment(MuonCalibSegment & seg) { m_chi2 = m_chi2+m_tracker.chi2PerDegreesOfFreedom(); m_nb_segments_used = m_nb_segments_used+1; -// debug display // -// display_segment(&seg, display); -// display << "MESSAGE CONTINUE\n"; - // fill the autocalibration objects // // auxiliary variables // track = m_tracker.track(); // refitted track - d_track = vector<double>(m_tracker.numberOfTrackHits()); - residual_value = vector<double>(m_tracker.numberOfTrackHits()); - w = vector<MTStraightLine>(m_tracker.numberOfTrackHits()); + d_track = std::vector<double>(m_tracker.numberOfTrackHits()); + residual_value = std::vector<double>(m_tracker.numberOfTrackHits()); + w = std::vector<MTStraightLine>(m_tracker.numberOfTrackHits()); G = CLHEP::HepVector(m_tracker.numberOfTrackHits()); - zeta = vector<double>(m_tracker.numberOfTrackHits()); + zeta = std::vector<double>(m_tracker.numberOfTrackHits()); // base function values // for (unsigned int l=0; l<m_order; l++) { @@ -1051,11 +968,7 @@ void RtCalibrationAnalytic::setInput(const IMdtCalibrationOutput * rt_input) { // CHECK IF THE OUTPUT CLASS IS SUPPORTED // //////////////////////////////////////////// if (input==0) { - cerr << endl - << "Class RtCalibrationAnalytic, " - << "method setInput: ERROR!\n" - << "Calibration input class not supported.\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationAnalytic::setInput - Calibration input class not supported.", __FILE__, __LINE__)); } ///////////////////////////////////////////////////////////////// @@ -1079,11 +992,7 @@ void RtCalibrationAnalytic::setInput(const IMdtCalibrationOutput * rt_input) { const RtRelationLookUp *rt_LookUp(dynamic_cast<const RtRelationLookUp *>(m_rt)); if (rt_Chebyshev==0 && rt_LookUp==0) { - cerr << endl - << "Class RtCalibrationAnalytic, " - << "method setInput: ERROR!\n" - << "r-t class not supported.\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationAnalytic::setInput - r-t class not supported.", __FILE__, __LINE__)); } // RtChebyshev // @@ -1119,7 +1028,7 @@ bool RtCalibrationAnalytic::analyse(void) { const RtChebyshev *rt_Chebyshev(dynamic_cast<const RtChebyshev *>(m_rt)); const RtRelationLookUp *rt_LookUp(dynamic_cast<const RtRelationLookUp *>(m_rt)); double r_corr; // radial correction - vector<double> rt_param(m_rt->nPar()); // parameters for the new r-t + std::vector<double> rt_param(m_rt->nPar()); // parameters for the new r-t double x; // reduced time RtParabolicExtrapolation rt_extrapolator; // r-t extrapolator RtFromPoints rt_from_points; // r-t from points @@ -1129,11 +1038,8 @@ bool RtCalibrationAnalytic::analyse(void) { //////////////////////////////////////// m_alpha = m_A.inverse(ifail)*m_b; if (ifail!=0) { - cerr << endl - << "Class RtCalibrationAnalytic, method analyse: ERROR!" - << endl - << "Could not solve the autocalibration equation!" - << endl; + MsgStream log(Athena::getMessageSvc(), "RtCalibrationAnalytic"); + log<<MSG::WARNING<< "analyse() - Could not solve the autocalibration equation!"<<endmsg; return false; } @@ -1155,7 +1061,7 @@ bool RtCalibrationAnalytic::analyse(void) { step = m_r_max/static_cast<double>(nb_points); // sample points and Chebyshev fitter // - vector<SamplePoint> x_r(nb_points+1); + std::vector<SamplePoint> x_r(nb_points+1); BaseFunctionFitter fitter(rt_Chebyshev->numberOfRtParameters()); ChebyshevPolynomial chebyshev; @@ -1214,24 +1120,6 @@ bool RtCalibrationAnalytic::analyse(void) { delete m_rt_new; } m_rt_new = new RtChebyshev(rt_param); - - // parabolic extrapolation // commented, as extr. to end-point is done after convergence -/* if (m_do_parabolic_extrapolation) { - RtRelationLookUp tmprt(performParabolicExtrapolation(false, true, - *m_rt_new)); - if (m_rt_new!=0) { - delete m_rt_new; - } - - vector<SamplePoint> t_r(nb_points+1); - for (unsigned int k=0; k<nb_points+1; k++) { - t_r[k].set_x1(t_from_r(k*step)); - t_r[k].set_x2(tmprt.radius(k*step)); - t_r[k].set_error(1.0); - } - m_rt_new = new RtChebyshev(rt_from_points.getRtChebyshev(t_r, - rt_Chebyshev->numberOfRtParameters())); - }*/ } // input-rt is of type RtRelationLookUp // @@ -1275,16 +1163,6 @@ bool RtCalibrationAnalytic::analyse(void) { } m_r_max = m_rt_new->radius(m_rt_new->tUpper()); - // parabolic extrapolation // -// if (m_do_parabolic_extrapolation) { -// RtRelationLookUp tmprt(performParabolicExtrapolation(false, true, -// *m_rt_new)); -// if (m_rt_new!=0) { -// delete m_rt_new; -// } -// m_rt_new = new RtRelationLookUp(tmprt); -// } -// } ///////////////////////////////////////////////////////// @@ -1293,7 +1171,6 @@ bool RtCalibrationAnalytic::analyse(void) { // estimate r-t accuracy // m_rt_accuracy = 0.0; - // double m_rt_accuracy_diff = 0.0; double r_corr_max =0.0; for (unsigned int k=0; k<100; k++) { @@ -1308,18 +1185,11 @@ bool RtCalibrationAnalytic::analyse(void) { m_rt_accuracy = m_rt_accuracy+r_corr*r_corr; } m_rt_accuracy = sqrt(0.01*m_rt_accuracy); - // m_rt_accuracy_diff = m_rt_accuracy_previous - m_rt_accuracy; m_rt_accuracy_previous = m_rt_accuracy; // convergence? // m_chi2 = m_chi2/static_cast<double>(m_nb_segments_used); - // cout << "------------------ ITERATION: "<< m_iteration <<" ---------------------- " << endl; - // cout << " CHI2:\t" << m_chi2 <<endl; - // cout << " CORDUNC.DIFF:\t" << fabs(m_rt_accuracy_diff) << endl; - // cout << " Accuracy Guess:\t" << fabs(m_rt_accuracy) << endl; - // if ((m_chi2<=m_chi2_previous || fabs(m_rt_accuracy_diff)>0.001) && - // m_iteration<m_max_it) { if ( ((m_chi2<m_chi2_previous && fabs(m_chi2-m_chi2_previous)>0.01) || fabs(m_rt_accuracy)>0.001) && m_iteration<m_max_it) { m_status = 0; // no convergence yet @@ -1388,7 +1258,7 @@ RtRelationLookUp * RtCalibrationAnalytic::performParabolicExtrapolation( RtRelationLookUp *rt_low(0), *rt_high(0); // pointers to the r-t // relationships after // extrapolation - vector<SamplePoint> add_fit_point; // additional r-t points used if r(0) or + std::vector<SamplePoint> add_fit_point; // additional r-t points used if r(0) or // r(t_max) is fixed. //////////////////////////////// diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationCurved.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationCurved.cxx index 05a151e30805..5d223bc695fe 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationCurved.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationCurved.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -22,14 +22,6 @@ // (important to reduce oscillations in r(t) relationship) //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS RtCalibrationCurved :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibRt/RtCalibrationCurved.h" #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" #include "MdtCalibRt/RtCalibrationOutput.h" @@ -43,7 +35,6 @@ #include "MdtCalibRt/RtParabolicExtrapolation.h" #include "MdtCalibData/RtFromPoints.h" #include "MdtCalibRt/AdaptiveResidualSmoothing.h" - #include "MdtCalibInterfaces/IMdtCalibrationOutput.h" #include "MdtCalibData/IRtRelation.h" #include "MdtCalibData/RtRelationLookUp.h" @@ -52,20 +43,15 @@ #include "MdtCalibFitters/CurvedPatRec.h" #include "MuonCalibEventBase/MuonCalibSegment.h" #include "MuonCalibMath/BaseFunction.h" - #include "MultilayerRtDifference.h" - +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" #include "sstream" #include "TF1.h" #include "TProfile.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - using namespace MuonCalib; -using namespace std; inline Double_t RtCalibrationCurved_polfun(Double_t *x, Double_t *par) { return par[0] * RtScalePolynomial(x[0]); @@ -333,9 +319,10 @@ const IMdtCalibrationOutput * RtCalibrationCurved::analyseSegments(const std::ve handleSegment(*seg[k]); } if(!analyse(seg)) { + MsgStream log(Athena::getMessageSvc(), "RtCalibrationCurved"); + log<<MSG::WARNING<< "analyseSegments() - analyse failed, segments:"<<endmsg; for(unsigned int i=0; i<seg.size(); i++) { - std::cout << i << " " << seg[i]->direction() <<" " - << seg[i]->position() << std::endl; + log<<MSG::WARNING<<i<<" "<<seg[i]->direction()<<" "<<seg[i]->position()<<endmsg; } return NULL; } @@ -427,8 +414,8 @@ const IMdtCalibrationOutput * RtCalibrationCurved::analyseSegments(const std::ve // break, do no smoothing if there are not enough segments // if (counter<1000) { - cerr << "Class RtCalibrationCurved, no smoothing applied due to " - << "too small number of reconstructed segments!\n"; + MsgStream log(Athena::getMessageSvc(), "RtCalibrationCurved"); + log<<MSG::WARNING<< "analyseSegments() - too small number of reconstructed segments!"<<endmsg; // final residuals // double r, d; for (unsigned int k=0; k<seg.size(); k++) { @@ -537,14 +524,14 @@ bool RtCalibrationCurved::handleSegment(MuonCalibSegment & seg) { // hit selection vectors for refits unsigned int nb_hits_in_ml; // number of hits in the multilayers double x; // reduced time = (r(t)-0.5*m_r_max)/(0.5*m_r_max) - vector<double> d_track; // signed distances of the track from the anode + std::vector<double> d_track; // signed distances of the track from the anode // wires of the tubes - vector<MTStraightLine> w; // anode wires + std::vector<MTStraightLine> w; // anode wires Amg::Vector3D null(0.0, 0.0, 0.0); // auxiliary 0 vector Amg::Vector3D xhat(1.0, 0.0, 0.0); // auxiliary unit vector // objects needed to calculate the autocalibration matrix and vector // - vector<CLHEP::HepVector> F; // auxiliary vectors for the calculation of the + std::vector<CLHEP::HepVector> F; // auxiliary vectors for the calculation of the // track cooeffients matrix CLHEP::HepVector residual_value; // residuals values CLHEP::HepVector weighted_residual; // residual values weighted by the inverse @@ -556,9 +543,6 @@ bool RtCalibrationCurved::handleSegment(MuonCalibSegment & seg) { // PREPARATION FOR THE SEGMENT REFIT // /////////////////////////////////////// -// debug display // -// display_segment(&seg, display); - // overwrite the drift radii according to the input r-t relationship, // // calculate the average spatial resolution to define a road width, // // select the hits in the chamber // @@ -574,7 +558,6 @@ bool RtCalibrationCurved::handleSegment(MuonCalibSegment & seg) { } // overwrite radius // - // std::cout<<"XXxxXX "<<m_rt->GetTmaxDiff()<<std::endl; seg.mdtHOT()[k]->setDriftRadius(m_rt->radius( seg.mdtHOT()[k]->driftTime()), aux_res); @@ -655,14 +638,10 @@ bool RtCalibrationCurved::handleSegment(MuonCalibSegment & seg) { m_chi2 = m_chi2+m_tracker->chi2PerDegreesOfFreedom(); m_nb_segments_used = m_nb_segments_used+1; -// debug display // -// display_segment(&seg, display); -// display << "MESSAGE CONTINUE\n"; - // fill the autocalibration objects // // track coeffient matrix and its inverse // - F = vector<CLHEP::HepVector>(m_tracker->numberOfTrackHits()); + F = std::vector<CLHEP::HepVector>(m_tracker->numberOfTrackHits()); for (unsigned int h=0; h<m_tracker->numberOfTrackHits(); h++) { const MdtCalibHitBase &hb=*(m_tracker->trackHits()[h]); m_multilayer_rt_difference->Fill(hb, *m_rt); @@ -690,17 +669,15 @@ bool RtCalibrationCurved::handleSegment(MuonCalibSegment & seg) { int ifail; m_M_track_inverse = m_M_track.inverse(ifail); if (ifail!=0) { - cerr << endl - << "Class RtCalibrationCurved, method handleSegment: WARNING!" - << endl - << "Could not invert track matrix!\n"; + MsgStream log(Athena::getMessageSvc(), "RtCalibrationCurved"); + log<<MSG::WARNING<< "handleSegment() - Could not invert track matrix!"<<endmsg; return true; } // Jacobian matrix for the residuals // // track distances, residuals, corrections // - d_track = vector<double>(m_tracker->numberOfTrackHits()); - w = vector<MTStraightLine>(m_tracker->numberOfTrackHits()); + d_track = std::vector<double>(m_tracker->numberOfTrackHits()); + w = std::vector<MTStraightLine>(m_tracker->numberOfTrackHits()); residual_value = CLHEP::HepVector(m_tracker->numberOfTrackHits()); weighted_residual = CLHEP::HepVector(m_tracker->numberOfTrackHits()); for (unsigned int l=0; l<m_order; l++) { @@ -724,55 +701,6 @@ bool RtCalibrationCurved::handleSegment(MuonCalibSegment & seg) { } } -// test track matrix // -// static ofstream outfile("tmp.txt"); -// CLHEP::HepVector my_b(3); -// for (int p=0; p<my_b.num_row(); p++) { -// my_b[p] = 0.0; -// for (unsigned int h=0; h<m_tracker->numberOfTrackHits(); h++) { -// // my_b[p] = my_b[p]+m_Legendre->value(p, (m_tracker->trackHits( -// // )[h]->localPosition()).z())* -// // ( -// // +(2*d_track[h]>=0-1)*m_tracker->trackHits()[h]->driftRadius() -// // +(m_tracker->trackHits()[h]->localPosition()).y() -// // /sqrt(1.0+std::pow((track.getTangent( -// // (m_tracker->trackHits( -// // )[h]->localPosition()).z())).a_x2(), 2)) -// // ) -// // /( -// // (m_tracker->trackHits()[h])->sigma2DriftRadius() -// // *sqrt(1.0+std::pow((track.getTangent( -// // (m_tracker->trackHits( -// // )[h]->localPosition()).z())).a_x2(), 2)) -// // ); -// my_b[p] = my_b[p]+((m_tracker->trackHits()[h]->localPosition()).y() -// +(2*(d_track[h]>=0)-1) -// *sqrt(1.0+std::pow((track.getTangent( -// (m_tracker->trackHits( -// )[h]->localPosition()).z())).a_x2() ,2)) -// *m_tracker->trackHits()[h]->driftRadius()) -// *m_Legendre->value(p, (m_tracker->trackHits( -// )[h]->localPosition()).z()) -// /((m_tracker->trackHits()[h])->sigma2DriftRadius() -// *(1.0+std::pow((track.getTangent( -// (m_tracker->trackHits( -// )[h]->localPosition()).z())).a_x2() ,2))); -// } -// } -// CLHEP::HepVector my_alpha(3); -// my_alpha = m_M_track_inverse*my_b; -// for (unsigned int h=0; h<m_tracker->numberOfTrackHits(); h++) { -// double ypos(0.0); -// for (unsigned int p=0; p<3; p++) { -// ypos = ypos+my_alpha[p]*m_Legendre->value(p, (m_tracker->trackHits( -// )[h]->localPosition()).z()); -// } -// outfile << (m_tracker->trackHits()[h]->localPosition()).z() << "\t" -// << m_tracker->curvedTrack().getPointOnLine( -// (m_tracker->trackHits()[h]->localPosition()).z()).y() -// << "\t" << ypos << endl; -// } - // Jacobian // D = CLHEP::HepMatrix(m_tracker->numberOfTrackHits(), m_tracker->numberOfTrackHits()); for (unsigned int h=0; h<m_tracker->numberOfTrackHits(); h++) { @@ -785,7 +713,7 @@ bool RtCalibrationCurved::handleSegment(MuonCalibSegment & seg) { // autocalibration objects // // errors of the residuals // - vector<double> sigma_residual(m_tracker->numberOfTrackHits(), 0.0); + std::vector<double> sigma_residual(m_tracker->numberOfTrackHits(), 0.0); for (unsigned int h=0; h<m_tracker->numberOfTrackHits(); h++) { for (unsigned int hp=0; hp<m_tracker->numberOfTrackHits(); hp++) { sigma_residual[h] = sigma_residual[h]+std::pow(D[h][hp]*(m_tracker->trackHits()[hp])->sigmaDriftRadius(), 2); @@ -854,11 +782,7 @@ void RtCalibrationCurved::setInput(const IMdtCalibrationOutput * rt_input) { // CHECK IF THE OUTPUT CLASS IS SUPPORTED // //////////////////////////////////////////// if (input==0) { - cerr << endl - << "Class RtCalibrationCurved, " - << "method setInput: ERROR!\n" - << "Calibration input class not supported.\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationCurved::setInput - Calibration input class not supported.", __FILE__, __LINE__)); } ///////////////////////////////////////////////////////////////// @@ -881,11 +805,7 @@ void RtCalibrationCurved::setInput(const IMdtCalibrationOutput * rt_input) { const RtRelationLookUp *rt_LookUp(dynamic_cast<const RtRelationLookUp *>(m_rt)); if (rt_Chebyshev==0 && rt_LookUp==0) { - cerr << endl - << "Class RtCalibrationCurved, " - << "method setInput: ERROR!\n" - << "r-t class not supported.\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationCurved::setInput - r-t class not supported.", __FILE__, __LINE__)); } // RtChebyshev // @@ -914,13 +834,12 @@ bool RtCalibrationCurved::analyse(const std::vector<MuonCalibSegment*> & seg) { // VARIABLES // /////////////// int ifail; // flag indicating a failure of the matrix inversion - unsigned int nb_points(30); // number of points used to set the new - // r-t relationship + unsigned int nb_points(30); // number of points used to set the new r-t relationship double step; // r step size const RtChebyshev *rt_Chebyshev(dynamic_cast<const RtChebyshev *>(m_rt)); const RtRelationLookUp *rt_LookUp(dynamic_cast<const RtRelationLookUp *>(m_rt)); double r_corr; // radial correction - vector<double> rt_param(m_rt->nPar()); // parameters for the new r-t + std::vector<double> rt_param(m_rt->nPar()); // parameters for the new r-t double x; // reduced time RtFromPoints rt_from_points; // r-t from points @@ -930,11 +849,8 @@ bool RtCalibrationCurved::analyse(const std::vector<MuonCalibSegment*> & seg) { m_alpha = m_A.inverse(ifail)*m_b; if (ifail!=0) { - cerr << endl - << "Class RtCalibrationCurved, method analyse: ERROR!" - << endl - << "Could not solve the autocalibration equation!" - << endl; + MsgStream log(Athena::getMessageSvc(), "RtCalibrationCurved"); + log<<MSG::WARNING<< "analyse() - Could not solve the autocalibration equation!"<<endmsg; return false; } @@ -954,7 +870,7 @@ bool RtCalibrationCurved::analyse(const std::vector<MuonCalibSegment*> & seg) { step = m_r_max/static_cast<double>(nb_points); // sample points and Chebyshev fitter // - vector<SamplePoint> x_r(nb_points+1); + std::vector<SamplePoint> x_r(nb_points+1); BaseFunctionFitter fitter(rt_Chebyshev->numberOfRtParameters()); ChebyshevPolynomial chebyshev; @@ -1008,48 +924,6 @@ bool RtCalibrationCurved::analyse(const std::vector<MuonCalibSegment*> & seg) { m_rt_new = new RtChebyshev(rt_param); m_rt_new->SetTmaxDiff(m_rt->GetTmaxDiff()); - // parabolic extrapolation // - /* - if (m_do_parabolic_extrapolation) { - RtRelationLookUp tmprt(performParabolicExtrapolation(false, true, - *m_rt_new)); -// vector<SamplePoint> add_fit_point; -// if (m_fix_min) { -// add_fit_point.push_back( -// SamplePoint(m_rt_new->tLower(), 0.0, 1.0)); -// } -// RtRelationLookUp tmp_rt(rt_extrapolator.getRtWithParabolicExtrapolation( -// *m_rt_new, -// m_rt_new->radius(m_rt_new->tLower())+1.0, -// m_rt_new->radius(m_rt_new->tLower())+3.0, -// m_rt_new->radius(m_rt_new->tLower()), -// add_fit_point)); -// add_fit_point.clear(); -// if (m_fix_max) { -// add_fit_point.push_back( -// SamplePoint(m_rt_new->tUpper(), m_r_max, 1.0)); -// } -// RtRelationLookUp tmprt(rt_extrapolator.getRtWithParabolicExtrapolation( -// tmp_rt, -// m_rt_new->radius(m_rt_new->tUpper())-1.0, -// m_rt_new->radius(m_rt_new->tUpper())-3.0, -// m_rt_new->radius(m_rt_new->tUpper()), -// add_fit_point)); - - if (m_rt_new!=0) { - delete m_rt_new; - } - - vector<SamplePoint> t_r(nb_points+1); - for (unsigned int k=0; k<nb_points+1; k++) { - t_r[k].set_x1(t_from_r(k*step)); - t_r[k].set_x2(tmprt.radius(k*step)); - t_r[k].set_error(1.0); - } - m_rt_new = new RtChebyshev(rt_from_points.getRtChebyshev(t_r, - rt_Chebyshev->numberOfRtParameters())); - } -*/ } // input-rt is of type RtRelationLookUp // @@ -1083,46 +957,6 @@ bool RtCalibrationCurved::analyse(const std::vector<MuonCalibSegment*> & seg) { } m_rt_new = new RtRelationLookUp(rt_param); m_rt_new->SetTmaxDiff(m_rt->GetTmaxDiff()); - // parabolic extrapolation // -/* - if (m_do_parabolic_extrapolation) { - RtRelationLookUp tmprt(performParabolicExtrapolation(false, true, - *m_rt_new)); -// vector<SamplePoint> add_fit_point; -// // if (m_fix_min) { -// // add_fit_point.push_back( -// // SamplePoint(m_rt_new->tLower(), 0.0, 1.0)); -// // } -// // // RtRelationLookUp tmp_rt(rt_extrapolator.getRtWithParabolicExtrapolation( -// // // *m_rt_new, -// // // m_rt_new->radius(m_rt_new->tLower())+1.0, -// // // m_rt_new->radius(m_rt_new->tLower())+3.0, -// // // m_rt_new->radius(m_rt_new->tLower()), -// // // add_fit_point)); -// // RtRelationLookUp tmp_rt(rt_extrapolator.getRtWithParabolicExtrapolation( -// // *m_rt_new, -// // 1.2, -// // 3.0, -// // 0.0, -// // add_fit_point)); -// // add_fit_point.clear(); -// if (m_fix_max) { -// add_fit_point.push_back( -// SamplePoint(m_rt_new->tUpper(), m_r_max, 1.0)); -// } -// RtRelationLookUp tmprt(rt_extrapolator.getRtWithParabolicExtrapolation( -// *m_rt_new, -// m_r_max-1.0, -// m_r_max-3.0, -// m_r_max, -// add_fit_point)); - - if (m_rt_new!=0) { - delete m_rt_new; - } - m_rt_new = new RtRelationLookUp(tmprt); - } -*/ } ///////////////////////////////////////////////////////// @@ -1173,7 +1007,6 @@ bool RtCalibrationCurved::analyse(const std::vector<MuonCalibSegment*> & seg) { if(m_iteration>0 && m_do_multilayer_rt_scale) { m_multilayer_rt_difference->DoFit(m_rt_new, &seg); } else { - // std::cout<<"No update in first iteration!"<<std::endl; m_multilayer_rt_difference->DoFit(); } @@ -1256,10 +1089,7 @@ void RtCalibrationCurved::init(const double & rt_accuracy, m_tracker = new CurvedPatRec; if (m_order==0) { - cerr << "\n" - << "Class RtCalibrationCurved, method init: ERROR!" - << "\nOrder of the correction polynomial must be >0!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationCurved::init - Order of the correction polynomial must be >0!", __FILE__, __LINE__)); } m_t_length = 1000.0; @@ -1270,8 +1100,8 @@ void RtCalibrationCurved::init(const double & rt_accuracy, m_rt_new = 0; m_output = 0; - m_U = vector<CLHEP::HepVector>(m_order); - m_U_weighted = vector<CLHEP::HepVector>(m_order); + m_U = std::vector<CLHEP::HepVector>(m_order); + m_U_weighted = std::vector<CLHEP::HepVector>(m_order); m_A = CLHEP::HepSymMatrix(m_order, 0); m_b = CLHEP::HepVector(m_order, 0); m_alpha = CLHEP::HepVector(m_order, 0); @@ -1279,11 +1109,7 @@ void RtCalibrationCurved::init(const double & rt_accuracy, // correction function if (func_type<1 || func_type>3) { m_base_function = 0; - cerr << "\n" - << "Class RtCalibrationCurved, method init: " - << "ERROR!\n" - << "Illegal correction function type!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationCurved::init - Illegal correction function type!", __FILE__, __LINE__)); } switch(func_type) { case 1: @@ -1294,15 +1120,9 @@ void RtCalibrationCurved::init(const double & rt_accuracy, break; case 3: if (m_order<2) { - cerr << "\n" - << "Class RtCalibrationCurved, " - << "method init: ERROR!\n" - << "Order must be >2 for polygons! " - << "It is set to " << m_order - << "by the user.\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nRtCalibrationCurved::init - Order must be >2 for polygons! It is set to %i by the user.", __FILE__, __LINE__, m_order)); } - vector<double> x(m_order); + std::vector<double> x(m_order); double bin_width=2.0/static_cast<double>(m_order-1); for (unsigned int k=0; k<m_order; k++) { x[k] = -1+k*bin_width; @@ -1501,7 +1321,7 @@ RtRelationLookUp * RtCalibrationCurved::performParabolicExtrapolation( /////////////// RtParabolicExtrapolation rt_extrapolator; // r-t extrapolator RtRelationLookUp *rt_low(0), *rt_high(0); // pointers to the r-t relationships after extrapolation - vector<SamplePoint> add_fit_point; // additional r-t points used if r(0) or r(t_max) is fixed. + std::vector<SamplePoint> add_fit_point; // additional r-t points used if r(0) or r(t_max) is fixed. //////////////////////////////// // EXTRAPOLATE TO LARGE RADII // diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationIntegration.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationIntegration.cxx index 4fe22311935a..5036eccfe74c 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationIntegration.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtCalibrationIntegration.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -15,33 +15,20 @@ // //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS RtCalibrationIntegration :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// standard C++ // #include <algorithm> #include <iostream> #include <fstream> -// MuonCalib // #include "MdtCalibRt/RtCalibrationIntegration.h" #include "MdtCalibT0/T0MTHistos.h" #include "MdtCalibData/RtFromPoints.h" #include "MdtCalibRt/RtParabolicExtrapolation.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" -//root// #include "TF1.h" #include "TList.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: -using namespace std; using namespace MuonCalib; inline Double_t slope_function_C(Double_t *x, Double_t *par) { @@ -65,9 +52,6 @@ inline void update_parameter_on_mttmax(TH1 * h, TF1 *f, const float &b, const fl f->FixParameter(T0MTHistos::TMAX_PAR_NR_A, slope_function->GetParameter(0)); f->FixParameter(T0MTHistos::TMAX_PAR_NR_B, b); f->FixParameter(T0MTHistos::TMAX_PAR_NR_T, T); -// std::cout<<"LLllLL "<<slope_function->GetParameter(0)<<" "<<b<<std::endl; -// std::cout<<"LLllLL "<<f->GetParameter(T0MTHistos::TMAX_PAR_NR_A)<<" "<<f->GetParameter(T0MTHistos::TMAX_PAR_NR_B)<<std::endl; - } //***************************************************************************** @@ -194,7 +178,7 @@ bool RtCalibrationIntegration::analyse(void) { // used in the integration procedure unsigned int nb_bins(100); // number of integration bins double bin_content; // number of entries per bin - vector<SamplePoint> point(nb_bins+1); // (t, r) points + std::vector<SamplePoint> point(nb_bins+1); // (t, r) points double radius(0.0); // r(t) double scf=0.; // scale factor (r_max/number of used hits) RtFromPoints rt_from_points; // r-t converter @@ -204,11 +188,8 @@ bool RtCalibrationIntegration::analyse(void) { /////////////////////////////////////////////////////////////////////////// if (m_t_drift.size()<2000) { - cerr << endl - << "Class RtCalibrationIntegration, method analyse: " - << "FAILURE!\n" - << "Less than 2000 drift-time entries! No r-t " - << "relationship will be determined!\n"; + MsgStream log(Athena::getMessageSvc(), "RtCalibrationIntegration"); + log<<MSG::WARNING<< "analyse() - Less than 2000 drift-time entries! No r-t relationship will be determined!"<<endmsg; return false; } @@ -241,22 +222,16 @@ bool RtCalibrationIntegration::analyse(void) { // t0 and tmax fits // if (!drift_time_spec.FitT0() || !drift_time_spec.T0Ok()) { - cerr << endl - << "Class RtCalibrationIntegration, method analyse: " - << "FAILURE!\n" - << "t0 fit not successful, no r-t relationship will be " - << "calculated!\n"; + MsgStream log(Athena::getMessageSvc(), "RtCalibrationIntegration"); + log<<MSG::WARNING<< "analyse() - t0 fit not successful, no r-t relationship will be calculated!"<<endmsg; return false; } t0 = drift_time_spec.GetT0Function()->GetParameter( T0MTHistos::T0_PAR_NR_T0); if (!drift_time_spec.FitTmax() || !drift_time_spec.TmaxOk()) { - cerr << endl - << "Class RtCalibrationIntegration, method analyse: " - << "FAILURE!\n" - << "tmax fit not successful, no r-t relationship will " - << "be calculated!\n"; + MsgStream log(Athena::getMessageSvc(), "RtCalibrationIntegration"); + log<<MSG::WARNING<< "analyse() - tmax fit not successful, no r-t relationship will be calculated!"<<endmsg; return false; } tmax = drift_time_spec.GetTMaxFunction()->GetParameter( @@ -298,21 +273,13 @@ bool RtCalibrationIntegration::analyse(void) { point[nb_bins].set_x2(m_r_max); point[nb_bins].set_error(1.); - - /*//dump points - for(unsigned int i=0; i<point.size(); i++) - { - std::cout<<i<<" "<<point[i].x1()<<" "<<point[i].x2()<<" "<<point[i].error()<<std::endl; - }*/ - // get the r-t relationship // m_rt = new RtChebyshev(rt_from_points.getRtChebyshev(point, 15)); - // m_rt = new RtRelationLookUp(rt_from_points.getRtRelationLookUp(point)); /////////////////////////////////////////////////// // PARABOLIC EXTRAPOLATION FOR LARGE DRIFT RADII // /////////////////////////////////////////////////// - vector<SamplePoint> add_fit_point; // additional r-t points for r(t_max) + std::vector<SamplePoint> add_fit_point; // additional r-t points for r(t_max) add_fit_point.push_back(SamplePoint(tmax,m_r_max, 1.0)); RtParabolicExtrapolation rt_extrapolated; RtRelationLookUp tmp_rt( rt_extrapolated.getRtWithParabolicExtrapolation( @@ -355,8 +322,6 @@ bool RtCalibrationIntegration::analyse(void) { { int refit=static_cast<int>((b[1] + 1.33717e-03)>(b[0] + 1.33717e-03)); int norefit=static_cast<bool>(refit)?0:1; -// std::cout<<"HHhhHH "<<refit<<" "<<norefit<<std::endl; -// std::cout<<"HHhhHH "<<b[norefit]<<std::endl; TF1 *fixfun=drift_time_spec_ml[refit].GetTMaxFunctionNC(); fixfun->FixParameter(T0MTHistos::TMAX_PAR_NR_B, b[norefit]); update_parameter_on_mttmax(drift_time_spec_ml[refit].GetTSpec(), fixfun, b[norefit], T[norefit],*t0_setting.TMaxSettings()); diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtParabolicExtrapolation.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtParabolicExtrapolation.cxx index 90ab4b98359f..353b388f50c5 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtParabolicExtrapolation.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibRt/src/RtParabolicExtrapolation.cxx @@ -1,39 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 10.11.2008, AUTHOR: OLIVER KORTNER -// Modified: 28.02.2009 by O. Kortner and J. von Loeben, extend extrapolation -// features -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MuonCalibMath/BaseFunctionFitter.h" #include "MuonCalibMath/LegendrePolynomial.h" #include "MdtCalibRt/RtParabolicExtrapolation.h" #include "MdtCalibData/IRtRelation.h" #include "MdtCalibData/RtRelationLookUp.h" - -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" using namespace MuonCalib; -using namespace std; - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS RtCalibrationAnalytic :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//***************************************************************************** - -//::::::::::::::::::::::::: -//:: DEFAULT CONSTRUCTOR :: -//::::::::::::::::::::::::: RtParabolicExtrapolation::RtParabolicExtrapolation(void) { } @@ -55,10 +32,10 @@ RtRelationLookUp RtParabolicExtrapolation::getRtWithParabolicExtrapolation( double t_min(t_from_r(r_min, in_rt)); double t_max(t_from_r(r_max, in_rt)); - vector<SamplePoint> t_r(10); + std::vector<SamplePoint> t_r(10); BaseFunctionFitter fitter(3); LegendrePolynomial pol; - vector<double> rt_param(102); // parameters of the output r-t relationship + std::vector<double> rt_param(102); // parameters of the output r-t relationship double r, t; // drift radius //////////////////////// @@ -104,7 +81,7 @@ RtRelationLookUp RtParabolicExtrapolation::getRtWithParabolicExtrapolation( const double & r_min, const double & r_max, const double & r_ext, - const vector<SamplePoint> & add_fit_points + const std::vector<SamplePoint> & add_fit_points ) const { /////////////// @@ -114,10 +91,10 @@ RtRelationLookUp RtParabolicExtrapolation::getRtWithParabolicExtrapolation( // double t_min(t_from_r(r_min, in_rt)); double t_min(get_max_t_at_r(r_min, in_rt)); double t_max(t_from_r(r_max, in_rt)); - vector<SamplePoint> t_r(10); + std::vector<SamplePoint> t_r(10); BaseFunctionFitter fitter(3); LegendrePolynomial pol; - vector<double> rt_param(102); // parameters of the output r-t relationship + std::vector<double> rt_param(102); // parameters of the output r-t relationship double r, t; // drift radius, drift time //////////////////////// @@ -145,7 +122,6 @@ RtRelationLookUp RtParabolicExtrapolation::getRtWithParabolicExtrapolation( // modified and extrapolated points in the r-t rt_param[0] = in_rt.tLower(); rt_param[1] = (in_rt.tUpper()-in_rt.tLower())/99.0; -// cerr <<"r_ext:\t"<< r_ext << "\tr_min\t" << r_min << "\tr_max\t" << r_max << endl; for (unsigned int k=0; k<100; k++) { t = rt_param[0]+rt_param[1]*k; r = in_rt.radius(t); @@ -180,11 +156,8 @@ RtRelationLookUp RtParabolicExtrapolation::getRtWithParabolicExtrapolation( // within the fit region else if (r_ext <= r_max && r_ext >=r_min) { rt_param[k+2] = r; - cerr << "Class RtParabolicExtrapolation," - << "WARNING: \n\t Extrapolated radius withing fit region" - << " - Nothing to be done." - << endl; - + MsgStream log(Athena::getMessageSvc(), "RtParabolicExtrapolation"); + log<<MSG::WARNING<< "getRtWithParabolicExtrapolation() - Extrapolated radius withing fit region - Nothing to be done."<<endmsg; } } @@ -242,7 +215,5 @@ double RtParabolicExtrapolation::get_max_t_at_r(const double & r, return t+1.0; } } - return in_rt.tLower(); - } diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/exe/T0Fit.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/exe/T0Fit.cxx index 6e5f2e66bd3b..2b51a99b8ce4 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/exe/T0Fit.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/exe/T0Fit.cxx @@ -1,8 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MdtCalibT0/T0MTHistos.h" + #include "TROOT.h" #include "TFile.h" #include "TH1.h" @@ -15,9 +16,6 @@ #include "cstdlib" using namespace MuonCalib; -using namespace std; - - int main(int argc, char * argv[]) { diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/ADCMTHistos.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/ADCMTHistos.cxx index 12b1a9a8a756..050c6d6ea2fd 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/ADCMTHistos.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/ADCMTHistos.cxx @@ -1,29 +1,26 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MdtCalibT0/ADCMTHistos.h" -//root #include "TH1.h" #include "TF1.h" #include "TDirectory.h" #include <cmath> -using namespace std; - namespace MuonCalib { /** skew normal ADC fitting */ inline Double_t adcfitf_skewnormal(Double_t *x, Double_t *par){ - //par[0] = skew gauss norm + //par[0] = skew gauss norm //par[1] = skew gauss mean (i.e. mu) //par[2] = skew gauss sigma (i.e sigma) //par[3] = skew factor (i.e. alpha) // Numeric constants Double_t invsq2pi = 1.0/(std::sqrt(2*M_PI)); - Double_t twoPi = 2*M_PI; + Double_t twoPi = 2*M_PI; Double_t delta_value = par[3]/(std::sqrt(1.+par[3]*par[3])); Double_t omega_square = (par[2]*par[2])/(1. - 4.*delta_value*delta_value/(twoPi)); @@ -42,7 +39,7 @@ namespace MuonCalib { } -void ADCMTHistos :: FillA(double a) +void ADCMTHistos::FillA(double a) {m_adc->Fill(static_cast<Axis_t>(a));} @@ -50,15 +47,10 @@ void ADCMTHistos :: FillA(double a) // Initialize(int id, const T0MTSettings & settings) // ////////////////////////////////////////////////////////// -void ADCMTHistos :: Initialize(int id, const T0MTSettings * settings, const char * hname) +void ADCMTHistos::Initialize(int id, const T0MTSettings * settings, const char * hname) { m_settings=settings; -// if(m_settings->VerboseLevel()>1) -// { - cout<<"ADCMTHistos :: Initialize: called"<<endl; -// } char buf[100]; - std::cout<<gDirectory->GetName()<<std::endl; if(hname==NULL) snprintf(buf, 100, "adc_spec_%d", id); else @@ -68,29 +60,17 @@ void ADCMTHistos :: Initialize(int id, const T0MTSettings * settings, const char m_adc_ok=false; } - - -bool ADCMTHistos :: FitAdc() +bool ADCMTHistos::FitAdc() { -/* m_adc_fit = new TF1("adc_fun", "landau(0) + gaus(3)"); - m_adc->Fit("landau", "Q"); - TF1 *lan_fit=m_adc->GetFunction("landau"); - for(int i=0; i<3; i++) - m_adc_fit->SetParameter(i, lan_fit->GetParameter(i)); - m_adc->Fit("adc_fun", "Q"); -*/ m_adc_fit = new TF1("adc_fun",adcfitf_skewnormal, 50, 320, 4); Double_t average = m_adc->GetMean(); Double_t max=m_adc->GetMaximum(); -// m_adc->SetAxisRange(50,350,"X"); m_adc_fit->SetParameters(max,average,40,1); // initialize value m_adc_fit->SetLineColor(kRed); m_adc_fit->SetParNames("Max","Mean", "Sigma","Skew_factor"); m_adc_fit->SetParLimits(0,0,1000000); m_adc_fit->SetParLimits(1,100,200); m_adc_fit->SetParLimits(2,0,200); - //gStyle->SetOptFit(1011); - m_adc->Fit("adc_fun","Q+","",50,320); m_adc_ok = true; return true; diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/MTT0PatternRecognition.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/MTT0PatternRecognition.cxx index ad90b4149671..219e044e8aa4 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/MTT0PatternRecognition.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/MTT0PatternRecognition.cxx @@ -1,26 +1,22 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//this #include "MdtCalibT0/MTT0PatternRecognition.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" -//root #include "TLine.h" #include "TGraph.h" #include "TH1.h" -using namespace std; - namespace MuonCalib{ - ////////////////////////////////////////////////////////////////// // estimate_background(const TH1 &hist, double scale_min) // ////////////////////////////////////////////////////////////////// - -bool MTT0PatternRecognition :: estimate_background( TH1F *hist, double scale_min) +bool MTT0PatternRecognition::estimate_background(TH1F* hist, double scale_min) { //Get first bin in input histogram which is not empty. This avoids underestimation of the background rate if the range of the input histogram exceeds the TDC-range int min(-1); @@ -32,12 +28,12 @@ bool MTT0PatternRecognition :: estimate_background( TH1F *hist, double scale_min break; } } - if(min==-1) - { - cerr<<"MTT0PattternRecognition :: estimate_background: No hits in input histogram!"<<endl; + if(min==-1) { + MsgStream log(Athena::getMessageSvc(), "MTT0PattternRecognition"); + log<<MSG::WARNING<< "estimate_background() - No hits in input histogram!"<<endmsg; m_error=true; return false; - } + } double maxx=scale_min-40; int max=hist->FindBin(maxx); //we want 10 bins minimum for the background estimate @@ -48,12 +44,12 @@ bool MTT0PatternRecognition :: estimate_background( TH1F *hist, double scale_min min=0; } //if there are still not enough bins for the background estimate we have a problem - if(max-min<m_settings->MinBackgroundBins()) - { - cerr<<"MTT0PattternRecognition :: estimate_background: Rising edge is to glose to lower histogram range!"<<endl; + if(max-min<m_settings->MinBackgroundBins()) { + MsgStream log(Athena::getMessageSvc(), "MTT0PattternRecognition"); + log<<MSG::WARNING<< "estimate_background() - Rising edge is to glose to lower histogram range!"<<endmsg; m_error=true; return false; - } + } //calculate average bin content m_background=0.0; double back_squared=0.0; @@ -99,7 +95,7 @@ bool MTT0PatternRecognition :: estimate_background( TH1F *hist, double scale_min // estimate_height(const TH1 &hist) // ////////////////////////////////////////// -double MTT0PatternRecognition :: estimate_height( TH1F *hist) +double MTT0PatternRecognition::estimate_height(TH1F* hist) { //smooth histogram if(!m_vbh.Smooth(hist->GetBinWidth(1))) @@ -152,13 +148,12 @@ double MTT0PatternRecognition :: estimate_height( TH1F *hist) m_height+=hist->GetBinContent(i); nbins++; } - if(nbins<1) - { - cerr<<"top region is too small!"<<endl; - cout<<"left="<<left<<" right="<<right<<endl; + if(nbins<1) { + MsgStream log(Athena::getMessageSvc(), "MTT0PattternRecognition"); + log<<MSG::WARNING<< "estimate_height() - top region is too small! left="<<left<<" right="<<right<<endmsg; m_error=true; return -1; - } + } m_height/=nbins; m_fit_max=right; return left; diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/MTTmaxPatternRecognition.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/MTTmaxPatternRecognition.cxx index 73c8d9ba0107..880c3bda50ac 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/MTTmaxPatternRecognition.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/MTTmaxPatternRecognition.cxx @@ -1,50 +1,44 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MdtCalibT0/MTTmaxPatternRecognition.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" -//root #include "TF1.h" #include "TLine.h" #include "TGraph.h" #include "TH1.h" #include <cmath> -using namespace std; +namespace MuonCalib { -namespace MuonCalib{ +inline Double_t myexp(Double_t *x, Double_t *p) { + return std::exp(p[0] + p[1] * (x[0] - p[3])) + p[2]; +} - - -inline Double_t myexp(Double_t *x, Double_t *p) - { - return exp(p[0] + p[1] * (x[0] - p[3])) + p[2]; - } - -bool MTTmaxPatternRecognition :: Initialize( TH1F *hist, double t0, const T0MTSettings * settings) - { +bool MTTmaxPatternRecognition::Initialize(TH1F* hist, double t0, const T0MTSettings* settings) { m_settings=settings->TMaxSettings(); m_draw_debug_graph=settings->DrawDebugGraphs(); m_error=false; m_t0=t0; m_error=!m_vbh.Initialize(hist, m_settings->VBHBinContent(), m_settings->MaxBinwidth(), t0 + m_settings->VBHLow()); - if(m_error || m_vbh.GetNumberOfBins()<2) - { - cerr<<"MTTmaxPatternRecognition :: Initialize: INitialization of VBH failed!"<<endl; - } + if(m_error || m_vbh.GetNumberOfBins()<2) { + MsgStream log(Athena::getMessageSvc(), "MTTmaxPatternRecognition"); + log<<MSG::WARNING<< "Initialize() - Initialization of VBH failed!"<<endmsg; + } if(!m_error) estimate_background(hist); if(!m_error) estimate_height(hist); return !m_error; - } +} ////////////////////////////////////////// // estimate_background( TH1 *hist) // ////////////////////////////////////////// -bool MTTmaxPatternRecognition :: estimate_background( TH1F *hist) - { +bool MTTmaxPatternRecognition::estimate_background(TH1F* hist) { //smooth VBH in several steps for(double i=1.0; i<=4.0; i*=2.0) { @@ -75,17 +69,16 @@ bool MTTmaxPatternRecognition :: estimate_background( TH1F *hist) peak_falling_slope=bin2.Width() - bin1.Width(); } } -// cout<<"Peak falling="<<peak_falling<<endl; //check region size int firstbin=hist->FindBin(peak_falling+m_settings->DistBackground()); int lastbin=hist->FindBin(m_vbh.GetBin(m_vbh.GetNumberOfBins() - 1).Right()); if(lastbin-firstbin<m_settings->MinBackgroundBins()) lastbin=hist->GetNbinsX(); - if(lastbin-firstbin<m_settings->MinBackgroundBins()) - { - cerr<<"MTTMaxPattternRecognition :: estimate_background: Falling edge is to glose to upper histogram range!"<<endl; + if(lastbin-firstbin<m_settings->MinBackgroundBins()) { + MsgStream log(Athena::getMessageSvc(), "MTTmaxPatternRecognition"); + log<<MSG::WARNING<< "estimate_background() - Falling edge is to glose to upper histogram range!"<<endmsg; m_error=true; return false; - } + } //calcul;ate mean m_background=0.0; double n_bins=0.0; @@ -106,15 +99,14 @@ bool MTTmaxPatternRecognition :: estimate_background( TH1F *hist) m_tmax_est=peak_falling; m_fit_max=hist->GetBinCenter(lastbin); return true; - } +} ////////////////////////////////////////////////////////// // estimate_height( TH1 *hist, double background_min) // ////////////////////////////////////////////////////////// -bool MTTmaxPatternRecognition :: estimate_height( TH1F *hist) - { +bool MTTmaxPatternRecognition::estimate_height(TH1F* hist) { //get start value for fit Double_t left = m_tmax_est - m_settings->DistAB() - m_settings->WidthAB(), right = m_tmax_est - m_settings->DistAB(); @@ -124,7 +116,6 @@ bool MTTmaxPatternRecognition :: estimate_height( TH1F *hist) fun->FixParameter(3, m_t0); hist->Fit("myexp", "Q0+", "", left, right); //store parameters -// TF1 *fun=hist->GetFunction("expo"); m_a=fun->GetParameter(0); m_b=fun->GetParameter(1); m_fit_min=m_tmax_est - m_settings->DistAB() - m_settings->WidthAB(); @@ -135,6 +126,6 @@ bool MTTmaxPatternRecognition :: estimate_height( TH1F *hist) (new TLine(right, 0, right, hist->GetMaximum()))->Write("tmax_height_right"); } return true; - } +} -} +} // end of MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/VariableBinwidthHistogram.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/VariableBinwidthHistogram.cxx index 99d7550db873..9ec88588b7c9 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/VariableBinwidthHistogram.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibT0/src/VariableBinwidthHistogram.cxx @@ -1,32 +1,25 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MdtCalibT0/VariableBinwidthHistogram.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" -// ROOT +#include <TString.h> // for Form #include "TH1.h" #include "TGraph.h" #include <cmath> -using namespace std; - namespace MuonCalib{ - ////////////////////////////////////////////////////////////////////////// // Initialize(const &TH1 hist, double binc_rate, double max_bin_width) // ////////////////////////////////////////////////////////////////////////// -bool VariableBinwidthHistogram :: Initialize(TH1F * hist, double binc_rate, double max_bin_width, double min_x, double max_x) - { - if(binc_rate<1.0) - { - cerr<<"ERROR in VariableBinwidthHistogram :: Initialize!"<<endl; - cerr<<"binc_rate must be greater than 1!"<<endl; - m_error=true; - return false; - } +bool VariableBinwidthHistogram::Initialize(TH1F* hist, double binc_rate, double max_bin_width, double min_x, double max_x) { + if(binc_rate<1.0) throw std::runtime_error(Form("File: %s, Line: %d\nVariableBinwidthHistogram::Initialize - binc_rate must be greater than 1!", __FILE__, __LINE__)); + //get maximum, firest bin and last bin double max; int first_bin(hist->FindBin(min_x)), last_bin(hist->FindBin(max_x)); @@ -91,24 +84,22 @@ bool VariableBinwidthHistogram :: Initialize(TH1F * hist, double binc_rate, doub // Smooth(double width) // ////////////////////////// -bool VariableBinwidthHistogram :: Smooth(double width) +bool VariableBinwidthHistogram::Smooth(double width) { //needs at last 3 bins to smooth - if(m_bins.size()<3) - { - cerr<<"VariableBinwidthHistogram :: Smooth: VBH has less than 3 bins!"<<endl; + if(m_bins.size()<3) { + MsgStream log(Athena::getMessageSvc(), "VariableBinwidthHistogram"); + log<<MSG::WARNING<< "Smooth() - VBH has less than 3 bins"<<endmsg; return false; - } + } for(unsigned int i=0; i<m_bins.size()-3; i++) { Double_t sl1=m_bins[i+1]->Width()-m_bins[i]->Width(); Double_t sl2=m_bins[i+2]->Width()-m_bins[i+1]->Width(); - //one slopes must be smaller or equal to bw -// if(fabs(sl1)>width && fabs(sl2)>width) continue; //slopes must be oposit sign if(sign(sl1)==sign(sl2)) continue; //prevents numerical effects - if(fabs(sl1)<width/2 || fabs(sl2)<width/2) continue; + if(std::abs(sl1)<width/2 || std::abs(sl2)<width/2) continue; //move bin boarder m_bins[i]->MoveRight(m_bins[i]->Right()-width/2*sign(sl2)); m_bins[i+1]->MoveLeft(m_bins[i]->Right()-width/2*sign(sl2)); @@ -121,7 +112,7 @@ bool VariableBinwidthHistogram :: Smooth(double width) // DenistyGraph() // ////////////////////////// -TGraph *VariableBinwidthHistogram :: DenistyGraph() const +TGraph* VariableBinwidthHistogram::DenistyGraph() const { Double_t *x = new Double_t[m_bins.size()], *y = new Double_t[m_bins.size()]; @@ -131,10 +122,6 @@ TGraph *VariableBinwidthHistogram :: DenistyGraph() const y[i]=m_bins[i]->Density(); } TGraph *gr=new TGraph(m_bins.size(), x, y); -// cout<<"delete"<<endl; -// delete [] x; -// delete [] y; -// cout<<"return"<<endl; return gr; } @@ -143,7 +130,7 @@ TGraph *VariableBinwidthHistogram :: DenistyGraph() const // BinWidthGraph() const // ////////////////////////////////// -TGraph *VariableBinwidthHistogram :: BinWidthGraph() const +TGraph* VariableBinwidthHistogram::BinWidthGraph() const { Double_t *x = new Double_t[m_bins.size()], *y = new Double_t[m_bins.size()]; @@ -153,8 +140,6 @@ TGraph *VariableBinwidthHistogram :: BinWidthGraph() const y[i]=m_bins[i]->Width(); } TGraph *gr=new TGraph(m_bins.size(), x, y); -// delete [] x; -// delete [] y; return gr; } @@ -163,7 +148,7 @@ TGraph *VariableBinwidthHistogram :: BinWidthGraph() const // BinContentGraph() const // ////////////////////////////////// -TGraph *VariableBinwidthHistogram :: BinContentGraph() const +TGraph* VariableBinwidthHistogram::BinContentGraph() const { Double_t *x = new Double_t[m_bins.size()], *y = new Double_t[m_bins.size()]; @@ -173,19 +158,17 @@ TGraph *VariableBinwidthHistogram :: BinContentGraph() const y[i]=m_bins[i]->Entries(); } TGraph *gr=new TGraph(m_bins.size(), x, y); -// delete [] x; -// delete [] y; return gr; } -TGraph *VariableBinwidthHistogram :: DiffDensityGraph() const +TGraph* VariableBinwidthHistogram::DiffDensityGraph() const { - if(m_bins.size()<2) - { - cerr<<"VariableBinwidthHistogram :: DiffDensity(): Need at alst 2 bins for differential density!"<<endl; + if(m_bins.size()<2) { + MsgStream log(Athena::getMessageSvc(), "VariableBinwidthHistogram"); + log<<MSG::WARNING<< "DiffDensityGraph() - Need at alst 2 bins for differential density!"<<endmsg; return new TGraph(); - } + } Double_t *x = new Double_t[m_bins.size()-1], *y = new Double_t[m_bins.size()-1]; for(unsigned int i=0; i<m_bins.size()-1; i++) @@ -199,13 +182,13 @@ TGraph *VariableBinwidthHistogram :: DiffDensityGraph() const -TGraph *VariableBinwidthHistogram :: DiffBinwidthGraph() const +TGraph* VariableBinwidthHistogram::DiffBinwidthGraph() const { - if(m_bins.size()<2) - { - cerr<<"VariableBinwidthHistogram :: DiffBinwidth(): Need at alst 2 bins for differential density!"<<endl; + if(m_bins.size()<2) { + MsgStream log(Athena::getMessageSvc(), "VariableBinwidthHistogram"); + log<<MSG::WARNING<< "DiffBinwidthGraph() - Need at alst 2 bins for differential density!"<<endmsg; return new TGraph(); - } + } Double_t *x = new Double_t[m_bins.size()-1], *y = new Double_t[m_bins.size()-1]; for(unsigned int i=0; i<m_bins.size()-1; i++) diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/QuasianalyticLineReconstructionTool.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/QuasianalyticLineReconstructionTool.cxx index 5e4a29e63e46..969e911ffba5 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/QuasianalyticLineReconstructionTool.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibTools/src/QuasianalyticLineReconstructionTool.cxx @@ -1,27 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 07.03.2006, AUTHOR: OLIVER KORTNER -// Modified: 15.07.2006 by O. Kortner, interface to additional functionality -// of QuasianalyticLineReconstruction added. -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MdtCalibTools/QuasianalyticLineReconstructionTool.h" #include "GaudiKernel/MsgStream.h" #include "MdtCalibFitters/QuasianalyticLineReconstruction.h" -//::::::::::::::::::::::: -//:: NAMESPACE SETTING :: -//::::::::::::::::::::::: - using namespace MuonCalib; -using namespace std; //:::::::::::::::::::::::::::::::::::::::::::::::::::: //:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS :: diff --git a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/MuonCalibTriggerInfoBranch.cxx b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/MuonCalibTriggerInfoBranch.cxx index 590ed9706c09..9f55e0183a1c 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/MuonCalibTriggerInfoBranch.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibExtraTree/MuonCalibExtraTreeAlg/src/MuonCalibTriggerInfoBranch.cxx @@ -1,23 +1,18 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonCalibExtraTreeAlg/MuonCalibTriggerInfoBranch.h" #include "MuonCalibExtraTreeEvent/MuonCalibTriggerInfo.h" - #include "MuonCalibNtuple/NtupleBranchCreator.h" - #include "TrigT1Result/CTP_Decoder.h" #include "TrigT1Result/CTP_RDO.h" #include "TTree.h" - #include <iostream> #include <set> #include <map> -using namespace std; - namespace MuonCalib { MuonCalibTriggerInfoBranch::MuonCalibTriggerInfoBranch(std::string branchName) : diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BFielCorrectionUpdateTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BFielCorrectionUpdateTool.cxx index 3273eb99793b..0548fc070e96 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BFielCorrectionUpdateTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BFielCorrectionUpdateTool.cxx @@ -1,33 +1,13 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 02.02.2009, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF THE CONSTRUCTORS AND METHODS DEFINED IN THE CLASS :: -//:: BFieldCorrectionUpdateTool :: -//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// standard C++ // #include <iostream> #include <fstream> -// MuonCalib // #include "MdtCalibData/RtSpline.h" #include "CalibNtupleAnalysisAlg/BFieldCorrectionUpdateTool.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - -using namespace std; using namespace MuonCalib; //***************************************************************************** @@ -43,7 +23,7 @@ BFieldCorrectionUpdateTool::BFieldCorrectionUpdateTool( ///////////////// // JOB OPTIONS // ///////////////// - m_rt_file_name = string("truth_rt.dat"); + m_rt_file_name = std::string("truth_rt.dat"); declareProperty("rtFile", m_rt_file_name); /////////////////////// @@ -148,11 +128,11 @@ bool BFieldCorrectionUpdateTool::initialize_BFieldCorFunc(void) { ///////////// // OBJECTS // ///////////// - ifstream rt_file; + std::ifstream rt_file; char s[255]; // auxiliary character pointer double dummy; // auxiliary double - vector<double> r,t; // entries in the r-t table - vector<double> B_corr_param(2); + std::vector<double> r,t; // entries in the r-t table + std::vector<double> B_corr_param(2); ////////////////////////////////////////////// // OPEN THE r-t FILE AND READ THE r-t TABLE // @@ -179,7 +159,7 @@ bool BFieldCorrectionUpdateTool::initialize_BFieldCorFunc(void) { } // create a spline r-t relationship // - vector<double> param(2*r.size()); + std::vector<double> param(2*r.size()); for (unsigned int k=0; k<r.size(); k++) { param[2*k] = t[k]; param[2*k+1] = r[k]; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx index fcbc7d3b8f50..0d5d92b4cae0 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/CalibNtupleAnalysisAlg/src/BarrelSecondCoordinatePreparationTool.cxx @@ -1,41 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 23.01.2008, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF THE METHODS DEFINED IN THE CLASS :: -//:: BarrelSecondCoordinatePreparationTool :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// standard C++ // #include <iostream> #include <fstream> -// MuonCalib // #include "CalibNtupleAnalysisAlg/BarrelSecondCoordinatePreparationTool.h" - -//MuonReadoutGeometry #include "MuonReadoutGeometry/MdtReadoutElement.h" - -//MuonCalibITools #include "MuonCalibITools/IIdToFixedIdTool.h" - -//MuonCalibEventBase #include "MuonCalibEventBase/MuonCalibRawRpcHit.h" #include "MuonCalibEventBase/MuonCalibRawHitCollection.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: -using namespace std; using namespace MuonCalib; //***************************************************************************** @@ -144,8 +119,8 @@ void BarrelSecondCoordinatePreparationTool::prepareSegments( } // COLLECT RAW RPC HITS - vector<MuonCalibRawRpcHit *> raw_hits; - for (vector<MuonCalibRawRpcHit *>::const_iterator it1=raw_RPC_begin_it; it1!=raw_RPC_end_it; it1++) { + std::vector<MuonCalibRawRpcHit *> raw_hits; + for (std::vector<MuonCalibRawRpcHit *>::const_iterator it1=raw_RPC_begin_it; it1!=raw_RPC_end_it; it1++) { raw_hits.push_back(*it1); } @@ -174,7 +149,7 @@ void BarrelSecondCoordinatePreparationTool::prepareSegments( //:: METHOD handleRPChits :: //:::::::::::::::::::::::::: bool BarrelSecondCoordinatePreparationTool::handleRPChits(MuonCalibSegment & MDT_segment, - vector<MuonCalibRawRpcHit *> & raw_hits) { + std::vector<MuonCalibRawRpcHit *> & raw_hits) { //Segment parameters MuonFixedId seg_ID(MDT_segment.mdtHOT()[0]->identify()); @@ -217,9 +192,9 @@ bool BarrelSecondCoordinatePreparationTool::handleRPChits(MuonCalibSegment & MDT int num_total(0); int num_current(0); - vector<CLHEP::HepVector> RPChits; - vector<int> in_seg_sector; - vector<int> num_hits_same_layer; + std::vector<CLHEP::HepVector> RPChits; + std::vector<int> in_seg_sector; + std::vector<int> num_hits_same_layer; SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey}; const MuonGM::MuonDetectorManager* MuonDetMgr = DetectorManagerHandle.cptr(); @@ -228,7 +203,7 @@ bool BarrelSecondCoordinatePreparationTool::handleRPChits(MuonCalibSegment & MDT return false; } - vector<MuonCalibRawRpcHit *>::iterator raw_it = raw_hits.begin(); + std::vector<MuonCalibRawRpcHit *>::iterator raw_it = raw_hits.begin(); while (raw_it != raw_hits.end()) { bool bad_hit = false; MuonFixedId ID((*raw_it)->identify()); @@ -376,8 +351,8 @@ bool BarrelSecondCoordinatePreparationTool::handleRPChits(MuonCalibSegment & MDT ///////////////////////////////////////////// // Fit by RPC hits // ///////////////////////////////////////////// -int BarrelSecondCoordinatePreparationTool::rpcFit(vector<CLHEP::HepVector> &RPC_hits, - vector<int> in_sect, vector<int> num_same, double max_r, +int BarrelSecondCoordinatePreparationTool::rpcFit(std::vector<CLHEP::HepVector> &RPC_hits, + std::vector<int> in_sect, std::vector<int> num_same, double max_r, CLHEP::HepVector &tr_par, double &angle_err) { int ierr(0); // Status of Matrix Inversion diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase/src/MdtStationT0Container.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase/src/MdtStationT0Container.cxx index b78fa069bf2c..c81e9d8c50b1 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase/src/MdtStationT0Container.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase/src/MdtStationT0Container.cxx @@ -1,58 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 01.02.2007, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS MdtStationT0Container :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include <cstdlib> #include <iostream> #include <fstream> #include "MuonCalibStandAloneBase/MdtStationT0Container.h" +#include <TString.h> // for Form -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - -using namespace std; using namespace MuonCalib; - -//***************************************************************************** - -//::::::::::::::::: -//:: METHOD init :: -//::::::::::::::::: - -/*void MdtStationT0Container::init(void) { - - m_t0 = vector< vector< vector<double> > >(2); // two multilayers - m_adc = vector< vector< vector<double> > >(2); // two multilayers - for (unsigned int k=0; k<m_t0.size(); k++) { - m_t0[k] = vector< vector<double> >(4); // up to four layers in - // a multilayer - m_adc[k] = vector< vector<double> >(4); // up to four layers in - // a multilayer - for (unsigned l=0; l<m_t0[k].size(); l++) { - m_t0[k][l] = vector<double>(72, 9e9); - m_adc[k][l] = vector<double>(72, 9e9); - // up to 72 tubes per layer - } - } - m_t0_loaded=false; - return; - -}*/ - //***************************************************************************** //::::::::::::::: @@ -113,11 +70,11 @@ void MdtStationT0Container::readT0File(const std::string & file_name) { // VARIABLES // /////////////// - string sdummy; // auxiliary string for file reading + std::string sdummy; // auxiliary string for file reading int idummy; // auxiliary integer for file reading double dummy; // auxiliary double for file reading int ml, ly, tb; // multilayer, layer, tube - ifstream infile; // t0 file + std::ifstream infile; // t0 file ////////////////// // OPEN t0 file // @@ -125,11 +82,7 @@ void MdtStationT0Container::readT0File(const std::string & file_name) { infile.open(file_name.c_str()); if (infile.fail()) { - cerr << endl - << "Class MdtStationT0Container, method readToFile: " - << "ERROR!\n" - << "Could not open file " << file_name << "!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nMdtStationT0Container::readT0File - Could not open file %s!", __FILE__, __LINE__, file_name.c_str())); } ////////////////////// diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase/src/T0Refinement.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase/src/T0Refinement.cxx index 8e255b04abfd..7f856499439f 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase/src/T0Refinement.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneBase/src/T0Refinement.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -15,30 +15,15 @@ // only 3 last points are used for t0-fit. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -//::::::::::::::::::::::::::::::::::::::::::::::: -//:: METHODS DEFINED IN THE CLASS T0Refinement :: -//::::::::::::::::::::::::::::::::::::::::::::::: - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - -// standard C++ // #include <iostream> #include <fstream> -// MuonCalib // #include "MuonCalibStandAloneBase/T0Refinement.h" #include "MuonCalibStandAloneBase/NtupleStationId.h" #include "MuonCalibMath/SimplePolynomial.h" #include "MuonCalibMath/BaseFunctionFitter.h" #include "MdtCalibInterfaces/IMdtSegmentFitter.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - -using namespace std; using namespace MuonCalib; //***************************************************************************** @@ -90,7 +75,7 @@ double T0Refinement::getDeltaT0(MuonCalibSegment * segment, double sigma; // sigma(r) BaseFunctionFitter fitter(3); SimplePolynomial pol; // polynomial base functions x^k - vector<SamplePoint> my_points(3); + std::vector<SamplePoint> my_points(3); IMdtPatRecFitter *segment_fitter(0); // pointer to the segment fitter if (curved) { segment_fitter = m_cfitter; @@ -286,7 +271,7 @@ my_points[2].set_x1(-2.0*m_delta_t0); double min_chi2=9e9; double best_t0=delta_t0_opt; double current_t0=delta_t0_opt; - vector<double> t0s, chi2, mchi2; + std::vector<double> t0s, chi2, mchi2; while(1) { for (unsigned int k=0; k<seg.mdtHitsOnTrack(); k++) { diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h index 224d8a13d4fa..57dd9c60ef54 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDeadElementsAnalysis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* **************************************************** * @@ -12,7 +12,6 @@ #include <string> #include <stdio.h> -//using namespace std; static const int nmmax=100; static const int ntmax=600; Double_t polnml3(Double_t *x, Double_t *parf); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h index f5ad80eef891..4d7590a3c9a9 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //Author Marco Vanadia mvanadia@cern.ch @@ -19,12 +19,8 @@ #include <TKey.h> #include <vector> -//using namespace std; - namespace MuonCalib{ -//classes declarations - class Tube; class Layer; class Mezzanine; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTName.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTName.h index c58b48d1ee91..96b943bc52f5 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTName.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MDTName.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* Author: Marco Vanadia vanadiam@roma1.infn.it*/ @@ -13,8 +13,6 @@ #include <stdlib.h> #include "TString.h" -//using namespace std; - namespace MuonCalib{ class MDTName{ diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h index 8558578edaf6..4f902ed94a6d 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/MdtDqaTrackAnalysis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonCalib_TrackAnalysisH @@ -7,13 +7,12 @@ #include <iostream> #include <vector> -#include <math.h> -#include <fstream> -#include <string> -#include <iomanip> -#include <sstream> +#include <math.h> +#include <fstream> +#include <string> +#include <iomanip> +#include <sstream> -// For the Extra Tree Analysis // #include "MuonCalibExtraTreeEvent/MuonCalibExtendedTrack.h" #include "MuonCalibExtraTreeEvent/MuonCalibExtendedSegment.h" #include "MuonCalibExtraTreeEvent/EventHandler.h" @@ -26,8 +25,6 @@ #include "MuonCalibExtraTreeEvent/MuonCalibTrackSummary.h" #include "MuonCalibExtraTreeEvent/MuonCalibSelector.h" #include "MuonCalibExtraTreeEvent/MuonCalibTriggerInfo.h" -// #include "MuonCalibExtraNtuple/NTReaderBase_E.h" -// MuonCalib // #include "MuonCalibEventBase/MuonCalibRawHitCollection.h" #include "MuonCalibEventBase/MuonCalibRawMdtHit.h" #include "MuonCalibEventBase/MuonCalibSegment.h" @@ -36,13 +33,10 @@ #include "MuonCalibEventBase/MuonCalibPattern.h" #include "MuonCalibEventBase/MuonCalibRawHitCollection.h" #include "MuonCalibEventBase/MuonCalibTruthCollection.h" - #include "MuonCalibStandAloneExtraTools/HistogramManager.h" #include "MuonCalibStandAloneExtraTools/SegmentAnalysis.h" #include "MuonCalibStandAloneBase/RegionSelectionSvc.h" -//using namespace std; - namespace MuonCalib{ class MdtDqaTrackAnalysis{ diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/SegmentAnalysis.h b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/SegmentAnalysis.h index 800df3994178..c9c113543741 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/SegmentAnalysis.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/MuonCalibStandAloneExtraTools/SegmentAnalysis.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonCalib_SegmentAnalysisH @@ -13,7 +13,6 @@ #include <iomanip> #include <sstream> -// MuonCalib // #include "MuonCalibEventBase/MuonCalibRawHitCollection.h" #include "MuonCalibEventBase/MuonCalibRawMdtHit.h" #include "MuonCalibEventBase/MuonCalibSegment.h" @@ -23,8 +22,6 @@ #include "MuonCalibStandAloneExtraTools/HistogramManager.h" #include "MuonCalibStandAloneBase/RegionSelectionSvc.h" -//using namespace std; - namespace MuonCalib{ class SegmentAnalysis{ diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDqaDeadElements.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDqaDeadElements.cxx index 84a3b53d3adb..a9be6e9af6a1 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDqaDeadElements.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MDTDqaDeadElements.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //Author Marco Vanadia vanadiam@roma1.infn.it @@ -22,10 +22,6 @@ //#include "./MDTDqaDeadElements.h" #include "MuonCalibStandAloneExtraTools/MDTDqaDeadElements.h" -using namespace std; - -//Status values conventions - #define NOTUBE 0 //Used for chambers with ML1 smaller than ML2 #define DEADCHAMBER 1 #define LOWSTATISTICSCHAMBER 7 @@ -147,7 +143,7 @@ namespace MuonCalib { //calculateStatistics only calculate median and median deviation of the object, not of its sub-objects //to calculate these values for the whole chamber and its sub-parts, use the method MDTChamber::updateStatistics() - vector<double> values; + std::vector<double> values; for(int k=1; k<=this->getNtubes(); k++) { Tube *t= getTube(k); @@ -249,7 +245,7 @@ namespace MuonCalib { //Here we must also compute the entries in mezzanine, because of the way we built it - vector<double> values; + std::vector<double> values; for(int k=1; k<=this->getNtubes(); k++) { Tube *t= getTube(k); if((t->getStatus())==0) continue; //Double check just not to lose entries; @@ -359,7 +355,7 @@ namespace MuonCalib { //calculateStatistics only calculate median and median deviation of the object, not of its sub-objects //to calculate these values for the whole chamber and its sub-parts, use the method MDTChamber::updateStatistics() - vector<double> values; + std::vector<double> values; for(int j=1; j<=getNlayers(); j++) { Layer *l=getLayer(j); @@ -585,7 +581,7 @@ namespace MuonCalib { //calculateStatistics only calculate median and median deviation of the object, not of its sub-objects //to calculate these values for the whole chamber and its sub-parts, use the method MDTChamber::updateStatistics() - vector<double> values; + std::vector<double> values; double sum=0; int ntubes=0; for(int i=1; i<=getNmultilayers(); i++) { @@ -669,24 +665,6 @@ namespace MuonCalib { } void MDTChamber::Print() { - // cout<<"---------------Chamber "<<this->getName()<<"----------------"<<endl<<endl; - // for(int i=1; i<=getNmultilayers(); i++) { - // Multilayer *ml=this->getMultilayer(i); - // for(int j=1; j<=ml->getNlayers(); j++) { - // Layer *l=ml->getLayer(j); - // for(int k=1; k<=l->getNtubes(); k++) { - // Tube *t=l->getTube(k); - // if(t->getStatus()==0) cout<<" "; - // else { - // if(t->getStatus()==10) cout<<"O"; - // else cout<<"X"; - // } - // } - // cout<<endl; - // } - // cout<<endl<<endl; - // } - // cout<<"--------------------------------------------------------------------"<<endl<<endl; } //end MDTChamber::Print //////////////////////////////////////////////////////////////////////////////////////////////// @@ -758,8 +736,6 @@ namespace MuonCalib { int nsectorsanalysed=0; int nchambersanalysed=0; - // cout<<endl<<"--------------Start of MDTDqaDeadElementsAnalysis--------------------"<<endl<<endl; - if(m_write_report) { TString filename=f->GetName(); filename+="_DeadElementsAnalysis_Report.txt"; @@ -768,7 +744,6 @@ namespace MuonCalib { if(m_write_compact_report) { TString filename=f->GetName(); filename+="_DeadElementsAnalysis_CompactReport.txt"; - //filename="DeadElements_CompactReport.txt"; m_comp_report.open((const char*)filename); } if(m_write_list_of_dead_tubes) { @@ -777,23 +752,19 @@ namespace MuonCalib { m_filelistofdeads.open((const char*)filename); } for(int iregion=1; iregion<=4; iregion++) { - string region_name; + std::string region_name; if(iregion==1) region_name="Barrel_A"; if(iregion==2) region_name="Barrel_C"; if(iregion==3) region_name="Endcap_A"; if(iregion==4) region_name="Endcap_C"; - string regiondir_name="/MDT/"+region_name; + std::string regiondir_name="/MDT/"+region_name; - // if(m_verbose) cout<<endl<<"------------------------Analyzing region: "<<regiondir_name<<"------------------"<<endl; - TDirectory* regiondir=(TDirectory*)f->Get(regiondir_name.c_str()); if(!regiondir) { - // cout<<"MDTDqaDeadElements::MDTDqaDeadElementsAnalysis WARNING: region not found in rootfile"<<endl; continue; } TH2F *hsummary=(TH2F*)regiondir->FindObjectAny("DeadElements"); if(!hsummary) { - // cout<<"MDTDqaDeadElements::MDTDqaDeadElementsAnalysis WARNING: DeadElements histogram not found: "<<region_name<<endl; continue; } hsummary->Reset(); @@ -813,10 +784,7 @@ namespace MuonCalib { sector_name+=isector; TDirectory *sectordir=(TDirectory*)regiondir->Get((const char*)sector_name); - // if(m_verbose) cout<<endl<<"--------------------Analysing Sector "<<sector_name<<"------------------"<<endl; - if(!sectordir) { - // if(m_verbose) cout<<"Sector not found in rootfile"<<endl; continue; } if(m_do_analysis)nsectorsanalysed++; @@ -824,77 +792,60 @@ namespace MuonCalib { TIter next(sectordir->GetListOfKeys()); TKey *key; while((key=(TKey*)next())) { - string chamber_name=key->GetName(); + std::string chamber_name=key->GetName(); if(chamber_name=="OVERVIEW") continue; TDirectory *chamberdir=(TDirectory*)sectordir->Get(chamber_name.c_str()); TDirectory *deadstatusdir=(TDirectory*)sectordir->Get((chamber_name+"/DeadStatus").c_str()); TDirectory *expertdir=(TDirectory*)sectordir->Get((chamber_name+"/Expert").c_str()); - - // if(m_verbose) cout<<endl<<"------------------Analysing chamber "<<chamber_name<<"---------------"<<endl; if(!chamberdir) { - // cout<<"Failed to load chamberdir from rootfile"<<endl; continue; } if(!deadstatusdir) { - // cout<<"Failed to load deadstatusdir from rootfile"<<endl; continue; } if(!expertdir) { - // cout<<"Failed to load expertdir from rootfile"<<endl; continue; } TH1F *hgeom=(TH1F*)expertdir->FindObjectAny("DeadTubeRefMap"); if(!hgeom) { - // cout<<"DeadTubeRefMap histogram not found: "<<chamber_name<<endl; continue; } MDTChamber *chamber= new MDTChamber(hgeom,TString(chamber_name)); TH1F *hadccut=(TH1F*)chamberdir->FindObjectAny("a_HitsPerTubeAdcCut"); if(!hadccut) { - // cout<<"a_HitsPerTubeAdcCut histogram not found: "<<chamber_name<<endl; delete chamber; chamber=0; continue; } TH2F *hdeadchannels=(TH2F*) expertdir->FindObjectAny("ChamberDeadChannels"); if(!hdeadchannels) { - // cout<<"ChamberDeadChannels histogram not found: "<<chamber_name<<endl; delete chamber; chamber=0; continue; } TH2F *hdeadtubes=(TH2F*) deadstatusdir->FindObjectAny("ChamberDeadTubes"); if(!hdeadtubes) { - // cout<<"ChamberDeadTubes histogram not found: "<<chamber_name<<endl; delete chamber; chamber=0; continue; } TH1F *hdeadmap=(TH1F*) expertdir->FindObjectAny("DeadTubeMap"); if(!hdeadmap) { - // cout<<"DeadTubeMap histogram not found: "<<chamber_name<<endl; delete chamber; chamber=0; continue; } - // if(m_verbose) cout<<"Reading a_HitsPerTubeAdcCut to fill chamber tubes entries"<<endl; fillChamber(chamber,hadccut); hdeadmap->Reset(); hdeadchannels->Reset(); hdeadtubes->Reset(); - // if(m_verbose) cout<<endl<<"Starting DEAD elements analysis: "<<chamber_name<<endl; if(m_do_analysis)doAnalysis(chamber); if(m_print_chambers) chamber->Print(); if(m_do_analysis) nchambersanalysed++; - // if(m_verbose) cout<<"Filling 2D and layer by layer map: "<<chamber_name<<endl; - //DEBUG - //chamber->buildMezzanines(); - // - //To fix the correct values in the output histograms hdeadchannels->SetMinimum(0); hdeadchannels->SetMaximum(10); @@ -929,19 +880,6 @@ namespace MuonCalib { if(m_write_list_of_dead_tubes) { m_filelistofdeads.close(); } - // if(m_verbose) cout<<endl<<"--------------------------------------------------------"<<endl; - // cout<<endl<<endl; - // cout<<"Regions analysed: "<<nregionsanalysed<<endl; - // cout<<"Sectors analysed: "<<nsectorsanalysed<<endl; - // cout<<"Chambers analysed: "<<nchambersanalysed<<endl; - // cout<<"Tube analyzed: "<<m_ntubes<<endl; - // cout<<"Found: "<<m_deadtubes<<" Dead Tubes; "<<m_deadmezzanines<<" Dead Mezzanines; "<<m_deadlayers<<" Dead Layers; "; - // cout<<m_deadmultilayers<<" Dead Multilayers; "<<m_deadchambers<<" Dead Chambers; "; - // cout<<m_lowstatisticschambers<<" Chambers with low statistics; "<<m_lowstatisticsfortubeschambers; - // cout<<" Chambers with statistics too low to analyze tubes;"<<endl; - // cout<<"Found "<<m_lowstatmezzanines<<" mezzanines with low statistics"<<endl; - // if(m_do_noisy) cout<<"Noisy tubes: "<<m_noisytubes<<endl; - // cout<<endl<<"--------------End of MDTDqaDeadElementsAnalysis--------------------"<<endl<<endl; if(m_write_list_of_dead_tubes) { TString filename=f->GetName(); @@ -995,7 +933,6 @@ namespace MuonCalib { int ntubes=1; TH1F *hdeadtubestatus=(TH1F*)chamberdir->FindObjectAny("b_DeadTubeStatus"); if(!hdeadtubestatus) { - // cout<<"MDTDqaDeadElements::fillDeadMap WARNING: b_DeadTubeStatus not found "<<chamber->getName()<<endl; return; } hdeadtubestatus->Reset(); @@ -1012,7 +949,6 @@ namespace MuonCalib { TH1F *hdeadperlayer=(TH1F*)deadstatusdir->FindObjectAny((const char*)deadlayername); if(!hdeadperlayer) { - // if(m_verbose) cout<<"MDTDqaDeadElements::fillDeadMap WARNING: "<<deadlayername<<" histogram not found: "<<chamber->getName()<<endl; continue; } hdeadperlayer->Reset(); @@ -1073,12 +1009,12 @@ namespace MuonCalib { //under or equal to MINMEDIAN, the //chamber has too low statistics and too high fluctuations to be analysed; - if(m_write_report) m_file_report<<endl<<"Analysing Chamber "<<chamber->getName()<<"------------------------"<<endl; + if(m_write_report) m_file_report<<std::endl<<"Analysing Chamber "<<chamber->getName()<<"------------------------"<<std::endl; if(chamber->getEntries()<=MINENTRIES) { chamber->setStatus(DEADCHAMBER); - if(m_write_report) m_file_report<<chamber->getName()<<" Appears to be dead chamber as it has no entries"<<endl<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_CHAMBER"<<endl; + if(m_write_report) m_file_report<<chamber->getName()<<" Appears to be dead chamber as it has no entries"<<std::endl<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_CHAMBER"<<std::endl; m_deadchambers++; m_dead_chambers_per_sector++; return; @@ -1093,17 +1029,17 @@ namespace MuonCalib { if((median!=0)&&(median_deviation==0)) ratio=-1; if((median!=0)&&(median_deviation!=0)) ratio=median/median_deviation; if(m_write_report) m_file_report<<"entries="<<chamber->getEntries(); - if(m_write_report) m_file_report<<" median= "<<median<<"; median_dev= "<<median_deviation<<"; ratio="<<ratio<<endl; + if(m_write_report) m_file_report<<" median= "<<median<<"; median_dev= "<<median_deviation<<"; ratio="<<ratio<<std::endl; if((median<=MINMEDIAN)&&(ratio<=MAXRATIO)) { chamber->setStatus(LOWSTATISTICSCHAMBER); - if(m_write_report) m_file_report<<chamber->getName()<<" Has Low Statistics, it won't be analysed"<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" LOW STATISTICS"<<endl; + if(m_write_report) m_file_report<<chamber->getName()<<" Has Low Statistics, it won't be analysed"<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" LOW STATISTICS"<<std::endl; m_lowstatisticschambers++; m_lowstat_chambers_per_sector++; return; } - if(m_write_report) m_file_report<<chamber->getName()<<" Has enough statistics, starting other analysis"<<endl; + if(m_write_report) m_file_report<<chamber->getName()<<" Has enough statistics, starting other analysis"<<std::endl; //Here you start with chamber's sub-parts analysis @@ -1118,8 +1054,8 @@ namespace MuonCalib { //reanalyseMezzanines(chamber); //this method sets a mezzanine as dead if more than 50% of its tubes are dead. For the moment keep it diasbled until the dead tube analysis is fixed - if(m_write_report) m_file_report<<endl<<"END OF ANALYSIS "<<chamber->getName()<<"------------------------"<<endl; - if(m_write_report) m_file_report<<endl<<endl; + if(m_write_report) m_file_report<<std::endl<<"END OF ANALYSIS "<<chamber->getName()<<"------------------------"<<std::endl; + if(m_write_report) m_file_report<<std::endl<<std::endl; /*DEBUG for mezzanines for(int i=1; i<=chamber->getNmultilayers(); i++) { @@ -1161,13 +1097,13 @@ namespace MuonCalib { double med=ml->getMedian(); if(med>maxMLmedian) maxMLmedian=med; } - if(m_write_report) m_file_report<<"MLs MAXMEDIAN="<<maxMLmedian<<endl; + if(m_write_report) m_file_report<<"MLs MAXMEDIAN="<<maxMLmedian<<std::endl; if(maxMLmedian<MIN_MAXMEDIAN_ML) { - if(m_write_report) m_file_report<<"MLs have not enough statistics to be analized"<<endl; + if(m_write_report) m_file_report<<"MLs have not enough statistics to be analized"<<std::endl; return; } if(chamber->getNmultilayers()==1) { - if(m_write_report) m_file_report<<"Only 1ML in chamber; ML analysis ok;"<< endl; + if(m_write_report) m_file_report<<"Only 1ML in chamber; ML analysis ok;"<< std::endl; return; } for(int i=1; i<=chamber->getNmultilayers(); i++) { @@ -1191,14 +1127,14 @@ namespace MuonCalib { double diffToOther=diff/meanMedDev; if(m_write_report) m_file_report<<"ML"<<i<<"entries="<<ml->getEntries(); if(m_write_report) m_file_report<<"; median="<<ml->getMedian()<<"; diffToOther="<<diffToOther<<"; "; - if(m_write_report) m_file_report<<"maxMezzMed="<<maxMezzMed<<endl; + if(m_write_report) m_file_report<<"maxMezzMed="<<maxMezzMed<<std::endl; int contr=0; if((ml->getMedian()<=MIN_ML_MED)||((10*ml->getMedian())<ml2->getMedian())) { if(diffToOther<-SPREADDEAD) { if(maxMezzMed<(ml2->getMedian()-SPREADDEAD*meanMedDev)) { - if(m_write_report) m_file_report<<"ML "<<i<<" seems to be dead ML"<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MULTILAYER "<<i<<endl; + if(m_write_report) m_file_report<<"ML "<<i<<" seems to be dead ML"<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MULTILAYER "<<i<<std::endl; ml->setStatus(DEADML); m_deadmultilayers++; m_dead_multilayers_per_sector++; @@ -1206,15 +1142,15 @@ namespace MuonCalib { } } } else if((diffToOther<-SPREADINEFFICIENT)&&(maxMezzMed<(ml2->getMedian()-SPREADINEFFICIENT*meanMedDev))) { - if(m_write_report) m_file_report<<"ML "<<i<<" seems to be inefficient ML"<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" inefficient_MULTILAYER "<<i<<endl; + if(m_write_report) m_file_report<<"ML "<<i<<" seems to be inefficient ML"<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" inefficient_MULTILAYER "<<i<<std::endl; ml->setStatus(INEFFICIENTML); m_deadmultilayers++; m_dead_multilayers_per_sector++; contr=1; } - if(contr==0) {if(m_write_report) m_file_report<<"ML "<<i<<" OK"<<endl;} + if(contr==0) {if(m_write_report) m_file_report<<"ML "<<i<<" OK"<<std::endl;} } return; @@ -1254,7 +1190,7 @@ namespace MuonCalib { } if(maxMedianLayers<MIN_MAXLAYER_MED) { - if(m_write_report) m_file_report<<"Layers without enough statistics, not analysed"<<endl; + if(m_write_report) m_file_report<<"Layers without enough statistics, not analysed"<<std::endl; return; } @@ -1267,14 +1203,14 @@ namespace MuonCalib { double medianOfOtherMedians=0; double medianOfOtherMediansDevs=0; - vector<double> values; - vector<double> values_dev; + std::vector<double> values; + std::vector<double> values_dev; double maxMezzMedian=0; for(int k=0; k<ml->getNmezzanines(); k++) { Mezzanine *mezz=ml->getMezzanine(k); - vector<double> values_mezz; + std::vector<double> values_mezz; for(int y=1; y<=mezz->getNtubes(); y++) { Tube *t=mezz->getTube(y); if(t->getStatus()!=10) continue; @@ -1282,7 +1218,6 @@ namespace MuonCalib { values_mezz.push_back(t->getValue()); } int size_mezz=values_mezz.size(); - // if(size_mezz==0) {cout<<"BAD DEFINED MEZZANINE IN CHAMBER"<<chamber->getName()<<endl; continue;} double mezzmed; sort(values_mezz.begin(), values_mezz.end()); if((size_mezz%2)==1) mezzmed=values_mezz[(size_mezz-1)/2]; @@ -1300,7 +1235,6 @@ namespace MuonCalib { } int size=values.size(); - // if(size==0) {cout<<"BAD DEFINED LAYER IN CHAMBER"<<chamber->getName()<<endl; continue;} sort(values.begin(), values.end()); if((size%2)==1) medianOfOtherMedians=values[(size-1)/2]; else medianOfOtherMedians=(double)(values[size/2]+values[(size/2)-1])/2.; @@ -1321,13 +1255,13 @@ namespace MuonCalib { if(m_write_report) m_file_report<<"Layer"<<j<<" entries= "<<l->getEntries()<<" median="<<l->getMedian()<<"; diffToOther="<<diffToOthers<<"; "; if(m_write_report) m_file_report<<"medianOfOthersMedian="<<medianOfOtherMedians<<"; "; if(m_write_report) m_file_report<<"medianOfOthersMedianDev="<<medianOfOtherMediansDevs<<"; "; - if(m_write_report) m_file_report<<"maxMezzMedian="<<maxMezzMedian<<endl; + if(m_write_report) m_file_report<<"maxMezzMedian="<<maxMezzMedian<<std::endl; if((diffToOthers>SPREADHOT)&&(l->getMedian()>MINMEDHOT)) { if(!m_do_noisy) continue; - if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be noisy layer"<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" noisy_LAYER "<<i<<" "<<j<<endl; + if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be noisy layer"<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" noisy_LAYER "<<i<<" "<<j<<std::endl; l->setStatus(NOISYLAYER); contr=1; } @@ -1335,8 +1269,8 @@ namespace MuonCalib { if(l->getMedian()<MIN_LAYER_MED) { if((diffToOthers<=-SPREADDEAD)||(medianOfOtherMedians>MIN_OTHERMEDIANS_DEAD)) { if((maxMezzMedian<(medianOfOtherMedians-SPREADDEAD*medianOfOtherMediansDevs))||(maxMezzMedian<=MIN_OTHERMEDIANS_DEAD)) { - if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be dead layer"<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_LAYER "<<i<<" "<<j<<endl; + if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be dead layer"<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_LAYER "<<i<<" "<<j<<std::endl; l->setStatus(DEADLAYER); m_deadlayers++; m_dead_layers_per_sector++; @@ -1344,14 +1278,14 @@ namespace MuonCalib { } } } else if((diffToOthers<-SPREADINEFFICIENT)&&(maxMezzMedian<(medianOfOtherMedians-SPREADINEFFICIENT*medianOfOtherMediansDevs))) { - if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be inefficient layer"<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" inefficient_LAYER "<<i<<" "<<j<<endl; + if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" seems to be inefficient layer"<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" inefficient_LAYER "<<i<<" "<<j<<std::endl; l->setStatus(INEFFICIENTLAYER); m_deadlayers++; m_dead_layers_per_sector++; contr=1; } - if(contr==0) {if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" ok"<<endl;} + if(contr==0) {if(m_write_report) m_file_report<<"ML "<<i<<" Layer "<<j<<" ok"<<std::endl;} } } @@ -1376,8 +1310,8 @@ namespace MuonCalib { } if(ntubes==0) continue; else if((double)((double)ndeadtubes/(double)ntubes)>0.5) { - if(m_write_report) m_file_report<<"ML "<<i<<" Mezzanine "<<j<<" appears to be dead mezzanine"<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MEZZANINE_rean "<<i<<" "<<j<<endl; + if(m_write_report) m_file_report<<"ML "<<i<<" Mezzanine "<<j<<" appears to be dead mezzanine"<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MEZZANINE_rean "<<i<<" "<<j<<std::endl; mezz->setStatus(DEADMEZZANINE); //m_dead_tubes_per_sector-=ntubes; m_dead_tubes_per_sector-=ndeadtubes; @@ -1420,8 +1354,8 @@ namespace MuonCalib { double medianOfMediansDeviation=0; double medianDeviationOfMedians=0; - vector<double> values; - vector<double> values_dev; + std::vector<double> values; + std::vector<double> values_dev; for(int i=1; i<=chamber->getNmultilayers(); i++) { Multilayer *ml=chamber->getMultilayer(i); @@ -1454,10 +1388,10 @@ namespace MuonCalib { double chamberFlatness=medianDeviationOfMedians/medianOfMediansDeviation; if(maxMedianMezzanines<MIN_MAXMEDIAN) { - if(m_write_report) m_file_report<<"Mezzanines without enough statistics, not analysed"<<endl; + if(m_write_report) m_file_report<<"Mezzanines without enough statistics, not analysed"<<std::endl; return; } - if(m_write_report) m_file_report<<"ChamberFlatness="<<chamberFlatness<<endl; + if(m_write_report) m_file_report<<"ChamberFlatness="<<chamberFlatness<<std::endl; for(int i=1; i<=chamber->getNmultilayers(); i++) { Multilayer *ml=chamber->getMultilayer(i); @@ -1477,8 +1411,8 @@ namespace MuonCalib { double medianOfOtherMedians=0; double medianOfOtherMediansDevs=0; - vector<double> values; - vector<double> values_dev; + std::vector<double> values; + std::vector<double> values_dev; double minOtherLargerMedians=-1; @@ -1524,26 +1458,18 @@ namespace MuonCalib { continue; } - //if(chamber->getName()!="BIR1A11") continue; - //cout<<"mezzanine status "<<mezz->getStatus()<<endl; - - //cout<<"mezz "<<j<<endl; if(j>0) { if(ml->getMezzanine(j-1)!=NULL) { - //cout<<" sx"<<endl; near_mezz.push_back(ml->getMezzanine(j-1)); } } if(j<(ml->getNmezzanines()-1)) { if(ml->getMezzanine(j+1)!=NULL) { - //cout<<" dx"<<endl; near_mezz.push_back(ml->getMezzanine(j+1)); } } if(other_ml!=NULL) { - // double value=-1; if(other_ml->getMezzanine(j)!=NULL) { - //cout<<" up"<<endl; near_mezz.push_back(other_ml->getMezzanine(j)); } } @@ -1553,32 +1479,19 @@ namespace MuonCalib { bool OneGood=false; double lower_limit=9999999; for(unsigned int k=0; k<near_mezz.size(); k++) { - //if(near_mezz[k]->getStatus()!=10) continue; - -// double other_med=near_mezz[k]->getMedian(); -// double other_meddev=near_mezz[k]->getMedianDeviation(); double other_min70=near_mezz[k]->get70min(); - //if((other_med-2*other_meddev)<0) continue; OneGood=true; if(other_min70<lower_limit) lower_limit=other_min70; - } double max70= mezz->get70max(); if(OneGood&&max70<(lower_limit/5.)&&(lower_limit>5)&&med==0) isDead=true; if(isDead) { - //cout<<chamber->getName()<<" ml="<<i<<" mezz="<<j<<" med="<<med<<" meddev="<<meddev<<" lowlim="<<(lower_limit/5.)<<endl; - for(unsigned int k=0; k<near_mezz.size(); k++) { -// double other_med=near_mezz[k]->getMedian(); -// double other_meddev=near_mezz[k]->getMedianDeviation(); - //cout<<" other md="<<other_med<<" other md_dev="<<other_meddev<<endl; - } - if(m_write_report) m_file_report<<chamber->getName()<<" ML "<<i<<" Mezzanine "<<j<<" appears to be dead_mezzanine; low_limit="<<lower_limit<<" median="<<med<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MEZZANINE "<<i<<" "<<j<<endl; + if(m_write_report) m_file_report<<chamber->getName()<<" ML "<<i<<" Mezzanine "<<j<<" appears to be dead_mezzanine; low_limit="<<lower_limit<<" median="<<med<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_MEZZANINE "<<i<<" "<<j<<std::endl; mezz->setStatus(DEADMEZZANINE); m_deadmezzanines++; m_dead_mezzanines_per_sector++; - // contr=1; } } @@ -1590,9 +1503,9 @@ namespace MuonCalib { if(m_write_report) m_file_report<<"ML"<<i<<" mezz"<<j<<": med="<<mezz->getMedian()<<"; "<<" mad="<<mezz->getMedianDeviation(); if(m_write_report) m_file_report<<"medev"<<medianOfOtherMediansDevs<<"; "; if(m_write_report) m_file_report<<"entries="<<mezz->getEntries()<<"; diffToOthers="<<diffToOthers<<"; "; - if(m_write_report) m_file_report<<"minlargermed="<<minOtherLargerMedians<<endl; + if(m_write_report) m_file_report<<"minlargermed="<<minOtherLargerMedians<<std::endl; if(m_write_report) m_file_report<<"inefficient if med below="; - if(m_write_report) m_file_report<<(minOtherLargerMedians-5*medianOfOtherMediansDevs)<<endl; + if(m_write_report) m_file_report<<(minOtherLargerMedians-5*medianOfOtherMediansDevs)<<std::endl; } } @@ -1627,7 +1540,7 @@ namespace MuonCalib { int ndeadtubes=0; int nnoisytubes=0; - if(m_write_report) m_file_report<<"Starting Tube Analysis"<<endl; + if(m_write_report) m_file_report<<"Starting Tube Analysis"<<std::endl; double median=chamber->getMedian(); //double median_deviation=chamber->getMedianDeviation(); @@ -1646,8 +1559,8 @@ namespace MuonCalib { } if((maxMezzMed>=50)&&(chamber->get70()==0)) { chamber->setStatus(DEADCHAMBER); - if(m_write_report) m_file_report<<chamber->getName()<<" Appears to be a chamber with only few live tubes"<<endl<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" strange_CHAMBER"<<endl; + if(m_write_report) m_file_report<<chamber->getName()<<" Appears to be a chamber with only few live tubes"<<std::endl<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" strange_CHAMBER"<<std::endl; m_deadchambers++; m_dead_chambers_per_sector++; return; @@ -1657,8 +1570,8 @@ namespace MuonCalib { if(median<MINCHAMBERMED) { m_lowstatisticsfortubeschambers++; m_lowstat_chambers_per_sector++; - if(m_write_report) m_file_report<<"This chamber has too low statistics to analyze single tubes"<<endl; - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" LOW STATISTICS FOR TUBES"<<endl; + if(m_write_report) m_file_report<<"This chamber has too low statistics to analyze single tubes"<<std::endl; + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" LOW STATISTICS FOR TUBES"<<std::endl; for(int i=1; i<=chamber->getNmultilayers(); i++) { Multilayer *ml=chamber->getMultilayer(i); if(ml->getStatus()!=10) continue; @@ -1677,7 +1590,6 @@ namespace MuonCalib { } double marco_limit=0.1*(chamber->get90min())-1.; -// double marco_HOTlimit=10.*(chamber->get90max()); for(int i=1; i<=chamber->getNmultilayers(); i++) { Multilayer *ml=chamber->getMultilayer(i); @@ -1687,28 +1599,21 @@ namespace MuonCalib { double limit=medML-SPREADDEAD*medDevML; if(m_write_report) { - m_file_report<<"ML"<<i<<" Tube Limit="<<limit<<"; medML="<<medML<<" ;medDevML="<<medDevML<<"; medML/10="<<((double)medML/10.)<<"; tube noisy over="<<(10*standard_deviation+median)<<" marcolimit="<<marco_limit<<endl; + m_file_report<<"ML"<<i<<" Tube Limit="<<limit<<"; medML="<<medML<<" ;medDevML="<<medDevML<<"; medML/10="<<((double)medML/10.)<<"; tube noisy over="<<(10*standard_deviation+median)<<" marcolimit="<<marco_limit<<std::endl; } for(int j=0; j<ml->getNmezzanines(); j++) { Mezzanine *mezz=ml->getMezzanine(j); if(mezz->getStatus()!=10) continue; -// double medMezz=mezz->getMedian(); -// double medDevMezz=mezz->getMedianDeviation(); double marco_limitMezz=0.1*mezz->get70min()-1; - //if(chamber->getName()=="BIL6A01") cout<<" Mezzanine "<<i<<" "<<j<<" limit="<<marco_limitMezz<<endl; for(int k=1; k<=mezz->getNtubes(); k++) { Tube *t=mezz->getTube(k); if(t->getStatus()!=10) continue; m_ntubes++; int value=t->getValue(); - - //if(chamber->getName()=="BIL6A01") cout<<i<<" "<<j<<" "<<k<<" entries="<<value<<endl; - if(value<marco_limitMezz) { - if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_TUBE "<<t->getML()<<" "<<t->getLayer()<<" "<<t->getPosition()<<endl; - //if(chamber->getName()=="BIL6A01")cout<<"DEAD!!!"<<endl; - + if(value<marco_limitMezz) { + if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_TUBE "<<t->getML()<<" "<<t->getLayer()<<" "<<t->getPosition()<<std::endl; t->setStatus(DEADTUBE); ndeadtubes++; m_deadtubes++; @@ -1716,77 +1621,8 @@ namespace MuonCalib { } } } -// for(int j=1; j<=ml->getNlayers(); j++) -// { -// Layer *l=ml->getLayer(j); -// if(l->getStatus()!=10) continue; -// if(chamber->getName()=="BIL6A01")cout<<"Layer "<<j<<endl; -// for(int k=1; k<=l->getNtubes(); k++) -// { -// Tube *t=l->getTube(k); - -// int value=t->getValue(); -// if(chamber->getName()=="BIL6A01") cout<<i<<" "<<j<<" "<<k<<" entries="<<value<<endl; -// } -// } - -// for(int j=1; j<=ml->getNlayers(); j++) -// { -// Layer *l=ml->getLayer(j); -// if(l->getStatus()!=10) continue; - -// for(int k=1; k<=l->getNtubes(); k++) -// { -// Tube *t=l->getTube(k); -// if(t->getStatus()!=10) continue; -// m_ntubes++; -// int value=t->getValue(); -// double valueSD=(standard_deviation==0)?(0.):((value-median)/standard_deviation); -// //double valueSD=(median_deviation==0)?(0.):((value-median)/median_deviation); altra possibilita' - - -// if(((value<limit)&&(value<(medML/10.))&&(medML>=10)&&(medML<=200))||((value==0)&&(medML>=50))) -// { -// //m_file_report<<"ML "<<i<<" Layer "<<k<<" Tubo "<<k<<" seems to be dead"<<endl; -// if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_TUBE "<<i<<" "<<j<<" "<<k<<endl; -// t->setStatus(DEADTUBE); -// ndeadtubes++; -// m_deadtubes++; -// m_dead_tubes_per_sector++; -// } -// else if(value<(marco_limit)) -// { -// if(m_write_compact_report) m_comp_report<<chamber->getName()<<" dead_TUBE "<<i<<" "<<j<<" "<<k<<endl; -// t->setStatus(DEADTUBE); -// ndeadtubes++; -// m_deadtubes++; -// m_dead_tubes_per_sector++; -// } - -// else if((valueSD>10)&&(median>=10)) -// { -// if(!m_do_noisy) continue; -// //m_file_report<<"ML "<<i<<" Layer "<<k<<" Tubo "<<k<<" seems to be noisy"<<endl; -// if(m_write_compact_report) m_comp_report<<chamber->getName()<<" noisy_TUBE "<<i<<" "<<j<<" "<<k<<endl; -// t->setStatus(NOISYTUBE); -// nnoisytubes++; -// m_noisytubes++; - -// } -// else if(value>marco_HOTlimit) -// { -// if(!m_do_noisy) continue; -// if(m_write_compact_report) m_comp_report<<chamber->getName()<<" noisy_TUBE "<<i<<" "<<j<<" "<<k<<endl; -// t->setStatus(NOISYTUBE); -// nnoisytubes++; -// m_noisytubes++; - -// } - -// } -// } } - if(m_write_report) m_file_report<<"End of tube analysis; "<<ndeadtubes<<"dead tubes found"<<nnoisytubes<<"noisy tubes found"<<endl; + if(m_write_report) m_file_report<<"End of tube analysis; "<<ndeadtubes<<"dead tubes found"<<nnoisytubes<<"noisy tubes found"<<std::endl; } //end MDTDqaDeadElements::analyseTubes @@ -1799,7 +1635,7 @@ namespace MuonCalib { for(int k=1; k<=l->getNtubes(); k++) { Tube *t=l->getTube(k); if((t->getStatus()==10)||(t->getStatus()==0)) continue; - m_filelistofdeads<<"Chamber "<<chamber->getName()<<" ML "<<i<<" L "<<j<<" Tube "<<k<<" DEAD"<<endl; + m_filelistofdeads<<"Chamber "<<chamber->getName()<<" ML "<<i<<" L "<<j<<" Tube "<<k<<" DEAD"<<std::endl; } } } diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTrackAnalysis.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTrackAnalysis.cxx index e335da72110d..b863d0c4cdb6 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTrackAnalysis.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneExtraTools/src/MdtDqaTrackAnalysis.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuonCalib_TrackAnalysisCXX @@ -10,8 +10,6 @@ #include "TH1.h" #include "TProfile.h" -using namespace std; - namespace MuonCalib { MdtDqaTrackAnalysis::MdtDqaTrackAnalysis(RegionSelectionSvc *punt, int trkauthor, HistogramManager *histoman, bool verbose) { @@ -19,19 +17,11 @@ MdtDqaTrackAnalysis::MdtDqaTrackAnalysis(RegionSelectionSvc *punt, int trkauthor m_histoManager=histoman; p_reg_sel_svc=punt; m_verbose=verbose; - // if(m_TrkAuthor==0) cout<<"tracking with MuID algorithm"<<endl; - // if(m_TrkAuthor==100) cout<<"tracking with STACO algorithm"<<endl; } void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_nr*/, const std::vector<MuonCalibSegment *> &segments, unsigned int position) { - // SERVE QUESTO ???? - // if( !p_reg_sel_svc){ - // std::cout << "Region Selection Service NOT INITIALIZED " << std::endl; - // return; - // } - - string histoType; + std::string histoType; const MuonCalibEvent_E& extra_event(dynamic_cast<const MuonCalibEvent_E&>(event)); @@ -126,17 +116,7 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n /*:::::::::::::StacoMuonCombined <-> MuidCB:::::::::::::::::::::::::::::::*/ /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ - - // bool DEBUG_DEVEL = false; - - // if (DEBUG_DEVEL) { - // cout << " " << std::endl; - // cout << "===== Handling Event " << extra_event.eventInfo().eventNumber() << " " - // << extra_event.eventInfo().tag() << " =====" << endl; - // cout << " Nr of PhiPattern: " << extra_event.nrPhiPat() << endl; - // cout << " Nr of Tracks (all authors) : " << extra_event.nrTracks() << endl; - // cout << " Nr of MBTS hits : " << extra_event.nrMBTS() << endl; - // } + MuonCalibEvent_E::TrackVec::const_iterator trk=extra_event.beginTrack(); MuonCalibEvent_E::TrackVec::const_iterator trk_end=extra_event.endTrack(); @@ -147,8 +127,6 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n MuonCalibSelector::TrackVec trk_inner = EventHandler.extendedTracks(1000); MuonCalibSelector::TrkCit track_it = trk_selected.begin(); MuonCalibSelector::TrkCit track_it_end = trk_selected.end(); - // MuonCalibSelector::TrkCit track_inner = trk_inner.begin(); - // MuonCalibSelector::TrkCit track_inner_end = trk_inner.end(); int Id_TrackID = 1000 ; // ID Track int Id_TrackSA = 0 ; // Moore (Moore - Default) @@ -192,9 +170,6 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n MuonCalibSelector::TrkCit trk_SAIP_it3 = trk_SA_IP.begin(); MuonCalibSelector::TrkCit trk_SAIP_end3 = trk_SA_IP.end(); - - // MuonCalibTriggerInfo bunch; - // if( bunch.bcIndex() >0) cout << bunch.bcIndex() << endl; int i_trk_sel = 0; @@ -291,8 +266,6 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n if (h1trkIDmult) h1trkIDmult->Fill(trk_ID.size()); - // if (DEBUG_DEVEL) cout << " DEBUG ID momenta : " << endl; - /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ /*:::::::::::::::::::::::ALGORITHM DEPENDENT (MUID or STACO)::::::::::::::::::::*/ @@ -488,20 +461,6 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n ( (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->p() - (*trk_SAIP_it3)->p())/1000. ); } } -// cout <<"--------------------------------------------------------------------------------------------"<< endl; -// cout <<"COMBINED"<<' '<< "x " << (*trk_CB_it2)->x0() << " y" << (*trk_CB_it2)->y0() << " z " << (*trk_CB_it2)->z0() -// << " p " << (*trk_CB_it2)->p() << " pt " << (*trk_CB_it2)->pt() << endl; -// cout <<"ASSO TAG"<<' '<< "x " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->x0() << " y" << (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->y0() -// << " z " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->z0() -// << " p " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->p() << " pt " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackTag)->pt() << endl; -// if((*trk_CB_it2)->getAssociatedTrack(Id_TrackSA)){ -// cout <<"ASSO SA"<<' '<< "x " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA)->x0() << " y" << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA)->y0() -// << " z " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA)->z0() -// << " p " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA)->p() << " pt " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA)->pt() << endl;} -// if((*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP)){ -// cout <<"ASSO SA_IP"<<' '<< "x " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP)->x0() << " y" << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP)->y0() -// << " z " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP)->z0() -// << " p " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP)->p() << " pt " << (*trk_CB_it2)->getAssociatedTrack(Id_TrackSA_IP)->pt() << endl;} } @@ -516,8 +475,6 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n if(h2_cutflow) h2_cutflow->Fill(1,i); } if(ID_HasCutLevel>1 && IsCombined){ - // cout <<"ID"<<' '<< "x " << (*trk_ID_it2)->x0() << " y " << (*trk_ID_it2)->y0() << " z " << (*trk_ID_it2)->z0() - // << " p " << (*trk_ID_it2)->p() << " pt " << (*trk_ID_it2)->pt() << endl; } } @@ -532,10 +489,6 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n for(int i =0;i<=SA_HasCutLevel;i++){ if(h2_cutflow) h2_cutflow->Fill(2,i); } - if(SA_HasCutLevel>1 && IsCombined){ -// cout <<"SA"<<' '<< "x " << (*trk_SA_it2)->x0() << " y " << (*trk_SA_it2)->y0() << " z " << (*trk_SA_it2)->z0() -// << " p " << (*trk_SA_it2)->p() << " pt " << (*trk_SA_it2)->pt() << endl; - } } for(; trk_SAIP_it2 != trk_SAIP_end2; ++trk_SAIP_it2 ){ @@ -548,10 +501,6 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n for(int i =0;i<=SAIP_HasCutLevel;i++){ if(h2_cutflow) h2_cutflow->Fill(3,i); } - if(SAIP_HasCutLevel>1 && IsCombined){ - // cout <<"SAIP"<<' '<< "x " << (*trk_SAIP_it2)->x0() << " y " << (*trk_SAIP_it2)->y0() << " z " << (*trk_SAIP_it2)->z0() - // << " p " << (*trk_SAIP_it2)->p() << " pt " << (*trk_SAIP_it2)->pt() << endl; - } } for(; trk_Tag_it2 != trk_Tag_end2; ++trk_Tag_it2 ) { @@ -564,10 +513,6 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n for(int i =0;i<=Tag_HasCutLevel;i++){ if(h2_cutflow) h2_cutflow->Fill(4,i); } - if(Tag_HasCutLevel>1 && IsCombined){ -// cout <<"TAG"<<' '<< "x " << (*trk_Tag_it2)->x0() << " y " << (*trk_Tag_it2)->y0() << " z " << (*trk_Tag_it2)->z0() -// << " p " << (*trk_Tag_it2)->p() << " pt " << (*trk_Tag_it2)->pt() << endl; - } } /*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/ @@ -591,11 +536,8 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n goodEvent = CollisionEvent; // IN CASE YOU WANT ALL EVENTS, just COMMENT THIS LINE // HERE SELECT THE TRACK TYPE - string TrackMDTtime_selection = "SA"; - // string TrackMDTtime_selection = "SA_IP"; - // string TrackMDTtime_selection = "Tag"; - // string TrackMDTtime_selection = "CB"; - // string TrackMDTtime_selection = "NONE"; + std::string TrackMDTtime_selection = "SA"; + // HERE SELECT THE CUT THE TRACK MUST PASS // int PASSEDCUT = 0; // if goodEvent = CollisionEvent is enables @@ -634,17 +576,10 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n for (unsigned int k=position; k<segments.size(); k++) { // LOOP OVER SEGMENTS MuonCalibSegment *segment(segments[k]); - // int autore = segment->author(); - // int fitOK = 0; - // if (segment->hasFittedT0() ) fitOK = 1; - // cout << " DEBUG DEBUG : autore, fitOK, t0, chi2 " - // <<autore<<" "<<fitOK<<" "<<segment->fittedT0()<<" "<<segment->chi2() <<endl; const MuonCalibExtendedSegment *segext = (const MuonCalibExtendedSegment* ) segment; segs.push_back(segext); } - // int iallSegMDTtime = -99; - //if (segs.size()>0) iallSegMDTtime = MDTtiming(segs); } else { for(;trkMDTtime_it!=trkMDTtime_it_end;++trkMDTtime_it){ @@ -657,32 +592,23 @@ void MdtDqaTrackAnalysis::handleEvent(const MuonCalibEvent &event, int /*evnt_n int TRACK_HasCutLevel = -10; TRACK_HasCutLevel = cutflow( trkMDTtime_it, dTimeMBTS, Ev_ngoodtrack, Ev_pveto, TRACK_npixel, TRACK_nsct); if (TRACK_HasCutLevel<PASSEDCUT) { - //cout << "DEBUG DEBUG DEBUG : TRACK_HasCutLevel = "<< TRACK_HasCutLevel << endl; continue; } const std::vector<const MuonCalibExtendedSegment*> assoSegments = (*trkMDTtime_it)->associatedSegments(); bool additionalCut = true; - // additionalCut = (*trkMDTtime_it)->z0ip()>2800. && (*trkMDTtime_it)->z0ip()<3800.; if (assoSegments.size()>0 && additionalCut ) iMDTtime = MDTtiming(assoSegments); - // cout << " DEBUG DEBUG iMDTtime = "<<iMDTtime<<endl; if (iMDTtime==1) { - // cout << " debug filling 1 " << endl; if (h2d0VSz0_goodT) { - // cout << " debug filling 1 " << endl; h2d0VSz0_goodT->Fill( (*trkMDTtime_it)->z0ip(), (*trkMDTtime_it)->d0()); } } if (iMDTtime==0) { - // cout << " debug filling 0 " << endl; if (h2d0VSz0_badT) { - // cout << " debug filling 0 " << endl; h2d0VSz0_badT->Fill( (*trkMDTtime_it)->z0ip(), (*trkMDTtime_it)->d0()); } } if (iMDTtime==-1) { - // cout << " debug filling -1 " << endl; if (h2d0VSz0_noSeg) { - // cout << " debug filling -1 " << endl; h2d0VSz0_noSeg->Fill( (*trkMDTtime_it)->z0ip(), (*trkMDTtime_it)->d0()); } } @@ -824,7 +750,7 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm // // MODIFICATIONS INTRODUCED FOR MUON VETO ANALYSIS WITH SEGMENTS refitted-t0 // - string histoType; + std::string histoType; histoType="nSegPerTrack"; TH1F *h1_nSegAll = (TH1F*) m_histoManager->GetHisto("DEBUG",histoType); histoType="nSegPerTrack_HitCut"; TH2F *h2_nSegHitCut = (TH2F*) m_histoManager->GetHisto("DEBUG",histoType); @@ -872,15 +798,11 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm unsigned int MINNUMHITS = 5; int nseg_hitCut = 0; - // if(debug_seg) cout << " ------------- Start loop on Segments. Number of segments: " << segments.size() << endl; std::vector<const MuonCalibExtendedSegment*>::const_iterator seg_it; for (seg_it = segments.begin(); seg_it!=segments.end(); seg_it++) { // START LOOP ON SEGMENTS -// unsigned int nMDThits = (*seg_it)->mdtHitsOnTrack(); if ((*seg_it)->mdtHitsOnTrack() >= MINNUMHITS) { // IF segment has >= MINNUMHITS nseg_hitCut++; if ( nseg_hitCut >=NSEGMAX ) { - // cout << " WARNING : Number of segments in the same layer (inner/mid/out) GREATER THAN "<<NSEGMAX - // << " segment skipped " << endl; continue; } @@ -892,7 +814,7 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm if (t0refit!= 0.) { int hitCount(0); - string chamberName_firstHit; + std::string chamberName_firstHit; int chamberEta_firstHit(0); bool sameChamber = true; bool adjacentChamber = false; @@ -901,7 +823,7 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm hitCount++; MuonFixedId id = (*aHit_it)->identify(); MDTName chamb(id); - string chamberName = chamb.getOnlineName(); + std::string chamberName = chamb.getOnlineName(); if (hitCount==1) { chamberName_firstHit = chamberName; chamberEta_firstHit = chamb.getOnlineEta(); @@ -917,14 +839,9 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm } } - // if (debug_seg) { - // cout << chamberName << " ML "<< id.mdtMultilayer()<< " Layer "<<id.mdtTubeLayer() - // <<" tube " << id.mdtTube() << " tube t0 "<< (*aHit_it)->tubeT0() << endl; - // } } // end loop over hits if (sameChamber || adjacentChamber) { // IF all hits are in the same or adjacent Chamber - // if (sameChamber && chamberEta_firstHit==2) // THIS IS TO STUDY WITH MC THE t0 RESOLUTION t0acceptedSeg[nAcceptedSeg]=t0refit; nAcceptedSeg++; if (chamberName_firstHit.substr(0,2) == "BI") { @@ -966,32 +883,26 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm for (int i=0;i<17;i++) sectorWithSegments[i]=0; for (int n=0;n<nseg_BI;n++) { - // if(debug_seg) cout <<" t0refit_BI, sector " <<t0refit_BI[n][0]<<" "<<t0refit_BI[n][1]<<endl; h2_t0BI->Fill(t0refit_BI[n][1],t0refit_BI[n][0]); sectorWithSegments[(int)t0refit_BI[n][1]]++; } for (int n=0;n<nseg_BM;n++) { - // if(debug_seg) cout <<" t0refit_BM, sector " <<t0refit_BM[n][0]<<" "<<t0refit_BM[n][1]<<endl; h2_t0BM->Fill(t0refit_BM[n][1],t0refit_BM[n][0]); sectorWithSegments[(int)t0refit_BM[n][1]]++; } for (int n=0;n<nseg_BO;n++) { - // if(debug_seg) cout <<" t0refit_BO, sector " <<t0refit_BO[n][0]<<" "<<t0refit_BO[n][1]<<endl; h2_t0BO->Fill(t0refit_BO[n][1],t0refit_BO[n][0]); sectorWithSegments[(int)t0refit_BO[n][1]]++; } for (int n=0;n<nseg_EI;n++) { - // if(debug_seg) cout <<" t0refit_EI, sector " <<t0refit_EI[n][0]<<" "<<t0refit_EI[n][1]<<endl; h2_t0EI->Fill(t0refit_EI[n][1],t0refit_EI[n][0]); sectorWithSegments[(int)t0refit_EI[n][1]]++; } for (int n=0;n<nseg_EM;n++) { - // if(debug_seg) cout <<" t0refit_EM, sector " <<t0refit_EM[n][0]<<" "<<t0refit_EM[n][1]<<endl; h2_t0EM->Fill(t0refit_EM[n][1],t0refit_EM[n][0]); sectorWithSegments[(int)t0refit_EM[n][1]]++; } for (int n=0;n<nseg_EO;n++) { - // if(debug_seg) cout <<" t0refit_EO, sector " <<t0refit_EO[n][0]<<" "<<t0refit_EO[n][1]<<endl; h2_t0EO->Fill(t0refit_EO[n][1],t0refit_EO[n][0]); sectorWithSegments[(int)t0refit_EO[n][1]]++; } @@ -1004,12 +915,6 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm sectorWithHighestNseg = i; } } - // if(debug_seg) { - // cout << " nseg_BI,BM,BO,EI,EM,EO : "<<nseg_BI<<" "<<nseg_BM<<" "<<nseg_BO<<" " - // <<nseg_EI<<" "<<nseg_EM<<" "<<nseg_EO<<endl; - // cout << " Sector with Highest Number of Segments : " <<sectorWithHighestNseg - // << " Nsegments : "<<topnSegInSector<< endl; - // } h2_nSegHitCut->Fill( (float)sectorWithHighestNseg, (float)topnSegInSector ); if (topnSegInSector>1) { // look for combinations BO-BM @@ -1017,7 +922,6 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm for (int n2=0;n2<nseg_BM;n2++) { if (t0refit_BO[n1][1]==(float)sectorWithHighestNseg && t0refit_BM[n2][1]==(float)sectorWithHighestNseg) { float deltat0_BOBM = t0refit_BO[n1][0]-t0refit_BM[n2][0]; - // if(debug_seg) cout << " Found BO-BM = " << deltat0_BOBM <<endl; h2_t0BOBM->Fill((float)sectorWithHighestNseg,deltat0_BOBM); } } @@ -1027,7 +931,6 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm for (int n2=0;n2<nseg_BI;n2++) { if (t0refit_BO[n1][1]==(float)sectorWithHighestNseg && t0refit_BI[n2][1]==(float)sectorWithHighestNseg) { float deltat0_BOBI = t0refit_BO[n1][0]-t0refit_BI[n2][0]; - // if(debug_seg) cout << " Found BO-BI = " << deltat0_BOBI <<endl ; h2_t0BOBI->Fill((float)sectorWithHighestNseg,deltat0_BOBI); } } @@ -1037,7 +940,6 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm for (int n2=0;n2<nseg_BI;n2++) { if (t0refit_BM[n1][1]==(float)sectorWithHighestNseg && t0refit_BI[n2][1]==(float)sectorWithHighestNseg) { float deltat0_BMBI = t0refit_BM[n1][0]-t0refit_BI[n2][0]; - // if(debug_seg) cout << " Found BM-BI = " << deltat0_BMBI <<endl ; h2_t0BMBI->Fill((float)sectorWithHighestNseg,deltat0_BMBI); } } @@ -1048,7 +950,6 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm for (int n2=0;n2<nseg_EM;n2++) { if (t0refit_EO[n1][1]==(float)sectorWithHighestNseg && t0refit_EM[n2][1]==(float)sectorWithHighestNseg) { float deltat0_EOEM = t0refit_EO[n1][0]-t0refit_EM[n2][0]; - // if(debug_seg) cout << " Found EO-EM = " << deltat0_EOEM <<endl; h2_t0EOEM->Fill((float)sectorWithHighestNseg,deltat0_EOEM); } } @@ -1058,7 +959,6 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm for (int n2=0;n2<nseg_EI;n2++) { if (t0refit_EO[n1][1]==(float)sectorWithHighestNseg && t0refit_EI[n2][1]==(float)sectorWithHighestNseg) { float deltat0_EOEI = t0refit_EO[n1][0]-t0refit_EI[n2][0]; - // if(debug_seg) cout << " Found EO-EI = " << deltat0_EOEI <<endl ; h2_t0EOEI->Fill((float)sectorWithHighestNseg,deltat0_EOEI); } } @@ -1068,7 +968,6 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm for (int n2=0;n2<nseg_EI;n2++) { if (t0refit_EM[n1][1]==(float)sectorWithHighestNseg && t0refit_EI[n2][1]==(float)sectorWithHighestNseg) { float deltat0_EMEI = t0refit_EM[n1][0]-t0refit_EI[n2][0]; - // if(debug_seg) cout << " Found EM-EI = " << deltat0_EMEI <<endl ; h2_t0EMEI->Fill((float)sectorWithHighestNseg,deltat0_EMEI); } } @@ -1083,9 +982,7 @@ int MdtDqaTrackAnalysis::MDTtiming(const std::vector<const MuonCalibExtendedSegm } if (nAcceptedSeg>0 && nacc==nAcceptedSeg) iMDTtime = 1; // THIS CONDITION is verified if ALL segments are good ! if (nAcceptedSeg>0 && nacc<nAcceptedSeg) iMDTtime = 0; - - // cout << " DEBUG DEBUG iMDTtime in the class = "<<iMDTtime<<endl; - + return iMDTtime; } //end MdtDqaTrackAnalysis::MDTtiming diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx index e979db49abd1..bb30b9207efa 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleControlHistogramsTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -20,10 +20,6 @@ //:: NtupleControlHistogramsTool :: //:::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - // standard C++ // #include <iostream> #include <fstream> @@ -31,10 +27,8 @@ // CLHEP // #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" -// MuonReadoutGeometry // #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" -// MuonCalib // #include "MuonCalibStandAloneTools/NtupleControlHistogramsTool.h" #include "MuonCalibEventBase/MuonCalibRawHitCollection.h" #include "MuonCalibEventBase/MuonCalibRawMdtHit.h" @@ -45,16 +39,10 @@ #include "MdtCalibT0/T0MTHistos.h" #include "MuonCalibStandAloneBase/RegionSelectionSvc.h" #include "MdtCalibIOSvc/MdtCalibInputSvc.h" -//root; #include "TF1.h" #include "TTree.h" #include "TProfile.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - -using namespace std; using namespace MuonCalib; //***************************************************************************** @@ -88,19 +76,19 @@ NtupleControlHistogramsTool::NtupleControlHistogramsTool(const std::string & t, m_road_width = 1.0; // by default road width = 1 mm declareProperty("roadWidth", m_road_width); - m_MDT_ID_helper = string("MDTIDHELPER"); + m_MDT_ID_helper = std::string("MDTIDHELPER"); declareProperty("MDTIdHelper", m_MDT_ID_helper); - m_RPC_ID_helper = string("RPCIDHELPER"); + m_RPC_ID_helper = std::string("RPCIDHELPER"); declareProperty("RPCIdHelper", m_RPC_ID_helper); - m_idToFixedIdToolType = string("MuonCalib::IdToFixedIdTool"); + m_idToFixedIdToolType = std::string("MuonCalib::IdToFixedIdTool"); declareProperty("idToFixedIdToolType", m_idToFixedIdToolType); - m_idToFixedIdToolName = string("MuonCalib_IdToFixedIdTool"); + m_idToFixedIdToolName = std::string("MuonCalib_IdToFixedIdTool"); declareProperty("idToFixedIdToolName", m_idToFixedIdToolName); - m_ROOT_file_name = string("NtupleControlHistogramsTool.root"); + m_ROOT_file_name = std::string("NtupleControlHistogramsTool.root"); declareProperty("ROOTFileName", m_ROOT_file_name); ///////////////////////////// @@ -302,8 +290,8 @@ StatusCode NtupleControlHistogramsTool::finalize(void) { station_phi = it->first.GetPhi(); station_name = it->first.GetStation(); strncpy(station_name_str, id.stationNumberToFixedStationString(it->first.GetStation()).c_str(), 9); - ostringstream sw_id; - ostringstream hw_id; + std::ostringstream sw_id; + std::ostringstream hw_id; hw_id<<station_name_str<<abs(station_eta); if(station_eta>0) hw_id<<"A"; @@ -416,7 +404,6 @@ StatusCode NtupleControlHistogramsTool::handleEvent( /////////////// const MuonCalibRawHitCollection *raw_hits(event.rawHitCollection()); -// const MuonCalibSegment *rpcHits(event.rpcHitCollection()); unsigned int ml, ly, tb; // multilayer, layer, tube unsigned int ndof; // number of degrees of freedom of the segment fit int strip, strip2; // rpc strip @@ -1020,7 +1007,7 @@ void NtupleControlHistogramsTool::createMaps(const MuonFixedId & id) { // histograms // ToString tostring; - string file_dir(id.stationNumberToFixedStationString(id.stationName()) + std::string file_dir(id.stationNumberToFixedStationString(id.stationName()) +"_"+tostring(id.phi())+"_"+tostring(id.eta())); m_tfile->mkdir(file_dir.c_str()); m_tfile->cd(file_dir.c_str()); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleSimpleResolutionTool.cxx b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleSimpleResolutionTool.cxx index bf4c15d7649d..43e30ca362e3 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleSimpleResolutionTool.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibStandAlone/MuonCalibStandAloneTools/src/NtupleSimpleResolutionTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //*********************************************************// @@ -7,10 +7,6 @@ // Author: I.Potrap (MPI) // //*********************************************************// -////////////////// -// HEADER FILES // -////////////////// - // standard C++ // #include <iostream> #include <fstream> @@ -30,7 +26,6 @@ #include "MuonCalibStandAloneTools/NtupleSimpleresolutionTool.h" #include "MdtCalibIOSvc/MdtCalibInputSvc.h" - //root #include "TFile.h" #include "TH1.h" @@ -43,11 +38,6 @@ #include "CLHEP/Matrix/Matrix.h" #include "CLHEP/Matrix/Vector.h" -//////////////////////// -// NAMESPACE SETTINGS // -//////////////////////// - -using namespace std; namespace MuonCalib { const unsigned int NtupleSimpleResolutionTool::MAXNUMHITS=50; @@ -85,7 +75,7 @@ m_calib_input_svc("MdtCalibInputSvc", n), m_reg_sel_svc("RegionSelectionSvc", n) declareProperty("SuppressionLow", m_SUPPRESS_LOW); m_SUPPRESS_TOP = 0.2; declareProperty("SuppressionTop", m_SUPPRESS_TOP); - m_spr_out_name = string("spr_out.root"); + m_spr_out_name = std::string("spr_out.root"); declareProperty("OutputResolutionFunction", m_spr_out_name); } @@ -477,11 +467,11 @@ void NtupleSimpleResolutionTool::end_of_data(const IRtRelation * rt_rel) { // SpRes from DistToTrack calculation: spResCalc(false); - ofstream outfile("spr.out", ios::app); - outfile<<m_reg_sel_svc->GetRegionSelection()<<": NumIt-s ="<<setw(3)<<iteration<< - " conv ="<<setw(6)<<setprecision(2)<<delta_conv<< - " r_conv ="<<setw(6)<<setprecision(2)<<r_conv<< - " NumOfSegments ="<<setw(6)<<m_refitted_segment.size()<<endl; + std::ofstream outfile("spr.out", std::ios::app); + outfile<<m_reg_sel_svc->GetRegionSelection()<<": NumIt-s ="<<std::setw(3)<<iteration<< + " conv ="<<std::setw(6)<<std::setprecision(2)<<delta_conv<< + " r_conv ="<<std::setw(6)<<std::setprecision(2)<<r_conv<< + " NumOfSegments ="<<std::setw(6)<<m_refitted_segment.size()<<std::endl; outfile.close(); delete sprfun_old; @@ -531,7 +521,7 @@ void NtupleSimpleResolutionTool::end_of_data(const IRtRelation * rt_rel) { // } // perform sigma-t fit // - vector<SamplePoint> point(31); + std::vector<SamplePoint> point(31); double r_min(rt_rel->radius(rt_rel->tLower())); double r_max(rt_rel->radius(rt_rel->tUpper())); double bin_width((r_max-r_min)/static_cast<double>(point.size()-1)); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/ConstantContentBinMaker.cxx b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/ConstantContentBinMaker.cxx index c013940a8b55..97b2e3c26a85 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/ConstantContentBinMaker.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/ConstantContentBinMaker.cxx @@ -1,23 +1,11 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 08.06.2008, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MuonCalibMath/ConstantContentBinMaker.h" #include <iostream> -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: using namespace MuonCalib; -using namespace std; //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS ConstantContentBinMaker :: diff --git a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataBin.cxx b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataBin.cxx index b3832fe10daf..c39a2690a282 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataBin.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataBin.cxx @@ -1,26 +1,13 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 07.06.2008, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MuonCalibMath/DataBin.h" #include <algorithm> #include <iostream> #include "cmath" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - using namespace MuonCalib; -using namespace std; //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS DataBin :: diff --git a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataPoint.cxx b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataPoint.cxx index 177727b92b63..edad7cfb2fb7 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataPoint.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataPoint.cxx @@ -1,15 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 07.06.2008, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include "MuonCalibMath/DataPoint.h" //:::::::::::::::::::::::: @@ -17,7 +9,6 @@ //:::::::::::::::::::::::: using namespace MuonCalib; -using namespace std; //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS DataPoint :: diff --git a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/PolygonBase.cxx b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/PolygonBase.cxx index 4758ca847065..634201da76bb 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/PolygonBase.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/PolygonBase.cxx @@ -1,25 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// 29.06.2006, AUTHOR: OLIVER KORTNER -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -//:::::::::::::::::: -//:: HEADER FILES :: -//:::::::::::::::::: - #include <iostream> #include <cstdlib> #include "MuonCalibMath/PolygonBase.h" -//:::::::::::::::::::::::: -//:: NAMESPACE SETTINGS :: -//:::::::::::::::::::::::: - using namespace MuonCalib; -using namespace std; //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS PolygonBase :: -- GitLab From e1a0357561aae3f3b40547d21f60c7a45457a8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= <nicolas.koehler@cern.ch> Date: Thu, 16 Apr 2020 10:10:09 +0200 Subject: [PATCH 2/2] fix compilation of MuonCalibMath --- .../MuonCalibMath/CMakeLists.txt | 5 +++-- .../src/ConstantContentBinMaker.cxx | 12 +++++----- .../MuonCalibMath/src/DataBin.cxx | 17 +++++--------- .../MuonCalibMath/src/PolygonBase.cxx | 22 +++---------------- 4 files changed, 19 insertions(+), 37 deletions(-) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/CMakeLists.txt b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/CMakeLists.txt index d6238fd0d7a9..fe0be088f2a1 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/CMakeLists.txt +++ b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/CMakeLists.txt @@ -7,7 +7,8 @@ atlas_subdir( MuonCalibMath ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC - Event/EventPrimitives ) + Event/EventPrimitives + Control/AthenaKernel ) # External dependencies: find_package( CLHEP ) @@ -21,6 +22,6 @@ atlas_add_library( MuonCalibMath INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} EventPrimitives + LINK_LIBRARIES ${CLHEP_LIBRARIES} EventPrimitives AthenaKernel PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ) diff --git a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/ConstantContentBinMaker.cxx b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/ConstantContentBinMaker.cxx index 97b2e3c26a85..9a71b1fac180 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/ConstantContentBinMaker.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/ConstantContentBinMaker.cxx @@ -3,6 +3,9 @@ */ #include "MuonCalibMath/ConstantContentBinMaker.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" + #include <iostream> using namespace MuonCalib; @@ -51,7 +54,7 @@ bool ConstantContentBinMaker::binDataPoints(const unsigned int & bin_content, unsigned int n_bins(static_cast<unsigned int>( log(m_points.size()/static_cast<double>(bin_content)) /log(2.0))); - vector<unsigned int> splitting_axis(ref_coord); + std::vector<unsigned int> splitting_axis(ref_coord); unsigned int axis_counter(0); /////////// @@ -66,9 +69,8 @@ bool ConstantContentBinMaker::binDataPoints(const unsigned int & bin_content, ///////////////////////////////////////////////// if (m_points.size()==0 || n_bins<2) { - cerr << endl - << "Class ConstantContentBinMaker, method binDataPoints: WARNING!" - << "\nToo few data points for binning!\n"; + MsgStream log(Athena::getMessageSvc(), "ConstantContentBinMaker"); + log<< MSG::WARNING << "Class ConstantContentBinMaker, method binDataPoints: Too few data points for binning!"<<endmsg; return false; } @@ -77,7 +79,7 @@ bool ConstantContentBinMaker::binDataPoints(const unsigned int & bin_content, //////////////////////////////// if (ref_coord.size()==0) { - splitting_axis = vector<unsigned int>( + splitting_axis = std::vector<unsigned int>( m_points[0].dataVector().rows()); for (unsigned int k=0; k<splitting_axis.size(); k++) { splitting_axis[k] = k; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataBin.cxx b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataBin.cxx index c39a2690a282..852e874026f3 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataBin.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/DataBin.cxx @@ -6,6 +6,7 @@ #include <algorithm> #include <iostream> #include "cmath" +#include <TString.h> // for Form using namespace MuonCalib; @@ -50,9 +51,7 @@ DataBin::DataBin(const Amg::VectorX & lower_boundaries, //////////////////////////////////////////////////////// if (lower_boundaries.rows()!=upper_boundaries.rows()) { - cerr << "Class MuonCalibMath/DataBin, constructor: ERROR!\n" - << "Dimensions of lower and upper bin boundaries disagree.\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nDataBin::DataBin - Dimensions of lower and upper bin boundaries disagree.", __FILE__, __LINE__)); } ////////////////////////////////////////////////////// @@ -179,9 +178,7 @@ DataBin * DataBin::splitBin(const unsigned int & ref_coord) { //////////////////////////////////////////////////////////////////// if (ref_coord>=static_cast<unsigned int >(m_bin_centre.rows())) { - cerr << "Class MuonCalibMath/DataBin, method splitBin: ERROR!\n" - << "Reference coordinate out of range!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nDataBin::splitBin - Reference coordinate out of range!", __FILE__, __LINE__)); } //////////////////////////////////////////////////// @@ -189,9 +186,7 @@ DataBin * DataBin::splitBin(const unsigned int & ref_coord) { //////////////////////////////////////////////////// if (m_points.size()<4) { - cerr << "Class MuonCalibMath/DataBin, method splitBin: ERROR!\n" - << "Less than 4 points in the bin!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nDataBin::splitBin - Less than 4 points in the bin!", __FILE__, __LINE__)); } ///////////////////////////////////////////////////////////// @@ -215,7 +210,7 @@ DataBin * DataBin::splitBin(const unsigned int & ref_coord) { Amg::VectorX bin_1_low = m_lower_boundaries; Amg::VectorX bin_1_up = m_upper_boundaries; bin_1_up[ref_coord] = (m_points[k_split]).dataVector()[ref_coord]; - vector<DataPoint> bin_1_points(k_split); + std::vector<DataPoint> bin_1_points(k_split); for (unsigned k=0; k<k_split; k++) { bin_1_points[k] = m_points[k]; } @@ -224,7 +219,7 @@ DataBin * DataBin::splitBin(const unsigned int & ref_coord) { Amg::VectorX bin_2_low = m_lower_boundaries; bin_2_low[ref_coord] = (m_points[k_split]).dataVector()[ref_coord]; Amg::VectorX bin_2_up = m_upper_boundaries; - vector<DataPoint> bin_2_points(m_points.size()-k_split); + std::vector<DataPoint> bin_2_points(m_points.size()-k_split); for (unsigned int k=k_split; k<m_points.size(); k++) { bin_2_points[k-k_split] = m_points[k]; } diff --git a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/PolygonBase.cxx b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/PolygonBase.cxx index 634201da76bb..0a5844a0486c 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/PolygonBase.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibUtils/MuonCalibMath/src/PolygonBase.cxx @@ -5,19 +5,10 @@ #include <iostream> #include <cstdlib> #include "MuonCalibMath/PolygonBase.h" +#include <TString.h> // for Form using namespace MuonCalib; -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -//:: IMPLEMENTATION OF METHODS DEFINED IN THE CLASS PolygonBase :: -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -//***************************************************************************** - -//::::::::::::::::::: -//:: METHOD init :: -//::::::::::::::::::: - void PolygonBase::init(const std::vector<double> & x) { /////////////////////////////// @@ -26,10 +17,7 @@ void PolygonBase::init(const std::vector<double> & x) { for (unsigned int k=0; k<x.size()-1; k++) { if (x[k]>=x[k+1]) { - cerr << "\n" - << "Class PolygonBase, method init: ERROR!\n" - << "Abscissae not in increasing order!\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nPolygonBase::init - Abscissae not in increasing order!", __FILE__, __LINE__)); } } @@ -56,11 +44,7 @@ double PolygonBase::value(const int & k, const double & x) const { /////////////////////////////////// if (k<0 || k>static_cast<int>(m_x.size()-1)) { - cerr << "\n" - << "Class PolygonBase, method value: ERROR!\n" - << "Illegal function index " << k << "!\n" - << "Should be >0 and <" << m_x.size() << ".\n"; - exit(1); + throw std::runtime_error(Form("File: %s, Line: %d\nPolygonBase::value - Illegal function index %i! Should be >0 and <%lu", __FILE__, __LINE__, k, m_x.size())); } ////////////////////////////////////////////// -- GitLab