Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveUtil.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_REveUtil
13#define ROOT7_REveUtil
14
15#include "REveTypes.hxx"
16
17#include <string_view>
18#include <map>
19
20class TObject;
21class TObjArray;
22class TGeoManager;
23
24namespace ROOT {
25namespace Experimental {
26
27class REveElement;
28
29////////////////////////////////////////////////////////////////////////////////
30/// REveUtil
31/// Standard utility functions for Reve.
32////////////////////////////////////////////////////////////////////////////////
33
35{
36private:
38
39public:
40 virtual ~REveUtil() {}
41
42 // Macro functions
43
44 static Bool_t CheckMacro(const char *mac);
45 static void AssertMacro(const char *mac);
46 static void Macro(const char *mac);
47 static void LoadMacro(const char *mac);
48
49 // Input string verification and sanitization
50
51 static bool VerifyObjectFilterOrTableExpression(std::string_view expr);
52
53 // Color management
54
55 static void ColorFromIdx(Color_t ci, UChar_t col[4], Bool_t alpha = kTRUE);
56 static void ColorFromIdx(Color_t ci, UChar_t col[4], Char_t transparency);
57 static void ColorFromIdx(Float_t f1, Color_t c1, Float_t f2, Color_t c2, UChar_t col[4], Bool_t alpha = kTRUE);
58 static Color_t *FindColorVar(TObject *obj, const char *varname);
59
60 static void SetColorBrightness(Float_t value, Bool_t full_redraw = kFALSE);
61
62 // Math utilities
63
66
67 static Bool_t IsU1IntervalContainedByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ);
68 static Bool_t IsU1IntervalOverlappingByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ);
69
70 static Float_t GetFraction(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ);
71};
72
74{
75 return IsU1IntervalContainedByMinMax(meanM - deltaM, meanM + deltaM, meanQ - deltaQ, meanQ + deltaQ);
76}
77
79{
80 return IsU1IntervalContainedByMinMax(meanM - deltaM, meanM + deltaM, meanQ - deltaQ, meanQ + deltaQ);
81}
82
83
84////////////////////////////////////////////////////////////////////////////////
85/// REveGeoManagerHolder
86/// Exception-safe global variable holders
87////////////////////////////////////////////////////////////////////////////////
88
90{
91private:
92 TGeoManager *fManager{nullptr}; ///<! hold manager
93 Int_t fNSegments{0}; ///<! previous settings for num segments
94
95public:
96 REveGeoManagerHolder(TGeoManager *new_gmgr = nullptr, Int_t n_seg = 0);
98};
99
100////////////////////////////////////////////////////////////////////////////////
101/// REveRefCnt
102/// REveRefCnt base-class (interface)
103////////////////////////////////////////////////////////////////////////////////
104
106{
107 REveRefCnt(const REveRefCnt &) = delete;
108 REveRefCnt &operator=(const REveRefCnt &) = delete;
109
110protected:
112
113public:
114 REveRefCnt() = default;
115 virtual ~REveRefCnt() {}
116
117 void IncRefCount() { ++fRefCount; }
119 {
120 if (--fRefCount <= 0)
122 }
123
124 virtual void OnZeroRefCount() = 0;
125};
126
127////////////////////////////////////////////////////////////////////////////////
128/// REveRefBackPtr
129/// reference-count with back pointers
130////////////////////////////////////////////////////////////////////////////////
131
133{
136
137protected:
138 typedef std::map<REveElement *, Int_t> RefMap_t;
139
141
142public:
143 REveRefBackPtr() = default;
144 ~REveRefBackPtr() override;
145
148 virtual void IncRefCount(REveElement *re);
149 virtual void DecRefCount(REveElement *re);
150
151 virtual void StampBackPtrElements(UChar_t stamps);
152};
153
154} // namespace Experimental
155} // namespace ROOT
156
157#endif
bool Bool_t
Definition RtypesCore.h:63
short Color_t
Definition RtypesCore.h:85
unsigned char UChar_t
Definition RtypesCore.h:38
char Char_t
Definition RtypesCore.h:37
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Base class for REveUtil visualization elements, providing hierarchy management, rendering control and...
REveGeoManagerHolder Exception-safe global variable holders.
Definition REveUtil.hxx:90
Int_t fNSegments
! previous settings for num segments
Definition REveUtil.hxx:93
TGeoManager * fManager
! hold manager
Definition REveUtil.hxx:92
REveRefBackPtr reference-count with back pointers.
Definition REveUtil.hxx:133
REveRefBackPtr(const REveRefBackPtr &)=delete
std::map< REveElement *, Int_t > RefMap_t
Definition REveUtil.hxx:138
REveRefBackPtr & operator=(const REveRefBackPtr &)=delete
~REveRefBackPtr() override
Destructor. Noop, should complain if back-ref list is not empty.
Definition REveUtil.cxx:409
virtual void StampBackPtrElements(UChar_t stamps)
Add given stamps to elements in the list of reverse references.
Definition REveUtil.cxx:441
REveRefCnt REveRefCnt base-class (interface)
Definition REveUtil.hxx:106
REveRefCnt(const REveRefCnt &)=delete
REveRefCnt & operator=(const REveRefCnt &)=delete
virtual void OnZeroRefCount()=0
REveUtil Standard utility functions for Reve.
Definition REveUtil.hxx:35
static Bool_t IsU1IntervalContainedByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ)
Definition REveUtil.hxx:73
static Bool_t IsU1IntervalOverlappingByMinMax(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ)
Return true if interval Q is overlapping within interval M for U1 variables.
Definition REveUtil.cxx:313
static void LoadMacro(const char *mac)
Makes sure that macro 'mac' is loaded, but do not reload it.
Definition REveUtil.cxx:107
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
Definition REveUtil.cxx:95
static Bool_t CheckMacro(const char *mac)
Checks if macro 'mac' is loaded.
Definition REveUtil.cxx:67
static Float_t GetFraction(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ)
Get fraction of interval [minQ, maxQ] in [minM, maxM].
Definition REveUtil.cxx:332
static void SetColorBrightness(Float_t value, Bool_t full_redraw=kFALSE)
Tweak all ROOT colors to become brighter (if value > 0) or darker (value < 0).
Definition REveUtil.cxx:226
static Bool_t IsU1IntervalContainedByMinMax(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ)
Return true if interval Q is contained within interval M for U1 variables.
Definition REveUtil.cxx:292
static Bool_t IsU1IntervalOverlappingByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ)
Definition REveUtil.hxx:78
static void ColorFromIdx(Color_t ci, UChar_t col[4], Bool_t alpha=kTRUE)
Fill col with RGBA values corresponding to index ci.
Definition REveUtil.cxx:138
static Color_t * FindColorVar(TObject *obj, const char *varname)
Find address of Color_t data-member with name varname in object obj.
Definition REveUtil.cxx:207
static void AssertMacro(const char *mac)
Load and execute macro 'mac' if it has not been loaded yet.
Definition REveUtil.cxx:85
static bool VerifyObjectFilterOrTableExpression(std::string_view expr)
Input string verification and sanitization.
Definition REveUtil.cxx:117
static TObjArray * fgDefaultColors
Definition REveUtil.hxx:37
The manager class for any TGeo geometry.
Definition TGeoManager.h:44
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
return c1
Definition legend1.C:41
TF1 * f1
Definition legend1.C:11
return c2
Definition legend2.C:14
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...