#ifndef PDETECTOR_H
#define PDETECTOR_H
#include <string>
#include <iostream>
#include <map>
#include "pHit.h"

using std::cout;
using std::endl;
using std::string;
using std::map;

class pDetector {

public:


  pDetector(const string & s=0,pHit *p=0): _name(s) 
      {
	  if(p!=0)AddHit(p);
      };
  void AddHit(pHit *p){_hits.push_back(p);} 
//   void AddHit(const char *c){
//       _hits.push_back(pUtil::GetpHit(_name,c));
//   }
  void Print() const {
    cout << " pDetector: " << GetName() << endl;
    cout << " pHit stored: " << endl;
    for( pHitColl::const_iterator p=_hits.begin(); p!= _hits.end();++p)
      (*p)->Print();
  }

  pHit* GetHit(const int n) {return _hits[n];}
  pHitColl* GetHitColl() {return &_hits;}
  string GetName() const {return _name;}
  void SetName(const string & s){_name=s;}
  
private:
  string _name;
  pHitColl _hits;
  
};

typedef map<string,pDetector*> pDetMap;

#endif //PDETECTOR_H
