From 1df5211d6d309a5ab11b8c37de82e807fb5ef486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 22 Apr 2024 11:05:16 +0200 Subject: [PATCH 1/6] Common: Fix compilation warnings --- Common/Core/PID/ParamBase.h | 2 +- Common/Core/PID/TPCPIDResponse.h | 10 +++++----- Common/TableProducer/mcCollsExtra.cxx | 2 +- Common/TableProducer/trackselection.cxx | 4 ++++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Common/Core/PID/ParamBase.h b/Common/Core/PID/ParamBase.h index 50c3f50132d..221ce6c81b7 100644 --- a/Common/Core/PID/ParamBase.h +++ b/Common/Core/PID/ParamBase.h @@ -183,7 +183,7 @@ class PidParameters : public TNamed /// Getter for the parameters /// \return returns an array of parameters - const pidvar_t GetParameter(int i) const { return mPar[i]; } + pidvar_t GetParameter(int i) const { return mPar[i]; } /// Getter for the size of the parameter /// \return returns the size of the parameter array diff --git a/Common/Core/PID/TPCPIDResponse.h b/Common/Core/PID/TPCPIDResponse.h index 8008b22d082..e565a6e3e6f 100644 --- a/Common/Core/PID/TPCPIDResponse.h +++ b/Common/Core/PID/TPCPIDResponse.h @@ -62,11 +62,11 @@ class Response const std::array GetBetheBlochParams() const { return mBetheBlochParams; } const std::array GetResolutionParamsDefault() const { return mResolutionParamsDefault; } const std::vector GetResolutionParams() const { return mResolutionParams; } - const float GetMIP() const { return mMIP; } - const float GetNClNormalization() const { return nClNorm; } - const float GetChargeFactor() const { return mChargeFactor; } - const float GetMultiplicityNormalization() const { return mMultNormalization; } - const bool GetUseDefaultResolutionParam() const { return mUseDefaultResolutionParam; } + float GetMIP() const { return mMIP; } + float GetNClNormalization() const { return nClNorm; } + float GetChargeFactor() const { return mChargeFactor; } + float GetMultiplicityNormalization() const { return mMultNormalization; } + bool GetUseDefaultResolutionParam() const { return mUseDefaultResolutionParam; } /// Gets the expected signal of the track template diff --git a/Common/TableProducer/mcCollsExtra.cxx b/Common/TableProducer/mcCollsExtra.cxx index 3c8b42a0267..f809453b391 100644 --- a/Common/TableProducer/mcCollsExtra.cxx +++ b/Common/TableProducer/mcCollsExtra.cxx @@ -135,7 +135,7 @@ struct mcCollisionExtra { if (iter != sortedIndices.end()) { int index = iter - sortedIndices.begin(); for (int iMcColl = index + 1; iMcColl < index + 17; iMcColl++) { - if (iMcColl >= sortedIndices.size()) + if (iMcColl >= static_cast(sortedIndices.size())) continue; if (mcCollisionHasPoI[sortedIndices[iMcColl]]) bitset(forwardHistory, iMcColl - index - 1); diff --git a/Common/TableProducer/trackselection.cxx b/Common/TableProducer/trackselection.cxx index 7ae8930de17..42b724ced0b 100644 --- a/Common/TableProducer/trackselection.cxx +++ b/Common/TableProducer/trackselection.cxx @@ -74,6 +74,7 @@ struct TrackSelectionTask { break; } LOG(warning) << "isRun3 == true and itsMatching == 0: not setting globalTracks = getGlobalTrackSelection();, but going to itsMatching == 1 and set getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny)"; + [[fallthrough]]; case 1: // Run 3 kAny on 3 IB layers of ITS if (isRun3) { @@ -81,6 +82,7 @@ struct TrackSelectionTask { globalTracks = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSibAny, dcaSetup.value); break; } + [[fallthrough]]; case 2: // Run 3 kAny on all 7 layers of ITS if (isRun3) { @@ -88,6 +90,7 @@ struct TrackSelectionTask { globalTracks = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSallAny, dcaSetup.value); break; } + [[fallthrough]]; case 3: // Run 3 kAll on all 7 layers of ITS if (isRun3) { @@ -95,6 +98,7 @@ struct TrackSelectionTask { globalTracks = getGlobalTrackSelectionRun3ITSMatch(TrackSelection::GlobalTrackRun3ITSMatching::Run3ITSall7Layers, dcaSetup.value); break; } + [[fallthrough]]; default: LOG(fatal) << "TrackSelectionTask with undefined cuts. Fix it!"; break; From b35ff1c1e4d1f5d6310ad5168da5ea8b1a5d385a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 22 Apr 2024 11:52:11 +0200 Subject: [PATCH 2/6] Fix cpplint --- Common/Core/PID/ParamBase.h | 31 ++++++++++++++++----------- Common/TableProducer/mcCollsExtra.cxx | 25 ++++++++++----------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Common/Core/PID/ParamBase.h b/Common/Core/PID/ParamBase.h index 221ce6c81b7..18176013df7 100644 --- a/Common/Core/PID/ParamBase.h +++ b/Common/Core/PID/ParamBase.h @@ -17,8 +17,13 @@ /// These are the basic storage elements to be kept in the CCDB /// -#ifndef O2_FRAMEWORK_PARAMBASE_H_ -#define O2_FRAMEWORK_PARAMBASE_H_ +#ifndef COMMON_CORE_PID_PARAMBASE_H_ +#define COMMON_CORE_PID_PARAMBASE_H_ + +#include // std::copy +#include // std::map +#include // std::string +#include // std::vector // ROOT includes #include "TNamed.h" @@ -40,15 +45,15 @@ class Parameters : public TNamed /// Parametric constructor /// \param size Number of parameters in the container - Parameters(unsigned int size) : mPar(std::vector(size)){}; + explicit Parameters(unsigned int size) : mPar(std::vector(size)){} /// Parametric constructor /// \param size Number of parameters in the container - Parameters(const TString name, unsigned int size) : TNamed(name, name), mPar(std::vector(size)){}; + Parameters(const TString name, unsigned int size) : TNamed(name, name), mPar(std::vector(size)){} /// Parametric constructor /// \param params Parameters to initialize the container - Parameters(const TString name, const std::vector params) : TNamed(name, name), mPar{} { SetParameters(params); }; + Parameters(const TString name, const std::vector params) : TNamed(name, name), mPar{} { SetParameters(params); } /// Default destructor ~Parameters() override = default; @@ -68,11 +73,11 @@ class Parameters : public TNamed /// Setter for the parameter, using a parameter object /// \param params parameter object with parameters - void SetParameters(const Parameters params) { SetParameters(params.mPar); }; + void SetParameters(const Parameters params) { SetParameters(params.mPar); } /// Setter for the parameter, using a parameter pointer /// \param params pointer to parameter object with parameters - void SetParameters(const Parameters* params) { SetParameters(params->mPar); }; + void SetParameters(const Parameters* params) { SetParameters(params->mPar); } /// Printer of the parameter values void Print(Option_t* option = "") const override; @@ -108,7 +113,7 @@ class PidParameters : public TNamed { public: /// Default constructor - PidParameters(TString name = "DefaultParameters") : TNamed(name, name), mPar{} {}; + explicit PidParameters(TString name = "DefaultParameters") : TNamed(name, name), mPar{} {}; /// Default destructor ~PidParameters() override = default; @@ -133,11 +138,11 @@ class PidParameters : public TNamed /// Setter for the parameter, using a parameter object /// \param params parameter object with parameters - void SetParameters(const PidParameters params) { SetParameters(params.mPar); }; + void SetParameters(const PidParameters params) { SetParameters(params.mPar); } /// Setter for the parameter, using a parameter pointer /// \param params pointer to parameter object with parameters - void SetParameters(const PidParameters* params) { SetParameters(params->mPar); }; + void SetParameters(const PidParameters* params) { SetParameters(params->mPar); } /// Printer of the parameter values void Print(Option_t* /*option = ""*/) const override @@ -210,12 +215,12 @@ class Parametrization : public TNamed /// Parametric constructor /// \param name Name (and title) of the parametrization /// \param size Number of parameters of the parametrization - Parametrization(TString name, unsigned int size) : TNamed(name, name), mParameters(name + "Parameters", size){}; + Parametrization(TString name, unsigned int size) : TNamed(name, name), mParameters(name + "Parameters", size){} /// Parametric constructor /// \param name Name (and title) of the parametrization /// \param params Parameters of the parametrization - Parametrization(TString name, const std::vector params) : TNamed(name, name), mParameters{name + "Parameters", params} {}; + Parametrization(TString name, const std::vector params) : TNamed(name, name), mParameters{name + "Parameters", params} {} /// Default destructor ~Parametrization() override = default; @@ -260,4 +265,4 @@ class Parametrization : public TNamed } // namespace o2::pid -#endif // O2_FRAMEWORK_PARAMBASE_H_ +#endif // COMMON_CORE_PID_PARAMBASE_H_ diff --git a/Common/TableProducer/mcCollsExtra.cxx b/Common/TableProducer/mcCollsExtra.cxx index f809453b391..d8860818d2c 100644 --- a/Common/TableProducer/mcCollsExtra.cxx +++ b/Common/TableProducer/mcCollsExtra.cxx @@ -11,6 +11,19 @@ // // Quick and dirty task to correlate MC <-> data // + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" #include "Framework/AnalysisDataModel.h" @@ -32,18 +45,6 @@ #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Framework/ASoAHelpers.h" - using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; From f71a743ff1375d4d9d0dfee0ffc985d2f1bc3b57 Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Mon, 22 Apr 2024 11:53:36 +0200 Subject: [PATCH 3/6] Please consider the following formatting changes (#70) --- Common/Core/PID/ParamBase.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Common/Core/PID/ParamBase.h b/Common/Core/PID/ParamBase.h index 18176013df7..ec4b17083f4 100644 --- a/Common/Core/PID/ParamBase.h +++ b/Common/Core/PID/ParamBase.h @@ -21,9 +21,9 @@ #define COMMON_CORE_PID_PARAMBASE_H_ #include // std::copy -#include // std::map -#include // std::string -#include // std::vector +#include // std::map +#include // std::string +#include // std::vector // ROOT includes #include "TNamed.h" @@ -45,11 +45,11 @@ class Parameters : public TNamed /// Parametric constructor /// \param size Number of parameters in the container - explicit Parameters(unsigned int size) : mPar(std::vector(size)){} + explicit Parameters(unsigned int size) : mPar(std::vector(size)) {} /// Parametric constructor /// \param size Number of parameters in the container - Parameters(const TString name, unsigned int size) : TNamed(name, name), mPar(std::vector(size)){} + Parameters(const TString name, unsigned int size) : TNamed(name, name), mPar(std::vector(size)) {} /// Parametric constructor /// \param params Parameters to initialize the container @@ -215,7 +215,7 @@ class Parametrization : public TNamed /// Parametric constructor /// \param name Name (and title) of the parametrization /// \param size Number of parameters of the parametrization - Parametrization(TString name, unsigned int size) : TNamed(name, name), mParameters(name + "Parameters", size){} + Parametrization(TString name, unsigned int size) : TNamed(name, name), mParameters(name + "Parameters", size) {} /// Parametric constructor /// \param name Name (and title) of the parametrization From 45cf00bc318f043dd7246a2506e7e4b05621c6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 22 Apr 2024 12:13:25 +0200 Subject: [PATCH 4/6] Fix cpplint error --- Common/TableProducer/mcCollsExtra.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/TableProducer/mcCollsExtra.cxx b/Common/TableProducer/mcCollsExtra.cxx index d8860818d2c..6491e38fe97 100644 --- a/Common/TableProducer/mcCollsExtra.cxx +++ b/Common/TableProducer/mcCollsExtra.cxx @@ -16,11 +16,11 @@ #include #include +#include #include #include #include #include -#include #include #include From c0f733adf3aca57a5c9610e4ba3e22c9e70b8cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 22 Apr 2024 12:18:58 +0200 Subject: [PATCH 5/6] Get index with std::distance --- Common/TableProducer/mcCollsExtra.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Common/TableProducer/mcCollsExtra.cxx b/Common/TableProducer/mcCollsExtra.cxx index 6491e38fe97..9ef6008b7ae 100644 --- a/Common/TableProducer/mcCollsExtra.cxx +++ b/Common/TableProducer/mcCollsExtra.cxx @@ -134,9 +134,9 @@ struct mcCollisionExtra { auto mcCollision = collision.mcCollision(); auto iter = std::find(sortedIndices.begin(), sortedIndices.end(), mcCollision.index()); if (iter != sortedIndices.end()) { - int index = iter - sortedIndices.begin(); - for (int iMcColl = index + 1; iMcColl < index + 17; iMcColl++) { - if (iMcColl >= static_cast(sortedIndices.size())) + auto index = std::distance(iter, sortedIndices.begin()); + for (size_t iMcColl = index + 1; iMcColl < index + 17; iMcColl++) { + if (iMcColl >= sortedIndices.size()) continue; if (mcCollisionHasPoI[sortedIndices[iMcColl]]) bitset(forwardHistory, iMcColl - index - 1); From 8e62a8d030628d3a0e5dd089c1fc304d1aee4ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Mon, 22 Apr 2024 12:19:21 +0200 Subject: [PATCH 6/6] Fix cpplint --- Common/TableProducer/mcCollsExtra.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/TableProducer/mcCollsExtra.cxx b/Common/TableProducer/mcCollsExtra.cxx index 9ef6008b7ae..3ad7a143acd 100644 --- a/Common/TableProducer/mcCollsExtra.cxx +++ b/Common/TableProducer/mcCollsExtra.cxx @@ -16,7 +16,7 @@ #include #include -#include +#include "Math/Vector4D.h" #include #include #include