CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/SimG4CMS/Muon/interface/MuonSensitiveDetector.h

Go to the documentation of this file.
00001 #ifndef MuonSensitiveDetector_h
00002 #define MuonSensitiveDetector_h
00003 
00018 #include "SimG4Core/Notification/interface/Observer.h"
00019 #include "SimG4Core/Notification/interface/BeginOfEvent.h"
00020 #include "SimG4Core/Notification/interface/EndOfEvent.h"
00021 #include "SimG4Core/SensitiveDetector/interface/SensitiveTkDetector.h"
00022 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00023 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00024 
00025 #include "G4Step.hh"
00026 #include "G4StepPoint.hh"
00027 #include "G4Track.hh"
00028 
00029 #include <string>
00030 
00031 class MuonSlaveSD;
00032 class MuonSimHitNumberingScheme;
00033 class MuonFrameRotation;
00034 class UpdatablePSimHit;
00035 class MuonSubDetector;
00036 class MuonG4Numbering;
00037 class SimHitPrinter;
00038 class TrackInformation;
00039 class G4Track;
00040 class G4ProcessTypeEnumerator;
00041 class G4TrackToParticleID;
00042 class SimTrackManager;
00043 
00044 class MuonSensitiveDetector : 
00045 public SensitiveTkDetector,
00046 public Observer<const BeginOfEvent*>,
00047 public Observer<const EndOfEvent*>
00048  {
00049 
00050  public:    
00051   MuonSensitiveDetector(std::string, const DDCompactView &,
00052                         SensitiveDetectorCatalog &, edm::ParameterSet const &,
00053                         const SimTrackManager*);
00054   virtual ~MuonSensitiveDetector();
00055   virtual G4bool ProcessHits(G4Step *,G4TouchableHistory *);
00056   virtual uint32_t setDetUnitId(G4Step *);
00057   virtual void EndOfEvent(G4HCofThisEvent*);
00058 
00059   void fillHits(edm::PSimHitContainer&, std::string use);
00060   std::vector<std::string> getNames();
00061   std::string type();
00062 
00063   const MuonSlaveSD* GetSlaveMuon() const {
00064     return slaveMuon; }
00065   
00066  private:
00067   void update(const BeginOfEvent *);
00068   void update(const ::EndOfEvent *);
00069   virtual void clearHits();
00070 
00071   Local3DPoint toOrcaRef(Local3DPoint in ,G4Step * s);
00072   Local3DPoint toOrcaUnits(Local3DPoint);
00073   Global3DPoint toOrcaUnits(Global3DPoint);
00074 
00075   TrackInformation* getOrCreateTrackInformation( const G4Track* theTrack );
00076 
00077  private:
00078   MuonSlaveSD* slaveMuon;
00079   MuonSimHitNumberingScheme* numbering;
00080   MuonSubDetector* detector;
00081   MuonFrameRotation* theRotation;
00082   MuonG4Numbering* g4numbering;
00083 
00084   void storeVolumeAndTrack(G4Step *);
00085   bool newHit(G4Step *);
00086   void createHit(G4Step *);
00087   void updateHit(G4Step *);
00088   void saveHit();
00089   
00095   Local3DPoint InitialStepPositionVsParent(G4Step * currentStep, G4int levelsUp);
00096   Local3DPoint FinalStepPositionVsParent(G4Step * currentStep, G4int levelsUp);
00097 
00098   G4VPhysicalVolume * thePV;
00099   UpdatablePSimHit* theHit;
00100   uint32_t theDetUnitId; 
00101   unsigned int theTrackID;
00102  
00103   bool printHits;
00104   SimHitPrinter* thePrinter;
00105   Global3DPoint theGlobalEntry;
00106 
00107   //--- SimTracks cuts
00108   double STenergyPersistentCut;
00109   bool STallMuonsPersistent;
00110 
00111   G4ProcessTypeEnumerator* theG4ProcessTypeEnumerator;
00112 
00113   G4TrackToParticleID* myG4TrackToParticleID;
00114   const SimTrackManager* theManager;
00115 };
00116 
00117 #endif // MuonSensitiveDetector_h