|
||||
File indexing completed on 2025-01-18 09:17:09
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // 0027 // 0028 // Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) 0029 // 0030 // History: 0031 // ----------- 0032 // 28 Nov 2001 Elena Guardincerri Created 0033 // 29 Nov 2002 Energy deposition bug fixed (Alfonso.mantero@ge.infn.it) 0034 // ------------------------------------------------------------------- 0035 0036 #include "XrayFluoHPGeSD.hh" 0037 #include "XrayFluoSensorHit.hh" 0038 #include "XrayFluoDetectorConstruction.hh" 0039 #include "G4VPhysicalVolume.hh" 0040 #include "G4Step.hh" 0041 #include "G4VTouchable.hh" 0042 #include "G4TouchableHistory.hh" 0043 #include "G4SDManager.hh" 0044 #include "G4ios.hh" 0045 #include "G4VProcess.hh" 0046 0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0048 0049 XrayFluoHPGeSD::XrayFluoHPGeSD(G4String name, 0050 XrayFluoDetectorConstruction* det) 0051 :G4VSensitiveDetector(name),Detector(det) 0052 { 0053 collectionName.insert("HPGeCollection"); 0054 HitHPGeID = new G4int[500]; 0055 //G4cout << "XrayFluoHPGeSD created" << G4endl; 0056 0057 } 0058 0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0060 0061 XrayFluoHPGeSD::~XrayFluoHPGeSD() 0062 { 0063 0064 delete [] HitHPGeID; 0065 0066 // delete HPGeCollection; 0067 0068 G4cout << "XrayFluoHPGeSD deleted" << G4endl; 0069 } 0070 0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0072 0073 void XrayFluoHPGeSD::Initialize(G4HCofThisEvent*HCE) 0074 0075 //initializes HCE with the hits collection(s) created by this 0076 //sensitive detector 0077 { 0078 if (HCE){ 0079 0080 HPGeCollection = new XrayFluoSensorHitsCollection 0081 (SensitiveDetectorName,collectionName[0]); 0082 for (G4int j=0;j<Detector->GetNbOfPixels();j++) 0083 {HitHPGeID [j]= -1;}; 0084 } 0085 } 0086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0087 0088 G4bool XrayFluoHPGeSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist) 0089 { 0090 0091 if (ROhist){ 0092 0093 G4double edep = aStep->GetTotalEnergyDeposit(); 0094 // G4String particleName = aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName(); 0095 // G4String processName = aStep->GetTrack()->GetCreatorProcess()->GetProcessName(); 0096 0097 // G4double partEnergy = aStep->GetPreStepPoint()->GetKineticEnergy(); 0098 // G4double secondEnergy = aStep->GetPostStepPoint()->GetKineticEnergy(); 0099 // G4cout << " la particella che deposita e': " << particleName << " ha una energia di keV " 0100 // << partEnergy << " e deposita "<< edep << G4endl; 0101 // G4cout << " la particella creata deposita: " << secondEnergy << G4endl; 0102 // if (processName){ 0103 0104 0105 0106 // G4cout << " la particella viene da: " << processName << G4endl; 0107 // } 0108 0109 // else {G4cout << " il deposito proviene da: Rayleugh" << G4endl;} 0110 0111 if (edep==0.) return false; 0112 0113 // G4cout << " edep = " << edep << G4endl; 0114 0115 G4TouchableHistory* theTouchable 0116 = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable()); 0117 0118 G4VPhysicalVolume* physVol = theTouchable->GetVolume(); 0119 // theTouchable->MoveUpHistory(); 0120 G4int PixelNumber = 0; 0121 if (Detector->GetNbOfPixels()>1) PixelNumber= physVol->GetCopyNo() ; 0122 if ( HitHPGeID[PixelNumber]==-1) 0123 { 0124 XrayFluoSensorHit* HPGeHit = new XrayFluoSensorHit(); 0125 HPGeHit->AddEnergy(edep); 0126 HitHPGeID[PixelNumber] = HPGeCollection->insert(HPGeHit) - 1; 0127 if (verboseLevel>0){ 0128 G4cout << " New Hit on pixel: " << PixelNumber << G4endl; 0129 } 0130 } 0131 else 0132 { 0133 (*HPGeCollection)[HitHPGeID[PixelNumber]]->AddEnergy(edep); 0134 //G4double ED =(*HPGeCollection)[HitHPGeID[PixelNumber]]->GetEdepTot(); 0135 if (verboseLevel>0) 0136 G4cout << " Energy added to Pixel: " << PixelNumber << G4endl; 0137 } 0138 0139 return true; 0140 } 0141 else {return false;} 0142 0143 } 0144 0145 0146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0147 0148 void XrayFluoHPGeSD::EndOfEvent(G4HCofThisEvent* HCE) 0149 { 0150 static G4int HCID = -1; 0151 if(HCID<0) 0152 { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); } 0153 HCE->AddHitsCollection(HCID,HPGeCollection); 0154 } 0155 0156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0157 0158 void XrayFluoHPGeSD::clear() 0159 {} 0160 0161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0162 0163 void XrayFluoHPGeSD::DrawAll() 0164 {} 0165 0166 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0167 0168 void XrayFluoHPGeSD::PrintAll() 0169 {} 0170 0171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0172 0173 0174 0175 0176 0177 0178 0179 0180 0181 0182 0183 0184 0185 0186
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |