CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DummyEvelyser Class Reference

Inheritance diagram for DummyEvelyser:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DummyEvelyser (const edm::ParameterSet &)
 ~DummyEvelyser ()

Protected Member Functions

TEveGeoTopNode * make_node (const TString &path, Int_t vis_level, Bool_t global_cs)

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
virtual void endJob ()
virtual void endRun (const edm::Run &, const edm::EventSetup &)
void remakeGeometry (const DisplayGeomRecord &dgRec)

Private Attributes

edm::Service< EveServicem_eve
TEveElement * m_geomList
edm::ESWatcher< DisplayGeomRecordm_geomWatcher
TEveTrackList * m_trackList
edm::InputTag m_trackTags

Detailed Description

Definition at line 49 of file DummyEvelyser.cc.


Constructor & Destructor Documentation

DummyEvelyser::DummyEvelyser ( const edm::ParameterSet iConfig) [explicit]
DummyEvelyser::~DummyEvelyser ( )

Definition at line 102 of file DummyEvelyser.cc.

{}

Member Function Documentation

void DummyEvelyser::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 205 of file DummyEvelyser.cc.

References edm::ESWatcher< T >::check(), edm::Event::getByLabel(), m_eve, m_geomWatcher, m_trackList, m_trackTags, fireworks::prepareTrack(), and testEve_cfg::tracks.

{
   printf("DummyEvelyser::analyze\n");

   if (m_eve)
   {
      // Remake geometry if it has changed.
      m_geomWatcher.check(iSetup);


      // Stripped down demo from Tracking twiki.

      using namespace edm;

      Handle<View<reco::Track> >  tracks;
      iEvent.getByLabel(m_trackTags, tracks);

      m_trackList->DestroyElements();

      // All top-level elements are removed from default event-store at
      // the end of each event.
      m_eve->AddElement(m_trackList);

      int cnt = 0;
      for (View<reco::Track>::const_iterator itTrack = tracks->begin();
           itTrack != tracks->end(); ++itTrack, ++cnt)
      {
         TEveTrack* trk = fireworks::prepareTrack(*itTrack, m_trackList->GetPropagator());
         trk->SetElementName (TString::Format("Track %d", cnt));
         trk->SetElementTitle(TString::Format("Track %d, pt=%.3f", cnt, itTrack->pt()));
         trk->MakeTrack();
         trk->SetAttLineAttMarker(m_trackList);
         m_trackList->AddElement(trk);

         // The display() function runs the GUI event-loop and shows
         // whatever has been registered so far to eve.
         // It returns when user presses the "Step" button (or "Continue" or
         // "Next Event").
         m_eve->display(std::string("DummyEvelyser::analyze done for:\n") + trk->GetName());
      }
   }
}
void DummyEvelyser::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 134 of file DummyEvelyser.cc.

References m_eve, and m_trackList.

{
   printf("DummyEvelyser::beginJob\n");

   if (m_eve)
   {
      // Make a track-list container we'll hold on until the end of the job.
      // This allows us to preserve settings done by user via GUI.
      m_trackList = new TEveTrackList("Tracks"); 
      m_trackList->SetMainColor(6);
      m_trackList->SetMarkerColor(kYellow);
      m_trackList->SetMarkerStyle(4);
      m_trackList->SetMarkerSize(0.5);

      m_trackList->IncDenyDestroy();

      TEveTrackPropagator *prop = m_trackList->GetPropagator();
      prop->SetStepper(TEveTrackPropagator::kRungeKutta);
      // Use simplified magnetic field provided by EveService.
      m_eve->setupFieldForPropagator(prop);
   }
}
void DummyEvelyser::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 170 of file DummyEvelyser.cc.

References m_eve, and m_geomList.

{
   printf("DummyEvelyser::beginRun\n");

   if (m_eve)
   {
      m_geomList = new TEveElementList("DummyEvelyzer Geom");
      m_eve->AddGlobalElement(m_geomList);
      m_eve->getManager()->GetGlobalScene()->GetGLScene()->SetStyle(TGLRnrCtx::kWireFrame);
   }
}
void DummyEvelyser::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 157 of file DummyEvelyser.cc.

References m_trackList.

{
   printf("DummyEvelyser::endJob\n");

   if (m_trackList)
   {
      m_trackList->DecDenyDestroy();
      m_trackList = 0;
   }
}
void DummyEvelyser::endRun ( const edm::Run ,
const edm::EventSetup  
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 182 of file DummyEvelyser.cc.

{
   printf("DummyEvelyser::endRun\n");
}
TEveGeoTopNode * DummyEvelyser::make_node ( const TString &  path,
Int_t  vis_level,
Bool_t  global_cs 
) [protected]

Definition at line 110 of file DummyEvelyser.cc.

References m_geomList.

Referenced by remakeGeometry().

{
   if (! gGeoManager->cd(path))
   {
      Warning("make_node", "Path '%s' not found.", path.Data());
      return 0;
   }

   TEveGeoTopNode* tn = new TEveGeoTopNode(gGeoManager, gGeoManager->GetCurrentNode());
   tn->SetVisLevel(vis_level);
   if (global_cs)
   {
      tn->RefMainTrans().SetFrom(*gGeoManager->GetCurrentMatrix());
   }
   m_geomList->AddElement(tn);

   return tn;
}
void DummyEvelyser::remakeGeometry ( const DisplayGeomRecord dgRec) [private]

Definition at line 189 of file DummyEvelyser.cc.

References relativeConstraints::geom, edm::eventsetup::EventSetupRecord::get(), m_geomList, make_node(), and edm::ESHandle< T >::product().

{
   m_geomList->DestroyElements();

   edm::ESHandle<TGeoManager> geom;
   dgRec.get(geom);
   TEveGeoManagerHolder _tgeo(const_cast<TGeoManager*>(geom.product()));

   // To have a full one, all detectors in one top-node:
   // make_node("/cms:World_1/cms:CMSE_1", 4, kTRUE);

   make_node("/cms:World_1/cms:CMSE_1/tracker:Tracker_1", 1, kTRUE);
   make_node("/cms:World_1/cms:CMSE_1/caloBase:CALO_1",   1, kTRUE);
   make_node("/cms:World_1/cms:CMSE_1/muonBase:MUON_1",   1, kTRUE);
}

Member Data Documentation

Definition at line 69 of file DummyEvelyser.cc.

Referenced by analyze(), beginJob(), and beginRun().

TEveElement* DummyEvelyser::m_geomList [private]

Definition at line 72 of file DummyEvelyser.cc.

Referenced by beginRun(), make_node(), and remakeGeometry().

Definition at line 75 of file DummyEvelyser.cc.

Referenced by analyze().

TEveTrackList* DummyEvelyser::m_trackList [private]

Definition at line 73 of file DummyEvelyser.cc.

Referenced by analyze(), beginJob(), and endJob().

Definition at line 71 of file DummyEvelyser.cc.

Referenced by analyze().