File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,21 +76,20 @@ int main(int argc, char **argv) {
7676 for (size_t iPDF=0 ; iPDF < mySamples.size (); iPDF++) {
7777 MACH3LOG_INFO (" Number of samples: {}" , mySamples[iPDF]->GetNSamples ());
7878 for (int iSample = 0 ; iSample < mySamples[iPDF]->GetNSamples (); iSample++){
79- THStack* Stack = new THStack (* mySamples[iPDF]->ReturnStackedHistBySelection1D (iSample, vecParams[iParam], Selection) );
80- TLegend* Legend = new TLegend (* mySamples[iPDF]->ReturnStackHistLegend () );
79+ auto Stack = mySamples[iPDF]->ReturnStackedHistBySelection1D (iSample, vecParams[iParam], Selection);
80+ TLegend* Legend = mySamples[iPDF]->ReturnStackHistLegend ();
8181
8282 Canv->cd (1 );
8383 Stack->Draw (" HIST" );
8484 // Due to crappy TStack design, you need to draw THStack first then assign axis titles
85- Stack->SetTitle (mySamples[iPDF]->GetSampleTitle (iSample).c_str ());
85+ std::string title = mySamples[iPDF]->GetSampleTitle (iSample);
86+ Stack->SetTitle (title.c_str ());
8687 Stack->GetXaxis ()->SetTitle ((vecParams[iParam]).c_str ());
8788 Canv->cd (2 );
8889 Legend->Draw ();
8990
9091 Canv->Update ();
9192 Canv->Print (OutputName);
92- delete Stack; Stack = nullptr ;
93- delete Legend; Legend = nullptr ;
9493 }
9594 }
9695 }
You can’t perform that action at this time.
0 commit comments