17 #include <FairLogger.h>
18 #include <FairParSet.h>
19 #include <FairRunAna.h>
20 #include <FairRuntimeDb.h>
32 : fMap(pulse->GetMap()), fSim(move(sim)), fClusterize(move(
cluster)), fPulse(move(pulse)),
48 ROOT::EnableThreadSafety();
56 FairRunAna *ana = FairRunAna::Instance();
57 FairRuntimeDb *rtdb = ana->GetRuntimeDb();
58 fPar =
dynamic_cast<AtDigiPar *
>(rtdb->getContainer(
"AtDigiPar"));
64 if (
fSim->GetSpaceChargeModel())
65 fSim->GetSpaceChargeModel()->LoadParameters(
fPar);
77 for (
int i = 0; i < numIter; ++i) {
79 int idx = startIter + i;
86 result.fIterNum = idx;
87 result.fObjective = obj;
94 LOG(debug) <<
"Done with run iter range";
120 auto start = std::chrono::high_resolution_clock::now();
123 std::vector<std::pair<int, int>> threadParam;
126 threadParam.emplace_back(0, iterPerTh);
128 threadParam[i].second++;
130 threadParam[i].first = threadParam[i - 1].first + threadParam[i - 1].second;
132 for (
int i = 0; i < threadParam.size(); ++i) {
133 LOG(info) << i <<
": " << threadParam[i].first <<
" " << threadParam[i].second;
136 std::vector<std::thread> threads;
138 LOG(debug) <<
"Creating thread " << i <<
" with " << threadParam[i].first <<
" " << threadParam[i].second
139 <<
" and " <<
fPulse.get();
142 threads.emplace_back(
143 [
this](std::pair<int, int> param,
AtPulse *pulse) { this->
RunIterRange(param.first, param.second, pulse); },
148 for (
auto &th : threads)
151 auto stop = std::chrono::high_resolution_clock::now();
154 LOG(info) <<
"Simulation of " <<
fNumIter <<
" events took "
155 << std::chrono::duration_cast<std::chrono::milliseconds>(stop - start).count() <<
" ms.";
162 LOG(debug) <<
"Digitizing event at " << idx;
167 LOG(debug) <<
"Running PSA at " << idx;
170 LOG(debug) <<
"Done digitizing event at " << idx;
179 resultArray.Delete();
181 simRawEvent.Delete();
185 int clonesIdx = resultArray.GetEntries();
186 int eventIdx = res.fIterNum;
187 LOG(debug) <<
"Filling iteration " << eventIdx <<
" at index " << resultArray.GetEntries();
189 new (resultArray[clonesIdx])
AtMCResult(std::move(res));
212 distro->TruncateSpace();