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

/Go4GUI/TGo4WindowEditStatus.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 "TGo4WindowEditStatus.h"
00017 
00018 #include "Go4LockGuard/TGo4LockGuard.h"
00019 #include "Go4Log/TGo4Log.h"
00020 #include "Go4ConditionsBase/TGo4Condition.h"
00021 
00022 #include "TGo4WindowEditSlots.h"
00023 
00024 
00025 TGo4WindowEditStatus::TGo4WindowEditStatus(const char* name, const char* title)
00026     :TGo4Status(name,title), fxCondition(0), fbCentralMode(kFALSE)
00027 
00028 {
00029    //fxCondition=new TGo4Condition("dummy"); // dummy for central mode
00030 }
00031 
00032 TGo4WindowEditStatus::~TGo4WindowEditStatus()
00033 {
00034    TGo4LockGuard Global;
00035    delete fxCondition;
00036 }
00037 
00038 
00039 
00040 void TGo4WindowEditStatus::SetCondition(TGo4Condition *con)
00041 {
00042    TGo4LockGuard Global;
00043    Bool_t multiedit=kTRUE;
00044    if(fxCondition)
00045       {
00046          multiedit=fxCondition->IsMultiEdit();
00047          delete fxCondition;
00048 
00049       }
00050   fxCondition= con;
00051   if(fxCondition)
00052    {
00053       fxCondition->SetOwnedByEditor(kTRUE); // prevent interactive deletion from rmb menu
00054       fxCondition->SetMultiEdit(multiedit); // preserve previous mode of editor
00055       // eval properties of condition;
00056       // -------array mode?
00057       if(fxCondition->IsArrayType())
00058          {
00059             // suppress the drawing of labels for overall statistics
00060             // (only labels for array elements supported in editor):
00061             fxCondition->TGo4Condition::SetIntDraw(kFALSE);
00062             fxCondition->TGo4Condition::SetXMeanDraw(kFALSE);
00063             fxCondition->TGo4Condition::SetXRMSDraw(kFALSE);
00064             fxCondition->TGo4Condition::SetYMeanDraw(kFALSE);
00065             fxCondition->TGo4Condition::SetYRMSDraw(kFALSE);
00066             fxCondition->TGo4Condition::SetXMaxDraw(kFALSE);
00067             fxCondition->TGo4Condition::SetYMaxDraw(kFALSE);
00068             fxCondition->TGo4Condition::SetCMaxDraw(kFALSE);
00069          }
00070       else{ }
00071    }
00072 
00073 
00074 }
00075 
00076 
00077 void TGo4WindowEditStatus::SetSlot(TGo4WindowEditSlots* myslot)
00078 {
00079    fxSlots=myslot;
00080 }
00081 
00082 
00083 
00084 Int_t TGo4WindowEditStatus::GetNumberOfConditions()
00085 {
00086 if(fxCondition) return (fxCondition->GetNumberOfConditions());
00087 return 1;
00088 }
00089 
00090 Double_t TGo4WindowEditStatus::Xmin()
00091 {
00092 if(fxCondition) return fxCondition->GetXLow();
00093 return -1;
00094 }
00095 
00096 Double_t TGo4WindowEditStatus::Xmax()
00097 {
00098 if(fxCondition) return fxCondition->GetXUp();
00099 return -1;
00100 }
00101 
00102 Double_t TGo4WindowEditStatus::Ymin()
00103 {
00104 if(fxCondition) return fxCondition->GetYLow();
00105 return -1;
00106 }
00107 
00108 Double_t TGo4WindowEditStatus::Ymax()
00109 {
00110 if(fxCondition) return fxCondition->GetYUp();
00111 return -1;
00112 }
00113 
00114 Bool_t TGo4WindowEditStatus::IsEnabled()
00115 {
00116 Bool_t enabled=kFALSE;
00117 Bool_t lastresult=kFALSE;
00118 Bool_t markreset=kFALSE;
00119 Bool_t result=kFALSE;
00120 Bool_t truevalue=kFALSE;
00121 Bool_t falsevalue=kFALSE;
00122 if(fxCondition)
00123    fxCondition->GetFlags(&enabled, &lastresult, &markreset, &result, &truevalue, &falsevalue);
00124 return enabled;
00125 }
00126 
00127 Bool_t TGo4WindowEditStatus::TrueValue()
00128 {
00129 Bool_t enabled=kFALSE;
00130 Bool_t lastresult=kFALSE;
00131 Bool_t markreset=kFALSE;
00132 Bool_t result=kFALSE;
00133 Bool_t truevalue=kFALSE;
00134 Bool_t falsevalue=kFALSE;
00135 if(fxCondition)
00136    fxCondition->GetFlags(&enabled, &lastresult, &markreset, &result, &truevalue, &falsevalue);
00137 return truevalue;
00138 }
00139 
00140 Bool_t TGo4WindowEditStatus::FalseValue()
00141 {
00142 Bool_t enabled=kFALSE;
00143 Bool_t lastresult=kFALSE;
00144 Bool_t markreset=kFALSE;
00145 Bool_t result=kFALSE;
00146 Bool_t truevalue=kFALSE;
00147 Bool_t falsevalue=kFALSE;
00148 if(fxCondition)
00149    fxCondition->GetFlags(&enabled, &lastresult, &markreset, &result, &truevalue, &falsevalue);
00150 return falsevalue;
00151 }
00152 
00153 Bool_t TGo4WindowEditStatus::ResultValue()
00154 {
00155 Bool_t enabled=kFALSE;
00156 Bool_t lastresult=kFALSE;
00157 Bool_t markreset=kFALSE;
00158 Bool_t result=kFALSE;
00159 Bool_t truevalue=kFALSE;
00160 Bool_t falsevalue=kFALSE;
00161 if(fxCondition)
00162    fxCondition->GetFlags(&enabled, &lastresult, &markreset, &result, &truevalue, &falsevalue);
00163 return result;
00164 
00165 }
00166 
00167 Int_t TGo4WindowEditStatus::Counts()
00168 {
00169 if(fxCondition) return fxCondition->Counts();
00170 return 0;
00171 }
00172 
00173 Int_t TGo4WindowEditStatus::TrueCounts()
00174 {
00175 if(fxCondition) return fxCondition->TrueCounts();
00176 return 0;
00177 }
00178 
00179 const Text_t* TGo4WindowEditStatus::ConditionName()
00180 {
00181 TGo4Condition* condi=0;
00182 if(fxCondition) condi=fxCondition->GetActiveCondition();
00183 if(condi) return condi->GetName();
00184 return 0;
00185 }
00186 
00187 Bool_t TGo4WindowEditStatus::IsVisible()
00188 {
00189 if(fxCondition) return (fxCondition->IsVisible());
00190 return kFALSE;
00191 }
00192 
00193 void TGo4WindowEditStatus::SetCurrentIndex(Int_t ix)
00194 {
00195 if(fxCondition) fxCondition->SetCurrentIndex(ix);
00196 }
00197 
00198 Int_t TGo4WindowEditStatus::GetCurrentIndex()
00199 {
00200 if(fxCondition) return (fxCondition->GetCurrentIndex());
00201 return 0;
00202 }
00203 
00204 Bool_t TGo4WindowEditStatus::IsMultiEdit()
00205 {
00206 if(fxCondition) return (fxCondition->IsMultiEdit());
00207 return kFALSE;
00208 }
00209 
00210 void TGo4WindowEditStatus::SetMultiEdit(Bool_t on)
00211 {
00212 if(fxCondition)
00213    {
00214       if(!on && fxCondition->IsArrayType())
00215             fxCondition->TGo4Condition::SetVisible(kTRUE); // ensure visibility of array entries in single mode
00216       fxCondition->SetMultiEdit(on);
00217 
00218    }
00219 }
00220 
00221 Bool_t TGo4WindowEditStatus::IsPolygon()
00222 {
00223 if(fxCondition) return (fxCondition->GetActiveCondition()->IsPolygonType());
00224 return kFALSE;
00225 }
00226 
00227 Bool_t TGo4WindowEditStatus::IsArray()
00228 {
00229 
00230 if(fxCondition) return (fxCondition->IsArrayType());
00231 return kFALSE;
00232 }
00233 
00234 Bool_t TGo4WindowEditStatus::Is2D()
00235 {
00236 if(fxCondition && fxCondition->GetActiveCondition()->GetDimension()>1)
00237    return kTRUE;
00238 return kFALSE;
00239 }
00240 
00241 
00242 void TGo4WindowEditStatus::Print(Option_t* opt)
00243 {
00244    Text_t option[64];
00245    Text_t textbuffer[1024];
00246    Text_t contype[64];
00247    Text_t condim[64];
00248    Int_t buflen=1024;
00249    Int_t size=0;
00250    Text_t* current=textbuffer;
00251    if(opt=="")
00252       snprintf(option,64,"%s","CSM");
00253    else
00254       snprintf(option,64,"%s",opt);
00255    Bool_t printcon=strstr(option,"C");
00256    Bool_t printstat=strstr(option,"S");
00257    //Bool_t printmark=strstr(option,"M");
00258    if(IsPolygon())
00259       snprintf(contype,64,"Polygon type");
00260    else
00261       snprintf(contype,64,"Window type");
00262    if(Is2D())
00263       snprintf(condim,64,"2-dim");
00264    else
00265       snprintf(condim,64,"1-dim");
00266 
00267    if(printcon)
00268    {
00269       size+=snprintf(current,buflen-size,
00270       "\n! Condition %s (%s %s) status:\n!  Enab.: \tVis.: \tRes.: \tTrue: \t\tCnts: \t\tTrueCnts:\n   %d\t\t%d\t\t%d\t\t%d\t\t%d\t\t%d\n!  Xlow: \t\tXup: \t\tYlow: \t\tYup:\n   %.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t"
00271       ,ConditionName(),
00272       contype,condim, IsEnabled(), IsVisible(), ResultValue(),TrueValue(),
00273       Counts(),TrueCounts(),Xmin(),Xmax(),Ymin(),Ymax());
00274    }
00275    current=textbuffer+size;
00276    if(printstat)
00277    {
00278       size+=snprintf(current,buflen-size,
00279       "\n! Condition %s statistics with histogram %s:\n!   Int:\t\tXmax:\t\tYmax:\t\tCmax:\t\tXmean:\t\tYmean:\t\tXrms:\t\tYrms:\n    %.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f",
00280       ConditionName(), fxSlots->GetHistogramName(),
00281       fxSlots->GetIntegral(), fxSlots->GetXMax(),fxSlots->GetYMax(), fxSlots->GetCMax(),
00282       fxSlots->GetMean(1), fxSlots->GetMean(2), fxSlots->GetRMS(1), fxSlots->GetRMS(2));
00283    }
00284   current=textbuffer+size;
00285 //  if(printmark)
00286 //   {
00287 //      size+=snprintf(current,buflen-size,
00288 //      "\n! Cursor values for histogram %s:\n!   X:  \t\tY:  \t\tXbin:\t\tYbin:\t\tCounts:\n    %.2f\t\t%.2f\t\t%d\t\t%d\t\t%d",
00289 //      fxSlots->GetHistogramName(),
00290 //      fxSlots->GetPickX(), fxSlots->GetPickY(), fxSlots->GetPickXBin(),fxSlots->GetPickYBin(),
00291 //      fxSlots->GetPickCounts());
00292 //      //TGo4Log::Message(1,textbuffer);
00293 //   }
00294 if(printcon || printstat)
00295    TGo4Log::Message(1,textbuffer);
00296 //if(printmark)
00297 //   fxSlots->PrintCursorList("go4log");
00298 }
00299 
00300 //----------------------------END OF GO4 SOURCE FILE ---------------------

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