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

Sensitive detector implementation for the ROOT hits persistency example. More...

#include <Doxymodules_persistency.h>

Inheritance diagram for ExP01TrackerSD:
G4VSensitiveDetector

Public Member Functions

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

Private Attributes

ExP01TrackerHitsCollectionfTrackerCollection
 
G4int fHCID
 

Detailed Description

Sensitive detector implementation for the ROOT hits persistency example.

Definition at line 89 of file Doxymodules_persistency.h.

Constructor & Destructor Documentation

◆ ExP01TrackerSD()

ExP01TrackerSD::ExP01TrackerSD ( G4String  name)

Definition at line 45 of file ExP01TrackerSD.cc.

47{
48 G4String HCname = name + "_HC";
49 collectionName.insert(HCname);
50 G4cout << collectionName.size() << " CalorimeterSD name: " << name << " collection Name: "
51 << HCname << G4endl;
52 fHCID = -1;
53}
ExP01TrackerHitsCollection * fTrackerCollection

◆ ~ExP01TrackerSD()

ExP01TrackerSD::~ExP01TrackerSD ( )

Definition at line 57 of file ExP01TrackerSD.cc.

58{
60}
static RootIO * GetInstance()
Definition RootIO.cc:67
void Close()
Definition RootIO.cc:95

Member Function Documentation

◆ Initialize()

void ExP01TrackerSD::Initialize ( G4HCofThisEvent HCE)
virtual

Definition at line 64 of file ExP01TrackerSD.cc.

65{
67 (SensitiveDetectorName,collectionName[0]);
68 if (fHCID < 0) {
69 G4cout << "CalorimeterSD::Initialize: " << SensitiveDetectorName << " "
70 << collectionName[0] << G4endl;
71 fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
72
73 }
74 HCE->AddHitsCollection(fHCID, fTrackerCollection);
75}
G4THitsCollection< ExP01TrackerHit > ExP01TrackerHitsCollection

◆ ProcessHits()

G4bool ExP01TrackerSD::ProcessHits ( G4Step aStep,
G4TouchableHistory  
)
virtual

Definition at line 79 of file ExP01TrackerSD.cc.

80{
81 G4double edep = aStep->GetTotalEnergyDeposit();
82
83 if(edep==0.) return false;
84
85 ExP01TrackerHit* newHit = new ExP01TrackerHit();
86 newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
87 newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchable()
88 ->GetReplicaNumber());
89 newHit->SetEdep (edep);
90 newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
91 fTrackerCollection->insert( newHit );
92
93 //newHit->Print();
94 //newHit->Draw();
95
96 return true;
97}
Hit implementation for the persistency example.
void SetTrackID(G4int track)
void SetPos(G4ThreeVector xyz)
void SetEdep(G4double de)
void SetChamberNb(G4int chamb)

◆ EndOfEvent()

void ExP01TrackerSD::EndOfEvent ( G4HCofThisEvent )
virtual

Definition at line 101 of file ExP01TrackerSD.cc.

102{
103 // storing the hits in ROOT file
104 G4int NbHits = fTrackerCollection->entries();
105 std::vector<ExP01TrackerHit*> hitsVector;
106
107 {
108 G4cout << "\n-------->Storing hits in the ROOT file: in this event there are " << NbHits
109 << " hits in the tracker chambers: " << G4endl;
110 for (G4int i=0;i<NbHits;i++) (*fTrackerCollection)[i]->Print();
111 }
112
113
114 for (G4int i=0;i<NbHits;i++)
115 hitsVector.push_back((*fTrackerCollection)[i]);
116
117 RootIO::GetInstance()->Write(&hitsVector);
118
119 //
120}
void Write(std::vector< ExP01TrackerHit * > *)
Definition RootIO.cc:78

Member Data Documentation

◆ fTrackerCollection

ExP01TrackerHitsCollection* ExP01TrackerSD::fTrackerCollection
private

Definition at line 58 of file ExP01TrackerSD.hh.

◆ fHCID

G4int ExP01TrackerSD::fHCID
private

Definition at line 59 of file ExP01TrackerSD.hh.


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

Applications | User Support | Publications | Collaboration