Page History
...
This page holds a few example code-snippets for use in pyana analysis. The analysis is written in python and uses MatPlotLib.PyPlot for plotting of data. Compare with myana user examples to see how (some of) the same things can be done using the myana analysis framework.
For all the examples, you may assume that the pyana module contains a class with at least 'beginjob', 'event' and 'endjob' functions that starts something like this:
Code Block | ||||
---|---|---|---|---|
| ||||
import numpy as np
import matplotlib.pyplot as plt
from pypdsdata import xtc
class mypyana(object):
def __init__(self,source=""):
self.source = source
self.counter = None
def beginjob(self,evt,env):
self.counter = 0
def event(self,evt,env):
self.counter += 1
# snippet code goes here
thedata = evt.get(xtc.TypeId.Type.Id_SomeType, self.source )
def endjob(self,evt,env):
print "Job done! Processed %d events. " % self.counter
# place for plotting etc
|
BeamLine Data: EBeam
To read out energy, charge and position of the beam from the beamline data, use getEBeam()
. It returns a class/structure that has the following members/fields:
...
Overview
Content Tools