Hello,
we would appreciate some help to improve the performance of our code. A short description of the problem:
We are using root version 5.22 and TTrees containing several std:vector of variable size (typically of size less than 10).
We create histograms using TSelectorDraw in the following way:
TSelectorDraw* thisSelector = new TSelectorDraw();
TList* input = new TList();
input->Add(new TNamed(“varexp”,varexp));
input->Add(new TNamed(“selection”,selection));
thisSelector->SetInputList(input);
where “varexp” denotes the variable in the tree and histogram to be filled, such as:
“jetPt+>>+histogramName”
“selection” is a string containing cut statements such as
jetPt>30 && TMath::Abs(jetEta)<2.4 && triggerHLTJet15U==1 && 3dDistance>-0.5
where jetPt, jetEta, etc. are again std::vectors<> of same length.
The TTree is then processed with something like:
TFile* thisFile = TFile::Open( … );
TTree* thisTree = (TTree*)thisFile->Get(“Events”);
Long64_t nentries = thisTree->GetEntries();
thisTree->Process(thisSelector,“goff”,nentries,0);
Trees typically contain several millions of events and the program runs several hours at 100% CPU which is not satisfactory.
The profiler (gprof) tells us that most of the CPU time is spent in TSelectorDraw::Process.
Do you have any hints or recommendations how to increase performance? Would a manual event loop or a different data structure (fixed size arrays instead of vectors) improve anything?
Thanks for your help in advance,
best,
alex