/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/GenAnalysisTools/TruthHelper/TruthHelper-00-00-01/TruthHelper/GenAccessIO.h

Go to the documentation of this file.
00001 //
00002 #ifndef TRUTHHELPER_GENACCESSIO_H
00003 #define TRUTHHELPER_GENACCESSIO_H
00004 // STL
00005 #include <string>
00006 #include "GaudiKernel/Bootstrap.h"
00007 #include "GaudiKernel/ISvcLocator.h"
00008 #include "GaudiKernel/DataObject.h"
00009 #include "GaudiKernel/ObjectVector.h"
00010 // StoreGate
00011 #include "StoreGate/StoreGateSvc.h"
00012 // #include "StoreGate/DataHandle.h"
00013 
00014 #include "GeneratorObjects/McEventCollection.h"
00015 #include "HepMC/GenParticle.h"
00016 #include <vector>
00017 typedef std::vector<const HepMC::GenParticle*>  MCparticleCollection ;
00018 typedef std::vector<const HepMC::GenParticle*>::const_iterator  MCparticleCollectionCIter ;
00019  
00020 class GenIMCselector;
00021 
00022 class GenAccessIO {
00023 public:
00024   typedef std::string String;
00025   //
00026   GenAccessIO();
00027   StatusCode getMC   (MCparticleCollection&)                            const;
00028   StatusCode getMC   (MCparticleCollection&, 
00029                       const GenIMCselector* )                const;
00030   //
00031   StatusCode getDH (const McEventCollection*&)             const;
00032   StatusCode getDH (const McEventCollection*&, String key) const;
00033   StatusCode store (McEventCollection*)                               const;
00034   StatusCode store (McEventCollection*, String key) const;
00035   
00036 private:
00037   //    IDataProviderSvc* m_dataSvc;
00038   StoreGateSvc* m_sgSvc;
00039 };
00040 
00041 
00042 inline GenAccessIO::GenAccessIO():m_sgSvc(0){
00043   ISvcLocator* svcLoc = Gaudi::svcLocator( );
00044   if( (svcLoc->service( "StoreGateSvc", m_sgSvc )).isFailure() ){
00045     throw StatusCode::FAILURE;
00046   }
00047 }
00048 
00049 inline 
00050 StatusCode GenAccessIO::getDH(const McEventCollection*& dh) const {
00051   if((m_sgSvc->retrieve(dh)).isFailure() ){
00052     return StatusCode::FAILURE;
00053   }
00054   return StatusCode::SUCCESS;
00055 }
00056 
00057 inline 
00058 StatusCode GenAccessIO::getDH(const McEventCollection*& dh, String key) const {
00059   if( (m_sgSvc->retrieve(dh, key)).isFailure() ){
00060     return StatusCode::FAILURE;
00061   }
00062   return StatusCode::SUCCESS;
00063 }
00064 
00065 inline StatusCode GenAccessIO::store(McEventCollection* pObject) const { 
00066   return (m_sgSvc->record(pObject) ) ;
00067 }
00068 
00069 inline 
00070 StatusCode GenAccessIO::store(McEventCollection* storee, String key) const { 
00071   return (m_sgSvc->record(storee, key) ) ;
00072 }
00073 
00074 #endif

Generated on Tue Nov 29 23:12:39 2016 for BOSS_7.0.2 by  doxygen 1.4.7