Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

LdGlastDataCnv.cpp

Go to the documentation of this file.
00001 // LdGlastDataCnv.cpp: implementation of the LdGlastDataCnv class.
00002 //
00004 
00005 #define LdGlastDataCnv_CPP
00006 
00007 #include "GaudiKernel/CnvFactory.h"
00008 #include "GaudiKernel/IDataProviderSvc.h"
00009 #include "GaudiKernel/ObjectVector.h"
00010 #include "GlastSvc/../src/data/TdCsIData.h"
00011 #include "GlastSvc/../src/data/TdSiData.h"
00012 #include "GlastSvc/../src/data/TdVetoData.h"
00013 #include "GlastSvc/../src/data/LdGlastData.h"
00014 
00015 #include "GlastSvc/GlastDetSvc/IGlastDetSvc.h"
00016 
00017 #include "src/EventSelector/IRFConverter.h"
00018 #include "GlastSvc/data/LdGlastDataCnv.h"
00019 
00020 
00021 
00023 static CnvFactory<LdGlastDataCnv> s_factory;
00024 const ICnvFactory& LdGlastDataCnvFactory = s_factory;
00025 
00026 // local static copy.
00027 static IRFConverter myConverter;
00028 
00030 StatusCode LdGlastDataCnv::createObj(IOpaqueAddress* pAddress, DataObject*& refpObject)   {
00031 
00032     myConverter.clear();
00033     
00034     m_detSvc->accept(myConverter);
00035     
00036     // Make sure that the IRFConverter copy of the TdSiData is
00037     // not being deleted
00038     
00039     const SiData* si = myConverter.getSiData();
00040     const CsIData* csi = myConverter.getCsIData();
00041     const IVetoData* veto = myConverter.getVetoData();
00042     
00043     LdGlastData* glastData = new LdGlastData(csi,si,veto);
00044     
00045     refpObject =  glastData;
00046     
00047     
00048     // Check to see if all is well with the IRFCOnverter copy of
00049     // TdSiData
00050     if (refpObject == NULL )   {
00051         delete refpObject;
00052         refpObject = 0;
00053         return StatusCode::FAILURE;
00054     }
00055     
00056     return StatusCode::SUCCESS;
00057 }
00058 
00060 StatusCode LdGlastDataCnv::updateObj(IOpaqueAddress* pAddress, DataObject* pObject)   {
00061 /*    TdSiData* allData;
00062 
00063     // Try to dynamic_cast pObject into a TdCsIData
00064     try {
00065         allData  = dynamic_cast<TdSiData*>(pObject);
00066     } catch(...) {
00067        return StatusCode::FAILURE;
00068     }
00069 
00070     // Read in the ACD data via the GlastDetector::accept method
00071     // This is now being dynamically declared so that we can keep
00072     // the reference for the TDS.
00073     IRFConverter* myConverter = new IRFConverter();
00074     
00075     m_detSvc->accept(*myConverter);
00076 
00077 
00078     allData =  myConverter->getTdSiData();
00079 
00080     delete myConverter;
00081     myConverter = 0;
00082 
00083     if (pObject == NULL )   {
00084         delete pObject;
00085         pObject = 0;
00086         return StatusCode::FAILURE;
00087     }*/
00088     return StatusCode::SUCCESS;
00089     
00090 }
00091 
00093 const CLID& LdGlastDataCnv::classID()    {
00094   return CLID_LdGlastDataCnv; 
00095 }
00096 
00098 LdGlastDataCnv::LdGlastDataCnv(ISvcLocator* svc) 
00099 : BaseCnv(classID(), svc)
00100 {
00101 
00102   declareObject("/Event/TdGlastData", objType(), "PASS");
00103 }
00104 
00106 LdGlastDataCnv::~LdGlastDataCnv(){ }
00107 

Generated at Wed Nov 21 12:21:13 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000