alieve_online.C - added camera checking (for shrinking views problem)
authorpdebski <pdebski@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Sep 2010 09:02:32 +0000 (09:02 +0000)
committerpdebski <pdebski@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Sep 2010 09:02:32 +0000 (09:02 +0000)
tpc _clusters.C - added coloured clusters
alieve_set_cuts.C - added gui mode for cuts and simple analysis
set_momentum_vectors.C - display momentum vectors in alieve
make_residuals.C - gui window for setting residuals display
AliEveConfigManager - added one tab with cuts
AliEveV0 - added one function

EVE/EveBase/AliEveConfigManager.cxx
EVE/EveBase/AliEveConfigManager.h
EVE/EveBase/AliEveV0.h
EVE/alice-macros/alieve_set_cuts.C [new file with mode: 0644]
EVE/alice-macros/make_residuals.C [new file with mode: 0644]
EVE/alice-macros/set_momentum_vectors.C [new file with mode: 0644]
EVE/alice-macros/tpc_clusters.C
EVE/macros/alieve_online.C

index fdc2f5f..332b7ca 100644 (file)
@@ -42,7 +42,7 @@ namespace
 {
  enum EAliEveMenu_e
  {
-   kAEMDefault, kAEMScreen, kAEMProjector, kAEMNotransparency, kAEMTransparentDark, kAEMTransparentLight, kAEMTransparentMonoDark, kAEMTransparentMonoLight, kAEMGreen, kAEMBright, kAEMYellow, kAEMTpc, kAEMAll, kAEM3d, kAEMRphi, kAEMRhoz, kAEMAllhr, kAEM3dhr, kAEMRphihr, kAEMRhozhr, kAEMSavemacros, kAEMLoadmacros, kAEMSave, kAEMOpen, kAEMSetDefault
+   kAEMDefault, kAEMScreen, kAEMProjector, kAEMNotransparency, kAEMTransparentDark, kAEMTransparentLight, kAEMTransparentMonoDark, kAEMTransparentMonoLight, kAEMGreen, kAEMBright, kAEMYellow, kAEMTpc, kAEMAll, kAEM3d, kAEMRphi, kAEMRhoz, kAEMAllhr, kAEM3dhr, kAEMRphihr, kAEMRhozhr, kAEMSavemacros, kAEMLoadmacros, kAEMSave, kAEMOpen, kAEMSetDefault, kAEMResiduals,  kAEMCuts, kAEMVectors, kAEMGui
  };
 }
  
@@ -76,6 +76,7 @@ AliEveConfigManager* AliEveConfigManager::GetMaster()
 //______________________________________________________________________________
 AliEveConfigManager::AliEveConfigManager() :
   TObject(),
+  fAnalysisPopup(0),
   fAliEvePopup(0),
   fAliEveGeometries(0),
   fAliEvePictures(0),
@@ -162,13 +163,29 @@ AliEveConfigManager::AliEveConfigManager() :
   fAliEvePopup->AddPopup("&DataSelection", fAliEveDataSelection);
   fAliEvePopup->AddSeparator();
 
+  fAnalysisPopup = new TGPopupMenu(gClient->GetRoot());  
+//  fAnalysisPopup->AddEntry("&Residuals", kAEMResiduals);
+//  fAnalysisPopup->AddSeparator();
+  fAnalysisPopup->AddEntry("&Cuts", kAEMCuts);
+  fAnalysisPopup->AddSeparator();
+  fAnalysisPopup->AddEntry("&Momentum vectors", kAEMVectors);
+  fAnalysisPopup->AddSeparator();
+//  fAnalysisPopup->AddEntry("&Gui Mode", kAEMGui);
+//  fAnalysisPopup->AddSeparator();
+
   fAliEvePopup->Connect("Activated(Int_t)", "AliEveConfigManager",
                         this, "AliEvePopupHandler(Int_t)");
+
+  fAnalysisPopup->Connect("Activated(Int_t)", "AliEveConfigManager",
+                        this, "AliEvePopupHandler(Int_t)");
+
   fLoadCheck = kFALSE;
 
 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,25,4)
   TGMenuBar *mBar = gEve->GetBrowser()->GetMenuBar();
   mBar->AddPopup("&AliEve", fAliEvePopup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
+  ((TGCompositeFrame*)mBar->GetParent()->GetParent())->Layout();
+  mBar->AddPopup("&Tools", fAnalysisPopup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
   gEve->GetBrowser()->GetTopMenuFrame()->Layout();
 #else
   // Uber hack as TRootBrowser does not provede manu-bar getter.
@@ -182,6 +199,8 @@ AliEveConfigManager::AliEveConfigManager() :
   TGMenuBar *mBar = (TGMenuBar*) xxFE->fFrame;
   mBar->AddPopup("&AliEve", fAliEvePopup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
   ((TGCompositeFrame*)mBar->GetParent()->GetParent())->Layout();
+  mBar->AddPopup("&Tools", fAnalysisPopup, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
+  ((TGCompositeFrame*)mBar->GetParent()->GetParent())->Layout();
 #endif
 }
 
@@ -643,13 +662,13 @@ void AliEveConfigManager::AliEvePopupHandler(Int_t id)
      TEveElement::List_i i = viewers->BeginChildren();
      i++;
      TEveViewer* view3d = ((TEveViewer*)*i);
-     view3d->GetGLViewer()->SavePictureScale(file1,4.0); // getting high resolution
+     view3d->GetGLViewer()->SavePictureScale(file1,6.0); // getting high resolution
      i++;
      TEveViewer* viewrphi = ((TEveViewer*)*i);
-     viewrphi->GetGLViewer()->SavePictureScale(file2,4.0);
+     viewrphi->GetGLViewer()->SavePictureScale(file2,6.0);
      i++;
      TEveViewer* viewrhoz = ((TEveViewer*)*i);
-     viewrhoz->GetGLViewer()->SavePictureScale(file3,4.0);
+     viewrhoz->GetGLViewer()->SavePictureScale(file3,6.0);
      
      printf("Done.\n"); 
       
@@ -956,6 +975,46 @@ void AliEveConfigManager::AliEvePopupHandler(Int_t id)
 
     }
 
+/*
+    case kAEMResiduals:
+    {
+
+      TEveUtil::Macro("make_residuals.C");
+
+      break;
+
+    }
+*/
+
+    case kAEMCuts:
+    {
+
+      TEveUtil::Macro("alieve_set_cuts.C");
+
+      break;
+
+    }
+
+    case kAEMVectors:
+    {
+
+      TEveUtil::Macro("set_momentum_vectors.C");
+
+      break;
+
+    }
+
+/*
+    case kAEMGui:
+    {
+
+      TEveUtil::Macro("alieve_gui_mode.C");
+
+      break;
+
+    }
+*/
+
     default:
     {
       Warning(kEH, "Unknown menu entry.");
index ab43f0b..81e73a2 100644 (file)
@@ -31,6 +31,8 @@ public:
 protected:
   static AliEveConfigManager* fgMaster;  // Main instance.
 
+  TGPopupMenu      *fAnalysisPopup; // AliEve menu with analysis tools.
+
   TGPopupMenu      *fAliEvePopup; // AliEve menu.
 
   TGPopupMenu      *fAliEveGeometries; // AliEve submenu - geometries.
index f42582a..81c43b7 100644 (file)
@@ -70,6 +70,7 @@ public:
   Float_t GetEta()    const { return fRecDecayP.Eta(); }
   Float_t GetRadius() const { return fRecDecayV.Perp(); }
   Float_t GetPt()     const { return fRecDecayP.Perp(); }
+  Float_t GetMomentum() const { return fRecDecayP.Mag(); }
 
   Float_t GetInvMass(Int_t nPdgCode, Int_t pPdgCode) const;
   Float_t GetK0sInvMass() const { return GetInvMass(kPiMinus,kPiPlus); }
diff --git a/EVE/alice-macros/alieve_set_cuts.C b/EVE/alice-macros/alieve_set_cuts.C
new file mode 100644 (file)
index 0000000..2a50ad1
--- /dev/null
@@ -0,0 +1,3902 @@
+#include <TGButton.h>
+#include <TGComboBox.h>
+#include <TEveBrowser.h>
+#include <TGButtonGroup.h>
+#include <TGLabel.h>
+#include <TGNumberEntry.h>
+#include <TG3DLine.h>
+#include <TApplication.h>
+#include <TGComboBox.h>
+#include <TLatex.h>
+#include <TGSlider.h>
+#include "TGDoubleSlider.h"
+#include <TEvePointSet.h>
+
+/*
+class CutsDoubleSlider : public TGMainFrame {
+
+protected:
+   TGLabel*            gLabel;
+   TGCheckButton*      gApplyCut;
+   TGNumberEntry*      gMaxValue;
+   TGNumberEntry*      gMinValue;
+   TGDoubleSlider*     gDoubleSlider;
+
+public:
+   CutsDoubleSlider((const TGWindow* p, Int_t sliderWidth, const char* labelText, Int_t valMin, Int_t valMax, Pixel_t backgroundColor, Pixel_t textColor);
+
+   void GetLabel() { return gLabel; };
+   void GetCheckButton() { return gApplyCut; };
+   void GetEntryMax() { return gMaxValue; };
+   void GetEntryMin() { return gMinValue; };
+   void GetSlider() { return gDoubleSlider; };
+
+   ClassDef(CutsDoubleSlider, 0)
+};
+
+CutsDoubleSlider::CutsDoubleSlider(const TGWindow* p, Int_t sliderWidth, const char* labelText, Int_t valMin, Int_t valMax, Pixel_t backgroundColor, Pixel_t textColor)
+ : TGMainFrame(p, 10, 10, kHorizontalFrame)
+{
+
+   TGVerticalFrame *vframe = new TGVerticalFrame(this);
+
+   TGHorizontalFrame* hframe = new TGHorizontalFrame(vframe, 200, 20, kFixedWidth);
+   TGLabel *label = 0;
+
+   gLabel = new TGLabel(hframe,labelText);
+   gLabel->SetBackgroundColor(backgroundColor);
+   gLabel->SetTextColor(textColor);
+
+   gMinValue = new TGNumberEntry(hframe, 0, 6);
+   gMinValue->SetNumber(valMin);
+   gMinValue->SetBackgroundColor(backgroundColor);
+
+   gMaxValue = new TGNumberEntry(hframe, 0, 6);
+   gMaxValue->SetNumber(valMax);
+   gMaxValue->SetBackgroundColor(backgroundColor);
+
+   gApplyCut = new TGCheckButton(hframe, "", 10);
+   gApplyCut->SetBackgroundColor(backgroundColor);
+
+   hframe->AddFrame(gLabel, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+   hframe->AddFrame(gMinValue, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
+   hframe->AddFrame(gMaxValue, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
+   hframe->AddFrame(gApplyCut, new TGLayoutHints(kLHintsRight, 4, 0, 0, 0));
+   hframe->SetBackgroundColor(backgroundColor);
+
+   vframe->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
+
+   hframe = new TGHorizontalFrame(vframe, 200, 20, kFixedWidth);
+
+   gDoubleSlider = new TGDoubleHSlider(hframe, sliderWidth, 1, -1, kHorizontalFrame, backgroundColor, kFALSE, kFALSE);
+   gDoubleSlider->SetRange(valMin, valMax);
+   gDoubleSlider->SetPosition(valMin, valMax);
+   gDoubleSlider->SetBackgroundColor(backgroundColor);
+
+   hframe->AddFrame(gDoubleSlider, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+   hframe->SetBackgroundColor(backgroundColor);
+
+   vframe->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 10));
+
+   AddFrame(vframe, new TGLayoutHints(kLHintsCenterX));
+
+   SetBackgroundColor(backgroundColor);
+
+   Resize();
+
+   MapSubwindows();
+
+   SetWMSizeHints(GetDefaultWidth(), GetDefaultHeight(), 1000, 1000, 0 ,0);
+   SetWindowName("Double Slider");
+   MapRaised();
+
+}
+
+*/
+
+class SetCutsWindow : public TGMainFrame {
+
+protected:
+   TGCheckButton* gDrawV0s;
+   TGCheckButton* gDrawCascades;
+   TGCheckButton* gDrawKinks;
+   TGCheckButton* gDrawVertex;
+   TGCheckButton* gDrawTracklets;
+   TGCheckButton* gDrawTracks;
+   TGCheckButton* gDrawClusters;
+   TGCheckButton* gDrawTracksType1;
+   TGCheckButton* gDrawTracksType2;
+   TGCheckButton* gDrawTracksType3;
+   TGCheckButton* gDrawTracksType4;
+   TGCheckButton* gDrawTracksType5;
+   TGCheckButton* gDrawTracksType6;
+   TGCheckButton* gDrawTracksType7;
+   TGCheckButton* gCutOnP;
+   TGCheckButton* gCutOnPt;
+   TGCheckButton* gCutOnEta;
+   TGCheckButton* gCutOnMult;
+   TGCheckButton* gCutOnCls;
+   TEveGDoubleValuator* gPRange;
+   TEveGDoubleValuator* gPtRange;
+   TEveGDoubleValuator* gEtaRange;
+   TGHSlider* gMultRange;
+   TGNumberEntry* gMultRangeNE;
+   TGHSlider* gClsRange;
+   TGNumberEntry* gClsRangeNE;
+   TGHSlider* gPMVRange;
+   TGLabel* gPMVRangeLabel;
+   TGComboBox* gVectorMode;
+   TGComboBox* gPosColorList;
+   TGTextButton* gPosColorButton;
+   TGComboBox* gNegColorList;
+   TGTextButton* gNegColorButton;
+   TGComboBox* gBkgColorList;
+   TGTextButton* gBkgColorButton;
+   TGLOverlayButton *gOverlayButton3D;
+   TGLOverlayButton *gOverlayButtonRPhi;
+   TGLOverlayButton *gOverlayButtonRhoZ;
+   Bool_t gDrawHistograms[12];
+   
+//   CutsDoubleSlider *slajder1;
+//   CutsDoubleSlider *slajder2;
+//   CutsDoubleSlider *slajder3;
+
+public:
+   SetCutsWindow();
+   void MultNECallBack();
+   void MultSliderCallBack();
+   void ClsNECallBack();
+   void ClsSliderCallBack();
+   void PosTracksCallBack();
+   void NegTracksCallBack();
+   void BackgroundCallBack();
+   void PMVSliderCallBack();
+   void AddDescriptions();
+   void MuonGeometry();
+   void DefaultGeometry();
+   void BrightGeometry();
+   void TransparentGeometry();
+   void YellowGeometry();
+   void SaveAllViews();
+   void Save3DView();
+   void SaveRPhiView();
+   void DrawPtHisto();
+   void DrawEtaHisto();
+   void DrawPhiHisto();
+   void DrawPhiPtHisto();
+   void DrawPtYHisto();
+   void DrawEtaPhiHisto();
+   void DrawPtHistoAll();
+   void DrawEtaHistoAll();
+   void DrawPhiHistoAll();
+   void DrawPhiPtHistoAll();
+   void DrawPtYHistoAll();
+   void DrawEtaPhiHistoAll();
+   void DrawHistos();
+   void DrawHistosAll();
+   void DrawResiduals();
+   Int_t GetTrackColorByMomentum(Double_t, Int_t);
+   void SetStandardCuts();
+   void AddMomentumVectors();
+   void SetCuts();
+   void CloseTab();
+   
+   ClassDef(SetCutsWindow, 0)
+};
+
+//________________________________________________
+
+namespace
+{
+
+   const char *gPictureSaveAsTypes[] = {"PNG Image", "*.png", 0, 0}; //for saving pictures
+
+}
+
+//________________________________________________
+
+SetCutsWindow::SetCutsWindow() : TGMainFrame(gClient->GetRoot(), 10, 10, kHorizontalFrame)
+{
+
+   // Main test window.
+
+   gEve->GetWindowManager()->HideAllEveDecorations();
+
+   SetCleanup(kDeepCleanup);
+
+   TGTextButton *b = 0;
+   TGLabel *label = 0;
+   TGHorizontalFrame *hframe = 0;
+   TGHorizontalFrame *hframeMerge = 0;
+   TGHorizontalFrame *hframe1 = 0;
+   TGHorizontalFrame *hframe2 = 0;
+   TGVerticalFrame *vframe = 0;
+
+   gOverlayButton3D = 0;
+   gOverlayButtonRPhi = 0;
+   gOverlayButtonRhoZ = 0;
+
+   for(Int_t i = 0; i < 12; i++)
+      gDrawHistograms[i] = kFALSE;
+
+   TEveBrowser *browser = gEve->GetBrowser();
+
+   TGShutter *mainShutter = new TGShutter(this, kSunkenFrame);
+
+   TGShutterItem *item1 = new TGShutterItem(mainShutter, new TGHotString("Draw Objects"), 1);
+
+   TGShutterItem *item2 = new TGShutterItem(mainShutter, new TGHotString("Track Cuts"), 2);
+
+   TGShutterItem *item3 = new TGShutterItem(mainShutter, new TGHotString("Colors"), 3);
+
+   TGShutterItem *item4 = new TGShutterItem(mainShutter, new TGHotString("Geometry"), 4);
+
+   TGShutterItem *item5 = new TGShutterItem(mainShutter, new TGHotString("Analysis"), 5);
+
+   TGShutterItem *item6 = new TGShutterItem(mainShutter, new TGHotString("Momentum Vectors"), 6);
+
+   mainShutter->AddItem(item1);
+
+   mainShutter->AddItem(item2);
+
+   mainShutter->AddItem(item3);
+
+   mainShutter->AddItem(item4);
+
+   mainShutter->AddItem(item5);
+
+   mainShutter->AddItem(item6);
+
+   AddFrame(mainShutter, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
+
+   TGCompositeFrame *container1 = (TGCompositeFrame *) item1->GetContainer();
+
+   TGCompositeFrame *container2 = (TGCompositeFrame *) item2->GetContainer();
+
+   TGCompositeFrame *container3 = (TGCompositeFrame *) item3->GetContainer();
+
+   TGCompositeFrame *container4 = (TGCompositeFrame *) item4->GetContainer();
+
+   TGCompositeFrame *container5 = (TGCompositeFrame *) item5->GetContainer();
+
+   TGCompositeFrame *container6 = (TGCompositeFrame *) item6->GetContainer();
+
+   // Draw Elements
+
+   TGVerticalFrame *drawElements = new TGVerticalFrame(container1);
+   container1->AddFrame(drawElements, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));//, 5, 5, 5, 5));// | kLHintsExpandY
+
+   // Track Cuts
+   TGVerticalFrame *trackCuts = new TGVerticalFrame(container2);
+   container2->AddFrame(trackCuts, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));//, 5, 5, 5, 5));// | kLHintsExpandY
+
+   // Buttons
+   TGVerticalFrame *buttons = new TGVerticalFrame(container3);
+   container3->AddFrame(buttons, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));//, 5, 5, 5, 5));// | kLHintsExpandY
+
+   // Geometry
+   TGVerticalFrame *geometry = new TGVerticalFrame(container4);
+   container4->AddFrame(geometry, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));//, 5, 5, 5, 5));// | kLHintsExpandY
+
+   // Analysis
+   TGVerticalFrame *analysis = new TGVerticalFrame(container5);
+   container5->AddFrame(analysis, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));//, 5, 5, 5, 5));// | kLHintsExpandY
+
+   // Momentum Vectors
+   TGVerticalFrame *momentumVectors = new TGVerticalFrame(container6);
+   container6->AddFrame(momentumVectors, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));//, 5, 5, 5, 5));// | kLHintsExpandY
+
+   // DRAW ELEMENTS
+
+   separator = new TGHorizontal3DLine(drawElements);
+   drawElements->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   label = new TGLabel(drawElements, "ESD objects");
+   drawElements->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   separator = new TGHorizontal3DLine(drawElements);
+   drawElements->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // V0s
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "V0s");
+   gDrawV0s = new TGCheckButton(hframeMerge, "", 10);
+   gDrawV0s->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawV0s);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // Cascades
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "Cascades");
+   gDrawCascades = new TGCheckButton(hframeMerge, "", 10);
+   gDrawCascades->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawCascades);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // Kinks
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "Kinks");
+   gDrawKinks = new TGCheckButton(hframeMerge, "", 10);
+   gDrawKinks->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawKinks);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // Primary Vertex
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "Primary Vertex");
+   gDrawVertex = new TGCheckButton(hframeMerge, "", 10);
+   gDrawVertex->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawVertex);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // Tracklets
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "Tracklets");
+   gDrawTracklets = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracklets->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracklets);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // Tracks
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "Tracks");
+   gDrawTracks = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracks->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracks);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // Clusters
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "Clusters");
+   gDrawClusters = new TGCheckButton(hframeMerge, "", 10);
+   gDrawClusters->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawClusters);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // TRACK TYPES
+
+   separator = new TGHorizontal3DLine(drawElements);
+   drawElements->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   label = new TGLabel(drawElements, "Track types");
+   drawElements->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   separator = new TGHorizontal3DLine(drawElements);
+   drawElements->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // sigma < 3
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "Sigma < 3");
+   gDrawTracksType1 = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracksType1->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracksType1);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // 3 < sigma < 5
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "3 < Sigma < 5");
+   gDrawTracksType2 = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracksType2->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracksType2);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // 5 < Sigma
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "5 < Sigma");
+   gDrawTracksType3 = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracksType3->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracksType3);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // no ITS refit; 
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "no ITS refit");
+   gDrawTracksType4 = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracksType4->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracksType4);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // no TPC refit
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "no TPC refit");
+   gDrawTracksType5 = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracksType5->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracksType5);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // ITS ncl>=3
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "ITS ncl>=3");
+   gDrawTracksType6 = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracksType6->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracksType6);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // ITS others
+
+   hframeMerge = new TGHorizontalFrame(drawElements, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframeMerge, "ITS others");
+   gDrawTracksType7 = new TGCheckButton(hframeMerge, "", 10);
+   gDrawTracksType7->SetEnabled(kTRUE);
+   hframeMerge->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+   hframeMerge->AddFrame(gDrawTracksType7);
+
+   drawElements->AddFrame(hframeMerge, new TGLayoutHints(kLHintsExpandX));
+
+   // Main menu
+
+   separator = new TGHorizontal3DLine(drawElements);
+   drawElements->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(drawElements, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Apply Cuts");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SetCuts()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));
+
+   drawElements->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(drawElements, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Close Tab");
+   b->Connect("Clicked()", "SetCutsWindow", this, "CloseTab()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   drawElements->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+   // TRACK CUTS
+
+   separator = new TGHorizontal3DLine(trackCuts);
+   trackCuts->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(trackCuts, 200, 20, kFixedWidth);
+
+   gPRange = new TEveGDoubleValuator(hframe,"P range:", 40, 0);
+   gPRange->SetNELength(6);
+   gPRange->SetLabelWidth(50);
+   gPRange->Build();
+   gPRange->GetSlider()->SetWidth(180);
+   gPRange->SetLimits(0, 5, TGNumberFormat::kNESRealTwo);
+   gPRange->SetValues(0, 5, TGNumberFormat::kNESRealTwo);
+
+   gCutOnP = new TGCheckButton(hframe, "", 10);
+   gCutOnP->SetEnabled(kTRUE);
+
+   hframe->AddFrame(gPRange, new TGLayoutHints(kLHintsExpandX, 10, 10, 10, 10));
+   hframe->AddFrame(gCutOnP, new TGLayoutHints(kLHintsNormal, 10, 10, 10, 10));
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+   // Pt
+
+   hframe = new TGHorizontalFrame(trackCuts, 200, 20, kFixedWidth);
+
+   gPtRange = new TEveGDoubleValuator(hframe,"Pt range:", 40, 0);
+   gPtRange->SetNELength(6);
+   gPtRange->SetLabelWidth(50);
+   gPtRange->Build();
+   gPtRange->GetSlider()->SetWidth(180);
+   gPtRange->SetLimits(0, 5, TGNumberFormat::kNESRealTwo);
+   gPtRange->SetValues(0, 5, TGNumberFormat::kNESRealTwo);
+
+   gCutOnPt = new TGCheckButton(hframe, "", 10);
+   gCutOnPt->SetEnabled(kTRUE);
+
+   hframe->AddFrame(gPtRange, new TGLayoutHints(kLHintsExpandX, 10, 10, 10, 10));
+   hframe->AddFrame(gCutOnPt, new TGLayoutHints(kLHintsNormal, 10, 10, 10, 10));
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+   // Eta
+
+   hframe = new TGHorizontalFrame(trackCuts, 200, 20, kFixedWidth);
+
+   gEtaRange = new TEveGDoubleValuator(hframe,"Eta range:", 40, 0);
+   gEtaRange->SetNELength(6);
+   gEtaRange->SetLabelWidth(50);
+   gEtaRange->Build();
+   gEtaRange->GetSlider()->SetWidth(180);
+   gEtaRange->SetLimits(-5, 5, TGNumberFormat::kNESRealTwo);
+   gEtaRange->SetValues(-5, 5, TGNumberFormat::kNESRealTwo);
+
+   gCutOnEta = new TGCheckButton(hframe, "", 10);
+   gCutOnEta->SetEnabled(kTRUE);
+
+   hframe->AddFrame(gEtaRange, new TGLayoutHints(kLHintsExpandX, 10, 10, 10, 10));
+   hframe->AddFrame(gCutOnEta, new TGLayoutHints(kLHintsNormal, 10, 10, 10, 10));
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+   // Multiplicity
+
+   hframe = new TGHorizontalFrame(trackCuts, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframe, "% Tracks displayed:");
+
+   gMultRangeNE = new TGNumberEntry(hframe, 0, 6);
+   gMultRangeNE->SetNumber(100);
+   gCutOnMult = new TGCheckButton(hframe, "", 10);
+   gCutOnMult->SetEnabled(kTRUE);
+
+   hframe->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+   hframe->AddFrame(gMultRangeNE, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
+   hframe->AddFrame(gCutOnMult, new TGLayoutHints(kLHintsRight, 10, 10, 0, 0));//kLHintsNormal
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
+
+   hframe = new TGHorizontalFrame(trackCuts, 200, 20, kFixedWidth);
+
+   gMultRange = new TGHSlider(hframe,180);
+   gMultRange->SetRange(0, 100);
+   gMultRange->SetPosition(100);
+   gMultRange->Connect("PositionChanged(Int_t)", "SetCutsWindow", this, "MultSliderCallBack()");
+
+   gMultRangeNE->Connect("ValueSet(Long_t)", "SetCutsWindow", this, "MultNECallBack()");
+
+   hframe->AddFrame(gMultRange, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 10));
+
+   // TPC Clusters
+
+   hframe = new TGHorizontalFrame(trackCuts, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframe, "TPC clusters:");
+
+   gClsRangeNE = new TGNumberEntry(hframe, 0, 6);
+   gClsRangeNE->SetNumber(0);
+   gClsRangeNE->Connect("ValueSet(Long_t)", "SetCutsWindow", this, "ClsNECallBack()");
+
+   gCutOnCls = new TGCheckButton(hframe, "", 10);
+   gCutOnCls->SetEnabled(kTRUE);
+
+   hframe->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+   hframe->AddFrame(gClsRangeNE, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
+   hframe->AddFrame(gCutOnCls, new TGLayoutHints(kLHintsRight, 10, 10, 0, 0));//kLHintsNormal
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 10, 0));
+
+   hframe = new TGHorizontalFrame(trackCuts, 200, 20, kFixedWidth);
+
+   gClsRange = new TGHSlider(hframe,180);
+   gClsRange->SetRange(0, 200);
+   gClsRange->SetPosition(0);
+   gClsRange->Connect("PositionChanged(Int_t)", "SetCutsWindow", this, "ClsSliderCallBack()");
+
+   hframe->AddFrame(gClsRange, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 0));
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 0, 0, 0, 10));
+
+   separator = new TGHorizontal3DLine(trackCuts);
+   trackCuts->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Standard cuts
+
+   hframe = new TGHorizontalFrame(trackCuts, 100, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Standard Cuts");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SetStandardCuts()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 10, 10, 10, 10));
+
+   // Main menu
+
+   separator = new TGHorizontal3DLine(trackCuts);
+   trackCuts->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(trackCuts, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Apply Cuts");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SetCuts()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(trackCuts, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Close Tab");
+   b->Connect("Clicked()", "SetCutsWindow", this, "CloseTab()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   trackCuts->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+//    trackCutsITS->SetMaxDCAToVertexXY(2.4);
+//    trackCutsITS->SetMaxDCAToVertexZ(3.2);
+
+
+   // BUTTONS
+
+   separator = new TGHorizontal3DLine(buttons);
+   buttons->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Positive tracks colorset
+
+   hframe = new TGHorizontalFrame(buttons, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframe, "Positive tracks:");
+   hframe->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+
+   gPosColorList = new TGComboBox(hframe);
+   gPosColorList->AddEntry("Blue", 1);
+   gPosColorList->AddEntry("Red", 2);
+   gPosColorList->AddEntry("Mixed", 3);
+   gPosColorList->Resize(100,20);
+   gPosColorList->Connect("Selected(Int_t)", "SetCutsWindow", this, "PosTracksCallBack()");
+   hframe->AddFrame(gPosColorList, new TGLayoutHints(kLHintsExpandX));
+
+   gPosColorButton = new TGTextButton(hframe, "    ");
+
+   hframe->AddFrame(gPosColorButton, new TGLayoutHints(kLHintsNormal, 5, 5, 1, 1));
+
+   buttons->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Negative tracks colorset
+
+   hframe = new TGHorizontalFrame(buttons, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframe, "Negative tracks:");
+   hframe->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+
+   gNegColorList = new TGComboBox(hframe);
+   gNegColorList->AddEntry("Blue", 1);
+   gNegColorList->AddEntry("Red", 2);
+   gNegColorList->AddEntry("Mixed", 3);
+   gNegColorList->Resize(100,20);
+   gNegColorList->Connect("Selected(Int_t)", "SetCutsWindow", this, "NegTracksCallBack()");
+   hframe->AddFrame(gNegColorList, new TGLayoutHints(kLHintsExpandX));
+
+   gNegColorButton = new TGTextButton(hframe, "    ");
+   hframe->AddFrame(gNegColorButton, new TGLayoutHints(kLHintsNormal, 5, 5, 1, 1));
+
+   buttons->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Background color
+
+   hframe = new TGHorizontalFrame(buttons, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframe, "Background:");
+   hframe->AddFrame(label, new TGLayoutHints(kLHintsExpandX));
+
+   gBkgColorList = new TGComboBox(hframe);
+   gBkgColorList->AddEntry("White", 1);
+   gBkgColorList->AddEntry("Black", 2);
+   gBkgColorList->Resize(100,20);
+   gBkgColorList->Connect("Selected(Int_t)", "SetCutsWindow", this, "BackgroundCallBack()");
+   hframe->AddFrame(gBkgColorList, new TGLayoutHints(kLHintsExpandX));
+
+   gBkgColorButton = new TGTextButton(hframe, "    ");
+   hframe->AddFrame(gBkgColorButton, new TGLayoutHints(kLHintsNormal, 5, 5, 1, 1));
+
+   buttons->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Main menu
+
+   separator = new TGHorizontal3DLine(buttons);
+   buttons->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(buttons, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Apply Cuts");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SetCuts()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));
+
+   buttons->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(buttons, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Close Tab");
+   b->Connect("Clicked()", "SetCutsWindow", this, "CloseTab()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   buttons->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+   // GEOMETRY
+
+   separator = new TGHorizontal3DLine(geometry);
+   geometry->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   label = new TGLabel(geometry, "Geometries");
+   geometry->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Geometry
+
+   separator = new TGHorizontal3DLine(geometry);
+   geometry->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(geometry, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "MUON arm");
+   b->Connect("Clicked()", "SetCutsWindow", this, "MuonGeometry()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(geometry, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Default");
+   b->Connect("Clicked()", "SetCutsWindow", this, "DefaultGeometry()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Bright");
+   b->Connect("Clicked()", "SetCutsWindow", this, "BrightGeometry()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(geometry, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Transparent");
+   b->Connect("Clicked()", "SetCutsWindow", this, "TransparentGeometry()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Yellow");
+   b->Connect("Clicked()", "SetCutsWindow", this, "YellowGeometry()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+//   hframe = new TGHorizontalFrame(geometry, 200, 20, kFixedWidth);
+
+//   b = new TGTextButton(hframe, "Close Tab");
+//   b->Connect("Clicked()", "SetCutsWindow", this, "CloseTab()");
+//   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+//   b = new TGTextButton(hframe, "Close Tab");
+//   b->Connect("Clicked()", "SetCutsWindow", this, "CloseTab()");
+//   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+//   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Snapshots
+
+   separator = new TGHorizontal3DLine(geometry);
+   geometry->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   label = new TGLabel(geometry, "Snapshots");
+   geometry->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   separator = new TGHorizontal3DLine(geometry);
+   geometry->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+//   hframe = new TGHorizontalFrame(geometry, 200, 20, kFixedWidth);
+
+//   b = new TGTextButton(hframe, "Descriptions");
+//   b->Connect("Clicked()", "SetCutsWindow", this, "AddDescriptions()");
+//   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+//   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(geometry, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Save all Views");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SaveAllViews()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(geometry, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "3D View");
+   b->Connect("Clicked()", "SetCutsWindow", this, "Save3DView()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "RPhi");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SaveRPhiView()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "RhoZ");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SaveRhoZView()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Main menu
+
+   separator = new TGHorizontal3DLine(geometry);
+   geometry->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(geometry, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Apply Cuts");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SetCuts()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));
+
+   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(geometry, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Close Tab");
+   b->Connect("Clicked()", "SetCutsWindow", this, "CloseTab()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   geometry->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+   // ANALYSIS
+
+   separator = new TGHorizontal3DLine(analysis);
+   analysis->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   label = new TGLabel(analysis, "Single Event Histograms");
+   analysis->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Single Event
+
+   separator = new TGHorizontal3DLine(analysis);
+   analysis->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(analysis, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Pt");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawPtHisto()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Eta");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawEtaHisto()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Phi");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawPhiHisto()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
+
+   hframe = new TGHorizontalFrame(analysis, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Phi-Pt");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawPhiPtHisto()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Pt-Y");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawPtYHisto()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Eta-Phi");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawEtaPhiHisto()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
+
+   hframe = new TGHorizontalFrame(analysis, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Draw Histograms");
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawHistos()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // All Events
+
+   separator = new TGHorizontal3DLine(analysis);
+   analysis->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   label = new TGLabel(analysis, "All Events Histograms");
+   analysis->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   separator = new TGHorizontal3DLine(analysis);
+   analysis->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(analysis, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Pt");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawPtHistoAll()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Eta");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawEtaHistoAll()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Phi");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawPhiHistoAll()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
+
+   hframe = new TGHorizontalFrame(analysis, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Phi-Pt");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawPhiPtHistoAll()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Pt-Y");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawPtYHistoAll()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   b = new TGTextButton(hframe, "Eta-Phi");
+   b->AllowStayDown(kTRUE);
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawEtaPhiHistoAll()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));//, 5, 5, 5, 5));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
+
+   hframe = new TGHorizontalFrame(analysis, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Draw Histograms");
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawHistosAll()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   separator = new TGHorizontal3DLine(analysis);
+   analysis->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   label = new TGLabel(analysis, "Residuals");
+   analysis->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   separator = new TGHorizontal3DLine(analysis);
+   analysis->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(analysis, 200, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Draw Residuals");
+   b->Connect("Clicked()", "SetCutsWindow", this, "DrawResiduals()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Main menu
+
+   separator = new TGHorizontal3DLine(analysis);
+   analysis->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(analysis, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Apply Cuts");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SetCuts()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(analysis, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Close Tab");
+   b->Connect("Clicked()", "SetCutsWindow", this, "CloseTab()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   analysis->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+   // MOMENTUM VECTORS
+
+   // Draw momentum vectors
+
+   separator = new TGHorizontal3DLine(momentumVectors);
+   momentumVectors->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   label = new TGLabel(momentumVectors, "Draw Momentum Vectors");
+   momentumVectors->AddFrame(label, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   separator = new TGHorizontal3DLine(momentumVectors);
+   momentumVectors->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(momentumVectors, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframe, "Scale:");
+   hframe->AddFrame(label, new TGLayoutHints(kLHintsNormal, 5, 5, 0, 0));
+
+   gVectorMode = new TGComboBox(hframe);
+   gVectorMode->AddEntry("Log scale", 1);
+   gVectorMode->AddEntry("maxP -> 600cm", 2);
+   gVectorMode->AddEntry("1GeV -> 100cm", 3);
+   gVectorMode->Resize(150,20);
+   gVectorMode->Select(2);
+
+   hframe->AddFrame(gVectorMode, new TGLayoutHints(kLHintsNormal, 0, 5, 0, 0));
+
+   momentumVectors->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(momentumVectors, 200, 20, kFixedWidth);
+
+   label = new TGLabel(hframe, "Minimal P: ");
+   hframe->AddFrame(label, new TGLayoutHints(kLHintsNormal, 5, 5, 0, 0));
+
+   gPMVRangeLabel = new TGLabel(hframe, "0.0");
+   hframe->AddFrame(gPMVRangeLabel, new TGLayoutHints(kLHintsNormal, 0, 0, 0, 0));
+
+   label = new TGLabel(hframe, "GeV/c");
+   hframe->AddFrame(label, new TGLayoutHints(kLHintsNormal, 1, 0, 0, 0));
+
+   momentumVectors->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(momentumVectors, 200, 20, kFixedWidth);
+
+   gPMVRange = new TGHSlider(hframe,180);
+   gPMVRange->SetRange(0, 50);
+   gPMVRange->SetPosition(0);
+   gPMVRange->Connect("PositionChanged(Int_t)", "SetCutsWindow", this, "PMVSliderCallBack()");
+
+   hframe->AddFrame(gPMVRange, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   momentumVectors->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(momentumVectors, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Draw");
+   b->Connect("Clicked()", "SetCutsWindow", this, "AddMomentumVectors()");
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 0, 0));
+
+   momentumVectors->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   // Main menu
+
+   separator = new TGHorizontal3DLine(momentumVectors);
+   momentumVectors->AddFrame(separator, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(momentumVectors, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Apply Cuts");
+   b->Connect("Clicked()", "SetCutsWindow", this, "SetCuts()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX));
+
+   momentumVectors->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   hframe = new TGHorizontalFrame(momentumVectors, 150, 20, kFixedWidth);
+
+   b = new TGTextButton(hframe, "Close Tab");
+   b->Connect("Clicked()", "SetCutsWindow", this, "CloseTab()");
+
+   hframe->AddFrame(b, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   momentumVectors->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX));
+
+   // FINAL STUFF
+
+   Resize();
+
+   MapSubwindows();
+
+   SetWMSizeHints(GetDefaultWidth(), GetDefaultHeight(), 1000, 1000, 0 ,0);
+   SetWindowName("Pb-Pb set");
+   MapRaised();
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::MultNECallBack()
+{
+
+   Double_t entry;
+
+   entry = gMultRangeNE->GetNumber();
+   gMultRange->SetPosition(entry);
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::MultSliderCallBack()
+{
+
+   Double_t entry;
+
+   entry = gMultRange->GetPosition();
+   gMultRangeNE->SetNumber(entry);
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::ClsNECallBack()
+{
+M
+   Double_t entry;
+
+   entry = gClsRangeNE->GetNumber();
+   gClsRange->SetPosition(entry);
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::ClsSliderCallBack()
+{
+
+   Double_t entry;
+
+   entry = gClsRange->GetPosition();
+   gClsRangeNE->SetNumber(entry);
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::PosTracksCallBack()
+{
+
+   switch(gPosColorList->GetSelected())
+   {
+
+      case 1:
+         gPosColorButton->SetBackgroundColor(gROOT->GetColor(4)->GetPixel());
+         gPosColorButton->SetText("    ");
+         break;
+
+      case 2:
+         gPosColorButton->SetBackgroundColor(gROOT->GetColor(2)->GetPixel());
+         gPosColorButton->SetText("    ");
+         break;
+
+      case 3:
+         gPosColorButton->SetBackgroundColor(gROOT->GetColor(18)->GetPixel());
+         gPosColorButton->SetText(" M ");
+         break;
+
+      default:
+         gPosColorButton->SetBackgroundColor(gROOT->GetColor(18)->GetPixel());
+         gPosColorButton->SetText("    ");
+         break;
+
+   }
+
+   return;
+
+}
+
+void SetCutsWindow::NegTracksCallBack()
+{
+
+   switch(gNegColorList->GetSelected())
+   {
+
+      case 1:
+         gNegColorButton->SetBackgroundColor(gROOT->GetColor(4)->GetPixel());
+         gNegColorButton->SetText("    ");
+         break;
+
+      case 2:
+         gNegColorButton->SetBackgroundColor(gROOT->GetColor(2)->GetPixel());
+         gNegColorButton->SetText("    ");
+         break;
+
+      case 3:
+         gNegColorButton->SetBackgroundColor(gROOT->GetColor(18)->GetPixel());
+         gNegColorButton->SetText(" M ");
+         break;
+
+      default:
+         gNegColorButton->SetBackgroundColor(gROOT->GetColor(18)->GetPixel());
+         gNegColorButton->SetText("    ");
+         break;
+
+   }
+
+   return;
+
+}
+
+void SetCutsWindow::BackgroundCallBack()
+{
+
+   switch(gBkgColorList->GetSelected())
+   {
+
+      case 1:
+         gBkgColorButton->SetBackgroundColor(gROOT->GetColor(0)->GetPixel());
+         gBkgColorButton->SetText("    ");
+
+         if(!gEve->GetViewers()->UseLightColorSet())
+           gEve->GetViewers()->SwitchColorSet(); //white background
+
+         break;
+
+      case 2:
+         gBkgColorButton->SetBackgroundColor(gROOT->GetColor(1)->GetPixel());
+         gBkgColorButton->SetText("    ");
+
+         if(gEve->GetViewers()->UseLightColorSet())
+            gEve->GetViewers()->SwitchColorSet(); //black background
+
+         break;
+
+      default:
+         gBkgColorButton->SetBackgroundColor(gROOT->GetColor(18)->GetPixel());
+         gBkgColorButton->SetText("    ");
+
+         break;
+
+   }
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::PMVSliderCallBack()
+{
+
+//   TGHSlider* gPMVRange;
+//   TGLabel* gPMVRangeLabel;
+
+
+   Double_t entry;
+
+   entry = gPMVRange->GetPosition();
+   gPMVRangeLabel->SetText(Form("%2.1f",0.1*entry));
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::AddDescriptions()
+{
+/*
+   if(gOverlayButton3D && gOverlayButtonRPhi && gOverlayButtonRhoZ)
+   {
+
+      (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("3D View")))->GetGLViewer()->RemoveOverlayElement((TGLOverlayElement*)gOverlayButton3D);
+      (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("RPhi View")))->GetGLViewer()->RemoveOverlayElement((TGLOverlayElement*)gOverlayButtonRPhi);
+      (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("RhoZ View")))->GetGLViewer()->RemoveOverlayElement((TGLOverlayElement*)gOverlayButtonRhoZ);
+
+   }
+   else
+   {
+
+      AliEveMultiView *multiView = AliEveMultiView::Instance();
+
+      TGLViewer *glv = (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("3D View")))->GetGLViewer();
+      gOverlayButton3D = new TGLOverlayButton(glv,  "ALICE run 123456 event 123", 0, 0, multiView->Get3DView()->GetEveFrame()->GetWidth(), 30);
+      gOverlayButton3D->SetAlphaValues(0.5, 0.5);
+
+      glv = (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("RPhi View")))->GetGLViewer();
+      gOverlayButtonRPhi = new TGLOverlayButton(glv,  "ALICE run 123456 event 123", 0, 0, multiView->GetRPhiView()->GetEveFrame()->GetWidth(), 30);
+      gOverlayButtonRPhi->SetAlphaValues(0.5, 0.5);
+
+      glv = (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("RhoZ View")))->GetGLViewer();
+      gOverlayButtonRhoZ = new TGLOverlayButton(glv,  "ALICE run 123456 event 123", 0, 0, multiView->GetRhoZView()->GetEveFrame()->GetWidth(), 30);
+      gOverlayButtonRhoZ->SetAlphaValues(0.5, 0.5);
+
+   }
+
+   gEve->Redraw3D(kFALSE, kTRUE);
+*/
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::MuonGeometry()
+{
+
+   if(gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON"))
+   {
+      if(gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON")->GetRnrSelf() || gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON")->GetRnrChildren())
+      {
+         gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON")->SetRnrSelf(kFALSE);
+         gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON")->SetRnrChildren(kFALSE);
+      }
+      else
+      {
+         gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON")->SetRnrSelf(kTRUE);
+         gEve->GetScenes()->FirstChild()->FindChild("Gentle MUON")->SetRnrChildren(kTRUE);
+      }  
+
+   }
+
+   gEve->FullRedraw3D();   
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DefaultGeometry()
+{
+
+   AliEveMultiView *mv = AliEveMultiView::Instance();
+
+   mv->DestroyAllGeometries(); //destroy RPhi and Rhoz geometries before putting new
+
+   gEve->LoadVizDB("geom_gentle_default.C", kTRUE, kTRUE); //loading geometry
+
+   if(!gEve->GetViewers()->UseLightColorSet())
+      gEve->GetViewers()->SwitchColorSet(); //white background
+
+   gEve->FullRedraw3D();   
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::BrightGeometry()
+{
+
+   AliEveMultiView *mv = AliEveMultiView::Instance();
+
+   mv->DestroyAllGeometries();
+
+   gEve->LoadVizDB("geom_gentle_bright.C", kTRUE, kTRUE);
+
+   if(gEve->GetViewers()->UseLightColorSet())
+      gEve->GetViewers()->SwitchColorSet();
+
+
+
+   gEve->FullRedraw3D();
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::TransparentGeometry()
+{
+
+   AliEveMultiView *mv = AliEveMultiView::Instance();
+
+   mv->DestroyAllGeometries();
+
+   gEve->LoadVizDB("geom_gentle_transparent.C", kTRUE, kTRUE);
+
+   if(!gEve->GetViewers()->UseLightColorSet())
+      gEve->GetViewers()->SwitchColorSet();
+
+   gEve->FullRedraw3D();
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::YellowGeometry()
+{
+
+   AliEveMultiView *mv = AliEveMultiView::Instance();
+
+   mv->DestroyAllGeometries();
+
+   gEve->LoadVizDB("geom_gentle_yellow.C", kTRUE, kTRUE);
+
+   if(!gEve->GetViewers()->UseLightColorSet())
+      gEve->GetViewers()->SwitchColorSet();
+
+   gEve->FullRedraw3D();    
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::SaveAllViews()
+{
+
+     TGFileInfo fi;
+     fi.fFileTypes   = gPictureSaveAsTypes;
+     fi.fIniDir      = StrDup(""); // current directory
+     fi.fFileTypeIdx = 0;
+     fi.fOverwrite   = kTRUE;
+     new TGFileDialog(gClient->GetDefaultRoot(),
+     gEve->GetMainWindow(), kFDSave, &fi);
+     if (!fi.fFilename) return;
+
+     TPMERegexp filere(".*/([^/]+$)");
+     if (filere.Match(fi.fFilename) != 2)
+     {
+       Warning("AliEvePopupHandler", "file '%s' bad.", fi.fFilename);
+       return;
+     }
+
+     TString file1(filere[1]);
+     TString file2(filere[1]);
+     TString file3(filere[1]);
+     
+     if (!file1.EndsWith(".png"))
+       file1 += "_3D.png";
+       
+     if (!file2.EndsWith(".png"))
+       file2 += "_RPhi.png";
+       
+     if (!file3.EndsWith(".png"))
+       file3 += "_RhoZ.png";
+
+     gSystem->ChangeDirectory(fi.fIniDir);
+      
+     printf("Saving...\n");
+
+     TEveViewerList *viewers = gEve->GetViewers();
+     TEveElement::List_i i = viewers->BeginChildren();
+     i++;
+     TEveViewer* view3d = ((TEveViewer*)*i);
+     view3d->GetGLViewer()->SavePictureScale(file1,4.0); // getting high resolution
+     i++;
+     TEveViewer* viewrphi = ((TEveViewer*)*i);
+     viewrphi->GetGLViewer()->SavePictureScale(file2,4.0);
+     i++;
+     TEveViewer* viewrhoz = ((TEveViewer*)*i);
+     viewrhoz->GetGLViewer()->SavePictureScale(file3,4.0);
+     
+     printf("Done.\n"); 
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::Save3DView()
+{
+
+     TGFileInfo fi;
+     fi.fFileTypes   = gPictureSaveAsTypes;
+     fi.fIniDir      = StrDup(""); // current directory
+     fi.fFileTypeIdx = 0;
+     fi.fOverwrite   = kTRUE;
+     new TGFileDialog(gClient->GetDefaultRoot(),
+     gEve->GetMainWindow(), kFDSave, &fi);
+     if (!fi.fFilename) return;
+
+     TPMERegexp filere(".*/([^/]+$)");
+     if (filere.Match(fi.fFilename) != 2)
+     {
+       Warning("AliEvePopupHandler", "file '%s' bad.", fi.fFilename);
+       return;
+     }
+
+     TString file1(filere[1]);
+     
+     if (!file1.EndsWith(".png"))
+       file1 += ".png";
+
+     gSystem->ChangeDirectory(fi.fIniDir);
+      
+     printf("Saving...\n");
+
+     TEveViewerList *viewers = gEve->GetViewers();
+     TEveElement::List_i i = viewers->BeginChildren();
+     i++;
+     TEveViewer* view3d = ((TEveViewer*)*i);
+     view3d->GetGLViewer()->SavePictureScale(file1,4.0);
+     
+     printf("Done.\n"); 
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::SaveRPhiView()
+{
+
+     TGFileInfo fi;
+     fi.fFileTypes   = gPictureSaveAsTypes;
+     fi.fIniDir      = StrDup(""); // current directory
+     fi.fFileTypeIdx = 0;
+     fi.fOverwrite   = kTRUE;
+     new TGFileDialog(gClient->GetDefaultRoot(),
+     gEve->GetMainWindow(), kFDSave, &fi);
+     if (!fi.fFilename) return;
+
+     TPMERegexp filere(".*/([^/]+$)");
+     if (filere.Match(fi.fFilename) != 2)
+     {
+       Warning("AliEvePopupHandler", "file '%s' bad.", fi.fFilename);
+       return;
+     }
+
+     TString file1(filere[1]);
+     
+     if (!file1.EndsWith(".png"))
+       file1 += ".png";
+     
+     gSystem->ChangeDirectory(fi.fIniDir);
+      
+     printf("Saving...\n");
+
+     TEveViewerList *viewers = gEve->GetViewers();
+     TEveElement::List_i i = viewers->BeginChildren();
+     i++;
+     i++;
+     TEveViewer* viewrphi = ((TEveViewer*)*i);
+     viewrphi->GetGLViewer()->SavePictureScale(file1,4.0);
+     
+     printf("Done.\n"); 
+
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::SaveRhoZView()
+{
+
+     TGFileInfo fi;
+     fi.fFileTypes   = gPictureSaveAsTypes;
+     fi.fIniDir      = StrDup(""); // current directory
+     fi.fFileTypeIdx = 0;
+     fi.fOverwrite   = kTRUE;
+     new TGFileDialog(gClient->GetDefaultRoot(),
+     gEve->GetMainWindow(), kFDSave, &fi);
+     if (!fi.fFilename) return;
+
+     TPMERegexp filere(".*/([^/]+$)");
+     if (filere.Match(fi.fFilename) != 2)
+     {
+       Warning("AliEvePopupHandler", "file '%s' bad.", fi.fFilename);
+       return;
+     }
+
+     TString file1(filere[1]);
+       
+     if (!file1.EndsWith(".png"))
+       file1 += ".png";
+
+     gSystem->ChangeDirectory(fi.fIniDir);
+     
+     printf("Saving...\n");
+
+     TEveViewerList *viewers = gEve->GetViewers();
+     TEveElement::List_i i = viewers->BeginChildren();
+     i++;
+     i++;
+     i++;
+     TEveViewer* viewrhoz = ((TEveViewer*)*i);
+     viewrhoz->GetGLViewer()->SavePictureScale(file1,4.0);
+     
+     printf("Done.\n"); 
+
+
+   return;
+
+}
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawPtHisto()
+{
+   if(gDrawHistograms[0])
+      gDrawHistograms[0] = kFALSE;
+   else
+      gDrawHistograms[0] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawEtaHisto()
+{
+   if(gDrawHistograms[1])
+      gDrawHistograms[1] = kFALSE;
+   else
+      gDrawHistograms[1] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawPhiHisto()
+{
+   if(gDrawHistograms[2])
+      gDrawHistograms[2] = kFALSE;
+   else
+      gDrawHistograms[2] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawPhiPtHisto()
+{
+   if(gDrawHistograms[3])
+      gDrawHistograms[3] = kFALSE;
+   else
+      gDrawHistograms[3] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawPtYHisto()
+{
+   if(gDrawHistograms[4])
+      gDrawHistograms[4] = kFALSE;
+   else
+      gDrawHistograms[4] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawEtaPhiHisto()
+{
+   if(gDrawHistograms[5])
+      gDrawHistograms[5] = kFALSE;
+   else
+      gDrawHistograms[5] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawPtHistoAll()
+{
+   if(gDrawHistograms[6])
+      gDrawHistograms[6] = kFALSE;
+   else
+      gDrawHistograms[6] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawEtaHistoAll()
+{
+   if(gDrawHistograms[7])
+      gDrawHistograms[7] = kFALSE;
+   else
+      gDrawHistograms[7] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawPhiHistoAll()
+{
+   if(gDrawHistograms[8])
+      gDrawHistograms[8] = kFALSE;
+   else
+      gDrawHistograms[8] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawPhiPtHistoAll()
+{
+   if(gDrawHistograms[9])
+      gDrawHistograms[9] = kFALSE;
+   else
+      gDrawHistograms[9] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawPtYHistoAll()
+{
+   if(gDrawHistograms[10])
+      gDrawHistograms[10] = kFALSE;
+   else
+      gDrawHistograms[10] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawEtaPhiHistoAll()
+{
+   if(gDrawHistograms[11])
+      gDrawHistograms[11] = kFALSE;
+   else
+      gDrawHistograms[11] = kTRUE;
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawHistos()
+{
+
+   Int_t nHistos1 = 0;
+   Int_t nHistos2 = 0;
+
+   TCanvas* pad1 = 0;
+   TCanvas* pad2 = 0;
+
+   if(gDrawHistograms[0])
+   {
+         nHistos1++;
+         TH1D* histPt = new TH1D("Pt\nSingle Event", "AliEve Pt histogram", 100, 0.0, 5.0);
+   }
+
+   if(gDrawHistograms[1])
+   {
+         nHistos1++;
+         TH1D* histEta = new TH1D("#eta\nSingle Event", "AliEve #eta histogram", 100, -1.5, 1.5);
+   }
+
+   if(gDrawHistograms[2])
+   {
+         nHistos1++;
+         TH1D* histPhi = new TH1D("#phi\nSingle Event", "AliEve #phi histogram", 100, 0.0, 2*TMath::Pi());
+   }
+
+   if(gDrawHistograms[3])
+   {
+         nHistos2++;
+         TH2D* histPhiPt = new TH2D("#phi-Pt\nSingle Event", "AliEve #phi-Pt histogram", 100, 0.0, 2*TMath::Pi(), 100, 0.0, 5.0);
+   }
+
+   if(gDrawHistograms[4])
+   {
+         nHistos2++;
+         TH2D* histPtY = new TH2D("Pt-Y\nSingle Event", "AliEve Pt-y histogram", 100, 0.0, 5.0, 100, -1.5, 1.5);
+   }
+
+   if(gDrawHistograms[5])
+   {
+         nHistos2++;
+         TH2D* histEtaPhi = new TH2D("#eta-#phi\nSingle Event", "AliEve #eta-#phi histogram", 100, -1.5, 1.5, 100, 0.0, 2*TMath::Pi());
+   }
+
+   AliESDEvent* esd = AliEveEventManager::AssertESD();
+
+   if(esd->GetNumberOfTracks())
+   {
+
+      for(Int_t j = 0; j < esd->GetNumberOfTracks(); j++)
+      {
+
+         AliESDtrack* track = esd->GetTrack(j);
+
+         if(gDrawHistograms[0])
+            histPt->Fill(track->Pt());
+         if(gDrawHistograms[1])
+            histEta->Fill(track->Eta());
+         if(gDrawHistograms[2])
+            histPhi->Fill(track->Phi());
+         if(gDrawHistograms[3])
+            histPhiPt->Fill(track->Phi(),track->Pt());
+         if(gDrawHistograms[4])
+            histPtY->Fill(track->Pt(),track->Y());
+         if(gDrawHistograms[5])
+            histEtaPhi->Fill(track->Eta(),track->Phi());
+
+      }
+
+   }
+
+   switch(nHistos1)
+   {
+      case 1:
+         pad1 = new TCanvas("AliEve 1D histograms - Single Event","AliEve 1D histograms - Single Event",800,600);
+         if(gDrawHistograms[0])
+            histPt->Draw();
+         if(gDrawHistograms[1])
+            histEta->Draw();
+         if(gDrawHistograms[2])
+            histPhi->Draw();
+         break;
+
+      case 2:
+         pad1 = new TCanvas("AliEve 1D histograms - Single Event","AliEve 1D histograms - Single Event",1200,500);
+         pad1->Divide(2,1);
+         if(!gDrawHistograms[0])
+         {
+            pad1->cd(1);
+            histEta->Draw();
+            pad1->cd(2);
+            histPhi->Draw();
+         }
+         if(!gDrawHistograms[1])
+         {
+            pad1->cd(1);
+            histPt->Draw();
+            pad1->cd(2);
+            histPhi->Draw();
+         }
+         if(!gDrawHistograms[2])
+         {
+            pad1->cd(1);
+            histPt->Draw();
+            pad1->cd(2);
+            histEta->Draw();
+         }
+         break;
+
+      case 3:
+         pad1 = new TCanvas("AliEve 1D histograms - Single Event","AliEve 1D histograms - Single Event",1200,500);
+         pad1->Divide(3,1);
+         pad1->cd(1);
+         histPt->Draw();
+         pad1->cd(2);
+         histEta->Draw();
+         pad1->cd(3);
+         histPhi->Draw();
+         break;
+
+      default:
+         break;
+   }
+
+   switch(nHistos2)
+   {
+      case 1:
+         pad2 = new TCanvas("AliEve 2D histograms - Single Event","AliEve 2D histograms - Single Event",800,600);
+         if(gDrawHistograms[3])
+            histPhiPt->Draw();
+         if(gDrawHistograms[4])
+            histPtY->Draw();
+         if(gDrawHistograms[5])
+            histEtaPhi->Draw();
+         break;
+
+      case 2:
+         pad2 = new TCanvas("AliEve 2D histograms - Single Event","AliEve 2D histograms - Single Event",1200,500);
+         pad2->Divide(2,1);
+         if(!gDrawHistograms[3])
+         {
+            pad2->cd(1);
+            histPtY->Draw();
+            pad2->cd(2);
+            histEtaPhi->Draw();
+         }
+         if(!gDrawHistograms[4])
+         {
+            pad2->cd(1);
+            histPhiPt->Draw();
+            pad2->cd(2);
+            histEtaPhi->Draw();
+         }
+         if(!gDrawHistograms[5])
+         {
+            pad2->cd(1);
+            histPhiPt->Draw();
+            pad2->cd(2);
+            histPtY->Draw();
+         }
+         break;
+
+      case 3:
+         pad2 = new TCanvas("AliEve 2D histograms - Single Event","AliEve 2D histograms - Single Event",1200,500);
+         pad2->Divide(3,1);
+         pad2->cd(1);
+         histPhiPt->Draw();
+         pad2->cd(2);
+         histPtY->Draw();
+         pad2->cd(3);
+         histEtaPhi->Draw();
+         break;
+
+      default:
+         break;
+   }
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawHistosAll()
+{
+
+   Int_t nHistos1 = 0;
+   Int_t nHistos2 = 0;
+
+   TCanvas* pad1 = 0;
+   TCanvas* pad2 = 0;
+
+   if(gDrawHistograms[6])
+   {
+         nHistos1++;
+         TH1D* histPt = new TH1D("Pt\nAll Events", "AliEve Pt histogram", 100, 0.0, 5.0);
+   }
+
+   if(gDrawHistograms[7])
+   {
+         nHistos1++;
+         TH1D* histEta = new TH1D("#eta\nAll Events", "AliEve #eta histogram", 100, -1.5, 1.5);
+   }
+
+   if(gDrawHistograms[8])
+   {
+         nHistos1++;
+         TH1D* histPhi = new TH1D("#phi\nAll Events", "AliEve #phi histogram", 100, 0.0, 2*TMath::Pi());
+   }
+
+   if(gDrawHistograms[9])
+   {
+         nHistos2++;
+         TH2D* histPhiPt = new TH2D("#phi-Pt\nAll Events", "AliEve #phi-Pt histogram", 100, 0.0, 2*TMath::Pi(), 100, 0.0, 5.0);
+   }
+
+   if(gDrawHistograms[10])
+   {
+         nHistos2++;
+         TH2D* histPtY = new TH2D("Pt-Y\nAll Events", "AliEve Pt-y histogram", 100, 0.0, 5.0, 100, -1.5, 1.5);
+   }
+
+   if(gDrawHistograms[11])
+   {
+         nHistos2++;
+         TH2D* histEtaPhi = new TH2D("#eta-#phi\nAll Events", "AliEve #eta-#phi histogram", 100, 1.5, 1.5, 100, 0.0, 2*TMath::Pi());
+   }
+
+   Int_t nEvents = AliEveEventManager::GetMaster()->GetMaxEventId();
+
+   AliEveEventManager::GetMaster()->GotoEvent(0);
+
+   for(Int_t i = 0; i <= nEvents; i++)
+   {
+
+   AliESDEvent* esd = AliEveEventManager::AssertESD();
+
+   if(esd->GetNumberOfTracks())
+   {
+
+      for(Int_t j = 0; j < esd->GetNumberOfTracks(); j++)
+      {
+
+         AliESDtrack* track = esd->GetTrack(j);
+
+         if(gDrawHistograms[6])
+            histPt->Fill(track->Pt());
+         if(gDrawHistograms[7])
+            histEta->Fill(track->Eta());
+         if(gDrawHistograms[8])
+            histPhi->Fill(track->Phi());
+         if(gDrawHistograms[9])
+            histPhiPt->Fill(track->Phi(),track->Pt());
+         if(gDrawHistograms[10])
+            histPtY->Fill(track->Pt(),track->Y());
+         if(gDrawHistograms[11])
+            histEtaPhi->Fill(track->Eta(),track->Phi());
+
+      }
+
+   }
+
+      AliEveEventManager::GetMaster()->NextEvent();
+
+   }
+
+   switch(nHistos1)
+   {
+      case 1:
+         pad1 = new TCanvas("AliEve 1D histograms - All Events","AliEve 1D histograms - All Events",800,600);
+         if(gDrawHistograms[6])
+            histPt->Draw();
+         if(gDrawHistograms[7])
+            histEta->Draw();
+         if(gDrawHistograms[8])
+            histPhi->Draw();
+         break;
+
+      case 2:
+         pad1 = new TCanvas("AliEve 1D histograms - All Events","AliEve 1D histograms - All Events",1200,500);
+         pad1->Divide(2,1);
+         if(!gDrawHistograms[6])
+         {
+            pad1->cd(1);
+            histEta->Draw();
+            pad1->cd(2);
+            histPhi->Draw();
+         }
+         if(!gDrawHistograms[7])
+         {
+            pad1->cd(1);
+            histPt->Draw();
+            pad1->cd(2);
+            histPhi->Draw();
+         }
+         if(!gDrawHistograms[8])
+         {
+            pad1->cd(1);
+            histPt->Draw();
+            pad1->cd(2);
+            histEta->Draw();
+         }
+         break;
+
+      case 3:
+         pad1 = new TCanvas("AliEve 1D histograms - All Events","AliEve 1D histograms - All Events",1200,500);
+         pad1->Divide(3,1);
+         pad1->cd(1);
+         histPt->Draw();
+         pad1->cd(2);
+         histEta->Draw();
+         pad1->cd(3);
+         histPhi->Draw();
+         break;
+
+      default:
+         break;
+   }
+
+   switch(nHistos2)
+   {
+      case 1:
+         pad2 = new TCanvas("AliEve 2D histograms - All Events","AliEve 2D histograms - All Events",800,600);
+         if(gDrawHistograms[9])
+            histPt->Draw();
+         if(gDrawHistograms[10])
+            histEta->Draw();
+         if(gDrawHistograms[11])
+            histPhi->Draw();
+         break;
+
+      case 2:
+         pad2 = new TCanvas("AliEve 2D histograms - All Events","AliEve 2D histograms - All Events",1200,500);
+         pad2->Divide(2,1);
+         if(!gDrawHistograms[9])
+         {
+            pad2->cd(1);
+            histPtY->Draw();
+            pad2->cd(2);
+            histEtaPhi->Draw();
+         }
+         if(!gDrawHistograms[10])
+         {
+            pad2->cd(1);
+            histPhiPt->Draw();
+            pad2->cd(2);
+            histEtaPhi->Draw();
+         }
+         if(!gDrawHistograms[11])
+         {
+            pad2->cd(1);
+            histPhiPt->Draw();
+            pad2->cd(2);
+            histPtY->Draw();
+         }
+         break;
+
+      case 3:
+         pad2 = new TCanvas("AliEve 2D histograms - All Events","AliEve 2D histograms - All Events",1200,500);
+         pad2->Divide(3,1);
+         pad2->cd(1);
+         histPhiPt->Draw();
+         pad2->cd(2);
+         histPtY->Draw();
+         pad2->cd(3);
+         histEtaPhi->Draw();
+         break;
+
+      default:
+         break;
+   }
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::DrawResiduals()
+{
+
+   TEveUtil::Macro("make_residuals.C");
+
+   return;
+
+}
+
+//______________________________________________________________________________
+
+Int_t SetCutsWindow::GetTrackColorByMomentum(Double_t momentum, Int_t size)
+{
+
+
+   Double_t step = 2.0/size;
+
+   for(Int_t i = 0; i < size; i++)
+   {
+
+      if(momentum > i*step && momentum <= (i+1)*step)
+      {
+//         cout << "tutaj " << i <<endl;
+         return i;
+      }
+
+   }
+
+//   cout << i <<endl;
+   return i;
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::SetStandardCuts()
+{
+
+   gDrawV0s->SetOn(kFALSE,kFALSE);
+   gDrawCascades->SetOn(kFALSE,kFALSE);
+   gDrawKinks->SetOn(kFALSE,kFALSE);
+   gDrawVertex->SetOn(kFALSE,kFALSE);
+   gDrawTracklets->SetOn(kFALSE,kFALSE);
+   gDrawTracks->SetOn(kTRUE,kFALSE);
+   gDrawClusters->SetOn(kFALSE,kFALSE);
+   gDrawTracksType1->SetOn(kTRUE,kFALSE);
+   gDrawTracksType2->SetOn(kTRUE,kFALSE);
+   gDrawTracksType3->SetOn(kTRUE,kFALSE);
+   gDrawTracksType4->SetOn(kFALSE,kFALSE);
+   gDrawTracksType5->SetOn(kFALSE,kFALSE);
+   gDrawTracksType6->SetOn(kFALSE,kFALSE);
+   gDrawTracksType7->SetOn(kFALSE,kFALSE);
+   gCutOnP->SetOn(kFALSE,kFALSE);
+   gCutOnPt->SetOn(kTRUE,kFALSE);
+   gCutOnEta->SetOn(kTRUE,kFALSE);
+   gCutOnMult->SetOn(kFALSE,kFALSE);
+   gCutOnCls->SetOn(kTRUE,kFALSE);
+   gPtRange->SetValues(0.15,gPtRange->GetLimitMax());
+   gEtaRange->SetValues(-0.9,0.9);
+   gClsRangeNE->SetNumber(70);
+   gClsRange->SetPosition(70);
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::AddMomentumVectors()
+{
+
+//   Bool_t drawWithTracks = kTRUE;
+
+   if(gEve->GetEventScene()->FirstChild()->FindChild("Momentum Vectors"))
+      gEve->GetEventScene()->FirstChild()->FindChild("Momentum Vectors")->Destroy();
+
+   TString str1 = 0;
+   TString str2 = 0;
+
+   TEveElement::List_i i = gEve->GetEventScene()->FirstChild()->BeginChildren();
+   TEveElement::List_i j = gEve->GetEventScene()->FirstChild()->EndChildren();
+   TEveElement::List_i k;
+
+   TEveElementList* momentumVectorList = new TEveElementList("Momentum Vectors");
+
+   Double_t maxMomentum = 0;
+   Double_t vectorLength = 600.0;
+
+   Double_t x1 = 0;
+   Double_t y1 = 0;
+   Double_t z1 = 0;
+
+   Double_t x2 = 0;
+   Double_t y2 = 0;
+   Double_t z2 = 0;
+
+   Bool_t draw = kFALSE;
+
+   Int_t mode = gVectorMode->GetSelected();
+   Double_t cut = 0.1*gPMVRange->GetPosition();
+
+   //==============================================
+   // find highest momentum (to normalize)
+   //==============================================
+
+   if(mode != 3)
+   {
+   for(k = i; k != j; k++)
+   {
+      TEveElement* element = (TEveElement*) *k;
+
+      str1 = element->GetElementName();
+
+      if(str1.Contains("Tracks") || str1.Contains("tracks"))
+      {
+
+         TEveElement::List_i m = element->BeginChildren();
+         TEveElement::List_i n = element->EndChildren();
+         TEveElement::List_i l;
+
+         for(l = m; l != n; l++)
+         {
+            TEveElement* trackType = (TEveElement*) *l;
+            str2 = trackType->GetElementName();
+
+            if(str2.Contains("Sigma < 3"))
+            {
+               if(trackType->HasChildren())
+               {
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     if(trackSingle1->GetESDTrack()->P() > maxMomentum)
+                       maxMomentum = trackSingle1->GetESDTrack()->P();
+
+                  }
+               }
+            }
+
+
+            if(str2.Contains("3 < Sigma < 5"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     if(trackSingle1->GetESDTrack()->P() > maxMomentum)
+                       maxMomentum = trackSingle1->GetESDTrack()->P();
+
+                  }
+               }
+            }
+
+            if(str2.Contains("5 < Sigma"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     if(trackSingle1->GetESDTrack()->P() > maxMomentum)
+                       maxMomentum = trackSingle1->GetESDTrack()->P();
+
+
+                  }
+               }
+            }
+         }
+      }
+   }
+   }
+   //==============================================
+   // clean the display
+   //==============================================
+/*
+   if(!drawWithTracks)
+
+      for(k = i; k != j; k++)
+      {
+         TEveElement* element = (TEveElement*) *k;
+
+         str1 = element->GetElementName();
+
+         element->SetRnrSelf(kFALSE);
+
+         if(element->HasChildren())
+            element->SetRnrChildren(kFALSE);
+
+      }
+
+   }
+*/
+   //==============================================
+   // draw momentum vectors
+   //==============================================
+
+   if(mode == 1 && maxMomentum > 1)
+      vectorLength = 100/TMath::Log(100*maxMomentum);
+   if(mode == 2 && maxMomentum)
+      vectorLength = vectorLength/maxMomentum;
+   if(mode == 3)
+      vectorLength = 100;
+
+   for(k = i; k != j; k++)
+   {
+      TEveElement* element = (TEveElement*) *k;
+
+      str1 = element->GetElementName();
+
+      if(str1.Contains("Tracks") || str1.Contains("tracks"))
+      {
+
+         TEveElement::List_i m = element->BeginChildren();
+         TEveElement::List_i n = element->EndChildren();
+         TEveElement::List_i l;
+
+         for(l = m; l != n; l++)
+         {
+            TEveElement* trackType = (TEveElement*) *l;
+            str2 = trackType->GetElementName();
+
+//            trackType->SetRnrSelf(kFALSE);
+
+//            if(trackType->HasChildren())
+//               trackType->SetRnrChildren(kFALSE);
+
+            if(str2.Contains("Sigma < 3"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElementList* momentumVectorList1 = new TEveElementList("sigma < 3");
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     TEveLine* momentumVector = new TEveLine(TString::Format("Momentum Vector"));
+
+                     if(trackSingle1->GetESDTrack()->P() > cut)
+                     {
+
+                        x1 = trackSingle1->GetESDTrack()->Xv();
+                        y1 = trackSingle1->GetESDTrack()->Yv();
+                        z1 = trackSingle1->GetESDTrack()->Zv();
+
+                        momentumVector->SetPoint(0, x1, y1, z1);
+
+                        if(mode == 1)
+                        {
+                           x2 = x1+vectorLength*TMath::Log(100*trackSingle1->GetESDTrack()->P())*trackSingle1->GetESDTrack()->Px();
+                           y2 = y1+vectorLength*TMath::Log(100*trackSingle1->GetESDTrack()->P())*trackSingle1->GetESDTrack()->Py();
+                           z2 = z1+vectorLength*TMath::Log(100*trackSingle1->GetESDTrack()->P())*trackSingle1->GetESDTrack()->Pz();
+                        }
+
+                        if(mode == 2)
+                        {
+                           x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                           y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                           z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+                        }
+
+                        if(mode == 3)
+                        {
+                           x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                           y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                           z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+                        }
+
+                        if((mode != 1 && mode!= 2 && mode != 3) ||
+                          ( mode == 3 && trackSingle1->GetESDTrack()->P() <= 0.01))
+                           continue;
+
+                        momentumVector->SetPoint(1, x2, y2, z2);
+
+/*
+                        if(trackSingle1->GetESDTrack()->Charge() == -1)
+                           momentumVector->SetLineColor(kGreen);
+                        else
+                           momentumVector->SetLineColor(kRed);
+*/
+                        momentumVector->SetLineColor(kRed);
+
+                        momentumVector->SetLineWidth(1);
+                        momentumVector->SetLineStyle(0);
+                        momentumVector->SetTitle(Form("%f GeV/c", trackSingle1->GetESDTrack()->P()));
+
+                        momentumVectorList1->AddElement(momentumVector);
+
+                     }
+
+                  }
+
+                  momentumVectorList->AddElement(momentumVectorList1);
+
+                  draw = kTRUE;
+
+               }
+            }
+
+
+            if(str2.Contains("3 < Sigma < 5"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  TEveElementList* momentumVectorList2 = new TEveElementList("3 < sigma < 5");
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     TEveLine* momentumVector = new TEveLine(TString::Format("Momentum Vector"));
+
+                     if(trackSingle1->GetESDTrack()->P() > cut)
+                     {
+
+                        x1 = trackSingle1->GetESDTrack()->Xv();
+                        y1 = trackSingle1->GetESDTrack()->Yv();
+                        z1 = trackSingle1->GetESDTrack()->Zv();
+
+                        momentumVector->SetPoint(0, x1, y1, z1);
+
+                        if(mode == 1)
+                        {
+                           x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px()*TMath::Log(trackSingle1->GetESDTrack()->P());
+                           y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py()*TMath::Log(trackSingle1->GetESDTrack()->P());
+                           z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz()*TMath::Log(trackSingle1->GetESDTrack()->P());
+                        }
+
+                        if(mode == 2)
+                        {
+                           x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                           y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                           z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+                        }
+
+                        if(mode == 3)
+                        {
+                           x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                           y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                           z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+                        }
+
+                        if(mode != 1 && mode!= 2 && mode != 3)
+                           continue;
+
+                        momentumVector->SetPoint(1, x2, y2, z2);
+
+/*
+                        if(trackSingle1->GetESDTrack()->Charge() == -1)
+                           momentumVector->SetLineColor(kGreen+2);
+                        else
+                           momentumVector->SetLineColor(kRed+2);
+*/
+                        momentumVector->SetLineColor(kRed+2);
+
+                        momentumVector->SetLineWidth(1);
+                        momentumVector->SetLineStyle(0);
+                        momentumVector->SetTitle(Form("%f GeV/c", trackSingle1->GetESDTrack()->P()));
+
+                        momentumVectorList2->AddElement(momentumVector);
+
+                     }
+
+                  }
+
+//                  gEve->AddElement(momentumVectorList2);
+                  momentumVectorList->AddElement(momentumVectorList2);
+
+                  draw = kTRUE;
+
+               }
+            }
+
+            if(str2.Contains("5 < Sigma"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElementList* momentumVectorList3 = new TEveElementList("5 < sigma");
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     TEveLine* momentumVector = new TEveLine(TString::Format("Momentum Vector"));
+
+                     if(trackSingle1->GetESDTrack()->P() > cut)
+                     {
+
+                        x1 = trackSingle1->GetESDTrack()->Xv();
+                        y1 = trackSingle1->GetESDTrack()->Yv();
+                        z1 = trackSingle1->GetESDTrack()->Zv();
+
+                        momentumVector->SetPoint(0, x1, y1, z1);
+
+                        if(mode == 1)
+                        {
+                           x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px()*TMath::Log(trackSingle1->GetESDTrack()->P());
+                           y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py()*TMath::Log(trackSingle1->GetESDTrack()->P());
+                           z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz()*TMath::Log(trackSingle1->GetESDTrack()->P());
+                        }
+
+                        if(mode == 2)
+                        {
+                           x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                           y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                           z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+                        }
+
+                        if(mode == 3)
+                        {
+                           x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                           y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                           z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+                        }
+
+                        if(mode != 1 && mode!= 2 && mode != 3)
+                           continue;
+
+                        momentumVector->SetPoint(1, x2, y2, z2);
+/*
+                        if(trackSingle1->GetESDTrack()->Charge() == -1)
+                           momentumVector->SetLineColor(kGreen+3);
+                        else
+                           momentumVector->SetLineColor(kRed+3);
+*/
+                        momentumVector->SetLineColor(kRed+3);
+
+                        momentumVector->SetLineWidth(1);
+                        momentumVector->SetLineStyle(0);
+                        momentumVector->SetTitle(Form("%f GeV/c", trackSingle1->GetESDTrack()->P()));
+
+                        momentumVectorList3->AddElement(momentumVector);
+
+                     }
+
+                  }
+
+                  //gEve->AddElement(momentumVectorList3);
+                  momentumVectorList->AddElement(momentumVectorList3);
+
+                  draw = kTRUE;
+
+               }
+            }
+         }
+      }
+   }
+  gEve->AddElement(momentumVectorList);
+
+  TEveElement* top = gEve->GetCurrentEvent();
+
+  AliEveMultiView *mv = AliEveMultiView::Instance();
+
+  mv->DestroyEventRPhi();
+  mv->DestroyEventRhoZ();
+
+  mv->ImportEventRPhi(top);
+  mv->ImportEventRhoZ(top);
+
+  gEve->FullRedraw3D(kFALSE, kTRUE);
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::SetCuts()
+{
+
+   TString str1 = 0;
+   TString str2 = 0;
+
+   Int_t posTrackColor= gPosColorList->GetSelected();
+   Int_t negTrackColor= gNegColorList->GetSelected();
+
+   TEveElement::List_i i = gEve->GetEventScene()->FirstChild()->BeginChildren();
+   TEveElement::List_i j = gEve->GetEventScene()->FirstChild()->EndChildren();
+   TEveElement::List_i k;
+
+   Double_t x1, y1, z1, x2, y2, z2;
+
+   for(k = i; k != j; k++)
+   {
+      TEveElement* element = (TEveElement*) *k;
+
+      str1 = element->GetElementName();
+
+      if(gDrawV0s->IsOn())
+      {
+         if(str1.Contains("ESD v0") || str1.Contains("ESD V0"))
+         {
+            element->SetRnrSelf(kTRUE);
+
+            if(element->HasChildren())
+               element->SetRnrChildren(kTRUE);
+
+            continue;
+         }
+      }
+
+      if(gDrawCascades->IsOn())
+      {
+         if(str1.Contains("ESD cascade") || str1.Contains("ESD Cascade"))
+         {
+            element->SetRnrSelf(kTRUE);
+
+            if(element->HasChildren())
+               element->SetRnrChildren(kTRUE);
+
+            continue;
+         }
+      }
+
+      if(gDrawKinks->IsOn())
+      {
+         if(str1.Contains("ESD kink") || str1.Contains("ESD Kink"))
+         {
+            element->SetRnrSelf(kTRUE);
+
+            if(element->HasChildren())
+               element->SetRnrChildren(kTRUE);
+
+            continue;
+         }
+      }
+
+      if(gDrawVertex->IsOn())
+      {
+         if(str1.Contains("Primary Vertex") || str1.Contains("primary Vertex") || str1.Contains("Primary vertex") || str1.Contains("primary vertex"))
+         {
+            element->SetRnrSelf(kTRUE);
+
+            if(element->HasChildren())
+               element->SetRnrChildren(kTRUE);
+
+            continue;
+         }
+      }
+
+      if(gDrawTracklets->IsOn())
+      {
+         if(str1.Contains("Tracklets") || str1.Contains("tracklets"))
+         {
+            element->SetRnrSelf(kTRUE);
+
+            if(element->HasChildren())
+               element->SetRnrChildren(kTRUE);
+
+            continue;
+         }
+      }
+
+      if(gDrawTracks->IsOn())
+      {
+
+//         Int_t colorPos[10] = {kRed, kBlue, kOrange, kCyan, kGreen, kGray, kViolet, kMagenta, kSpring, kYellow};
+
+Int_t colorNeg[10] = 
+{
+kCyan-4,
+kCyan,
+kAzure+10,
+kAzure+8,
+kAzure+5,
+kAzure,
+kBlue,
+kBlue+1,
+kBlue+2,
+kBlue+3
+};
+
+Int_t colorPos[10] = 
+{
+kYellow-4,
+kYellow,
+kOrange+10,
+kOrange,
+kOrange+7,
+kOrange+10,
+kRed,
+kRed+1,
+kRed+2,
+kRed+3
+};
+
+Int_t colorAll[22] = 
+{
+kBlue+4,
+kBlue+2,
+kBlue,
+kAzure,
+kAzure-3,
+kAzure+7,
+kCyan,
+kCyan-7,
+kGreen-7,
+kGreen-4,
+kGreen,
+kSpring,
+kSpring+7,
+kSpring+8,
+kYellow,
+kOrange,
+kOrange-3,
+kOrange+7,
+kOrange+4,
+kRed,
+kRed+2,
+kMagenta
+};
+
+         if(str1.Contains("Tracks") || str1.Contains("tracks"))
+         {
+            element->SetRnrSelf(kTRUE);
+
+            if(element->HasChildren())
+               element->SetRnrChildren(kTRUE);
+
+            TEveElement::List_i m = element->BeginChildren();
+            TEveElement::List_i n = element->EndChildren();
+            TEveElement::List_i l;
+
+            for(l = m; l != n; l++)
+            {
+               TEveElement* trackType = (TEveElement*) *l;
+               str2 = trackType->GetElementName();
+
+               trackType->SetRnrSelf(kFALSE);
+
+               (dynamic_cast<TEveTrackList*>trackType)->GetPropagator()->SetMaxR(250);
+
+               if(trackType->HasChildren())
+                  trackType->SetRnrChildren(kFALSE);
+
+               if(gDrawTracksType1->IsOn() && str2.Contains("Sigma < 3"))
+               {
+                  trackType->SetRnrSelf(kTRUE);
+
+                  if(trackType->HasChildren())
+                  {
+
+                     trackType->SetRnrChildren(kTRUE);
+                     TEveElement::List_i x = trackType->BeginChildren();
+                     TEveElement::List_i y = trackType->EndChildren();
+                     TEveElement::List_i z;
+
+                     for(z = x; z != y; z++)
+                     {
+
+                        AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                        if(trackSingle1->GetESDTrack()->GetSign() > 0)
+                        {
+                           if(posTrackColor == 1)
+                              trackSingle1->SetLineColor(colorNeg[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(posTrackColor == 2)
+                              trackSingle1->SetLineColor(colorPos[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(posTrackColor == 3)
+                              trackSingle1->SetLineColor(colorAll[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),22)]);
+                        }
+                        else
+                        {
+                           if(negTrackColor == 1)
+                              trackSingle1->SetLineColor(colorNeg[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(negTrackColor == 2)
+                              trackSingle1->SetLineColor(colorPos[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(negTrackColor == 3)
+                              trackSingle1->SetLineColor(colorAll[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),22)]);
+                        }
+
+                        trackSingle1->SetLineStyle(1);
+                        trackSingle1->SetRnrSelf(kTRUE);
+
+
+                     }
+
+                  }
+
+               }
+
+
+               if(gDrawTracksType2->IsOn() && str2.Contains("3 < Sigma < 5"))
+               {
+                  trackType->SetRnrSelf(kTRUE);
+
+                  if(trackType->HasChildren())
+                  {
+                     trackType->SetRnrChildren(kTRUE);
+                     TEveElement::List_i x = trackType->BeginChildren();
+                     TEveElement::List_i y = trackType->EndChildren();
+                     TEveElement::List_i z;
+
+                     for(z = x; z != y; z++)
+                     {
+
+                        AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                        if(trackSingle1->GetESDTrack()->GetSign() > 0)
+                        {
+                           if(posTrackColor == 1)
+                              trackSingle1->SetLineColor(colorNeg[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(posTrackColor == 2)
+                              trackSingle1->SetLineColor(colorPos[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(posTrackColor == 3)
+                              trackSingle1->SetLineColor(colorAll[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),22)]);
+                        }
+                        else
+                        {
+                           if(negTrackColor == 1)
+                              trackSingle1->SetLineColor(colorNeg[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(negTrackColor == 2)
+                              trackSingle1->SetLineColor(colorPos[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(negTrackColor == 3)
+                              trackSingle1->SetLineColor(colorAll[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),22)]);
+                        }
+
+                        trackSingle1->SetLineStyle(1);
+                        trackSingle1->SetRnrSelf(kTRUE);
+
+                     }
+                  }
+               }
+
+               if(gDrawTracksType3->IsOn() && str2.Contains("5 < Sigma"))
+               {
+                  trackType->SetRnrSelf(kTRUE);
+
+                  if(trackType->HasChildren())
+                  {
+
+                     trackType->SetRnrChildren(kTRUE);
+                     TEveElement::List_i x = trackType->BeginChildren();
+                     TEveElement::List_i y = trackType->EndChildren();
+                     TEveElement::List_i z;
+
+                     for(z = x; z != y; z++)
+                     {
+
+                        AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                        if(trackSingle1->GetESDTrack()->GetSign() > 0)
+                        {
+                           if(posTrackColor == 1)
+                              trackSingle1->SetLineColor(colorNeg[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(posTrackColor == 2)
+                              trackSingle1->SetLineColor(colorPos[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(posTrackColor == 3)
+                              trackSingle1->SetLineColor(colorAll[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),22)]);
+                        }
+                        else
+                        {
+                           if(negTrackColor == 1)
+                              trackSingle1->SetLineColor(colorNeg[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(negTrackColor == 2)
+                              trackSingle1->SetLineColor(colorPos[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),10)]);
+                           if(negTrackColor == 3)
+                              trackSingle1->SetLineColor(colorAll[GetTrackColorByMomentum(trackSingle1->GetESDTrack()->Pt(),22)]);
+                        }
+
+                        trackSingle1->SetLineStyle(1);
+                        trackSingle1->SetRnrSelf(kTRUE);
+
+                     }
+                  }
+               }
+
+               if(gDrawTracksType4->IsOn() && str2.Contains("no ITS refit"))
+               {
+                  trackType->SetRnrSelf(kTRUE);
+
+                  if(trackType->HasChildren())
+                  {
+
+                     trackType->SetRnrChildren(kTRUE);
+                     TEveElement::List_i x = trackType->BeginChildren();
+                     TEveElement::List_i y = trackType->EndChildren();
+                     TEveElement::List_i z;
+
+                     for(z = x; z != y; z++)
+                     {
+                        TEveElement* trackSingle = (TEveElement*) *z;
+                        trackSingle->SetRnrSelf(kTRUE);
+                     }
+                  }
+               }
+
+               if(gDrawTracksType5->IsOn() && str2.Contains("no TPC refit"))
+               {
+                  trackType->SetRnrSelf(kTRUE);
+
+                  if(trackType->HasChildren())
+                  {
+
+                     trackType->SetRnrChildren(kTRUE);
+                     TEveElement::List_i x = trackType->BeginChildren();
+                     TEveElement::List_i y = trackType->EndChildren();
+                     TEveElement::List_i z;
+
+                     for(z = x; z != y; z++)
+                     {
+                        TEveElement* trackSingle = (TEveElement*) *z;
+                        trackSingle->SetRnrSelf(kTRUE);
+                     }
+                  }
+               }
+
+               if(gDrawTracksType6->IsOn() && str2.Contains("ITS ncl>=3"))
+               {
+                  trackType->SetRnrSelf(kTRUE);
+
+                  if(trackType->HasChildren())
+                  {
+
+                     trackType->SetRnrChildren(kTRUE);
+                     TEveElement::List_i x = trackType->BeginChildren();
+                     TEveElement::List_i y = trackType->EndChildren();
+                     TEveElement::List_i z;
+
+                     for(z = x; z != y; z++)
+                     {
+                        TEveElement* trackSingle = (TEveElement*) *z;
+                        trackSingle->SetRnrSelf(kTRUE);
+                     }
+                  }
+               }
+
+               if(gDrawTracksType7->IsOn() && str2.Contains("ITS others"))
+               {
+                  trackType->SetRnrSelf(kTRUE);
+
+                  if(trackType->HasChildren())
+                  {
+
+                     trackType->SetRnrChildren(kTRUE);
+                     TEveElement::List_i x = trackType->BeginChildren();
+                     TEveElement::List_i y = trackType->EndChildren();
+                     TEveElement::List_i z;
+
+                     for(z = x; z != y; z++)
+                     {
+                        TEveElement* trackSingle = (TEveElement*) *z;
+                        trackSingle->SetRnrSelf(kTRUE);
+                     }
+                  }
+               }
+
+            }
+            
+            continue;
+         }
+
+      }
+
+      if(gDrawClusters->IsOn())
+      {
+
+         TEvePointSetArray * cc = 0;
+         TEvePointSet* clusters = 0;
+
+         if((str1.Contains("Clusters") && !str1.Contains("TPC")) || str1.Contains("Colorized"))
+         {
+
+            if(!gCutOnEta->IsOn())
+            {            
+               element->SetRnrSelf(kTRUE);
+               element->SetRnrChildren(kTRUE);
+
+                  if(gEve->GetEventScene()->FirstChild()->FindChild("ITS ClCut"))
+                     gEve->GetEventScene()->FirstChild()->FindChild("ITS ClCut")->Destroy();
+
+               continue;
+            }
+            else
+            {            
+               element->SetRnrSelf(kFALSE);
+               element->SetRnrChildren(kFALSE);
+
+               if(str1.Contains("ITS"))
+               {
+
+                  clusters = dynamic_cast<TEvePointSet*>(element);
+
+                  if(gEve->GetEventScene()->FirstChild()->FindChild("ITS ClCut"))
+                     gEve->GetEventScene()->FirstChild()->FindChild("ITS ClCut")->Destroy();
+
+                  pointset = new TEvePointSet(clusters->GetLastPoint());
+                  pointset->SetMarkerStyle(4);
+                  pointset->SetMarkerColor(kBlue);
+                  pointset->SetMarkerSize(0.4);
+                  pointset->SetName("ITS ClCut");
+
+                  for(Int_t iCluster = 0; iCluster < clusters->GetLastPoint(); iCluster++)
+                  {
+
+                     clusters->GetPoint(iCluster, x1, y1, z1);
+
+                     if(TMath::Sqrt(x1*x1 + y1*y1 + z1*z1) != 0 && z1 != 0)
+                     {
+                        Double_t eta = -TMath::Log(TMath::Tan(0.5*TMath::ACos(z1/TMath::Sqrt(x1*x1 + y1*y1 + z1*z1))));
+
+                        if(eta > gEtaRange->GetMin() && eta < gEtaRange->GetMax())
+                        {
+                           pointset->SetNextPoint(x1, y1, z1);
+                        }
+                     }
+                  }
+
+                  pointset->SetRnrSelf(kTRUE);
+                  pointset->SetRnrChildren(kTRUE);
+
+                  gEve->AddElement(pointset);
+
+               }
+
+               if(str1.Contains("TPC"))
+               {
+
+                  cc = new TEvePointSetArray("TPC ClCut");
+                  cc->SetMainColor(kRed);
+                  cc->SetMarkerStyle(4);
+                  cc->SetMarkerSize(0.4);
+                  cc->InitBins("Cluster Charge",
+                               (dynamic_cast<TEvePointSetArray*>(element))->GetNBins()-2,
+                               (dynamic_cast<TEvePointSetArray*>(element))->GetMin(),
+                               (dynamic_cast<TEvePointSetArray*>(element))->GetMax());
+  
+                  cc->GetBin(0)->SetMainColor(kGray);
+                  cc->GetBin(0)->SetMarkerSize(0.4);
+                  cc->GetBin(1)->SetMainColor(kBlue);
+                  cc->GetBin(1)->SetMarkerSize(0.42);
+                  cc->GetBin(2)->SetMainColor(kCyan);
+                  cc->GetBin(2)->SetMarkerSize(0.44);
+                  cc->GetBin(3)->SetMainColor(kGreen);
+                  cc->GetBin(3)->SetMarkerSize(0.46);
+                  cc->GetBin(4)->SetMainColor(kYellow);
+                  cc->GetBin(4)->SetMarkerSize(0.48);
+                  cc->GetBin(5)->SetMainColor(kRed);
+                  cc->GetBin(5)->SetMarkerSize(0.50);
+                  cc->GetBin(6)->SetMainColor(kMagenta);
+                  cc->GetBin(6)->SetMarkerSize(0.52);
+
+                  Double_t range = (cc->GetMax()) - (cc->GetMin());
+
+                  if(gEve->GetEventScene()->FirstChild()->FindChild("TPC ClCut"))
+                     gEve->GetEventScene()->FirstChild()->FindChild("TPC ClCut")->Destroy();
+
+                  for(Int_t iBin = 0; iBin < cc->GetNBins(); iBin++)
+                  {
+
+                     clusters =(dynamic_cast<TEvePointSetArray*>(element))->GetBin(iBin);
+
+                     for(Int_t iCluster = 0; iCluster < clusters->GetLastPoint(); iCluster++)
+                     {
+
+                        clusters->GetPoint(iCluster, x1, y1, z1);
+
+                        if(TMath::Sqrt(x1*x1 + y1*y1 + z1*z1) != 0 && z1 != 0)
+                        {
+                           Double_t eta = -TMath::Log(TMath::Tan(0.5*TMath::ACos(z1/TMath::Sqrt(x1*x1 + y1*y1 + z1*z1))));
+
+                           if(eta > gEtaRange->GetMin() && eta < gEtaRange->GetMax())
+                           {
+                              cc->Fill(x1, y1, z1,(range/(cc->GetNBins())*iBin)-1);
+                           }
+                        }
+                     }
+
+                  }
+
+                  cc->SetRnrSelf(kTRUE);
+                  cc->SetRnrChildren(kTRUE);
+
+                  gEve->AddElement(cc);
+
+               }
+
+               if(str1.Contains("TRD"))
+               {
+
+                  clusters = dynamic_cast<TEvePointSet*>(element);
+
+                  if(gEve->GetEventScene()->FirstChild()->FindChild("TRD ClCut"))
+                     gEve->GetEventScene()->FirstChild()->FindChild("TRD ClCut")->Destroy();
+
+                  pointset = new TEvePointSet(clusters->GetLastPoint());
+                  pointset->SetMarkerStyle(4);
+                  pointset->SetMarkerColor(kCyan);
+                  pointset->SetMarkerSize(0.4);
+                  pointset->SetName("TRD ClCut");
+
+                  for(Int_t iCluster = 0; iCluster < clusters->GetLastPoint(); iCluster++)
+                  {
+
+                     clusters->GetPoint(iCluster, x1, y1, z1);
+
+                     if(TMath::Sqrt(x1*x1 + y1*y1 + z1*z1) != 0 && z1 != 0)
+                     {
+                        Double_t eta = -TMath::Log(TMath::Tan(0.5*TMath::ACos(z1/TMath::Sqrt(x1*x1 + y1*y1 + z1*z1))));
+
+                        if(eta > gEtaRange->GetMin() && eta < gEtaRange->GetMax())
+                        {
+                           pointset->SetNextPoint(x1, y1, z1);
+                        }
+                     }
+                  }
+
+                  pointset->SetRnrSelf(kTRUE);
+                  pointset->SetRnrChildren(kTRUE);
+
+                  gEve->AddElement(pointset);
+
+                  }
+
+                  if(str1.Contains("TOF"))
+                  {
+
+                     clusters = dynamic_cast<TEvePointSet*>(element);
+
+                     if(gEve->GetEventScene()->FirstChild()->FindChild("TOF ClCut"))
+                        gEve->GetEventScene()->FirstChild()->FindChild("TOF ClCut")->Destroy();
+
+                     pointset = new TEvePointSet(clusters->GetLastPoint());
+                     pointset->SetMarkerStyle(4);
+                     pointset->SetMarkerColor(kOrange+9);
+                     pointset->SetMarkerSize(0.4);
+                     pointset->SetName("TOF ClCut");
+
+                     for(Int_t iCluster = 0; iCluster < clusters->GetLastPoint(); iCluster++)
+                     {
+
+                        clusters->GetPoint(iCluster, x1, y1, z1);
+
+                        if(TMath::Sqrt(x1*x1 + y1*y1 + z1*z1) != 0 && z1 != 0)
+                        {
+                           Double_t eta = -TMath::Log(TMath::Tan(0.5*TMath::ACos(z1/TMath::Sqrt(x1*x1 + y1*y1 + z1*z1))));
+
+                           if(eta > gEtaRange->GetMin() && eta < gEtaRange->GetMax())
+                           {
+                              pointset->SetNextPoint(x1, y1, z1);
+                           }
+                        }
+                     }
+
+                     pointset->SetRnrSelf(kTRUE);
+                     pointset->SetRnrChildren(kTRUE);
+
+                     gEve->AddElement(pointset);
+
+                  }
+
+               continue;
+
+            }
+
+         }
+/*
+         if(str1.Contains("Colorized"))
+         {
+
+           cout << "\n\n\n" << (dynamic_cast<TEvePointSetArray*>(element))->GetNBins() << "\n\n\n" << endl;
+
+            if(!gCutOnEta->IsOn())
+            {            
+               element->SetRnrSelf(kTRUE);
+               element->SetRnrChildren(kTRUE);
+            }
+            else
+            {            
+               element->SetRnrSelf(kFALSE);
+               element->SetRnrChildren(kFALSE);
+            }
+
+            continue;
+
+         }
+*/
+      }
+/*
+      if(str1.Contains("TPC") && str1.Contains("Clusters") && !str1.Contains("Colorized"))
+      {
+
+         element->SetRnrChildren(kFALSE);
+         element->SetRnrSelf(kFALSE);
+
+         if(gEve->GetEventScene()->FirstChild()->FindChild("TPC ClCut"))
+            gEve->GetEventScene()->FirstChild()->FindChild("TPC ClCut")->Destroy();
+
+         if(gCutOnEta->IsOn())
+         {
+            clusters = dynamic_cast<TEvePointSet*>(element);
+
+            pointset = new TEvePointSet(clusters->GetLastPoint());
+            pointset->SetMarkerStyle(4);
+            pointset->SetMarkerColor(kBlue);
+            pointset->SetMarkerSize(0.4);
+            pointset->SetName("TPC ClCut");
+
+            for(Int_t iCluster = 0; iCluster < clusters->GetLastPoint(); iCluster++)
+            {
+
+               clusters->GetPoint(iCluster, x1, y1, z1);
+
+               if(TMath::Sqrt(x1*x1 + y1*y1 + z1*z1) != 0 && z1 != 0)
+               {
+                  Double_t eta = -TMath::Log(TMath::Tan(0.5*TMath::ACos(z1/TMath::Sqrt(x1*x1 + y1*y1 + z1*z1))));
+
+                  if(eta > gEtaRange->GetMin() && eta < gEtaRange->GetMax())
+                  {
+                     pointset->SetNextPoint(x1, y1, z1);
+                  }
+               }
+            }
+
+            pointset->SetRnrSelf(kTRUE);
+            pointset->SetRnrChildren(kTRUE);
+
+            gEve->AddElement(pointset);
+
+         }
+
+         continue;
+
+      }
+*/
+      if(!str1.Contains("ClCut"))
+      {
+         element->SetRnrChildren(kFALSE);
+         element->SetRnrSelf(kFALSE);
+      }
+
+   }
+
+   if(gDrawTracks->IsOn() || gDrawV0s->IsOn() || gDrawCascades->IsOn() || gDrawKinks->IsOn())
+   {
+
+      i = gEve->GetEventScene()->FirstChild()->FindChild("ESD Tracks by category")->BeginChildren();
+      j = gEve->GetEventScene()->FirstChild()->FindChild("ESD Tracks by category")->EndChildren();
+
+      for(k = i; k != j; k++)
+      {
+
+         TEveElement* trackList = (TEveElement*) *k;
+
+         TEveElement::List_i m = trackList->BeginChildren();
+         TEveElement::List_i n = trackList->EndChildren();
+         TEveElement::List_i l;
+
+         for(l = m; l != n; l++)
+         {
+
+            AliEveTrack *track = dynamic_cast<AliEveTrack*>((TEveElement*) *l);
+
+            if(gCutOnMult->IsOn())
+            {
+
+               Double_t draw = gRandom->Rndm();
+
+               if(draw > (gMultRangeNE->GetNumber())/100)
+               {
+
+                  track->SetRnrSelf(kFALSE);
+                  continue;
+
+               }
+            }
+
+            if(gCutOnCls->IsOn())
+            {
+
+               if(track->GetESDTrack()->GetTPCNcls() < gClsRangeNE->GetNumber())
+               {
+                     track->SetRnrSelf(kFALSE);
+                     continue;
+               }
+
+            }
+
+            if(gCutOnP->IsOn())
+            {
+
+               if(gPRange->GetMax() == gPRange->GetLimitMax())
+               {
+
+                  if(track->GetESDTrack()->P() < gPRange->GetMin())
+                  {
+                     track->SetRnrSelf(kFALSE);
+                     continue;
+                  }
+
+               }
+
+               else
+               {
+                  if(track->GetESDTrack()->P() < gPRange->GetMin() || track->GetESDTrack()->P() > gPRange->GetMax())
+                  {
+                     track->SetRnrSelf(kFALSE);
+                     continue;
+                  }
+
+               }
+
+            }
+
+            if(gCutOnPt->IsOn())
+            {
+
+               if(gPtRange->GetMax() == gPtRange->GetLimitMax())
+               {
+
+                  if(track->GetESDTrack()->Pt() < gPtRange->GetMin())
+                  {
+                     track->SetRnrSelf(kFALSE);
+                     continue;
+                  }
+
+               }
+
+               else
+               {
+                  if(track->GetESDTrack()->Pt() < gPtRange->GetMin() || track->GetESDTrack()->Pt() > gPtRange->GetMax())
+                  {
+                     track->SetRnrSelf(kFALSE);
+                     continue;
+                  }
+
+               }
+
+            }
+
+            if(gCutOnEta->IsOn())
+            {
+
+               if(gEtaRange->GetMax() == gEtaRange->GetLimitMax() && gEtaRange->GetMin() == gEtaRange->GetLimitMin())
+                  continue;
+
+               if(gEtaRange->GetMax() == gEtaRange->GetLimitMax())
+               {
+
+                  if(track->GetESDTrack()->Eta() < gEtaRange->GetMin())
+                  {
+                     track->SetRnrSelf(kFALSE);
+                     continue;
+                  }
+
+               }
+
+               if(gEtaRange->GetMin() == gEtaRange->GetLimitMin())
+               {
+
+                  if(track->GetESDTrack()->Eta() > gEtaRange->GetMax())
+                  {
+                     track->SetRnrSelf(kFALSE);
+                     continue;
+                  }
+
+               }
+
+               if(track->GetESDTrack()->Eta() < gEtaRange->GetMin() || track->GetESDTrack()->Eta() > gEtaRange->GetMax())
+               {
+                  track->SetRnrSelf(kFALSE);
+                  continue;
+               }
+
+            }
+
+         }   
+
+      }
+
+/*
+      i = gEve->GetEventScene()->FirstChild()->FindChild("ESD v0")->BeginChildren();
+      j = gEve->GetEventScene()->FirstChild()->FindChild("ESD v0")->EndChildren();
+
+      for(k = i; k != j; k++)
+      {
+
+         AliEveV0 *v0 = dynamic_cast<AliEveV0*>((TEveElement*) *k);
+            
+         if(gCutOnP->IsOn())
+         {
+
+            if(gPRange->GetMax() == gPRange->GetLimitMax())
+            {
+
+               if(v0->GetP() < gPRange->GetMin())
+               {
+                  v0->SetRnrSelf(kFALSE);
+                  v0->SetRnrChildren(kFALSE);
+                  v0->GetPosTrack()->SetRnrSelf(kFALSE);
+                  v0->GetNegTrack()->SetRnrSelf(kFALSE);
+                  v0->GetPointingLine()->SetRnrSelf(kFALSE);
+                  v0->GetPosTrack()->SetRnrChildren(kFALSE);
+                  v0->GetNegTrack()->SetRnrChildren(kFALSE);
+                  v0->GetPointingLine()->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            else
+            {
+               if(v0->GetP() < gPRange->GetMin() || v0->GetP() > gPRange->GetMax())
+               {
+                  v0->SetRnrSelf(kFALSE);
+                  v0->SetRnrChildren(kFALSE);
+                  v0->GetPosTrack()->SetRnrSelf(kFALSE);
+                  v0->GetNegTrack()->SetRnrSelf(kFALSE);
+                  v0->GetPointingLine()->SetRnrSelf(kFALSE);
+                  v0->GetPosTrack()->SetRnrChildren(kFALSE);
+                  v0->GetNegTrack()->SetRnrChildren(kFALSE);
+                  v0->GetPointingLine()->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+         }
+
+         if(gCutOnPt->IsOn())
+         {
+
+            if(gPtRange->GetMax() == gPtRange->GetLimitMax())
+            {
+
+               if(v0->GetPt() < gPtRange->GetMin())
+               {
+                  v0->SetRnrSelf(kFALSE);
+                  v0->SetRnrChildren(kFALSE);
+                  v0->GetPosTrack()->SetRnrSelf(kFALSE);
+                  v0->GetNegTrack()->SetRnrSelf(kFALSE);
+                  v0->GetPointingLine()->SetRnrSelf(kFALSE);
+                  v0->GetPosTrack()->SetRnrChildren(kFALSE);
+                  v0->GetNegTrack()->SetRnrChildren(kFALSE);
+                  v0->GetPointingLine()->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            else
+            {
+               if(v0->GetPt() < gPtRange->GetMin() || v0->GetPt() > gPtRange->GetMax())
+               {
+                  v0->SetRnrSelf(kFALSE);
+                  v0->SetRnrChildren(kFALSE);
+                  v0->GetPosTrack()->SetRnrSelf(kFALSE);
+                  v0->GetNegTrack()->SetRnrSelf(kFALSE);
+                  v0->GetPointingLine()->SetRnrSelf(kFALSE);
+                  v0->GetPosTrack()->SetRnrChildren(kFALSE);
+                  v0->GetNegTrack()->SetRnrChildren(kFALSE);
+                  v0->GetPointingLine()->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+         }
+
+         if(gCutOnEta->IsOn())
+         {
+
+            if(gEtaRange->GetMax() == gEtaRange->GetLimitMax() && gEtaRange->GetMax() == gEtaRange->GetLimitMax())
+               continue;
+
+            if(gEtaRange->GetMax() == gEtaRange->GetLimitMax())
+            {
+               if(v0->GetEta() < gEtaRange->GetMin())
+               {
+                  v0->SetRnrSelf(kFALSE);
+                  v0->SetRnrChildren(kFALSE);
+                  v0->GetPosTrack()->SetRnrSelf(kFALSE);
+                  v0->GetNegTrack()->SetRnrSelf(kFALSE);
+                  v0->GetPointingLine()->SetRnrSelf(kFALSE);
+                  v0->GetPosTrack()->SetRnrChildren(kFALSE);
+                  v0->GetNegTrack()->SetRnrChildren(kFALSE);
+                  v0->GetPointingLine()->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            if(gEtaRange->GetMin() == gEtaRange->GetLimitMin())
+            {
+
+               if(v0->GetEta() > gEtaRange->GetMax())
+               {
+                  v0->SetRnrSelf(kFALSE);
+                  v0->SetRnrChildren(kFALSE);
+                  v0->GetPosTrack()->SetRnrSelf(kFALSE);
+                  v0->GetNegTrack()->SetRnrSelf(kFALSE);
+                  v0->GetPointingLine()->SetRnrSelf(kFALSE);
+                  v0->GetPosTrack()->SetRnrChildren(kFALSE);
+                  v0->GetNegTrack()->SetRnrChildren(kFALSE);
+                  v0->GetPointingLine()->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            if(v0->GetEta() < gEtaRange->GetMin() || v0->GetEta() > gEtaRange->GetMax())
+            {
+               v0->SetRnrSelf(kFALSE);
+               v0->SetRnrChildren(kFALSE);
+               v0->GetPosTrack()->SetRnrSelf(kFALSE);
+               v0->GetNegTrack()->SetRnrSelf(kFALSE);
+               v0->GetPointingLine()->SetRnrSelf(kFALSE);
+               v0->GetPosTrack()->SetRnrChildren(kFALSE);
+               v0->GetNegTrack()->SetRnrChildren(kFALSE);
+               v0->GetPointingLine()->SetRnrChildren(kFALSE);
+
+               continue;
+            }
+
+         }
+
+         v0->SetRnrSelf(kTRUE);
+         v0->SetRnrChildren(kTRUE);
+               v0->GetPosTrack()->SetRnrSelf(kTRUE);
+               v0->GetNegTrack()->SetRnrSelf(kTRUE);
+               v0->GetPointingLine()->SetRnrSelf(kTRUE);
+               v0->GetPosTrack()->SetRnrChildren(kTRUE);
+               v0->GetNegTrack()->SetRnrChildren(kTRUE);
+               v0->GetPointingLine()->SetRnrChildren(kTRUE);
+
+      }
+
+cout << "doszlo v0s" << endl;
+
+      i = gEve->GetEventScene()->FirstChild()->FindChild("ESD cascade")->BeginChildren();
+      j = gEve->GetEventScene()->FirstChild()->FindChild("ESD cascade")->EndChildren();
+
+      for(k = i; k != j; k++)
+      {
+
+         AliEveCascade *cascade = dynamic_cast<AliEveCascade*>((TEveElement*) *k);
+            
+         if(gCutOnP->IsOn())
+         {
+
+            if(gPRange->GetMax() == gPRange->GetLimitMax())
+            {
+
+               if(cascade->GetPtot() < gPRange->GetMin())
+               {
+                  cascade->SetRnrSelf(kFALSE);
+                  cascade->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            else
+            {
+               if(cascade->GetPtot() < gPRange->GetMin() || cascade->GetPtot() > gPRange->GetMax())
+               {
+                  cascade->SetRnrSelf(kFALSE);
+                  cascade->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+         }
+
+         if(gCutOnPt->IsOn())
+         {
+
+            if(gPtRange->GetMax() == gPtRange->GetLimitMax())
+            {
+
+               if(cascade->GetPt() < gPtRange->GetMin())
+               {
+                  cascade->SetRnrSelf(kFALSE);
+                  cascade->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            else
+            {
+               if(cascade->GetPt() < gPtRange->GetMin() || cascade->GetPt() > gPtRange->GetMax())
+               {
+                  cascade->SetRnrSelf(kFALSE);
+                  cascade->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+         }
+
+         if(gCutOnEta->IsOn())
+         {
+
+            if(gEtaRange->GetMax() == gEtaRange->GetLimitMax() && gEtaRange->GetMax() == gEtaRange->GetLimitMax())
+               continue;
+
+            if(gEtaRange->GetMax() == gEtaRange->GetLimitMax())
+            {
+               if(cascade->GetEta() < gEtaRange->GetMin())
+               {
+                  cascade->SetRnrSelf(kFALSE);
+                  cascade->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            if(gEtaRange->GetMin() == gEtaRange->GetLimitMin())
+            {
+
+               if(cascade->GetEta() > gEtaRange->GetMax())
+               {
+                  cascade->SetRnrSelf(kFALSE);
+                  cascade->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            if(cascade->GetEta() < gEtaRange->GetMin() || cascade->GetEta() > gEtaRange->GetMax())
+            {
+               cascade->SetRnrSelf(kFALSE);
+               cascade->SetRnrChildren(kFALSE);
+               continue;
+            }
+
+         }
+
+         cascade->SetRnrSelf(kTRUE);
+         cascade->SetRnrChildren(kTRUE);
+
+      }
+
+
+      i = gEve->GetEventScene()->FirstChild()->FindChild("ESD kink")->BeginChildren();
+      j = gEve->GetEventScene()->FirstChild()->FindChild("ESD kink")->EndChildren();
+
+      for(k = i; k != j; k++)
+      {
+
+         AliEveKink *kink = dynamic_cast<AliEveKink*>((TEveElement*) *k);
+            
+         if(gCutOnP->IsOn())
+         {
+
+            if(gPRange->GetMax() == gPRange->GetLimitMax())
+            {
+
+               if(kink->GetESDTrack()->P() < gPRange->GetMin())
+               {
+                  kink->SetRnrSelf(kFALSE);
+                  kink->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            else
+            {
+               if(kink->GetESDTrack()->P() < gPRange->GetMin() || kink->GetESDTrack()->P() > gPRange->GetMax())
+               {
+                  kink->SetRnrSelf(kFALSE);
+                  kink->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+         }
+
+         if(gCutOnPt->IsOn())
+         {
+
+            if(gPtRange->GetMax() == gPtRange->GetLimitMax())
+            {
+
+               if(kink->GetESDTrack()->Pt() < gPtRange->GetMin())
+               {
+                  kink->SetRnrSelf(kFALSE);
+                  kink->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            else
+            {
+               if(kink->GetESDTrack()->Pt() < gPtRange->GetMin() || kink->GetESDTrack()->Pt() > gPtRange->GetMax())
+               {
+                  kink->SetRnrSelf(kFALSE);
+                  kink->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+         }
+
+         if(gCutOnEta->IsOn())
+         {
+
+            if(gEtaRange->GetMax() == gEtaRange->GetLimitMax() && gEtaRange->GetMax() == gEtaRange->GetLimitMax())
+               continue;
+
+            if(gEtaRange->GetMax() == gEtaRange->GetLimitMax())
+            {
+               if(kink->GetESDTrack()->Eta() < gEtaRange->GetMin())
+               {
+                  kink->SetRnrSelf(kFALSE);
+                  kink->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            if(gEtaRange->GetMin() == gEtaRange->GetLimitMin())
+            {
+
+               if(kink->GetESDTrack()->Eta() > gEtaRange->GetMax())
+               {
+                  kink->SetRnrSelf(kFALSE);
+                  kink->SetRnrChildren(kFALSE);
+                  continue;
+               }
+
+            }
+
+            if(kink->GetESDTrack()->Eta() < gEtaRange->GetMin() || kink->GetESDTrack()->Eta() > gEtaRange->GetMax())
+            {
+               kink->SetRnrSelf(kFALSE);
+               kink->SetRnrChildren(kFALSE);
+               continue;
+            }
+
+         }
+
+         kink->SetRnrSelf(kTRUE);
+         kink->SetRnrChildren(kTRUE);
+
+      }
+*/
+
+  }
+
+  TEveElement* top = gEve->GetCurrentEvent();
+
+  AliEveMultiView *mv = AliEveMultiView::Instance();
+
+  mv->DestroyEventRPhi();
+  mv->DestroyEventRhoZ();
+
+  mv->ImportEventRPhi(top);
+  mv->ImportEventRhoZ(top);
+
+  gEve->FullRedraw3D(kFALSE, kTRUE);
+
+}
+
+//______________________________________________________________________________
+
+void SetCutsWindow::CloseTab()
+{
+
+      TEveBrowser *browser = gEve->GetBrowser();
+      Int_t current = browser->GetTabLeft()->GetCurrent();
+
+      browser->GetTabLeft()->RemoveTab(current);
+
+}
+
+//______________________________________________________________________________
+
+void alieve_set_cuts()
+{
+
+      TEveBrowser *browser = gEve->GetBrowser();
+
+      browser->StartEmbedding(TRootBrowser::kLeft);
+
+      new SetCutsWindow();
+
+      browser->StopEmbedding("Cut Selection");
+
+}
diff --git a/EVE/alice-macros/make_residuals.C b/EVE/alice-macros/make_residuals.C
new file mode 100644 (file)
index 0000000..643a16f
--- /dev/null
@@ -0,0 +1,567 @@
+#include <TGButton.h>
+#include <TGButtonGroup.h>
+#include <TGLabel.h>
+#include <TGNumberEntry.h>
+#include <TG3DLine.h>
+#include <TApplication.h>
+#include <TGComboBox.h>
+#include <TLatex.h>
+
+
+class ButtonWindow : public TGMainFrame {
+
+protected:
+   TGComboBox *option1;
+   TGComboBox *option2;
+   TGComboBox *option3;
+   TGComboBox *option4;
+   TGComboBox *option5;
+   TGComboBox *option6;
+   TGComboBox *option7;
+   TGComboBox *option8;
+   TGComboBox *option9;
+   TGComboBox *option10;
+   TGTextEntry *cut1;
+   TGTextEntry *cut2;
+   TGTextEntry *cut3;
+   TGTextEntry *cut4;
+   TGTextEntry *customCutSelection;
+   TGTextEntry *customDrawSelection;
+   TGNumberEntry *nEntries;
+   TGNumberEntry *firstEntry;
+
+public:
+   ButtonWindow();
+   void DrawResiduals();
+   
+   ClassDef(ButtonWindow, 0)
+};
+
+//________________________________________________
+
+ButtonWindow::ButtonWindow() : TGMainFrame(gClient->GetRoot(), 10, 10, kHorizontalFrame)
+{
+   // Main test window.
+
+   SetCleanup(kDeepCleanup);
+
+   // Controls on right
+   TGVerticalFrame *controls = new TGVerticalFrame(this);
+   AddFrame(controls, new TGLayoutHints(kLHintsRight | kLHintsExpandY, 5, 5, 5, 5));
+
+   // control margins of the text
+
+   TGLabel *label1 = 0;
+   TGLabel *label2 = 0;
+   TGLabel *label3 = 0;
+   TGLabel *label4 = 0;
+   TGLabel *label5 = 0;
+   TGLabel *label6 = 0;
+   TGHorizontal3DLine *separator = 0;
+
+   TGGroupFrame *margins = new TGGroupFrame(controls, "Residuals Drawing Options");
+   margins->SetTitlePos(TGGroupFrame::kCenter);
+
+//==========================
+
+   separator = new TGHorizontal3DLine(margins);
+
+   margins->AddFrame(separator, new TGLayoutHints(kLHintsExpandX));
+
+   label1 = new TGLabel(margins, "Axes");
+
+   margins->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+   TGHorizontalFrame *hframe1 = new TGHorizontalFrame(margins, 400, 20, kFixedWidth);
+   
+   label1 = new TGLabel(hframe1, "X axis: ");
+
+   option1 = new TGComboBox(hframe1,"Draw option");
+   option1->AddEntry("fX",1);
+   option1->AddEntry("fY",2);
+   option1->AddEntry("fZ",3);
+   option1->AddEntry("fR",4);
+   option1->Resize(120,20);
+
+   label3 = new TGLabel(hframe1, "Y axis: ");
+
+   option2 = new TGComboBox(hframe1,"Draw option");
+   option2->AddEntry("fPx",1);
+   option2->AddEntry("fPy",2);
+   option2->AddEntry("fPz",3);
+   option2->AddEntry("fPt",4);
+   option2->AddEntry("fP",5);
+   option2->Resize(120,20);
+
+   hframe1->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+   hframe1->AddFrame(option1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+   hframe1->AddFrame(label3, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+   hframe1->AddFrame(option2, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+   margins->AddFrame(hframe1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+//==========================
+
+   separator = new TGHorizontal3DLine(margins);
+
+   margins->AddFrame(separator, new TGLayoutHints(kLHintsExpandX));
+
+   label1 = new TGLabel(margins, "Cut Selection");
+
+   margins->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+//===============================
+
+   TGHorizontalFrame *hframe3 = new TGHorizontalFrame(margins, 400, 20, kFixedWidth);
+   
+   label1 = new TGLabel(hframe3, " 1. ");
+
+   option3 = new TGComboBox(hframe3,"Cut");
+   option3->AddEntry("fPx",1);
+   option3->AddEntry("fPy",2);
+   option3->AddEntry("fPz",3);
+   option3->AddEntry("fPt",4);
+   option3->AddEntry("fP",5);
+   option3->Resize(100,20);
+
+   option4 = new TGComboBox(hframe3,"-");
+   option4->AddEntry("(no cut)",0);
+   option4->AddEntry("<",1);
+   option4->AddEntry(">",2);
+   option4->Resize(100,20);
+
+   cut1 = new TGTextEntry(hframe3);
+
+   hframe3->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe3->AddFrame(option3, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe3->AddFrame(option4, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe3->AddFrame(cut1, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+   margins->AddFrame(hframe3, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+//=====================================
+
+   TGHorizontalFrame *hframe4 = new TGHorizontalFrame(margins, 400, 20, kFixedWidth);
+   
+   label1 = new TGLabel(hframe4, "2. ");
+
+   option5 = new TGComboBox(hframe4,"Cut");
+   option5->AddEntry("fPx",1);
+   option5->AddEntry("fPy",2);
+   option5->AddEntry("fPz",3);
+   option5->AddEntry("fPt",4);
+   option5->AddEntry("fP",5);
+   option5->Resize(100,20);
+
+   option6 = new TGComboBox(hframe4,"-");
+   option6->AddEntry("(no cut)",0);
+   option6->AddEntry("<",1);
+   option6->AddEntry(">",2);
+   option6->Resize(100,20);
+
+   cut2 = new TGTextEntry(hframe4);
+//   cut2 = new TGNumberEntryField(hframe4, 40, 20, kFixedWidth);
+
+   hframe4->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe4->AddFrame(option5, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe4->AddFrame(option6, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe4->AddFrame(cut2, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+   margins->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+   separator = new TGHorizontal3DLine(margins);
+
+   margins->AddFrame(separator, new TGLayoutHints(kLHintsExpandX));
+
+   label1 = new TGLabel(margins, "Custom Cut Selection");
+
+   margins->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+   customCutSelection = new TGTextEntry(margins);
+
+   margins->AddFrame(customCutSelection, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+//========================================
+
+   separator = new TGHorizontal3DLine(margins);
+
+   margins->AddFrame(separator, new TGLayoutHints(kLHintsExpandX));
+
+   label1 = new TGLabel(margins, "Draw Selection");
+
+   margins->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+//========================================
+
+   TGHorizontalFrame *hframe5 = new TGHorizontalFrame(margins, 400, 20, kFixedWidth);
+   
+   label1 = new TGLabel(hframe5, "1. ");
+
+   option7 = new TGComboBox(hframe5,"Cut");
+   option7->AddEntry("fPx",1);
+   option7->AddEntry("fPy",2);
+   option7->AddEntry("fPz",3);
+   option7->AddEntry("fPt",4);
+   option7->AddEntry("fP",5);
+   option7->Resize(100,20);
+
+   option8 = new TGComboBox(hframe5,"-");
+   option8->AddEntry("(no cut)",0);
+   option8->AddEntry("<",1);
+   option8->AddEntry(">",2);
+   option8->Resize(100,20);
+
+   cut3 = new TGTextEntry(hframe5);
+//   cut3 = new TGNumberEntryField(hframe5, 40, 20, kFixedWidth);
+
+   hframe5->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe5->AddFrame(option7, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe5->AddFrame(option8, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe5->AddFrame(cut3, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+   margins->AddFrame(hframe5, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+//=======================================
+
+   TGHorizontalFrame *hframe6 = new TGHorizontalFrame(margins, 400, 20, kFixedWidth);
+   
+   label1 = new TGLabel(hframe6, "2. ");
+
+   option9 = new TGComboBox(hframe6,"Cut");
+   option9->AddEntry("fPx",1);
+   option9->AddEntry("fPy",2);
+   option9->AddEntry("fPz",3);
+   option9->AddEntry("fPt",4);
+   option9->AddEntry("fP",5);
+   option9->Resize(100,20);
+
+   option10 = new TGComboBox(hframe6,"-");
+   option10->AddEntry("(no cut)",0);
+   option10->AddEntry("<",1);
+   option10->AddEntry(">",2);
+   option10->Resize(100,20);
+
+   cut4 = new TGTextEntry(hframe6);
+//   cut4 = new TGNumberEntryField(hframe6, 40, 20, kFixedWidth);
+
+   hframe6->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe6->AddFrame(option9, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe6->AddFrame(option10, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe6->AddFrame(cut4, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+   margins->AddFrame(hframe6, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+   separator = new TGHorizontal3DLine(margins);
+
+   margins->AddFrame(separator, new TGLayoutHints(kLHintsExpandX));
+
+   label1 = new TGLabel(margins, "Custom Draw Selection");
+
+   margins->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+   customDrawSelection = new TGTextEntry(margins);
+
+   margins->AddFrame(customDrawSelection, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+//==========================
+
+   separator = new TGHorizontal3DLine(margins);
+
+   margins->AddFrame(separator, new TGLayoutHints(kLHintsExpandX));
+
+   label1 = new TGLabel(margins, "Entries Selection");
+
+   margins->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 3, 4));
+
+//========================================
+
+   TGHorizontalFrame *hframe7 = new TGHorizontalFrame(margins, 400, 20, kFixedWidth);
+   
+   label1 = new TGLabel(hframe7, "nEntries");
+
+   nEntries = new TGNumberEntry(hframe7, 40, 20, kFixedWidth);
+
+   label2 = new TGLabel(hframe7, "firstEntry");
+
+   firstEntry = new TGNumberEntry(hframe7, 40, 20, kFixedWidth);
+
+   hframe7->AddFrame(label1, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe7->AddFrame(nEntries, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe7->AddFrame(label2, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+   hframe7->AddFrame(firstEntry, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+   margins->AddFrame(hframe7, new TGLayoutHints(kLHintsExpandX, 5, 5, 1, 1));
+
+//==========================
+
+   separator = new TGHorizontal3DLine(margins);
+
+   margins->AddFrame(separator, new TGLayoutHints(kLHintsExpandX));
+
+   const TGFont *font = gClient->GetFont("-*-times-bold-r-*-*-16-*-*-*-*-*-*-*");
+//   const TGFont *font = gClient->GetFont("-*-symbol-medium-r-normal-*-16-*-*-*-*-*-*-*");
+   FontStruct_t buttonFont = font->GetFontStruct();
+   ULong_t buttonRedColor;
+   gClient->GetColorByName("red", buttonRedColor);
+   TGTextButton *draw = new TGTextButton(margins,"Draw Residuals");
+   draw->SetTextColor(buttonRedColor);
+   draw->SetFont(buttonFont);
+   draw->Connect("Clicked()", "ButtonWindow", this, "DrawResiduals()");
+   margins->AddFrame(draw, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
+
+   controls->AddFrame(margins, new TGLayoutHints(kLHintsExpandX));
+
+   MapSubwindows();
+   Resize();
+
+   SetWMSizeHints(GetDefaultWidth(), GetDefaultHeight(), 1000, 1000, 0 ,0);
+   SetWindowName("Residuals");
+   MapRaised();
+}
+
+//______________________________________________________________________________
+void ButtonWindow::DrawResiduals()
+{
+
+      TString selection1, selection2, selection3, selection4, selection5 selection6, selection7, selection8, selection9, selection10;
+
+      switch(option1->GetSelected())
+      {
+         case 1:
+            selection1 = "fX";
+            break;
+         case 2:
+            selection1 = "fY";
+            break;
+         case 3:
+            selection1 = "fZ";
+            break;
+         default:
+            selection1 = "fX";
+            break;
+      }
+    
+      switch(option2->GetSelected())
+      {
+         case 1:
+            selection2 = "fPx";
+            break;
+         case 2:
+            selection2 = "fPy";
+            break;
+         case 3:
+            selection2 = "fPz";
+            break;
+         case 4:
+            selection2 = "fPt";
+            break;
+         case 5:
+            selection2 = "fP";
+            break;
+         default:
+            selection2 = "fP";
+            break;
+      }
+
+      switch(option3->GetSelected())
+      {
+         case 1:
+            selection3 = "fPx";
+            break;
+         case 2:
+            selection3 = "fPy";
+            break;
+         case 3:
+            selection3 = "fPz";
+            break;
+         case 4:
+            selection3 = "fPt";
+            break;
+         case 5:
+            selection3 = "fP";
+            break;
+         default:
+            selection3 = "fP";
+            break;
+      }
+
+      switch(option4->GetSelected())
+      {
+         case 1:
+            selection4 = "<";
+            break;
+         case 2:
+            selection4 = ">";
+            break;
+         default:
+            selection4 = "<";
+            break;
+      }
+
+      switch(option5->GetSelected())
+      {
+         case 1:
+            selection5 = "fPx";
+            break;
+         case 2:
+            selection5 = "fPy";
+            break;
+         case 3:
+            selection5 = "fPz";
+            break;
+         case 4:
+            selection5 = "fPt";
+            break;
+         case 5:
+            selection5 = "fP";
+            break;
+         default:
+            selection5 = "fP";
+            break;
+      }
+
+      switch(option6->GetSelected())
+      {
+         case 1:
+            selection6 = "<";
+            break;
+         case 2:
+            selection6 = ">";
+            break;
+         default:
+            selection6 = "<";
+            break;
+      }
+
+      switch(option7->GetSelected())
+      {
+         case 1:
+            selection7 = "fPx";
+            break;
+         case 2:
+            selection7 = "fPy";
+            break;
+         case 3:
+            selection7 = "fPz";
+            break;
+         case 4:
+            selection7 = "fPt";
+            break;
+         case 5:
+            selection7 = "fP";
+            break;
+         default:
+            selection7 = "fP";
+            break;
+      }
+
+      switch(option8->GetSelected())
+      {
+         case 1:
+            selection8 = "<";
+            break;
+         case 2:
+            selection8 = ">";
+            break;
+         default:
+            selection8 = "<";
+            break;
+      }
+
+      switch(option9->GetSelected())
+      {
+         case 1:
+            selection9 = "fPx";
+            break;
+         case 2:
+            selection9 = "fPy";
+            break;
+         case 3:
+            selection9 = "fPz";
+            break;
+         case 4:
+            selection9 = "fPt";
+            break;
+         case 5:
+            selection9 = "fP";
+            break;
+         default:
+            selection3 = "fP";
+            break;
+      }
+
+      switch(option10->GetSelected())
+      {
+         case 1:
+            selection10 = "<";
+            break;
+         case 2:
+            selection10 = ">";
+            break;
+         default:
+            selection10 = "<";
+            break;
+      }
+
+      TString cutSelectionMerged;// = ("abs(ESDfriend.fTracks[].fTPCOut."+selection3+"[4])"+selection4+cut1->GetText());
+      TString drawSelectionMerged1 = ("track[]."+selection2+"[0]:track[]."+selection1);
+      TString drawSelectionMerged2;// = ("abs(track[]."+selection7+"[0])"+selection8+cut3->GetText());
+
+      if(customCutSelection->GetText())
+        cutSelectionMerged = customCutSelection->GetText();
+
+      if(customDrawSelection->GetText())
+        drawSelectionMerged2 = customDrawSelection->GetText();
+
+
+      cout << cutSelectionMerged << endl;
+      cout << "abs(ESDfriend.fTracks[].fTPCOut.fP[4])<0.5" <<endl;
+
+      cout << drawSelectionMerged1 << endl;
+      cout << "track[].fP[0]:track[].fX" << endl;
+
+      cout << drawSelectionMerged2 << endl;
+      cout << "abs(track[].fP[0])<20" << endl;
+
+      cout << "nEntries: " << nEntries->GetNumber() << endl;
+      cout << "firstEntry: " << firstEntry->GetNumber() << endl;
+
+
+      TEveUtil::LoadMacro("ConfigCalibTrain.C");
+
+      AliESDEvent *esd = AliEveEventManager::AssertESD();
+
+      ConfigCalibTrain(esd->GetRunNumber());
+
+      AliESDfriendTrack::MakeDebugStreamer(kTRUE);
+
+      TTreeSRedirector *pcstreamRes = AliESDfriendTrack::GetDebugStreamer();
+
+      TFile fRes("AliESDfriends.root");
+
+      TTree *treeRes = (TTree*)fRes.Get("esdFriendTree");     
+
+      TCanvas* cnv = new TCanvas();
+
+      treeRes->Draw("ESDfriend.fTracks[].MakeResidualGraph(1)",cutSelectionMerged," ",nEntries->GetNumber(),firstEntry->GetNumber());
+//      treeRes->Draw("ESDfriend.fTracks[].MakeResidualGraph(1)","abs(ESDfriend.fTracks[].fTPCOut.fP[4])<0.5"," ",nEntries,firstEntry);
+
+      delete pcstreamRes;
+
+      TFile fRes("residual.root");
+
+      dump.Draw(drawSelectionMerged1,drawSelectionMerged2);
+
+//      dump.Draw("track[].fP[0]:track[].fX","abs(track[].fP[0])<20");
+
+
+
+}
+
+//_____________________________________________________________________________
+void make_residuals()
+{
+
+      new ButtonWindow();
+
+}
diff --git a/EVE/alice-macros/set_momentum_vectors.C b/EVE/alice-macros/set_momentum_vectors.C
new file mode 100644 (file)
index 0000000..ad4dd6a
--- /dev/null
@@ -0,0 +1,351 @@
+void set_momentum_vectors()//(Int_t mode = 1, Double_t minMomentum = 0, Bool_t drawWithTracks = kTRUE)
+{
+
+   TString str1 = 0;
+   TString str2 = 0;
+
+   Bool_t draw = kFALSE;
+
+   TEveElement::List_i i = gEve->GetEventScene()->FirstChild()->BeginChildren();
+   TEveElement::List_i j = gEve->GetEventScene()->FirstChild()->EndChildren();
+   TEveElement::List_i k;
+
+   TEveElementList* momentumVectorList = new TEveElementList("Momentum Vectors");
+
+   Double_t maxMomentum = 0;
+   Double_t vectorLength = 600.0;
+
+   Double_t x1 = 0;
+   Double_t y1 = 0;
+   Double_t z1 = 0;
+
+   Double_t x2 = 0;
+   Double_t y2 = 0;
+   Double_t z2 = 0;
+
+   //==============================================
+   // find highest momentum (to normalize)
+   //==============================================
+
+   for(k = i; k != j; k++)
+   {
+      TEveElement* element = (TEveElement*) *k;
+
+      str1 = element->GetElementName();
+
+      if(str1.Contains("Tracks") || str1.Contains("tracks"))
+      {
+
+         TEveElement::List_i m = element->BeginChildren();
+         TEveElement::List_i n = element->EndChildren();
+         TEveElement::List_i l;
+
+         for(l = m; l != n; l++)
+         {
+            TEveElement* trackType = (TEveElement*) *l;
+            str2 = trackType->GetElementName();
+
+            if(str2.Contains("Sigma < 3"))
+            {
+               if(trackType->HasChildren())
+               {
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     if(trackSingle1->GetESDTrack()->P() > maxMomentum)
+                       maxMomentum = trackSingle1->GetESDTrack()->P();
+
+                  }
+               }
+            }
+
+
+            if(str2.Contains("3 < Sigma < 5"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     if(trackSingle1->GetESDTrack()->P() > maxMomentum)
+                       maxMomentum = trackSingle1->GetESDTrack()->P();
+
+                  }
+               }
+            }
+
+            if(str2.Contains("5 < Sigma"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     if(trackSingle1->GetESDTrack()->P() > maxMomentum)
+                       maxMomentum = trackSingle1->GetESDTrack()->P();
+
+
+                  }
+               }
+            }
+         }
+      }
+   }
+
+   //==============================================
+   // clean the display
+   //==============================================
+/*
+   if(!drawWithTracks)
+
+      for(k = i; k != j; k++)
+      {
+         TEveElement* element = (TEveElement*) *k;
+
+         str1 = element->GetElementName();
+
+         element->SetRnrSelf(kFALSE);
+
+         if(element->HasChildren())
+            element->SetRnrChildren(kFALSE);
+
+      }
+
+   }
+*/
+   //==============================================
+   // draw momentum vectors
+   //==============================================
+
+   if(maxMomentum)
+      vectorLength = vectorLength/maxMomentum;
+//      vectorLength = vectorLength/TMath::Log(maxMomentum);
+
+   for(k = i; k != j; k++)
+   {
+      TEveElement* element = (TEveElement*) *k;
+
+      str1 = element->GetElementName();
+
+      if(str1.Contains("Tracks") || str1.Contains("tracks"))
+      {
+
+         TEveElement::List_i m = element->BeginChildren();
+         TEveElement::List_i n = element->EndChildren();
+         TEveElement::List_i l;
+
+         for(l = m; l != n; l++)
+         {
+            TEveElement* trackType = (TEveElement*) *l;
+            str2 = trackType->GetElementName();
+
+            trackType->SetRnrSelf(kFALSE);
+
+            if(trackType->HasChildren())
+               trackType->SetRnrChildren(kFALSE);
+
+            if(str2.Contains("Sigma < 3"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElementList* momentumVectorList1 = new TEveElementList("sigma < 3");
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     TEveLine* momentumVector = new TEveLine(TString::Format("Momentum Vector"));
+
+                     x1 = trackSingle1->GetESDTrack()->Xv();
+                     y1 = trackSingle1->GetESDTrack()->Yv();
+                     z1 = trackSingle1->GetESDTrack()->Zv();
+
+                     momentumVector->SetPoint(0, x1, y1, z1);
+
+                     x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                     y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                     z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+
+                     momentumVector->SetPoint(1, x2, y2, z2);
+
+/*
+                     if(trackSingle1->GetESDTrack()->Charge() == -1)
+                        momentumVector->SetLineColor(kGreen);
+                     else
+                        momentumVector->SetLineColor(kRed);
+*/
+                     momentumVector->SetLineColor(kRed);
+
+                     momentumVector->SetLineWidth(1);
+                     momentumVector->SetLineStyle(0);
+                     momentumVector->SetTitle(Form("%f GeV/c", trackSingle1->GetESDTrack()->P()));
+
+                     momentumVectorList1->AddElement(momentumVector);
+
+                  }
+
+//                  gEve->AddElement(momentumVectorList1);
+                  momentumVectorList->AddElement(momentumVectorList1);
+
+                  draw = kTRUE;
+
+               }
+            }
+
+
+            if(str2.Contains("3 < Sigma < 5"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  TEveElementList* momentumVectorList2 = new TEveElementList("3 < sigma < 5");
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     TEveLine* momentumVector = new TEveLine(TString::Format("Momentum Vector"));
+
+                     x1 = trackSingle1->GetESDTrack()->Xv();
+                     y1 = trackSingle1->GetESDTrack()->Yv();
+                     z1 = trackSingle1->GetESDTrack()->Zv();
+
+                     momentumVector->SetPoint(0, x1, y1, z1);
+
+                     x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                     y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                     z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+
+                     momentumVector->SetPoint(1, x2, y2, z2);
+/*
+                     if(trackSingle1->GetESDTrack()->Charge() == -1)
+                        momentumVector->SetLineColor(kGreen+2);
+                     else
+                        momentumVector->SetLineColor(kRed+2);
+*/
+                     momentumVector->SetLineColor(kRed+2);
+
+                     momentumVector->SetLineWidth(1);
+                     momentumVector->SetLineStyle(0);
+                     momentumVector->SetTitle(Form("%f GeV/c", trackSingle1->GetESDTrack()->P()));
+
+                     momentumVectorList2->AddElement(momentumVector);
+
+                  }
+
+//                  gEve->AddElement(momentumVectorList2);
+                  momentumVectorList->AddElement(momentumVectorList2);
+
+                  draw = kTRUE;
+
+               }
+            }
+
+            if(str2.Contains("5 < Sigma"))
+            {
+
+               if(trackType->HasChildren())
+               {
+
+                  TEveElementList* momentumVectorList3 = new TEveElementList("5 < sigma");
+
+                  TEveElement::List_i x = trackType->BeginChildren();
+                  TEveElement::List_i y = trackType->EndChildren();
+                  TEveElement::List_i z;
+
+                  for(z = x; z != y; z++)
+                  {
+
+                     AliEveTrack* trackSingle1 = dynamic_cast<AliEveTrack*>((TEveElement*) *z);
+
+                     TEveLine* momentumVector = new TEveLine(TString::Format("Momentum Vector"));
+
+                     x1 = trackSingle1->GetESDTrack()->Xv();
+                     y1 = trackSingle1->GetESDTrack()->Yv();
+                     z1 = trackSingle1->GetESDTrack()->Zv();
+
+                     momentumVector->SetPoint(0, x1, y1, z1);
+
+                     x2 = x1+vectorLength*trackSingle1->GetESDTrack()->Px();
+                     y2 = y1+vectorLength*trackSingle1->GetESDTrack()->Py();
+                     z2 = z1+vectorLength*trackSingle1->GetESDTrack()->Pz();
+
+                     momentumVector->SetPoint(1, x2, y2, z2);
+/*
+                     if(trackSingle1->GetESDTrack()->Charge() == -1)
+                        momentumVector->SetLineColor(kGreen+3);
+                     else
+                        momentumVector->SetLineColor(kRed+3);
+*/
+                     momentumVector->SetLineColor(kRed+3);
+
+                     momentumVector->SetLineWidth(1);
+                     momentumVector->SetLineStyle(0);
+                     momentumVector->SetTitle(Form("%f GeV/c", trackSingle1->GetESDTrack()->P()));
+
+                     momentumVectorList3->AddElement(momentumVector);
+
+                  }
+
+                  //gEve->AddElement(momentumVectorList3);
+                  momentumVectorList->AddElement(momentumVectorList3);
+
+                  draw = kTRUE;
+
+               }
+            }
+         }
+      }
+   }
+  gEve->AddElement(momentumVectorList);
+
+  TEveElement* top = gEve->GetCurrentEvent();
+
+  AliEveMultiView *mv = AliEveMultiView::Instance();
+
+  mv->DestroyEventRPhi();
+  mv->DestroyEventRhoZ();
+
+  mv->ImportEventRPhi(top);
+  mv->ImportEventRhoZ(top);
+
+  gEve->FullRedraw3D(kFALSE, kTRUE);
+
+}
index f485737..64f78c6 100644 (file)
@@ -15,19 +15,24 @@ class TEvePointSet;
 #else
 
 #include <TEveManager.h>
+#include <TColor.h>
 #include <TEvePointSet.h>
 #include <EveBase/AliEveEventManager.h>
 
 #include <AliRunLoader.h>
 #include <AliCluster.h>
 #include <TPC/AliTPCClustersRow.h>
+#include <TPC/AliTPCclusterMI.h>
 
 #endif
 
 TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
 {
+
   const Int_t kMaxCl=100*160;
 
+  Int_t fNColorBins = 5;
+
   AliEveEventManager::AssertGeometry();
 
   AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
@@ -45,6 +50,26 @@ TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
   TEvePointSet* clusters = new TEvePointSet(kMaxCl);
   clusters->SetOwnIds(kTRUE);
 
+  TEvePointSetArray * cc = new TEvePointSetArray("TPC Clusters Colorized");
+  cc->SetMainColor(kRed);
+  cc->SetMarkerStyle(4);
+  cc->SetMarkerSize(0.4);
+  cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*60.);
+  
+  cc->GetBin(0)->SetMainColor(kGray);
+  cc->GetBin(0)->SetMarkerSize(0.4);
+  cc->GetBin(1)->SetMainColor(kBlue);
+  cc->GetBin(1)->SetMarkerSize(0.42);
+  cc->GetBin(2)->SetMainColor(kCyan);
+  cc->GetBin(2)->SetMarkerSize(0.44);
+  cc->GetBin(3)->SetMainColor(kGreen);
+  cc->GetBin(3)->SetMarkerSize(0.46);
+  cc->GetBin(4)->SetMainColor(kYellow);
+  cc->GetBin(4)->SetMarkerSize(0.48);
+  cc->GetBin(5)->SetMainColor(kRed);
+  cc->GetBin(5)->SetMarkerSize(0.50);
+  cc->GetBin(6)->SetMainColor(kMagenta);
+  cc->GetBin(6)->SetMarkerSize(0.52);
 
   Float_t maxRsqr = maxR*maxR;
   Int_t nentr=(Int_t)cTree->GetEntries();
@@ -57,11 +82,15 @@ TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
 
     while (ncl--)
     {
+
+      AliTPCclusterMI* clusterMi = (AliTPCclusterMI*) cl->At(ncl);
+
       AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
       Float_t g[3]; //global coordinates
       c->GetGlobalXYZ(g);
       if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
       {
+        cc->Fill(g[0], g[1], g[2], clusterMi->GetQ());
        clusters->SetNextPoint(g[0], g[1], g[2]);
        AliCluster *atp = new AliCluster(*c);
        clusters->SetPointId(atp);
@@ -89,7 +118,14 @@ TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270)
 
   clusters->ApplyVizTag(viz_tag, "Clusters");
 
-  gEve->AddElement(clusters, cont);
+//  clusters->SetRnrSelf(kFALSE);
+//  clusters->SetRnrChildren(kFALSE);    
+
+//  gEve->AddElement(clusters, cont);
+
+  cc->SetRnrSelf(kTRUE);
+
+  gEve->AddElement(cc);
 
   gEve->Redraw3D();
 
index ce7b4d3..50f36c6 100644 (file)
@@ -175,6 +175,28 @@ void alieve_online_on_new_event()
 
   glv->DoDraw();
 
+//  TGLViewer *glv = (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("3D View")))->GetGLViewer();
+  TGLViewer *glv1 = (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("RPhi View")))->GetGLViewer();
+  TGLViewer *glv2 = (dynamic_cast<TEveViewer*>(gEve->GetViewers()->FindChild("RhoZ View")))->GetGLViewer();
+  Double_t RPhiCameraFrustrumCenter = TMath::Sqrt(glv1->CurrentCamera().FrustumCenter().X()*glv1->CurrentCamera().FrustumCenter().X() + glv1->CurrentCamera().FrustumCenter().Y()*glv1->CurrentCamera().FrustumCenter().Y());
+
+  Double_t RhoZCameraFrustrumCenter = TMath::Sqrt(glv2->CurrentCamera().FrustumCenter().X()*glv2->CurrentCamera().FrustumCenter().X() + glv2->CurrentCamera().FrustumCenter().Y()*glv2->CurrentCamera().FrustumCenter().Y());
+
+  if(RPhiCameraFrustrumCenter > 500 || RhoZCameraFrustrumCenter > 500)
+  {
+
+    glv->ResetCurrentCamera();
+    glv->CurrentCamera().RotateRad(-0.3, -1.8);
+    glv->CurrentCamera().Dolly(250, kFALSE, kFALSE);
+
+    glv1->ResetCurrentCamera();
+    glv2->ResetCurrentCamera();
+
+    gEve->FullRedraw3D();
+
+  }
+
   multiView->DestroyEventRPhi();
   if (gCenterProjectionsAtPrimaryVertex)
     multiView->SetCenterRPhi(x[0], x[1], x[2]);