4 #include "G4VPhysicalVolume.hh" 5 #include "G4PVPlacement.hh" 6 #include "G4HCofThisEvent.hh" 7 #include "G4TouchableHistory.hh" 10 #include "G4VSolid.hh" 11 #include "G4DynamicParticle.hh" 12 #include "G4ParticleDefinition.hh" 13 #include "G4SDManager.hh" 16 #include "G4PhysicalConstants.hh" 17 #include "G4SystemOfUnits.hh" 23 m_trackManager(manager), theHCID(-1), theHC(
nullptr), theNSteps(0) {
33 LogDebug(
"FiberSim") <<
"HFChamberSD : Initialize called for " << GetName();
44 double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
45 int trackID = aStep->GetTrack()->GetTrackID();
46 if(charge == 0. || trackID != 1 ||aStep->GetTrack()->GetParentID() != 0 || aStep->GetTrack()->GetCreatorProcess() !=
nullptr)
return false;
50 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
51 const G4VTouchable* touch = preStepPoint->GetTouchable();
54 double edep = aStep->GetTotalEnergyDeposit();
55 double time = (preStepPoint->GetGlobalTime())/ns;
57 const G4ThreeVector& globalPos = preStepPoint->GetPosition();
58 G4ThreeVector localPos = touch->GetHistory()->GetTopTransform().TransformPoint(globalPos);
59 const G4DynamicParticle* particle = aStep->GetTrack()->GetDynamicParticle();
60 const G4ThreeVector& momDir = particle->GetMomentumDirection();
67 LogDebug(
"FiberSim") <<
"HFChamberSD: Hit created in (" 68 << touch->GetVolume(0)->GetLogicalVolume()->GetName()
69 <<
") " <<
" ID " << detID <<
" Track " << trackID
70 <<
" Edep: " << edep/
MeV <<
" MeV; Time: " << time
71 <<
" ns; Position (local) " << localPos <<
" (global ) " 72 << globalPos <<
" direction " << momDir;
80 LogDebug(
"FiberSim") <<
"HFChamberSD: Sees" <<
theHC->entries() <<
" hits";
95 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
96 return (touch->GetReplicaNumber(0));
std::vector< PCaloHit > PCaloHitContainer
void clearHits() override
void setLocalPos(const G4ThreeVector &xyz)
Compact representation of the geometrical detector hierarchy.
uint32_t setDetUnitId(const G4Step *) override
HFShowerG4HitsCollection * theHC
std::string const collectionName[nCollections]
void Initialize(G4HCofThisEvent *HCE) override
void fillHits(edm::PCaloHitContainer &, const std::string &) override
void setPrimMomDir(const G4ThreeVector &xyz)
G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist) override
void EndOfEvent(G4HCofThisEvent *HCE) override
void setGlobalPos(const G4ThreeVector &xyz)
HFChamberSD(const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, const edm::ParameterSet &, const SimTrackManager *)
G4THitsCollection< HFShowerG4Hit > HFShowerG4HitsCollection