NAGASH 0.9.8
Next Generation Analysis System
|
Some tips to make your framework run faster.
Some tips to make your framework run faster.
The NAGASH::LoopEvent::Execute() will be called for each entry in the TTree
, and methods like NAGASH::ResultGroup::Get(), NAGASH::ConfigTool::GetPar() and NAGASH::PlotGroup::GetPlot1D() involves a std::map::find
called which is unnecessary and time-consuming. To avoid the unnecessary cost, you can store the pointer of your objects or value of booked parameters as member variables. An example is shown in this.
The opening and close of TFile
are time-consuming. If you want to recover massive plots in your program, you should create a NAGASH::TFileHelper object and pass it to methods like NAGASH::PlotGroup::Recover() instead of the file name.
Consider the following two ways of defining a histogram:
The two histograms are "identical". But the filling of h2
will be much slower because ROOT
uses binary search to decide the bin number. For h1
, since the size of bins are fixed, ROOT
can directly calculate the bin number, thus the filling will be faster.