chainparams.cpp contains a line of code that checks whether the chain’s genesis block is equal to a specified hash.
You can see an example for the line here:
hashGenesisBlock = genesis.GetHash();
assert(hashGenesisBlock == uint256("9915158279673d101912be80f25c20627f1dd8bf5231e7c46bfec5ed19737f44"));
To print it the hash of the genesis block, you can use
printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());
Which prints the genesis block in terminal or debug.log