3 #include "G4SDManager.hh" 5 #include "G4StepPoint.hh" 6 #include "G4Transform3D.hh" 7 #include "G4LogicalVolumeStore.hh" 18 G4VSensitiveDetector(iname),
name(iname) {}
26 G4SDManager * SDman = G4SDManager::GetSDMpointer();
27 SDman->AddNewDetector(
this);
32 G4LogicalVolumeStore * theStore = G4LogicalVolumeStore::GetInstance();
33 G4LogicalVolumeStore::const_iterator it;
34 for (it = theStore->begin(); it != theStore->end(); it++)
36 G4LogicalVolume *
v = *it;
37 if (vname==v->GetName()) { v->SetSensitiveDetector(
this); }
43 #include "G4TouchableHistory.hh" 48 G4StepPoint * preStepPoint =
currentStep->GetPreStepPoint();
49 const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
51 G4TouchableHistory * theTouchable=(G4TouchableHistory *)
52 (preStepPoint->GetTouchable());
53 G4ThreeVector localCoordinates = theTouchable->GetHistory()
54 ->GetTopTransform().TransformPoint(globalCoordinates);
61 G4StepPoint * postStepPoint =
currentStep->GetPostStepPoint();
62 G4StepPoint * preStepPoint =
currentStep->GetPreStepPoint();
63 const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
65 G4TouchableHistory * theTouchable = (G4TouchableHistory *)
66 (preStepPoint->GetTouchable());
67 G4ThreeVector localCoordinates = theTouchable->GetHistory()
68 ->GetTopTransform().TransformPoint(globalCoordinates);
80 if ( aStep ==
nullptr )
return ;
82 G4Track* CurrentTrk = aStep->GetTrack() ;
83 const G4ThreeVector& CurrentPos = CurrentTrk->GetPosition() ;
84 G4ThreeVector CurrentMom = CurrentTrk->GetMomentum() ;
85 G4VPhysicalVolume* pCurrentVol = CurrentTrk->GetVolume() ;
87 if ( pCurrentVol !=
nullptr )
89 NameOfVol = pCurrentVol->GetName() ;
93 NameOfVol =
"CorruptedVolumeInfo" ;
100 xyz[0] = CurrentPos.x() ;
101 xyz[1] = CurrentPos.y() ;
102 xyz[2] = CurrentPos.z() ;
111 throw SimG4Exception(
"SimG4CoreSensitiveDetector: Corrupted Event - NaN detected (position) in volume " + NameOfVol);
114 xyz[0] = CurrentMom.x() ;
115 xyz[1] = CurrentMom.y() ;
116 xyz[2] = CurrentMom.z() ;
117 if ( !(xyz[0]==xyz[0]) || !(xyz[1]==xyz[1]) || !(xyz[2]==xyz[2]) ||
121 throw SimG4Exception(
"SimG4CoreSensitiveDetector: Corrupted Event - NaN detected (3-momentum) in volume " + NameOfVol);
~SensitiveDetector() override
type of data representation of DDCompactView
SensitiveDetector(std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
virtual void AssignSD(const std::string &vname)
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point)
void NaNTrap(G4Step *step)
Point3DBase< float, LocalTag > Local3DPoint
void EndOfEvent(G4HCofThisEvent *eventHC) override
return(e1-e2)*(e1-e2)+dp *dp
Local3DPoint FinalStepPosition(G4Step *s, coordinates)
void Initialize(G4HCofThisEvent *eventHC) override
Local3DPoint InitialStepPosition(G4Step *s, coordinates)