// A cheating cluster code that uses the MCParticle 
// history to define calorimeter clusters.
// Jan 15,1999 Rob Shanks Creation of Cluster class
// Feb 5, 1999 Rob Shanks Replacement of all pointers in class with objects

#ifndef CLUSTER
#define CLUSTER

#include "TMath.h"
#include "IntObj.h"
#include "Event.h"
#include "towerID.h"
#include "McPart.h"
#include "TObject.h"
#include "TObjArray.h"
#include "EDeposit.h"

class Cluster: public TObject {

public:

  Cluster();
  ~Cluster();
  void Clean();

  void SetUpCluster(Float_t energy,Float_t ePhi,Float_t eTheta,Float_t R,
		    Float_t phiRMS,Float_t thetaRMS,Float_t RRms);

  Float_t GetEnergy();
  Float_t GetEnergyTheta();
  Float_t GetEnergyPhi();
  Float_t GetEnergyR();
  Float_t GetEnergyThetaRMS();
  Float_t GetEnergyPhiRMS();
  Float_t GetEnergyRRMS();
  Float_t GetClusterStartDepth();
  void AddHit(towerID* tower,IntObj* index,EDeposit* edep);
  void AddParticle(IntObj* part);
  
  void Spew(FILE* ofile);
  
  TObjArray* McList() { return &m_mcList;};
  TObjArray* IndexList() { return &m_IndexList;};
  TObjArray* HitList() { return &m_hitList;};
  TObjArray* MCEList() { return &m_mcEList;};
  
private:
  
  Float_t m_energy;       // cluster energy
  Float_t m_energyTheta;  // cluster theta weighted by energy
  Float_t m_energyPhi;    // cluster phi weighted by energy
  Float_t m_energyThetaRMS;  // cluster theta RMSweighted by energy
  Float_t m_energyPhiRMS;    // cluster phi RMS weighted by energy
  Float_t m_eRRMS;
  
  Float_t m_eR;              // IP to cluster Emax dist.
  Float_t m_clusterStartDepth; // radius where cluster goes above min-I
  
  TObjArray m_mcList;  // list of indices of contributing MC particles. 
                       // Contents are IntObj objects.
  TObjArray m_IndexList;  // list of indices to CalHit objects. Contents are
                          // IntObj objects.
  TObjArray m_mcEList;  // list of energy from contributing MC particles. 
                        // Contents are EDeposit objects.
  TObjArray m_hitList;  // list of constituent towers. Contents are towerID 
			// objects.

ClassDef(Cluster,1)
};

#endif
