CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/Fireworks/Geometry/plugins/EveDisplayPlugin.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    EveDisplayPlugin
00004 // Class:      EveDisplayPlugin
00005 // 
00013 //
00014 // Original Author:  Chris D Jones
00015 //         Created:  Wed Sep 26 08:27:23 EDT 2007
00016 // $Id: EveDisplayPlugin.cc,v 1.1 2010/04/01 21:58:00 chrjones Exp $
00017 //
00018 //
00019 
00020 // system include files
00021 #include <memory>
00022 #include <iostream>
00023 #include <sstream>
00024 
00025 // user include files
00026 #include "FWCore/Framework/interface/Frameworkfwd.h"
00027 #include "Fireworks/Geometry/interface/DisplayPlugin.h"
00028 #include "Fireworks/Geometry/interface/DisplayPluginFactory.h"
00029 
00030 #include "Fireworks/Geometry/interface/DisplayGeomRecord.h"
00031 
00032 #include "FWCore/Framework/interface/ESHandle.h"
00033 #include "FWCore/Framework/interface/EventSetup.h"
00034 
00035 #include "TGeoManager.h"
00036 #include "TEveManager.h"
00037 #include "TEveGeoNode.h"
00038 
00039 //
00040 // class decleration
00041 //
00042 
00043 class EveDisplayPlugin : public fireworks::geometry::DisplayPlugin {
00044 
00045    public:
00046       explicit EveDisplayPlugin();
00047       ~EveDisplayPlugin();
00048 
00049 
00050    private:
00051       virtual void run(const edm::EventSetup&);
00052 
00053 };
00054 
00055 //
00056 // constants, enums and typedefs
00057 //
00058 
00059 //
00060 // static data member definitions
00061 //
00062 
00063 //
00064 // constructors and destructor
00065 //
00066 EveDisplayPlugin::EveDisplayPlugin()
00067 {
00068    //now do what ever initialization is needed
00069 
00070 }
00071 
00072 
00073 EveDisplayPlugin::~EveDisplayPlugin()
00074 {
00075  
00076    // do anything here that needs to be done at desctruction time
00077    // (e.g. close files, deallocate resources etc.)
00078 
00079 }
00080 
00081 
00082 //
00083 // member functions
00084 //
00085 // ------------ method called to for each event  ------------
00086 void
00087 EveDisplayPlugin::run(const edm::EventSetup& iSetup)
00088 {
00089   std::cout << "In the EveDisplayPlugin::analyze method..." << std::endl;
00090    using namespace edm;
00091 
00092    ESHandle<TGeoManager> geom;
00093    iSetup.get<DisplayGeomRecord>().get(geom);
00094 
00095 
00096    TEveManager::Create();
00097 
00098    TEveGeoTopNode* trk = new TEveGeoTopNode(const_cast<TGeoManager*>(geom.product()),
00099                                             geom->GetTopNode());
00100    trk->SetVisLevel(2);
00101    gEve->AddGlobalElement(trk);
00102 
00103 }
00104 
00105 
00106 //define this as a plug-in
00107 DEFINE_FIREWORKS_GEOM_DISPLAY(EveDisplayPlugin);