some minor improvements proposed by BMW: fix data to graph

This commit is contained in:
suter_a 2015-09-20 19:06:38 +02:00
parent e55ac4ecee
commit fc9c573f2a

View File

@ -4780,18 +4780,22 @@ void PMusrCanvas::PlotData(Bool_t unzoom)
// add all data to fMultiGraphData
for (UInt_t i=0; i<fNonMusrData.size(); i++) {
// the next two lines are ugly but needed for the following reasons:
// the next three lines are ugly but needed for the following reasons:
// TMultiGraph is taking ownership of the TGraphErrors, hence a deep copy is needed.
// This is not resulting in a memory leak, since the TMultiGraph object will do the cleanup
TGraphErrors *ge = new TGraphErrors(*(fNonMusrData[i].data));
// Data points and model curves should be fixed on the graph and not dragged around using, e.g., the mouse.
ge->SetEditable(false);
fMultiGraphData->Add(ge, "p");
}
// add all the theory to fMultiGraphData
for (UInt_t i=0; i<fNonMusrData.size(); i++) {
// the next two lines are ugly but needed for the following reasons:
// the next three lines are ugly but needed for the following reasons:
// TMultiGraph is taking ownership of the TGraphErrors, hence a deep copy is needed.
// This is not resulting in a memory leak, since the TMultiGraph object will do the cleanup
TGraphErrors *ge = new TGraphErrors(*(fNonMusrData[i].theory));
// Data points and model curves should be fixed on the graph and not dragged around using, e.g., the mouse.
ge->SetEditable(false);
fMultiGraphData->Add(ge, "l");
}
@ -4836,6 +4840,11 @@ void PMusrCanvas::PlotData(Bool_t unzoom)
if (fMultiGraphLegend)
fMultiGraphLegend->Draw();
}
// report canvas status events in non-musr plots
if (!fMainCanvas->GetShowEventStatus()) {
fMainCanvas->ToggleEventStatus();
}
}
fDataTheoryPad->Update();
@ -5018,10 +5027,12 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom)
// add all diff data to fMultiGraphDiff
for (UInt_t i=0; i<fNonMusrData.size(); i++) {
// the next two lines are ugly but needed for the following reasons:
// the next three lines are ugly but needed for the following reasons:
// TMultiGraph is taking ownership of the TGraphErrors, hence a deep copy is needed.
// This is not resulting in a memory leak, since the TMultiGraph object will do the cleaing
TGraphErrors *ge = new TGraphErrors(*(fNonMusrData[i].diff));
// Data points and model curves should be fixed on the graph and not dragged around using, e.g., the mouse.
ge->SetEditable(false);
fMultiGraphDiff->Add(ge, "p");
}