BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
AtRndmGen_test.cxx
Go to the documentation of this file.
1/** @file AtRndmGen_test.cxx
2 * @brief unit test for AtRndSvc
3 *
4 * based on ATLAS software
5 *
6 **/
7
8#include <cassert>
9#include <iostream>
10#include "TestTools/initGaudi.h"
11#include "GaudiKernel/ISvcLocator.h"
12#include "AthenaKernel/IAtRndmGenSvc.h"
13#include "StoreGate/tools/hash_functions.h"
14#include "CLHEP/Random/RandomEngine.h"
15
16using std::cerr;
17using std::cout;
18using std::endl;
19using namespace Athena_test;
20
21int main() {
22 ISvcLocator* pSvcLoc(0);
23 if (!initGaudi("AtRndmGen_test.txt", pSvcLoc)) {
24 cerr << "This test can not be run" << endl;
25 return 0;
26 }
27 assert(pSvcLoc);
28
29 IAtRndmGenSvc* pAtRndmGen(0);
30 assert((pSvcLoc->service("AtRndmGenSvc", pAtRndmGen, true)).isSuccess());
31 assert(pAtRndmGen);
32 // this depends on AtRndmGen_test.txt
33 HepRandomEngine* pEng(pAtRndmGen->GetEngine("PITHIA_INIT"));
34 assert(pEng);
35 const long* seeds(pEng->getSeeds());
36 assert(1 == seeds[1]-seeds[0]);
37
38 pEng=pAtRndmGen->setOnDefinedSeeds(1,"PITHIA");
39 assert(pEng);
40 seeds = pEng->getSeeds();
41 // this depends on the details of setOnDefinedSeeds
42 assert(9000 == seeds[0]-seeds[1]);
43 assert(SG::simpleStringHash("PITHIA") == seeds[0] - 10000);
44
45 cout << "*** AtRndSvc_test OK ***" <<endl;
46 return 0;
47}
int main()