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

McDisplayAlg.cxx

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/McDisplay/src/McDisplayAlg.cxx,v 1.2 2001/02/18 17:41:17 burnett Exp $
00002 
00003 // Include files
00004 #include "McDisplay/McDisplayAlg.h"
00005 
00006 #include "Gaudi/MessageSvc/MsgStream.h"
00007 #include "Gaudi/Kernel/AlgFactory.h"
00008 #include "Gaudi/Interfaces/IDataProviderSvc.h"
00009 #include "Gaudi/DataSvc/SmartDataPtr.h"
00010 
00011 
00012 #include "gui/DisplayControl.h"
00013 #include "GuiSvc/GuiSvc.h"
00014 #include "gui/GuiMgr.h"
00015 
00016 static const AlgFactory<McDisplayAlg>  Factory;
00017 const IAlgFactory& McDisplayAlgFactory = Factory;
00018 
00019 
00020 //------------------------------------------------------------------------------
00023 McDisplayAlg::McDisplayAlg(const std::string& name, ISvcLocator* pSvcLocator) :
00024 Algorithm(name, pSvcLocator), m_detSvc(0) {
00025 }
00026 
00027 
00028 //------------------------------------------------------------------------------
00035 StatusCode McDisplayAlg::initialize() {
00036 
00037     MsgStream log(msgSvc(), name());
00038     log << MSG::INFO << "initialize" << endreq;
00039     
00040    StatusCode sc = StatusCode::SUCCESS;
00041     GuiSvc* guiSvc=0;
00042     
00043     if ( service("GuiSvc", guiSvc).isFailure() ){
00044         log << MSG::WARNING << "Couldn't find the GuiSvc!" << endreq;
00045         sc =StatusCode::SUCCESS; 
00046     }else
00047     {
00048         makeTree();
00049 
00050         gui::DisplayControl& display = guiSvc->guiMgr()->display();
00051 
00052         display.add(m_mcEvent = new DisplayMcEvent(m_root), "McEvents hits");
00053     }
00054     
00055     return sc;
00056 }
00057 
00058 
00059 //------------------------------------------------------------------------------
00060 StatusCode McDisplayAlg::execute() {
00061     
00062     StatusCode  yoMomma = StatusCode::SUCCESS;
00063     MsgStream   log( msgSvc(), name() );
00064     log << MSG::INFO << "execute" << endreq;
00065     
00066     return yoMomma;
00067     
00068 }
00069 
00070 
00071 //------------------------------------------------------------------------------
00072 StatusCode McDisplayAlg::finalize() {
00073     
00074     MsgStream log(msgSvc(), name());
00075     log << MSG::INFO << "finalize" << endreq;    
00076     return StatusCode::SUCCESS;
00077 }
00078 
00079 
00080 StatusCode McDisplayAlg::makeTree(){
00081 
00082     m_root = new McVertex();
00083 
00084     m_part1 = new McParticle();
00085     m_part2 = new McParticle();
00086     m_part3 = new McParticle();
00087 
00088     m_vert1 = new McVertex();
00089     m_vert2 = new McVertex();
00090     m_vert3 = new McVertex();
00091 
00092 
00093     m_root->setInitialPosition(HepPoint3D(0,0,50));
00094     m_root->setMcParticle(m_part1);
00095     m_part1->setMcVertex(m_root);
00096     m_root->setFinalPosition(HepPoint3D(0,0,30));
00097 
00098     m_root->addDaughterMcParticle(m_part2);
00099     m_root->addDaughterMcParticle(m_part3);
00100 
00101     m_part2->setMcVertex(m_vert1);
00102     m_part3->setMcVertex(m_vert2);
00103 
00104     m_vert1->setInitialPosition(HepPoint3D(0,0,30));
00105     m_vert2->setInitialPosition(HepPoint3D(0,0,30));
00106 
00107     m_vert1->setFinalPosition(HepPoint3D(0,30,25));
00108     m_vert2->setFinalPosition(HepPoint3D(0,-30,25));
00109 
00110     return StatusCode::SUCCESS;
00111 
00112 }
00113 
00114 
00115 

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