39 ClassImp(TEveCaloVizEditor);
44 TEveCaloVizEditor::TEveCaloVizEditor(
const TGWindow *p, Int_t width, Int_t height,
45 UInt_t options, Pixel_t back) :
46 TGedFrame(p, width, height, options | kVerticalFrame, back),
62 MakeTitle(
"TEveCaloViz");
68 TGHorizontalFrame* scf =
new TGHorizontalFrame(
this);
70 label =
new TGLabel(scf,
"ScaleAbsolute:");
71 scf->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsBottom));
73 fScaleAbs =
new TGCheckButton(scf);
74 scf->AddFrame(fScaleAbs,
new TGLayoutHints(kLHintsLeft, 3, 5, 3, 0));
75 fScaleAbs->Connect(
"Toggled(Bool_t)",
"TEveCaloVizEditor",
this,
"DoScaleAbs()");
78 fMaxValAbs =
new TEveGValuator(scf,
"MaxEVal:", 70, 0);
79 fMaxValAbs->SetLabelWidth(56);
80 fMaxValAbs->SetNELength(5);
81 fMaxValAbs->SetShowSlider(kFALSE);
83 fMaxValAbs->SetLimits(0, 1000);
84 fMaxValAbs->Connect(
"ValueSet(Double_t)",
"TEveCaloVizEditor",
this,
"DoMaxValAbs()");
85 scf->AddFrame(fMaxValAbs,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
87 AddFrame(scf,
new TGLayoutHints(kLHintsTop, 4, 1, 1, 0));
91 fMaxTowerH =
new TEveGValuator(
this,
"MaxTowerH:", 96, 0);
92 fMaxTowerH->SetLabelWidth(71);
93 fMaxTowerH->SetNELength(5);
94 fMaxTowerH->SetShowSlider(kFALSE);
96 fMaxTowerH->SetLimits(0.1, 500, 501, TGNumberFormat::kNESRealOne);
97 fMaxTowerH->Connect(
"ValueSet(Double_t)",
"TEveCaloVizEditor",
this,
"DoMaxTowerH()");
98 AddFrame(fMaxTowerH,
new TGLayoutHints(kLHintsTop, 4, 1, 1, 1));
103 fDataFrame = CreateEditorTabSubFrame(
"Data");
107 TGHorizontalFrame *group =
new TGHorizontalFrame(fDataFrame);
108 TGCompositeFrame *labfr =
new TGHorizontalFrame(group, 28, 20, kFixedSize);
110 TGFont *myfont = gClient->GetFont(
"-adobe-times-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
111 label =
new TGLabel(labfr,
"Plot:");
112 label->SetTextFont(myfont);
113 labfr->AddFrame(label,
new TGLayoutHints(kLHintsLeft | kLHintsBottom));
114 group->AddFrame(labfr,
new TGLayoutHints(kLHintsLeft));
116 fPlotE =
new TGRadioButton(group,
new TGHotString(
"E"), 11);
117 fPlotE->Connect(
"Clicked()",
"TEveCaloVizEditor",
this,
"DoPlot()");
118 group->AddFrame(fPlotE,
new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2, 2, 0, 0));
120 fPlotEt =
new TGRadioButton(group,
new TGHotString(
"Et"), 22);
121 fPlotEt->Connect(
"Clicked()",
"TEveCaloVizEditor",
this,
"DoPlot()");
122 group->AddFrame(fPlotEt,
new TGLayoutHints(kLHintsLeft | kLHintsBottom, 2, 2, 0, 0));
124 fDataFrame->AddFrame(group,
new TGLayoutHints(kLHintsTop, 4, 1, 1, 0));
128 fEtaRng =
new TEveGDoubleValuator(fDataFrame,
"Eta rng:", 40, 0);
129 fEtaRng->SetNELength(6);
130 fEtaRng->SetLabelWidth(labelW);
132 fEtaRng->GetSlider()->SetWidth(195);
133 fEtaRng->SetLimits(-5.5, 5.5, TGNumberFormat::kNESRealTwo);
134 fEtaRng->Connect(
"ValueSet()",
"TEveCaloVizEditor",
this,
"DoEtaRange()");
135 fDataFrame->AddFrame(fEtaRng,
new TGLayoutHints(kLHintsTop, 1, 1, 4, 5));
138 fPhi =
new TEveGValuator(fDataFrame,
"Phi:", 90, 0);
139 fPhi->SetLabelWidth(labelW);
140 fPhi->SetNELength(6);
142 fPhi->SetLimits(-TMath::Pi(), TMath::Pi(), TGNumberFormat::kNESRealTwo);
143 fPhi->Connect(
"ValueSet(Double_t)",
"TEveCaloVizEditor",
this,
"DoPhi()");
144 fDataFrame->AddFrame(fPhi,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
146 fPhiOffset =
new TEveGValuator(fDataFrame,
"PhiOff:", 90, 0);
147 fPhiOffset->SetLabelWidth(labelW);
148 fPhiOffset->SetNELength(6);
150 fPhiOffset->SetLimits(0, TMath::Pi(), TGNumberFormat::kNESRealTwo);
151 fPhiOffset->Connect(
"ValueSet(Double_t)",
"TEveCaloVizEditor",
this,
"DoPhi()");
152 fDataFrame->AddFrame(fPhiOffset,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
154 fSliceFrame =
new TGVerticalFrame(fDataFrame);
155 fDataFrame->AddFrame(fSliceFrame);
161 void TEveCaloVizEditor::MakeSliceInfo()
163 Int_t ns = fM->GetData()->GetNSlices();
164 Int_t nf = fSliceFrame->GetList()->GetSize();
168 for (Int_t i=nf; i<ns; ++i)
170 TGHorizontalFrame* f =
new TGHorizontalFrame(fSliceFrame);
172 TEveGValuator* threshold =
new TEveGValuator(f,
"", 90, 0, i);
173 threshold->SetLabelWidth(50);
174 threshold->SetNELength(6);
175 threshold->SetShowSlider(kFALSE);
177 threshold->SetLimits(0, 1000, TGNumberFormat::kNESRealTwo);
178 threshold->Connect(
"ValueSet(Double_t)",
"TEveCaloVizEditor",
this,
"DoSliceThreshold()");
179 f->AddFrame(threshold,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
181 TGColorSelect* color =
new TGColorSelect(f, 0, i);
182 f->AddFrame(color,
new TGLayoutHints(kLHintsLeft|kLHintsTop, 3, 1, 0, 1));
183 color->Connect(
"ColorSelected(Pixel_t)",
"TEveCaloVizEditor",
this,
"DoSliceColor(Pixel_t)");
185 TGNumberEntry* transparency =
new TGNumberEntry(f, 0., 2, i,
186 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
187 TGNumberFormat::kNELLimitMinMax, 0, 100);
188 transparency->SetHeight(18);
189 transparency->GetNumberEntry()->SetToolTipText(
"Transparency: 0 is opaque, 100 fully transparent.");
190 f->AddFrame(transparency,
new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
191 transparency->Connect(
"ValueSet(Long_t)",
"TEveCaloVizEditor",
this,
"DoSliceTransparency(Long_t)");
194 fSliceFrame->AddFrame(f,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
199 TIter frame_iterator(fSliceFrame->GetList());
200 for (Int_t i=0; i<nf; ++i)
202 TGFrameElement *el = (TGFrameElement*) frame_iterator();
203 TGHorizontalFrame *fr = (TGHorizontalFrame*) el->fFrame;
206 TEveCaloData::SliceInfo_t &si = fM->GetData()->RefSliceInfo(i);
208 TEveGValuator *threshold = (TEveGValuator*) ((TGFrameElement*) fr->GetList()->At(0))->fFrame;
209 TGColorSelect *color = (TGColorSelect*) ((TGFrameElement*) fr->GetList()->At(1) )->fFrame;
210 TGNumberEntry *transp = (TGNumberEntry*) ((TGFrameElement*) fr->GetList()->At(2))->fFrame;
212 threshold->GetLabel()->SetText(si.fName);
213 threshold->SetValue(si.fThreshold);
214 color->SetColor(TColor::Number2Pixel(si.fColor), kFALSE);
215 transp->SetNumber(si.fTransparency);
217 if (! fr->IsMapped()) {
224 if (fr->IsMapped()) {
234 void TEveCaloVizEditor::SetModel(TObject* obj)
236 fM =
dynamic_cast<TEveCaloViz*
>(obj);
239 fPlotEt->SetState(kButtonDown, kFALSE);
240 fPlotE->SetState(kButtonUp, kFALSE);
244 fPlotE->SetState(kButtonDown, kFALSE);
245 fPlotEt->SetState(kButtonUp, kFALSE);
250 TGCompositeFrame* p = GetGedEditor()->GetEditorTab(
"Data");
251 if (p->GetList()->IsEmpty())
257 fScaleAbs->SetState(fM->GetScaleAbs() ? kButtonDown : kButtonUp);
258 fMaxValAbs->SetValue(fM->GetMaxValAbs());
259 fMaxTowerH->SetValue(fM->GetMaxTowerH());
262 fM->GetData()->GetEtaLimits(min, max);
263 fEtaRng->SetLimits((Float_t)min, (Float_t)max);
264 fEtaRng->SetValues(fM->fEtaMin, fM->fEtaMax);
266 fM->GetData()->GetPhiLimits(min, max);
267 fPhi->SetLimits(min, max, 101, TGNumberFormat::kNESRealTwo);
268 fPhi->SetValue(fM->fPhi);
269 if ( fM->GetData()->GetWrapTwoPi())
271 fPhi->SetToolTip(
"Center angle in radians");
272 fPhiOffset->SetLimits(1e-3, TMath::Pi(), 101, TGNumberFormat::kNESRealTwo);
276 Float_t d = (max-min)*0.5;
277 fPhiOffset->SetLimits(1e-3, d, 101, TGNumberFormat::kNESRealTwo);
279 fPhiOffset->SetValue(fM->fPhiOffset);
280 fPhiOffset->SetToolTip(
"Phi range in radians");
287 fDataFrame->UnmapWindow();
294 void TEveCaloVizEditor::DoMaxTowerH()
296 fM->SetMaxTowerH(fMaxTowerH->GetValue());
303 void TEveCaloVizEditor::DoScaleAbs()
305 fM->SetScaleAbs(fScaleAbs->IsOn());
312 void TEveCaloVizEditor::DoMaxValAbs()
314 fM->SetMaxValAbs(fMaxValAbs->GetValue());
321 void TEveCaloVizEditor::DoPlot()
323 TGButton *btn = (TGButton *) gTQSender;
324 Int_t
id = btn->WidgetId();
326 if (
id == fPlotE->WidgetId())
327 fPlotEt->SetState(kButtonUp);
329 fPlotE->SetState(kButtonUp);
331 fM->SetPlotEt(fPlotEt->IsDown());
338 void TEveCaloVizEditor::DoEtaRange()
340 fM->SetEta(fEtaRng->GetMin(), fEtaRng->GetMax());
347 void TEveCaloVizEditor::DoPhi()
349 fM->SetPhiWithRng(fPhi->GetValue(), fPhiOffset->GetValue());
356 void TEveCaloVizEditor::DoSliceThreshold()
358 TEveGValuator *st = (TEveGValuator *) gTQSender;
359 fM->SetDataSliceThreshold(st->WidgetId(), st->GetValue());
366 void TEveCaloVizEditor::DoSliceColor(Pixel_t pixel)
368 TGColorSelect *cs = (TGColorSelect *) gTQSender;
369 fM->SetDataSliceColor(cs->WidgetId(), Color_t(TColor::GetColor(pixel)));
376 void TEveCaloVizEditor::DoSliceTransparency(Long_t t)
378 TGNumberEntry *cs = (TGNumberEntry*) gTQSender;
379 fM->GetData()->SetSliceTransparency(cs->WidgetId(), t);
388 ClassImp(TEveCalo3DEditor);
393 TEveCalo3DEditor::TEveCalo3DEditor(
const TGWindow *p, Int_t width, Int_t height,
394 UInt_t options, Pixel_t back) :
395 TGedFrame(p, width, height, options | kVerticalFrame, back),
397 fFrameTransparency(0)
399 MakeTitle(
"TEveCalo3D");
401 TGHorizontalFrame* f =
new TGHorizontalFrame(
this);
402 TGLabel* lab =
new TGLabel(f,
"Frame transparency: ");
403 f->AddFrame(lab,
new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 1, 1, 1));
405 fFrameTransparency =
new TGNumberEntry(f, 0., 2, -1,
406 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
407 TGNumberFormat::kNELLimitMinMax, 0, 100);
409 fFrameTransparency->SetHeight(18);
410 fFrameTransparency->GetNumberEntry()->SetToolTipText(
"Transparency: 0 is opaque, 100 fully transparent.");
411 f->AddFrame(fFrameTransparency,
new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
412 fFrameTransparency->Connect(
"ValueSet(Long_t)",
"TEveCalo3DEditor",
this,
"DoFrameTransparency()");
414 AddFrame(f,
new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
420 void TEveCalo3DEditor::SetModel(TObject* obj)
422 fM =
dynamic_cast<TEveCalo3D*
>(obj);
423 fFrameTransparency->SetNumber(fM->GetFrameTransparency());
429 void TEveCalo3DEditor::DoFrameTransparency()
431 fM->SetFrameTransparency((Char_t)(fFrameTransparency->GetNumber()));