Functions | Variables
tracks Namespace Reference

Functions

def GetTrackPars (rec, itrk)
 python wrapper for track parameters array N.B. More...
 
def GetPhi (pos, x0, pars)
 
def GetDeltaPhi (rec, itrk)
 

Variables

 tm = ROOT.TreeManager("../structuredtree.root")
 
 bt = ROOT.Backtracker(tm)
 
 gen = tm.GetGenTree()
 
 g4 = tm.GetG4Tree()
 
 rec = tm.GetRecoTree()
 
 hntrack = TH1F("hntrack", ";N^{0} tracks per #nu;", 50,-0.5,49.5)
 
 hnhit = TH1F("hnhit", "TPC track reco; N^{0} hits per track;",200,0.5,1000.5)
 
 hnvtx = TH1F("hnvtx", ";N^{0} vertices per #nu;", 6,1.5,7.5)
 
 hnvtxtrk = TH1F("hnvtxtrk",";N^{0} vertices per track;", 5,-0.5,4.5)
 
 hntrkvtx = TH1F("hntrkvtx",";N^{0} tracks per vertex;", 7,2.5,9.5)
 
 hx0 = TH1F("hx0", "TPC track reco: fit parameters;x_{0} [cm]", 50,-280,280)
 
 hy0 = TH1F("hy0", "TPC track reco: fit parameters;y_{0} [cm]", 50,-450,150)
 
 hz0 = TH1F("hz0", "TPC track reco: fit parameters;z_{0} [cm]", 50,1250,1750)
 
 hr = TH1F("hr", "TPC track reco: fit parameters;radius in y-z plane [cm]", 100,0,800)
 
 hphi0 = TH1F("hphi0", "TPC track reco: fit parameters;#phi_{0} [rad]", 40,-20,-20)
 
 hlambda = TH1F("hlambda", "TPC track reco: fit parameters;#lambda [rad]", 50,-3.2,3.2)
 
 hdeltaphi = TH1F("hdeltaphi", "TPC track reco: fit parameters;#phi_{end}- #phi_{vertex} [rad]",50,-2*math.pi,2*math.pi)
 
 hdeltaphilen = TH1F("hdeltaphilen", "TPC track reco: fit parameters;(#phi_{end}- #phi_{vertex})/track length [rad/cm]",50,-0.005,0.005)
 
 hlength_fwd = TH1F("hlength_fwd",";track length [cm]",100,0,500)
 
 hlength_bkd = TH1F("hlength_bkd",";track length [cm]",100,0,500)
 
 hmom_fwd = TH1F("hmom_fwd",";momentum [GeV/c]",100,0,5)
 
 hmom_bkd = TH1F("hmom_bkd",";momentum [GeV/c]",100,0,5)
 
 hpval = TH1F("hpval","Track reco;p-value;",100,0,1)
 
 hpdg = TH1F("hpdg",";PDG code",2800,-500,2300)
 
 hpdg_max = TH1F("hpdg_max",";PDG code",2800,-500,2300)
 
 hpdg_max_pval = TH2F("hpdg_max_pval",";track fit p-value;PDG code",40,0,1,2800,-500,2300)
 
 hng4p = TH1F("hng4p",";number MCParticles matched to track",7,-0.5,6.5)
 
 hg4mom = TH1F("hg4mom",";momentum per particle [GeV/c]",100,0,5)
 
 hg4mom_tot_pval = TH2F("hg4mom_tot_pval","TPC track reco;track fit p-value ; p_{true} [GeV/c]",40,0,1,40,0,3)
 
 hg4mom1 = TH1F("hg4mom1",";maximum single-particle momentum [GeV/c]",100,0,5)
 
 hg4mom1_frac = TH1F("hg4mom1_frac",";fraction of total momentum held by single-particle max",100,0,1.01)
 
 hntrkpart = TH1F("hntrkpart", "MCParticle #rightarrow Track ; N^{0} tracks per particle",10,-0.5,9.5)
 
 hntrkpart_p = TH1F("hntrkpart_p", "MCParticle #rightarrow Track ; N^{0} tracks per particle",9,0.5,9.5)
 
 hntrkpart_mu = TH1F("hntrkpart_mu", "MCParticle #rightarrow Track ; N^{0} tracks per particle",9,0.5,9.5)
 
 hntrkpart_pic = TH1F("hntrkpart_pic","MCParticle #rightarrow Track ; N^{0} tracks per particle",9,0.5,9.5)
 
 hntrkpart_e = TH1F("hntrkpart_e", "MCParticle #rightarrow Track ; N^{0} tracks per particle",9,0.5,9.5)
 
 hntrkpart_vs_mom = TH2F('hntrkpart_vs_mom','MCParticle #rightarrow Track ; N^{0} tracks per particle; true initial momentum [GeV/c]',10,-0.5,9.5,50,0,3)
 
 hntrkpart_vs_gyro = TH2F('hntrkpart_vs_gyro','MCParticle #rightarrow Track ; N^{0} tracks per particle;gyroradius [m]',10,-0.5,9.5,50,0,10)
 
 hnmom1_frac = TH2F("hnmom1_frac",";fraction of total momentum ; number of particles",50,0,1.01,14,0.5,14.5)
 
 hmomres2d = TH2F("hmomres2d",";P_{true} [GeV/c] ; P_{reco} [GeV/c]",50,0,3,50,0,3)
 
 hmomres2d_pval = TH2F("hmomres2d_pval",";track fit p-value;p_{true} - p_{reco} [GeV/c]",50,0,1,50,-3,5)
 
 hmomres2d_frac_pval = TH2F("hmomres2d_frac_pval",";track fit p-value;(p_{true} - p_{reco})/p_{true}",50,0,1,50,-1,1)
 
 hmomres_diff = TH1F("hmomres_diff","TPC track reco; p_{true} - p_{reco} [GeV/c];",80,-3,5)
 
 hmomres_frac = TH1F("hmomres_frac","TPC track reco; ( p_{true} - p_{reco})/p_{true};",60,-1,1)
 
 hxdiff = TH1F("hxdiff","TPC track reco;true - reco [cm]",100,-35,35)
 
 hydiff = TH1F("hydiff","TPC track reco;true - reco [cm]",100,-35,35)
 
 hzdiff = TH1F("hzdiff","TPC track reco;true - reco [cm]",100,-35,35)
 
 pval = ROOT.TMath.Prob(rec.TrackChiSqrFwd(itrk),rec.NTrackHit(itrk)-5)
 
 trkpars = GetTrackPars(rec,itrk)
 
 trkvtx = rec.TrackVertex(itrk)
 
 ig4ps = bt.TrackToG4Particles(itrk)
 
int imax = 0
 
int maxp = -1
 
int sump = 0
 
 posbeg = rec.TrackVertex(itrk)
 
 posend = rec.TrackEnd(itrk)
 
 trueposbeg = rec.TrackTruePosBeg(itrk);
 
 trueposend = rec.TrackTruePosEnd(itrk);
 
 itrks = bt.G4ParticleToTracks(ig4p)
 
int ntracks = 0
 
 clength = TCanvas()
 
 cmom = TCanvas()
 
 cng4p = TCanvas()
 
 cg4mom = TCanvas()
 
 cg4mom1 = TCanvas()
 
 cg4mom1_frac = TCanvas()
 
 cnmom1_frac = TCanvas()
 
 cmomres2d = TCanvas()
 
 cpdg = TCanvas()
 
 cntrkpart = TCanvas()
 
 leg = ROOT.TLegend(0.65,0.4,0.8,0.75)
 
 cmomres_diff = TCanvas()
 
 cmomres_frac = TCanvas()
 
 cntrack = TCanvas()
 
 cnhit = TCanvas()
 
 cmomres2d_pval = TCanvas()
 
 cg4mom_tot_pval = TCanvas()
 
 cpdg_max_pval = TCanvas()
 
 cposdiff = TCanvas()
 
 legdiff = ROOT.TLegend(0.2,0.6,0.35,0.85)
 
 cpval = TCanvas()
 
 cmomfracres2d_pval = TCanvas()
 
 cnvtx = TCanvas()
 
 cnvtxtrk = TCanvas()
 
 cntrkvtx = TCanvas()
 
 cx0 = TCanvas()
 
 cy0 = TCanvas()
 
 cz0 = TCanvas()
 
 cr = TCanvas()
 
 cphi0 = TCanvas()
 
 clambda = TCanvas()
 
 cdeltaphi = TCanvas()
 
 cdeltaphilen = TCanvas()
 
 cntrkpart_vs_mom = TCanvas()
 
 prof = hntrkpart_vs_mom.ProfileX()
 
 cntrkpart_vs_gyro = TCanvas()
 
 null = input("press <Enter> to close canvas and exit program.")
 ask for user input as a way to keep the program from ending so we can see the histogram. More...
 

Function Documentation

def tracks.GetDeltaPhi (   rec,
  itrk 
)

Definition at line 60 of file tracks.py.

60 def GetDeltaPhi(rec, itrk) :
61 
62  #parsvec = ROOT.std.vector("float")(5)
63  #pars = np.asarray(parsvec) # python-friendly array
64  #rec.TrackParBeg(itrk,pars)
65  pars = GetTrackPars(rec,itrk)
66 
67  vtx = rec.TrackVertex(itrk)
68  end = rec.TrackEnd(itrk)
69 
70  phivtx = GetPhi(vtx,vtx.X(),pars)
71  phiend = GetPhi(end,vtx.X(),pars)
72  return phiend-phivtx
73 
74 
75 
def GetPhi(pos, x0, pars)
Definition: tracks.py:36
def GetTrackPars(rec, itrk)
python wrapper for track parameters array N.B.
Definition: tracks.py:23
def GetDeltaPhi(rec, itrk)
Definition: tracks.py:60
def tracks.GetPhi (   pos,
  x0,
  pars 
)

Definition at line 36 of file tracks.py.

36 def GetPhi(pos,x0,pars):
37 
38  # give params human-readable names
39  y0 = pars[0]
40  z0 = pars[1]
41  r = 1.0/pars[2] # radius of curvature of circle in y-z plane
42  phi0 = pars[3]
43  lam = pars[4]
44 
45  # circle center
46  yc = y0 + r * math.cos(phi0)
47  zc = z0 - r * math.sin(phi0)
48 
49  # need to get phi from x-coordinate
50  # in y,z, phi is degenerate: phi = phi + m*2pi, m is int
51  return (pos.X()-x0)/(r*math.tan(lam))+phi0
52 
53 
54 
55 
56 # phi-difference between track endpoints
57 # input: rec (recoTree accessor) and track index (int)
58 # output: value of delta phi (float)
59 # N.B. assume backward and forward fit give very similar track params and use forward only
def GetPhi(pos, x0, pars)
Definition: tracks.py:36
def tracks.GetTrackPars (   rec,
  itrk 
)

python wrapper for track parameters array N.B.

assume backward and forward fit give very similar track params and use forward only

Definition at line 23 of file tracks.py.

23 def GetTrackPars(rec,itrk) :
24  parsvec = ROOT.std.vector("float")(5)
25  pars = np.asarray(parsvec) # python-friendly array
26  rec.TrackParBeg(itrk,pars)
27  return pars
28 
29 
30 # inputs
31 # - pos : trajectory point on a fit track (TLorentzvector)
32 # - x0 : 6th track parameter (independent of track fit)
33 # - params[5] : track fit parameters(y0,z0,c,phi0,lambda)
34 # output
35 # - phi (radians)
def GetTrackPars(rec, itrk)
python wrapper for track parameters array N.B.
Definition: tracks.py:23

Variable Documentation

tracks.bt = ROOT.Backtracker(tm)

Definition at line 83 of file tracks.py.

tracks.cdeltaphi = TCanvas()

Definition at line 472 of file tracks.py.

tracks.cdeltaphilen = TCanvas()

Definition at line 477 of file tracks.py.

tracks.cg4mom = TCanvas()

Definition at line 322 of file tracks.py.

tracks.cg4mom1 = TCanvas()

Definition at line 326 of file tracks.py.

tracks.cg4mom1_frac = TCanvas()

Definition at line 329 of file tracks.py.

tracks.cg4mom_tot_pval = TCanvas()

Definition at line 388 of file tracks.py.

tracks.clambda = TCanvas()

Definition at line 467 of file tracks.py.

tracks.clength = TCanvas()

Definition at line 308 of file tracks.py.

tracks.cmom = TCanvas()

Definition at line 313 of file tracks.py.

tracks.cmomfracres2d_pval = TCanvas()

Definition at line 416 of file tracks.py.

tracks.cmomres2d = TCanvas()

Definition at line 335 of file tracks.py.

tracks.cmomres2d_pval = TCanvas()

Definition at line 385 of file tracks.py.

tracks.cmomres_diff = TCanvas()

Definition at line 365 of file tracks.py.

tracks.cmomres_frac = TCanvas()

Definition at line 369 of file tracks.py.

tracks.cng4p = TCanvas()

Definition at line 318 of file tracks.py.

tracks.cnhit = TCanvas()

Definition at line 381 of file tracks.py.

tracks.cnmom1_frac = TCanvas()

Definition at line 332 of file tracks.py.

tracks.cntrack = TCanvas()

Definition at line 376 of file tracks.py.

tracks.cntrkpart = TCanvas()

Definition at line 345 of file tracks.py.

tracks.cntrkpart_vs_gyro = TCanvas()

Definition at line 490 of file tracks.py.

tracks.cntrkpart_vs_mom = TCanvas()

Definition at line 482 of file tracks.py.

tracks.cntrkvtx = TCanvas()

Definition at line 435 of file tracks.py.

tracks.cnvtx = TCanvas()

Definition at line 421 of file tracks.py.

tracks.cnvtxtrk = TCanvas()

Definition at line 428 of file tracks.py.

tracks.cpdg = TCanvas()

Definition at line 338 of file tracks.py.

tracks.cpdg_max_pval = TCanvas()

Definition at line 391 of file tracks.py.

tracks.cphi0 = TCanvas()

Definition at line 462 of file tracks.py.

tracks.cposdiff = TCanvas()

Definition at line 395 of file tracks.py.

tracks.cpval = TCanvas()

Definition at line 410 of file tracks.py.

tracks.cr = TCanvas()

Definition at line 457 of file tracks.py.

tracks.cx0 = TCanvas()

Definition at line 442 of file tracks.py.

tracks.cy0 = TCanvas()

Definition at line 447 of file tracks.py.

tracks.cz0 = TCanvas()

Definition at line 452 of file tracks.py.

tracks.g4 = tm.GetG4Tree()

Definition at line 87 of file tracks.py.

tracks.gen = tm.GetGenTree()

Definition at line 86 of file tracks.py.

tracks.hdeltaphi = TH1F("hdeltaphi", "TPC track reco: fit parameters;#phi_{end}- #phi_{vertex} [rad]",50,-2*math.pi,2*math.pi)

Definition at line 107 of file tracks.py.

tracks.hdeltaphilen = TH1F("hdeltaphilen", "TPC track reco: fit parameters;(#phi_{end}- #phi_{vertex})/track length [rad/cm]",50,-0.005,0.005)

Definition at line 108 of file tracks.py.

tracks.hg4mom = TH1F("hg4mom",";momentum per particle [GeV/c]",100,0,5)

Definition at line 124 of file tracks.py.

tracks.hg4mom1 = TH1F("hg4mom1",";maximum single-particle momentum [GeV/c]",100,0,5)

Definition at line 126 of file tracks.py.

tracks.hg4mom1_frac = TH1F("hg4mom1_frac",";fraction of total momentum held by single-particle max",100,0,1.01)

Definition at line 127 of file tracks.py.

tracks.hg4mom_tot_pval = TH2F("hg4mom_tot_pval","TPC track reco;track fit p-value ; p_{true} [GeV/c]",40,0,1,40,0,3)

Definition at line 125 of file tracks.py.

tracks.hlambda = TH1F("hlambda", "TPC track reco: fit parameters;#lambda [rad]", 50,-3.2,3.2)

Definition at line 106 of file tracks.py.

tracks.hlength_bkd = TH1F("hlength_bkd",";track length [cm]",100,0,500)

Definition at line 112 of file tracks.py.

tracks.hlength_fwd = TH1F("hlength_fwd",";track length [cm]",100,0,500)

Definition at line 111 of file tracks.py.

tracks.hmom_bkd = TH1F("hmom_bkd",";momentum [GeV/c]",100,0,5)

Definition at line 116 of file tracks.py.

tracks.hmom_fwd = TH1F("hmom_fwd",";momentum [GeV/c]",100,0,5)

Definition at line 115 of file tracks.py.

tracks.hmomres2d = TH2F("hmomres2d",";P_{true} [GeV/c] ; P_{reco} [GeV/c]",50,0,3,50,0,3)

Definition at line 140 of file tracks.py.

tracks.hmomres2d_frac_pval = TH2F("hmomres2d_frac_pval",";track fit p-value;(p_{true} - p_{reco})/p_{true}",50,0,1,50,-1,1)

Definition at line 142 of file tracks.py.

tracks.hmomres2d_pval = TH2F("hmomres2d_pval",";track fit p-value;p_{true} - p_{reco} [GeV/c]",50,0,1,50,-3,5)

Definition at line 141 of file tracks.py.

tracks.hmomres_diff = TH1F("hmomres_diff","TPC track reco; p_{true} - p_{reco} [GeV/c];",80,-3,5)

Definition at line 143 of file tracks.py.

tracks.hmomres_frac = TH1F("hmomres_frac","TPC track reco; ( p_{true} - p_{reco})/p_{true};",60,-1,1)

Definition at line 144 of file tracks.py.

tracks.hng4p = TH1F("hng4p",";number MCParticles matched to track",7,-0.5,6.5)

Definition at line 123 of file tracks.py.

tracks.hnhit = TH1F("hnhit", "TPC track reco; N^{0} hits per track;",200,0.5,1000.5)

Definition at line 95 of file tracks.py.

tracks.hnmom1_frac = TH2F("hnmom1_frac",";fraction of total momentum ; number of particles",50,0,1.01,14,0.5,14.5)

Definition at line 137 of file tracks.py.

tracks.hntrack = TH1F("hntrack", ";N^{0} tracks per #nu;", 50,-0.5,49.5)

Definition at line 94 of file tracks.py.

tracks.hntrkpart = TH1F("hntrkpart", "MCParticle #rightarrow Track ; N^{0} tracks per particle",10,-0.5,9.5)

Definition at line 129 of file tracks.py.

tracks.hntrkpart_e = TH1F("hntrkpart_e", "MCParticle #rightarrow Track ; N^{0} tracks per particle",9,0.5,9.5)

Definition at line 133 of file tracks.py.

tracks.hntrkpart_mu = TH1F("hntrkpart_mu", "MCParticle #rightarrow Track ; N^{0} tracks per particle",9,0.5,9.5)

Definition at line 131 of file tracks.py.

tracks.hntrkpart_p = TH1F("hntrkpart_p", "MCParticle #rightarrow Track ; N^{0} tracks per particle",9,0.5,9.5)

Definition at line 130 of file tracks.py.

tracks.hntrkpart_pic = TH1F("hntrkpart_pic","MCParticle #rightarrow Track ; N^{0} tracks per particle",9,0.5,9.5)

Definition at line 132 of file tracks.py.

tracks.hntrkpart_vs_gyro = TH2F('hntrkpart_vs_gyro','MCParticle #rightarrow Track ; N^{0} tracks per particle;gyroradius [m]',10,-0.5,9.5,50,0,10)

Definition at line 135 of file tracks.py.

tracks.hntrkpart_vs_mom = TH2F('hntrkpart_vs_mom','MCParticle #rightarrow Track ; N^{0} tracks per particle; true initial momentum [GeV/c]',10,-0.5,9.5,50,0,3)

Definition at line 134 of file tracks.py.

tracks.hntrkvtx = TH1F("hntrkvtx",";N^{0} tracks per vertex;", 7,2.5,9.5)

Definition at line 98 of file tracks.py.

tracks.hnvtx = TH1F("hnvtx", ";N^{0} vertices per #nu;", 6,1.5,7.5)

Definition at line 96 of file tracks.py.

tracks.hnvtxtrk = TH1F("hnvtxtrk",";N^{0} vertices per track;", 5,-0.5,4.5)

Definition at line 97 of file tracks.py.

tracks.hpdg = TH1F("hpdg",";PDG code",2800,-500,2300)

Definition at line 120 of file tracks.py.

tracks.hpdg_max = TH1F("hpdg_max",";PDG code",2800,-500,2300)

Definition at line 121 of file tracks.py.

tracks.hpdg_max_pval = TH2F("hpdg_max_pval",";track fit p-value;PDG code",40,0,1,2800,-500,2300)

Definition at line 122 of file tracks.py.

tracks.hphi0 = TH1F("hphi0", "TPC track reco: fit parameters;#phi_{0} [rad]", 40,-20,-20)

Definition at line 105 of file tracks.py.

tracks.hpval = TH1F("hpval","Track reco;p-value;",100,0,1)

Definition at line 119 of file tracks.py.

tracks.hr = TH1F("hr", "TPC track reco: fit parameters;radius in y-z plane [cm]", 100,0,800)

Definition at line 104 of file tracks.py.

tracks.hx0 = TH1F("hx0", "TPC track reco: fit parameters;x_{0} [cm]", 50,-280,280)

Definition at line 101 of file tracks.py.

tracks.hxdiff = TH1F("hxdiff","TPC track reco;true - reco [cm]",100,-35,35)

Definition at line 146 of file tracks.py.

tracks.hy0 = TH1F("hy0", "TPC track reco: fit parameters;y_{0} [cm]", 50,-450,150)

Definition at line 102 of file tracks.py.

tracks.hydiff = TH1F("hydiff","TPC track reco;true - reco [cm]",100,-35,35)

Definition at line 147 of file tracks.py.

tracks.hz0 = TH1F("hz0", "TPC track reco: fit parameters;z_{0} [cm]", 50,1250,1750)

Definition at line 103 of file tracks.py.

tracks.hzdiff = TH1F("hzdiff","TPC track reco;true - reco [cm]",100,-35,35)

Definition at line 148 of file tracks.py.

tracks.ig4ps = bt.TrackToG4Particles(itrk)

Definition at line 192 of file tracks.py.

tracks.imax = 0

Definition at line 195 of file tracks.py.

tracks.itrks = bt.G4ParticleToTracks(ig4p)

Definition at line 239 of file tracks.py.

tracks.leg = ROOT.TLegend(0.65,0.4,0.8,0.75)

Definition at line 351 of file tracks.py.

tracks.legdiff = ROOT.TLegend(0.2,0.6,0.35,0.85)

Definition at line 401 of file tracks.py.

tracks.maxp = -1

Definition at line 196 of file tracks.py.

int tracks.ntracks = 0

Definition at line 246 of file tracks.py.

string tracks.null = input("press <Enter> to close canvas and exit program.")

ask for user input as a way to keep the program from ending so we can see the histogram.

python doesn't like empty input strings so I abuse exception handling

Definition at line 504 of file tracks.py.

tracks.posbeg = rec.TrackVertex(itrk)

Definition at line 214 of file tracks.py.

tracks.posend = rec.TrackEnd(itrk)

Definition at line 215 of file tracks.py.

tracks.prof = hntrkpart_vs_mom.ProfileX()

Definition at line 485 of file tracks.py.

tracks.pval = ROOT.TMath.Prob(rec.TrackChiSqrFwd(itrk),rec.NTrackHit(itrk)-5)

Definition at line 168 of file tracks.py.

tracks.rec = tm.GetRecoTree()

Definition at line 88 of file tracks.py.

int tracks.sump = 0

Definition at line 197 of file tracks.py.

tracks.tm = ROOT.TreeManager("../structuredtree.root")

Definition at line 82 of file tracks.py.

tracks.trkpars = GetTrackPars(rec,itrk)

Definition at line 172 of file tracks.py.

tracks.trkvtx = rec.TrackVertex(itrk)

Definition at line 173 of file tracks.py.

tracks.trueposbeg = rec.TrackTruePosBeg(itrk);

Definition at line 216 of file tracks.py.

tracks.trueposend = rec.TrackTruePosEnd(itrk);

Definition at line 217 of file tracks.py.