Skip to content

Commit 8f439a1

Browse files
committed
coated thickness unit inverted
1 parent 233b356 commit 8f439a1

File tree

2 files changed

+30
-43
lines changed

2 files changed

+30
-43
lines changed

common/data/Materials/Surf_Generic_Photocathode_20nm.dat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"jConstProperties": {
66
"COATEDTHICKNESS": {
77
"jValue": 20,
8-
"jUnit": "nm",
9-
"jInvertUnit" : ""
8+
"jUnit": "nm"
109
}
1110
},
1211
"jProperties": {

common/framework/src/OMSimSensitiveDetector.cc

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ OMSimSensitiveDetector::~OMSimSensitiveDetector()
4545

4646
/**
4747
* @brief Fetches the boundary process for detecting boundary absorptions.
48-
*
49-
* Retrieves and stores the `G4OpBoundaryProcess` to check for photon detection
48+
*
49+
* Retrieves and stores the `G4OpBoundaryProcess` to check for photon detection
5050
* at boundaries. Logs an error if the process is not found.
5151
*/
5252
void OMSimSensitiveDetector::fetchBoundaryProcess()
@@ -78,58 +78,50 @@ void OMSimSensitiveDetector::setPMTResponse(OMSimPMTResponse *p_response)
7878

7979
/**
8080
* @brief Processes hits for optical photons in the detector.
81-
*
82-
* If the detector type is one of the perfect detectors (100% efficient),
83-
* the photon hit is registered directly. Otherwise, it checks for volume
81+
*
82+
* If the detector type is one of the perfect detectors (100% efficient),
83+
* the photon hit is registered directly. Otherwise, it checks for volume
8484
* or boundary absorption based on the detector type.
85-
*
85+
*
8686
* @param p_step The current step information.
8787
* @param p_touchableHistory The history of touchable objects.
8888
* @return True if the photon hit was stored, false otherwise.
8989
*/
9090
G4bool OMSimSensitiveDetector::ProcessHits(G4Step *p_step, G4TouchableHistory *p_touchableHistory)
9191
{
92-
if (p_step->GetTrack()->GetDefinition() == G4OpticalPhoton::Definition()) // check if particle is a photon
93-
{
94-
95-
switch (m_detectorType)
96-
{
97-
case DetectorType::PerfectVolumePhotonDetector: // 100% efficient VolumePhotonDetector
98-
return handleGeneralPhotonDetector(p_step, p_touchableHistory);
92+
if (p_step->GetTrack()->GetDefinition() != G4OpticalPhoton::Definition())
93+
return false;
9994

100-
case DetectorType::PerfectBoundaryPhotonDetector: // 100% efficient BoundaryPhotonDetector
101-
return handleGeneralPhotonDetector(p_step, p_touchableHistory);
95+
if (DetectorType::PerfectVolumePhotonDetector == m_detectorType || DetectorType::PerfectBoundaryPhotonDetector == m_detectorType || DetectorType::PerfectPMT == m_detectorType)
96+
{
97+
if (m_detectorType == DetectorType::PerfectPMT) return handlePMT(p_step, p_touchableHistory);
98+
return handleGeneralPhotonDetector(p_step, p_touchableHistory);
99+
}
102100

103-
case DetectorType::PerfectPMT: // 100% efficient PMT
104-
return handlePMT(p_step, p_touchableHistory);
105-
}
101+
if (m_detectorType == DetectorType::VolumePhotonDetector)
102+
{
106103
if (checkVolumeAbsorption(p_step))
107104
{
108-
switch (m_detectorType)
109-
{
110-
case DetectorType::VolumePhotonDetector:
111-
return handleGeneralPhotonDetector(p_step, p_touchableHistory);
112-
}
105+
return handleGeneralPhotonDetector(p_step, p_touchableHistory);
113106
}
114-
else if (checkBoundaryAbsorption(p_step))
107+
}
108+
109+
else if (checkBoundaryAbsorption(p_step)) //if none of the above, it is a boundary photon detector
110+
{
111+
switch (m_detectorType)
115112
{
116-
switch (m_detectorType)
117-
{
118-
case DetectorType::BoundaryPhotonDetector:
119-
return handleGeneralPhotonDetector(p_step, p_touchableHistory);
120-
case DetectorType::PMT:
121-
return handlePMT(p_step, p_touchableHistory);
122-
}
113+
case DetectorType::PMT:
114+
return handlePMT(p_step, p_touchableHistory);
115+
case DetectorType::BoundaryPhotonDetector:
116+
return handleGeneralPhotonDetector(p_step, p_touchableHistory);
123117
}
124118
}
125-
126119
return false;
127120
}
128121

129-
130122
/**
131123
* @brief Retrieves photon information from a given step.
132-
*
124+
*
133125
* @param p_step The current step information.
134126
* @return PhotonInfo struct containing the photon details.
135127
*/
@@ -156,10 +148,9 @@ PhotonInfo OMSimSensitiveDetector::getPhotonInfo(G4Step *p_step)
156148
return info;
157149
}
158150

159-
160151
/**
161152
* @brief Checks if the photon was absorbed in the volume.
162-
*
153+
*
163154
* @param p_step The current step information.
164155
* @return True if the photon was absorbed, false otherwise.
165156
*/
@@ -168,7 +159,6 @@ G4bool OMSimSensitiveDetector::checkVolumeAbsorption(G4Step *p_step)
168159
return p_step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == "OpAbsorption";
169160
}
170161

171-
172162
/**
173163
* @brief Checks if the photon was detected at a boundary.
174164
* @param p_step The current step information.
@@ -200,10 +190,9 @@ G4bool OMSimSensitiveDetector::checkBoundaryAbsorption(G4Step *p_step)
200190
*/
201191
bool OMSimSensitiveDetector::isPhotonDetected(double p_efficiency)
202192
{
203-
return G4UniformRand() < p_efficiency;
193+
return G4UniformRand() < p_efficiency;
204194
}
205195

206-
207196
/**
208197
* @brief Handles hits for PMT detectors.
209198
* @param p_step The current step information.
@@ -215,7 +204,7 @@ G4bool OMSimSensitiveDetector::handlePMT(G4Step *p_step, G4TouchableHistory *p_t
215204
PhotonInfo info = getPhotonInfo(p_step);
216205

217206
// if QE cut is enabled, check if photon is detected (using detection probability, if detail PMT is enabled)
218-
if (m_QEcut && !isPhotonDetected(info.PMTResponse.detectionProbability))
207+
if (m_QEcut && !isPhotonDetected(info.PMTResponse.detectionProbability))
219208
return false;
220209
else if (m_QEcut)
221210
info.PMTResponse.detectionProbability = 1; // if QE cut is enabled, detection probability is 1 as photon was detected
@@ -282,4 +271,3 @@ void OMSimSensitiveDetector::killParticle(G4Track *p_track)
282271
p_track->SetTrackStatus(fStopAndKill);
283272
}
284273
}
285-

0 commit comments

Comments
 (0)