Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4Picture.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE 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 "TGo4Picture.h"
00017 
00018 #include "Riostream.h"
00019 #include "TClass.h"
00020 #include "TObjArray.h"
00021 #include "TObjString.h"
00022 #include "TVirtualPad.h"
00023 #include "TFrame.h"
00024 #include "TList.h"
00025 #include "TPad.h"
00026 #include "TCanvas.h"
00027 #include "TH1.h"
00028 #include "TGraph.h"
00029 #include "THStack.h"
00030 #include "TStyle.h"
00031 #include "TText.h"
00032 #include "TDatime.h"
00033 #include "TArrayL.h"
00034 #include "TAttLine.h"
00035 #include "TAttFill.h"
00036 #include "TAttMarker.h"
00037 #include "TPaveStats.h"
00038 #if ROOT_VERSION_CODE > ROOT_VERSION(5,9,0)
00039 #include "TBufferXML.h"
00040 #endif
00041 enum OptionsIdentifiers {
00042    op_RangeXMin   = 1,
00043    op_RangeXMax   = 2,
00044    op_RangeYMin   = 3,
00045    op_RangeYMax   = 4,
00046 
00047    op_LineColor   = 5,
00048    op_LineStyle   = 6,
00049    op_LineWidth   = 7,
00050 
00051    op_FillColor   = 8,
00052    op_FillStyle   = 9,
00053 
00054    op_MarkerColor = 10,
00055    op_MarkerSize  = 11,
00056    op_MarkerStyle = 12,
00057 
00058    op_LogScaleX   = 13,
00059    op_LogScaleY   = 14,
00060    op_LogScaleZ   = 15,
00061 
00062    op_TitleTime   = 16,
00063    op_TitleDate   = 17,
00064    op_TitleItem   = 18,
00065 
00066    op_HisStatsX1  = 19,
00067    op_HisStatsY1  = 20,
00068    op_HisStatsX2  = 21,
00069    op_HisStatsY2  = 22,
00070 
00071 //   op_PicHeader   = 23,
00072 
00073    op_HisStats    = 24,
00074    op_HisTitle    = 25,
00075    op_LegendDraw  = 26,
00076    op_Crosshair   = 27,
00077    op_AutoScale   = 28,
00078    op_Superimpose = 29,
00079    op_ContentModified = 30,
00080    op_PadModified = 31,
00081 
00082    op_RangeZMin   = 32,
00083    op_RangeZMax   = 33,
00084 
00085    op_FullDim     = 34,
00086    op_FullXMin    = 35,
00087    op_FullXMax    = 36,
00088    op_FullYMin    = 37,
00089    op_FullYMax    = 38,
00090    op_FullZMin    = 39,
00091    op_FullZMax    = 40,
00092    op_AxisX       = 41, // 12 parameters
00093    op_AxisY       = 53, // 12 parameters
00094    op_AxisZ       = 65, // 12 parameters
00095    op_Pad         = 77, // 8 parameters
00096    op_HisStatsOpt = 85,
00097    op_HisStatsFit = 86,
00098    op_RebinX      = 87,
00099    op_RebinY      = 88,
00100 
00101    op_ObjsBound   = 0x4000,
00102 
00103    op_Style        = op_ObjsBound,
00104    op_Draw         = op_ObjsBound+1,
00105    op_HisStatsOptF = op_ObjsBound+2,
00106    op_HisStatsFitF = op_ObjsBound+3
00107 
00108 };
00109 
00110 TGo4Picture::TGo4Picture() :
00111    TNamed(),
00112    fiNDivX(1),
00113    fiNDivY(1),
00114    fiPosX(0),
00115    fiPosY(0),
00116    fxNames(0),
00117    fxObjects(0),
00118    fxSubPictures(0),
00119    fiOptSize(0),
00120    fxOptIndex(),
00121    fxOptValue(),
00122    fxOptObjects(0),
00123    fxSpecialObjects(0),
00124    fiLastIndex(0)
00125 {
00126 }
00127 
00128 TGo4Picture::TGo4Picture(const char* name, const char* title, Int_t ndivy, Int_t ndivx) :
00129    TNamed(name, title),
00130    fiNDivX(1),
00131    fiNDivY(1),
00132    fiPosX(0),
00133    fiPosY(0),
00134    fxNames(0),
00135    fxObjects(0),
00136    fxSubPictures(0),
00137    fiOptSize(0),
00138    fxOptIndex(),
00139    fxOptValue(),
00140    fxOptObjects(0),
00141    fxSpecialObjects(0),
00142    fiLastIndex(0)
00143 {
00144    SetDivision(ndivy, ndivx);
00145 }
00146 
00147 TGo4Picture::TGo4Picture(TGo4Picture& picture) :
00148    TNamed(),
00149    fiNDivX(1),
00150    fiNDivY(1),
00151    fiPosX(0),
00152    fiPosY(0),
00153    fxNames(0),
00154    fxObjects(0),
00155    fxSubPictures(0),
00156    fiOptSize(0),
00157    fxOptIndex(),
00158    fxOptValue(),
00159    fxOptObjects(0),
00160    fxSpecialObjects(0),
00161    fiLastIndex(0)
00162 {
00163    UpdateFrom(&picture);
00164 }
00165 
00166 TGo4Picture::~TGo4Picture()
00167 {
00168    if (fxNames!=0) delete fxNames;
00169    if (fxObjects) delete fxObjects;
00170    if (fxSubPictures!=0) delete fxSubPictures;
00171    if (fxOptObjects!=0) delete fxOptObjects;
00172    if (fxSpecialObjects) delete fxSpecialObjects;
00173 }
00174 
00175 void TGo4Picture::SetDrawHeader(Bool_t draw)
00176 {
00177    SetTitleTime(draw);
00178    SetTitleDate(draw);
00179 }
00180 
00181 Bool_t TGo4Picture::IsDrawHeader()
00182 {
00183    return IsTitleTime() && IsTitleDate();
00184 }
00185 
00186 void TGo4Picture::SetDivision(Int_t ndivy, Int_t ndivx)
00187 {
00188   if (ndivx<1) fiNDivX = 1; else fiNDivX = ndivx;
00189   if (ndivy<1) fiNDivY = 1; else fiNDivY = ndivy;
00190 }
00191 
00192 TGo4Picture* TGo4Picture::FindPic(Int_t posy, Int_t posx)
00193 {
00194    if (fxSubPictures==0) return 0;   if (posx<0) posx=0; else if(posx>=GetDivX()) posx = GetDivX()-1;
00195    if (posy<0) posy=0; else if(posy>=GetDivY()) posy = GetDivY()-1;
00196    for (Int_t n=0;n<=fxSubPictures->GetLast();n++) {
00197       TGo4Picture* sub = dynamic_cast<TGo4Picture*> (fxSubPictures->At(n));
00198       if (sub!=0)
00199         if (sub->CheckPosition(posy,posx)) return sub;
00200    }
00201    return 0;
00202 }
00203 
00204 TGo4Picture* TGo4Picture::Pic(Int_t posy, Int_t posx)
00205 {
00206    if (!IsDivided()) return this;
00207    if (posx<0) posx=0; else if(posx>=GetDivX()) posx = GetDivX()-1;
00208    if (posy<0) posy=0; else if(posy>=GetDivY()) posy = GetDivY()-1;
00209    TGo4Picture* sub = FindPic(posy, posx);
00210    if (sub!=0) return sub;
00211    sub = new TGo4Picture("Sub", "Sub picture");
00212    sub->SetPosition(posy, posx);
00213    if (fxSubPictures==0) {
00214      fxSubPictures = new TObjArray();
00215      fxSubPictures->SetOwner(kTRUE);
00216    }
00217    fxSubPictures->Add(sub);
00218    return sub;
00219 }
00220 
00221 void TGo4Picture::SetLinesDivision(Int_t numlines, const Int_t* numbers)
00222 {
00223    SetDivision(numlines,1);
00224    for (Int_t n=0;n<numlines;n++)
00225      if (numbers[n]>1) Pic(n,0)->SetDivision(1,numbers[n]);
00226 }
00227 
00228 void TGo4Picture::SetLinesDivision(Int_t numlines,
00229                                   Int_t n0, Int_t n1, Int_t n2, Int_t n3, Int_t n4,
00230                                   Int_t n5, Int_t n6, Int_t n7, Int_t n8, Int_t n9)
00231 {
00232    const Int_t numbers[10] = { n0, n1, n2, n3, n4, n5, n6, n7, n8, n9};
00233    SetLinesDivision(numlines, numbers);
00234 }
00235 
00236 TGo4Picture* TGo4Picture::LPic(Int_t nline, Int_t ncol)
00237 {
00238    if (!IsDivided()) return this;
00239    TGo4Picture* sub = Pic(nline, 0);
00240    if (sub==0) return 0;
00241    if (sub->IsDivided()) return sub->Pic(0,ncol);
00242                     else return sub;
00243 }
00244 
00245 void TGo4Picture::SetPosition(Int_t posy, Int_t posx)
00246 {
00247   fiPosX = posx; fiPosY = posy;
00248 }
00249 
00250 Bool_t TGo4Picture::CheckPosition(Int_t posy, Int_t posx)
00251 {
00252    return (fiPosX == posx) && (fiPosY == posy);
00253 }
00254 
00255 void TGo4Picture::AddH1(TH1* histo, Option_t* DrawOption)
00256 {
00257    AddObject(histo, DrawOption);
00258 }
00259 
00260 void TGo4Picture::AddH1(Int_t posy, Int_t posx, TH1* histo, Option_t* DrawOption)
00261 {
00262    AddObject(posy, posx, histo, DrawOption);
00263 }
00264 
00265 void TGo4Picture::AddHStack(THStack* st, Option_t* DrawOption)
00266 {
00267    AddObject(st, DrawOption);
00268 }
00269 
00270 void TGo4Picture::AddHStack(Int_t posy, Int_t posx, THStack* st, Option_t* DrawOption)
00271 {
00272     AddObject(posy, posx, st, DrawOption);
00273 }
00274 
00275 void TGo4Picture::AddGraph(TGraph* gr, Option_t* DrawOption)
00276 {
00277    AddObject(gr, DrawOption);
00278 }
00279 
00280 void TGo4Picture::AddGraph(Int_t posy, Int_t posx, TGraph* gr, Option_t* DrawOption)
00281 {
00282    AddObject(posy, posx, gr, DrawOption);
00283 }
00284 
00285 void TGo4Picture::AddCondition(TNamed* cond)
00286 {
00287    AddObject(cond);
00288 }
00289 
00290 void TGo4Picture::AddCondition(Int_t posy, Int_t posx, TNamed* cond)
00291 {
00292    AddObject(posy, posx, cond);
00293 }
00294 
00295 void TGo4Picture::AddObjName(const char* name, Option_t* DrawOption)
00296 {
00297    if (name==0) return;
00298    if (fxNames==0) {
00299       fxNames = new TObjArray();
00300       fxNames->SetOwner(kTRUE);
00301    }
00302    fxNames->Add(new TObjString(name));
00303    SetDrawOption(DrawOption, fxNames->GetLast());
00304 //   if ((DrawOption!=0) && (*DrawOption!=0))
00305 //      SetDrawOption(DrawOption, PictureIndex);
00306 
00307    fiLastIndex = fxNames->GetLast();
00308 }
00309 
00310 void TGo4Picture::AddObjName(Int_t posy, Int_t posx, const char* name, Option_t* DrawOption)
00311 {
00312    if (name!=0)
00313      Pic(posy,posx)->AddObjName(name, DrawOption);
00314 }
00315 
00316 void TGo4Picture::ClearObjNames(Bool_t recursive)
00317 {
00318    if (fxNames!=0) {
00319      delete fxNames;
00320      fxNames = 0;
00321    }
00322    fiLastIndex = 0;
00323    if (recursive && fxSubPictures)
00324     for (Int_t n=0;n<=fxSubPictures->GetLast();n++) {
00325       TGo4Picture* sub = dynamic_cast<TGo4Picture*> (fxSubPictures->At(n));
00326       if (sub) sub->ClearObjNames(recursive);
00327     }
00328 }
00329 
00330 Int_t TGo4Picture::GetNumObjNames()
00331 {
00332   return (fxNames==0) ? 0 : fxNames->GetLast()+1;
00333 }
00334 
00335 Bool_t TGo4Picture::IsObjNames()
00336 {
00337    if (GetNumObjNames()>0) return kTRUE;
00338 
00339    if (fxSubPictures)
00340      for (Int_t n=0;n<=fxSubPictures->GetLast();n++) {
00341        TGo4Picture* sub = dynamic_cast<TGo4Picture*> (fxSubPictures->At(n));
00342        if (sub && sub->IsObjNames()) return kTRUE;
00343    }
00344    return kFALSE;
00345 }
00346 
00347 const char* TGo4Picture::GetObjName(Int_t n)
00348 {
00349   if ((fxNames==0) || (n<0) || (n>fxNames->GetLast())) return 0;
00350   TObjString* str = dynamic_cast<TObjString*> (fxNames->At(n));
00351   if (str!=0) return str->String().Data();
00352          else return 0;
00353 }
00354 
00355 void TGo4Picture::AddObject(TObject* obj, Option_t* DrawOption)
00356 {
00357    if (obj!=0)
00358       AddObjName(obj->GetName(), DrawOption);
00359 }
00360 
00361 void TGo4Picture::AddObject(Int_t posy, Int_t posx, TObject* obj, Option_t* DrawOption)
00362 {
00363    if (obj!=0)
00364       AddObjName(posy, posx, obj->GetName(), DrawOption);
00365 }
00366 
00367 void TGo4Picture::SetRangeX(Double_t min, Double_t max)
00368 {
00369   SetOptionD(PictureIndex, op_RangeXMin, min);
00370   SetOptionD(PictureIndex, op_RangeXMax, max);
00371 }
00372 
00373 Bool_t TGo4Picture::GetRangeX(Double_t& min, Double_t& max)
00374 {
00375    min = 0.; max = 0;
00376    return GetOptionD(PictureIndex, op_RangeXMin, min) &&
00377           GetOptionD(PictureIndex, op_RangeXMax, max);
00378 }
00379 
00380 void TGo4Picture::ClearRangeX()
00381 {
00382    ClearOption(PictureIndex, op_RangeXMin);
00383    ClearOption(PictureIndex, op_RangeXMax);
00384 }
00385 
00386 void TGo4Picture::SetRangeY(Double_t min, Double_t max)
00387 {
00388   SetOptionD(PictureIndex, op_RangeYMin, min);
00389   SetOptionD(PictureIndex, op_RangeYMax, max);
00390 }
00391 
00392 Bool_t TGo4Picture::GetRangeY(Double_t& min, Double_t& max)
00393 {
00394    min = 0.; max = 0;
00395    return GetOptionD(PictureIndex, op_RangeYMin, min) &&
00396           GetOptionD(PictureIndex, op_RangeYMax, max);
00397 }
00398 
00399 void TGo4Picture::ClearRangeY()
00400 {
00401    ClearOption(PictureIndex, op_RangeYMin);
00402    ClearOption(PictureIndex, op_RangeYMax);
00403 }
00404 
00405 void TGo4Picture::SetRangeZ(Double_t min, Double_t max)
00406 {
00407   SetOptionD(PictureIndex, op_RangeZMin, min);
00408   SetOptionD(PictureIndex, op_RangeZMax, max);
00409 }
00410 
00411 Bool_t TGo4Picture::GetRangeZ(Double_t& min, Double_t& max)
00412 {
00413    min = 0.; max = 0;
00414    return GetOptionD(PictureIndex, op_RangeZMin, min) &&
00415           GetOptionD(PictureIndex, op_RangeZMax, max);
00416 }
00417 
00418 void TGo4Picture::ClearRangeZ()
00419 {
00420    ClearOption(PictureIndex, op_RangeZMin);
00421    ClearOption(PictureIndex, op_RangeZMax);
00422 }
00423 
00424 void TGo4Picture::SetRange(Int_t naxis, Double_t min, Double_t max)
00425 {
00426    switch (naxis) {
00427       case 0: SetRangeX(min, max); break;
00428       case 1: SetRangeY(min, max); break;
00429       case 2: SetRangeZ(min, max); break;
00430    }
00431 }
00432 
00433 Bool_t TGo4Picture::GetRange(Int_t naxis, Double_t& min, Double_t& max)
00434 {
00435    switch (naxis) {
00436       case 0: return GetRangeX(min, max); break;
00437       case 1: return GetRangeY(min, max); break;
00438       case 2: return GetRangeZ(min, max); break;
00439    }
00440    return kFALSE;
00441 }
00442 
00443 void TGo4Picture::ClearRange(Int_t naxis)
00444 {
00445    switch (naxis) {
00446       case 0: ClearRangeX(); break;
00447       case 1: ClearRangeY(); break;
00448       case 2: ClearRangeZ(); break;
00449       default:
00450          ClearRangeX();
00451          ClearRangeY();
00452          ClearRangeZ();
00453          break;
00454    }
00455 }
00456 
00457 void TGo4Picture::SetLogScale(Int_t nscale, Int_t zn)
00458 {
00459    Int_t typ;
00460    switch (nscale) {
00461        case 1: typ = op_LogScaleY; break;
00462        case 2: typ = op_LogScaleZ; break;
00463        default: typ = op_LogScaleX;
00464    }
00465    SetOption(PictureIndex, typ, zn);
00466 }
00467 
00468 Int_t TGo4Picture::GetLogScale(Int_t nscale)
00469 {
00470    Int_t typ;
00471    switch (nscale) {
00472        case 1: typ = op_LogScaleY; break;
00473        case 2: typ = op_LogScaleZ; break;
00474        default: typ = op_LogScaleX;
00475    }
00476    Long_t zn;
00477    if (GetOption(PictureIndex, typ, zn)) return zn;
00478                                     else return 0;
00479 }
00480 
00481 void TGo4Picture::GetLogScales(TVirtualPad* pad)
00482 {
00483    if (pad == 0) return;
00484    Long_t zn;
00485    if (GetOption(PictureIndex, op_LogScaleX, zn)) pad->SetLogx(zn);
00486    if (GetOption(PictureIndex, op_LogScaleY, zn)) pad->SetLogy(zn);
00487    if (GetOption(PictureIndex, op_LogScaleZ, zn)) pad->SetLogz(zn);
00488 }
00489 
00490 void TGo4Picture::ClearLogScales()
00491 {
00492    ClearOption(PictureIndex, op_LogScaleX);
00493    ClearOption(PictureIndex, op_LogScaleY);
00494    ClearOption(PictureIndex, op_LogScaleZ);
00495 }
00496 
00497 void TGo4Picture::SetLineAtt(Color_t color, Style_t style, Width_t width, Int_t index)
00498 {
00499    CheckIndex(index);
00500    SetOption(index, op_LineColor, color);
00501    SetOption(index, op_LineStyle, style);
00502    SetOption(index, op_LineWidth, width);
00503 }
00504 
00505 void TGo4Picture::SetLineAtt(TAttLine* line, Int_t index)
00506 {
00507    if (line==0) return;
00508    CheckIndex(index);
00509    SetOption(index, op_LineColor, line->GetLineColor());
00510    SetOption(index, op_LineStyle, line->GetLineStyle());
00511    SetOption(index, op_LineWidth, line->GetLineWidth());
00512 }
00513 
00514 Bool_t TGo4Picture::GetLineAtt(TAttLine* line, Int_t index)
00515 {
00516    if (line==0) return kFALSE;
00517    CheckIndex(index);
00518    Long_t color = -111, style=-111, width=-111;
00519    if (GetOption(index, op_LineColor, color)) line->SetLineColor(color);
00520    if (GetOption(index, op_LineStyle, style)) line->SetLineStyle(style);
00521    if (GetOption(index, op_LineWidth, width)) line->SetLineWidth(width);
00522    return (color!=-111) && (style!=-111) && (width!=-111);
00523 }
00524 
00525 void TGo4Picture::ClearLineAtt(Int_t index)
00526 {
00527    CheckIndex(index);
00528    ClearOption(index, op_LineColor);
00529    ClearOption(index, op_LineStyle);
00530    ClearOption(index, op_LineWidth);
00531 }
00532 
00533 void TGo4Picture::SetFillAtt(Color_t color, Style_t style, Int_t index)
00534 {
00535    CheckIndex(index);
00536    SetOption(index, op_FillColor, color);
00537    SetOption(index, op_FillStyle, style);
00538 }
00539 
00540 void TGo4Picture::SetFillAtt(TAttFill* fill, Int_t index)
00541 {
00542    if (fill==0) return;
00543    CheckIndex(index);
00544    SetOption(index, op_FillColor, fill->GetFillColor());
00545    SetOption(index, op_FillStyle, fill->GetFillStyle());
00546 }
00547 
00548 Bool_t TGo4Picture::GetFillAtt(TAttFill* fill, Int_t index)
00549 {
00550    if (fill==0) return kFALSE;
00551    CheckIndex(index);
00552    Long_t color = -111, style = -111;
00553    if (GetOption(index, op_FillColor, color)) fill->SetFillColor(color);
00554    if (GetOption(index, op_FillStyle, style)) fill->SetFillStyle(style);
00555    return (color!=-111) && (style!=-111);
00556 }
00557 
00558 void TGo4Picture::ClearFillAtt(Int_t index)
00559 {
00560    CheckIndex(index);
00561    ClearOption(index, op_FillColor);
00562    ClearOption(index, op_FillStyle);
00563 }
00564 
00565 void TGo4Picture::SetMarkerAtt(Color_t color, Size_t size, Style_t style, Int_t index)
00566 {
00567    CheckIndex(index);
00568    SetOption(index, op_MarkerColor, color);
00569    SetOption(index, op_MarkerSize, int(size));
00570    SetOption(index, op_MarkerStyle, style);
00571 }
00572 
00573 void TGo4Picture::SetMarkerAtt(TAttMarker* marker, Int_t index)
00574 {
00575    if (marker==0) return;
00576    CheckIndex(index);
00577    SetOption(index, op_MarkerColor, marker->GetMarkerColor());
00578    SetOption(index, op_MarkerSize, int(marker->GetMarkerSize()));
00579    SetOption(index, op_MarkerStyle, marker->GetMarkerStyle());
00580 }
00581 
00582 Bool_t TGo4Picture::GetMarkerAtt(TAttMarker* marker, Int_t index)
00583 {
00584    if (marker==0) return kFALSE;
00585    CheckIndex(index);
00586    Long_t color=-111, size=-111, style=-111;
00587    if (GetOption(index, op_MarkerColor, color)) marker->SetMarkerColor(color);
00588    if (GetOption(index, op_MarkerSize, size)) marker->SetMarkerSize(size);
00589    if (GetOption(index, op_MarkerStyle, style)) marker->SetMarkerStyle(style);
00590    return (color!=-111) && (size!=-111) && (style!=-111);
00591 }
00592 
00593 void TGo4Picture::ClearMarkerAtt(Int_t index)
00594 {
00595    CheckIndex(index);
00596    ClearOption(index, op_MarkerColor);
00597    ClearOption(index, op_MarkerSize);
00598    ClearOption(index, op_MarkerStyle);
00599 }
00600 
00601 void TGo4Picture::SetRebinX(Int_t ngroupx, Int_t index)
00602 {
00603    CheckIndex(index);
00604    if (ngroupx>0) SetOption(index, op_RebinX, ngroupx);
00605              else ClearOption(index, op_RebinX);
00606 }
00607 
00608 void TGo4Picture::SetRebinY(Int_t ngroupy, Int_t index)
00609 {
00610    CheckIndex(index);
00611    if (ngroupy>0) SetOption(index, op_RebinY, ngroupy);
00612              else ClearOption(index, op_RebinY);
00613 }
00614 
00615 Int_t TGo4Picture::GetRebinX(Int_t index)
00616 {
00617    CheckIndex(index);
00618    Long_t ngroupx = 0;
00619    if (!GetOption(index, op_RebinX, ngroupx)) ngroupx = 0;
00620    return ngroupx;
00621 }
00622 
00623 Int_t TGo4Picture::GetRebinY(Int_t index)
00624 {
00625    CheckIndex(index);
00626    Long_t ngroupy = 0;
00627    if (!GetOption(index, op_RebinY, ngroupy)) ngroupy = 0;
00628    return ngroupy;
00629 }
00630 
00631 void TGo4Picture::ClearRebin(Int_t index)
00632 {
00633    CheckIndex(index);
00634    ClearOption(index, op_RebinX);
00635    ClearOption(index, op_RebinY);
00636 }
00637 
00638 void TGo4Picture::GetDrawAttributes(TObject* obj, Int_t index)
00639 {
00640    if (obj==0) return;
00641    CheckIndex(index);
00642 //   cout << "TGo4Picture::GetDrawAttributes( " << index << "  obj = " << obj->GetName() << endl;
00643    GetLineAtt((TAttLine*) Cast(obj, TAttLine::Class()), index);
00644    GetFillAtt((TAttFill*) Cast(obj, TAttFill::Class()), index);
00645    GetMarkerAtt((TAttMarker*) Cast(obj, TAttMarker::Class()), index);
00646    GetH1Att((TH1*) Cast(obj, TH1::Class()), index);
00647    GetPadAtt((TPad*) Cast(obj, TPad::Class()), index);
00648 }
00649 
00650 void TGo4Picture::SetDrawAttributes(TObject* obj, Int_t index)
00651 {
00652    if (obj==0) return;
00653    CheckIndex(index);
00654 //   cout << "TGo4Picture::SetDrawAttributes " << obj->GetName() << "  indx = " << index << endl;
00655    SetLineAtt((TAttLine*) Cast(obj, TAttLine::Class()), index);
00656    SetFillAtt((TAttFill*) Cast(obj, TAttFill::Class()), index);
00657    SetMarkerAtt((TAttMarker*) Cast(obj, TAttMarker::Class()), index);
00658    SetH1Att((TH1*) Cast(obj, TH1::Class()), index);
00659    SetPadAtt((TPad*) Cast(obj, TPad::Class()), index);
00660 }
00661 
00662 void TGo4Picture::SetH1Att(TH1* h1, Int_t index)
00663 {
00664    if (h1==0) return;
00665    CheckIndex(index);
00666    SetAxisAtt(0, h1->GetXaxis(), index);
00667    SetAxisAtt(1, h1->GetYaxis(), index);
00668    SetAxisAtt(2, h1->GetZaxis(), index);
00669 }
00670 
00671 void TGo4Picture::GetH1Att(TH1* h1, Int_t index)
00672 {
00673    if (h1==0) return;
00674    CheckIndex(index);
00675    GetAxisAtt(0, h1->GetXaxis(), index);
00676    GetAxisAtt(1, h1->GetYaxis(), index);
00677    GetAxisAtt(2, h1->GetZaxis(), index);
00678 }
00679 
00680 void TGo4Picture::SetAxisAtt(Int_t naxis,
00681                       Color_t AxisColor,
00682                       Color_t LabelColor,
00683                       Style_t LabelFont,
00684                       Float_t LabelOffset,
00685                       Float_t LabelSize,
00686                       Int_t Ndivisions,
00687                       Float_t TickLength,
00688                       Color_t TitleColor,
00689                       Style_t TitleFont,
00690                       Float_t TitleOffset,
00691                       Float_t TitleSize,
00692                       Bool_t decimals,
00693                       const char* ticks,
00694                       Int_t bits,
00695                       Int_t index)
00696 {
00697    if ((naxis<0) || (naxis>2)) return;
00698    CheckIndex(index);
00699    Int_t op = op_AxisX;
00700    if (naxis==1) op = op_AxisY; else
00701    if (naxis==2) op = op_AxisZ;
00702 
00703    SetOption (index, op+0, AxisColor);
00704    SetOption (index, op+1, LabelColor);
00705    SetOption (index, op+2, LabelFont);
00706    SetOptionF(index, op+3, LabelOffset);
00707    SetOptionF(index, op+4, LabelSize);
00708    SetOption (index, op+5, Ndivisions);
00709    SetOptionF(index, op+6, TickLength);
00710    SetOption (index, op+7, TitleColor);
00711    SetOption (index, op+8, TitleFont);
00712    SetOptionF(index, op+9, TitleOffset);
00713    SetOptionF(index, op+10, TitleSize);
00714    // copy all user defined bits
00715    if (decimals) bits = bits | 1;
00716    if (ticks!=0) {
00717       if (strchr(ticks,'+')!=0) bits = bits | 2;
00718       if (strchr(ticks,'-')!=0) bits = bits | 4;
00719    }
00720    SetOption (index, op+11, bits);
00721 }
00722 
00723 void TGo4Picture::SetAxisAtt(Int_t naxis, TAxis* axis, Int_t index)
00724 {
00725    if (axis!=0)
00726       SetAxisAtt(naxis,
00727               axis->GetAxisColor(),
00728               axis->GetLabelColor(),
00729               axis->GetLabelFont(),
00730               axis->GetLabelOffset(),
00731               axis->GetLabelSize(),
00732               axis->GetNdivisions(),
00733               axis->GetTickLength(),
00734               axis->GetTitleColor(),
00735               axis->GetTitleFont(),
00736               axis->GetTitleOffset(),
00737               axis->GetTitleSize(),
00738               axis->GetDecimals(),
00739               axis->GetTicks(),
00740               axis->TestBits(0x0ff0),
00741               index);
00742 }
00743 
00744 void TGo4Picture::GetAxisAtt(Int_t naxis, TAxis* axis, Int_t index)
00745 {
00746    if ((axis==0) || (naxis<0) || (naxis>2)) return;
00747    CheckIndex(index);
00748    Int_t op = op_AxisX;
00749    if (naxis==1) op = op_AxisY; else
00750    if (naxis==2) op = op_AxisZ;
00751 
00752    Long_t lv;
00753    Float_t fv;
00754    if (GetOption (index, op+0, lv)) axis->SetAxisColor(lv);
00755    if (GetOption (index, op+1, lv)) axis->SetLabelColor(lv);
00756    if (GetOption (index, op+2, lv)) axis->SetLabelFont(lv);
00757    if (GetOptionF(index, op+3, fv)) axis->SetLabelOffset(fv);
00758    if (GetOptionF(index, op+4, fv)) axis->SetLabelSize(fv);
00759    if (GetOption (index, op+5, lv)) axis->SetNdivisions(lv);
00760    if (GetOptionF(index, op+6, fv)) axis->SetTickLength(fv);
00761    if (GetOption (index, op+7, lv)) axis->SetTitleColor(lv);
00762    if (GetOption (index, op+8, lv)) axis->SetTitleFont(lv);
00763    if (GetOptionF(index, op+9, fv)) axis->SetTitleOffset(fv);
00764    if (GetOptionF(index, op+10, fv)) axis->SetTitleSize(fv);
00765    if (GetOption (index, op+11, lv)) {
00766       axis->SetDecimals((lv & 1) != 0);
00767       TString ticks;
00768       if ((lv & 2) != 0) ticks+="+";
00769       if ((lv & 4) != 0) ticks+="-";
00770       axis->SetTicks(ticks.Data());
00771       for(int n=9;n<24;n++) {
00772          if (n==13) continue;
00773          Int_t mask = BIT(n);
00774          axis->SetBit(mask, (lv & mask) != 0);
00775       }
00776    }
00777 }
00778 
00779 void TGo4Picture::SetPadAtt(Int_t BorderMode,
00780                             Int_t BorderSize,
00781                             Int_t Gridx,
00782                             Int_t Gridy,
00783                             Double_t Phi,
00784                             Double_t Theta,
00785                             Int_t Tickx,
00786                             Int_t Ticky,
00787                             Int_t index)
00788 {
00789    CheckIndex(index);
00790    SetOption (index, op_Pad+ 0, BorderMode);
00791    SetOption (index, op_Pad+ 1, BorderSize);
00792    SetOption (index, op_Pad+ 2, Gridx);
00793    SetOption (index, op_Pad+ 3, Gridy);
00794    SetOptionD(index, op_Pad+ 4, Phi);
00795    SetOptionD(index, op_Pad+ 5, Theta);
00796    SetOption (index, op_Pad+ 6, Tickx);
00797    SetOption (index, op_Pad+ 7, Ticky);
00798 }
00799 
00800 void TGo4Picture::SetPadAtt(TPad* pad, Int_t index)
00801 {
00802    if (pad==0) return;
00803    CheckIndex(index);
00804    SetPadAtt(pad->GetBorderMode(),
00805              pad->GetBorderSize(),
00806              pad->GetGridx(),
00807              pad->GetGridy(),
00808              pad->GetPhi(),
00809              pad->GetTheta(),
00810              pad->GetTickx(),
00811              pad->GetTicky(),
00812              index);
00813    SetDrawAttributes(pad->GetFrame(), index);
00814 }
00815 
00816 void TGo4Picture::GetPadAtt(TPad* pad, Int_t index)
00817 {
00818    if (pad==0) return;
00819    CheckIndex(index);
00820 
00821    Long_t lv;
00822    Double_t dv;
00823    if (GetOption (index, op_Pad+ 0, lv)) pad->SetBorderMode(lv);
00824    if (GetOption (index, op_Pad+ 1, lv)) pad->SetBorderSize(lv);
00825    if (GetOption (index, op_Pad+ 2, lv)) pad->SetGridx(lv);
00826    if (GetOption (index, op_Pad+ 3, lv)) pad->SetGridy(lv);
00827    if (GetOptionD(index, op_Pad+ 4, dv)) pad->SetPhi(dv);
00828    if (GetOptionD(index, op_Pad+ 5, dv)) pad->SetTheta(dv);
00829    if (GetOption (index, op_Pad+ 6, lv)) pad->SetTickx(lv);
00830    if (GetOption (index, op_Pad+ 7, lv)) pad->SetTicky(lv);
00831    GetDrawAttributes(pad->GetFrame(), index);
00832 }
00833 
00834 void* TGo4Picture::Cast(TObject* obj, TClass* cl)
00835 {
00836    if ((obj==0) || (cl==0)) return 0;
00837    Int_t shift = obj->IsA()->GetBaseClassOffset(cl);
00838    if (shift<0) return 0;
00839    return (char*) obj + shift;
00840 }
00841 
00842 void TGo4Picture::SetHisStats(Bool_t on)
00843 {
00844    SetOption(PictureIndex, op_HisStats, on ? 1 : 0);
00845 }
00846 
00847 Bool_t TGo4Picture::IsHisStats() const
00848 {
00849    Long_t zn = kTRUE;
00850    GetOption(PictureIndex, op_HisStats, zn);
00851    return zn!=0;
00852 }
00853 
00854 void TGo4Picture::SetStatsAttr(Double_t x1, Double_t y1, Double_t x2, Double_t y2,
00855                                Int_t optstat, const char* statformat,
00856                                Int_t optfit, const char* fitformat)
00857 {
00858    SetOptionD(PictureIndex, op_HisStatsX1, x1);
00859    SetOptionD(PictureIndex, op_HisStatsY1, y1);
00860    SetOptionD(PictureIndex, op_HisStatsX2, x2);
00861    SetOptionD(PictureIndex, op_HisStatsY2, y2);
00862 
00863    SetOption(PictureIndex, op_HisStatsOpt, optstat);
00864    SetStrOption(PictureIndex, op_HisStatsOptF, statformat);
00865    SetOption(PictureIndex, op_HisStatsFit, optfit);
00866    SetStrOption(PictureIndex, op_HisStatsFitF, fitformat);
00867 }
00868 
00869 void TGo4Picture::SetStatsAttr(TPaveStats* stats)
00870 {
00871    if (stats!=0)
00872       SetStatsAttr(stats->GetX1NDC(), stats->GetY1NDC(),
00873                    stats->GetX2NDC(), stats->GetY2NDC(),
00874                    stats->GetOptStat(), stats->GetStatFormat(),
00875                    stats->GetOptFit(), stats->GetFitFormat());
00876 }
00877 
00878 Bool_t TGo4Picture::GetStatsAttr(TPaveStats* stats)
00879 {
00880    if (stats==0) return kFALSE;
00881 
00882    Double_t x1, y1, x2, y2;
00883    if (GetOptionD(PictureIndex, op_HisStatsX1, x1) &&
00884        GetOptionD(PictureIndex, op_HisStatsY1, y1) &&
00885        GetOptionD(PictureIndex, op_HisStatsX2, x2) &&
00886        GetOptionD(PictureIndex, op_HisStatsY2, y2)) {
00887          stats->SetX1NDC(x1);
00888          stats->SetY1NDC(y1);
00889          stats->SetX2NDC(x2);
00890          stats->SetY2NDC(y2);
00891          stats->ConvertNDCtoPad();
00892        }
00893 
00894    Long_t optstat, optfit;
00895    if (GetOption(PictureIndex, op_HisStatsOpt, optstat))
00896      stats->SetOptStat(optstat);
00897 
00898    if (GetOption(PictureIndex, op_HisStatsFit, optfit))
00899      stats->SetOptFit(optfit);
00900 
00901    const char* fmtstat = GetStrOption(PictureIndex, op_HisStatsOptF);
00902    if (fmtstat!=0) stats->SetStatFormat(fmtstat);
00903 
00904    const char* fmtfit = GetStrOption(PictureIndex, op_HisStatsFitF);
00905    if (fmtfit!=0) stats->SetFitFormat(fmtfit);
00906 
00907    return kTRUE;
00908 }
00909 
00910 void TGo4Picture::SetHisTitle(bool on)
00911 {
00912    SetOption(PictureIndex, op_HisTitle, on ? 1 : 0);
00913 }
00914 
00915 Bool_t TGo4Picture::IsHisTitle() const
00916 {
00917    Long_t zn = kTRUE;
00918    GetOption(PictureIndex, op_HisTitle, zn);
00919    return zn!=0;
00920 }
00921 
00922 void TGo4Picture::SetTitleTime(Bool_t on)
00923 {
00924    SetOption(PictureIndex, op_TitleTime, on ? 1 : 0);
00925 }
00926 
00927 Bool_t TGo4Picture::IsTitleTime() const
00928 {
00929    Long_t zn = kTRUE;
00930    GetOption(PictureIndex, op_TitleTime, zn);
00931    return zn!=0;
00932 }
00933 
00934 void TGo4Picture::SetTitleDate(Bool_t on)
00935 {
00936    SetOption(PictureIndex, op_TitleDate, on ? 1 : 0);
00937 }
00938 
00939 Bool_t TGo4Picture::IsTitleDate() const
00940 {
00941    Long_t zn = kFALSE;
00942    GetOption(PictureIndex, op_TitleDate, zn);
00943    return zn!=0;
00944 }
00945 
00946 void TGo4Picture::SetTitleItem(Bool_t on)
00947 {
00948    SetOption(PictureIndex, op_TitleItem, on ? 1 : 0);
00949 }
00950 
00951 Bool_t TGo4Picture::IsTitleItem() const
00952 {
00953    Long_t zn = kFALSE;
00954    GetOption(PictureIndex, op_TitleItem, zn);
00955    return zn!=0;
00956 }
00957 
00958 void TGo4Picture::SetLegendDraw(bool on)
00959 {
00960    SetOption(PictureIndex, op_LegendDraw, on ? 1 : 0);
00961 }
00962 
00963 bool TGo4Picture::IsLegendDraw() const
00964 {
00965    Long_t zn = kTRUE;
00966    GetOption(PictureIndex, op_LegendDraw, zn);
00967    return zn!=0;
00968 }
00969 
00970 void TGo4Picture::SetCrosshair(bool on)
00971 {
00972    SetOption(PictureIndex, op_Crosshair, on ? 1 : 0);
00973 }
00974 
00975 bool TGo4Picture::IsCrosshair() const
00976 {
00977    Long_t zn = kFALSE;
00978    GetOption(PictureIndex, op_Crosshair, zn);
00979    return zn!=0;
00980 }
00981 
00982 void TGo4Picture::SetAutoScale(bool on)
00983 {
00984    SetOption(PictureIndex, op_AutoScale, on ? 1 : 0);
00985 }
00986 
00987 bool TGo4Picture::IsAutoScale() const
00988 {
00989    Long_t zn = kTRUE;
00990    GetOption(PictureIndex, op_AutoScale, zn);
00991    return zn!=0;
00992 }
00993 
00994 void TGo4Picture::SetSuperimpose(bool on)
00995 {
00996    SetOption(PictureIndex, op_Superimpose, on ? 1 : 0);
00997 }
00998 
00999 bool TGo4Picture::IsSuperimpose() const
01000 {
01001    Long_t zn = kFALSE;
01002    GetOption(PictureIndex, op_Superimpose, zn);
01003    return zn!=0;
01004 }
01005 
01006 void TGo4Picture::SetContentModified(bool on)
01007 {
01008    SetOption(PictureIndex, op_ContentModified, on ? 1 : 0);
01009 }
01010 
01011 bool TGo4Picture::IsContentModified() const
01012 {
01013    Long_t zn = kFALSE;
01014    GetOption(PictureIndex, op_ContentModified, zn);
01015    return zn!=0;
01016 }
01017 
01018 void TGo4Picture::SetPadModified(bool on)
01019 {
01020    SetOption(PictureIndex, op_PadModified, on ? 1 : 0);
01021 }
01022 
01023 bool TGo4Picture::IsPadModified() const
01024 {
01025    Long_t zn = kFALSE;
01026    GetOption(PictureIndex, op_PadModified, zn);
01027    return zn!=0;
01028 }
01029 
01030 void TGo4Picture::ChangeDrawOption(Int_t kind, Int_t value)
01031 {
01032    switch(kind) {
01033       case 0: break;
01034       case 1: break;
01035       case 2: break;
01036       case 3: SetLogScale(0, value); break;
01037       case 4: SetLogScale(1, value); break;
01038       case 5: SetLogScale(2, value); break;
01039       case 6: SetHisStats(value!=0); break;
01040       case 7: SetHisTitle(value!=0); break;
01041       case 8: SetLegendDraw(value!=0); break;
01042       case 9: SetCrosshair(value!=0); break;
01043       case 10: {
01044          Int_t numdim = GetFullRangeDim();
01045          SetAutoScale(value!=0);
01046          Double_t min, max;
01047          if (!IsAutoScale()) { // keep current selection if not autosacle
01048             if ((numdim==1) && !GetRange(1, min, max)) {
01049                GetFullRange(1, min, max);
01050                SetRange(1, min, max);
01051             } else
01052             if ((numdim==2) && !GetRange(1, min, max)) {
01053                GetFullRange(2, min, max);
01054                SetRange(2, min, max);
01055             }
01056          }
01057          break;
01058       }
01059       case 11: SetSuperimpose(value!=0); break;
01060       case 12: SetTitleTime(value!=0); break;
01061       case 13: SetTitleDate(value!=0); break;
01062       case 14: SetTitleItem(value!=0); break;
01063    }
01064    SetPadModified();
01065 }
01066 
01067 
01068 void TGo4Picture::SetFullRangeDim(Int_t ndim)
01069 {
01070    SetOption(PictureIndex, op_FullDim, ndim);
01071 }
01072 
01073 Int_t TGo4Picture::GetFullRangeDim() const
01074 {
01075    Long_t zn = 0;
01076    GetOption(PictureIndex, op_FullDim, zn);
01077    return zn;
01078 }
01079 
01080 void TGo4Picture::SetFullRange(Int_t naxis, Double_t min, Double_t max)
01081 {
01082    Int_t op;
01083    switch (naxis) {
01084       case 1: op = op_FullYMin; break;
01085       case 2: op = op_FullZMin; break;
01086       default: op = op_FullXMin; break;
01087    }
01088    SetOptionD(PictureIndex, op, min);
01089    SetOptionD(PictureIndex, op+1, max);
01090 }
01091 
01092 Bool_t TGo4Picture::GetFullRange(Int_t naxis, Double_t& min, Double_t& max)
01093 {
01094    Int_t op;
01095    switch (naxis) {
01096       case 1: op = op_FullYMin; break;
01097       case 2: op = op_FullZMin; break;
01098       default: op = op_FullXMin; break;
01099    }
01100    return GetOptionD(PictureIndex, op, min) && GetOptionD(PictureIndex, op+1, max);
01101 }
01102 
01103 void TGo4Picture::ClearFullRange(Int_t naxis)
01104 {
01105    if (naxis<0) {
01106      for(int n=0;n<3;n++)
01107        ClearFullRange(n);
01108      ClearOption(PictureIndex, op_FullDim);
01109    }
01110    Int_t op;
01111    switch (naxis) {
01112       case 1: op = op_FullYMin; break;
01113       case 2: op = op_FullZMin; break;
01114       default: op = op_FullXMin; break;
01115    }
01116    ClearOption(PictureIndex, op);
01117    ClearOption(PictureIndex, op+1);
01118 }
01119 
01120 void TGo4Picture::UpdateFrom(TGo4Picture* source, TClass* selectedobjclass)
01121 {
01122    if (source==0) return;
01123    Clear();
01124 
01125    SetName(source->GetName());
01126    SetTitle(source->GetTitle());
01127 
01128    fiNDivX = source->fiNDivX;
01129    fiNDivY = source->fiNDivY;
01130    fiPosX = source->fiPosX;
01131    fiPosY = source->fiPosY;
01132 
01133    for (Int_t n=0; n<source->GetNumObjNames();n++)
01134       AddObjName(source->GetObjName(n));
01135 
01136    if (source->GetSpecialObjects()!=0)
01137       fxSpecialObjects = (TList*) source->GetSpecialObjects()->Clone();
01138 
01139    CopyOptionsFrom(source);
01140 
01141    if (source->fxSubPictures!=0) {
01142      fxSubPictures = new TObjArray();
01143      fxSubPictures->SetOwner(kTRUE);
01144      for (Int_t n=0;n<=source->fxSubPictures->GetLast();n++) {
01145        TGo4Picture* sub = dynamic_cast<TGo4Picture*> (source->fxSubPictures->At(n));
01146        if (sub!=0) {
01147          TGo4Picture* newsub = new TGo4Picture;
01148          newsub->UpdateFrom(sub, selectedobjclass);
01149          fxSubPictures->Add(newsub);
01150        }
01151      }
01152    }
01153 }
01154 
01155 void TGo4Picture::CopyOptionsFrom(TGo4Picture* source)
01156 {
01157    fiOptSize = source->fiOptSize;
01158    source->fxOptIndex.Copy(fxOptIndex);
01159    source->fxOptValue.Copy(fxOptValue);
01160    if (fxOptObjects!=0) delete fxOptObjects;
01161    fxOptObjects = 0;
01162    if (source->fxOptObjects)
01163       fxOptObjects = (TObjArray*) source->fxOptObjects->Clone();
01164 }
01165 
01166 
01167 void TGo4Picture::Clear(Option_t* option)
01168 {
01169    fiNDivX = 1;
01170    fiNDivY = 1;
01171    fiPosX = 0;
01172    fiPosY = 0;
01173    if (fxNames!=0) { delete fxNames; fxNames = 0; }
01174    if (fxSubPictures!=0) { delete fxSubPictures; fxSubPictures = 0; }
01175    fiLastIndex = 0;
01176    fiOptSize = 0;
01177    fxOptIndex.Set(0);
01178    fxOptValue.Set(0);
01179    if (fxOptObjects!=0) { delete fxOptObjects; fxOptObjects = 0; }
01180 }
01181 
01182 Int_t TGo4Picture::FindOptPos(Short_t index, Short_t typ) const
01183 {
01184    Long_t zn = index + 1 + (typ << 16);
01185    for (Int_t i=0;i<fiOptSize;i++)
01186      if (fxOptIndex[i]==zn) return i;
01187    return -1;
01188 }
01189 
01190 Int_t TGo4Picture::ExtendOptPos(Short_t index, Short_t typ)
01191 {
01192    Long_t zn = index + 1 + (typ << 16);
01193    if (fxOptIndex.GetSize()==fiOptSize) {
01194      fxOptIndex.Set(fiOptSize+8);
01195      fxOptValue.Set(fiOptSize+8);
01196    }
01197    fxOptIndex[fiOptSize] = zn;
01198    fiOptSize++;
01199    return fiOptSize-1;
01200 }
01201 
01202 void TGo4Picture::SetOption(Short_t index, Short_t typ, Long_t value)
01203 {
01204    if (typ>=op_ObjsBound) return;
01205    Int_t pos = FindOptPos(index,typ);
01206    if (pos<0) pos = ExtendOptPos(index, typ);
01207    fxOptValue[pos] = value;
01208 }
01209 
01210 Bool_t TGo4Picture::GetOption(Short_t index, Short_t typ, Long_t& value) const
01211 {
01212    if (typ>=op_ObjsBound) return kFALSE;
01213    Int_t pos = FindOptPos(index,typ);
01214    if (pos<0) return kFALSE;
01215    value = fxOptValue[pos];
01216    return kTRUE;
01217 }
01218 
01219 Long_t TGo4Picture::GetI(Short_t index, Short_t typ, Long_t def) const
01220 {
01221    Long_t value = 0;
01222    if (!GetOption(index, typ, value)) return def;
01223    return value;
01224 }
01225 
01226 void TGo4Picture::SetOptionF(Short_t index, Short_t typ, Float_t value)
01227 {
01228    Long_t buf;
01229    if (sizeof(Long_t)==sizeof(Float_t))
01230       memcpy(&buf, &value, sizeof(Long_t));
01231    else {
01232       Double_t v(value);
01233       memcpy(&buf, &v, sizeof(Long_t));
01234    }
01235    SetOption(index, typ, buf);
01236 }
01237 
01238 Bool_t TGo4Picture::GetOptionF(Short_t index, Short_t typ, Float_t& value)
01239 {
01240    Long_t buf;
01241    Bool_t res = GetOption(index, typ, buf);
01242 
01243    if (res){
01244       if (sizeof(Long_t)==sizeof(Float_t))
01245          memcpy(&value, &buf, sizeof(Long_t));
01246       else {
01247          Double_t v;
01248          memcpy(&v, &buf, sizeof(Long_t));
01249          value = v;
01250       }
01251    }
01252    return res;
01253 }
01254 
01255 void TGo4Picture::SetOptionD(Short_t index, Short_t typ, Double_t value)
01256 {
01257    Long_t buf;
01258    if (sizeof(Long_t)==sizeof(Float_t))  {
01259       Float_t v(value);
01260       memcpy(&buf, &v, sizeof(Long_t));
01261    } else
01262       memcpy(&buf, &value, sizeof(Long_t));
01263    SetOption(index, typ, buf);
01264 }
01265 
01266 Bool_t TGo4Picture::GetOptionD(Short_t index, Short_t typ, Double_t& value)
01267 {
01268    Long_t buf;
01269    Bool_t res = GetOption(index, typ, buf);
01270 
01271    if (res){
01272       if (sizeof(Long_t)==sizeof(Float_t)) {
01273          Float_t v;
01274          memcpy(&v, &buf, sizeof(Long_t));
01275          value = v;
01276       } else
01277          memcpy(&value, &buf, sizeof(Long_t));
01278    }
01279    return res;
01280 }
01281 
01282 Double_t TGo4Picture::GetD(Short_t index, Short_t typ, Double_t def)
01283 {
01284    Double_t value;
01285    if (!GetOptionD(index, typ, value)) return def;
01286    return value;
01287 }
01288 
01289 
01290 void TGo4Picture::SetObjOption(Short_t index, Short_t typ, TObject* obj)
01291 {
01292    if (obj==0) return;
01293    if (typ<op_ObjsBound) { delete obj; return; }
01294    Int_t pos = FindOptPos(index, typ);
01295    if (pos>=0) {
01296      TObject* old = fxOptObjects->RemoveAt(fxOptValue[pos]);
01297      delete old;
01298      fxOptObjects->AddAt(obj, fxOptValue[pos]);
01299    } else {
01300      pos = ExtendOptPos(index, typ);
01301      if (fxOptObjects==0) {
01302         fxOptObjects = new TObjArray();
01303         fxOptObjects->SetOwner(kTRUE);
01304      }
01305      fxOptObjects->Add(obj);
01306      fxOptValue[pos] = fxOptObjects->GetLast();
01307    }
01308 }
01309 
01310 TObject* TGo4Picture::GetObjOption(Short_t index, Short_t typ)
01311 {
01312    if (typ<op_ObjsBound) return 0;
01313    Int_t pos = FindOptPos(index, typ);
01314    if (pos<0) return 0;
01315    return fxOptObjects->At(fxOptValue[pos]);
01316 }
01317 
01318 void TGo4Picture::SetStrOption(Short_t index, Short_t typ, const char* value)
01319 {
01320   if (value==0) return;
01321   SetObjOption(index, typ, new TObjString(value));
01322 }
01323 
01324 const char* TGo4Picture::GetStrOption(Short_t index, Short_t typ, const char* defvalue)
01325 {
01326   TObjString* ostr = dynamic_cast<TObjString*> (GetObjOption(index, typ));
01327   if (ostr==0) return defvalue;
01328   return ostr->String().Data();
01329 }
01330 
01331 void TGo4Picture::SetDrawOption(Option_t* option, Int_t index)
01332 {
01333    CheckIndex(index);
01334    if (option==0) ClearOption(index, op_Draw);
01335              else SetStrOption(index, op_Draw, option);
01336 }
01337 
01338 Option_t* TGo4Picture::GetDrawOption(Int_t index)
01339 {
01340    CheckIndex(index);
01341    return (Option_t*) GetStrOption(index, op_Draw);
01342 }
01343 
01344 void TGo4Picture::SetStyle(TStyle* style, Int_t index)
01345 {
01346    if (style==0) return;
01347    CheckIndex(index);
01348    SetObjOption(index, op_Style, new TStyle(*style));
01349 }
01350 
01351 TStyle* TGo4Picture::FindStyle(Int_t index)
01352 {
01353    CheckIndex(index);
01354    Int_t pos = FindOptPos(index, op_Style);
01355    if (pos<0) return 0;
01356    return dynamic_cast<TStyle*> (GetObjOption(index, op_Style));
01357 }
01358 
01359 TStyle* TGo4Picture::GetStyle(Int_t index)
01360 {
01361    CheckIndex(index);
01362    TStyle* style = FindStyle(index);
01363    if (style==0) {
01364      style = new TStyle(*gStyle);
01365      SetObjOption(index, op_Style, style);
01366    }
01367    return style;
01368 }
01369 
01370 void TGo4Picture::ClearOption(Short_t index, Short_t typ)
01371 {
01372   ClearOption(FindOptPos(index,typ));
01373 }
01374 
01375 void TGo4Picture::ClearOption(Int_t pos)
01376 {
01377   if (pos<0) return;
01378   Int_t bnd = op_ObjsBound << 16;
01379 
01380   if (fxOptIndex[pos]>=bnd) {
01381     for (Int_t i=0;i<fiOptSize;i++)
01382       if (fxOptIndex[i]>=bnd)
01383         if (fxOptValue[i]>fxOptValue[pos]) fxOptValue[i]-=1;
01384     TObject* obj = fxOptObjects->RemoveAt(fxOptValue[pos]);
01385     delete obj;
01386     fxOptObjects->Compress();
01387     if (fxOptObjects->GetLast()<0) {
01388        delete fxOptObjects;
01389        fxOptObjects = 0;
01390     }
01391   }
01392 
01393   for (Int_t i=pos;i<fiOptSize-1;i++) {
01394     fxOptIndex[i] = fxOptIndex[i+1];
01395     fxOptValue[i] = fxOptValue[i+1];
01396   }
01397   fiOptSize--;
01398 }
01399 
01400 void TGo4Picture::CheckIndex(Int_t& index)
01401 {
01402   if(index==UndefIndex){
01403     if (fiLastIndex>=PictureIndex) index = fiLastIndex;
01404                               else index = PictureIndex;
01405   }
01406 }
01407 
01408 void TGo4Picture::ClearAllOptions(Short_t index)
01409 {
01410   if (index<0) {
01411      fxOptIndex.Set(0);
01412      fxOptValue.Set(0);
01413      if (fxOptObjects) {
01414        delete fxOptObjects;
01415        fxOptObjects = 0;
01416     }
01417   } else {
01418      Int_t pos = 0;
01419      while (pos<fiOptSize)
01420        if ((fxOptIndex[pos] & 0x7fff)==index+1) ClearOption(pos);
01421                                            else pos++;
01422   }
01423 }
01424 
01425 Int_t TGo4Picture::GetObjAttIndex(TObject* obj)
01426 {
01427    if (obj==0) return UndefIndex;
01428    for (Int_t n=0;n<GetNumObjNames();n++)
01429      if (strcmp(GetObjName(n),obj->GetName())==0) return n;
01430    return UndefIndex;
01431 }
01432 
01433 void TGo4Picture::DrawPic(TVirtualPad* pad)
01434 {
01435    if (pad==0) return;
01436    double txt_y = 0.9;
01437    if (IsDivided()) {
01438      pad->Divide(GetDivX(), GetDivY());
01439      for(Int_t posx=0; posx<GetDivX(); posx++)
01440        for(Int_t posy=0; posy<GetDivY(); posy++) {
01441            TGo4Picture* sub = FindPic(posy,posx);
01442            if (sub) sub->DrawPic(pad->GetPad(posy*GetDivX() + posx + 1));
01443        }
01444    } else
01445    for (Int_t indx=0;indx<GetNumObjNames();indx++) {
01446       TString str = "Obj: ";
01447       str += GetObjName(indx);
01448       const char* opt = GetDrawOption(indx);
01449       if ((opt==0) && (indx==0))
01450         opt = GetDrawOption(PictureIndex);
01451       if (opt!=0) {
01452          str += "  Opt: ";
01453          str += opt;
01454       }
01455       TText* txt = new TText(0.1, txt_y, str.Data());
01456       pad->cd();
01457       txt->Draw();
01458       if (GetNumObjNames()<8) txt_y -= 0.1;
01459                          else txt_y -= 0.8/GetNumObjNames();
01460    }
01461 }
01462 
01463 void TGo4Picture::Draw(Option_t* option)
01464 {
01465    TCanvas* c = 0;
01466    if (gPad==0) {
01467       c = new TCanvas();
01468       c->cd();
01469    } else {
01470       c = gPad->GetCanvas();
01471       c->Clear();
01472       c->cd();
01473    }
01474    if (c==0) return;
01475 
01476    if (IsDrawHeader()) {
01477       TString txt = c->GetName();
01478       txt += "  Pic: ";
01479       txt += GetName();
01480       if (strcmp(GetName(), GetTitle())!=0) {
01481          txt += "  Title: ";
01482          txt += GetTitle();
01483       }
01484       c->SetTitle(txt.Data());
01485    }
01486 
01487    DrawPic(c);
01488 }
01489 
01490 void TGo4Picture::PrintPic(int shift, Bool_t showopt)
01491 {
01492    for (int n=0;n<shift;n++) cout << ' ';
01493    if (IsDivided()) {
01494       cout << "Divided numx:" << GetDivX() << "  numy:" << GetDivY() << endl;
01495       for(Int_t posx=0; posx<GetDivX(); posx++)
01496          for(Int_t posy=0; posy<GetDivY(); posy++) {
01497             for (int n=0;n<shift+2;n++) cout << ' ';
01498             cout << "subpic x:" << posx << " y:" << posy << endl;
01499             TGo4Picture* sub = FindPic(posy,posx);
01500             if (sub) sub->PrintPic(shift+4, showopt);
01501          }
01502    } else {
01503       cout << "Objects:" << endl;
01504       for (Int_t num=0; num<GetNumObjNames(); num++) {
01505         const char* objname = GetObjName(num);
01506         for (int n=0;n<shift+2;n++) cout << ' ';
01507         cout << objname;
01508 
01509         Option_t* drawopt = GetDrawOption(num);
01510         if (drawopt) cout << "   opt: " << drawopt;
01511         cout << endl;
01512       }
01513       if (!showopt) return;
01514       for (int n=0;n<shift;n++) cout << ' ';
01515       cout << "Options:" << endl;
01516       for (Int_t nop=0;nop<fiOptSize;nop++) {
01517          Int_t indx = (fxOptIndex[nop] & 0x00ff);
01518          Int_t op = fxOptIndex[nop] >> 16;
01519          for (int n=0;n<shift+2;n++) cout << ' ';
01520          cout << indx << "  " << op << "  " << fxOptValue[nop] << endl;
01521       }
01522    }
01523 }
01524 
01525 void TGo4Picture::Print(Option_t* option) const
01526 {
01527    cout << "Picture  " << GetName() << endl;
01528    ((TGo4Picture*)this)->PrintPic(2, (strstr(option,"attr")!=0));
01529 }
01530 
01531 void TGo4Picture::AddSubPicture(TGo4Picture* pic)
01532 {
01533    if (pic == 0) return;
01534    if (fxSubPictures==0) {
01535       fxSubPictures = new TObjArray();
01536       fxSubPictures->SetOwner(kTRUE);
01537    }
01538    fxSubPictures->Add(pic);
01539 }
01540 
01541 void TGo4Picture::AddSpecialObject(TObject* obj, Option_t* drawopt)
01542 {
01543    if (fxSpecialObjects==0) {
01544       fxSpecialObjects = new TList;
01545       fxSpecialObjects->SetOwner(kTRUE);
01546    }
01547 
01548    fxSpecialObjects->Add(obj, drawopt);
01549 }
01550 
01551 void TGo4Picture::AddSpecialObjectXml(const char* xmlcode, Option_t* drawopt)
01552 {
01553    #if ROOT_VERSION_CODE > ROOT_VERSION(5,9,0)
01554    TObject* obj = TBufferXML::ConvertFromXML(xmlcode);
01555    if (obj!=0) AddSpecialObject(obj, drawopt);
01556    #endif
01557 }
01558 
01559 #if ROOT_VERSION_CODE > ROOT_VERSION(5,11,6)
01560 void TGo4Picture::SavePrimitive(ostream& fs, Option_t*)
01561 #else
01562 void TGo4Picture::SavePrimitive(ofstream& fs, Option_t*)
01563 #endif
01564 {
01565    fs << "TGo4Picture *" << GetName() << " = new TGo4Picture(\"" << GetName()
01566       << "\", \"" << GetTitle() << "\");" << endl;
01567    TString name = GetName();
01568    name+="->";
01569 
01570    fs << name << "SetCrosshair(" << (IsCrosshair() ? "true" : "false") << ");" << endl;
01571 
01572    MakeScript(fs, name.Data());
01573 }
01574 
01575 void TGo4Picture::MakeAxisScript(ostream& fs, const char* name, Int_t index, Int_t naxis)
01576 {
01577    if ((naxis<0) || (naxis>2)) return;
01578    const char* axisname = "X";
01579    Int_t op = op_AxisX;
01580    if (naxis==1) { op = op_AxisY; axisname = "Y"; } else
01581    if (naxis==2) { op = op_AxisZ; axisname = "Z"; }
01582 
01583    Long_t lv;
01584    Float_t fv;
01585    if (!GetOption (index, op+0, lv)) return;
01586 
01587    fs << name << "SetAxisAtt(" << naxis << ", ";
01588    fs << lv << ", ";
01589    if (!GetOption (index, op+1, lv)) lv = gStyle->GetLabelColor(axisname);
01590    fs << lv << ", ";
01591    if (!GetOption (index, op+2, lv)) lv = gStyle->GetLabelFont(axisname);
01592    fs << lv << ", ";
01593    if (!GetOptionF(index, op+3, fv)) fv = gStyle->GetLabelOffset(axisname);
01594    fs << fv << ", ";
01595    if (!GetOptionF(index, op+4, fv)) fv = gStyle->GetLabelSize(axisname);
01596    fs << fv << ", ";
01597    if (!GetOption (index, op+5, lv)) lv = gStyle->GetNdivisions(axisname);
01598    fs << lv << ", ";
01599    if (!GetOptionF(index, op+6, fv)) fv = gStyle->GetTickLength(axisname);
01600    fs << fv << ", ";
01601    if (!GetOption (index, op+7, lv)) lv = gStyle->GetTitleColor(axisname);
01602    fs << lv << ", ";
01603    if (!GetOption (index, op+8, lv)) lv = gStyle->GetTitleFont(axisname);
01604    fs << lv << ", ";
01605    if (!GetOptionF(index, op+9, fv)) fv = gStyle->GetTitleOffset(axisname);
01606    fs << fv << ", ";
01607    if (!GetOptionF(index, op+10, fv)) fv = gStyle->GetTitleSize(axisname);
01608    fs << fv << ", ";
01609 
01610    if (GetOption (index, op+11, lv)) {
01611       if ((lv & 1) != 0) fs << "kTRUE, ";
01612                     else fs << "kFALSE, ";
01613       TString ticks;
01614       if ((lv & 2) != 0) ticks+="+";
01615       if ((lv & 4) != 0) ticks+="-";
01616       fs << "\"" << ticks <<"\", ";
01617       fs << (lv & 0x0ff0) << ", ";
01618    } else
01619       fs << "kTRUE, \"+\", 0, ";
01620 
01621    fs << index << ");" << endl;
01622 }
01623 
01624 void TGo4Picture::MakeScript(ostream& fs, const char* name)
01625 {
01626    for(Int_t naxis=0;naxis<3;naxis++)
01627      if (GetLogScale(naxis)>0)
01628        fs << name << "SetLogScale(" << naxis << ", 1);" << endl;
01629 
01630    Double_t min, max;
01631    if (GetRangeX(min, max))
01632      fs << name << "SetRangeX(" << min << ", " << max << ");" << endl;
01633    if (GetRangeY(min, max))
01634      fs << name << "SetRangeY(" << min << ", " << max << ");" << endl;
01635    if (GetRangeZ(min, max))
01636      fs << name << "SetRangeZ(" << min << ", " << max << ");" << endl;
01637 
01638    TAttLine latt;
01639    TAttFill fatt;
01640    TAttMarker matt;
01641 
01642    if (GetLineAtt(&latt,PictureIndex))
01643      fs << name << "SetLineAtt("
01644         << latt.GetLineColor() << ", "
01645         << latt.GetLineStyle() << ", "
01646         << latt.GetLineWidth() << ", " << PictureIndex << ");" << endl;
01647    if (GetFillAtt(&fatt, PictureIndex))
01648       fs << name << "SetFillAtt("
01649          << fatt.GetFillColor() << ", "
01650          << fatt.GetFillStyle() << ", " << PictureIndex << ");" << endl;
01651    if (GetMarkerAtt(&matt, PictureIndex))
01652       fs << name << "SetMarkerAtt("
01653          << matt.GetMarkerColor() << ", "
01654          << matt.GetMarkerSize() << ", "
01655          << matt.GetMarkerStyle()<< ", " << PictureIndex << ");" << endl;
01656 
01657    fs << name << "SetHisStats(" << (IsHisStats() ? "true" : "false") << ");" << endl;
01658 
01659    if (IsHisStats()) {
01660      fs << name << "SetStatsAttr("
01661         << GetD(PictureIndex, op_HisStatsX1, gStyle->GetStatX()-gStyle->GetStatW()) << ", "
01662         << GetD(PictureIndex, op_HisStatsY1, gStyle->GetStatY()-gStyle->GetStatH()) << ", "
01663         << GetD(PictureIndex, op_HisStatsX2, gStyle->GetStatX()) << ", "
01664         << GetD(PictureIndex, op_HisStatsY2, gStyle->GetStatY()) << ", "
01665         << GetI(PictureIndex, op_HisStatsOpt, 1111) << ", \""
01666         << GetStrOption(PictureIndex, op_HisStatsOptF, "6.4g") << "\", "
01667         << GetI(PictureIndex, op_HisStatsFit, 111) << ", \""
01668         << GetStrOption(PictureIndex, op_HisStatsFitF, "5.4g") << "\");" << endl;
01669    }
01670 
01671    fs << name << "SetHisTitle(" << (IsHisTitle() ? "true" : "false") << ");" << endl;
01672 
01673    fs << name << "SetAutoScale(" << (IsAutoScale() ? "true" : "false") << ");" << endl;
01674 
01675    if (IsSuperimpose()) {
01676       fs << name << "SetSuperimpose(true);" << endl;
01677       fs << name << "SetLegendDraw(" << (IsLegendDraw() ? "true" : "false") << ");" << endl;
01678    }
01679 
01680    Long_t lv;
01681    Double_t dv;
01682    fs << name << "SetPadAtt(";
01683    if (!GetOption (PictureIndex, op_Pad+ 0, lv)) lv = gStyle->GetPadBorderMode();
01684    fs << lv << ", ";
01685    if (!GetOption (PictureIndex, op_Pad+ 1, lv)) lv = gStyle->GetPadBorderSize();
01686    fs << lv << ", ";
01687    if (!GetOption (PictureIndex, op_Pad+ 2, lv)) lv = gStyle->GetPadGridX();
01688    fs << lv << ", ";
01689    if (!GetOption (PictureIndex, op_Pad+ 3, lv)) lv = gStyle->GetPadGridY();
01690    fs << lv << ", ";
01691    if (!GetOptionD(PictureIndex, op_Pad+ 4, dv)) dv = 0.;
01692    fs << dv << ", ";
01693    if (!GetOptionD(PictureIndex, op_Pad+ 5, dv)) dv = 0.;
01694    fs << dv << ", ";
01695    if (!GetOption (PictureIndex, op_Pad+ 6, lv)) lv = gStyle->GetPadTickX();
01696    fs << lv << ", ";
01697    if (!GetOption (PictureIndex, op_Pad+ 7, lv)) lv = gStyle->GetPadTickY();
01698    fs << lv << ");" << endl;
01699 
01700    const char* drawopt = GetDrawOption(PictureIndex);
01701    if (drawopt!=0)
01702       fs << name << "SetDrawOption(\"" << drawopt << "\", " << PictureIndex << ");" << endl;
01703 
01704    for(Int_t indx=0;indx<GetNumObjNames();indx++) {
01705       const char* objname = GetObjName(indx);
01706       const char* objopt = GetDrawOption(indx);
01707 
01708       fs << name << "AddObjName(\"" << objname << "\"";
01709       if (objopt!=0) fs << ", \"" << objopt << "\"";
01710       fs << ");" << endl;
01711       if (GetLineAtt(&latt,indx))
01712         fs << name << "SetLineAtt("
01713            << latt.GetLineColor() << ", "
01714            << latt.GetLineStyle() << ", "
01715            << latt.GetLineWidth() << ", " << indx << ");" << endl;
01716       if (GetFillAtt(&fatt, indx))
01717          fs << name << "SetFillAtt("
01718             << fatt.GetFillColor() << ", "
01719             << fatt.GetFillStyle() << ", " << indx << ");" << endl;
01720       if (GetMarkerAtt(&matt, indx))
01721          fs << name << "SetMarkerAtt("
01722             << matt.GetMarkerColor() << ", "
01723             << matt.GetMarkerSize() << ", "
01724             << matt.GetMarkerStyle() << ", " << indx << ");" << endl;
01725 
01726       MakeAxisScript(fs, name, indx, 0);
01727       MakeAxisScript(fs, name, indx, 1);
01728       MakeAxisScript(fs, name, indx, 2);
01729 
01730       if (GetRebinX(indx)>0)
01731          fs << name << "SetRebinX(" << GetRebinX(indx) << ", " << indx << ");" << endl;
01732 
01733       if (GetRebinY(indx)>0)
01734          fs << name << "SetRebinY(" << GetRebinY(indx) << ", " << indx << ");" << endl;
01735    }
01736 
01737    #if ROOT_VERSION_CODE > ROOT_VERSION(5,9,0)
01738    TListIter iter(fxSpecialObjects);
01739    TObject* obj = 0;
01740    while ((obj=iter())!=0) {
01741 
01742       TString xmlbuf = TBufferXML::ConvertToXML(obj);
01743 
01744       TString buf = xmlbuf;
01745       Int_t len = 0;
01746       do {
01747         len = buf.Length();
01748         buf.ReplaceAll("\n ","\n");
01749       } while (len!=buf.Length());
01750 
01751       buf.ReplaceAll("\n"," ");
01752       buf.ReplaceAll("\"","\\\"");
01753 
01754       buf.Prepend("\"");
01755       buf.Append("\"");
01756 
01757       if (buf.Length()>950) {
01758          fs << "TString sbuf = \"\";" << endl;
01759          const char* pos = xmlbuf.Data();
01760          while (*pos!=0) {
01761             const char* lastpos = pos;
01762             while ((*pos !=0) && (*pos!='\n')) pos++;
01763             TString subbuf(lastpos, pos-lastpos);
01764             subbuf.ReplaceAll("\"","\\\"");
01765             fs << "TGo4Picture::Add(sbuf,\"" << subbuf << "\");" << endl;
01766             if (*pos==0) break;
01767             pos++;
01768          }
01769          buf = "sbuf";
01770       }
01771 
01772       fs << name << "AddSpecialObjectXml(" << buf;
01773 
01774       Option_t* opt = iter.GetOption();
01775 
01776       if ((opt!=0) && (*opt!=0))
01777          fs << ", \"" << opt << "\"";
01778       fs << ");" << endl;
01779    }
01780    #endif
01781 
01782    if (IsDivided()) {
01783       fs << name << "SetDivision(" << GetDivY() << ", " << GetDivX() << ");" << endl;
01784       for(int ny=0;ny<GetDivY();ny++)
01785         for(int nx=0;nx<GetDivX();nx++) {
01786            TString subname = name;
01787            subname+="Pic(";
01788            subname+=ny;
01789            subname+=",";
01790            subname+=nx;
01791            subname+=")->";
01792            Pic(ny,nx)->MakeScript(fs, subname.Data());
01793         }
01794    }
01795 }
01796 
01797 
01798 
01799 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:29 2008 for Go4-v3.04-1 by  doxygen 1.4.2