7 #include "G4SDManager.hh" 10 #include "G4StepPoint.hh" 11 #include "G4Transform3D.hh" 12 #include "G4LogicalVolumeStore.hh" 13 #include "G4TouchableHistory.hh" 14 #include "G4VUserTrackInformation.hh" 22 G4VSensitiveDetector(iname)
31 G4SDManager * SDman = G4SDManager::GetSDMpointer();
32 SDman->AddNewDetector(
this);
34 const std::vector<std::string>& lvNames = clg.
logicalNames(iname);
36 for (
auto & lvname : lvNames) {
41 <<
" <" << iname <<
"> : Assigns SD to LVs " << ss.str();
52 G4LogicalVolumeStore * theStore = G4LogicalVolumeStore::GetInstance();
53 for (
auto & lv : *theStore)
55 if (vname == lv->GetName()) {
56 lv->SetSensitiveDetector(
this);
63 const G4StepPoint * preStepPoint = step->GetPreStepPoint();
64 const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
66 const G4TouchableHistory * theTouchable=
static_cast<const G4TouchableHistory *
>(preStepPoint->GetTouchable());
67 const G4ThreeVector localCoordinates = theTouchable->GetHistory()
68 ->GetTopTransform().TransformPoint(globalCoordinates);
74 const G4StepPoint * postStepPoint = step->GetPostStepPoint();
75 const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
77 const G4StepPoint * preStepPoint = step->GetPreStepPoint();
78 const G4ThreeVector localCoordinates = preStepPoint->GetTouchable()->GetHistory()
79 ->GetTopTransform().TransformPoint(globalCoordinates);
85 const G4StepPoint * preStepPoint = step->GetPreStepPoint();
86 G4ThreeVector localCoordinates = preStepPoint->GetTouchable()->GetHistory()
87 ->GetTopTransform().TransformPoint(preStepPoint->GetPosition());
93 const G4ThreeVector& globalCoordinates = step->GetPostStepPoint()->GetPosition();
94 G4ThreeVector localCoordinates = step->GetPreStepPoint()->GetTouchable()->GetHistory()
95 ->GetTopTransform().TransformPoint(globalCoordinates);
104 <<
" no TrackInformation available for trackID= " 105 << aTrack->GetTrackID();
106 throw SimG4Exception(
"SimG4CoreSensitiveDetector: cannot handle hits for " 120 const G4Track* CurrentTrk = aStep->GetTrack();
121 const G4ThreeVector& CurrentPos = CurrentTrk->GetPosition();
122 double xyz = CurrentPos.x() + CurrentPos.y() + CurrentPos.z();
123 const G4ThreeVector& CurrentMom = CurrentTrk->GetMomentum();
124 xyz += CurrentMom.x() + CurrentMom.y() + CurrentMom.z();
128 const G4VPhysicalVolume* pCurrentVol = aStep->GetPreStepPoint()->GetPhysicalVolume();
129 const G4String& NameOfVol = pCurrentVol->GetName();
130 throw SimG4Exception(
"SimG4CoreSensitiveDetector: Corrupted Event - NaN detected in volume "
SensitiveDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
~SensitiveDetector() override
const std::vector< std::string > & logicalNames(const std::string &readoutName) const
Compact representation of the geometrical detector hierarchy.
void AssignSD(const std::string &vname)
std::string const collectionName[nCollections]
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
std::vector< std::string > namesOfSD
void EndOfEvent(G4HCofThisEvent *eventHC) override
Local3DPoint LocalPostStepPosition(const G4Step *step) const
void setNames(const std::vector< std::string > &)
Local3DPoint LocalPreStepPosition(const G4Step *step) const
void Initialize(G4HCofThisEvent *eventHC) override
void NaNTrap(const G4Step *step) const
Local3DPoint InitialStepPosition(const G4Step *step, coordinates) const