00001 #ifndef SimG4Core_SensitiveDetector_H 00002 #define SimG4Core_SensitiveDetector_H 00003 00004 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00005 00006 //#include "DataFormats/GeometryVector/interface/LocalPoint.h" 00007 //#include "DataFormats/GeometryVector/interface/LocalVector.h" 00008 #include "DataFormats/GeometryVector/interface/LocalPoint.h" 00009 #include "DataFormats/GeometryVector/interface/LocalVector.h" 00010 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" 00011 #include "SimG4Core/Geometry/interface/SensitiveDetectorCatalog.h" 00012 00013 #include "G4VSensitiveDetector.hh" 00014 00015 #include <boost/cstdint.hpp> 00016 #include <string> 00017 00018 class G4Step; 00019 class G4HCofThisEvent; 00020 class G4TouchableHistory; 00021 class G4VPhysicalVolume; 00022 class DDCompactView; 00023 00024 class SensitiveDetector : public G4VSensitiveDetector 00025 { 00026 public: 00027 explicit SensitiveDetector(std::string & iname, const DDCompactView & cpv, 00028 SensitiveDetectorCatalog & , 00029 edm::ParameterSet const & p); 00030 virtual ~SensitiveDetector(); 00031 virtual void Initialize(G4HCofThisEvent * eventHC); 00032 virtual void clearHits() = 0; 00033 virtual G4bool ProcessHits(G4Step * step ,G4TouchableHistory * tHistory) = 0; 00034 virtual uint32_t setDetUnitId(G4Step * step) = 0; 00035 void Register(); 00036 virtual void AssignSD(std::string & vname); 00037 virtual void EndOfEvent(G4HCofThisEvent * eventHC); 00038 enum coordinates {WorldCoordinates, LocalCoordinates}; 00039 Local3DPoint InitialStepPosition(G4Step * s, coordinates); 00040 Local3DPoint FinalStepPosition(G4Step * s, coordinates); 00041 Local3DPoint ConvertToLocal3DPoint(G4ThreeVector point); 00042 std::string nameOfSD() { return name; } 00043 virtual std::vector<std::string> getNames() 00044 { 00045 std::vector<std::string> temp; 00046 temp.push_back(nameOfSD()); 00047 return temp; 00048 } 00049 00050 void NaNTrap( G4Step* step ) ; 00051 00052 private: 00053 std::string name; 00054 G4Step * currentStep; 00055 }; 00056 00057 #endif