Adding the AliTagFrame class: the tag window (definition of ranges) of the GUI (third...
authorpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Nov 2006 13:01:26 +0000 (13:01 +0000)
committerpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Nov 2006 13:01:26 +0000 (13:01 +0000)
ANALYSIS/Aliengui/AliTagFrame.cxx [new file with mode: 0644]
ANALYSIS/Aliengui/AliTagFrame.h [new file with mode: 0644]

diff --git a/ANALYSIS/Aliengui/AliTagFrame.cxx b/ANALYSIS/Aliengui/AliTagFrame.cxx
new file mode 100644 (file)
index 0000000..bf49b84
--- /dev/null
@@ -0,0 +1,127 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//-----------------------------------------------------------------
+//           AliTagFrame class
+//   The class that deals with the event tag tab of the GUI
+//   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
+//-----------------------------------------------------------------
+
+#include "TGButton.h"
+#include "TGLabel.h"
+#include "TGNumberEntry.h"
+#include "TTimer.h"
+
+#include "AliTagFrame.h"
+
+ClassImp(AliTagFrame)
+
+//___________________________________________________________________________
+AliTagFrame::AliTagFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t options, const char* tagName, Int_t tagId, ETagRangeType range)
+  : TGTransientFrame(p, main, w, h, options), fMin(0), fMax(0), fRange(range) {
+  //constructor
+  SetCleanup(kDeepCleanup);
+
+  SetWindowName(tagName);
+/*
+   AliTagFrameFunctions tagFunctions [6] = {
+     &AliTagFrame::Vx, &AliTagFrame::Vy, &AliTagFrame::Vz,
+     &AliTagFrame::Participants, &AliTagFrame::ImpactParameter, &AliTagFrame::PrimaryVertex
+   };
+
+   AliTagFrameFunctions tagFunctions [3] = {
+     &AliTagFrame::NegMultiplicityRange, &AliTagFrame::VOsRange, &AliTagFrame::NPionRange
+   };
+*/
+
+  CreateTagName(tagName);
+  //   CREATE_TAG_FRAME(this, tagFunctions[tagId])();
+  if(fRange == kRangeMinMax){
+    CreateTagRange(fVFrame1, fEntry1, "Min");
+    CreateTagRange(fVFrame2, fEntry2, "Max");
+  }
+  else if(fRange == kRangeMin){
+    CreateTagRange(fVFrame1, fEntry1, "Min");
+  }
+  else if(fRange == kRangeMax){
+    CreateTagRange(fVFrame1, fEntry1, "Max");
+  }
+   
+  CreateTagButton();
+
+  fButton->Connect("Clicked()", "AliTagFrame", this, "OnClicked()");
+
+  MapSubwindows();
+  Resize();
+  MapWindow();
+  
+  gClient->WaitFor(this); 
+}
+
+//___________________________________________________________________________
+AliTagFrame::~AliTagFrame() {
+  // destructor
+
+  //   DeleteWindow();
+}
+
+//___________________________________________________________________________
+void AliTagFrame::CreateTagName(const char* name) {
+  // Creates the Tag Name and insert it at Result Group Frame     
+
+   AddFrame(new TGLabel(this, new TGString(name)), new TGLayoutHints(kLHintsLeft, 5,5,40,5));
+}
+
+//___________________________________________________________________________
+void AliTagFrame::CreateTagRange(TGVerticalFrame * vFrame, TGNumberEntryField *& entry, const char* name) {
+  // Creates the label and entries.
+  
+  vFrame = new TGVerticalFrame(this);
+  AddFrame(vFrame, new TGLayoutHints(kLHintsCenterX, 5,5,5,5));
+  
+  TGLabel * label2 = new TGLabel(vFrame, new TGString(name));
+  vFrame->AddFrame(label2, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5,5,5,5));
+  entry = new TGNumberEntryField(vFrame);
+  vFrame->AddFrame(entry, new TGLayoutHints(kLHintsBottom, 5,5,5,5));
+}
+
+//___________________________________________________________________________
+void AliTagFrame::CreateTagButton() {
+  // Creates the OK button.
+  
+  fButton = new TGTextButton(this, "OK", 1);
+  AddFrame(fButton, new TGLayoutHints(kLHintsRight, 5,5,35,5));
+}
+
+//___________________________________________________________________________
+void AliTagFrame::OnClicked() {
+  // OnClicked slot.
+  
+  if(fRange == kRangeMinMax){
+    fMin = static_cast<int>(fEntry1->GetNumber());
+    fMax = static_cast<int>(fEntry2->GetNumber());
+  }
+  else if(fRange == kRangeMin){
+    fMin = static_cast<int>(fEntry1->GetNumber());
+  }
+  else if(fRange == kRangeMax){
+    fMax = static_cast<int>(fEntry1->GetNumber());
+  }
+  
+  TTimer::SingleShot(1, "AliTagFrame", this, "CloseWindow()");
+}
+
diff --git a/ANALYSIS/Aliengui/AliTagFrame.h b/ANALYSIS/Aliengui/AliTagFrame.h
new file mode 100644 (file)
index 0000000..8833e6d
--- /dev/null
@@ -0,0 +1,74 @@
+#ifndef ALITAGFRAME_H
+#define ALITAGFRAME_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+//-------------------------------------------------------------------------
+//                          Class AliTagFrame
+//   AliTagFrame class that describes the event tag frame of the GUI
+//
+//    Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
+//-------------------------------------------------------------------------
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//                                                                      //
+//                           AliTagFrame                                //
+//                                                                      //
+//                      Event tag tab of the GUI.                       //
+//                                                                      //
+//////////////////////////////////////////////////////////////////////////
+
+
+#include <TGFrame.h>
+
+class TGCanvas;
+class TGVerticalFrame;
+class TGButton;
+class TGNumberEntryField;
+
+enum ETagRangeType {
+   kRangeMin,
+   kRangeMax,
+   kRangeMinMax
+};
+
+//___________________________________________________________________________
+class AliTagFrame : public TGTransientFrame {
+public:
+  AliTagFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t options, const char* text, Int_t tagId, ETagRangeType range);
+  ~AliTagFrame();
+
+  Int_t GetRangeMin() const {return fMin;}
+  Int_t GetRangeMax() const {return fMax;}
+
+  void  OnClicked();
+   
+//___________________________________________________________________________
+private:
+  AliTagFrame(const AliTagFrame&); // copy ctor
+  AliTagFrame& operator= (const AliTagFrame&); // assignment op
+
+  // methods to build the GUI
+   void  CreateTagName(const char* name);
+   void  CreateTagRange(TGVerticalFrame* frame, TGNumberEntryField*& entry, const char *name);
+   void  CreateTagButton();
+
+   void (AliTagFrame::*fTagCutMethods [3]) (void); //tag fields
+   
+   Int_t              fMin;   // min range
+   Int_t              fMax;   // max range
+   ETagRangeType      fRange; // range type
+
+   TGNumberEntryField *fEntry1, *fEntry2; //range entry fields
+
+   TGButton           *fButton; //button
+   TGVerticalFrame    *fVFrame1, *fVFrame2; //vertical frames
+
+   ClassDef(AliTagFrame, 0) // Tag Frame
+};
+
+#endif