Fixed array declarations and loop controls in Pyramid.cpp and Detector.cpp