ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ExGflash2SensitiveDetector.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ExGflash2SensitiveDetector.cc
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
//
29
//
30
// Created by Joanna Weng 26.11.2004
31
#include "
ExGflash2SensitiveDetector.hh
"
32
#include "ExGflashHit.hh"
33
#include "
G4GFlashSpot.hh
"
34
#include "
ExGflash2DetectorConstruction.hh
"
35
#include "
G4VPhysicalVolume.hh
"
36
#include "
G4Step.hh
"
37
#include "
G4VTouchable.hh
"
38
#include "
G4TouchableHistory.hh
"
39
40
//WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
41
42
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44
ExGflash2SensitiveDetector::ExGflash2SensitiveDetector
(
G4String
name
,
45
ExGflash2DetectorConstruction
* det)
46
:
G4VSensitiveDetector
(name),
G4VGFlashSensitiveDetector
(), fDetector(det), fHCID(-1)
47
{
48
G4String
caloname=
"ExGflashCollection"
;
49
collectionName
.
insert
(caloname);
50
}
51
52
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
54
ExGflash2SensitiveDetector::~ExGflash2SensitiveDetector
()
55
{}
56
57
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58
59
void
ExGflash2SensitiveDetector::Initialize
(
G4HCofThisEvent
* HCE)
60
{
61
if
(
fHCID
<0){
fHCID
=
GetCollectionID
(0); }
62
fCaloHitsCollection
=
new
63
ExGflashHitsCollection
(
SensitiveDetectorName
,
collectionName
[0]);
// first collection
64
HCE->
AddHitsCollection
(
fHCID
,
fCaloHitsCollection
);
65
}
66
67
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68
69
void
ExGflash2SensitiveDetector::EndOfEvent
(
G4HCofThisEvent
*)
70
{}
71
72
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73
74
G4bool
ExGflash2SensitiveDetector::ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
* ROhist)
75
{
76
G4double
e
=aStep->
GetTotalEnergyDeposit
();
77
if
(e<=0.)
return
false
;
78
79
G4TouchableHistory
* theTouchable
80
= (
G4TouchableHistory
*)(aStep->
GetPreStepPoint
()->
GetTouchable
());
81
82
// enrgy deposited -> make Hit
83
//const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
84
//G4TouchableHistory* theTouchable =
85
// (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
86
ExGflashHit
* caloHit=
new
ExGflashHit
();
87
caloHit->
SetEdep
(e);
88
caloHit->
SetPos
(aStep->
GetPreStepPoint
()->
GetPosition
());
89
fCaloHitsCollection
->
insert
(caloHit);
90
if
(ROhist){;}
91
G4VPhysicalVolume
* physVol = theTouchable->
GetVolume
();
92
G4int
crystalnum=0;
93
for
(
int
i=0;i<100;i++)
//@@@@@@@ ExGflash2SensitiveDetector:vorsichty
94
{
95
if
(physVol ==
fDetector
->
GetCristal
(i)) crystalnum= i;
96
}
97
caloHit->
SetCrystalNum
(crystalnum);
98
99
return
true
;
100
}
101
102
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103
104
// Separate GFLASH interface
105
G4bool
ExGflash2SensitiveDetector::ProcessHits
(
G4GFlashSpot
*aSpot ,
G4TouchableHistory
* ROhist)
106
{
//cout<<"This is ProcessHits GFLASH"<<endl;
107
G4double
e
=aSpot->
GetEnergySpot
()->
GetEnergy
();
108
if
(e<=0.)
return
false
;
109
110
G4VPhysicalVolume
* pCurrentVolume = aSpot->
GetTouchableHandle
()->
GetVolume
();
111
112
ExGflashHit
* caloHit=
new
ExGflashHit
();
113
caloHit->
SetEdep
(e);
114
caloHit->
SetPos
(aSpot->
GetEnergySpot
()->
GetPosition
());
115
fCaloHitsCollection
->
insert
(caloHit);
116
if
(ROhist){;}
117
//cout <<pCurrentVolume->GetName() << endl;
118
G4int
crystalnum=0;
119
for
(
int
i=0;i<100;i++)
//@@@@@@@ ExGflash2SensitiveDetector:vorsichty
120
{
121
if
(pCurrentVolume ==
fDetector
->
GetCristal
(i)) crystalnum= i;
122
}
123
caloHit->
SetCrystalNum
(crystalnum);
124
125
return
true
;
126
}
127
128
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129
geant4
tree
geant4-10.6-release
examples
extended
parameterisations
gflash
gflash2
src
ExGflash2SensitiveDetector.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:09
using
1.8.2 with
ECCE GitHub integration