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

Atlfast::TesIO Class Reference

#include <TesIO.h>

List of all members.


Public Types

typedef std::string String

Public Methods

 TesIO ()
TesIoStat getMC (MCparticleCollection &) const
TesIoStat getMC (MCparticleCollection &, const HepMC_helper::IMCselector *) const
template<class T> TesIoStat copy (std::vector< T * > &) const
template<class T> TesIoStat copy (std::vector< T * > &, String key) const
template<class T> TesIoStat getDH (const DataHandle< T > &) const
template<class T> TesIoStat getDH (const DataHandle< T > &, String key) const
template<class T> TesIoStat store (T *) const
template<class T> TesIoStat store (T *, String key) const

Private Attributes

StoreGateSvc * m_sgSvc

Member Typedef Documentation

typedef std::string Atlfast::TesIO::String
 

Definition at line 49 of file TesIO.h.


Constructor & Destructor Documentation

Atlfast::TesIO::TesIO   [inline]
 

Definition at line 72 of file TesIO.h.

References m_sgSvc.

00072                      :m_sgSvc(0){
00073     ISvcLocator* svcLoc = Gaudi::svcLocator( );
00074     if( (svcLoc->service( "StoreGateSvc", m_sgSvc )).isFailure() ){
00075       throw TesIoStat(StatusCode::FAILURE, "TesIO could not find StoreGate");
00076     }
00077   }    

Member Function Documentation

TesIoStat Atlfast::TesIO::getMC MCparticleCollection &    const
 

Definition at line 16 of file TesIO.cxx.

00016                                                                 {
00017     const HepMC_helper::IMCselector* selector = new HepMC_helper::All();
00018     TesIoStat stat = this->getMC(mcParticles, selector);
00019     return stat;
00020   }

TesIoStat Atlfast::TesIO::getMC MCparticleCollection &   ,
const HepMC_helper::IMCselector  
const
 

Definition at line 23 of file TesIO.cxx.

References getDH().

00024                                                                        {
00025     
00026     const DataHandle<McEventCollection> mcCollptr;
00027     TesIoStat stat = this->getDH(mcCollptr);
00028     if(!stat){
00029       return TesIoStat(StatusCode::FAILURE,"Could not find MC ptcles in TES");
00030     }
00031       
00032     //    HepMC_helper::MCselectorWrapper wrappedSelector(selector);
00033     
00034     // Iterate over all McEvent records
00035     McEventCollection::const_iterator itr;
00036     for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
00037       // Access the HepMC record which is wrapped within McEvent
00038       HepMC::GenEvent* genEvt = (*itr)->pGenEvt()  ;
00039       if(genEvt == 0) return TesIoStat(StatusCode::FAILURE,
00040                                        "Could not find HEP Gen event");
00041       
00042       // Copy all final state particles of the correct type into the 
00043       // collection
00044       
00045       //      HepMC::copy_if( genEvt->particles_begin(), 
00046       //              genEvt->particles_end(),
00047       //              back_inserter( mcParticles),
00048       //              wrappedSelector
00049       //              );
00050       //      HepMC::copy_if( genEvt->particles_begin(), 
00051       //              genEvt->particles_end(),
00052       //              back_inserter( mcParticles),
00053       //              *(selector->create())
00054       //              );
00055             GenEvent::particle_const_iterator it= genEvt->particles_begin();
00056             GenEvent::particle_const_iterator en= genEvt->particles_end();
00057             for(; it!=en; ++it){
00058               if((*selector)(*it)){mcParticles.push_back(*it);}
00059             }
00060     }
00061     
00062     return TesIoStat(StatusCode::SUCCESS);
00063     
00064   }

template<class T>
TesIoStat Atlfast::TesIO::copy std::vector< T * > &    const [inline]
 

Definition at line 82 of file TesIO.h.

References getDH(), and Atlfast::TesIoStat::message().

00082                                                         {
00083     DataHandle<ObjectVector<T> > objects;
00084     TesIoStat stat = this->getDH(objects);
00085     if(!stat) {
00086       return TesIoStat(StatusCode::FAILURE,
00087                        "Could not copy collection: "+stat.message());
00088     }
00089     
00090     std::copy(objects->begin(),objects->end(),back_inserter(localCopy));
00091     return TesIoStat(StatusCode::SUCCESS, "Copied Collection from TDS");
00092     
00093   }

template<class T>
TesIoStat Atlfast::TesIO::copy std::vector< T * > &   ,
String    key
const [inline]
 

Definition at line 98 of file TesIO.h.

References getDH(), and Atlfast::TesIoStat::message().

00098                                                                     {
00099     DataHandle<ObjectVector<T> > objects;
00100     TesIoStat stat = this->getDH(objects, key);
00101     if(!stat){
00102       return TesIoStat(StatusCode::FAILURE,
00103                        "Could not copy keyed collection: "+stat.message());
00104     }
00105 
00106     std::copy(objects->begin(),objects->end(),back_inserter(localCopy));
00107     return TesIoStat(StatusCode::SUCCESS, "Copied Collection from TDS");
00108     
00109   }

template<class T>
TesIoStat Atlfast::TesIO::getDH const DataHandle< T > &    const [inline]
 

Definition at line 114 of file TesIO.h.

References m_sgSvc.

Referenced by copy(), and getMC().

00114                                                         {
00115     if((m_sgSvc->retrieve(dh)).isFailure() ){
00116       return TesIoStat(StatusCode::FAILURE,
00117                        "Could not find a valid DataHandle");
00118     }
00119     return TesIoStat(StatusCode::SUCCESS, "Found unkeyed DH in TDS");
00120   }

template<class T>
TesIoStat Atlfast::TesIO::getDH const DataHandle< T > &   ,
String    key
const [inline]
 

Definition at line 125 of file TesIO.h.

References m_sgSvc.

00125                                                                     {
00126     if( (m_sgSvc->retrieve(dh, key)).isFailure() ){
00127       return TesIoStat(StatusCode::FAILURE,
00128                        "Could not find a valid keyed DataHandle");
00129     }
00130     return TesIoStat(StatusCode::SUCCESS, "Found keyed DH in TDS");
00131   }

template<class T>
TesIoStat Atlfast::TesIO::store T *    const [inline]
 

Definition at line 135 of file TesIO.h.

References m_sgSvc.

00135                                                                   { 
00136     return (TesIoStat(m_sgSvc->record(pObject)) ) ;
00137   }

template<class T>
TesIoStat Atlfast::TesIO::store T *   ,
String    key
const [inline]
 

Definition at line 142 of file TesIO.h.

References m_sgSvc.

00142                                                       { 
00143     return (TesIoStat(m_sgSvc->record(storee, key)) ) ;
00144   }

Member Data Documentation

StoreGateSvc* Atlfast::TesIO::m_sgSvc [private]
 

Definition at line 65 of file TesIO.h.

Referenced by getDH(), store(), and TesIO().


The documentation for this class was generated from the following files:
Generated on Wed Jan 15 11:00:34 2003 for AtlfastUtils by doxygen1.3-rc1