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"
20 m_trackManager(manager), theHCID(-1), theHC(0), theNSteps(0) {
23 LogDebug(
"FiberSim") <<
"***************************************************"
27 <<
"* Constructing a HFChamberSD with name " << GetName()
31 <<
"***************************************************";
35 std::vector<std::string> lvNames = clg.
logicalNames(name);
37 for (std::vector<std::string>::iterator it=lvNames.begin();
38 it !=lvNames.end(); it++){
40 LogDebug(
"FiberSim") <<
"HFChamberSD : Assigns SD to LV " << (*it);
50 LogDebug(
"FiberSim") <<
"HFChamberSD : Initialize called for " << GetName();
61 double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
62 int trackID = aStep->GetTrack()->GetTrackID();
63 if(charge == 0. || trackID != 1 ||aStep->GetTrack()->GetParentID() != 0 || aStep->GetTrack()->GetCreatorProcess() !=
NULL)
return false;
67 G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
68 const G4VTouchable* touch = preStepPoint->GetTouchable();
71 double edep = aStep->GetTotalEnergyDeposit();
72 double time = (preStepPoint->GetGlobalTime())/ns;
74 G4ThreeVector globalPos = preStepPoint->GetPosition();
75 G4ThreeVector localPos = touch->GetHistory()->GetTopTransform().TransformPoint(globalPos);
76 const G4DynamicParticle* particle = aStep->GetTrack()->GetDynamicParticle();
77 G4ThreeVector momDir = particle->GetMomentumDirection();
84 LogDebug(
"FiberSim") <<
"HFChamberSD: Hit created in ("
85 << touch->GetVolume(0)->GetLogicalVolume()->GetName()
86 <<
") " <<
" ID " << detID <<
" Track " << trackID
87 <<
" Edep: " << edep/MeV <<
" MeV; Time: " << time
88 <<
" ns; Position (local) " << localPos <<
" (global ) "
89 << globalPos <<
" direction " << momDir;
97 LogDebug(
"FiberSim") <<
"HFChamberSD: Sees" <<
theHC->entries() <<
" hits";
112 const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
113 return (touch->GetReplicaNumber(0));
std::vector< PCaloHit > PCaloHitContainer
std::vector< std::string > logicalNames(std::string &readoutName)
virtual uint32_t setDetUnitId(G4Step *)
void setPrimMomDir(G4ThreeVector xyz)
virtual void fillHits(edm::PCaloHitContainer &, std::string)
type of data representation of DDCompactView
HFShowerG4HitsCollection * theHC
std::string const collectionName[nCollections]
virtual void EndOfEvent(G4HCofThisEvent *HCE)
HFChamberSD(std::string, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
virtual void AssignSD(std::string &vname)
void setGlobalPos(G4ThreeVector xyz)
virtual void Initialize(G4HCofThisEvent *HCE)
void setLocalPos(G4ThreeVector xyz)
G4THitsCollection< HFShowerG4Hit > HFShowerG4HitsCollection
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)