Versions Compared

Key

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

...

The Xtc package defines several classes.

Class

...

XtcFileIterator

This An xtc file is a base class for any source of information in the xtc file (e.g. Detector, Beamline, Process). Defined in pdsdata/xtc/Src.hhcollection of datagrams (Dgram). This is an iterator to loop through all datagrams in a file.

Public Member Functions:

Code Block
  // Constructor //and Constructorsdestructor
  XtcFileIterator(int  Src(fd, size_t maxDgramSize);
    Src(Level::Type level~XtcFileIterator();

    uint32_t log()   const;Dgram* next();

Class Dgram

Datagram - structure of a piece of information within the xtc file.
A datagram contains: Sequence, Env and Xtc.

Code Block

       // logical identifier
    uint32_t phy()  Dgram
 const;   --------------------------------------
   //| physical identifier

    Level::Type level() const; // level

    bool operator==(const Src& s) const;

Protected Attributes

Code Block

   |                 |
 Sequence         Env    uint32_t _log; // logical  identifier
    uint32_t _phy; // physical identifier

Class BldInfo

...

Xtc

Public Attributes:

Code Block

     PDS_DGRAM_STRUCT // #define PDS_DGRAM_STRUCT Sequence seq; Env env; Xtc xtc

Class Sequence

Defined in pdsdata/xtc/BldInfoSequence.hh.

Public Types:

Code Block
    enum Type    { EBeamEvent = 0, PhaseCavityOccurrence = 1, FEEGasDetEnergyMarker = 2, NumberOf};
    enum         {NumberOfTypes = 3 };

Public Member Functions:

...

Code Block

    // Constructors
    

...

Sequence() {}
    

...

Sequence(

...

const Sequence&);

...

    

...

Sequence(const ClockTime& clock, const TimeStamp& stamp);
    Sequence(Type, TransitionId::Value, const ClockTime&, const TimeStamp&);

    Type type() 

...

const;

...

Static Public Member Functions

Code Block

    staticTransitionId::Value const char* name(const BldInfo&);

Class ProcInfo

Process information class. This is a derived class that inherits from Src.
Holds process info for all Levels except Source.

Public Member Functions:

service() const;
    bool isExtended() const;
    bool isEvent() const;
    const ClockTime& clock() const {return _clock;}
    const TimeStamp& stamp() const {return _stamp;}

    Sequence& operator=(const Sequence&);

Class Env

Defined in pdsdata/xtc/Env.hh

Public Member Functions

Code Block

    // Constructors
    Env() {}
    Env(const Env& in) : _env(in._env) {}
    Env(uint32_t env);
Code Block

    // Constructor
    ProcInfo(Level::Type level,     //
             uint32_t processId,    // 
             uint32_t ipAddr);      // 

    uint32_t processId() const;
    uint32_t ipAddrvalue()    const;

    voidconst Env& operator=(const   ipAddr(intEnv& that);

Class

...

Detector information. Inherits from Src. Defined in pdsdata/xtc/DetInfo.hh and implemented in pdsdata/xtc/src/DetInfo.cc.

Xtc

This class defines a container for data stored in an xtc file. An event is a collection of such containers. The size and location of the unspecified data contained are defined by the "sizeofPayload" and "payload" functions. To iterate over a set of such containers see "XtcIterator.hh".

Public Member Functions:
ConstructorsPublic Types:

Code Block
    enum//Constructor Detectorused {
to create an empty, unlabeled
  NoDetector  Xtc() : = 0,damage(0), extent(0) {};

    // Copy AmoImsconstructor, will copy everything, but NOT the payload.
 = 1,  // AMO Ion Momentum SpectrometerXtc(const Xtc& xtc) :
      AmoGasdet     = 2,damage(xtc.damage), src(xtc.src), contains(xtc.contains), extent(sizeof(Xtc)) {}

    //
 AMO Gas Detector Xtc(inconst FrontEndTypeId& Enclosuretype) :
      AmoETof  damage(0), contains(type), extent(sizeof(Xtc)) {}

    Xtc(const =TypeId& 3type, const // AMO Electron Time-of-flightSrc& _src) :
      AmoITof       = 4,  // AMO Ion Time-of-flight
      AmoMbesdamage(0), src(_src), contains(type), extent(sizeof(Xtc)) {}

    Xtc(const TypeId& _tag, const Src& _src, unsigned _damage) :
       = 5,  // AMO Magnetic bottle electron spectrometer
      AmoVmi   damage(_damage), src(_src), contains(_tag), extent(sizeof(Xtc)) {}

    Xtc(const TypeId& _tag, const Src& _src, const Damage& _damage) :
     = 6damage(_damage),  // AMO Velocity map imagingsrc(_src), contains(_tag), extent(sizeof(Xtc)) {}

Overloaded allocation operators to allow the insertion of a dummy "Xtc" within a datagram.

Code Block
    void* operator AmoBps   new(size_t size, char* p)     ={ 7,  // AMO Beam position screenreturn (void*)p; }
    void* operator Camp   new(size_t size, Xtc* p)      { return p->alloc(size); }
Code Block
= 8,  // CFel-ASG-Multi-Purpose EndStation
    // Return EpicsArcha pointer (of unspecified type) =to 9,the payload //
associated with this class
   BldEb char*        = 10,
payload()       SxrBeamlineconst {  = 11,return (char*)(this+1); }

    // Return SxrEndstationthe = 12,
      XppSb1Ipm  size (in bytes) of the payload associated with the class.
   = 13,
int      XppSb1Pim    sizeofPayload() =const 14,
{ return extent - sizeof(Xtc); }

 XppMonPim   // Return =the 15,
Xtc which is immediately following an XppSb2Ipmobject of this class.
  = 16,
 Xtc*     XppSb3Ipm  next()   = 17,
      XppSb3Pim     = 18,
{ return (Xtc*)((char*)this+extent); }
   XppSb4Pim const Xtc* next()  = 19,
      XppGon const { return (const    = 20,
  Xtc*)((char*)this+extent); }

    void*    XppLas  alloc(uint32_t size)  { void* buffer = 21,
      XppEndstation = 22,next(); extent += size; return buffer; }

Public Attributes:

Code Block
    Damage  AmoEndstation = 23, damage;
    Src  CxiEndstation = 24,
      XcsEndstation = 25,src;
    TypeId  MecEndstation = 26, contains;
      NumDetector   = 27
    };
    enum Device {
      NoDevice  = 0,
      Evr       = 1,
      Acqiris   = 2,
      Opal1000  = 3,
      TM6740    = 4,
      pnCCD     = 5,
      Princeton = 6,
      Fccd      = 7,
      Ipimb     = 8,
      Encoder   = 9,
      Cspad     = 10,
      NumDevice = 11
    };

Public Member Functions

uint32_t extent;

Class XtcIterator

This class allows iteration over a collection of "Xtc" objects. An "event" generated from DataFlow consists of data described by a collection of "Xtc" objects. Therefore, this class is instrumental in the navigation of an event's data. The set of "Xtc"s is determined by passing (typically to the constructor) a root "Xtc" which describes the collection of "Xtc"s to process. This root, for example is provided by an event's datagram.

As this is an Abstract-Base-Class, it is expected that an application will subclass from this class, providing an implementation of the "process" method. This method will be called back for each "Xtc" in the collection. Note that the "Xtc" to process is passed as an argument. If the "process" method wishes to abort the iteration a zero (0) value is returned. The iteration is initiated by calling the "iterate" member function.

Public Member Functions:
Constructors and destructor:

Code Block

    XtcIterator(Xtc* root);
    XtcIterator() {}
    virtual ~XtcIterator() {}

The first constructor takes an argument the "Xtc" which defines the collection to iterate over.

Code Block

    virtual int process(Xtc* xtc) = 0;

This function is pure virtual and must be implemented by all derived classes.

Code Block

    void      iterate();

This function commences iteration over the collection specified by the constructor.

Code Block

    void      iterate(Xtc*);

Iterate over the collection specifed as an argument to the function. For each "Xtc" found call back the "process" function. If the "process" function returns zero (0) the iteration is aborted and control is returned to the caller. Otherwise, control is returned when all elements of the collection have been scanned.

Code Block

    const Xtc* root()  const;

This function returns the collection specified by the constructor.

Class Level

Defined in pdsdata/xtc/Level.hh

Public Types:

Code Block

  enum Type{Control, Source, Segment, Event, Recorder, Observer, Reporter,
            NumberOfLevels};

Static Public Member Functions

Code Block

  static const char* name(Type type);

Class TransitionId

Public Types:

Code Block

    enum Value {
      Unknown, Reset,
      Map, Unmap,
      Configure, Unconfigure,
      BeginRun, EndRun,
      BeginCalibCycle, EndCalibCycle,
      Enable, Disable,
      L1Accept,
      NumberOf };

Static Public Member Functions:

Code Block

    static const char* name(TransitionId::Value id);

Class Src

This is a base class for any source of information in the xtc file (e.g. Detector, Beamline, Process). Defined in pdsdata/xtc/Src.hh

Public Member Functions:

Code Block

    // Constructors
    Src();
    Src(Level::Type level);

    uint32_t log()   const;    // logical identifier
    uint32_t phy()   const;    // physical identifier

    Level::Type level() const; // level

    bool operator==(const Src& s) const;

Protected Attributes

Code Block

    uint32_t _log; // logical  identifier
    uint32_t _phy; // physical identifier

Class BldInfo

Beamline data Information. This is a derived class that inherits from Src.
Defined in pdsdata/xtc/BldInfo.hh

Public Types:

Code Block

    enum Type { EBeam = 0, PhaseCavity = 1, FEEGasDetEnergy = 2, NumberOf = 3 };

Public Member Functions

  • Constructors and Destructor
    Code Block
    
        BldInfo() {}
        BldInfo(uint32_t processId, Type type);
    
  • Accessors
    Code Block
    
        uint32_t processId() const;
        Type     type()  const;
    

Static Public Member Functions

Code Block

    static const char* name(const BldInfo&);

Class ProcInfo

Process information class. This is a derived class that inherits from Src.
Holds process info for all Levels except Source.

Public Member Functions:

Code Block

    // Constructor
    ProcInfo(Level::Type level,     //
             uint32_t processId,    //
             uint32_t ipAddr);      //

    uint32_t processId() const;
    uint32_t ipAddr()    const;
    void     ipAddr(int);

Class DetInfo

Detector information. Inherits from Src. Defined in pdsdata/xtc/DetInfo.hh and implemented in pdsdata/xtc/src/DetInfo.cc.

Public Types:

Code Block

    enum Detector {
      NoDetector    = 0,
      AmoIms        = 1,  // AMO Ion Momentum Spectrometer
      AmoGasdet     = 2,  // AMO Gas Detector (in FrontEnd Enclosure)
      AmoETof       = 3,  // AMO Electron Time-of-flight
      AmoITof       = 4,  // AMO Ion Time-of-flight
      AmoMbes       = 5,  // AMO Magnetic bottle electron spectrometer
      AmoVmi        = 6,  // AMO Velocity map imaging
      AmoBps        = 7,  // AMO Beam position screen
      Camp          = 8,  // CFel-ASG-Multi-Purpose EndStation
      EpicsArch     = 9,  //
      BldEb         = 10,
      SxrBeamline   = 11,
      SxrEndstation = 12,
      XppSb1Ipm     = 13,
      XppSb1Pim     = 14,
      XppMonPim     = 15,
      XppSb2Ipm     = 16,
      XppSb3Ipm     = 17,
      XppSb3Pim     = 18,
      XppSb4Pim     = 19,
      XppGon        = 20,
      XppLas        = 21,
      XppEndstation = 22,
      AmoEndstation = 23,
      CxiEndstation = 24,
      XcsEndstation = 25,
      MecEndstation = 26,
      NumDetector   = 27
    };
    enum Device {
      NoDevice  = 0,
      Evr       = 1,
      Acqiris   = 2,
      Opal1000  = 3,
      TM6740    = 4,
      pnCCD     = 5,
      Princeton = 6,
      Fccd      = 7,
      Ipimb     = 8,
      Encoder   = 9,
      Cspad     = 10,
      NumDevice = 11
    };

Public Member Functions

Code Block

    // Constructors
    DetInfo() {}
    DetInfo(uint32_t   processId,   //
            Detector   det,         //
            uint32_t   detId,       //
            Device     dev,         //
            uint32_t   devId);      //

    bool operator==(const DetInfo &) const;

    uint32_t processId() const;
    Detector detector() const;
    Device device() const;
    uint32_t detId() const;
    uint32_t devId() const;

Static Public Member Functions

Code Block

    static const char *name(Detector);
    static const char *name(Device);
    static const char *name(const DetInfo &);

Class ClockTime

Defined in pdsdata/xtc/ClockTime.hh.

Public Member Functions:

  • Constructors (ClockTime has no destructor)
    Code Block
    
        ClockTime();
        ClockTime(const ClockTime& t);
        ClockTime(unsigned sec, unsigned nsec);
    
  • Accessors:
    Code Block
    
        unsigned seconds    () const {return _high;}
        unsigned nanoseconds() const {return _low;}
    
  • Operators
    Code Block
    
        ClockTime& operator=(const ClockTime&);
        bool operator> (const ClockTime&) const;
        bool operator==(const ClockTime&) const;
    

Class Damage

Defined in pdsdata/xtc/Damage.hh, inline implementation.

Public Types:

Code Block

    enum Value {
      DroppedContribution    = 1,
      OutOfOrder             = 12,
      OutOfSynch             = 13,
      UserDefined            = 14,
      IncompleteContribution = 15,
      ContainsIncomplete     = 16
    };
    // reserve the top byte to augment user defined errors
    enum {NotUserBitsMask=0x00FFFFFF, UserBitsShift = 24};
  • DroppedContribution - means that event is "split" and contains only partial data from incomplete set of detectors. There may be another (or even few) datagram with the same timestamp containing remaining data from the same event.
  • OutOfOrder - In this case the event may contain data from one or more detector which actually belong to a different event.
  • OutOfSynch
  • UserDefined - reserved for user-defined conditions
  • IncompleteContribution - means that data in that particular container is badly damaged, are incomplete, and cannot be used
  • ContainsIncomplete - means that it contains one or more containers at deeper XTC levels which have IncompleteContribution damage, events with this damage may be partially useful
Code Block

Bit   Mask   Name
-----------------------------------
 1  0x00002  DroppedContribution
12  0x01000  OutOfOrder
13  0x02000  OutOfSynch
14  0x04000  UserDefined
15  0x08000  IncompleteContribution
16  0x10000  ContainsIncomplete

Bit = n means 1<<n, i.e. 1 shifted left n bits:

                    Decimal     Binary
int32_t value =     1           00000000000000000000000000000001
                                |       |       |       |
DroppedContribution             00000000000000000000000000000010
OutOfOrder                      00000000000000000001000000000000
OutOfSynch         
Code Block

    // Constructors
    DetInfo() {}
    DetInfo(uint32_t   processId,   //
            Detector   det,         //
            uint32_t   detId,       //
            Device     dev,         //
    00000000000000000010000000000000
UserDefined        uint32_t   devId);      //

    bool operator==(const DetInfo &) const;

00000000000000000100000000000000
IncompleteContribution        uint32_t processId() const;00000000000000001000000000000000
ContainsIncomplete      Detector detector() const;
    Device device() const; 00000000000000010000000000000000

Public Member Functions:

Code Block
    uint32_t detId() const;// Constructor
    Damage(uint32_t devId(v) : _damage(v) const;

Static Public Member Functions

Code Block
{}

    static const char *name(Detector);
 uint32_t  value() const   static const char *name(Device);
    static const char *name(const DetInfo &);

Class ClockTime

Defined in pdsdata/xtc/ClockTime.hh.

Public Member Functions:

...

 { return _damage; }
    void     increase(Damage::Value v)  { _damage |= ((1<<v) & NotUserBitsMask); }
    

...

void     

...

increase(uint32_t v)     

...

 

...

 {

...

 _

...

damage |= v & NotUserBitsMask; }
    

...

uint32_t 

...

bits() const

...

               { 

...

return _damage & NotUserBitsMask;}
    

...

uint32_t userBits() const

...

   

...

 

...

 

...

Class Damage

Defined in pdsdata/xtc/Damage.hh, inline implementation.

Public Types:

Code Block

    enum Value {
 return _damage >> UserBitsShift; }
  DroppedContribution  void  = 1,
  userBits(uint32_t v) {
  OutOfOrder    _damage &= NotUserBitsMask;
      _damage |= 12,
(v << UserBitsShift);
    OutOfSynch}

Class TimeStamp

Public Types:

Code Block

    enum {NumFiducialBits = 17};
    enum {MaxFiducials = 13,(1<<17)-32};
    enum {ErrFiducial = (1<<17)-1};

Public Member Functions:

Code Block

UserDefined     TimeStamp();
       = 14,TimeStamp(const TimeStamp&);
    TimeStamp(const TimeStamp&, IncompleteContribution = 15,unsigned control);
    TimeStamp(unsigned ticks, ContainsIncompleteunsigned fiducials, unsigned vector, unsigned = 16control=0);

    };
unsigned ticks   // reserve the top byte to augment user defined errors() const;
    unsigned fiducials() const;
    enum {NotUserBitsMask=0x00FFFFFF, UserBitsShift = 24};

Public Member Functions:

Code Block

    // Constructor
    Damage(uint32_t v) : _damage(v) {}unsigned control  () const;
    unsigned vector   () const;

    uint32_t  value() constTimeStamp& operator= (const TimeStamp&);
    bool       operator==(const TimeStamp&) const;
    bool   { return _damage; }
 operator>=(const TimeStamp&) const;
 void   bool  increase(Damage::Value v)  { _damage |operator<= ((1<<v)const TimeStamp&) NotUserBitsMask)const;
 }
   bool   void    operator< increase(uint32_t vconst TimeStamp&) const;
    bool     { _damage |=operator> v(const TimeStamp& NotUserBitsMask; }) const;

Class TypeId

Public Types:

Code Block
    uint32_t bits() constenum Type {
      Any,
      Id_Xtc,   { return _damage & NotUserBitsMask;}
   // uint32_t userBits() constgeneric hierarchical container
      Id_Frame,     { return _damage >>// UserBitsShift;raw }image
    void     userBits(uint32_t v) {Id_AcqWaveform,
      _damage &= NotUserBitsMask;Id_AcqConfig,
      Id_damage |= (v << UserBitsShift);TwoDGaussian, // 2-D Gaussian + covariances
    }

Class Dgram

Datagram - structure of a piece of information within the xtc file.

Public Attributes:

Code Block

  Id_Opal1kConfig,
      PDS_DGRAM_STRUCT // #define PDS_DGRAM_STRUCT Sequence seq; Env env; Xtc xtc

Class Sequence

Defined in pdsdata/xtc/Sequence.hh.

Public Types:

Code Block
Id_FrameFexConfig,
      Id_EvrConfig,
      Id_TM6740Config,
      Id_ControlConfig,
    enum Type  Id_pnCCDframe,
    {Event = 0Id_pnCCDconfig,
 Occurrence    = 1, Marker = 2};
    enumId_Epics,        // Epics Data Type
      Id_FEEGasDetEnergy,
    {NumberOfTypes = 3};

Public Member Functions:

Code Block
 Id_EBeam,
    // Constructors
  Id_PhaseCavity,
     Sequence() {} Id_PrincetonFrame,
    Sequence(const Sequence&);  Id_PrincetonConfig,
    Sequence(const ClockTime& clock, const TimeStamp& stamp);
Id_EvrData,
      Sequence(Type, TransitionId::Value, const ClockTime&, const TimeStamp&);
Id_FrameFccdConfig,
      Id_FccdConfig,
    Type type() const; Id_IpimbData,
    TransitionId::Value  service() const;Id_IpimbConfig,
    bool isExtended() const; Id_EncoderData,
    bool isEvent() const; Id_EncoderConfig,
    const ClockTime& clock() const {return _clock;}
    const TimeStamp& stamp() const {return _stamp;}

    Sequence& operator=(const Sequence&);

Class Env

Defined in pdsdata/xtc/Env.hh

Public Member Functions

Code Block
  Id_EvrIOConfig,
      Id_PrincetonInfo,
      Id_CspadElement,
      Id_CspadConfig,
      Id_IpmFexConfig,  // LUSI Diagnostics
    // Constructors
  Id_IpmFex,
     Env() {}
 Id_DiodeFexConfig,
      Env(const Env& in) : _env(in._env) {}
Id_DiodeFex,
      Id_PimImageConfig,
      NumberOf};

Public Member Functions:

Code Block
Env(uint32_t env);

    uint32_t valueTypeId() const;
{}
    TypeId(const EnvTypeId& operator=(const Env& that);

Class Xtc

Class Level

Defined in pdsdata/xtc/Level.hh

Public Types:

Code Block

  enum Type{Control, Source, Segment, Event, Recorder, Observer, Reporter,
            NumberOfLevels};

Static Public Member Functions

Code Block

  v);
    TypeId(Type type, uint32_t version);

    Type     id()      const;
    uint32_t version() const;
    uint32_t value()   const;

    static const char* name(Type type);

Class TimeStamp

Class

...