EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
main.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file main.cxx
1 
2 #include <iostream>
3 #include <vector>
4 #include <fstream>
5 
6 #include "CbmRichRingFinderHough.h"
7 #include "Stopwatch.h"
8 
9 #include "tbb/tick_count.h"
10 
11 int main( int argc, const char* argv[] )
12 {
13  cout << "-I- Start ring finder" << endl;
14 
15  cout <<"-I- Read data from text file" << endl;
16 
17  std::ifstream fin("../data/events.txt");
18  int nofEvents = 100;
19  int evNum, nhits;
20  float x,y;
21  std::vector<CbmRichHoughHit> data;
22  std::vector< std::vector<CbmRichHoughHit> > dataAll;
23  data.reserve(1000);
24  for (int iE = 0; iE < nofEvents; iE++){
25  fin >> evNum >> nhits;
26  cout << "event " << evNum << ", nof hits = " << nhits <<endl;
27  data.clear();
28  for(int iHit = 0; iHit < nhits; iHit++) {
29  CbmRichHoughHit tempPoint;
30  fin >> x >>y;
31  tempPoint.fHit.fX = x;
32  tempPoint.fHit.fY = y;
33  tempPoint.fX2plusY2 = x * x + y * y;
34  tempPoint.fId = iHit;
35  tempPoint.fIsUsed = false;
36  data.push_back(tempPoint);
37  }
38  dataAll.push_back(data);
39  }
40 
41  //tbb::tick_count t0 = tbb::tick_count::now();
42 
43  //Stopwatch timer;
44 
46  timer.Start();
47  for (int iE = 0; iE < dataAll.size(); iE++){
48  cout << "-I- Event:" << iE << endl;
49  finder->DoFind(dataAll[iE]);
50  }
51  //tbb::tick_count t1 = tbb::tick_count::now();
52  //cout << "Exec time per event " << 1000.*(t1-t0).seconds()/nofEvents << " ms" << endl;
53 
54 
55  timer.Stop();
56  cout << "CPU time = " << 1000.*timer.CpuTime() / nofEvents<< " ms per event" << endl;
57  cout << "Real time = " << 1000.*timer.RealTime() / nofEvents<< " ms per event" << endl;
58 
59 
60  dataAll.clear();
61  delete finder;
62 }