00001 #include "DsRpcModel.h"
00002
00003
00004 #include "G4MuonPlus.hh"
00005 #include "G4MuonMinus.hh"
00006 #include "G4FastTrack.hh"
00007 #include "G4TransportationManager.hh"
00008 #include "G4Navigator.hh"
00009 #include "G4VSensitiveDetector.hh"
00010
00011 class G4Hooks {
00012 public:
00013 G4Hooks()
00014 : fakeStep(new G4Step)
00015 , touchable(new G4TouchableHistory )
00016 , navi(new G4Navigator)
00017 , setup(false) { }
00018
00019 ~G4Hooks() {
00020 delete fakeStep;
00021 delete navi;
00022
00023 }
00024
00025 G4Step * fakeStep;
00026 G4TouchableHandle touchable;
00027 G4Navigator* navi;
00028 bool setup;
00029 };
00030
00031 DsRpcModel::DsRpcModel(const G4String& name, G4Envelope* volume, G4bool unique)
00032 : G4VFastSimulationModel(name,volume,unique)
00033 , m_hooks(new G4Hooks)
00034 {
00035 G4cout << "DsRpcModel " << name << " created" << G4endl;
00036 }
00037
00038 DsRpcModel::DsRpcModel(const G4String& name)
00039 : G4VFastSimulationModel(name)
00040 , m_hooks(new G4Hooks)
00041 {
00042 G4cout << "DsRpcModel " << name << " created" << G4endl;
00043 }
00044
00045 DsRpcModel::~DsRpcModel ()
00046 {
00047 delete m_hooks; m_hooks = 0;
00048 }
00049
00050
00051 G4bool DsRpcModel::IsApplicable(const G4ParticleDefinition& particle)
00052 {
00053 G4cout << "DsRpcModel " << particle.GetParticleName() << G4endl;
00054 return &particle == G4MuonPlus::Definition()|| &particle == G4MuonMinus::Definition();
00055 }
00056
00057 G4bool DsRpcModel::ModelTrigger(const G4FastTrack & )
00058 {
00059
00060 return true;
00061 }
00062
00063 void DsRpcModel::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep)
00064 {
00065 const G4Track* track = fastTrack.GetPrimaryTrack();
00066 double energy = track->GetKineticEnergy();
00067
00068 fastStep.ProposeTrackStatus(fStopAndKill);
00069 fastStep.ProposePrimaryTrackPathLength(0.0);
00070 fastStep.ProposeTotalEnergyDeposited(energy);
00071 }