43double REveUtil::ServerTimeMs()
45 using clock = std::chrono::steady_clock;
46 static const clock::time_point origin = clock::now();
47 return std::chrono::duration<double, std::milli>(clock::now() - origin).count();
53constexpr int kServerTimeWidth = 16;
65 const bool is_array = msg.back() ==
']';
67 msg += is_array ?
",{\"server_time\":" :
",\"server_time\":";
68 msg.append(kServerTimeWidth,
' ');
69 msg += is_array ?
"}]" :
"}";
78 const std::size_t tail = msg.back() ==
']' ? 2 : 1;
79 char buf[kServerTimeWidth + 1];
80 snprintf(buf,
sizeof(buf),
"%*.3f", kServerTimeWidth,
ServerTimeMs());
81 msg.replace(msg.size() - tail - kServerTimeWidth, kServerTimeWidth, buf, kServerTimeWidth);
101void ChompTailAndDir(
TString& s,
char c=
'.')
124 TString foo(mac); ChompTailAndDir(foo);
128 return (
gROOT->GetGlobalFunction(foo.
Data(),
nullptr,
kTRUE) !=
nullptr);
147 gROOT->LoadMacro(mac);
149 TString foo(mac); ChompTailAndDir(foo); foo +=
"()";
159 gROOT->LoadMacro(mac);
168 static const std::regex bad_re(
"[^\\w](?:gSystem|gROOT)[^\\w]", std::regex::optimize);
169 static const std::regex public_extra_re(
"(?:\\|\")", std::regex::optimize);
171 auto beg = expr.cbegin(), end = expr.cend();
172 if (std::regex_search(beg, end, bad_re))
175 const bool is_public =
true;
176 if (is_public && std::regex_search(beg, end, public_extra_re))
192 col[0] = (
UChar_t)(255*
c->GetRed());
193 col[1] = (
UChar_t)(255*
c->GetGreen());
194 col[2] = (
UChar_t)(255*
c->GetBlue());
195 if (alpha) col[3] = 255;
200 col[0] = 255; col[1] = 0; col[2] = 255;
201 if (alpha) col[3] = 255;
212 UChar_t alpha = (255*(100 - transparency))/100;
217 col[0] = (
UChar_t)(255*
c->GetRed());
218 col[1] = (
UChar_t)(255*
c->GetGreen());
219 col[2] = (
UChar_t)(255*
c->GetBlue());
225 col[0] = 255; col[1] = 0; col[2] = 255; col[3] = alpha;
244 if (alpha) col[3] = 255;
262 throw(eh +
"could not find member '" + varname +
"' in class " + obj->
IsA()->
GetName() +
".");
263 return (
Color_t*) (((
char*)obj) + off);
277 if (value < -2.5 || value > 2.5)
279 Error(
"REveUtil::SetColorBrightness",
"value '%f' out of range [-0.5, 0.5].",
value);
289 for (
Int_t i = 0; i < n_col; ++i)
298 for (
Int_t i = 0; i < n_col; ++i)
306 croot =
new TColor(*cdef);
307 colors->
AddAt(croot, i);
344 using namespace TMath;
348 minQ += TwoPi(); maxQ += TwoPi();
350 else if (minQ > maxM)
352 minQ -= TwoPi(); maxQ -= TwoPi();
354 return minQ >= minM && maxQ <= maxM;
365 using namespace TMath;
369 minQ += TwoPi(); maxQ += TwoPi();
371 else if (minQ > maxM)
373 minQ -= TwoPi(); maxQ -= TwoPi();
375 return maxQ >= minM && minQ <= maxM;
383 if (minQ>=minM && maxQ<=maxM)
386 else if (minQ<minM && maxQ>maxM)
387 return (maxM-minM)/(maxQ-minQ);
389 else if (minQ>=minM && maxQ>maxM)
390 return (maxM-minQ)/(maxQ-minQ);
392 else if (minQ<minM && maxQ<=maxM)
393 return (maxQ-minM)/(maxQ-minQ);
479 if (--(i->second) <= 0)
483 Warning(
"REveRefBackPtr::DecRefCount",
"element '%s' not found in back-refs.", re->GetCName());
493 i.first->AddStamp(stamps);
short Color_t
Color number (short)
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
char Char_t
Character 1 byte (char)
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
R__EXTERN TGeoManager * gGeoManager
R__EXTERN TGeoIdentity * gGeoIdentity
REveException Exception-type thrown by Eve classes.
~REveGeoManagerHolder()
Destructor.
Int_t fNSegments
! previous settings for num segments
TGeoManager * fManager
! hold manager
REveGeoManagerHolder(TGeoManager *new_gmgr=nullptr, Int_t n_seg=0)
Constructor.
void FullRedraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Perform 3D redraw of all scenes and viewers.
~REveRefBackPtr() override
Destructor. Noop, should complain if back-ref list is not empty.
virtual void StampBackPtrElements(UChar_t stamps)
Add given stamps to elements in the list of reverse references.
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.
static double ServerTimeMs()
Milliseconds from a monotonic clock, counted from first use.
static void LoadMacro(const char *mac)
Makes sure that macro 'mac' is loaded, but do not reload it.
static void Macro(const char *mac)
Execute macro 'mac'. Do not reload the macro.
static Bool_t CheckMacro(const char *mac)
Checks if macro 'mac' is loaded.
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].
static void AppendServerTime(std::string &msg)
Append "server_time" to the JSON message msg, a non-empty object or array: as its last key,...
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).
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.
static void ColorFromIdx(Color_t ci, UChar_t col[4], Bool_t alpha=kTRUE)
Fill col with RGBA values corresponding to index ci.
static void StampServerTime(std::string &msg)
Set the "server_time" that AppendServerTime() put at the end of msg to now.
static Color_t * FindColorVar(TObject *obj, const char *varname)
Find address of Color_t data-member with name varname in object obj.
static void AssertMacro(const char *mac)
Load and execute macro 'mac' if it has not been loaded yet.
static bool VerifyObjectFilterOrTableExpression(std::string_view expr)
Input string verification and sanitization.
static TObjArray * fgDefaultColors
Longptr_t GetDataMemberOffset(const char *membername) const
return offset for member name.
The color creation and management class.
virtual void SetRGB(Float_t r, Float_t g, Float_t b)
Initialize this color and its "dark" and "bright" associated colors.
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
void Copy(TObject &color) const override
Copy this color to obj.
An identity transformation.
The manager class for any TGeo geometry.
TObjArray * GetListOfMatrices() const
void SetNsegments(Int_t nseg)
Set number of segments for approximating circles in drawing.
Int_t GetNsegments() const
Get number of segments approximating circles.
const char * GetName() const override
Returns name of object.
Int_t GetEntriesFast() const
void AddAt(TObject *obj, Int_t idx) override
Add object at position ids.
TObject * At(Int_t idx) const override
TObject * RemoveAt(Int_t idx) override
Remove object at index idx.
Mother of all ROOT objects.
virtual TClass * IsA() const
const char * Data() const
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TString & Remove(Ssiz_t pos)
Namespace for ROOT features in testing.
R__EXTERN REveManager * gEve
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.