ROOT logo

From $ROOTSYS/tutorials/geom/runplugin.C

iterplugin *plugin = 0;

void runplugin()
{
//+ Creates and runs a simple iterator plugin connected to TGeoPainter iterator.
// It demonstrates the possibility to dynamically change the color of drawn
// volumes acording some arbitrary criteria *WITHOUT* changing the color of the 
// same volume drawn on branches that do not match the criteria.
//
// To run:
// root[0]   .L iterplugin.cxx+
// root[1]   .x runplugin.C
// root[2]   select(2,kMagenta);
// root[3]   select(3,kBlue)
// ...

   gROOT->ProcessLine(".x $ROOTSYS/tutorials/geom/rootgeom.C");
   plugin = new iterplugin();
   gGeoManager->GetGeomPainter()->SetIteratorPlugin(plugin);
}

void select(Int_t replica=1, Int_t color=kGreen)
{
// Change current color. Replica range: 1-4
   plugin->Select(replica, color);
   gGeoManager->GetGeomPainter()->ModifiedPad();
}
 runplugin.C:1
 runplugin.C:2
 runplugin.C:3
 runplugin.C:4
 runplugin.C:5
 runplugin.C:6
 runplugin.C:7
 runplugin.C:8
 runplugin.C:9
 runplugin.C:10
 runplugin.C:11
 runplugin.C:12
 runplugin.C:13
 runplugin.C:14
 runplugin.C:15
 runplugin.C:16
 runplugin.C:17
 runplugin.C:18
 runplugin.C:19
 runplugin.C:20
 runplugin.C:21
 runplugin.C:22
 runplugin.C:23
 runplugin.C:24
 runplugin.C:25
 runplugin.C:26
 runplugin.C:27
 runplugin.C:28