1 / 9

TDS objects and Converters.

TDS objects and Converters. (Transient Data Store). Ian Gable Software Workshop Jan 2001. The TDS. What is the TDS? A Gaudi mechanism for quickly and easily manipulating data objects.

kiral
Download Presentation

TDS objects and Converters.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TDS objects and Converters. (Transient Data Store) Ian Gable Software Workshop Jan 2001

  2. The TDS What is the TDS? • A Gaudi mechanism for quickly and easily manipulating data objects. • It boils down to a method of storing pointers to objects in a tree structure reminiscent of any file system. • You could store raw data in a part of the tree /Event/Raw/CsIEvents And then store MC Events in another: /Event/MC/McHits • Once you have an object in the TDS, it’s possible to make it persistent with very little extra difficulty. The persistency mechanism in our case is ROOT. Ian Gable

  3. What is a TDS object? • As the name suggest a TDS object is an object that plugs into the TDS • To be a TDS object a class must inherit from the Gaudi class DataObject or CaintainedObject. • The class must also have certain features that will allow it to work with the TDS • The easiest thing to do is to show example Class: Ian Gable

  4. Example TDS Class #ifndef TDCSI_DATA_H #define TDCSI_DATA_H 1 extern const CLID& CLID_MyClass; class MyClass : virtual public DataObject { public: virtual const CLID& clID() const { return MyClass::classID(); } static const CLID& classID() { return CLID_MyClass; } MyClass (); ~MyClass (); //! number of hit towers in the layer layer=0.. int getNumber (){ return someNumber }; //! energy recorded in the ith tower float getLongNumber() { return longNumber }; Ian Gable

  5. //! Serialize the object for reading virtual StreamBuffer& serialize( StreamBuffer& s ); //! Serialize the object for writing virtual StreamBuffer& serialize( StreamBuffer& s ) const; //! Fill the ASCII output stream virtual std::ostream& fillStream( std::ostream& s ) const; private: int m_someNumber; double m_longNumber }; Ian Gable

  6. //################################################################//################################################################ // MyClassSerializeFunctions //################################################################ //! Serialize the object for writing inline StreamBuffer& MyClass::serialize( StreamBuffer& s ) const { DataObject::serialize(s); return s << m_someNumber << m_longNumber ; } //! Serialize the object for reading inline StreamBuffer& MyClass::serialize( StreamBuffer& s ) { DataObject::serialize(s); return s; >> m_someNumber >> m_longNumber ; } Ian Gable

  7. The EventModel After setting up the object one needs to make an addition to the Glast EventModel • The event model records the Structure of the TDS Here’s our current EventModel: class EvModel { public: EvModel() { // The whole GLAST event EventModel::Event = "/Event"; // set up the MC structure EventModel::MC::Event = EventModel::Event + "/MC"; EventModel::Irf::Event = EventModel::Event + "/Irf"; EventModel::Irf::IrfAcdHits = EventModel::Irf::Event + "/IrfAcdHits"; EventModel::Irf::IrfCalHits = EventModel::Irf::Event + "/IrfCalHits"; EventModel::Irf::IrfTkrHits = EventModel::Irf::Event + "/IrfTkrHits"; EventModel::Raw::Event = EventModel::Event + "/Raw"; EventModel::Raw::TdCsIDatas = EventModel::Raw::Event + "/TdCsIDatas"; EventModel::Raw::TdSiDatas = EventModel::Raw::Event + "/TdSiDatas"; } }; Ian Gable

  8. Converters • In terms of Gaudi a converter is a class that works with the TDS to transform objects from one representation to another. • Converters become associated with TDS objects such that after a TDS object is matched with the appropriate converter only one line is needed to load the object • SmartDataPtr<TDSObject> m_tdsObj(eventSvc(), “/Event/Sublevel/TDSObjects”) • Once the above call is made the TDS checks to see if there is a pointer to an object in memory and if does not exists the appropriate converter is called to bring the object to life. • An object can be loaded from whatever persistent form it exists in or it can be made from transforming another object. Ian Gable

  9. Things to come away with • TDS objects are easy to create and fit into the existing Gaudi GLAST frame work. • Converters are very versatile. • Once implemented a TDS object is simple to use. • One line loading of an object which the end user doesn’t need to think about. It just happens. • For more information please see the GLAST Gaudi home page. Linked from Software home • Have a look at my document Making TDS objects and Converters http://www-glast.slac.stanford.edu/software/Gaudi/starting_point/tdsobjects.htm Ian Gable

More Related