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

#include <GammaRayTelTrackerSD.hh>

Inheritance diagram for GammaRayTelTrackerSD:
G4VSensitiveDetector

Public Member Functions

 GammaRayTelTrackerSD (G4String)
 
 ~GammaRayTelTrackerSD ()
 
void Initialize (G4HCofThisEvent *)
 
G4bool ProcessHits (G4Step *astep, G4TouchableHistory *ROHist)
 
void EndOfEvent (G4HCofThisEvent *)
 
void clear ()
 
void DrawAll ()
 
void PrintAll ()
 
- 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
 
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

Definition at line 51 of file GammaRayTelTrackerSD.hh.

Constructor & Destructor Documentation

GammaRayTelTrackerSD::GammaRayTelTrackerSD ( G4String  name)

Definition at line 54 of file GammaRayTelTrackerSD.cc.

References G4VSensitiveDetector::collectionName, GammaRayTelDetectorConstruction::GetNbOfTKRLayers(), GammaRayTelDetectorConstruction::GetNbOfTKRStrips(), GammaRayTelDetectorConstruction::GetNbOfTKRTiles(), G4RunManager::GetRunManager(), G4RunManager::GetUserDetectorConstruction(), and G4CollectionNameVector::insert().

55 {
57  Detector =
59 
60  G4int NbOfTKRTiles = Detector->GetNbOfTKRTiles();
61  NbOfTKRStrips = Detector->GetNbOfTKRStrips();
62  NbOfTKRLayers = Detector->GetNbOfTKRLayers();
63  NbOfTKRStrips = NbOfTKRStrips*NbOfTKRTiles;
64 
65  NbOfTKRChannels = NbOfTKRStrips* NbOfTKRTiles * NbOfTKRLayers;
66 
67  ThitXID = new G4int[NbOfTKRChannels];
68  ThitYID = new G4int[NbOfTKRChannels];
69  collectionName.insert("TrackerCollection");
70 }
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
int G4int
Definition: G4Types.hh:78
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
G4VSensitiveDetector(G4String name)
G4CollectionNameVector collectionName
GammaRayTelTrackerSD::~GammaRayTelTrackerSD ( )

Definition at line 74 of file GammaRayTelTrackerSD.cc.

75 {
76  delete [] ThitXID;
77  delete [] ThitYID;
78 }

Member Function Documentation

void GammaRayTelTrackerSD::clear ( void  )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 219 of file GammaRayTelTrackerSD.cc.

220 {}
void GammaRayTelTrackerSD::DrawAll ( void  )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 224 of file GammaRayTelTrackerSD.cc.

225 {}
void GammaRayTelTrackerSD::EndOfEvent ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 200 of file GammaRayTelTrackerSD.cc.

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

201 {
202  static G4int HCID = -1;
203  if(HCID<0)
204  {
206  }
207  HCE->AddHitsCollection(HCID,TrackerCollection);
208 
209 
210  for (G4int i=0;i<NbOfTKRChannels;i++)
211  {
212  ThitXID[i] = -1;
213  ThitYID[i] = -1;
214  };
215 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
int G4int
Definition: G4Types.hh:78
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4CollectionNameVector collectionName
void GammaRayTelTrackerSD::Initialize ( G4HCofThisEvent )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 82 of file GammaRayTelTrackerSD.cc.

References G4VSensitiveDetector::collectionName, and G4VSensitiveDetector::SensitiveDetectorName.

83 {
84  TrackerCollection = new GammaRayTelTrackerHitsCollection
86 
87  for (G4int i=0;i<NbOfTKRChannels;i++)
88  {
89  ThitXID[i] = -1;
90  ThitYID[i] = -1;
91  };
92 }
int G4int
Definition: G4Types.hh:78
G4THitsCollection< GammaRayTelTrackerHit > GammaRayTelTrackerHitsCollection
G4CollectionNameVector collectionName
void GammaRayTelTrackerSD::PrintAll ( void  )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 229 of file GammaRayTelTrackerSD.cc.

230 {}
G4bool GammaRayTelTrackerSD::ProcessHits ( G4Step astep,
G4TouchableHistory ROHist 
)
virtual

Implements G4VSensitiveDetector.

Definition at line 96 of file GammaRayTelTrackerSD.cc.

References GammaRayTelTrackerHit::AddSil(), G4VPhysicalVolume::GetCopyNo(), G4VPhysicalVolume::GetName(), GammaRayTelDetectorConstruction::GetNbOfTKRStrips(), GammaRayTelDetectorConstruction::GetNbOfTKRTiles(), G4StepPoint::GetPosition(), G4Step::GetPreStepPoint(), G4Step::GetTotalEnergyDeposit(), G4StepPoint::GetTouchable(), G4TouchableHistory::GetVolume(), G4THitsCollection< T >::insert(), python.hepunit::keV, GammaRayTelTrackerHit::SetNSilPlane(), GammaRayTelTrackerHit::SetNStrip(), GammaRayTelTrackerHit::SetPlaneType(), and GammaRayTelTrackerHit::SetPos().

97 {
98 
99  G4double edep = aStep->GetTotalEnergyDeposit();
100  if ((edep/keV == 0.)) return false;
101 
102  G4int StripTotal = Detector->GetNbOfTKRStrips();
103  G4int TileTotal = Detector->GetNbOfTKRTiles();
104 
105  // This TouchableHistory is used to obtain the physical volume
106  // of the hit
107  G4TouchableHistory* theTouchable
108  = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
109 
110  //G4VPhysicalVolume* phys_tile = theTouchable->GetVolume();
111 
112  G4VPhysicalVolume* plane = theTouchable->GetVolume(1);
113 
114  G4int PlaneNumber = 0;
115  PlaneNumber=plane->GetCopyNo();
116  G4String PlaneName = plane->GetName();
117 
118  // The RO History is used to obtain the real strip
119  // of the hit
120 
121  G4int StripNumber = 0;
122  G4VPhysicalVolume* strip = 0;
123  strip = ROhist->GetVolume();
124 
125  // if (strip){
126  G4String StripName = strip->GetName();
127  StripNumber= strip->GetCopyNo();
128  // }
129  // ROhist->MoveUpHistory();
130  G4VPhysicalVolume* tile = ROhist->GetVolume(1);
131  G4int TileNumber = tile->GetCopyNo();
132  G4String TileName = tile->GetName();
133 
134  G4int NTile = (TileNumber%TileTotal);
135  G4int j=0;
136 
137  G4int NChannel = 0;
138 
139  for (j=0;j<TileTotal;j++)
140  {
141  if(NTile==j) StripNumber += StripTotal*NTile;
142  }
143 
144  NChannel = PlaneNumber*TileTotal*StripTotal + StripNumber;
145 
146  /* G4cout << NChannel << " Channel Number" << G4endl;
147  G4cout << " Plane Number = " << PlaneNumber << " " << PlaneName
148  << G4endl;
149  G4cout << StripName << " " << StripNumber << G4endl; */
150 
151  if (PlaneName == "TKRDetectorX" )
152  // The hit is on an X silicon plane
153  {
154  // This is a new hit
155  if (ThitXID[NChannel]==-1)
156  {
158  TrackerHit->SetPlaneType(1);
159  TrackerHit->AddSil(edep);
160  TrackerHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
161  TrackerHit->SetNSilPlane(PlaneNumber);
162  TrackerHit->SetNStrip(StripNumber);
163  ThitXID[NChannel] =
164  TrackerCollection->insert(TrackerHit) -1;
165  }
166  else // This is not new
167  {
168  (*TrackerCollection)[ThitXID[NChannel]]->AddSil(edep);
169  // G4cout << "X" << PlaneNumber << " " << StripNumber << G4endl;
170  }
171  }
172 
173  if (PlaneName == "TKRDetectorY")
174  // The hit is on an Y silicon plane
175  {
176  // This is a new hit
177  if (ThitYID[NChannel]==-1)
178  {
180  TrackerHit->SetPlaneType(0);
181  TrackerHit->AddSil(edep);
182  TrackerHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
183  TrackerHit->SetNSilPlane(PlaneNumber);
184  TrackerHit->SetNStrip(StripNumber);
185  ThitYID[NChannel] =
186  TrackerCollection->insert(TrackerHit)-1;
187  }
188  else // This is not new
189  {
190  (*TrackerCollection)[ThitYID[NChannel]]->AddSil(edep);
191  // G4cout << "Y" << PlaneNumber << " " << StripNumber << G4endl;
192  }
193  }
194 
195  return true;
196 }
G4VPhysicalVolume * GetVolume(G4int depth=0) const
int G4int
Definition: G4Types.hh:78
const G4String & GetName() const
void SetPos(G4ThreeVector xyz)
virtual G4int GetCopyNo() const =0
double G4double
Definition: G4Types.hh:76

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