Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
B5HodoscopeSD Class Reference

Hodoscope sensitive detector. More...

#include <B5HodoscopeSD.hh>

Inheritance diagram for B5HodoscopeSD:
G4VSensitiveDetector

Public Member Functions

 B5HodoscopeSD (G4String name)
 
virtual ~B5HodoscopeSD ()
 
virtual void Initialize (G4HCofThisEvent *HCE)
 
virtual G4bool ProcessHits (G4Step *aStep, G4TouchableHistory *ROhist)
 
- Public Member Functions inherited from G4VSensitiveDetector
 G4VSensitiveDetector (G4String name)
 
 G4VSensitiveDetector (const G4VSensitiveDetector &right)
 
virtual ~G4VSensitiveDetector ()
 
const G4VSensitiveDetectoroperator= (const G4VSensitiveDetector &right)
 
G4int operator== (const G4VSensitiveDetector &right) const
 
G4int operator!= (const G4VSensitiveDetector &right) const
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
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

Hodoscope sensitive detector.

Definition at line 43 of file B5HodoscopeSD.hh.

Constructor & Destructor Documentation

B5HodoscopeSD::B5HodoscopeSD ( G4String  name)

Definition at line 43 of file B5HodoscopeSD.cc.

References G4VSensitiveDetector::collectionName, and G4CollectionNameVector::insert().

44 : G4VSensitiveDetector(name), fHitsCollection(0), fHCID(-1)
45 {
46  G4String HCname = "hodoscopeColl";
47  collectionName.insert(HCname);
48 }
G4VSensitiveDetector(G4String name)
G4CollectionNameVector collectionName
B5HodoscopeSD::~B5HodoscopeSD ( )
virtual

Definition at line 52 of file B5HodoscopeSD.cc.

53 {}

Member Function Documentation

void B5HodoscopeSD::Initialize ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 57 of file B5HodoscopeSD.cc.

References G4HCofThisEvent::AddHitsCollection(), G4VSensitiveDetector::collectionName, G4SDManager::GetCollectionID(), G4SDManager::GetSDMpointer(), and G4VSensitiveDetector::SensitiveDetectorName.

58 {
59  fHitsCollection = new B5HodoscopeHitsCollection
61  if (fHCID<0)
62  { fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection); }
63  hce->AddHitsCollection(fHCID,fHitsCollection);
64 }
G4THitsCollection< B5HodoscopeHit > B5HodoscopeHitsCollection
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4CollectionNameVector collectionName
G4bool B5HodoscopeSD::ProcessHits ( G4Step aStep,
G4TouchableHistory ROhist 
)
virtual

Implements G4VSensitiveDetector.

Definition at line 68 of file B5HodoscopeSD.cc.

References G4THitsCollection< T >::entries(), G4VPhysicalVolume::GetCopyNo(), G4StepPoint::GetGlobalTime(), G4TouchableHistory::GetHistory(), G4VPhysicalVolume::GetLogicalVolume(), G4Step::GetPreStepPoint(), G4NavigationHistory::GetTopTransform(), G4Step::GetTotalEnergyDeposit(), G4StepPoint::GetTouchable(), G4TouchableHistory::GetVolume(), G4THitsCollection< T >::insert(), G4AffineTransform::Invert(), G4AffineTransform::NetRotation(), G4AffineTransform::NetTranslation(), B5HodoscopeHit::SetLogV(), B5HodoscopeHit::SetPos(), and B5HodoscopeHit::SetRot().

69 {
70  G4double edep = step->GetTotalEnergyDeposit();
71  if (edep==0.) return true;
72 
73  G4StepPoint* preStepPoint = step->GetPreStepPoint();
74 
75  G4TouchableHistory* touchable
76  = (G4TouchableHistory*)(preStepPoint->GetTouchable());
77  G4int copyNo = touchable->GetVolume()->GetCopyNo();
78  G4double hitTime = preStepPoint->GetGlobalTime();
79 
80  // check if this finger already has a hit
81  G4int ix = -1;
82  for (G4int i=0;i<fHitsCollection->entries();i++)
83  {
84  if ((*fHitsCollection)[i]->GetID()==copyNo)
85  {
86  ix = i;
87  break;
88  }
89  }
90 
91  if (ix>=0)
92  // if it has, then take the earlier time
93  {
94  if ((*fHitsCollection)[ix]->GetTime()>hitTime)
95  { (*fHitsCollection)[ix]->SetTime(hitTime); }
96  }
97  else
98  // if not, create a new hit and set it to the collection
99  {
100  B5HodoscopeHit* hit = new B5HodoscopeHit(copyNo,hitTime);
101  G4VPhysicalVolume* physical = touchable->GetVolume();
102  hit->SetLogV(physical->GetLogicalVolume());
103  G4AffineTransform transform
104  = touchable->GetHistory()->GetTopTransform();
105  transform.Invert();
106  hit->SetRot(transform.NetRotation());
107  hit->SetPos(transform.NetTranslation());
108  fHitsCollection->insert(hit);
109  }
110  return true;
111 }
G4VPhysicalVolume * GetVolume(G4int depth=0) const
void SetPos(G4ThreeVector xyz)
G4ThreeVector NetTranslation() const
const G4VTouchable * GetTouchable() const
int G4int
Definition: G4Types.hh:78
G4AffineTransform & Invert()
G4RotationMatrix NetRotation() const
void SetRot(G4RotationMatrix rmat)
G4LogicalVolume * GetLogicalVolume() const
virtual G4int GetCopyNo() const =0
G4double GetGlobalTime() const
const G4AffineTransform & GetTopTransform() const
const G4NavigationHistory * GetHistory() const
double G4double
Definition: G4Types.hh:76
void SetLogV(G4LogicalVolume *val)

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