Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
quadset.C File Reference

Detailed Description

Demonstates usage of 2D digit class TEveQuadSet.

void quadset_callback(TEveDigitSet* ds, Int_t idx, TObject* obj);
TString quadset_tooltip_callback(TEveDigitSet* ds, Int_t idx);
void quadset_set_callback(TEveDigitSet* ds);
//------------------------------------------------------------------------------
TEveQuadSet* quadset(Float_t x=0, Float_t y=0, Float_t z=0,
Int_t num=100, Bool_t registerSet=kTRUE)
{
TRandom r(0);
TEveRGBAPalette *pal = new TEveRGBAPalette(0, 130);
box->SetAAQuadXY(-10, -10, 0, 20, 20);
box->SetFrameColor(kGray);
TEveQuadSet* q = new TEveQuadSet("RectangleXY");
q->SetOwnIds(kTRUE);
q->SetPalette(pal);
q->SetFrame(box);
for (Int_t i=0; i<num; ++i)
{
q->AddQuad(r.Uniform(-10, 9), r.Uniform(-10, 9), 0,
r.Uniform(0.2, 1), r.Uniform(0.2, 1));
q->QuadValue(r.Uniform(0, 130));
q->QuadId(new TNamed(Form("QuadIdx %d", i),
"TNamed assigned to a quad as an indentifier."));
}
q->RefitPlex();
TEveTrans& t = q->RefMainTrans();
t.RotateLF(1, 3, 0.5*TMath::Pi());
t.SetPos(x, y, z);
TGLCameraOverlay* co = v->GetCameraOverlay();
// Uncomment these two lines to get internal highlight / selection.
// q->SetPickable(1);
// q->SetAlwaysSecSelect(1);
TEveRGBAPaletteOverlay *po = new TEveRGBAPaletteOverlay(pal, 0.55, 0.1, 0.4, 0.05);
// To set user-interface (GUI + overlay) to display real values
// mapped with a linear function: r = 0.1 * i + 0;
// pal->SetUIDoubleRep(kTRUE, 0.1, 0);
if (registerSet)
{
}
Info("quadset", "use alt-left-mouse to select individual digits.");
return q;
}
TEveQuadSet* quadset_emc(Float_t x=0, Float_t y=0, Float_t z=0, Int_t num=100)
{
TRandom r(0);
TEveQuadSet* q = new TEveQuadSet("EMC Supermodule");
q->SetOwnIds(kTRUE);
q->SetDefWidth(8);
q->SetDefHeight(8);
for (Int_t i=0; i<num; ++i)
{
q->AddQuad(r.Uniform(-100, 100), r.Uniform(-100, 100));
q->QuadValue(r.Uniform(0, 130));
q->QuadId(new TNamed(Form("Cell %d", i), "Dong!"));
}
q->RefitPlex();
TEveTrans& t = q->RefMainTrans();
t.SetPos(x, y, z);
return q;
}
TEveQuadSet* quadset_circ()
{
TRandom rnd(0);
Float_t R = 10, dW = 1, dH = .5;
{
Float_t frame[3*36];
Float_t *p = frame;
for (Int_t i = 0; i < 36; ++i, p += 3) {
p[0] = 11 * TMath::Cos(TMath::TwoPi()*i/36);
p[1] = 11 * TMath::Sin(TMath::TwoPi()*i/36);
p[2] = 0;
}
box->SetQuadByPoints(frame, 36);
}
box->SetFrameColor(kGray);
TEveQuadSet* q = new TEveQuadSet("Pepe");
q->SetFrame(box);
for (Float_t r = R; r > 2; r *= 0.8)
{
Int_t maxI = 2.0*TMath::Pi()*r / 2;
for (Int_t i = 0; i < maxI; ++i)
{
q->AddHexagon(x, y, rnd.Uniform(-1, 1), rnd.Uniform(0.2, 1));
q->QuadValue(rnd.Uniform(0, 130));
}
}
q->RefitPlex();
TEveTrans& t = q->RefMainTrans();
t.RotateLF(1, 3, 0.5*TMath::Pi());
return q;
}
TEveQuadSet* quadset_hex(Float_t x=0, Float_t y=0, Float_t z=0,
Int_t num=100, Bool_t registerSet=kTRUE)
{
TRandom r(0);
{
TEveQuadSet* q = new TEveQuadSet("HexagonXY");
for (Int_t i=0; i<num; ++i)
{
q->AddHexagon(r.Uniform(-10, 10),
r.Uniform(-10, 10),
r.Uniform(-10, 10),
r.Uniform(0.2, 1));
q->QuadValue(r.Uniform(0, 120));
}
q->RefitPlex();
TEveTrans& t = q->RefMainTrans();
t.SetPos(x, y, z);
if (registerSet)
{
}
}
{
TEveQuadSet* q = new TEveQuadSet("HexagonYX");
for (Int_t i=0; i<num; ++i)
{
q->AddHexagon(r.Uniform(-10, 10),
r.Uniform(-10, 10),
r.Uniform(-10, 10),
r.Uniform(0.2, 1));
q->QuadValue(r.Uniform(0, 120));
}
q->RefitPlex();
TEveTrans& t = q->RefMainTrans();
t.SetPos(x, y, z);
if (registerSet)
{
}
return q;
}
}
TEveQuadSet* quadset_hexid(Float_t x=0, Float_t y=0, Float_t z=0,
Int_t num=100, Bool_t registerSet=kTRUE)
{
TRandom r(0);
TEveQuadSet* q = new TEveQuadSet("HexagonXY");
{
q->SetOwnIds(kTRUE);
for (Int_t i=0; i<num; ++i)
{
q->AddHexagon(r.Uniform(-10, 10),
r.Uniform(-10, 10),
r.Uniform(-10, 10),
r.Uniform(0.2, 1));
q->QuadValue(r.Uniform(0, 120));
q->QuadId(new TNamed(Form("Quad with idx=%d", i),
"This title is not confusing."));
}
q->RefitPlex();
TEveTrans& t = q->RefMainTrans();
t.SetPos(x, y, z);
if (registerSet)
{
}
}
quadset_set_callback(q);
// With the following you get per digit highlight with tooltip.
//q->SetPickable(1);
//q->SetAlwaysSecSelect(1);
// Otherwise you need to Alt - left click to get info printout.
return q;
}
void quadset_hierarchy(Int_t n=4)
{
TEveRGBAPalette* pal = new TEveRGBAPalette(20, 100);
pal->SetLimits(0, 120);
box->SetAABox(-10, -10, -10, 20, 20, 20);
box->SetFrameColor(33);
TEveElementList* l = new TEveElementList("Parent/Dir");
l->SetTitle("Tooltip");
// l->SetMainColor(3);
for (Int_t i=0; i<n; ++i)
{
TEveQuadSet* qs = quadset_hexid(0, 0, 50*i, 50, kFALSE);
qs->SetPalette(pal);
qs->SetFrame(box);
l->AddElement(qs);
}
}
//------------------------------------------------------------------------------
void quadset_callback(TEveDigitSet* ds, Int_t idx, TObject* obj)
{
printf("dump_digit_set_hit - 0x%lx, id=%d, obj=0x%lx\n",
(ULong_t) ds, idx, (ULong_t) obj);
}
TString quadset_tooltip_callback(TEveDigitSet* ds, Int_t idx)
{
// This gets called for tooltip if the following is set:
// q->SetPickable(1);
// q->SetAlwaysSecSelect(1);
return TString::Format("callback tooltip for '%s' - 0x%lx, id=%d\n",
ds->GetElementName(), (ULong_t) ds, idx);
}
void quadset_set_callback(TEveDigitSet* ds)
{
ds->SetCallbackFoo(quadset_callback);
ds->SetTooltipCBFoo(quadset_tooltip_callback);
}
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned long ULong_t
Definition RtypesCore.h:55
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
@ kGray
Definition Rtypes.h:65
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
Definition TError.cxx:218
R__EXTERN TEveManager * gEve
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
float * q
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
Base-class for storage of digit collections; provides transformation matrix (TEveTrans),...
void SetPalette(TEveRGBAPalette *p)
Set TEveRGBAPalette pointer.
void SetCallbackFoo(Callback_foo f)
void SetTooltipCBFoo(TooltipCB_foo f)
void SetFrame(TEveFrameBox *b)
Set TEveFrameBox pointer.
A list of TEveElements.
virtual const char * GetElementName() const
Virtual function for retrieving name of the element.
Description of a 2D or 3D frame that can be used to visually group a set of objects.
void AddElement(TEveElement *element, TEveElement *parent=nullptr)
Add an element.
TGLViewer * GetDefaultGLViewer() const
Get TGLViewer of the default TEveViewer.
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Supports various internal formats that result in rendering of a set of planar (lines,...
Definition TEveQuadSet.h:20
@ kQT_RectangleXZFixedDimY
Definition TEveQuadSet.h:38
Description of TEveRGBAPaletteOverlay.
A generic, speed-optimised mapping from value to RGBA color supporting different wrapping and range t...
void SetLimits(Int_t low, Int_t high)
Set low/high limits on signal value.
TEveTrans is a 4x4 transformation matrix for homogeneous coordinates stored internally in a column-ma...
Definition TEveTrans.h:27
void RotateLF(Int_t i1, Int_t i2, Double_t amount)
Rotate in local frame. Does optimised version of MultRight.
void SetPos(Double_t x, Double_t y, Double_t z)
Set position (base-vec 4).
A GL overlay element which displays camera furstum.
void SetShowOrthographic(Bool_t x)
void SetOrthographicMode(EMode m)
virtual void AddOverlayElement(TGLOverlayElement *el)
Add overlay element.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
void SetCurrentCamera(ECameraType camera)
Set current active camera - 'cameraType' one of: kCameraPerspX, kCameraPerspY, kCameraPerspZ,...
@ kCameraOrthoZOY
Definition TGLViewer.h:62
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
Basic string class.
Definition TString.h:139
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:594
constexpr Double_t Pi()
Definition TMath.h:37
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:588
constexpr Double_t TwoPi()
Definition TMath.h:44
TLine l
Definition textangle.C:4
Author
Matevz Tadel

Definition in file quadset.C.