TGeoPconEditor.cxx

Go to the documentation of this file.
00001 // @(#):$Id: TGeoPconEditor.cxx 36535 2010-11-08 14:41:54Z agheata $
00002 // Author: M.Gheata 
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 //////////////////////////////////////////////////////////////////////////
00013 //                                                                      //
00014 //  TGeoPconEditor                                                      //
00015 //                                                                      //
00016 //////////////////////////////////////////////////////////////////////////
00017 //Begin_Html
00018 /*
00019 <img src="gif/pcon_pic.gif">
00020 */
00021 //End_Html
00022 //Begin_Html
00023 /*
00024 <img src="gif/pcon_ed.jpg">
00025 */
00026 //End_Html
00027 
00028 #include "TGeoPconEditor.h"
00029 #include "TGeoTabManager.h"
00030 #include "TGeoPcon.h"
00031 #include "TGeoManager.h"
00032 #include "TVirtualGeoPainter.h"
00033 #include "TPad.h"
00034 #include "TView.h"
00035 #include "TGTab.h"
00036 #include "TGComboBox.h"
00037 #include "TGButton.h"
00038 #include "TGTextEntry.h"
00039 #include "TGNumberEntry.h"
00040 #include "TGLabel.h"
00041 
00042 ClassImp(TGeoPconEditor)
00043 
00044 enum ETGeoPconWid {
00045    kPCON_NAME, kPCON_NZ, kPCON_PHI1, kPCON_DPHI, kPCON_APPLY, kPCON_UNDO
00046 };
00047 
00048 //______________________________________________________________________________
00049 TGeoPconEditor::TGeoPconEditor(const TGWindow *p, Int_t width,
00050                                    Int_t height, UInt_t options, Pixel_t back)
00051    : TGeoGedFrame(p, width, height, options | kVerticalFrame, back)
00052 {
00053    // Constructor for polycone editor
00054    fShape   = 0;
00055    fNsections = 0;
00056    fSections = 0;
00057    fNsecti = 0;
00058    fPhi1i = 0;
00059    fDPhii = 0;
00060    fZi = 0;
00061    fRmini = 0;
00062    fRmaxi = 0;
00063    fIsModified = kFALSE;
00064    fIsShapeEditable = kFALSE;
00065 
00066    fLHsect = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0,0,2,2);
00067       
00068    // TextEntry for shape name
00069    MakeTitle("Name");
00070    fShapeName = new TGTextEntry(this, new TGTextBuffer(50), kPCON_NAME);
00071    fShapeName->Resize(135, fShapeName->GetDefaultHeight());
00072    fShapeName->SetToolTipText("Enter the polycone name");
00073    fShapeName->Associate(this);
00074    AddFrame(fShapeName, new TGLayoutHints(kLHintsLeft, 3, 1, 2, 5));
00075 
00076    MakeTitle("Parameters");
00077    // Number entry for Nsections
00078    TGTextEntry *nef;
00079    TGCompositeFrame *f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
00080    f1->AddFrame(new TGLabel(f1, "Nz"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00081    fENz = new TGNumberEntry(f1, 0., 5, kPCON_NZ);
00082    fENz->SetNumAttr(TGNumberFormat::kNEAPositive);
00083    fENz->SetNumStyle(TGNumberFormat::kNESInteger);
00084    fENz->Resize(100,fENz->GetDefaultHeight());
00085    nef = (TGTextEntry*)fENz->GetNumberEntry();
00086    nef->SetToolTipText("Enter the  number of Z sections");
00087    fENz->Associate(this);
00088    f1->AddFrame(fENz, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00089    AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
00090    
00091    // Number entry for Phi1
00092    f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
00093    f1->AddFrame(new TGLabel(f1, "Phi1"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00094    fEPhi1 = new TGNumberEntry(f1, 0., 5, kPCON_PHI1);
00095    fEPhi1->Resize(100,fEPhi1->GetDefaultHeight());
00096    nef = (TGTextEntry*)fEPhi1->GetNumberEntry();
00097    nef->SetToolTipText("Enter the starting phi angle [deg]");
00098    fEPhi1->Associate(this);
00099    f1->AddFrame(fEPhi1, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00100    AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
00101 
00102    // Number entry for Dphi
00103    f1 = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
00104    f1->AddFrame(new TGLabel(f1, "Dphi"), new TGLayoutHints(kLHintsLeft, 1, 1, 6, 0));
00105    fEDPhi = new TGNumberEntry(f1, 0., 5, kPCON_DPHI);
00106    fEDPhi->SetNumAttr(TGNumberFormat::kNEAPositive);
00107    fEDPhi->Resize(100,fEDPhi->GetDefaultHeight());
00108    nef = (TGTextEntry*)fEDPhi->GetNumberEntry();
00109    nef->SetToolTipText("Enter the phi range [deg]");
00110    fEDPhi->Associate(this);
00111    f1->AddFrame(fEDPhi, new TGLayoutHints(kLHintsRight, 2, 2, 2, 2));
00112    AddFrame(f1, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
00113 
00114    // TGCanvas containing sections
00115    MakeTitle("Pcon sections");
00116    fCan = new TGCanvas(this, 160, 200,  kSunkenFrame | kDoubleBorder);
00117    TGCompositeFrame *cont = new TGCompositeFrame(fCan->GetViewPort(), 155, 20, kVerticalFrame | kFixedWidth);
00118    fCan->SetContainer(cont);
00119    // labels for #i, Z, Rmin, Rmax
00120    f1 = new TGCompositeFrame(cont, 160, 10, kHorizontalFrame | kFixedWidth);
00121    f1->AddFrame(new TGLabel(f1, "#"), new TGLayoutHints(kLHintsLeft, 2, 20, 6, 0));
00122    f1->AddFrame(new TGLabel(f1, "Z"), new TGLayoutHints(kLHintsLeft, 2, 20, 6, 0));
00123    f1->AddFrame(new TGLabel(f1, "Rmin"), new TGLayoutHints(kLHintsLeft, 2, 20, 6, 0));
00124    f1->AddFrame(new TGLabel(f1, "Rmax"), new TGLayoutHints(kLHintsLeft, 2, 10, 6, 0));
00125    cont->AddFrame(f1, new TGLayoutHints(kLHintsLeft, 0,0,0,0));
00126    CreateSections(2);
00127 
00128    AddFrame(fCan, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 4));
00129       
00130    // Delayed draw
00131    fDFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth | kSunkenFrame);
00132    fDelayed = new TGCheckButton(fDFrame, "Delayed draw");
00133    fDFrame->AddFrame(fDelayed, new TGLayoutHints(kLHintsLeft , 2, 2, 4, 4));
00134    AddFrame(fDFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
00135 
00136    // Buttons
00137    fBFrame = new TGCompositeFrame(this, 155, 10, kHorizontalFrame | kFixedWidth);
00138    fApply = new TGTextButton(fBFrame, "Apply");
00139    fBFrame->AddFrame(fApply, new TGLayoutHints(kLHintsLeft, 2, 2, 4, 4));
00140    fApply->Associate(this);
00141    fUndo = new TGTextButton(fBFrame, "Undo");
00142    fBFrame->AddFrame(fUndo, new TGLayoutHints(kLHintsRight , 2, 2, 4, 4));
00143    fUndo->Associate(this);
00144    AddFrame(fBFrame,  new TGLayoutHints(kLHintsLeft, 6, 6, 4, 4));  
00145    fUndo->SetSize(fApply->GetSize());
00146 }
00147 
00148 //______________________________________________________________________________
00149 TGeoPconEditor::~TGeoPconEditor()
00150 {
00151 // Destructor
00152    if (fSections) delete fSections;
00153    if (fZi) delete [] fZi;
00154    if (fRmini) delete [] fRmini;
00155    if (fRmaxi) delete [] fRmaxi;
00156    TGFrameElement *el;
00157    TIter next(GetList());
00158    while ((el = (TGFrameElement *)next())) {
00159       if (el->fFrame->IsComposite()) 
00160          TGeoTabManager::Cleanup((TGCompositeFrame*)el->fFrame);
00161    }
00162    Cleanup();   
00163 }
00164 
00165 //______________________________________________________________________________
00166 void TGeoPconEditor::ConnectSignals2Slots()
00167 {
00168    // Connect signals to slots.
00169    fENz->Connect("ValueSet(Long_t)", "TGeoPconEditor", this, "DoNz()");
00170    fEPhi1->Connect("ValueSet(Long_t)", "TGeoPconEditor", this, "DoPhi()");
00171    fEDPhi->Connect("ValueSet(Long_t)", "TGeoPconEditor", this, "DoPhi()");
00172    fApply->Connect("Clicked()", "TGeoPconEditor", this, "DoApply()");
00173    fUndo->Connect("Clicked()", "TGeoPconEditor", this, "DoUndo()");
00174    fShapeName->Connect("TextChanged(const char *)", "TGeoPconEditor", this, "DoModified()");
00175    fInit = kFALSE;
00176 }
00177 
00178 
00179 //______________________________________________________________________________
00180 void TGeoPconEditor::SetModel(TObject* obj)
00181 {
00182    // Connect to a given pcon.
00183    if (obj == 0 || (obj->IsA() != TGeoPcon::Class())) {
00184       SetActive(kFALSE);
00185       return;                 
00186    } 
00187    fShape = (TGeoPcon*)obj;
00188    const char *sname = fShape->GetName();
00189    if (!strcmp(sname, fShape->ClassName())) fShapeName->SetText("-no_name");
00190    else fShapeName->SetText(sname);
00191 
00192    Int_t nsections = fShape->GetNz();
00193    fNsecti = nsections;
00194    fENz->SetNumber(nsections);
00195    fEPhi1->SetNumber(fShape->GetPhi1());
00196    fPhi1i = fShape->GetPhi1();
00197    fEDPhi->SetNumber(fShape->GetDphi());
00198    fDPhii = fShape->GetDphi();
00199    CreateSections(nsections);
00200    UpdateSections();
00201    
00202    fApply->SetEnabled(kFALSE);
00203    fUndo->SetEnabled(kFALSE);
00204    
00205    if (fInit) ConnectSignals2Slots();
00206    SetActive();
00207 }
00208 
00209 //______________________________________________________________________________
00210 void TGeoPconEditor::CreateSections(Int_t inew)
00211 {
00212 // Change dynamically the number of sections.
00213    if (inew == fNsections) return;
00214    if (!fSections) fSections = new TObjArray(8);
00215    TGCompositeFrame *cont = (TGCompositeFrame*)fCan->GetContainer();
00216    TGeoPconSection *sect;
00217    Int_t isect;
00218    // new sections requested
00219    if (inew>fNsections) {
00220       for (isect=fNsections; isect<inew; isect++) {
00221          sect = new TGeoPconSection(cont, 150, 10, isect);
00222          fSections->Add(sect);
00223          cont->AddFrame(sect, fLHsect);
00224          sect->Connect("Changed(Int_t)", "TGeoPconEditor", this, "DoSectionChange(Int_t)");
00225       }   
00226    } else {
00227    // some sections need to be removed
00228       for (isect=inew; isect<fNsections; isect++) {
00229          sect = (TGeoPconSection*)fSections->At(isect);
00230          sect->HideDaughters();
00231          cont->HideFrame(sect);
00232          cont->RemoveFrame(sect);
00233 //         sect->Disconnect("Changed(Int_t)", "TGeoPconEditor", this, "DoSectionChange(Int_t)");
00234          fSections->RemoveAt(isect);
00235          delete sect;
00236       }
00237    }   
00238    fNsections = inew;
00239    fCan->MapSubwindows();
00240    cont->Layout();
00241    cont->MapWindow();
00242    fCan->Layout();
00243 }         
00244 
00245 //______________________________________________________________________________
00246 Bool_t TGeoPconEditor::CheckSections(Bool_t change)
00247 {
00248 // Check validity of sections
00249    TGeoPconSection *sect;
00250    Double_t zmin = 0;
00251    Double_t rmin = 0, rmax = 1.;
00252    for (Int_t isect=0; isect<fNsections; isect++) {
00253       sect = (TGeoPconSection*)fSections->At(isect);
00254       if (isect && (sect->GetZ()<zmin)) {
00255          if (!change) return kFALSE;
00256          sect->SetZ(zmin+1.);
00257       }   
00258       zmin = sect->GetZ();
00259       if (sect->GetRmin()<0 ||
00260           (sect->GetRmax()<0) || ((sect->GetRmin()==0) && (sect->GetRmax()==0))) {
00261          if (!change) return kFALSE;
00262          sect->SetRmin(rmin);
00263          sect->SetRmax(rmax);
00264       }   
00265       rmin = sect->GetRmin();
00266       rmax = sect->GetRmax();
00267    }
00268    return kTRUE;   
00269 }
00270       
00271 //______________________________________________________________________________
00272 void TGeoPconEditor::UpdateSections()
00273 {
00274 // Update sections according fShape.
00275    if (fZi) delete [] fZi;
00276    if (fRmini) delete [] fRmini;
00277    if (fRmaxi) delete [] fRmaxi;
00278    fZi = new Double_t[fNsections];
00279    fRmini = new Double_t[fNsections];
00280    fRmaxi = new Double_t[fNsections];
00281    TGeoPconSection *sect;
00282    for (Int_t isect=0; isect<fNsections; isect++) {
00283       sect = (TGeoPconSection*)fSections->At(isect);
00284       sect->SetZ(fShape->GetZ(isect));
00285       fZi[isect] = fShape->GetZ(isect);
00286       sect->SetRmin(fShape->GetRmin(isect));
00287       fRmini[isect] = fShape->GetRmin(isect);
00288       sect->SetRmax(fShape->GetRmax(isect));
00289       fRmaxi[isect] = fShape->GetRmax(isect);
00290    }   
00291 }      
00292       
00293 //______________________________________________________________________________
00294 Bool_t TGeoPconEditor::IsDelayed() const
00295 {
00296 // Check if shape drawing is delayed.
00297    return (fDelayed->GetState() == kButtonDown);
00298 }
00299 
00300 //______________________________________________________________________________
00301 void TGeoPconEditor::DoName()
00302 {
00303    // Perform name change
00304    DoModified();
00305 }
00306 
00307 //______________________________________________________________________________
00308 void TGeoPconEditor::DoApply()
00309 {
00310 // Slot for applying modifications.
00311    const char *name = fShapeName->GetText();
00312    if (strcmp(name,fShape->GetName())) fShape->SetName(name);
00313    fApply->SetEnabled(kFALSE);
00314    fUndo->SetEnabled();
00315    if (!CheckSections()) return;
00316    // check if number of sections changed
00317    Bool_t recreate = kFALSE;
00318    Int_t nz = fENz->GetIntNumber();
00319    Double_t phi1 = fEPhi1->GetNumber();
00320    Double_t dphi = fEDPhi->GetNumber();
00321    if (nz != fShape->GetNz()) recreate = kTRUE;
00322    TGeoPconSection *sect;
00323    Int_t isect;
00324    if (recreate) {
00325       Double_t *array = new Double_t[3*(nz+1)];
00326       array[0] = phi1;
00327       array[1] = dphi;
00328       array[2] = nz;
00329       for (isect=0; isect<nz; isect++) {
00330          sect = (TGeoPconSection*)fSections->At(isect);
00331          array[3+3*isect] = sect->GetZ();
00332          array[4+3*isect] = sect->GetRmin();
00333          array[5+3*isect] = sect->GetRmax();
00334       }
00335       fShape->SetDimensions(array);
00336       delete [] array;
00337       if (fPad) {
00338          if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
00339             TView *view = fPad->GetView();
00340             if (!view) {
00341                fShape->Draw();
00342                fPad->GetView()->ShowAxis();
00343             } else {
00344                const Double_t *orig = fShape->GetOrigin();
00345                view->SetRange(orig[0]-fShape->GetDX(), orig[1]-fShape->GetDY(), orig[2]-fShape->GetDZ(),
00346                               orig[0]+fShape->GetDX(), orig[1]+fShape->GetDY(), orig[2]+fShape->GetDZ());
00347                Update();
00348             }                  
00349          } else Update();
00350       }   
00351       return;
00352    }           
00353    // No need to call SetDimensions   
00354    if (TMath::Abs(phi1-fShape->GetPhi1())>1.e-6) fShape->Phi1() = phi1;
00355    if (TMath::Abs(dphi-fShape->GetDphi())>1.e-6)  fShape->Dphi() = dphi;
00356    for (isect=0; isect<fNsections; isect++) {
00357       sect = (TGeoPconSection*)fSections->At(isect);
00358       fShape->Z(isect) = sect->GetZ();
00359       fShape->Rmin(isect) = sect->GetRmin();
00360       fShape->Rmax(isect) = sect->GetRmax();
00361    }   
00362    fShape->ComputeBBox();
00363    if (fPad) {
00364       if (gGeoManager && gGeoManager->GetPainter() && gGeoManager->GetPainter()->IsPaintingShape()) {
00365          TView *view = fPad->GetView();
00366          if (!view) {
00367             fShape->Draw();
00368             fPad->GetView()->ShowAxis();
00369          } else {
00370             const Double_t *orig = fShape->GetOrigin();
00371             view->SetRange(orig[0]-fShape->GetDX(), orig[1]-fShape->GetDY(), orig[2]-fShape->GetDZ(),
00372                            orig[0]+fShape->GetDX(), orig[1]+fShape->GetDY(), orig[2]+fShape->GetDZ());
00373             Update();
00374          }                  
00375       } else Update();
00376    }   
00377 }
00378 
00379 //______________________________________________________________________________
00380 void TGeoPconEditor::DoSectionChange(Int_t isect)
00381 {
00382 // Change parameters of section isect;
00383    TGeoPconSection *sect, *sectlo=0, *secthi=0;
00384    sect = (TGeoPconSection*)fSections->At(isect);
00385    if (isect) sectlo = (TGeoPconSection*)fSections->At(isect-1);
00386    if (isect<fNsections-1) secthi = (TGeoPconSection*)fSections->At(isect+1);
00387    Double_t z = sect->GetZ();
00388    if (sectlo && z<sectlo->GetZ()) {
00389       z = sectlo->GetZ();
00390       sect->SetZ(z);
00391    }   
00392    if (secthi && z>secthi->GetZ()) {
00393       z = secthi->GetZ();
00394       sect->SetZ(z);
00395    } 
00396    DoModified();
00397    if (!IsDelayed()) DoApply();
00398 }   
00399 
00400 //______________________________________________________________________________
00401 void TGeoPconEditor::DoNz()
00402 {
00403 // Change number of sections.
00404    Int_t nz = fENz->GetIntNumber();
00405    if (nz < 2) {
00406       nz = 2;
00407       fENz->SetNumber(nz);
00408    }   
00409    CreateSections(nz);
00410    CheckSections(kTRUE);
00411    DoModified();
00412    if (!IsDelayed()) DoApply();
00413 }   
00414 
00415 //______________________________________________________________________________
00416 void TGeoPconEditor::DoPhi()
00417 {
00418 // Change phi range.
00419    Double_t phi1 = fEPhi1->GetNumber();
00420    Double_t dphi = fEDPhi->GetNumber();
00421    if (TMath::Abs(phi1)>360) fEPhi1->SetNumber(0);
00422    if (dphi>360) fEDPhi->SetNumber(360);
00423    DoModified();
00424    if (!IsDelayed()) DoApply();
00425 }   
00426 
00427 //______________________________________________________________________________
00428 void TGeoPconEditor::DoModified()
00429 {
00430 // Slot for signaling modifications.
00431    fApply->SetEnabled();
00432 }
00433 
00434 //______________________________________________________________________________
00435 void TGeoPconEditor::DoUndo()
00436 {
00437 // Slot for undoing last operation.
00438    fENz->SetNumber(fNsecti);
00439    CreateSections(fNsecti);
00440    fEPhi1->SetNumber(fPhi1i);
00441    fEDPhi->SetNumber(fDPhii);
00442    TGeoPconSection *sect;
00443    for (Int_t isect=0; isect<fNsections; isect++) {
00444       sect = (TGeoPconSection*)fSections->At(isect);
00445       sect->SetZ(fZi[isect]);
00446       sect->SetRmin(fRmini[isect]);
00447       sect->SetRmax(fRmaxi[isect]);
00448    }   
00449    DoApply();
00450    fUndo->SetEnabled(kFALSE);
00451    fApply->SetEnabled(kFALSE);
00452 }
00453 
00454 ClassImp(TGeoPconSection)
00455 
00456 //______________________________________________________________________________
00457 TGeoPconSection::TGeoPconSection(const TGWindow *p, UInt_t w, UInt_t h, Int_t id)
00458                 :TGCompositeFrame(p,w,h,kHorizontalFrame | kFixedWidth)
00459 {
00460    // Constructor.
00461 
00462    fNumber = id;
00463    TGTextEntry *nef;
00464    // Label with number
00465    AddFrame(new TGLabel(this, TString::Format("#%i",id)), new TGLayoutHints(kLHintsLeft, 2, 4, 6, 0));
00466    
00467    // Z entry
00468    fEZ = new TGNumberEntry(this, 0., 5);
00469    fEZ->Resize(40,fEZ->GetDefaultHeight());
00470    nef = (TGTextEntry*)fEZ->GetNumberEntry();
00471    nef->SetToolTipText("Enter the Z position");
00472    fEZ->Associate(this);
00473    AddFrame(fEZ, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
00474    // Rmin entry
00475    fERmin = new TGNumberEntry(this, 0., 5);
00476    fERmin->SetNumAttr(TGNumberFormat::kNEAPositive);
00477    fERmin->Resize(40,fERmin->GetDefaultHeight());
00478    nef = (TGTextEntry*)fERmin->GetNumberEntry();
00479    nef->SetToolTipText("Enter the minimum radius");
00480    fERmin->Associate(this);
00481    AddFrame(fERmin, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
00482    // Rmax entry
00483    fERmax = new TGNumberEntry(this, 0., 5);
00484    fERmax->SetNumAttr(TGNumberFormat::kNEAPositive);
00485    fERmax->Resize(40,fERmax->GetDefaultHeight());
00486    nef = (TGTextEntry*)fERmax->GetNumberEntry();
00487    nef->SetToolTipText("Enter the maximum radius");
00488    fERmax->Associate(this);
00489    AddFrame(fERmax, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
00490    
00491    ConnectSignals2Slots();
00492    MapSubwindows();
00493    Layout();
00494 }
00495 
00496 //______________________________________________________________________________
00497 TGeoPconSection::~TGeoPconSection()
00498 {
00499 // Destructor
00500    Cleanup();   
00501 }
00502 
00503 //______________________________________________________________________________
00504 void TGeoPconSection::HideDaughters()
00505 {
00506 // Hide daughter frames
00507    fEZ->UnmapWindow();
00508    fERmin->UnmapWindow();
00509    fERmax->UnmapWindow();
00510 }
00511 
00512 //______________________________________________________________________________
00513 void TGeoPconSection::Changed(Int_t i)
00514 {
00515 // Emit Changed(Int_t) signal.
00516    Emit("Changed(Int_t)", i);
00517 }   
00518 
00519 //______________________________________________________________________________
00520 void TGeoPconSection::ConnectSignals2Slots()
00521 {
00522 // Connect signals to slots.
00523    fEZ->Connect("ValueSet(Long_t)", "TGeoPconSection", this, "DoZ()");
00524    fERmin->Connect("ValueSet(Long_t)", "TGeoPconSection", this, "DoRmin()");
00525    fERmax->Connect("ValueSet(Long_t)", "TGeoPconSection", this, "DoRmax()");
00526 }
00527 
00528 //______________________________________________________________________________
00529 Double_t TGeoPconSection::GetZ() const
00530 {
00531 // Z value getter
00532    return fEZ->GetNumber();
00533 }   
00534 
00535 //______________________________________________________________________________
00536 Double_t TGeoPconSection::GetRmin() const
00537 {
00538 // Rmin value getter
00539    return fERmin->GetNumber();
00540 }   
00541 
00542 //______________________________________________________________________________
00543 Double_t TGeoPconSection::GetRmax() const
00544 {
00545 // Rmax value getter
00546    return fERmax->GetNumber();
00547 }   
00548 
00549 //______________________________________________________________________________
00550 void TGeoPconSection::SetZ(Double_t z)
00551 {
00552 // Z value setter
00553    fEZ->SetNumber(z);
00554 }   
00555 
00556 //______________________________________________________________________________
00557 void TGeoPconSection::SetRmin(Double_t rmin)
00558 {
00559 // Rmin value setter
00560    fERmin->SetNumber(rmin);
00561 }   
00562 
00563 //______________________________________________________________________________
00564 void TGeoPconSection::SetRmax(Double_t rmax)
00565 {
00566 // Rmax value setter
00567    fERmax->SetNumber(rmax);
00568 }   
00569 
00570 //______________________________________________________________________________
00571 void TGeoPconSection::DoZ()
00572 {
00573 // Z slot.
00574    Changed(fNumber);
00575 }
00576 
00577 //______________________________________________________________________________
00578 void TGeoPconSection::DoRmin()
00579 {
00580 // Rmin slot.
00581    Double_t rmin = fERmin->GetNumber();
00582    Double_t rmax = fERmax->GetNumber();
00583    if (rmin>rmax-1.e-8) fERmin->SetNumber(rmax);
00584    Changed(fNumber);
00585 }
00586    
00587 //______________________________________________________________________________
00588 void TGeoPconSection::DoRmax()
00589 {
00590 // Rmax slot.
00591    Double_t rmin = fERmin->GetNumber();
00592    Double_t rmax = fERmax->GetNumber();
00593    if (rmax<rmin+1.e-8) fERmax->SetNumber(rmin);
00594    Changed(fNumber);
00595 }

Generated on Tue Jul 5 14:13:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1