1
0
Fork 0

Ex4.2 feedback: CaloCell return type

This commit is contained in:
Eric Teunis de Boone 2020-06-30 13:58:41 +02:00
parent f5524b020c
commit 83bf4e34dc
2 changed files with 2 additions and 20 deletions

View file

@ -1,18 +0,0 @@
//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 ] ;
}

View file

@ -13,10 +13,10 @@ class CaloCell
// No need for Constructor or Destructor // No need for Constructor or Destructor
double getEnergy() const { return energy; } double getEnergy() const { return energy; }
bool setEnergy( double new_energy ) { return (energy = new_energy) ; } void setEnergy( double new_energy ) { energy = new_energy ; }
int getId() const { return ID ; } int getId() const { return ID ; }
bool setId( int new_id ) { return ( ID = new_id ) ; } void setId( int new_id ) { ID = new_id ; }
private: private: