#include "GeneHe3detSD.hh" #include "G4HCofThisEvent.hh" #include "G4Ions.hh" #include "G4ParticleDefinition.hh" #include "G4ParticleTypes.hh" #include "G4SDManager.hh" #include "G4Step.hh" #include "G4VPhysicalVolume.hh" #include "G4ios.hh" #include "GeneHe3detHit.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... GeneHe3detSD::GeneHe3detSD(G4String name) : G4VSensitiveDetector(name) { G4String HCname = "GeneHe3detHitCollection"; collectionName.insert(HCname); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... GeneHe3detSD::~GeneHe3detSD() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void GeneHe3detSD::Initialize(G4HCofThisEvent*) { scintillatorCollection = new GeneHe3detHitsCollection(SensitiveDetectorName, collectionName[0]); HitID = -1; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4bool GeneHe3detSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { G4double edep = aStep->GetTotalEnergyDeposit(); G4ParticleDefinition* particleType = aStep->GetTrack()->GetDefinition(); G4String particleName = particleType->GetParticleName(); // G4double stepl = 0.; // if (particleType->GetPDGCharge() != 0.) // stepl = aStep->GetStepLength(); if (particleName == "opticalphoton") return false; if ((edep == 0.)) return false; G4StepPoint* preStepPoint = aStep->GetPreStepPoint(); G4TouchableHistory* theTouchable = (G4TouchableHistory*)(preStepPoint->GetTouchable()); G4int copyNo = theTouchable->GetVolume()->GetCopyNo(); // fill in hit GeneHe3detHit* newHit = new GeneHe3detHit(); newHit->SetCpNo(copyNo); newHit->SetEdep(edep); newHit->SetPos(aStep->GetPostStepPoint()->GetPosition()); newHit->SetTime(aStep->GetPostStepPoint()->GetGlobalTime()); newHit->SetParticle(particleName); newHit->SetParticleEnergy(aStep->GetPreStepPoint()->GetKineticEnergy()); HitID = scintillatorCollection->insert(newHit); return true; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void GeneHe3detSD::EndOfEvent(G4HCofThisEvent* HCE) { G4String HCname = collectionName[0]; static G4int HCID = -1; if (HCID < 0) HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname); HCE->AddHitsCollection(HCID, scintillatorCollection); G4int nHits = scintillatorCollection->entries(); if (verboseLevel >= 1) G4cout << " Si collection: " << nHits << " hits" << G4endl; if (verboseLevel >= 2) scintillatorCollection->PrintAllHits(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void GeneHe3detSD::clear() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void GeneHe3detSD::DrawAll() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void GeneHe3detSD::PrintAll() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....