]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/macros/alieve_init.C
avoid refitting the tracklet but use the values calculated during
[u/mrichter/AliRoot.git] / EVE / macros / alieve_init.C
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 void alieve_init(const Text_t* path   = ".", Int_t event=0,
11                  const Text_t* esdfile = 0,
12                  const Text_t* aodfile = 0,
13                  const Text_t* rawfile = 0,
14                  const Text_t* cdburi  = 0,
15                  Bool_t assert_runloader = kFALSE,
16                  Bool_t assert_esd       = kFALSE,
17                  Bool_t assert_aod       = kFALSE,
18                  Bool_t assert_raw       = kFALSE)
19 {
20   Info("alieve_init", "Adding standard macros.");
21   TString  hack = gSystem->pwd(); // Problem with TGFileBrowser cding
22   alieve_init_import_macros();
23   gSystem->cd(hack);
24
25   alieve_init_basic_vizdb();
26   // Temporarily assert also default vizdb.
27   TEveUtil::AssertMacro("VizDB_scan.C");
28
29   gSystem->ProcessEvents();
30
31   AliEveEventManager::SetESDFileName(esdfile);
32   AliEveEventManager::SetRawFileName(rawfile);
33   AliEveEventManager::SetCdbUri(cdburi);
34   AliEveEventManager::SetAssertElements(assert_runloader, assert_esd,
35                                         assert_aod, assert_raw);
36
37   // Open event
38   if (path != 0)
39   {
40     Info("alieve_init", "Opening event %d from '%s' ...", event, path);
41     TString name("Event"); // CINT has trouble with direct "Event".
42     new AliEveEventManager(name, path, event);
43     gEve->AddEvent(AliEveEventManager::GetMaster());
44   }
45 }
46
47 void alieve_init_import_macros()
48 {
49   // Put macros in the list of browsables, add a macro browser to
50   // top-level GUI.
51
52   TString macdir("$(ALICE_ROOT)/EVE/alice-macros");
53   gSystem->ExpandPathName(macdir);
54
55   TFolder* f = gEve->GetMacroFolder();
56   void* dirhandle = gSystem->OpenDirectory(macdir.Data());
57   if (dirhandle != 0)
58   {
59     char* filename;
60     TPMERegexp re("\\.C$");
61     std::list<string> names; // This form understood by cint (fails with std::string).
62     while ((filename = gSystem->GetDirEntry(dirhandle)) != 0)
63     {
64       if (re.Match(filename))
65         names.push_back(filename);
66     }
67     names.sort();
68     //PH The line below is replaced waiting for a fix in Root
69     //PH which permits to use variable siza arguments in CINT
70     //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
71     // f->Add(new TEveMacro(Form("%s/%s", macdir.Data(), filename)));
72     char fullName[1000];
73     for (std::list<string>::iterator si=names.begin(); si!=names.end(); ++si)
74     {
75       sprintf(fullName,"%s/%s", macdir.Data(), si->c_str());
76       f->Add(new TEveMacro(fullName));
77     }
78   }
79   gSystem->FreeDirectory(dirhandle);
80
81   gROOT->GetListOfBrowsables()->Add
82     // (new TSystemDirectory("alice-macros", macdir.Data())); // !!!! this spits blood, but then works
83     (new TSystemDirectory(macdir.Data(), macdir.Data()));
84
85   {
86     TEveBrowser   *br = gEve->GetBrowser();
87     TGFileBrowser *fb = 0;
88     fb = br->GetFileBrowser();
89     fb->GotoDir(macdir);
90     {
91       br->StartEmbedding(0);
92       fb = br->MakeFileBrowser();
93       fb->BrowseObj(f);
94       fb->Show();
95       br->StopEmbedding();
96       br->SetTabTitle("Macros", 0);
97       br->SetTab(0, 0);
98     }
99   }
100 }
101
102 void alieve_init_basic_vizdb()
103 {
104   TEvePointSet* ps;
105
106   ps = new TEvePointSet();
107   ps->SetMarkerColor(4);
108   ps->SetMarkerSize(0.2);
109   ps->SetMarkerStyle(2);
110   gEve->InsertVizDBEntry("Clusters", ps);
111 }