From Stefano:
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveLegoEditor.cxx
index 0c0a6fb5659ce752535970b97919847170c7e42e..c19e58f7cacbf59a484dec7c91aff99f3a3a269a 100644 (file)
@@ -34,31 +34,38 @@ AliEveLegoEditor::AliEveLegoEditor(const TGWindow *p, Int_t width, Int_t height,
              UInt_t options, Pixel_t back) :
   TGedFrame(p, width, height, options | kVerticalFrame, back),
   fM(0),
-
   fAllEventsButton(0),
   fParticlesBG(0),
   fTrackSelection(0),
-  fEventSelection(0),
-  fRevents(0),
+  fPosCharged(0),
+  fNegCharged(0),
+  fElectrons(0),
+  fMuons(0),
+  fPions(0),
+  fKaons(0),
+  fProtons(0),
   fLabel(0),
   fLabel1(0),
   fThreshold(0),
   fMaxPt(0),
   fSelect(0),
-  fButtonPrev(0),
-  fButtonNext(0),
-
-  fParticlesBGAE(0),
+  fParticlesBGAE(0),  
   fTrackSelectionAE(0),
-  fEventSelectionAE(0),
-  fReventsAE(0),
+  fPosChargedAE(0),
+  fNegChargedAE(0),
+  fElectronsAE(0),
+  fMuonsAE(0),
+  fPionsAE(0),
+  fKaonsAE(0),
+  fProtonsAE(0),
+  fApplyChanges(0),
   fLabelAE(0),
   fLabel1AE(0),
   fThresholdAE(0),
   fMaxPtAE(0),
-  fSelectAE(0),
-  fButtonPrevAE(0),
-  fButtonNextAE(0)
+  fEventControl(0),
+  fIsMC(kFALSE),
+  fCollisionCandidatesOnly(0)
 {
   // Constructor.
   MakeTitle("AliEveLego");
@@ -68,13 +75,41 @@ AliEveLegoEditor::AliEveLegoEditor(const TGWindow *p, Int_t width, Int_t height,
   AddFrame(fAllEventsButton, new TGLayoutHints(kLHintsExpandX));
   fAllEventsButton->Connect("Clicked()", "AliEveLegoEditor", this, "DoAllEvents()");
 
-  fParticlesBG = new TGButtonGroup(this, "Charge selection:", kVerticalFrame);
-  fRcharge[0] = new TGRadioButton(fParticlesBG, new TGHotString("&Positive and negative"));
-  fRcharge[1] = new TGRadioButton(fParticlesBG, new TGHotString("&Only positive"));
-  fRcharge[2] = new TGRadioButton(fParticlesBG, new TGHotString("&Only negative"));
-  fRcharge[0]->SetState(kButtonDown);
+  fParticlesBG = new TGGroupFrame(this, "Particle selection:", kVerticalFrame);
+  fPosCharged  = new TGCheckButton(fParticlesBG, new TGHotString("&Positive charged"));
+  fNegCharged  = new TGCheckButton(fParticlesBG, new TGHotString("&Negative charged"));
+  fElectrons   = new TGCheckButton(fParticlesBG, new TGHotString("&Electrons"));
+  fMuons       = new TGCheckButton(fParticlesBG, new TGHotString("&Muons"));
+  fPions       = new TGCheckButton(fParticlesBG, new TGHotString("&Pions"));
+  fKaons       = new TGCheckButton(fParticlesBG, new TGHotString("&Kaons"));
+  fProtons     = new TGCheckButton(fParticlesBG, new TGHotString("&Protons"));
+
+  fPosCharged->SetState(kButtonDown);
+  fNegCharged->SetState(kButtonDown);
+  fElectrons->SetState(kButtonUp);
+  fMuons->SetState(kButtonUp);
+  fPions->SetState(kButtonUp);
+  fKaons->SetState(kButtonUp);
+  fProtons->SetState(kButtonUp);
+
+  fPosCharged->Connect("Clicked()", "AliEveLegoEditor", this, "ShowPosCharge()");
+  fNegCharged->Connect("Clicked()", "AliEveLegoEditor", this, "ShowNegCharge()");
+  fElectrons->Connect("Clicked()", "AliEveLegoEditor", this, "ShowElectrons()");
+  fMuons->Connect("Clicked()", "AliEveLegoEditor", this, "ShowMuons()");
+  fPions->Connect("Clicked()", "AliEveLegoEditor", this, "ShowPions()");
+  fKaons->Connect("Clicked()", "AliEveLegoEditor", this, "ShowKaons()");
+  fProtons->Connect("Clicked()", "AliEveLegoEditor", this, "ShowProtons()");
+
+  fParticlesBG->AddFrame(fPosCharged, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+  fParticlesBG->AddFrame(fNegCharged, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+  fParticlesBG->AddFrame(fElectrons, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+  fParticlesBG->AddFrame(fMuons, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+  fParticlesBG->AddFrame(fPions, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+  fParticlesBG->AddFrame(fKaons, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+  fParticlesBG->AddFrame(fProtons, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+  fParticlesBG->SetLayoutManager(new TGVerticalLayout(fParticlesBG));
+
   AddFrame(fParticlesBG, new TGLayoutHints(kLHintsExpandX));
-  fParticlesBG->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByCharge(Int_t)");
 
   fTrackSelection = new TGButtonGroup(this, "Track selection:", kHorizontalFrame);
   fRtracks[0] = new TGRadioButton(fTrackSelection, new TGHotString("&All tracks  "));
@@ -115,90 +150,106 @@ AliEveLegoEditor::AliEveLegoEditor(const TGWindow *p, Int_t width, Int_t height,
   horz1->AddFrame( fThreshold, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY));
 
 
+}
 
-  //***************
-
-  // Events selection
-  fEventSelection = new TGGroupFrame(this, "Event selection:", kHorizontalFrame);
-
-  fRevents = new TGCheckButton(fEventSelection, new TGHotString("&Show info "));
-  fRevents->SetState(kButtonUp);
-  fRevents->Connect("Clicked()", "AliEveLegoEditor", this, "ShowEventSelection()");
-  fEventSelection->AddFrame(fRevents, new TGLayoutHints(kLHintsLeft | kLHintsTop));
-
-  fSelect = new TGComboBox(fEventSelection,-1,kHorizontalFrame | kSunkenFrame | kDoubleBorder | kOwnBackground);
-  fSelect->AddEntry("All events",0);
-  fSelect->AddEntry("Beam 1",1);
-  fSelect->AddEntry("Beam 2",2);
-  fSelect->AddEntry("Beams 1 & 2",3);
-  fSelect->Resize(102,22);
-  fSelect->Select(0);
-  fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
-
-  fSelect->Connect("Selected(Int_t)", "AliEveLegoEditor", this, "SelectEventSelection(Int_t)");
-
-  AddFrame(fEventSelection, new TGLayoutHints(kLHintsExpandX));
-
-  //**********
+/******************************************************************************/
 
-  TGHorizontalFrame *horz3 = new TGHorizontalFrame(this);
+//______________________________________________________________________________
+void AliEveLegoEditor::SetModel(TObject* obj)
+{
+  fM = dynamic_cast<AliEveLego*>(obj);
+}
 
-  fButtonPrev = new TGTextButton(horz3, "Previous event");
-  horz3->AddFrame(fButtonPrev, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX));
-  fButtonPrev->Connect("Clicked()", "AliEveLegoEditor", this, "ShowPrevEvent()");
+//______________________________________________________________________________
+void AliEveLegoEditor::DoAllEvents()
+{
+  fAllEventsButton->SetEnabled(kFALSE);
+  CreateAllEventsEditor();
+  fM->LoadAllEvents();
+}
 
-  fButtonNext = new TGTextButton(horz3, "Next event");
-  horz3->AddFrame( fButtonNext, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsExpandX));
-  fButtonNext->Connect("Clicked()", "AliEveLegoEditor", this, "ShowNextEvent()");
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowPosCharge()
+{   
+  fM->SetParticleType(0);
+}
 
-  AddFrame(horz3, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowNegCharge()
+{
+  fM->SetParticleType(1);
+}
 
-  //**********
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowElectrons()
+{
+  fM->SetParticleType(2);
+}
 
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowMuons()
+{
+  fM->SetParticleType(3);
+}
 
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowPions()
+{
+  fM->SetParticleType(4);
 }
 
-/******************************************************************************/
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowKaons()
+{
+  fM->SetParticleType(5);
+}
 
 //______________________________________________________________________________
-void AliEveLegoEditor::SetModel(TObject* obj)
+void AliEveLegoEditor::ShowProtons()
 {
-  fM = dynamic_cast<AliEveLego*>(obj);
+  fM->SetParticleType(6);
 }
 
-/******************************************************************************/
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowPosChargeAE()
+{
+   fM->SetParticleTypeAE(0);
+}
 
-// Implements callback/slot methods
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowNegChargeAE()
+{
+  fM->SetParticleTypeAE(1);
+}
 
 //______________________________________________________________________________
-// void AliEveLegoEditor::DoXYZZ()
-// {
-//    // Slot for XYZZ.
-//
-//    fM->SetXYZZ(fXYZZ->GetValue());
-//    Update();
-// }
+void AliEveLegoEditor::ShowElectronsAE()
+{
+  fM->SetParticleTypeAE(2);
+}
 
 //______________________________________________________________________________
-void AliEveLegoEditor::DoAllEvents()
+void AliEveLegoEditor::ShowMuonsAE()
 {
-  // Slot for XYZZ.
-  fAllEventsButton->SetEnabled(kFALSE);
-  CreateAllEventsEditor();
-  fM->LoadAllEvents();
+  fM->SetParticleTypeAE(3);
+}
 
+//______________________________________________________________________________
+void AliEveLegoEditor::ShowPionsAE()
+{
+  fM->SetParticleTypeAE(4);
 }
 
 //______________________________________________________________________________
-void AliEveLegoEditor::ShowByCharge(Int_t id)
-{   
-  fM->SetCharge(id);
+void AliEveLegoEditor::ShowKaonsAE()
+{
+  fM->SetParticleTypeAE(5);
 }
 
 //______________________________________________________________________________
-void AliEveLegoEditor::ShowByChargeAE(Int_t id)
+void AliEveLegoEditor::ShowProtonsAE()
 {
-   fM->SetAllEventsCharge(id);
+  fM->SetParticleTypeAE(6);
 }
 
 //______________________________________________________________________________
@@ -237,41 +288,54 @@ void AliEveLegoEditor::ShowByTracksAE(Int_t id)
    fM->SetTracksAE(id);
 }
 
-//______________________________________________________________________________
-void AliEveLegoEditor::ShowByEvents(Int_t id)
-{
-   fM->SetEvents(id);
-}
-
-//______________________________________________________________________________
-void AliEveLegoEditor::ShowEventSelection()
-{
-   fM->SetEventSelection();
-}
-
-//______________________________________________________________________________
-void AliEveLegoEditor::SelectEventSelection(Int_t id)
-{
-   fM->SelectEventSelection(id);
-}
-
 //______________________________________________________________________________
 void AliEveLegoEditor::CreateAllEventsEditor()
 {
    // create the GUI of all events
    TGVerticalFrame *this2 = this->CreateEditorTabSubFrame("All events style");
 
-   TGLabel *ftitle = new TGLabel(this2, "AliLego all events ------");
-   this2->AddFrame(ftitle, new TGLayoutHints(kLHintsLeft | kLHintsCenterY));
+   fEventControl = new TGButtonGroup(this2, "Event control:", kVerticalFrame);
+   fIsMC = new TGCheckButton(fEventControl, new TGHotString("&Data is from simulation (MC)"));
+   fCollisionCandidatesOnly = new TGCheckButton(fEventControl, new TGHotString("&Only collision candidates events"));
+
+   fIsMC->SetState(kButtonUp);
+   fCollisionCandidatesOnly->SetState(kButtonUp);
+
+   fIsMC->Connect("Clicked()", "AliEveLegoEditor", this, "DataIsMC()");
+   fCollisionCandidatesOnly->Connect("Clicked()", "AliEveLegoEditor", this, "CollisionCandidatesOnly()");
+   this2->AddFrame(fEventControl, new TGLayoutHints(kLHintsExpandX));
+
+   fParticlesBGAE = new TGButtonGroup(this2, "Particle selection:", kVerticalFrame);
+
+   fPosChargedAE  = new TGCheckButton(fParticlesBGAE, new TGHotString("&Positive charged"));
+   fNegChargedAE  = new TGCheckButton(fParticlesBGAE, new TGHotString("&Negative charged"));
+   fElectronsAE   = new TGCheckButton(fParticlesBGAE, new TGHotString("&Electrons"));
+   fMuonsAE       = new TGCheckButton(fParticlesBGAE, new TGHotString("&Muons"));
+   fPionsAE       = new TGCheckButton(fParticlesBGAE, new TGHotString("&Pions"));
+   fKaonsAE       = new TGCheckButton(fParticlesBGAE, new TGHotString("&Kaons"));
+   fProtonsAE     = new TGCheckButton(fParticlesBGAE, new TGHotString("&Protons"));
+
+   fPosChargedAE->SetState(kButtonDown);
+   fNegChargedAE->SetState(kButtonDown);
+   fElectronsAE->SetState(kButtonUp);
+   fMuonsAE->SetState(kButtonUp);
+   fPionsAE->SetState(kButtonUp);
+   fKaonsAE->SetState(kButtonUp);
+   fProtonsAE->SetState(kButtonUp);
+
+   fPosChargedAE->Connect("Clicked()", "AliEveLegoEditor", this, "ShowPosChargeAE()");
+   fNegChargedAE->Connect("Clicked()", "AliEveLegoEditor", this, "ShowNegChargeAE()");
+   fElectronsAE->Connect("Clicked()", "AliEveLegoEditor", this, "ShowElectronsAE()");
+   fMuonsAE->Connect("Clicked()", "AliEveLegoEditor", this, "ShowMuonsAE()");
+   fPionsAE->Connect("Clicked()", "AliEveLegoEditor", this, "ShowPionsAE()");
+   fKaonsAE->Connect("Clicked()", "AliEveLegoEditor", this, "ShowKaonsAE()");
+   fProtonsAE->Connect("Clicked()", "AliEveLegoEditor", this, "ShowProtonsAE()");
 
-   fParticlesBGAE = new TGButtonGroup(this2, "Charge selection:", kVerticalFrame);
-   fRchargeAE[0] = new TGRadioButton(fParticlesBGAE, new TGHotString("&Positive and negative"));
-   fRchargeAE[1] = new TGRadioButton(fParticlesBGAE, new TGHotString("&Only positive"));
-   fRchargeAE[2] = new TGRadioButton(fParticlesBGAE, new TGHotString("&Only negative"));
-   fRchargeAE[0]->SetState(kButtonDown);
    this2->AddFrame(fParticlesBGAE, new TGLayoutHints(kLHintsExpandX));
 
-   fParticlesBGAE->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByChargeAE(Int_t)");
+   fApplyChanges = new TGTextButton(this2, "Apply particle selection");
+   this2->AddFrame(fApplyChanges, new TGLayoutHints(kLHintsExpandX));
+   fApplyChanges->Connect("Clicked()", "AliEveLegoEditor", this, "ApplyChanges()");
 
    fTrackSelectionAE = new TGButtonGroup(this2, "Track selection:", kHorizontalFrame);
    fRtracksAE[0] = new TGRadioButton(fTrackSelectionAE, new TGHotString("&All tracks  "));
@@ -314,17 +378,23 @@ void AliEveLegoEditor::CreateAllEventsEditor()
 
    this2->AddFrame(horz1AE, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
 
+
 }
 
 //______________________________________________________________________________
-void AliEveLegoEditor::ShowPrevEvent()
+void AliEveLegoEditor::ApplyChanges()
 {
-   fM->ShowPrevEvent();
+  fM->ApplyParticleTypeSelectionAE();
 }
 
 //______________________________________________________________________________
-void AliEveLegoEditor::ShowNextEvent()
+void AliEveLegoEditor::DataIsMC()
 {
-   fM->ShowNextEvent();
+  fM->SwitchDataType();
 }
 
+//______________________________________________________________________________
+void AliEveLegoEditor::CollisionCandidatesOnly()
+{
+  fM->SetCollisionCandidatesOnly();
+}