Exemplo n.º 1
0
void addDetectorTab( const Char_t *name, 
		     const Char_t *title, 
		     const Char_t *_top="CAVE",
		     const Int_t   vis = 5 )
{

  TGeoVolume *top = gGeoManager->FindVolumeFast(_top);
  if (!top)
    {
      cout << Form("Top volume %s not found",_top) << endl;
      return;
    }

  TGeoNode       *node = top -> FindNode(name);
  if ( !node )
    {
      cout << Form("Node %s not found",name) << endl;
      return;
    }

  TEveViewer *viewer = gEve -> SpawnNewViewer( title );
  TEveScene  *scene  = gEve -> SpawnNewScene ( title );
  viewer -> AddScene( scene );

  TGLViewer *v3 = viewer->GetGLViewer();
  v3->SetClearColor(33);
  
  TEveGeoTopNode *edon = new TEveGeoTopNode( gGeoManager, node );
  {
    edon -> SetVisLevel( vis );
  }
  
  gEve -> AddGlobalElement( edon, scene );

}
Exemplo n.º 2
0
//______________________________________________________________________________
TEveCalo2D* MakeCalo2D(TEveCalo3D* calo3d, TEveWindowSlot* slot,
                       TEveProjection::EPType_e t)
{
   // Projected calorimeter.

   TEveViewer* v; TEveScene* s;
   MakeViewerScene(slot, v, s);
   v->SetElementName("Viewer - 2D");
   s->SetElementName("Scene - 2D");

   TEveProjectionManager* mng = new TEveProjectionManager();
   mng->SetProjection(t);

   TEveProjectionAxes* axes = new TEveProjectionAxes(mng);
   s->AddElement(axes);
   TEveCalo2D* calo2d = (TEveCalo2D*) mng->ImportElements(calo3d);
   s->AddElement(calo2d);

   v->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);

   gEve->AddToListTree(mng, kTRUE);
   gEve->AddToListTree(calo2d, kTRUE);

   return calo2d;
}
Exemplo n.º 3
0
void compound()
{
   TEveManager::Create();

   TEveLine* ml = new TEveLine;
   ml->SetMainColor(kRed);
   ml->SetLineStyle(2);
   ml->SetLineWidth(3);
   gEve->InsertVizDBEntry("BigLine", ml);

   TEveCompound* cmp = new TEveCompound;
   cmp->SetMainColor(kGreen);
   gEve->AddElement(cmp);

   TRandom rnd(0);

   cmp->OpenCompound();

   cmp->AddElement(random_line(rnd, 20, 10));
   cmp->AddElement(random_line(rnd, 20, 10));

   TEveLine* line = random_line(rnd, 20, 12);
   line->ApplyVizTag("BigLine");
   cmp->AddElement(line);

   cmp->CloseCompound();

   // Projected view
   TEveViewer *viewer = gEve->SpawnNewViewer("Projected");
   TEveScene  *scene  = gEve->SpawnNewScene("Projected Event");
   viewer->AddScene(scene);
   {
      TGLViewer* v = viewer->GetGLViewer();
      v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
   }

   // projections
   TEveProjectionManager* mng = new TEveProjectionManager(TEveProjection::kPT_RPhi);
   scene->AddElement(mng);
   TEveProjectionAxes* axes = new TEveProjectionAxes(mng);
   scene->AddElement(axes);
   gEve->AddToListTree(axes, kTRUE);
   gEve->AddToListTree(mng, kTRUE);

   mng->ImportElements(cmp);

   gEve->Redraw3D(kTRUE);
}
Exemplo n.º 4
0
//______________________________________________________________________________
TEveCaloLego* MakeCaloLego(TEveCaloData* data, TEveWindowSlot* slot)
{
   // Eta-phi lego view.

   TEveViewer* v;
   TEveScene* s;
   if (slot)
   {
      TEveViewer* v; TEveScene* s;
      MakeViewerScene(slot, v, s);
   } else {
      v = gEve->GetDefaultViewer();
      s = gEve->GetEventScene();
   }
   v->SetElementName("Viewer - Lego");
   s->SetElementName("Scene - Lego");

   gStyle->SetPalette(1, 0);
   TEveCaloLego* lego = new TEveCaloLego(data);
   s->AddElement(lego);

   // By the default lego extends is (1x1x1). Resize it to put in 'natural' 
   // coordinates, so that y extend in 2*Pi and set height of lego two times
   //  smaller than y extend to have better view in 3D perspective.
   lego->InitMainTrans();
   lego->RefMainTrans().SetScale(TMath::TwoPi(), TMath::TwoPi(), TMath::Pi());

   // draws scales and axis on borders of window
   TGLViewer* glv = v->GetGLViewer();
   TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay();
   glv->AddOverlayElement(overlay);
   overlay->SetCaloLego(lego);

   // set event handler to move from perspective to orthographic view.
   glv->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
   glv->SetEventHandler
      (new TEveLegoEventHandler(glv->GetGLWidget(), glv, lego));
   gEve->AddToListTree(lego, kTRUE);

   return lego;
}