Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
extended
parameterisations
gflash
src
ExGflashSensitiveDetector.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
// Created by Joanna Weng 26.11.2004
30
#include "
ExGflashSensitiveDetector.hh
"
31
#include "
ExGflashHitsCollection.hh
"
32
#include "
ExGflashHit.hh
"
33
#include "
G4VPhysicalVolume.hh
"
34
#include "
G4Step.hh
"
35
#include "
G4VTouchable.hh
"
36
#include "
G4TouchableHistory.hh
"
37
#include "
G4SDManager.hh
"
38
#include <iostream>
39
using namespace
std;
40
//WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
41
ExGflashSensitiveDetector::ExGflashSensitiveDetector
(
G4String
name
,
ExGflashDetectorConstruction
* det):
42
G4VSensitiveDetector
(name),
G4VGFlashSensitiveDetector
(), Detector(det)
43
{
44
//@@@@ xN08SensitiveDetector:: evtl name im constructor des G4VGFlashSensitiveDetector ?
45
G4String
caloname=
"ExGflashCollection"
;
46
collectionName
.
insert
(caloname);
47
}
48
49
ExGflashSensitiveDetector::~ExGflashSensitiveDetector
() {}
50
51
void
ExGflashSensitiveDetector::Initialize
(
G4HCofThisEvent
*HCE)
52
{
53
G4cout
<<
"::Initializing the sensitive detector"
<<
G4endl
;
54
static
G4int
HCID = -1;
55
if
(HCID<0){ HCID =
GetCollectionID
(0); }
56
caloHitsCollection=
new
57
ExGflashHitsCollection
(
SensitiveDetectorName
,
collectionName
[0]);
// first collection
58
HCE->
AddHitsCollection
( HCID, caloHitsCollection );
59
}
60
61
void
ExGflashSensitiveDetector::EndOfEvent
(
G4HCofThisEvent
*HCE)
62
{
63
if
(HCE){;}
64
// No Hadronic
65
// cout<<"IEndOfEvent " << HCID << endl;
66
}
67
68
G4bool
ExGflashSensitiveDetector::ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
* ROhist)
69
{
//cout<<"This is ProcessHits"<<endl;
70
G4double
e
=aStep->
GetTotalEnergyDeposit
();
71
if
(e<=0.)
return
false
;
72
73
G4TouchableHistory
* theTouchable
74
= (
G4TouchableHistory
*)(aStep->
GetPreStepPoint
()->
GetTouchable
());
75
76
// enrgy deposited -> make Hit
77
//const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
78
//G4TouchableHistory* theTouchable = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
79
ExGflashHit
* caloHit=
new
ExGflashHit
();
80
caloHit->
SetEdep
(e);
81
caloHit->
SetPos
(aStep->
GetPreStepPoint
()->
GetPosition
());
82
caloHitsCollection->
insert
(caloHit);
83
if
(ROhist){;}
84
G4VPhysicalVolume
* physVol = theTouchable->
GetVolume
();
85
G4int
crystalnum=0;
86
for
(
int
i=0;i<100;i++)
//@@@@@@@ ExGflashSensitiveDetector:vorsichty
87
{
88
if
(physVol == Detector->
GetCristal
(i)) crystalnum= i;
89
}
90
caloHit->
SetCrystalNum
(crystalnum);
91
92
return
true
;
93
}
94
95
// Separate GFLASH interface
96
G4bool
ExGflashSensitiveDetector::ProcessHits
(
G4GFlashSpot
*aSpot ,
G4TouchableHistory
* ROhist)
97
{
//cout<<"This is ProcessHits GFLASH"<<endl;
98
G4double
e
=aSpot->
GetEnergySpot
()->
GetEnergy
();
99
if
(e<=0.)
return
false
;
100
101
G4VPhysicalVolume
* pCurrentVolume = aSpot->
GetTouchableHandle
()->
GetVolume
();
102
103
ExGflashHit
* caloHit=
new
ExGflashHit
();
104
caloHit->
SetEdep
(e);
105
caloHit->
SetPos
(aSpot->
GetEnergySpot
()->
GetPosition
());
106
caloHitsCollection->
insert
(caloHit);
107
if
(ROhist){;}
108
//cout <<pCurrentVolume->GetName() << endl;
109
G4int
crystalnum=0;
110
for
(
int
i=0;i<100;i++)
//@@@@@@@ ExGflashSensitiveDetector:vorsichty
111
{
112
if
(pCurrentVolume == Detector->
GetCristal
(i)) crystalnum= i;
113
}
114
caloHit->
SetCrystalNum
(crystalnum);
115
116
return
true
;
117
}
Generated on Sat May 25 2013 14:33:00 for Geant4 by
1.8.4