/*
*** header file including the declaration of the classes 
*/

class PhotoTube;

// Event class contains all the information of a single event as
// well as some operations on these data
class Event {
 public:
    Event(int n);                        // Create Event of n elements
    Event();                             // Create Event of 0 elements
    Event(const Event&);                 // Copy Event
    ~Event();                            // Destroy Event
    PhotoTube*& operator[](int i);        // Subscripting
    int numTubes();                      // Number of elements
    Event& operator=(const Event&);      // Event assignment
    Event& operator=(PhotoTube*);         // Scalar assignment 
    void setSize(int n);                 // Change size
    void setCColor();	                 // set the color of each PMT
    void setTColor();
    void fadeCColor();                   // fade to find the hottest points
    void fadeTColor();
    void increaseCColor();
    void increaseTColor();
    void init(float*);
    void rotate();

 private:
    int numHits;                         // Number of elements
    float minCharge;
    float maxCharge;
    float minTime;
    float maxTime;    
    PhotoTube** tubeArray;                // Pointer to PhotoTube Array
    void copy(const Event& a);           // Copy in elements of a
};


// PhotoTube class contains all the information of a phototube as well as
// some operations on these data
class PhotoTube	
{
 public:
  PhotoTube();
  PhotoTube(float* para, int i);
  float getT();
  float getC();
  int getScreenX();	                 // get the coordinates on screen
  int getScreenY();                
  int getTColor();                       // get the color for displaying
  int getCColor();
  void virtual calcXY() = 0;                 // calculate the coords on screen
  void virtual rotate() = 0;                 // calculate the rotated coordinates
  void setCColor(float max, float min);  // set the color for displaying
  void setTColor(float max, float min);
  PhotoTube& operator = (PhotoTube&);    // overload "="

 protected:
  float x, y, z;
  int screenX, screenY;
 private:
  float time, charge;
  int index;
  int ccolor;
  int tcolor;
};


// subclass TopTube provides the way to calculate the screen position
// of tubes on the top circle
class TopTube : public PhotoTube
{
 public:
  TopTube();
  TopTube(float*, int);
  void virtual calcXY();
  void virtual rotate();
};

// subclass BottomTube provides the way to calculate the screen
// position of tubes on the bottom circle
class BottomTube : public PhotoTube
{
 public:
  BottomTube();
  BottomTube(float*, int);
  void virtual calcXY();
  void virtual rotate();
};

// for the rest tubes
class SideTube : public PhotoTube
{
 public:
  SideTube();
  SideTube(float*, int);
  void virtual calcXY();
  void virtual rotate();
};


// Colors class decides the color value according to the values of charge 
// and time
class Colors	
{
 public:
  Colors();
  int decide(int i);

 private:
  static int RED1;
  static int RED2;
  static int ORANGE;
  static int PURPLE;
  static int GREEN;
  static int BLACK;
  static int BLUE1;
  static int BLUE2;
  static int BLUE3;
  static int YELLOW;

};
