Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
XAluminumElectrodeSensitivity Class Reference

#include <XAluminumElectrodeSensitivity.hh>

Inheritance diagram for XAluminumElectrodeSensitivity:
Collaboration diagram for XAluminumElectrodeSensitivity:

Public Member Functions

 XAluminumElectrodeSensitivity (const G4String &)
 
virtual ~XAluminumElectrodeSensitivity ()
 
virtual void Initialize (G4HCofThisEvent *)
 
virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
XAluminumElectrodeHitsCollectionGetHitsCollection ()
 
- Public Member Functions inherited from G4VSensitiveDetector
 G4VSensitiveDetector (G4String name)
 
 G4VSensitiveDetector (const G4VSensitiveDetector &right)
 
virtual ~G4VSensitiveDetector ()
 
G4VSensitiveDetectoroperator= (const G4VSensitiveDetector &right)
 
G4int operator== (const G4VSensitiveDetector &right) const
 
G4int operator!= (const G4VSensitiveDetector &right) const
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void PrintAll ()
 
G4bool Hit (G4Step *aStep)
 
void SetROgeometry (G4VReadOutGeometry *value)
 
void SetFilter (G4VSDFilter *value)
 
G4int GetNumberOfCollections () const
 
G4String GetCollectionName (G4int id) const
 
void SetVerboseLevel (G4int vl)
 
void Activate (G4bool activeFlag)
 
G4bool isActive () const
 
G4String GetName () const
 
G4String GetPathName () const
 
G4String GetFullPathName () const
 
G4VReadOutGeometryGetROgeometry () const
 
G4VSDFilterGetFilter () const
 
virtual G4VSensitiveDetectorClone () const
 

Protected Member Functions

void WriteHitInfo (const XAluminumElectrodeHit *aHit)
 
- Protected Member Functions inherited from G4VSensitiveDetector
virtual G4int GetCollectionID (G4int i)
 

Additional Inherited Members

- Protected Attributes inherited from G4VSensitiveDetector
G4CollectionNameVector collectionName
 
G4String SensitiveDetectorName
 
G4String thePathName
 
G4String fullPathName
 
G4int verboseLevel
 
G4bool active
 
G4VReadOutGeometryROgeometry
 
G4VSDFilterfilter
 

Detailed Description

Definition at line 45 of file XAluminumElectrodeSensitivity.hh.

Constructor & Destructor Documentation

XAluminumElectrodeSensitivity::XAluminumElectrodeSensitivity ( const G4String name)

Definition at line 54 of file XAluminumElectrodeSensitivity.cc.

55  : G4VSensitiveDetector(name) {
56  collectionName.insert("XAluminumElectrodeHit");
57  fHCID = -1;
58 
59  G4AutoLock lockIt(&theMutex); // Only one thread opens files!
60  fWriter = new std::fstream("caustic.ssv",std::fstream::out|std::fstream::ate);
61  if (!fWriter->is_open()) {
62  G4cerr << "XAluminumElectrodeSensitivity::Constructor:"
63  << "\n\tFailed to open caustic.ssv for appending data."
64  << "\n\tCreating caustic.ssv" << G4endl;
65  fWriter->open("caustic.ssv");
66  }
67 
68  fWriter2 = new std::fstream("timing.ssv",std::fstream::out|std::fstream::ate);
69  if (!fWriter2->is_open()) {
70  G4cerr << "XAluminumElectrodeSensitivity::Constructor: "
71  << "\n\tFailed to open timing.ssv for appending data."
72  << "\n\tCreating timing.ssv." << G4endl;
73  fWriter2->open("timing.ssv");
74  }
75 
76  if (!(fWriter->is_open() && fWriter2->is_open())) {
77  G4cerr << "XAluminumElectrodeSensitivity::Constructor: "
78  << "\nERROR: COULD NOT CREATE OUTPUT FILES FOR WRITING" << G4endl;
79  }
80 }
G4VSensitiveDetector(G4String name)
#define G4endl
Definition: G4ios.hh:61
G4CollectionNameVector collectionName
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

XAluminumElectrodeSensitivity::~XAluminumElectrodeSensitivity ( )
virtual

Definition at line 84 of file XAluminumElectrodeSensitivity.cc.

84  {
85  G4AutoLock lockIt(&theMutex); // Only one thread deletes!
86 
87  if (fWriter) {
88  fWriter->close();
89  delete fWriter; fWriter = 0;
90  }
91 
92  if (fWriter2) {
93  fWriter2->close();
94  delete fWriter2; fWriter2 = 0;
95  }
96 }

Member Function Documentation

void XAluminumElectrodeSensitivity::EndOfEvent ( G4HCofThisEvent )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 147 of file XAluminumElectrodeSensitivity.cc.

147  {
148  if (!fHitsCollection || fHitsCollection->GetSize()==0) return;
149 
150  for (size_t i=0; i<fHitsCollection->GetSize(); i++) {
151  WriteHitInfo(dynamic_cast<XAluminumElectrodeHit*>(fHitsCollection->GetHit(i)));
152  }
153 }
virtual G4VHit * GetHit(size_t i) const
void WriteHitInfo(const XAluminumElectrodeHit *aHit)
virtual size_t GetSize() const

Here is the call graph for this function:

XAluminumElectrodeHitsCollection * XAluminumElectrodeSensitivity::GetHitsCollection ( )

Definition at line 101 of file XAluminumElectrodeSensitivity.cc.

101  {
102  return fHitsCollection;
103 }
void XAluminumElectrodeSensitivity::Initialize ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 107 of file XAluminumElectrodeSensitivity.cc.

108 {
109  fHitsCollection =
111  collectionName[0]);
112  if (fHCID<0)
113  { fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection); }
114  HCE->AddHitsCollection(fHCID,fHitsCollection);
115 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
G4THitsCollection< XAluminumElectrodeHit > XAluminumElectrodeHitsCollection
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4CollectionNameVector collectionName

Here is the call graph for this function:

G4bool XAluminumElectrodeSensitivity::ProcessHits ( G4Step aStep,
G4TouchableHistory  
)
virtual

Implements G4VSensitiveDetector.

Definition at line 119 of file XAluminumElectrodeSensitivity.cc.

121 {
122  //if(aStep->GetTrack()->GetDefinition()!=Phonon::PhononDefinition()) return true;
123  G4double edp = aStep->GetNonIonizingEnergyDeposit();
124  if(edp==0.) return true;
125 
126  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
127  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
128  G4TouchableHistory* theTouchable
129  = (G4TouchableHistory*)(preStepPoint->GetTouchable());
130  G4ThreeVector fWorldPos = postStepPoint->GetPosition();
131  G4ThreeVector fLocalPos
132  = theTouchable->GetHistory()->GetTopTransform().TransformPoint(fWorldPos);
133 
135  aHit->fTime = postStepPoint->GetGlobalTime();
136  aHit->fEdep = edp;
137  aHit->fWorldPos = fWorldPos;
138  aHit->fLocalPos = fLocalPos;
139 
140  fHitsCollection->insert(aHit);
141 
142  return true;
143 }
G4double GetNonIonizingEnergyDeposit() const
G4int insert(T *aHit)
const G4VTouchable * GetTouchable() const
G4StepPoint * GetPreStepPoint() const
const G4ThreeVector & GetPosition() const
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const
G4StepPoint * GetPostStepPoint() const
G4double GetGlobalTime() const
const G4AffineTransform & GetTopTransform() const
const G4NavigationHistory * GetHistory() const
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

void XAluminumElectrodeSensitivity::WriteHitInfo ( const XAluminumElectrodeHit aHit)
protected

Definition at line 158 of file XAluminumElectrodeSensitivity.cc.

158  {
159  if (!aHit) return;
160 
161  G4AutoLock lockIt(&theMutex); // Only one event can write at a time
162 
163  *fWriter << "\n" << aHit->fWorldPos.getX()/mm
164  << "," << aHit->fWorldPos.getY()/mm
165  << "," << aHit->fWorldPos.getZ()/mm;
166 
167  *fWriter2 << "\n" << aHit->fTime/ns << " " << aHit->fEdep/eV;
168 }
static constexpr double mm
Definition: G4SIunits.hh:115
double getY() const
double getX() const
static constexpr double eV
Definition: G4SIunits.hh:215
double getZ() const
#define ns
Definition: xmlparse.cc:614

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: