diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..6b4a6648b6e78ca5d71caf7de73a70f7e6c5fd82 --- /dev/null +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigT1/TrigT1NSWSimTools diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/L1TdrStgcTriggerLogic.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/L1TdrStgcTriggerLogic.h index 28ad419f4cd1ae688ea5ac6969dcda8f1e66e62b..b3fefe6d8e1bc6a4f2a868e4b3b8277ef84d2ddd 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/L1TdrStgcTriggerLogic.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/L1TdrStgcTriggerLogic.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - 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 NSW_L1TDRSTGCTRIGGERLOGIC_H @@ -10,8 +10,7 @@ #include "TrigT1NSWSimTools/TriggerTypes.h" #include "TrigT1NSWSimTools/SectorTriggerCandidate.h" #include "TrigT1NSWSimTools/SingleWedgePadTrigger.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" -#include "AthenaKernel/MsgStreamMember.h" +#include "AthenaBaseComps/AthMessaging.h" #include <string> @@ -45,12 +44,11 @@ namespace NSWL1 { davide.gerbaudo@gmail.com April 2013 */ -class L1TdrStgcTriggerLogic { +class L1TdrStgcTriggerLogic : public AthMessaging { public: L1TdrStgcTriggerLogic();//get svc from parent class - virtual ~L1TdrStgcTriggerLogic(); /** @brief main function to compute trigger candidates @@ -104,21 +102,6 @@ class L1TdrStgcTriggerLogic { const std::vector< size_t > &padIndicesLayer1, const std::vector< size_t > &padIndicesLayer2, const std::vector< size_t > &padIndicesLayer3); - protected: - /// Log a message using the Athena controlled logging system - MsgStream& msg(MSG::Level lvl) const { return m_msg.get() << lvl; } - - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl(MSG::Level lvl) { return m_msg.get().level() <= lvl; } - - - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; - - - - - private: std::vector<size_t> filterByLayer(const std::vector<std::shared_ptr<PadOfflineData>> &pads, diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMLoadVariables.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMLoadVariables.h index a5d34a11aeaead04ac109ca97f36bb76c2ec6444..e4ea56d0bf589d33239676ddf1e62da34c269b10 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMLoadVariables.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMLoadVariables.h @@ -6,7 +6,7 @@ #define MMLOADVARIABLES_H #include "MMT_struct.h" //for digitWrapper, hitData_key, hitData_entry, evInf_entry -#include "AthenaBaseComps/AthMsgStreamMacros.h" +#include "AthenaBaseComps/AthMessaging.h" #include <map> #include <vector> @@ -24,12 +24,11 @@ namespace MuonGM { class MuonDetectorManager; } - class MMLoadVariables { + class MMLoadVariables : public AthMessaging { public: MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetectorManager* detManager, const MmIdHelper* idhelper, MMT_Parameters *par); - ~MMLoadVariables()=default; void getMMDigitsInfo(std::vector<digitWrapper>& entries, std::map<hitData_key,hitData_entry>& Hits_Data_Set_Time, std::map<int,evInf_entry>& Event_Info); //Import_Athena..._.m stuff @@ -125,24 +124,6 @@ namespace MuonGM { std::vector<int> NSWMM_off_channel; }; histogramVariables histVars; - - protected: - /// Log a message using the Athena controlled logging system - MsgStream& - msg(MSG::Level lvl) const { - return m_msg.get() << lvl; - } - - /// Check whether the logging system is active at the provided verbosity level - bool - msgLvl(MSG::Level lvl) { - return m_msg.get().level() <= lvl; - } - - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; - - private: diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Finder.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Finder.h index 7702886a9737a5048b56cd29efbcf97755edac0b..ead0f1119c097774cfa028b8269d06ae6d53ec09 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Finder.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Finder.h @@ -1,18 +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 */ #ifndef MMT_FINDER_H #define MMT_FINDER_H - -#include "AthenaKernel/MsgStreamMember.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" +#include "AthenaBaseComps/AthMessaging.h" #include "MMT_struct.h" -class MMT_Finder{ +class MMT_Finder : public AthMessaging { public: MMT_Finder(MMT_Parameters *par, int nUVRoads = 1); ~MMT_Finder(){} @@ -22,12 +20,6 @@ class MMT_Finder{ void fillHitBuffer(std::map<std::pair<int,int>,finder_entry>& hitBuffer, const Hit& hit) const; void checkBufferForHits(std::vector<bool>& plane_is_hit, std::vector<Hit>& track, int road, std::map<std::pair<int,int>,finder_entry> hitBuffer) const; - - // / Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } - // / Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - private: std::vector<int> q_planes(const std::string& type) const; //Finder components @@ -40,8 +32,5 @@ class MMT_Finder{ MMT_Parameters* m_par; int m_nUVRoads; - - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; }; #endif diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Fitter.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Fitter.h index 6d68b56d84eb3264dfacd14b7c1a38f9dbf3503b..3f6fb557f0b3173a835dfc5d6fdcdb5843973f0c 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Fitter.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_Fitter.h @@ -1,19 +1,18 @@ /* - 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 MMT_FITTER_H #define MMT_FITTER_H -#include "AthenaKernel/MsgStreamMember.h" +#include "AthenaBaseComps/AthMessaging.h" #include "MMT_struct.h" -class MMT_Fitter{ +class MMT_Fitter : AthMessaging { public: MMT_Fitter(MMT_Parameters *par, int nlg=256, double LG_min=0., double LG_max=0.5); - ~MMT_Fitter(){} void Get_Fit(std::vector<Hit>& track, std::map<int,evFit_entry>& Event_Fit, std::map<hitData_key,hitData_entry>& Hits_Data_Set_Time); evFit_entry fit_event(int event, std::vector<Hit>& track, std::vector<hitData_entry>& hitDatas, int& nfit, std::vector<std::pair<double,double> >&mxmy, double& mxl, double& mv, double& mu) const; int get_last() const {return m_last;} @@ -21,12 +20,6 @@ class MMT_Fitter{ int SC_ROI_n_y() const {return m_par->n_y;} int find_hitData(const std::vector<hitData_entry>& hitDatas, const hitData_key& key) const; - - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - protected: int m_last; //some variables @@ -69,8 +62,5 @@ class MMT_Fitter{ float32fixed<2> m_LG_min,m_LG_max; std::vector<int> q_planes(char type) const;//return position of what planes are where - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; - }; #endif diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_struct.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_struct.h index b26e025512ae752d66adfe0bc91ae67f836efaaf..89e0f4dda95f22ae249f60e9c755188542909f55 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_struct.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_struct.h @@ -12,7 +12,7 @@ #include "MuonDigitContainer/MmDigit.h" #include "MuonSimEvent/MMSimHitCollection.h" -#include "AthenaKernel/MsgStreamMember.h" +#include "AthenaBaseComps/AthMessaging.h" #include "TLorentzVector.h" #include "TMath.h" @@ -193,7 +193,7 @@ struct par_par{ }; -class MMT_Parameters{ +class MMT_Parameters : public AthMessaging { public: MMT_Parameters(par_par inputParams,char wedgeSize, const MuonGM::MuonDetectorManager* detManager); @@ -309,16 +309,6 @@ class MMT_Parameters{ float32fixed<18> mid_plane_large_X, mid_plane_large, mid_plane_large_UV; float32fixed<4> vertical_strip_width_UV; - - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; - - }; struct mm_digit_entry{ diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMTriggerTool.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMTriggerTool.h index 01dfb723f2c185b208fbaf1e43db8352f1107f1d..4ade632b0c32a33832564cb572cf2bc37ff2da34 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMTriggerTool.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMTriggerTool.h @@ -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 MMTRIGGERTOOL_H @@ -70,7 +70,7 @@ namespace NSWL1 { //Histogram StatusCode book_branches(); //!< book the branches void clear_ntuple_variables(); //!< clear the variables used in the analysis ntuple - void fillNtuple(MMLoadVariables loadedVariables); + void fillNtuple(const MMLoadVariables& loadedVariables); // properties: container and service names diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/L1TdrStgcTriggerLogic.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/L1TdrStgcTriggerLogic.cxx index d5783c03eb89d34842922b33f3bd1c5b82d2a7b9..b1d8f4c359ecf8b5f1ad8735bb3de948b61544bb 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/L1TdrStgcTriggerLogic.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/L1TdrStgcTriggerLogic.cxx @@ -1,13 +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 */ +#include "AthenaKernel/getMessageSvc.h" + #include "TrigT1NSWSimTools/L1TdrStgcTriggerLogic.h" #include "TrigT1NSWSimTools/SectorTriggerCandidate.h" #include "TrigT1NSWSimTools/SingleWedgePadTrigger.h" #include "TrigT1NSWSimTools/tdr_compat_enum.h" #include "TrigT1NSWSimTools/GeoUtils.h" #include "TrigT1NSWSimTools/PadOfflineData.h" + #include <fstream> #include <functional> #include <numeric> @@ -23,12 +26,9 @@ namespace NSWL1{ L1TdrStgcTriggerLogic::L1TdrStgcTriggerLogic(): - - m_msg("L1TdrStgcTriggerLogic"){ - } - //------------------------------------- - L1TdrStgcTriggerLogic::~L1TdrStgcTriggerLogic() {} + AthMessaging(Athena::getMessageSvc(), "L1TdrStgcTriggerLogic") {} //------------------------------------- + bool L1TdrStgcTriggerLogic::hitPattern(const std::shared_ptr<PadOfflineData> &firstPad, const std::shared_ptr<PadOfflineData> &otherPad, std::string &pattern) { return L1TdrStgcTriggerLogic::hitPattern(firstPad->padEtaId(), firstPad->padPhiId(), otherPad->padEtaId(), diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx index 9f8c6b7b50c6c48334c9bcfaa91ee0ebeea4bc6e..aa70dd67d5078364ef42d3da2a2143fe7e44ca8e 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMLoadVariables.cxx @@ -17,16 +17,18 @@ #include "EventInfo/EventID.h" #include "StoreGate/StoreGateSvc.h" #include "MuonIdHelpers/MmIdHelper.h" +#include "AthenaKernel/getMessageSvc.h" #include "TVector3.h" #include <cmath> +#include <stdexcept> using std::map; using std::vector; using std::string; MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetectorManager* detManager, const MmIdHelper* idhelper, MMT_Parameters *par): - m_msg("MMLoadVariables"){ + AthMessaging(Athena::getMessageSvc(), "MMLoadVariables") { m_par = par; m_evtStore = evtStore; m_detManager = detManager; @@ -517,7 +519,7 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec int setl=setup.length(); if(plane>=setl||plane<0){ ATH_MSG_FATAL("Pick a plane in [0,"<<setup.length()<<"] not "<<plane); - exit(1); + throw std::runtime_error("MMLoadVariables::Get_Strip_ID: invalid plane"); } string xuv=setup.substr(plane,1); if(xuv=="u"){//||xuv=="v"){ @@ -530,7 +532,7 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec } else if(xuv!="x"){ ATH_MSG_FATAL("Invalid plane option " << xuv ); - exit(2); + throw std::runtime_error("MMLoadVariables::Get_Strip_ID: invalid plane"); } double strip_hit = ceil(y_hit*1./strip_width); return strip_hit; diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMStripTdsOfflineTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMStripTdsOfflineTool.cxx index 0a0afcf900e4c15c21dcda818a3b6eaeef253fa5..af3b6f251c73d39e60b2a6e8d9c01430d97e1c06 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMStripTdsOfflineTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMStripTdsOfflineTool.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 */ // Athena/Gaudi includes @@ -610,7 +610,8 @@ namespace NSWL1 { double y_hit=Y; int setl=setup.length(); if(plane>=setl||plane<0){ - ATH_MSG_ERROR("Pick a plane in [0,"<<setup.length()<<"] not "<<plane); exit(1); + ATH_MSG_ERROR("Pick a plane in [0,"<<setup.length()<<"] not "<<plane); + throw std::runtime_error("MMStripTdsOfflineTool::Get_Strip_ID: invalid plane index"); } std::string xuv=setup.substr(plane,1); if(xuv=="u"){//||xuv=="v"){ @@ -622,7 +623,8 @@ namespace NSWL1 { y_hit = -X*sin(degree)+Y*cos(degree); } else if(xuv!="x"){ - ATH_MSG_ERROR("Invalid plane option " << xuv); exit(2); + ATH_MSG_ERROR("Invalid plane option " << xuv); + throw std::runtime_error("MMStripTdsOfflineTool::Get_Strip_ID: invalid plane option"); } double strip_hit = ceil(y_hit*1./strip_width); return strip_hit; diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Finder.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Finder.cxx index 22628e9e01f88ec45cabd258e5480f628a26e16e..d923ed329bd7f0a45ed0e8d056f9f4c65d7872bf 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Finder.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Finder.cxx @@ -1,7 +1,8 @@ /* - 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 "AthenaKernel/getMessageSvc.h" #include "TrigT1NSWSimTools/MMT_Finder.h" using std::vector; @@ -9,7 +10,8 @@ using std::map; using std::pair; using std::string; -MMT_Finder::MMT_Finder(MMT_Parameters *par, int nUVRoads){ +MMT_Finder::MMT_Finder(MMT_Parameters *par, int nUVRoads) : + AthMessaging(Athena::getMessageSvc(), "MMT_Finder") { ATH_MSG_DEBUG("MMT_Finder::building finder"); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Fitter.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Fitter.cxx index 89e7fea16cdc715229c55c93c1843d577cc99e1c..d5b3c0affdc2b0ee35ec6d5d31323fa2be49b870 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Fitter.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_Fitter.cxx @@ -1,12 +1,12 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// Athena/Gaudi includes -#include "AthenaBaseComps/AthMsgStreamMacros.h" +#include "AthenaKernel/getMessageSvc.h" #include "TrigT1NSWSimTools/MMT_Fitter.h" +#include <stdexcept> using std::set; using std::vector; @@ -14,7 +14,9 @@ using std::pair; using std::string; -MMT_Fitter::MMT_Fitter(MMT_Parameters *par, int nlg, double lgmin, double lgmax): /*m_par(par),*/ m_number_LG_regions(nlg), m_LG_min(lgmin), m_LG_max(lgmax), m_msg("MMT_Fitter") +MMT_Fitter::MMT_Fitter(MMT_Parameters *par, int nlg, double lgmin, double lgmax): + AthMessaging(Athena::getMessageSvc(), "MMT_Fitter"), + m_number_LG_regions(nlg), m_LG_min(lgmin), m_LG_max(lgmax) { ATH_MSG_DEBUG("MMT_F::building fitter"); m_par=par; @@ -45,7 +47,7 @@ evFit_entry MMT_Fitter::fit_event(int event, vector<Hit>& track, vector<hitData_ if(ROI.theta==-999){ for(unsigned int i=0;i<track.size();i++) track[i].print(); ATH_MSG_WARNING("SOMETHING IS OFF! fit_event\n"); - exit(-999); + throw std::runtime_error("MMT_Fitter::fit_event: invalid ROI.theta"); } float32fixed<2> M_x_local = Get_Local_Slope(track,ROI.theta.getFixed(),ROI.phi.getFixed()),Delta_Theta_division = Get_Delta_Theta_division(M_x_local,M_x_global,1.), Delta_Theta = Get_Delta_Theta(M_x_local,M_x_global), dtheta_idl=Get_Delta_Theta_division(ideal_local_slope(track),M_x_global); @@ -273,11 +275,11 @@ float32fixed<2> MMT_Fitter::DT_Factors_val(int i, int j) const{ } if(j<0||j>1){ ATH_MSG_WARNING("DT_Factors only has two entries on the second index (for LG and mult_factor); you inputed an index of " << j ); - exit(1); + throw std::runtime_error("MMT_Fitter::DT_Factors_val: invalid index"); } if(i<0||i>=m_number_LG_regions){ ATH_MSG_WARNING("There are " << m_number_LG_regions << " in DT_Factors(_val); you inputed an index of " << i ); - exit(1); + throw std::runtime_error("MMT_Fitter::DT_Factors_val: invalid index"); } double a=1.;//not sure what this is for, so hard to choose fixed_point algebra if(j==0) return mult_factor_lgr(i,a,m_number_LG_regions,m_LG_min,m_LG_max); @@ -305,7 +307,7 @@ vector<Hit> MMT_Fitter::q_hits(const string& type,const vector<Hit>& track) cons string setup(m_par->setup); if(setup.length()!=track.size()){ ATH_MSG_WARNING("Setup has length: "<<setup.length()<<", but there are "<<track.size()<<" hits in the track"); - exit(2); + throw std::runtime_error("MMT_Fitter::q_hits: inconsistent setup"); } vector<int> qpl(m_par->q_planes(type)); vector<Hit> q_hits; @@ -407,7 +409,7 @@ float32fixed<4> MMT_Fitter::Slope_Components_ROI_val(int jy, int ix, int thetaph } if(thetaphi<0||thetaphi>1){ ATH_MSG_WARNING("Slope_Components_ROI only has two entries on the third index (for theta and phi); you inputed an index of " << thetaphi); - exit(2); + throw std::runtime_error("MMT_Fitter::Slope_Components_ROI_val: invalid number of entries"); } if(thetaphi==0) return Slope_Components_ROI_theta(jy,ix); return Slope_Components_ROI_phi(jy,ix); diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_struct.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_struct.cxx index 2f37a669d270446f5e9012d444144c47d89b7ce0..8fec1e823908f0cf37c887346bd7239e15e1db77 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_struct.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMT_struct.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigT1NSWSimTools/MMT_struct.h" @@ -9,9 +9,9 @@ #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MMReadoutElement.h" +#include "AthenaKernel/getMessageSvc.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" - +#include <stdexcept> using std::vector; using std::string; @@ -22,7 +22,7 @@ using std::setprecision; using std::setw; -float MMTStructConst = 8192.; +const float MMTStructConst = 8192.; std_align::std_align(int qcm,const TVector3& trans,const TVector3& ang):type(qcm),translate(trans),rotate(ang){ if(type==0){ @@ -39,7 +39,7 @@ string std_align::par_title(int par_num,bool small_unit)const{ else if(par_num==4) par_title="#beta_{z}"; else if(par_num==5) par_title="#alpha_{t}"; else{ - exit(3); + throw std::runtime_error("MMT_struct: Invalid parameter index"); } if(par_num>2){ if(small_unit)par_title+=" [mrad]"; @@ -57,7 +57,7 @@ string std_align::par_name(int par_num)const{ else if(par_num==4) par_name="drz"; else if(par_num==5) par_name="drt"; else{ - exit(3); + throw std::runtime_error("MMT_struct: Invalid parameter index"); } return par_name; } @@ -240,7 +240,8 @@ string par_par::detail()const{ return misal.detail()+"; "+corr.detail(); } -MMT_Parameters::MMT_Parameters(par_par inputParams, char wedgeSize, const MuonGM::MuonDetectorManager* detManager){ +MMT_Parameters::MMT_Parameters(par_par inputParams, char wedgeSize, const MuonGM::MuonDetectorManager* detManager) + : AthMessaging(Athena::getMessageSvc(), "MMT_Parameters") { if(inputParams.misal.is_nominal())inputParams.misal.type=0; //can still do sim_corrections for nominal if(inputParams.corr.is_nominal()&&inputParams.corr.type==2)inputParams.corr.type=0; @@ -312,7 +313,7 @@ MMT_Parameters::MMT_Parameters(par_par inputParams, char wedgeSize, const MuonGM if(z_nominal.size() != setup.size()){ ATH_MSG_WARNING( "Number of planes in setup is "<< setup.size() << ", but we have a nominal " << z_nominal.size() << " planes."); - exit(9); + throw std::runtime_error("MMT_Parameters: Invalid number of planes"); } mid_plane_large=float32fixed<18>(0.); @@ -532,10 +533,10 @@ int MMT_Parameters::is_u(int plane){ return (std::find(planes_u.begin(), planes_ int MMT_Parameters::is_v(int plane){ return (std::find(planes_v.begin(), planes_v.end(), plane) != planes_v.end()) ? 1 : 0; } vector<int> MMT_Parameters::q_planes(const string& type) const{ - if(type.length()!=1) exit(0); + if(type.length()!=1) throw std::runtime_error("MMT_Parameters::q_planes: Invalid type"); if(type.compare("x")!=0&&type.compare("u")!=0&&type.compare("v")!=0){ ATH_MSG_WARNING("Unsupported plane type " << type << " in q_planes...aborting....\n"); - exit(0); + throw std::runtime_error("MMT_Parameters::q_planes: Unsupported plane type"); } vector<int> q_planes; for(unsigned int ip=0;ip<setup.size();ip++){ @@ -727,7 +728,7 @@ void MMT_Parameters::fill_crep_table(const string&dir,const string&tag){ crep>>title; if(title!=estr+pstr+index_to_hit_str(k)){ ATH_MSG_WARNING("Something's wrong with your simulation-based correct read-in...you want entries for "<<estr+pstr+index_to_hit_str(k)<<", but you got "<<title<<" in "<<crep_nom.str()); - exit(2); + throw std::runtime_error("MMT_Parameters::fill_crep_table: Invalid configuration"); } crep>>the>>phi>>dth; crep_table[i][j][k][0]=the*fudge_factor;crep_table[i][j][k][1]=phi;crep_table[i][j][k][2]=dth*fudge_factor; @@ -887,7 +888,8 @@ void MMT_Parameters::Delta_theta_optimization_LG(){ int MMT_Parameters::xhits_to_lcl_int(const vector<bool>& xhits) const{ if(xhits.size()!=4){ - ATH_MSG_WARNING("There should be 4 xplanes, only "<<xhits.size()<<" in the xhit vector given to local_slope_index()\n"); exit(99); + ATH_MSG_WARNING("There should be 4 xplanes, only "<<xhits.size()<<" in the xhit vector given to local_slope_index()\n"); + throw std::runtime_error("MMT_Parameters::xhits_to_lcl_int: Invalid number of planes"); } if(xhits[0]&& xhits[1]&& xhits[2]&& xhits[3]) return 0; else if( xhits[0]&& xhits[1]&& xhits[2]&&!xhits[3]) return 1; @@ -936,7 +938,8 @@ string MMT_Parameters::bool_to_hit_str(const vector<bool>&track)const{ vector<bool> MMT_Parameters::lcl_int_to_xhits(int lcl_int)const{ vector<bool> xhits(4,true); if(lcl_int<0||lcl_int>10){ - ATH_MSG_WARNING("Wherefore dost thou chooseth the hits of planes of X for thy lcl_int "<<lcl_int<<"? 'Tis not in [0,10]!"); exit(-99); + ATH_MSG_WARNING("Wherefore dost thou chooseth the hits of planes of X for thy lcl_int "<<lcl_int<<"? 'Tis not in [0,10]!"); + throw std::runtime_error("MMT_Parameters::lcl_int_to_xhits: invalid value for lcl_int"); } if(lcl_int==0) return xhits; if(lcl_int==1||lcl_int==5||lcl_int==6||lcl_int==8)xhits[3]=false; diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerTool.cxx index fee66bf9b1da08853df6f3aa842c61ff06f2deff..c71aae6c22946c782bd34f648182ed60ebe40ac2 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerTool.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 */ // local includes @@ -10,8 +10,6 @@ #include "GaudiKernel/ITHistSvc.h" #include "GaudiKernel/IIncidentSvc.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" - //Muon software includes #include "MuonDigitContainer/MmDigit.h" diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.cxx index 5194015022e3f340f3db53780084b31354c0c6fe..2088839fcd3364811e9c4e21daf3bda77ec2f90d 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/MMTriggerToolTree.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 */ // Athena/Gaudi includes @@ -440,7 +440,7 @@ namespace NSWL1 { m_NSWMM_off_channel->clear(); } - void MMTriggerTool::fillNtuple(MMLoadVariables loadedVariables){ + void MMTriggerTool::fillNtuple(const MMLoadVariables& loadedVariables){ *m_NSWMM_dig_stationEta = loadedVariables.histVars.NSWMM_dig_stationEta; *m_NSWMM_dig_stationPhi = loadedVariables.histVars.NSWMM_dig_stationPhi;