Versions Compared

Key

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

...

The examples above are meant to show you how you can make your own code.  With different experiments using different hardware and having different goals, these examples might not apply to your particular experiment / datafile. If so, you'll need to search the main code and libraries a bit to find something more suitable. Here's a brief description of the functions of the myana.cc example and main.cc:

Panel

myana.hh and myana.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.

Panel

main.hh and main.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

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.

All the functionality needed to get data from the xtc file is (or should be) defined in main.cc and in the files it includes (including the pdsdata library). Get an uppdated list of all the available functions by looking at main.hh (implementations are in main.cc).

More examples
Panel

myana_morefeatures.cc

...

panel

This version of the "user analysis module" shows how to obtain some more information from the xtc file:
beginjob():

  • we book a profile histogram for AMO Ion Time-of-flight (AmoITof) waveform data, and also five regular histograms to fill with single event data from the first five events. To do this we need some information about the AmoITof configuration, which is obtained using the getAcqConfig(). This gives us the number of channels that were used, number of samples and sampling intervals, all needed to book the histogram.
  • also a constant-fraction histogram is booked for AmoITof. This has it's own fill function, as we shall see from the event() function.
  • For the Electron Time-of-flight detector (AmoETof), we similarly get the configuration data and make one profile histogram for each channel used.
  • Also get config information about the Magnetic bottle electron spectrometer (AmoMbes).
  • A Princeton camera and a fast CCD (FCCD) was also in use. These have their own getConfig functions: getPrincetonConfig( DetInfo::SxrBeamline, ...) and getFccdConfig(SxrFccd, ...).
    In beginrun() we get the config info from AmoITof again, to check if it changed between runs in the same job.

event():

  • fills the histograms booked at the beginning of the job: getAcqValue() gets the data from a given detector for each event. The main program is already keeping track of which event we're processing at the time. The constant-fraction histogram is filled by the function fillConstFrac(), defined in main.cc. This histogram is filled with the boundary position each time the pulse crosses the threshold,
  • the rest of event() uses a lot of get-functions to show how to use some of these. Generally, they all give you values through scalar or array variables passed as arguments to the functions. The example doesn't show what you would use this information for, but you might already know that (smile)
Panel

Example of how to store several variables in a root NTuple for further processing (histogramming, correlation studies etc.).

panel
Panel

myana_cspad.cc, CspadTemp.cc, CspadTemp.hh

...


CsPad image

Panel

Opal image processing, projections, image export

...