]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
From Stefano Carrazza:
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Aug 2010 12:48:52 +0000 (12:48 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Aug 2010 12:48:52 +0000 (12:48 +0000)
Display of TGLOverlayButton's for run, event and trigger information
for the ESD data.

EVE/EveBase/AliEveBeamsInfo.cxx
EVE/EveBase/AliEveBeamsInfo.h
EVE/EveBase/AliEveBeamsInfoEditor.cxx
EVE/EveBase/AliEveBeamsInfoEditor.h
EVE/EveBase/AliEveLego.cxx
EVE/EveBase/AliEveLego.h
EVE/EveBase/AliEveLegoEditor.cxx
EVE/EveBase/AliEveLegoEditor.h

index 4125d289fca6c82bc6640b65b782dc01d9786dc5..26cd19596b080bb9a57e421fd5836cf81fad35c8 100644 (file)
@@ -1,5 +1,5 @@
 // $Id$
-// Author: Stefano Carrazza 2010
+// Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
 
 /**************************************************************************
  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
@@ -13,6 +13,7 @@
 #include "AliEveEventManager.h"
 #include "AliEveEventSelector.h"
 #include "AliEveMultiView.h"
+#include "AliRawEventHeaderBase.h"
 
 #include "TEveWindow.h"
 #include "TEveManager.h"
 #include "TEveViewer.h"
 #include "TEveScene.h"
 #include "TGLOverlayButton.h"
+#include "TTimeStamp.h"
 
 
 //______________________________________________________________________________
-// This class provides the triggers information about beams.
+// This class provides:
+//
+// 1) Run and event information from ESD as TGLOverlayButtons.
+//
+// 2) Determine for real and MC data if the event is collision candidate or not.
+//
+// 3) Possibility to filter events per type.
 //
 
 ClassImp(AliEveBeamsInfo)
@@ -31,12 +39,30 @@ ClassImp(AliEveBeamsInfo)
 //______________________________________________________________________________
 AliEveBeamsInfo::AliEveBeamsInfo(const char* name) :
   TEveElementList(name),
+  fAlpha(1.5),
+  fIsMC(kFALSE),
   fEsd(0),
   fShowEventsInfo(kTRUE),
   fPhysicsSelection(0),
+  fEventNumber(0),
   fCollisionCandidate(0),
+  fCollisionBoolean(0),
   fBeam1(0),
+  fBeam1Boolean(0),
   fBeam2(0),
+  fBeam2Boolean(0),
+  fRunNumber(0),
+  fEventType(0),
+  fEventTypeLabel(0),
+  fPeriod(0),
+  fOrbit(0),
+  fBC(0),
+  fTimeStamp(0),
+  fMagnetField(0),
+  fTrigger(0),
+  fTriggerClassesPanel(0),
+  fNumberOfActiveTriggerClasses(0),
+  fTriggerClasses(0),
   fAl(0),
   fHisto2dv(0),
   fEventSelector(0)
@@ -44,7 +70,7 @@ AliEveBeamsInfo::AliEveBeamsInfo(const char* name) :
   // Constructor.
   gEve->AddToListTree(this,0);
 
-  // get current ESD event
+  // Get current ESD event
   fEsd = AliEveEventManager::AssertESD();
   fAl = AliEveMultiView::Instance();  
   fEventSelector = AliEveEventManager::GetMaster()->GetEventSelector();
@@ -54,15 +80,11 @@ AliEveBeamsInfo::AliEveBeamsInfo(const char* name) :
   fPhysicsSelection->SetAnalyzeMC(kFALSE);
   fPhysicsSelection->Initialize(fEsd->GetRunNumber());
 
-  // loading physics selection and triggers buttons
-  fCollisionCandidate = new TGLOverlayButton(0, "", 10.0, -10.0, 190.0, 20.0);
-  fCollisionCandidate->SetAlphaValues(1.5,1.5);
-  fBeam1 = new TGLOverlayButton(0, "", 10.0, -30.0, 190.0, 20.0);
-  fBeam1->SetAlphaValues(1.5,1.5);
-  fBeam2 = new TGLOverlayButton(0, "", 10.0, -50.0, 190.0, 20.0);
-  fBeam2->SetAlphaValues(1.5,1.5);
+  // Loading physics selection and triggers buttons
+  CreateEventPanel();
+  CreateRunPanel();
 
-  // show beams info
+  // Show beams info
   ShowBeamsInfo(fShowEventsInfo, kFALSE);
 
 }
@@ -70,69 +92,207 @@ AliEveBeamsInfo::AliEveBeamsInfo(const char* name) :
 //______________________________________________________________________________
 AliEveBeamsInfo::~AliEveBeamsInfo()
 {
-  // deleting variables
+  // Deleting variables
   delete fEsd;
   delete fPhysicsSelection;
+  delete fEventNumber;
   delete fCollisionCandidate;
+  delete fCollisionBoolean;
   delete fBeam1;
+  delete fBeam1Boolean;
   delete fBeam2;
+  delete fBeam2Boolean;
+  delete fRunNumber;
+  delete fPeriod;
+  delete fOrbit;
+  delete fBC;
+  delete fTimeStamp;
+  delete fMagnetField;
+  delete fTrigger;
+  delete fTriggerClassesPanel;  
+  delete fEventType;
+  delete fEventTypeLabel;
   delete fAl;
   delete fHisto2dv;
+  RemoveTriggerClasses();
+}
+
+//______________________________________________________________________________
+void AliEveBeamsInfo::CreateEventPanel()
+{
+  // Create vertical panel
+  Double_t fPosx = 10.0;
+  Double_t fPosy = -10.0;
+  Double_t fXlengh = 220.0;
+  Double_t fStep = 20.0; 
 
+  fEventNumber = new TGLOverlayButton(0 , "", fPosx, fPosy, fXlengh, fStep);
+  fPosy-=fStep;
+
+  fCollisionCandidate = new TGLOverlayButton(0, "Collision:", fPosx, fPosy, fXlengh-fXlengh/2.0, fStep);
+  fCollisionBoolean = new TGLOverlayButton(0, "", fPosx+fXlengh/2.0, fPosy, fXlengh/2.0, fStep);
+  fPosy-=fStep;
+
+  fBeam1 = new TGLOverlayButton(0, "Beam 1:", fPosx, fPosy, fXlengh-fXlengh/2.0, fStep);
+  fBeam1Boolean = new TGLOverlayButton(0, "", fPosx+fXlengh/2.0, fPosy, fXlengh/2.0, fStep);
+  fPosy-=fStep;
+
+  fBeam2 = new TGLOverlayButton(0, "Beam 2:", fPosx, fPosy, fXlengh-fXlengh/2.0, fStep);
+  fBeam2Boolean = new TGLOverlayButton(0, "", fPosx+fXlengh/2.0, fPosy, fXlengh/2.0, fStep);
+
+  fPosy-=2*fStep;
+  fTriggerClassesPanel = new TGLOverlayButton(0, "Active trigger classes:", fPosx, fPosy, fXlengh, fStep);
 }
 
+//______________________________________________________________________________
+void AliEveBeamsInfo::CreateRunPanel()
+{
+  // Create horizontal panel
+  Double_t fPosy = -10.0;
+  Double_t fPosx = 250.0;
+  Double_t fStep = 20.0;
+  Double_t fXlengh = 120.0;
+  TString fText;
+
+  fText.Form("Run #: %d",fEsd->GetRunNumber());
+  fRunNumber = new TGLOverlayButton(0, fText.Data(), fPosx, fPosy, fXlengh, fStep);
+  fPosx+=fXlengh;
+
+  fEventType = new TGLOverlayButton(0, "", fPosx, fPosy , fXlengh, fStep);
+  fPosx+=fXlengh;
+
+  fEventTypeLabel = new TGLOverlayButton(0, "", fPosx, fPosy, 2*fXlengh, fStep);
+
+  // New line
+  fPosx = 250.0;
+  fPosy = -30.0;
+
+  fPeriod = new TGLOverlayButton(0, "", fPosx, fPosy, fXlengh, fStep);
+  fPosx+=fXlengh;
+
+  fOrbit = new TGLOverlayButton(0, "", fPosx, fPosy, fXlengh, fStep);
+  fPosx+=fXlengh;
+
+  fBC = new TGLOverlayButton(0, "", fPosx, fPosy, fXlengh, fStep);
+  fPosx+=fXlengh;
+
+  fTrigger = new TGLOverlayButton(0, "", fPosx, fPosy, fXlengh, fStep);
+
+  // New line
+  fPosx = 250.0;
+  fPosy = -50.0;
+
+  fTimeStamp = new TGLOverlayButton(0, "", fPosx, fPosy, 2*fXlengh, fStep);
+  fPosx+=2*fXlengh;
+
+  fMagnetField = new TGLOverlayButton(0, "", fPosx, fPosy, 2*fXlengh, fStep);
+  fPosx+=2*fXlengh;
+}
+
+//______________________________________________________________________________
 void AliEveBeamsInfo::ShowBeamsInfo(Bool_t show, Bool_t updateonly)
 {
-  // Collision candidate
+  // Update & setup TGLOverlayButtons
   fHisto2dv = (TEveViewer*) gEve->GetViewers()->FindChild("2D Lego Viewer");
 
-  if (show == 0)
+  if (!show)
   {
+    RemoveOverlayButton(fEventNumber);
+    RemoveOverlayButton(fCollisionCandidate);
+    RemoveOverlayButton(fCollisionBoolean);
+    RemoveOverlayButton(fBeam1);
+    RemoveOverlayButton(fBeam1Boolean);
+    RemoveOverlayButton(fBeam2);
+    RemoveOverlayButton(fBeam2Boolean);
+
+    RemoveOverlayButton(fRunNumber);
+    RemoveOverlayButton(fEventType);
+    RemoveOverlayButton(fEventTypeLabel);
+    RemoveOverlayButton(fPeriod);
+    RemoveOverlayButton(fOrbit);
+    RemoveOverlayButton(fBC);
+    RemoveOverlayButton(fTimeStamp);
+    RemoveOverlayButton(fMagnetField);
+    RemoveOverlayButton(fTrigger);
+
+    RemoveOverlayButton(fTriggerClassesPanel);
+    RemoveTriggerClasses();
+  } else {
 
-    gEve->GetDefaultGLViewer()->RemoveOverlayElement(fCollisionCandidate);
-    fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fCollisionCandidate);
-    if(fHisto2dv)
-      fHisto2dv->GetGLViewer()->RemoveOverlayElement(fCollisionCandidate);
+  if (!updateonly)
+  {
+    AddOverlayButton(fEventNumber);
+    AddOverlayButton(fCollisionCandidate);
+    AddOverlayButton(fCollisionBoolean);
+    AddOverlayButton(fBeam1);
+    AddOverlayButton(fBeam1Boolean);
+    AddOverlayButton(fBeam2);
+    AddOverlayButton(fBeam2Boolean);
+
+    AddOverlayButton(fRunNumber);
+    AddOverlayButton(fEventType);
+    AddOverlayButton(fEventTypeLabel);
+    AddOverlayButton(fPeriod);
+    AddOverlayButton(fOrbit);
+    AddOverlayButton(fBC);
+    AddOverlayButton(fTimeStamp);
+    AddOverlayButton(fMagnetField);
+    AddOverlayButton(fTrigger);
+
+    AddOverlayButton(fTriggerClassesPanel);
+    AddTriggerClasses();
+  }
 
-    gEve->GetDefaultGLViewer()->RemoveOverlayElement(fBeam1);
-    fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fBeam1);
-    if(fHisto2dv)
-      fHisto2dv->GetGLViewer()->RemoveOverlayElement(fBeam1);
+  TString fText;
+  fText.Form("Event #: %d", fEsd->GetEventNumberInFile());
+  fEventNumber->SetText(fText.Data());
 
-    gEve->GetDefaultGLViewer()->RemoveOverlayElement(fBeam2);
-    fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(fBeam2);
-    if(fHisto2dv)
-      fHisto2dv->GetGLViewer()->RemoveOverlayElement(fBeam2);
+  fText.Form("Event type: %d",fEsd->GetEventType());
+  fEventType->SetText(fText.Data());
 
+  if(fEsd->GetEventType() == 0)
+  {
+    fText.Form("UNKNOW EVENT TYPE");
   } else {
+    fText.Form("%s", AliRawEventHeaderBase::GetTypeName(fEsd->GetEventType()));
+  }
+  fEventTypeLabel->SetText(fText.Data());
+
+  fText.Form("Period: %x", fEsd->GetPeriodNumber());
+  fPeriod->SetText(fText.Data());
+
+  fText.Form("Orbit: %x", fEsd->GetOrbitNumber());
+  fOrbit->SetText(fText.Data());
+
+  fText.Form("BC: %x", fEsd->GetBunchCrossNumber());
+  fBC->SetText(fText.Data());
+
+  TTimeStamp ts(fEsd->GetTimeStamp());
+  fText.Form("Timestamp: %s",ts.AsString("s"));
+  fTimeStamp->SetText(fText.Data());
+
+  fText.Form("Magnetic field: %.2e kG", fEsd->GetMagneticField());
+  fMagnetField->SetText(fText.Data());
 
-  if (updateonly == kFALSE) {
-    gEve->GetDefaultGLViewer()->AddOverlayElement(fCollisionCandidate);
-    fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fCollisionCandidate);
-    if(fHisto2dv)
-      fHisto2dv->GetGLViewer()->AddOverlayElement(fCollisionCandidate);
+  if (fEsd->GetTriggerMask() > (ULong64_t) 100 && fIsMC == kFALSE)
+  {
+    fText.Form("Trigger: #");
+  } else {    
+    fText.Form("Trigger: %llx", fEsd->GetTriggerMask());
   }
+  fTrigger->SetText(fText.Data());
+
+  UpdateTriggerClasses();
 
   Bool_t ev = fPhysicsSelection->IsCollisionCandidate(fEsd);
 
   if (ev == 1)
   {
-     fCollisionCandidate->SetText("Collision candidate: YES");
+     fCollisionBoolean->SetText("YES");
+     fCollisionBoolean->SetBackColor(0x00ff00);
   } else {
-     fCollisionCandidate->SetText("Collision candidate: NO ");
-  }
-
-  // Beam 1 & 2 setup: method 1
-  if (updateonly == kFALSE) {
-     gEve->GetDefaultGLViewer()->AddOverlayElement(fBeam1);
-     fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fBeam1);
-     if(fHisto2dv)
-      fHisto2dv->GetGLViewer()->AddOverlayElement(fBeam1);
-
-     gEve->GetDefaultGLViewer()->AddOverlayElement(fBeam2);
-     fAl->Get3DView()->GetGLViewer()->AddOverlayElement(fBeam2);
-     if(fHisto2dv)
-      fHisto2dv->GetGLViewer()->AddOverlayElement(fBeam2);
+     fCollisionBoolean->SetText("NO");
+     fCollisionBoolean->SetBackColor(0xff0000);
   }
 
   Bool_t b1  = fEsd->IsTriggerClassFired("CINT1A-ABCE-NOPF-ALL");
@@ -141,20 +301,20 @@ void AliEveBeamsInfo::ShowBeamsInfo(Bool_t show, Bool_t updateonly)
 
   if (b1 == 1 || b12 == 1)
   {
-     fBeam1->SetText("Beam 1: YES");
-     fBeam1->SetBackColor(0x00ff00);
+     fBeam1Boolean->SetText("YES");
+     fBeam1Boolean->SetBackColor(0x00ff00);
   } else {
-     fBeam1->SetText("Beam 1: NO");
-     fBeam1->SetBackColor(0xff0000);
+     fBeam1Boolean->SetText("NO");
+     fBeam1Boolean->SetBackColor(0xff0000);
   }
 
   if (b2 == 1 || b12 == 1)
   {
-     fBeam2->SetText("Beam 2: YES");
-     fBeam2->SetBackColor(0x00ff00);
+     fBeam2Boolean->SetText("YES");
+     fBeam2Boolean->SetBackColor(0x00ff00);
   } else {
-     fBeam2->SetText("Beam 2: NO");
-     fBeam2->SetBackColor(0xff0000);
+     fBeam2Boolean->SetText("NO");
+     fBeam2Boolean->SetBackColor(0xff0000);
   }
 }
 
@@ -165,28 +325,44 @@ gEve->Redraw3D(kTRUE);
 //______________________________________________________________________________
 void AliEveBeamsInfo::Update()
 {
-  // update beams information for current event
+  // Update beams information for current event
   ShowBeamsInfo(fShowEventsInfo, kTRUE);
 }
 
 //______________________________________________________________________________
-void AliEveBeamsInfo::ShowEventSelection()
+void AliEveBeamsInfo::AddOverlayButton(TGLOverlayButton *button)
 {
-  // activate/deactivate info box
-  if (fShowEventsInfo == 0)
-  {
-    fShowEventsInfo = 1;
-  } else {
-    fShowEventsInfo = 0;
-  }
+  // Add buttons to viewers
+  button->SetAlphaValues(fAlpha, fAlpha);
+
+  gEve->GetDefaultGLViewer()->AddOverlayElement(button);
+  fAl->Get3DView()->GetGLViewer()->AddOverlayElement(button);
+  if(fHisto2dv)
+    fHisto2dv->GetGLViewer()->AddOverlayElement(button);
+}
+
+//______________________________________________________________________________
+void AliEveBeamsInfo::RemoveOverlayButton(TGLOverlayButton *button)
+{
+  // Remove buttons to viewers
+  gEve->GetDefaultGLViewer()->RemoveOverlayElement(button);
+  fAl->Get3DView()->GetGLViewer()->RemoveOverlayElement(button);
+  if(fHisto2dv)
+    fHisto2dv->GetGLViewer()->RemoveOverlayElement(button);
+}
 
+//______________________________________________________________________________
+void AliEveBeamsInfo::ShowEventSelection(Bool_t status)
+{
+  // Activate/deactivate info box
+  fShowEventsInfo = status;
   ShowBeamsInfo(fShowEventsInfo);
 }
 
 //______________________________________________________________________________
 void AliEveBeamsInfo::SelectEventSelection(Int_t id)
 {
-  // show trigger information
+  // Show trigger information
   if (id == 0)
   {
      fEventSelector->SetSelectOnTriggerType(kFALSE);
@@ -201,14 +377,129 @@ void AliEveBeamsInfo::SelectEventSelection(Int_t id)
 //______________________________________________________________________________
 void AliEveBeamsInfo::ShowPrevEvent()
 {
-  // go to the previous event
+  // Go to the previous event
   AliEveEventManager::GetMaster()->PrevEvent();
 }
 
 //______________________________________________________________________________
 void AliEveBeamsInfo::ShowNextEvent()
 {
+  // Go to the next event
   AliEveEventManager::GetMaster()->NextEvent();
 }
 
+//______________________________________________________________________________
+void AliEveBeamsInfo::SwitchDataType(Bool_t status)
+{
+  // Activate/deactivate MC / real data type
+  fIsMC = status;
+
+  // Removing defaul physics selection
+  delete fPhysicsSelection;
+  fPhysicsSelection = NULL;
+
+  fPhysicsSelection = new AliPhysicsSelection();
+  fPhysicsSelection->SetAnalyzeMC(fIsMC);
+  fPhysicsSelection->Initialize(fEsd->GetRunNumber());
+  Update();
+}
+
+//______________________________________________________________________________
+void AliEveBeamsInfo::AddTriggerClasses()
+{
+  // Add trigger classes
+  if (!fTriggerClasses){
+
+    TString fTriggerNameString = fEsd->GetESDRun()->GetActiveTriggerClasses();
+    TString *fTriggerName = SepareTriggerClasses(fNumberOfActiveTriggerClasses, fTriggerNameString);
+
+    fTriggerClasses = new TGLOverlayButton*[fNumberOfActiveTriggerClasses];
+
+    Double_t fPosy = -130.0;
+    Double_t fStep = 20.0;
+    for (Int_t i = 0; i < fNumberOfActiveTriggerClasses; i++)
+    {
+      fTriggerClasses[i] = new TGLOverlayButton(0, fTriggerName[i].Data(), 10, fPosy, 220.0, 20);
+      fTriggerClasses[i]->SetBackColor(0xce970a);
+      fTriggerClasses[i]->SetAlphaValues(fAlpha, fAlpha);
+      fPosy-=fStep;
+
+      AddOverlayButton(fTriggerClasses[i]);
+    }
+  }
+}
+
+//______________________________________________________________________________
+void AliEveBeamsInfo::RemoveTriggerClasses()
+{
+  // Remove overlay buttons
+  for(Int_t i = 0; i < fNumberOfActiveTriggerClasses; i++)
+  {
+    RemoveOverlayButton(fTriggerClasses[i]);
+  }
+
+  delete[] fTriggerClasses;
+  fTriggerClasses = 0;
+}
+
+//______________________________________________________________________________
+void AliEveBeamsInfo::UpdateTriggerClasses()
+{
+  // Remove trigger information and update it
+  RemoveTriggerClasses();
+  AddTriggerClasses();
+}
+
+//______________________________________________________________________________
+TString *AliEveBeamsInfo::SepareTriggerClasses(Int_t &fNumberOfClasses, TString fTriggerSource)
+{
+  // Get trigger string and separe triggers into TString's
+  Int_t fStringLength = fTriggerSource.Length();
+  fNumberOfClasses = 0;
+
+  for (Int_t i = 1; i < fStringLength; i++)
+  {
+    TString fString = fTriggerSource(i,2);
+    if (fString == "  "){
+      fNumberOfClasses++;
+    }
+  }
+  fNumberOfClasses++;
+
+  TString *fTriggerResult = new TString[fNumberOfClasses];
+
+  Int_t fIndex = 1;
+  Int_t fLastIndex = 0;
+  Int_t fFirstIndex = 1;
+  Int_t fClassNumber = 0;
+  for(;;)
+  {
+    if(fIndex >= fStringLength) break;
+    TString fString = fTriggerSource(fIndex,1);
+    fIndex++;
+    fLastIndex++;
+    if (fString == " "){
+      fTriggerResult[fClassNumber] = fTriggerSource(fFirstIndex, fLastIndex-1);
+      fFirstIndex = fIndex+1;
+      fLastIndex = 0;
+      fIndex++;
+      fClassNumber++;
+    }
+  }
+  return fTriggerResult;
+}
+
+//______________________________________________________________________________
+void AliEveBeamsInfo::SetAlpha(Double_t val)
+{
+  // Set the new alpha value for TGLOverlayButton
+  fAlpha = val;
+
+  // First remove all buttons from viewers
+  ShowBeamsInfo(kFALSE);
+
+  // Then replot everything with the next alpha value
+  ShowBeamsInfo(kTRUE);
+}
+
 /******************************************************************************/
index 1e6a57d1cebdf059a1b75a73f88103221ed0ec94..a43452e030cfe4ac1c606ac4d34be0e1c6cb6571 100644 (file)
@@ -1,5 +1,5 @@
 // $Id$
-// Author: Stefano Carrazza 2010
+// Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
 
 /**************************************************************************
  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
@@ -20,9 +20,8 @@ class AliEveMultiView;
 class TGLOverlayButton;
 class TEveViewer;
 
-
 //______________________________________________________________________________
-// Display beams and triggers information on gl-viewers.
+// Display beams and triggers information on AliEve viewers, from ESD.
 //
 
 class AliEveBeamsInfo : public TEveElementList
@@ -30,27 +29,63 @@ class AliEveBeamsInfo : public TEveElementList
 public:
   AliEveBeamsInfo(const char* name="AliEveBeamsInfo");
   virtual ~AliEveBeamsInfo();
+  void ShowEventSelection(Bool_t status);
 
   // Set Methods
-  void ShowEventSelection();
+  void SetAlpha(Double_t val);
+
+  // Get Methods
+  TString * SepareTriggerClasses(Int_t &fNumberOfClasses, TString fTriggerSource);
 
   // Functions
-  void ShowBeamsInfo(Bool_t show, Bool_t updateonly = kFALSE);
-  void Update();
+  void AddOverlayButton(TGLOverlayButton *button);
+  void AddTriggerClasses();
+  void CreateEventPanel();
+  void CreateRunPanel();
+  void RemoveOverlayButton(TGLOverlayButton *button);
+  void RemoveTriggerClasses();
   void SelectEventSelection(Int_t id);
+  void ShowBeamsInfo(Bool_t show, Bool_t updateonly = kFALSE);
   void ShowPrevEvent();
   void ShowNextEvent();
+  void SwitchDataType(Bool_t status);
+  void Update();
+  void UpdateTriggerClasses();  
 
 private:
-  AliESDEvent *fEsd;                      // esd event
-  Bool_t fShowEventsInfo;                 // determine if show events info
-  AliPhysicsSelection *fPhysicsSelection; // physics selection object
-  TGLOverlayButton *fCollisionCandidate;  // AliPhysicsSelection button output
-  TGLOverlayButton *fBeam1;               // beam 1 information
-  TGLOverlayButton *fBeam2;               // beam 2 information
-  AliEveMultiView  *fAl;                  // multiview instance
-  TEveViewer *fHisto2dv;                  // 2D lego view
-  AliEveEventSelector *fEventSelector;    // current event selector
+  Double_t            fAlpha;                // Alpha value
+  Bool_t              fIsMC;                 // Check data type
+  AliESDEvent         *fEsd;                 // Esd event
+  Bool_t              fShowEventsInfo;       // Determine if show events info
+  AliPhysicsSelection *fPhysicsSelection;    // Physics selection object
+
+  TGLOverlayButton    *fEventNumber;         // Event number
+  TGLOverlayButton    *fCollisionCandidate;  // AliPhysicsSelection button output
+  TGLOverlayButton    *fCollisionBoolean;    // Collision boolean
+
+  TGLOverlayButton    *fBeam1;               // Beam 1 information
+  TGLOverlayButton    *fBeam1Boolean;        // Beam 1 boolean
+  TGLOverlayButton    *fBeam2;               // Beam 2 information
+  TGLOverlayButton    *fBeam2Boolean;        // Beam 2 boolean
+
+  TGLOverlayButton    *fRunNumber;           // Show data run number
+  TGLOverlayButton    *fEventType;           // Show event type
+  TGLOverlayButton    *fEventTypeLabel;      // Show event type label
+  TGLOverlayButton    *fPeriod;              // Show event period
+  TGLOverlayButton    *fOrbit;               // Show orbit
+  TGLOverlayButton    *fBC;                  // Show bc
+
+  TGLOverlayButton    *fTimeStamp;           // Time stamp information
+  TGLOverlayButton    *fMagnetField;         // Magnetic field
+  TGLOverlayButton    *fTrigger;             // Trigger
+
+  TGLOverlayButton    *fTriggerClassesPanel; // Active trigger classes panel
+  Int_t               fNumberOfActiveTriggerClasses; // Number of active trigger classes
+  TGLOverlayButton    **fTriggerClasses;      // Active trigger classes
+
+  AliEveMultiView     *fAl;                   // Multiview instance
+  TEveViewer          *fHisto2dv;             // 2D lego view
+  AliEveEventSelector *fEventSelector;        // Current event selector
 
   AliEveBeamsInfo(const AliEveBeamsInfo&);            // Not implemented
   AliEveBeamsInfo& operator=(const AliEveBeamsInfo&); // Not implemented
index 4c9edd5915fecc31b7e61e4cf5f55b9c9a9ef4a7..b977c11f162585657c7d0762d2abae6f6d662c87 100644 (file)
@@ -1,5 +1,5 @@
 // $Id$
-// Author: Stefano Carrazza 2010
+// Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
 
 /**************************************************************************
  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
@@ -7,22 +7,19 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-#include "AliEveBeamsInfoEditor.h"
 #include "AliEveBeamsInfo.h"
+#include "AliEveBeamsInfoEditor.h"
 
 #include "TVirtualPad.h"
 #include "TColor.h"
-
-// Cleanup these includes:
-#include "TGLabel.h"
 #include "TGButton.h"
-#include "TGNumberEntry.h"
 #include "TGColorSelect.h"
-#include "TGDoubleSlider.h"
-#include "TGString.h"
 #include "TGComboBox.h"
+#include "TGDoubleSlider.h"
 #include "TGFrame.h"
-
+#include "TGLabel.h"
+#include "TGNumberEntry.h"
+#include "TGString.h"
 
 //______________________________________________________________________________
 // GUI editor for AliEveBeamsInfo.
@@ -35,37 +32,44 @@ AliEveBeamsInfoEditor::AliEveBeamsInfoEditor(const TGWindow *p, Int_t width, Int
              UInt_t options, Pixel_t back) :
   TGedFrame(p, width, height, options | kVerticalFrame, back),
   fM(0),
+  fIsMC(0),
   fEventSelection(0),
   fShowEvents(0),
   fSelect(0),
   fButtonPrev(0),
-  fButtonNext(0)
+  fButtonNext(0),
+  fSetAlpha(0),
+  fAlpha(0)
 {
   // Constructor.
   MakeTitle("AliEveBeamsInfo");
 
-  // Events selection
-  fEventSelection = new TGGroupFrame(this, "Event selection:", kHorizontalFrame);
-
-  fShowEvents = new TGCheckButton(fEventSelection, new TGHotString("&Show info "));
+  // Events selection  
+  fShowEvents = new TGCheckButton(this, new TGHotString("&Show information box"));
   fShowEvents->SetState(kButtonDown);
   fShowEvents->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowEventSelection()");
-  fEventSelection->AddFrame(fShowEvents, new TGLayoutHints(kLHintsLeft | kLHintsTop));
+  AddFrame(fShowEvents, new TGLayoutHints(kLHintsExpandX));
+
+  fIsMC = new TGCheckButton(this, new TGHotString("&Data is from simulation (MC)"));
+  fIsMC->SetState(kButtonUp);
+  fIsMC->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "SwitchDataType()");
+  AddFrame(fIsMC, new TGLayoutHints(kLHintsExpandX));
 
+  fEventSelection = new TGGroupFrame(this, "Event filter:", kHorizontalFrame);
   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->AddEntry("Show all events",0);
+  fSelect->AddEntry("Only Beam 1 events",1);
+  fSelect->AddEntry("Only Beam 2 events",2);
+  fSelect->AddEntry("Beams 1 & 2 events",3);
+  fSelect->Resize(120,22);
   fSelect->Select(0);
-  fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
+  fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
 
   fSelect->Connect("Selected(Int_t)", "AliEveBeamsInfoEditor", this, "SelectEventSelection(Int_t)");
 
   AddFrame(fEventSelection, new TGLayoutHints(kLHintsExpandX));
 
-  //**********
+  //------
 
   TGHorizontalFrame *h = new TGHorizontalFrame(this);
 
@@ -79,6 +83,17 @@ AliEveBeamsInfoEditor::AliEveBeamsInfoEditor(const TGWindow *p, Int_t width, Int
 
   AddFrame(h, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
 
+  fSetAlpha = new TGGroupFrame(this, "Transparency value:", kHorizontalFrame);
+  fAlpha = new TGNumberEntry(fSetAlpha,  1.5, 7, -1,
+                             TGNumberFormat::kNESRealOne,
+                             TGNumberFormat::kNEANonNegative,
+                             TGNumberFormat::kNELLimitMinMax,
+                             0, 1.5);
+  fAlpha->Resize(120,22);
+  fSetAlpha->AddFrame(fAlpha, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
+  fAlpha->Connect("ValueSet(Long_t)", "AliEveBeamsInfoEditor", this, "SetAlpha()");
+
+  AddFrame(fSetAlpha, new TGLayoutHints(kLHintsExpandX));
 }
 
 //______________________________________________________________________________
@@ -91,25 +106,44 @@ void AliEveBeamsInfoEditor::SetModel(TObject* obj)
 //______________________________________________________________________________
 void AliEveBeamsInfoEditor::ShowEventSelection()
 {
-   fM->ShowEventSelection();
+  // Show event selection
+  fM->ShowEventSelection(fShowEvents->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveBeamsInfoEditor::SelectEventSelection(Int_t id)
 {
-   fM->SelectEventSelection(id);
+  // Show event selection
+  fM->SelectEventSelection(id);
 }
 
 //______________________________________________________________________________
 void AliEveBeamsInfoEditor::ShowPrevEvent()
 {
+  // Show previous event
   fM->ShowPrevEvent();
 }
 
 //______________________________________________________________________________
 void AliEveBeamsInfoEditor::ShowNextEvent()
 {
+  // Show next event
   fM->ShowNextEvent();
 }
 
+//______________________________________________________________________________
+void AliEveBeamsInfoEditor::SwitchDataType()
+{
+  // Show previous event
+  fM->SwitchDataType(fIsMC->IsOn());
+}
+
+//______________________________________________________________________________
+void AliEveBeamsInfoEditor::SetAlpha()
+{
+  // Set alpha
+  fM->SetAlpha(fAlpha->GetNumber());
+}
+
+
 /******************************************************************************/
index fef520d051b21a461d0347fc1108ed7656b6ee87..ef6b0b1bbaaf62f54187e2f05c70b055133ea174 100644 (file)
@@ -1,5 +1,5 @@
 // $Id$
-// Author: Stefano Carrazza 2010
+// Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
 
 /**************************************************************************
  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
 #include "TGedFrame.h"
 
 class TGButton;
-class TGCheckButton;
-class TGNumberEntry;
 class TGColorSelect;
-class TGGroupFrame;
 class TGComboBox;
+class TGCheckButton;
+class TGGroupFrame;
+class TGNumberEntry;
 class TGTextButton;
 
 class AliEveBeamsInfo;
@@ -35,21 +35,28 @@ public:
 
    virtual void SetModel(TObject* obj);
 
-   // Declare callback/slot methods
-   void ShowEventSelection();
+   // Set Methods
+   void SetAlpha();
+
+   // Slot methods
    void SelectEventSelection(Int_t id);
+   void ShowEventSelection();
    void ShowPrevEvent();
    void ShowNextEvent();
+   void SwitchDataType();
 
 protected:
-   AliEveBeamsInfo            *fM; // Model object.
+   AliEveBeamsInfo *fM;              // Model object.
 
 private:
-   TGGroupFrame  *fEventSelection;  // event selection group box
-   TGCheckButton *fShowEvents;      // display information checkbox
-   TGComboBox    *fSelect;          // combo box display
-   TGTextButton  *fButtonPrev;      // previous event selection
-   TGTextButton  *fButtonNext;      // next event selection
+   TGCheckButton   *fIsMC;           // activating mc selection
+   TGGroupFrame    *fEventSelection; // event selection group box
+   TGCheckButton   *fShowEvents;     // display information checkbox
+   TGComboBox      *fSelect;         // combo box display
+   TGTextButton    *fButtonPrev;     // previous event selection
+   TGTextButton    *fButtonNext;     // next event selection
+   TGGroupFrame    *fSetAlpha;       // set alpha for overlay buttons
+   TGNumberEntry   *fAlpha;          // alpha value
 
    AliEveBeamsInfoEditor(const AliEveBeamsInfoEditor&);            // Not implemented
    AliEveBeamsInfoEditor& operator=(const AliEveBeamsInfoEditor&); // Not implemented
index cb7aceca195b0988d5ec93014530b30ef1c826d5..532820a24ba22b7bf9256d1387f2f938f276de8e 100644 (file)
@@ -1,5 +1,5 @@
 // $Id$
-// Author: Stefano Carrazza 2010
+// Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
 
 /**************************************************************************
  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
 #include "TStopwatch.h"
 
 //______________________________________________________________________________
-// Allow histograms visualization in 2D and 3D.
+// This class provides the following features:
+//
+// 1) 2D and 3D calorimeter like histograms of tracks distribution,
+// providing particle selection by charge (positive and negative),
+// and by specie: electrons, muons, pions, kaons and protons.
+//
+// 2) Histograms are plotted around detectors, allowing track selection: all tracks,
+// only primary tracks. It allows pT maximum and minimum threashold.
+//
+// 3) 2D and 3D calorimeter like histograms of particles distribution obtained
+// from all events.
+//
+// 4) Possibility to use AliPhysicsSelection during the all events histograms creation.
+// It is also possible to switch between real data and simulation data (MC).
 //
 
 ClassImp(AliEveLego)
@@ -100,7 +113,8 @@ AliEveLego::AliEveLego(const char* name) :
 
   for (Int_t s = 0; s < 7; s++)
   {
-    if (s > 1){
+    if (s > 1)
+    {
       fParticleTypeId[s] = kFALSE;
       fParticleTypeIdAE[s] = kFALSE;
     } else {
@@ -109,6 +123,7 @@ AliEveLego::AliEveLego(const char* name) :
     }
   }
 
+  // Loading Physics Selection to determine the collision candidates
   fPhysicsSelection = new AliPhysicsSelection();
   fPhysicsSelection->Initialize(fEsd->GetRunNumber());
 
@@ -128,21 +143,21 @@ AliEveLego::AliEveLego(const char* name) :
   fHistoKaons->SetDirectory(0);
   fHistoProtons->SetDirectory(0);
 
-  // colors from get_pdg_color() in /alice-macros/kine_tracks.C
+  // Colors from get_pdg_color() in /alice-macros/kine_tracks.C
   static Color_t fElectro = 5;
   static Color_t fMuon = 30;
   static Color_t fPion = 3;
   static Color_t fKaon = 38;
   static Color_t fProton = 10;
 
+  // Adding data to TEveCaloDataHist
   fData = new TEveCaloDataHist();
-
   fData->AddHistogram(fHistoneg);
   fData->RefSliceInfo(0).Setup("NegCg:", 0, kBlue);
   fData->AddHistogram(fHistopos);
   fData->RefSliceInfo(1).Setup("PosCg:", 0, kRed);
   fData->AddHistogram(fHistoElectrons);
-  fData->RefSliceInfo(2).Setup("Electrons:", 0, fElectro);
+  fData->RefSliceInfo(2).Setup("Elect.:", 0, fElectro);
   fData->AddHistogram(fHistoMuons);
   fData->RefSliceInfo(3).Setup("Muons:", 0, fMuon);
   fData->AddHistogram(fHistoPions);
@@ -150,7 +165,7 @@ AliEveLego::AliEveLego(const char* name) :
   fData->AddHistogram(fHistoKaons);
   fData->RefSliceInfo(5).Setup("Kaons:", 0, fKaon);
   fData->AddHistogram(fHistoProtons);
-  fData->RefSliceInfo(6).Setup("Protons:", 0, fProton);
+  fData->RefSliceInfo(6).Setup("Proto.:", 0, fProton);
 
   fData->GetEtaBins()->SetTitleFont(120);
   fData->GetEtaBins()->SetTitle("h");
@@ -158,26 +173,27 @@ AliEveLego::AliEveLego(const char* name) :
   fData->GetPhiBins()->SetTitle("f");
   fData->IncDenyDestroy();
 
+  // Setting up the position of the 3D calorimeter histogram view.
   fCalo3d = new TEveCalo3D(fData);
   fCalo3d->SetBarrelRadius(550);
   fCalo3d->SetEndCapPos(550);
 
-  // plotting histo
+  // Adding data to the Lego object
   fLego = new TEveCaloLego(fData);
 
-  // projections
+  // Creating projections
   fAl = AliEveMultiView::Instance();
   fAl->ImportEventRPhi(fCalo3d);
   fAl->ImportEventRhoZ(fCalo3d);
 
-  // Update
+  // Update viewers and scenes
   Update();
 }
 
 //______________________________________________________________________________
 AliEveLego::~AliEveLego()
 {
-   // deleting variables
+   // Deleting variables
    delete fEsd;
    delete fPhysicsSelection;
    delete fHistopos;
@@ -194,10 +210,8 @@ AliEveLego::~AliEveLego()
    delete fHistoKaonsAllEvents;
    delete fHistoProtons;
    delete fHistoProtonsAllEvents;
-
    delete[] fParticleTypeId;
    delete[] fParticleTypeIdAE;
-
    delete fData;
    delete fDataAllEvents;
    delete fLego;
@@ -205,7 +219,6 @@ AliEveLego::~AliEveLego()
    delete fCalo3d;
    delete fCalo3dAllEvents;
    delete fGlv;
-
    delete fHisto2dv;
    delete fHisto2ds;
    delete fHisto2ds2;
@@ -217,12 +230,10 @@ AliEveLego::~AliEveLego()
    delete fHisto2dAllEventss1;
    delete fHisto2dAllEventss2;
    delete fHisto2dAllEventss3;
-
    delete fAl;
    delete fHisto2dLegoOverlay;
    delete fHisto2dAllEventsLegoOverlay;
    delete fHisto2dAllEventsSlot;
-
 }
 
 namespace
@@ -230,7 +241,7 @@ namespace
   //____________________________________________________________________________
   Double_t getphi(Double_t phi)
   {
-    // phi correction for alice
+    // Phi correction for alice
 
     if (phi > TMath::Pi()) {
       phi -= TMath::TwoPi();
@@ -258,26 +269,27 @@ TEveCaloDataHist* AliEveLego::LoadData()
      const Double_t sign = fEsd->GetTrack(n)->GetSign();
      const Int_t prob = GetParticleType(track);     
 
-      if (sign > 0)
-        fHistopos->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+     // Filling histograms
+     if (sign > 0)
+       fHistopos->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-      if (sign < 0)
-        fHistoneg->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+     if (sign < 0)
+       fHistoneg->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-      if (prob == 0)
-        fHistoElectrons->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+     if (prob == 0)
+       fHistoElectrons->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-      if (prob == 1)
-        fHistoMuons->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+     if (prob == 1)
+       fHistoMuons->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-      if (prob == 2)
-        fHistoPions->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+     if (prob == 2)
+       fHistoPions->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-      if (prob == 3)
-        fHistoKaons->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+     if (prob == 3)
+       fHistoKaons->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-      if (prob == 4)
-        fHistoProtons->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+     if (prob == 4)
+       fHistoProtons->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
    }
 
    fData->DataChanged();
@@ -290,7 +302,7 @@ TEveCaloDataHist* AliEveLego::LoadData()
 //______________________________________________________________________________
 TEveCaloDataHist* AliEveLego::LoadAllData()
 {
-   // load data from all events ESD
+   // Load data from all events ESD
    fHistoposAllEvents->Reset();
    fHistonegAllEvents->Reset();
    fHistoElectronsAllEvents->Reset();
@@ -317,29 +329,34 @@ TEveCaloDataHist* AliEveLego::LoadAllData()
            const Double_t sign = track->GetSign();
            const Int_t prob = GetParticleType(track);
 
-            if (sign > 0)
-              fHistoposAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+           if (sign > 0)
+             fHistoposAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-            if (sign < 0)
-              fHistonegAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+           if (sign < 0)
+             fHistonegAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-            if (prob == 0)
-              fHistoElectronsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+           if (prob == 0)
+             fHistoElectronsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-            if (prob == 1)
-              fHistoMuonsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+           if (prob == 1)
+             fHistoMuonsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-            if (prob == 2)
-              fHistoPionsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+           if (prob == 2)
+             fHistoPionsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-            if (prob == 3)
-              fHistoKaonsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+           if (prob == 3)
+             fHistoKaonsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
 
-            if (prob == 4)
-              fHistoProtonsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
-         }
+           if (prob == 4)
+             fHistoProtonsAllEvents->Fill(track->Eta(), getphi(track->Phi()), fabs(track->Pt()));
+        }
    }
+
+   // Setting the current view to the first event
    t->GetEntry(0);
+
+   // Usefull information,
+   // with this we can estimate the event efficiency
    printf("Number of events loaded: %i, with AliPhysicsSelection: %i\n",fAcceptedEvents,fCollisionCandidatesOnly);
 
    fDataAllEvents->DataChanged();
@@ -533,7 +550,7 @@ TEveCaloDataHist* AliEveLego::FilterAllData()
       }
    }
 
-   // Positive only
+   // Particles species and charges filter
    if ( fParticleTypeIdAE[0] == kFALSE ) fHistoposAllEvents->Reset();
    if ( fParticleTypeIdAE[1] == kFALSE ) fHistonegAllEvents->Reset();
    if ( fParticleTypeIdAE[2] == kFALSE ) fHistoElectronsAllEvents->Reset();
@@ -641,7 +658,7 @@ TEveCaloLego* AliEveLego::CreateHistoLego(TEveWindowSlot *slot)
 //______________________________________________________________________________
 TEveCalo3D* AliEveLego::Create3DView()
 {
-   //initialization
+   // Initialization
    if (fHisto2ds2 == 0) {
       fHisto2ds2 = gEve->SpawnNewScene("3D Histogram", "3D Histogram");
       gEve->GetDefaultViewer()->AddScene(fHisto2ds2);
@@ -655,7 +672,7 @@ TEveCalo3D* AliEveLego::Create3DView()
 //______________________________________________________________________________
 TEveCalo3D* AliEveLego::Create3DView(TEveWindowSlot *slot)
 {
-   // creates a 3d view for the 3d histogram
+   // Creates a 3d view for the 3d histogram
    if ( fHisto2dAllEventsv1 == 0 ) {
 
       slot->MakeCurrent();
@@ -678,7 +695,7 @@ TEveCalo3D* AliEveLego::Create3DView(TEveWindowSlot *slot)
 //______________________________________________________________________________
 void AliEveLego::CreateProjections(TEveWindowSlot* slot1, TEveWindowSlot* slot2)
 {
-   // create projections
+   // Create projections
    if (fHisto2dAllEventsv2 == 0) {
 
       slot1->MakeCurrent();
@@ -699,8 +716,8 @@ void AliEveLego::CreateProjections(TEveWindowSlot* slot1, TEveWindowSlot* slot2)
       fHisto2dAllEventsv2->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
    }
 
-   if (fHisto2dAllEventsv3 == 0) {
-
+   if (fHisto2dAllEventsv3 == 0)
+   {
       slot2->MakeCurrent();
       fHisto2dAllEventsv3 = gEve->SpawnNewViewer("RhoZ projection", "RhoZ projection");
       fHisto2dAllEventss3 = gEve->SpawnNewScene("RhoZ projection", "RhoZ projection");
@@ -718,7 +735,6 @@ void AliEveLego::CreateProjections(TEveWindowSlot* slot1, TEveWindowSlot* slot2)
 
       fHisto2dAllEventsv3->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
    }
-
    return;
 }
 
@@ -816,37 +832,35 @@ TEveCaloDataHist* AliEveLego::LoadAllEvents()
       printf("Filling histogram... Finished\n");
       timer.Stop();
       timer.Print();
-
    }
-
    return fDataAllEvents;
 }
 
 //______________________________________________________________________________
 void AliEveLego::ApplyParticleTypeSelectionAE()
 {
-  // reload all events applying particle type selection
+  // Reload all events applying particle type selection
   FilterAllData();
 }
 
 //______________________________________________________________________________
 Float_t AliEveLego::GetPtMax()
 {
-   // return pT maximum
+   // Return pT maximum
    return fData->GetMaxVal(fLego->GetPlotEt());
 }
 
 //______________________________________________________________________________
 Float_t AliEveLego::GetPtMaxAE()
 {
-   // return pT max from all events
+   // Return pT max from all events
    return fDataAllEvents->GetMaxVal(fLegoAllEvents->GetPlotEt());
 }
 
 //______________________________________________________________________________
 Int_t AliEveLego::GetParticleType(AliESDtrack *track)
 {
-  // determine the particle type
+  // Determine the particle type
   Double_t *prob = new Double_t[5];
   track->GetESDpid(prob);
 
@@ -864,29 +878,19 @@ Int_t AliEveLego::GetParticleType(AliESDtrack *track)
 }
 
 //______________________________________________________________________________
-void AliEveLego::SetParticleType(Int_t id)
+void AliEveLego::SetParticleType(Int_t id, Bool_t status)
 {
-  // activate/deactivate particles types
-  if (fParticleTypeId[id] == 0)
-  {
-    fParticleTypeId[id] = 1;
-  } else {
-    fParticleTypeId[id] = 0;
-  }
+  // Activate/deactivate particles types
+  fParticleTypeId[id] = status;
 
   Update();
 }
 
 //______________________________________________________________________________
-void AliEveLego::SetParticleTypeAE(Int_t id)
+void AliEveLego::SetParticleTypeAE(Int_t id, Bool_t status)
 {
-  // activate/deactivate particles types
-  if (fParticleTypeIdAE[id] == 0)
-  {
-    fParticleTypeIdAE[id] = 1;
-  } else {
-    fParticleTypeIdAE[id] = 0;
-  }
+  // Activate/deactivate particles types
+  fParticleTypeIdAE[id] = status;
 }
 
 //______________________________________________________________________________
@@ -938,20 +942,16 @@ void AliEveLego::SetThresholdAE(Double_t val)
 }
 
 //______________________________________________________________________________
-void AliEveLego::SwitchDataType()
+void AliEveLego::SwitchDataType(Bool_t status)
 {
-  // activate/deactivate MC / real data type
-  if (fIsMC == 0)
-  {
-    fIsMC = 1;
-  } else {
-    fIsMC = 0;
-  }
-  //Removing defaul physics selection
+  // Activate/deactivate MC / real data type
+  fIsMC = status;
 
+  // Removing defaul physics selection
   delete fPhysicsSelection;
   fPhysicsSelection = NULL;
 
+  // Re-initialization of physics selection
   fPhysicsSelection = new AliPhysicsSelection();
   fPhysicsSelection->SetAnalyzeMC(fIsMC);
   fPhysicsSelection->Initialize(fEsd->GetRunNumber());
@@ -961,7 +961,7 @@ void AliEveLego::SwitchDataType()
 //______________________________________________________________________________
 void AliEveLego::SetCollisionCandidatesOnly()
 {
-  // activate/deactivate MC / real data type
+  // Activate/deactivate MC / real data type
   if (fCollisionCandidatesOnly == 0)
   {
     fCollisionCandidatesOnly = 1;
index 7e71577d5098a79899280859f88df775ba4303b1..b5b89f56719f2dd6e6f1a0defcf8f39043f0447c 100644 (file)
@@ -1,5 +1,5 @@
 // $Id$
-// Author: Stefano Carrazza 2010
+// Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
 
 /**************************************************************************
  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
 class AliESDEvent;
 class AliEveEventSelector;
 class AliEveMultiView;
-class AliPhysicsSelection;
 class AliESDtrack;
+class AliPhysicsSelection;
 
+class TEveCalo3D;
 class TEveCaloDataHist;
 class TEveCaloLego;
 class TEveCaloLegoOverlay;
-class TEveCalo3D;
 class TEveScene;
 class TEveViewer;
 class TEveWindowSlot;
@@ -30,8 +30,7 @@ class TGLViewer;
 class TH2F;
 
 //______________________________________________________________________________
-// Creates a 2D lego histogram on a new tab.
-// Allow 3D visualization and projection of the lego histogram on the 3D Viewer and the MultiView.
+// 2D & 3D calorimeter like histograms from the ESD data.
 //
 
 class AliEveLego : public TEveElementList
@@ -41,100 +40,96 @@ public:
   virtual ~AliEveLego();
 
   // Get Methods
+  TEveCalo3D*       GetCalo3D()         {   return fCalo3d;           }
+  TEveCalo3D*       GetCalo3DAllEvents(){   return fCalo3dAllEvents;  }
   TEveCaloDataHist* GetData()           {   return fData;             }
-  TEveCaloDataHist* GetDataAllEvents()  {   return fDataAllEvents;  }
+  TEveCaloDataHist* GetDataAllEvents()  {   return fDataAllEvents;    }
   AliESDEvent*      GetESD()            {   return fEsd;              }
   TEveCaloLego*     GetLego()           {   return fLego;             }
-  TEveCaloLego*     GetLegoAllEvents()  {   return fLegoAllEvents;  }
-  TEveCalo3D*       GetCalo3D()         {   return fCalo3d;           }
-  TEveCalo3D*       GetCalo3DAllEvents(){   return fCalo3dAllEvents;}
+  TEveCaloLego*     GetLegoAllEvents()  {   return fLegoAllEvents;    }
   AliEveMultiView*  GetMultiView()      {   return fAl;               }
+  Int_t             GetParticleType(AliESDtrack *track);
   Float_t           GetPtMax();
   Float_t           GetPtMaxAE();
-  Int_t             GetParticleType(AliESDtrack *track);
 
   // Set Methods
-  void SetParticleType(Int_t id);
-  void SetParticleTypeAE(Int_t id);
-  void SetTracks(Int_t id) {  fTracksId = id;  Update();  }
-  void SetTracksAE(Int_t id) {  fTracksIdAE = id;  FilterAllData();  }
+  void SetCollisionCandidatesOnly();
   void SetMaxPt(Double_t val);
   void SetMaxPtAE(Double_t val);
+  void SetParticleType(Int_t id, Bool_t status);
+  void SetParticleTypeAE(Int_t id, Bool_t status);
   void SetThreshold(Double_t val);
   void SetThresholdAE(Double_t val);
-  void SwitchDataType();
-  void SetCollisionCandidatesOnly();
+  void SetTracks(Int_t id)   {  fTracksId = id;    Update();         }
+  void SetTracksAE(Int_t id) {  fTracksIdAE = id;  FilterAllData();  }
 
   // Functions
-  void Update();
-  TEveCaloDataHist* LoadData();
-  TEveCaloDataHist* LoadAllData();
-  TEveCaloDataHist* FilterData();
-  TEveCaloDataHist* FilterAllData();
+  void              ApplyParticleTypeSelectionAE();
   TEveCaloLego*     CreateHistoLego();
   TEveCaloLego*     CreateHistoLego(TEveWindowSlot* slot);
   TEveCalo3D*       Create3DView();
   TEveCalo3D*       Create3DView(TEveWindowSlot* slot);
   void              CreateProjections(TEveWindowSlot* slot1,
                                       TEveWindowSlot* slot2);
+  TEveCaloDataHist* FilterData();
+  TEveCaloDataHist* FilterAllData();
+  TEveCaloDataHist* LoadData();
+  TEveCaloDataHist* LoadAllData();
   TEveCaloDataHist* LoadAllEvents();
-  void ApplyParticleTypeSelectionAE();
+  void              SwitchDataType(Bool_t status);
+  void              Update();
+
 
 private:
-  Bool_t fIsMC;                    // switch to MC mode for AliPhysicsSelection
-  Bool_t fCollisionCandidatesOnly; // activate flag when loading all events
-  Bool_t *fParticleTypeId;    // determine how particles to show
-  Bool_t *fParticleTypeIdAE;  // determine how particles to show
-  Int_t   fTracksId;          // determine tracks selection
-  Float_t fMaxPt;             // set maximum pT
-
-  Int_t fTracksIdAE;  // determine tracks selection for all events
-  Float_t fMaxPtAE;   // determine maximum pT for all events
-
-  AliESDEvent *fEsd;                      // ESD tree
-  AliPhysicsSelection *fPhysicsSelection; // physics selection object
-  TH2F *fHistopos;                        // positive charge histogram
-  TH2F *fHistoposAllEvents;               // positive charge histogram for all events
-  TH2F *fHistoneg;                        // negative charge histogram
-  TH2F *fHistonegAllEvents;               // negative charge histogram for all events
-  TH2F *fHistoElectrons;                  // electrons histogram
-  TH2F *fHistoElectronsAllEvents;         // electrons histogram all events
-  TH2F *fHistoMuons;                      // muons histogram
-  TH2F *fHistoMuonsAllEvents;             // muons histogram all events
-  TH2F *fHistoPions;                      // pions histogram
-  TH2F *fHistoPionsAllEvents;             // pions histogram all events
-  TH2F *fHistoKaons;                      // kaons histogram
-  TH2F *fHistoKaonsAllEvents;             // kaons histogram all events
-  TH2F *fHistoProtons;                    // protons histogram
-  TH2F *fHistoProtonsAllEvents;           // protons histogram all events
-
-  TEveCaloDataHist *fData;          // calo data for 2D, 3D histograms
-  TEveCaloDataHist *fDataAllEvents; // calo data for all events
-  TEveCaloLego *fLego;              // calo lego for histograms
-  TEveCaloLego *fLegoAllEvents;     // calo lego for all events histograms
-  TEveCalo3D *fCalo3d;              // 3D histogram for single event
-  TEveCalo3D *fCalo3dAllEvents;     // 3D histogram for all events
-  TGLViewer  *fGlv;                 // viewer object
-
-  TEveViewer *fHisto2dv;           // viewer for histograms
-  TEveScene  *fHisto2ds;           // scene for 3d histogram
-  TEveScene  *fHisto2ds2;          // scene for 3d histogram new tab
-  TEveViewer *fHisto2dAllEventsv0; // viewer 1 for all events tab
-  TEveViewer *fHisto2dAllEventsv1; // viewer 2 for all events tab
-  TEveViewer *fHisto2dAllEventsv2; // viewer 3 for all events tab
-  TEveViewer *fHisto2dAllEventsv3; // viewer 4 for all events tab
-  TEveScene  *fHisto2dAllEventss0; // scene for all events tab
-  TEveScene  *fHisto2dAllEventss1; // scene for all events tab
-  TEveScene  *fHisto2dAllEventss2; // scene for all events tab
-  TEveScene  *fHisto2dAllEventss3; // scene for all events tab
-
-  AliEveMultiView *fAl;            // AliEveMultiView object to create 2D projections
-  TEveCaloLegoOverlay *fHisto2dLegoOverlay; // Overlay for calo lego
-  TEveCaloLegoOverlay* fHisto2dAllEventsLegoOverlay; // Overlay for calo lego all events
-  TEveWindowSlot* fHisto2dAllEventsSlot;  // window slot for 2d all events histogram
-
-  AliEveLego(const AliEveLego&);            // Not implemented
-  AliEveLego& operator=(const AliEveLego&); // Not implemented
+  Bool_t              fIsMC;                    // Switch to MC mode for AliPhysicsSelection
+  Bool_t              fCollisionCandidatesOnly; // Activate flag when loading all events
+  Bool_t              *fParticleTypeId;         // Determine how particles to show
+  Bool_t              *fParticleTypeIdAE;       // Determine how particles to show
+  Int_t               fTracksId;                // Determine tracks selection
+  Float_t             fMaxPt;                   // Set maximum pT
+  Int_t               fTracksIdAE;              // Determine tracks selection for all events
+  Float_t             fMaxPtAE;                 // Determine maximum pT for all events
+  AliESDEvent         *fEsd;                    // ESD tree
+  AliPhysicsSelection *fPhysicsSelection;       // Physics selection object
+  TH2F                *fHistopos;               // Positive charge histogram
+  TH2F                *fHistoposAllEvents;      // Positive charge histogram for all events
+  TH2F                *fHistoneg;               // Negative charge histogram
+  TH2F                *fHistonegAllEvents;      // Negative charge histogram for all events
+  TH2F                *fHistoElectrons;         // Electrons histogram
+  TH2F                *fHistoElectronsAllEvents;// Electrons histogram all events
+  TH2F                *fHistoMuons;             // Muons histogram
+  TH2F                *fHistoMuonsAllEvents;    // Muons histogram all events
+  TH2F                *fHistoPions;             // Pions histogram
+  TH2F                *fHistoPionsAllEvents;    // Pions histogram all events
+  TH2F                *fHistoKaons;             // Kaons histogram
+  TH2F                *fHistoKaonsAllEvents;    // Kaons histogram all events
+  TH2F                *fHistoProtons;           // Protons histogram
+  TH2F                *fHistoProtonsAllEvents;  // Protons histogram all events
+  TEveCaloDataHist    *fData;                   // Calo data for 2D, 3D histograms
+  TEveCaloDataHist    *fDataAllEvents;          // Calo data for all events
+  TEveCaloLego        *fLego;                   // Calo lego for histograms
+  TEveCaloLego        *fLegoAllEvents;          // Calo lego for all events histograms
+  TEveCalo3D          *fCalo3d;                 // 3D histogram for single event
+  TEveCalo3D          *fCalo3dAllEvents;        // 3D histogram for all events
+  TGLViewer           *fGlv;                    // Viewer object
+  TEveViewer          *fHisto2dv;               // Viewer for histograms
+  TEveScene           *fHisto2ds;               // Scene for 3d histogram
+  TEveScene           *fHisto2ds2;              // Scene for 3d histogram new tab
+  TEveViewer          *fHisto2dAllEventsv0;     // Viewer 1 for all events tab
+  TEveViewer          *fHisto2dAllEventsv1;     // Viewer 2 for all events tab
+  TEveViewer          *fHisto2dAllEventsv2;     // Viewer 3 for all events tab
+  TEveViewer          *fHisto2dAllEventsv3;     // Viewer 4 for all events tab
+  TEveScene           *fHisto2dAllEventss0;     // Scene for all events tab
+  TEveScene           *fHisto2dAllEventss1;     // Scene for all events tab
+  TEveScene           *fHisto2dAllEventss2;     // Scene for all events tab
+  TEveScene           *fHisto2dAllEventss3;     // Scene for all events tab
+  AliEveMultiView     *fAl;                     // AliEveMultiView object to create 2D projections
+  TEveCaloLegoOverlay *fHisto2dLegoOverlay;     // Overlay for calo lego
+  TEveCaloLegoOverlay *fHisto2dAllEventsLegoOverlay; // Overlay for calo lego all events
+  TEveWindowSlot      *fHisto2dAllEventsSlot;   // Window slot for 2d all events histogram
+
+  AliEveLego(const AliEveLego&);                // Not implemented
+  AliEveLego& operator=(const AliEveLego&);     // Not implemented
 
 
   ClassDef(AliEveLego, 0); // Short description.
index c19e58f7cacbf59a484dec7c91aff99f3a3a269a..aec0041092b4fbd14889d05bd0f4fb3afc276573 100644 (file)
@@ -1,5 +1,5 @@
 // $Id$
-// Author: Stefano Carrazza 2010
+// Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
 
 /**************************************************************************
  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
@@ -7,24 +7,23 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-#include "AliEveLegoEditor.h"
 #include "AliEveLego.h"
+#include "AliEveLegoEditor.h"
 
-#include "TVirtualPad.h"
 #include "TColor.h"
-
-#include "TGLabel.h"
 #include "TGButton.h"
-#include "TGNumberEntry.h"
-#include "TGColorSelect.h"
-#include "TGDoubleSlider.h"
 #include "TGButtonGroup.h"
-#include "TGString.h"
+#include "TGColorSelect.h"
 #include "TGComboBox.h"
+#include "TGDoubleSlider.h"
 #include "TGFrame.h"
+#include "TGLabel.h"
+#include "TGNumberEntry.h"
+#include "TGString.h"
+#include "TVirtualPad.h"
 
 //______________________________________________________________________________
-// GUI editor for AliEveLego.
+// This is the GUI editor for AliEveLego.
 //
 
 ClassImp(AliEveLegoEditor)
@@ -71,10 +70,13 @@ AliEveLegoEditor::AliEveLegoEditor(const TGWindow *p, Int_t width, Int_t height,
   MakeTitle("AliEveLego");
 
   // Create widgets
+
+  //------ AllEventsButton ------
   fAllEventsButton = new TGTextButton(this, "Create lego of all events");
   AddFrame(fAllEventsButton, new TGLayoutHints(kLHintsExpandX));
   fAllEventsButton->Connect("Clicked()", "AliEveLegoEditor", this, "DoAllEvents()");
 
+  //------ Particle Selection ------
   fParticlesBG = new TGGroupFrame(this, "Particle selection:", kVerticalFrame);
   fPosCharged  = new TGCheckButton(fParticlesBG, new TGHotString("&Positive charged"));
   fNegCharged  = new TGCheckButton(fParticlesBG, new TGHotString("&Negative charged"));
@@ -111,6 +113,7 @@ AliEveLegoEditor::AliEveLegoEditor(const TGWindow *p, Int_t width, Int_t height,
 
   AddFrame(fParticlesBG, new TGLayoutHints(kLHintsExpandX));
 
+  //------ Track selection ------
   fTrackSelection = new TGButtonGroup(this, "Track selection:", kHorizontalFrame);
   fRtracks[0] = new TGRadioButton(fTrackSelection, new TGHotString("&All tracks  "));
   fRtracks[1] = new TGRadioButton(fTrackSelection, new TGHotString("&Primary tracks"));
@@ -118,8 +121,7 @@ AliEveLegoEditor::AliEveLegoEditor(const TGWindow *p, Int_t width, Int_t height,
   AddFrame(fTrackSelection, new TGLayoutHints(kLHintsExpandX));
   fTrackSelection->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByTracks(Int_t)");
 
-  //**************
-
+  //------ Track threshold ------
   TGHorizontalFrame *horz = new TGHorizontalFrame(this);
   AddFrame(horz, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
   fLabel = new TGLabel(horz, "Tracks maximum Pt (GeV): ");
@@ -152,17 +154,17 @@ AliEveLegoEditor::AliEveLegoEditor(const TGWindow *p, Int_t width, Int_t height,
 
 }
 
-/******************************************************************************/
-
 //______________________________________________________________________________
 void AliEveLegoEditor::SetModel(TObject* obj)
 {
+  // Calls the associated AliEveLego object
   fM = dynamic_cast<AliEveLego*>(obj);
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::DoAllEvents()
 {
+  // Creates the all events editor
   fAllEventsButton->SetEnabled(kFALSE);
   CreateAllEventsEditor();
   fM->LoadAllEvents();
@@ -171,142 +173,163 @@ void AliEveLegoEditor::DoAllEvents()
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowPosCharge()
 {   
-  fM->SetParticleType(0);
+  // Send particle type to main class
+  fM->SetParticleType(0, fPosCharged->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowNegCharge()
 {
-  fM->SetParticleType(1);
+  // Send particle type to main class
+  fM->SetParticleType(1, fNegCharged->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowElectrons()
 {
-  fM->SetParticleType(2);
+  // Send particle type to main class
+  fM->SetParticleType(2, fElectrons->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowMuons()
 {
-  fM->SetParticleType(3);
+  // Send particle type to main class
+  fM->SetParticleType(3, fMuons->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowPions()
 {
-  fM->SetParticleType(4);
+  // Send particle type to main class
+  fM->SetParticleType(4, fPions->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowKaons()
 {
-  fM->SetParticleType(5);
+  // Send particle type to main class
+  fM->SetParticleType(5, fKaons->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowProtons()
 {
-  fM->SetParticleType(6);
+  // Send particle type to main class
+  fM->SetParticleType(6, fProtons->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowPosChargeAE()
 {
-   fM->SetParticleTypeAE(0);
+  // Send particle type to main class
+  fM->SetParticleTypeAE(0, fPosChargedAE->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowNegChargeAE()
 {
-  fM->SetParticleTypeAE(1);
+  // Send particle type to main class
+  fM->SetParticleTypeAE(1, fNegChargedAE->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowElectronsAE()
 {
-  fM->SetParticleTypeAE(2);
+  // Send particle type to main class
+  fM->SetParticleTypeAE(2, fElectronsAE->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowMuonsAE()
 {
-  fM->SetParticleTypeAE(3);
+  // Send particle type to main class
+  fM->SetParticleTypeAE(3, fMuonsAE->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowPionsAE()
 {
-  fM->SetParticleTypeAE(4);
+  // Send particle type to main class
+  fM->SetParticleTypeAE(4, fPionsAE->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowKaonsAE()
 {
-  fM->SetParticleTypeAE(5);
+  // Send particle type to main class
+  fM->SetParticleTypeAE(5, fKaonsAE->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowProtonsAE()
 {
-  fM->SetParticleTypeAE(6);
+  // Send particle type to main class
+  fM->SetParticleTypeAE(6, fProtonsAE->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::SetMaxPt()
 {
-   fM->SetMaxPt(fMaxPt->GetNumber());
+  // Send particle type to main class
+  fM->SetMaxPt(fMaxPt->GetNumber());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::SetMaxPtAE()
 {
-   fM->SetMaxPtAE(fMaxPtAE->GetNumber());
+  // Send particle type to main class
+  fM->SetMaxPtAE(fMaxPtAE->GetNumber());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::SetThreshold()
 {
-   fM->SetThreshold(fThreshold->GetNumber());
+  // Send particle type to main class
+  fM->SetThreshold(fThreshold->GetNumber());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::SetThresholdAE()
 {
-   fM->SetThresholdAE(fThresholdAE->GetNumber());
+  // Send particle type to main class
+  fM->SetThresholdAE(fThresholdAE->GetNumber());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowByTracks(Int_t id)
 {
-   fM->SetTracks(id);
+  // Send particle type to main class
+  fM->SetTracks(id);
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ShowByTracksAE(Int_t id)
 {
-   fM->SetTracksAE(id);
+  // Send particle type to main class
+  fM->SetTracksAE(id);
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::CreateAllEventsEditor()
 {
-   // create the GUI of all events
+   // Create the GUI of all events
    TGVerticalFrame *this2 = this->CreateEditorTabSubFrame("All events style");
 
+   //------ Event control ------
    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"));
 
+   //------ Simulation checkbox ------
    fIsMC->SetState(kButtonUp);
    fCollisionCandidatesOnly->SetState(kButtonUp);
-
    fIsMC->Connect("Clicked()", "AliEveLegoEditor", this, "DataIsMC()");
    fCollisionCandidatesOnly->Connect("Clicked()", "AliEveLegoEditor", this, "CollisionCandidatesOnly()");
    this2->AddFrame(fEventControl, new TGLayoutHints(kLHintsExpandX));
 
+   //------ Particle selection ------
    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"));
@@ -333,19 +356,20 @@ void AliEveLegoEditor::CreateAllEventsEditor()
 
    this2->AddFrame(fParticlesBGAE, new TGLayoutHints(kLHintsExpandX));
 
+   //------ Apply particle selection criteria ------
    fApplyChanges = new TGTextButton(this2, "Apply particle selection");
-   this2->AddFrame(fApplyChanges, new TGLayoutHints(kLHintsExpandX));
    fApplyChanges->Connect("Clicked()", "AliEveLegoEditor", this, "ApplyChanges()");
+   this2->AddFrame(fApplyChanges, new TGLayoutHints(kLHintsExpandX));
 
+   //------ Track selection ------
    fTrackSelectionAE = new TGButtonGroup(this2, "Track selection:", kHorizontalFrame);
    fRtracksAE[0] = new TGRadioButton(fTrackSelectionAE, new TGHotString("&All tracks  "));
    fRtracksAE[1] = new TGRadioButton(fTrackSelectionAE, new TGHotString("&Primary tracks"));
-   fRtracksAE[0]->SetState(kButtonDown);
-   this2->AddFrame(fTrackSelectionAE, new TGLayoutHints(kLHintsExpandX));
+   fRtracksAE[0]->SetState(kButtonDown);   
    fTrackSelectionAE->Connect("Clicked(Int_t)", "AliEveLegoEditor", this, "ShowByTracksAE(Int_t)");
+   this2->AddFrame(fTrackSelectionAE, new TGLayoutHints(kLHintsExpandX));
 
-   //**************
-
+   //------ Threshold setup ------
    TGHorizontalFrame *horzAE = new TGHorizontalFrame(this2);
 
    fLabelAE = new TGLabel(horzAE, "Tracks maximum Pt (GeV): ");
@@ -377,24 +401,25 @@ void AliEveLegoEditor::CreateAllEventsEditor()
    horz1AE->AddFrame( fThresholdAE, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsCenterY));
 
    this2->AddFrame(horz1AE, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
-
-
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::ApplyChanges()
 {
+  // Apply particle selection for all events
   fM->ApplyParticleTypeSelectionAE();
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::DataIsMC()
 {
-  fM->SwitchDataType();
+  // Set data type
+  fM->SwitchDataType(fIsMC->IsOn());
 }
 
 //______________________________________________________________________________
 void AliEveLegoEditor::CollisionCandidatesOnly()
 {
+  // Activate collision candidates only
   fM->SetCollisionCandidatesOnly();
 }
index 1abf63ff7e979ec60dce80d1d6b7d49387caded1..b9e2002378365c8524b48d36f154be4e2d74357c 100644 (file)
@@ -1,5 +1,5 @@
 // $Id$
-// Author: Stefano Carrazza 2010
+// Author: Stefano Carrazza 2010, CERN, stefano.carrazza@cern.ch
 
 /**************************************************************************
  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
 #include "TGedFrame.h"
 
 class TGButton;
+class TGButtonGroup;
 class TGCheckButton;
-class TGNumberEntry;
 class TGColorSelect;
-class TGButtonGroup;
-class TGRadioButton;
-class TGLabel;
 class TGComboBox;
 class TGGroupFrame;
+class TGLabel;
+class TGNumberEntry;
+class TGRadioButton;
 
 class AliEveLego;
 
 //______________________________________________________________________________
-// Short description of AliEveLegoEditor
+// AliEveLegoEditor is the class editor of AliEveLego
 //
 
 class AliEveLegoEditor : public TGedFrame
@@ -37,7 +37,11 @@ public:
 
    virtual void SetModel(TObject* obj);
 
-   // Declare callback/slot methods
+   // Slot methods
+   void ApplyChanges();
+   void CollisionCandidatesOnly();
+   void CreateAllEventsEditor();
+   void DataIsMC();
    void DoAllEvents();
    void ShowPosCharge();
    void ShowNegCharge();
@@ -59,32 +63,28 @@ public:
    void SetMaxPtAE();
    void ShowByTracks(Int_t id);
    void ShowByTracksAE(Int_t id);
-   void CreateAllEventsEditor();
-   void ApplyChanges();
-   void DataIsMC();
-   void CollisionCandidatesOnly();
 
 protected:
-   AliEveLego            *fM; // Model object.
+   AliEveLego    *fM;                // Model object.
 
+private:
    // Single event GUI
-   TGTextButton  *fAllEventsButton; // text button for all events
-   TGGroupFrame  *fParticlesBG;     // particle selection button
-   TGButtonGroup *fTrackSelection;  // track selection button
-   TGCheckButton *fPosCharged;      // check button for positive only charged particles
-   TGCheckButton *fNegCharged;      // check button for negative only charged particles
-   TGCheckButton *fElectrons;       // check button for electrons
-   TGCheckButton *fMuons;           // check button for muons
-   TGCheckButton *fPions;           // check button for pions
-   TGCheckButton *fKaons;           // check button for kaons
-   TGCheckButton *fProtons;         // check button for protons
-   TGRadioButton *fRtracks[2];      // radio button for track selection
-   TGLabel       *fLabel;           // label for track selection
-   TGLabel       *fLabel1;          // label for event selection
-   TGNumberEntry *fThreshold;       // number entry to setup threshold
-   TGNumberEntry *fMaxPt;           // number entry to setup max pt
-   TGComboBox    *fSelect;          // combo box to filter events
-
+   TGTextButton  *fAllEventsButton;  // text button for all events
+   TGGroupFrame  *fParticlesBG;      // particle selection button
+   TGButtonGroup *fTrackSelection;   // track selection button
+   TGCheckButton *fPosCharged;       // check button for positive only charged particles
+   TGCheckButton *fNegCharged;       // check button for negative only charged particles
+   TGCheckButton *fElectrons;        // check button for electrons
+   TGCheckButton *fMuons;            // check button for muons
+   TGCheckButton *fPions;            // check button for pions
+   TGCheckButton *fKaons;            // check button for kaons
+   TGCheckButton *fProtons;          // check button for protons
+   TGRadioButton *fRtracks[2];       // radio button for track selection
+   TGLabel       *fLabel;            // label for track selection
+   TGLabel       *fLabel1;           // label for event selection
+   TGNumberEntry *fThreshold;        // number entry to setup threshold
+   TGNumberEntry *fMaxPt;            // number entry to setup max pt
+   TGComboBox    *fSelect;           // combo box to filter events
 
    // All events GUI
    TGButtonGroup *fParticlesBGAE;    // particle selection button for all events
@@ -102,13 +102,10 @@ protected:
    TGLabel       *fLabel1AE;         // label for event selection
    TGNumberEntry *fThresholdAE;      // number entry to setup threshold
    TGNumberEntry *fMaxPtAE;          // number entry to setup max pt
-
-   TGButtonGroup *fEventControl;            // event control panel
-   TGCheckButton *fIsMC;                    // check if data is from MC
+   TGButtonGroup *fEventControl;     // event control panel
+   TGCheckButton *fIsMC;             // check if data is from MC
    TGCheckButton *fCollisionCandidatesOnly; // fill all collision candidates events
 
-private:
-
    AliEveLegoEditor(const AliEveLegoEditor&);            // Not implemented
    AliEveLegoEditor& operator=(const AliEveLegoEditor&); // Not implemented