Geant4  10.02.p03
ExP01TrackerSD Class Reference

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

#include <ExP01TrackerSD.hh>

Inheritance diagram for ExP01TrackerSD:
Collaboration diagram for ExP01TrackerSD:

Public Member Functions

 ExP01TrackerSD (G4String)
 
 ~ExP01TrackerSD ()
 
virtual void Initialize (G4HCofThisEvent *)
 
virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
- Public Member Functions inherited from G4VSensitiveDetector
 G4VSensitiveDetector (G4String name)
 
 G4VSensitiveDetector (const G4VSensitiveDetector &right)
 
virtual ~G4VSensitiveDetector ()
 
G4VSensitiveDetectoroperator= (const G4VSensitiveDetector &right)
 
G4int operator== (const G4VSensitiveDetector &right) const
 
G4int operator!= (const G4VSensitiveDetector &right) const
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void PrintAll ()
 
G4bool Hit (G4Step *aStep)
 
void SetROgeometry (G4VReadOutGeometry *value)
 
void SetFilter (G4VSDFilter *value)
 
G4int GetNumberOfCollections () const
 
G4String GetCollectionName (G4int id) const
 
void SetVerboseLevel (G4int vl)
 
void Activate (G4bool activeFlag)
 
G4bool isActive () const
 
G4String GetName () const
 
G4String GetPathName () const
 
G4String GetFullPathName () const
 
G4VReadOutGeometryGetROgeometry () const
 
G4VSDFilterGetFilter () const
 
virtual G4VSensitiveDetectorClone () const
 

Private Attributes

ExP01TrackerHitsCollectionfTrackerCollection
 
G4int fHCID
 

Additional Inherited Members

- Protected Member Functions inherited from G4VSensitiveDetector
virtual G4int GetCollectionID (G4int i)
 
- Protected Attributes inherited from G4VSensitiveDetector
G4CollectionNameVector collectionName
 
G4String SensitiveDetectorName
 
G4String thePathName
 
G4String fullPathName
 
G4int verboseLevel
 
G4bool active
 
G4VReadOutGeometryROgeometry
 
G4VSDFilterfilter
 

Detailed Description

Sensitive detector implementation for the ROOT hits persistency example.

Definition at line 48 of file ExP01TrackerSD.hh.

Constructor & Destructor Documentation

◆ ExP01TrackerSD()

ExP01TrackerSD::ExP01TrackerSD ( G4String  name)

Definition at line 46 of file ExP01TrackerSD.cc.

48 {
49  G4String HCname = name + "_HC";
50  collectionName.insert(HCname);
51  G4cout << collectionName.size() << " CalorimeterSD name: " << name << " collection Name: "
52  << HCname << G4endl;
53  fHCID = -1;
54 }
G4GLOB_DLL std::ostream G4cout
ExP01TrackerHitsCollection * fTrackerCollection
G4VSensitiveDetector(G4String name)
#define G4endl
Definition: G4ios.hh:61
G4CollectionNameVector collectionName
Here is the call graph for this function:

◆ ~ExP01TrackerSD()

ExP01TrackerSD::~ExP01TrackerSD ( )

Definition at line 58 of file ExP01TrackerSD.cc.

59 {
61 }
static RootIO * GetInstance()
Definition: RootIO.cc:68
void Close()
Definition: RootIO.cc:97
Here is the call graph for this function:

Member Function Documentation

◆ EndOfEvent()

void ExP01TrackerSD::EndOfEvent ( G4HCofThisEvent )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 102 of file ExP01TrackerSD.cc.

103 {
104  // storing the hits in ROOT file
105  G4int NbHits = fTrackerCollection->entries();
106  std::vector<ExP01TrackerHit*> hitsVector;
107 
108  {
109  G4cout << "\n-------->Storing hits in the ROOT file: in this event there are " << NbHits
110  << " hits in the tracker chambers: " << G4endl;
111  for (G4int i=0;i<NbHits;i++) (*fTrackerCollection)[i]->Print();
112  }
113 
114 
115  for (G4int i=0;i<NbHits;i++)
116  hitsVector.push_back((*fTrackerCollection)[i]);
117 
118  RootIO::GetInstance()->Write(&hitsVector);
119 
120  //
121 }
static RootIO * GetInstance()
Definition: RootIO.cc:68
int G4int
Definition: G4Types.hh:78
void Write(std::vector< ExP01TrackerHit *> *)
Definition: RootIO.cc:79
G4GLOB_DLL std::ostream G4cout
ExP01TrackerHitsCollection * fTrackerCollection
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ Initialize()

void ExP01TrackerSD::Initialize ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 65 of file ExP01TrackerSD.cc.

66 {
69  if (fHCID < 0) {
70  G4cout << "CalorimeterSD::Initialize: " << SensitiveDetectorName << " "
71  << collectionName[0] << G4endl;
73 
74  }
76 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
G4GLOB_DLL std::ostream G4cout
ExP01TrackerHitsCollection * fTrackerCollection
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
G4THitsCollection< ExP01TrackerHit > ExP01TrackerHitsCollection
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
G4CollectionNameVector collectionName
Here is the call graph for this function:

◆ ProcessHits()

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

Implements G4VSensitiveDetector.

Definition at line 80 of file ExP01TrackerSD.cc.

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

Member Data Documentation

◆ fHCID

G4int ExP01TrackerSD::fHCID
private

Definition at line 60 of file ExP01TrackerSD.hh.

◆ fTrackerCollection

ExP01TrackerHitsCollection* ExP01TrackerSD::fTrackerCollection
private

Definition at line 59 of file ExP01TrackerSD.hh.


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