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

IrfAcdHitCnv.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 //
00003 // Implementation of class :  IrfAcdHitCnv
00004 //
00005 //
00006 //------------------------------------------------------------------------------
00007 #define IrfAcdHitCnv_CPP 
00008 
00009 // Include files
00010 #include "GaudiKernel/CnvFactory.h"
00011 #include "GaudiKernel/IDataProviderSvc.h"
00012 #include "GlastEvent/TopLevel/ObjectVector.h"
00013 #include "GlastEvent/Irf/IrfAcdHit.h"
00014 #include "GaudiKernel/IGlastDetSvc.h"
00015 
00016 #include "src/EventSelector/IRFConverter.h"
00017 
00018 // Inherited sources
00019 #include "GlastSvc/Irf/IrfAcdHitCnv.h"
00020 
00021 
00022 // Instantiation of a static factory class used by clients to create instances
00023 static CnvFactory<IrfAcdHitCnv> s_factory;
00024 const ICnvFactory& IrfAcdHitCnvFactory = s_factory;
00025 
00027 StatusCode IrfAcdHitCnv::createObj(IOpaqueAddress* pAddress, DataObject*& refpObject)   {
00028   refpObject = new IrfAcdHitVector();
00029   StatusCode status = updateObj(pAddress, refpObject);
00030   if ( !status.isSuccess() )   {
00031     delete refpObject;
00032     refpObject = 0;
00033   }
00034   return status;
00035 }
00036 
00038 StatusCode IrfAcdHitCnv::updateObj(IOpaqueAddress* pAddress, DataObject* pObject)   {
00039   ObjectVector<IrfAcdHit>* tileList  = dynamic_cast<ObjectVector<IrfAcdHit>*>(pObject);
00040   if ( 0 != tileList )    {
00041 
00042       // read in the ACD data via the GlastDetector::accept method
00043       IRFConverter myConverter;
00044       m_detSvc->accept(myConverter);
00045       
00046       // iterate over the tiles and store in the pObject vector
00047       ObjectVector<IrfAcdHit>* acdData = myConverter.getIrfAcdHits();// Very important method.
00048       for (ObjectVector<IrfAcdHit>::const_iterator it = acdData->begin(); it != acdData->end(); it++) {
00049           IrfAcdHit * tile = new IrfAcdHit();
00050           tile->setEnergy((*it)->energy());
00051           tile->setId((*it)->id());
00052           tileList->push_back(tile);
00053       }
00054 
00055       return StatusCode::SUCCESS;
00056   }
00057 
00058   return StatusCode::FAILURE;
00059 }
00060 
00062 const CLID& IrfAcdHitCnv::classID()    {
00063   return ObjectVector<IrfAcdHit>::classID(); 
00064 }
00065 
00067 IrfAcdHitCnv::IrfAcdHitCnv(ISvcLocator* svc) 
00068 : BaseCnv(classID(), svc)
00069 {
00070 
00071   declareObject("/Event/Irf/IrfAcdHits", objType(), "PASS");
00072 }
00073 
00075 IrfAcdHitCnv::~IrfAcdHitCnv(){ }

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