Skip to content

Commit d8ec95b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 68f296f commit d8ec95b

File tree

8 files changed

+56
-55
lines changed

8 files changed

+56
-55
lines changed

CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,17 @@ else ()
188188
set(REST_MPFR OFF)
189189
endif (${REST_MPFR} MATCHES "ON")
190190

191-
#### GSL ####
192-
# Find GSL
191+
# GSL #### Find GSL
193192
find_package(GSL REQUIRED)
194193

195194
# Include GSL directories
196195
set(external_include_dirs ${external_include_dirs} ${GSL_INCLUDE_DIRS})
197196

198197
# Link GSL libraries
199-
set(external_libs ${external_libs};${GSL_LIBRARIES} )
198+
set(external_libs ${external_libs};${GSL_LIBRARIES})
200199

201-
message ( STATUS "Found GSL libraries : ${GSL_LIBRARIES}")
202-
message ( STATUS "GSL headers : ${GSL_INCLUDE_DIRS}")
200+
message(STATUS "Found GSL libraries : ${GSL_LIBRARIES}")
201+
message(STATUS "GSL headers : ${GSL_INCLUDE_DIRS}")
203202

204203
# CURL #####
205204
find_library(CURL_LIB curl)

source/framework/core/inc/TRestSystemOfUnits.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,7 @@
4242
namespace REST_Units {
4343

4444
// We use more common physics units instead of SI unit
45-
enum Physical_Unit {
46-
Energy,
47-
Time,
48-
Length,
49-
Mass,
50-
Voltage,
51-
MagneticField,
52-
Pressure,
53-
Angle,
54-
NOT_A_UNIT = -1
55-
};
45+
enum Physical_Unit { Energy, Time, Length, Mass, Voltage, MagneticField, Pressure, Angle, NOT_A_UNIT = -1 };
5646

5747
class TRestSystemOfUnits {
5848
private:

source/framework/core/src/TRestMetadata.cxx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,9 +1168,10 @@ void TRestMetadata::ReplaceForLoopVars(TiXmlElement* e, map<string, string> forL
11681168
}
11691169
}
11701170

1171-
e->SetAttribute(name, ReplaceMathematicalExpressions(outputBuffer, 0,
1172-
"Please, check parameter name: " + parName +
1173-
" (ReplaceForLoopVars)").c_str());
1171+
e->SetAttribute(name, ReplaceMathematicalExpressions(
1172+
outputBuffer, 0,
1173+
"Please, check parameter name: " + parName + " (ReplaceForLoopVars)")
1174+
.c_str());
11741175
}
11751176

11761177
attr = attr->Next();
@@ -1327,7 +1328,8 @@ void TRestMetadata::ExpandIncludeFile(TiXmlElement* e) {
13271328
TiXmlElement* ele = GetElementFromFile(filename);
13281329
if (ele == nullptr) {
13291330
RESTError << "TRestMetadata::ExpandIncludeFile. No xml elements contained in the include "
1330-
"file \"" << filename << "\"" << RESTendl;
1331+
"file \""
1332+
<< filename << "\"" << RESTendl;
13311333
exit(1);
13321334
}
13331335
while (ele != nullptr) {
@@ -1409,7 +1411,8 @@ void TRestMetadata::ExpandIncludeFile(TiXmlElement* e) {
14091411

14101412
if (remoteele == nullptr) {
14111413
RESTWarning << "Cannot find the needed xml section in "
1412-
"include file!" << RESTendl;
1414+
"include file!"
1415+
<< RESTendl;
14131416
RESTWarning << "type: \"" << type << "\" , name: \"" << name << "\" . Skipping"
14141417
<< RESTendl;
14151418
RESTWarning << RESTendl;
@@ -2292,7 +2295,8 @@ TString TRestMetadata::GetLibraryVersion() { return fLibraryVersion; }
22922295
void TRestMetadata::ReSetVersion() {
22932296
if (!this->InheritsFrom("TRestRun"))
22942297
RESTError << "version is a static value, you cannot set version "
2295-
"for a class!" << RESTendl;
2298+
"for a class!"
2299+
<< RESTendl;
22962300
else {
22972301
fVersion = REST_RELEASE;
22982302
}
@@ -2304,7 +2308,8 @@ void TRestMetadata::ReSetVersion() {
23042308
void TRestMetadata::UnSetVersion() {
23052309
if (!this->InheritsFrom("TRestRun"))
23062310
RESTError << "version is a static value, you cannot set version "
2307-
"for a class!" << RESTendl;
2311+
"for a class!"
2312+
<< RESTendl;
23082313
else {
23092314
fVersion = -1;
23102315
fCommit = -1;
@@ -2571,7 +2576,8 @@ void TRestMetadata::ReadOneParameter(string name, string value) {
25712576
} else {
25722577
RESTWarning << this->ClassName() << " find unit definition in parameter: " << name
25732578
<< ", but the corresponding data member doesn't support it. Data "
2574-
"member type: " << datamember.type << RESTendl;
2579+
"member type: "
2580+
<< datamember.type << RESTendl;
25752581
datamember.ParseString(value);
25762582
}
25772583
} else {

source/framework/sensitivity/src/TRestComponent.cxx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ ROOT::RVecD TRestComponent::GetRandom() {
316316
if (!GetDensity()) {
317317
for (size_t n = 0; n < GetDimensions(); n++) result.push_back(0);
318318
RESTWarning << "TRestComponent::GetRandom. Component might not be initialized! Use "
319-
"TRestComponent::Initialize()." << RESTendl;
319+
"TRestComponent::Initialize()."
320+
<< RESTendl;
320321
return result;
321322
}
322323

@@ -346,10 +347,11 @@ ROOT::RDF::RNode TRestComponent::GetMonteCarloDataFrame(Int_t N) {
346347
/* Excluding Rndm from df */
347348
std::vector<std::string> columns = df.GetColumnNames();
348349
std::vector<std::string> excludeColumns = {"Rndm"};
349-
columns.erase(std::remove_if(columns.begin(), columns.end(), [&excludeColumns](std::string elem) {
350-
return std::find(excludeColumns.begin(), excludeColumns.end(), elem) !=
351-
excludeColumns.end();
352-
}),
350+
columns.erase(std::remove_if(columns.begin(), columns.end(),
351+
[&excludeColumns](std::string elem) {
352+
return std::find(excludeColumns.begin(), excludeColumns.end(), elem) !=
353+
excludeColumns.end();
354+
}),
353355
columns.end());
354356

355357
std::string user = getenv("USER");
@@ -375,13 +377,15 @@ TCanvas* TRestComponent::DrawComponent(std::vector<std::string> drawVariables,
375377
TString drawOption) {
376378
if (drawVariables.size() > 2 || drawVariables.size() == 0) {
377379
RESTError << "TRestComponent::DrawComponent. The number of variables to be drawn must "
378-
"be 1 or 2!" << RESTendl;
380+
"be 1 or 2!"
381+
<< RESTendl;
379382
return fCanvas;
380383
}
381384

382385
if (scanVariables.size() > 2 || scanVariables.size() == 0) {
383386
RESTError << "TRestComponent::DrawComponent. The number of variables to be scanned must "
384-
"be 1 or 2!" << RESTendl;
387+
"be 1 or 2!"
388+
<< RESTendl;
385389
return fCanvas;
386390
}
387391

source/framework/sensitivity/src/TRestComponentDataSet.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ void TRestComponentDataSet::FillHistograms() {
306306
/// different random sample.
307307
///
308308
void TRestComponentDataSet::RegenerateActiveNodeDensity() {
309-
310309
if (fActiveNode >= 0 && fNodeDensity[fActiveNode]) {
311310
delete fNodeDensity[fActiveNode];
312311
} else {
@@ -434,7 +433,7 @@ std::vector<Int_t> TRestComponentDataSet::ExtractNodeStatistics() {
434433
nEv = fDataSet.GetDataFrame().Filter(filter).Range(fSamples).Count();
435434
}
436435

437-
if ((Int_t) * nEv < fSamples) {
436+
if ((Int_t)*nEv < fSamples) {
438437
RESTWarning << "The number of requested samples (" << fSamples
439438
<< ") is higher than the number of dataset entries (" << *nEv << ")" << RESTendl;
440439
}

source/framework/sensitivity/src/TRestExperiment.cxx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ void TRestExperiment::SetExperimentalDataSet(const std::string& filename) {
124124

125125
if (!fSignal || !fBackground) {
126126
RESTWarning << "TRestExperiment::SetExperimentalDataSet. Signal and background components must "
127-
"be available before atempt to load experimental data" << RESTendl;
127+
"be available before atempt to load experimental data"
128+
<< RESTendl;
128129
fDataReady = false;
129130
return;
130131
}
@@ -133,7 +134,8 @@ void TRestExperiment::SetExperimentalDataSet(const std::string& filename) {
133134
for (const auto& v : fSignal->GetVariables()) {
134135
if (std::find(columns.begin(), columns.end(), v) == columns.end()) {
135136
RESTError << "TRestExperiment::SetExperimentalDataSetFile a component variable was not found in "
136-
"the dataset!" << RESTendl;
137+
"the dataset!"
138+
<< RESTendl;
137139
fDataReady = false;
138140
return;
139141
}
@@ -261,9 +263,9 @@ void TRestExperiment::PrintMetadata() {
261263
RESTMetadata << "Random seed : " << fSeed << RESTendl;
262264
RESTMetadata << " " << RESTendl;
263265
if (fExposureTime > 0) {
264-
RESTMetadata << " - Exposure time : " << fExposureTime* units("s") << " seconds" << RESTendl;
265-
RESTMetadata << " - Exposure time : " << fExposureTime* units("hr") << " hours" << RESTendl;
266-
RESTMetadata << " - Exposure time : " << fExposureTime* units("day") << " days" << RESTendl;
266+
RESTMetadata << " - Exposure time : " << fExposureTime * units("s") << " seconds" << RESTendl;
267+
RESTMetadata << " - Exposure time : " << fExposureTime * units("hr") << " hours" << RESTendl;
268+
RESTMetadata << " - Exposure time : " << fExposureTime * units("day") << " days" << RESTendl;
267269
}
268270

269271
if (fSignal) RESTMetadata << " - Signal component : " << fSignal->GetName() << RESTendl;

source/framework/sensitivity/src/TRestExperimentList.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ void TRestExperimentList::InitFromConfigFile() {
117117

118118
if (nExpectedColumns == 0) {
119119
RESTError << "TRestExperimentList::InitFromConfigFile. At least one free parameter required! "
120-
"(Exposure/Background/Signal)" << RESTendl;
120+
"(Exposure/Background/Signal)"
121+
<< RESTendl;
121122
return;
122123
}
123124

@@ -134,7 +135,8 @@ void TRestExperimentList::InitFromConfigFile() {
134135
}
135136

136137
RESTError << "TRestExperimentList::InitFromConfigFile. Number of expected columns does not match "
137-
"the number of table columns" << RESTendl;
138+
"the number of table columns"
139+
<< RESTendl;
138140
RESTError << "Number of table columns : " << nTableColumns << RESTendl;
139141
RESTError << "Number of expected columns : " << nExpectedColumns << RESTendl;
140142
RESTError << "Expected columns : " << expectedColumns << RESTendl;

source/framework/sensitivity/src/TRestSensitivity.cxx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ TRestSensitivity::~TRestSensitivity() {}
6767
/// \param name The name of the specific metadata. It will be used to find the
6868
/// corresponding TRestAxionMagneticField section inside the RML.
6969
///
70-
TRestSensitivity::TRestSensitivity(const char *cfgFileName, const std::string &name)
70+
TRestSensitivity::TRestSensitivity(const char* cfgFileName, const std::string& name)
7171
: TRestMetadata(cfgFileName) {
7272
LoadConfigFromFile(fConfigFileName, name);
7373
}
@@ -92,7 +92,7 @@ Double_t TRestSensitivity::ApproachByFactor(Double_t g4, Double_t chi0, Double_t
9292
Double_t Chi2 = 0;
9393
do {
9494
Chi2 = 0;
95-
for (const auto &exp : fExperiments) Chi2 += -2 * UnbinnedLogLikelihood(exp, g4);
95+
for (const auto& exp : fExperiments) Chi2 += -2 * UnbinnedLogLikelihood(exp, g4);
9696

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

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

119119
Double_t target = sigma * sigma;
120120

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

148148
std::vector<std::vector<Double_t>> trackingData;
149-
for (const auto &var : experiment->GetSignal()->GetVariables()) {
149+
for (const auto& var : experiment->GetSignal()->GetVariables()) {
150150
auto values = experiment->GetExperimentalDataFrame().Take<Double_t>(var);
151151
std::vector<Double_t> vDbl = std::move(*values);
152152
trackingData.push_back(vDbl);
@@ -169,11 +169,10 @@ Double_t TRestSensitivity::UnbinnedLogLikelihood(const TRestExperiment *experime
169169
///////////////////////////////////////////////
170170
/// \brief
171171
///
172-
TH1D *TRestSensitivity::SignalStatisticalTest(Int_t N) {
173-
172+
TH1D* TRestSensitivity::SignalStatisticalTest(Int_t N) {
174173
std::vector<Double_t> couplings;
175174
for (int n = 0; n < N; n++) {
176-
for (const auto &exp : fExperiments) exp->GetSignal()->RegenerateActiveNodeDensity();
175+
for (const auto& exp : fExperiments) exp->GetSignal()->RegenerateActiveNodeDensity();
177176

178177
Double_t coupling = TMath::Sqrt(TMath::Sqrt(GetCoupling()));
179178
couplings.push_back(coupling);
@@ -185,7 +184,7 @@ TH1D *TRestSensitivity::SignalStatisticalTest(Int_t N) {
185184

186185
if (fSignalTest) delete fSignalTest;
187186
fSignalTest = new TH1D("SignalTest", "A signal test", 100, 0.9 * min_value, 1.1 * max_value);
188-
for (const auto &coup : couplings) fSignalTest->Fill(coup);
187+
for (const auto& coup : couplings) fSignalTest->Fill(coup);
189188

190189
return fSignalTest;
191190
}
@@ -197,18 +196,18 @@ void TRestSensitivity::InitFromConfigFile() {
197196
TRestMetadata::InitFromConfigFile();
198197

199198
int cont = 0;
200-
TRestMetadata *metadata = (TRestMetadata *)this->InstantiateChildMetadata(cont, "Experiment");
199+
TRestMetadata* metadata = (TRestMetadata*)this->InstantiateChildMetadata(cont, "Experiment");
201200
while (metadata != nullptr) {
202201
cont++;
203202
if (metadata->InheritsFrom("TRestExperimentList")) {
204-
TRestExperimentList *experimentsList = (TRestExperimentList *)metadata;
205-
std::vector<TRestExperiment *> exList = experimentsList->GetExperiments();
203+
TRestExperimentList* experimentsList = (TRestExperimentList*)metadata;
204+
std::vector<TRestExperiment*> exList = experimentsList->GetExperiments();
206205
fExperiments.insert(fExperiments.end(), exList.begin(), exList.end());
207206
} else if (metadata->InheritsFrom("TRestExperiment")) {
208-
fExperiments.push_back((TRestExperiment *)metadata);
207+
fExperiments.push_back((TRestExperiment*)metadata);
209208
}
210209

211-
metadata = (TRestMetadata *)this->InstantiateChildMetadata(cont, "Experiment");
210+
metadata = (TRestMetadata*)this->InstantiateChildMetadata(cont, "Experiment");
212211
}
213212

214213
Initialize();

0 commit comments

Comments
 (0)