Page History
...
The Xtc package defines several classes.
Class XtcFileIterator
An xtc file is a collection of datagrams (Dgram).
A datagram contains: Sequence, Env and Xtc.. This is an iterator to loop through all datagrams in a file.
Public Member Functions:
Code Block |
---|
// Constructor and destructor XtcFileIterator(int fd, size_t maxDgramSize); ~XtcFileIterator(); Dgram* next(); |
Class Dgram
Datagram - structure of a piece of information within the xtc file.
A datagram contains: Sequence, Env and Xtc.
Code Block |
---|
Dgram --- Dgram ----------------------------------------- | | | Sequence Env Xtc |
...
Public Member FunctionsAttributes:
Code Block |
---|
// Constructor and destructor XtcFileIterator(int fd, size_t maxDgramSize); ~XtcFileIterator(); Dgram* next(); |
Class Dgram
Datagram - structure of a piece of information within the xtc file.
PDS_DGRAM_STRUCT // #define PDS_DGRAM_STRUCT Sequence seq; Env env; Xtc xtc
|
Class Sequence
Defined in pdsdata/xtc/Sequence.hh
.
Public TypesPublic Attributes:
Code Block |
---|
enum PDS_DGRAM_STRUCT // #define PDS_DGRAM_STRUCT Sequence seq; Env env; Xtc xtc |
Class 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:
Constructors:
Type {Event = 0, Occurrence = 1, Marker = 2};
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&) |
Code Block |
//Constructor used to create an empty, unlabeled Xtc() : damage(0), extent(0) {}; // Copy constructor, will copy everything, but NOT the payload.Type type() const; TransitionId::Value service() const; Xtcbool isExtended() const; Xtc& xtc bool isEvent() :const; const ClockTime& damageclock(xtc.damage), src(xtc.src), contains(xtc.contains), extent(sizeof(Xtc)) {} const {return _clock;} // const TimeStamp& stamp() Xtc(const TypeId& type) :{return _stamp;} Sequence& damage(0), contains(type), extent(sizeof(Xtc)) {} operator=(const Sequence&); |
Class Env
Defined in pdsdata/xtc/Env.hh
Public Member Functions
Code Block |
---|
// Constructors Env() {} XtcEnv(const TypeIdEnv& type,in) const Src& _src) :: _env(in._env) {} Env(uint32_t env); damage(0), src(_src), contains(type), extent(sizeof(Xtc)) {} uint32_t value() const; Xtc(const TypeIdEnv& _tag, operator=(const SrcEnv& that); |
Class 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:
Constructors:
Code Block |
---|
//Constructor used to create an empty, unlabeled Xtc() : damage(0), extent(0) {};_src, unsigned _damage) : damage(_damage), src(_src), contains(_tag), extent(sizeof(Xtc)) {} Xtc(const TypeId& _tag, const Src& _src, const Damage& _damage// Copy constructor, will copy everything, but NOT the payload. Xtc(const Xtc& xtc) : damage(_xtc.damage), src(_xtc.src), contains(_tagxtc.contains), extent(sizeof(Xtc)) {} |
Overloaded allocation operators to allow the insertion of a dummy "Xtc" within a datagram.
Code Block |
---|
void* operator new(size_t size, char* p) // Xtc(const TypeId& type) : { return damage(void*0)p; } void* operator new(size_t size, Xtc* p) { return p->alloc(size); } , contains(type), extent(sizeof(Xtc)) {} Xtc(const TypeId& type, const Src& _src) : damage(0), src(_src), contains(type), extent(sizeof(Xtc)) {} Xtc(const TypeId& _tag, const Src& _src, unsigned _damage) : damage(_damage), src(_src), contains(_tag), extent(sizeof(Xtc)) {} Xtc(const TypeId& _tag, const Src& _src, const Damage& _damage) : damage(_damage), src(_src), contains(_tag), extent(sizeof(Xtc)) {} |
Overloaded allocation operators to allow the insertion of a dummy "Xtc" within a datagram.
Code Block |
---|
void* operator new(size_t size, char* p) { return (void*)p; }
void* operator new(size_t size, Xtc* p) { return p->alloc(size); }
|
Code Block |
---|
Code Block |
// Return a pointer (of unspecified type) to the payload associated with this class char* payload() const { return (char*)(this+1); } // Return the size (in bytes) of the payload associated with the class. int sizeofPayload() const { return extent - sizeof(Xtc); } // Return thea Xtcpointer which(of isunspecified immediately following an object oftype) to the payload associated with this class. Xtcchar* next payload() const { return (Xtcchar*)((char*)this+extent1); } // Return constthe Xtc*size next(in bytes) of the payload associated with the class. int sizeofPayload() const { return (const Xtc*)((char*)this+extentextent - sizeof(Xtc); } void*// Return the Xtc which is alloc(uint32_t size) { void* buffer = next(); extent += size; return buffer; } |
Public Attributes:
Code Block |
---|
Damage damage; Srcimmediately following an object of this class. Xtc* next() src; TypeId contains;{ return (Xtc*)((char*)this+extent); } const Xtc* next() const { return (const Xtc*)((char*)this+extent); } void* alloc(uint32_t extent; |
Class XtcIterator
This is an abstract class.
size) { void* buffer = next(); extent += size; return buffer; }
|
Public Attributes:
Code Block |
---|
Damage damage;
Src src;
TypeId contains;
uint32_t extent;
|
Class XtcIterator
This class allows iteration over a collection of "Xtc" objects. An "event" generated 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.
...
This function returns the collection specified by the constructor.
Class
...
Level
Defined in pdsdata/xtc/SequenceLevel.hh
.
Public Types:
Code Block |
---|
enum Type{Control, Source, Segment, {Event, =Recorder, 0Observer, Occurrence = 1, Marker = 2};Reporter, enum {NumberOfTypes = 3NumberOfLevels}; |
Static Public Member Functions:
Code Block |
---|
static const char* name(Type type); |
Class TransitionId
Public Types:
Code Block |
---|
// Constructors enum Sequence()Value {} Sequence(const Sequence&); Unknown, Reset, Sequence(const ClockTime& clockMap, constUnmap, TimeStamp& stamp); Sequence(TypeConfigure, TransitionId::ValueUnconfigure, const ClockTime&, const TimeStamp&); Type type() const;BeginRun, EndRun, TransitionId::Value service() const;BeginCalibCycle, EndCalibCycle, bool isExtended() const; Enable, Disable, bool isEvent() const; L1Accept, const ClockTime& clock() const {return _clock;}NumberOf }; |
Static Public Member Functions:
Code Block |
---|
const TimeStamp& stamp() static const {return _stamp;} Sequence& operator=(const Sequence&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
Defined in pdsdata/xtc/Env.hh
Public Member Functions:
Code Block |
---|
// Constructors EnvSrc() {}; Env(const Env& in) : _env(in._env) {}Src(Level::Type level); Env(uint32_t env); log() const; // logical identifier uint32_t valuephy() const; // physical identifier Level::Type level() const Env&; // level bool operator==(const EnvSrc& thats) const; |
Protected Attributes
Class Src
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.
This is a base class for any source of information in the xtc file (e.g. Detector, Beamline, Process). Defined in pdsdata/xtc/SrcBldInfo.hh
Public Member FunctionsTypes:
Code Block |
---|
//enum Constructors Type { EBeam Src(); Src(Level::Type level); = 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: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
...
Code Block |
---|
BldInfo() {}
BldInfo(uint32_t processId, Type type);
|
...
// Constructor ProcInfo(Level::Type level, // uint32_t processId, // uint32_t ipAddr); // uint32_t processId() const; |
...
uint32_t ipAddr() |
...
const;
|
...
Static Public Member Functions
Code Block |
---|
void static const char* name(const BldInfo&ipAddr(int); |
Class
...
DetInfo
Process Detector information class. This is a derived class that inherits from Src.
Holds process info for all Levels except Source.. Inherits from Src. Defined in pdsdata/xtc/DetInfo.hh
and implemented in pdsdata/xtc/src/DetInfo.cc
.
Public TypesPublic Member Functions:
Code Block |
---|
// Constructor enum Detector { ProcInfo(Level::Type level, NoDetector = //0, AmoIms uint32_t processId, // = 1, // AMO Ion Momentum Spectrometer AmoGasdet = 2, 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 // AMO Gas Detector (in FrontEnd Enclosure) AmoETof = 3, // AMO Electron Time-of-flight AmoITof = 4, // AMO Ion Time-of-flight AmoMbes = 05, // AMO Magnetic bottle AmoIms electron spectrometer AmoVmi = 16, // AMO IonVelocity Momentummap Spectrometerimaging AmoGasdetAmoBps = 27, // AMO Beam Gasposition Detectorscreen (in FrontEnd Enclosure) Camp AmoETof = 38, // AMO Electron Time-of-flightCFel-ASG-Multi-Purpose EndStation AmoITofEpicsArch = 49, // AMO Ion Time-of-flight BldEb AmoMbes = 510, // AMO Magnetic bottle electron spectrometer SxrBeamline = 11, AmoVmiSxrEndstation = 12, =XppSb1Ipm 6, // AMO Velocity map imaging= 13, AmoBpsXppSb1Pim = 714, // AMO Beam positionXppMonPim screen = 15, Camp XppSb2Ipm = 8, // CFel-ASG-Multi-Purpose EndStation16, EpicsArchXppSb3Ipm = 917, // XppSb3Pim = 18, BldEb XppSb4Pim = 1019, SxrBeamlineXppGon = 11, = 20, SxrEndstation = 12, XppLas XppSb1Ipm = 1321, XppSb1PimXppEndstation = 22, = 14, AmoEndstation = 23, XppMonPim CxiEndstation = 1524, XppSb2IpmXcsEndstation = 1625, XppSb3IpmMecEndstation = 1726, XppSb3PimNumDetector = 18,27 }; XppSb4Pim enum Device = 19,{ XppGon NoDevice = 200, XppLas Evr = 211, XppEndstationAcqiris = 222, AmoEndstationOpal1000 = 233, TM6740 CxiEndstation = 244, pnCCD XcsEndstation = 255, MecEndstationPrinceton = 266, NumDetectorFccd = 277, }; Ipimb enum Device { = 8, NoDevice Encoder = 09, Evr Cspad = 110, Acqiris NumDevice = 2,11 }; |
Public Member Functions
Code Block |
---|
Opal1000 =// 3,Constructors DetInfo() {} TM6740 DetInfo(uint32_t = 4processId, // pnCCD = 5, Detector Princetondet, = 6, Fccd // = 7, Ipimbuint32_t detId, = 8, // Encoder = 9, CspadDevice = 10dev, NumDevice = 11 }; |
Public Member Functions
Code Block |
---|
// // Constructors DetInfo() {} DetInfo(uint32_t processId,devId); // bool operator==(const DetInfo &) const; Detector uint32_t det,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 Deviceconst char *name(Device); dev, 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:Static Public Member Functions
Code Block |
---|
enum Value { static const char *name(Detector); DroppedContribution static const char *name(Device);= 1, static constOutOfOrder char *name(const DetInfo &); |
Class ClockTime
Defined in pdsdata/xtc/ClockTime.hh
.
Public Member Functions:
...
|
...
|
...
|
...
= 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:
|
Class Damage
Defined in pdsdata/xtc/Damage.hh
, inline implementation.
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 00000000000000000010000000000000 UserDefined 00000000000000000100000000000000 IncompleteContribution 00000000000000001000000000000000 ContainsIncomplete 00000000000000010000000000000000 |
Public Types:
Code Block |
---|
Decimal enum Value {Binary int32_t value = DroppedContribution 1 = 1, OutOfOrder00000000000000000000000000000001 = 12, OutOfSynch | = 13, | UserDefined | = 14,| DroppedContribution IncompleteContribution = 15, 00000000000000000000000000000010 OutOfOrder ContainsIncomplete = 16 }; // reserve the top byte to augment user defined errors00000000000000000001000000000000 OutOfSynch enum {NotUserBitsMask=0x00FFFFFF, UserBitsShift = 24}; |
Public Member Functions:
Code Block |
---|
// Constructor Damage(uint32_t v) : _damage(v) {} 00000000000000000010000000000000 UserDefined uint32_t value() const 00000000000000000100000000000000 IncompleteContribution { return _damage; } void 00000000000000001000000000000000 ContainsIncomplete increase(Damage::Value v) { _damage |= ((1<<v) & 00000000000000010000000000000000 |
Public Member Functions:
Code Block |
---|
NotUserBitsMask); } void// Constructor increaseDamage(uint32_t v) {: _damage |= (v) & NotUserBitsMask; {} uint32_t bits value() const { return _damage &; NotUserBitsMask;} uint32_t userBits() const void increase(Damage::Value v) { return _damage >> UserBitsShift |= ((1<<v) & NotUserBitsMask); } void userBitsincrease(uint32_t v) { _damage &= NotUserBitsMask; { _damage |= (v << UserBitsShift); } |
Class Level
Defined in pdsdata/xtc/Level.hh
Public Types:
Code Block |
---|
enum Type{Control, Source, Segment, Event, Recorder, Observer, Reporter, & NotUserBitsMask; } uint32_t bits() const NumberOfLevels}; |
Static Public Member Functions
Code Block |
---|
static{ constreturn char* name(Type type); |
Class TimeStamp
Public Types:
Code Block |
---|
enum {NumFiducialBits = 17}; _damage & NotUserBitsMask;} uint32_t userBits() const enum {MaxFiducials = (1<<17)-32}; { return enum_damage {ErrFiducial>> = (1<<17)-1}; |
Public Member Functions:
Code Block |
---|
UserBitsShift; } void TimeStamp(); TimeStampuserBits(const TimeStamp&);uint32_t v) { TimeStamp(const TimeStamp&, unsigned control) _damage &= NotUserBitsMask; TimeStamp(unsigned ticks, unsigned fiducials, unsigned vector, unsigned control=0_damage |= (v << UserBitsShift); unsigned ticks} |
Class TimeStamp
Public Types:
Code Block |
---|
enum {NumFiducialBits ()= const17}; enum unsigned{MaxFiducials = fiducials(1<<17) const-32}; unsignedenum control{ErrFiducial = (1<<17)-1}; |
Public Member Functions:
Code Block |
---|
const; unsigned vector TimeStamp() const; TimeStamp& operator= (const TimeStamp&); bool operator==TimeStamp(const TimeStamp&, unsigned control) const; boolTimeStamp(unsigned ticks, unsigned fiducials, unsigned vector, unsigned operator>=(const TimeStamp&) constcontrol=0); boolunsigned ticks operator<=(const TimeStamp&) const; bool unsigned fiducials() const; unsigned control operator< (const TimeStamp&) const; boolunsigned vector () const; operator>TimeStamp& operator= (const TimeStamp&) const; |
Class TransitionId
Public Types:
Code Block |
---|
enumbool Value { Unknown, Reset,operator==(const TimeStamp&) const; bool Map, Unmap, Configure, Unconfigure,operator>=(const TimeStamp&) const; bool BeginRun, EndRun, operator<=(const BeginCalibCycle, EndCalibCycle, TimeStamp&) const; bool Enable, Disable, operator< (const L1Accept,TimeStamp&) const; bool NumberOf }; |
Static Public Member Functions:
Code Block |
---|
staticoperator> (const char* name(TransitionId::Value id)TimeStamp&) const; |
Class TypeId
Public Types:
...