File indexing completed on 2025-09-18 09:32:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT7_REveUtil
0013 #define ROOT7_REveUtil
0014
0015 #include "REveTypes.hxx"
0016
0017 #include <string_view>
0018 #include <map>
0019
0020 class TObject;
0021 class TObjArray;
0022 class TGeoManager;
0023
0024 namespace ROOT {
0025 namespace Experimental {
0026
0027 class REveElement;
0028
0029
0030
0031
0032
0033
0034 class REveUtil
0035 {
0036 private:
0037 static TObjArray *fgDefaultColors;
0038
0039 public:
0040 virtual ~REveUtil() {}
0041
0042
0043
0044 static Bool_t CheckMacro(const char *mac);
0045 static void AssertMacro(const char *mac);
0046 static void Macro(const char *mac);
0047 static void LoadMacro(const char *mac);
0048
0049
0050
0051 static bool VerifyObjectFilterOrTableExpression(std::string_view expr);
0052
0053
0054
0055 static void ColorFromIdx(Color_t ci, UChar_t col[4], Bool_t alpha = kTRUE);
0056 static void ColorFromIdx(Color_t ci, UChar_t col[4], Char_t transparency);
0057 static void ColorFromIdx(Float_t f1, Color_t c1, Float_t f2, Color_t c2, UChar_t col[4], Bool_t alpha = kTRUE);
0058 static Color_t *FindColorVar(TObject *obj, const char *varname);
0059
0060 static void SetColorBrightness(Float_t value, Bool_t full_redraw = kFALSE);
0061
0062
0063
0064 static Bool_t IsU1IntervalContainedByMinMax(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ);
0065 static Bool_t IsU1IntervalOverlappingByMinMax(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ);
0066
0067 static Bool_t IsU1IntervalContainedByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ);
0068 static Bool_t IsU1IntervalOverlappingByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ);
0069
0070 static Float_t GetFraction(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ);
0071 };
0072
0073 inline Bool_t REveUtil::IsU1IntervalContainedByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ)
0074 {
0075 return IsU1IntervalContainedByMinMax(meanM - deltaM, meanM + deltaM, meanQ - deltaQ, meanQ + deltaQ);
0076 }
0077
0078 inline Bool_t REveUtil::IsU1IntervalOverlappingByMeanDelta(Float_t meanM, Float_t deltaM, Float_t meanQ, Float_t deltaQ)
0079 {
0080 return IsU1IntervalContainedByMinMax(meanM - deltaM, meanM + deltaM, meanQ - deltaQ, meanQ + deltaQ);
0081 }
0082
0083
0084
0085
0086
0087
0088
0089 class REveGeoManagerHolder
0090 {
0091 private:
0092 TGeoManager *fManager{nullptr};
0093 Int_t fNSegments{0};
0094
0095 public:
0096 REveGeoManagerHolder(TGeoManager *new_gmgr = nullptr, Int_t n_seg = 0);
0097 ~REveGeoManagerHolder();
0098 };
0099
0100
0101
0102
0103
0104
0105 class REveRefCnt
0106 {
0107 REveRefCnt(const REveRefCnt &) = delete;
0108 REveRefCnt &operator=(const REveRefCnt &) = delete;
0109
0110 protected:
0111 Int_t fRefCount{0};
0112
0113 public:
0114 REveRefCnt() = default;
0115 virtual ~REveRefCnt() {}
0116
0117 void IncRefCount() { ++fRefCount; }
0118 void DecRefCount()
0119 {
0120 if (--fRefCount <= 0)
0121 OnZeroRefCount();
0122 }
0123
0124 virtual void OnZeroRefCount() = 0;
0125 };
0126
0127
0128
0129
0130
0131
0132 class REveRefBackPtr : public REveRefCnt
0133 {
0134 REveRefBackPtr(const REveRefBackPtr &) = delete;
0135 REveRefBackPtr &operator=(const REveRefBackPtr &) = delete;
0136
0137 protected:
0138 typedef std::map<REveElement *, Int_t> RefMap_t;
0139
0140 RefMap_t fBackRefs;
0141
0142 public:
0143 REveRefBackPtr() = default;
0144 ~REveRefBackPtr() override;
0145
0146 using REveRefCnt::DecRefCount;
0147 using REveRefCnt::IncRefCount;
0148 virtual void IncRefCount(REveElement *re);
0149 virtual void DecRefCount(REveElement *re);
0150
0151 virtual void StampBackPtrElements(UChar_t stamps);
0152 };
0153
0154 }
0155 }
0156
0157 #endif