00001 #ifndef XeCore_h
00002 #define XeCore_h
00003
00004 #include <XeVersion.h>
00005
00006 #include <iomanip>
00007 #include <sstream>
00008 #include <vector>
00009 #include <set>
00010 #include <map>
00011 #include <math.h>
00012
00013 #include "TArrow.h"
00014 #include "TBox.h"
00015 #include "TCanvas.h"
00016 #include "TEllipse.h"
00017 #include "TF1.h"
00018 #include "TFile.h"
00019 #include "TGLayout.h"
00020 #include "TGraphErrors.h"
00021 #include "TGraph.h"
00022 #include "TGWindow.h"
00023 #include "TH1I.h"
00024 #include "TH2F.h"
00025 #include "TH2I.h"
00026 #include "TKey.h"
00027 #include "TLatex.h"
00028 #include "TLegend.h"
00029 #include "TMath.h"
00030 #include "TMultiGraph.h"
00031 #include "TPolyLine.h"
00032 #include "TPolyMarker.h"
00033 #include "TProfile.h"
00034 #include "TROOT.h"
00035 #include "TStopwatch.h"
00036 #include "TStyle.h"
00037 #include "TSystem.h"
00038 #include "TTree.h"
00039 #include "TVector.h"
00040
00041 #define deleteWithPointer(ptr) {if(ptr!=NULL){ delete ptr;ptr=NULL;}}
00042
00043 #define RESET_PRECISION resetiosflags(ios_base::floatfield )<<setprecision(6)
00044
00045 enum bandType { NO_BAND = -1
00046 , LOWER_EDGE
00047 , BAND_CENTER
00048 , UPPER_EDGE
00049 , N_EDGES
00050 } ;
00051
00052 enum symmetryType { SYMMETRIC
00053 , ASYMMETRIC
00054 } ;
00055
00056
00057 enum statusType { UNCHECKED, IN_ERROR, CHECKED_OK};
00058
00059 enum displayType { UNKNOWN_DISPLAY = -1
00060 , S2_VS_S1
00061 , S2_OVER_S1_VS_S1
00062 , FLATTENED_S2_VS_S1
00063 , BAND_VS_SLICE
00064 , N_DISPLAYS
00065 , CURRENT_DISPLAY = N_DISPLAYS
00066 } ;
00067
00068 STATIC_CONST double VERY_LARGE = 1.E19
00069 , TINY = 1.E-99
00070 , VERY_SMALL = -VERY_LARGE
00071 , VERY_SMALL_LOG = -10000.
00072 , UNDEFINED = -VERY_LARGE
00073 , AUTOMATIC = UNDEFINED*10.
00074 , CRAZY = 98765432123456789.
00075 ;
00076
00077
00078 enum XeFonts { DEFAULT_FONT=62
00079 , LATEX_FONT=132
00080 } ;
00081
00082 enum myColors { darkGreen=kGreen+1
00083 };
00084
00085 enum trackingPoint { ENTRY
00086 , EXIT
00087 } ;
00088
00089 enum lineStyle { PLAIN = 1
00090 , DASHED = 2
00091 , DOTTED = 3
00092 , DASH_DOTTED = 4
00093 , LONG_DASH_DOTTED = 5
00094 , LONG_DASHED = 7
00095 } ;
00096
00097 enum styleDefault { DEFAULT_LINE_COLOR = kBlue
00098 , DEFAULT_LINE_WIDTH = 2
00099 , DEFAULT_LINE_STYLE = PLAIN
00100 , DEFAULT_MARKER_COLOR = kBlack
00101 , DEFAULT_MARKER_STYLE = 7
00102 , DEFAULT_FILL_COLOR = 0
00103 , DEFAULT_FILL_STYLE = 0
00104 , CUT_LINE_COLOR = kSpring
00105 , CUT_FILL_WIDTH = 102
00106 , CUT_FILL_COLOR = kSpring
00107 , CUT_FILL_STYLE = 3001
00108 } ;
00109
00110 STATIC_CONST double DEFAULT_MARKER_SIZE=1.;
00111
00112 enum legendMode {WITH_LEGEND, NO_LEGEND};
00113
00114 enum flagType { VERY_LARGE_INT = 9999999
00115 , VERY_SMALL_INT = -VERY_LARGE_INT
00116 , UNDEFINED_INT
00117 , SAME
00118 , NEXT
00119 , AUTO
00120 , ALL
00121 , NONE
00122 , GENERAL
00123 , LINEAR
00124 , LOG
00125 , EXPONENTIAL
00126 , LOGX_LINY
00127 , PARABOLIC
00128 } ;
00129
00130 const string UNDEFINED_STRING="???";
00131 const string XENON_100_REFERENCE
00132 ="https://xecluster.lngs.infn.it/dokuwiki/doku.php?id=xenon:xenon100:analysis";
00133
00134 const string LABEL_BAND = "Band number"
00135 , LABEL_ER = "E_{r} (KeV)"
00136 , LABEL_EVT_AFTER_SEL = "Events after selection"
00137 , LABEL_EVT_DAY = "Events (day^{-1})"
00138 , LABEL_EVT = "Events"
00139 , LABEL_EVT_MAX = "Events_{max}"
00140 , LABEL_EVT_KEV = "Events (KeV^{-1})"
00141 , LABEL_EVT_KG_DAY = "Events (Kg^{-1} day^{-1})"
00142 , LABEL_EVT_KG_DAY_KEV = "Events (Kg^{-1} day^{-1} KeV^{-1})"
00143 , LABEL_EVT_PE = "Events (p.e^{-1})"
00144 , LABEL_FF = "F^{2}"
00145 , LABEL_FLATTENED = "Flattened log_{10}(S2/S1)"
00146 , LABEL_LEFF = "L_{eff}"
00147 , LABEL_LEFF_TVALUE = "t-Value for L_{eff}"
00148 , LABEL_MASS = "Mass (GeV/c^{2})"
00149 , LABEL_NORMTO1 = "Distribution norm. to 1"
00150 , LABEL_LOG_LIKELIHOOD = "-log(Likelihood)"
00151 , LABEL_PVALUE = "P-value"
00152 , LABEL_Q_EXCLUSION = "q_{excl.}"
00153 , LABEL_S1 = "S1 (p.e.)"
00154 , LABEL_S2 = "S2"
00155 , LABEL_S2_OVER_S1 = "S2/S1"
00156 , LABEL_SA = "SA(y)"
00157 , LABEL_SIGMA = "\\sigma (cm^{2})"
00158 , LABEL_SIGMA_MAX = "\\sigma_{max} (cm^{2})"
00159 , LABEL_SLICE = "Slice Number"
00160 , LABEL_VESC = "V_{esc}"
00161 , LABEL_Y_UOVER2 = "y=u/2"
00162 ;
00163
00164 STATIC_CONST int DEFAULT_N_BANDS = 12
00165 , DEFAULT_N_SLICES = 27
00166 ;
00167
00168 class stopper;
00169
00170
00171
00172
00173 class XeCore {
00174
00175 public :
00176
00177
00178
00179
00180
00181 virtual ~XeCore();
00182 XeCore();
00183
00184
00185
00186
00187
00188 static void setDebugLevel(int l);
00189
00190
00191
00192
00193
00194 static void setTraceLevel(int l);
00195
00196
00197
00198
00199
00200 static void showTheReferences(bool show=true);
00201
00202
00203
00204
00205 static void suppressWarnings(bool suppress=true);
00206
00207
00208
00209
00210 static void showWarnings(bool show=true);
00211
00212
00213
00214
00215 static int getDebugLevel();
00216
00217
00218
00219
00220 static int getTraceLevel();
00221
00222
00223
00224
00225 static void fillHist(TH1* h, vector<double> &v);
00226
00227
00228
00229
00230
00231
00232 static TH1F* getCumulated(TH1F* h);
00233
00234
00235
00236
00237
00238 static void saveObjects(string fileName);
00239
00240
00241
00242
00243
00244 static void restoreObjects(string fileName);
00245
00246
00247
00248
00249
00250
00251 static bool doWarn();
00252 static void resetPrecision();
00253 static void restoreWarnings();
00254 static void saveWarnings();
00255 static void displayFlag(string title,int tab,bool value,bool def);
00256 static void displayFlag(string title,int tab,int value,int def);
00257 static void displayFlag(string tit,int tab,double val,double def);
00258 static void displayFlag(string title,int tab,string what,bool def);
00259 static bool isALaTeXName(string s);
00260 static bool isALaTeXChar(char c);
00261 static bool fileExists(string path);
00262 static string addASpace(string s);
00263 static string makeItAFileName(string s);
00264 static string makeItALaTeXName(string s);
00265 static string upperCase(string s);
00266 static string lowerCase(string s);
00267 static string trim(string s);
00268 static string justify(string s, int w, bool left,bool trim);
00269 static string leftJustify(string s,int w, bool trim=false);
00270 static string rightJustify(string s, int w, bool trim=false);
00271 static string formatI(int v, int w=1, int trailer=0);
00272 static string formatLI(int v, int w=1, int p=1);
00273 static string formatRI(int v, int w=1, int p=1);
00274 static string formatF(double v, int w=1, int p=1);
00275 static string formatLF(double v, int w=1, int p=1);
00276 static string formatRF(double v, int w=1, int p=1);
00277 static string formatG(double v, int w=1, int p=1);
00278 static string formatLG(double v, int w=1, int p=1);
00279 static string formatRG(double v, int w=1, int p=1);
00280 static string formatLatex(double v, int p=1);
00281 static string yesOrNo(bool b);
00282 static string doOrDont(bool b);
00283 static string removeHeader(string original, string header);
00284 static string replaceSlashes(string s);
00285 static string replaceBlanks(string s);
00286 static string replaceParentheses(string s);
00287 static vector<double> decodeVector(string text);
00288
00289
00290 static bool initializeCore();
00291 static string getEdgeName(int e);
00292
00293
00294 protected :
00295
00296 static int debugLevel;
00297 static int traceLevel;
00298 static bool coreInitialized;
00299 static bool withWarnings;
00300 static bool savedWarnings;
00301 static stopper *mainStopper;
00302
00303
00304 ClassDef(XeCore,1)
00305
00306 } ;
00307
00308
00309
00310
00311
00312
00313 class XeGraphics : virtual public XeCore {
00314
00315 public:
00316
00317 XeGraphics();
00318 virtual ~XeGraphics();
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330 static void newFrame( string title,double xmi,double xma
00331 , double ymi,double yma,string tx="",string ty=""
00332 , int xMode=LINEAR, int yMode=LINEAR);
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346 static void newFrameZ( string title,double xmi,double xma
00347 , double ymi,double yma,double zmi,double zma
00348 , int zscale=LINEAR,string tx="",string ty="");
00349
00350
00351
00352
00353
00354
00355
00356
00357 static void newCanvas(string name="", int nx=1 ,int ny=1, bool square=false);
00358
00359
00360
00361
00362
00363 static void saveCanvas(string header="");
00364
00365
00366
00367
00368
00369
00370
00371
00372 static void subCanvas(int nx,int ny, int window=0);
00373
00374
00375
00376
00377 static void nextSubCanvas();
00378
00379
00380
00381
00382
00383 static void subCanvas(int window);
00384
00385
00386
00387
00388
00389
00390
00391
00392 static void subCanvas(double xmin,double xmax,double ymin,double ymax);
00393
00394
00395
00396
00397 static void updateGraphics();
00398
00399
00400
00401
00402
00403
00404
00405
00406 static void drawHist(TH1* h,string tx="",string ty="",string opt="");
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416 static void drawHist(TH1* h,int ysc, string tx="",string ty="",string opt="");
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426 static void drawHist(TH2* h,string tx="",string ty="",int zscale=LINEAR);
00427
00428
00429
00430
00431
00432
00433 static TH1F* drawCumulated(TH1F* h, int color=kRed);
00434
00435
00436
00437
00438
00439 static void setFont(int font);
00440
00441
00442
00443
00444 static int getFont();
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456 static bool isScaleOK(int flag,bool warn=true);
00457
00458
00459
00460
00461
00462
00463
00464 static int isLog(int scale);
00465
00466
00467
00468
00469
00470
00471
00472 static bool isScaleError(int flag,bool warn=true);
00473
00474 protected:
00475
00476 static int font;
00477 static TCanvas* canvas;
00478 static TPad* pad;
00479 static int xCanvas;
00480 static int yCanvas;
00481 static int wCanvas;
00482
00483 };
00484
00485
00486
00487
00488
00489 class XeTool : virtual public XeCore {
00490
00491 public:
00492
00493 XeTool();
00494 virtual ~XeTool();
00495 };
00496
00497
00498
00499
00500
00501 class stopper : public XeTool, public TStopwatch {
00502
00503 public :
00504
00505 stopper(string name);
00506 ~stopper();
00507
00508
00509
00510
00511 void restart();
00512
00513
00514
00515
00516 void print();
00517
00518
00519
00520
00521 void lapse();
00522
00523 ClassDef(stopper,1)
00524
00525 protected :
00526
00527 string name;
00528 };
00529
00530
00531
00532
00533
00534
00535
00536 class MethodCounter : public XeTool {
00537
00538 public :
00539
00540
00541
00542
00543
00544 ~MethodCounter();
00545 MethodCounter();
00546
00547
00548
00549
00550
00551 static void count(string method);
00552
00553
00554
00555
00556 static void list();
00557
00558
00559
00560
00561 static void reset();
00562
00563
00564
00565
00566
00567 protected :
00568
00569 static map<string,int> counts;
00570
00571 } ;
00572
00573 class XeTopObject;
00574
00575
00576
00577
00578
00579 class XeObject : virtual public XeCore, virtual public TObject {
00580
00581
00582 public:
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593 virtual bool checkIt();
00594
00595
00596
00597
00598
00599 virtual void traceFlags();
00600
00601 virtual ~XeObject();
00602 XeObject();
00603 XeObject(string name);
00604
00605
00606
00607
00608
00609 void trace(trackingPoint tp, string method);
00610
00611 void setLaTeXName(string latex);
00612 void setReference(string ref);
00613 void printReference(int ntab=0);
00614 void setLegend(string legend="");
00615
00616
00617
00618
00619
00620 virtual void setName(string n);
00621 virtual string getFrameName();
00622
00623
00624
00625
00626
00627
00628
00629 bool print(int level=1);
00630
00631
00632
00633
00634
00635
00636
00637 bool check();
00638
00639
00640
00641
00642 bool hasLegend();
00643
00644
00645
00646
00647
00648 bool isReferenced();
00649
00650
00651
00652
00653 bool hasName();
00654
00655
00656
00657
00658
00659 string getLegend();
00660
00661
00662
00663
00664 const char* getNameChar();
00665
00666
00667
00668
00669 string getName();
00670
00671
00672
00673
00674 string getNameSpace();
00675
00676
00677
00678
00679
00680
00681 XeObject* getUp();
00682
00683
00684
00685
00686
00687
00688 XeObject* getDown(int g);
00689
00690
00691
00692
00693
00694 vector<XeObject*>* getDowns();
00695
00696
00697
00698
00699
00700 int getNDowns();
00701
00702
00703
00704
00705 string getLaTeXName();
00706
00707
00708
00709
00710 string getReference();
00711
00712
00713
00714
00715
00716
00717
00718 void openCanvas(int nx=1, int ny=1,bool square=false);
00719
00720
00721
00722
00723
00724 void write(string name="");
00725
00726
00727
00728
00729
00730 void read(string name="");
00731
00732
00733
00734
00735
00736
00737 void writeToSimpleFile(string fName="",string oName="");
00738
00739
00740
00741
00742
00743
00744
00745
00746 void readFromSimpleFile(string fName="", string oName="");
00747
00748
00749
00750
00751
00752
00753 void printTree(int depth=12345,int offset=0);
00754
00755
00756
00757
00758
00759 static void setResultsDirectory(string dir="");
00760 static string getResultsDirectory();
00761 static bool withReference();
00762 static void showTheReferences(bool show=true);
00763
00764
00765
00766
00767 static XeTopObject *getTop();
00768 void setFrameName(string frame);
00769 void setXenon100Reference(string xenonRef);
00770
00771
00772
00773
00774
00775 void addName(string n);
00776 void setName(const char* n);
00777
00778
00779
00780
00781
00782 int getStatus();
00783
00784
00785
00786
00787 string getStatusName();
00788
00789
00790
00791
00792 string getMiniStatusName();
00793
00794
00795
00796
00797
00798 static string getStatusName(int s);
00799
00800
00801
00802
00803
00804 static string getMiniStatusName(int s);
00805
00806
00807
00808
00809 bool isCheckedOK();
00810
00811
00812
00813
00814 bool isOK();
00815
00816
00817
00818
00819 bool isError();
00820
00821
00822
00823
00824 void markError();
00825
00826
00827
00828
00829 void markOK();
00830
00831
00832
00833
00834 void markUnchecked();
00835
00836
00837
00838
00839
00840 void markFromCheck(bool ok);
00841
00842
00843
00844
00845 bool checkAll();
00846
00847
00848
00849
00850
00851 bool isChanged();
00852
00853
00854
00855
00856
00857 void markAsChanged(bool propagateUp=true);
00858
00859
00860
00861
00862 void doNotMarkAsChanged();
00863
00864
00865
00866
00867 void markAsRecomputed();
00868
00869
00870
00871
00872
00873 void attach(XeObject* daughter);
00874
00875
00876
00877
00878
00879 void detach(XeObject* daughter);
00880
00881
00882
00883
00884
00885 void detachItself();
00886
00887
00888
00889
00890
00891
00892 void linkUp(XeObject* up);
00893
00894
00895
00896
00897
00898
00899 virtual bool printIt(int level=1);
00900
00901 protected:
00902
00903
00904
00905 static string resultsDirectory;
00906 static bool showReference;
00907 string Name;
00908 string LaTeXName;
00909 string FrameName;
00910 string Reference;
00911 string legend;
00912 bool changed;
00913 int status;
00914
00915 string upName;
00916 XeObject* up;
00917 vector<XeObject*> downs;
00918
00919
00920
00921
00922 void initializeObject(string n=UNDEFINED_STRING);
00923
00924
00925
00926
00927 virtual void traceTheFlags();
00928
00929
00930 ClassDef(XeObject,1)
00931
00932 };
00933
00934
00935
00936
00937
00938 XeTopObject* top=NULL;
00939
00940 class XeTopObject : public XeObject {
00941
00942 public :
00943
00944
00945
00946
00947
00948 static void newInstance();
00949
00950 XeTopObject();
00951 ~XeTopObject();
00952
00953 protected:
00954
00955 ClassDef(XeTopObject,1)
00956 };
00957
00958
00959
00960
00961 class XeTable : public map<int,double> , public XeObject {
00962
00963 public :
00964
00965 XeTable();
00966 XeTable(string name);
00967 virtual ~XeTable();
00968
00969
00970
00971
00972
00973
00974 void add(int i,double value);
00975
00976
00977
00978
00979 int getFirst();
00980
00981
00982
00983
00984 int getLast();
00985
00986
00987
00988
00989
00990 bool printIt(int level=1);
00991
00992 protected :
00993
00994
00995 int first;
00996 int last;
00997
00998 ClassDef(XeTable,1)
00999 };
01000
01001 typedef map<int,double>::iterator XeTableIterator;
01002
01003
01004
01005
01006
01007
01008
01009 class Flattener : public XeObject {
01010
01011
01012
01013
01014
01015 public :
01016
01017 virtual ~Flattener();
01018 Flattener();
01019 Flattener(string name);
01020
01021
01022
01023
01024
01025
01026 virtual double flatten(double S1, double S2)=0;
01027
01028
01029
01030
01031
01032
01033 virtual double unflatten(double S1, double flat)=0;
01034
01035
01036
01037
01038
01039
01040 void unflatten(TGraph* origin,TGraph* added);
01041
01042 ClassDef(Flattener,1)
01043
01044 };
01045
01046
01047
01048
01049
01050 class XeStyle : virtual public XeGraphics, virtual public XeObject {
01051
01052
01053
01054
01055
01056 public :
01057
01058
01059
01060
01061
01062
01063 XeStyle( int lineColor=DEFAULT_LINE_COLOR
01064 , int lineWidth=DEFAULT_LINE_WIDTH
01065 , int lineStyle=DEFAULT_LINE_STYLE
01066 , int markerColor=DEFAULT_MARKER_COLOR
01067 , double markerSize=DEFAULT_MARKER_SIZE
01068 , int markerStyle=DEFAULT_MARKER_STYLE
01069 , int fillColor=DEFAULT_FILL_COLOR
01070 , int fillStyle=DEFAULT_FILL_STYLE);
01071 void setLineColor(int color=DEFAULT_LINE_COLOR);
01072
01073
01074
01075
01076
01077 void setLineStyleColor(int index=0);
01078 void setLineStyle(int style=DEFAULT_LINE_STYLE);
01079 void setLineWidth(int width=DEFAULT_LINE_WIDTH);
01080 void setLineProperties(int color=DEFAULT_LINE_COLOR
01081 ,int width=DEFAULT_LINE_WIDTH
01082 ,int style=DEFAULT_LINE_STYLE);
01083 int getLineColor();
01084 int getLineStyle();
01085 int getLineWidth();
01086
01087 void setMarkerColor(int color=DEFAULT_MARKER_COLOR);
01088 void setMarkerStyleColor(int index=0);
01089 void setMarkerStyle(int style=DEFAULT_MARKER_STYLE);
01090 void setMarkerSize(double size=DEFAULT_MARKER_SIZE);
01091 void setMarkerProperties(int color=DEFAULT_MARKER_COLOR
01092 ,double size=DEFAULT_MARKER_SIZE
01093 ,int style=DEFAULT_MARKER_STYLE);
01094 int getMarkerColor();
01095 int getMarkerStyle();
01096 double getMarkerSize();
01097
01098 void setFillColor(int color=DEFAULT_FILL_COLOR);
01099 void setFillStyle(int style=DEFAULT_FILL_STYLE);
01100 void setFillProperties(int color=DEFAULT_FILL_COLOR
01101 ,int style=DEFAULT_FILL_STYLE);
01102 int getFillColor();
01103 int getFillStyle();
01104
01105
01106
01107
01108
01109
01110
01111
01112 static int getStyleColor(int index);
01113
01114
01115
01116
01117
01118
01119
01120 static int getRainbowColor(int index, int nC, int mode=ASYMMETRIC);
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132 static XeStyle* forTValue(double t);
01133
01134 static XeStyle* forEdge(int edge);
01135
01136 ~XeStyle();
01137
01138
01139
01140
01141
01142
01143 bool printIt(int level=1);
01144
01145
01146
01147
01148
01149 protected :
01150
01151 int lineColor;
01152 int lineWidth;
01153 int lineStyle;
01154 int markerColor;
01155 double markerSize;
01156 int markerStyle;
01157 int fillColor;
01158 int fillStyle;
01159
01160 ClassDef(XeStyle,1)
01161 };
01162
01163
01164
01165
01166
01167 class XeStylized : virtual public XeGraphics , virtual public XeObject {
01168
01169 public :
01170
01171
01172
01173
01174
01175
01176
01177
01178 virtual void applyStyle();
01179
01180
01181
01182
01183
01184
01185 virtual void draw(string options="L",int flag=0)=0;
01186
01187
01188
01189
01190 virtual double getMaxX()=0;
01191
01192
01193
01194
01195 virtual double getMinX()=0;
01196
01197
01198
01199
01200 virtual double getMaxY()=0;
01201
01202
01203
01204
01205 virtual double getMinY()=0;
01206
01207
01208
01209
01210 virtual double getMinYNotZero()=0;
01211
01212
01213
01214
01215
01216
01217 void drawWithFrame(string options="C",int flag=0);
01218
01219
01220
01221
01222
01223
01224 void drawWithCanvasAndFrame(string options="C",int flag=0);
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236 void drawFrame( double xmi=AUTOMATIC, double xma=AUTOMATIC
01237 , double ymi=AUTOMATIC, double yma=AUTOMATIC
01238 , int xScale=AUTO , int yscale=AUTO
01239 ) ;
01240
01241
01242
01243 virtual string generatedXLabel();
01244
01245
01246
01247
01248 virtual string generatedYLabel();
01249
01250 XeStylized();
01251
01252
01253
01254
01255
01256
01257
01258
01259 XeStylized(string name,string xL="", string yL="",string zL="");
01260
01261
01262
01263
01264
01265
01266
01267
01268 void setXYLabels(string xL="", string yL="", string zL="");
01269
01270
01271
01272
01273
01274
01275 void setDefaultXScale(int scale);
01276
01277
01278
01279
01280
01281 void setDefaultYScale(int scale);
01282
01283
01284
01285
01286
01287
01288 int getDefaultXScale();
01289
01290
01291
01292
01293
01294 int getDefaultYScale();
01295
01296
01297
01298
01299
01300 void setStyle(XeStyle* style=NULL);
01301
01302 void setLineProperties(int color=DEFAULT_LINE_COLOR
01303 ,int width=DEFAULT_LINE_WIDTH
01304 ,int style=DEFAULT_LINE_STYLE);
01305 void setLineColor(int color=DEFAULT_LINE_COLOR);
01306
01307
01308
01309
01310
01311
01312
01313 void setRainbowColor(int index, int nC, int mode=ASYMMETRIC);
01314
01315
01316
01317
01318
01319
01320 void setLineStyleColor(int index=0);
01321 void setLineStyle(int style=DEFAULT_LINE_STYLE);
01322 void setLineWidth(int width=DEFAULT_LINE_WIDTH);
01323 void setMarkerProperties(int color=DEFAULT_MARKER_COLOR
01324 ,double size=DEFAULT_MARKER_SIZE
01325 ,int style=DEFAULT_MARKER_STYLE);
01326 void setMarkerColor(int color=DEFAULT_MARKER_COLOR);
01327
01328
01329
01330
01331
01332 void setMarkerStyleColor(int index=0);
01333 void setMarkerStyle(int style=DEFAULT_MARKER_STYLE);
01334 void setMarkerSize(double size=DEFAULT_MARKER_SIZE);
01335 void setFillProperties(int color=DEFAULT_FILL_COLOR
01336 ,int style=DEFAULT_FILL_STYLE);
01337 void setFillColor(int color=DEFAULT_FILL_COLOR);
01338 void setFillStyle(int width=DEFAULT_FILL_STYLE);
01339
01340 int getLineColor();
01341 int getLineStyle();
01342 int getLineWidth();
01343 int getMarkerColor();
01344 int getMarkerStyle();
01345 int getFillColor();
01346 int getFillStyle();
01347 double getMarkerSize();
01348 string getXLabel();
01349 string getYLabel();
01350 string getZLabel();
01351 XeStyle* getStyle();
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363 void drawIt(int plot, string options="L",int flag=0);
01364
01365
01366 virtual ~XeStylized();
01367 void printStyle();
01368 void setXLabel(string xL);
01369 void setYLabel(string yL);
01370 void setZLabel(string zL);
01371
01372 protected :
01373
01374 XeStyle style;
01375 string xLabel;
01376 string yLabel;
01377 string zLabel;
01378 int defaultXScale;
01379 int defaultYScale;
01380
01381 ClassDef(XeStylized,1)
01382 };
01383
01384
01385
01386
01387
01388
01389 class XeGraph : public XeStylized {
01390
01391 public :
01392
01393
01394
01395
01396
01397 XeGraph();
01398
01399
01400
01401
01402
01403
01404
01405 XeGraph( string name, string xLab="", string yLab="");
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416 XeGraph( string fn, string name ,int dummy, string Xlab=""
01417 , string Ylab="" , XeStyle* st=NULL , string legend="");
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431 XeGraph( string name, int n,double *x, double *y, string Xlab=""
01432 ,string Ylab="" , XeStyle* st=NULL ,string legend=""
01433 , double norm=1.);
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443 XeGraph( string name, int n, string Xlab="" ,string Ylab=""
01444 , XeStyle* st=NULL ,string legend="");
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456 XeGraph(string name , TGraph& gr , string Xlab="", string Ylab=""
01457 , XeStyle* st=NULL, string legend="");
01458
01459
01460
01461
01462 void drawS1S2(string opt="");
01463
01464 void set(int i);
01465 void setPoint(int i, double x, double y);
01466 int getN();
01467 double* getX();
01468 double* getY();
01469 double getX(int i);
01470 double getY(int i);
01471 double getMinX();
01472 double getMaxX();
01473 double getMinY();
01474 double getMaxY();
01475
01476
01477
01478
01479 double getMinYNotZero();
01480
01481
01482
01483
01484 double getSumX();
01485
01486
01487
01488
01489 double getSumY();
01490
01491 XeGraph* divide(XeGraph* reference);
01492
01493
01494
01495
01496
01497 TGraph *getTGraph();
01498
01499
01500
01501
01502
01503
01504 void draw(string options="L",int flag=WITH_LEGEND);
01505 virtual ~XeGraph();
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515 bool printGraph(int n=0,bool stat=false,double xNorm=1.,double yNorm=1.);
01516
01517
01518
01519
01520
01521 void addGraph(TGraph &gr);
01522 void drawInsideS1S2(string opt="");
01523
01524
01525
01526
01527
01528 void setTheNames(string n,string leg="");
01529 void applyStyle();
01530 bool isCompatible(XeGraph* reference);
01531 void printHeader();
01532
01533
01534
01535
01536
01537
01538 bool printIt(int level=1);
01539 protected :
01540
01541
01542 TGraph graph;
01543
01544 ClassDef(XeGraph,1)
01545 } ;
01546
01547
01548
01549
01550
01551 class XeGraphPositive : public XeGraph {
01552
01553 public :
01554
01555
01556
01557
01558
01559 ~XeGraphPositive();
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570 XeGraphPositive( string name, int n, double *x,double *y,string xLab=""
01571 ,string yLab="" , XeStyle* style=NULL ,string legend="");
01572
01573
01574
01575
01576
01577
01578
01579
01580 XeGraphPositive(string name, TGraph* gr, string xLab="", string yLab=""
01581 , XeStyle* style=NULL, string legend="");
01582 XeGraphPositive(string name, XeGraph* gr);
01583
01584
01585
01586
01587
01588 ClassDef(XeGraphPositive,1)
01589
01590 protected:
01591
01592 void build(int n, double *x, double *y, XeStyle* style,string legend);
01593
01594 } ;
01595
01596
01597
01598
01599
01600
01601
01602
01603 class XeMultiGraph : public XeStylized , public vector<XeGraph*> {
01604
01605
01606 public :
01607
01608
01609
01610
01611
01612 ~XeMultiGraph();
01613
01614 XeMultiGraph();
01615
01616
01617
01618
01619
01620
01621
01622 XeMultiGraph(string name,string xA="",string yA="", string zA="");
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634 XeMultiGraph(string name, int ng, XeGraph** g, double* z=NULL
01635 ,string xA="",string yA="", string zA="");
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646 XeMultiGraph(string name, vector<XeGraph*>& v, vector<double>* vz=NULL
01647 ,string xA="",string yA="", string zA="");
01648
01649
01650
01651
01652
01653
01654 XeMultiGraph* normalize(XeGraph* reference);
01655
01656
01657
01658
01659
01660
01661 XeMultiGraph* normalize(int i=AUTO);
01662
01663
01664
01665
01666
01667
01668 void draw(string options="L",int withLegend=0);
01669
01670
01671
01672
01673
01674
01675
01676
01677 void add(XeGraph* g,double z=UNDEFINED);
01678
01679
01680
01681
01682
01683
01684
01685 void add(XeGraph* g,int color, string legend="");
01686
01687
01688
01689
01690 double getMinX();
01691
01692
01693
01694
01695 double getMaxX();
01696
01697
01698
01699
01700 double getMinY();
01701
01702
01703
01704
01705 double getMaxY();
01706
01707
01708
01709
01710 double getMinYNotZero();
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720 void setRainbowColors(int mode=ASYMMETRIC);
01721
01722
01723
01724
01725 void setSymmetricRainbowColors();
01726
01727
01728
01729
01730 void setAsymmetricRainbowColors();
01731
01732
01733 void modifyLineColor(int color=DEFAULT_LINE_COLOR);
01734 void modifyLineStyle(int style=DEFAULT_LINE_STYLE);
01735 void modifyLineWidth(int width=DEFAULT_LINE_WIDTH);
01736
01737
01738
01739
01740
01741 XeMultiGraph* transpose();
01742
01743
01744
01745
01746
01747 void setReferenceGraph(XeGraph *g);
01748
01749
01750
01751
01752
01753 void setReferenceGraph(int i);
01754
01755
01756
01757
01758
01759
01760 XeGraph* getGraph(int i);
01761
01762
01763
01764
01765
01766 XeGraph* getReferenceGraph();
01767
01768
01769
01770
01771
01772 void forceAxes(int which=0);
01773
01774
01775
01776
01777
01778 void add(XeMultiGraph* mg);
01779
01780
01781
01782
01783
01784 string generatedXLabel();
01785 string generatedYLabel();
01786 void applyStyle();
01787
01788
01789
01790
01791
01792
01793
01794 double getZ(int g);
01795
01796
01797
01798
01799
01800 double* getZ();
01801
01802
01803
01804
01805
01806 vector<double>* getVz();
01807
01808
01809
01810
01811
01812
01813 double getX(int g);
01814
01815
01816
01817
01818
01819 double* getX();
01820
01821
01822
01823
01824
01825 vector<double>* getVx();
01826
01827
01828
01829
01830
01831 bool printIt(int level=1);
01832
01833 protected :
01834
01835
01836
01837
01838
01839 void resetTheLegends();
01840
01841
01842
01843
01844
01845 bool addLegend(string leg);
01846
01847 set<string> theLegends;
01848 XeGraph* referenceGraph;
01849 vector<double> Vx;
01850 vector<double> Vz;
01851
01852 ClassDef(XeMultiGraph,1)
01853 } ;
01854
01855
01856
01857
01858
01859
01860 class S1S2Display : virtual public XeGraphics {
01861
01862 public :
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874 static void setMode(int mode);
01875
01876
01877
01878
01879
01880
01881
01882
01883 static void setLimits(double xmi,double xma,double ymi,double yma);
01884
01885
01886
01887
01888 static void setTheDefaultLimits();
01889
01890
01891
01892
01893
01894
01895
01896 static void openCanvas(int nx=1, int ny=1,bool square=false);
01897
01898
01899
01900
01901
01902 static void drawFrame(string title);
01903
01904
01905
01906
01907
01908
01909
01910
01911 static void drawFrameZ( string title,double zmin,double zmax
01912 , int zScale=LINEAR);
01913
01914
01915
01916
01917
01918 static bool areCutsHatched();
01919 static bool checkFull();
01920 static bool isFullyDefined();
01921 static bool isModeDefined();
01922 static double getXmax();
01923 static double getXmin();
01924 static double getY(double x,double y);
01925 static double getYmax();
01926 static double getYmin();
01927 static double undoY(double x,double y);
01928 static int getDefaultLogMode(int m=CURRENT_DISPLAY);
01929 static int getMode(int m=CURRENT_DISPLAY);
01930 static string getCanvasName();
01931 static string getName();
01932 static string getXLabel();
01933 static string getYLabel();
01934 static void hatchTheCuts(bool h=true);
01935 static void setNBands(int nb);
01936 static void setNSlices(int ns);
01937 static void setXmax(double xma);
01938 static void setXmin(double xmi);
01939 static void setYmax(double yma);
01940 static void setYmin(double ymi);
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952
01953 static void drawBox(double x0,double x1,double y0,double y1
01954 ,int color, bool ratio=false);
01955
01956
01957 S1S2Display();
01958 ~S1S2Display();
01959
01960 static bool requiresComputation(int m=CURRENT_DISPLAY);
01961 static void setCurrentFlattener(Flattener* flatten);
01962 static Flattener* getCurrentFlattener();
01963
01964 protected :
01965
01966 static int displayMode;
01967 static int nBands;
01968 static int nSlices;
01969 static bool cutsAreHatched;
01970 static double xmin;
01971 static double xmax;
01972 static double ymin;
01973 static double ymax;
01974 static Flattener* currentFlattener;
01975
01976 };
01977
01978
01979
01980
01981
01982
01983 class S1S2Object : virtual public XeGraphics, virtual public XeObject {
01984
01985 public :
01986
01987
01988
01989
01990
01991
01992
01993 virtual bool isDrawable(int mode);
01994
01995
01996
01997
01998 S1S2Object();
01999
02000
02001
02002
02003
02004 S1S2Object(string name);
02005 virtual ~S1S2Object();
02006
02007
02008
02009
02010 virtual void draw()=0;
02011
02012
02013
02014
02015 virtual double minX()=0;
02016
02017
02018
02019
02020 virtual double minY()=0;
02021
02022
02023
02024
02025 virtual double maxX()=0;
02026
02027
02028
02029
02030 virtual double maxY()=0;
02031
02032
02033
02034
02035 virtual void setAutomaticLimits(bool automatic=true);
02036
02037
02038
02039
02040 virtual void drawTheFrame();
02041
02042
02043
02044
02045 void drawFrame();
02046
02047
02048
02049
02050
02051
02052
02053 void drawFrameWithZ(double zmin, double zmax, int zscale);
02054
02055
02056
02057
02058
02059
02060 void setS1S2Mode(int mode);
02061
02062
02063
02064
02065
02066 int getS1S2Mode();
02067
02068
02069
02070
02071
02072
02073
02074
02075 void drawS1S2(int mode=CURRENT_DISPLAY,bool same=false);
02076
02077 protected :
02078
02079 bool automaticLimits;
02080
02081 };
02082
02083
02084 #endif
02085