diff --git a/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx b/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx index 1895d7cba350c03028eca676062e2a5444d43890..9d52c9c8771b72a35650d9a61d27e0fe452b3256 100644 --- a/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx +++ b/analysis/common/at_kfpf_interface/ATKFParticleFinder.cxx @@ -103,7 +103,7 @@ KFParticleTopoReconstructor* ATKFParticleFinder::CreateTopoReconstructor() { int n_good_tracks = 0; - for (int i_track = 0; i_track < kf_tracks_->GetNumberOfChannels(); + for (unsigned int i_track = 0; i_track < kf_tracks_->GetNumberOfChannels(); i_track++) { const AnalysisTree::Track& rec_track = kf_tracks_->GetChannel(i_track); if (rec_track.GetField<bool>(passcuts_field_id_) == 0) continue; @@ -117,7 +117,7 @@ KFParticleTopoReconstructor* ATKFParticleFinder::CreateTopoReconstructor() { int j_track = 0; - for (int i_track = 0; i_track < kf_tracks_->GetNumberOfChannels(); + for (unsigned int i_track = 0; i_track < kf_tracks_->GetNumberOfChannels(); i_track++) { const AnalysisTree::Track& rec_track = kf_tracks_->GetChannel(i_track); diff --git a/core/detectors/much/CbmMuchGeoScheme.cxx b/core/detectors/much/CbmMuchGeoScheme.cxx index ef4008483932544179d6cf2974ae9c972e1d4b57..1ae081aba677216e3785b5455050271010a29362 100644 --- a/core/detectors/much/CbmMuchGeoScheme.cxx +++ b/core/detectors/much/CbmMuchGeoScheme.cxx @@ -379,7 +379,7 @@ CbmMuchGeoScheme::GetLayerSides(Int_t iStation) const { try { return fSides.at(iStation); - } catch (std::out_of_range exc) { + } catch (const std::out_of_range& exc) { Fatal("GetLayerSides", "No input array of stations."); } return vector<CbmMuchLayerSide*>(); @@ -895,7 +895,7 @@ vector<CbmMuchModule*> CbmMuchGeoScheme::GetModules(Int_t iStation) const { try { return fModules.at(iStation); - } catch (std::out_of_range exc) { + } catch (const std::out_of_range& exc) { Fatal("GetModules", "No input array of stations."); } return vector<CbmMuchModule*>(); diff --git a/core/detectors/much/CbmMuchSegmentManual.h b/core/detectors/much/CbmMuchSegmentManual.h index e5208472feae52f9b194bfd99d111ca516f88979..7447b3c63c67d0785989665de0a095eaccd8a8c9 100644 --- a/core/detectors/much/CbmMuchSegmentManual.h +++ b/core/detectors/much/CbmMuchSegmentManual.h @@ -256,7 +256,7 @@ private: std::stringstream ss(str); if ((ss >> number).fail() || !(ss >> std::ws).eof()) throw std::bad_cast(); - } catch (std::bad_cast exc) { Fatal("", "Invalid cast.\n"); } + } catch (const std::bad_cast& exc) { Fatal("", "Invalid cast.\n"); } } // -------------------------------------------------------------------------------- diff --git a/core/detectors/much/CbmMuchSegmentSector.h b/core/detectors/much/CbmMuchSegmentSector.h index 8a98c316cff29c8fce7f916813fd39416c9284bc..dffaac7fd3ebd17140f9bfa304ddb02d1eb66191 100644 --- a/core/detectors/much/CbmMuchSegmentSector.h +++ b/core/detectors/much/CbmMuchSegmentSector.h @@ -152,7 +152,7 @@ private: std::stringstream ss(str); if ((ss >> number).fail() || !(ss >> std::ws).eof()) throw std::bad_cast(); - } catch (std::bad_cast exc) { Fatal("", "Invalid cast.\n"); } + } catch (const std::bad_cast& exc) { Fatal("", "Invalid cast.\n"); } } // -------------------------------------------------------------------------------- diff --git a/core/detectors/tof/CbmTofGeoHandler.cxx b/core/detectors/tof/CbmTofGeoHandler.cxx index e6c9f1e9c52b0990405e4b7b0b2f3aee85675e87..51b61a244108516e5fdee24ee2f89000dc6be9b6 100644 --- a/core/detectors/tof/CbmTofGeoHandler.cxx +++ b/core/detectors/tof/CbmTofGeoHandler.cxx @@ -405,10 +405,10 @@ Int_t CbmTofGeoHandler::VolId(const Text_t* name) const { // // Return the unique numeric identifier for volume name // - char sname[20]; Int_t len = strlen(name) - 1; if (name[len] != ' ') { return VolIdGeo(name); } - strncpy(sname, name, len); + char sname[len + 1]; + memcpy(sname, name, len); sname[len] = 0; return VolIdGeo(sname); } diff --git a/fles/mcbm2018/monitor/CbmMcbm2018MonitorMuch.cxx b/fles/mcbm2018/monitor/CbmMcbm2018MonitorMuch.cxx index b4dd067f8cfdaa653a19c34b8f0efdf6f91a2f5c..f13405c175d4a8b04380f0d45ca385a8b8d8ec60 100644 --- a/fles/mcbm2018/monitor/CbmMcbm2018MonitorMuch.cxx +++ b/fles/mcbm2018/monitor/CbmMcbm2018MonitorMuch.cxx @@ -346,7 +346,7 @@ void CbmMcbm2018MonitorMuch::AddMsComponentToList(size_t component, LOG(error) << "CbmMcbm2018MonitorMuch::AddMsComponentToList => " << "Ignored the addition of component " << component << " as it is above the hadcoded limit of " - << static_cast<const Int_t>(kiMaxNbFlibLinks) << " !!!!!!!!! " + << static_cast<Int_t>(kiMaxNbFlibLinks) << " !!!!!!!!! " << "\n" << " To change this behavior check kiMaxNbFlibLinks in " "CbmMcbm2018MonitorMuch.cxx"; diff --git a/fles/mcbm2018/monitor/CbmMcbm2018MonitorMuchLite.cxx b/fles/mcbm2018/monitor/CbmMcbm2018MonitorMuchLite.cxx index 59dfabd1dfd08fd9c6c34cbecff16e5710b9bb9c..694977d3707734f15b75696a68bb11cba131266d 100644 --- a/fles/mcbm2018/monitor/CbmMcbm2018MonitorMuchLite.cxx +++ b/fles/mcbm2018/monitor/CbmMcbm2018MonitorMuchLite.cxx @@ -333,7 +333,7 @@ void CbmMcbm2018MonitorMuchLite::AddMsComponentToList( LOG(error) << "CbmMcbm2018MonitorMuchLite::AddMsComponentToList => " << "Ignored the addition of component " << component << " as it is above the hadcoded limit of " - << static_cast<const Int_t>(kiMaxNbFlibLinks) << " !!!!!!!!! " + << static_cast<Int_t>(kiMaxNbFlibLinks) << " !!!!!!!!! " << "\n" << " To change this behavior check kiMaxNbFlibLinks in " "CbmMcbm2018MonitorMuchLite.cxx"; diff --git a/fles/mcbm2018/monitor/CbmMcbm2018MonitorSts.cxx b/fles/mcbm2018/monitor/CbmMcbm2018MonitorSts.cxx index 1737feeb280420898617bccfb465bef8b87b57a6..5256de3817d577d0cc6354389ff4aaa5ffae6aa8 100644 --- a/fles/mcbm2018/monitor/CbmMcbm2018MonitorSts.cxx +++ b/fles/mcbm2018/monitor/CbmMcbm2018MonitorSts.cxx @@ -445,7 +445,7 @@ void CbmMcbm2018MonitorSts::AddMsComponentToList(size_t component, LOG(error) << "CbmMcbm2018MonitorSts::AddMsComponentToList => " << "Ignored the addition of component " << component << " as it is above the hadcoded limit of " - << static_cast<const Int_t>(kiMaxNbFlibLinks) << " !!!!!!!!! " + << static_cast<Int_t>(kiMaxNbFlibLinks) << " !!!!!!!!! " << "\n" << " To change this behavior check kiMaxNbFlibLinks in " "CbmMcbm2018MonitorSts.cxx"; diff --git a/fles/mcbm2018/parameter/CbmMcbm2018PsdPar.cxx b/fles/mcbm2018/parameter/CbmMcbm2018PsdPar.cxx index 2bbd9cd6e701a4375db0624daed74a7fe2a3f2bb..f629d23aad466f11cc88156bfa6cba49a8ec8479 100644 --- a/fles/mcbm2018/parameter/CbmMcbm2018PsdPar.cxx +++ b/fles/mcbm2018/parameter/CbmMcbm2018PsdPar.cxx @@ -102,7 +102,7 @@ Int_t CbmMcbm2018PsdPar::FeeChanToGbtChan(UInt_t uChannelInFee) { else { LOG(fatal) << "CbmMcbm2018PsdPar::FeeChanToGbtChan => Index out of bound, " << uChannelInFee << " vs " - << static_cast<const uint32_t>(kuNbChannelsPerFee) + << static_cast<uint32_t>(kuNbChannelsPerFee) << ", returning crazy value!"; return -1; } // else of if( uChannelInFee < kuNbChannelsPerFee ) diff --git a/fles/mcbm2018/parameter/CbmMcbm2018TofPar.cxx b/fles/mcbm2018/parameter/CbmMcbm2018TofPar.cxx index 6732b6805c34f4587c10cc5d73e417fe8c18bb66..e93e7e13c8697743c6873a0d7f91d297ad067819 100644 --- a/fles/mcbm2018/parameter/CbmMcbm2018TofPar.cxx +++ b/fles/mcbm2018/parameter/CbmMcbm2018TofPar.cxx @@ -150,8 +150,7 @@ Int_t CbmMcbm2018TofPar::Get4ChanToPadiChan(UInt_t uChannelInFee) { else { LOG(fatal) << "CbmMcbm2018TofPar::Get4ChanToPadiChan => Index out of bound, " - << uChannelInFee << " vs " - << static_cast<const uint32_t>(kuNbChannelsPerFee) + << uChannelInFee << " vs " << static_cast<uint32_t>(kuNbChannelsPerFee) << ", returning crazy value!"; return -1; } // else of if( uChannelInFee < kuNbChannelsPerFee ) @@ -162,8 +161,7 @@ Int_t CbmMcbm2018TofPar::PadiChanToGet4Chan(UInt_t uChannelInFee) { else { LOG(fatal) << "CbmMcbm2018TofPar::PadiChanToGet4Chan => Index out of bound, " - << uChannelInFee << " vs " - << static_cast<const uint32_t>(kuNbChannelsPerFee) + << uChannelInFee << " vs " << static_cast<uint32_t>(kuNbChannelsPerFee) << ", returning crazy value!"; return -1; } // else of if( uChannelInFee < kuNbChannelsPerFee ) @@ -177,8 +175,7 @@ Int_t CbmMcbm2018TofPar::ElinkIdxToGet4Idx(UInt_t uElink) { + kuNbGet4PerGbtx * (uElink / kuNbGet4PerGbtx); else { LOG(fatal) << "CbmMcbm2018TofPar::ElinkIdxToGet4Idx => Index out of bound, " - << uElink << " vs " - << static_cast<const uint32_t>(kuNbGet4PerGdpb) + << uElink << " vs " << static_cast<uint32_t>(kuNbGet4PerGdpb) << ", returning crazy value!"; return -1; } // else of if( uElink < kuNbGet4PerGbtx ) @@ -191,8 +188,7 @@ Int_t CbmMcbm2018TofPar::Get4IdxToElinkIdx(UInt_t uGet4) { + kuNbGet4PerGbtx * (uGet4 / kuNbGet4PerGbtx); else { LOG(fatal) << "CbmMcbm2018TofPar::Get4IdxToElinkIdx => Index out of bound, " - << uGet4 << " vs " - << static_cast<const uint32_t>(kuNbGet4PerGdpb) + << uGet4 << " vs " << static_cast<uint32_t>(kuNbGet4PerGdpb) << ", returning crazy value!"; return -1; } // else of if( uElink < kuNbGet4PerGbtx ) diff --git a/sim/transport/generators/pluto/PDataBase.cxx b/sim/transport/generators/pluto/PDataBase.cxx index ce42996f9c7a1909a224634c1018a491ad02cfa8..24f8b0af79f3488a3a2e780cac9d4cfa1642c86e 100644 --- a/sim/transport/generators/pluto/PDataBase.cxx +++ b/sim/transport/generators/pluto/PDataBase.cxx @@ -225,7 +225,7 @@ Int_t PDataBase ::ConvertParamKey(const char*& newparamname, Int_t key) { return -1; }; -char* PDataBase ::GetDescription(const char* paramname) { +TString PDataBase ::GetDescription(const char* paramname) { //Interpretation of pattern TString spattern(paramname); TObjArray* array = spattern.Tokenize(TString(":")); @@ -252,7 +252,7 @@ char* PDataBase ::GetDescription(const char* paramname) { done = 1; } } - return (char*) bla.Data(); + return bla; } Bool_t PDataBase ::GetParamDouble(Int_t key, diff --git a/sim/transport/generators/pluto/PDataBase.h b/sim/transport/generators/pluto/PDataBase.h index bd352f7dd94d680599d98cf4f297f9548fd98969..cf127ab1516167f5099f4e812bc3ffc234976ea6 100644 --- a/sim/transport/generators/pluto/PDataBase.h +++ b/sim/transport/generators/pluto/PDataBase.h @@ -89,7 +89,7 @@ public: Int_t length = -1); //get "paramname" from string database Int_t GetParamTObj(const char* paramname); - char* GetDescription(const char* paramname); + TString GetDescription(const char* paramname); void GetFastParamInt(const char* paramname, Int_t* pkey) { if ((*pkey) < 0) *pkey = GetParamInt(paramname);