#ifndef OAEVENT_IMCHIT_HXX
#define OAEVENT_IMCHIT_HXX

#include <iostream>
#include <vector>

#include "ISingleHit.hxx"
#include "IG4VHit.hxx"

namespace COMET {
    class IG4VHit;
    class IMCHit;
    class IWritableMCHit;
}

/// A single calibrated hit detector element from the MC.  This corresponds to
/// a real measurement inside the detector, but after it has been fully
/// calibrated.
class COMET::IMCHit : public ISingleHit {
public:
    typedef std::vector<IG4VHit*> ContributorContainer;

    IMCHit();
    IMCHit(const IWritableMCHit& val);
    virtual ~IMCHit();

    /// Return the MC information for the raw MC hits that contributed to this
    /// hit.
    virtual const ContributorContainer& GetContributors() const {
        return fContributors;
    }

    // Return the number of hits that contribute to this hit.       
    virtual int GetContributorCount() const {return fContributors.size();}

    /// Print the hit information.
    virtual void ls(Option_t *opt = "") const;

protected:
    /// The G4HitBase objects that contributed to this hit.
    ContributorContainer fContributors;

    ClassDef(IMCHit,6);
};

/// Provide a writable derived class used to create a IMCHit object.
class COMET::IWritableMCHit : public IMCHit {
public:
    IWritableMCHit();
    IWritableMCHit(const IWritableMCHit& h);
    virtual ~IWritableMCHit();

    void SetGeomID(IGeometryId id);

    void SetCharge(double q);

    void SetTime(double t);

    void SetChargeValidity(bool valid);

    void SetTimeValidity(bool valid);

    void SetChannelID(COMET::IChannelId id);

    /// Return non constant version of the MC information for the raw MC hits
    /// that contributed to this hit.
    virtual ContributorContainer& GetContributors() {
        return fContributors;
    }

    /// Return the MC information for the raw MC hits that contributed to this
    /// hit.
    virtual const ContributorContainer& GetContributors() const {
        return fContributors;
    }

    ClassDef(IWritableMCHit,7);
};
#endif