Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file ExGflash1SensitiveDetector.cc 27 /// \file ExGflash1SensitiveDetector.cc 28 /// \brief Implementation of the ExGflash1Sens 28 /// \brief Implementation of the ExGflash1SensitiveDetector class 29 // 29 // 30 // Created by Joanna Weng 26.11.2004 30 // Created by Joanna Weng 26.11.2004 31 #include "ExGflash1SensitiveDetector.hh" 31 #include "ExGflash1SensitiveDetector.hh" 32 << 33 #include "ExGflash1DetectorConstruction.hh" << 34 #include "ExGflashHit.hh" 32 #include "ExGflashHit.hh" 35 << 36 #include "G4GFlashSpot.hh" 33 #include "G4GFlashSpot.hh" 37 #include "G4Step.hh" << 34 #include "ExGflash1DetectorConstruction.hh" 38 #include "G4TouchableHistory.hh" << 39 #include "G4VPhysicalVolume.hh" 35 #include "G4VPhysicalVolume.hh" >> 36 #include "G4Step.hh" 40 #include "G4VTouchable.hh" 37 #include "G4VTouchable.hh" >> 38 #include "G4TouchableHistory.hh" 41 39 42 // WARNING : You have to use also G4VGFlashS << 40 //WARNING : You have to use also G4VGFlashSensitiveDetector() as base class 43 41 44 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 43 46 ExGflash1SensitiveDetector::ExGflash1Sensitive 44 ExGflash1SensitiveDetector::ExGflash1SensitiveDetector(G4String name, 47 << 45 ExGflash1DetectorConstruction* det) 48 : G4VSensitiveDetector(name), fDetector(det) << 46 : G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fDetector(det), fHCID(-1) 49 { 47 { 50 G4String caloname = "ExGflashCollection"; << 48 G4String caloname="ExGflashCollection"; 51 collectionName.insert(caloname); 49 collectionName.insert(caloname); 52 } 50 } 53 51 54 //....oooOO0OOooo........oooOO0OOooo........oo 52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 55 53 56 ExGflash1SensitiveDetector::~ExGflash1Sensitiv << 54 ExGflash1SensitiveDetector::~ExGflash1SensitiveDetector() >> 55 {} 57 56 58 //....oooOO0OOooo........oooOO0OOooo........oo 57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 58 60 void ExGflash1SensitiveDetector::Initialize(G4 59 void ExGflash1SensitiveDetector::Initialize(G4HCofThisEvent* HCE) 61 { 60 { 62 if (fHCID < 0) { << 61 if(fHCID<0){ fHCID = GetCollectionID(0); } 63 fHCID = GetCollectionID(0); << 62 fCaloHitsCollection=new 64 } << 63 ExGflashHitsCollection(SensitiveDetectorName,collectionName[0]); // first collection 65 fCaloHitsCollection = << 64 HCE->AddHitsCollection( fHCID, fCaloHitsCollection ); 66 new ExGflashHitsCollection(SensitiveDetect << 67 HCE->AddHitsCollection(fHCID, fCaloHitsColle << 68 } 65 } 69 66 70 //....oooOO0OOooo........oooOO0OOooo........oo 67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 68 72 void ExGflash1SensitiveDetector::EndOfEvent(G4 << 69 void ExGflash1SensitiveDetector::EndOfEvent(G4HCofThisEvent*) >> 70 {} 73 71 74 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 73 76 G4bool ExGflash1SensitiveDetector::ProcessHits << 74 G4bool ExGflash1SensitiveDetector::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist) 77 { 75 { 78 G4double e = aStep->GetTotalEnergyDeposit(); << 76 G4double e=aStep->GetTotalEnergyDeposit(); 79 if (e <= 0.) return false; << 77 if(e<=0.)return false; 80 << 78 81 auto theTouchable = (G4TouchableHistory*)(aS << 79 G4TouchableHistory* theTouchable 82 << 80 = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable()); >> 81 83 // enrgy deposited -> make Hit 82 // enrgy deposited -> make Hit 84 // const G4VPhysicalVolume* physVol= aStep-> << 83 //const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume(); 85 // G4TouchableHistory* theTouchable = << 84 //G4TouchableHistory* theTouchable = 86 // (G4TouchableHistory*)(aStep->GetPreStepPo 85 // (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable()); 87 auto caloHit = new ExGflashHit(); << 86 ExGflashHit* caloHit=new ExGflashHit(); 88 caloHit->SetEdep(e); 87 caloHit->SetEdep(e); 89 caloHit->SetPos(aStep->GetPreStepPoint()->Ge 88 caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition()); 90 fCaloHitsCollection->insert(caloHit); 89 fCaloHitsCollection->insert(caloHit); 91 if (ROhist) { << 90 if (ROhist){;} 92 ; << 93 } << 94 G4VPhysicalVolume* physVol = theTouchable->G 91 G4VPhysicalVolume* physVol = theTouchable->GetVolume(); 95 G4int crystalnum = 0; << 92 G4int crystalnum=0; 96 for (int i = 0; i < 100; i++) //@@@@@@@ ExG << 93 for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty 97 { << 94 { 98 if (physVol == fDetector->GetCristal(i)) c << 95 if(physVol == fDetector->GetCristal(i)) crystalnum= i; 99 } << 96 } 100 caloHit->SetCrystalNum(crystalnum); 97 caloHit->SetCrystalNum(crystalnum); 101 << 98 102 return true; 99 return true; 103 } 100 } 104 101 105 //....oooOO0OOooo........oooOO0OOooo........oo 102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 106 103 107 // Separate GFLASH interface 104 // Separate GFLASH interface 108 G4bool ExGflash1SensitiveDetector::ProcessHits << 105 G4bool ExGflash1SensitiveDetector::ProcessHits(G4GFlashSpot*aSpot ,G4TouchableHistory* ROhist) 109 { // cout<<"This is ProcessHits GFLASH"<<endl << 106 { //cout<<"This is ProcessHits GFLASH"<<endl; 110 G4double e = aSpot->GetEnergySpot()->GetEner << 107 G4double e=aSpot->GetEnergySpot()->GetEnergy(); 111 if (e <= 0.) return false; << 108 if(e<=0.)return false; 112 << 109 113 G4VPhysicalVolume* pCurrentVolume = aSpot->G 110 G4VPhysicalVolume* pCurrentVolume = aSpot->GetTouchableHandle()->GetVolume(); 114 << 111 115 auto caloHit = new ExGflashHit(); << 112 ExGflashHit* caloHit=new ExGflashHit(); 116 caloHit->SetEdep(e); 113 caloHit->SetEdep(e); 117 caloHit->SetPos(aSpot->GetEnergySpot()->GetP 114 caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition()); 118 fCaloHitsCollection->insert(caloHit); 115 fCaloHitsCollection->insert(caloHit); 119 if (ROhist) { << 116 if (ROhist){;} 120 ; << 117 //cout <<pCurrentVolume->GetName() << endl; 121 } << 118 G4int crystalnum=0; 122 // cout <<pCurrentVolume->GetName() << end << 119 for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty 123 G4int crystalnum = 0; << 120 { 124 for (int i = 0; i < 100; i++) //@@@@@@@ ExG << 121 if(pCurrentVolume == fDetector->GetCristal(i)) crystalnum= i; 125 { << 122 } 126 if (pCurrentVolume == fDetector->GetCrista << 127 } << 128 caloHit->SetCrystalNum(crystalnum); 123 caloHit->SetCrystalNum(crystalnum); 129 << 124 130 return true; 125 return true; 131 } 126 } 132 127 133 //....oooOO0OOooo........oooOO0OOooo........oo 128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 129 134 130