ATLAS Offline Software
Loading...
Searching...
No Matches
AFP_SiDSensitiveDetector Class Reference

#include <AFP_SiDSensitiveDetector.h>

Inheritance diagram for AFP_SiDSensitiveDetector:
Collaboration diagram for AFP_SiDSensitiveDetector:

Public Member Functions

 AFP_SiDSensitiveDetector (const std::string &name, const std::string &hitCollectionName)
 ~AFP_SiDSensitiveDetector ()
void Initialize (G4HCofThisEvent *) override final
G4bool ProcessHits (G4Step *, G4TouchableHistory *) override final
template<class... Args>
void AddHit (Args &&... args)
 Templated method to stuff a single hit into the sensitive detector class.

Private Member Functions

 FRIEND_TEST (AFP_SiDSensitiveDetectortest, ProcessHits)
 FRIEND_TEST (AFP_SiDSensitiveDetectortest, AddHit)
AFP_SIDSimHitCollectionBuildergetHitCollection () const

Private Attributes

int m_nHitID
float m_delta_pixel_x
float m_delta_pixel_y
float m_death_edge [4][10]
float m_lower_edge [4][10]
std::string m_hitCollectionName
AFP_SIDSimHitCollectionBuilderm_HitColl {}

Detailed Description

Definition at line 22 of file AFP_SiDSensitiveDetector.h.

Constructor & Destructor Documentation

◆ AFP_SiDSensitiveDetector()

AFP_SiDSensitiveDetector::AFP_SiDSensitiveDetector ( const std::string & name,
const std::string & hitCollectionName )

Definition at line 33 of file AFP_SiDSensitiveDetector.cxx.

34 : G4VSensitiveDetector( name )
35 , m_nHitID(-1)
36 , m_delta_pixel_x(0.050)
37 , m_delta_pixel_y(0.250)
38 , m_hitCollectionName(hitCollectionName)
39{
40 for( int i=0; i < 4; i++){
41 for( int j=0; j < 10; j++){
42 m_death_edge[i][j] = AFP_CONSTANTS::SiT_DeathEdge; //in mm, it is left edge as the movement is horizontal
44 }
45 }
46}
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
static constexpr double SiT_LowerEdge
static constexpr double SiT_DeathEdge

◆ ~AFP_SiDSensitiveDetector()

AFP_SiDSensitiveDetector::~AFP_SiDSensitiveDetector ( )
inline

Definition at line 32 of file AFP_SiDSensitiveDetector.h.

32{ /* I don't own myHitColl if all has gone well */ }

Member Function Documentation

◆ AddHit()

template<class... Args>
void AFP_SiDSensitiveDetector::AddHit ( Args &&... args)
inline

Templated method to stuff a single hit into the sensitive detector class.

This could get rather tricky, but the idea is to allow fast simulations to use the very same SD classes as the standard simulation.

Definition at line 41 of file AFP_SiDSensitiveDetector.h.

42 {
43 if (m_HitColl) {
44 m_HitColl->Emplace(std::forward<Args>(args)...);
45 }
46 }
AFP_SIDSimHitCollectionBuilder * m_HitColl

◆ FRIEND_TEST() [1/2]

AFP_SiDSensitiveDetector::FRIEND_TEST ( AFP_SiDSensitiveDetectortest ,
AddHit  )
private

◆ FRIEND_TEST() [2/2]

AFP_SiDSensitiveDetector::FRIEND_TEST ( AFP_SiDSensitiveDetectortest ,
ProcessHits  )
private

◆ getHitCollection()

AFP_SIDSimHitCollectionBuilder * AFP_SiDSensitiveDetector::getHitCollection ( ) const
private

Definition at line 518 of file AFP_SiDSensitiveDetector.cxx.

519{
520 auto* eventInfo = AtlasG4EventUserInfo::GetEventUserInfo();
521 if (!eventInfo) {
522 return nullptr;
523 }
524 auto hitCollections = eventInfo->GetHitCollectionMap();
525 return hitCollections ? hitCollections->Find<AFP_SIDSimHitCollectionBuilder>(m_hitCollectionName) : nullptr;
526}
static AtlasG4EventUserInfo * GetEventUserInfo()

◆ Initialize()

void AFP_SiDSensitiveDetector::Initialize ( G4HCofThisEvent * )
finaloverride

Definition at line 50 of file AFP_SiDSensitiveDetector.cxx.

51{
53}
AFP_SIDSimHitCollectionBuilder * getHitCollection() const

◆ ProcessHits()

bool AFP_SiDSensitiveDetector::ProcessHits ( G4Step * pStep,
G4TouchableHistory *  )
finaloverride

Definition at line 57 of file AFP_SiDSensitiveDetector.cxx.

58{
59 if (!m_HitColl) {
61 if (!m_HitColl) {
62 return false;
63 }
64 }
65
66 if(verboseLevel>5)
67 {
68 G4cout << "AFP_SiDSensitiveDetector::ProcessHits" << G4endl;
69 }
70
71 int nTrackID=-1;
72 int nParticleEncoding=-1;
73 float fKineticEnergy=0.0;
74 float fEnergyDeposit=0.0;
75 float fPreStepX=0.0;
76 float fPreStepY=0.0;
77 float fPreStepZ=0.0;
78 float fPostStepX=0.0;
79 float fPostStepY=0.0;
80 float fPostStepZ=0.0;
81 float fGlobalTime=0.0;
82 int nStationID=-1;
83 int nDetectorID=-1;
84 // int nPixelRow=-1;
85 // int nPixelCol=-1;
86
87 bool bIsSIDAuxVSID=false;
88
89 // step, track and particle info
90 G4Track* pTrack = pStep->GetTrack();
91 G4ParticleDefinition* pParticleDefinition = pTrack->GetDefinition();
92 G4StepPoint* pPreStepPoint = pStep->GetPreStepPoint();
93 G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
94 G4ThreeVector PreStepPointPos = pPreStepPoint->GetPosition();
95 G4ThreeVector PostStepPointPos = pPostStepPoint->GetPosition();
96
97 nTrackID=pTrack->GetTrackID();
98 fKineticEnergy = pPreStepPoint->GetKineticEnergy();
99 fEnergyDeposit = pStep->GetTotalEnergyDeposit();
100
101 fPreStepX = PreStepPointPos.x();
102 fPreStepY = PreStepPointPos.y();
103 fPreStepZ = PreStepPointPos.z();
104 fPostStepX = PostStepPointPos.x();
105 fPostStepY = PostStepPointPos.y();
106 fPostStepZ = PostStepPointPos.z();
107 nParticleEncoding = pParticleDefinition->GetPDGEncoding();
108 fGlobalTime = pStep->GetPreStepPoint()->GetGlobalTime()/CLHEP::picosecond; // time w.r.t. prestep or poststep ??
109
110 // name of physical volume
111 G4TouchableHandle touch1 = pPreStepPoint->GetTouchableHandle();
112 G4VPhysicalVolume* volume = touch1->GetVolume();
113 G4String VolumeName = volume->GetName();
114
115 //G4ThreeVector ph0 = pStep->GetDeltaPosition().unit();
116 //if (fKineticEnergy<10000. && ph0.y()>.2) pTrack->SetTrackStatus(fKillTrackAndSecondaries);
117 //if (VolumeName.contains("TDQuarticBar")) return 1;
118
119 if(verboseLevel>5)
120 {
121 G4cout << "hit volume name is " << VolumeName << G4endl;
122
123 G4cout << "global, x_pre: " << fPreStepX << ", y_pre: " << fPreStepY << ", z_pre: " << fPreStepZ << G4endl;
124 G4cout << "global, x_post: " << fPostStepX << ", y_post: " << fPostStepY << ", z_post: " << fPostStepZ << G4endl;
125 }
126 //scan station and detector id
127 char* ppv1, *ppv2;
128 char szbuff[32];
129 memset(&szbuff[0],0,sizeof(szbuff));
130 strncpy(szbuff,VolumeName.data(),sizeof(szbuff));
131 szbuff[sizeof(szbuff)-1] = '\0'; // idiomatic use of strncpy...
132 ppv1=strchr(szbuff,'[');
133 ppv2=strchr(szbuff,']');
134 if(!ppv2 || !ppv1){
135 G4cout << "ERROR: Invalid format of volume name " << VolumeName << G4endl;
136 return false;
137 }
138 else *ppv2='\0';
139
140 nStationID=10*(szbuff[3]-0x30)+(szbuff[4]-0x30);
141 nDetectorID=atoi(ppv1+1);
142
143 m_nHitID++;
144
146#if G4VERSION_NUMBER < 1100
147 if (VolumeName.contains("SIDSensor") || (bIsSIDAuxVSID=VolumeName.contains("SIDVacuumSensor"))){
148#else
149 if (G4StrUtil::contains(VolumeName, "SIDSensor") || (bIsSIDAuxVSID=G4StrUtil::contains(VolumeName, "SIDVacuumSensor"))){
150#endif
151
152 if(!bIsSIDAuxVSID && !(fEnergyDeposit>0.0))
153 {
154 //hit in SID sensor but with zero deposited energy (transportation)
155 }
156 else
157 {
158 if (bIsSIDAuxVSID)
159 {
160 m_HitColl->Emplace(m_nHitID,nTrackID,nParticleEncoding,fKineticEnergy,fEnergyDeposit,
161 fPreStepX,fPreStepY,fPreStepZ,fPostStepX,fPostStepY,fPostStepZ,
162 fGlobalTime,nStationID,nDetectorID,bIsSIDAuxVSID,-1,-1);
163 }
164 else
165 {
166 // Cut on maximum number of SID hits/station
167 if(m_HitColl->HasReachedLimit(nStationID)) return 1;
168
169 // Get the Touchable History:
170 const G4TouchableHistory* myTouch = static_cast<const G4TouchableHistory*>(pPreStepPoint->GetTouchable());
171 // Calculate the local step position.
172 // From a G4 FAQ:
173 // http://geant4-hn.slac.stanford.edu:5090/HyperNews/public/get/geometry/17/1.html
174
175 const G4AffineTransform transformation = myTouch->GetHistory()->GetTopTransform();
176 const G4ThreeVector localPosition_pre = transformation.TransformPoint(PreStepPointPos);
177 const G4ThreeVector localPosition_post = transformation.TransformPoint(PostStepPointPos);
178
179 const G4ThreeVector normpX( 1., 0., 0.);
180 const G4ThreeVector normnX(-1., 0., 0.);
181 const G4ThreeVector normpY( 0., 1., 0.);
182 const G4ThreeVector normnY( 0.,-1., 0.);
183 const G4ThreeVector normpZ( 0., 0., 1.);
184 const G4ThreeVector normnZ( 0., 0.,-1.);
185
186 G4double BarpX = static_cast<G4ReflectedSolid *>(myTouch->GetSolid())->DistanceToOut(localPosition_pre, normpX);
187 G4double BarnX = static_cast<G4ReflectedSolid *>(myTouch->GetSolid())->DistanceToOut(localPosition_pre, normnX);
188 G4double BarpY = static_cast<G4ReflectedSolid *>(myTouch->GetSolid())->DistanceToOut(localPosition_pre, normpY);
189 G4double BarnY = static_cast<G4ReflectedSolid *>(myTouch->GetSolid())->DistanceToOut(localPosition_pre, normnY);
190 G4double BarpZ = static_cast<G4ReflectedSolid *>(myTouch->GetSolid())->DistanceToOut(localPosition_pre, normpZ);
191 G4double BarnZ = static_cast<G4ReflectedSolid *>(myTouch->GetSolid())->DistanceToOut(localPosition_pre, normnZ);
192
193 G4double BarHalfX = .5 * (BarpX+BarnX);
194 G4double BarHalfY = .5 * (BarpY+BarnY);
195 G4double BarHalfZ = .5 * (BarpZ+BarnZ);
196
197 // x should be 50 mu, y should be 250 mu, z should be 250mu
198
199 G4double x_det = BarHalfX + localPosition_pre.x(); // we will remove death edge later - death_edge[nStationID][nDetectorID];
200 G4double y_det = BarHalfY + localPosition_pre.y(); // we will remove lower edge later - lower_edge[nStationID][nDetectorID];
201 G4double z_det = BarHalfZ + localPosition_pre.z();
202
203 G4double x_det_post = BarHalfX + localPosition_post.x(); //- death_edge[nStationID][nDetectorID];
204 G4double y_det_post = BarHalfY + localPosition_post.y(); //- lower_edge[nStationID][nDetectorID];
205 G4double z_det_post = BarHalfZ + localPosition_post.z();
206
207 //G4double track_length_XY = sqrt(pow(fPostStepX-fPreStepX,2)+pow(fPostStepY-fPreStepY,2));
208 G4double track_length_XY = sqrt(pow(x_det_post-x_det,2)+pow(y_det_post-y_det,2));
209
210 G4double angle_phi_global = atan2(fPostStepY-fPreStepY,fPostStepX-fPreStepX);
211 G4double angle_phi = atan2(y_det_post-y_det,x_det_post-x_det);
212
213 //G4double tan_phi_global = (fPostStepY-fPreStepY)/(fPostStepX-fPreStepX);
214 G4double tan_phi = (y_det_post-y_det)/(x_det_post-x_det);
215
216 if(verboseLevel>5)
217 {
218 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: local, x_det: " << x_det << ", y_det: " << y_det << ", z_det: " << z_det << G4endl;
219 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: local, x_det_post: " << x_det_post << ", y_det_post: " << y_det_post << ", z_det_post: " << z_det_post << G4endl;
220 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: angle_phi_global in -pi:pi = " << angle_phi_global << G4endl;
221 }
222 if (angle_phi_global < 0.) angle_phi_global = 2.*M_PI + angle_phi_global;
223 if(verboseLevel>5)
224 {
225 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: angle_phi_global in 0:2pi = " << angle_phi_global << G4endl;
226 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: angle_phi in -pi:pi = " << angle_phi << G4endl;
227 }
228 if (angle_phi < 0.) angle_phi = 2.*M_PI + angle_phi;
229 if(verboseLevel>5)
230 {
231 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: angle_phi in 0:2pi = " << angle_phi << G4endl;
232 }
233 signed int pre_pixel_x = (signed int)(x_det / m_delta_pixel_x);
234 signed int pre_pixel_y = (signed int)(y_det / m_delta_pixel_y);
235 signed int post_pixel_x = (signed int)(x_det_post / m_delta_pixel_x);
236 signed int post_pixel_y = (signed int)(y_det_post / m_delta_pixel_y);
237
238 signed int sign_pixels_x = 0;
239 signed int sign_pixels_y = 0;
240
241 int number_pixels_x = (int) (std::abs((post_pixel_x-pre_pixel_x)*1.0));
242 int number_pixels_y = (int) (std::abs((post_pixel_y-pre_pixel_y)*1.0));
243
244 if (number_pixels_x > 0)
245 {
246 sign_pixels_x = (post_pixel_x-pre_pixel_x)/number_pixels_x;
247 }
248 if (number_pixels_y > 0)
249 {
250 sign_pixels_y = (post_pixel_y-pre_pixel_y)/number_pixels_y;
251 }
252
253 int n_death_pixels = (int)(m_death_edge[nStationID][nDetectorID]/m_delta_pixel_x);
254 int n_lower_pixels = (int)(m_lower_edge[nStationID][nDetectorID]/m_delta_pixel_y);
255
256 if(verboseLevel>5)
257 {
258 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: pre: pixel["<< pre_pixel_x - n_death_pixels <<"]["<< pre_pixel_y - n_lower_pixels <<"] was hit" << G4endl;
259 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: post: pixel["<< post_pixel_x - n_death_pixels<<"]["<< post_pixel_y - n_lower_pixels<<"] was hit" << G4endl;
260 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: chip's length in x: " << 2.*BarHalfX << ", in y: " << 2.*BarHalfY << ", in z: " << 2.*BarHalfZ << G4endl;
261 }
262 signed int first = -1;
263
264 G4double x_next_pixel = -9999.;
265 G4double y_next_pixel = -9999.;
266
267 G4double x_border = -9999.;
268 G4double y_border = -9999.;
269
270 G4double pixel_track_length_XY = -1.;
271 G4double angle_2pixel = 10.;
272
273 //number of pixel in death and lower edge
274
275 int act_pixel_x = pre_pixel_x;
276 int act_pixel_y = pre_pixel_y;
277
278 //G4double act_pos_x = x_det;
279 //G4double act_pos_y = y_det;
280
281 if(verboseLevel>5)
282 {
283 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: actual pixel in x = " << act_pixel_x << ", in y = " << act_pixel_y << G4endl;
284 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: actual compensated pixel in x = " << act_pixel_x - n_death_pixels << ", in y = " << act_pixel_y - n_lower_pixels << G4endl;
285 }
286 if ((number_pixels_x == 0) && (number_pixels_y == 0))
287 {
288
289 if(verboseLevel>5)
290 {
291 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: pre and post in the same pixel " << G4endl;
292 }
293 if (( pre_pixel_y - n_lower_pixels <= 80) && (pre_pixel_x -n_death_pixels <= 336) && ( pre_pixel_y - n_lower_pixels > 0) && (pre_pixel_x - n_death_pixels > 0))
294 {
295 m_HitColl->Emplace(m_nHitID,nTrackID,nParticleEncoding,fKineticEnergy,fEnergyDeposit,
296 fPreStepX,fPreStepY,fPreStepZ,fPostStepX,fPostStepY,fPostStepZ,
297 fGlobalTime,nStationID,nDetectorID,bIsSIDAuxVSID,
298 (pre_pixel_y - n_lower_pixels - 1),
299 (pre_pixel_x - n_death_pixels - 1));
300 m_HitColl->CountHit(nStationID);
301 }
302 else if(verboseLevel>5)
303 {
304 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: hit outside of pixel's sensitive area " << G4endl;
305 }
306 }
307 else
308 {
309 if(verboseLevel>5)
310 {
311 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: pre and post in diferent pixels " << G4endl;
312 }
313 // still not complete logic, last step must be cut
314
315 while ( (number_pixels_x >= 0) && (number_pixels_y >= 0) )
316 {
317
318 if ((angle_phi >= 0.) && (angle_phi < M_PI_2))
319 {
320 x_next_pixel = (act_pixel_x+1)*m_delta_pixel_x; //- death_edge[nStationID][nDetectorID];
321 y_next_pixel = (act_pixel_y+1)*m_delta_pixel_y; //- death_edge[nStationID][nDetectorID];
322 angle_2pixel = atan2(y_next_pixel-y_det,x_next_pixel-x_det);
323
324 if (angle_2pixel < 0.) angle_2pixel = 2*M_PI + angle_2pixel;
325 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: angle_2pixel in 0:2pi = " << angle_2pixel << G4endl; }
326
327 if (angle_2pixel > angle_phi)
328 {
329 first = 0; // x border will be hit first
330 }
331 else
332 {
333 first = 1;
334 }
335 }
336
337 else if ((angle_phi >= M_PI_2) && (angle_phi < M_PI))
338 {
339 x_next_pixel = (act_pixel_x+0)*m_delta_pixel_x; //- death_edge[nStationID][nDetectorID];
340 y_next_pixel = (act_pixel_y+1)*m_delta_pixel_y; //- death_edge[nStationID][nDetectorID];
341 angle_2pixel = atan2(y_next_pixel-y_det,x_next_pixel-x_det);
342
343 if (angle_2pixel < 0.) angle_2pixel = 2*M_PI + angle_2pixel;
344 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: angle_2pixel in 0:2pi = " << angle_2pixel << G4endl; }
345
346 if (angle_2pixel > angle_phi)
347 {
348 first = 1; // y border will be hit first
349 }
350 else
351 {
352 first = 0;
353 }
354 }
355
356 else if ((angle_phi >= M_PI) && (angle_phi < 3.*M_PI_2))
357 {
358 x_next_pixel = (act_pixel_x+0)*m_delta_pixel_x; //- death_edge[nStationID][nDetectorID];
359 y_next_pixel = (act_pixel_y+0)*m_delta_pixel_y; //- death_edge[nStationID][nDetectorID];
360 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: next pixel corner, x = " << x_next_pixel << ", y =" << y_next_pixel << G4endl; }
361
362 angle_2pixel = atan2(y_next_pixel-y_det,x_next_pixel-x_det);
363
364 if (angle_2pixel < 0.) angle_2pixel = 2*M_PI + angle_2pixel;
365 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: angle_2pixel in 0:2pi = " << angle_2pixel << G4endl; }
366
367 if (angle_2pixel > angle_phi)
368 {
369 first = 0; // x border will be hit first
370 }
371 else
372 {
373 first = 1;
374 }
375 }
376
377 else if ((angle_phi >= 3.*M_PI_2) && (angle_phi < 2.*M_PI))
378 {
379 x_next_pixel = (act_pixel_x+1)*m_delta_pixel_x; //- death_edge[nStationID][nDetectorID];
380 y_next_pixel = (act_pixel_y+0)*m_delta_pixel_y; //- death_edge[nStationID][nDetectorID];
381 angle_2pixel = atan2(y_next_pixel-y_det,x_next_pixel-x_det);
382
383 if (angle_2pixel < 0.) angle_2pixel = 2*M_PI + angle_2pixel;
384 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: angle_2pixel in 0:2pi = " << angle_2pixel << G4endl; }
385
386 if (angle_2pixel > angle_phi)
387 {
388 first = 1; // y border will be hit first
389 }
390 else
391 {
392 first = 0;
393 }
394 }
395
396 else
397 {
398 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: something is wrong here!!! " << G4endl; }
399 }
400
401
402 if (first == -1 ) {
403 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: something is wrong here!!! " << G4endl; }
404 throw std::runtime_error("AFP_SiSensitiveDetector::ProcessHits: something is wrong here");
405 }
406
407 if(verboseLevel>5)
408 {
409 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: actual pixel in x = " << act_pixel_x << ", in y = " << act_pixel_y << G4endl;
410 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: actual compensated pixel in x = " << act_pixel_x - n_death_pixels << ", in y = " << act_pixel_y - n_lower_pixels << G4endl;
411 }
412
413 if (first == 0 )
414 {
415
416 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: cross is x, " << G4endl; }
417 x_border = x_next_pixel;
418
419 if ((sign_pixels_x >= 0) && (x_border > x_det_post)) x_border = x_det_post;
420 if ((sign_pixels_x < 0) && (x_border < x_det_post)) x_border = x_det_post;
421
422 y_border = tan_phi*(x_border-x_det) + y_det;
423
424 if (( act_pixel_y - n_lower_pixels <= 80) && (act_pixel_x -n_death_pixels <= 336) && ( act_pixel_y - n_lower_pixels > 0) && (act_pixel_x - n_death_pixels > 0))
425 {
426 pixel_track_length_XY = sqrt(pow(x_border-x_det,2)+pow(y_border-y_det,2));
427
428 if(verboseLevel>5)
429 {
430 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: overall energy = " << fEnergyDeposit << G4endl;
431 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: track XY length = " << track_length_XY << G4endl;
432 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: actual XY length = " << pixel_track_length_XY << G4endl;
433 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: deposited energy = " << fEnergyDeposit*(pixel_track_length_XY/track_length_XY) << G4endl;
434 }
435
436 // this logic has to be still checked, tracks is necessary fully in sensitive area, but logic is probably ok
437 m_HitColl->Emplace(m_nHitID,nTrackID,nParticleEncoding,fKineticEnergy,
438 fEnergyDeposit*(pixel_track_length_XY/track_length_XY),
439 fPreStepX,fPreStepY,fPreStepZ,fPostStepX,fPostStepY,fPostStepZ,
440 fGlobalTime,nStationID,nDetectorID,bIsSIDAuxVSID,
441 (act_pixel_y - n_lower_pixels - 1),
442 (act_pixel_x - n_death_pixels - 1));
443
444 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits:pixel["<< act_pixel_x - n_death_pixels <<"]["<< act_pixel_y - n_lower_pixels <<"] will be stored, with energy "
445 << fEnergyDeposit*(pixel_track_length_XY/track_length_XY) << G4endl; }
446
447 m_HitColl->CountHit(nStationID);
448 }
449
450 x_det = x_border;
451 y_det = y_border;
452
453 x_next_pixel = x_next_pixel + sign_pixels_x*m_delta_pixel_x;
454 number_pixels_x = number_pixels_x - 1;
455
456 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: remaining number of pixels in x = " << number_pixels_x << ", in y = " << number_pixels_y << G4endl; }
457
458 act_pixel_x = act_pixel_x + sign_pixels_x;
459 }
460
461 if (first == 1 )
462 {
463
464 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: cross is y, " << G4endl; }
465 y_border = y_next_pixel;
466
467 if ((sign_pixels_y >= 0) && (y_border > y_det_post)) y_border = y_det_post;
468 if ((sign_pixels_y < 0) && (y_border < y_det_post)) y_border = y_det_post;
469
470 x_border = (y_border-y_det)/tan_phi + x_det;
471
472 if (( act_pixel_y - n_lower_pixels <= 80) && (act_pixel_x -n_death_pixels <= 336) && ( act_pixel_y - n_lower_pixels > 0) && (act_pixel_x - n_death_pixels > 0))
473 {
474 pixel_track_length_XY = sqrt(pow(x_border-x_det,2)+pow(y_border-y_det,2));
475
476 if(verboseLevel>5)
477 {
478 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: overall energy = " << fEnergyDeposit << G4endl;
479 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: track XY length = " << track_length_XY << G4endl;
480 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: actual XY length = " << pixel_track_length_XY << G4endl;
481 G4cout << "AFP_SiDSensitiveDetector::ProcessHits: deposited energy = " << fEnergyDeposit*(pixel_track_length_XY/track_length_XY) << G4endl;
482 }
483
484 // this logic has to be still checked, tracks is necessary fully in sensitive area, but logic is probably ok
485 m_HitColl->Emplace(m_nHitID,nTrackID,nParticleEncoding,fKineticEnergy,
486 fEnergyDeposit*(pixel_track_length_XY/track_length_XY),
487 fPreStepX,fPreStepY,fPreStepZ,fPostStepX,fPostStepY,fPostStepZ,
488 fGlobalTime,nStationID,nDetectorID,bIsSIDAuxVSID,
489 (act_pixel_y - n_lower_pixels - 1),
490 (act_pixel_x - n_death_pixels - 1));
491
492 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits:pixel["<< act_pixel_x - n_death_pixels <<"]["<< act_pixel_y - n_lower_pixels <<"] will be stored, with energy "
493 << fEnergyDeposit*(pixel_track_length_XY/track_length_XY) << G4endl; }
494
495 m_HitColl->CountHit(nStationID);
496 }
497
498 y_det = y_border;
499 x_det = x_border;
500
501 y_next_pixel = y_next_pixel + sign_pixels_y*m_delta_pixel_y;
502 number_pixels_y = number_pixels_y - 1;
503
504 if(verboseLevel>5) { G4cout << "AFP_SiDSensitiveDetector::ProcessHits: remaining number of pixels in x = " << number_pixels_x << ", in y = " << number_pixels_y << G4endl; }
505
506
507 act_pixel_y = act_pixel_y + sign_pixels_y;
508 }
509 }
510 }
511 }
512 }
513 }
514
515 return true;
516}
#define M_PI
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
bool first
Definition DeMoScan.py:534
constexpr int pow(int x)
Definition conifer.h:27

Member Data Documentation

◆ m_death_edge

float AFP_SiDSensitiveDetector::m_death_edge[4][10]
private

Definition at line 54 of file AFP_SiDSensitiveDetector.h.

◆ m_delta_pixel_x

float AFP_SiDSensitiveDetector::m_delta_pixel_x
private

Definition at line 53 of file AFP_SiDSensitiveDetector.h.

◆ m_delta_pixel_y

float AFP_SiDSensitiveDetector::m_delta_pixel_y
private

Definition at line 53 of file AFP_SiDSensitiveDetector.h.

◆ m_HitColl

AFP_SIDSimHitCollectionBuilder* AFP_SiDSensitiveDetector::m_HitColl {}
private

Definition at line 60 of file AFP_SiDSensitiveDetector.h.

60{};

◆ m_hitCollectionName

std::string AFP_SiDSensitiveDetector::m_hitCollectionName
private

Definition at line 58 of file AFP_SiDSensitiveDetector.h.

◆ m_lower_edge

float AFP_SiDSensitiveDetector::m_lower_edge[4][10]
private

Definition at line 55 of file AFP_SiDSensitiveDetector.h.

◆ m_nHitID

int AFP_SiDSensitiveDetector::m_nHitID
private

Definition at line 51 of file AFP_SiDSensitiveDetector.h.


The documentation for this class was generated from the following files: