Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
 

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 ( G4String  name)

Definition at line 46 of file ExP01TrackerSD.cc.

47  :G4VSensitiveDetector(name), fTrackerCollection(0), fHCID(0)
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
G4VSensitiveDetector(G4String name)
#define G4endl
Definition: G4ios.hh:61
G4CollectionNameVector collectionName

Here is the call graph for this function:

ExP01TrackerSD::~ExP01TrackerSD ( )

Definition at line 58 of file ExP01TrackerSD.cc.

59 {
61 }
static RootIO * GetInstance()
Definition: RootIO.cc:68
void Close()
Definition: RootIO.cc:96

Here is the call graph for this function:

Member Function Documentation

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
G4int entries() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void Write(std::vector< ExP01TrackerHit * > *)
Definition: RootIO.cc:79
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

void ExP01TrackerSD::Initialize ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 65 of file ExP01TrackerSD.cc.

66 {
67  fTrackerCollection = new ExP01TrackerHitsCollection
69  if (fHCID < 0) {
70  G4cout << "CalorimeterSD::Initialize: " << SensitiveDetectorName << " "
71  << collectionName[0] << G4endl;
73 
74  }
75  HCE->AddHitsCollection(fHCID, fTrackerCollection);
76 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
G4GLOB_DLL std::ostream G4cout
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:

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 }
G4int insert(T *aHit)
const G4VTouchable * GetTouchable() const
G4StepPoint * GetPreStepPoint() const
Hit implementation for the persistency example.
const G4ThreeVector & GetPosition() const
G4int GetTrackID() const
void SetEdep(G4double de)
G4double GetTotalEnergyDeposit() const
void SetPos(G4ThreeVector xyz)
void SetChamberNb(G4int chamb)
G4StepPoint * GetPostStepPoint() const
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:58
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const
void SetTrackID(G4int track)

Here is the call graph for this function:


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