14#include "FairRootManager.h"
15#include "tbb/parallel_for.h"
16#include "tbb/parallel_invoke.h"
17#include "tbb/spin_mutex.h"
19#include "tbb/task_scheduler_init.h"
20#include "tbb/task_scheduler_observer.h"
21#include "tbb/tick_count.h"
46 for (
int i = 0; i < 8; i++) {
56#define handle_error_en(en, msg) \
65 pthread_t I = pthread_self();
66 spin_mutex::scoped_lock lock;
81 CPU_SET(cpuId, &cpuset);
83 s = pthread_setaffinity_np(thread,
sizeof(cpu_set_t), &cpuset);
85 cout <<
" pthread_setaffinity_np " << endl;
93 pthread_t I = pthread_self();
94 cout <<
"Thread with number " << I <<
" was ended " << --
threads_counter;
101 std::vector<std::vector<CbmRichHoughHit>>
fData;
113 for (
int i = 0; i <
fData.size(); i++) {
138 cout <<
"InitStatus CbmRichParallelQa::Init()" << endl;
140 FairRootManager* ioman = FairRootManager::Instance();
142 Fatal(
"CbmRichParallelQa::Init",
"RootManager not instantised!");
145 fRichHits = (TClonesArray*) ioman->GetObject(
"RichHit");
147 Fatal(
"CbmRichParallelQa::Init",
"No RichHit array!");
150 fRichRings = (TClonesArray*) ioman->GetObject(
"RichRing");
152 Fatal(
"CbmRichParallelQa::Init",
"No RichRing array!");
170 std::vector<CbmRichHoughHit> data;
172 const Int_t nhits =
fRichHits->GetEntriesFast();
174 cout <<
"-E- CbmRichRingFinderHough::DoFind:No hits in this event." << endl;
179 for (Int_t iHit = 0; iHit < nhits; iHit++) {
186 tempPoint.fId = iHit;
188 data.push_back(tempPoint);
192 fData.push_back(data);
195 cout <<
"-I- NofTasks = " <<
fNofTasks << endl;
199 tbb::task_scheduler_init init(
fNofTasks);
206 tbb::tick_count t0 = tbb::tick_count::now();
207 task* root_task =
new (task::allocate_root()) empty_task;
215 root_task->spawn_and_wait_for_all(list);
216 tbb::tick_count t1 = tbb::tick_count::now();
218 root_task->destroy(*root_task);
220 cout << 1000. *
fExecTime <<
" ms for " <<
fData.size() <<
" events" << endl;
221 cout << 1000. *
fExecTime / (
fData.size()) <<
" ms per event " << endl;
225 fout.open(
"parallel.txt", std::ios_base::app);
map< int, long > threadToCpuMap
map< int, int > threadNumberToCpuMap
Int_t DoFind(CbmEvent *event, TClonesArray *hitArray, TClonesArray *projArray, TClonesArray *ringArray)
Implementation of RICH hit for ring finder algorithm.
virtual ~CbmRichParallelQa()
std::vector< std::vector< CbmRichHoughHit > > fData
virtual InitStatus Init()
virtual void Exec(Option_t *option)
CbmL1RichENNRingFinder * fHT[kMAX_NOF_THREADS]
static const int kMAX_NOF_THREADS
TClonesArray * fRichRings
CbmL1RichENNRingFinder * fHT
FinderTaskQa(CbmL1RichENNRingFinder *HTImpl, const std::vector< std::vector< CbmRichHoughHit > > &data)
std::vector< std::vector< CbmRichHoughHit > > fData
void on_scheduler_exit(bool Is_worker)
void on_scheduler_entry(bool Is_worker)