00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4CondArray.h"
00017
00018 #include <iostream.h>
00019
00020 #include "TGo4WinCond.h"
00021 #include "TGo4PolyCond.h"
00022 #include "TGo4CondArrayPainter.h"
00023 #include "Go4Log/TGo4Log.h"
00024
00025
00026 TGo4WinCond* TGo4CondArray::Win(Int_t i){
00027 if(fiType != kWINDOW) return 0;
00028 else return (TGo4WinCond*) At(i);
00029 }
00030
00031 TGo4PolyCond* TGo4CondArray::Poly(Int_t i){
00032 if(fiType != kPOLYGON) return 0;
00033 else return (TGo4PolyCond*) At(i);
00034 }
00035
00036 TGo4Condition * TGo4CondArray::operator[](Int_t i){
00037 return (TGo4Condition*) condarr->At(i);
00038 }
00039
00040 TGo4Condition * TGo4CondArray::At(Int_t i){
00041
00042 return (TGo4Condition*) condarr->At(i);
00043 }
00044
00045 TGo4CondArray::TGo4CondArray()
00046 : TGo4Condition(), condarr(0),fiNumCond(0),fiType(0),fiSelectedCond(0)
00047 {
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 }
00063
00064 TGo4CondArray::TGo4CondArray(const char* name, Int_t elements, Int_t contype)
00065 : TGo4Condition(name,"TGo4CondArray"), fiSelectedCond(0)
00066 {
00067 char x[128];
00068 fiNumCond = elements;
00069 if(contype == kWINDOW){
00070 condarr = new TObjArray(elements);
00071 fiType = contype;
00072 for(Int_t i = 0; i < elements; i++){
00073 snprintf(x,127,"%s%06d",name,i);
00074 condarr->AddLast(new TGo4WinCond(x));
00075 }}
00076 else if(contype == kPOLYGON){
00077 condarr = new TObjArray(elements);
00078 fiType = contype;
00079 for(Int_t i = 0; i < elements; i++){
00080 snprintf(x,127,"%s%06d",name,i);
00081 condarr->AddLast(new TGo4PolyCond(x));
00082 }}
00083 else{
00084 fiNumCond = 0;
00085 fiType = 0;
00086 }
00087 }
00088
00089 TGo4CondArray::TGo4CondArray(const char* name, Int_t elements, const char* type)
00090 : TGo4Condition(name,type),fiSelectedCond(0)
00091 {
00092 char x[128];
00093 fiNumCond = elements;
00094 if(strcmp(type,"TGo4WinCond")==0){
00095 condarr = new TObjArray(elements);
00096 fiType = kWINDOW;
00097 for(Int_t i = 0; i < elements; i++){
00098 snprintf(x,127,"%s%06d",name,i);
00099 condarr->AddLast(new TGo4WinCond(x));
00100 }}
00101 else if(strcmp(type,"TGo4PolyCond")==0){
00102 condarr = new TObjArray(elements);
00103 fiType = kPOLYGON;
00104 for(Int_t i = 0; i < elements; i++){
00105 snprintf(x,127,"%s%06d",name,i);
00106 condarr->AddLast(new TGo4PolyCond(x));
00107 }}
00108 else{
00109 fiNumCond = 0;
00110 fiType = 0;
00111 }
00112 }
00113
00114 TGo4CondArray::~TGo4CondArray()
00115 {
00116 if(fxPainter) delete fxPainter;
00117
00118
00119 fxPainter=0;
00120
00121 if (condarr!=0) {
00122 condarr->Delete();
00123 delete condarr;
00124 }
00125 }
00126
00127 Bool_t TGo4CondArray::IsArrayType(){return kTRUE;}
00128
00129
00130 void TGo4CondArray::GetValues(){}
00131
00132 Bool_t TGo4CondArray::Test(){
00133 return true;
00134 }
00135
00136 Bool_t TGo4CondArray::Test(Double_t x, Double_t y)
00137 {
00138 Bool_t rev=kTRUE;
00139 if(IsMultiEdit())
00140 {
00141 Int_t ii = condarr->GetLast()+1;
00142 for(Int_t i = 0; i < ii; i++)
00143 {
00144 IncCounts();
00145 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00146 Bool_t result=cond->Test(x,y);
00147 if(result) IncTrueCounts();
00148 rev&=result;
00149 }
00150 }
00151 else
00152 {
00153 TGo4Condition* conny=At(GetCurrentIndex());
00154 if(conny) rev=conny->Test(x,y);
00155 }
00156 return rev;
00157
00158 }
00159 Bool_t TGo4CondArray::Test(Double_t x)
00160 {
00161 Bool_t rev=kTRUE;
00162 if(IsMultiEdit())
00163 {
00164 Int_t ii = condarr->GetLast()+1;
00165 for(Int_t i = 0; i < ii; i++)
00166 {
00167 IncCounts();
00168 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00169 Bool_t result=cond->Test(x);
00170 if(result) IncTrueCounts();
00171 rev&=result;
00172 }
00173 }
00174 else
00175 {
00176 TGo4Condition* conny=At(GetCurrentIndex());
00177 if(conny) rev=conny->Test(x);
00178 }
00179 return rev;
00180 }
00181
00182
00183 void TGo4CondArray::SetValues(){}
00184
00185 void TGo4CondArray::PrintCondition(Bool_t points){
00186 TGo4Condition *cond;
00187 TGo4WinCond *pwc;
00188 TGo4PolyCond *ppc;
00189
00190 Int_t ii = condarr->GetLast()+1;
00191 cond= (TGo4Condition*) condarr->At(0);
00192 Bool_t wc = (strcmp(cond->ClassName(),"TGo4WinCond")==0);
00193 Bool_t pc = (strcmp(cond->ClassName(),"TGo4PolyCond")==0);
00194 cout << GetName() << " has " << ii << " " << cond->ClassName() << " conditions" << endl;
00195 for(Int_t i = 0; i < ii; i++)
00196 {
00197 cond=(TGo4Condition*) condarr->UncheckedAt(i);
00198 pwc = (TGo4WinCond*)cond;
00199 ppc = (TGo4PolyCond*)cond;
00200 if(wc)pwc->PrintCondition(points);
00201 else if(pc)ppc->PrintCondition(points);
00202 else cond->Print();
00203 }
00204 }
00205
00206 void TGo4CondArray::PrintBar(){
00207 TGo4Condition *cond;
00208 Int_t ii = condarr->GetLast()+1;
00209 TObject* ob= condarr->At(0);
00210 Bool_t con = (ob!=0) ? ob->InheritsFrom("TGo4Condition") : kFALSE;
00211 cout <<"-"<<ClassName()<<" "<<GetName()<<" Printout:" << endl;
00212
00213 for(Int_t i = 0; i < ii; i++)
00214 {
00215 if(con)
00216 {
00217 cond=(TGo4Condition*) condarr->UncheckedAt(i);
00218 TROOT::IndentLevel();
00219 cond->PrintBar();
00220 }
00221 }
00222
00223 }
00224
00225 Int_t TGo4CondArray::GetNumberOfConditions()
00226 {
00227 return GetNumber();
00228 }
00229
00230
00231 Int_t TGo4CondArray::GetNumber() const
00232 {
00233 return (condarr->GetLast()+1);
00234 }
00235
00236
00237 const char* TGo4CondArray::GetType() const
00238 {
00239 TGo4Condition *cond = (TGo4Condition*) condarr->At(0);
00240 return cond->ClassName();
00241 }
00242
00243
00244 void TGo4CondArray::GetType(Int_t& type) const
00245 {
00246 type = fiType;
00247 }
00248
00249 void TGo4CondArray::Enable(){
00250 TGo4Condition::Enable();
00251 if(IsMultiEdit())
00252 {
00253 Int_t ii = condarr->GetLast()+1;
00254
00255 for(Int_t i = 0; i < ii; i++)
00256 {
00257 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00258 cond->Enable();
00259 }
00260 }
00261 else
00262 {
00263 TGo4Condition* conny=At(GetCurrentIndex());
00264 if(conny) conny->Enable();
00265 }
00266 }
00267
00268 void TGo4CondArray::Disable(Bool_t result)
00269 {
00270 TGo4Condition::Disable(result);
00271 if(IsMultiEdit())
00272 {
00273 Int_t ii = condarr->GetLast()+1;
00274
00275 for(Int_t i = 0; i < ii; i++)
00276 {
00277 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00278 cond->Disable(result);
00279 }
00280 }
00281 else
00282 {
00283 TGo4Condition* conny=At(GetCurrentIndex());
00284 if(conny) conny->Disable(result);
00285 }
00286 }
00287
00288 void TGo4CondArray::Invert(Bool_t on)
00289 {
00290 TGo4Condition::Invert(on);
00291 if(IsMultiEdit())
00292 {
00293 Int_t ii = condarr->GetLast()+1;
00294
00295 for(Int_t i = 0; i < ii; i++)
00296 {
00297 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00298 cond->Invert(on);
00299 }
00300 }
00301 else
00302 {
00303 TGo4Condition* conny=At(GetCurrentIndex());
00304 if(conny) conny->Invert(on);
00305 }
00306 }
00307
00308 void TGo4CondArray::MarkReset(Bool_t on)
00309 {
00310 TGo4Condition::MarkReset(on);
00311 if(IsMultiEdit())
00312 {
00313 Int_t ii = condarr->GetLast()+1;
00314 for(Int_t i = 0; i < ii; i++)
00315 {
00316 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00317 cond->MarkReset(on);
00318 }
00319 }
00320 else
00321 {
00322 TGo4Condition* conny=At(GetCurrentIndex());
00323 if(conny) conny->MarkReset(on);
00324 }
00325 }
00326
00327 void TGo4CondArray::GetFlags(Bool_t* enabled, Bool_t* lastresult, Bool_t* markreset,
00328 Bool_t* result, Bool_t* truevalue, Bool_t* falsevalue)
00329 {
00330 if(IsMultiEdit())
00331 {
00332 Int_t ii = condarr->GetLast()+1;
00333 for(Int_t i = 0; i < ii; i++)
00334 {
00335 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00336 cond->GetFlags(enabled,lastresult,markreset, result, truevalue, falsevalue);
00337 }
00338 }
00339 else
00340 {
00341 TGo4Condition* conny=At(GetCurrentIndex());
00342 if(conny) conny->GetFlags(enabled,lastresult,markreset, result, truevalue, falsevalue);
00343
00344 }
00345 }
00346
00347
00348
00349
00350
00351
00352 void TGo4CondArray::ResetCounts(){
00353 TGo4Condition::ResetCounts();
00354 if(IsMultiEdit())
00355 {
00356
00357 Int_t ii = condarr->GetLast()+1;
00358 for(Int_t i = 0; i < ii; i++)
00359 {
00360 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00361 cond->ResetCounts();
00362 }
00363 }
00364 else
00365 {
00366 TGo4Condition* conny=At(GetCurrentIndex());
00367 if(conny) conny->ResetCounts();
00368 }
00369 }
00370
00371 Int_t TGo4CondArray::Counts()
00372 {
00373 Int_t rev=0;
00374 if(IsMultiEdit())
00375 {
00376 rev=TGo4Condition::Counts();
00377 }
00378 else
00379 {
00380 TGo4Condition* conny=At(GetCurrentIndex());
00381 if(conny) rev=conny->Counts();
00382 }
00383 return rev;
00384 }
00385
00386 Int_t TGo4CondArray::TrueCounts()
00387 {
00388 Int_t rev=0;
00389 if(IsMultiEdit())
00390 {
00391 rev=TGo4Condition::Counts();
00392 }
00393 else
00394 {
00395 TGo4Condition* conny=At(GetCurrentIndex());
00396 if(conny) rev=conny->Counts();
00397 }
00398 return rev;
00399 }
00400
00401 Double_t TGo4CondArray::GetXLow()
00402 {
00403 Double_t rev=0;
00404 if(IsMultiEdit())
00405 {
00406 rev=-1;
00407 }
00408 else
00409 {
00410 TGo4Condition* conny=At(GetCurrentIndex());
00411 if(conny) rev=conny->GetXLow();
00412 }
00413 return rev;
00414 }
00415
00416 Double_t TGo4CondArray::GetXUp()
00417 {
00418 Double_t rev=0;
00419 if(IsMultiEdit())
00420 {
00421 rev=-1;
00422 }
00423 else
00424 {
00425 TGo4Condition* conny=At(GetCurrentIndex());
00426 if(conny) rev=conny->GetXUp();
00427 }
00428 return rev;
00429 }
00430
00431 Double_t TGo4CondArray::GetYLow()
00432 {
00433 Double_t rev=0;
00434 if(IsMultiEdit())
00435 {
00436 rev=-1;
00437 }
00438 else
00439 {
00440 TGo4Condition* conny=At(GetCurrentIndex());
00441 if(conny) rev=conny->GetYLow();
00442 }
00443 return rev;
00444 }
00445
00446 Double_t TGo4CondArray::GetYUp()
00447 {
00448 Double_t rev=0;
00449 if(IsMultiEdit())
00450 {
00451 rev=-1;
00452 }
00453 else
00454 {
00455 TGo4Condition* conny=At(GetCurrentIndex());
00456 if(conny) rev=conny->GetYUp();
00457 }
00458 return rev;
00459 }
00460
00461
00462
00463 void TGo4CondArray::SetValues(Double_t low1, Double_t up1){
00464 if(fiType == kWINDOW)
00465 {
00466 if(IsMultiEdit())
00467 {
00468 Int_t ii = condarr->GetLast()+1;
00469 for(Int_t i = 0; i < ii; i++)
00470 {
00471 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00472 cond->SetValues(low1,up1);
00473 }
00474 }
00475 else
00476 {
00477 TGo4Condition* conny=At(GetCurrentIndex());
00478 if(conny) conny->SetValues(low1,up1);
00479 }
00480 }
00481 }
00482
00483 void TGo4CondArray::SetValues(Double_t low1, Double_t up1, Double_t low2, Double_t up2){
00484 if(fiType == kWINDOW)
00485 {
00486 if(IsMultiEdit())
00487 {
00488 Int_t ii = condarr->GetLast()+1;
00489 for(Int_t i = 0; i < ii; i++)
00490 {
00491 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00492 cond->SetValues(low1,up1,low2,up2);
00493 }
00494 }
00495 else
00496 {
00497 TGo4Condition* conny=At(GetCurrentIndex());
00498 if(conny) conny->SetValues(low1,up1,low2,up2);
00499 }
00500 }
00501 }
00502
00503 void TGo4CondArray::SetValues(TCutG * newcut)
00504 {
00505 if(fiType == kPOLYGON)
00506 {
00507 if(IsMultiEdit())
00508 {
00509 Int_t ii = condarr->GetLast()+1;
00510 for(Int_t i = 0; i < ii; i++)
00511 {
00512 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00513 cond->SetValues(newcut);
00514 }
00515 }
00516 else
00517 {
00518 TGo4Condition* conny=At(GetCurrentIndex());
00519 if(conny) conny->SetValues(newcut);
00520 }
00521 }
00522 }
00523
00524 Bool_t TGo4CondArray::UpdateFrom(TGo4Condition * cond, Bool_t counts){
00525 TGo4Condition::UpdateFrom(cond,counts);
00526 TGo4Condition *scond;
00527 TGo4Condition *dcond;
00528 TGo4CondArray *carr;
00529 if(cond->InheritsFrom("TGo4CondArray"))
00530 {
00531 Int_t dii = condarr->GetLast()+1;
00532 Int_t sii = ((TGo4CondArray*)cond)->GetNumber();
00533 if(dii == sii)
00534 {
00535 Bool_t result=kTRUE;
00536 carr = (TGo4CondArray*)cond;
00537
00538 for(Int_t i = 0; i < dii; i++){
00539 dcond=(TGo4Condition*) condarr->UncheckedAt(i);
00540 scond=(TGo4Condition*) (*carr)[i];
00541 result = result && ( dcond->UpdateFrom(scond,counts));
00542 }
00543 return result;
00544 }
00545 else
00546 {
00547 return kFALSE;
00548 }
00549 }
00550 else
00551 {
00552 return kFALSE;
00553 }
00554 }
00555
00556 void TGo4CondArray::SetVisible(Bool_t on)
00557 {
00558 if(IsMultiEdit())
00559 {
00560 TGo4Condition::SetVisible(on);
00561 Int_t ii = condarr->GetLast()+1;
00562 for(Int_t i = 0; i < ii; i++)
00563 {
00564 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00565 cond->SetVisible(on);
00566 }
00567 }
00568 else
00569 {
00570 TGo4Condition* conny=At(GetCurrentIndex());
00571 if(conny) conny->SetVisible(on);
00572 }
00573 }
00574
00575 Bool_t TGo4CondArray::IsVisible()
00576 {
00577 Bool_t rev=kFALSE;
00578 if(IsMultiEdit())
00579 {
00580 rev=TGo4Condition::IsVisible();
00581 }
00582 else
00583 {
00584 TGo4Condition* conny=At(GetCurrentIndex());
00585 if(conny) rev=conny->IsVisible();
00586 }
00587 return rev;
00588 }
00589
00590 void TGo4CondArray::SetLabelDraw(Bool_t on)
00591 {
00592 if(IsMultiEdit())
00593 {
00594 TGo4Condition::SetLabelDraw(on);
00595 Int_t ii = condarr->GetLast()+1;
00596 for(Int_t i = 0; i < ii; i++)
00597 {
00598 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00599 cond->SetLabelDraw(on);
00600 }
00601 }
00602 else
00603 {
00604 TGo4Condition* conny=At(GetCurrentIndex());
00605 if(conny) conny->SetLabelDraw(on);
00606 }
00607 }
00608 Bool_t TGo4CondArray::IsLabelDraw()
00609 {
00610 Bool_t rev=kFALSE;
00611 if(IsMultiEdit())
00612 {
00613 rev=TGo4Condition::IsLabelDraw();
00614 }
00615 else
00616 {
00617 TGo4Condition* conny=At(GetCurrentIndex());
00618 if(conny) rev=conny->IsLabelDraw();
00619 }
00620 return rev;
00621 }
00622
00623
00624 void TGo4CondArray::SetLimitsDraw(Bool_t on)
00625 {
00626 if(IsMultiEdit())
00627 {
00628 TGo4Condition::SetLimitsDraw(on);
00629 Int_t ii = condarr->GetLast()+1;
00630 for(Int_t i = 0; i < ii; i++)
00631 {
00632 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00633 cond->SetLimitsDraw(on);
00634 }
00635 }
00636 else
00637 {
00638 TGo4Condition* conny=At(GetCurrentIndex());
00639 if(conny) conny->SetLimitsDraw(on);
00640 }
00641 }
00642
00643 Bool_t TGo4CondArray::IsLimitsDraw()
00644 {
00645 Bool_t rev=kFALSE;
00646 if(IsMultiEdit())
00647 {
00648 rev=TGo4Condition::IsLimitsDraw();
00649 }
00650 else
00651 {
00652 TGo4Condition* conny=At(GetCurrentIndex());
00653 if(conny) rev=conny->IsLimitsDraw();
00654 }
00655 return rev;
00656 }
00657
00658
00659 void TGo4CondArray::SetIntDraw(Bool_t on)
00660 {
00661 if(IsMultiEdit())
00662 {
00663 TGo4Condition::SetIntDraw(on);
00664 Int_t ii = condarr->GetLast()+1;
00665 for(Int_t i = 0; i < ii; i++)
00666 {
00667 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00668 cond->SetIntDraw(on);
00669 }
00670 }
00671 else
00672 {
00673 TGo4Condition* conny=At(GetCurrentIndex());
00674 if(conny) conny->SetIntDraw(on);
00675 }
00676 }
00677 Bool_t TGo4CondArray::IsIntDraw()
00678 {
00679 Bool_t rev=kFALSE;
00680 if(IsMultiEdit())
00681 {
00682 rev=TGo4Condition::IsIntDraw();
00683 }
00684 else
00685 {
00686 TGo4Condition* conny=At(GetCurrentIndex());
00687 if(conny) rev=conny->IsIntDraw();
00688 }
00689 return rev;
00690 }
00691 void TGo4CondArray::SetXMeanDraw(Bool_t on)
00692 {
00693 if(IsMultiEdit())
00694 {
00695 TGo4Condition::SetXMeanDraw(on);
00696 Int_t ii = condarr->GetLast()+1;
00697 for(Int_t i = 0; i < ii; i++)
00698 {
00699 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00700 cond->SetXMeanDraw(on);
00701 }
00702 }
00703 else
00704 {
00705 TGo4Condition* conny=At(GetCurrentIndex());
00706 if(conny) conny->SetXMeanDraw(on);
00707 }
00708 }
00709 Bool_t TGo4CondArray::IsXMeanDraw()
00710 {
00711 Bool_t rev=kFALSE;
00712 if(IsMultiEdit())
00713 {
00714 rev=TGo4Condition::IsXMeanDraw();
00715 }
00716 else
00717 {
00718 TGo4Condition* conny=At(GetCurrentIndex());
00719 if(conny) rev=conny->IsXMeanDraw();
00720 }
00721 return rev;
00722 }
00723 void TGo4CondArray::SetXRMSDraw(Bool_t on)
00724 {
00725 if(IsMultiEdit())
00726 {
00727 TGo4Condition::SetXRMSDraw(on);
00728 Int_t ii = condarr->GetLast()+1;
00729 for(Int_t i = 0; i < ii; i++)
00730 {
00731 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00732 cond->SetXRMSDraw(on);
00733 }
00734 }
00735 else
00736 {
00737 TGo4Condition* conny=At(GetCurrentIndex());
00738 if(conny) conny->SetXRMSDraw(on);
00739 }
00740 }
00741 Bool_t TGo4CondArray::IsXRMSDraw()
00742 {
00743 Bool_t rev=kFALSE;
00744 if(IsMultiEdit())
00745 {
00746 rev=TGo4Condition::IsXRMSDraw();
00747 }
00748 else
00749 {
00750 TGo4Condition* conny=At(GetCurrentIndex());
00751 if(conny) rev=conny->IsXRMSDraw();
00752 }
00753 return rev;
00754 }
00755 void TGo4CondArray::SetYMeanDraw(Bool_t on)
00756 {
00757 if(IsMultiEdit())
00758 {
00759 TGo4Condition::SetYMeanDraw(on);
00760 Int_t ii = condarr->GetLast()+1;
00761 for(Int_t i = 0; i < ii; i++)
00762 {
00763 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00764 cond->SetYMeanDraw(on);
00765 }
00766 }
00767 else
00768 {
00769 TGo4Condition* conny=At(GetCurrentIndex());
00770 if(conny) conny->SetYMeanDraw(on);
00771 }
00772 }
00773 Bool_t TGo4CondArray::IsYMeanDraw()
00774 {
00775 Bool_t rev=kFALSE;
00776 if(IsMultiEdit())
00777 {
00778 rev=TGo4Condition::IsYMeanDraw();
00779 }
00780 else
00781 {
00782 TGo4Condition* conny=At(GetCurrentIndex());
00783 if(conny) rev=conny->IsYMeanDraw();
00784 }
00785 return rev;
00786 }
00787 void TGo4CondArray::SetYRMSDraw(Bool_t on)
00788 {
00789 if(IsMultiEdit())
00790 {
00791 TGo4Condition::SetYRMSDraw(on);
00792 Int_t ii = condarr->GetLast()+1;
00793 for(Int_t i = 0; i < ii; i++)
00794 {
00795 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00796 cond->SetYRMSDraw(on);
00797 }
00798 }
00799 else
00800 {
00801 TGo4Condition* conny=At(GetCurrentIndex());
00802 if(conny) conny->SetYRMSDraw(on);
00803 }
00804 }
00805 Bool_t TGo4CondArray::IsYRMSDraw()
00806 {
00807 Bool_t rev=kFALSE;
00808 if(IsMultiEdit())
00809 {
00810 rev=TGo4Condition::IsYRMSDraw();
00811 }
00812 else
00813 {
00814 TGo4Condition* conny=At(GetCurrentIndex());
00815 if(conny) rev=conny->IsYRMSDraw();
00816 }
00817 return rev;
00818 }
00819 void TGo4CondArray::SetXMaxDraw(Bool_t on)
00820 {
00821 if(IsMultiEdit())
00822 {
00823 TGo4Condition::SetXMaxDraw(on);
00824 Int_t ii = condarr->GetLast()+1;
00825 for(Int_t i = 0; i < ii; i++)
00826 {
00827 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00828 cond->SetXMaxDraw(on);
00829 }
00830 }
00831 else
00832 {
00833 TGo4Condition* conny=At(GetCurrentIndex());
00834 if(conny) conny->SetXMaxDraw(on);
00835 }
00836 }
00837 Bool_t TGo4CondArray::IsXMaxDraw()
00838 {
00839 Bool_t rev=kFALSE;
00840 if(IsMultiEdit())
00841 {
00842 rev=TGo4Condition::IsXMaxDraw();
00843 }
00844 else
00845 {
00846 TGo4Condition* conny=At(GetCurrentIndex());
00847 if(conny) rev=conny->IsXMaxDraw();
00848 }
00849 return rev;
00850 }
00851 void TGo4CondArray::SetYMaxDraw(Bool_t on)
00852 {
00853 if(IsMultiEdit())
00854 {
00855 TGo4Condition::SetYMaxDraw(on);
00856 Int_t ii = condarr->GetLast()+1;
00857 for(Int_t i = 0; i < ii; i++)
00858 {
00859 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00860 cond->SetYMaxDraw(on);
00861 }
00862 }
00863 else
00864 {
00865 TGo4Condition* conny=At(GetCurrentIndex());
00866 if(conny) conny->SetYMaxDraw(on);
00867 }
00868 }
00869 Bool_t TGo4CondArray::IsYMaxDraw()
00870 {
00871 Bool_t rev=kFALSE;
00872 if(IsMultiEdit())
00873 {
00874 rev=TGo4Condition::IsYMaxDraw();
00875 }
00876 else
00877 {
00878 TGo4Condition* conny=At(GetCurrentIndex());
00879 if(conny) rev=conny->IsYMaxDraw();
00880 }
00881 return rev;
00882 }
00883 void TGo4CondArray::SetCMaxDraw(Bool_t on)
00884 {
00885 if(IsMultiEdit())
00886 {
00887 TGo4Condition::SetCMaxDraw(on);
00888 Int_t ii = condarr->GetLast()+1;
00889 for(Int_t i = 0; i < ii; i++)
00890 {
00891 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00892 cond->SetCMaxDraw(on);
00893 }
00894 }
00895 else
00896 {
00897 TGo4Condition* conny=At(GetCurrentIndex());
00898 if(conny) conny->SetCMaxDraw(on);
00899 }
00900 }
00901 Bool_t TGo4CondArray::IsCMaxDraw()
00902 {
00903 Bool_t rev=kFALSE;
00904 if(IsMultiEdit())
00905 {
00906 rev=TGo4Condition::IsCMaxDraw();
00907 }
00908 else
00909 {
00910 TGo4Condition* conny=At(GetCurrentIndex());
00911 if(conny) rev=conny->IsCMaxDraw();
00912 }
00913 return rev;
00914 }
00915
00916 Double_t TGo4CondArray::GetIntegral(TH1* histo, Option_t* opt)
00917 {
00918 Double_t rev=0;
00919 if(IsMultiEdit())
00920 {
00921
00922 Int_t ii = condarr->GetLast()+1;
00923 for(Int_t i = 0; i < ii; i++)
00924 {
00925 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00926 rev+=cond->GetIntegral(histo,opt);
00927 }
00928 }
00929 else
00930 {
00931 TGo4Condition* conny=At(GetCurrentIndex());
00932 if(conny) rev=conny->GetIntegral(histo,opt);
00933 }
00934 return rev;
00935 }
00936
00937 Double_t TGo4CondArray::GetMean(TH1* histo, Int_t axis)
00938 {
00939 Double_t rev=0;
00940 if(IsMultiEdit())
00941 {
00942
00943 Int_t ii = condarr->GetLast()+1;
00944 Double_t sum=0;
00945 for(Int_t i = 0; i < ii; i++)
00946 {
00947 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
00948 sum+=cond->GetMean(histo,axis);
00949 rev=sum/ii;
00950 }
00951 }
00952 else
00953 {
00954 TGo4Condition* conny=At(GetCurrentIndex());
00955 if(conny) rev=conny->GetMean(histo,axis);
00956 }
00957 return rev;
00958 }
00959 Double_t TGo4CondArray::GetRMS(TH1* histo, Int_t axis)
00960 {
00961 Double_t rev=0;
00962 if(IsMultiEdit())
00963 {
00964 rev=-2;
00965 }
00966 else
00967 {
00968 TGo4Condition* conny=At(GetCurrentIndex());
00969 if(conny) rev=conny->GetRMS(histo,axis);
00970 }
00971 return rev;
00972 }
00973 Double_t TGo4CondArray::GetXMax(TH1* histo)
00974 {
00975 Double_t rev=0;
00976 if(IsMultiEdit())
00977 {
00978 rev=-2;
00979 }
00980 else
00981 {
00982 TGo4Condition* conny=At(GetCurrentIndex());
00983 if(conny) rev=conny->GetXMax(histo);
00984 }
00985 return rev;
00986 }
00987 Double_t TGo4CondArray::GetYMax(TH1* histo)
00988 {
00989 Double_t rev=0;
00990 if(IsMultiEdit())
00991 {
00992 rev=-2;
00993 }
00994 else
00995 {
00996 TGo4Condition* conny=At(GetCurrentIndex());
00997 if(conny) rev=conny->GetYMax(histo);
00998 }
00999 return rev;
01000 }
01001 Double_t TGo4CondArray::GetCMax(TH1* histo)
01002 {
01003 Double_t rev=0;
01004 if(IsMultiEdit())
01005 {
01006
01007 Int_t ii = condarr->GetLast()+1;
01008 for(Int_t i = 0; i < ii; i++)
01009 {
01010 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
01011 Double_t lmax=cond->GetCMax(histo);
01012 if(lmax>rev) rev=lmax;
01013 }
01014 }
01015 else
01016 {
01017 TGo4Condition* conny=At(GetCurrentIndex());
01018 if(conny) rev=conny->GetCMax(histo);
01019 }
01020 return rev;
01021 }
01022
01023
01024 TGo4Condition* TGo4CondArray::GetActiveCondition()
01025 {
01026 if(IsMultiEdit())
01027 return this;
01028 else
01029 return At(GetCurrentIndex());
01030 }
01031
01032
01033
01034
01035 Bool_t TGo4CondArray::IsChanged()
01036 {
01037 Int_t ii = condarr->GetLast()+1;
01038 for(Int_t i = 0; i < ii; i++)
01039 {
01040 TGo4Condition* cond=(TGo4Condition*) condarr->UncheckedAt(i);
01041 if(cond->IsChanged()) return kTRUE;
01042 }
01043 return kFALSE;
01044 }
01045
01046
01047 Bool_t TGo4CondArray::IsPolygonType()
01048 {
01049 Bool_t rev=kFALSE;
01050 if(IsMultiEdit())
01051 {
01052 if(fiType == kPOLYGON)
01053 rev=kTRUE;
01054 else
01055 rev=kFALSE;
01056 }
01057 else
01058 {
01059 TGo4Condition* conny=At(GetCurrentIndex());
01060 if(conny) rev=conny->IsPolygonType();
01061 }
01062 return rev;
01063 }
01064
01065 void TGo4CondArray::SetCurrentIndex(Int_t ix)
01066 {
01067 fiSelectedCond=ix;
01068 }
01069
01070
01071 Int_t TGo4CondArray::GetCurrentIndex()
01072 {
01073 return fiSelectedCond;
01074 }
01075
01076
01077 void TGo4CondArray::Draw(Option_t* opt)
01078 {
01079 TGo4Condition::Draw(opt);
01080 for(Int_t i=0; i<GetNumber(); ++i)
01081 {
01082 TGo4Condition* con=At(i);
01083 if(con)
01084 {
01085 con->SetPainted(IsPainted());
01086 con->SetDrawPad(GetDrawPad());
01087 }
01088 }
01089 }
01090
01091
01092
01093 void TGo4CondArray::SetPainter(TGo4ConditionPainter* painter)
01094 {
01095 if(painter==0) return;
01096 if(painter->InheritsFrom("TGo4CondArrayPainter"))
01097 {
01098 if(fxPainter) delete fxPainter;
01099 fxPainter=painter;
01100 }
01101 else
01102 {
01103 TGo4Log::Warn("Could not set painter of class %s for TGo4CondArray %s",
01104 painter->IsA()->GetName(),GetName());
01105 }
01106 }
01107
01108 TGo4ConditionPainter* TGo4CondArray::CreatePainter()
01109 {
01110 TGo4ConditionPainter* painter=new TGo4CondArrayPainter(GetName());
01111 painter->SetCondition(this);
01112 return painter;
01113 }
01114
01115 ClassImp(TGo4CondArray)
01116
01117