00001 //---------------------------------------------------------------------------// 00002 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu// 00003 // // 00004 // MAJORANA Simulation // 00005 // // 00006 // This code implementation is the intellectual property of the // 00007 // MAJORANA Collaboration. It is based on Geant4, an intellectual // 00008 // property of the RD44 GEANT4 collaboration. // 00009 // // 00010 // ********************* // 00011 // // 00012 // Neither the authors of this software system, nor their employing // 00013 // institutes, nor the agencies providing financial support for this // 00014 // work make any representation or warranty, express or implied, // 00015 // regarding this software system or assume any liability for its use. // 00016 // By copying, distributing or modifying the Program (or any work based // 00017 // on on the Program) you indicate your acceptance of this statement, // 00018 // and all its terms. // 00019 // // 00020 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu// 00021 //---------------------------------------------------------------------------// 00022 // 00023 // $Id: MaGeGeometrySD.cc,v 1.2 2004/11/09 13:42:39 xliu Exp $ 00024 // 00025 // CLASS IMPLEMENTATION: @CLASS_NAME@.cc 00026 // 00027 //---------------------------------------------------------------------------// 00033 // 00034 //---------------------------------------------------------------------------// 00044 //---------------------------------------------------------------------------// 00045 // 00046 #include "gerdageometry/MaGeGeometrySD.hh" 00047 #include "gerdageometry/MaGeGeometrySDHit.hh" 00048 00049 #include "G4Step.hh" 00050 #include "G4HCofThisEvent.hh" 00051 #include "G4TouchableHistory.hh" 00052 #include "G4ios.hh" 00053 00054 //---------------------------------------------------------------------------// 00055 00056 MaGeGeometrySD::MaGeGeometrySD(G4String name) 00057 :G4VSensitiveDetector(name) 00058 { 00059 G4String HCname; 00060 collectionName.insert(HCname="HitsCollection"); 00061 } 00062 00063 MaGeGeometrySD::~MaGeGeometrySD(){;} 00064 00065 void MaGeGeometrySD::Initialize(G4HCofThisEvent* HCE) 00066 { 00067 static int HCID = -1; 00068 HitsCollection = new MaGeGeometrySDHitsCollection 00069 (SensitiveDetectorName,collectionName[0]); 00070 if(HCID<0) 00071 { HCID = GetCollectionID(0); } 00072 HCE->AddHitsCollection(HCID,HitsCollection); 00073 } 00074 00075 00076 G4bool MaGeGeometrySD::ProcessHits(G4Step* aStep, G4TouchableHistory*) 00077 { 00078 G4double edep = aStep->GetTotalEnergyDeposit(); 00079 if(edep==0.) return false; 00080 00081 MaGeGeometrySDHit* newHit = new MaGeGeometrySDHit(); 00082 newHit->SetEdep( edep ); 00083 newHit->SetPos( aStep->GetPreStepPoint()->GetPosition() ); 00084 // newHit->SetEkinetic( aStep->GetKineticEnergy() ); 00085 newHit->SetSteplength( aStep->GetStepLength() ); 00086 // newHit->SetTracklength( aStep->GetTrackLength() ); 00087 00088 // how to get volume name 00089 G4TouchableHistory* theTouchable 00090 = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable()); 00091 newHit->SetVolumename( theTouchable->GetVolume()->GetName() ); 00092 newHit->SetCopynumber( theTouchable->GetVolume()->GetCopyNo() ); 00093 HitsCollection->insert( newHit ); 00094 return true; 00095 } 00096 00097 void MaGeGeometrySD::EndOfEvent(G4HCofThisEvent*) 00098 {;} 00099