The chapter06/scenetonemap.cpp file in the example code.
Bruce Justin Lindbloom has provided a useful web resource for conversion between color spaces. It includes among other things the transformation matrices needed to convert from RGB to XYZ. Visit: http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_RGB.html.
The Rendering to a texture recipe in Chapter 5, Using Textures.