1 // Author: Benjamin Hess 29/01/2010
3 /*************************************************************************
4 * Copyright (C) 2009-2010, Alexandru Bercuci, Benjamin Hess. *
5 * All rights reserved. *
6 *************************************************************************/
8 //////////////////////////////////////////////////////////////////////////
10 // AliEveTRDTrackListEditor //
12 // The AliEveTRDTrackListEditor provides the graphical functionality //
13 // for the AliEveTRDTrackList. It creates the tabs and canvases, when //
14 // they are needed and, as well, frees allocated memory on destruction //
15 // (or if new events are loaded and thus some tabs are closed). //
16 // The function DrawHistos() accesses the temporary file created by the //
17 // AliEveTRDTrackList and draws the desired data (the file will be //
18 // created within the call of ApplyMacros()). Have a look at this //
19 // function to learn more about the structure of the file and how to //
20 // access the data. //
21 //////////////////////////////////////////////////////////////////////////
23 #include <EveDet/AliEveTRDData.h>
24 #include <EveDet/AliEveTRDTrackList.h>
25 #include "AliEveTRDTrackListEditor.h"
27 #include <EveBase/AliEveEventManager.h>
28 #include <AliTRDReconstructor.h>
29 #include <AliTRDtrackV1.h>
32 #include <TEveBrowser.h>
33 #include <TEveGedEditor.h>
34 #include <TEveMacro.h>
35 #include <TEveManager.h>
38 #include <TGButtonGroup.h>
39 #include <TGFileDialog.h>
41 #include <TGListBox.h>
45 #include <TObjString.h>
48 #include <TGTextEntry.h>
49 #include <TGTextEdit.h>
50 #include <TGComboBox.h>
51 #include <TGTextView.h>
53 #include <TTreeStream.h>
56 ClassImp(AliEveTRDTrackListEditor)
58 ///////////////////////////////////////////////////////////
59 ///////////// AliEveTRDTrackListEditor //////////////////
60 ///////////////////////////////////////////////////////////
61 AliEveTRDTrackListEditor::AliEveTRDTrackListEditor(const TGWindow* p, Int_t width, Int_t height,
62 UInt_t options, Pixel_t back) :
63 TGedFrame(p, width, height, options, back),
67 fInheritedMacroList(0),
68 fInheritSettings(kFALSE),
76 frbColor(new TGRadioButton*[3]),
77 frbTrack(new TGRadioButton*[3]),
88 fLabel1(0), fLabel2(0), fLabel3(0), fLabel4(0),
89 fLine1(0), fLine2(0), fLine3(0), fLine4(0), fLine5(0),
92 // Creates the AliEveTRDTrackListEditor.
95 fLine5 = new TGHorizontal3DLine(this, 194, 8);
96 AddFrame(fLine5, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 8));
97 fStyleFrame = new TGHorizontalFrame(this);
98 AddFrame(fStyleFrame);
100 // Style - Track model
101 fbgStyleTrack = new TGButtonGroup(fStyleFrame, "Track model");
102 fbgStyleTrack->SetMapSubwindows(kTRUE);
103 fbgStyleTrack->Resize(194, 200);
104 fStyleFrame->AddFrame(fbgStyleTrack);
106 frbTrack[0] = new TGRadioButton(fbgStyleTrack, "Rieman", 0);
107 frbTrack[0]->SetToolTipText("Set the track model to \"Rieman\" (i.e. the used fit method)");
108 frbTrack[1] = new TGRadioButton(fbgStyleTrack, "Kalman", 1);
109 frbTrack[1]->SetToolTipText("Set the track model to \"Kalman\" (i.e. the used fit method)");
110 frbTrack[2] = new TGRadioButton(fbgStyleTrack, "Line", 2);
111 frbTrack[2]->SetToolTipText("Set the track model to \"Line\" (i.e. the used fit method)");
113 // Style - Color model
114 fbgStyleColor = new TGButtonGroup(fStyleFrame, "Color model");
115 fbgStyleColor->SetMapSubwindows(kTRUE);
116 fbgStyleColor->Resize(194, 200);
117 fStyleFrame->AddFrame(fbgStyleColor);
119 frbColor[0] = new TGRadioButton(fbgStyleColor, "PID LQ", 0);
120 frbColor[0]->SetToolTipText("Set color model to \"PID LQ\" -> 2 dimensional likelihood particle identification");
121 frbColor[1] = new TGRadioButton(fbgStyleColor, "PID NN", 1);
122 frbColor[1]->SetToolTipText("Set color model to \"PID NN\" -> Neural network particle identification");
123 frbColor[2] = new TGRadioButton(fbgStyleColor, "ESD Source", 2);
124 frbColor[2]->SetToolTipText("Set color model to \"ESD Source\" -> By source (TPC track prolongation or TRD stand alone)");
126 // Functionality for adding plugins
127 fMainFrame = CreateEditorTabSubFrame("Process");
129 fLabel1 = new TGLabel(fMainFrame,"Add plugin(s):");
130 fMainFrame->AddFrame(fLabel1);
131 fBrowseFrame = new TGHorizontalFrame(fMainFrame);
133 fteField = new TGTextEntry(fBrowseFrame);
134 fteField->SetToolTipText("Enter the pathname of the macro you want to add here and press \"Enter\"");
135 fteField->Connect("ReturnPressed()","AliEveTRDTrackListEditor", this, "HandleMacroPathSet()");
136 fBrowseFrame->AddFrame(fteField);
138 fbBrowse = new TGTextButton(fBrowseFrame, "Browse");
139 fbBrowse->SetToolTipText("Browse the macro you want to add");
140 fbBrowse->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "BrowseMacros()");
141 fBrowseFrame->AddFrame(fbBrowse);
143 fbNew = new TGTextButton(fBrowseFrame, "New");
144 fbNew->SetToolTipText("Start macro creation wizard");
145 fbNew->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "NewMacros()");
146 fBrowseFrame->AddFrame(fbNew);
147 fMainFrame->AddFrame(fBrowseFrame);
149 fLine1 = new TGHorizontal3DLine(fMainFrame, 194, 8);
150 fMainFrame->AddFrame(fLine1, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2));
151 fLabel2 = new TGLabel(fMainFrame,"Selection plugins:");
152 fMainFrame->AddFrame(fLabel2);
154 ftlMacroSelList = new TGListBox(fMainFrame);
155 ftlMacroSelList->Resize(194, 94);
156 ftlMacroSelList->SetMultipleSelections(kTRUE);
157 fMainFrame->AddFrame(ftlMacroSelList);
159 fLine2 = new TGHorizontal3DLine(fMainFrame, 194, 8);
160 fMainFrame->AddFrame(fLine2, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2));
161 fLabel3 = new TGLabel(fMainFrame,"Process plugins:");
162 fMainFrame->AddFrame(fLabel3);
164 ftlMacroList = new TGListBox(fMainFrame);
165 ftlMacroList->Resize(194, 94);
166 ftlMacroList->SetMultipleSelections(kTRUE);
167 fMainFrame->AddFrame(ftlMacroList);
169 fLine3 = new TGHorizontal3DLine(fMainFrame, 194, 8);
170 fMainFrame->AddFrame(fLine3, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2));
172 fbApplyMacros = new TGTextButton(fMainFrame, "Apply plugin(s)");
173 fbApplyMacros->SetToolTipText("Apply all selected macros/class functins to the list of tracks -> A data file will be generated");
174 fbApplyMacros->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "ApplyMacros()");
175 fbApplyMacros->SetRightMargin(12);
176 fMainFrame->AddFrame(fbApplyMacros);
178 fbRemoveMacros = new TGTextButton(fMainFrame, "Remove plugin(s)");
179 fbRemoveMacros->SetToolTipText("Remove the selected macros/class functions from the list(s)");
180 fbRemoveMacros->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "RemoveMacros()");
181 fMainFrame->AddFrame(fbRemoveMacros);
183 // Stuff for displaying histograms
184 fHistoFrame = CreateEditorTabSubFrame("Results");
185 fHistoFrame->SetMapSubwindows(kTRUE);
186 fLabel4 = new TGLabel(fHistoFrame,"Data from plugins:");
187 fHistoFrame->AddFrame(fLabel4);
189 fHistoSubFrame = new TGVerticalFrame(fHistoFrame);
190 fHistoSubFrame->SetMapSubwindows(kTRUE);
191 fHistoSubFrame->Resize(194, 200);
192 fHistoFrame->AddFrame(fHistoSubFrame);
194 fLine4 = new TGHorizontal3DLine(fHistoFrame, 194, 8);
195 fHistoFrame->AddFrame(fLine4, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2));
197 fbDrawHisto = new TGTextButton(fHistoFrame, "Draw projections");
198 fbDrawHisto->SetToolTipText("Uses the data file created by the last \"Apply selected plugin(s)\".\nClick here to display the data histograms of the selected macros.\nSelect multiple macros to create multi-dimensional plots.\nHisto macros cannot be used for multi-dimensional plots!");
199 fbDrawHisto->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "DrawHistos()");
200 fHistoFrame->AddFrame(fbDrawHisto);
202 // Set up file dialog
203 fFileInfo = new TGFileInfo();
204 fFileInfo->SetMultipleSelection(kTRUE);
206 fFileTypes = new Char_t*[6];
207 fFileTypes[0] = (Char_t*)"All files"; fFileTypes[1] = (Char_t*)"*";
208 fFileTypes[2] = (Char_t*)"ROOT macros"; fFileTypes[3] = (Char_t*)"*.C";
209 fFileTypes[4] = 0; fFileTypes[5] = 0;
210 fFileInfo->fFileTypes = (const Char_t**)fFileTypes;
211 fFileInfo->fFileTypeIdx = 2;
212 fFileInfo->fMultipleSelection = kTRUE;
214 fHistoCanvasName = new TGString("");
216 // Handle style changed signals:
217 fbgStyleTrack->Connect("Clicked(Int_t)", "AliEveTRDTrackListEditor", this, "SetTrackModel(Int_t)");
218 fbgStyleColor->Connect("Clicked(Int_t)", "AliEveTRDTrackListEditor", this, "SetTrackColor(Int_t)");
220 // Handle the signal "Selected(Int_t ind)"
221 ftlMacroList->Connect("Selected(Int_t)", "AliEveTRDTrackListEditor", this, "UpdateMacroListSelection(Int_t)");
222 ftlMacroSelList->Connect("Selected(Int_t)", "AliEveTRDTrackListEditor", this, "UpdateMacroListSelection(Int_t)");
224 // Handle the signal "NewEventLoaded"
225 AliEveEventManager::GetMaster()->Connect("NewEventLoaded()", "AliEveTRDTrackListEditor", this, "HandleNewEventLoaded()");
227 // Handle the signal "Selected" (another tab has been selected)
228 GetGedEditor()->GetTab()->Connect("Selected(Int_t)", "AliEveTRDTrackListEditor", this, "HandleTabChangedToIndex(Int_t)");
231 //______________________________________________________
232 AliEveTRDTrackListEditor::~AliEveTRDTrackListEditor()
234 // Destructor: Closes all tabs created by this object and
235 // frees the corresponding memory.
239 delete [] fFileTypes;
248 // Close and delete all tabs that have been created by this class
251 if (fHistoCanvasName != 0)
253 delete fHistoCanvasName;
254 fHistoCanvasName = 0;
256 if (fInheritedMacroList != 0)
258 fInheritedMacroList->Delete();
259 delete fInheritedMacroList;
260 fInheritedMacroList = 0;
264 //______________________________________________________
265 void AliEveTRDTrackListEditor::AddMacro(const Char_t* name, const Char_t* path)
267 // Adds the macro path/name to the macro list. A warning is provided, if there is
268 // something wrong, e.g. if the macro does not have the correct signature.
269 Int_t result = fM->AddMacro(path, name);
277 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Warning", "Macro is already in list (won't be added again)!",
278 kMBIconExclamation, kMBOk);
281 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", "Failed to load the macro (check messages in the terminal)!",
282 kMBIconExclamation, kMBOk);
284 case SIGNATURE_ERROR:
285 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
286 "Macro has not the signature of...\n...a single track selection macro: Bool_t YourMacro(const AliTRDtrackV1*)\n...a correlated tracks selection macro: Bool_t YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*)\n...a single track analyse macro: void YourMacro(const AliTRDtrackV1*, Double_t*&, Int_t&)\n...a correlated tracks analyse macro: void YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*, Double_t*&, Int_t&)\n...a single track histo macro: TH1* YourMacro(const AliTRDtrackV1*)\n...a correlated tracks histo macro: TH1* YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*)",
287 kMBIconExclamation, kMBOk);
289 case NOT_EXIST_ERROR:
290 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
291 "File does not exist or you do not have read permission!", kMBIconExclamation, kMBOk);
294 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
295 Form("AliEveTRDTrackList::AddMacro exited with unknown return value: %d", result),
296 kMBIconExclamation, kMBOk);
301 //______________________________________________________
302 void AliEveTRDTrackListEditor::ApplyMacros()
304 // Applies the selected macros and updates the view.
306 Bool_t success = kFALSE;
308 // First apply the single track selection macros
309 TList* selIterator = new TList();
310 ftlMacroSelList->GetSelectedEntries(selIterator);
311 fM->ApplySTSelectionMacros(selIterator);
316 // Now apply the process macros
317 TList* procIterator = new TList();
318 ftlMacroList->GetSelectedEntries(procIterator);
319 success = fM->ApplyProcessMacros(selIterator, procIterator);
321 // Update histogram tab (data has to be reloaded)
325 // AlieveTRDTrackList::ApplyProcessMacros() automatically selects a macro -> Draw the histogram for it,
326 // if a process macro has been applied
327 if (success && procIterator->GetEntries() > 0)
329 // Set focus on "Histograms" tab
330 GetGedEditor()->GetTab()->SetTab("Results");
339 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
340 "AliEveTRDTrackList::ApplyProcessMacros experienced an error (cf. CINT-output)!",
341 kMBIconExclamation, kMBOk);
345 //______________________________________________________
346 void AliEveTRDTrackListEditor::NewMacros()
348 // Start the macro creation wizard.
349 // thanks to Jacek Otwinowski<J.Otwinowski@GSI.DE> for this suggestion
351 AliEveTRDMacroWizard *wizz = new AliEveTRDMacroWizard();
352 wizz->Connect("Create(Char_t*)", "AliEveTRDTrackListEditor", this, "AddMacro(Char_t*)");
356 //______________________________________________________
357 void AliEveTRDTrackListEditor::BrowseMacros()
359 // Creates a file-dialog. The selected files will be added to the macro list
360 // via AddMacro(...).
362 new TGFileDialog(gClient->GetRoot(), GetMainFrame(), kFDOpen, fFileInfo);
364 if (fFileInfo->fIniDir != 0 && fFileInfo->fFileNamesList != 0)
367 TObject* iter = fFileInfo->fFileNamesList->First();
373 // NOTE: fileInfo->fFileNamesList will be changed by that, too!
374 name = (Char_t*)strrchr(iter->GetName(), '/');
375 // Delete '"' at the end
376 name[strlen(name)] = '\0';
378 AddMacro(name + 1, fFileInfo->fIniDir);
379 iter = (TObjString*)fFileInfo->fFileNamesList->After(iter);
383 // -> The following problem has been fixed (trunk -> Changes according to 03 September 2008):
384 // Some error occurs, when one ends the filedialog with "cancel": fileInfo->fFileNamesList is set to 0x0, but
385 // in the next launch no new memory is allocated. So do this manually.
386 //if (fileInfo->fFileNamesList == 0) fileInfo->fFileNamesList = new TList();
389 //______________________________________________________
390 void AliEveTRDTrackListEditor::CloseTabs()
392 // Closes + deletes the tabs created by this object
394 if (fHistoCanvas != 0)
396 // Close the created tab, if it exists
397 if (fHistoCanvasName != 0)
399 if (gEve->GetBrowser()->GetTab(1)->SetTab(fHistoCanvasName->GetString()))
401 // Now the created tab is the current one and can be deleted
402 gEve->GetBrowser()->GetTab(1)->RemoveTab();
405 // With the tab removal, the canvas will be deleted automatically!
410 //______________________________________________________
411 void AliEveTRDTrackListEditor::DrawHistos()
413 // Accesses the temporary data file created by the last call of ApplyMacros() and draws
414 // histograms according to the selection in the "Histograms"-tab.
416 Int_t nHistograms = GetNSelectedHistograms();
417 if (nHistograms <= 0)
419 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
420 "No data selected. Please select the data you want to plot!", kMBIconExclamation, kMBOk);
425 new TGMsgBox(gClient->GetRoot(), GetMainFrame(),
426 "Error", "Only histograms with up to 3 dimensions supported. Please select 1,2 or 3 data macros!",
427 kMBIconExclamation, kMBOk);
431 // Check, if a histo macro shall be drawn
432 Int_t indexOfHistoMacro = -1;
433 Int_t selectedChecked = 0;
434 for (Int_t j = 0; j < fM->fDataFromMacroList->GetEntries(); j++)
436 if (fCheckButtons[j]->TGButton::GetState() == kButtonDown)
440 // Histo macro? -> To check this, look for the substring "(histo macro)"
441 if (strstr(fM->fDataFromMacroList->At(j)->GetName(), "(histo macro)") != 0)
443 // Is also another macro selected?
446 // Histo macros cannot(!) be correlated!
447 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms",
448 "Histo macros (return value \"TH1*\") cannot be combined with other macros",
449 kMBIconExclamation, kMBOk);
453 // Mark this histo macro for drawing
454 indexOfHistoMacro = j;
456 // Have all selected macros been checked? -> If yes, we are done with this
457 if (selectedChecked == nHistograms) break;
462 TFile* file = new TFile(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER")), "READ");
465 Error("Draw histograms", "Cannot open file \"/tmp/TRD.TrackListMacroData_%s.root\"",
466 gSystem->Getenv("USER"));
467 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms",
468 Form("Cannot open file \"/tmp/TRD.TrackListMacroData_%s.root\"", gSystem->Getenv("USER")),
469 kMBIconExclamation, kMBOk);
477 Int_t indexOfMacro1 = 0;
478 Int_t indexOfMacro2 = 0;
479 Int_t indexOfMacro3 = 0;
481 // Variable for the loop below -> Will be set to aborting value, if a histo macro is drawn
485 if (indexOfHistoMacro >= 0)
487 if ((t = (TTree*)file->Get(Form("TrackData%d", indexOfHistoMacro))))
489 SetDrawingToHistoCanvasTab();
492 t->SetBranchAddress(Form("Macro%d", indexOfHistoMacro), &myHist);
494 if (myHist != 0) myHist->Draw();
497 Error("Draw histograms", "No histogram for histo macro \"%s\" found!",
498 fM->fDataFromMacroList->At(indexOfHistoMacro)->GetName());
499 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms",
500 Form("No histogram for histo macro \"%s\" found!",
501 fM->fDataFromMacroList->At(indexOfHistoMacro)->GetName()), kMBIconExclamation, kMBOk);
505 UpdateHistoCanvasTab();
509 Error("Draw histograms", "No data for histo macro \"%s\" found!\nMaybe no tracks have been selected.",
510 fM->fDataFromMacroList->At(indexOfHistoMacro)->GetName());
511 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms",
512 Form("No data for histo macro \"%s\" found!\nMaybe no tracks have been selected.",
513 fM->fDataFromMacroList->At(indexOfHistoMacro)->GetName()), kMBIconExclamation, kMBOk);
516 // Skip the loop below
517 i = fM->fDataFromMacroList->GetEntries();
520 // Load the trees in succession and remember the entries -> Plot the analyse macros
521 for ( ; i < fM->fDataFromMacroList->GetEntries(); i++)
523 if (fCheckButtons[i]->TGButton::GetState() == kButtonDown)
528 if (!(t = (TTree*)file->Get(Form("TrackData%d", i))))
530 Error("Draw histograms", "No data for macro \"%s\" found!\nMaybe no tracks have been selected.",
531 fM->fDataFromMacroList->At(i)->GetName());
532 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms",
533 Form("No data for macro \"%s\" found!\nMaybe no tracks have been selected.",
534 fM->fDataFromMacroList->At(i)->GetName()), kMBIconExclamation, kMBOk);
539 if (nHistograms == 1)
541 SetDrawingToHistoCanvasTab();
543 t->Draw(Form("Macro%d", indexOfMacro1), "1");
544 ((TH1*)gPad->GetPrimitive("htemp"))->SetTitle(Form("%s;%s",
545 fM->fDataFromMacroList->At(indexOfMacro1)->GetName(),
546 fM->fDataFromMacroList->At(indexOfMacro1)->GetName()));
547 UpdateHistoCanvasTab();
552 else if (tFriend1 == 0)
555 if (!(tFriend1 = (TTree*)file->Get(Form("TrackData%d", i))))
557 Error("Draw histograms", "No data for macro \"%s\" found!\nMaybe no tracks have been selected.",
558 fM->fDataFromMacroList->At(i)->GetName());
559 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms",
560 Form("No data for macro \"%s\" found!\nMaybe no tracks have been selected.",
561 fM->fDataFromMacroList->At(i)->GetName()),
562 kMBIconExclamation, kMBOk);
567 if (nHistograms == 2)
569 SetDrawingToHistoCanvasTab();
571 t->AddFriend(tFriend1);
572 t->Draw(Form("Macro%d:Macro%d", indexOfMacro1, indexOfMacro2), "1");
573 ((TH1*)gPad->GetPrimitive("htemp"))->SetTitle(Form("%s - %s;%s;%s",
574 fM->fDataFromMacroList->At(indexOfMacro2)->GetName(),
575 fM->fDataFromMacroList->At(indexOfMacro1)->GetName(),
576 fM->fDataFromMacroList->At(indexOfMacro2)->GetName(),
577 fM->fDataFromMacroList->At(indexOfMacro1)->GetName()));
579 UpdateHistoCanvasTab();
588 if (!(tFriend2 = (TTree*)file->Get(Form("TrackData%d", i))))
590 Error("Draw histograms", "No data for macro \"%s\" found!\nMaybe no tracks have been selected.",
591 fM->fDataFromMacroList->At(i)->GetName());
592 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms",
593 Form("No data for macro \"%s\" found!\nMaybe no tracks have been selected.",
594 fM->fDataFromMacroList->At(i)->GetName()), kMBIconExclamation, kMBOk);
598 SetDrawingToHistoCanvasTab();
600 t->AddFriend(tFriend1);
601 t->AddFriend(tFriend2);
602 t->Draw(Form("Macro%d:Macro%d:Macro%d", indexOfMacro1, indexOfMacro2, indexOfMacro3), "1");
603 ((TH1*)gPad->GetPrimitive("htemp"))->SetTitle(Form("%s - %s - %s;%s;%s;%s",
604 fM->fDataFromMacroList->At(indexOfMacro3)->GetName(),
605 fM->fDataFromMacroList->At(indexOfMacro2)->GetName(),
606 fM->fDataFromMacroList->At(indexOfMacro1)->GetName(),
607 fM->fDataFromMacroList->At(indexOfMacro3)->GetName(),
608 fM->fDataFromMacroList->At(indexOfMacro2)->GetName(),
609 fM->fDataFromMacroList->At(indexOfMacro1)->GetName()));
611 UpdateHistoCanvasTab();
618 if (t != 0) delete t;
620 if (tFriend1 != 0) delete tFriend1;
622 if (tFriend2 != 0) delete tFriend2;
630 //______________________________________________________
631 Int_t AliEveTRDTrackListEditor::GetNSelectedHistograms() const
633 // Returns the number of selected macros (or rather: of their selected data) in the "Histograms"-tab
637 for (Int_t i = 0; i < fM->fDataFromMacroList->GetEntries(); i++)
639 if (fCheckButtons[i]->TGButton::GetState() == kButtonDown) count++;
645 //______________________________________________________
646 void AliEveTRDTrackListEditor::HandleMacroPathSet()
648 // Takes the input of the text field (adding a macro), checks if the macro can be
649 // accessed (and that it exists) and adds the macro to the macro list via AddMacro(...).
650 // You can use environment variables in the text field, e.g. "$ALICE_ROOT/Eve/alice-macro/myMacro.C".
652 Char_t bname[AliEveTRDTrackList::fkMaxMacroNameLength]; // allocate buffers
654 if (strlen(fteField->GetText()) != 0)
656 // Expand the pathname
657 Char_t* systemPath = gSystem->ExpandPathName(fteField->GetText());
658 fteField->SetText(systemPath);
662 // Check if file exists
665 fp = fopen(fteField->GetText(), "rb");
671 Char_t* name = (Char_t*)strrchr(fteField->GetText(), '/');
676 memset(name, '\0', sizeof(Char_t) * AliEveTRDTrackList::fkMaxMacroNameLength);
677 snprintf(name, AliEveTRDTrackList::fkMaxMacroNameLength, "%s", fteField->GetText());
679 // Add path to textfield -> Path is "./" -> Use length for the name + 2
680 Char_t pathname[AliEveTRDTrackList::fkMaxMacroNameLength + 2];
681 memset(pathname, '\0', sizeof(Char_t) * (AliEveTRDTrackList::fkMaxMacroNameLength + 2));
682 snprintf(pathname, AliEveTRDTrackList::fkMaxMacroNameLength + 2, "./%s", fteField->GetText());
683 fteField->SetText(pathname);
691 Char_t path[AliEveTRDTrackList::fkMaxMacroPathLength];
692 memset(path, '\0', sizeof(Char_t) * AliEveTRDTrackList::fkMaxMacroPathLength);
693 snprintf(path, strlen(fteField->GetText()) - strlen(name), "%s", fteField->GetText());
695 // Ignore the slash "/" in name
696 AddMacro(name + 1, path);
701 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
702 "File does not exist or you do not have read permission!", kMBIconExclamation, kMBOk);
707 //______________________________________________________
708 void AliEveTRDTrackListEditor::HandleNewEventLoaded()
710 // Closes the tabs created by this object and sets a flag that will
711 // cause the function SetModel() to inherit the macro lists + style
712 // for the next AliEveTRDTrackList from the current one.
714 // Inherit the macro list and track style for the next track list!
715 fInheritSettings = kTRUE;
721 //______________________________________________________
722 void AliEveTRDTrackListEditor::HandleTabChangedToIndex(Int_t index)
724 // Saves the current tab in the current AliEveTRDTrackList.
726 fM->SetSelectedTab(index);
729 //______________________________________________________
730 void AliEveTRDTrackListEditor::InheritMacroList()
732 // The old macro list is possibly stored in the corresponding interior map. This function will
733 // use this interior map to move the data from the interior map to the newly loaded AliEveTRDTrackList.
734 // Then the interior map will be cleaned up. With this, the settings will be inherited from the previously
735 // loaded AliEveTRDTrackList.
737 if (fInheritedMacroList == 0) return;
740 fM->fMacroList->Delete();
742 // Store data from interior list in the track list's map
743 TMapIter* iter = (TMapIter*)fInheritedMacroList->MakeIterator();
746 TMacroData* macro = 0;
748 while ((key = iter->Next()) != 0)
750 macro = (TMacroData*)fInheritedMacroList->GetValue(key);
751 if (macro != 0) fM->fMacroList->Add(new TObjString(key->GetName()),
752 new TMacroData(macro->GetName(), macro->GetPath(), macro->GetType()));
755 Error("AliEveTRDTrackListEditor::InheritMacroList", "Failed to inherit the macro \"%s\"!", key->GetName());
759 fInheritedMacroList->Delete();
760 delete fInheritedMacroList;
761 fInheritedMacroList = 0;
764 //______________________________________________________
765 void AliEveTRDTrackListEditor::InheritStyle()
767 // The old styles are stored in the corresponding button groups. This function will replace
768 // the style settings of the newly loaded AliEveTRDTrackList with the old styles. With this, the settings
769 // will be inherited from the previously loaded AliEveTRDTrackList.
771 for (Int_t ind = 0; ind < 3; ind++)
773 if (fbgStyleTrack->GetButton(ind)->IsOn())
779 for (Int_t ind = 0; ind < 3; ind++)
781 if (fbgStyleColor->GetButton(ind)->IsOn())
789 //______________________________________________________
790 void AliEveTRDTrackListEditor::RemoveMacros()
792 // Removes the selected macros from the corresponding list.
795 ftlMacroList->GetSelectedEntries(&iterator);
796 fM->RemoveSelectedMacros(&iterator);
800 ftlMacroSelList->GetSelectedEntries(&iterator);
801 fM->RemoveSelectedMacros(&iterator);
803 // Selected macros are deleted from the list -> No selected entries left
804 fM->fMacroListSelected = 0;
808 //______________________________________________________
809 void AliEveTRDTrackListEditor::SaveMacroList(TMap* list)
811 // Saves the provided macro list in an interior list. This list will be used by
812 // InheritMacroList() to restore the data in "list". With this method one is able
813 // to inherit the macro list from track list to track list (i.e. from event to event).
815 if (fInheritedMacroList != 0)
817 fInheritedMacroList->Delete();
818 delete fInheritedMacroList;
820 fInheritedMacroList = new TMap();
821 fInheritedMacroList->SetOwnerKeyValue(kTRUE, kTRUE);
823 TMapIter* iter = (TMapIter*)list->MakeIterator();
825 TMacroData* macro = 0;
827 while ((key = iter->Next()) != 0)
829 macro = (TMacroData*)fM->fMacroList->GetValue(key);
830 if (macro != 0) fInheritedMacroList->Add(new TObjString(key->GetName()),
831 new TMacroData(macro->GetName(), macro->GetPath(), macro->GetType()));
834 Error("AliEveTRDTrackListEditor::SaveMacroList", "Failed to inherit the macro \"%s\"!", key->GetName());
839 //______________________________________________________
840 void AliEveTRDTrackListEditor::SetDrawingToHistoCanvasTab()
842 // Sets gPad to the tab with the name of the current AliEveTRDTrackList. If this tab does
843 // not exist, it will be created. Otherwise, it is re-used.
845 // If the tab with the canvas has been closed, the canvas will be deleted.
846 // So, if there is no tab, set the canvas pointer to zero and recreate it in a new tab.
847 if (fHistoCanvas != 0)
849 if (gEve->GetBrowser()->GetTab(1)->SetTab(fHistoCanvasName->GetString()) == 0)
857 fHistoCanvas = gEve->AddCanvasTab(fM->GetName());
863 //______________________________________________________
864 void AliEveTRDTrackListEditor::SetModel(TObject* obj)
866 // Sets the model object, updates the related data in the GUI and
867 // inherits settings (cf. Inherit*(...)), if the flag fInheritSettings is set to kTRUE.
869 fM = dynamic_cast<AliEveTRDTrackList*>(obj);
873 Error("SetModel", "Parameter is zero pointer");
877 // Provide a pointer to this editor
880 // If macro list + track style shall be inherited from previously loaded track list, do so
881 if (fInheritSettings)
886 fInheritSettings = kFALSE;
889 // Select the correct styles
891 UChar_t style = fM->GetSelectedTrackStyle();
892 if (TESTBIT(style, AliEveTRDTrack::kSource)) b = 2;
895 if (TESTBIT(style, AliEveTRDTrack::kPID)) b = 1;
898 fbgStyleColor->SetButton(b, kTRUE);
901 if (TESTBIT(style, AliEveTRDTrack::kTrackCosmics)) b = 2;
904 if (TESTBIT(style, AliEveTRDTrack::kTrackModel)) b = 1;
907 fbgStyleTrack->SetButton(b, kTRUE);
913 GetGedEditor()->GetTab()->SetTab(fM->GetSelectedTab());
916 //______________________________________________________
917 void AliEveTRDTrackListEditor::SetTrackColor(Int_t ind)
919 // Sets the color model for the tracks, updates the tracks with this model and
920 // redraws the scene.
924 case AliTRDpidUtil::kLQ:
925 fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDpidUtil::kLQ);
927 case AliTRDpidUtil::kNN:
928 fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDpidUtil::kNN);
931 fM->UpdateTrackStyle(AliEveTRDTrack::kSource);
938 //______________________________________________________
939 void AliEveTRDTrackListEditor::SetTrackModel(Int_t ind)
941 // Sets the track model for the tracks, updates the tracks with this model and
942 // redraws the scene.
946 case AliEveTRDTrack::kRieman:
947 fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kRieman);
949 case AliEveTRDTrack::kKalman:
950 fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kKalman);
953 fM->UpdateTrackStyle(AliEveTRDTrack::kTrackCosmics);
960 //______________________________________________________
961 void AliEveTRDTrackListEditor::UpdateDataFromMacroListSelection()
963 // Saves the current selection in the "Histograms"-tab to the current
964 // AliEveTRDTrackList. This means that the selection is updated and won't
965 // get lost, if another editor is loaded in Eve.
967 for (Int_t i = 0; i < fM->fDataFromMacroList->GetEntries(); i++)
969 fM->SetHistoDataSelection(i, fCheckButtons[i]->IsOn());
973 //______________________________________________________
974 void AliEveTRDTrackListEditor::UpdateHistoCanvasTab()
976 // Updates the histogram and the corresponding tab (including titles).
978 // Update name of the tab (tab has been set to current tab!)
979 fHistoCanvasName->SetString(fM->GetName());
981 // Use a copy of fHistoCanvasName!! -> If the user closes a tab manually, the TGString
982 // will be deleted -> Error might occur, when accessing the pointer
983 gEve->GetBrowser()->GetTab(1)->GetCurrentTab()->SetText(new TGString(fHistoCanvasName));
985 // Switch tabs to force redrawing
986 gEve->GetBrowser()->GetTab(1)->SetTab(0);
987 gEve->GetBrowser()->GetTab(1)->SetTab(fHistoCanvasName->GetString());
988 fHistoCanvas->Update();
991 //______________________________________________________
992 void AliEveTRDTrackListEditor::UpdateHistoList()
994 // Reloads (updates) the buttons in the "Histograms"-tab via
995 // the current AliEveTRDTrackList (data).
997 fHistoSubFrame->TGCompositeFrame::Cleanup();
999 // Set buttons for histograms
1000 if (fCheckButtons != 0) delete fCheckButtons;
1001 fCheckButtons = new TGCheckButton*[fM->fDataFromMacroList->GetEntries()];
1003 TObjString* iter = (TObjString*)fM->fDataFromMacroList->First();
1004 for (Int_t i = 0; i < fM->fDataFromMacroList->GetEntries() && iter != 0; i++)
1006 fCheckButtons[i] = new TGCheckButton(fHistoSubFrame, iter->GetName());
1007 fHistoSubFrame->AddFrame(fCheckButtons[i]);
1009 fCheckButtons[i]->SetState(kButtonUp, kFALSE);
1010 fCheckButtons[i]->MapRaised();
1011 fCheckButtons[i]->SetOn(fM->HistoDataIsSelected(i));
1012 fCheckButtons[i]->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "UpdateDataFromMacroListSelection()");
1014 iter = (TObjString*)fM->fDataFromMacroList->After(iter);
1018 //______________________________________________________
1019 void AliEveTRDTrackListEditor::UpdateMacroList()
1021 // Reloads (updates) the macro list (selection AND process macros) via
1022 // the current AliEveTRDTrackList (data).
1024 ftlMacroList->RemoveAll();
1025 ftlMacroSelList->RemoveAll();
1027 TMapIter* iter = (TMapIter*)fM->fMacroList->MakeIterator();
1029 TMacroData* macro = 0;
1032 while ((key = iter->Next()) != 0)
1034 macro = (TMacroData*)fM->fMacroList->GetValue(key);
1037 if (macro->IsProcessMacro())
1039 ftlMacroList->AddEntry(macro->GetName(), ind);
1040 // Select, what has been selected before
1041 ftlMacroList->Select(ind, fM->MacroListIsSelected(ind));
1044 else if (macro->IsSelectionMacro())
1046 ftlMacroSelList->AddEntry(macro->GetName(), ind);
1047 // Select, what has been selected before
1048 ftlMacroSelList->Select(ind, fM->MacroListIsSelected(ind));
1053 Error("AliEveTRDTrackListEditor::UpdateMacroList()",
1054 "Macro \"%s/%s.C\" is neither a selection macro nor a process macro!",
1055 macro->GetPath(), macro->GetName());
1060 Error("AliEveTRDTrackListEditor::UpdateMacroList()",
1061 "Macro list is corrupted: Macro \"%s\" not found!", key->GetName());
1065 ftlMacroList->SortByName();
1066 ftlMacroSelList->SortByName();
1069 //______________________________________________________
1070 void AliEveTRDTrackListEditor::UpdateMacroListSelection(Int_t ind)
1072 // Saves the current selection in the macro listS to the current
1073 // AliEveTRDTrackList. This means that the selection is updated and won't
1074 // get lost, if another editor is loaded in Eve.
1075 // NOTE: The indices in BOTH lists will be unique!
1077 // Toggle selected item
1078 fM->SetMacroListSelection(ind, !fM->MacroListIsSelected(ind));
1082 //______________________________________________________
1083 //______________________________________________________
1084 //______________________________________________________
1087 /////////////////////////////////////////////////
1088 ClassImp(AliEveTRDMacroWizard)
1089 /////////////////////////////////////////////////
1091 //______________________________________________________
1092 AliEveTRDMacroWizard::AliEveTRDMacroWizard(const TGWindow* p)
1093 :TGMainFrame(p ? p : gClient->GetRoot(), 10, 10, kMainFrame | kVerticalFrame)
1100 // Creates the macro wizard.
1102 const Int_t width = 300;
1105 TGHorizontalFrame *fFrameName = new TGHorizontalFrame(this, 10, 10, kHorizontalFrame);
1106 TGLabel *fLabel = new TGLabel(fFrameName, "Name*");
1107 fLabel->SetTextJustify(36);
1108 fLabel->SetMargins(0,0,0,0);
1109 fLabel->SetWrapLength(-1);
1110 fFrameName->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
1112 fText = new TGTextEntry(fFrameName);
1113 fText->SetMaxLength(255);
1114 fText->SetAlignment(kTextLeft);
1116 fText->Resize(width, fText->GetDefaultHeight());
1117 fFrameName->AddFrame(fText, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2));
1121 TGHorizontalFrame *fFrameComment = new TGHorizontalFrame(this,10,10,kHorizontalFrame);
1122 fLabel = new TGLabel(fFrameComment, "Comment");
1123 fLabel->SetTextJustify(36);
1124 fLabel->SetMargins(0,0,0,0);
1125 fLabel->SetWrapLength(-1);
1126 fFrameComment->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
1128 fTextEdit = new TGTextEdit(fFrameComment, width, 5*fText->GetDefaultHeight());
1129 fFrameComment->AddFrame(fTextEdit, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2));
1132 TGHorizontalFrame *fFrameType = new TGHorizontalFrame(this,10,10,kHorizontalFrame);
1133 fLabel = new TGLabel(fFrameType, "Type*");
1134 fLabel->SetTextJustify(36);
1135 fLabel->SetMargins(0,0,0,0);
1136 fLabel->SetWrapLength(-1);
1137 fFrameType->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
1139 fCombo = new TGComboBox(fFrameType, -1, kHorizontalFrame | kSunkenFrame | kDoubleBorder | kOwnBackground);
1140 fCombo->AddEntry("Single Track Selection", AliEveTRDTrackList::kSingleTrackSelect);
1141 fCombo->AddEntry("Pair Tracks Selection", AliEveTRDTrackList::kCorrelTrackSelect);
1142 fCombo->AddEntry("Single Track Analyse", AliEveTRDTrackList::kSingleTrackAnalyse);
1143 fCombo->AddEntry("Single Track Histo", AliEveTRDTrackList::kSingleTrackHisto);
1144 fCombo->AddEntry("Pair Tracks Analyse", AliEveTRDTrackList::kCorrelTrackAnalyse);
1145 fCombo->AddEntry("Pair Tracks Histo", AliEveTRDTrackList::kCorrelTrackHisto);
1147 fCombo->Resize(width, fText->GetDefaultHeight());
1148 fFrameType->AddFrame(fCombo, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2));
1151 TGHorizontalFrame *fFrameAction = new TGHorizontalFrame(this,10,10,kHorizontalFrame);
1152 fbCancel = new TGTextButton(fFrameAction, "Cancel");
1153 fbCancel->SetToolTipText("Exit macro creation wizard");
1154 fFrameAction->AddFrame(fbCancel, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2));
1155 fbCreate = new TGTextButton(fFrameAction, "Done");
1156 fbCreate->SetToolTipText("Use settings to create the macro");
1157 fFrameAction->AddFrame(fbCreate, new TGLayoutHints(kLHintsRight | kLHintsTop,2,2,2,2));
1161 TGHorizontalFrame *fFrameText = new TGHorizontalFrame(this,10,10,kHorizontalFrame);
1162 fLabel = new TGLabel(fFrameText, "(*) Mandatory fields");
1163 fLabel->SetTextJustify(36);
1164 fLabel->SetMargins(0,0,0,0);
1165 fLabel->SetWrapLength(-1);
1166 fFrameText->AddFrame(fLabel, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
1168 // put things together
1169 AddFrame(fFrameName, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
1170 AddFrame(fFrameComment, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
1171 AddFrame(fFrameType, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
1172 AddFrame(fFrameAction, new TGLayoutHints(kLHintsRight | kLHintsTop | kLHintsExpandX,2,2,2,2));
1174 TGHorizontal3DLine *fLine = new TGHorizontal3DLine(this, 281, 2);
1175 AddFrame(fLine, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
1176 AddFrame(fFrameText, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX,2,2,2,2));
1179 SetWindowName("TRD Macro Wizard");
1180 SetMWMHints(kMWMDecorAll,
1185 Resize(GetDefaultSize());
1189 //fCombo->Connect("Selected(Int_t)", "AliEveTRDMacroWizard", this, "Create(Int_t)");
1190 fbCreate->Connect("Clicked()", "AliEveTRDMacroWizard", this, "HandleCreate()");
1191 fbCancel->Connect("Clicked()", "AliEveTRDMacroWizard", this, "CloseWindow()");
1194 fCombo->Select(1, kFALSE);
1197 const Char_t *fIncludes =
1198 "#if !defined(__CINT__) || defined(__MAKECINT__)\n"
1199 "#include <TROOT.h>\n"
1200 "#include <TH1.h>\n"
1201 "#include <TRD/AliTRDgeometry.h>\n"
1202 "#include <TRD/AliTRDcluster.h>\n"
1203 "#include <TRD/AliTRDseedV1.h>\n"
1204 "#include <TRD/AliTRDtrackV1.h>\n"
1207 const Char_t *fMacroTemplate[7] = {
1209 ," if (!track) return kFALSE;\n"
1213 " if (!track) return;\n"
1215 ," if (!track) return 0x0;\n"
1216 " TH1* h = 0x0;\n\n"
1217 "// Set bins, xmin and xmax here\n"
1219 " Double_t xmin = 0;\n"
1220 " Double_t xmax = 100;\n\n"
1221 " if(!(h = (TH1*)gROOT->FindObject(\"h\"))){\n"
1222 " h = new TH1(\"h\", \"Title\", n, xmin, xmax);\n"
1223 " h->GetXaxis()->SetTitle("");\n"
1224 " h->GetYaxis()->SetTitle("");\n"
1225 " } else h->Reset();\n"
1227 ," if (!track) return kFALSE;\n"
1228 " if (!track2) return kFALSE;\n"
1232 " if (!track) return;\n"
1233 " if (!track2) return;\n"
1235 ," if (!track) return 0x0;\n"
1236 " if (!track2) return 0x0;\n"
1237 " TH1* h = 0x0;\n\n"
1238 "// Set bins, xmin and xmax here\n"
1240 " Double_t xmin = 0;\n"
1241 " Double_t xmax = 100;\n\n"
1242 " if(!(h = (TH1*)gROOT->FindObject(\"h\"))){\n"
1243 " h = new TH1(\"h\", \"Title\", n, xmin, xmax);\n"
1244 " h->GetXaxis()->SetTitle("");\n"
1245 " h->GetYaxis()->SetTitle("");\n"
1246 " } else h->Reset();\n"
1248 //______________________________________________________
1249 void AliEveTRDMacroWizard::Create(Int_t type)
1251 // Creates the macro with the selected type (combo box).
1253 const Char_t *name = fText->GetText();
1254 if(strcmp(name,"")==0){
1255 AliInfo("Please specify a name for your macro.");
1256 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
1257 "Please specify a name for your macro.", kMBIconExclamation, kMBOk);
1258 //fCombo->Select(-1);
1262 // Note: gSystem->AccessPathName(...) returns kTRUE, if the access FAILED!
1263 if(!gSystem->AccessPathName(Form("./%s.C", name))){
1264 // If there is already a file with this name -> Error
1265 AliInfo(Form("A macro \"%s.C\" already exists in the current directory!\nPlease choose another name!", name));
1266 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
1267 Form("A macro \"%s.C\" already exists in the current directory!\nPlease choose another name!", name), kMBIconExclamation, kMBOk);
1268 //fCombo->Select(-1);
1273 if(!(fp = fopen(Form("%s.C", name), "wt"))){
1274 AliInfo("Couldn't create macro file.");
1275 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
1276 "Couldn't create macro file.", kMBIconExclamation, kMBOk);
1277 //fCombo->Select(-1);
1281 TGText *comment = fTextEdit->GetText();
1282 Char_t *line = 0x0; Int_t iline = 0;
1283 while((line = comment->GetLine(TGLongPosition(0,iline++), 200))) fprintf(fp, "// %s\n", line);
1285 fprintf(fp, "\n%s\n", fIncludes);
1288 case AliEveTRDTrackList::kSingleTrackSelect:
1289 fprintf(fp, "Bool_t %s(const AliTRDtrackV1 *track)\n", name);
1291 case AliEveTRDTrackList::kCorrelTrackSelect:
1292 fprintf(fp, "Bool_t %s(const AliTRDtrackV1 *track, const AliTRDtrackV1 *track2)\n", name);
1294 case AliEveTRDTrackList::kSingleTrackAnalyse:
1295 fprintf(fp, "void %s(const AliTRDtrackV1 *track, Double_t*& r, Int_t& n)\n", name);
1297 case AliEveTRDTrackList::kSingleTrackHisto:
1298 fprintf(fp, "TH1* %s(const AliTRDtrackV1 *track)\n", name);
1300 case AliEveTRDTrackList::kCorrelTrackAnalyse:
1301 fprintf(fp, "void %s(const AliTRDtrackV1 *track, const AliTRDtrackV1 *track2, Double_t*& r, Int_t& n)\n", name);
1303 case AliEveTRDTrackList::kCorrelTrackHisto:
1304 fprintf(fp, "TH1* %s(const AliTRDtrackV1 *track, const AliTRDtrackV1 *track2)\n", name);
1307 AliInfo(Form("Unknown type[%d]", type));
1308 new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error",
1309 Form("Unknown type[%d]", type), kMBIconExclamation, kMBOk);
1311 gSystem->Exec(Form("rm -f %s.C", name));
1312 //fCombo->Select(-1);
1316 fprintf(fp, "{\n%s\n", fMacroTemplate[type]);
1317 fprintf(fp, "// add your own code here\n\n\n}\n");
1320 Emit("Create(Int_t)", type);
1321 Create((Char_t*)name);
1325 //______________________________________________________
1326 void AliEveTRDMacroWizard::Create(Char_t *name)
1328 // Emits the creation signal.
1330 Emit("Create(Char_t*)", Form("%s.C", name));
1333 //______________________________________________________
1334 void AliEveTRDMacroWizard::HandleCreate()
1336 // Handles the signal, when the creation button is pressed.
1338 Create(fCombo->GetSelected());