00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveTrackPropagatorEditor.h"
00013 #include "TEveTrackPropagator.h"
00014
00015
00016 #include "TEveGValuators.h"
00017 #include "TEveManager.h"
00018
00019 #include "TVirtualPad.h"
00020 #include "TColor.h"
00021
00022 #include "TGLabel.h"
00023 #include "TG3DLine.h"
00024 #include "TGButton.h"
00025 #include "TGNumberEntry.h"
00026 #include "TGColorSelect.h"
00027 #include "TGComboBox.h"
00028 #include "TGDoubleSlider.h"
00029 #include "TGComboBox.h"
00030 #include "TAttMarkerEditor.h"
00031
00032
00033
00034
00035
00036
00037 ClassImp(TEveTrackPropagatorSubEditor);
00038
00039
00040 TEveTrackPropagatorSubEditor::TEveTrackPropagatorSubEditor(const TGWindow *p):
00041 TGVerticalFrame(p),
00042 fM (0),
00043
00044 fMaxR(0), fMaxZ(0), fMaxOrbits(0), fMaxAng(0), fDelta(0),
00045
00046 fRefsCont(0), fPMFrame(0),
00047 fFitDaughters(0), fFitReferences(0),
00048 fFitDecay(0), fFitCluster2Ds(0),
00049 fRnrDaughters(0), fRnrReferences(0),
00050 fRnrDecay(0), fRnrCluster2Ds(0),
00051 fRnrFV(0),
00052 fPMAtt(0), fFVAtt(0),
00053 fProjTrackBreaking(0), fRnrPTBMarkers(0), fPTBAtt(0)
00054 {
00055
00056
00057 Int_t labelW = 51;
00058
00059
00060 fMaxR = new TEveGValuator(this, "Max R:", 90, 0);
00061 fMaxR->SetLabelWidth(labelW);
00062 fMaxR->SetNELength(6);
00063 fMaxR->Build();
00064 fMaxR->SetLimits(0.1, TEveTrackPropagator::fgEditorMaxR, 101, TGNumberFormat::kNESRealOne);
00065 fMaxR->SetToolTip("Maximum radius to which the tracks will be drawn.");
00066 fMaxR->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxR()");
00067 AddFrame(fMaxR, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00068
00069 fMaxZ = new TEveGValuator(this, "Max Z:", 90, 0);
00070 fMaxZ->SetLabelWidth(labelW);
00071 fMaxZ->SetNELength(6);
00072 fMaxZ->Build();
00073 fMaxZ->SetLimits(0.1, TEveTrackPropagator::fgEditorMaxZ, 101, TGNumberFormat::kNESRealOne);
00074 fMaxZ->SetToolTip("Maximum z-coordinate to which the tracks will be drawn.");
00075 fMaxZ->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxZ()");
00076 AddFrame(fMaxZ, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00077
00078 fMaxOrbits = new TEveGValuator(this, "Orbits:", 90, 0);
00079 fMaxOrbits->SetLabelWidth(labelW);
00080 fMaxOrbits->SetNELength(6);
00081 fMaxOrbits->Build();
00082 fMaxOrbits->SetLimits(0.1, 10, 101, TGNumberFormat::kNESRealOne);
00083 fMaxOrbits->SetToolTip("Maximal angular path of tracks' orbits (1 ~ 2Pi).");
00084 fMaxOrbits->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxOrbits()");
00085 AddFrame(fMaxOrbits, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00086
00087 fMaxAng = new TEveGValuator(this, "Angle:", 90, 0);
00088 fMaxAng->SetLabelWidth(labelW);
00089 fMaxAng->SetNELength(6);
00090 fMaxAng->Build();
00091 fMaxAng->SetLimits(1, 160, 81, TGNumberFormat::kNESRealOne);
00092 fMaxAng->SetToolTip("Maximal angular step between two helix points.");
00093 fMaxAng->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoMaxAng()");
00094 AddFrame(fMaxAng, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00095
00096 fDelta = new TEveGValuator(this, "Delta:", 90, 0);
00097 fDelta->SetLabelWidth(labelW);
00098 fDelta->SetNELength(6);
00099 fDelta->Build();
00100 fDelta->SetLimits(0.001, 10, 101, TGNumberFormat::kNESRealThree);
00101 fDelta->SetToolTip("Maximal error at the mid-point of the line connecting to helix points.");
00102 fDelta->Connect("ValueSet(Double_t)", "TEveTrackPropagatorSubEditor", this, "DoDelta()");
00103 AddFrame(fDelta, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00104 }
00105
00106
00107 void TEveTrackPropagatorSubEditor::CreateRefsContainer(TGVerticalFrame* p)
00108 {
00109
00110
00111
00112 fRefsCont = new TGCompositeFrame(p, 80, 20, kVerticalFrame);
00113 fPMFrame = new TGVerticalFrame(fRefsCont);
00114
00115 {
00116 TGGroupFrame* fitPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
00117 fitPM->SetTitlePos(TGGroupFrame::kLeft);
00118 fPMFrame->AddFrame( fitPM, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
00119
00120 TGMatrixLayout *ml = new TGMatrixLayout(fitPM, 0,1,6);
00121 fitPM->SetLayoutManager(ml);
00122
00123 fFitDaughters = new TGCheckButton(fitPM, "Fit Daughters", TEvePathMark::kDaughter);
00124 fFitReferences = new TGCheckButton(fitPM, "Fit Refs", TEvePathMark::kReference);
00125 fFitDecay = new TGCheckButton(fitPM, "Fit Decay", TEvePathMark::kDecay);
00126 fFitCluster2Ds = new TGCheckButton(fitPM, "Fit 2D Clusters", TEvePathMark::kCluster2D);
00127
00128 fitPM->AddFrame(fFitDaughters);
00129 fitPM->AddFrame(fFitReferences);
00130 fitPM->AddFrame(fFitDecay);
00131 fitPM->AddFrame(fFitCluster2Ds);
00132
00133 fFitDecay ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
00134 fFitReferences->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
00135 fFitDaughters ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
00136 fFitCluster2Ds->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoFitPM()");
00137 }
00138
00139 {
00140 TGGroupFrame* rnrPM = new TGGroupFrame(fPMFrame, "PathMarks:", kLHintsTop | kLHintsCenterX);
00141 rnrPM->SetTitlePos(TGGroupFrame::kLeft);
00142 fPMFrame->AddFrame( rnrPM, new TGLayoutHints(kLHintsTop | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
00143
00144 TGMatrixLayout *ml = new TGMatrixLayout(rnrPM, 0, 1, 6);
00145 rnrPM->SetLayoutManager(ml);
00146
00147 fRnrDaughters = new TGCheckButton(rnrPM, "Rnr Daughters", TEvePathMark::kDaughter);
00148 fRnrReferences = new TGCheckButton(rnrPM, "Rnr Refs", TEvePathMark::kReference);
00149 fRnrDecay = new TGCheckButton(rnrPM, "Rnr Decay", TEvePathMark::kDecay);
00150 fRnrCluster2Ds = new TGCheckButton(rnrPM, "Rnr 2D Clusters", TEvePathMark::kCluster2D);
00151
00152 rnrPM->AddFrame(fRnrDaughters);
00153 rnrPM->AddFrame(fRnrReferences);
00154 rnrPM->AddFrame(fRnrDecay);
00155 rnrPM->AddFrame(fRnrCluster2Ds);
00156
00157 fRnrDecay ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
00158 fRnrReferences->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
00159 fRnrDaughters ->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
00160 fRnrCluster2Ds->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPM()");
00161
00162 fRefsCont->AddFrame(fPMFrame, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
00163 }
00164
00165 {
00166 fPMAtt = new TAttMarkerEditor(fRefsCont);
00167 TGFrameElement *el = (TGFrameElement*) fPMAtt->GetList()->First();
00168 TGFrame *f = el->fFrame; fPMAtt->RemoveFrame(f);
00169 f->DestroyWindow(); delete f;
00170 fRefsCont->AddFrame(fPMAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
00171 }
00172
00173 {
00174 TGCompositeFrame *vf = new TGCompositeFrame
00175 (fRefsCont, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground);
00176 vf->AddFrame(new TGLabel(vf, "FirstVertex"),
00177 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00178 vf->AddFrame(new TGHorizontal3DLine(vf),
00179 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
00180 fRefsCont->AddFrame(vf, new TGLayoutHints(kLHintsTop, 0, 0, 4, 0));
00181
00182 fRnrFV = new TGCheckButton(fRefsCont, "Rnr");
00183 fRnrFV->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrFV()");
00184 fRefsCont->AddFrame(fRnrFV, new TGLayoutHints(kLHintsTop, 5, 1, 2, 0));
00185 {
00186 fFVAtt = new TAttMarkerEditor(fRefsCont);
00187 TGFrameElement *el = (TGFrameElement*) fFVAtt->GetList()->First();
00188 TGFrame *f = el->fFrame; fFVAtt->RemoveFrame(f);
00189 f->DestroyWindow(); delete f;
00190 fRefsCont->AddFrame(fFVAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
00191 }
00192 }
00193
00194 {
00195 TGCompositeFrame *vf = new TGCompositeFrame
00196 (fRefsCont, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground);
00197 vf->AddFrame(new TGLabel(vf, "BreakPoints"),
00198 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00199 vf->AddFrame(new TGHorizontal3DLine(vf),
00200 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 5));
00201 fRefsCont->AddFrame(vf, new TGLayoutHints(kLHintsTop, 0, 0, 4, 0));
00202
00203 {
00204 UInt_t labelW = 40;
00205 UInt_t labelH = 20;
00206 TGHorizontalFrame* hf = new TGHorizontalFrame(fRefsCont);
00207
00208 TGCompositeFrame *labfr = new TGHorizontalFrame(hf, labelW, labelH, kFixedSize);
00209 TGLabel* label = new TGLabel(labfr, "Mode:");
00210 labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsBottom));
00211 hf->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
00212
00213 fProjTrackBreaking = new TGComboBox(hf);
00214 fProjTrackBreaking->AddEntry("Break tracks", TEveTrackPropagator::kPTB_Break);
00215 fProjTrackBreaking->AddEntry("First point position", TEveTrackPropagator::kPTB_UseFirstPointPos);
00216 fProjTrackBreaking->AddEntry("Last point position", TEveTrackPropagator::kPTB_UseLastPointPos);
00217 fProjTrackBreaking->Connect("Selected(Int_t)", "TEveTrackPropagatorSubEditor", this, "DoModePTB(UChar_t)");
00218 fProjTrackBreaking->Resize(140, labelH);
00219 hf->AddFrame(fProjTrackBreaking, new TGLayoutHints(kLHintsLeft, 0,0,2,0));
00220 fRefsCont->AddFrame(hf, new TGLayoutHints(kLHintsTop, 4, 1, 1, 1));
00221 }
00222
00223 fRnrPTBMarkers = new TGCheckButton(fRefsCont, "Rnr");
00224 fRnrPTBMarkers->Connect("Clicked()","TEveTrackPropagatorSubEditor", this, "DoRnrPTB()");
00225 fRefsCont->AddFrame(fRnrPTBMarkers, new TGLayoutHints(kLHintsTop, 5, 1, 2, 0));
00226 {
00227 fPTBAtt = new TAttMarkerEditor(fRefsCont);
00228 TGFrameElement *el = (TGFrameElement*) fPTBAtt->GetList()->First();
00229 TGFrame *f = el->fFrame; fPTBAtt->RemoveFrame(f);
00230 f->DestroyWindow(); delete f;
00231 fRefsCont->AddFrame(fPTBAtt, new TGLayoutHints(kLHintsTop, 1, 1, 3, 1));
00232 }
00233 }
00234
00235 p->AddFrame(fRefsCont, new TGLayoutHints(kLHintsTop| kLHintsExpandX));
00236 }
00237
00238
00239 void TEveTrackPropagatorSubEditor::SetModel(TEveTrackPropagator* m)
00240 {
00241
00242
00243 fM = m;
00244
00245 fMaxR->SetValue(fM->fMaxR);
00246 fMaxZ->SetValue(fM->fMaxZ);
00247 fMaxOrbits->SetValue(fM->fMaxOrbs);
00248 fMaxAng->SetValue(fM->GetMaxAng());
00249 fDelta->SetValue(fM->GetDelta());
00250
00251 if(fM->fEditPathMarks)
00252 {
00253 ShowFrame(fPMFrame);
00254 fRnrDaughters->SetState(fM->fRnrDaughters ? kButtonDown : kButtonUp);
00255 fRnrReferences->SetState(fM->fRnrReferences ? kButtonDown : kButtonUp);
00256 fRnrDecay->SetState(fM->fRnrDecay ? kButtonDown : kButtonUp);
00257 fRnrCluster2Ds->SetState(fM->fRnrCluster2Ds ? kButtonDown : kButtonUp);
00258
00259 fFitDaughters->SetState(fM->fFitDaughters ? kButtonDown : kButtonUp);
00260 fFitReferences->SetState(fM->fFitReferences ? kButtonDown : kButtonUp);
00261 fFitDecay->SetState(fM->fFitDecay ? kButtonDown : kButtonUp);
00262 fFitCluster2Ds->SetState(fM->fFitCluster2Ds ? kButtonDown : kButtonUp);
00263
00264 fPMAtt->SetModel(&fM->fPMAtt);
00265 }
00266 else
00267 {
00268 fRefsCont->HideFrame(fPMFrame);
00269 }
00270
00271 fRnrFV->SetState(fM->fRnrFV ? kButtonDown : kButtonUp);
00272 fFVAtt->SetModel(&fM->fFVAtt);
00273
00274 fProjTrackBreaking->Select(fM->fProjTrackBreaking, kFALSE);
00275 fRnrPTBMarkers->SetState(fM->fRnrPTBMarkers ? kButtonDown : kButtonUp);
00276 fPTBAtt->SetModel(&fM->fPTBAtt);
00277 }
00278
00279
00280
00281
00282 void TEveTrackPropagatorSubEditor::Changed()
00283 {
00284
00285
00286 Emit("Changed()");
00287 }
00288
00289
00290
00291
00292 void TEveTrackPropagatorSubEditor::DoMaxR()
00293 {
00294
00295
00296 fM->SetMaxR(fMaxR->GetValue());
00297 Changed();
00298 }
00299
00300
00301 void TEveTrackPropagatorSubEditor::DoMaxZ()
00302 {
00303
00304
00305 fM->SetMaxZ(fMaxZ->GetValue());
00306 Changed();
00307 }
00308
00309
00310 void TEveTrackPropagatorSubEditor::DoMaxOrbits()
00311 {
00312
00313
00314 fM->SetMaxOrbs(fMaxOrbits->GetValue());
00315 Changed();
00316 }
00317
00318
00319 void TEveTrackPropagatorSubEditor::DoMaxAng()
00320 {
00321
00322
00323 fM->SetMaxAng(fMaxAng->GetValue());
00324 Changed();
00325 }
00326
00327
00328 void TEveTrackPropagatorSubEditor::DoDelta()
00329 {
00330
00331
00332 fM->SetDelta(fDelta->GetValue());
00333 Changed();
00334 }
00335
00336
00337
00338
00339 void TEveTrackPropagatorSubEditor::DoFitPM()
00340 {
00341
00342
00343 TGButton* b = (TGButton *) gTQSender;
00344 TEvePathMark::EType_e type = TEvePathMark::EType_e(b->WidgetId());
00345 Bool_t on = b->IsOn();
00346
00347 switch(type)
00348 {
00349 case TEvePathMark::kDaughter:
00350 fM->SetFitDaughters(on);
00351 break;
00352 case TEvePathMark::kReference:
00353 fM->SetFitReferences(on);
00354 break;
00355 case TEvePathMark::kDecay:
00356 fM->SetFitDecay(on);
00357 break;
00358 case TEvePathMark::kCluster2D:
00359 fM->SetFitCluster2Ds(on);
00360 break;
00361
00362 default:
00363 break;
00364 }
00365 Changed();
00366 }
00367
00368
00369 void TEveTrackPropagatorSubEditor::DoRnrPM()
00370 {
00371
00372
00373 TGButton * b = (TGButton *) gTQSender;
00374 TEvePathMark::EType_e type = TEvePathMark::EType_e(b->WidgetId());
00375 Bool_t on = b->IsOn();
00376 switch(type){
00377 case TEvePathMark::kDaughter:
00378 fM->SetRnrDaughters(on);
00379 break;
00380 case TEvePathMark::kReference:
00381 fM->SetRnrReferences(on);
00382 break;
00383 case TEvePathMark::kDecay:
00384 fM->SetRnrDecay(on);
00385 break;
00386 case TEvePathMark::kCluster2D:
00387 fM->SetRnrCluster2Ds(on);
00388 break;
00389 default:
00390 break;
00391 }
00392 Changed();
00393 }
00394
00395
00396 void TEveTrackPropagatorSubEditor::DoRnrFV()
00397 {
00398
00399
00400 fM->SetRnrFV(fRnrFV->IsOn());
00401 Changed();
00402 }
00403
00404
00405 void TEveTrackPropagatorSubEditor::DoModePTB(UChar_t mode)
00406 {
00407
00408
00409 fM->SetProjTrackBreaking(mode);
00410 Changed();
00411 }
00412
00413
00414 void TEveTrackPropagatorSubEditor::DoRnrPTB()
00415 {
00416
00417
00418 fM->SetRnrPTBMarkers(fRnrPTBMarkers->IsOn());
00419 Changed();
00420 }
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433 ClassImp(TEveTrackPropagatorEditor);
00434
00435
00436 TEveTrackPropagatorEditor::TEveTrackPropagatorEditor(const TGWindow *p,
00437 Int_t width, Int_t height,
00438 UInt_t options, Pixel_t back) :
00439 TGedFrame(p, width, height, options | kVerticalFrame, back),
00440 fM(0),
00441 fRSSubEditor(0)
00442 {
00443
00444
00445 MakeTitle("RenderStyle");
00446
00447 fRSSubEditor = new TEveTrackPropagatorSubEditor(this);
00448 fRSSubEditor->Connect("Changed()", "TEveTrackPropagatorEditor", this, "Update()");
00449 AddFrame(fRSSubEditor, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0,0,0));
00450
00451 TGVerticalFrame* refsFrame = CreateEditorTabSubFrame("Refs");
00452 {
00453 TGCompositeFrame *cf = new TGCompositeFrame
00454 (refsFrame, 145, 10, kHorizontalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground);
00455 cf->AddFrame(new TGLabel(cf, "PathMarks"),
00456 new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
00457 cf->AddFrame(new TGHorizontal3DLine(cf),
00458 new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
00459 refsFrame->AddFrame(cf, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
00460 }
00461
00462
00463 fRSSubEditor->CreateRefsContainer(refsFrame);
00464 fRSSubEditor->fPMAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
00465 fRSSubEditor->fFVAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
00466
00467 fRSSubEditor->Connect("Changed()", "TEveTrackPropagatorEditor", this, "Update()");
00468 }
00469
00470
00471
00472
00473 void TEveTrackPropagatorEditor::SetModel(TObject* obj)
00474 {
00475
00476
00477 fM = dynamic_cast<TEveTrackPropagator*>(obj);
00478 fRSSubEditor->SetModel(fM);
00479 }