//CaloGrid.cc
#include <iostream>
#include "CaloGrid.hh"

CaloCell* CaloGrid::cell( int x, int y ) {
	if ( x >= nx or x < 0 ) {
		std::cout << "CaloGrid::cell() Error: out of grid (x)" << std::endl ;
		return nullptr;
	}

	if ( y >= ny or y < 0 ) {
		std::cout << "CaloGrid::cell() Error: out of grid (y)" << std::endl ;
		return nullptr;
	}

	return &cells[ x*nx + y ] ;
}

