From acd75d33aa695f825768b1a8e2e663430e8d8cb3 Mon Sep 17 00:00:00 2001 From: Vincenzo Eduardo Padulano Date: Wed, 28 Feb 2024 18:50:09 +0100 Subject: [PATCH] [tmva][NFC] Run clang-format on Result* headers --- tmva/tmva/inc/TMVA/Results.h | 92 +++++++++-------- tmva/tmva/inc/TMVA/ResultsClassification.h | 89 +++++++++-------- tmva/tmva/inc/TMVA/ResultsMulticlass.h | 110 ++++++++++----------- tmva/tmva/inc/TMVA/ResultsRegression.h | 56 +++++------ 4 files changed, 171 insertions(+), 176 deletions(-) diff --git a/tmva/tmva/inc/TMVA/Results.h b/tmva/tmva/inc/TMVA/Results.h index ec94e6001c4bc..3f406a48f1a30 100644 --- a/tmva/tmva/inc/TMVA/Results.h +++ b/tmva/tmva/inc/TMVA/Results.h @@ -51,52 +51,50 @@ class TGraph; namespace TMVA { - class DataSet; - class MsgLogger; - - class Results:public TObject { - - public: - - Results( const DataSetInfo* dsi, TString resultsName ); - Results(); - virtual ~Results(); - - // setters - void Store( TObject* obj, const char* alias=nullptr ); - void SetTreeType( Types::ETreeType type ) { fTreeType = type; } - - // getters - Types::ETreeType GetTreeType() const { return fTreeType; } - const DataSetInfo* GetDataSetInfo() const { return fDsi; } - DataSet* GetDataSet() const { return fDsi->GetDataSet(); } - TList* GetStorage() const { return fStorage; } - TObject* GetObject(const TString & alias) const; - TH1* GetHist(const TString & alias) const; - TH2* GetHist2D(const TString & alias) const; - TGraph* GetGraph(const TString & alias) const; - virtual Types::EAnalysisType GetAnalysisType() { return Types::kNoAnalysisType; } - //test - Bool_t DoesExist(const TString & alias) const; - - // delete all stored data -// using TObject::Delete; - void Delete(Option_t *option="") override; - - virtual const std::vector< Float_t >& operator [] ( Int_t ievt ) const = 0; - - private: - Types::ETreeType fTreeType; ///< tree type for this result - const DataSetInfo *fDsi; ///<-> a pointer to the datasetinfo-object - TList *fStorage; ///<-> stores all the result-histograms - std::map *fHistAlias; ///<-> internal map for quick access to stored histograms - mutable MsgLogger* fLogger; ///GetDataSet(); } + TList *GetStorage() const { return fStorage; } + TObject *GetObject(const TString &alias) const; + TH1 *GetHist(const TString &alias) const; + TH2 *GetHist2D(const TString &alias) const; + TGraph *GetGraph(const TString &alias) const; + virtual Types::EAnalysisType GetAnalysisType() { return Types::kNoAnalysisType; } + // test + Bool_t DoesExist(const TString &alias) const; + + // delete all stored data + // using TObject::Delete; + void Delete(Option_t *option = "") override; + + virtual const std::vector &operator[](Int_t ievt) const = 0; + +private: + Types::ETreeType fTreeType; ///< tree type for this result + const DataSetInfo *fDsi; ///<-> a pointer to the datasetinfo-object + TList *fStorage; ///<-> stores all the result-histograms + std::map *fHistAlias; ///<-> internal map for quick access to stored histograms + mutable MsgLogger *fLogger; ///& operator []( Int_t ievt ) const override { fRet[0] = fMvaValues[ievt]; return fRet; } - std::vector* GetValueVector() { return &fMvaValues; } - std::vector* GetValueVectorTypes() { return &fMvaValuesTypes; } - - Types::EAnalysisType GetAnalysisType() override { return Types::kClassification; } - - - private: - - std::vector< Float_t > fMvaValues; ///< mva values (Results) - std::vector< Bool_t> fMvaValuesTypes; ///< mva values type(sig/bkg) (Results) - mutable std::vector< Float_t > fRet; ///< return val - mutable MsgLogger* fLogger; /// &operator[](Int_t ievt) const override + { + fRet[0] = fMvaValues[ievt]; + return fRet; + } + std::vector *GetValueVector() { return &fMvaValues; } + std::vector *GetValueVectorTypes() { return &fMvaValuesTypes; } + + Types::EAnalysisType GetAnalysisType() override { return Types::kClassification; } + +private: + std::vector fMvaValues; ///< mva values (Results) + std::vector fMvaValuesTypes; ///< mva values type(sig/bkg) (Results) + mutable std::vector fRet; ///< return val + mutable MsgLogger *fLogger; ///& value, Int_t ievt ); - void Resize( Int_t entries ) { fMultiClassValues.resize( entries ); } - using TObject::Clear; - void Clear(Option_t *) override { fMultiClassValues.clear(); } - - // getters - Long64_t GetSize() const { return fMultiClassValues.size(); } - const std::vector< Float_t >& operator[] ( Int_t ievt ) const override { return fMultiClassValues.at(ievt); } - std::vector >* GetValueVector() { return &fMultiClassValues; } - - Types::EAnalysisType GetAnalysisType() override { return Types::kMulticlass; } - Float_t GetAchievableEff(UInt_t cls){return fAchievableEff.at(cls);} - Float_t GetAchievablePur(UInt_t cls){return fAchievablePur.at(cls);} - std::vector& GetAchievableEff(){return fAchievableEff;} - std::vector& GetAchievablePur(){return fAchievablePur;} - - TMatrixD GetConfusionMatrix(Double_t effB); - - // histogramming - void CreateMulticlassPerformanceHistos(TString prefix); - void CreateMulticlassHistos( TString prefix, Int_t nbins, Int_t nbins_high); - - Double_t EstimatorFunction( std::vector & ) override; - std::vector GetBestMultiClassCuts(UInt_t targetClass); - - private: - - mutable std::vector > fMultiClassValues; ///< mva values (Results) - mutable MsgLogger* fLogger; /// fAchievableEff; - std::vector fAchievablePur; - std::vector > fBestCuts; - - // Temporary storage used during GetBestMultiClassCuts - std::vector fClassSumWeights; - std::vector fEventWeights; - std::vector fEventClasses; - - protected: - - ClassDefOverride(ResultsMulticlass,3); - - }; - -} +class MsgLogger; + +class ResultsMulticlass : public Results, public IFitterTarget { + +public: + ResultsMulticlass(const DataSetInfo *dsi, TString resultsName); + ~ResultsMulticlass(); + + // setters + void SetValue(std::vector &value, Int_t ievt); + void Resize(Int_t entries) { fMultiClassValues.resize(entries); } + using TObject::Clear; + void Clear(Option_t *) override { fMultiClassValues.clear(); } + + // getters + Long64_t GetSize() const { return fMultiClassValues.size(); } + const std::vector &operator[](Int_t ievt) const override { return fMultiClassValues.at(ievt); } + std::vector> *GetValueVector() { return &fMultiClassValues; } + + Types::EAnalysisType GetAnalysisType() override { return Types::kMulticlass; } + Float_t GetAchievableEff(UInt_t cls) { return fAchievableEff.at(cls); } + Float_t GetAchievablePur(UInt_t cls) { return fAchievablePur.at(cls); } + std::vector &GetAchievableEff() { return fAchievableEff; } + std::vector &GetAchievablePur() { return fAchievablePur; } + + TMatrixD GetConfusionMatrix(Double_t effB); + + // histogramming + void CreateMulticlassPerformanceHistos(TString prefix); + void CreateMulticlassHistos(TString prefix, Int_t nbins, Int_t nbins_high); + + Double_t EstimatorFunction(std::vector &) override; + std::vector GetBestMultiClassCuts(UInt_t targetClass); + +private: + mutable std::vector> fMultiClassValues; ///< mva values (Results) + mutable MsgLogger *fLogger; /// fAchievableEff; + std::vector fAchievablePur; + std::vector> fBestCuts; + + // Temporary storage used during GetBestMultiClassCuts + std::vector fClassSumWeights; + std::vector fEventWeights; + std::vector fEventClasses; + +protected: + ClassDefOverride(ResultsMulticlass, 3); +}; + +} // namespace TMVA #endif diff --git a/tmva/tmva/inc/TMVA/ResultsRegression.h b/tmva/tmva/inc/TMVA/ResultsRegression.h index bbe285940f1e0..fa7b9c0f02e19 100644 --- a/tmva/tmva/inc/TMVA/ResultsRegression.h +++ b/tmva/tmva/inc/TMVA/ResultsRegression.h @@ -47,44 +47,40 @@ namespace TMVA { - class MsgLogger; +class MsgLogger; - class ResultsRegression : public Results { +class ResultsRegression : public Results { - public: +public: + ResultsRegression(const DataSetInfo *dsi, TString resultsName); + ~ResultsRegression(); - ResultsRegression( const DataSetInfo* dsi, TString resultsName ); - ~ResultsRegression(); + // setters + void SetValue(std::vector &value, Int_t ievt); + void Resize(Int_t entries) { fRegValues.resize(entries); } - // setters - void SetValue( std::vector& value, Int_t ievt ); - void Resize( Int_t entries ) { fRegValues.resize( entries ); } + using TObject::Clear; + void Clear(Option_t *) override { fRegValues.clear(); } - using TObject::Clear; - void Clear(Option_t *) override { fRegValues.clear(); } + // getters + Long64_t GetSize() const { return fRegValues.size(); } + const std::vector &operator[](Int_t ievt) const override { return fRegValues.at(ievt); } + std::vector> *GetValueVector() { return &fRegValues; } - // getters - Long64_t GetSize() const { return fRegValues.size(); } - const std::vector< Float_t >& operator [] ( Int_t ievt ) const override { return fRegValues.at(ievt); } - std::vector >* GetValueVector() { return &fRegValues; } + TH2F *DeviationAsAFunctionOf(UInt_t varNum, UInt_t tgtNum); + TH1F *QuadraticDeviation(UInt_t tgtNum, Bool_t truncate = false, Double_t truncvalue = 0.); + void CreateDeviationHistograms(TString prefix); - TH2F* DeviationAsAFunctionOf( UInt_t varNum, UInt_t tgtNum ); - TH1F* QuadraticDeviation( UInt_t tgtNum, Bool_t truncate = false, Double_t truncvalue = 0. ); - void CreateDeviationHistograms( TString prefix ); + Types::EAnalysisType GetAnalysisType() override { return Types::kRegression; } - Types::EAnalysisType GetAnalysisType() override { return Types::kRegression; } +private: + mutable std::vector> fRegValues; ///< mva values (Results) + mutable MsgLogger *fLogger; /// > fRegValues; ///< mva values (Results) - mutable MsgLogger* fLogger; ///