Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LXeScintSD.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: LXeScintSD.cc 68752 2013-04-05 10:23:47Z gcosmo $
27 //
30 //
31 //
32 #include "LXeScintSD.hh"
33 #include "LXeScintHit.hh"
34 #include "G4VPhysicalVolume.hh"
35 #include "G4LogicalVolume.hh"
36 #include "G4Track.hh"
37 #include "G4Step.hh"
38 #include "G4ParticleDefinition.hh"
39 #include "G4VTouchable.hh"
40 #include "G4TouchableHistory.hh"
41 #include "G4ios.hh"
42 #include "G4VProcess.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
47  : G4VSensitiveDetector(name)
48 {
49  fScintCollection = NULL;
50  collectionName.insert("scintCollection");
51 }
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60  fScintCollection = new LXeScintHitsCollection
62  //A way to keep all the hits of this event in one place if needed
63  static G4int hitsCID = -1;
64  if(hitsCID<0){
65  hitsCID = GetCollectionID(0);
66  }
67  hitsCE->AddHitsCollection( hitsCID, fScintCollection );
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
73  G4double edep = aStep->GetTotalEnergyDeposit();
74  if(edep==0.) return false; //No edep so dont count as hit
75 
76  G4StepPoint* thePrePoint = aStep->GetPreStepPoint();
77  G4TouchableHistory* theTouchable =
79  G4VPhysicalVolume* thePrePV = theTouchable->GetVolume();
80 
81  G4StepPoint* thePostPoint = aStep->GetPostStepPoint();
82 
83  //Get the average position of the hit
84  G4ThreeVector pos = thePrePoint->GetPosition() + thePostPoint->GetPosition();
85  pos/=2.;
86 
87  LXeScintHit* scintHit = new LXeScintHit(thePrePV);
88 
89  scintHit->SetEdep(edep);
90  scintHit->SetPos(pos);
91 
92  fScintCollection->insert(scintHit);
93 
94  return true;
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
98 
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102 
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106 
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
110 
const XML_Char * name
Definition: expat.h:151
G4VPhysicalVolume * GetVolume(G4int depth=0) const
void SetPos(G4ThreeVector xyz)
Definition: LXeScintHit.hh:67
G4int insert(T *aHit)
const G4VTouchable * GetTouchable() const
int G4int
Definition: G4Types.hh:78
virtual G4int GetCollectionID(G4int i)
LXeScintSD(G4String name)
Definition: LXeScintSD.cc:46
G4StepPoint * GetPreStepPoint() const
virtual ~LXeScintSD()
Definition: LXeScintSD.cc:55
const G4ThreeVector & GetPosition() const
void SetEdep(G4double de)
Definition: LXeScintHit.hh:63
bool G4bool
Definition: G4Types.hh:79
G4THitsCollection< LXeScintHit > LXeScintHitsCollection
Definition: LXeScintHit.hh:79
Definition: G4Step.hh:76
G4double GetTotalEnergyDeposit() const
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
virtual void DrawAll()
Definition: LXeScintSD.cc:107
G4StepPoint * GetPostStepPoint() const
virtual void clear()
Definition: LXeScintSD.cc:103
Definition of the LXeScintSD class.
virtual void Initialize(G4HCofThisEvent *)
Definition: LXeScintSD.cc:59
G4CollectionNameVector collectionName
virtual void EndOfEvent(G4HCofThisEvent *)
Definition: LXeScintSD.cc:99
double G4double
Definition: G4Types.hh:76
Definition of the LXeScintHit class.
static const G4double pos
virtual void PrintAll()
Definition: LXeScintSD.cc:111
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *)
Definition: LXeScintSD.cc:72