Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 30, 2024
1 parent 8d51deb commit e28f08d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions source/framework/sensitivity/src/TRestExperiment.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ void TRestExperiment::SetExperimentalDataSetFile(const std::string& filename) {

if (!fSignal || !fBackground) {
RESTWarning << "TRestExperiment::SetExperimentalDataSetFile. Signal and background components must "
"be available before atempt to load experimental data" << RESTendl;
"be available before atempt to load experimental data"
<< RESTendl;
fDataReady = false;
return;
}
Expand All @@ -133,7 +134,8 @@ void TRestExperiment::SetExperimentalDataSetFile(const std::string& filename) {
for (const auto& v : fSignal->GetVariables()) {
if (std::find(columns.begin(), columns.end(), v) == columns.end()) {
RESTError << "TRestExperiment::SetExperimentalDataSetFile a component variable was not found in "
"the dataset!" << RESTendl;
"the dataset!"
<< RESTendl;
fDataReady = false;
return;
}
Expand Down
22 changes: 11 additions & 11 deletions source/framework/sensitivity/src/TRestSensitivity.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TRestSensitivity::~TRestSensitivity() {}
/// \param name The name of the specific metadata. It will be used to find the
/// corresponding TRestAxionMagneticField section inside the RML.
///
TRestSensitivity::TRestSensitivity(const char *cfgFileName, const std::string &name)
TRestSensitivity::TRestSensitivity(const char* cfgFileName, const std::string& name)
: TRestMetadata(cfgFileName) {
LoadConfigFromFile(fConfigFileName, name);
}
Expand All @@ -92,7 +92,7 @@ Double_t TRestSensitivity::ApproachByFactor(Double_t g4, Double_t chi0, Double_t
Double_t Chi2 = 0;
do {
Chi2 = 0;
for (const auto &exp : fExperiments) Chi2 += -2 * UnbinnedLogLikelihood(exp, g4);
for (const auto& exp : fExperiments) Chi2 += -2 * UnbinnedLogLikelihood(exp, g4);

g4 = factor * g4;
} while (Chi2 - chi0 < target);
Expand All @@ -101,7 +101,7 @@ Double_t TRestSensitivity::ApproachByFactor(Double_t g4, Double_t chi0, Double_t
/// Coarse movement to get to Chi2 below target (/2)
do {
Chi2 = 0;
for (const auto &exp : fExperiments) Chi2 += -2 * UnbinnedLogLikelihood(exp, g4);
for (const auto& exp : fExperiments) Chi2 += -2 * UnbinnedLogLikelihood(exp, g4);

g4 = g4 / factor;
} while (Chi2 - chi0 > target);
Expand All @@ -114,7 +114,7 @@ Double_t TRestSensitivity::ApproachByFactor(Double_t g4, Double_t chi0, Double_t
///
Double_t TRestSensitivity::GetCoupling(Double_t sigma, Double_t precision) {
Double_t Chi2_0 = 0;
for (const auto &exp : fExperiments) Chi2_0 += -2 * UnbinnedLogLikelihood(exp, 0);
for (const auto& exp : fExperiments) Chi2_0 += -2 * UnbinnedLogLikelihood(exp, 0);

Double_t target = sigma * sigma;

Expand All @@ -131,7 +131,7 @@ Double_t TRestSensitivity::GetCoupling(Double_t sigma, Double_t precision) {
///////////////////////////////////////////////
/// \brief It returns the Log(L) for the experiment and coupling given by argument.
///
Double_t TRestSensitivity::UnbinnedLogLikelihood(const TRestExperiment *experiment, Double_t g4) {
Double_t TRestSensitivity::UnbinnedLogLikelihood(const TRestExperiment* experiment, Double_t g4) {
Double_t lhood = 0;
if (!experiment->IsDataReady()) {
RESTError << "TRestSensitivity::UnbinnedLogLikelihood. Experiment " << experiment->GetName()
Expand All @@ -152,7 +152,7 @@ Double_t TRestSensitivity::UnbinnedLogLikelihood(const TRestExperiment *experime
if (ROOT::IsImplicitMTEnabled()) ROOT::DisableImplicitMT();

std::vector<std::vector<Double_t>> trackingData;
for (const auto &var : experiment->GetSignal()->GetVariables()) {
for (const auto& var : experiment->GetSignal()->GetVariables()) {
auto values = experiment->GetExperimentalDataFrame().Take<Double_t>(var);
std::vector<Double_t> vDbl = std::move(*values);
trackingData.push_back(vDbl);
Expand Down Expand Up @@ -189,18 +189,18 @@ void TRestSensitivity::InitFromConfigFile() {
TRestMetadata::InitFromConfigFile();

int cont = 0;
TRestMetadata *metadata = (TRestMetadata *)this->InstantiateChildMetadata(cont, "Experiment");
TRestMetadata* metadata = (TRestMetadata*)this->InstantiateChildMetadata(cont, "Experiment");
while (metadata != nullptr) {
cont++;
if (metadata->InheritsFrom("TRestExperimentList")) {
TRestExperimentList *experimentsList = (TRestExperimentList *)metadata;
std::vector<TRestExperiment *> exList = experimentsList->GetExperiments();
TRestExperimentList* experimentsList = (TRestExperimentList*)metadata;
std::vector<TRestExperiment*> exList = experimentsList->GetExperiments();
fExperiments.insert(fExperiments.end(), exList.begin(), exList.end());
} else if (metadata->InheritsFrom("TRestExperiment")) {
fExperiments.push_back((TRestExperiment *)metadata);
fExperiments.push_back((TRestExperiment*)metadata);
}

metadata = (TRestMetadata *)this->InstantiateChildMetadata(cont, "Experiment");
metadata = (TRestMetadata*)this->InstantiateChildMetadata(cont, "Experiment");
}

Initialize();
Expand Down

0 comments on commit e28f08d

Please sign in to comment.