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) {
40 edm::LogInfo(
"SensitiveDetector") <<
" <" << iname <<
"> : Assigns SD to LVs " 53 G4LogicalVolumeStore * theStore = G4LogicalVolumeStore::GetInstance();
54 for (
auto & lv : *theStore)
56 if (vname == lv->GetName()) {
57 lv->SetSensitiveDetector(
this);
64 const G4StepPoint * preStepPoint = step->GetPreStepPoint();
65 const G4ThreeVector& globalCoordinates = preStepPoint->GetPosition();
67 G4TouchableHistory * theTouchable=(G4TouchableHistory *)(preStepPoint->GetTouchable());
68 const G4ThreeVector localCoordinates = theTouchable->GetHistory()
69 ->GetTopTransform().TransformPoint(globalCoordinates);
75 const G4StepPoint * postStepPoint = step->GetPostStepPoint();
76 const G4ThreeVector& globalCoordinates = postStepPoint->GetPosition();
78 const G4StepPoint * preStepPoint = step->GetPreStepPoint();
79 G4TouchableHistory * theTouchable = (G4TouchableHistory *)(preStepPoint->GetTouchable());
80 const G4ThreeVector localCoordinates = theTouchable->GetHistory()
81 ->GetTopTransform().TransformPoint(globalCoordinates);
87 const G4StepPoint * preStepPoint = step->GetPreStepPoint();
88 G4TouchableHistory * theTouchable=(G4TouchableHistory *)(preStepPoint->GetTouchable());
89 G4ThreeVector localCoordinates = theTouchable->GetHistory()
90 ->GetTopTransform().TransformPoint(preStepPoint->GetPosition());
96 const G4ThreeVector& globalCoordinates = step->GetPostStepPoint()->GetPosition();
97 G4TouchableHistory * theTouchable =
98 (G4TouchableHistory *)(step->GetPreStepPoint()->GetTouchable());
99 G4ThreeVector localCoordinates = theTouchable->GetHistory()
100 ->GetTopTransform().TransformPoint(globalCoordinates);
109 <<
" no TrackInformation available for trackID= " 110 << aTrack->GetTrackID();
111 throw SimG4Exception(
"SimG4CoreSensitiveDetector: cannot handle hits for " 125 const G4Track* CurrentTrk = aStep->GetTrack();
126 const G4ThreeVector& CurrentPos = CurrentTrk->GetPosition();
127 double xyz = CurrentPos.x() + CurrentPos.y() + CurrentPos.z();
128 const G4ThreeVector& CurrentMom = CurrentTrk->GetMomentum();
129 xyz += CurrentMom.x() + CurrentMom.y() + CurrentMom.z();
133 const G4VPhysicalVolume* pCurrentVol = aStep->GetPreStepPoint()->GetPhysicalVolume();
134 const G4String& NameOfVol = pCurrentVol->GetName();
135 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