Warning, file /include/root/TCandle.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TCandle
0013 #define ROOT_TCandle
0014
0015 #include "TObject.h"
0016 #include "TAttLine.h"
0017 #include "TAttFill.h"
0018 #include "TAttMarker.h"
0019 #include "TString.h"
0020
0021 #include "TMath.h"
0022
0023 class TH1D;
0024
0025 const Int_t kNMAXPOINTS = 2010;
0026
0027 class TCandle : public TAttLine, public TAttFill, public TAttMarker {
0028 public:
0029
0030 enum CandleOption: long {
0031 kNoOption = 0,
0032 kBox = 1,
0033 kMedianLine = 10,
0034 kMedianNotched = 20,
0035 kMedianCircle = 30,
0036 kMeanLine = 100,
0037 kMeanCircle = 300,
0038 kWhiskerAll = 1000,
0039 kWhisker15 = 2000,
0040 kAnchor = 10000,
0041 kPointsOutliers = 100000,
0042 kPointsAll = 200000,
0043 kPointsAllScat = 300000,
0044 kHistoLeft = 1000000,
0045 kHistoRight = 2000000,
0046 kHistoViolin = 3000000,
0047 kHistoZeroIndicator = 10000000,
0048 kHorizontal = 100000000
0049 };
0050
0051
0052 protected:
0053
0054 bool fIsRaw;
0055 bool fIsCalculated;
0056 TH1D *fProj{nullptr};
0057 bool fDismiss;
0058
0059 Double_t fPosCandleAxis;
0060 Double_t fCandleWidth;
0061 Double_t fHistoWidth;
0062
0063 Double_t fMean;
0064 Double_t fMedian;
0065 Double_t fMedianErr;
0066 Double_t fBoxUp;
0067 Double_t fBoxDown;
0068 Double_t fWhiskerUp;
0069 Double_t fWhiskerDown;
0070
0071 Double_t *fDatapoints{nullptr};
0072 Long64_t fNDatapoints;
0073
0074 Double_t fDrawPointsX[kNMAXPOINTS];
0075 Double_t fDrawPointsY[kNMAXPOINTS];
0076 Long64_t fNDrawPoints;
0077
0078 Double_t fHistoPointsX[kNMAXPOINTS];
0079 Double_t fHistoPointsY[kNMAXPOINTS];
0080 int fNHistoPoints;
0081
0082 CandleOption fOption;
0083 TString fOptionStr;
0084 int fLogX;
0085 int fLogY;
0086 int fLogZ;
0087
0088 Double_t fAxisMin;
0089 Double_t fAxisMax;
0090
0091 void Calculate();
0092
0093 int GetCandleOption(const int pos) const {return (fOption/(long)TMath::Power(10,pos))%10;}
0094
0095 void PaintBox(Int_t nPoints, Double_t *x, Double_t *y, Bool_t swapXY);
0096 void PaintLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Bool_t swapXY);
0097
0098 public:
0099
0100 TCandle();
0101 TCandle(const char *opt);
0102 TCandle(const Double_t candlePos, const Double_t candleWidth, Long64_t n, Double_t * points);
0103 TCandle(const Double_t candlePos, const Double_t candleWidth, TH1D *proj);
0104 TCandle(const TCandle &candle);
0105 ~TCandle() override;
0106
0107 Double_t GetMean() const {return fMean;}
0108 Double_t GetMedian() const {return fMedian;}
0109 Double_t GetQ1() const {return fBoxUp;}
0110 Double_t GetQ2() const {return fMedian;}
0111 Double_t GetQ3() const {return fBoxDown;}
0112 Bool_t IsHorizontal() const {return IsOption(kHorizontal); }
0113 Bool_t IsVertical() const {return !IsOption(kHorizontal); }
0114 Bool_t IsCandleScaled() const;
0115 Bool_t IsViolinScaled() const;
0116
0117 void SetOption(CandleOption opt) { fOption = opt; }
0118 void SetLog(int x, int y, int z) { fLogX = x; fLogY = y; fLogZ = z;}
0119 void SetAxisPosition(const Double_t candlePos) { fPosCandleAxis = candlePos; }
0120
0121 void SetCandleWidth(const Double_t width) { fCandleWidth = width; }
0122 void SetHistoWidth(const Double_t width) { fHistoWidth = width; }
0123 void SetHistogram(TH1D *proj) { fProj = proj; fIsCalculated = false;}
0124
0125 virtual void Paint(Option_t *option="");
0126 void ConvertToPadCoords(Double_t minAxis, Double_t maxAxis, Double_t axisMinCoord, Double_t axisMaxCoord);
0127
0128 virtual void SetMean(Double_t mean) { fMean = mean; }
0129 virtual void SetMedian(Double_t median) { fMedian = median; }
0130 virtual void SetQ1(Double_t q1) { fBoxUp = q1; }
0131 virtual void SetQ2(Double_t q2) { fMedian = q2; }
0132 virtual void SetQ3(Double_t q3) { fBoxDown = q3; }
0133
0134 int ParseOption(char *optin);
0135 const char *GetDrawOption() const { return fOptionStr.Data(); }
0136 long GetOption() const { return fOption; }
0137 bool IsOption(CandleOption opt) const;
0138 static void SetWhiskerRange(const Double_t wRange);
0139 static void SetBoxRange(const Double_t bRange);
0140 static void SetScaledCandle(const Bool_t cScale = true);
0141 static void SetScaledViolin(const Bool_t vScale = true);
0142
0143 ClassDefOverride(TCandle,2)
0144 };
0145 #endif