00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "BDSGlobalConstants.hh"
00014
00015 #include "BDSDumpSD.hh"
00016 #include "BDSDebug.hh"
00017 #include "G4VPhysicalVolume.hh"
00018 #include "G4LogicalVolume.hh"
00019 #include "G4Track.hh"
00020 #include "G4Step.hh"
00021 #include "G4ParticleDefinition.hh"
00022 #include "G4VTouchable.hh"
00023 #include "G4TouchableHistory.hh"
00024 #include "G4ios.hh"
00025 #include "G4RotationMatrix.hh"
00026 #include "G4ThreeVector.hh"
00027
00028 #include "G4AffineTransform.hh"
00029
00030 BDSDumpSD::BDSDumpSD(G4String name, G4String type):
00031 G4VSensitiveDetector(name),
00032 itsType(type)
00033 {
00034 }
00035
00036 BDSDumpSD::~BDSDumpSD()
00037 {;}
00038
00039 void BDSDumpSD::Initialize(G4HCofThisEvent*)
00040 {
00041 }
00042
00043 G4bool BDSDumpSD::ProcessHits(G4Step*aStep,G4TouchableHistory*)
00044 {
00045 G4cout << __METHOD_NAME__ <<G4endl;
00046 G4Track* theTrack=aStep->GetTrack();
00047 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
00048
00049
00050
00051 if(preStepPoint->GetStepStatus()==fGeomBoundary){
00052 if(abs(theTrack->GetDefinition()->GetPDGEncoding()) == 11){
00053 #ifdef BDSDEBUG
00054 G4cout << __METHOD_NAME__ <<"Dump: postponing track..."<<G4endl;
00055 #endif
00056 BDSGlobalConstants::Instance()->setWaitingForDump(true);
00057
00058
00059 theTrack->SetTrackStatus(fPostponeToNextEvent);
00060
00061
00062 G4AffineTransform tf(aStep->GetPreStepPoint()->GetTouchableHandle()->
00063 GetHistory()->GetTopTransform().Inverse());
00064 BDSGlobalConstants::Instance()->SetDumpTransform(tf);
00065 }
00066 }
00067 return true;
00068 }