27 {
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 G4StepPoint* fakePreStepPoint = fakeStep->GetPreStepPoint();
44 G4StepPoint* fakePostStepPoint = fakeStep->GetPostStepPoint();
45 G4TouchableHandle a_touchableHandle = fakePreStepPoint->GetTouchableHandle();
46
47
48
49
50
51
52
53
54 std::vector<G4double> energies;
55 energies.resize(4,0.);
56 energies[3] = fakeStep->GetTotalEnergyDeposit();
57
58
59
60
61
62
63
64 G4VPhysicalVolume* physicalVolume = a_touchableHandle->GetVolume();
65
66
68 {
69#ifdef DEBUG_PROCESS
70 G4cout << "ZdcG4::ZDC_EscapedEnergyProcessing::Process - "
71 << " particle created in volume '"
72 << physicalVolume->GetName()
73 << "'" << G4endl;
74#endif
75
76 G4LogicalVolume* logicalVolume = physicalVolume->GetLogicalVolume();
77
78
79
80 fakePreStepPoint->SetMaterial( logicalVolume->GetMaterial() );
81 fakePostStepPoint->SetMaterial( logicalVolume->GetMaterial() );
82
83
84 G4VSensitiveDetector* sensitiveDetector =
85 logicalVolume->GetSensitiveDetector();
86
88#ifdef DEBUG_PROCESS
89 G4cout << " ... which has sensitive detector '" << sensitiveDetector->GetName() << "'" << G4endl;
90#endif
91 ZDC_G4CalibSD* zdcG4CalibSD(nullptr);
92 G4MultiSensitiveDetector* zdcG4MultSD = dynamic_cast<G4MultiSensitiveDetector*>(sensitiveDetector);
93
94 if(zdcG4MultSD !=0){
96 for(
unsigned int i=0;
i<zdcG4MultSD->GetSize();
i++){
97 zdcG4CalibSD = dynamic_cast<ZDC_G4CalibSD*>(zdcG4MultSD->GetSD(i));
98 if (zdcG4CalibSD){
99
101#ifdef DEBUG_PROCESS
102 G4cout << " ... which contains calibration sensitive detector '" << zdcG4CalibSD->GetName() << "'" << G4endl;
103#endif
104 zdcG4CalibSD->SpecialHit(fakeStep,energies);
105 }
106 }
108#ifdef DEBUG_PROCESS
109 G4cout << "ZdcG4::ZDC_EscapedEnergyProcessing::Process - "
110 << " particle (x,y,z)=("
111 << a_point.x() << ","
112 << a_point.y() << ","
113 << a_point.z() << ") with energy="
114 << a_energy
115 << " was created in volume '"
116 << physicalVolume->GetName()
117 << "'; could not find a CalibrationSensitiveDetector"
118 << " within ZdcG4MultSD'"
119 << zdcG4MultSD->GetName() << "'"
120 << G4endl;
121 G4cout << " Using default sensitive detector." << G4endl;
122#endif
124 return false;
125 }
126
127 } else {
128
129 zdcG4CalibSD = dynamic_cast<ZDC_G4CalibSD*>(sensitiveDetector);
131#ifdef DEBUG_PROCESS
132 G4cout << " ... which is a ZDC_G4CalibSD " << G4endl;
133#endif
134 zdcG4CalibSD->SpecialHit( fakeStep, energies );
135 }
136 else
137 {
138
139
140
141 ZDC_G4CalibSD* calibSD = dynamic_cast<ZDC_G4CalibSD*>(sensitiveDetector);
142 if ( calibSD != 0 ){
143
144#ifdef DEBUG_PROCESS
145 G4cout << " ... which is a calibration sensitive detector " << G4endl;
146#endif
148 } else {
149#ifdef DEBUG_PROCESS
150 G4cout << "ZdcG4::ZDC_EscapedEnergyProcessing::Process - "
151 << " particle (x,y,z)=("
152 << a_point.x() << ","
153 << a_point.y() << ","
154 << a_point.z() << ") with energy="
155 << a_energy
156 << " was created in volume '"
157 << physicalVolume->GetName()
158 << "' with sensitive detector '"
159 << sensitiveDetector->GetName()
160 << "' which is not a CalibrationSensitiveDetector."
161 << G4endl;
162 G4cout << " Using default sensitive detector." << G4endl;
163#endif
164
166 return false;
167 }
168 }
169 }
170 } else {
171
172
173#ifdef DEBUG_PROCESS
174 G4cout << "ZdcG4::ZDC_EscapedEnergyProcessing::Process - "
175 << " particle (x,y,z)=("
176 << a_point.x() << ","
177 << a_point.y() << ","
178 << a_point.z() << ") with energy="
179 << a_energy
180 << " was created in volume '"
181 << physicalVolume->GetName()
182 << "' which is not sensitive."
183 << G4endl;
184 G4cout << " Using default sensitive detector." << G4endl;
185#endif
187 return false;
188 }
189 }
190
191
192 return true;
193}
G4bool SpecialHit(G4Step *a_step, const std::vector< G4double > &a_energies)