Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // 27 // ------------------------------------------- 24 // -------------------------------------------------------------- 28 // GEANT 4 - Underground Dark Matter Detecto 25 // GEANT 4 - Underground Dark Matter Detector Advanced Example 29 // 26 // 30 // For information related to this code c 27 // For information related to this code contact: Alex Howard 31 // e-mail: alexander.howard@cern.ch << 28 // e-mail: a.s.howard@ic.ac.uk 32 // ------------------------------------------- 29 // -------------------------------------------------------------- 33 // Comments 30 // Comments 34 // 31 // 35 // Underground Advanced 32 // Underground Advanced 36 // by A. Howard and H. Araujo 33 // by A. Howard and H. Araujo 37 // (27th November 2001) 34 // (27th November 2001) 38 // 35 // 39 // PmtSD (sensitive PMT) program 36 // PmtSD (sensitive PMT) program 40 // ------------------------------------------- 37 // -------------------------------------------------------------- 41 38 42 #include "DMXPmtSD.hh" 39 #include "DMXPmtSD.hh" 43 40 44 #include "DMXDetectorConstruction.hh" 41 #include "DMXDetectorConstruction.hh" 45 42 46 #include "G4VPhysicalVolume.hh" 43 #include "G4VPhysicalVolume.hh" 47 #include "G4Step.hh" 44 #include "G4Step.hh" 48 #include "G4VTouchable.hh" 45 #include "G4VTouchable.hh" 49 #include "G4TouchableHistory.hh" 46 #include "G4TouchableHistory.hh" 50 #include "G4SDManager.hh" 47 #include "G4SDManager.hh" 51 #include "G4UImanager.hh" 48 #include "G4UImanager.hh" 52 #include "G4ios.hh" 49 #include "G4ios.hh" 53 50 54 51 55 DMXPmtSD::DMXPmtSD(G4String name) << 52 DMXPmtSD::DMXPmtSD(G4String name, DMXDetectorConstruction* DMXSD) 56 :G4VSensitiveDetector(name) { << 53 :G4VSensitiveDetector(name),DMXDetector(DMXSD) { 57 54 58 G4String HCname="pmtCollection"; 55 G4String HCname="pmtCollection"; 59 collectionName.insert(HCname); 56 collectionName.insert(HCname); 60 } 57 } 61 58 62 59 63 DMXPmtSD::~DMXPmtSD() {;} 60 DMXPmtSD::~DMXPmtSD() {;} 64 61 65 62 66 ////////////////////////////////////////////// 63 //////////////////////////////////////////////////////////////////////////// 67 void DMXPmtSD::Initialize(G4HCofThisEvent*) { 64 void DMXPmtSD::Initialize(G4HCofThisEvent*) { 68 65 69 pmtCollection = new DMXPmtHitsCollection 66 pmtCollection = new DMXPmtHitsCollection 70 (SensitiveDetectorName,collectionName[0]); 67 (SensitiveDetectorName,collectionName[0]); 71 68 72 HitID = -1; 69 HitID = -1; 73 70 74 71 75 } 72 } 76 73 77 74 78 75 79 ////////////////////////////////////////////// 76 //////////////////////////////////////////////////////////////////////////// 80 G4bool DMXPmtSD::ProcessHits 77 G4bool DMXPmtSD::ProcessHits 81 (G4Step* aStep, G4TouchableHistory*){ 78 (G4Step* aStep, G4TouchableHistory*){ 82 79 83 // make known hit position 80 // make known hit position 84 DMXPmtHit* aPmtHit = new DMXPmtHit(); 81 DMXPmtHit* aPmtHit = new DMXPmtHit(); 85 aPmtHit->SetPos(aStep->GetPostStepPoint()->G 82 aPmtHit->SetPos(aStep->GetPostStepPoint()->GetPosition()); 86 aPmtHit->SetTime(aStep->GetPostStepPoint()-> 83 aPmtHit->SetTime(aStep->GetPostStepPoint()->GetGlobalTime()); 87 HitID = pmtCollection->insert(aPmtHit); 84 HitID = pmtCollection->insert(aPmtHit); 88 85 89 return true; 86 return true; 90 87 91 } 88 } 92 89 93 90 94 91 95 ////////////////////////////////////////////// 92 //////////////////////////////////////////////////////////////////////////// 96 void DMXPmtSD::EndOfEvent(G4HCofThisEvent* HCE 93 void DMXPmtSD::EndOfEvent(G4HCofThisEvent* HCE) { 97 94 98 G4String HCname = collectionName[0]; 95 G4String HCname = collectionName[0]; 99 96 100 static G4int HCID = -1; 97 static G4int HCID = -1; 101 if(HCID<0) 98 if(HCID<0) 102 HCID = G4SDManager::GetSDMpointer()->GetCo 99 HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname); 103 HCE->AddHitsCollection(HCID,pmtCollection); 100 HCE->AddHitsCollection(HCID,pmtCollection); 104 101 105 G4int nHits = pmtCollection->entries(); 102 G4int nHits = pmtCollection->entries(); 106 if (verboseLevel>=1) { 103 if (verboseLevel>=1) { 107 G4cout << " PMT collection: " << nHits 104 G4cout << " PMT collection: " << nHits << " hits" << G4endl; 108 if (verboseLevel>=2) 105 if (verboseLevel>=2) 109 pmtCollection->PrintAllHits(); 106 pmtCollection->PrintAllHits(); 110 } 107 } 111 108 112 109 113 } 110 } 114 111 115 112 116 ////////////////////////////////////////////// 113 //////////////////////////////////////////////////////////////////////////// 117 void DMXPmtSD::clear() {;} 114 void DMXPmtSD::clear() {;} 118 115 119 116 120 void DMXPmtSD::DrawAll() {;} 117 void DMXPmtSD::DrawAll() {;} 121 118 122 119 123 void DMXPmtSD::PrintAll() {;} 120 void DMXPmtSD::PrintAll() {;} 124 121 125 122 126 123 127 124 128 125