]>
Commit | Line | Data |
---|---|---|
16db6074 | 1 | ////////////////////////////////////////////////////////////////////////// |
2 | // // | |
3 | // The AliEveTRDTrackListEditor provides the graphical functionality // | |
4 | // for the AliEveTRDTrackList. It creates the tabs and canvases, when // | |
5 | // they are needed and, as well, frees allocated memory on destruction // | |
6 | // (or if new events are loaded and thus some tabs are closed). // | |
7 | // The function DrawHistos() accesses the temporary file created by the // | |
8 | // AliEveTRDTrackList and draws the desired data (the file will be // | |
9 | // created within the call of ApplyMacros()). Have a look at this // | |
10 | // function to learn more about the structure of the file and how to // | |
11 | // access the data. // | |
12 | // // | |
13 | // Authors : // | |
14 | // A.Bercuci <A.Bercuci@gsi.de> // | |
15 | // B.Hess <Hess@Stud.Uni-Heidelberg.de> // | |
16 | ////////////////////////////////////////////////////////////////////////// | |
17 | ||
8bdeb570 | 18 | #include <EveDet/AliEveTRDData.h> |
19 | #include <EveDet/AliEveTRDTrackList.h> | |
20 | #include "AliEveTRDTrackListEditor.h" | |
2ef0687e | 21 | |
8bdeb570 | 22 | #include <EveBase/AliEveEventManager.h> |
23 | #include <AliTRDReconstructor.h> | |
24 | #include <AliTRDtrackV1.h> | |
caaf90d2 | 25 | #include <TGButton.h> |
8e27fca1 | 26 | #include <TCanvas.h> |
4f6473f6 | 27 | #include <TEveBrowser.h> |
8e27fca1 | 28 | #include <TEveGedEditor.h> |
caaf90d2 | 29 | #include <TEveMacro.h> |
30 | #include <TEveManager.h> | |
8e27fca1 | 31 | #include <TFile.h> |
32 | #include <TG3DLine.h> | |
4cbab605 | 33 | #include <TGButtonGroup.h> |
8e27fca1 | 34 | #include <TGFileDialog.h> |
35 | #include <TGLabel.h> | |
36 | #include <TGListBox.h> | |
37 | #include <TGMsgBox.h> | |
38 | #include <TGTab.h> | |
caaf90d2 | 39 | #include <TObjString.h> |
caaf90d2 | 40 | #include <TROOT.h> |
8e27fca1 | 41 | #include <TSystem.h> |
42 | #include <TGTextEntry.h> | |
43 | #include <TGTextView.h> | |
bcb45225 | 44 | #include <TH1.h> |
8e27fca1 | 45 | #include <TTreeStream.h> |
46 | ||
caaf90d2 | 47 | |
2ef0687e | 48 | ClassImp(AliEveTRDTrackListEditor) |
49 | ||
50 | /////////////////////////////////////////////////////////// | |
51 | ///////////// AliEveTRDTrackListEditor ////////////////// | |
52 | /////////////////////////////////////////////////////////// | |
53 | AliEveTRDTrackListEditor::AliEveTRDTrackListEditor(const TGWindow* p, Int_t width, Int_t height, | |
54 | UInt_t options, Pixel_t back) : | |
55 | TGedFrame(p, width, height, options, back), | |
56 | fM(0), | |
4f6473f6 | 57 | fHistoCanvas(0), |
58 | fHistoCanvasName(0), | |
8bdeb570 | 59 | fInheritSettings(kFALSE), |
ecbbe371 | 60 | fStyleFrame(0), |
2ef0687e | 61 | fMainFrame(0), |
caaf90d2 | 62 | fHistoFrame(0), |
63 | fHistoSubFrame(0), | |
2ef0687e | 64 | fBrowseFrame(0), |
4cbab605 | 65 | fbgStyleColor(0), |
66 | fbgStyleTrack(0), | |
67 | frbColor(new TGRadioButton*[3]), | |
68 | frbTrack(new TGRadioButton*[3]), | |
caaf90d2 | 69 | fbBrowse(0), |
70 | fbApplyMacros(0), | |
71 | fbRemoveMacros(0), | |
72 | fbDrawHisto(0), | |
73 | fteField(0), | |
74 | ftlMacroList(0), | |
75 | ftlMacroSelList(0), | |
76 | fFileInfo(0), | |
77 | fFileTypes(0), | |
78 | fLabel1(0), fLabel2(0), fLabel3(0), fLabel4(0), | |
4cbab605 | 79 | fLine1(0), fLine2(0), fLine3(0), fLine4(0), fLine5(0), |
caaf90d2 | 80 | fCheckButtons(0) |
4cbab605 | 81 | { |
16db6074 | 82 | // Creates the AliEveTRDTrackListEditor. |
83 | ||
4cbab605 | 84 | // Style stuff |
85 | fLine5 = new TGHorizontal3DLine(this, 194, 8); | |
86 | AddFrame(fLine5, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 8)); | |
ecbbe371 | 87 | fStyleFrame = new TGHorizontalFrame(this); |
88 | AddFrame(fStyleFrame); | |
4cbab605 | 89 | |
90 | // Style - Track model | |
ecbbe371 | 91 | fbgStyleTrack = new TGButtonGroup(fStyleFrame, "Track model"); |
4cbab605 | 92 | fbgStyleTrack->SetMapSubwindows(kTRUE); |
93 | fbgStyleTrack->Resize(194, 200); | |
ecbbe371 | 94 | fStyleFrame->AddFrame(fbgStyleTrack); |
4cbab605 | 95 | |
ecbbe371 | 96 | frbTrack[0] = new TGRadioButton(fbgStyleTrack, "Rieman", 0); |
8bdeb570 | 97 | frbTrack[0]->SetToolTipText("Set the track model to \"Rieman\""); |
4cbab605 | 98 | fbgStyleTrack->AddFrame(frbTrack[0]); |
ecbbe371 | 99 | frbTrack[1] = new TGRadioButton(fbgStyleTrack, "Kalman", 1); |
8bdeb570 | 100 | frbTrack[1]->SetToolTipText("Set the track model to \"Kalman\""); |
4cbab605 | 101 | fbgStyleTrack->AddFrame(frbTrack[1]); |
ecbbe371 | 102 | frbTrack[2] = new TGRadioButton(fbgStyleTrack, "Line", 2); |
8bdeb570 | 103 | frbTrack[2]->SetToolTipText("Set the track model to \"Line\""); |
4cbab605 | 104 | fbgStyleTrack->AddFrame(frbTrack[2]); |
4cbab605 | 105 | |
106 | // Style - Color model | |
8bdeb570 | 107 | fbgStyleColor = new TGButtonGroup(fStyleFrame, "Color model"); |
4cbab605 | 108 | fbgStyleColor->SetMapSubwindows(kTRUE); |
109 | fbgStyleColor->Resize(194, 200); | |
ecbbe371 | 110 | fStyleFrame->AddFrame(fbgStyleColor); |
4cbab605 | 111 | |
ecbbe371 | 112 | frbColor[0] = new TGRadioButton(fbgStyleColor, "PID LQ", 0); |
8bdeb570 | 113 | frbColor[0]->SetToolTipText("Set color model to \"PID LQ\""); |
4cbab605 | 114 | fbgStyleColor->AddFrame(frbColor[0]); |
ecbbe371 | 115 | frbColor[1] = new TGRadioButton(fbgStyleColor, "PID NN", 1); |
8bdeb570 | 116 | frbColor[1]->SetToolTipText("Set color model to \"PID NN\""); |
4cbab605 | 117 | fbgStyleColor->AddFrame(frbColor[1]); |
ecbbe371 | 118 | frbColor[2] = new TGRadioButton(fbgStyleColor, "ESD Source", 2); |
8bdeb570 | 119 | frbColor[2]->SetToolTipText("Set color model to \"ESD Source\""); |
4cbab605 | 120 | fbgStyleColor->AddFrame(frbColor[2]); |
4cbab605 | 121 | |
122 | ||
123 | // Functionality for adding macros | |
8bdeb570 | 124 | fMainFrame = CreateEditorTabSubFrame("Apply macros"); |
4cbab605 | 125 | |
3f797131 | 126 | fLabel1 = new TGLabel(fMainFrame,"Add macro(s):"); |
127 | fMainFrame->AddFrame(fLabel1); | |
2ef0687e | 128 | fBrowseFrame = new TGHorizontalFrame(fMainFrame); |
129 | ||
caaf90d2 | 130 | fteField = new TGTextEntry(fBrowseFrame); |
8bdeb570 | 131 | fteField->SetToolTipText("Enter the pathname of the macro you want to add here and press \"Enter\""); |
caaf90d2 | 132 | fteField->Connect("ReturnPressed()","AliEveTRDTrackListEditor", this, "HandleMacroPathSet()"); |
133 | fBrowseFrame->AddFrame(fteField); | |
2ef0687e | 134 | |
caaf90d2 | 135 | fbBrowse = new TGTextButton(fBrowseFrame, "Browse"); |
8bdeb570 | 136 | fbBrowse->SetToolTipText("Browse the macro you want to add"); |
caaf90d2 | 137 | fbBrowse->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "BrowseMacros()"); |
138 | fBrowseFrame->AddFrame(fbBrowse); | |
2ef0687e | 139 | fMainFrame->AddFrame(fBrowseFrame); |
140 | ||
3f797131 | 141 | fLine1 = new TGHorizontal3DLine(fMainFrame, 194, 8); |
caaf90d2 | 142 | fMainFrame->AddFrame(fLine1, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2)); |
3f797131 | 143 | fLabel2 = new TGLabel(fMainFrame,"Selection macros:"); |
144 | fMainFrame->AddFrame(fLabel2); | |
145 | ||
caaf90d2 | 146 | ftlMacroSelList = new TGListBox(fMainFrame); |
147 | ftlMacroSelList->Resize(194, 94); | |
148 | ftlMacroSelList->SetMultipleSelections(kTRUE); | |
149 | fMainFrame->AddFrame(ftlMacroSelList); | |
3f797131 | 150 | |
151 | fLine2 = new TGHorizontal3DLine(fMainFrame, 194, 8); | |
caaf90d2 | 152 | fMainFrame->AddFrame(fLine2, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2)); |
8bdeb570 | 153 | fLabel3 = new TGLabel(fMainFrame,"Process macros:"); |
3f797131 | 154 | fMainFrame->AddFrame(fLabel3); |
155 | ||
caaf90d2 | 156 | ftlMacroList = new TGListBox(fMainFrame); |
157 | ftlMacroList->Resize(194, 94); | |
158 | ftlMacroList->SetMultipleSelections(kTRUE); | |
159 | fMainFrame->AddFrame(ftlMacroList); | |
2ef0687e | 160 | |
3f797131 | 161 | fLine3 = new TGHorizontal3DLine(fMainFrame, 194, 8); |
caaf90d2 | 162 | fMainFrame->AddFrame(fLine3, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2)); |
3f797131 | 163 | |
caaf90d2 | 164 | fbApplyMacros = new TGTextButton(fMainFrame, "Apply selected macro(s)"); |
8bdeb570 | 165 | fbApplyMacros->SetToolTipText("Apply all selected macros to the tracklist -> A data file will be generated"); |
caaf90d2 | 166 | fbApplyMacros->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "ApplyMacros()"); |
167 | fbApplyMacros->SetRightMargin(12); | |
168 | fMainFrame->AddFrame(fbApplyMacros); | |
2ef0687e | 169 | |
caaf90d2 | 170 | fbRemoveMacros = new TGTextButton(fMainFrame, "Remove selected macro(s)"); |
8bdeb570 | 171 | fbRemoveMacros->SetToolTipText("Remove the selected macro(s) from the list(s)"); |
caaf90d2 | 172 | fbRemoveMacros->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "RemoveMacros()"); |
173 | fMainFrame->AddFrame(fbRemoveMacros); | |
2ef0687e | 174 | |
caaf90d2 | 175 | // Stuff for displaying histograms |
8bdeb570 | 176 | fHistoFrame = CreateEditorTabSubFrame("Histograms"); |
caaf90d2 | 177 | fHistoFrame->SetMapSubwindows(kTRUE); |
178 | fLabel4 = new TGLabel(fHistoFrame,"Data from applied macros:"); | |
179 | fHistoFrame->AddFrame(fLabel4); | |
180 | ||
181 | fHistoSubFrame = new TGVerticalFrame(fHistoFrame); | |
182 | fHistoSubFrame->SetMapSubwindows(kTRUE); | |
183 | fHistoSubFrame->Resize(194, 200); | |
184 | fHistoFrame->AddFrame(fHistoSubFrame); | |
185 | ||
186 | fLine4 = new TGHorizontal3DLine(fHistoFrame, 194, 8); | |
187 | fHistoFrame->AddFrame(fLine4, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 8, 2)); | |
188 | ||
189 | fbDrawHisto = new TGTextButton(fHistoFrame, "Draw histogram"); | |
2f9b41fd | 190 | fbDrawHisto->SetToolTipText("Uses the data file created by the last \"Apply selected macro(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!"); |
caaf90d2 | 191 | fbDrawHisto->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "DrawHistos()"); |
192 | fHistoFrame->AddFrame(fbDrawHisto); | |
2ef0687e | 193 | |
194 | // Set up file dialog | |
caaf90d2 | 195 | fFileInfo = new TGFileInfo(); |
196 | fFileInfo->SetMultipleSelection(kTRUE); | |
197 | ||
198 | fFileTypes = new Char_t*[6]; | |
199 | fFileTypes[0] = (Char_t*)"All files"; fFileTypes[1] = (Char_t*)"*"; | |
200 | fFileTypes[2] = (Char_t*)"ROOT macros"; fFileTypes[3] = (Char_t*)"*.C"; | |
201 | fFileTypes[4] = 0; fFileTypes[5] = 0; | |
202 | fFileInfo->fFileTypes = (const Char_t**)fFileTypes; | |
203 | fFileInfo->fFileTypeIdx = 2; | |
204 | fFileInfo->fMultipleSelection = kTRUE; | |
4f6473f6 | 205 | |
206 | fHistoCanvasName = new TGString(""); | |
207 | ||
4cbab605 | 208 | // Handle style changed signals: |
209 | fbgStyleTrack->Connect("Clicked(Int_t)", "AliEveTRDTrackListEditor", this, "SetTrackModel(Int_t)"); | |
210 | fbgStyleColor->Connect("Clicked(Int_t)", "AliEveTRDTrackListEditor", this, "SetTrackColor(Int_t)"); | |
211 | ||
4f6473f6 | 212 | // Handle the signal "Selected(Int_t ind)" |
213 | ftlMacroList->Connect("Selected(Int_t)", "AliEveTRDTrackListEditor", this, "UpdateMacroListSelection(Int_t)"); | |
214 | ftlMacroSelList->Connect("Selected(Int_t)", "AliEveTRDTrackListEditor", this, "UpdateMacroSelListSelection(Int_t)"); | |
215 | ||
216 | // Handle the signal "NewEventLoaded" | |
8bdeb570 | 217 | gAliEveEvent->Connect("NewEventLoaded()", "AliEveTRDTrackListEditor", this, "HandleNewEventLoaded()"); |
4f6473f6 | 218 | |
219 | // Handle the signal "Selected" (another tab has been selected) | |
220 | GetGedEditor()->GetTab()->Connect("Selected(Int_t)", "AliEveTRDTrackListEditor", | |
221 | this, "HandleTabChangedToIndex(Int_t)"); | |
2ef0687e | 222 | } |
223 | ||
c04e790a | 224 | //______________________________________________________ |
caaf90d2 | 225 | AliEveTRDTrackListEditor::~AliEveTRDTrackListEditor() |
3f797131 | 226 | { |
16db6074 | 227 | // Destructor: Closes all tabs created by this object and |
228 | // frees the corresponding memory. | |
229 | ||
caaf90d2 | 230 | if (fFileTypes != 0) |
39b891ff | 231 | { |
caaf90d2 | 232 | delete [] fFileTypes; |
233 | fFileTypes = 0; | |
2ef0687e | 234 | } |
3f797131 | 235 | |
caaf90d2 | 236 | if (fFileInfo != 0) |
39b891ff | 237 | { |
caaf90d2 | 238 | delete fFileInfo; |
239 | fFileInfo = 0; | |
39b891ff | 240 | } |
4f6473f6 | 241 | // Close and delete all tabs that have been created by this class |
242 | CloseTabs(); | |
243 | ||
244 | if (fHistoCanvasName != 0) | |
245 | { | |
246 | delete fHistoCanvasName; | |
247 | fHistoCanvasName = 0; | |
248 | } | |
caaf90d2 | 249 | } |
250 | ||
c04e790a | 251 | //______________________________________________________ |
caaf90d2 | 252 | void AliEveTRDTrackListEditor::AddMacro(const Char_t* path, const Char_t* name) |
253 | { | |
16db6074 | 254 | // Adds the macro path/name to the macro list. A warning is provided, if there is |
255 | // something wrong, e.g. if the macro does not have the correct signature. | |
256 | ||
caaf90d2 | 257 | Int_t result = fM->AddMacro(path, name); |
258 | ||
259 | switch (result) | |
39b891ff | 260 | { |
caaf90d2 | 261 | case SUCCESS: |
262 | UpdateMacroList(); | |
263 | break; | |
264 | case WARNING: | |
39b891ff | 265 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Warning", "Macro is already in list (won't be added again)!", |
266 | kMBIconExclamation, kMBOk); | |
caaf90d2 | 267 | break; |
268 | case SIGNATURE_ERROR: | |
269 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", | |
2f9b41fd | 270 | "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*)", |
caaf90d2 | 271 | kMBIconExclamation, kMBOk); |
272 | break; | |
273 | case NOT_EXIST_ERROR: | |
274 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", | |
275 | "File does not exist or you do not have read permission!", kMBIconExclamation, kMBOk); | |
276 | break; | |
277 | default: | |
278 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", | |
279 | Form("AliEveTRDTrackList::AddMacro exited with unknown return value: %d", result), | |
280 | kMBIconExclamation, kMBOk); | |
281 | break; | |
2ef0687e | 282 | } |
283 | } | |
284 | ||
c04e790a | 285 | //______________________________________________________ |
2ef0687e | 286 | void AliEveTRDTrackListEditor::ApplyMacros() |
287 | { | |
16db6074 | 288 | // Applies the selected macros and updates the view. |
289 | ||
ea24e1bc | 290 | Bool_t success = kFALSE; |
291 | ||
3f797131 | 292 | // First apply the selection macros |
caaf90d2 | 293 | TList* iterator = new TList(); |
294 | ftlMacroSelList->GetSelectedEntries(iterator); | |
295 | fM->ApplySelectionMacros(iterator); | |
296 | ||
39b891ff | 297 | // Update view |
298 | gEve->Redraw3D(); | |
39b891ff | 299 | |
caaf90d2 | 300 | if (iterator != 0) delete iterator; |
2ef0687e | 301 | |
3f797131 | 302 | // Now apply the process macros |
303 | iterator = new TList(); | |
caaf90d2 | 304 | ftlMacroList->GetSelectedEntries(iterator); |
ea24e1bc | 305 | success = fM->ApplyProcessMacros(iterator); |
2ef0687e | 306 | |
caaf90d2 | 307 | // Update histogram tab (data has to be reloaded) |
308 | SetModel(fM); | |
309 | Update(); | |
2ef0687e | 310 | |
bcb45225 | 311 | // AlieveTRDTrackList::ApplyProcessMacros() automatically selects a macro -> Draw the histogram for it, |
312 | // if a process macro has been applied | |
ea24e1bc | 313 | if (success && iterator->GetEntries() > 0) |
4f6473f6 | 314 | { |
315 | // Set focus on "Histograms" tab | |
316 | GetGedEditor()->GetTab()->SetTab("Histograms"); | |
317 | ||
318 | DrawHistos(); | |
319 | } | |
bcb45225 | 320 | |
321 | if (iterator != 0) delete iterator; | |
322 | iterator = 0; | |
ea24e1bc | 323 | |
324 | if (!success) | |
325 | { | |
326 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", | |
327 | "AliEveTRDTrackList::ApplyProcessMacros experienced an error (cf. CINT-output)!", | |
328 | kMBIconExclamation, kMBOk); | |
329 | } | |
8e27fca1 | 330 | } |
c04e790a | 331 | |
332 | //______________________________________________________ | |
2ef0687e | 333 | void AliEveTRDTrackListEditor::BrowseMacros() |
334 | { | |
16db6074 | 335 | // Creates a file-dialog. The selected files will be added to the macro list |
336 | // via AddMacro(...). | |
337 | ||
caaf90d2 | 338 | new TGFileDialog(gClient->GetRoot(), GetMainFrame(), kFDOpen, fFileInfo); |
2ef0687e | 339 | |
caaf90d2 | 340 | if (fFileInfo->fIniDir != 0 && fFileInfo->fFileNamesList != 0) |
3f797131 | 341 | { |
2ef0687e | 342 | // Extract filenames |
caaf90d2 | 343 | TObject* iter = fFileInfo->fFileNamesList->First(); |
2ef0687e | 344 | |
345 | Char_t* name = 0; | |
346 | ||
347 | while (iter != 0) | |
348 | { | |
caaf90d2 | 349 | // NOTE: fileInfo->fFileNamesList will be changed by that, too! |
2ef0687e | 350 | name = strrchr(iter->GetName(), '/'); |
351 | // Delete '"' at the end | |
352 | name[strlen(name)] = '\0'; | |
caaf90d2 | 353 | |
354 | AddMacro(fFileInfo->fIniDir, name + 1); | |
355 | iter = (TObjString*)fFileInfo->fFileNamesList->After(iter); | |
2ef0687e | 356 | } |
357 | } | |
3f797131 | 358 | |
caaf90d2 | 359 | // -> The following problem has been fixed (trunk -> Changes according to 03 September 2008): |
3f797131 | 360 | // Some error occurs, when one ends the filedialog with "cancel": fileInfo->fFileNamesList is set to 0x0, but |
361 | // in the next launch no new memory is allocated. So do this manually. | |
caaf90d2 | 362 | //if (fileInfo->fFileNamesList == 0) fileInfo->fFileNamesList = new TList(); |
363 | } | |
364 | ||
4f6473f6 | 365 | //______________________________________________________ |
366 | void AliEveTRDTrackListEditor::CloseTabs() | |
367 | { | |
16db6074 | 368 | // Closes + deletes the tabs created by this object |
369 | ||
4f6473f6 | 370 | if (fHistoCanvas != 0) |
371 | { | |
372 | // Close the created tab, if it exists | |
373 | if (fHistoCanvasName != 0) | |
374 | { | |
375 | if (gEve->GetBrowser()->GetTab(1)->SetTab(fHistoCanvasName->GetString())) | |
376 | { | |
377 | // Now the created tab is the current one and can be deleted | |
378 | gEve->GetBrowser()->GetTab(1)->RemoveTab(); | |
379 | } | |
380 | } | |
381 | // With the tab removal, the canvas will be deleted automatically! | |
382 | fHistoCanvas = 0; | |
383 | } | |
384 | } | |
385 | ||
c04e790a | 386 | //______________________________________________________ |
caaf90d2 | 387 | void AliEveTRDTrackListEditor::DrawHistos() |
388 | { | |
16db6074 | 389 | // Accesses the temporary data file created by the last call of ApplyMacros() and draws |
390 | // histograms according to the selection in the "Histograms"-tab. | |
391 | ||
caaf90d2 | 392 | Int_t nHistograms = GetNSelectedHistograms(); |
393 | if (nHistograms <= 0) | |
394 | { | |
395 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", | |
396 | "No data selected. Please select the data you want to plot!", kMBIconExclamation, kMBOk); | |
397 | return; | |
398 | } | |
399 | if (nHistograms > 3) | |
400 | { | |
401 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), | |
402 | "Error", "Only histograms with up to 3 dimensions supported. Please select 1,2 or 3 data macros!", | |
403 | kMBIconExclamation, kMBOk); | |
404 | return; | |
405 | } | |
406 | ||
bcb45225 | 407 | // Check, if a histo macro shall be drawn |
408 | Int_t indexOfHistoMacro = -1; | |
409 | Int_t selectedChecked = 0; | |
410 | for (Int_t j = 0; j < fM->fDataFromMacroList->GetEntries(); j++) | |
411 | { | |
412 | if (fCheckButtons[j]->TGButton::GetState() == kButtonDown) | |
413 | { | |
414 | selectedChecked++; | |
415 | ||
8bdeb570 | 416 | // Histo macro? -> To check this, look for the substring "(histo macro)" |
417 | if (strstr(fM->fDataFromMacroList->At(j)->GetName(), "(histo macro)") != 0) | |
bcb45225 | 418 | { |
419 | // Is also another macro selected? | |
420 | if (nHistograms > 1) | |
421 | { | |
422 | // Histo macros cannot(!) be correlated! | |
423 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms", | |
2f9b41fd | 424 | "Histo macros (return value \"TH1*\") cannot be combined with other macros", |
bcb45225 | 425 | kMBIconExclamation, kMBOk); |
426 | return; | |
427 | } | |
428 | ||
429 | // Mark this histo macro for drawing | |
430 | indexOfHistoMacro = j; | |
431 | ||
432 | // Have all selected macros been checked? -> If yes, we are done with this | |
433 | if (selectedChecked == nHistograms) break; | |
434 | } | |
435 | } | |
436 | } | |
437 | ||
8bdeb570 | 438 | TFile* file = new TFile(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER")), "READ"); |
caaf90d2 | 439 | if (!file) |
440 | { | |
8bdeb570 | 441 | Error("Draw histograms", Form("Cannot open file \"/tmp/TRD.TrackListMacroData_%s.root\"", |
442 | gSystem->Getenv("USER"))); | |
caaf90d2 | 443 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms", |
8bdeb570 | 444 | Form("Cannot open file \"/tmp/TRD.TrackListMacroData_%s.root\"", gSystem->Getenv("USER")), |
445 | kMBIconExclamation, kMBOk); | |
caaf90d2 | 446 | return; |
447 | } | |
448 | ||
449 | TTree* t = 0; | |
450 | TTree* tFriend1 = 0; | |
451 | TTree* tFriend2 = 0; | |
452 | ||
453 | Int_t indexOfMacro1 = 0; | |
454 | Int_t indexOfMacro2 = 0; | |
455 | Int_t indexOfMacro3 = 0; | |
456 | ||
bcb45225 | 457 | // Variable for the loop below -> Will be set to aborting value, if a histo macro is drawn |
458 | Int_t i = 0; | |
459 | ||
460 | // Draw histo macro? | |
461 | if (indexOfHistoMacro >= 0) | |
462 | { | |
463 | if ((t = (TTree*)file->Get(Form("TrackData%d", indexOfHistoMacro)))) | |
464 | { | |
465 | SetDrawingToHistoCanvasTab(); | |
466 | ||
467 | TH1* myHist = 0; | |
468 | t->SetBranchAddress(Form("Macro%d", indexOfHistoMacro), &myHist); | |
469 | t->GetEntry(0); | |
470 | if (myHist != 0) myHist->Draw(); | |
471 | else | |
472 | { | |
473 | Error("Draw histograms", Form("No histogram for histo macro \"%s\" found!", | |
474 | fM->fDataFromMacroList->At(indexOfHistoMacro)->GetName())); | |
475 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms", | |
476 | Form("No histogram for histo macro \"%s\" found!", | |
477 | fM->fDataFromMacroList->At(indexOfHistoMacro)->GetName()), kMBIconExclamation, kMBOk); | |
478 | ||
479 | } | |
480 | ||
5715955a | 481 | UpdateHistoCanvasTab(); |
bcb45225 | 482 | } |
483 | else | |
484 | { | |
485 | Error("Draw histograms", Form("No data for histo macro \"%s\" found!", | |
486 | fM->fDataFromMacroList->At(indexOfHistoMacro)->GetName())); | |
487 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms", | |
488 | Form("No data for histo macro \"%s\" found!", | |
489 | fM->fDataFromMacroList->At(indexOfHistoMacro)->GetName()), kMBIconExclamation, kMBOk); | |
490 | } | |
491 | ||
492 | // Skip the loop below | |
493 | i = fM->fDataFromMacroList->GetEntries(); | |
494 | } | |
495 | ||
2f9b41fd | 496 | // Load the trees in succession and remember the entries -> Plot the analyse macros |
bcb45225 | 497 | for ( ; i < fM->fDataFromMacroList->GetEntries(); i++) |
caaf90d2 | 498 | { |
499 | if (fCheckButtons[i]->TGButton::GetState() == kButtonDown) | |
500 | { | |
501 | if (t == 0) | |
502 | { | |
503 | indexOfMacro1 = i; | |
504 | if (!(t = (TTree*)file->Get(Form("TrackData%d", i)))) | |
505 | { | |
bcb45225 | 506 | Error("Draw histograms", Form("No data for macro \"%s\" found!", fM->fDataFromMacroList->At(i)->GetName())); |
caaf90d2 | 507 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms", |
bcb45225 | 508 | Form("No data for macro \"%s\" found!", fM->fDataFromMacroList->At(i)->GetName()), |
509 | kMBIconExclamation, kMBOk); | |
caaf90d2 | 510 | break; |
511 | } | |
bcb45225 | 512 | |
2f9b41fd | 513 | // 1d histogram |
caaf90d2 | 514 | if (nHistograms == 1) |
515 | { | |
bcb45225 | 516 | SetDrawingToHistoCanvasTab(); |
8bdeb570 | 517 | |
bcb45225 | 518 | t->Draw(Form("Macro%d", indexOfMacro1), "1"); |
519 | ((TH1*)gPad->GetPrimitive("htemp"))->SetTitle(Form("%s;%s", | |
520 | fM->fDataFromMacroList->At(indexOfMacro1)->GetName(), | |
521 | fM->fDataFromMacroList->At(indexOfMacro1)->GetName())); | |
8bdeb570 | 522 | UpdateHistoCanvasTab(); |
caaf90d2 | 523 | |
524 | break; | |
525 | } | |
526 | } | |
527 | else if (tFriend1 == 0) | |
528 | { | |
529 | indexOfMacro2 = i; | |
530 | if (!(tFriend1 = (TTree*)file->Get(Form("TrackData%d", i)))) | |
531 | { | |
bcb45225 | 532 | Error("Draw histograms", Form("No data for macro \"%s\" found!", fM->fDataFromMacroList->At(i)->GetName())); |
caaf90d2 | 533 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms", |
bcb45225 | 534 | Form("No data for macro \"%s\" found!", fM->fDataFromMacroList->At(i)->GetName()), |
535 | kMBIconExclamation, kMBOk); | |
caaf90d2 | 536 | break; |
537 | } | |
538 | ||
539 | // 2d histogram | |
540 | if (nHistograms == 2) | |
541 | { | |
bcb45225 | 542 | SetDrawingToHistoCanvasTab(); |
543 | ||
caaf90d2 | 544 | t->AddFriend(tFriend1); |
545 | t->Draw(Form("Macro%d:Macro%d", indexOfMacro1, indexOfMacro2), "1"); | |
bcb45225 | 546 | ((TH1*)gPad->GetPrimitive("htemp"))->SetTitle(Form("%s - %s;%s;%s", |
547 | fM->fDataFromMacroList->At(indexOfMacro2)->GetName(), | |
548 | fM->fDataFromMacroList->At(indexOfMacro1)->GetName(), | |
549 | fM->fDataFromMacroList->At(indexOfMacro2)->GetName(), | |
550 | fM->fDataFromMacroList->At(indexOfMacro1)->GetName())); | |
4f6473f6 | 551 | |
bcb45225 | 552 | UpdateHistoCanvasTab(); |
caaf90d2 | 553 | |
554 | break; | |
555 | } | |
556 | } | |
557 | // 3d histogram | |
558 | else | |
559 | { | |
560 | indexOfMacro3 = i; | |
561 | if (!(tFriend2 = (TTree*)file->Get(Form("TrackData%d", i)))) | |
562 | { | |
bcb45225 | 563 | Error("Draw histograms", Form("No data for macro \"%s\" found!", fM->fDataFromMacroList->At(i)->GetName())); |
caaf90d2 | 564 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error - Draw histograms", |
bcb45225 | 565 | Form("No data for macro \"%s\" found!", fM->fDataFromMacroList->At(i)->GetName()), |
566 | kMBIconExclamation, kMBOk); | |
caaf90d2 | 567 | break; |
568 | } | |
4f6473f6 | 569 | |
bcb45225 | 570 | SetDrawingToHistoCanvasTab(); |
4f6473f6 | 571 | |
caaf90d2 | 572 | t->AddFriend(tFriend1); |
573 | t->AddFriend(tFriend2); | |
574 | t->Draw(Form("Macro%d:Macro%d:Macro%d", indexOfMacro1, indexOfMacro2, indexOfMacro3), "1"); | |
bcb45225 | 575 | ((TH1*)gPad->GetPrimitive("htemp"))->SetTitle(Form("%s - %s - %s;%s;%s;%s", |
576 | fM->fDataFromMacroList->At(indexOfMacro3)->GetName(), | |
577 | fM->fDataFromMacroList->At(indexOfMacro2)->GetName(), | |
578 | fM->fDataFromMacroList->At(indexOfMacro1)->GetName(), | |
579 | fM->fDataFromMacroList->At(indexOfMacro3)->GetName(), | |
580 | fM->fDataFromMacroList->At(indexOfMacro2)->GetName(), | |
581 | fM->fDataFromMacroList->At(indexOfMacro1)->GetName())); | |
582 | ||
583 | UpdateHistoCanvasTab(); | |
caaf90d2 | 584 | |
585 | break; | |
586 | } | |
587 | } | |
588 | } | |
589 | ||
590 | if (t != 0) delete t; | |
591 | t = 0; | |
592 | if (tFriend1 != 0) delete tFriend1; | |
593 | tFriend1 = 0; | |
594 | if (tFriend2 != 0) delete tFriend2; | |
595 | tFriend2 = 0; | |
596 | ||
597 | file->Close("R"); | |
598 | delete file; | |
599 | file = 0; | |
600 | } | |
601 | ||
c04e790a | 602 | //______________________________________________________ |
caaf90d2 | 603 | Int_t AliEveTRDTrackListEditor::GetNSelectedHistograms() |
604 | { | |
16db6074 | 605 | // Returns the number of selected macros (or rather: Their data) in the "Histograms"-tab |
606 | ||
caaf90d2 | 607 | Int_t count = 0; |
608 | ||
609 | for (Int_t i = 0; i < fM->fDataFromMacroList->GetEntries(); i++) | |
610 | { | |
611 | if (fCheckButtons[i]->TGButton::GetState() == kButtonDown) count++; | |
612 | } | |
613 | ||
614 | return count; | |
2ef0687e | 615 | } |
616 | ||
c04e790a | 617 | //______________________________________________________ |
2ef0687e | 618 | void AliEveTRDTrackListEditor::HandleMacroPathSet() |
619 | { | |
16db6074 | 620 | // Takes the input of the text field (adding a macro), checks if the macro can be |
621 | // accessed (and that it exists) and adds the macro to the macro list via AddMacro(...). | |
622 | // You can use environment variables in the text field, e.g. "$ALICE_ROOT/Eve/alice-macro/myMacro.C". | |
623 | ||
caaf90d2 | 624 | if (strlen(fteField->GetText()) != 0) |
5715955a | 625 | { |
626 | // Expand the pathname | |
627 | Char_t* systemPath = gSystem->ExpandPathName(fteField->GetText()); | |
628 | fteField->SetText(systemPath); | |
629 | delete systemPath; | |
630 | systemPath = 0; | |
631 | ||
2ef0687e | 632 | // Check if file exists |
633 | FILE* fp = NULL; | |
634 | ||
caaf90d2 | 635 | fp = fopen(fteField->GetText(), "rb"); |
39b891ff | 636 | if (fp != NULL) |
637 | { | |
3f797131 | 638 | fclose(fp); |
caaf90d2 | 639 | |
3f797131 | 640 | // Extract filename |
caaf90d2 | 641 | Char_t* name = strrchr(fteField->GetText(), '/'); |
3f797131 | 642 | |
643 | // Current path | |
39b891ff | 644 | if (name == NULL) |
645 | { | |
4f6473f6 | 646 | name = new Char_t[AliEveTRDTrackList::fkMaxMacroNameLength]; |
647 | memset(name, '\0', sizeof(Char_t) * AliEveTRDTrackList::fkMaxMacroNameLength); | |
caaf90d2 | 648 | sprintf(name, "%s", fteField->GetText()); |
3f797131 | 649 | |
4f6473f6 | 650 | // Add path to textfield -> Path is "./" -> Use length for the name + 2 |
651 | Char_t pathname[AliEveTRDTrackList::fkMaxMacroNameLength + 2]; | |
652 | memset(pathname, '\0', sizeof(Char_t) * (AliEveTRDTrackList::fkMaxMacroNameLength + 2)); | |
caaf90d2 | 653 | sprintf(pathname, "./%s", fteField->GetText()); |
654 | fteField->SetText(pathname); | |
655 | ||
656 | AddMacro(".", name); | |
657 | if (name != 0) delete name; | |
658 | name = 0; | |
39b891ff | 659 | } |
660 | // Different path | |
661 | else | |
662 | { | |
3f797131 | 663 | // Extract path |
4f6473f6 | 664 | Char_t* path = new Char_t[AliEveTRDTrackList::fkMaxMacroPathLength]; |
665 | memset(path, '\0', sizeof(Char_t) * AliEveTRDTrackList::fkMaxMacroPathLength); | |
caaf90d2 | 666 | strncpy(path, fteField->GetText(), strlen(fteField->GetText()) - strlen(name)); |
667 | ||
668 | // Ignore the slash "/" in name | |
669 | AddMacro(path, name + 1); | |
670 | ||
671 | if (path != 0) delete path; | |
672 | path = 0; | |
673 | } | |
39b891ff | 674 | } |
675 | else | |
676 | { | |
3f797131 | 677 | new TGMsgBox(gClient->GetRoot(), GetMainFrame(), "Error", |
39b891ff | 678 | "File does not exist or you do not have read permission!", kMBIconExclamation, kMBOk); |
2ef0687e | 679 | } |
680 | } | |
681 | } | |
682 | ||
4f6473f6 | 683 | //______________________________________________________ |
684 | void AliEveTRDTrackListEditor::HandleNewEventLoaded() | |
685 | { | |
16db6074 | 686 | // Closes the tabs created by this object and sets a flag that will |
687 | // cause the function SetModel() to inherit the macro lists + style | |
688 | // for the next AliEveTRDTrackList from the current one. | |
689 | ||
8bdeb570 | 690 | // Inherit the macro list and track style for the next track list! |
691 | fInheritSettings = kTRUE; | |
bcb45225 | 692 | |
693 | // Close the tabs | |
4f6473f6 | 694 | CloseTabs(); |
695 | } | |
696 | ||
697 | //______________________________________________________ | |
698 | void AliEveTRDTrackListEditor::HandleTabChangedToIndex(Int_t index) | |
699 | { | |
16db6074 | 700 | // Saves the current tab in the current AliEveTRDTrackList. |
701 | ||
4f6473f6 | 702 | fM->SetSelectedTab(index); |
703 | } | |
704 | ||
bcb45225 | 705 | //______________________________________________________ |
706 | void AliEveTRDTrackListEditor::InheritMacroList() | |
707 | { | |
16db6074 | 708 | // The old macro lists are stored in the corresponding list boxes. This function will add |
709 | // these lists to the newly loaded AliEveTRDTrackList (or better replace the AliEveTRDTrackList's | |
710 | // macro lists by these lists). With this, the settings will be inherited from the previously loaded | |
711 | // AliEveTRDTrackList. | |
bcb45225 | 712 | |
713 | // Selection macros | |
714 | fM->fMacroSelList->Delete(); | |
715 | for (Int_t i = 0; i < ftlMacroSelList->GetNumberOfEntries(); i++) | |
716 | { | |
2f9b41fd | 717 | fM->AddMacroFast(ftlMacroSelList->GetEntry(i)->GetTitle(), |
718 | fM->GetMacroType(ftlMacroSelList->GetEntry(i)->GetTitle(), kFALSE)); | |
bcb45225 | 719 | } |
720 | ||
721 | // Process macros | |
722 | fM->fMacroList->Delete(); | |
723 | for (Int_t i = 0; i < ftlMacroList->GetNumberOfEntries(); i++) | |
724 | { | |
8bdeb570 | 725 | fM->AddMacroFast(ftlMacroList->GetEntry(i)->GetTitle(), fM->GetMacroType(ftlMacroList->GetEntry(i)->GetTitle(), |
726 | kFALSE)); | |
727 | } | |
728 | } | |
729 | ||
730 | //______________________________________________________ | |
731 | void AliEveTRDTrackListEditor::InheritStyle() | |
732 | { | |
16db6074 | 733 | // The old styles are stored in the corresponding button groups. This function will replace |
734 | // the style settings of the newly loaded AliEveTRDTrackList with the old styles. With this, the settings | |
735 | // will be inherited from the previously loaded AliEveTRDTrackList. | |
8bdeb570 | 736 | |
737 | for (Int_t ind = 0; ind < 3; ind++) | |
738 | { | |
739 | if (fbgStyleTrack->GetButton(ind)->IsOn()) | |
740 | { | |
741 | SetTrackModel(ind); | |
742 | break; | |
743 | } | |
744 | } | |
745 | for (Int_t ind = 0; ind < 3; ind++) | |
746 | { | |
747 | if (fbgStyleColor->GetButton(ind)->IsOn()) | |
748 | { | |
749 | SetTrackColor(ind); | |
750 | break; | |
751 | } | |
bcb45225 | 752 | } |
753 | } | |
754 | ||
c04e790a | 755 | //______________________________________________________ |
2ef0687e | 756 | void AliEveTRDTrackListEditor::RemoveMacros() |
757 | { | |
16db6074 | 758 | // Removes the selected macros from the corresponding lists. |
759 | ||
2ef0687e | 760 | TList* iterator = new TList(); |
761 | ||
caaf90d2 | 762 | ftlMacroList->GetSelectedEntries(iterator); |
763 | fM->RemoveProcessMacros(iterator); | |
3f797131 | 764 | |
caaf90d2 | 765 | if (iterator != 0) delete iterator; |
3f797131 | 766 | |
caaf90d2 | 767 | iterator = new TList(); |
768 | ftlMacroSelList->GetSelectedEntries(iterator); | |
769 | fM->RemoveSelectionMacros(iterator); | |
2ef0687e | 770 | |
4f6473f6 | 771 | // Selected macros are deleted from the list -> No selected entries left |
772 | fM->fMacroListSelected = 0; | |
773 | fM->fMacroSelListSelected = 0; | |
774 | ||
2ef0687e | 775 | UpdateMacroList(); |
caaf90d2 | 776 | |
777 | if (iterator != 0) delete iterator; | |
778 | iterator = 0; | |
2ef0687e | 779 | } |
780 | ||
bcb45225 | 781 | //______________________________________________________ |
782 | void AliEveTRDTrackListEditor::SetDrawingToHistoCanvasTab() | |
783 | { | |
16db6074 | 784 | // Sets gPad to the tab with the name of the current AliEveTRDTrackList. If this tab does |
785 | // not exist, it will be created. Otherwise, it is re-used. | |
786 | ||
bcb45225 | 787 | // If the tab with the canvas has been closed, the canvas will be deleted. |
788 | // So, if there is no tab, set the canvas pointer to zero and recreate it in a new tab. | |
789 | if (fHistoCanvas != 0) | |
790 | { | |
791 | if (gEve->GetBrowser()->GetTab(1)->SetTab(fHistoCanvasName->GetString()) == 0) | |
792 | { | |
793 | fHistoCanvas = 0; | |
794 | } | |
795 | } | |
796 | ||
797 | if (!fHistoCanvas) | |
798 | { | |
799 | fHistoCanvas = gEve->AddCanvasTab(fM->GetName()); | |
800 | } | |
801 | ||
802 | gPad = fHistoCanvas; | |
803 | } | |
804 | ||
c04e790a | 805 | //______________________________________________________ |
2ef0687e | 806 | void AliEveTRDTrackListEditor::SetModel(TObject* obj) |
8e27fca1 | 807 | { |
16db6074 | 808 | // Sets the model object, updates the related data in the GUI and |
809 | // inherits settings (cf. Inherit*(...)), if the flag fInheritSettings is set to kTRUE. | |
810 | ||
2ef0687e | 811 | fM = dynamic_cast<AliEveTRDTrackList*>(obj); |
812 | ||
8bdeb570 | 813 | if (fM == 0) |
814 | { | |
8e27fca1 | 815 | Error("SetModel", "Parameter is zero pointer"); |
816 | return; | |
817 | } | |
818 | ||
8bdeb570 | 819 | // If macro list + track style shall be inherited from previously loaded track list, do so |
820 | if (fInheritSettings) | |
bcb45225 | 821 | { |
822 | InheritMacroList(); | |
8bdeb570 | 823 | InheritStyle(); |
824 | ||
825 | fInheritSettings = kFALSE; | |
bcb45225 | 826 | } |
ecbbe371 | 827 | |
8bdeb570 | 828 | // Select the correct styles |
ecbbe371 | 829 | Int_t b = 0; |
830 | UChar_t style = fM->GetSelectedTrackStyle(); | |
8bdeb570 | 831 | if (TESTBIT(style, AliEveTRDTrack::kSource)) b = 2; |
832 | else | |
833 | { | |
834 | if (TESTBIT(style, AliEveTRDTrack::kPID)) b = 1; | |
ecbbe371 | 835 | else b = 0; |
836 | } | |
837 | fbgStyleColor->SetButton(b, kTRUE); | |
838 | ||
839 | ||
8bdeb570 | 840 | if (TESTBIT(style, AliEveTRDTrack::kTrackCosmics)) b = 2; |
841 | else | |
842 | { | |
843 | if (TESTBIT(style, AliEveTRDTrack::kTrackModel)) b = 1; | |
ecbbe371 | 844 | else b = 0; |
845 | } | |
846 | fbgStyleTrack->SetButton(b, kTRUE); | |
bcb45225 | 847 | |
2ef0687e | 848 | UpdateMacroList(); |
8e27fca1 | 849 | UpdateHistoList(); |
850 | ||
4f6473f6 | 851 | // View correct tab |
ecbbe371 | 852 | GetGedEditor()->GetTab()->SetTab(fM->GetSelectedTab()); |
4f6473f6 | 853 | } |
854 | ||
4cbab605 | 855 | //______________________________________________________ |
8bdeb570 | 856 | void AliEveTRDTrackListEditor::SetTrackColor(Int_t ind) |
4cbab605 | 857 | { |
16db6074 | 858 | // Sets the color model for the tracks, updates the tracks with this model and |
859 | // redraws the scene. | |
860 | ||
8bdeb570 | 861 | switch(ind) |
862 | { | |
2f9b41fd | 863 | case AliTRDReconstructor::kLQPID: |
864 | fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDReconstructor::kLQPID); | |
865 | break; | |
866 | case AliTRDReconstructor::kNNPID: | |
867 | fM->UpdateTrackStyle(AliEveTRDTrack::kPID, AliTRDReconstructor::kNNPID); | |
868 | break; | |
869 | default: | |
870 | fM->UpdateTrackStyle(AliEveTRDTrack::kSource); | |
871 | break; | |
ecbbe371 | 872 | } |
8bdeb570 | 873 | |
ecbbe371 | 874 | gEve->Redraw3D(); |
4cbab605 | 875 | } |
876 | ||
877 | //______________________________________________________ | |
8bdeb570 | 878 | void AliEveTRDTrackListEditor::SetTrackModel(Int_t ind) |
4cbab605 | 879 | { |
16db6074 | 880 | // Sets the track model for the tracks, updates the tracks with this model and |
881 | // redraws the scene. | |
882 | ||
8bdeb570 | 883 | switch(ind) |
884 | { | |
2f9b41fd | 885 | case AliEveTRDTrack::kRieman: |
886 | fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kRieman); | |
887 | break; | |
888 | case AliEveTRDTrack::kKalman: | |
889 | fM->UpdateTrackStyle(AliEveTRDTrack::kTrackModel, AliEveTRDTrack::kKalman); | |
890 | break; | |
891 | default: | |
892 | fM->UpdateTrackStyle(AliEveTRDTrack::kTrackCosmics); | |
893 | break; | |
ecbbe371 | 894 | } |
8bdeb570 | 895 | |
ecbbe371 | 896 | gEve->Redraw3D(); |
4cbab605 | 897 | } |
898 | ||
4f6473f6 | 899 | //______________________________________________________ |
900 | void AliEveTRDTrackListEditor::UpdateDataFromMacroListSelection() | |
901 | { | |
16db6074 | 902 | // Saves the current selection in the "Histograms"-tab to the current |
903 | // AliEveTRDTrackList. This means that the selection is updated and won't | |
904 | // get lost, if another editor is loaded in Eve. | |
905 | ||
4f6473f6 | 906 | for (Int_t i = 0; i < fM->fDataFromMacroList->GetEntries(); i++) |
8e27fca1 | 907 | { |
4f6473f6 | 908 | fM->SetHistoDataSelection(i, fCheckButtons[i]->IsOn()); |
8e27fca1 | 909 | } |
caaf90d2 | 910 | } |
911 | ||
ecbbe371 | 912 | //______________________________________________________ |
913 | void AliEveTRDTrackListEditor::UpdateHistoCanvasTab() | |
914 | { | |
16db6074 | 915 | // Updates the histogram and the corresponding tab (including titles). |
916 | ||
ecbbe371 | 917 | // Update name of the tab (tab has been set to current tab!) |
918 | fHistoCanvasName->SetString(fM->GetName()); | |
919 | ||
920 | // Use a copy of fHistoCanvasName!! -> If the user closes a tab manually, the TGString | |
921 | // will be deleted -> Error might occur, when accessing the pointer | |
922 | gEve->GetBrowser()->GetTab(1)->GetCurrentTab()->SetText(new TGString(fHistoCanvasName)); | |
923 | ||
924 | // Switch tabs to force redrawing | |
925 | gEve->GetBrowser()->GetTab(1)->SetTab(0); | |
926 | gEve->GetBrowser()->GetTab(1)->SetTab(fHistoCanvasName->GetString()); | |
927 | fHistoCanvas->Update(); | |
928 | } | |
929 | ||
c04e790a | 930 | //______________________________________________________ |
caaf90d2 | 931 | void AliEveTRDTrackListEditor::UpdateHistoList() |
932 | { | |
16db6074 | 933 | // Reloads (updates) the buttons in the "Histograms"-tab via |
934 | // the current AliEveTRDTrackList (data). | |
935 | ||
4f6473f6 | 936 | fHistoSubFrame->TGCompositeFrame::Cleanup(); |
caaf90d2 | 937 | |
938 | // Set buttons for histograms | |
939 | if (fCheckButtons != 0) delete fCheckButtons; | |
940 | fCheckButtons = new TGCheckButton*[fM->fDataFromMacroList->GetEntries()]; | |
941 | ||
942 | TObjString* iter = (TObjString*)fM->fDataFromMacroList->First(); | |
943 | for (Int_t i = 0; i < fM->fDataFromMacroList->GetEntries() && iter != 0; i++) | |
944 | { | |
945 | fCheckButtons[i] = new TGCheckButton(fHistoSubFrame, iter->GetName()); | |
946 | fHistoSubFrame->AddFrame(fCheckButtons[i]); | |
947 | ||
948 | fCheckButtons[i]->SetState(kButtonUp, kFALSE); | |
949 | fCheckButtons[i]->MapRaised(); | |
4f6473f6 | 950 | fCheckButtons[i]->SetOn(fM->HistoDataIsSelected(i)); |
951 | fCheckButtons[i]->Connect("Clicked()", "AliEveTRDTrackListEditor", this, "UpdateDataFromMacroListSelection()"); | |
caaf90d2 | 952 | |
953 | iter = (TObjString*)fM->fDataFromMacroList->After(iter); | |
954 | } | |
2ef0687e | 955 | } |
956 | ||
c04e790a | 957 | //______________________________________________________ |
2ef0687e | 958 | void AliEveTRDTrackListEditor::UpdateMacroList() |
959 | { | |
16db6074 | 960 | // Reloads (updates) the macro list (selection AND process macros) via |
961 | // the current AliEveTRDTrackList (data). | |
962 | ||
caaf90d2 | 963 | ftlMacroList->RemoveAll(); |
2ef0687e | 964 | |
caaf90d2 | 965 | TObjString* iter = (TObjString*)fM->fMacroList->First(); |
2ef0687e | 966 | |
4f6473f6 | 967 | Int_t ind = 0; |
2ef0687e | 968 | while (iter != 0) |
969 | { | |
4f6473f6 | 970 | ftlMacroList->AddEntry(iter->GetName(), ind++); |
caaf90d2 | 971 | iter = (TObjString*)fM->fMacroList->After(iter); |
2ef0687e | 972 | } |
973 | ||
caaf90d2 | 974 | ftlMacroList->SortByName(); |
3f797131 | 975 | |
4f6473f6 | 976 | // Select, what has been selected before |
977 | for (Int_t i = 0; i < fM->fMacroList->GetEntries(); i++) | |
978 | { | |
979 | ftlMacroList->Select(i, fM->MacroListIsSelected(i)); | |
980 | } | |
981 | ||
982 | ||
3f797131 | 983 | |
caaf90d2 | 984 | ftlMacroSelList->RemoveAll(); |
3f797131 | 985 | |
caaf90d2 | 986 | iter = (TObjString*)fM->fMacroSelList->First(); |
3f797131 | 987 | |
4f6473f6 | 988 | ind = 0; |
3f797131 | 989 | while (iter != 0) |
990 | { | |
4f6473f6 | 991 | ftlMacroSelList->AddEntry(iter->GetName(), ind++); |
caaf90d2 | 992 | iter = (TObjString*)fM->fMacroSelList->After(iter); |
3f797131 | 993 | } |
994 | ||
caaf90d2 | 995 | ftlMacroSelList->SortByName(); |
4f6473f6 | 996 | |
997 | // Select, what has been selected before | |
998 | for (Int_t i = 0; i < fM->fMacroSelList->GetEntries(); i++) | |
999 | { | |
1000 | ftlMacroSelList->Select(i, fM->MacroSelListIsSelected(i)); | |
1001 | } | |
1002 | } | |
1003 | ||
1004 | //______________________________________________________ | |
1005 | void AliEveTRDTrackListEditor::UpdateMacroListSelection(Int_t ind) | |
1006 | { | |
16db6074 | 1007 | // Saves the current selection in the process macro list to the current |
1008 | // AliEveTRDTrackList. This means that the selection is updated and won't | |
1009 | // get lost, if another editor is loaded in Eve. | |
1010 | ||
4f6473f6 | 1011 | // Toggle selected item |
1012 | fM->SetMacroListSelection(ind, !fM->MacroListIsSelected(ind)); | |
1013 | } | |
1014 | ||
1015 | //______________________________________________________ | |
1016 | void AliEveTRDTrackListEditor::UpdateMacroSelListSelection(Int_t ind) | |
1017 | { | |
16db6074 | 1018 | // Saves the current selection in the selection macro list to the current |
1019 | // AliEveTRDTrackList. This means that the selection is updated and won't | |
1020 | // get lost, if another editor is loaded in Eve. | |
1021 | ||
4f6473f6 | 1022 | // Toggle selected item |
1023 | fM->SetMacroSelListSelection(ind, !fM->MacroSelListIsSelected(ind)); | |
2ef0687e | 1024 | } |