Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
B2::TrackerSD Class Reference
basic » B2 » B2a | basic » B2 » B2b

Tracker sensitive detector class. More...

#include <Doxymodules_basic.h>

Inheritance diagram for B2::TrackerSD:
G4VSensitiveDetector

Public Member Functions

 TrackerSD (const G4String &name, const G4String &hitsCollectionName)
 
 ~TrackerSD () override=default
 
void Initialize (G4HCofThisEvent *hitCollection) override
 
G4bool ProcessHits (G4Step *step, G4TouchableHistory *history) override
 
void EndOfEvent (G4HCofThisEvent *hitCollection) override
 

Private Attributes

TrackerHitsCollectionfHitsCollection = nullptr
 

Detailed Description

Tracker sensitive detector class.

The hits are accounted in hits in ProcessHits() function which is called by Geant4 kernel at each step. A hit is created with each step with non zero energy deposit.

Definition at line 47 of file Doxymodules_basic.h.

Constructor & Destructor Documentation

◆ TrackerSD()

B2::TrackerSD::TrackerSD ( const G4String name,
const G4String hitsCollectionName 
)

Definition at line 42 of file TrackerSD.cc.

45{
46 collectionName.insert(hitsCollectionName);
47}

◆ ~TrackerSD()

B2::TrackerSD::~TrackerSD ( )
overridedefault

Member Function Documentation

◆ Initialize()

void B2::TrackerSD::Initialize ( G4HCofThisEvent hitCollection)
override

Definition at line 51 of file TrackerSD.cc.

52{
53 // Create hits collection
54
56 = new TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
57
58 // Add this collection in hce
59
60 G4int hcID
61 = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
62 hce->AddHitsCollection( hcID, fHitsCollection );
63}
TrackerHitsCollection * fHitsCollection
Definition TrackerSD.hh:64
G4THitsCollection< TrackerHit > TrackerHitsCollection
Definition TrackerHit.hh:87

◆ ProcessHits()

G4bool B2::TrackerSD::ProcessHits ( G4Step step,
G4TouchableHistory history 
)
override

Definition at line 67 of file TrackerSD.cc.

69{
70 // energy deposit
71 G4double edep = aStep->GetTotalEnergyDeposit();
72
73 if (edep==0.) return false;
74
75 auto newHit = new TrackerHit();
76
77 newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
78 newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchableHandle()
79 ->GetCopyNumber());
80 newHit->SetEdep(edep);
81 newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
82
83 fHitsCollection->insert( newHit );
84
85 //newHit->Print();
86
87 return true;
88}

◆ EndOfEvent()

void B2::TrackerSD::EndOfEvent ( G4HCofThisEvent hitCollection)
override

Definition at line 92 of file TrackerSD.cc.

93{
94 if ( verboseLevel>1 ) {
95 std::size_t nofHits = fHitsCollection->entries();
96 G4cout << G4endl
97 << "-------->Hits Collection: in this event they are " << nofHits
98 << " hits in the tracker chambers: " << G4endl;
99 for ( std::size_t i=0; i<nofHits; i++ ) (*fHitsCollection)[i]->Print();
100 }
101}

Member Data Documentation

◆ fHitsCollection

TrackerHitsCollection* B2::TrackerSD::fHitsCollection = nullptr
private

Definition at line 64 of file TrackerSD.hh.


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

Applications | User Support | Publications | Collaboration