Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XrayFluoHPGeSD.cc
Go to the documentation of this file.
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-V04-01-03
29 //
30 // Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
31 //
32 // History:
33 // -----------
34 // 28 Nov 2001 Elena Guardincerri Created
35 // 29 Nov 2002 Energy deposition bug fixed (Alfonso.mantero@ge.infn.it)
36 // -------------------------------------------------------------------
37 
38 #include "XrayFluoHPGeSD.hh"
39 #include "XrayFluoSensorHit.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 #include "G4VProcess.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
53 :G4VSensitiveDetector(name),Detector(det)
54 {
55  collectionName.insert("HPGeCollection");
56  HitHPGeID = new G4int[500];
57  //G4cout << "XrayFluoHPGeSD created" << G4endl;
58 
59 }
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
62 
64 {
65 
66  delete [] HitHPGeID;
67 
68  // delete HPGeCollection;
69 
70  G4cout << "XrayFluoHPGeSD deleted" << G4endl;
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74 
76 
77 //initializes HCE with the hits collection(s) created by this
78  //sensitive detector
79 {
80  if (HCE){
81 
82  HPGeCollection = new XrayFluoSensorHitsCollection
84  for (G4int j=0;j<Detector->GetNbOfPixels();j++)
85  {HitHPGeID [j]= -1;};
86  }
87 }
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
89 
91 {
92 
93  if (ROhist){
94 
95  G4double edep = aStep->GetTotalEnergyDeposit();
96  // G4String particleName = aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName();
97  // G4String processName = aStep->GetTrack()->GetCreatorProcess()->GetProcessName();
98 
99  // G4double partEnergy = aStep->GetPreStepPoint()->GetKineticEnergy();
100  // G4double secondEnergy = aStep->GetPostStepPoint()->GetKineticEnergy();
101  // G4cout << " la particella che deposita e': " << particleName << " ha una energia di keV "
102  // << partEnergy << " e deposita "<< edep << G4endl;
103  // G4cout << " la particella creata deposita: " << secondEnergy << G4endl;
104  // if (processName){
105 
106 
107 
108  // G4cout << " la particella viene da: " << processName << G4endl;
109  // }
110 
111  // else {G4cout << " il deposito proviene da: Rayleugh" << G4endl;}
112 
113  if (edep==0.) return false;
114 
115  // G4cout << " edep = " << edep << G4endl;
116 
117  G4TouchableHistory* theTouchable
119 
120  G4VPhysicalVolume* physVol = theTouchable->GetVolume();
121  // theTouchable->MoveUpHistory();
122  G4int PixelNumber = 0;
123  if (Detector->GetNbOfPixels()>1) PixelNumber= physVol->GetCopyNo() ;
124  if ( HitHPGeID[PixelNumber]==-1)
125  {
126  XrayFluoSensorHit* HPGeHit = new XrayFluoSensorHit();
127  HPGeHit->AddEnergy(edep);
128  HitHPGeID[PixelNumber] = HPGeCollection->insert(HPGeHit) - 1;
129  if (verboseLevel>0){
130  G4cout << " New Hit on pixel: " << PixelNumber << G4endl;
131  }
132  }
133  else
134  {
135  (*HPGeCollection)[HitHPGeID[PixelNumber]]->AddEnergy(edep);
136  //G4double ED =(*HPGeCollection)[HitHPGeID[PixelNumber]]->GetEdepTot();
137  if (verboseLevel>0)
138  G4cout << " Energy added to Pixel: " << PixelNumber << G4endl;
139  }
140 
141  return true;
142  }
143  else {return false;}
144 
145 }
146 
147 
148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
149 
151 {
152  static G4int HCID = -1;
153  if(HCID<0)
155  HCE->AddHitsCollection(HCID,HPGeCollection);
156 }
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
159 
161 {}
162 
163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
164 
166 {}
167 
168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
169 
171 {}
172 
173 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
174 
175 
176 
177 
178 
179 
180 
181 
182 
183 
184 
185 
186 
187 
188 
const XML_Char * name
Definition: expat.h:151
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4bool ProcessHits(G4Step *, G4TouchableHistory *)
G4int insert(T *aHit)
const G4VTouchable * GetTouchable() const
int G4int
Definition: G4Types.hh:78
G4THitsCollection< XrayFluoSensorHit > XrayFluoSensorHitsCollection
void Initialize(G4HCofThisEvent *)
G4StepPoint * GetPreStepPoint() const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
Definition: G4Step.hh:76
G4double GetTotalEnergyDeposit() const
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
XrayFluoHPGeSD(G4String, XrayFluoDetectorConstruction *)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
void AddEnergy(G4double de)
virtual G4int GetCopyNo() const =0
#define G4endl
Definition: G4ios.hh:61
G4CollectionNameVector collectionName
void EndOfEvent(G4HCofThisEvent *)
double G4double
Definition: G4Types.hh:76