00001
00008 #include <cassert>
00009 #include <iostream>
00010 #include "TestTools/initGaudi.h"
00011 #include "GaudiKernel/ISvcLocator.h"
00012 #include "AthenaKernel/IAtRndmGenSvc.h"
00013 #include "StoreGate/tools/hash_functions.h"
00014 #include "CLHEP/Random/RandomEngine.h"
00015
00016 using std::cerr;
00017 using std::cout;
00018 using std::endl;
00019 using namespace Athena_test;
00020
00021 int main() {
00022 ISvcLocator* pSvcLoc(0);
00023 if (!initGaudi("AtRndmGen_test.txt", pSvcLoc)) {
00024 cerr << "This test can not be run" << endl;
00025 return 0;
00026 }
00027 assert(pSvcLoc);
00028
00029 IAtRndmGenSvc* pAtRndmGen(0);
00030 assert((pSvcLoc->service("AtRndmGenSvc", pAtRndmGen, true)).isSuccess());
00031 assert(pAtRndmGen);
00032
00033 HepRandomEngine* pEng(pAtRndmGen->GetEngine("PITHIA_INIT"));
00034 assert(pEng);
00035 const long* seeds(pEng->getSeeds());
00036 assert(1 == seeds[1]-seeds[0]);
00037
00038 pEng=pAtRndmGen->setOnDefinedSeeds(1,"PITHIA");
00039 assert(pEng);
00040 seeds = pEng->getSeeds();
00041
00042 assert(9000 == seeds[0]-seeds[1]);
00043 assert(SG::simpleStringHash("PITHIA") == seeds[0] - 10000);
00044
00045 cout << "*** AtRndSvc_test OK ***" <<endl;
00046 return 0;
00047 }