1 // Uncomment to display debugging infos
2 //#define ALIEVETRDTRACKLIST_DEBUG
4 #include "AliEveTRDTrackList.h"
6 #include <AliTRDReconstructor.h>
12 #include <TObjString.h>
16 #include <TTreeStream.h>
18 ClassImp(AliEveTRDTrackList)
20 ///////////////////////////////////////////////////////////
21 ///////////// AliEveTRDTrackList ////////////////////////
22 ///////////////////////////////////////////////////////////
23 AliEveTRDTrackList::AliEveTRDTrackList(const Text_t* n, const Text_t* t, Bool_t doColor):
24 TEveElementList(n, t, doColor),
27 fDataFromMacroList(0),
30 fHistoDataSelected(0),
31 fMacroListSelected(0),
32 fMacroSelListSelected(0),
33 fSelectedTab(1), // Standard tab: "Apply macros" (index 1)
36 // Only accept childs of type AliEveTRDTrack
37 SetChildClass(AliEveTRDTrack::Class());
39 // Allocate memory for the lists and declare them as owners of their contents
40 fMacroList = new TList();
41 fMacroList->TCollection::SetOwner(kTRUE);
42 fMacroSelList = new TList();
43 fMacroSelList->TCollection::SetOwner(kTRUE);
44 fDataFromMacroList = new TList();
45 fDataFromMacroList->TCollection::SetOwner(kTRUE);
47 fMacroTypes = new TMap();
48 // Set map to owner of it's objects to delete them, if they are removed from the map
49 fMacroTypes->SetOwnerKeyValue(kTRUE, kTRUE);
51 // Set the build directory for AClic
52 gSystem->SetBuildDir("$HOME/.trdQArec");
57 //______________________________________________________
58 AliEveTRDTrackList::~AliEveTRDTrackList()
66 if (fMacroSelList != 0)
68 fMacroSelList->Delete();
72 if (fDataFromMacroList != 0)
74 fDataFromMacroList->Delete();
75 delete fDataFromMacroList;
76 fDataFromMacroList = 0;
85 fMacroTypes->DeleteAll();
89 // Note: gSystem->AccessPathName(...) returns kTRUE, if the access FAILED!
90 if(!gSystem->AccessPathName(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER"))))
91 gSystem->Exec(Form("rm /tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER")));
94 //______________________________________________________
95 Int_t AliEveTRDTrackList::AddMacro(const Char_t* path, const Char_t* nameC, Bool_t forceReload)
97 // First check the type of the macro:
98 // If it has the signature of a selection macro:
99 // Bool_t MacroName(AliTRDtrackV1*)
100 // it is assumed to be a selection macro.
101 // If it has the signature of a process macro:
102 // void MacroName(AliTRDtrackV1*, Double_t*&, Int_t&)
103 // it is assumed to be a process macro.
104 // In all other cases: Macro is rejected
106 Char_t* entryName = MakeMacroEntry(path, nameC);
108 Char_t pathname[fkMaxMacroPathNameLength];
109 memset(pathname, '\0', sizeof(Char_t) * fkMaxMacroPathNameLength);
111 // Expand the path and create the pathname
112 Char_t* systemPath = gSystem->ExpandPathName(path);
113 sprintf(pathname, "%s/%s", systemPath, nameC);
117 // Delete ".C" from filename
118 Char_t name[fkMaxMacroNameLength];
119 memset(name, '\0', sizeof(Char_t) * fkMaxMacroNameLength);
121 for (UInt_t ind = 0; ind < fkMaxMacroNameLength && ind < strlen(nameC) - 2; ind++) name[ind] = nameC[ind];
123 // Check, if files exists
126 fp = fopen(pathname, "rb");
134 if (entryName != 0) delete entryName;
137 return NOT_EXIST_ERROR;
140 // Clean up root, load the desired macro and then check the type of the macro
143 if (forceReload) gROOT->ProcessLineSync(Form(".L %s++", pathname));
144 else gROOT->ProcessLineSync(Form(".L %s+", pathname));
146 AliEveTRDTrackListMacroType type = GetMacroType(entryName, kFALSE);
151 // Has not the correct signature!
152 if (type == kUnknown)
154 if (entryName != 0) delete entryName;
156 return SIGNATURE_ERROR;
159 Int_t returnValue = WARNING;
161 // Only add macro, if it is not already in the list
162 if ((type == kSingleTrackAnalyse || type == kSingleTrackHisto
163 || type == kCorrelTrackAnalyse || type == kCorrelTrackHisto) && fMacroList->FindObject(entryName) == 0)
165 fMacroList->Add(new TObjString(entryName));
168 fMacroTypes->Add(new TObjString(entryName), new TObjString(Form("%d", type)));
170 // We do not know, where the element has been inserted - deselect this list
171 fMacroListSelected = 0;
173 returnValue = SUCCESS;
175 else if ((type == kSingleTrackSelect || type == kCorrelTrackSelect) && fMacroSelList->FindObject(entryName) == 0)
177 fMacroSelList->Add(new TObjString(entryName));
178 fMacroSelList->Sort();
180 fMacroTypes->Add(new TObjString(entryName), new TObjString(Form("%d", type)));
182 // We do not know, where the element has been inserted - deselect this list
183 fMacroSelListSelected = 0;
185 returnValue = SUCCESS;
187 else returnValue = WARNING;
189 if (entryName != 0) delete entryName;
195 //______________________________________________________
196 void AliEveTRDTrackList::AddMacroFast(const Char_t* entry, AliEveTRDTrackListMacroType type)
200 case kSingleTrackSelect:
201 case kCorrelTrackSelect:
202 fMacroSelList->Add(new TObjString(entry));
203 fMacroSelList->Sort();
205 fMacroTypes->Add(new TObjString(entry), new TObjString(Form("%d", type)));
207 // We do not know, where the element has been inserted - deselect this list
208 fMacroSelListSelected = 0;
211 case kSingleTrackAnalyse:
212 case kSingleTrackHisto:
213 case kCorrelTrackAnalyse:
214 case kCorrelTrackHisto:
215 fMacroList->Add(new TObjString(entry));
218 fMacroTypes->Add(new TObjString(entry), new TObjString(Form("%d", type)));
220 // We do not know, where the element has been inserted - deselect this list
221 fMacroListSelected = 0;
224 Error("AliEveTRDTrackList::AddMacroFast", Form("Unknown macro type for entry \"%s\"!", entry));
229 //______________________________________________________
230 void AliEveTRDTrackList::AddMacroFast(const Char_t* path, const Char_t* name, AliEveTRDTrackListMacroType type)
232 Char_t* entry = MakeMacroEntry(path, name);
235 AddMacroFast(entry, type);
237 #ifdef ALIEVETRDTRACKLIST_DEBUG
238 // Successfull add will only be displayed in debug mode
239 printf("#AliEveTRDTrackList::AddMacroFast: Added macro \"%s/%s\" to the corresponding list\n", path, name);
247 // Error will always be displayed
248 printf("#AliEveTRDTrackList::AddMacroFast: ERROR: Could not add macro \"%s/%s\" to the corresponding list\n",
253 //______________________________________________________
254 void AliEveTRDTrackList::AddStandardMacros()
256 // Add your standard macros here, e.g.:
257 // To add a macro use:
258 // AddMacro("$(ALICE_ROOT)/myFolder", "myMacroName.C");
259 // -> If the file does not exist, nothing happens. So if you want to handle this,
260 // use the return value of AddMacro (NOT_EXIST_ERROR is returned, if file does not exist)
261 // (-> You can also check for other return values (see AddMacro(...)))
262 AddMacro("$(ALICE_ROOT)/TRD/qaRec/macros", "clusterSelection.C");
263 AddMacro("$(ALICE_ROOT)/TRD/qaRec/macros", "chargeDistr.C");
264 AddMacro("$(ALICE_ROOT)/TRD/qaRec/macros", "clusterResiduals.C");
265 AddMacro("$(ALICE_ROOT)/TRD/qaRec/macros", "PH.C");
268 //______________________________________________________
269 Bool_t AliEveTRDTrackList::ApplyProcessMacros(TList* iterator)
271 // No process macros need to be processed
272 if (iterator->GetEntries() <= 0) return kTRUE;
277 // Clear old data and re-allocate
278 if (fDataTree == 0) fDataTree = new TTreeSRedirector(Form("/tmp/TRD.TrackListMacroData_%s.root",
279 gSystem->Getenv("USER")));
282 Error("Apply process macros", Form("File \"/tmp/TRD.TrackListMacroData_%s.root\" could not be accessed properly!",
283 gSystem->Getenv("USER")));
287 if (fDataFromMacroList != 0)
289 fDataFromMacroList->Delete();
290 delete fDataFromMacroList;
292 fDataFromMacroList = new TList();
293 fDataFromMacroList->TCollection::SetOwner(kTRUE);
295 fHistoDataSelected = 0;
298 Char_t name[fkMaxMacroNameLength];
299 Char_t** cmds = new Char_t*[iterator->GetEntries()];
300 AliEveTRDTrackListMacroType* mType = new AliEveTRDTrackListMacroType[iterator->GetEntries()];
302 AliEveTRDTrackListMacroType macroType = kUnknown;
303 Int_t numHistoMacros = 0;
306 AliEveTRDTrack* track1 = 0;
307 AliEveTRDTrack* track2 = 0;
308 TH1* returnedHist = 0x0;
310 // Collect the commands for each macro and add them to "data-from-list"
311 for (Int_t i = 0; i < iterator->GetEntries(); i++)
313 memset(name, '\0', sizeof(Char_t) * fkMaxMacroNameLength);
315 cmds[i] = new Char_t[(fkMaxMacroPathNameLength + fkMaxApplyCommandLength)];
316 memset(cmds[i], '\0', sizeof(Char_t) * (fkMaxMacroNameLength + fkMaxApplyCommandLength));
318 #ifdef ALIEVETRDTRACKLIST_DEBUG
319 printf("AliEveTRDTrackList: Applying process macro: %s\n", iterator->At(i)->GetTitle());
323 sscanf(iterator->At(i)->GetTitle(), "%s (Path: %*s)", name);
325 // Delete ".C" at the end
326 // -> Note: Physical address pointer, do NOT delete. / Changes "name" as well!
327 Char_t* dotC = (Char_t*)strrchr(name, '.');
335 // Find the type of the process macro
336 macroType = GetMacroType(iterator->At(i)->GetTitle(), kTRUE);
337 if (macroType == kSingleTrackHisto)
339 mType[i] = macroType;
341 // Create the command
342 sprintf(cmds[i], "%s(automaticTrackV1_1);", name);
344 // Add to "data-from-list" -> Mark as a histo macro with the substring "(histo macro)"
345 fDataFromMacroList->Add(new TObjString(Form("%s (histo macro)", name)));
347 else if (macroType == kSingleTrackAnalyse)
349 mType[i] = macroType;
350 // Create the command
351 sprintf(cmds[i], "%s(automaticTrackV1_1, results, n);", name);
353 // Add to "data-from-list"
354 fDataFromMacroList->Add(new TObjString(name));
356 else if (macroType == kCorrelTrackHisto)
358 mType[i] = macroType;
360 // Create the command
361 sprintf(cmds[i], "%s(automaticTrackV1_1, automaticTrackV1_2);", name);
363 // Add to "data-from-list" -> Mark as a histo macro with the substring "(histo macro)"
364 fDataFromMacroList->Add(new TObjString(Form("%s (histo macro)", name)));
366 else if (macroType == kCorrelTrackAnalyse)
368 mType[i] = macroType;
369 // Create the command
370 sprintf(cmds[i], "%s(automaticTrackV1_1, automaticTrackV1_2, results, n);", name);
372 // Add to "data-from-list"
373 fDataFromMacroList->Add(new TObjString(name));
377 Error("Apply process macros",
378 Form("Process macro list corrupted: Macro \"%s\" is not registered as a process macro!", name));
383 // Allocate memory for the histograms
384 if (numHistoMacros > 0) histos = new TH1*[numHistoMacros];
385 for (Int_t i = 0; i < numHistoMacros; i++) histos[i] = 0;
387 // Walk through the list of tracks
388 for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
390 track1 = dynamic_cast<AliEveTRDTrack*>(*iter);
392 if (!track1) continue;
394 // Skip tracks that have not been selected
395 if (!track1->GetRnrState()) continue;
397 track1->ExportToCINT((Text_t*)"automaticTrack");
398 // Cast to AliTRDtrackV1
399 gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_1 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
401 // Collect data for each macro
402 for (Int_t i = 0, histoIndex = 0; i < iterator->GetEntries(); i++)
404 // Single track histo
405 if (mType[i] == kSingleTrackHisto)
407 returnedHist = (TH1*)gROOT->ProcessLineSync(cmds[i]);
408 if (returnedHist != 0x0)
410 if (histos[histoIndex] == 0) histos[histoIndex] = (TH1*)gROOT->ProcessLineSync(cmds[i]);
411 else histos[histoIndex]->Add((const TH1*)gROOT->ProcessLineSync(cmds[i]));
418 // Correlated tracks histo
419 else if (mType[i] == kCorrelTrackHisto)
421 // Loop over all pairs behind the current one - together with the other loop this will be a loop
422 // over all pairs. We have a pair of tracks, if and only if both tracks of the pair are selected (Rnr-state)
423 // and are not equal.
424 TEveElement::List_i iter2 = iter;
426 for ( ; iter2 != this->EndChildren(); ++iter2)
428 track2 = dynamic_cast<AliEveTRDTrack*>(*iter2);
430 if (!track2) continue;
432 // Skip tracks that have not been selected
433 if (!track2->GetRnrState()) continue;
435 track2->ExportToCINT((Text_t*)"automaticTrack");
436 // Cast to AliTRDtrackV1
437 gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_2 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
439 returnedHist = (TH1*)gROOT->ProcessLineSync(cmds[i]);
440 if (returnedHist != 0x0)
442 if (histos[histoIndex] == 0) histos[histoIndex] = (TH1*)gROOT->ProcessLineSync(cmds[i]);
443 else histos[histoIndex]->Add((const TH1*)gROOT->ProcessLineSync(cmds[i]));
451 // Single track analyse
452 else if (mType[i] == kSingleTrackAnalyse)
454 // Create data pointers in CINT, execute the macro and get the data
455 gROOT->ProcessLineSync("Double_t* results = 0;");
456 gROOT->ProcessLineSync("Int_t n = 0;");
457 gROOT->ProcessLineSync(cmds[i]);
458 Double_t* results = (Double_t*)gROOT->ProcessLineSync("results;");
459 Int_t nResults = (Int_t)gROOT->ProcessLineSync("n;");
463 Error("Apply macros", Form("Error reading data from macro \"%s\"", iterator->At(i)->GetTitle()));
466 for (Int_t resInd = 0; resInd < nResults; resInd++)
468 (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << results[resInd] << (Char_t*)"\n";
474 // Correlated tracks analyse
475 else if (mType[i] == kCorrelTrackAnalyse)
477 // Loop over all pairs behind the current one - together with the other loop this will be a loop
478 // over all pairs. We have a pair of tracks, if and only if both tracks of the pair are selected (Rnr-state)
479 // and are not equal.
480 TEveElement::List_i iter2 = iter;
482 for ( ; iter2 != this->EndChildren(); ++iter2)
484 track2 = dynamic_cast<AliEveTRDTrack*>(*iter2);
486 if (!track2) continue;
488 // Skip tracks that have not been selected
489 if (!track2->GetRnrState()) continue;
491 track2->ExportToCINT((Text_t*)"automaticTrack");
492 // Cast to AliTRDtrackV1
493 gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_2 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
495 // Create data pointers in CINT, execute the macro and get the data
496 gROOT->ProcessLineSync("Double_t* results = 0;");
497 gROOT->ProcessLineSync("Int_t n = 0;");
498 gROOT->ProcessLineSync(cmds[i]);
499 Double_t* results = (Double_t*)gROOT->ProcessLineSync("results;");
500 Int_t nResults = (Int_t)gROOT->ProcessLineSync("n;");
504 Error("Apply macros", Form("Error reading data from macro \"%s\"", iterator->At(i)->GetTitle()));
507 for (Int_t resInd = 0; resInd < nResults; resInd++)
509 (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << results[resInd] << (Char_t*)"\n";
519 for (Int_t i = 0, histoIndex = 0; i < iterator->GetEntries() && histoIndex < numHistoMacros; i++)
521 if (mType[i] == kSingleTrackHisto || mType[i] == kCorrelTrackHisto)
523 // Might be empty (e.g. no tracks have been selected)!
524 if (histos[histoIndex] != 0)
526 (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << histos[histoIndex] << (Char_t*)"\n";
532 if (fDataTree != 0) delete fDataTree;
535 if (cmds != 0) delete [] cmds;
536 if (mType != 0) delete mType;
539 if (histos != 0) delete [] histos;
545 // If there is data, select the first data set
546 if (iterator->GetEntries() > 0) SETBIT(fHistoDataSelected, 0);
548 // Now the data is stored in "/tmp/TRD.TrackListMacroData_$USER.root"
549 // The editor will access this file to display the data
553 //______________________________________________________
554 void AliEveTRDTrackList::ApplySelectionMacros(TList* iterator)
556 Char_t name[fkMaxMacroNameLength];
557 Char_t cmd[(fkMaxMacroNameLength + fkMaxApplyCommandLength)];
559 AliEveTRDTrackListMacroType macroType = kUnknown;
560 AliEveTRDTrack* track1 = 0;
561 AliEveTRDTrack* track2 = 0;
562 Bool_t selectedByMacro = kFALSE;
567 // Select all tracks at first. A track is then deselect, if at least one selection macro
568 // returns kFALSE for this track
569 // Enable all tracks (Note: EnableListElements(..) will call "ElementChanged", which will cause unforeseen behavior!)
570 for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
572 ((TEveElement*)(*iter))->SetRnrState(kTRUE);
576 for (Int_t i = 0; i < iterator->GetEntries(); i++)
579 memset(name, '\0', sizeof(Char_t) * fkMaxMacroNameLength);
580 memset(cmd, '\0', sizeof(Char_t) * (fkMaxMacroNameLength + fkMaxApplyCommandLength));
582 #ifdef ALIEVETRDTRACKLIST_DEBUG
583 printf("AliEveTRDTrackList: Applying selection macro: %s\n", iterator->At(i)->GetTitle());
587 sscanf(iterator->At(i)->GetTitle(), "%s (Path: %*s)", name);
588 // Delete ".C" at the end
589 // -> Note: Physical address pointer, do NOT delete. / Changes "name" as well!
590 Char_t* dotC = (Char_t*)strrchr(name, '.');
598 // Determine macro type
599 macroType = GetMacroType(iterator->At(i)->GetTitle(), kTRUE);
601 // Single track select macro
602 if (macroType == kSingleTrackSelect)
604 // Create the command
605 sprintf(cmd, "%s(automaticTrackV1);", name);
607 // Walk through the list of tracks
608 for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
610 track1 = dynamic_cast<AliEveTRDTrack*>(*iter);
612 if (!track1) continue;
614 // If the track has already been deselected, nothing is to do here
615 if (!track1->GetRnrState()) continue;
617 track1->ExportToCINT((Text_t*)"automaticTrack");
618 // Cast to AliTRDtrackV1
619 gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
620 selectedByMacro = (Bool_t)gROOT->ProcessLineSync(cmd);
621 track1->SetRnrState(selectedByMacro && track1->GetRnrState());
624 // Correlated tracks select macro
625 else if (macroType == kCorrelTrackSelect)
627 // Create the command
628 sprintf(cmd, "%s(automaticTrackV1_1, automaticTrackV1_2);", name);
630 // Walk through the list of tracks and loop over all possible track pairs
631 for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
633 track1 = dynamic_cast<AliEveTRDTrack*>(*iter);
635 if (!track1) continue;
637 // If the track has already been deselected, nothing is to do here
638 if (!track1->GetRnrState()) continue;
640 track1->ExportToCINT((Text_t*)"automaticTrack");
641 // Cast to AliTRDtrackV1
642 gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_1 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
644 // Correlate the track with each other track (except for itself!)
645 for (TEveElement::List_i iter2 = this->BeginChildren() ; iter2 != this->EndChildren(); ++iter2)
647 // Do not correlate track with itself
648 if (iter == iter2) continue;
650 track2 = dynamic_cast<AliEveTRDTrack*>(*iter2);
652 if (!track2) continue;
654 track2->ExportToCINT((Text_t*)"automaticTrack");
655 // Cast to AliTRDtrackV1
656 gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_2 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
657 selectedByMacro = (Bool_t)gROOT->ProcessLineSync(cmd);
658 track1->SetRnrState(selectedByMacro && track1->GetRnrState());
660 // If track has not been selected by this call, it is switched off and we are done with this track
661 if (!selectedByMacro) break;
667 Error("Apply selection macros",
668 Form("Selection macro list corrupted: Macro \"%s\" is not registered as a selection macro!", name));
676 //______________________________________________________
677 AliEveTRDTrackList::AliEveTRDTrackListMacroType AliEveTRDTrackList::GetMacroType(const Char_t* entry, Bool_t UseList)
679 AliEveTRDTrackListMacroType type = kUnknown;
681 // Re do the check of the macro type
684 Char_t name[fkMaxMacroNameLength];
686 memset(name, '\0', sizeof(Char_t) * fkMaxMacroNameLength);
689 sscanf(entry, "%s (Path: %*s)", name);
691 // Delete ".C" at the end
692 // -> Note: Physical address pointer, do NOT delete. / Changes "name" as well!
693 Char_t* dotC = (Char_t*)strrchr(name, '.');
701 // Single track select macro or single track histo macro?
702 TFunction* f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*", kTRUE);
705 // Some additional check (is the parameter EXACTLY of the desired type?)
706 if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0)
708 // Single track select macro?
709 if (!strcmp(f->GetReturnTypeName(), "Bool_t"))
711 type = kSingleTrackSelect;
713 // single track histo macro?
714 else if (!strcmp(f->GetReturnTypeName(), "TH1*"))
716 type = kSingleTrackHisto;
720 // Single track analyse macro?
721 else if ((f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*, Double_t*&, Int_t&", kTRUE))
724 if (!strcmp(f->GetReturnTypeName(), "void"))
726 // Some additional check (are the parameters EXACTLY of the desired type?)
727 if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 &&
728 strstr(f->GetMangledName(), "cODouble_tmUaNsP") != 0x0 &&
729 strstr(f->GetMangledName(), "cOInt_taNsP") != 0x0)
731 type = kSingleTrackAnalyse;
735 // Correlated tracks select macro or correlated tracks histo macro?
736 else if ((f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*, const AliTRDtrackV1*", kTRUE))
739 // Some additional check (is the parameter EXACTLY of the desired type?)
740 if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 &&
741 strstr(f->GetMangledName(), "cOconstsPAliTRDtrackV1mUsP") != 0x0)
743 // Single track select macro?
744 if (!strcmp(f->GetReturnTypeName(), "Bool_t"))
746 type = kCorrelTrackSelect;
748 // single track histo macro?
749 else if (!strcmp(f->GetReturnTypeName(), "TH1*"))
751 type = kCorrelTrackHisto;
755 // Correlated tracks analyse macro?
756 else if ((f = gROOT->GetGlobalFunctionWithPrototype(name,
757 "const AliTRDtrackV1*, const AliTRDtrackV1*, Double_t*&, Int_t&", kTRUE))
760 if (!strcmp(f->GetReturnTypeName(), "void"))
762 // Some additional check (is the parameter EXACTLY of the desired type?)
763 if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 &&
764 strstr(f->GetMangledName(), "cOconstsPAliTRDtrackV1mUsP") != 0x0 &&
765 strstr(f->GetMangledName(), "cODouble_tmUaNsP") != 0x0 &&
766 strstr(f->GetMangledName(), "cOInt_taNsP") != 0x0)
768 type = kCorrelTrackAnalyse;
773 // Use list to look up the macro type
776 TObjString* objEntry = 0;
777 objEntry = (TObjString*)fMacroTypes->GetValue(entry);
778 if (objEntry == 0) return kUnknown;
780 type = (AliEveTRDTrackListMacroType)objEntry->GetString().Atoi();
783 case kSingleTrackSelect:
784 case kSingleTrackAnalyse:
785 case kSingleTrackHisto:
786 case kCorrelTrackSelect:
787 case kCorrelTrackAnalyse:
788 case kCorrelTrackHisto:
799 //______________________________________________________
800 Char_t* AliEveTRDTrackList::MakeMacroEntry(const Char_t* path, const Char_t* name)
802 Char_t* entry = new Char_t[(fkMaxMacroPathNameLength + 30)];
803 memset(entry, '\0', sizeof(Char_t) * (fkMaxMacroPathNameLength + 30));
805 Char_t* systemPath = gSystem->ExpandPathName(path);
806 sprintf(entry, "%s (Path: %s)", name, systemPath);
813 //______________________________________________________
814 void AliEveTRDTrackList::RemoveProcessMacros(TList* iterator)
817 for (Int_t i = 0; i < iterator->GetEntries(); i++)
819 // Key and value will be deleted, too, since fMacroTypes is the owner of them
820 fMacroTypes->DeleteEntry(fMacroTypes->FindObject(iterator->At(i)->GetTitle()));
822 obj = (TObjString*)fMacroList->Remove(fMacroList->FindObject(iterator->At(i)->GetTitle()));
823 if (obj != 0) delete obj;
828 //______________________________________________________
829 void AliEveTRDTrackList::RemoveSelectionMacros(TList* iterator)
832 for (Int_t i = 0; i < iterator->GetEntries(); i++)
834 // Key and value will be deleted, too, since fMacroTypes is the owner of them
835 fMacroTypes->DeleteEntry(fMacroTypes->FindObject(iterator->At(i)->GetTitle()));
837 obj = (TObjString*)fMacroSelList->Remove(fMacroSelList->FindObject(iterator->At(i)->GetTitle()));
838 if (obj != 0) delete obj;
843 //______________________________________________________
844 void AliEveTRDTrackList::UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s, UChar_t ss)
848 case AliEveTRDTrack::kSource:
849 SETBIT(fSelectedStyle, AliEveTRDTrack::kSource);
851 case AliEveTRDTrack::kPID:
852 CLRBIT(fSelectedStyle, AliEveTRDTrack::kSource);
855 case AliTRDReconstructor::kLQPID:
856 CLRBIT(fSelectedStyle, AliEveTRDTrack::kPID);
858 case AliTRDReconstructor::kNNPID:
859 SETBIT(fSelectedStyle, AliEveTRDTrack::kPID);
863 case AliEveTRDTrack::kTrackCosmics:
864 SETBIT(fSelectedStyle, AliEveTRDTrack::kTrackCosmics);
866 case AliEveTRDTrack::kTrackModel:
867 CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackCosmics);
870 case AliEveTRDTrack::kRieman:
871 CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel);
873 case AliEveTRDTrack::kKalman:
874 AliWarning("Kalman fit under testing for the moment.");
875 //SETBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel);
882 // Walk through the list of tracks
883 AliEveTRDTrack* track = 0x0;
884 for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
886 if (!(track = dynamic_cast<AliEveTRDTrack*>(*iter))) continue;
888 track->SetStatus(fSelectedStyle);