-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New metadata classes to perform calibration and odds analysis over a TRestDataSet #392
Merged
Changes from 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
85a87e6
New metadata class TRestCalibration meant to perform the calibration …
juanangp cba6187
New metadata class TRestOdds to perform the log odds computation over…
juanangp 61ce575
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 871dcea
Addresssing typo
juanangp c01f386
Removing unnecessary comment
juanangp 8fcea71
Addressing PR comments
juanangp 70e4523
Renaming TRestCalibration to TRestDataSetCalibration
juanangp 92a7d66
Renaming TRestOdds to TRestDataSetOdds
juanangp 4d2b5bc
Merge branch 'calibOdds' of github.com:rest-for-physics/framework int…
juanangp 4e9db6c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7d8d6db
Addressing compilation issues after renaming
juanangp 7188a30
Merge branch 'calibOdds' of github.com:rest-for-physics/framework int…
juanangp e47252b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 924009c
Merge branch 'master' into calibOdds
jgalan 2be446b
Merge branch 'master' into calibOdds
juanangp 41b49d7
Merge branch 'master' into calibOdds
juanangp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/************************************************************************* | ||
* This file is part of the REST software framework. * | ||
* * | ||
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) * | ||
* For more information see https://gifna.unizar.es/trex * | ||
* * | ||
* REST is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* REST is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have a copy of the GNU General Public License along with * | ||
* REST in $REST_PATH/LICENSE. * | ||
* If not, see https://www.gnu.org/licenses/. * | ||
* For the list of contributors see $REST_PATH/CREDITS. * | ||
*************************************************************************/ | ||
|
||
#ifndef REST_TRestCalibration | ||
#define REST_TRestCalibration | ||
|
||
#include "TRestMetadata.h" | ||
|
||
/// This class is meant to perform the calibration of different runs | ||
class TRestCalibration : public TRestMetadata { | ||
private: | ||
// Name of the output file | ||
std::string fOutputFileName = ""; | ||
// Name of the dataSet inside the config file | ||
std::string fDataSetName = ""; | ||
// Vector containing expected energy peaks in keV must be sorted | ||
std::vector<double> fEnergyPeaks; | ||
// Vector containing calibrated peaks in ADCs | ||
std::vector<double> fCalibPeaks; | ||
// Vector containing calibrated sigma in ADCs | ||
std::vector<double> fCalibFWHM; | ||
// Name of the calibration file to be used | ||
std::string fCalibFile = ""; | ||
// Calibration variable to be used | ||
std::string fCalObservable = ""; | ||
// Range to be calibrated | ||
TVector2 fCalibRange; | ||
// Number of bins used in the calibration | ||
Int_t fNBins; | ||
// Slope from the calibration fit | ||
Double_t fSlope = 0; | ||
// Intercept of the calibration fit | ||
Double_t fIntercept = 0; | ||
|
||
void Initialize() override; | ||
void InitFromConfigFile() override; | ||
|
||
public: | ||
void PrintMetadata() override; | ||
|
||
void Calibrate(); | ||
|
||
inline void SetDataSetName(const std::string& dSName) { fDataSetName = dSName; } | ||
inline void SetOutputFileName(const std::string& outName) { fOutputFileName = outName; } | ||
inline void SetCalibrationFile(const std::string& calibFile) { fCalibFile = calibFile; } | ||
|
||
inline auto GetCalibPeaks() const { return fCalibPeaks; } | ||
inline auto GetCalibFWHM() const { return fCalibFWHM; } | ||
|
||
inline double GetSlope() const { return fSlope; } | ||
inline double GetIntercept() const { return fIntercept; } | ||
inline std::string GetCalObservable() const { return fCalObservable; } | ||
|
||
TRestCalibration(); | ||
TRestCalibration(const char* configFilename, std::string name = ""); | ||
~TRestCalibration(); | ||
|
||
ClassDefOverride(TRestCalibration, 1); | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/************************************************************************* | ||
* This file is part of the REST software framework. * | ||
* * | ||
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) * | ||
* For more information see https://gifna.unizar.es/trex * | ||
* * | ||
* REST is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* REST is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have a copy of the GNU General Public License along with * | ||
* REST in $REST_PATH/LICENSE. * | ||
* If not, see https://www.gnu.org/licenses/. * | ||
* For the list of contributors see $REST_PATH/CREDITS. * | ||
*************************************************************************/ | ||
|
||
#ifndef REST_TRestOdds | ||
#define REST_TRestOdds | ||
|
||
#include "TH1F.h" | ||
#include "TRestCut.h" | ||
#include "TRestMetadata.h" | ||
|
||
/// This class is meant to compute the log odds for different datasets | ||
class TRestOdds : public TRestMetadata { | ||
private: | ||
// Name of the output file | ||
std::string fOutputFileName = ""; | ||
// Name of the dataSet inside the config file | ||
std::string fDataSetName = ""; | ||
// Vector containing different obserbable names | ||
std::vector<std::string> fObsName; | ||
// Vector containing different obserbable ranges | ||
std::vector<TVector2> fObsRange; | ||
// Vector containing number of bins for the different observables | ||
std::vector<int> fObsNbins; | ||
// Name of the odds file to be used to get the PDF | ||
std::string fOddsFile = ""; | ||
|
||
/// Cuts over the dataset for PDF selection | ||
TRestCut* fCut = nullptr; | ||
|
||
// Map containing the PDF of the different observables | ||
std::map<std::string, TH1F*> fHistos; //! | ||
|
||
void Initialize() override; | ||
void InitFromConfigFile() override; | ||
|
||
public: | ||
void PrintMetadata() override; | ||
|
||
void ComputeLogOdds(); | ||
|
||
inline void SetDataSetName(const std::string& dSName) { fDataSetName = dSName; } | ||
inline void SetOutputFileName(const std::string& outName) { fOutputFileName = outName; } | ||
inline void SetOddsFile(const std::string& oddsFile) { fOddsFile = oddsFile; } | ||
|
||
TRestOdds(); | ||
TRestOdds(const char* configFilename, std::string name = ""); | ||
~TRestOdds(); | ||
|
||
ClassDefOverride(TRestOdds, 1); | ||
}; | ||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave one white space between data member definitions so that is easier to read the documentation line corresponding to the metadata member.
Also I think doxygen requires to use a triple
///
comment.