19 Bool_t failed =
false;
21 Int_t i, start[2] = { 1000, 2000 }, width = 2000, end[2] = { start[0] + 1 + width, start[1] + width };
24 R3BTCalPar* par =
new R3BTCalPar();
25 R3BTCalEngine* engine =
new R3BTCalEngine(par, 0);
27 for (Int_t i = 0; i < 100000; i++)
29 engine->Fill(1, 1, 1, i % width + start[0]);
30 engine->Fill(1, 1, 3, i % width + start[0]);
31 engine->Fill(1, 1, 2, i % width + start[1]);
32 engine->Fill(1, 1, 4, i % width + start[1]);
35 engine->CalculateParamTacquila();
37 for (Int_t pmt = 0; pmt < 2; pmt++)
39 R3BTCalModulePar* mpar = par->GetModuleParAt(1, 1, 1 + pmt);
42 for (i = 0; i < start[pmt] - 1; i++)
43 if (mpar->GetTimeTacquila(i) != -10000)
46 cout <<
"Expected tac-time of channel " << i <<
" to be -10000 but is " << mpar->GetTimeTacquila(i)
51 const Double_t step = 25. / width;
52 for (i = 0; i <= width; i++)
54 if (mpar->GetTimeTacquila(start[pmt] + i - 1) > ((i * step) + tol) ||
55 mpar->GetTimeTacquila(start[pmt] + i - 1) < ((i * step) - tol))
58 cout <<
"Expected tac-time of channel " << i + start[pmt] - 1 <<
" to be " << i * step <<
" ± " << tol
59 <<
" but is " << mpar->GetTimeTacquila(i + start[pmt] - 1) << endl;
63 for (i = end[pmt] + 1; i < 5000; i++)
65 if (mpar->GetTimeTacquila(i) != -10000)
68 cout <<
"Expected tac-time of channel " << i <<
" to be -10000 but is " << mpar->GetTimeTacquila(i)
79 par =
new R3BTCalPar();
80 engine =
new R3BTCalEngine(par, 0);
82 for (Int_t i = 0; i < 100000; i++)
84 engine->Fill(1, 1, 1, i % width + start[0]);
85 engine->Fill(1, 1, 3, i % width + start[0]);
86 engine->Fill(1, 1, 2, i % width + start[1]);
87 engine->Fill(1, 1, 4, i % width + start[1]);
90 engine->CalculateParamVFTX();
92 for (Int_t pmt = 0; pmt < 2; pmt++)
94 R3BTCalModulePar* mpar = par->GetModuleParAt(1, 1, 1 + pmt);
97 for (i = 0; i < start[pmt] - 1; i++)
98 if (mpar->GetTimeVFTX(i) != -10000)
101 cout <<
"Expected VFTX-time of channel " << i <<
" to be -10000 but is " << mpar->GetTimeVFTX(i)
105 Double_t tol = 0.002;
106 const Double_t step = 5. / width;
107 for (i = 0; i <= width; i++)
109 if (mpar->GetTimeVFTX(start[pmt] + i - 1) > ((i * step) + tol) ||
110 mpar->GetTimeVFTX(start[pmt] + i - 1) < ((i * step) - tol))
113 cout <<
"Expected VFTX-time of channel " << i + start[pmt] - 1 <<
" to be " << i * step <<
" ± " << tol
114 <<
" but is " << mpar->GetTimeVFTX(i + start[pmt] - 1) << endl;
118 for (i = end[pmt] + 1; i < 5000; i++)
120 if (mpar->GetTimeVFTX(i) != -10000)
123 cout <<
"Expected VFTX-time of channel " << i <<
" to be -10000 but is " << mpar->GetTimeVFTX(i)
131 Double_t rtime = timer.RealTime();
132 Double_t ctime = timer.CpuTime();
133 cout << endl << endl;
134 cout <<
"Real time " << rtime <<
" s, CPU time " << ctime <<
"s" << endl << endl;
137 cout << endl <<
" Test failed! " << endl;
139 cout << endl <<
" Test successful! " << endl;