Warning, file /geant4/examples/advanced/underground_physics/src/DMXScintSD.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 #include "DMXScintSD.hh"
0043
0044 #include "DMXScintHit.hh"
0045 #include "DMXDetectorConstruction.hh"
0046
0047 #include "G4VPhysicalVolume.hh"
0048 #include "G4HCofThisEvent.hh"
0049 #include "G4Step.hh"
0050 #include "G4SDManager.hh"
0051 #include "G4ParticleDefinition.hh"
0052 #include "G4ParticleTypes.hh"
0053 #include "G4Ions.hh"
0054 #include "G4ios.hh"
0055
0056 #include "G4OpticalPhoton.hh"
0057
0058
0059
0060 DMXScintSD::DMXScintSD(G4String name)
0061 :G4VSensitiveDetector(name)
0062 {
0063 G4String HCname="scintillatorCollection";
0064 collectionName.insert(HCname);
0065 }
0066
0067
0068
0069 DMXScintSD::~DMXScintSD(){ }
0070
0071
0072
0073 void DMXScintSD::Initialize(G4HCofThisEvent*)
0074 {
0075 scintillatorCollection = new DMXScintHitsCollection
0076 (SensitiveDetectorName,collectionName[0]);
0077
0078 HitID = -1;
0079 }
0080
0081
0082
0083 G4bool DMXScintSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
0084 {
0085
0086
0087 if(aStep->GetTrack()->GetDefinition()
0088 == G4OpticalPhoton::OpticalPhotonDefinition()) return false;
0089
0090
0091 G4double edep = aStep->GetTotalEnergyDeposit();
0092 G4ParticleDefinition* particleType = aStep->GetTrack()->GetDefinition();
0093 G4String particleName = particleType->GetParticleName();
0094
0095 G4double stepl = 0.;
0096 if (particleType->GetPDGCharge() != 0.)
0097 stepl = aStep->GetStepLength();
0098
0099 if ((edep==0.)&&(stepl==0.)) return false;
0100
0101
0102
0103 DMXScintHit* newHit = new DMXScintHit();
0104 newHit->SetEdep(edep);
0105 newHit->SetPos(aStep->GetPostStepPoint()->GetPosition());
0106 newHit->SetTime(aStep->GetPreStepPoint()->GetGlobalTime());
0107 newHit->SetParticle(particleName);
0108 newHit->SetParticleEnergy(aStep->GetPreStepPoint()->GetKineticEnergy() );
0109
0110 HitID = scintillatorCollection->insert(newHit);
0111
0112 return true;
0113 }
0114
0115
0116
0117
0118 void DMXScintSD::EndOfEvent(G4HCofThisEvent* HCE)
0119 {
0120
0121 G4String HCname = collectionName[0];
0122 static G4int HCID = -1;
0123 if(HCID<0)
0124 HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname);
0125 HCE->AddHitsCollection(HCID,scintillatorCollection);
0126
0127 G4int nHits = scintillatorCollection->entries();
0128 if (verboseLevel>=1)
0129 G4cout << " LXe collection: " << nHits << " hits" << G4endl;
0130 if (verboseLevel>=2)
0131 scintillatorCollection->PrintAllHits();
0132
0133 }
0134
0135
0136
0137 void DMXScintSD::clear()
0138 {}
0139
0140
0141
0142 void DMXScintSD::DrawAll()
0143 {}
0144
0145
0146
0147 void DMXScintSD::PrintAll()
0148 {}
0149
0150
0151