Functions | Variables
PandAna.Demos.pi0_spectra Namespace Reference

Functions

def kGammaCut (tables)
 Look for events where all prongs are photon like multiliners need to be done with def x(tables): blah return blah then x = Cut(x) More...
 
def kContain (tables)
 
def kMass (tables)
 Computes the invariant mass of two prong events. More...
 
def gaussian (x, x0, a, stdev, o)
 

Variables

 kTwoProng
 Look for vertices with two prongs Note: We don't need to explicitly check if there is a vertex like in CAFAna. More...
 
 kGammaCut = Cut(kGammaCut)
 
 kContain = Cut(kContain)
 
 kPlaneGap
 
 kPlaneContig
 
 kTruePi0
 
 kMass = Var(kMass)
 
 start = time.time()
 
string dMC = '/pnfs/nova/persistent/users/karlwarb/HDF5-Training-19-02-26/ND-GIBUU-FHC'
 
list filesMC = [os.path.join(dMC,f) for f in os.listdir(dMC) if 'h5caf.h5' in f]
 
 tablesMC = loader(filesMC, limit=100)
 
string dData = '/pnfs/nova/persistent/users/karlwarb/HDF5-Training-19-02-26/ND-Data-FHC'
 
list filesData = [os.path.join(dData,f) for f in os.listdir(dData) if 'h5caf.h5' in f]
 
 tablesData = loader(filesData, limit=100)
 
 cutTot = kTwoProng&kGammaCut&kContain&kPlaneContig&kPlaneGap
 
 cutBkg = cutTot&~kTruePi0
 
 data = spectrum(tablesData, cutTot, kMass)
 
 bkg = spectrum(tablesMC, cutBkg, kMass)
 
 tot = spectrum(tablesMC, cutTot, kMass)
 
 POT = data.POT()
 
 inttot = tot.integral(POT=POT)
 
 intbkg = bkg.integral(POT=POT)
 
tuple pur = (inttot - intbkg)/inttot
 
int nbins = 8
 
tuple range = (0,400)
 
 d
 
 bins
 
 m
 
 _
 
 b
 
int centers = (bins[:-1] + bins[1:])/2
 
 dataparam
 
 datacov
 
 p0
 
 mcparam
 
 mccov
 
 dataerr = np.sqrt(np.diag(datacov))
 
 mcerr = np.sqrt(np.diag(mccov))
 
string datamu = 'Data $\mu$: '
 
string datasi = 'Data $\sigma$: '
 
string mcmu = 'MC $\mu$: '
 
string mcsi = 'MC $\sigma$: '
 
 figsize
 
 weights
 
 histtype
 
 color
 
 label
 
 derr = poisson_conf_interval(d,'frequentist-confidence')
 
 yerr
 
 fmt
 
 handles
 
 labels
 
 c
 
 loc
 
 fontsize
 
 horizontalalignment
 
 verticalalignment
 
 transform
 

Function Documentation

def PandAna.Demos.pi0_spectra.gaussian (   x,
  x0,
  a,
  stdev,
  o 
)

Definition at line 145 of file pi0_spectra.py.

145  def gaussian(x, x0, a, stdev, o):
146  return a * np.exp( - ((x - x0) / stdev) ** 2 / 2) + o
147 
def gaussian(x, x0, a, stdev, o)
Definition: pi0_spectra.py:145
def PandAna.Demos.pi0_spectra.kContain (   tables)

Definition at line 42 of file pi0_spectra.py.

References PandAna.Demos.pi0_spectra.kContain.

42 def kContain(tables):
43  df = tables['rec.vtx.elastic']
44  return (df['vtx.x'] < 180) & \
45  (df['vtx.x'] > -180) & \
46  (df['vtx.y'] < 180) & \
47  (df['vtx.y'] > -180) & \
48  (df['vtx.z'] < 1000) & \
49  (df['vtx.z'] > 50)
def PandAna.Demos.pi0_spectra.kGammaCut (   tables)

Look for events where all prongs are photon like multiliners need to be done with def x(tables): blah return blah then x = Cut(x)

Definition at line 36 of file pi0_spectra.py.

References PandAna.Demos.pi0_spectra.kGammaCut.

36 def kGammaCut(tables):
37  df = tables['rec.vtx.elastic.fuzzyk.png.cvnpart']['photonid']
38  return (df > 0.75).groupby(level=KL).agg(np.all)
def PandAna.Demos.pi0_spectra.kMass (   tables)

Computes the invariant mass of two prong events.

Definition at line 67 of file pi0_spectra.py.

References PandAna.Demos.pi0_spectra.kMass, and stan::math.prod().

67 def kMass(tables):
68  # Note: We could leave this check out, but you would get a warning about taking
69  # the sqrt of negative numbers at the end (it won't crash like cafana).
70  # dataframes can support NaNs just fine.
71  check = tables['rec.vtx.elastic.fuzzyk']['npng'] == 2
72 
73  df = tables['rec.vtx.elastic.fuzzyk.png'][check]
74  x = df['dir.x']
75  y = df['dir.y']
76  z = df['dir.z']
77 
78  # Compute the length of the dir vector and then normalize
79  l = np.sqrt(x*x+y*y+z*z)
80  x = x/l
81  y = y/l
82  z = z/l
83 
84  # compute the dot product
85  dot = x.groupby(level=KL).prod()+y.groupby(level=KL).prod()+z.groupby(level=KL).prod()
86 
87  # multiply the energy of all prongs in each event together
88  EProd = df['calE'].groupby(level=KL).prod()
89 
90  # return a dataframe with a single column of the invariant mass
91  deadscale = 0.8747
92  return 1000*deadscale*np.sqrt(2*EProd*(1-dot))
93  # note NaNs can be removed by (df == df)
T prod(const std::vector< T > &v)
Definition: prod.hpp:17

Variable Documentation

PandAna.Demos.pi0_spectra._
private

Definition at line 142 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.b

Definition at line 143 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.bins

Definition at line 141 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.bkg = spectrum(tablesMC, cutBkg, kMass)
PandAna.Demos.pi0_spectra.c

Definition at line 179 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.centers = (bins[:-1] + bins[1:])/2

Definition at line 148 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.color

Definition at line 167 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.cutBkg = cutTot&~kTruePi0

Definition at line 112 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.cutTot = kTwoProng&kGammaCut&kContain&kPlaneContig&kPlaneGap

Definition at line 111 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.d

Definition at line 141 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.data = spectrum(tablesData, cutTot, kMass)

Definition at line 115 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.datacov

Definition at line 151 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.dataerr = np.sqrt(np.diag(datacov))

Definition at line 154 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.datamu = 'Data $\mu$: '

Definition at line 157 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.dataparam

Definition at line 151 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.datasi = 'Data $\sigma$: '

Definition at line 158 of file pi0_spectra.py.

string PandAna.Demos.pi0_spectra.dData = '/pnfs/nova/persistent/users/karlwarb/HDF5-Training-19-02-26/ND-Data-FHC'

Definition at line 105 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.derr = poisson_conf_interval(d,'frequentist-confidence')

Definition at line 171 of file pi0_spectra.py.

string PandAna.Demos.pi0_spectra.dMC = '/pnfs/nova/persistent/users/karlwarb/HDF5-Training-19-02-26/ND-GIBUU-FHC'

Definition at line 101 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.figsize

Definition at line 164 of file pi0_spectra.py.

list PandAna.Demos.pi0_spectra.filesData = [os.path.join(dData,f) for f in os.listdir(dData) if 'h5caf.h5' in f]

Definition at line 106 of file pi0_spectra.py.

list PandAna.Demos.pi0_spectra.filesMC = [os.path.join(dMC,f) for f in os.listdir(dMC) if 'h5caf.h5' in f]

Definition at line 102 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.fmt
PandAna.Demos.pi0_spectra.fontsize

Definition at line 188 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.handles

Definition at line 178 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.histtype

Definition at line 167 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.horizontalalignment

Definition at line 188 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.intbkg = bkg.integral(POT=POT)

Definition at line 134 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.inttot = tot.integral(POT=POT)

Definition at line 133 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.kContain = Cut(kContain)

Definition at line 50 of file pi0_spectra.py.

Referenced by PandAna.Demos.pi0_spectra.kContain().

PandAna.Demos.pi0_spectra.kGammaCut = Cut(kGammaCut)

Definition at line 39 of file pi0_spectra.py.

Referenced by PandAna.Demos.pi0_spectra.kGammaCut().

PandAna.Demos.pi0_spectra.kMass = Var(kMass)

Definition at line 94 of file pi0_spectra.py.

Referenced by PandAna.Demos.pi0_spectra.kMass().

PandAna.Demos.pi0_spectra.kPlaneContig
Initial value:
1 = Cut(lambda tables:
2  (tables['rec.vtx.elastic.fuzzyk.png']['maxplanecont'] > 4).\
3  groupby(level=KL).agg(np.all))

Definition at line 56 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.kPlaneGap
Initial value:
1 = Cut(lambda tables:
2  (tables['rec.vtx.elastic.fuzzyk.png']['maxplanegap'] > 1).\
3  groupby(level=KL).agg(np.all))

Definition at line 52 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.kTruePi0
Initial value:
1 = Cut(lambda tables:
2  tables['rec.sand.nue']['npi0'] > 0)

Definition at line 61 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.kTwoProng
Initial value:
1 = Cut(lambda tables:
2  (tables['rec.vtx.elastic.fuzzyk']['npng'] == 2).groupby(level=KL).agg(np.any))

Look for vertices with two prongs Note: We don't need to explicitly check if there is a vertex like in CAFAna.

Note 2: One liners can be done with lambda functions directly in the cut.

Definition at line 28 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.label

Definition at line 167 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.labels
PandAna.Demos.pi0_spectra.loc

Definition at line 185 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.m

Definition at line 142 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.mccov

Definition at line 152 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.mcerr = np.sqrt(np.diag(mccov))

Definition at line 155 of file pi0_spectra.py.

Referenced by om::OnMonProd.OnMonProd().

PandAna.Demos.pi0_spectra.mcmu = 'MC $\mu$: '

Definition at line 159 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.mcparam

Definition at line 152 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.mcsi = 'MC $\sigma$: '

Definition at line 160 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.nbins = 8

Definition at line 139 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.p0
PandAna.Demos.pi0_spectra.POT = data.POT()

Definition at line 123 of file pi0_spectra.py.

tuple PandAna.Demos.pi0_spectra.pur = (inttot - intbkg)/inttot
PandAna.Demos.pi0_spectra.range = (0,400)

Definition at line 140 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.start = time.time()

Definition at line 99 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.tablesData = loader(filesData, limit=100)

Definition at line 107 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.tablesMC = loader(filesMC, limit=100)

Definition at line 103 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.tot = spectrum(tablesMC, cutTot, kMass)
PandAna.Demos.pi0_spectra.transform
PandAna.Demos.pi0_spectra.verticalalignment

Definition at line 188 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.weights

Definition at line 167 of file pi0_spectra.py.

PandAna.Demos.pi0_spectra.yerr

Definition at line 172 of file pi0_spectra.py.