Skip to content
Snippets Groups Projects
Commit 3b6e48cb authored by Sergey Linev's avatar Sergey Linev Committed by Axel Naumann
Browse files

fitpanel: more c++11 when using std::multimap

parent e306f872
No related branches found
No related tags found
No related merge requests found
...@@ -187,9 +187,6 @@ typedef std::multimap<TObject*, TF1*> FitFuncMap_t; ...@@ -187,9 +187,6 @@ typedef std::multimap<TObject*, TF1*> FitFuncMap_t;
TF1* TFitEditor::FindFunction() TF1* TFitEditor::FindFunction()
{ {
// Get the list of functions from the system
std::vector<TF1*>& funcList(fSystemFuncs);
// Get the title/name of the function from fFuncList // Get the title/name of the function from fFuncList
TGTextLBEntry *te = (TGTextLBEntry *)fFuncList->GetSelectedEntry(); TGTextLBEntry *te = (TGTextLBEntry *)fFuncList->GetSelectedEntry();
if ( !te ) return 0; if ( !te ) return 0;
...@@ -197,9 +194,7 @@ TF1* TFitEditor::FindFunction() ...@@ -197,9 +194,7 @@ TF1* TFitEditor::FindFunction()
// Look for a system function if it's USER DEFINED function // Look for a system function if it's USER DEFINED function
if ( fTypeFit->GetSelected() == kFP_UFUNC ) { if ( fTypeFit->GetSelected() == kFP_UFUNC ) {
for ( fSystemFuncIter it = funcList.begin(); for (auto f : fSystemFuncs) {
it != funcList.end(); ++it ) {
TF1* f = (*it);
if ( strcmp( f->GetName(), name ) == 0 ) if ( strcmp( f->GetName(), name ) == 0 )
// If found, return it. // If found, return it.
return f; return f;
...@@ -260,6 +255,7 @@ TF1* copyTF1(TF1* f) ...@@ -260,6 +255,7 @@ TF1* copyTF1(TF1* f)
fnew->Save(xmin,xmax,0,0,0,0); fnew->Save(xmin,xmax,0,0,0,0);
fnew->SetParent( 0 ); fnew->SetParent( 0 );
fnew->AddToGlobalList(false); fnew->AddToGlobalList(false);
printf("Create TF1 %s %p\n", fnew->GetName(), fnew);
return fnew; return fnew;
} }
} }
...@@ -1681,9 +1677,7 @@ void TFitEditor::FillFunctionList(Int_t) ...@@ -1681,9 +1677,7 @@ void TFitEditor::FillFunctionList(Int_t)
Int_t newid = kFP_ALTFUNC; Int_t newid = kFP_ALTFUNC;
// Add system functions // Add system functions
for ( fSystemFuncIter it = fSystemFuncs.begin(); for (auto f : fSystemFuncs) {
it != fSystemFuncs.end(); ++it ) {
TF1* f = (*it);
// Don't include system functions that has been previously // Don't include system functions that has been previously
// used to fit, as those are included under the kFP_PREVFIT // used to fit, as those are included under the kFP_PREVFIT
// section. // section.
...@@ -2186,14 +2180,14 @@ void TFitEditor::DoFit() ...@@ -2186,14 +2180,14 @@ void TFitEditor::DoFit()
GetParameters(fFuncPars,fitFunc); GetParameters(fFuncPars,fitFunc);
// Save fit data for future use as a PrevFit function. // Save fit data for future use as a PrevFit function.
TF1* tmpTF1 = static_cast<TF1*>( copyTF1(fitFunc) ); TF1* tmpTF1 = copyTF1(fitFunc);
ostringstream name; ostringstream name;
name << "PrevFit-" << fPrevFit.size() + 1; name << "PrevFit-" << fPrevFit.size() + 1;
if ( strcmp(tmpTF1->GetName(), "PrevFitTMP") != 0 ) if ( strcmp(tmpTF1->GetName(), "PrevFitTMP") != 0 )
name << "-" << tmpTF1->GetName(); name << "-" << tmpTF1->GetName();
tmpTF1->SetName(name.str().c_str()); tmpTF1->SetName(name.str().c_str());
fPrevFit.insert(FitFuncMap_t::value_type(fFitObject, tmpTF1)); fPrevFit.emplace(fFitObject, tmpTF1);
fSystemFuncs.push_back( copyTF1(tmpTF1) ); fSystemFuncs.emplace_back( copyTF1(tmpTF1) );
float xmin = 0.f, xmax = 0.f, ymin = 0.f, ymax = 0.f, zmin = 0.f, zmax = 0.f; float xmin = 0.f, xmax = 0.f, ymin = 0.f, ymax = 0.f, zmin = 0.f, zmax = 0.f;
if ( fParentPad ) { if ( fParentPad ) {
...@@ -3311,7 +3305,7 @@ TF1* TFitEditor::HasFitFunction() ...@@ -3311,7 +3305,7 @@ TF1* TFitEditor::HasFitFunction()
// breaks in the loops would make it to be different to // breaks in the loops would make it to be different to
// fPrevFit.end() if the function is already stored // fPrevFit.end() if the function is already stored
if ( it == fPrevFit.end() ) { if ( it == fPrevFit.end() ) {
fPrevFit.insert( FitFuncMap_t::value_type( fFitObject, static_cast<TF1*>( copyTF1( func ) ) ) ); fPrevFit.emplace(fFitObject, copyTF1(func));
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment