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 "TError.h"
18
19#include <map>
20#include <set>
21#include <exception>
22
23class TGeoManager;
24
25namespace ROOT {
26namespace Experimental {
27
28class RLogChannel;
29/// Log channel for Eve diagnostics.
30RLogChannel &EveLog();
31
32class REveElement;
33
34////////////////////////////////////////////////////////////////////////////////
35/// REveUtil
36/// Standard utility functions for Reve.
37////////////////////////////////////////////////////////////////////////////////
38
40{
41private:
43
44public:
45 virtual ~REveUtil() {}
46
47 // Macro functions
48
49 static Bool_t CheckMacro(const char *mac);
50 static void AssertMacro(const char *mac);
51 static void Macro(const char *mac);
52 static void LoadMacro(const char *mac);
53
54 // Color management
55
56 static void ColorFromIdx(Color_t ci, UChar_t col[4], Bool_t alpha = kTRUE);
57 static void ColorFromIdx(Color_t ci, UChar_t col[4], Char_t transparency);
58 static void ColorFromIdx(Float_t f1, Color_t c1, Float_t f2, Color_t c2, UChar_t col[4], Bool_t alpha = kTRUE);
59 static Color_t *FindColorVar(TObject *obj, const char *varname);
60
61 static void SetColorBrightness(Float_t value, Bool_t full_redraw = kFALSE);
62
63 // Math utilities
64
67
68 static Bool_t IsU1IntervalContainedByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ);
69 static Bool_t IsU1IntervalOverlappingByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ);
70
71 static Float_t GetFraction(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ);
72};
73
75{
76 return IsU1IntervalContainedByMinMax(meanM - deltaM, meanM + deltaM, meanQ - deltaQ, meanQ + deltaQ);
77}
78
80{
81 return IsU1IntervalContainedByMinMax(meanM - deltaM, meanM + deltaM, meanQ - deltaQ, meanQ + deltaQ);
82}
83
84
85////////////////////////////////////////////////////////////////////////////////
86/// REveGeoManagerHolder
87/// Exception-safe global variable holders
88////////////////////////////////////////////////////////////////////////////////
89
91{
92private:
93 TGeoManager *fManager{nullptr}; ///<! hold manager
94 Int_t fNSegments{0}; ///<! previous settings for num segments
95
96public:
97 REveGeoManagerHolder(TGeoManager *new_gmgr = nullptr, Int_t n_seg = 0);
99};
100
101////////////////////////////////////////////////////////////////////////////////
102/// REveRefCnt
103/// REveRefCnt base-class (interface)
104////////////////////////////////////////////////////////////////////////////////
105
107{
108protected:
110
111public:
112 REveRefCnt() = default;
113 virtual ~REveRefCnt() {}
114
116 REveRefCnt &operator=(const REveRefCnt &) { return *this; }
117
118 void IncRefCount() { ++fRefCount; }
120 {
121 if (--fRefCount <= 0)
123 }
124
125 virtual void OnZeroRefCount() { delete this; }
126};
127
128////////////////////////////////////////////////////////////////////////////////
129/// REveRefBackPtr
130/// reference-count with back pointers
131////////////////////////////////////////////////////////////////////////////////
132
134{
135protected:
136 typedef std::map<REveElement *, Int_t> RefMap_t;
137
139
140public:
142 virtual ~REveRefBackPtr();
143
146
149 virtual void IncRefCount(REveElement *re);
150 virtual void DecRefCount(REveElement *re);
151
152 virtual void StampBackPtrElements(UChar_t stamps);
153};
154
155} // namespace Experimental
156} // namespace ROOT
157
158#endif
int Int_t
Definition RtypesCore.h:45
unsigned char UChar_t
Definition RtypesCore.h:38
char Char_t
Definition RtypesCore.h:37
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
short Color_t
Definition RtypesCore.h:83
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:91
REveGeoManagerHolder Exception-safe global variable holders.
Definition REveUtil.hxx:91
Int_t fNSegments
! previous settings for num segments
Definition REveUtil.hxx:94
TGeoManager * fManager
! hold manager
Definition REveUtil.hxx:93
REveRefBackPtr reference-count with back pointers.
Definition REveUtil.hxx:134
virtual ~REveRefBackPtr()
Destructor. Noop, should complain if back-ref list is not empty.
Definition REveUtil.cxx:402
std::map< REveElement *, Int_t > RefMap_t
Definition REveUtil.hxx:136
REveRefBackPtr & operator=(const REveRefBackPtr &)
Assignment operator.
Definition REveUtil.cxx:422
REveRefBackPtr()
Default constructor.
Definition REveUtil.cxx:393
virtual void StampBackPtrElements(UChar_t stamps)
Add given stamps to elements in the list of reverse references.
Definition REveUtil.cxx:454
REveRefCnt REveRefCnt base-class (interface)
Definition REveUtil.hxx:107
REveRefCnt & operator=(const REveRefCnt &)
Definition REveUtil.hxx:116
REveRefCnt(const REveRefCnt &)
Definition REveUtil.hxx:115
REveUtil Standard utility functions for Reve.
Definition REveUtil.hxx:40
static Bool_t IsU1IntervalContainedByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ)
Definition REveUtil.hxx:74
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:297
static void LoadMacro(const char *mac)
Makes sure that macro 'mac' is loaded, but do not reload it.
Definition REveUtil.cxx:110
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
Definition REveUtil.cxx:98
static Bool_t CheckMacro(const char *mac)
Checks if macro 'mac' is loaded.
Definition REveUtil.cxx:70
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:316
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:210
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:276
static Bool_t IsU1IntervalOverlappingByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ)
Definition REveUtil.hxx:79
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:122
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:191
static void AssertMacro(const char *mac)
Load and execute macro 'mac' if it has not been loaded yet.
Definition REveUtil.cxx:88
static TObjArray * fgDefaultColors
Definition REveUtil.hxx:42
The manager class for any TGeo geometry.
Definition TGeoManager.h:45
An array of TObjects.
Definition TObjArray.h:37
Mother of all ROOT objects.
Definition TObject.h:37
return c1
Definition legend1.C:41
TF1 * f1
Definition legend1.C:11
return c2
Definition legend2.C:14
RLogChannel & EveLog()
Log channel for Eve diagnostics.
Definition REveUtil.cxx:36
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...