#include "TEveTrackEditor.h"
#include "TEveTrack.h"
#include "TEveTrackPropagator.h"
#include "TEveTrackPropagatorEditor.h"
#include "TEveManager.h"
#include "TEveGValuators.h"
#include "TVirtualPad.h"
#include "TColor.h"
#include "TGedEditor.h"
#include "TAttMarkerEditor.h"
#include "TGLabel.h"
#include "TG3DLine.h"
#include "TGButton.h"
#include "TGNumberEntry.h"
#include "TGColorSelect.h"
#include "TGDoubleSlider.h"
#include "TGComboBox.h"
#include "TGMsgBox.h"
#include "TH1F.h"
#include "TROOT.h"
#include "TSystem.h"
ClassImp(TEveTrackEditor)
TEveTrackEditor::TEveTrackEditor(const TGWindow *p, Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fM(0),
fRSEditor(0)
{
MakeTitle("TEveTrack");
TGHorizontalFrame* f = new TGHorizontalFrame(this);
fRSEditor = new TGTextButton(f, "Edit Propagator");
fRSEditor->Connect("Clicked()", "TEveTrackEditor", this, "DoEditPropagator()");
f->AddFrame(fRSEditor, new TGLayoutHints(kLHintsLeft, 2, 1, 4, 4));
AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
}
void TEveTrackEditor::SetModel(TObject* obj)
{
fM = dynamic_cast<TEveTrack*>(obj);
}
void TEveTrackEditor::DoEditPropagator()
{
fGedEditor->SetModel(fGedEditor->GetPad(), fM->GetPropagator(), kButton1Down);
}
ClassImp(TEveTrackListEditor)
TEveTrackListEditor::TEveTrackListEditor(const TGWindow *p,
Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fTC (0),
fPtRange (0),
fPRange (0),
fRSSubEditor(0)
{
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
fRnrPoints = new TGCheckButton(f, "Draw Marker");
f->AddFrame(fRnrPoints, new TGLayoutHints(kLHintsLeft, 2,1,0,0));
fRnrPoints->Connect("Toggled(Bool_t)"," TEveTrackListEditor", this, "DoRnrPoints()");
fRnrLine = new TGCheckButton(f, "Draw TEveLine");
f->AddFrame(fRnrLine, new TGLayoutHints(kLHintsLeft, 1,2,0,0));
fRnrLine->Connect("Toggled(Bool_t)", "TEveTrackListEditor", this, "DoRnrLine()");
AddFrame(f, new TGLayoutHints(kLHintsTop, 0,0,2,1));
}
{
Int_t labelW = 51;
Int_t dbW = 210;
fPtRange = new TEveGDoubleValuator(this,"Pt rng:", 40, 0);
fPtRange->SetNELength(6);
fPtRange->SetLabelWidth(labelW);
fPtRange->Build();
fPtRange->GetSlider()->SetWidth(dbW);
fPtRange->SetLimits(0, 10, TGNumberFormat::kNESRealTwo);
fPtRange->Connect("ValueSet()",
"TEveTrackListEditor", this, "DoPtRange()");
AddFrame(fPtRange, new TGLayoutHints(kLHintsTop, 1, 1, 4, 1));
fPRange = new TEveGDoubleValuator(this,"P rng:", 40, 0);
fPRange->SetNELength(6);
fPRange->SetLabelWidth(labelW);
fPRange->Build();
fPRange->GetSlider()->SetWidth(dbW);
fPRange->SetLimits(0, 100, TGNumberFormat::kNESRealTwo);
fPRange->Connect("ValueSet()",
"TEveTrackListEditor", this, "DoPRange()");
AddFrame(fPRange, new TGLayoutHints(kLHintsTop, 1, 1, 4, 1));
}
MakeTitle("RenderStyle");
fRSSubEditor = new TEveTrackPropagatorSubEditor(this);
fRSSubEditor->Connect("Changed()", "TEveTrackListEditor", this, "Update()");
AddFrame(fRSSubEditor, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0,0,0));
CreateRefsTab();
}
void TEveTrackListEditor::CreateRefsTab()
{
fRefs = CreateEditorTabSubFrame("Refs");
TGCompositeFrame *title1 = new TGCompositeFrame(fRefs, 145, 10,
kHorizontalFrame |
kLHintsExpandX |
kFixedWidth |
kOwnBackground);
title1->AddFrame(new TGLabel(title1, "PathMarks"),
new TGLayoutHints(kLHintsLeft, 1, 1, 0, 0));
title1->AddFrame(new TGHorizontal3DLine(title1),
new TGLayoutHints(kLHintsExpandX, 5, 5, 7, 7));
fRefs->AddFrame(title1, new TGLayoutHints(kLHintsTop, 0, 0, 2, 0));
fRSSubEditor->CreateRefsContainer(fRefs);
fRSSubEditor->fPMAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
fRSSubEditor->fFVAtt->SetGedEditor((TGedEditor*)gEve->GetEditor());
}
void TEveTrackListEditor::SetModel(TObject* obj)
{
fTC = dynamic_cast<TEveTrackList*>(obj);
fRnrLine ->SetState(fTC->GetRnrLine() ? kButtonDown : kButtonUp);
fRnrPoints->SetState(fTC->GetRnrPoints() ? kButtonDown : kButtonUp);
Float_t llim;
fPtRange->SetValues(fTC->fMinPt, fTC->fMaxPt);
llim = TMath::Log10(fTC->fLimPt);
fPtRange->SetLimits(0, fTC->fLimPt, llim < 2 ? TGNumberFormat::kNESRealTwo : (llim < 3 ? TGNumberFormat::kNESRealOne : TGNumberFormat::kNESInteger));
fPRange ->SetValues(fTC->fMinP, fTC->fMaxP);
llim = TMath::Log10(fTC->fLimP);
fPRange ->SetLimits(0, fTC->fLimP, llim < 2 ? TGNumberFormat::kNESRealTwo : (llim < 3 ? TGNumberFormat::kNESRealOne : TGNumberFormat::kNESInteger));
fRSSubEditor->SetModel(fTC->GetPropagator());
}
void TEveTrackListEditor::DoRnrLine()
{
fTC->SetRnrLine(fRnrLine->IsOn());
Update();
}
void TEveTrackListEditor::DoRnrPoints()
{
fTC->SetRnrPoints(fRnrPoints->IsOn());
Update();
}
void TEveTrackListEditor::DoPtRange()
{
fTC->SelectByPt(fPtRange->GetMin(), fPtRange->GetMax());
Update();
}
void TEveTrackListEditor::DoPRange()
{
fTC->SelectByP(fPRange->GetMin(), fPRange->GetMax());
Update();
}
#include "TCanvas.h"
#include "TGLViewer.h"
#include "TEveManager.h"
ClassImp(TEveTrackCounterEditor)
TEveTrackCounterEditor::TEveTrackCounterEditor(const TGWindow *p, Int_t width, Int_t height,
UInt_t options, Pixel_t back) :
TGedFrame(p, width, height, options | kVerticalFrame, back),
fM(0),
fClickAction (0),
fInfoLabel (0),
fEventId (0)
{
MakeTitle("TEveTrackCounter");
Int_t labelW = 42;
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
TGLabel* lab = new TGLabel(f, "Click:");
f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 2));
fClickAction = new TGComboBox(f);
fClickAction->AddEntry("Print", 0);
fClickAction->AddEntry("Toggle", 1);
TGListBox* lb = fClickAction->GetListBox();
lb->Resize(lb->GetWidth(), 2*16);
fClickAction->Resize(70, 20);
fClickAction->Connect("Selected(Int_t)", "TEveTrackCounterEditor", this,
"DoClickAction(Int_t)");
f->AddFrame(fClickAction, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
AddFrame(f);
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this);
TGLabel* lab = new TGLabel(f, "Status:");
f->AddFrame(lab, new TGLayoutHints(kLHintsLeft, 1, 5, 1, 2));
fInfoLabel = new TGLabel(f);
f->AddFrame(fInfoLabel, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 9, 1, 2));
AddFrame(f);
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
TGLabel* l = new TGLabel(g, "View:");
g->AddFrame(l, new TGLayoutHints(kLHintsLeft, 0,0,4,0));
f->AddFrame(g);
TGTextButton* b;
b = new TGTextButton(f, "Orto XY");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "TEveTrackCounterEditor", this, "DoOrtoXY()");
b = new TGTextButton(f, "Orto ZY");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "TEveTrackCounterEditor", this, "DoOrtoZY()");
b = new TGTextButton(f, "Persp");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "TEveTrackCounterEditor", this, "DoPersp()");
AddFrame(f);
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
TGLabel* l = new TGLabel(g, "Event:");
g->AddFrame(l, new TGLayoutHints(kLHintsLeft, 0,0,4,0));
f->AddFrame(g);
TGTextButton* b;
b = new TGTextButton(f, "Prev");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "TEveTrackCounterEditor", this, "DoPrev()");
fEventId = new TGNumberEntry(f, 0, 3, -1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax, 0, 1000);
f->AddFrame(fEventId, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
fEventId->Connect("ValueSet(Long_t)", "TEveTrackCounterEditor", this, "DoSetEvent()");
b = new TGTextButton(f, "Next");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "TEveTrackCounterEditor", this, "DoNext()");
AddFrame(f);
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
TGLabel* l = new TGLabel(g, "Report:");
g->AddFrame(l, new TGLayoutHints(kLHintsLeft, 0,0,4,0));
f->AddFrame(g);
TGTextButton* b;
b = new TGTextButton(f, "Print");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "TEveTrackCounterEditor", this, "DoPrintReport()");
b = new TGTextButton(f, "File");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "TEveTrackCounterEditor", this, "DoFileReport()");
AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 0));
}
{
TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
TGLabel* l = new TGLabel(g, "Histos:");
g->AddFrame(l, new TGLayoutHints(kLHintsLeft, 0,0,4,0));
f->AddFrame(g);
TGTextButton* b;
b = new TGTextButton(f, "Show");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "TEveTrackCounterEditor", this, "DoShowHistos()");
AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
}
}
void TEveTrackCounterEditor::SetModel(TObject* obj)
{
fM = dynamic_cast<TEveTrackCounter*>(obj);
fClickAction->Select(fM->fClickAction, kFALSE);
fInfoLabel->SetText(Form("All: %3d; Primaries: %3d", fM->fAllTracks, fM->fGoodTracks));
fEventId->SetNumber(fM->GetEventId());
}
void TEveTrackCounterEditor::DoOrtoXY()
{
gEve->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY) ;
}
void TEveTrackCounterEditor::DoOrtoZY()
{
gEve->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoZOY) ;
}
void TEveTrackCounterEditor::DoPersp()
{
gEve->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraPerspXOZ) ;
}
void TEveTrackCounterEditor::DoPrev()
{
TEveUtil::Macro("event_prev.C");
gEve->EditElement(fM);
}
void TEveTrackCounterEditor::DoNext()
{
TEveUtil::Macro("event_next.C");
gEve->EditElement(fM);
}
void TEveTrackCounterEditor::DoSetEvent()
{
TEveUtil::LoadMacro("event_goto.C");
gROOT->ProcessLine(Form("event_goto(%d);", (Int_t) fEventId->GetNumber()));
gEve->EditElement(fM);
}
void TEveTrackCounterEditor::DoPrintReport()
{
fM->OutputEventTracks();
}
void TEveTrackCounterEditor::DoFileReport()
{
TString file(Form("ev-report-%03d.txt", fM->GetEventId()));
if (gSystem->AccessPathName(file) == kFALSE)
{
Int_t ret;
new TGMsgBox(fClient->GetRoot(), GetMainFrame(),
"File Exist",
Form("Event record for event %d already exist.\n Replace?", fM->GetEventId()),
kMBIconQuestion, kMBYes | kMBNo, &ret);
if (ret == kMBNo)
return;
}
FILE* out = fopen(file, "w");
fM->OutputEventTracks(out);
fclose(out);
}
void TEveTrackCounterEditor::DoShowHistos()
{
TH1F* hcnt = new TH1F("cnt", "Primeries per event", 41, -0.5, 40.5);
TH1F* hchg = new TH1F("chg", "Primary charge", 3, -1.5, 1.5);
TH1F* hpt = new TH1F("pt", "pT distribution", 40, 0.0, 8.0);
TH1F* heta = new TH1F("eta", "eta distribution", 40, -1.0, 1.0);
Int_t nn;
for (Int_t i=0; i<1000; ++i)
{
TString file(Form("ev-report-%03d.txt", i));
if (gSystem->AccessPathName(file) == kFALSE)
{
Int_t ev, ntr;
FILE* f = fopen(file, "read");
nn = fscanf(f, "Event = %d Ntracks = %d", &ev, &ntr);
if (nn != 2) { printf("SAFR1 %d\n", nn); fclose(f); return; }
hcnt->Fill(ntr);
for (Int_t t=0; t<ntr; ++t)
{
Int_t id, chg;
Float_t pt, eta;
nn = fscanf(f, "%d: chg=%d pt=%f eta=%f", &id, &chg, &pt, &eta);
if (nn != 4) { printf("SAFR2 %d\n", nn); fclose(f); return; }
hchg->Fill(chg);
hpt ->Fill(pt);
heta->Fill(eta);
}
fclose(f);
}
}
TCanvas* c;
if (gPad == 0 || gPad->GetCanvas()->IsEditable() == kFALSE) {
c = new TCanvas("Scanwas", "Scanning Results", 800, 600);
} else {
c = gPad->GetCanvas();
c->Clear();
}
c->Divide(2, 2);
c->cd(1); hcnt->Draw();
c->cd(2); hchg->Draw();
c->cd(3); hpt ->Draw();
c->cd(4); heta->Draw();
c->Modified();
c->Update();
}
void TEveTrackCounterEditor::DoClickAction(Int_t mode)
{
fM->SetClickAction(mode);
}
Last update: Thu Jan 17 08:49:26 2008
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.