CMS 3D CMS Logo

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

DisplayGeom Class Reference

Inheritance diagram for DisplayGeom:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

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 endJob ()
void remakeGeometry (const DisplayGeomRecord &dgRec)

Private Attributes

edm::Service< EveServicem_eve
TEveElement * m_geomList
edm::ESWatcher< DisplayGeomRecordm_geomWatcher
int m_level
bool m_MF

Detailed Description

Definition at line 40 of file DisplayGeom.cc.


Constructor & Destructor Documentation

DisplayGeom::DisplayGeom ( const edm::ParameterSet iConfig) [explicit]

Definition at line 72 of file DisplayGeom.cc.

References edm::ParameterSet::getUntrackedParameter(), m_level, and m_MF.

                                                      :
   m_eve(),
   m_geomList(0),
   m_geomWatcher(this, &DisplayGeom::remakeGeometry)
{
   m_level =  iConfig.getUntrackedParameter<int>( "level", 2);
   m_MF    =  iConfig.getUntrackedParameter<int>( "MF", false);
}
DisplayGeom::~DisplayGeom ( )

Definition at line 82 of file DisplayGeom.cc.

{
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 117 of file DisplayGeom.cc.

References edm::ESWatcher< T >::check(), i, m_eve, m_geomWatcher, alignCSCRings::r, and alignCSCRings::s.

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

      // Add a test obj
      if (!gRandom)
         gRandom = new TRandom(0);
      TRandom& r= *gRandom;

      Float_t s = 100;

      TEvePointSet* ps = new TEvePointSet();
      ps->SetOwnIds(kTRUE);
      for(Int_t i = 0; i< 100; i++)
      {
         ps->SetNextPoint(r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s));
         ps->SetPointId(new TNamed(Form("Point %d", i), ""));
      }

      ps->SetMarkerColor(TMath::Nint(r.Uniform(2, 9)));
      ps->SetMarkerSize(r.Uniform(1, 2));
      ps->SetMarkerStyle(4);
      m_eve->AddElement(ps);
   }
}
void DisplayGeom::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 148 of file DisplayGeom.cc.

References m_eve, and m_geomList.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 160 of file DisplayGeom.cc.

                    {
}
TEveGeoTopNode * DisplayGeom::make_node ( const TString &  path,
Int_t  vis_level,
Bool_t  global_cs 
) [protected]

Definition at line 91 of file DisplayGeom.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 DisplayGeom::remakeGeometry ( const DisplayGeomRecord dgRec) [private]

Definition at line 164 of file DisplayGeom.cc.

References relativeConstraints::geom, edm::eventsetup::EventSetupRecord::get(), m_geomList, m_level, m_MF, 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);

   if (m_MF)
   {
      make_node("/cms:World_1", m_level, kTRUE);
   }
   else
   {
      make_node("/cms:World_1/cms:CMSE_1/tracker:Tracker_1", m_level, kTRUE);
      make_node("/cms:World_1/cms:CMSE_1/caloBase:CALO_1",   m_level, kTRUE);
      make_node("/cms:World_1/cms:CMSE_1/muonBase:MUON_1",   m_level, kTRUE);
   }
}

Member Data Documentation

Definition at line 56 of file DisplayGeom.cc.

Referenced by analyze(), and beginJob().

TEveElement* DisplayGeom::m_geomList [private]

Definition at line 58 of file DisplayGeom.cc.

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

Definition at line 64 of file DisplayGeom.cc.

Referenced by analyze().

int DisplayGeom::m_level [private]

Definition at line 60 of file DisplayGeom.cc.

Referenced by DisplayGeom(), and remakeGeometry().

bool DisplayGeom::m_MF [private]

Definition at line 62 of file DisplayGeom.cc.

Referenced by DisplayGeom(), and remakeGeometry().