1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: XrayFluoHPGeSD.cc |
---|
28 | // GEANT4 tag $Name: xray_fluo-V03-02-00 |
---|
29 | // |
---|
30 | // Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) |
---|
31 | // |
---|
32 | // History: |
---|
33 | // ----------- |
---|
34 | // 28 Nov 2001 Elena Guardincerri Created |
---|
35 | // |
---|
36 | // ------------------------------------------------------------------- |
---|
37 | |
---|
38 | #include "XrayFluoHPGeSD.hh" |
---|
39 | #include "XrayFluoSensorHit.hh" |
---|
40 | #include "XrayFluoDetectorConstruction.hh" |
---|
41 | #include "G4VPhysicalVolume.hh" |
---|
42 | #include "G4Step.hh" |
---|
43 | #include "G4VTouchable.hh" |
---|
44 | #include "G4TouchableHistory.hh" |
---|
45 | #include "G4SDManager.hh" |
---|
46 | #include "G4ios.hh" |
---|
47 | |
---|
48 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
49 | |
---|
50 | XrayFluoHPGeSD::XrayFluoHPGeSD(G4String name, |
---|
51 | XrayFluoDetectorConstruction* det) |
---|
52 | :G4VSensitiveDetector(name),Detector(det) |
---|
53 | { |
---|
54 | collectionName.insert("HPGeCollection"); |
---|
55 | HitHPGeID = new G4int[500]; |
---|
56 | } |
---|
57 | |
---|
58 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
59 | |
---|
60 | XrayFluoHPGeSD::~XrayFluoHPGeSD() |
---|
61 | { |
---|
62 | delete [] HitHPGeID; |
---|
63 | } |
---|
64 | |
---|
65 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
66 | |
---|
67 | void XrayFluoHPGeSD::Initialize(G4HCofThisEvent*HCE) |
---|
68 | |
---|
69 | //initializes HCE with the hits collection(s) created by this |
---|
70 | //sensitive detector |
---|
71 | { |
---|
72 | HPGeCollection = new XrayFluoSensorHitsCollection |
---|
73 | (SensitiveDetectorName,collectionName[0]); |
---|
74 | for (G4int j=0;j<Detector->GetNbOfPixels();j++) |
---|
75 | {HitHPGeID [j]= -1;}; |
---|
76 | } |
---|
77 | |
---|
78 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
79 | |
---|
80 | G4bool XrayFluoHPGeSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist) |
---|
81 | { |
---|
82 | G4double edep = aStep->GetTotalEnergyDeposit(); |
---|
83 | if ((edep==0.)) return false; |
---|
84 | |
---|
85 | G4TouchableHistory* theTouchable |
---|
86 | = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable()); |
---|
87 | |
---|
88 | G4VPhysicalVolume* physVol = theTouchable->GetVolume(); |
---|
89 | theTouchable->MoveUpHistory(); |
---|
90 | G4int PixelNumber = 0; |
---|
91 | if (Detector->GetNbOfPixels()>1) PixelNumber= physVol->GetCopyNo() ; |
---|
92 | if ( HitHPGeID[PixelNumber]==-1) |
---|
93 | { |
---|
94 | XrayFluoSensorHit* HPGeHit = new XrayFluoSensorHit(); |
---|
95 | HPGeHit->AddEnergy(edep); |
---|
96 | HitHPGeID[PixelNumber] = HPGeCollection->insert(HPGeHit) - 1; |
---|
97 | if (verboseLevel>0) |
---|
98 | G4cout << " New Hit on pixel: " << PixelNumber << G4endl; |
---|
99 | } |
---|
100 | else |
---|
101 | { |
---|
102 | (*HPGeCollection)[HitHPGeID[PixelNumber]]->AddEnergy(edep); |
---|
103 | //G4double ED =(*HPGeCollection)[HitHPGeID[PixelNumber]]->GetEdepTot(); |
---|
104 | if (verboseLevel>0) |
---|
105 | G4cout << " Energy added to Pixel: " << PixelNumber << G4endl; |
---|
106 | } |
---|
107 | |
---|
108 | return true; |
---|
109 | } |
---|
110 | |
---|
111 | |
---|
112 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
113 | |
---|
114 | void XrayFluoHPGeSD::EndOfEvent(G4HCofThisEvent* HCE) |
---|
115 | { |
---|
116 | static G4int HCID = -1; |
---|
117 | if(HCID<0) |
---|
118 | { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); } |
---|
119 | HCE->AddHitsCollection(HCID,HPGeCollection); |
---|
120 | } |
---|
121 | |
---|
122 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
123 | |
---|
124 | void XrayFluoHPGeSD::clear() |
---|
125 | {} |
---|
126 | |
---|
127 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
128 | |
---|
129 | void XrayFluoHPGeSD::DrawAll() |
---|
130 | {} |
---|
131 | |
---|
132 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
133 | |
---|
134 | void XrayFluoHPGeSD::PrintAll() |
---|
135 | {} |
---|
136 | |
---|
137 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
138 | |
---|
139 | |
---|
140 | |
---|
141 | |
---|