SND@LHC Software
Loading...
Searching...
No Matches
g4Ex_gap.MyTrackingActionD Class Reference
Inheritance diagram for g4Ex_gap.MyTrackingActionD:
Collaboration diagram for g4Ex_gap.MyTrackingActionD:

Public Member Functions

 PostUserTrackingAction (self, atrack)
 
 PreUserTrackingAction (self, atrack)
 
 myPrintout (self, atrack)
 

Detailed Description

Definition at line 309 of file g4Ex_gap.py.

Member Function Documentation

◆ myPrintout()

g4Ex_gap.MyTrackingActionD.myPrintout (   self,
  atrack 
)

Definition at line 364 of file g4Ex_gap.py.

364 def myPrintout(self, atrack):
365 part = atrack.GetDynamicParticle()
366 pid = part.GetPDGcode()
367 vx = atrack.GetVertexPosition()
368 pos = atrack.GetPosition()
369 mom = atrack.GetMomentum()
370 print('TA',pid,atrack.GetTotalEnergy()/GeV,ecut*GeV)
371 print('start tracking',atrack.GetDynamicParticle().GetPDGcode(),atrack.GetKineticEnergy()/GeV,vx.z/m,pos.z/m,mom.z/GeV)
372
373# ------------------------------------------------------------------

◆ PostUserTrackingAction()

g4Ex_gap.MyTrackingActionD.PostUserTrackingAction (   self,
  atrack 
)

Definition at line 310 of file g4Ex_gap.py.

310 def PostUserTrackingAction(self,atrack):
311 if particleGun and atrack.GetTrackID() == 1:
312 # record dead of 400GeV proton
313 if atrack.GetTrackStatus() != atrack.GetTrackStatus().fAlive :
314 part = atrack.GetDynamicParticle()
315 pid = part.GetPDGcode()
316 vx = atrack.GetVertexPosition()
317 mom = atrack.GetMomentum()
318 ekin = atrack.GetKineticEnergy()/GeV
319 pos = atrack.GetPosition()
320 w = atrack.GetWeight()
321 parentid = int(w)/100000-10000
322 pythiaid = int(w)%100000-10000
323 h['ntuple'].Fill(float(pid), float(mom.x/GeV),float(mom.y/GeV),float(mom.z/GeV),\
324 float(pos.x/m),float(pos.y/m),float(pos.z/m),\
325 float(vx.x/m),float(vx.y/m),float(vx.z/m),pythiaid,parentid)
326

◆ PreUserTrackingAction()

g4Ex_gap.MyTrackingActionD.PreUserTrackingAction (   self,
  atrack 
)

Definition at line 327 of file g4Ex_gap.py.

327 def PreUserTrackingAction(self,atrack):
328 global trackHistory
329# need to be careful with energy cut, anti-protons and neutrons can always produce pions and kaons
330 part = atrack.GetDynamicParticle()
331 pid = part.GetPDGcode()
332 # if debug: self.myPrintout(atrack)
333 moid = atrack.GetParentID()
334 trackHistory[atrack.GetTrackID()]=[pid,moid]
335 tmoid = str(moid)
336 if moid in trackHistory:
337 mo = pdg.GetParticle(trackHistory[moid][0])
338 if mo : tmoid = mo.GetName()
339 tid = str(pid)
340 if pdg.GetParticle(pid): tid = pdg.GetParticle(pid).GetName()
341 mom = atrack.GetMomentum()
342 p = ROOT.TMath.Sqrt(mom.x*mom.x+mom.y*mom.y+mom.z*mom.z)
343 if debug and abs(pid)==13: print('track',atrack.GetTrackID(),tid,tmoid,moid,atrack.GetKineticEnergy()/MeV,p/MeV)
344 if pid==12:
345 if moid in trackHistory:
346 gmoid = trackHistory[moid][1]
347 if gmoid in trackHistory:
348 tgmoid = str(gmoid)
349 mo = pdg.GetParticle(trackHistory[gmoid][0])
350 if mo : tgmoid = mo.GetName()
351 print(' <--',gmoid,tgmoid)
352 gmoid = trackHistory[gmoid][1]
353 if gmoid in trackHistory:
354 tgmoid = str(gmoid)
355 mo = pdg.GetParticle(trackHistory[gmoid][0])
356 if mo : tgmoid = mo.GetName()
357 print(' <--',gmoid,tgmoid)
358
359 qed = pid in qedlist # use cut only for photons, electrons, protons and neutrons
360 if atrack.GetKineticEnergy()/GeV < ecut and (qed or allPart):
361 G4TrackingManager().SetStoreTrajectory(False)
362 atrack.SetTrackStatus(atrack.GetTrackStatus().fStopAndKill)
363

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