Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This example fetches data for each event and writes it to a root histogram and stores the histogram in a root file. You may want to store your data differently, e.g. one histogram for each event, or everything in a root ntuple for further processing. Or you can write some other format that you'd like to work with (ascii file, ... ).

Panel

myana.cc - example code to make a simple averaging histogram
main.cc - defines the functions used by myana.cc

myana_morefeatures.cc - example code that does a little more than myana.cc

...

examples/myana_cspad.cc -

...

example code to read out data from the CsPad XPP detector.

Here's a brief description of the functions of myana.cc and main.cc:

myana.hh,cc:

Panel

This is the "user analysis module".   This is where you fill in your own code to extract the information that you want from your experiment's xtc file. This module contain only the following functions:

beginjob()     called at the beginning of an analysis job. You can for instance book histograms here.
beginrun()     called at the beginning of a run (the analysis job might analyze several runs)
begincalib() called for each calibration cycle
event()           this is where you fetch, process and store information about each event (shot).
endcalib()
endrun()
endjob()
In the example, a profile histogram is booked in beginjob() and voltage vs. time is filled in each event. The profile histogram displays the average value of all events.

main.hh,cc:

Panel

This is the main control of the analysis, but you should avoid editing this file. After the all utility functions (in main) and user functions (in myana) have been read, main() is executed and controls the flow of the analysis. For each xtc file it calls

code

anafile(xtcname,

maxevt,

skip,

iDebugLevel);

which iterates through the xtc file, keeps track of all the datagrams in it, and makes sure to execute your beginjob() and event() functions.

...