Main Page   Modules   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

NoiseOccupancyTestResultStreamer.cpp

Go to the documentation of this file.
00001 #include "../NoiseOccupancyTestResult.h"
00002 #include "../RootStreamableAdapter.h"
00003 #include "NoiseOccupancyTestResultStreamer.h"
00004 
00005 #include <TGraph.h>
00006 #include <TF1.h>
00007 
00008 using namespace Sct;
00009 
00010 namespace SctData {
00011 namespace IO {
00012 
00013 
00014 NoiseOccupancyTestResultStreamer::NoiseOccupancyTestResultStreamer() throw() {}
00015 
00016 bool NoiseOccupancyTestResultStreamer::inMap = IOManager::addToMap("SctData::NoiseOccupancyTestResult", auto_ptr<Streamer>(new NoiseOccupancyTestResultStreamer()));
00017 
00018 shared_ptr<Streamable> NoiseOccupancyTestResultStreamer::read(IStream& in, const IOManager& manager) const throw(LogicError, IoError) {
00019     shared_ptr<Streamable> ad (new NoiseOccupancyTestResult());
00020     read(in, *ad, manager);
00021     return ad;
00022 }
00023 
00024 void NoiseOccupancyTestResultStreamer::write(OStream& out, const Streamable& ob, const IOManager& manager) const throw(LogicError, IoError) {
00025     //Let superclass do its work
00026     TestResultStreamer::write(out, ob, manager);
00027 
00028     const NoiseOccupancyTestResult& mytest = dynamic_cast<const NoiseOccupancyTestResult&>(ob);
00029     for (unsigned int ichip=0; ichip<nChipModule; ichip++) {
00030         writeChipResult(out, mytest.getChipResult(ichip), manager);
00031     }
00032 }
00033 
00034 void NoiseOccupancyTestResultStreamer::read(IStream& in, Streamable& ob, const IOManager& manager) const throw(LogicError, IoError) {
00035     TestResultStreamer::read(in, ob, manager);
00036 
00037     NoiseOccupancyTestResult& mytest = dynamic_cast<NoiseOccupancyTestResult&>(ob);
00038     for (unsigned int ichip=0; ichip<nChipModule; ichip++) {
00039         readChipResult(in, mytest.getChipResult(ichip), manager);
00040     }
00041 }
00042 
00043 void NoiseOccupancyTestResultStreamer::writeChipResult(OStream& out, const ChipNOResult& c, const IOManager& manager) const throw (LogicError, IoError) {
00044     manager.writeImpl(out, RootStreamableAdapter( *c.graph ), true);
00045     manager.writeImpl(out, RootStreamableAdapter( *c.fit ), false);
00046     out << c.mean << c.rms << c.offset;
00047 }
00048 
00049 void NoiseOccupancyTestResultStreamer::readChipResult(IStream& in, ChipNOResult& c, const IOManager& manager) const throw(LogicError, IoError) {
00050     shared_ptr<Streamable> ob = manager.readImpl(in);
00051     shared_ptr<RootStreamableAdapter> ad  = boost::dynamic_pointer_cast<RootStreamableAdapter>(ob);
00052     c.graph = shared_ptr<TGraph> ( dynamic_cast<TGraph*>(ad->getObject()));
00053     
00054     auto_ptr<TF1> f = NoiseOccupancyTestResult::createFitFunction();
00055     RootStreamableAdapter ad2( *f.release() );
00056     manager.readImpl(in, ad2, false);
00057     c.fit = shared_ptr<TF1> ( dynamic_cast<TF1*>(ad2.getObject()) );
00058     in >> c.mean >> c.rms >> c.offset;
00059 }
00060 
00061 }
00062 }

Generated on Mon Dec 15 19:36:09 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3