20 ut.bookHist(h,
'pz',
'pz',100,0.,100.)
21 ut.bookHist(h,
'oz',
'oz',100,-10000.,10000.)
22 ut.bookHist(h,
'ex',
'ex to det',100,-2.5,2.5,100,-2.5,2.5)
23 ut.bookHist(h,
'N',
'N tracks',300,0.5,299.5)
25 sTree.SetBranchAddress(
"MCTrack", MCTracks)
26 detPos = (3.5*u.m+70*u.m+40*u.m-100*u.m)
27 for n
in range(nEvents):
28 rc = sTree.GetEvent(n)
29 nMCTracks = MCTracks.GetEntriesFast()
30 rc = h[
'N'].Fill( nMCTracks )
31 for i
in range(nMCTracks):
32 atrack = MCTracks.At(i)
33 pdgCode = atrack.GetPdgCode()
34 mom = ROOT.TLorentzVector()
35 atrack.Get4Momentum(mom)
36 if abs(pdgCode)==13
or abs(pdgCode)==211:
37 rc = h[
'pz'].Fill( mom.Pz() )
38 rc = h[
'oz'].Fill( atrack.GetStartZ() )
39 lam = ( detPos-atrack.GetStartZ() )/mom.Pz()
40 xdet = (atrack.GetStartX()+lam*mom.Px() )/u.m
41 ydet = (atrack.GetStartY()+lam*mom.Py() )/u.m
42 rc = h[
'ex'].Fill(xdet,ydet )
46 ut.bookHist(h,
'tz',
'tracking hits z',100,-100.,100.)
47 ut.bookHist(h,
'tztx',
'tracking hits x vs z',1000,-40.,40.,100,-2.5,2.5)
48 ut.bookHist(h,
'txty',
'tracking hits y vs x',100,-2.5,2.5,100,-2.5,2.5)
49 sTree.SetBranchAddress(
"vetoPoint", TrackingHits)
50 for n
in range(nEvents):
51 rc = sTree.GetEvent(n)
52 nHits = TrackingHits.GetEntriesFast()
53 for i
in range(nHits):
54 ahit = TrackingHits.At(i)
55 rc = h[
'tz'].Fill( ahit.GetZ()/u.m )
56 rc = h[
'txty'].Fill( ahit.GetX()/u.m,ahit.GetY()/u.m )
57 rc = h[
'tztx'].Fill( ahit.GetZ()/u.m,ahit.GetX()/u.m )
60 for n
in range( min(10,nEvents) ):
61 rc = sTree.GetEvent(n)
62 nHits = TrackingHits.GetEntriesFast()
63 for i
in range(nHits):
64 ahit = TrackingHits.At(i)
65 print(ahit.GetZ()/u.m, ahit.GetDetectorID(),ahit.GetLength(),ahit.GetEnergyLoss())