Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XAlminumElectrodeSensitivity.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 //
28 //
29 // $Id$
30 //
32 
33 #include "XAlminumElectrodeHit.hh"
34 #include "G4HCofThisEvent.hh"
35 #include "G4TouchableHistory.hh"
36 #include "G4Track.hh"
37 #include "G4Step.hh"
38 #include "G4SDManager.hh"
39 #include "G4Navigator.hh"
40 #include "G4SystemOfUnits.hh"
41 #include "G4ios.hh"
42 
43 
44 using namespace std;
45 
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
52 {
53  G4String HCname;
54  collectionName.insert(HCname="XAlminumElectrodeHit");
55  HCID = -1;
56  fWriter.open("caustic.ssv", fstream::out | fstream::ate);
57  fWriter2.open("timing.ssv", fstream::out | fstream::ate);
58 
59  if(!fWriter.is_open()){
60  G4cout<<"\nXAlminumElectrodeSensitivity::Constructor:";
61  G4cout<<"\n\tFailed to open caustic.ssv for appending data.";
62  G4cout<<"\n\tCreating caustic.ssv";
63  fWriter.open("caustic.ssv");
64  }
65 
66  if(!fWriter2.is_open()){
67  G4cout<<"\nXAlminumElectrodeSensitivity::Constructor: ";
68  G4cout<<"\n\tFailed to open timing.ssv for appending data.";
69  G4cout<<"\n\tCreating timing.ssv.";
70  fWriter2.open("timing.ssv");
71  }
72 
73  if(!(fWriter.is_open() && fWriter2.is_open())){
74  G4cout<<"\nXAlminumElectrodeSensitivity::Constructor: ERROR: COULD NOT CREATE OUTPUT FILES FOR WRITING";
75  }
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
79 
81  fWriter.close();
82  fWriter2.close();
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
86 
88  return hitsCollection;
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
92 
94 {
97  if(HCID<0)
100 }
101 
102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
103 
105 {
106  //if(aStep->GetTrack()->GetDefinition()!=Phonon::PhononDefinition()) return true;
107  G4double edp = aStep->GetNonIonizingEnergyDeposit();
108  if(edp==0.) return true;
109 
110  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
111  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
112  G4TouchableHistory* theTouchable
113  = (G4TouchableHistory*)(preStepPoint->GetTouchable());
114  G4ThreeVector fWorldPos = postStepPoint->GetPosition();
115  G4ThreeVector fLocalPos
116  = theTouchable->GetHistory()->GetTopTransform().TransformPoint(fWorldPos);
117 
119  aHit->SetTime(postStepPoint->GetGlobalTime());
120  aHit->SetEDep(edp);
121  aHit->SetWorldPos(fWorldPos);
122  aHit->SetLocalPos(fLocalPos);
123 
124  hitsCollection->insert(aHit);
125 
126  fWriter<<"\n"<<fWorldPos.getX()/mm
127  <<","<<fWorldPos.getY()/mm
128  <<","<<fWorldPos.getZ()/mm;
129 
130  fWriter2<<"\n"<<postStepPoint->GetGlobalTime()/ns<<" "
131  <<aHit->GetEDep()/eV;
132 
133  return true;
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
137 
139 {;}
140