#ifndef PAMVMCTRKSD_H
#define PAMVMCTRKSD_H
#include <iostream>

#include "PamVMCDetectorSD.h"

using std::cout;
using std::endl;

class PamVMCTrkSD: public PamVMCDetectorSD{

 

public:
  PamVMCTrkSD():PamVMCDetectorSD("pHitData","TSPA",1000)
{
  
};


  /* virtual void FillHit(fin f,TVirtualMC *g){ 

  
     switch(f) {
    case ENTERING:
     
       CleanHit();
      FillVolID();
      InitHit(); 
    
    default:
     UpdateHit(g);
     cout<<"plane "<<GetPlaneID()<<" pad "<<GetPadID();
     cout<<" NEW HIT ENTERING OR  INSIDE "<<fnohit<<" PDG="<<fhit.GetPDG()<<" at "<<g->TrackTime()<<" fTOF is: "<<fhit.GetTOF()<<endl;
     break;      
   }

  switch(f){
  case EXITING:
  // Save hit if energy release is greater than zero
    UpdateHit(g); 
   if(fhit.GetEREL()){
  if(fdetID->FillVolID()){
      cout<<"plane "<<GetPlaneID()<<" pad "<<GetPadID();
      cout<<" NEW HIT EXITING "<<fnohit<<" PDG="<<fhit.GetPDG()<<" at "<<g->TrackTime()<<" fTOF is: "<<fhit.GetTOF()<<endl;
  	  SaveHit("TSPA");
  } else {
    cout << "TOF FillVolID false" <<endl; 
  }
    }
    break;
  default:
    break;
  }
  }

  */
Int_t GetPlaneID(){
    return ((int)fhit.GetPOS()/6+1);
}

Int_t GetPadID(){
    return (fhit.GetPOS()-(GetPlaneID()-1)*6);
}

  ClassDef(PamVMCTrkSD,1)

    };

#endif // PAMVMCTRKSD_H
