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

SGtester.cxx

Go to the documentation of this file.
00001 // ================================================
00002 //        ClusterMaker class Implementation
00003 //
00004 //  + PreCluster helper class
00005 //
00006 // ================================================
00007 //
00008 // Namespace Atlfast
00009 //
00010 #include "AtlfastAlgs/SGtester.h"
00011 // This package includes
00012 #include "AtlfastUtils/TesIO.h"
00013 #include "AtlfastEvent/CollectionDefs.h"
00014 #include "AtlfastAlgs/AssocTypeRecoverer.h"
00015 #include "AtlfastAlgs/AssocTypeConverter.h"
00016 #include "AtlfastUtils/CastAwayConst.h"
00017 #include "AtlfastUtils/HeaderPrinter.h"
00018 
00019 #include <algorithm>
00020 #include <vector>
00021 
00022 // Gaudi includes
00023 #include "GaudiKernel/DataSvc.h"
00024 #include "StoreGate/DataHandle.h"
00025 #include "GaudiKernel/ISvcLocator.h"
00026 #include "GaudiKernel/MsgStream.h"
00027 
00028 #include "StoreGate/tools/ClassID_traits.h"
00029 namespace Atlfast{
00030   class MyBigClass{
00031   public:
00032     MyBigClass(){
00033       for(int i=0; i!=1000; ++i){
00034         m_vec.push_back(i);
00035       }
00036     }
00037   private:
00038     std::vector<int> m_vec;
00039   };
00040 }
00041 CLASS_DEF(DataVector<Atlfast::MyBigClass>,            2350, 0)
00042 CLASS_DEF(DataVector<Atlfast::TwoCptCell>,            2351, 0)
00043 namespace Atlfast {
00044   //--------------------------------
00045   // Constructors and destructors
00046   //--------------------------------
00047   
00048   SGtester::SGtester
00049   ( const std::string& name, ISvcLocator* pSvcLocator ) 
00050     : Algorithm( name, pSvcLocator ){
00051     
00052     m_outputLocation1      = "/Event/SGtesterLocation1";
00053     m_outputLocation2      = "/Event/SGtesterLocation2";
00054   }
00055 
00056   // Destructor
00057   SGtester::~SGtester() {
00058     if(m_tesIO){ 
00059       delete m_tesIO;
00060     }
00061   } 
00062 
00063   
00064   //---------------------------------
00065   // initialise() 
00066   //---------------------------------
00067   
00068   StatusCode SGtester::initialize(){
00069  
00070    MsgStream log( messageService(), name() ) ;
00071    log << MSG::DEBUG<< "Cluster Maker initialising " << endreq;
00072  
00073 
00074    //    m_tesIO = new TesIO( eventDataService() );
00075    m_tesIO = new TesIO();
00076 
00077     HeaderPrinter hp("Atlfast SGtester: ", log);
00078     hp.add("Output Location1             ", m_outputLocation1);    
00079     hp.add("Output Location2             ", m_outputLocation2);    
00080     hp.print();
00081 
00082     return StatusCode::SUCCESS ;
00083   }
00084   
00085   //---------------------------------
00086   // finalise() 
00087   //---------------------------------
00088   
00089   StatusCode SGtester::finalize(){
00090     return StatusCode::SUCCESS ;
00091   }
00092   
00093 
00094   //----------------------------------------------
00095   // execute() method called once per event
00096   //----------------------------------------------
00097   //
00098   // This execute method is written to take care of the administration
00099   // only (accessing TES, etc).
00100   //
00101   // The actual clustering strategy is delegated to a further method
00102   // (to become an object at some point)
00103   //
00104   // All Clusters created are output to the TES
00105   StatusCode SGtester::execute( ){
00106     MsgStream log( messageService(), name() ) ;
00107     std::string message;
00108     //.........................................................
00109     // Extract the elements (cells, tracks..) from the TES 
00110     //
00111     //copy to vector -cannot use DataVector fo r type change!
00112     //    CellCollection* v1     = new CellCollection;
00113     //    CellCollection* v2     = new CellCollection;
00114     //    std::vector<ITwoCptCell*>* v2 = new std::vector<ITwoCptCell*>; // no ClassID
00115     DataVector<ITwoCptCell>* v1 = new DataVector<ITwoCptCell>;
00116     //    DataVector<MyBigClass>* v1 = new DataVector<MyBigClass>;
00117     for(int i =0; i!=10000; ++i){
00118       //      ITwoCptCell* c = new TwoCptCell;
00119       //      MyBigClass* c = new MyBigClass;
00120       ITwoCptCell* c = new TwoCptCell;
00121       v1->push_back(c);
00122     }
00123     //......................................
00124     // Set up for conversions of unused IKinematics back to concrete types
00125     //
00126 
00127     //Register the newly made clusters
00128     TesIoStat stat;
00129     stat = m_tesIO -> store(v1, m_outputLocation1);
00130     message = stat ?  "v1":"Failed to store v1 ";
00131     log<<MSG::DEBUG<<message<<endreq;
00132 
00133     //    stat = m_tesIO -> store(v2, m_outputLocation2);
00134     //    message = stat ?  "v2":"Failed to store v2 ";
00135     //    log<<MSG::DEBUG<<message<<endreq;
00136     return stat ;
00137     
00138   }
00139   
00140 } // end of namespace bracket
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 

Generated on Tue Mar 18 11:18:24 2003 for AtlfastAlgs by doxygen1.3-rc1