Transcript Heather

GLAST LAT Offline Software
Workshop - SLAC, Jan. 16-19, 2001
Persistent Data Store
Root I/O and the Gaudi Framework
GLAST LAT Offline Software
Workshop - SLAC, Jan. 16-19, 2001
Persistent Data… what?
• The data exists for later use, after the current run is finished.
– As input to another run within Gaudi or for external use.
• Data will be stored in Root files
– Why?
• We plan to support Root Analysis.
• We have the capability to allow IDL to read in Root files.
– Root2IDL
» A new version will be available for the Balloon.
• Gaudi framework provides the necessary converters to
read / write Root files.
2
GLAST LAT Offline Software
Workshop - SLAC, Jan. 16-19, 2001
Where we stand
•
•
•
The Gaudi framework provides an Event Persistency Service.
The service handles the details of calling the appropriate converter.
Converters handle the details of writing the event data to a specific
type of file or database.
– Gaudi v5 & v6 provide converters to write to Root files.
– Each object to be read / written to Root must provide serialize
methods.
• 2 simple routines:
StreamBuffer& serialize( StreamBuffer& s ) const {
return s << myData1 << myData2;
}
StreamBuffer& serialize( StreamBuffer& s ) {
return s >> myData1 >> myData2;
}
•
– Each object needs a Root converter – which is setup via a Gaudi
provided macro.
We can read / write from Root files using either Gaudi v5 or v6.
3
GLAST LAT Offline Software
Workshop - SLAC, Jan. 16-19, 2001
How does it work?
• For each event, the Transient
Data Store (TDS) contains the
event data.
• Writing to Root
– At the end of each event
(before the TDS is cleared),
data is stored in a Root
buffer.
– For every item in the TDS
that has been specified in
the job options file:
Event Loop
write data
retrieve data
Event
Persistency
Service
serialize(buffer s)
Root Converter
• The Data object’s
“serialize” method is
called to stream the
object’s data into a buffer.
– The Root files produced
store objects as TBlobs.
TDS
Algorithms
s
s << data1
<< data2
<< dataN;
Root File
4
GLAST LAT Offline Software
Workshop - SLAC, Jan. 16-19, 2001
Reading from an existing Root file
•
Occurs at the beginning of an
event to fill the TDS or during an
algorithm’s execution.
TDS
•
For each TBlob retrieved from
the Root file, the serialize method
for each object is called to
populate the object with the
appropriate values. The newly
created object is then inserted
into the TDS.
Event Loop
Event
Persistency
Service
Algorithms
Root File
Root Converter
serialize(buffer s)
s >> data1
>> data2
>> dataN;
5
GLAST LAT Offline Software
Workshop - SLAC, Jan. 16-19, 2001
Issues to be Addressed
•
•
•
In order to generalize the writing and reading of data into / out of Root
files, a generic data object named TBlob is utilized.
The TBlob is just a buffer, where the bits of the various data objects is
streamed in / out.
<< myData1 << myData2
myData1Bits
myData2Bits
>> myData1 >> myData2
TBlob Buffer
The actual structure of the data objects as they exist in Gaudi is lost.
– Fast I/O
– But…how do we analyze this data?
• Two Possible Solutions – Short Term & Long Term
– Convert TBlobs into our data objects.
– Modify the mechanism for Root I/O in Gaudi to write out the data as full
objects.
» This work will most likely be taken care of in a future version
of Gaudi if we can afford to wait.
6
GLAST LAT Offline Software
Workshop - SLAC, Jan. 16-19, 2001
Issues to be Addressed Continued…
• Gaudi v5 and Gaudi v6 store data in Root files slightly
differently…but use the same basic concept.
– So Root files generated using v5 cannot be read back in
when using v6.
– Changes will continue, but ultimately, it will converge.
– In the meantime, lack of backward compatibility can be fixed
if deemed necessary…
– This will become more important as we prepare to create
large data sets.
– The Gaudi team is aware of the situation.
7
GLAST LAT Offline Software
Workshop - SLAC, Jan. 16-19, 2001
Summary & Shameless Plug
• Root I/O works in the Gaudi framework.
• To setup an object to be available for Root I/O requires 3 things:
– Setup the serialize methods.
– Use the appropriate converter macro:
• _ImplementConverter(myTypeofObject)
• _ImplementContainerConverters(myTypeofObject)
– Set the appropriate input parameters in the job options file.
• More details of how to setup Gaudi to write / read Root files will
be explained at the software tutorial session tomorrow!
8