00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <TPieSlice.h>
00010
00011 #include <Riostream.h>
00012 #include <TError.h>
00013 #include <TROOT.h>
00014 #include <TVirtualPad.h>
00015 #include <TArc.h>
00016 #include <TMath.h>
00017 #include <TStyle.h>
00018 #include <TLatex.h>
00019 #include <TPaveText.h>
00020 #include <TH1.h>
00021
00022 ClassImp(TPieSlice)
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 TPieSlice::TPieSlice() : TNamed(), TAttFill(), TAttLine()
00035 {
00036
00037
00038 fPie = 0;
00039 fValue = 1;
00040 fRadiusOffset = 0;
00041 fIsActive = kFALSE;
00042 }
00043
00044
00045
00046 TPieSlice::TPieSlice(const char *name, const char *title,
00047 TPie *pie, Double_t val) :
00048 TNamed(name, title), TAttFill(), TAttLine()
00049 {
00050
00051
00052 fPie = pie;
00053 fValue = val;
00054 fRadiusOffset = 0;
00055 fIsActive = kFALSE;
00056 }
00057
00058
00059
00060 Int_t TPieSlice::DistancetoPrimitive(Int_t , Int_t )
00061 {
00062
00063
00064 Int_t dist = 9999;
00065
00066 if (fIsActive) {
00067 dist = 0;
00068 fIsActive = kFALSE;
00069 gPad->SetCursor(kHand);
00070 }
00071
00072 return dist;
00073 }
00074
00075
00076
00077 Double_t TPieSlice::GetRadiusOffset()
00078 {
00079
00080
00081 return fRadiusOffset;
00082 }
00083
00084
00085
00086 Double_t TPieSlice::GetValue()
00087 {
00088
00089
00090 return fValue;
00091 }
00092
00093
00094
00095 void TPieSlice::SavePrimitive(ostream &, Option_t * )
00096 {
00097
00098 }
00099
00100
00101
00102 void TPieSlice::SetRadiusOffset(Double_t val)
00103 {
00104
00105
00106 fRadiusOffset = val;
00107 if (fRadiusOffset<.0) fRadiusOffset = .0;
00108 }
00109
00110
00111
00112 void TPieSlice::SetValue(Double_t val)
00113 {
00114
00115
00116
00117 fValue = val;
00118 if (fValue<.0) {
00119 Warning("SetValue","Invalid negative value. Absolute value taken");
00120 fValue *= -1;
00121 }
00122
00123 fPie->MakeSlices(kTRUE);
00124 }