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

/Go4ConditionsBase/TGo4Condition.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 "TGo4Condition.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "TVirtualPad.h"
00021 
00022 #include "Go4Log/TGo4Log.h"
00023 #include "TGo4ConditionPainter.h"
00024 
00025 const Double_t TGo4Condition::fgdUPDATEEPSILON=0.01;
00026 
00027 Bool_t TGo4Condition::fgbLABELDRAW=kTRUE;
00028 Bool_t TGo4Condition::fgbLIMITSDRAW=kTRUE;
00029 Bool_t TGo4Condition::fgbINTDRAW=kTRUE;
00030 Bool_t TGo4Condition::fgbXMEANDRAW=kTRUE;
00031 Bool_t TGo4Condition::fgbXRMSDRAW=kTRUE;
00032 Bool_t TGo4Condition::fgbYMEANDRAW=kFALSE;
00033 Bool_t TGo4Condition::fgbYRMSDRAW=kFALSE;
00034 Bool_t TGo4Condition::fgbXMAXDRAW=kTRUE;
00035 Bool_t TGo4Condition::fgbYMAXDRAW=kFALSE;
00036 Bool_t TGo4Condition::fgbCMAXDRAW=kTRUE;
00037 
00038 
00039 // -----------------------------------------------
00040 // Constructors
00041 // -----------------------------------------------
00042 TGo4Condition::TGo4Condition(const char* name, const char* title)
00043 : TNamed(name, title), TAttLine(), TAttFill()
00044 {
00045   TRACE((15,"TGo4Condition::TGo4Condition(Text_t*)",__LINE__, __FILE__));
00046    fiDim=0;
00047    fbEnabled = false;
00048    fbResult  = true;
00049    fbTrue    = true;
00050    fbFalse   = false;
00051    fbMarkReset   = false;
00052    fiCounts  = 0;
00053    fiTrueCounts = 0;
00054    fxNextCondition =0;
00055    fbVisible=true;
00056    fbMultiEdit= true;
00057    fbHistogramLink=false;
00058    fxPainter=0;
00059    fdUpdateEpsilon=fgdUPDATEEPSILON;
00060    fbIsChanged=kFALSE;
00061    fbIsPainted=kFALSE;
00062    fbOwnedByEditor=kFALSE;
00063    fxHisto=0;
00064    fxDrawPad=0;
00065    fbStreamedCondition=kFALSE;
00066    fxCutHis=0;
00067    InitLabelStyle();
00068 }
00069 // ---------------------------------------------------------
00070 TGo4Condition::TGo4Condition(const char* name)
00071 : TNamed(name, "Go4 Condition"), TAttLine(), TAttFill()
00072 {
00073 TRACE((15,"TGo4Condition::TGo4Condition(Text_t*)",__LINE__, __FILE__));
00074    fiDim=0;
00075    fbEnabled = false;
00076    fbResult  = true;
00077    fbTrue    = true;
00078    fbFalse   = false;
00079    fbMarkReset   = false;
00080    fiCounts  = 0;
00081    fiTrueCounts= 0;
00082    fxNextCondition =0;
00083    fbVisible=true;
00084    fbMultiEdit= true;
00085    fbHistogramLink=false;
00086    fxPainter=0;
00087    fdUpdateEpsilon=fgdUPDATEEPSILON;
00088    fbIsChanged=kFALSE;
00089    fbIsPainted=kFALSE;
00090    fbOwnedByEditor=kFALSE;
00091    fxHisto=0;
00092    fxDrawPad=0;
00093    fbStreamedCondition=kFALSE;
00094    fxCutHis=0;
00095    InitLabelStyle();
00096 }
00097 // ---------------------------------------------------------
00098 TGo4Condition::TGo4Condition()
00099 : TNamed(), TAttLine(), TAttFill()
00100 {
00101 TRACE((15,"TGo4Condition::TGo4Condition()",__LINE__, __FILE__));
00102    fiDim=0;
00103    fbEnabled = false;
00104    fbResult  = true;
00105    fbTrue    = true;
00106    fbFalse   = false;
00107    fbMarkReset   = false;
00108    fiCounts  = 0;
00109    fiTrueCounts= 0;
00110    fxNextCondition =0;
00111    fbVisible=true;
00112    fbMultiEdit= true;
00113    fbHistogramLink=false;
00114    fxPainter=0;
00115    fdUpdateEpsilon=fgdUPDATEEPSILON;
00116    fbIsChanged=kFALSE;
00117    fbIsPainted=kFALSE;
00118    fbOwnedByEditor=kFALSE;
00119    fxHisto=0;
00120    fxDrawPad=0;
00121    fbStreamedCondition=kTRUE;
00122    fxCutHis=0;
00123    InitLabelStyle();
00124 }
00125 // ---------------------------------------------------------
00126 TGo4Condition::~TGo4Condition()
00127 {
00128 TRACE((15,"TGo4Condition::~TGo4Condition()",__LINE__, __FILE__));
00129 UnDraw();
00130 if(fxPainter) delete fxPainter;
00131 if(fxCutHis) delete fxCutHis;
00132 }
00133 // ---------------------------------------------------------
00134 Bool_t TGo4Condition::Test()
00135 {
00136    fiCounts++;
00137    return true;
00138 }
00139 // ---------------------------------------------------------
00140 void TGo4Condition::SetValues(){}
00141 // ---------------------------------------------------------
00142 void TGo4Condition::AddCondition(TGo4Condition* next)
00143 {
00144 TRACE((14,"TGo4Condition::AddCondition(TGo4Condition*)",__LINE__, __FILE__));
00145 }
00146 // ---------------------------------------------------------
00147 void TGo4Condition::IncTrueCounts()
00148 {
00149 TRACE((12,"TGo4Condition::IncTrueCounts()",__LINE__, __FILE__));
00150    fiTrueCounts++;
00151 }
00152 // ---------------------------------------------------------
00153 void TGo4Condition::IncCounts()
00154 {
00155 TRACE((12,"TGo4Condition::IncCounts()",__LINE__, __FILE__));
00156    fiCounts++;
00157 }
00158 // ---------------------------------------------------------
00159 Int_t TGo4Condition::Counts()
00160 {
00161 TRACE((12,"TGo4Condition::Counts()",__LINE__, __FILE__));
00162    return fiCounts;
00163 }
00164 // ---------------------------------------------------------
00165 Int_t TGo4Condition::TrueCounts()
00166 {
00167 TRACE((12,"TGo4Condition::TrueCounts()",__LINE__, __FILE__));
00168    return fiTrueCounts;
00169 }
00170 // ---------------------------------------------------------
00171 void TGo4Condition::ResetCounts()
00172 {
00173 TRACE((12,"TGo4Condition::ResetCounts()",__LINE__, __FILE__));
00174    fiTrueCounts=0;
00175    fiCounts=0;
00176 }
00177 // ---------------------------------------------------------
00178 void TGo4Condition::SetCounts(Int_t truecounts, Int_t counts)
00179 {
00180 TRACE((12,"TGo4Condition::SetCounts()",__LINE__, __FILE__));
00181    fiTrueCounts=truecounts;
00182    fiCounts=counts;
00183 }
00184 
00185 
00186 // ---------------------------------------------------------
00187 Int_t TGo4Condition::IsEnabled()
00188 {
00189 TRACE((12,"TGo4Condition::IsEnabled()",__LINE__, __FILE__));
00190    return fbEnabled;
00191 }
00192 // ---------------------------------------------------------
00193 void TGo4Condition::Invert(Bool_t on){
00194 TRACE((12,"TGo4Condition::Invert",__LINE__, __FILE__));
00195 fbTrue  = on ^ true;
00196 fbFalse = on ^ false;
00197 }
00198 
00199 // ---------------------------------------------------------
00200 void TGo4Condition::PrintCondition(Bool_t full){
00201 Float_t perc;
00202 Text_t line[128];
00203 Text_t num[64];
00204 if(fiCounts==0)perc=0.0;
00205 else perc=100.0/fiCounts*fiTrueCounts;
00206 cout << "Name:" << GetName()
00207      << " type:" << ClassName()
00208      << " title:" << GetTitle() << endl;
00209 if(fbHistogramLink)
00210 cout << "Connected to histogram " << fxHistoName << endl;
00211 if(fbEnabled)  strcpy(line,"Is Checked   ");
00212 else{
00213   if(fbResult) strcpy(line,"Always True  ");
00214   else         strcpy(line,"Always False ");
00215 }
00216 if(fbTrue) strcat(line,"normal  ");
00217 else       strcat(line,"inverse ");
00218 snprintf(num,63,", tested: %8d true: %8d is %3.0f%%",fiCounts,fiTrueCounts,perc);
00219 strcat(line,num);
00220 cout << line     << endl;
00221 }
00222 // ---------------------------------------------------------
00223 void TGo4Condition::PrintBar(){
00224 Float_t perc;
00225 Text_t line[128];
00226 Text_t num[64];
00227 strcpy(num,"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
00228 Char_t *pc;
00229 if(fiCounts==0) perc=0.0;
00230 else            perc=100.0/fiCounts*fiTrueCounts;
00231 pc=num + (Int_t)perc/2;
00232 *pc=0;
00233 snprintf(line,127,"%-24s %8d %3.0f%% |%-50s|",GetName(),fiCounts,perc,num);
00234 *pc='+';
00235 cout << line     << endl;
00236 }
00237 // -----------------------------------------------
00238 void TGo4Condition::Print(Option_t* opt) const{
00239    //cout <<"MyPrint:"<<GetName() << endl;
00240 TGo4Condition* localthis=const_cast<TGo4Condition*>(this);
00241 TString option=opt;
00242 option.ToLower();
00243 if(option.IsNull() || option=="*")
00244    {
00245        // old default: we print bar graphics to cout
00246       localthis->PrintBar();
00247    }
00248 else
00249    {
00250       // new printout of condition with different options:
00251    TString textbuffer="\nCondition ";
00252    textbuffer+=localthis->GetName();
00253    if(localthis->IsPolygonType())
00254       {
00255          textbuffer+=" (Polygon type, 2-dim)";
00256       }
00257    else
00258       {
00259          textbuffer+=" (Window type,";
00260          if(localthis->GetActiveCondition()->GetDimension()>1)
00261             textbuffer+=" 2-dim)";
00262          else
00263             textbuffer+=" 1-dim)";
00264       }
00265 
00266 
00267    //textbuffer+="\n";
00268    if(option.Contains("limits"))
00269       {
00270          Text_t buffer[256];
00271          snprintf(buffer,256,
00272                "\n!  Xlow: \t\tXup: \t\tYlow: \t\tYup:\n   %.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t",
00273                localthis->GetXLow(),localthis->GetXUp(),localthis->GetYLow(),localthis->GetYUp());
00274          textbuffer+=buffer;
00275 
00276       }
00277    if(option.Contains("flags"))
00278       {
00279           Text_t buffer[256];
00280           snprintf(buffer,256,
00281             "\n!  Status:\n!  Enab.: \tVis.: \tRes.: \tTrue: \tCnts: \tTrueCnts:\n   %d\t\t%d\t%d\t%d\t%d\t%d",
00282              localthis->fbEnabled, localthis->IsVisible(), localthis->fbResult, localthis->fbTrue,
00283              localthis->Counts(), localthis->TrueCounts());
00284           textbuffer+=buffer;
00285       }
00286    if(option.Contains("stats"))
00287       {
00288          // output of region statistics
00289 
00290          textbuffer+="\n!  with";
00291          TH1* hist=localthis->GetWorkHistogram();
00292          if(hist)
00293             {
00294                textbuffer+=" histogram: ";
00295                textbuffer+=hist->GetName();
00296                Text_t buffer[256];
00297                snprintf(buffer,256,
00298                "\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",
00299                localthis->GetIntegral(hist), localthis->GetXMax(hist),localthis->GetYMax(hist), localthis->GetCMax(hist),
00300                localthis->GetMean(hist,1), localthis->GetMean(hist,2), localthis->GetRMS(hist,1), localthis->GetRMS(hist,2));
00301                textbuffer+=buffer;
00302             }
00303          else
00304             {
00305                textbuffer+="out histogram";
00306             }
00307       }
00308    // now check output mode:
00309    if(option.Contains("go4log"))
00310       {
00311          TGo4Log::Message(1,textbuffer.Data());
00312       }
00313    else
00314       {
00315          cout << textbuffer.Data() << endl;
00316       }
00317    } //if(option.IsNull())
00318 }
00319 // ---------------------------------------------------------
00320 Bool_t TGo4Condition::UpdateFrom(TGo4Condition * cond, Bool_t counts){
00321     fbTrue    = cond->TGo4Condition::IsTrue();
00322     fbFalse   = cond->TGo4Condition::IsFalse();
00323     fbResult  = cond->TGo4Condition::FixedResult();
00324     fbEnabled = cond->TGo4Condition::IsEnabled();
00325     fbMarkReset = cond->fbMarkReset;
00326     fbVisible=cond->TGo4Condition::IsVisible();
00327     fbLabelDraw=cond->TGo4Condition::IsLabelDraw();
00328     fbMultiEdit=cond->TGo4Condition::IsMultiEdit();
00329     fbIntDraw= cond->TGo4Condition::IsIntDraw();
00330     fbXMeanDraw= cond->TGo4Condition::IsXMeanDraw();
00331     fbXRMSDraw= cond->TGo4Condition::IsXRMSDraw();
00332     fbYMeanDraw= cond->TGo4Condition::IsYMeanDraw();
00333     fbYRMSDraw= cond->TGo4Condition::IsYRMSDraw();
00334     fbXMaxDraw= cond->TGo4Condition::IsXMaxDraw();
00335     fbYMaxDraw= cond->TGo4Condition::IsYMaxDraw();
00336     fbCMaxDraw= cond->TGo4Condition::IsCMaxDraw();
00337     fbHistogramLink=cond->TGo4Condition::IsHistogramLink();
00338     fxHistoName=cond->fxHistoName;
00339     fdUpdateEpsilon= cond->fdUpdateEpsilon;
00340     fiDim=cond->GetDimension();
00341     if(counts){
00342       fiCounts = cond->TGo4Condition::Counts();
00343       fiTrueCounts = cond->TGo4Condition::TrueCounts();
00344       fbMarkReset = false;
00345     }
00346     if(fbMarkReset){
00347        ResetCounts();
00348        fbMarkReset = false;
00349     }
00350 
00351 return kTRUE;
00352 }
00353 
00354 void TGo4Condition::SetValues(Double_t low1, Double_t up1){ }
00355 void TGo4Condition::SetValues(Double_t low1, Double_t up1, Double_t low2, Double_t up2){ }
00356 void TGo4Condition::SetValues(TCutG * newcut){ }
00357 void TGo4Condition::SetValues(Double_t * x, Double_t * y, Int_t len){ }
00358 void TGo4Condition::GetValues(Int_t & dim, Double_t & xmin, Double_t & xmax, Double_t & ymin, Double_t & ymax)
00359 {
00360    xmin  = GetXLow();
00361    xmax  = GetXUp();
00362    ymin  = GetYLow();
00363    ymax  = GetYUp();
00364    dim = GetDimension();
00365 
00366 }
00367 Double_t TGo4Condition::GetXLow(){return 0;}
00368 Double_t TGo4Condition::GetXUp(){return 0;}
00369 Double_t TGo4Condition::GetYLow(){return 0;}
00370 Double_t TGo4Condition::GetYUp(){return 0;}
00371 Bool_t TGo4Condition::Test(Double_t x, Double_t y){ return true;}
00372 Bool_t TGo4Condition::Test(Double_t x){ return true;}
00373 Bool_t TGo4Condition::Test(Bool_t result){ return true;}
00374 TCutG* TGo4Condition::GetCut(Bool_t owner){ return 0;}
00375 Bool_t TGo4Condition::IsPolygonType(){return kFALSE;}
00376 Bool_t TGo4Condition::IsArrayType(){return kFALSE;}
00377 TGo4Condition* TGo4Condition::GetActiveCondition(){return this;}
00378 
00379 void TGo4Condition::SetCurrentIndex(Int_t) { }
00380 Int_t TGo4Condition::GetCurrentIndex(){ return 0; }
00381 Int_t TGo4Condition::GetNumberOfConditions(){return 1;}
00382 
00383 void TGo4Condition::MarkReset(Bool_t on)
00384 {
00385    fbMarkReset = on;
00386 }
00387 void TGo4Condition::Clear(Option_t* opt){
00388 ResetCounts();
00389 }
00390 
00391 void TGo4Condition::GetFlags(Bool_t* enabled, Bool_t* lastresult, Bool_t* markreset,
00392                    Bool_t* result, Bool_t* truevalue, Bool_t* falsevalue)
00393 {
00394   *enabled=fbEnabled;
00395   *lastresult=fbLastResult;
00396   *markreset=fbMarkReset;
00397   *result=fbResult;
00398   *truevalue=fbTrue;
00399   *falsevalue=fbFalse;
00400 }
00401 void TGo4Condition::SetFlags(Bool_t enabled, Bool_t lastresult, Bool_t markreset,
00402                    Bool_t result, Bool_t truevalue, Bool_t falsevalue)
00403 {
00404   fbEnabled=enabled;
00405   fbLastResult=lastresult;
00406   fbMarkReset=markreset;
00407   fbResult=result;
00408   fbTrue=truevalue;
00409   fbFalse=falsevalue;
00410 }
00411 
00412 
00413 
00414 Double_t TGo4Condition::GetIntegral(TH1* histo, Option_t* opt)
00415 {
00416    return 0;
00417 }
00418 
00419 Double_t TGo4Condition::GetMean(TH1* histo, Int_t axis)
00420 {
00421    return 0;
00422 }
00423 Double_t TGo4Condition::GetRMS(TH1* histo, Int_t axis)
00424 {
00425    return 0;
00426 }
00427 Double_t TGo4Condition::GetXMax(TH1* histo)
00428 {
00429    return 0;
00430 }
00431 Double_t TGo4Condition::GetYMax(TH1* histo)
00432 {
00433    return 0;
00434 }
00435 Double_t TGo4Condition::GetCMax(TH1* histo)
00436 {
00437    return 0;
00438 }
00439 
00440 void TGo4Condition::Disable(Bool_t result)
00441 {
00442   fbEnabled=kFALSE;
00443   fbResult=result;
00444 }
00445 
00446 void TGo4Condition::Enable()
00447 {
00448    fbEnabled=kTRUE;
00449 }
00450 
00451 
00452 void TGo4Condition::SetVisible(Bool_t on)
00453 {
00454    fbVisible=on;
00455 }
00456 
00457 Bool_t TGo4Condition::IsVisible()
00458 {
00459    return fbVisible;
00460 }
00461 
00462 void TGo4Condition::SetHistogramLink(Bool_t on)
00463 {
00464   fbHistogramLink=on;
00465 }
00466 
00467 Bool_t TGo4Condition::IsHistogramLink()
00468 {
00469    return (Bool_t) fbHistogramLink;
00470 }
00471 
00472 void TGo4Condition::SetLabelDraw(Bool_t on)
00473 {
00474 fbLabelDraw=on;
00475 }
00476 
00477 Bool_t TGo4Condition::IsLabelDraw()
00478 {
00479 return fbLabelDraw;
00480 }
00481 
00482 void TGo4Condition::SetLimitsDraw(Bool_t on)
00483 {
00484 fbLimitsDraw=on;
00485 }
00486 
00487 Bool_t TGo4Condition::IsLimitsDraw()
00488 {
00489 return fbLimitsDraw;
00490 }
00491 
00492 void TGo4Condition::SetIntDraw(Bool_t on)
00493 {
00494 fbIntDraw=on;
00495 }
00496 Bool_t TGo4Condition::IsIntDraw()
00497 {
00498 return fbIntDraw;
00499 }
00500 void TGo4Condition::SetXMeanDraw(Bool_t on)
00501 {
00502 fbXMeanDraw=on;
00503 }
00504 Bool_t TGo4Condition::IsXMeanDraw()
00505 {
00506 return fbXMeanDraw;
00507 }
00508 void TGo4Condition::SetXRMSDraw(Bool_t on)
00509 {
00510 fbXRMSDraw=on;
00511 }
00512 Bool_t TGo4Condition::IsXRMSDraw()
00513 {
00514 return fbXRMSDraw;
00515 }
00516 void TGo4Condition::SetYMeanDraw(Bool_t on)
00517 {
00518 fbYMeanDraw=on;
00519 }
00520 Bool_t TGo4Condition::IsYMeanDraw()
00521 {
00522 return fbYMeanDraw;
00523 }
00524 void TGo4Condition::SetYRMSDraw(Bool_t on)
00525 {
00526 fbYRMSDraw=on;
00527 }
00528 Bool_t TGo4Condition::IsYRMSDraw()
00529 {
00530 return fbYRMSDraw;
00531 }
00532 void TGo4Condition::SetXMaxDraw(Bool_t on)
00533 {
00534 fbXMaxDraw=on;
00535 }
00536 Bool_t TGo4Condition::IsXMaxDraw()
00537 {
00538 return fbXMaxDraw;
00539 }
00540 void TGo4Condition::SetYMaxDraw(Bool_t on)
00541 {
00542 fbYMaxDraw=on;
00543 }
00544 Bool_t TGo4Condition::IsYMaxDraw()
00545 {
00546 return fbYMaxDraw;
00547 }
00548 void TGo4Condition::SetCMaxDraw(Bool_t on)
00549 {
00550 fbCMaxDraw=on;
00551 }
00552 Bool_t TGo4Condition::IsCMaxDraw()
00553 {
00554 return fbCMaxDraw;
00555 }
00556 
00557 void TGo4Condition::SetHistogram(const char* name)
00558 {
00559   fxHistoName=name;
00560   fbHistogramLink=true;
00561 }
00562 
00563 const Text_t* TGo4Condition::GetLinkedHistogram()
00564 {
00565 return fxHistoName.Data();
00566 }
00567 
00568 void TGo4Condition::SetPainter(TGo4ConditionPainter*)
00569 {
00570 // delete old painter, replace by the new one
00571 // overwritten method in subclass may check if painter is correct type
00572 
00573 }
00574 
00575 
00576 void TGo4Condition::Paint(Option_t* opt)
00577 {
00579 if(fbStreamedCondition)
00580    {
00581         SetDrawPad(gPad);
00582         SetPainted(kTRUE);
00583         fbStreamedCondition=kFALSE;
00584    }
00585 if(!IsPainted() || GetDrawPad()!=gPad) return;
00586 if(!CheckWorkHistogram()) SetPadHistogram(gPad);
00587 if(fxPainter==0) fxPainter=CreatePainter();
00588 // condition subclass may not provide a real painter, then we skip painting:
00589 if(fxPainter!=0)
00590    {
00591       fxPainter->PaintCondition(opt);
00592       fxPainter->PaintLabel(opt);
00593    }
00594 }
00595 
00596 void TGo4Condition::Draw(Option_t* opt)
00597 {
00598    if(TGo4Condition::IsVisible())
00599       {
00600          if(gPad && gPad->GetListOfPrimitives()->FindObject(this)==0)
00601             {
00602                AppendPad(opt);
00603             }
00604          SetPainted(kTRUE);
00605          SetDrawPad(gPad);
00606       }
00607    else
00608       {
00609          UnDraw(opt);
00610       }
00611 }
00612 
00613 void TGo4Condition::UnDraw(Option_t* opt)
00614 {
00615 SetPainted(kFALSE);
00616 SetDrawPad(0);
00617 if(gPad!=0)
00618 {
00619    gPad->GetListOfPrimitives()->Remove(this);
00620    //gPad->Modified(kTRUE);
00621 }
00622 if(fxPainter==0) fxPainter=CreatePainter();
00623 // condition subclass may not provide a real painter, then we skip unpainting:
00624 if(fxPainter!=0)
00625    {
00626       fxPainter->UnPaintCondition(opt);
00627       //if(strcmp(opt,"keeplabel"))
00628          fxPainter->UnPaintLabel();
00629    }
00630 }
00631 
00632 TGo4ConditionPainter* TGo4Condition::CreatePainter()
00633 {
00634    return 0;
00635 }
00636 
00637 Bool_t TGo4Condition::IsChanged()
00638 {
00639    // not inline, because reimplementation necessary for condarray
00640    return fbIsChanged;
00641 }
00642 
00643 void TGo4Condition::SaveLabelStyle()
00644 {
00645 TGo4Condition::fgbLABELDRAW=fbLabelDraw;
00646 TGo4Condition::fgbLIMITSDRAW=fbLimitsDraw;
00647 TGo4Condition::fgbINTDRAW=fbIntDraw;
00648 TGo4Condition::fgbXMEANDRAW=fbXMeanDraw;
00649 TGo4Condition::fgbXRMSDRAW=fbXRMSDraw;
00650 TGo4Condition::fgbYMEANDRAW=fbYMeanDraw;
00651 TGo4Condition::fgbYRMSDRAW=fbYRMSDraw;
00652 TGo4Condition::fgbXMAXDRAW=fbXMaxDraw;
00653 TGo4Condition::fgbYMAXDRAW=fbYMaxDraw;
00654 TGo4Condition::fgbCMAXDRAW=fbCMaxDraw;
00655 
00656 
00657 }
00658 
00659 void TGo4Condition::InitLabelStyle()
00660 {
00661 fbLabelDraw=TGo4Condition::fgbLABELDRAW;
00662 fbLimitsDraw=TGo4Condition::fgbLIMITSDRAW;
00663 fbIntDraw=TGo4Condition::fgbINTDRAW;
00664 fbXMeanDraw=TGo4Condition::fgbXMEANDRAW;
00665 fbXRMSDraw=TGo4Condition::fgbXRMSDRAW;
00666 fbYMeanDraw=TGo4Condition::fgbYMEANDRAW;
00667 fbYRMSDraw=TGo4Condition::fgbYRMSDRAW;
00668 fbXMaxDraw=TGo4Condition::fgbXMAXDRAW;
00669 fbYMaxDraw=TGo4Condition::fgbYMAXDRAW;
00670 fbCMaxDraw=TGo4Condition::fgbCMAXDRAW;
00671 }
00672 
00673 void TGo4Condition::ResetLabel()
00674 {
00675 if(fxPainter)
00676    {
00677       fxPainter->UnPaintLabel("reset");
00678       fxPainter->PaintLabel();
00679    }
00680 }
00681 
00682 void TGo4Condition::SetWorkHistogram(TH1* histo)
00683 {
00684    TH1* oldhis=fxHisto;
00685    if(oldhis) gROOT->GetListOfCleanups()->Remove(oldhis);
00686    fxHisto=histo;
00687    if(fxHisto) gROOT->GetListOfCleanups()->Add(fxHisto);
00688    delete fxCutHis; // discard internal cut histogram
00689    fxCutHis=0;
00690 }
00691 
00692 Bool_t TGo4Condition::CheckWorkHistogram()
00693 {
00694 if(fxHisto && gROOT->GetListOfCleanups()->FindObject(fxHisto))
00695    {
00696       return kTRUE;
00697    }
00698 else
00699    {
00700       fxHisto=0;
00701       delete fxCutHis; // reset cut histogram
00702       fxCutHis=0;
00703       return kFALSE;
00704    }
00705 
00706 }
00707 
00708 void TGo4Condition::SetPadHistogram(TVirtualPad* pad)
00709 {
00710    if(pad==0) return;
00711    TIter iter(pad->GetListOfPrimitives());
00712    TObject* entry=0;
00713    while((entry=iter()) !=0)
00714       if (entry->InheritsFrom(TH1::Class())) {
00715         SetWorkHistogram(dynamic_cast<TH1*> (entry));
00716         break;
00717      }
00718 }
00719 
00720 
00721 // ---------------------------------------------------------
00722 
00723 ClassImp(TGo4Condition)
00724 
00725 //----------------------------END OF GO4 SOURCE FILE ---------------------

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