ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
LUCID
LUCID_G4_SD
src
LUCID_SensitiveDetector.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
// Class header
7
#include "
LUCID_SensitiveDetector.h
"
8
9
// Package headers
10
#include "
LUCID_HitHelper.h
"
11
12
// Athena headers
13
#include "
HitManagement/HitCollectionMap.h
"
14
#include "
LUCID_GeoModel/LUCID_Constants.h
"
15
#include "
MCTruth/AtlasG4EventUserInfo.h
"
16
#include "
MCTruth/TrackHelper.h
"
17
18
19
// Geant4 headers
20
#include "G4Step.hh"
21
#include "G4Track.hh"
22
#include "G4VProcess.hh"
23
#include "G4OpticalPhoton.hh"
24
25
// CLHEP headers
26
#include "CLHEP/Units/PhysicalConstants.h"
27
28
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29
30
LUCID_SensitiveDetector::LUCID_SensitiveDetector
(
const
std::string& name,
const
std::string& hitCollectionName)
31
: G4VSensitiveDetector( name )
32
,
m_hitCollectionName
( hitCollectionName )
33
{
34
m_hit
=
new
LUCID_HitHelper
();
35
}
36
37
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
38
// Initialize from G4.
39
void
LUCID_SensitiveDetector::Initialize
(G4HCofThisEvent *)
40
{
41
m_HitColl
=
getHitCollection
();
42
}
43
44
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45
46
bool
LUCID_SensitiveDetector::ProcessHits
(G4Step* aStep, G4TouchableHistory*) {
47
if
(!
m_HitColl
) {
48
m_HitColl
=
getHitCollection
();
49
if
(!
m_HitColl
) {
50
return
false
;
51
}
52
}
53
54
if
(verboseLevel>5)
55
{
56
G4cout <<
"LUCID_SensitiveDetector::ProcessHits - Begin"
<< G4endl;
57
}
58
G4Track* aTrack = aStep->GetTrack();
59
60
if
(aTrack->GetDefinition() != G4OpticalPhoton::OpticalPhotonDefinition())
return
false
;
61
62
if
(verboseLevel>5)
63
{
64
G4cout <<
"LUCID_SensitiveDetector::ProcessHits(): There is an OpticalPhoton "
<< G4endl;
65
}
66
67
aTrack->SetTrackStatus(fKillTrackAndSecondaries);
68
69
if
(aTrack->GetCreatorProcess()->GetProcessName() !=
"Cerenkov"
)
return
false
;
70
71
if
(verboseLevel>5)
72
{
73
G4cout <<
"LUCID_SensitiveDetector::ProcessHits(): It is from a Cerenkov process "
<< G4endl;
74
}
75
76
TrackHelper
trHelp(aTrack);
77
double
energy = aTrack->GetKineticEnergy()/CLHEP::eV;
78
double
lambda =
m_hit
->GetWaveLength(energy);
79
80
m_HitColl
->Emplace(
m_hit
->GetTubNumber(aStep),
81
aTrack->GetDefinition()->GetPDGEncoding(),
82
trHelp.
GenerateParticleLink
(),
83
LUCID_HitHelper::GetVolNumber
(aTrack->GetLogicalVolumeAtVertex()->GetName()),
84
m_hit
->GetPreStepPoint (aStep).x(),
85
m_hit
->GetPreStepPoint (aStep).y(),
86
m_hit
->GetPreStepPoint (aStep).z(),
87
m_hit
->GetPostStepPoint(aStep).x(),
88
m_hit
->GetPostStepPoint(aStep).y(),
89
m_hit
->GetPostStepPoint(aStep).z(),
90
m_hit
->GetPreStepTime (aStep),
91
m_hit
->GetPostStepTime (aStep),
92
lambda,
93
energy);
94
return
true
;
95
}
96
97
LUCID_SimHitCollection
*
LUCID_SensitiveDetector::getHitCollection
()
const
98
{
99
auto
* eventInfo =
AtlasG4EventUserInfo::GetEventUserInfo
();
100
if
(!eventInfo) {
101
return
nullptr
;
102
}
103
auto
hitCollections = eventInfo->GetHitCollectionMap();
104
return
hitCollections ? hitCollections->Find<
LUCID_SimHitCollection
>(
m_hitCollectionName
) :
nullptr
;
105
}
AtlasG4EventUserInfo.h
HitCollectionMap.h
LUCID_Constants.h
LUCID_HitHelper.h
LUCID_SensitiveDetector.h
LUCID_SimHitCollection
AtlasHitsVector< LUCID_SimHit > LUCID_SimHitCollection
Definition
LUCID_SimHitCollection.h:12
TrackHelper.h
AtlasG4EventUserInfo::GetEventUserInfo
static AtlasG4EventUserInfo * GetEventUserInfo()
Definition
AtlasG4EventUserInfo.h:96
LUCID_HitHelper
Definition
LUCID_HitHelper.h:24
LUCID_HitHelper::GetVolNumber
static int GetVolNumber(const G4String &)
Definition
LUCID_HitHelper.cxx:9
LUCID_SensitiveDetector::LUCID_SensitiveDetector
LUCID_SensitiveDetector(const std::string &name, const std::string &hitCollectionName)
Definition
LUCID_SensitiveDetector.cxx:30
LUCID_SensitiveDetector::m_hit
LUCID_HitHelper * m_hit
Definition
LUCID_SensitiveDetector.h:58
LUCID_SensitiveDetector::m_HitColl
LUCID_SimHitCollection * m_HitColl
Definition
LUCID_SensitiveDetector.h:57
LUCID_SensitiveDetector::ProcessHits
bool ProcessHits(G4Step *, G4TouchableHistory *) override final
Definition
LUCID_SensitiveDetector.cxx:46
LUCID_SensitiveDetector::getHitCollection
LUCID_SimHitCollection * getHitCollection() const
Definition
LUCID_SensitiveDetector.cxx:97
LUCID_SensitiveDetector::m_hitCollectionName
std::string m_hitCollectionName
Definition
LUCID_SensitiveDetector.h:55
LUCID_SensitiveDetector::Initialize
void Initialize(G4HCofThisEvent *) override final
Definition
LUCID_SensitiveDetector.cxx:39
TrackHelper
Definition
TrackHelper.h:20
TrackHelper::GenerateParticleLink
HepMcParticleLink GenerateParticleLink()
Generates a new HepMcParticleLink object on the stack based on the generation-zero unique id,...
Definition
TrackHelper.h:75
Generated on
for ATLAS Offline Software by
1.17.0