_ROOT Version:6.22/08
_Platform: linuxx8664gcc
Dear colleagues,
A few weeks ago, I learned how to parallelize tasks using the ROOT framework from a forum thread. (https://root-forum.cern.ch/t/parallelization-inside-a-root-macro/54453/5)
But now I face a different problem, and it might be I do not understand all the logic behind it.
Here a piece of my code:
std::map<std::string, std::unique_ptr<TH2D>> h2_;
std::vector<int> sts_address = {0x10018012, 0x10008012};
void BookHistograms(){
auto createHisto = [](int module_i){
int NbOfTimeBins = 2.*m_timeWindows / dClockCycle + 1;
for (unsigned int i = 0; i < 16; i++){
std::string name = Form("0x%x_ASIC_%u", module_i, i);
LOG(info) << Form("Creating %s", name.c_str());
h2_[name] = std::make_unique<TH2D>(name.c_str(), name.c_str(),
NbOfTimeBins, -m_timeWindows-1.5625, m_timeWindows+1.5625,
31, 1, 32);
}
return 1;
};
gROOT->SetBatch();
ROOT::TProcessExecutor workers(sts_address.size());
workers.Map(createHisto, sts_address);
LOG(info) << h2_.size();
}
the problem I have is that after calling BookHistograms(), the print out for the line LOG(info) << h2_.size();
, is
> 0
So, what am I missing here?