#include "TGComboBox.h"
#include "TGMsgBox.h"
+#include "TTree.h"
#include "TH1F.h"
#include "TCanvas.h"
+#include "TLatex.h"
#include "TEveManager.h"
#include "TROOT.h"
AliEveTrackCounterEditor::AliEveTrackCounterEditor(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)
+ fM(0), fAF(0), fDF(0),
+ fClickAction(0),
+ fInfoLabelTracks (0),
+ fInfoLabelTracklets(0),
+ fEventId(0)
{
// Constructor.
Int_t labelW = 42;
+
+ // Active frame
+
+ fAF = new TGVerticalFrame(this);
+
+ { // Deactivate button
+ TGHorizontalFrame* f = new TGHorizontalFrame(fAF, 210, 20, kFixedWidth);
+
+ TGTextButton* b = new TGTextButton(f, "Deactivate");
+ f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 4));
+ b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoDeactivate()");
+
+ fAF->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
+ }
{ // ClickAction
- TGHorizontalFrame* f = new TGHorizontalFrame(this);
+ TGHorizontalFrame* f = new TGHorizontalFrame(fAF);
TGLabel* lab = new TGLabel(f, "Click:");
f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 2));
fClickAction = new TGComboBox(f);
"DoClickAction(Int_t)");
f->AddFrame(fClickAction, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
- AddFrame(f);
+ fAF->AddFrame(f);
}
-
- { // Status
- TGHorizontalFrame* f = new TGHorizontalFrame(this);
- TGLabel* lab = new TGLabel(f, "Status:");
+ { // fInfoLabelTracks
+ TGHorizontalFrame* f = new TGHorizontalFrame(fAF);
+ TGLabel* lab = new TGLabel(f, "Tracks:");
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));
+ fInfoLabelTracks = new TGLabel(f);
+ f->AddFrame(fInfoLabelTracks, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 9, 1, 2));
- AddFrame(f);
+ fAF->AddFrame(f);
}
+ { // fInfoLabelTracklets
+ TGHorizontalFrame* f = new TGHorizontalFrame(fAF);
+ TGLabel* lab = new TGLabel(f, "Tracklets:");
+ f->AddFrame(lab, new TGLayoutHints(kLHintsLeft, 1, 5, 1, 2));
+
+ fInfoLabelTracklets = new TGLabel(f);
+ f->AddFrame(fInfoLabelTracklets, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 9, 1, 2));
+ fAF->AddFrame(f);
+ }
{
- TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
+ TGHorizontalFrame* f = new TGHorizontalFrame(fAF, 210, 20, kFixedWidth);
TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
TGLabel* l = new TGLabel(g, "Event:");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoNext()");
- AddFrame(f);
+ fAF->AddFrame(f);
}
-
{
- TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
+ TGHorizontalFrame* f = new TGHorizontalFrame(fAF, 210, 20, kFixedWidth);
TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
TGLabel* l = new TGLabel(g, "Report:");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoFileReport()");
- AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 0));
+ fAF->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 0));
}
{
- TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
+ TGHorizontalFrame* f = new TGHorizontalFrame(fAF, 210, 20, kFixedWidth);
TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
TGLabel* l = new TGLabel(g, "Histos:");
f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoShowHistos()");
- AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
+ fAF->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
}
- AliEveEventManager::GetMaster()->Connect("NewEventLoaded()",
- "AliEveTrackCounterEditor", this, "UpdateModel()");
+ AddFrame(fAF, new TGLayoutHints(kLHintsNormal|kLHintsExpandX|kLHintsExpandY));
+
+
+ // Disabled frame
+
+ fDF = new TGVerticalFrame(this);
+
+ { // Activate button
+ TGHorizontalFrame* f = new TGHorizontalFrame(fDF, 210, 20, kFixedWidth);
+
+ TGTextButton* b = new TGTextButton(f, "Activate");
+ f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
+ b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoActivate()");
+
+ fDF->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
+ }
+
+ AddFrame(fDF, new TGLayoutHints(kLHintsNormal|kLHintsExpandX|kLHintsExpandY));
+
+ AliEveEventManager::GetMaster()->Connect("NewEventLoaded()", "AliEveTrackCounterEditor", this, "UpdateModel()");
}
AliEveTrackCounterEditor::~AliEveTrackCounterEditor()
fM = dynamic_cast<AliEveTrackCounter*>(obj);
- fClickAction->Select(fM->fClickAction, kFALSE);
- fInfoLabel->SetText(Form("All: %3d; Primaries: %3d", fM->fAllTracks, fM->fGoodTracks));
- fEventId->SetNumber(fM->GetEventId());
+ if (fM->GetActive())
+ {
+ ShowFrame(fAF); HideFrame(fDF);
+
+ fClickAction->Select(fM->fClickAction, kFALSE);
+ fInfoLabelTracks ->SetText(Form("All: %3d; Primaries: %3d", fM->fAllTracks, fM->fGoodTracks));
+ fInfoLabelTracklets->SetText(Form("All: %3d; Primaries: %3d", fM->fAllTracklets, fM->fGoodTracklets));
+ fEventId->SetNumber(fM->GetEventId());
+ }
+ else
+ {
+ ShowFrame(fDF); HideFrame(fAF);
+ }
+
+ Layout();
+}
+
+/******************************************************************************/
+
+void AliEveTrackCounterEditor::DoActivate()
+{
+ // Activate track-counter
+
+ fM->SetActive(kTRUE);
+ AliEveEventManager::GetMaster()->GotoEvent(AliEveEventManager::GetMaster()->GetEventId());
+ fGedEditor->Layout();
+}
+
+void AliEveTrackCounterEditor::DoDeactivate()
+{
+ // Deactivate track-counter.
+
+ fM->SetActive(kFALSE);
+ AliEveEventManager::GetMaster()->GotoEvent(AliEveEventManager::GetMaster()->GetEventId());
}
/******************************************************************************/
void AliEveTrackCounterEditor::DoSetEvent()
{
// Slot for SetEvent.
+
AliEveEventManager::GetMaster()->GotoEvent((Int_t) fEventId->GetNumber());
}
{
// Slot for PrintReport.
- fM->OutputEventTracks();
+ fM->PrintEventTracks();
}
//______________________________________________________________________________
{
// Slot for FileReport.
- 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");
- if (out) {
- fM->OutputEventTracks(out);
- fclose(out);
- } else {
- Error("AliEveTrackCounterEditor::DoFileReport",
- "Can not open file '%s' for writing.", file.Data());
- }
+ fM->OutputEventTracks();
}
//______________________________________________________________________________
{
// Slot for ShowHistos.
- 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; // fscanf return value
-
- 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();
+ TEveUtil::Macro("make_scan_results.C");
+ TEveUtil::Macro("show_scan_results.C");
}
/******************************************************************************/