Skip to content

Commit

Permalink
TRestComponentDataSet::GetHistogram methods have been simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
jgalan committed Nov 25, 2023
1 parent a400f5a commit d9e4bee
Showing 1 changed file with 6 additions and 24 deletions.
30 changes: 6 additions & 24 deletions source/framework/sensitivity/src/TRestComponentDataSet.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,8 @@ THnD* TRestComponentDataSet::GetDensityForActiveNode() {
/// provided in the argument
///
TH1D* TRestComponentDataSet::GetHistogram(Double_t node, std::string varName) {
if (!ValidNode(node)) return nullptr;

Int_t v1 = GetVariableIndex(varName);

if (v1 >= 0) return GetDensityForNode(node)->Projection(v1);

return nullptr;
SetActiveNode(node);
return GetHistogram(varName);
}

/////////////////////////////////////////////
Expand All @@ -354,14 +349,8 @@ TH1D* TRestComponentDataSet::GetHistogram(std::string varName) {
/// provided in the argument
///
TH2D* TRestComponentDataSet::GetHistogram(Double_t node, std::string varName1, std::string varName2) {
if (!ValidNode(node)) return nullptr;

Int_t v1 = GetVariableIndex(varName1);
Int_t v2 = GetVariableIndex(varName2);

if (v1 >= 0 && v2 >= 0) return GetDensityForNode(node)->Projection(v1, v2);

return nullptr;
SetActiveNode(node);
return GetHistogram(varName1, varName2);
}

/////////////////////////////////////////////
Expand All @@ -387,15 +376,8 @@ TH2D* TRestComponentDataSet::GetHistogram(std::string varName1, std::string varN
///
TH3D* TRestComponentDataSet::GetHistogram(Double_t node, std::string varName1, std::string varName2,
std::string varName3) {
if (!ValidNode(node)) return nullptr;

Int_t v1 = GetVariableIndex(varName1);
Int_t v2 = GetVariableIndex(varName2);
Int_t v3 = GetVariableIndex(varName3);

if (v1 >= 0 && v2 >= 0 && v3 >= 0) return GetDensityForNode(node)->Projection(v1, v2, v3);

return nullptr;
SetActiveNode(node);
return GetHistogram(varName1, varName2, varName3);
}

/////////////////////////////////////////////
Expand Down

0 comments on commit d9e4bee

Please sign in to comment.