Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

TowerId.h

Go to the documentation of this file.
00001 #ifndef GLAST_TOWERID_H
00002 #define GLAST_TOWERID_H 1
00003 
00007 namespace idents {
00008 
00009 class TowerId
00010 {
00011   public:
00012 
00019       enum {xNum=4, yNum=4}; // not likely to change again
00020 
00022       TowerId (unsigned int id = 0):m_id(id){}
00023 
00025       TowerId (unsigned int ix, unsigned int iy):m_id(ix+xNum*iy){}
00026 
00028       int id () const {return m_id; }
00029 
00031       int ix () const {return (m_id % xNum);}
00032 
00034       int iy () const {return (m_id / xNum);}
00035 
00037       bool neighbor (const TowerId& n){
00038           int dx = ix()-n.ix(), dy=iy()-n.iy();
00039           return dx<2 && dx>-2 && dy<2 && dy>-2; 
00040       }
00041 
00042       /* dereference operator -- replace with explicit method above
00043       operator unsigned int () const { return m_id; }
00044       */
00045 
00046 private:
00047       unsigned int m_id;
00048 };
00049 
00050 } //namespace idents
00051 
00052 #endif
00053 

Generated at Wed Nov 21 12:20:09 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000