QwGeant4
QweakSimTungstenPlug_DetectorSD Class Reference

#include <QweakSimTungstenPlug_DetectorSD.hh>

Inherits G4VSensitiveDetector.

Public Member Functions

 QweakSimTungstenPlug_DetectorSD (G4String name)
 
 ~QweakSimTungstenPlug_DetectorSD ()
 
void Initialize (G4HCofThisEvent *HCE)
 
G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist)
 
void EndOfEvent (G4HCofThisEvent *HCE)
 

Private Attributes

QweakSimTungstenPlug_DetectorHitsCollectionTungstenPlug_DetectorHitsCollection
 
G4int TungstenPlug_CollectionID
 

Detailed Description

Definition at line 19 of file QweakSimTungstenPlug_DetectorSD.hh.

Constructor & Destructor Documentation

QweakSimTungstenPlug_DetectorSD::QweakSimTungstenPlug_DetectorSD ( G4String  name)

Definition at line 15 of file QweakSimTungstenPlug_DetectorSD.cc.

References TungstenPlug_CollectionID.

16 :G4VSensitiveDetector(name)
17 {
18  G4cout << name << G4endl;
19  collectionName.insert("TungstenPlugCollection");
21 }
QweakSimTungstenPlug_DetectorSD::~QweakSimTungstenPlug_DetectorSD ( )

Definition at line 26 of file QweakSimTungstenPlug_DetectorSD.cc.

27 {
28  //delete TungstenPlug_DetectorHitsCollection;
29 }

Member Function Documentation

void QweakSimTungstenPlug_DetectorSD::EndOfEvent ( G4HCofThisEvent *  HCE)

Definition at line 124 of file QweakSimTungstenPlug_DetectorSD.cc.

125 {
126  //G4int NbDCHits = DC_hitsCollection->entries();
127 
128  //G4cout << "\n-------->Hits Collection: in this event they are " << NbDCHits
129  // << " hits in the Drift Cells : " << G4endl;
130  //for (G4int i=0;i<NbDCHits;i++) (
131  // *DC_hitsCollection)[i]->Print();
132 
133 }
void QweakSimTungstenPlug_DetectorSD::Initialize ( G4HCofThisEvent *  HCE)

Definition at line 35 of file QweakSimTungstenPlug_DetectorSD.cc.

References TungstenPlug_CollectionID, and TungstenPlug_DetectorHitsCollection.

36 {
37  TungstenPlug_DetectorHitsCollection = new QweakSimTungstenPlug_DetectorHitsCollection(SensitiveDetectorName,collectionName[0]);
38  //if(TungstenPlug_CollectionID<0)
39  TungstenPlug_CollectionID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
41 
42 }
G4THitsCollection< QweakSimTungstenPlug_DetectorHit > QweakSimTungstenPlug_DetectorHitsCollection
QweakSimTungstenPlug_DetectorHitsCollection * TungstenPlug_DetectorHitsCollection
G4bool QweakSimTungstenPlug_DetectorSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *  ROhist 
)

Definition at line 47 of file QweakSimTungstenPlug_DetectorSD.cc.

References TungstenPlug_DetectorHitsCollection.

48 {
49  //--- Not Entering Geometry
50  if (aStep->GetPreStepPoint()->GetStepStatus() != fGeomBoundary ) return false;
51 
52  G4TouchableHandle theTouchable = aStep->GetPreStepPoint()->GetTouchableHandle();
53 
54  G4int motherCopyNo = theTouchable->GetVolume(1)->GetCopyNo(); // one Mother Volume
55 
56  //G4double parentID = aStep->GetTrack()->GetParentID();
57  G4double trackID = aStep->GetTrack()->GetTrackID();
58 
59  G4ParticleDefinition* fpParticleDefinition = aStep->GetTrack()->GetDefinition();
60  G4String particleName = fpParticleDefinition->GetParticleName();
61  //G4double pdgCharge = fpParticleDefinition->GetPDGCharge();
62  G4int pdgEncoding = fpParticleDefinition->GetPDGEncoding();
63 
64  //GlobalTimeOfHit
65  G4double globalTime = aStep->GetPreStepPoint()->GetGlobalTime();
66 
67  G4ThreeVector worldPos = aStep->GetPreStepPoint()->GetPosition();
68  G4ThreeVector localPos = theTouchable->GetHistory()->GetTopTransform().TransformPoint(worldPos);
69 
70  // Local Origin (where did the hit come from)
71  G4ThreeVector originVertexPosition = aStep->GetTrack()->GetVertexPosition();
72 
73  G4ThreeVector worldMomentum = aStep->GetPreStepPoint()->GetMomentum();
74  G4ThreeVector localMomentum = theTouchable->GetHistory()->GetTopTransform().TransformPoint(worldMomentum);
75  G4ThreeVector currentMomentumDirection = aStep->GetTrack()->GetMomentumDirection();
76  G4ThreeVector originVertexMomentumDirection = aStep->GetTrack()->GetVertexMomentumDirection();
77 
78  G4double originVertexKineticEnergy = aStep->GetTrack()->GetVertexKineticEnergy();
79  G4double originVertexTotalEnergy = aStep->GetTrack()->GetVertexKineticEnergy();//GetVertexTotalEnergy();
80 
81  G4double currentKineticEnergy = aStep->GetTrack()->GetKineticEnergy();
82  G4double currentTotalEnergy = aStep->GetTrack()->GetTotalEnergy();
83 
84  //--- TungstenPlug deposited energy
85  G4double depositedEnergy = aStep->GetTotalEnergyDeposit();
86 
87  //----------------- Store Hit information
89 
90  aHit -> StoreTrackID(trackID);
91 
92  aHit -> StoreParticleName(particleName);
93  aHit -> StoreParticleType(pdgEncoding);
94 
95  aHit -> StoreGlobalTime(globalTime);
96 
97  aHit -> StoreWorldPosition(worldPos);
98  aHit -> StoreLocalPosition(localPos);
99  aHit -> StoreOriginVertexPosition(originVertexPosition);
100 
101  aHit -> StoreWorldMomentum(worldMomentum);
102  aHit -> StoreLocalMomentum(localMomentum);
103  aHit -> StoreMomentumDirection(currentMomentumDirection);
104  aHit -> StoreOriginVertexMomentumDirection(originVertexMomentumDirection);
105 
106  aHit -> StoreOriginVertexKineticEnergy(originVertexKineticEnergy);
107  aHit -> StoreOriginVertexTotalEnergy(originVertexTotalEnergy); // kinetic energy
108 
109  aHit -> StoreKineticEnergy(currentKineticEnergy);
110  aHit -> StoreTotalEnergy(currentTotalEnergy);
111 
112  //--- TungstenPlug deposited energy
113  aHit -> StoreDepositedEnergy(depositedEnergy);
114 
116 
117  return true;
118 }
QweakSimTungstenPlug_DetectorHitsCollection * TungstenPlug_DetectorHitsCollection

Field Documentation

G4int QweakSimTungstenPlug_DetectorSD::TungstenPlug_CollectionID
private
QweakSimTungstenPlug_DetectorHitsCollection* QweakSimTungstenPlug_DetectorSD::TungstenPlug_DetectorHitsCollection
private

Definition at line 32 of file QweakSimTungstenPlug_DetectorSD.hh.

Referenced by Initialize(), and ProcessHits().


The documentation for this class was generated from the following files: