12 #include "G4ChargedGeantino.hh"
13 #include "G4DynamicParticle.hh"
14 #include "G4Geantino.hh"
16 #include "G4VPhysicalVolume.hh"
17 #include "G4VSolid.hh"
23 : G4VSensitiveDetector(
name )
24 , m_trackRecordCollection( outputCollectionName )
25 , m_SD_type( SD_type )
38 const G4StepPoint *preStep=aStep->GetPreStepPoint();
39 const G4VPhysicalVolume *preVol=preStep->GetPhysicalVolume();
40 const G4StepPoint *postStep=aStep->GetPostStepPoint();
41 const G4VPhysicalVolume *postVol=postStep->GetPhysicalVolume();
43 if (preVol==postVol) {
return false; }
45 const G4Track *
track(aStep->GetTrack());
48 int pdgcode = (
track->GetDefinition())?
track->GetDefinition()->GetPDGEncoding():0;
49 if (
track->GetDefinition() == G4Geantino::Definition() ) pdgcode=999;
50 if (
track->GetDefinition() == G4ChargedGeantino::Definition() ) pdgcode=998;
53 G4ThreeVector
pos=postStep->GetPosition();
54 G4ThreeVector
mom=postStep->GetMomentum();
59 const G4TouchableHistory* touchHist = (G4TouchableHistory*)preStep->GetTouchable();
60 const G4AffineTransform trans =
track->GetTouchable()->GetHistory()->GetTopTransform();
61 G4ThreeVector localPos=trans.TransformPoint(
pos);
62 G4ThreeVector localMom=
mom;
63 trans.ApplyAxisTransform(localMom);
64 const G4VSolid *shape= touchHist->GetSolid();
65 const G4ThreeVector normal=shape->SurfaceNormal(localPos);
67 if(normal.dot(localPos)>=0.)
return false;
71 const double ener=postStep->GetTotalEnergy();
74 const double time=postStep->GetGlobalTime();
99 if (!
track) { G4cout <<
"ERROR: the track pointer was zero" << G4endl;
return; }
101 G4VPhysicalVolume *preVol=
track->GetVolume();
103 const int pdgcode = (
track->GetDefinition())?
track->GetDefinition()->GetPDGEncoding():0;
105 const G4ThreeVector
pos = originPos?
track->GetVertexPosition():
track->GetPosition();
106 const double ener=originMom?(
track->GetVertexKineticEnergy()+
track->GetDynamicParticle()->GetMass()):
track->GetTotalEnergy();
107 G4ThreeVector
mom =
track->GetMomentum();
110 mom =
track->GetVertexMomentumDirection()*mommag;
113 const double time=
track->GetGlobalTime();
129 preVol?preVol->GetName():
"Unknown");