]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updates of the list anlyser (Ben)
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Dec 2009 10:39:55 +0000 (10:39 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Dec 2009 10:39:55 +0000 (10:39 +0000)
Do the following:
- Run "esd_tracks.C"
- Run "ana_list.C"
- In the list editor, go to the "list" tab and click the "start" button
- select one track (or more) and do ImportClustersFromIndex
- select points (hold "ctrl + alt"
- In the list editor ("list" tab) click the "stop" button

Please see the tool tips for more information!

Now you can (if there were macros dealing with AliTrackPoints) do some
analysis with these objects. But this is not the point. Please do:
- Export the list analyser to CINT and label it "list"
- run ".x ana_list_load_tracks.C(list)" to add tracks to the list
- run ".x ana_list_load_kinks.C(list)" to add kinks to the list

-> Enjoy the analysis of these objects  :)

EVE/EveDet/AliEveListAnalyser.cxx
EVE/EveDet/AliEveListAnalyser.h
EVE/EveDet/AliEveListAnalyserEditor.cxx
EVE/EveDet/AliEveListAnalyserEditor.h

index 67e4294c99104a91866b0d102abca56b9f26ab66..c8ab0cf9563cbb822bbec565400ded16558212da 100644 (file)
 #include <TTreeStream.h>
 #include <TMethodCall.h>
 
+//TODO - NEW -> Ordering! resp. remove the non-needed files 
+#include <TQObject.h>
+#include <TEveManager.h>
+#include <TGLSelectRecord.h>
+#include <TGLViewer.h>
+
 #include <AliTRDReconstructor.h>
 
 #include <EveDet/AliEveListAnalyser.h>
@@ -85,13 +91,14 @@ ClassImp(AliEveListAnalyser)
 ///////////////////////////////////////////////////////////
 AliEveListAnalyser::AliEveListAnalyser(const Text_t* n, const Text_t* t, Bool_t doColor):
   TEveElementList(n, t, doColor),
-  fEditor(0x0),
+  fConnected(kFALSE),
   fDataFromMacroList(0x0),
+  fEditor(0x0),
   fMacroList(0x0),
   fDataTree(0x0),
   fHistoDataSelected(0),
   fMacroListSelected(0),
-  fSelectedTab(1)                               // Standard tab: "Apply macros" (index 1)
+  fSelectedTab(2)                               // Standard tab: "Apply macros" (index 2)
 {
   // Creates the AliEveListAnalyser.
 
@@ -118,6 +125,9 @@ AliEveListAnalyser::~AliEveListAnalyser()
 {
   // Frees allocated memory (lists etc.).
 
+  // Stop adding objects
+  StopAddingObjects();
+
   // Let the editor know that the list will be destroyed -> The editor will save the data
   if (fEditor != 0)
   {
@@ -150,7 +160,6 @@ AliEveListAnalyser::~AliEveListAnalyser()
 //______________________________________________________
 Int_t AliEveListAnalyser::AddMacro(const Char_t* path, const Char_t* nameC, Bool_t forceReload)
 {
-// TODO: Update the comment concerning the supported types: TObject->'OBJECTTYPE'
   // Checks, if the file exists and if the signature is correct.
   // If these criteria are fullfilled, the library for this macro is built
   // and the macro is added to the corresponding list.
@@ -265,6 +274,71 @@ Bool_t AliEveListAnalyser::AddMacroFast(const Char_t* path, const Char_t* name,
   return success;
 }
 
+//TODO - NEW - To be implemented, tested, documented
+//______________________________________________________
+void AliEveListAnalyser::AddObjectToList(Int_t pointId)
+{
+  TEvePointSet* ps = dynamic_cast<TEvePointSet*>((TQObject*) gTQSender);
+  
+  if (!ps)
+  {
+    Error("AliEveListAnalyser::AddObjectToList", "Zero pointer!\n");
+    return;
+  }
+
+  // Check, if object is already there. If so, remove it!
+  
+  // 1st possibility: Object of the list clicked
+  if (this->HasChild(ps))
+  {
+    this->RemoveElement(ps);
+    return;
+  }
+    
+  TObject* obj = ps->GetPointId(pointId);
+  if (obj)
+  {
+    // 2nd possibility: Same object clicked again
+    TEveElement* listObj = 0x0;
+    listObj = this->FindChild(Form("[viewer:%d] %s%d", obj->GetUniqueID(), obj->GetName(), pointId));
+    if (listObj)
+    {
+      this->RemoveElement(listObj);  
+      return;
+    }
+
+    // Object clicked that is not in the list -> Add this object to list
+    TEvePointSet* newPS = new TEvePointSet(Form("[viewer:%d] %s%d", obj->GetUniqueID(), obj->GetName(), pointId));
+    Double_t x = 0, y = 0, z = 0;
+    ps->GetPoint(pointId, x, y, z);
+    newPS->SetPoint(0, x, y, z);
+    newPS->SetUserData(obj);
+    newPS->SetMarkerColor(5);
+    newPS->SetMarkerStyle(2);
+    newPS->SetMarkerSize(2.0);
+
+    AddElement(newPS);
+    gEve->Redraw3D();
+  }
+  else
+  {
+    Error("AliEveListAnalyser::AddObjectToList", "Selected object is NULL and therefore ignored!");
+  }
+
+/*
+  TGLSelectRecord rec = gEve->GetDefaultGLViewer()->GetSelRec();
+
+  printf("Objects (%d):\n", rec.GetN());
+  for (int i = 0; i < rec.GetN(); i++)
+  {
+    //printf("%s\n", ((TObject*)rec.GetItem(i))->IsA()->GetName());
+  }
+*/
+  
+  //printf("Type: %s\npointID: %s\n\n", ps->IsA()->GetName(), pointId);
+  //printf("Type objectsender: %s\nType sender: %s\n", ((TQObject*)gTQSender)->IsA()->GetName(), ((TQObjSender*)gTQSender)->IsA()->GetName());
+}
+
 //______________________________________________________
 void AliEveListAnalyser::AddStandardContent()
 {
@@ -328,7 +402,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
     mProcType = new AliEveListAnalyserMacroType[procIterator->GetEntries()];
   }
   
-  //TODO
   TClass** mProcObjectType = 0;
   if (procIterator->GetEntries() > 0) {
     mProcObjectType = new TClass*[procIterator->GetEntries()];
@@ -341,7 +414,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
     mSelType = new AliEveListAnalyserMacroType[selIterator->GetEntries()];
   }
 
-  //TODO
   TClass** mSelObjectType = 0;
   if (selIterator->GetEntries() > 0) {
     mSelObjectType = new TClass*[selIterator->GetEntries()];
@@ -374,7 +446,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
     printf("AliEveListAnalyser: Checking process macro: %s\n", macro->GetName());
 #endif 
            
-//TODO
     // Find the object type of the macro
     mProcObjectType[i] = macro->GetObjectType();
 
@@ -421,7 +492,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
     printf("AliEveListAnalyser: Checking selection macro: %s\n", macro->GetName());
 #endif
 
-//TODO
     // Find the object type of the macro
     mSelObjectType[i] = macro->GetObjectType();
        
@@ -467,7 +537,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
 
     // Collect data for each macro
     for (Int_t i = 0, histoIndex = 0; i < procIterator->GetEntries(); i++){
-//TODO
       // Find the type of the object and relate it to the macro object type
       // Only apply macro to this object, if...
       // ... the macro takes objects of exactly this type.
@@ -498,7 +567,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
           // Skip objects that have not been selected
           if (!object2->GetRnrState())  continue;
 
-//TODO
           // Same check of the macro object type as before
           if (((TObject*)object2->GetUserData())->IsA() != mProcObjectType[i] && 
               !((TObject*)object2->GetUserData())->InheritsFrom(mProcObjectType[i]))  continue;
@@ -511,7 +579,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
           selectedByCorrSelMacro = kTRUE;
           for (Int_t j = 0; j < selIterator->GetEntries(); j++){
             if (mSelType[j] == kCorrelObjectSelect){
-//TODO
           // Check, whether the macro can deal with both objects. If not, skip it.
           // Note: Again, via selCmds[i], the automatic objects are casted to the correct type!
           if (((TObject*)object1->GetUserData())->IsA() != mSelObjectType[j] && 
@@ -567,7 +634,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
           // Skip objects that have not been selected
           if (!object2->GetRnrState())  continue;
 
-//TODO
           // Same check of the macro object type as before
           if (((TObject*)object2->GetUserData())->IsA() != mProcObjectType[i] && 
               !((TObject*)object2->GetUserData())->InheritsFrom(mProcObjectType[i]))  continue;
@@ -580,7 +646,6 @@ Bool_t AliEveListAnalyser::ApplyProcessMacros(const TList* selIterator, const TL
           selectedByCorrSelMacro = kTRUE;
           for (Int_t j = 0; j < selIterator->GetEntries(); j++) {
             if (mSelType[j] == kCorrelObjectSelect) {
-//TODO
               // Check, whether the macro can deal with both objects. If not, skip it.
               // Note: Again, via selCmds[i], the automatic objects are casted to the correct type!
               if (((TObject*)object1->GetUserData())->IsA() != mSelObjectType[j] && 
@@ -710,7 +775,6 @@ void AliEveListAnalyser::ApplySTSelectionMacros(const TList* iterator)
         // If the object has already been deselected, nothing is to do here
         if (!object1->GetRnrState()) continue;
 
-//TODO
         // Find the type of the object and relate it to the macro object type
         // Only apply macro to this object, if...
         // ... the macro takes objects of exactly this type.
@@ -1005,3 +1069,51 @@ void AliEveListAnalyser::RemoveSelectedMacros(const TList* iterator)
     }
   }
 }
+
+//______________________________________________________
+void AliEveListAnalyser::ResetObjectList()
+{
+  // Remove all objects from the list.
+
+  RemoveElements();
+}
+
+//______________________________________________________
+Bool_t AliEveListAnalyser::StartAddingObjects()
+{ 
+  // Start adding objects for the analysis. Returns kTRUE on success.
+
+  if (fConnected == kFALSE)
+  {
+    fConnected = TQObject::Connect("TEvePointSet", "PointSelected(Int_t)", "AliEveListAnalyser", this, "AddObjectToList(Int_t)");
+    //fConnected = TQObject::Connect("TEvePointSet", "Message(char*)", "AliEveListAnalyser", this, "AddObjectToList(char*)");
+    if (fConnected) return kTRUE;
+    
+    Error("AliEveListAnalyser::StartAddingObjects", "Connection failed!");
+  }
+
+  return kFALSE;
+}
+
+//______________________________________________________
+Bool_t AliEveListAnalyser::StopAddingObjects()
+{
+  // Stop adding objects for the analysis. Returns kTRUE on success.
+
+  if (fConnected)
+  {
+    //if (TQObject::Disconnect("TEvePointSet", "AddObjectToList(Char_t*)"))  fConnected = kFALSE;
+    if (TQObject::Disconnect("TEvePointSet", "PointSelected(Int_t)", this, "AddObjectToList(Int_t)"))
+    { 
+      fConnected = kFALSE;
+      return kTRUE;
+    }
+    else
+    {
+      Error("AliEveListAnalyser::StopAddingObjects", "Disconnection failed!");
+      return kFALSE;
+    }
+  }
+
+  return kTRUE;
+}
index 9b5b2dd17737d0dac988ff85622d2412945e517e..52addfeab49f0c9be2d7e17d5fcb721c83765f79 100644 (file)
@@ -77,7 +77,7 @@
 
 #define UNSETBIT(n,i)  ((n) &= ~BIT(i))
 
-//class AliEveTRDTrack;
+
 class AliEveListAnalyserEditor;
 class AliTRDReconstructor;
 class TClass;
@@ -91,6 +91,10 @@ class TPair;
 class TString;
 class TTreeSRedirector;
 
+// TODO - NEW
+class TGLViewer;
+class TEveManager;
+
 class AliEveListAnalyser: public TEveElementList
 {
   friend class AliEveListAnalyserEditor;
@@ -126,11 +130,13 @@ public:
   virtual ~AliEveListAnalyser();
 
   Int_t AddMacro(const Char_t* path, const Char_t* name, Bool_t forceReload = kFALSE);                      
-  Bool_t AddMacroFast(const Char_t* path, const Char_t* name, AliEveListAnalyserMacroType type, TClass* objectType);        
+  Bool_t AddMacroFast(const Char_t* path, const Char_t* name, AliEveListAnalyserMacroType type, TClass* objectType);     
+  void AddObjectToList(Int_t pointId);   
   virtual void AddStandardContent();                           
   Bool_t ApplyProcessMacros(const TList* selIterator, const TList* procIterator);               
   void ApplySTSelectionMacros(const TList* iterator);
-
+  Bool_t GetConnected()             // Returns whether "adding objects by clicking" is enabled or not.
+    { return fConnected;  };
   // Returns the type of the macro of the corresponding entry (i.e. "macro.C (Path: path)"). 
   // If you have only the name and the path, you can simply use MakeMacroEntry.
   // If "UseList" is kTRUE, the type will be looked up in the internal list (very fast). But if this list
@@ -141,15 +147,19 @@ public:
   // Note: AddMacro(Fast) will update the internal list and RemoveProcess(/Selection)Macros respectively.
   AliEveListAnalyserMacroType GetMacroType(const Char_t* name, const Char_t* objectType = "TObject", Bool_t UseList = kTRUE) const; 
   
-  // TODO Documentation
   TClass* GetMacroObjectType(const Char_t* name) const;
-  void RemoveSelectedMacros(const TList* iterator);                                    
+  void RemoveSelectedMacros(const TList* iterator);
+  void ResetObjectList();
+  Bool_t StartAddingObjects();
+  Bool_t StopAddingObjects();
 
-protected:
-  AliEveListAnalyserEditor* fEditor; // Pointer to the editor of this list             
+protected:     
+  Bool_t fConnected;                 // Connection to the TEvePointSet signal
 
   TList* fDataFromMacroList;         // List of macros that currently have data for histograms
 
+  AliEveListAnalyserEditor* fEditor; // Pointer to the editor of this list
+
   TMap*  fMacroList;                 // Stores the names, paths, types and commands of all macros added to this list
 
   TTreeSRedirector *fDataTree;       // Tree containing data for histograms
index 30013e6dd7776e7df817cdf335c33a25e500239a..e96ffbcdff8a7d975a06604acffdeff32df46b21 100644 (file)
@@ -65,15 +65,19 @@ AliEveListAnalyserEditor::AliEveListAnalyserEditor(const TGWindow* p, Int_t widt
   fHistoCanvasName(0),
   fInheritedMacroList(0),
   fInheritSettings(kFALSE),
-  fMainFrame(0),
+  fBrowseFrame(0),
   fHistoFrame(0),
   fHistoSubFrame(0),
-  fBrowseFrame(0),
+  fMainFrame(0),
+  fObjectFrame(0),  
+  fbApplyMacros(0),
   fbBrowse(0),
+  fbDrawHisto(0),
   fbNew(0),
-  fbApplyMacros(0),
   fbRemoveMacros(0),
-  fbDrawHisto(0),
+  fbReset(0),
+  fbStart(0),
+  fbStop(0),
   fteField(0),
   ftlMacroList(0),
   ftlMacroSelList(0),
@@ -85,6 +89,24 @@ AliEveListAnalyserEditor::AliEveListAnalyserEditor(const TGWindow* p, Int_t widt
 {
   // Creates the AliEveListAnalyserEditor.
 
+  // Functionality for adding objects
+  fObjectFrame = CreateEditorTabSubFrame("List");
+
+  fbStart = new TGTextButton(fObjectFrame, "Start");
+  fObjectFrame->AddFrame(fbStart, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 3, 1));
+  fbStart->SetToolTipText("Start \"adding objects by clicking\":\nSimply hold ALT+CTRL and left-click an item in the viewer with your mouse\nto add this item to the list analyser.\nIf you click (in this way!) an item that is already in the list, it will be removed from it.\nNote: The key combination depends on your operating system!");
+  fbStart->Connect("Clicked()", "AliEveListAnalyserEditor", this, "DoStartAddingObjects()");
+
+  fbReset = new TGTextButton(fObjectFrame, "Reset");
+  fObjectFrame->AddFrame(fbReset, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 1));
+  fbReset->SetToolTipText("Remove all objects from the list");
+  fbReset->Connect("Clicked()", "AliEveListAnalyserEditor", this, "DoResetObjectList()");
+
+  fbStop = new TGTextButton(fObjectFrame, "Stop");
+  fObjectFrame->AddFrame(fbStop, new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 4, 1, 1, 4));
+  fbStop->SetToolTipText("Stop \"adding objects by clicking\"");
+  fbStop->Connect("Clicked()", "AliEveListAnalyserEditor", this, "DoStopAddingObjects()");
+
   // Functionality for adding macros  
   fMainFrame = CreateEditorTabSubFrame("Process");
    
@@ -357,6 +379,41 @@ void AliEveListAnalyserEditor::CloseTabs()
   }
 }
 
+//______________________________________________________
+void AliEveListAnalyserEditor::DoResetObjectList()
+{
+  fM->ResetObjectList();
+  Update();
+}
+
+//______________________________________________________
+void AliEveListAnalyserEditor::DoStartAddingObjects()
+{
+  if (fM->StartAddingObjects())
+  {
+    fbStart->SetState(kButtonDisabled);
+    fbStop->SetState(kButtonUp);
+  }
+  else
+  {
+    new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", "Failed to connect socket!", kMBIconExclamation, kMBOk);
+  }
+}
+
+//______________________________________________________
+void AliEveListAnalyserEditor::DoStopAddingObjects()
+{
+  if (fM->StopAddingObjects())
+  {
+    fbStop->SetState(kButtonDisabled);
+    fbStart->SetState(kButtonUp);
+  }
+  else
+  {
+    new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", "Failed to disconnect socket!", kMBIconExclamation, kMBOk);
+  }
+}
+
 //______________________________________________________
 void AliEveListAnalyserEditor::DrawHistos()
 {
@@ -835,6 +892,19 @@ void AliEveListAnalyserEditor::SetModel(TObject* obj)
 
   // View correct tab
   GetGedEditor()->GetTab()->SetTab(fM->GetSelectedTab()); 
+
+  // Set connection buttons correctly
+  if(fM->GetConnected())
+  {
+    fbStart->SetState(kButtonDisabled);
+    fbStop->SetState(kButtonUp);
+  }
+  else
+  {
+    fbStop->SetState(kButtonDisabled);
+    fbStart->SetState(kButtonEngaged);
+    fbStart->SetState(kButtonUp);
+  }
 }
 
 //______________________________________________________
@@ -971,12 +1041,13 @@ ClassImp(AliEveGeneralMacroWizard)
 //______________________________________________________
 AliEveGeneralMacroWizard::AliEveGeneralMacroWizard(const TGWindow* p)
   :TGMainFrame(p ? p : gClient->GetRoot(), 10, 10, kMainFrame | kVerticalFrame)
-  ,fTextName(0x0)
-  ,fTextObjectType(0x0)
+  ,fbCancel(0x0)
+  ,fbCreate(0x0)
   ,fCombo(0x0)
   ,fTextEdit(0x0)
-  ,fbCreate(0x0)
-  ,fbCancel(0x0)
+  ,fTextIncludes(0x0)
+  ,fTextName(0x0)  
+  ,fTextObjectType(0x0)
 {
   const Int_t width = 300;
 
@@ -1005,7 +1076,6 @@ AliEveGeneralMacroWizard::AliEveGeneralMacroWizard(const TGWindow* p)
   fFrameObjectType->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
 
   fTextObjectType = new TGTextEntry(fFrameObjectType);
-  fTextObjectType->SetMaxLength(255);
   fTextObjectType->SetAlignment(kTextLeft);
   fTextObjectType->SetText("");
   // Limit max.length to 80 characters
@@ -1014,6 +1084,22 @@ AliEveGeneralMacroWizard::AliEveGeneralMacroWizard(const TGWindow* p)
   fTextObjectType->Resize(width, fTextObjectType->GetDefaultHeight());
   fFrameObjectType->AddFrame(fTextObjectType, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2));
 
+  // horizontal frame
+  TGHorizontalFrame *fFrameIncludes = new TGHorizontalFrame(this,10,10,kHorizontalFrame);
+  fLabel = new TGLabel(fFrameIncludes, "Include files");
+  fLabel->SetTextJustify(36);
+  fLabel->SetMargins(0,0,0,0);
+  fLabel->SetWrapLength(-1);
+  fFrameIncludes->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
+
+  fTextIncludes = new TGTextEntry(fFrameIncludes);
+  fTextObjectType->SetAlignment(kTextLeft);
+  fTextIncludes->SetText("<TRD/AliTRDgeometry.h>,<TRD/AliTRDcluster.h>,<TRD/AliTRDseedV1.h>,<TRD/AliTRDtrackV1.h>");
+  fTextIncludes->SetCursorPosition(0);
+  fTextIncludes->SetToolTipText("The include files for your macro - separated by commas! -\n e.g. \"<TRD/AliTRDcluster.h>,<TRD/AliTRDtrackV1.h>\".\nThe suggested/default files can be used for track analysis");
+  fTextIncludes->Resize(width, fTextIncludes->GetDefaultHeight());
+  fFrameIncludes->AddFrame(fTextIncludes, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2));
+
   // horizontal frame
   TGHorizontalFrame *fFrameComment = new TGHorizontalFrame(this,10,10,kHorizontalFrame);
   fLabel = new TGLabel(fFrameComment, "Comment");
@@ -1053,7 +1139,6 @@ AliEveGeneralMacroWizard::AliEveGeneralMacroWizard(const TGWindow* p)
   fbCreate->SetToolTipText("Use settings to create the macro");
   fFrameAction->AddFrame(fbCreate, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2)); 
 
-
   // horizontal frame
   TGHorizontalFrame *fFrameText = new TGHorizontalFrame(this,10,10,kHorizontalFrame);
   fLabel = new TGLabel(fFrameText, "(*) Mandatory fields");
@@ -1065,6 +1150,7 @@ AliEveGeneralMacroWizard::AliEveGeneralMacroWizard(const TGWindow* p)
   // put things together  
   AddFrame(fFrameName, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
   AddFrame(fFrameObjectType, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
+  AddFrame(fFrameIncludes, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
   AddFrame(fFrameComment, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
   AddFrame(fFrameType, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
   AddFrame(fFrameAction, new TGLayoutHints(kLHintsRight | kLHintsTop | kLHintsExpandX,2,2,2,2));
@@ -1084,7 +1170,6 @@ AliEveGeneralMacroWizard::AliEveGeneralMacroWizard(const TGWindow* p)
   MapWindow();
 
   // Do the linking
-  //fCombo->Connect("Selected(Int_t)", "AliEveGeneralMacroWizard", this, "Create(Int_t)");
   fbCreate->Connect("Clicked()", "AliEveGeneralMacroWizard", this, "HandleCreate()");
   fbCancel->Connect("Clicked()", "AliEveGeneralMacroWizard", this, "CloseWindow()");
 
@@ -1093,15 +1178,9 @@ AliEveGeneralMacroWizard::AliEveGeneralMacroWizard(const TGWindow* p)
 }  
 
 const Char_t *fGeneralIncludes = 
-// TODO: Remove include files corresponding to a track list
 "#if !defined(__CINT__) || defined(__MAKECINT__)\n"
 "#include <TROOT.h>\n"
-"#include <TH1.h>\n"
-"#include <TRD/AliTRDgeometry.h>\n"
-"#include <TRD/AliTRDcluster.h>\n"
-"#include <TRD/AliTRDseedV1.h>\n"
-"#include <TRD/AliTRDtrackV1.h>\n"
-"#endif\n";
+"#include <TH1.h>\n";
 
 const Char_t *fGeneralMacroTemplate[7] = {
 ""
@@ -1145,79 +1224,6 @@ const Char_t *fGeneralMacroTemplate[7] = {
 "  } else h->Reset();\n"
 };
 
-
-//TODO: Needed?
-/*
-const Char_t *fGeneralMacroTemplate_WithType[7] = {
-""
-,"  if (!object) return kFALSE;\n"
-"  if (object->IsA() != OBJECTTYPE::Class()) return kFALSE;\n\n"
-"  const OBJECTTYPE* myObject = dynamic_cast<const OBJECTTYPE*>(object);\n" 
-"  if (!myObject) return kFALSE;\n"
-
-,"  n = 0;\n"
-"  r = 0x0;\n"
-"  if (!object) return;\n"
-"  if (object->IsA() != OBJECTTYPE::Class()) return;\n\n"
-"  const OBJECTTYPE* myObject = dynamic_cast<const OBJECTTYPE*>(object);\n" 
-"  if (!myObject) return;\n"
-
-,"  if (!object) return 0x0;\n"
-"  if (object->IsA() != OBJECTTYPE::Class()) return 0x0;\n\n"
-"  const OBJECTTYPE* myObject = dynamic_cast<const OBJECTTYPE*>(object);\n" 
-"  if (!myObject) return 0x0;\n\n"
-"  TH1* h = 0x0;\n\n"
-"// Set bins, xmin and xmax here\n"
-"  Int_t n = 1;\n"
-"  Double_t xmin = 0;\n"
-"  Double_t xmax = 100;\n\n" 
-"  if(!(h = (TH1*)gROOT->FindObject(\"h\"))){\n"
-"    h = new TH1(\"h\", \"Title\", n, xmin, xmax);\n"
-"    h->GetXaxis()->SetTitle("");\n"
-"    h->GetYaxis()->SetTitle("");\n"
-"  } else h->Reset();\n"
-
-,"  if (!object) return kFALSE;\n"
-"  if (!object2) return kFALSE;\n"
-"  if (object->IsA() != OBJECTTYPE::Class()) return kFALSE;\n"
-"  if (object2->IsA() != OBJECTTYPE::Class()) return kFALSE;\n\n"
-"  const OBJECTTYPE* myObject = dynamic_cast<const OBJECTTYPE*>(object);\n"
-"  const OBJECTTYPE* myObject2 = dynamic_cast<const OBJECTTYPE*>(object2);\n" 
-"  if (!myObject) return kFALSE;\n"
-"  if (!myObject2) return kFALSE;\n"
-
-,"  n = 0;\n"
-"  r = 0x0;\n"
-"  if (!object) return;\n"
-"  if (!object2) return;\n"
-"  if (object->IsA() != OBJECTTYPE::Class()) return;\n"
-"  if (object2->IsA() != OBJECTTYPE::Class()) return;\n\n"
-"  const OBJECTTYPE* myObject = dynamic_cast<const OBJECTTYPE*>(object);\n"
-"  const OBJECTTYPE* myObject2 = dynamic_cast<const OBJECTTYPE*>(object2);\n" 
-"  if (!myObject) return;\n"
-"  if (!myObject2) return;\n"
-
-,"  if (!object) return 0x0;\n"
-"  if (!object2) return 0x0;\n"
-"  if (object->IsA() != OBJECTTYPE::Class()) return 0x0;\n"
-"  if (object2->IsA() != OBJECTTYPE::Class()) return 0x0;\n\n"
-"  const OBJECTTYPE* myObject = dynamic_cast<const OBJECTTYPE*>(object);\n"
-"  const OBJECTTYPE* myObject2 = dynamic_cast<const OBJECTTYPE*>(object2);\n" 
-"  if (!myObject) return 0x0;\n"
-"  if (!myObject2) return 0x0;\n"
-"  TH1* h = 0x0;\n\n"
-"// Set bins, xmin and xmax here\n"
-"  Int_t n = 1;\n"
-"  Double_t xmin = 0;\n"
-"  Double_t xmax = 100;\n\n" 
-"  if(!(h = (TH1*)gROOT->FindObject(\"h\"))){\n"
-"    h = new TH1(\"h\", \"Title\", n, xmin, xmax);\n"
-"    h->GetXaxis()->SetTitle("");\n"
-"    h->GetYaxis()->SetTitle("");\n"
-"  } else h->Reset();\n"
-};
-*/
-
 //______________________________________________________
 void AliEveGeneralMacroWizard::Create(Int_t type)
 {
@@ -1227,7 +1233,6 @@ void AliEveGeneralMacroWizard::Create(Int_t type)
     Error("AliEveGeneralMacroWizard::Create", "Please specify a name for your macro.");
     new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", 
                  "Please specify a name for your macro.", kMBIconExclamation, kMBOk);
-    //fCombo->Select(-1);
     return;
   }
 
@@ -1276,7 +1281,6 @@ void AliEveGeneralMacroWizard::Create(Int_t type)
     Error("AliEveGeneralMacroWizard::Create", Form("A macro \"%s.C\" already exists in the current directory!\nPlease choose another name!", name));
     new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", 
                  Form("A macro \"%s.C\" already exists in the current directory!\nPlease choose another name!", name), kMBIconExclamation, kMBOk);
-    //fCombo->Select(-1);
     return;
   }
 
@@ -1285,7 +1289,6 @@ void AliEveGeneralMacroWizard::Create(Int_t type)
     Error("AliEveGeneralMacroWizard::Create", "Couldn't create macro file.");
     new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", 
                  "Couldn't create macro file.", kMBIconExclamation, kMBOk);
-    //fCombo->Select(-1);
     return;
   }
 
@@ -1293,10 +1296,20 @@ void AliEveGeneralMacroWizard::Create(Int_t type)
   Char_t* line = 0x0; Int_t iline = 0;
   while((line = comment->GetLine(TGLongPosition(0,iline++), 200))) fprintf(fp, "// %s\n", line);
 
-  fprintf(fp, "\n%s\n", fGeneralIncludes);
-
   TString* tempStr = new TString();
 
+  // Add include files:
+  // Remove white-spaces and replace commas
+  tempStr->Append(fTextIncludes->GetText());  
+  tempStr->ReplaceAll(" ", "");
+  tempStr->ReplaceAll(",","\n#include ");
+  // If there are files, add the first "#include " in front
+  if (tempStr->Length() > 3)  tempStr->Prepend("#include "); 
+
+  fprintf(fp, "\n%s%s\n#endif\n\n", fGeneralIncludes, tempStr->Data());
+  
+  tempStr->Clear();
+
   // Use default type
   if (!useGivenType)
   {
@@ -1341,7 +1354,6 @@ void AliEveGeneralMacroWizard::Create(Int_t type)
                  Form("Unknown type[%d]", type), kMBIconExclamation, kMBOk);
     fclose(fp);
     gSystem->Exec(Form("rm -f %s.C", name));
-    //fCombo->Select(-1);
 
     tempStr->Clear();
     if (tempStr != 0) delete tempStr;
@@ -1362,31 +1374,8 @@ void AliEveGeneralMacroWizard::Create(Int_t type)
   if (typeStr != 0) delete typeStr;
   typeStr = 0;
 
-//TODO: Version below?!
   fprintf(fp, "{\n%s\n", fGeneralMacroTemplate[type]);
-/*      
-  if (useGivenType)
-  {
-    // Replace "OBJECTTYPE" with the class name
-    TString* tempStr = new TString();
-    tempStr->Append(fGeneralMacroTemplate_WithType[type]);
-
-    tempStr->ReplaceAll("OBJECTTYPE", fTextObjectType->GetText());
-
-    fprintf(fp, "{\n%s\n", tempStr->Data());
 
-    if (tempStr != 0)
-    {
-      tempStr->Clear();
-      delete tempStr;
-      tempStr = 0;
-    }
-  }
-  else
-  {
-    fprintf(fp, "{\n%s\n", fGeneralMacroTemplate[type]);
-  }
-*/
   fprintf(fp, "// add your own code here\n\n\n}\n");
   fclose(fp);
 
index 66cda472d207f4c02cae72d39e4162647617088a..b216ef11a79a7d9a820794df165796bb6e2e5838 100644 (file)
@@ -73,6 +73,9 @@ public:
   void    ApplyMacros();
   void    BrowseMacros();
   void    CloseTabs();
+  void    DoResetObjectList();
+  void    DoStartAddingObjects();
+  void    DoStopAddingObjects();
   void    DrawHistos();
   Int_t   GetNSelectedHistograms() const;
   void    HandleMacroPathSet();
@@ -96,6 +99,10 @@ private:
   AliEveListAnalyserEditor(const AliEveListAnalyserEditor&);            // Not implemented
   AliEveListAnalyserEditor& operator=(const AliEveListAnalyserEditor&); // Not implemented 
 
+  // Help functions
+  void SetDrawingToHistoCanvasTab();        
+  void UpdateHistoCanvasTab();             
+
   TCanvas*          fHistoCanvas;            // Canvas for the histograms
   TGString*         fHistoCanvasName;        // Name of the histogram canvas
 
@@ -104,16 +111,20 @@ private:
   Bool_t            fInheritSettings;        // Flag indicating, whether the macro list will be inherited from
                                              // the previously loaded analyse object list within the next call of SetModel
 
-  TGVerticalFrame*   fMainFrame;             // Top frame for macro functionality.
+  TGHorizontalFrame* fBrowseFrame;           // Frame for features corresponding to searching macros
   TGVerticalFrame*   fHistoFrame;            // Top frame for the histogram stuff
   TGVerticalFrame*   fHistoSubFrame;         // Frame for the histogram buttons themselves
-  TGHorizontalFrame* fBrowseFrame;           // Frame for features corresponding to searching macros
-
-  TGTextButton*   fbBrowse;                  // "Browse" button
-  TGTextButton*   fbNew;                     // "New" button
+  TGVerticalFrame*   fMainFrame;             // Top frame for macro functionality.
+  TGVerticalFrame*   fObjectFrame;           // Frame for features corresponding to adding objects to the list
+  
   TGTextButton*   fbApplyMacros;             // "Apply macros" button
-  TGTextButton*   fbRemoveMacros;            // "Remove macros" button
+  TGTextButton*   fbBrowse;                  // "Browse" button
   TGTextButton*   fbDrawHisto;               // "Draw histogram" button
+  TGTextButton*   fbNew;                     // "New" button  
+  TGTextButton*   fbRemoveMacros;            // "Remove macros" button
+  TGTextButton*   fbReset;                   // "Reset" (list of added objects) button
+  TGTextButton*   fbStart;                   // "Start" (adding objects to list) button
+  TGTextButton*   fbStop;                    // "Stop" (adding objects to list) button
   TGTextEntry*    fteField;                  // Text field to insert macro path manually
   TGListBox*      ftlMacroList;              // To display the list of (process) macros
   TGListBox*      ftlMacroSelList;           // To display the list of (selection) macros
@@ -133,11 +144,7 @@ private:
   TGHorizontal3DLine *fLine3;
   TGHorizontal3DLine *fLine4; 
 
-  TGCheckButton** fCheckButtons;            // Check buttons for histograms
-
-  // Help functions
-  void SetDrawingToHistoCanvasTab();        
-  void UpdateHistoCanvasTab();              
+  TGCheckButton** fCheckButtons;            // Check buttons for histograms 
 
   ClassDef(AliEveListAnalyserEditor, 0);    // Editor for AliEveListAnalyser.
 };
@@ -165,12 +172,13 @@ private:
   AliEveGeneralMacroWizard(const AliEveGeneralMacroWizard&);
   AliEveGeneralMacroWizard& operator=(const AliEveGeneralMacroWizard&);
 
-  TGTextEntry *fTextName;
-  TGTextEntry *fTextObjectType;
-  TGComboBox  *fCombo;
-  TGTextEdit  *fTextEdit;
-  TGTextButton *fbCreate;                  // "Done" button
   TGTextButton *fbCancel;                  // "Cancel" button
+  TGTextButton *fbCreate;                  // "Done" button
+  TGComboBox  *fCombo;                     // "Type"
+  TGTextEdit  *fTextEdit;                  // "Comments"
+  TGTextEntry  *fTextIncludes;             // "Includes"
+  TGTextEntry *fTextName;                  // "Name"
+  TGTextEntry *fTextObjectType;            // "ObjectType"  
   
   ClassDef(AliEveGeneralMacroWizard, 0);      // Helper class to create macro templates 
 };