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

unit test for AtRndSvc More...

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

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 {
25 cerr << "This test can not be run" << endl;
26 return 0;
27 }
28 assert( pSvcLoc );
29
30 IAtRndmGenSvc* pAtRndmGen( 0 );
31 assert( ( pSvcLoc->service( "AtRndmGenSvc", pAtRndmGen, true ) ).isSuccess() );
32 assert( pAtRndmGen );
33 // this depends on AtRndmGen_test.txt
34 HepRandomEngine* pEng( pAtRndmGen->GetEngine( "PITHIA_INIT" ) );
35 assert( pEng );
36 const long* seeds( pEng->getSeeds() );
37 assert( 1 == seeds[1] - seeds[0] );
38
39 pEng = pAtRndmGen->setOnDefinedSeeds( 1, "PITHIA" );
40 assert( pEng );
41 seeds = pEng->getSeeds();
42 // this depends on the details of setOnDefinedSeeds
43 assert( 9000 == seeds[0] - seeds[1] );
44 assert( SG::simpleStringHash( "PITHIA" ) == seeds[0] - 10000 );
45
46 cout << "*** AtRndSvc_test OK ***" << endl;
47 return 0;
48}