Page History
...
For quick example suppose that we have this class defined in user module:
Code Block | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
# user analysis class class myana(object): def __init__(self, name, lower, uppper, bins=100) self.lower = float(lower) self.upper = float(upper) self.bin = int(bins) ... |
and this job configuration file:
Code Block | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
[pyana] modules = mypackage.myana mypackage.myana:wide [mypackage.myana] lower = 0 upper = 100 name = default [mypackage.myana:wide] lower = 0 upper = 1000 bins = 1000 name = wide |
With this the analysis job will instantiate two analysis objects with different parameters, equivalent to this pseudo-code:
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
# import class myana from mypackage.myana import myana # create instances instances = [ myana(lower = "0", upper = "100", name = "default"), myana(lower = "0", upper = "1000", bins = "1000", name = "wide") ] |
(the order of parameters in constructor and configuration file does not matter as all parameters are passed as keyword parameters.)
Data access
There are two types of data that framework passes to the user analysis modules – event data and environment data. Event data contains the data corresponding to current event that triggered the call to the user methods. In case of XTC input the event data contains complete datagram as read from DAQ. Event data in user module is represented with a special object of type pyana.event.Event
which has an extended interface for extracting individual object from datagram. This interface is described in a reference guide.
Environment data include all kinds of data which are not part of the event data. Usually environment data either stay the same for the whole job or change at a slower rate than event data. Example of the environment data could be configuration data read from XTC at the beginning of the job, EPICS data which is not updated on every event, and few other things. Environment data is represented for user code through the object of type pyana.event.Env
. Its interface is described in the reference manual.
Configuration
Multi-processing
...