98 strlcpy(myopt,opt,128);
184 return gStyle->GetCandleScaled();
192 return gStyle->GetViolinScaled();
205 gStyle->SetCandleWhiskerRange(wRange);
217 gStyle->SetCandleBoxRange(bRange);
226 gStyle->SetCandleScaled(cScale);
236 gStyle->SetViolinScaled(vScale);
245 char *
l = strstr(opt,
"CANDLE");
250 char direction =
' ';
253 if (
l[6] >=
'A' &&
l[6] <=
'Z') direction =
l[6];
254 if (
l[6] >=
'1' &&
l[6] <=
'9') preset =
l[6];
255 if (
l[7] >=
'A' &&
l[7] <=
'Z' && preset !=
' ') direction =
l[7];
256 if (
l[7] >=
'1' &&
l[7] <=
'9' && direction !=
' ') preset =
l[7];
258 if (direction ==
'X' || direction ==
'V') { }
262 else if (preset ==
'2')
264 else if (preset ==
'3')
266 else if (preset ==
'4')
268 else if (preset ==
'5')
270 else if (preset ==
'6')
272 else if (preset !=
' ')
275 if (preset !=
' ' && direction !=
' ')
277 else if (preset !=
' ' || direction !=
' ')
282 Bool_t useIndivOption =
false;
284 if (direction ==
' ') direction =
'X';
286 char *brOpen = strstr(opt,
"(");
287 char *brClose = strstr(opt,
")");
288 char indivOption[32];
289 if (brOpen && brClose) {
290 useIndivOption =
true;
292 strlcpy(indivOption, brOpen, brClose-brOpen+2);
293 sscanf(indivOption,
"(%d)", (
int*) &
fOption);
295 memcpy(brOpen,
" ",brClose-brOpen+1);
302 fOptionStr.Form(
"CANDLE%c%c",direction,preset);
305 if (!useIndivOption && !
fOption ) {
311 l = strstr(opt,
"VIOLIN");
315 char direction =
' ';
318 if (
l[6] >=
'A' &&
l[6] <=
'Z') direction =
l[6];
319 if (
l[6] >=
'1' &&
l[6] <=
'9') preset =
l[6];
320 if (
l[7] >=
'A' &&
l[7] <=
'Z' && preset !=
' ') direction =
l[7];
321 if (
l[7] >=
'1' &&
l[7] <=
'9' && direction !=
' ') preset =
l[7];
323 if (direction ==
'X' || direction ==
'V') { }
327 else if (preset ==
'2')
329 else if (preset !=
' ')
332 if (preset !=
' ' && direction !=
' ')
334 else if (preset !=
' ' || direction !=
' ')
339 Bool_t useIndivOption =
false;
341 if (direction ==
' ') direction =
'X';
343 char *brOpen = strstr(opt,
"(");
344 char *brClose = strstr(opt,
")");
345 char indivOption[32];
346 if (brOpen && brClose) {
347 useIndivOption =
true;
349 strlcpy(indivOption, brOpen, brClose-brOpen +2);
350 sscanf(indivOption,
"(%d)", (
int*) &
fOption);
352 memcpy(brOpen,
" ",brClose-brOpen+1);
359 fOptionStr.Form(
"VIOLIN%c%c", direction, preset);
362 if (!useIndivOption && !
fOption ) {
403 prob[0] = 0.5 - wRange/2.;
404 prob[4] = 0.5 + wRange/2.;
411 prob[1] = 0.5 - bRange/2.;
412 prob[3] = 0.5 + bRange/2.;
417 Double_t quantiles[5] = { 0., 0., 0., 0., 0. };
425 fProj->RebinX(divideBy);
427 fProj->GetQuantiles(5, quantiles, prob);
434 if (quantiles[0] >= quantiles[4] ||
435 quantiles[1] >= quantiles[3]) {
452 while (
fProj->GetBinContent(bin) == 0 && bin <= fProj->GetNbinsX()) bin++;
456 while (
fProj->GetBinContent(bin) == 0 && bin >= 1) bin--;
495 if (
fProj->GetEntries() > maxOutliers/2) myScale =
fProj->GetEntries()/(maxOutliers/2.);
497 for (
int bin = 0; bin <
fProj->GetNbinsX(); bin++) {
500 Double_t scaledBinContent =
fProj->GetBinContent(bin)/myScale;
501 if (scaledBinContent >0 && scaledBinContent < 1) scaledBinContent = 1;
502 for (
int j=0; j < (
int)scaledBinContent; j++) {
509 if ((
int)scaledBinContent == 1)
532 Error (
"PaintCandlePlot",
"Not possible to draw all outliers.");
539 myScale = nOutliers/(maxOutliers/2.);
547 if (!(i % (
int) myScale == 0 ))
continue;
575 Error (
"PaintCandlePlotRaw",
"Not possible to draw all outliers.");
586 fProj =
new TH1D(
"hpa",
"hpa",100,min,max+0.0001*(max-min));
587 fProj->SetDirectory(
nullptr);
601 for (
int bin = 1; bin <=
fProj->GetNbinsX(); bin++) {
603 if (
fProj->GetBinContent(bin) > 0) {
621 if (myBinValue > 0) myBinValue =
TMath::Log10(myBinValue);
else myBinValue = 0;
722 dimRight, dimRight-
fCandleWidth/3., dimRight, dimRight, dimLeft};
727 Double_t x[] = {dimLeft, dimLeft, dimRight, dimRight, dimLeft};
755 Double_t myMedianX[1], myMedianY[1];
766 if (myMedianX[0] > 0) myMedianX[0] =
TMath::Log10(myMedianX[0]);
else isValid =
false;
769 if (myMedianY[0] > 0) myMedianY[0] =
TMath::Log10(myMedianY[0]);
else isValid =
false;
776 if (isValid)
gPad->PaintPolyMarker(1,myMedianX,myMedianY);
795 if (myMeanX[0] > 0) myMeanX[0] =
TMath::Log10(myMeanX[0]);
else isValid =
false;
798 if (myMeanY[0] > 0) myMeanY[0] =
TMath::Log10(myMeanY[0]);
else isValid =
false;
806 if (isValid)
gPad->PaintPolyMarker(1,myMeanX,myMeanY);
850 for (pos = 0; pos < 16; pos++) {
851 if (myOpt > opt)
break;
857 return (thisOpt * myOpt) == opt;
870 for (
int i=0; i<nPoints; i++) {
876 for (
int i=0; i<nPoints; i++) {
882 gPad->PaintFillArea(nPoints,
x,
y);
883 gPad->PaintPolyLine(nPoints,
x,
y);
885 gPad->PaintFillArea(nPoints,
y,
x);
886 gPad->PaintPolyLine(nPoints,
y,
x);
908 gPad->PaintLine(x1, y1, x2, y2);
910 gPad->PaintLine(y1, x1, y2, x2);
946 fMean = axisMinCoord + ((
fMean-
a)/
b)*(axisMaxCoord-axisMinCoord);
949 fBoxUp = axisMinCoord + ((
fBoxUp-
a)/
b)*(axisMaxCoord-axisMinCoord);
int Int_t
Signed integer 4 bytes (int).
short Version_t
Class version identifier (short).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
short Style_t
Style number (short).
const char Option_t
Option string (const char).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
virtual Color_t GetFillColor() const
Return the fill area color.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetLineStyle() const
Return the line style.
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Double_t fMedian
Position of the median.
@ kHorizontal
If this bit is not set it is vertical.
void Streamer(TBuffer &) override
Stream an object of class TCandle.
static void SetScaledViolin(const Bool_t vScale=true)
Static function to set scaling between violin-withs.
bool fIsRaw
0: for TH1 projection, 1: using raw data
CandleOption fOption
Setting the style of the candle.
TString fOptionStr
String to draw the candle.
Double_t fAxisMax
The Maximum which is visible by the axis (used by zero indicator).
~TCandle() override
TCandle default destructor.
int fLogZ
make the candle appear logz-like
Double_t fPosCandleAxis
x-pos for a vertical candle
int GetCandleOption(const int pos) const
Double_t fMean
Position of the mean.
Double_t fWhiskerDown
Position of the lower whisker end.
Long64_t fNDrawPoints
max number of outliers or other point to be shown
virtual void Paint(Option_t *option="")
Paint one candle with its current attributes.
Double_t fAxisMin
The Minimum which is visible by the axis (used by zero indicator).
void ConvertToPadCoords(Double_t minAxis, Double_t maxAxis, Double_t axisMinCoord, Double_t axisMaxCoord)
The coordinates in the TParallelCoordVar-class are in Pad-Coordinates, so we need to convert them.
Double_t fDrawPointsY[kNMAXPOINTS]
y-coord for every outlier, ..
Long64_t fNDatapoints
Number of Datapoints within this candle.
Bool_t IsViolinScaled() const
Returns true if violin plot should be scaled.
Double_t fHistoPointsY[kNMAXPOINTS]
y-coord for the polyline of the histo
Bool_t IsHorizontal() const
Double_t fHistoPointsX[kNMAXPOINTS]
x-coord for the polyline of the histo
static void SetScaledCandle(const Bool_t cScale=true)
Static function to set scaling between candles-withs.
Double_t * fDatapoints
position of all Datapoints within this candle
int ParseOption(char *optin)
Parsing of the option-string.
bool fDismiss
True if the candle cannot be painted.
Double_t fWhiskerUp
Position of the upper whisker end.
static void SetBoxRange(const Double_t bRange)
Static function to set BoxRange, by setting box-range, one can force the box of the candle-chart to c...
bool IsOption(CandleOption opt) const
Return true is this option is activated in fOption.
int fLogY
make the candle appear logy-like
Double_t fMedianErr
The size of the notch.
void PaintBox(Int_t nPoints, Double_t *x, Double_t *y, Bool_t swapXY)
Paint a box for candle.
Double_t fBoxUp
Position of the upper box end.
int fLogX
make the candle appear logx-like
Double_t fDrawPointsX[kNMAXPOINTS]
x-coord for every outlier, ..
TCandle()
TCandle default constructor.
Double_t fBoxDown
Position of the lower box end.
void Calculate()
Calculates all values needed by the candle definition depending on the candle options.
void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Bool_t swapXY)
Paint a line for candle.
Double_t fHistoWidth
The histo width (the height of the max bin).
Bool_t IsCandleScaled() const
Returns true if candle plot should be scaled.
static void SetWhiskerRange(const Double_t wRange)
Static function to set WhiskerRange, by setting whisker-range, one can force the whiskers to cover th...
Double_t fCandleWidth
The candle width.
1-D histogram with a double per channel (see TH1 documentation)
Random number generator class based on the maximally equidistributed combined Tausworthe generator by...
Double_t Rndm() override
TausWorth generator from L'Ecuyer, uses as seed 3x32bits integers Use a mask of 0xffffffffUL to make ...
void Quantiles(Int_t n, Int_t nprob, Double_t *x, Double_t *quantiles, Double_t *prob, Bool_t isSorted=kTRUE, Int_t *index=nullptr, Int_t type=7)
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.