Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
ExTGTrackerSD Class Reference

Example of Sensitive detector. More...

#include <Doxymodules_persistency.h>

Inheritance diagram for ExTGTrackerSD:
G4VSensitiveDetector

Public Member Functions

 ExTGTrackerSD (G4String)
 
 ~ExTGTrackerSD ()
 
void Initialize (G4HCofThisEvent *)
 
G4bool ProcessHits (G4Step *, G4TouchableHistory *)
 
void EndOfEvent (G4HCofThisEvent *)
 

Private Attributes

ExTGTrackerHitsCollectionfTrackerCollection
 

Detailed Description

Example of Sensitive detector.

Definition at line 126 of file Doxymodules_persistency.h.

Constructor & Destructor Documentation

◆ ExTGTrackerSD()

ExTGTrackerSD::ExTGTrackerSD ( G4String  name)

Definition at line 39 of file ExTGTrackerSD.cc.

41{
42 G4String HCname;
43 collectionName.insert(HCname="trackerCollection");
44}

◆ ~ExTGTrackerSD()

ExTGTrackerSD::~ExTGTrackerSD ( )

Definition at line 47 of file ExTGTrackerSD.cc.

48{
49}

Member Function Documentation

◆ Initialize()

void ExTGTrackerSD::Initialize ( G4HCofThisEvent HCE)

Definition at line 52 of file ExTGTrackerSD.cc.

53{
55 (SensitiveDetectorName,collectionName[0]);
56 static G4int HCID = -1;
57 if ( HCID<0 )
58 {
59 HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
60 }
61 HCE->AddHitsCollection( HCID, fTrackerCollection );
62}
G4THitsCollection< ExTGTrackerHit > ExTGTrackerHitsCollection
ExTGTrackerHitsCollection * fTrackerCollection

◆ ProcessHits()

G4bool ExTGTrackerSD::ProcessHits ( G4Step aStep,
G4TouchableHistory  
)

Definition at line 65 of file ExTGTrackerSD.cc.

66{
67 G4double edep = aStep->GetTotalEnergyDeposit();
68
69 if(edep==0.) { return false; }
70
71 ExTGTrackerHit* newHit = new ExTGTrackerHit();
72 newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
73 newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchableHandle()
74 ->GetCopyNumber());
75 newHit->SetEdep (edep);
76 newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
77 fTrackerCollection->insert( newHit );
78
79 //newHit->Print();
80 //newHit->Draw();
81
82 return true;
83}
void SetChamberNb(G4int chamb)
void SetTrackID(G4int track)
void SetEdep(G4double de)
void SetPos(G4ThreeVector xyz)

◆ EndOfEvent()

void ExTGTrackerSD::EndOfEvent ( G4HCofThisEvent )

Definition at line 86 of file ExTGTrackerSD.cc.

87{
88 G4int NbHits = fTrackerCollection->entries();
89 G4cout << "\n-------->Hits Collection: in this event there are " << NbHits
90 << " hits in the tracker chambers: " << G4endl;
91 for (G4int i=0;i<NbHits;i++)
92 {
93 (*fTrackerCollection)[i]->Print();
94 }
95}

Member Data Documentation

◆ fTrackerCollection

ExTGTrackerHitsCollection* ExTGTrackerSD::fTrackerCollection
private

Definition at line 54 of file ExTGTrackerSD.hh.


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

Applications | User Support | Publications | Collaboration