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(0), theNSteps(0) {
26 LogDebug(
"FiberSim") <<
"***************************************************"
30 <<
"* Constructing a HFChamberSD with name " << GetName()
34 <<
"***************************************************";
38 const std::vector<std::string>& lvNames = clg.
logicalNames(name);
40 for (std::vector<std::string>::const_iterator it=lvNames.begin();
41 it !=lvNames.end(); it++){
43 LogDebug(
"FiberSim") <<
"HFChamberSD : Assigns SD to LV " << (*it);
53 LogDebug(
"FiberSim") <<
"HFChamberSD : Initialize called for " << GetName();
64 double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
65 int trackID = aStep->GetTrack()->GetTrackID();
66 if(charge == 0. || trackID != 1 ||aStep->GetTrack()->GetParentID() != 0 || aStep->GetTrack()->GetCreatorProcess() !=
NULL)
return false;
70 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
71 const G4VTouchable* touch = preStepPoint->GetTouchable();
74 double edep = aStep->GetTotalEnergyDeposit();
75 double time = (preStepPoint->GetGlobalTime())/ns;
77 G4ThreeVector globalPos = preStepPoint->GetPosition();
78 G4ThreeVector localPos = touch->GetHistory()->GetTopTransform().TransformPoint(globalPos);
79 const G4DynamicParticle* particle = aStep->GetTrack()->GetDynamicParticle();
80 G4ThreeVector momDir = particle->GetMomentumDirection();
87 LogDebug(
"FiberSim") <<
"HFChamberSD: Hit created in ("
88 << touch->GetVolume(0)->GetLogicalVolume()->GetName()
89 <<
") " <<
" ID " << detID <<
" Track " << trackID
90 <<
" Edep: " << edep/
MeV <<
" MeV; Time: " << time
91 <<
" ns; Position (local) " << localPos <<
" (global ) "
92 << globalPos <<
" direction " << momDir;
100 LogDebug(
"FiberSim") <<
"HFChamberSD: Sees" <<
theHC->entries() <<
" hits";
115 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
116 return (touch->GetReplicaNumber(0));
std::vector< PCaloHit > PCaloHitContainer
HFChamberSD(std::string, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
void setLocalPos(const G4ThreeVector &xyz)
virtual uint32_t setDetUnitId(G4Step *)
const std::vector< std::string > & logicalNames(const std::string &readoutName) const
virtual void fillHits(edm::PCaloHitContainer &, std::string)
type of data representation of DDCompactView
virtual void AssignSD(const std::string &vname)
HFShowerG4HitsCollection * theHC
std::string const collectionName[nCollections]
virtual void EndOfEvent(G4HCofThisEvent *HCE)
void setPrimMomDir(const G4ThreeVector &xyz)
void setGlobalPos(const G4ThreeVector &xyz)
virtual void Initialize(G4HCofThisEvent *HCE)
G4THitsCollection< HFShowerG4Hit > HFShowerG4HitsCollection
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)