Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:01:36

0001 // -*- C++ -*-
0002 //
0003 // Package:    EveDisplayPlugin
0004 // Class:      EveDisplayPlugin
0005 //
0006 /**\class EveDisplayPlugin EveDisplayPlugin.cc Reve/EveDisplayPlugin/src/EveDisplayPlugin.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Chris D Jones
0015 //         Created:  Wed Sep 26 08:27:23 EDT 2007
0016 //
0017 //
0018 
0019 #include "TROOT.h"
0020 #include "TSystem.h"
0021 #include "TColor.h"
0022 #include "TStyle.h"
0023 #include "TEnv.h"
0024 
0025 // system include files
0026 #include <memory>
0027 #include <iostream>
0028 #include <sstream>
0029 
0030 // user include files
0031 #include "FWCore/Framework/interface/Frameworkfwd.h"
0032 #include "Fireworks/Geometry/interface/DisplayPlugin.h"
0033 #include "Fireworks/Geometry/interface/DisplayPluginFactory.h"
0034 
0035 #include "Fireworks/Geometry/interface/DisplayGeomRecord.h"
0036 
0037 #include "FWCore/Framework/interface/ESHandle.h"
0038 #include "FWCore/Framework/interface/EventSetup.h"
0039 
0040 #include "TGeoManager.h"
0041 #include "TEveManager.h"
0042 #include "TEveGeoNode.h"
0043 
0044 //
0045 // class decleration
0046 //
0047 
0048 class EveDisplayPlugin : public fireworks::geometry::DisplayPlugin {
0049 public:
0050   explicit EveDisplayPlugin(edm::ConsumesCollector);
0051   ~EveDisplayPlugin() override;
0052 
0053 private:
0054   void run(const edm::EventSetup&) override;
0055   const edm::ESGetToken<TGeoManager, DisplayGeomRecord> m_geomToken;
0056 };
0057 
0058 //
0059 // constants, enums and typedefs
0060 //
0061 
0062 //
0063 // static data member definitions
0064 //
0065 
0066 //
0067 // constructors and destructor
0068 //
0069 EveDisplayPlugin::EveDisplayPlugin(edm::ConsumesCollector iCollector) : m_geomToken(iCollector.esConsumes()) {
0070   //now do what ever initialization is needed
0071 }
0072 
0073 EveDisplayPlugin::~EveDisplayPlugin() {
0074   // do anything here that needs to be done at desctruction time
0075   // (e.g. close files, deallocate resources etc.)
0076 }
0077 
0078 //
0079 // member functions
0080 //
0081 // ------------ method called to for each event  ------------
0082 void EveDisplayPlugin::run(const edm::EventSetup& iSetup) {
0083   std::cout << "In the EveDisplayPlugin::analyze method..." << std::endl;
0084   using namespace edm;
0085 
0086   TGeoManager const& geom = iSetup.getData(m_geomToken);
0087 
0088   TEveManager::Create();
0089 
0090   TEveGeoTopNode* trk = new TEveGeoTopNode(const_cast<TGeoManager*>(&geom), geom.GetTopNode());
0091   trk->SetVisLevel(2);
0092   gEve->AddGlobalElement(trk);
0093 }
0094 
0095 //define this as a plug-in
0096 DEFINE_FIREWORKS_GEOM_DISPLAY(EveDisplayPlugin);