Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4GUI/TGo4PadOptions.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4PadOptions.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "Go4ConditionsBase/TGo4Condition.h"
00021 
00022 TGo4PadOptions::TGo4PadOptions(TPad* Pad, const char * DrawOption, Bool_t DragAddOption)
00023         :TObject(),fxPad(Pad),fxDragAddOption(DragAddOption)
00024 {
00025 //   fxOption=new TString(DrawOption);
00026    HisDrawStyle=0;
00027     HisCoordStyle=0;
00028     HisXStyle=0;
00029     HisYStyle=0;
00030     HisZStyle=0;
00031     HisErrorStyle=0;
00032     fbHisStats=true;
00033     fbHisTitle=true;
00034     fbCrosshair=false;
00035     fbDrawLegend=true;
00036    fxFitOptions=0;
00037    fxCondition=0;
00038    fxLegend=0;
00039    fxAutoScale=true;
00040     fxUxmin=0;
00041     fxUxmax=1;
00042     fxUymin=0;
00043     fxUymax=1;
00044 
00045 }
00046 TGo4PadOptions::~TGo4PadOptions()
00047 {
00048    delete fxCondition;
00049 }
00050 
00051 void TGo4PadOptions::SetHistogramFullRange(Int_t Xmin, Int_t Xmax, Int_t Ymin, Int_t Ymax)
00052 {
00053    fYLastBin=Ymax;
00054     fYFirstBin=Ymin;
00055     fXLastBin=Xmax;
00056     fXFirstBin=Xmin;
00057 
00058 }
00059 void TGo4PadOptions::GetHistogramFullRange(Int_t &Xmin, Int_t &Xmax, Int_t &Ymin, Int_t &Ymax)
00060 {
00061    Ymax=fYLastBin;
00062     Ymin=fYFirstBin;
00063     Xmax=fXLastBin;
00064     Xmin=fXFirstBin;
00065 
00066 }
00067 
00068 void TGo4PadOptions::setHisDrawStyle(const char *DrawString)
00069 {
00070 Char_t *pc;
00071 // lower case
00072 pc=(Char_t *)DrawString;
00073 while(*pc!=0){if((*pc<91)&(*pc>64))*pc+=32;pc++;}
00074 
00075 // check for error options in string:
00076    if(strstr(DrawString,"e1")) HisErrorStyle=1;
00077    else if(strstr(DrawString,"e2")) HisErrorStyle=2;
00078    else if(strstr(DrawString,"e3")) HisErrorStyle=3;
00079    else if(strstr(DrawString,"e4")) HisErrorStyle=4;
00080    //else if(strstr(DrawString,"e")) HisErrorStyle=1; // missing: simple
00081    else HisErrorStyle=0;
00082    
00083    // check coordinate specs in string:
00084    if(strstr(DrawString,"pol"))  HisCoordStyle= 1;
00085    else if(strstr(DrawString,"sph"))  HisCoordStyle= 2;
00086    else if(strstr(DrawString,"cyl"))  HisCoordStyle= 3;
00087    // missing: "psr" (rapidity)
00088    else HisCoordStyle= 0;
00089 
00090 
00091    // check draw options itself:
00092    
00093         //if(strstr(DrawString,"hist"))  HisDrawStyle= 0; 
00094    if(strstr(DrawString,"lego1")) HisDrawStyle= 8;
00095    else if(strstr(DrawString,"lego2")) HisDrawStyle= 7;
00096    else if(strstr(DrawString,"lego3")) HisDrawStyle= 9;
00097    else if(strstr(DrawString,"lego")) HisDrawStyle= 9; // from gededitor   
00098    else if(strstr(DrawString,"surf1")) HisDrawStyle=10;
00099    else if(strstr(DrawString,"surf2")) HisDrawStyle= 3;
00100    else if(strstr(DrawString,"surf3")) HisDrawStyle=12;
00101    else if(strstr(DrawString,"surf4")) HisDrawStyle= 6;
00102    else if(strstr(DrawString,"surf"))  HisDrawStyle=11;   
00103    else if(strstr(DrawString,"cont0")) HisDrawStyle= 2;
00104    else if(strstr(DrawString,"cont1")) HisDrawStyle=13;
00105    else if(strstr(DrawString,"cont2")) HisDrawStyle=14;
00106    else if(strstr(DrawString,"cont3")) HisDrawStyle=15;
00107    else if(strstr(DrawString,"contz")) HisDrawStyle= 5;
00108    else if(strstr(DrawString,"cont"))  HisDrawStyle= 2;   
00109    else if(strstr(DrawString,"colz"))  HisDrawStyle= 4;
00110    else if(strstr(DrawString,"col"))   HisDrawStyle= 1;
00111    else if(strstr(DrawString,"box"))   HisDrawStyle=16;
00112    else if(strstr(DrawString,"text"))  HisDrawStyle=17;
00113    else if(strstr(DrawString,"asimage"))  HisDrawStyle=18;
00114    else if(strstr(DrawString,"p0"))  HisDrawStyle=19;
00115    //else if(strstr(DrawString,"p"))  HisDrawStyle=19; // missing
00116    else if(strstr(DrawString,"l") && HisCoordStyle!=1 && HisCoordStyle!=3)  HisDrawStyle=20;
00117    else if(strstr(DrawString,"c")&& HisCoordStyle!=3 && !strstr(DrawString,"nostack"))  HisDrawStyle=21;
00118    else if(strstr(DrawString,"b"))  HisDrawStyle=22;
00119    else HisDrawStyle= 0; // unknown option seen as default
00120    //cout <<"setHisDrawStyle sees string "<<DrawString<<" , set to "<<HisDrawStyle << endl;      
00121 }
00122 
00123 TString *TGo4PadOptions::GetStringDrawOption()
00124 {
00125    switch (HisDrawStyle) {
00126        case  0: fOption="hist";    break;
00127         case  8: fOption="lego1";   break;
00128         case  7: fOption="lego2";   break;
00129         case  9: fOption="lego3";   break;
00130       case 11: fOption="surf";   break;
00131         case 10: fOption="surf1";   break;
00132         case  3: fOption="surf2";   break;
00133         case 12: fOption="surf3";   break;
00134         case  6: fOption="surf4";   break;
00135         case  2: fOption="cont0";   break;
00136        case 13: fOption="cont1";   break;
00137         case 14: fOption="cont2";   break;
00138         case 15: fOption="cont3";   break;
00139         case  5: fOption="contz";   break;
00140         case  1: fOption="col";      break;
00141         case  4: fOption="colz";   break;
00142         case 16: fOption="box";      break;
00143         case 17: fOption="text";   break;
00144 #ifdef __GO4USEASIMAGE__
00145       case 18: fOption="asimage";   break;
00146 #else
00147       case 18: fOption="hist";   break; // need this to let histogram be drawn
00148 #endif
00149       case 19: fOption="p0";   break;
00150       case 20: fOption="l";   break;
00151       case 21: fOption="c";   break;
00152       case 22: fOption="b";   break;
00153      }
00154 
00155     switch (HisCoordStyle) {
00156        case 0:                   break;
00157         case 1:   fOption.Append(" ,pol");break;
00158         case 2:   fOption.Append(" ,sph");break;
00159         case 3:   fOption.Append(" ,cyl");break;
00160     }
00161 
00162      switch (HisErrorStyle) {
00163        case 0:                      break;
00164        case 1:   fOption.Append(" , E1");break;
00165         case 2:   fOption.Append(" , E2");break;
00166         case 3:   fOption.Append(" , E3");break;
00167         case 4:   fOption.Append(" , E4");break;
00168     }
00169 //cout << "GetStringDrawOption() has drawstyle "<<HisDrawStyle<< " converted to string "<<fOption<<endl;
00170 return &fOption;
00171 }
00172 
00173 void TGo4PadOptions::SetCondition(TGo4Condition* con)
00174 {
00175    if(fxCondition) delete fxCondition;
00176    fxCondition = (TGo4Condition*) con->Clone();
00177 
00178 }
00179 
00180 ClassImp(TGo4PadOptions)
00181 
00182 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:01 2005 for Go4-v2.10-5 by doxygen1.2.15