BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
AtRndmGen_test.cxx File Reference

unit test for AtRndSvc More...

#include <cassert>
#include <iostream>
#include "TestTools/initGaudi.h"
#include "GaudiKernel/ISvcLocator.h"
#include "AthenaKernel/IAtRndmGenSvc.h"
#include "StoreGate/tools/hash_functions.h"
#include "CLHEP/Random/RandomEngine.h"

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

unit test for AtRndSvc

based on ATLAS software

Definition in file AtRndmGen_test.cxx.

Function Documentation

◆ main()

int main ( )

Definition at line 21 of file AtRndmGen_test.cxx.

21 {
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}