Ex4.2 feedback: CaloCell return type
This commit is contained in:
parent
f5524b020c
commit
83bf4e34dc
2 changed files with 2 additions and 20 deletions
|
@ -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 ] ;
|
|
||||||
}
|
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Reference in a new issue