7 #include "G4SDManager.hh" 10 #include "G4StepPoint.hh" 11 #include "G4Transform3D.hh" 12 #include "G4LogicalVolumeStore.hh" 13 #include "G4TouchableHistory.hh" 14 #include "G4VUserTrackInformation.hh" 23 G4VSensitiveDetector(iname), m_isCalo(calo)
32 G4SDManager * SDman = G4SDManager::GetSDMpointer();
33 SDman->AddNewDetector(
this);
35 const std::vector<std::string>& lvNames = clg.
logicalNames(iname);
37 for (
auto & lvname : lvNames) {
42 <<
" <" << iname <<
"> : Assigns SD to LVs " << ss.str();
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 const G4TouchableHistory * theTouchable=
static_cast<const 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 const G4ThreeVector localCoordinates = preStepPoint->GetTouchable()->GetHistory()
80 ->GetTopTransform().TransformPoint(globalCoordinates);
86 const G4StepPoint * preStepPoint = step->GetPreStepPoint();
87 G4ThreeVector localCoordinates = preStepPoint->GetTouchable()->GetHistory()
88 ->GetTopTransform().TransformPoint(preStepPoint->GetPosition());
94 const G4ThreeVector& globalCoordinates = step->GetPostStepPoint()->GetPosition();
95 G4ThreeVector localCoordinates = step->GetPreStepPoint()->GetTouchable()->GetHistory()
96 ->GetTopTransform().TransformPoint(globalCoordinates);
105 <<
" no TrackInformation available for trackID= " 106 << aTrack->GetTrackID();
107 throw SimG4Exception(
"SimG4CoreSensitiveDetector: cannot handle hits for " 121 const G4Track* CurrentTrk = aStep->GetTrack();
122 const G4ThreeVector& CurrentPos = CurrentTrk->GetPosition();
123 double xyz = CurrentPos.x() + CurrentPos.y() + CurrentPos.z();
124 const G4ThreeVector& CurrentMom = CurrentTrk->GetMomentum();
125 xyz += CurrentMom.x() + CurrentMom.y() + CurrentMom.z();
129 const G4VPhysicalVolume* pCurrentVol = aStep->GetPreStepPoint()->GetPhysicalVolume();
130 const G4String& NameOfVol = pCurrentVol->GetName();
131 throw SimG4Exception(
"SimG4CoreSensitiveDetector: Corrupted Event - NaN detected in volume "
Local3DPoint ConvertToLocal3DPoint(const G4ThreeVector &point) const
~SensitiveDetector() override
constexpr bool isNotFinite(T x)
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::vector< std::string > m_namesOfSD
std::string const collectionName[nCollections]
Local3DPoint FinalStepPosition(const G4Step *step, coordinates) const
TrackInformation * cmsTrackInformation(const G4Track *aTrack)
void EndOfEvent(G4HCofThisEvent *eventHC) override
Local3DPoint LocalPostStepPosition(const G4Step *step) const
void setNames(const std::vector< std::string > &)
Local3DPoint LocalPreStepPosition(const G4Step *step) const
SensitiveDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
void Initialize(G4HCofThisEvent *eventHC) override
void NaNTrap(const G4Step *step) const
Local3DPoint InitialStepPosition(const G4Step *step, coordinates) const