SND@LHC Software
Loading...
Searching...
No Matches
dumpEvent.py
Go to the documentation of this file.
1
from
__future__
import
print_function
2
from
__future__
import
division
3
# example for dumping an MC event
4
import
ROOT,os,sys
5
import
rootUtils
as
ut
6
import
shipunit
as
u
7
import
ShipGeoConfig
8
ship_geo =
ShipGeoConfig.Config
().loadpy(
"$FAIRSHIP/geometry/geometry_config.py"
)
9
PDG = ROOT.TDatabasePDG.Instance()
10
11
def
printMCTrack
(n,MCTrack):
12
mcp = MCTrack[n]
13
print(
' %6i %7i %6.3F %6.3F %7.3F %7.3F %7.3F %7.3F %6i '
%(n,mcp.GetPdgCode(),mcp.GetPx()/u.GeV,mcp.GetPy()/u.GeV,mcp.GetPz()/u.GeV, \
14
mcp.GetStartX()/u.m,mcp.GetStartY()/u.m,mcp.GetStartZ()/u.m,mcp.GetMotherId() ))
15
16
def
dump
(i,pcut):
17
tree = ROOT.gROOT.FindObjectAny(
'cbmsim'
)
18
tree.GetEntry(i)
19
print(
' # pid px py pz vx vy vz mid'
)
20
n=-1
21
for
mcp
in
tree.MCTrack:
22
n+=1
23
if
mcp.GetP()/u.GeV < pcut :
continue
24
printMCTrack
(n,tree.MCTrack)
25
def
dumpStraw
(i):
26
tree = ROOT.gROOT.FindObjectAny(
'cbmsim'
)
27
tree.GetEntry(i)
28
for
aStraw
in
tree.strawtubesPoint:
29
trID = astraw.GetTrackID()
30
if
not
trID < 0:
31
printMCTrack
(trID,tree.MCTrack)
ShipGeoConfig.Config
Definition
ShipGeoConfig.py:114
dumpEvent.dump
dump(i, pcut)
Definition
dumpEvent.py:16
dumpEvent.dumpStraw
dumpStraw(i)
Definition
dumpEvent.py:25
dumpEvent.printMCTrack
printMCTrack(n, MCTrack)
Definition
dumpEvent.py:11
macro
dumpEvent.py
Generated by
1.9.8